Skip to content

Commit

Permalink
Register a glwindow test XR device
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Jeffrey committed Jul 6, 2019
1 parent 39ec04a commit 8e53585
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ports/glutin/Cargo.toml
Expand Up @@ -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"
Expand Down
16 changes: 16 additions & 0 deletions ports/glutin/embedder.rs
Expand Up @@ -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);
}
}
}
}

0 comments on commit 8e53585

Please sign in to comment.