pub trait DeviceAPI: 'static {
Show 18 methods
// Required methods
fn create_layer(
&mut self,
context_id: ContextId,
init: LayerInit,
) -> Result<LayerId, Error>;
fn destroy_layer(&mut self, context_id: ContextId, layer_id: LayerId);
fn floor_transform(&self) -> Option<RigidTransform3D<f32, Native, Floor>>;
fn viewports(&self) -> Viewports;
fn begin_animation_frame(
&mut self,
layers: &[(ContextId, LayerId)],
) -> Option<Frame>;
fn end_animation_frame(&mut self, layers: &[(ContextId, LayerId)]);
fn initial_inputs(&self) -> Vec<InputSource>;
fn set_event_dest(&mut self, dest: Sender<Event>);
fn quit(&mut self);
fn set_quitter(&mut self, quitter: Quitter);
fn update_clip_planes(&mut self, near: f32, far: f32);
fn granted_features(&self) -> &[String];
// Provided methods
fn environment_blend_mode(&self) -> EnvironmentBlendMode { ... }
fn request_hit_test(&mut self, _source: HitTestSource) { ... }
fn cancel_hit_test(&mut self, _id: HitTestId) { ... }
fn update_frame_rate(&mut self, rate: f32) -> f32 { ... }
fn supported_frame_rates(&self) -> Vec<f32> { ... }
fn reference_space_bounds(&self) -> Option<Vec<Point2D<f32, Floor>>> { ... }
}
Expand description
A trait for using an XR device
Required Methods§
sourcefn create_layer(
&mut self,
context_id: ContextId,
init: LayerInit,
) -> Result<LayerId, Error>
fn create_layer( &mut self, context_id: ContextId, init: LayerInit, ) -> Result<LayerId, Error>
Create a new layer
sourcefn destroy_layer(&mut self, context_id: ContextId, layer_id: LayerId)
fn destroy_layer(&mut self, context_id: ContextId, layer_id: LayerId)
Destroy a layer
sourcefn floor_transform(&self) -> Option<RigidTransform3D<f32, Native, Floor>>
fn floor_transform(&self) -> Option<RigidTransform3D<f32, Native, Floor>>
The transform from native coordinates to the floor.
fn viewports(&self) -> Viewports
sourcefn begin_animation_frame(
&mut self,
layers: &[(ContextId, LayerId)],
) -> Option<Frame>
fn begin_animation_frame( &mut self, layers: &[(ContextId, LayerId)], ) -> Option<Frame>
Begin an animation frame.
sourcefn end_animation_frame(&mut self, layers: &[(ContextId, LayerId)])
fn end_animation_frame(&mut self, layers: &[(ContextId, LayerId)])
End an animation frame, render the layer to the device, and block waiting for the next frame.
sourcefn initial_inputs(&self) -> Vec<InputSource>
fn initial_inputs(&self) -> Vec<InputSource>
Inputs registered with the device on initialization. More may be added, which should be communicated through a yet-undecided event mechanism
sourcefn set_event_dest(&mut self, dest: Sender<Event>)
fn set_event_dest(&mut self, dest: Sender<Event>)
Sets the event handling channel