mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
WebVR API Implementation, r=larsbergstrom
This commit is contained in:
parent
13826970c4
commit
c5705bff50
70 changed files with 13044 additions and 20 deletions
|
@ -54,6 +54,8 @@ servo_config = {path = "../config"}
|
|||
servo_url = {path = "../url"}
|
||||
style = {path = "../style", features = ["servo"]}
|
||||
url = "1.2"
|
||||
webvr = {path = "../webvr"}
|
||||
webvr_traits = {path = "../webvr_traits"}
|
||||
webdriver_server = {path = "../webdriver_server", optional = true}
|
||||
|
||||
[dependencies.webrender]
|
||||
|
|
|
@ -48,6 +48,8 @@ pub extern crate script_layout_interface;
|
|||
pub extern crate servo_config;
|
||||
pub extern crate servo_url;
|
||||
pub extern crate style;
|
||||
pub extern crate webvr;
|
||||
pub extern crate webvr_traits;
|
||||
|
||||
#[cfg(feature = "webdriver")]
|
||||
extern crate webdriver_server;
|
||||
|
@ -96,6 +98,7 @@ use std::cmp::max;
|
|||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::Sender;
|
||||
use webvr::{WebVRThread, WebVRCompositorHandler};
|
||||
|
||||
pub use gleam::gl;
|
||||
pub use servo_config as config;
|
||||
|
@ -193,6 +196,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
|
|||
debugger_chan,
|
||||
devtools_chan,
|
||||
supports_clipboard,
|
||||
&webrender,
|
||||
webrender_api_sender.clone());
|
||||
|
||||
// Send the constellation's swmanager sender to service worker manager thread
|
||||
|
@ -260,6 +264,7 @@ fn create_constellation(user_agent: Cow<'static, str>,
|
|||
debugger_chan: Option<debugger::Sender>,
|
||||
devtools_chan: Option<Sender<devtools_traits::DevtoolsControlMsg>>,
|
||||
supports_clipboard: bool,
|
||||
webrender: &webrender::Renderer,
|
||||
webrender_api_sender: webrender_traits::RenderApiSender)
|
||||
-> (Sender<ConstellationMsg>, SWManagerSenders) {
|
||||
let bluetooth_thread: IpcSender<BluetoothRequest> = BluetoothThreadFactory::new();
|
||||
|
@ -295,6 +300,16 @@ fn create_constellation(user_agent: Cow<'static, str>,
|
|||
layout_thread::LayoutThread,
|
||||
script::script_thread::ScriptThread>::start(initial_state);
|
||||
|
||||
if PREFS.is_webvr_enabled() {
|
||||
// WebVR initialization
|
||||
let (mut handler, sender) = WebVRCompositorHandler::new();
|
||||
let webvr_thread = WebVRThread::spawn(constellation_chan.clone(), sender);
|
||||
handler.set_webvr_thread_sender(webvr_thread.clone());
|
||||
|
||||
webrender.set_vr_compositor_handler(handler);
|
||||
constellation_chan.send(ConstellationMsg::SetWebVRThread(webvr_thread)).unwrap();
|
||||
}
|
||||
|
||||
if let Some(url) = url {
|
||||
constellation_chan.send(ConstellationMsg::InitLoadUrl(url)).unwrap();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue