mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Allow setting near/far clip planes
This commit is contained in:
parent
17f423723c
commit
0d79b2beaf
2 changed files with 14 additions and 3 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -5608,7 +5608,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webxr"
|
name = "webxr"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/webxr#17dcfc9dfd3b8b29caebe7cf022c1855d68920f1"
|
source = "git+https://github.com/servo/webxr#ee763bc2c579c72c1b1a0706e2876b1f1ddff34d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen 0.49.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -5617,6 +5617,7 @@ dependencies = [
|
||||||
"glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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)",
|
"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)",
|
"webxr-api 0.0.1 (git+https://github.com/servo/webxr)",
|
||||||
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -5625,7 +5626,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webxr-api"
|
name = "webxr-api"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/webxr#17dcfc9dfd3b8b29caebe7cf022c1855d68920f1"
|
source = "git+https://github.com/servo/webxr#ee763bc2c579c72c1b1a0706e2876b1f1ddff34d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -175,7 +175,7 @@ impl XRSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://immersive-web.github.io/webxr/#xr-animation-frame
|
/// 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
|
// Step 1
|
||||||
if let Some(pending) = self.pending_render_state.take() {
|
if let Some(pending) = self.pending_render_state.take() {
|
||||||
// https://immersive-web.github.io/webxr/#apply-the-pending-render-state
|
// 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
|
// Step 2
|
||||||
let base_layer = match self.active_render_state.get().GetBaseLayer() {
|
let base_layer = match self.active_render_state.get().GetBaseLayer() {
|
||||||
Some(layer) => layer,
|
Some(layer) => layer,
|
||||||
|
@ -279,6 +283,12 @@ impl XRSessionMethods for XRSession {
|
||||||
if let Some(ref layer) = init.baseLayer {
|
if let Some(ref layer) = init.baseLayer {
|
||||||
pending.set_layer(Some(&layer))
|
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
|
// XXXManishearth handle inlineVerticalFieldOfView
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue