Skip to content

Commit

Permalink
Allow setting near/far clip planes
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Aug 23, 2019
1 parent 17f4237 commit 0d79b2b
Show file tree
Hide file tree
Showing 2 changed files with 14 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.

12 changes: 11 additions & 1 deletion components/script/dom/xrsession.rs
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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(())
}
Expand Down

0 comments on commit 0d79b2b

Please sign in to comment.