rust_webvr_api/vr_layer.rs
1/// Data provided to a VRDisplay and presented in the HMD.
2#[derive(Debug, Clone)]
3#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
4pub struct VRLayer {
5 /// Source texture whose contents will be presented by the
6 /// VRDisplay when VRDisplay.submitFrame() is called.
7 pub texture_id: u32,
8
9 /// UVs defining the texture bounds to present to the eye in UV space: [x,y,w,h]
10 /// Defaults to [0.0, 0.0, 0.5, 1.0]
11 pub left_bounds: [f32; 4],
12
13 /// UVs defining the texture bounds to present to the eye in UV space: [x,y,w,h]
14 /// Defaults to [0.5, 0.0, 0.5, 1.0]
15 pub right_bounds: [f32; 4],
16
17 /// Hint with texture size
18 pub texture_size: Option<(u32, u32)>,
19}
20
21impl Default for VRLayer {
22 fn default() -> VRLayer {
23 VRLayer {
24 texture_id: 0,
25 left_bounds: [0.0, 0.0, 0.5, 1.0],
26 right_bounds: [0.5, 0.0, 0.5, 1.0],
27 texture_size : None
28 }
29 }
30}