mirror of
https://github.com/servo/servo.git
synced 2025-06-18 22:34:30 +01:00
allow setting base layer
This commit is contained in:
parent
d5911816e1
commit
682c89a18c
3 changed files with 18 additions and 4 deletions
|
@ -74,6 +74,8 @@ pub struct VRDisplay {
|
||||||
running_display_raf: Cell<bool>,
|
running_display_raf: Cell<bool>,
|
||||||
paused: Cell<bool>,
|
paused: Cell<bool>,
|
||||||
stopped_on_pause: Cell<bool>,
|
stopped_on_pause: Cell<bool>,
|
||||||
|
/// Whether or not this is XR mode
|
||||||
|
xr: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe_no_jsmanaged_fields!(WebVRDisplayData);
|
unsafe_no_jsmanaged_fields!(WebVRDisplayData);
|
||||||
|
@ -129,6 +131,7 @@ impl VRDisplay {
|
||||||
// This flag is set when the Display was presenting when it received a VR Pause event.
|
// This flag is set when the Display was presenting when it received a VR Pause event.
|
||||||
// When the VR Resume event is received and the flag is set, VR presentation automatically restarts.
|
// When the VR Resume event is received and the flag is set, VR presentation automatically restarts.
|
||||||
stopped_on_pause: Cell::new(false),
|
stopped_on_pause: Cell::new(false),
|
||||||
|
xr: Cell::new(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ enum XREnvironmentBlendMode {
|
||||||
|
|
||||||
attribute double depthNear;
|
attribute double depthNear;
|
||||||
attribute double depthFar;
|
attribute double depthFar;
|
||||||
// attribute XRLayer baseLayer;
|
attribute XRLayer? baseLayer;
|
||||||
|
|
||||||
// // Methods
|
// // Methods
|
||||||
// Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type, optional XRReferenceSpaceOptions options);
|
// Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type, optional XRReferenceSpaceOptions options);
|
||||||
|
|
|
@ -7,10 +7,11 @@ use crate::dom::bindings::codegen::Bindings::XRSessionBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionMethods;
|
use crate::dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionMethods;
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||||
use crate::dom::eventtarget::EventTarget;
|
use crate::dom::eventtarget::EventTarget;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::vrdisplay::VRDisplay;
|
use crate::dom::vrdisplay::VRDisplay;
|
||||||
|
use crate::dom::xrlayer::XRLayer;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ pub struct XRSession {
|
||||||
display: Dom<VRDisplay>,
|
display: Dom<VRDisplay>,
|
||||||
depth_near: Cell<f64>,
|
depth_near: Cell<f64>,
|
||||||
depth_far: Cell<f64>,
|
depth_far: Cell<f64>,
|
||||||
|
base_layer: MutNullableDom<XRLayer>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl XRSession {
|
impl XRSession {
|
||||||
|
@ -29,6 +31,7 @@ impl XRSession {
|
||||||
display: Dom::from_ref(display),
|
display: Dom::from_ref(display),
|
||||||
depth_near: Cell::new(0.1),
|
depth_near: Cell::new(0.1),
|
||||||
depth_far: Cell::new(1000.),
|
depth_far: Cell::new(1000.),
|
||||||
|
base_layer: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,4 +64,12 @@ impl XRSessionMethods for XRSession {
|
||||||
fn Mode(&self) -> XRSessionMode {
|
fn Mode(&self) -> XRSessionMode {
|
||||||
XRSessionMode::Immersive_vr
|
XRSessionMode::Immersive_vr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn SetBaseLayer(&self, layer: Option<&XRLayer>) {
|
||||||
|
self.base_layer.set(layer)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn GetBaseLayer(&self) -> Option<DomRoot<XRLayer>> {
|
||||||
|
self.base_layer.get()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue