Skip to content

Instantly share code, notes, and snippets.

@MortimerGoro
Last active November 23, 2016 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MortimerGoro/c4cef85672ca5757acaee51fdb5a9e2e to your computer and use it in GitHub Desktop.
Save MortimerGoro/c4cef85672ca5757acaee51fdb5a9e2e to your computer and use it in GitHub Desktop.
VRDevice traits for blogpost
pub trait VRDevice: Send + Sync {
// Returns unique device identifier.
fn device_id(&self) -> u64;
// Returns the current display data.
fn display_data(&self) -> VRDisplayData;
// Returns the inmediate VRFrameData of the HMD.
// Should be used when not presenting to the device.
fn inmediate_frame_data(&self, near_z: f64, far_z: f64) -> VRFrameData;
// Returns the synced VRFrameData to render the current frame.
// Should be used when presenting to the device.
// sync_poses must have been called before this call.
fn synced_frame_data(&self, next: f64, far_z: f64) -> VRFrameData;
// Resets the pose for this display.
fn reset_pose(&mut self);
// Synchronization point to keep in step with the HMD.
// Must be called in the render thread, before doing any work.
fn sync_poses(&mut self);
// Submits frame to the display.
// Must be called in the render thread.
fn submit_frame(&mut self, layer: &VRLayer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment