pub struct Session {
floor_transform: Option<RigidTransform3D<f32, Native, Floor>>,
viewports: Viewports,
sender: Sender<SessionMsg>,
environment_blend_mode: EnvironmentBlendMode,
initial_inputs: Vec<InputSource>,
granted_features: Vec<String>,
id: SessionId,
supported_frame_rates: Vec<f32>,
}
Expand description
An object that represents an XR session. This is owned by the content thread. https://www.w3.org/TR/webxr/#xrsession-interface
Fields§
§floor_transform: Option<RigidTransform3D<f32, Native, Floor>>
§viewports: Viewports
§sender: Sender<SessionMsg>
§environment_blend_mode: EnvironmentBlendMode
§initial_inputs: Vec<InputSource>
§granted_features: Vec<String>
§id: SessionId
§supported_frame_rates: Vec<f32>
Implementations§
source§impl Session
impl Session
pub fn id(&self) -> SessionId
pub fn floor_transform(&self) -> Option<RigidTransform3D<f32, Native, Floor>>
pub fn reference_space_bounds(&self) -> Option<Vec<Point2D<f32, Floor>>>
pub fn initial_inputs(&self) -> &[InputSource]
pub fn environment_blend_mode(&self) -> EnvironmentBlendMode
pub fn viewports(&self) -> &[Rect<i32, Viewport>]
sourcepub fn recommended_framebuffer_resolution(
&self,
) -> Option<Size2D<i32, Viewport>>
pub fn recommended_framebuffer_resolution( &self, ) -> Option<Size2D<i32, Viewport>>
A resolution large enough to contain all the viewports. https://immersive-web.github.io/webxr/#recommended-webgl-framebuffer-resolution
Returns None if the session is inline
pub fn create_layer( &self, context_id: ContextId, init: LayerInit, ) -> Result<LayerId, Error>
sourcepub fn destroy_layer(&self, context_id: ContextId, layer_id: LayerId)
pub fn destroy_layer(&self, context_id: ContextId, layer_id: LayerId)
Destroy a layer
pub fn set_layers(&self, layers: Vec<(ContextId, LayerId)>)
pub fn start_render_loop(&mut self)
pub fn update_clip_planes(&mut self, near: f32, far: f32)
pub fn set_event_dest(&mut self, dest: Sender<Event>)
pub fn render_animation_frame(&mut self)
pub fn end_session(&mut self)
pub fn apply_event(&mut self, event: FrameUpdateEvent)
pub fn granted_features(&self) -> &[String]
pub fn request_hit_test(&self, source: HitTestSource)
pub fn cancel_hit_test(&self, id: HitTestId)
pub fn update_frame_rate(&mut self, rate: f32, sender: Sender<f32>)
pub fn supported_frame_rates(&self) -> &[f32]
Trait Implementations§
source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl !Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more