Skip to content
Permalink
Browse files

Allow setting near/far clip planes

  • Loading branch information...
Manishearth committed Aug 20, 2019
1 parent 17f4237 commit 0d79b2beafd02376107b96531511a5f72aace97f
Showing with 14 additions and 3 deletions.
  1. +3 −2 Cargo.lock
  2. +11 −1 components/script/dom/xrsession.rs

Some generated files are not rendered by default. Learn more.

@@ -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(())
}

0 comments on commit 0d79b2b

Please sign in to comment.
You can’t perform that action at this time.