#[repr(C)]pub struct XRSession {Show 19 fields
eventtarget: EventTarget,
blend_mode: XREnvironmentBlendMode,
mode: XRSessionMode,
visibility_state: Cell<XRVisibilityState>,
viewer_space: MutNullableDom<XRSpace>,
session: DomRefCell<Session>,
frame_requested: Cell<bool>,
pending_render_state: MutNullableDom<XRRenderState>,
active_render_state: MutDom<XRRenderState>,
inline_projection_matrix: DomRefCell<Transform3D<f32, Viewer, Display>>,
next_raf_id: Cell<i32>,
raf_callback_list: DomRefCell<Vec<(i32, Option<Rc<XRFrameRequestCallback>>)>>,
current_raf_callback_list: DomRefCell<Vec<(i32, Option<Rc<XRFrameRequestCallback>>)>>,
input_sources: Dom<XRInputSourceArray>,
end_promises: DomRefCell<Vec<Rc<Promise>>>,
ended: Cell<bool>,
next_hit_test_id: Cell<HitTestId>,
pending_hit_test_promises: DomRefCell<HashMap<HitTestId, Rc<Promise>>>,
outside_raf: Cell<bool>,
}
Fields
eventtarget: EventTarget
blend_mode: XREnvironmentBlendMode
mode: XRSessionMode
visibility_state: Cell<XRVisibilityState>
viewer_space: MutNullableDom<XRSpace>
session: DomRefCell<Session>
frame_requested: Cell<bool>
pending_render_state: MutNullableDom<XRRenderState>
active_render_state: MutDom<XRRenderState>
inline_projection_matrix: DomRefCell<Transform3D<f32, Viewer, Display>>
Cached projection matrix for inline sessions
next_raf_id: Cell<i32>
raf_callback_list: DomRefCell<Vec<(i32, Option<Rc<XRFrameRequestCallback>>)>>
current_raf_callback_list: DomRefCell<Vec<(i32, Option<Rc<XRFrameRequestCallback>>)>>
input_sources: Dom<XRInputSourceArray>
end_promises: DomRefCell<Vec<Rc<Promise>>>
ended: Cell<bool>
https://immersive-web.github.io/webxr/#ended
next_hit_test_id: Cell<HitTestId>
pending_hit_test_promises: DomRefCell<HashMap<HitTestId, Rc<Promise>>>
outside_raf: Cell<bool>
Opaque framebuffers need to know the session is “outside of a requestAnimationFrame” https://immersive-web.github.io/webxr/#opaque-framebuffer
Implementations
sourceimpl XRSession
impl XRSession
fn __assert_parent_type(&self)
sourceimpl XRSession
impl XRSession
fn new_inherited(
session: Session,
render_state: &XRRenderState,
input_sources: &XRInputSourceArray,
mode: XRSessionMode
) -> XRSession
pub fn new(
global: &GlobalScope,
session: Session,
mode: XRSessionMode,
frame_receiver: IpcReceiver<Frame>
) -> Root<Dom<XRSession>>
pub fn with_session<R, F: FnOnce(&Session) -> R>(&self, with: F) -> R
pub fn is_ended(&self) -> bool
pub fn is_immersive(&self) -> bool
pub fn has_layers_feature(&self) -> bool
fn setup_raf_loop(&self, frame_receiver: IpcReceiver<Frame>)
pub fn is_outside_raf(&self) -> bool
fn attach_event_handler(&self)
pub fn setup_initial_inputs(&self)
fn event_callback(&self, event: XREvent)
sourcefn raf_callback(&self, frame: Frame)
fn raf_callback(&self, frame: Frame)
https://immersive-web.github.io/webxr/#xr-animation-frame
fn update_inline_projection_matrix(&self)
sourcepub fn inline_view(&self) -> View<Viewer>
pub fn inline_view(&self) -> View<Viewer>
Constructs a View suitable for inline sessions using the inlineVerticalFieldOfView and canvas size
pub fn session_id(&self) -> SessionId
pub fn dirty_layers(&self)
fn layers_begin_frame(&self, frame: &XRFrame)
fn layers_end_frame(&self, frame: &XRFrame)
sourcefn apply_frame_updates(&self, _frame: &XRFrame)
fn apply_frame_updates(&self, _frame: &XRFrame)
https://immersive-web.github.io/webxr/#xrframe-apply-frame-updates
fn handle_frame_event(&self, event: FrameUpdateEvent)
Trait Implementations
sourceimpl Castable for XRSession
impl Castable for XRSession
sourcefn is<T>(&self) -> boolwhere
T: DerivedFrom<Self>,
fn is<T>(&self) -> boolwhere
T: DerivedFrom<Self>,
sourcefn upcast<T>(&self) -> &Twhere
T: Castable,
Self: DerivedFrom<T>,
fn upcast<T>(&self) -> &Twhere
T: Castable,
Self: DerivedFrom<T>,
sourcefn downcast<T>(&self) -> Option<&T>where
T: DerivedFrom<Self>,
fn downcast<T>(&self) -> Option<&T>where
T: DerivedFrom<Self>,
sourceimpl DomObjectWrap for XRSession
impl DomObjectWrap for XRSession
sourceconst WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Box<Self>) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionBinding::Wrap as for<'a> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::boxed::Box<dom::xrsession::XRSession>) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::xrsession::XRSession>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Box<Self>) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::XRSessionBinding::XRSessionBinding::Wrap as for<'a> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::boxed::Box<dom::xrsession::XRSession>) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::xrsession::XRSession>>}
sourceimpl HasParent for XRSession
impl HasParent for XRSession
sourcefn as_parent(&self) -> &EventTarget
fn as_parent(&self) -> &EventTarget
This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is
type Parent = EventTarget
sourceimpl IDLInterface for XRSession
impl IDLInterface for XRSession
sourceimpl MallocSizeOf for XRSession
impl MallocSizeOf for XRSession
sourcefn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
sourceimpl MutDomObject for XRSession
impl MutDomObject for XRSession
sourceunsafe fn init_reflector(&self, obj: *mut JSObject)
unsafe fn init_reflector(&self, obj: *mut JSObject)
sourceimpl ToJSValConvertible for XRSession
impl ToJSValConvertible for XRSession
sourceunsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)
self
to a JSVal
. JSAPI failure causes a panic.sourceimpl XRSessionMethods for XRSession
impl XRSessionMethods for XRSession
sourcefn UpdateRenderState(
&self,
init: &XRRenderStateInit,
_: InRealm<'_>
) -> Result<(), Error>
fn UpdateRenderState(
&self,
init: &XRRenderStateInit,
_: InRealm<'_>
) -> Result<(), Error>
https://immersive-web.github.io/webxr/#dom-xrsession-updaterenderstate
sourcefn RequestAnimationFrame(&self, callback: Rc<XRFrameRequestCallback>) -> i32
fn RequestAnimationFrame(&self, callback: Rc<XRFrameRequestCallback>) -> i32
https://immersive-web.github.io/webxr/#dom-xrsession-requestanimationframe
sourcefn CancelAnimationFrame(&self, frame: i32)
fn CancelAnimationFrame(&self, frame: i32)
https://immersive-web.github.io/webxr/#dom-xrsession-cancelanimationframe
sourcefn EnvironmentBlendMode(&self) -> XREnvironmentBlendMode
fn EnvironmentBlendMode(&self) -> XREnvironmentBlendMode
https://immersive-web.github.io/webxr/#dom-xrsession-environmentblendmode
sourcefn VisibilityState(&self) -> XRVisibilityState
fn VisibilityState(&self) -> XRVisibilityState
https://immersive-web.github.io/webxr/#dom-xrsession-visibilitystate
sourcefn RequestReferenceSpace(
&self,
ty: XRReferenceSpaceType,
comp: InRealm<'_>
) -> Rc<Promise>
fn RequestReferenceSpace(
&self,
ty: XRReferenceSpaceType,
comp: InRealm<'_>
) -> Rc<Promise>
https://immersive-web.github.io/webxr/#dom-xrsession-requestreferencespace
sourcefn InputSources(&self) -> Root<Dom<XRInputSourceArray>>
fn InputSources(&self) -> Root<Dom<XRInputSourceArray>>
https://immersive-web.github.io/webxr/#dom-xrsession-inputsources