rust_webvr_api/
vr_framebuffer.rs

1/// Information about a FBO provided by a VRDisplay.
2#[derive(Debug, Clone)]
3#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
4pub struct VRFramebuffer {
5    /// Eye index of the framebuffer
6    pub eye_index: u32,
7
8    /// The attributes set up for this framebuffer
9    pub attributes: VRFramebufferAttributes,
10
11    /// The 2D rectangle that should be used to project the 3D scene
12    /// to the position of the eye camera. Measured in device pixels.
13    pub viewport: VRViewport,
14}
15
16#[derive(Debug, Copy, Clone)]
17#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
18pub struct VRFramebufferAttributes {
19    pub multiview: bool,
20    pub depth: bool,
21    pub multisampling: bool,
22}
23
24impl Default for VRFramebufferAttributes {
25     fn default() -> VRFramebufferAttributes {
26         Self {
27            multiview: false,
28            depth: false,
29            multisampling: false,
30         }
31     }
32}
33
34#[derive(Debug, Clone)]
35#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
36pub struct VRViewport {
37    pub x: i32,
38    pub y: i32,
39    pub width: i32,
40    pub height: i32,
41}
42
43impl VRViewport {
44    pub fn new(x: i32, y: i32, width: i32, height: i32) -> Self {
45        Self {
46            x: x,
47            y: y,
48            width: width,
49            height: height,
50        }
51    }
52}