1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use {VRDisplayData, VRFramebuffer, VRFramebufferAttributes, VRFrameData, VRFutureFrameData, VRGamepadPtr, VRLayer};
use gleam::gl::Gl;
use std::sync::Arc;
use std::cell::RefCell;
pub type VRDisplayPtr = Arc<RefCell<VRDisplay>>;
pub trait VRDisplay: Send + Sync {
fn id(&self) -> u32;
fn data(&self) -> VRDisplayData;
fn fetch_gamepads(&mut self) -> Result<Vec<VRGamepadPtr>, String>;
fn immediate_frame_data(&self, near_z: f64, far_z: f64) -> VRFrameData;
#[allow(deprecated)]
fn future_frame_data(&mut self, near_z: f64, far_z: f64) -> VRFutureFrameData {
self.sync_poses();
VRFutureFrameData::resolved(self.synced_frame_data(near_z, far_z))
}
#[deprecated(since="0.10.3", note="please use `future_frame_data` instead")]
fn synced_frame_data(&self, next: f64, far_z: f64) -> VRFrameData;
fn reset_pose(&mut self);
#[deprecated(since="0.10.3", note="please use `future_frame_data` instead")]
fn sync_poses(&mut self);
fn bind_framebuffer(&mut self, index: u32);
fn get_framebuffers(&self) -> Vec<VRFramebuffer>;
#[deprecated(since="0.10.3", note="please use `submit_layer` instead")]
fn render_layer(&mut self, layer: &VRLayer);
#[deprecated(since="0.10.3", note="please use `submit_layer` instead")]
fn submit_frame(&mut self);
#[allow(unused_variables)]
#[allow(deprecated)]
fn submit_layer(&mut self, gl: &Gl, layer: &VRLayer) {
self.render_layer(layer);
self.submit_frame();
}
fn start_present(&mut self, _attributes: Option<VRFramebufferAttributes>) {}
fn stop_present(&mut self) {}
}
impl PartialEq for VRDisplay {
fn eq(&self, other: &VRDisplay) -> bool {
self.id() == other.id()
}
}