Struct webxr_api::session::Session

source ·
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,
}
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

Implementations§

source§

impl Session

source

pub fn id(&self) -> SessionId

source

pub fn floor_transform(&self) -> Option<RigidTransform3D<f32, Native, Floor>>

source

pub fn initial_inputs(&self) -> &[InputSource]

source

pub fn environment_blend_mode(&self) -> EnvironmentBlendMode

source

pub fn viewports(&self) -> &[Rect<i32, Viewport>]

source

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

source

pub fn create_layer( &self, context_id: ContextId, init: LayerInit ) -> Result<LayerId, Error>

source

pub fn destroy_layer(&self, context_id: ContextId, layer_id: LayerId)

Destroy a layer

source

pub fn set_layers(&self, layers: Vec<(ContextId, LayerId)>)

source

pub fn start_render_loop(&mut self)

source

pub fn update_clip_planes(&mut self, near: f32, far: f32)

source

pub fn set_event_dest(&mut self, dest: Sender<Event>)

source

pub fn render_animation_frame(&mut self)

source

pub fn end_session(&mut self)

source

pub fn apply_event(&mut self, event: FrameUpdateEvent)

source

pub fn granted_features(&self) -> &[String]

source

pub fn request_hit_test(&self, source: HitTestSource)

source

pub fn cancel_hit_test(&self, id: HitTestId)

Trait Implementations§

source§

impl<'de> Deserialize<'de> for Session

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Session

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,