mirror of
https://github.com/servo/servo.git
synced 2025-10-01 00:59:15 +01:00
Register a glwindow test XR device
This commit is contained in:
parent
39ec04a065
commit
8e535857c2
3 changed files with 21 additions and 3 deletions
|
@ -59,7 +59,8 @@ log = "0.4"
|
|||
rust-webvr = { version = "0.13", features = ["glwindow"] }
|
||||
servo-media = {git = "https://github.com/servo/media"}
|
||||
tinyfiledialogs = "3.0"
|
||||
webxr = { git = "https://github.com/servo/webxr", features = ["glwindow"] }
|
||||
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
|
||||
webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "glwindow"] }
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies]
|
||||
image = "0.21"
|
||||
|
|
|
@ -71,4 +71,20 @@ impl EmbedderMethods for EmbedderCallbacks {
|
|||
// FIXME: support headless mode
|
||||
}
|
||||
}
|
||||
|
||||
fn register_webxr(&mut self, xr: &mut webxr_api::MainThreadRegistry) {
|
||||
if !opts::get().headless {
|
||||
if pref!(dom.webxr.test) {
|
||||
warn!("Creating test XR device");
|
||||
let gl = self.gl.clone();
|
||||
let events_loop_clone = self.events_loop.clone();
|
||||
let events_loop_factory = Box::new(move || {
|
||||
events_loop_clone.borrow_mut().take().ok_or(EventsLoopClosed)
|
||||
});
|
||||
let gl_version = app::gl_version();
|
||||
let discovery = webxr::glwindow::GlWindowDiscovery::new(gl, events_loop_factory, gl_version);
|
||||
xr.register(discovery);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue