mirror of
https://github.com/mii443/rust-openvr.git
synced 2025-08-23 00:35:31 +00:00
Additional compositor methods and docs
This commit is contained in:
@ -92,6 +92,14 @@ impl<'a> Compositor<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Call immediately after presenting your app's window (i.e. companion window) to unblock the compositor.
|
||||||
|
///
|
||||||
|
/// This is an optional call, which only needs to be used if you can't instead call `wait_get_poses` immediately
|
||||||
|
/// after submitting frames. For example, if your engine's render and game loop are not on separate threads, or
|
||||||
|
/// blocking the render thread until 3ms before the next vsync would introduce a deadlock of some sort. This
|
||||||
|
/// function tells the compositor that you have finished all rendering after having Submitted buffers for both eyes,
|
||||||
|
/// and it is free to start its rendering work. This should only be called from the same thread you are rendering
|
||||||
|
/// on.
|
||||||
pub fn post_present_handoff(&self) {
|
pub fn post_present_handoff(&self) {
|
||||||
unsafe { (self.0.PostPresentHandoff.unwrap())() };
|
unsafe { (self.0.PostPresentHandoff.unwrap())() };
|
||||||
}
|
}
|
||||||
@ -100,6 +108,13 @@ impl<'a> Compositor<'a> {
|
|||||||
pub fn is_fullscreen(&self) -> bool {
|
pub fn is_fullscreen(&self) -> bool {
|
||||||
unsafe { (self.0.IsFullscreen.unwrap())() }
|
unsafe { (self.0.IsFullscreen.unwrap())() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Clears the frame that was sent with the last call to `submit.
|
||||||
|
///
|
||||||
|
/// This will cause the compositor to show the grid until `submit` is called again.
|
||||||
|
pub fn clear_last_submitted_frame(&self) {
|
||||||
|
unsafe { self.0.ClearLastSubmittedFrame.unwrap()() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
@ -38,8 +38,7 @@ impl<'a> RenderModels<'a> {
|
|||||||
/// Get the names of available components.
|
/// Get the names of available components.
|
||||||
///
|
///
|
||||||
/// `component` does not correlate to a tracked device index, but is only used for iterating over all available
|
/// `component` does not correlate to a tracked device index, but is only used for iterating over all available
|
||||||
/// components. If it's out of range, this function will return None. Otherwise, it will return the size of the
|
/// components. If it's out of range, this function will return None.
|
||||||
/// buffer required for the name.
|
|
||||||
pub fn component_name(&self, model: &CStr, component: u32) -> Option<CString> {
|
pub fn component_name(&self, model: &CStr, component: u32) -> Option<CString> {
|
||||||
unsafe { get_string(|ptr, n| self.0.GetComponentName.unwrap()(model.as_ptr() as *mut _, component, ptr, n)) }
|
unsafe { get_string(|ptr, n| self.0.GetComponentName.unwrap()(model.as_ptr() as *mut _, component, ptr, n)) }
|
||||||
}
|
}
|
||||||
@ -50,7 +49,7 @@ impl<'a> RenderModels<'a> {
|
|||||||
(0..n).map(|i| self.component_name(model, i).expect("inconsistent component presence reported by OpenVR")).collect::<Vec<_>>().into_iter()
|
(0..n).map(|i| self.component_name(model, i).expect("inconsistent component presence reported by OpenVR")).collect::<Vec<_>>().into_iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Use this to get the render model name for the specified rendermode/component combination, to be passed to
|
/// Use this to get the render model name for the specified rendermodel/component combination, to be passed to
|
||||||
/// `load_render_model`.
|
/// `load_render_model`.
|
||||||
///
|
///
|
||||||
/// If the component name is out of range, this function will return None.
|
/// If the component name is out of range, this function will return None.
|
||||||
@ -64,10 +63,12 @@ impl<'a> RenderModels<'a> {
|
|||||||
|
|
||||||
/// Use this to query information about the component, as a function of the controller state.
|
/// Use this to query information about the component, as a function of the controller state.
|
||||||
///
|
///
|
||||||
/// Returns None if the component is invalid or should not be rendered in the current state.
|
/// Returns None if the component is invalid.
|
||||||
///
|
///
|
||||||
/// For dynamic controller components (ex: trigger) values will reflect component motions
|
/// Check `ComponentState::is_visible()` to determine whether the returned component should be rendered.
|
||||||
/// For static components this will return a consistent value independent of the VRControllerState_t
|
///
|
||||||
|
/// For dynamic controller components (ex: trigger) values will reflect component motions.
|
||||||
|
/// For static components this will return a consistent value independent of the `ControllerState`.
|
||||||
pub fn component_state(&self, model: &CStr, component: &CStr, state: &ControllerState, mode: &ControllerMode) -> Option<ComponentState> {
|
pub fn component_state(&self, model: &CStr, component: &CStr, state: &ControllerState, mode: &ControllerMode) -> Option<ComponentState> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut out = mem::uninitialized();
|
let mut out = mem::uninitialized();
|
||||||
|
Reference in New Issue
Block a user