Auto merge of #24018 - Manishearth:wherever-you-are, r=asajeffrey

Allow setting near/far clip planes

needs https://github.com/servo/webxr/pull/41

r? @asajeffrey

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24018)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-08-23 11:45:38 -04:00 committed by GitHub
commit f21d116069
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

5
Cargo.lock generated
View file

@ -5624,7 +5624,7 @@ dependencies = [
[[package]]
name = "webxr"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#17dcfc9dfd3b8b29caebe7cf022c1855d68920f1"
source = "git+https://github.com/servo/webxr#ee763bc2c579c72c1b1a0706e2876b1f1ddff34d"
dependencies = [
"bindgen 0.49.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -5633,6 +5633,7 @@ dependencies = [
"glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"openxr 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"webxr-api 0.0.1 (git+https://github.com/servo/webxr)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -5641,7 +5642,7 @@ dependencies = [
[[package]]
name = "webxr-api"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#17dcfc9dfd3b8b29caebe7cf022c1855d68920f1"
source = "git+https://github.com/servo/webxr#ee763bc2c579c72c1b1a0706e2876b1f1ddff34d"
dependencies = [
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -175,7 +175,7 @@ impl XRSession {
}
/// https://immersive-web.github.io/webxr/#xr-animation-frame
fn raf_callback(&self, (time, frame): (f64, Frame)) {
fn raf_callback(&self, (time, mut frame): (f64, Frame)) {
// Step 1
if let Some(pending) = self.pending_render_state.take() {
// https://immersive-web.github.io/webxr/#apply-the-pending-render-state
@ -200,6 +200,10 @@ impl XRSession {
}
}
for event in frame.events.drain(..) {
self.session.borrow_mut().apply_event(event)
}
// Step 2
let base_layer = match self.active_render_state.get().GetBaseLayer() {
Some(layer) => layer,
@ -279,6 +283,12 @@ impl XRSessionMethods for XRSession {
if let Some(ref layer) = init.baseLayer {
pending.set_layer(Some(&layer))
}
if init.depthFar.is_some() || init.depthNear.is_some() {
self.session
.borrow_mut()
.update_clip_planes(*pending.DepthNear() as f32, *pending.DepthFar() as f32);
}
// XXXManishearth handle inlineVerticalFieldOfView
Ok(())
}