mirror of
https://github.com/mii443/rust-openvr.git
synced 2025-08-22 16:25:36 +00:00
committed by
Benjamin Saunders
parent
b7a3259f42
commit
6aaa7d279a
18
.gitignore
vendored
18
.gitignore
vendored
@ -1,11 +1,9 @@
|
|||||||
/.tmp.txt
|
# Generated by Cargo
|
||||||
/Makefile
|
/target/
|
||||||
/bin
|
|
||||||
/lib
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
/modules/oculus_sdk_mac/LibOVR/Lib/Mac/Xcode/Release/
|
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
|
||||||
/target
|
|
||||||
*.py[co]
|
|
||||||
/src/sys/target/
|
|
||||||
*.lock
|
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
/idea/
|
|
||||||
|
/.idea/
|
||||||
|
/.vscode/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "openvr"
|
name = "openvr"
|
||||||
version = "0.5.2"
|
version = "0.6.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Colin Sherratt",
|
"Colin Sherratt",
|
||||||
"Erick Tryzelaar",
|
"Erick Tryzelaar",
|
||||||
@ -12,7 +12,7 @@ license = "MIT"
|
|||||||
homepage = "https://github.com/rust-openvr/rust-openvr"
|
homepage = "https://github.com/rust-openvr/rust-openvr"
|
||||||
repository = "https://github.com/rust-openvr/rust-openvr"
|
repository = "https://github.com/rust-openvr/rust-openvr"
|
||||||
|
|
||||||
description = "A high-level binding for openvr."
|
description = "A high-level binding for OpenVR."
|
||||||
|
|
||||||
keywords = ["vr", "vive", "steamvr"]
|
keywords = ["vr", "vive", "steamvr"]
|
||||||
categories = [ "hardware-support", "api-bindings" ]
|
categories = [ "hardware-support", "api-bindings" ]
|
||||||
@ -22,5 +22,5 @@ travis-ci = { repository = "rust-openvr/rust-openvr" }
|
|||||||
maintenance = { status = "passively-maintained" }
|
maintenance = { status = "passively-maintained" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
openvr_sys = "2"
|
openvr_sys = "2.0.3"
|
||||||
lazy_static = "0.2.8"
|
lazy_static = "1.3.0"
|
||||||
|
@ -4,39 +4,30 @@ rust-openvr
|
|||||||
[](https://travis-ci.org/rust-openvr/rust-openvr)
|
[](https://travis-ci.org/rust-openvr/rust-openvr)
|
||||||
[](https://gitter.im/rust-openvr/rust-openvr?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[](https://gitter.im/rust-openvr/rust-openvr?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
A high-level binding for OpenVR 1.0.10.
|
High-level bindings for OpenVR.
|
||||||
|
|
||||||
[API documentation](https://docs.rs/openvr/*/openvr/)
|
[API documentation](https://docs.rs/openvr/*/openvr/)
|
||||||
|
|
||||||
High-level documentation can be found at [the OpenVR wiki](https://github.com/ValveSoftware/openvr/wiki/API-Documentation).
|
[C/C++ API documentation](https://github.com/ValveSoftware/openvr/wiki/API-Documentation) for reference purposes.
|
||||||
|
|
||||||
Using rust-openvr
|
|
||||||
-----------
|
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
|
|
||||||
openvr-sys needs cmake and a C++ compiler so that it can compile and statically link the OpenVR client library.
|
`openvr-sys` requires CMake and C++ to compile and statically link the OpenVR library.
|
||||||
|
|
||||||
## Windows
|
**Imporant**: OpenVR does not support MinGW on Windows, i.e., you have to use the MSVC Rust toolchain and C++ compiler.
|
||||||
|
|
||||||
Upstream OpenVR does not support MinGW. You must use an MSVC-targeted rust toolchain and C++ compiler.
|
|
||||||
|
|
||||||
# Initializing
|
# Initializing
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|
||||||
extern crate openvr;
|
extern crate openvr;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Initialize OpenVR
|
// Initialize OpenVR.
|
||||||
let context = unsafe { openvr::init(openvr::ApplicationType::Scene) }.unwrap();
|
let context = unsafe { openvr::init(openvr::ApplicationType::Scene) }.unwrap();
|
||||||
|
|
||||||
// accessing subsystems
|
// Access subsystem.
|
||||||
let system = context.system().unwrap();
|
let system = context.system().unwrap();
|
||||||
|
|
||||||
// ..
|
// See examples/test.rs for a more detailed example.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# Examples
|
|
||||||
See examples/test.rs for a more detailed example.
|
|
@ -1,7 +1,8 @@
|
|||||||
extern crate openvr;
|
extern crate openvr;
|
||||||
|
|
||||||
fn print_matrix<M, N>(offset: u32, mat: M)
|
fn print_matrix<M, N>(offset: u32, mat: M)
|
||||||
where M: AsRef<[N]>,
|
where
|
||||||
|
M: AsRef<[N]>,
|
||||||
N: AsRef<[f32]>,
|
N: AsRef<[f32]>,
|
||||||
{
|
{
|
||||||
let offset: String = (0..offset).map(|_| ' ').collect();
|
let offset: String = (0..offset).map(|_| ' ').collect();
|
||||||
@ -35,7 +36,10 @@ fn main() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("\tRecommended size: {:?}", system.recommended_render_target_size());
|
println!(
|
||||||
|
"\tRecommended size: {:?}",
|
||||||
|
system.recommended_render_target_size()
|
||||||
|
);
|
||||||
println!("\tVSync: {:?}", system.time_since_last_vsync());
|
println!("\tVSync: {:?}", system.time_since_last_vsync());
|
||||||
|
|
||||||
print!("\tProjection matrix left ");
|
print!("\tProjection matrix left ");
|
||||||
@ -47,20 +51,19 @@ fn main() {
|
|||||||
print_matrix(25, system.eye_to_head_transform(openvr::Eye::Left));
|
print_matrix(25, system.eye_to_head_transform(openvr::Eye::Left));
|
||||||
|
|
||||||
print!("\tPoses ");
|
print!("\tPoses ");
|
||||||
let poses = system.device_to_absolute_tracking_pose(openvr::TrackingUniverseOrigin::RawAndUncalibrated, 0.0);
|
let poses = system
|
||||||
|
.device_to_absolute_tracking_pose(openvr::TrackingUniverseOrigin::RawAndUncalibrated, 0.0);
|
||||||
for pose in poses.iter() {
|
for pose in poses.iter() {
|
||||||
print_matrix(8+6, pose.device_to_absolute_tracking());
|
print_matrix(8 + 6, pose.device_to_absolute_tracking());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("\tDistortion example");
|
println!("\tDistortion example");
|
||||||
for u in 0..2 {
|
for u in 0..2 {
|
||||||
for v in 0..2 {
|
for v in 0..2 {
|
||||||
let pos = system.compute_distortion(
|
let pos = system
|
||||||
openvr::Eye::Left,
|
.compute_distortion(openvr::Eye::Left, u as f32 / 4., v as f32 / 4.)
|
||||||
u as f32 / 4.,
|
.unwrap();
|
||||||
v as f32 / 4.,
|
|
||||||
).unwrap();
|
|
||||||
print!("\t\t({:7.4}, {:7.4}) ", pos.red[0], pos.red[1]);
|
print!("\t\t({:7.4}, {:7.4}) ", pos.red[0], pos.red[1]);
|
||||||
}
|
}
|
||||||
println!();
|
println!();
|
||||||
@ -91,7 +94,10 @@ fn main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
println!("\tCalibration state: {:?}", chaperone.get_calibration_state());
|
println!(
|
||||||
|
"\tCalibration state: {:?}",
|
||||||
|
chaperone.get_calibration_state()
|
||||||
|
);
|
||||||
println!("\tPlay area size: {:?}", chaperone.get_play_area_size());
|
println!("\tPlay area size: {:?}", chaperone.get_play_area_size());
|
||||||
print!("\tPlay area rect: ");
|
print!("\tPlay area rect: ");
|
||||||
if let Some(play_area_rect) = chaperone.get_play_area_rect() {
|
if let Some(play_area_rect) = chaperone.get_play_area_rect() {
|
||||||
@ -99,7 +105,10 @@ fn main() {
|
|||||||
} else {
|
} else {
|
||||||
println!("None");
|
println!("None");
|
||||||
}
|
}
|
||||||
println!("\tAre bounds visible = {:?}", chaperone.are_bounds_visible());
|
println!(
|
||||||
|
"\tAre bounds visible = {:?}",
|
||||||
|
chaperone.are_bounds_visible()
|
||||||
|
);
|
||||||
println!();
|
println!();
|
||||||
|
|
||||||
println!("Done! \\o/");
|
println!("Done! \\o/");
|
||||||
|
@ -104,7 +104,12 @@ impl Chaperone {
|
|||||||
};
|
};
|
||||||
let is_ok = unsafe { self.0.GetPlayAreaRect.unwrap()(&mut r) };
|
let is_ok = unsafe { self.0.GetPlayAreaRect.unwrap()(&mut r) };
|
||||||
if is_ok {
|
if is_ok {
|
||||||
Some([r.vCorners[0].v, r.vCorners[1].v, r.vCorners[2].v, r.vCorners[3].v])
|
Some([
|
||||||
|
r.vCorners[0].v,
|
||||||
|
r.vCorners[1].v,
|
||||||
|
r.vCorners[2].v,
|
||||||
|
r.vCorners[3].v,
|
||||||
|
])
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
//! It is recommended that you continue presenting your application's own window, reusing either the left or right eye
|
//! It is recommended that you continue presenting your application's own window, reusing either the left or right eye
|
||||||
//! camera render target to draw a single quad (perhaps cropped to a lower fov to hide the hidden area mask).
|
//! camera render target to draw a single quad (perhaps cropped to a lower fov to hide the hidden area mask).
|
||||||
|
|
||||||
use std::{mem, ptr, error, fmt};
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
use std::{error, fmt, mem, ptr};
|
||||||
|
|
||||||
use openvr_sys as sys;
|
use openvr_sys as sys;
|
||||||
|
|
||||||
@ -21,14 +21,29 @@ use super::*;
|
|||||||
|
|
||||||
impl Compositor {
|
impl Compositor {
|
||||||
pub fn vulkan_instance_extensions_required(&self) -> Vec<CString> {
|
pub fn vulkan_instance_extensions_required(&self) -> Vec<CString> {
|
||||||
let temp = unsafe { get_string(|ptr, n| self.0.GetVulkanInstanceExtensionsRequired.unwrap()(ptr, n)) }.unwrap();
|
let temp = unsafe {
|
||||||
temp.as_bytes().split(|&x| x == b' ').map(|x| CString::new(x.to_vec()).expect("extension name contained null byte")).collect()
|
get_string(|ptr, n| self.0.GetVulkanInstanceExtensionsRequired.unwrap()(ptr, n))
|
||||||
|
}
|
||||||
|
.unwrap();
|
||||||
|
temp.as_bytes()
|
||||||
|
.split(|&x| x == b' ')
|
||||||
|
.map(|x| CString::new(x.to_vec()).expect("extension name contained null byte"))
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Safety: physical_device must be a valid VkPhysicalDevice
|
/// Safety: physical_device must be a valid VkPhysicalDevice
|
||||||
pub unsafe fn vulkan_device_extensions_required(&self, physical_device: *mut VkPhysicalDevice_T) -> Vec<CString> {
|
pub unsafe fn vulkan_device_extensions_required(
|
||||||
let temp = get_string(|ptr, n| self.0.GetVulkanDeviceExtensionsRequired.unwrap()(physical_device, ptr, n)).unwrap();
|
&self,
|
||||||
temp.as_bytes().split(|&x| x == b' ').map(|x| CString::new(x.to_vec()).expect("extension name contained null byte")).collect()
|
physical_device: *mut VkPhysicalDevice_T,
|
||||||
|
) -> Vec<CString> {
|
||||||
|
let temp = get_string(|ptr, n| {
|
||||||
|
self.0.GetVulkanDeviceExtensionsRequired.unwrap()(physical_device, ptr, n)
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
temp.as_bytes()
|
||||||
|
.split(|&x| x == b' ')
|
||||||
|
.map(|x| CString::new(x.to_vec()).expect("extension name contained null byte"))
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets tracking space returned by WaitGetPoses
|
/// Sets tracking space returned by WaitGetPoses
|
||||||
@ -43,8 +58,12 @@ impl Compositor {
|
|||||||
pub fn wait_get_poses(&self) -> Result<WaitPoses, CompositorError> {
|
pub fn wait_get_poses(&self) -> Result<WaitPoses, CompositorError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut result: WaitPoses = mem::uninitialized();
|
let mut result: WaitPoses = mem::uninitialized();
|
||||||
let e = self.0.WaitGetPoses.unwrap()(result.render.as_mut().as_mut_ptr() as *mut _, result.render.len() as u32,
|
let e = self.0.WaitGetPoses.unwrap()(
|
||||||
result.game.as_mut().as_mut_ptr() as *mut _, result.game.len() as u32);
|
result.render.as_mut().as_mut_ptr() as *mut _,
|
||||||
|
result.render.len() as u32,
|
||||||
|
result.game.as_mut().as_mut_ptr() as *mut _,
|
||||||
|
result.game.len() as u32,
|
||||||
|
);
|
||||||
if e == sys::EVRCompositorError_VRCompositorError_None {
|
if e == sys::EVRCompositorError_VRCompositorError_None {
|
||||||
Ok(result)
|
Ok(result)
|
||||||
} else {
|
} else {
|
||||||
@ -60,13 +79,23 @@ impl Compositor {
|
|||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// The handles you supply must be valid and comply with the graphics API's synchronization requirements.
|
/// The handles you supply must be valid and comply with the graphics API's synchronization requirements.
|
||||||
pub unsafe fn submit(&self, eye: Eye, texture: &Texture, bounds: Option<&texture::Bounds>, pose: Option<[[f32; 4]; 3]>) -> Result<(), CompositorError> {
|
pub unsafe fn submit(
|
||||||
|
&self,
|
||||||
|
eye: Eye,
|
||||||
|
texture: &Texture,
|
||||||
|
bounds: Option<&texture::Bounds>,
|
||||||
|
pose: Option<[[f32; 4]; 3]>,
|
||||||
|
) -> Result<(), CompositorError> {
|
||||||
use self::texture::Handle::*;
|
use self::texture::Handle::*;
|
||||||
let flags = match texture.handle {
|
let flags = match texture.handle {
|
||||||
Vulkan(_) => sys::EVRSubmitFlags_Submit_Default,
|
Vulkan(_) => sys::EVRSubmitFlags_Submit_Default,
|
||||||
OpenGLTexture(_) => sys::EVRSubmitFlags_Submit_Default,
|
OpenGLTexture(_) => sys::EVRSubmitFlags_Submit_Default,
|
||||||
OpenGLRenderBuffer(_) => sys::EVRSubmitFlags_Submit_GlRenderBuffer,
|
OpenGLRenderBuffer(_) => sys::EVRSubmitFlags_Submit_GlRenderBuffer,
|
||||||
} | if pose.is_some() { sys::EVRSubmitFlags_Submit_TextureWithPose } else { 0 };
|
} | if pose.is_some() {
|
||||||
|
sys::EVRSubmitFlags_Submit_TextureWithPose
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
};
|
||||||
let texture = sys::VRTextureWithPose_t_real {
|
let texture = sys::VRTextureWithPose_t_real {
|
||||||
handle: match texture.handle {
|
handle: match texture.handle {
|
||||||
Vulkan(ref x) => x as *const _ as *mut _,
|
Vulkan(ref x) => x as *const _ as *mut _,
|
||||||
@ -79,13 +108,18 @@ impl Compositor {
|
|||||||
OpenGLRenderBuffer(_) => sys::ETextureType_TextureType_OpenGL,
|
OpenGLRenderBuffer(_) => sys::ETextureType_TextureType_OpenGL,
|
||||||
},
|
},
|
||||||
eColorSpace: texture.color_space as sys::EColorSpace,
|
eColorSpace: texture.color_space as sys::EColorSpace,
|
||||||
mDeviceToAbsoluteTracking: sys::HmdMatrix34_t { m: pose.unwrap_or([[0.0; 4]; 3]) },
|
mDeviceToAbsoluteTracking: sys::HmdMatrix34_t {
|
||||||
|
m: pose.unwrap_or([[0.0; 4]; 3]),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
let e = self.0.Submit.unwrap()(
|
let e = self.0.Submit.unwrap()(
|
||||||
eye as sys::EVREye,
|
eye as sys::EVREye,
|
||||||
&texture as *const _ as *mut _,
|
&texture as *const _ as *mut _,
|
||||||
bounds.map(|x| x as *const _ as *mut texture::Bounds as *mut _).unwrap_or(ptr::null_mut()),
|
bounds
|
||||||
flags);
|
.map(|x| x as *const _ as *mut texture::Bounds as *mut _)
|
||||||
|
.unwrap_or(ptr::null_mut()),
|
||||||
|
flags,
|
||||||
|
);
|
||||||
if e == sys::EVRCompositorError_VRCompositorError_None {
|
if e == sys::EVRCompositorError_VRCompositorError_None {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
@ -138,7 +172,7 @@ impl Compositor {
|
|||||||
/// to access the queue. Note that PostPresentHandoff and SubmitExplicitTimingData will access the queue, so only
|
/// to access the queue. Note that PostPresentHandoff and SubmitExplicitTimingData will access the queue, so only
|
||||||
/// WaitGetPoses becomes safe for accessing the queue from another thread.
|
/// WaitGetPoses becomes safe for accessing the queue from another thread.
|
||||||
pub fn set_explicit_timing_mode(&self, mode: bool) {
|
pub fn set_explicit_timing_mode(&self, mode: bool) {
|
||||||
unsafe { self.0.SetExplicitTimingMode.unwrap()(mode) }
|
unsafe { self.0.SetExplicitTimingMode.unwrap()(mode as sys::EVRCompositorTimingMode) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn submit_explicit_timing_data(&self) -> Result<(), CompositorError> {
|
pub fn submit_explicit_timing_data(&self) -> Result<(), CompositorError> {
|
||||||
@ -151,7 +185,7 @@ impl Compositor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct WaitPoses {
|
pub struct WaitPoses {
|
||||||
/// Predicted to the point they will be at the upcoming frame.
|
/// Predicted to the point they will be at the upcoming frame.
|
||||||
pub render: TrackedDevicePoses,
|
pub render: TrackedDevicePoses,
|
||||||
@ -165,17 +199,28 @@ pub struct CompositorError(sys::EVRCompositorError);
|
|||||||
pub mod compositor_error {
|
pub mod compositor_error {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub const REQUEST_FAILED: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_RequestFailed);
|
pub const REQUEST_FAILED: CompositorError =
|
||||||
pub const INCOMPATIBLE_VERSION: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_IncompatibleVersion);
|
CompositorError(sys::EVRCompositorError_VRCompositorError_RequestFailed);
|
||||||
pub const DO_NOT_HAVE_FOCUS: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_DoNotHaveFocus);
|
pub const INCOMPATIBLE_VERSION: CompositorError =
|
||||||
pub const INVALID_TEXTURE: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_InvalidTexture);
|
CompositorError(sys::EVRCompositorError_VRCompositorError_IncompatibleVersion);
|
||||||
pub const IS_NOT_SCENE_APPLICATION: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_IsNotSceneApplication);
|
pub const DO_NOT_HAVE_FOCUS: CompositorError =
|
||||||
pub const TEXTURE_IS_ON_WRONG_DEVICE: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_TextureIsOnWrongDevice);
|
CompositorError(sys::EVRCompositorError_VRCompositorError_DoNotHaveFocus);
|
||||||
pub const TEXTURE_USES_UNSUPPORTED_FORMAT: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_TextureUsesUnsupportedFormat);
|
pub const INVALID_TEXTURE: CompositorError =
|
||||||
pub const SHARED_TEXTURES_NOT_SUPPORTED: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_SharedTexturesNotSupported);
|
CompositorError(sys::EVRCompositorError_VRCompositorError_InvalidTexture);
|
||||||
pub const INDEX_OUT_OF_RANGE: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_IndexOutOfRange);
|
pub const IS_NOT_SCENE_APPLICATION: CompositorError =
|
||||||
pub const ALREADY_SUBMITTED: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_AlreadySubmitted);
|
CompositorError(sys::EVRCompositorError_VRCompositorError_IsNotSceneApplication);
|
||||||
pub const INVALID_BOUNDS: CompositorError = CompositorError(sys::EVRCompositorError_VRCompositorError_InvalidBounds);
|
pub const TEXTURE_IS_ON_WRONG_DEVICE: CompositorError =
|
||||||
|
CompositorError(sys::EVRCompositorError_VRCompositorError_TextureIsOnWrongDevice);
|
||||||
|
pub const TEXTURE_USES_UNSUPPORTED_FORMAT: CompositorError =
|
||||||
|
CompositorError(sys::EVRCompositorError_VRCompositorError_TextureUsesUnsupportedFormat);
|
||||||
|
pub const SHARED_TEXTURES_NOT_SUPPORTED: CompositorError =
|
||||||
|
CompositorError(sys::EVRCompositorError_VRCompositorError_SharedTexturesNotSupported);
|
||||||
|
pub const INDEX_OUT_OF_RANGE: CompositorError =
|
||||||
|
CompositorError(sys::EVRCompositorError_VRCompositorError_IndexOutOfRange);
|
||||||
|
pub const ALREADY_SUBMITTED: CompositorError =
|
||||||
|
CompositorError(sys::EVRCompositorError_VRCompositorError_AlreadySubmitted);
|
||||||
|
pub const INVALID_BOUNDS: CompositorError =
|
||||||
|
CompositorError(sys::EVRCompositorError_VRCompositorError_InvalidBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for CompositorError {
|
impl fmt::Debug for CompositorError {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use super::{sys, VkInstance_T, VkDevice_T, VkPhysicalDevice_T, VkQueue_T};
|
use super::{sys, VkDevice_T, VkInstance_T, VkPhysicalDevice_T, VkQueue_T};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct Texture {
|
pub struct Texture {
|
||||||
|
70
src/lib.rs
70
src/lib.rs
@ -2,29 +2,29 @@ extern crate openvr_sys;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
|
|
||||||
use std::sync::atomic::{Ordering, AtomicBool, ATOMIC_BOOL_INIT};
|
|
||||||
use std::{fmt, error, ptr, mem};
|
|
||||||
use std::ffi::{CStr, CString};
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
use std::ffi::{CStr, CString};
|
||||||
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
use std::{error, fmt, mem, ptr};
|
||||||
|
|
||||||
use openvr_sys as sys;
|
use openvr_sys as sys;
|
||||||
|
|
||||||
mod tracking;
|
mod tracking;
|
||||||
|
|
||||||
pub mod system;
|
|
||||||
pub mod compositor;
|
|
||||||
pub mod render_models;
|
|
||||||
pub mod chaperone;
|
pub mod chaperone;
|
||||||
|
pub mod compositor;
|
||||||
pub mod property;
|
pub mod property;
|
||||||
|
pub mod render_models;
|
||||||
|
pub mod system;
|
||||||
|
|
||||||
pub use tracking::*;
|
pub use tracking::*;
|
||||||
|
|
||||||
pub use sys::VkPhysicalDevice_T;
|
|
||||||
pub use sys::VkDevice_T;
|
pub use sys::VkDevice_T;
|
||||||
pub use sys::VkInstance_T;
|
pub use sys::VkInstance_T;
|
||||||
|
pub use sys::VkPhysicalDevice_T;
|
||||||
pub use sys::VkQueue_T;
|
pub use sys::VkQueue_T;
|
||||||
|
|
||||||
static INITIALIZED: AtomicBool = ATOMIC_BOOL_INIT;
|
static INITIALIZED: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
||||||
/// Initialize OpenVR
|
/// Initialize OpenVR
|
||||||
///
|
///
|
||||||
@ -48,9 +48,13 @@ pub unsafe fn init(ty: ApplicationType) -> Result<Context, InitError> {
|
|||||||
}
|
}
|
||||||
if !sys::VR_IsInterfaceVersionValid(sys::IVRSystem_Version.as_ptr() as *const i8) {
|
if !sys::VR_IsInterfaceVersionValid(sys::IVRSystem_Version.as_ptr() as *const i8) {
|
||||||
sys::VR_ShutdownInternal();
|
sys::VR_ShutdownInternal();
|
||||||
return Err(InitError(sys::EVRInitError_VRInitError_Init_InterfaceNotFound));
|
return Err(InitError(
|
||||||
|
sys::EVRInitError_VRInitError_Init_InterfaceNotFound,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Ok(Context { live: Cell::new(true) })
|
Ok(Context {
|
||||||
|
live: Cell::new(true),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct System(&'static sys::VR_IVRSystem_FnTable);
|
pub struct System(&'static sys::VR_IVRSystem_FnTable);
|
||||||
@ -63,7 +67,9 @@ pub struct Chaperone(&'static sys::VR_IVRChaperone_FnTable);
|
|||||||
/// At most one of this object may exist at a time.
|
/// At most one of this object may exist at a time.
|
||||||
///
|
///
|
||||||
/// See safety notes in `init`.
|
/// See safety notes in `init`.
|
||||||
pub struct Context { live: Cell<bool> }
|
pub struct Context {
|
||||||
|
live: Cell<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
fn load<T>(suffix: &[u8]) -> Result<*const T, InitError> {
|
fn load<T>(suffix: &[u8]) -> Result<*const T, InitError> {
|
||||||
let mut magic = Vec::from(b"FnTable:".as_ref());
|
let mut magic = Vec::from(b"FnTable:".as_ref());
|
||||||
@ -71,16 +77,26 @@ fn load<T>(suffix: &[u8]) -> Result<*const T, InitError> {
|
|||||||
let mut error = sys::EVRInitError_VRInitError_None;
|
let mut error = sys::EVRInitError_VRInitError_None;
|
||||||
let result = unsafe { sys::VR_GetGenericInterface(magic.as_ptr() as *const i8, &mut error) };
|
let result = unsafe { sys::VR_GetGenericInterface(magic.as_ptr() as *const i8, &mut error) };
|
||||||
if error != sys::EVRInitError_VRInitError_None {
|
if error != sys::EVRInitError_VRInitError_None {
|
||||||
return Err(InitError(sys::EVRInitError_VRInitError_Init_InterfaceNotFound));
|
return Err(InitError(
|
||||||
|
sys::EVRInitError_VRInitError_Init_InterfaceNotFound,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Ok(result as *const T)
|
Ok(result as *const T)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Context {
|
impl Context {
|
||||||
pub fn system(&self) -> Result<System, InitError> { load(sys::IVRSystem_Version).map(|x| unsafe { System(&*x) }) }
|
pub fn system(&self) -> Result<System, InitError> {
|
||||||
pub fn compositor(&self) -> Result<Compositor, InitError> { load(sys::IVRCompositor_Version).map(|x| unsafe { Compositor(&*x) }) }
|
load(sys::IVRSystem_Version).map(|x| unsafe { System(&*x) })
|
||||||
pub fn render_models(&self) -> Result<RenderModels, InitError> { load(sys::IVRRenderModels_Version).map(|x| unsafe { RenderModels(&*x) }) }
|
}
|
||||||
pub fn chaperone(&self) -> Result<Chaperone, InitError> { load(sys::IVRChaperone_Version).map(|x| unsafe { Chaperone(&*x) }) }
|
pub fn compositor(&self) -> Result<Compositor, InitError> {
|
||||||
|
load(sys::IVRCompositor_Version).map(|x| unsafe { Compositor(&*x) })
|
||||||
|
}
|
||||||
|
pub fn render_models(&self) -> Result<RenderModels, InitError> {
|
||||||
|
load(sys::IVRRenderModels_Version).map(|x| unsafe { RenderModels(&*x) })
|
||||||
|
}
|
||||||
|
pub fn chaperone(&self) -> Result<Chaperone, InitError> {
|
||||||
|
load(sys::IVRChaperone_Version).map(|x| unsafe { Chaperone(&*x) })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Context {
|
impl Drop for Context {
|
||||||
@ -136,19 +152,19 @@ pub struct InitError(sys::EVRInitError);
|
|||||||
|
|
||||||
impl fmt::Debug for InitError {
|
impl fmt::Debug for InitError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let msg = unsafe {
|
let msg = unsafe { CStr::from_ptr(sys::VR_GetVRInitErrorAsSymbol(self.0)) };
|
||||||
CStr::from_ptr(sys::VR_GetVRInitErrorAsSymbol(self.0))
|
f.pad(
|
||||||
};
|
msg.to_str()
|
||||||
f.pad(msg.to_str().expect("OpenVR init error symbol was not valid UTF-8"))
|
.expect("OpenVR init error symbol was not valid UTF-8"),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl error::Error for InitError {
|
impl error::Error for InitError {
|
||||||
fn description(&self) -> &str {
|
fn description(&self) -> &str {
|
||||||
let msg = unsafe {
|
let msg = unsafe { CStr::from_ptr(sys::VR_GetVRInitErrorAsEnglishDescription(self.0)) };
|
||||||
CStr::from_ptr(sys::VR_GetVRInitErrorAsEnglishDescription(self.0))
|
msg.to_str()
|
||||||
};
|
.expect("OpenVR init error description was not valid UTF-8")
|
||||||
msg.to_str().expect("OpenVR init error description was not valid UTF-8")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,13 +183,15 @@ pub enum Eye {
|
|||||||
/// Helper to call OpenVR functions that return strings
|
/// Helper to call OpenVR functions that return strings
|
||||||
unsafe fn get_string<F: FnMut(*mut std::os::raw::c_char, u32) -> u32>(mut f: F) -> Option<CString> {
|
unsafe fn get_string<F: FnMut(*mut std::os::raw::c_char, u32) -> u32>(mut f: F) -> Option<CString> {
|
||||||
let n = f(ptr::null_mut(), 0);
|
let n = f(ptr::null_mut(), 0);
|
||||||
if n == 0 { return None }
|
if n == 0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
let mut storage = Vec::new();
|
let mut storage = Vec::new();
|
||||||
storage.reserve_exact(n as usize);
|
storage.reserve_exact(n as usize);
|
||||||
storage.resize(n as usize, mem::uninitialized());
|
storage.resize(n as usize, mem::uninitialized());
|
||||||
let n_ = f(storage.as_mut_ptr() as *mut _, n);
|
let n_ = f(storage.as_mut_ptr() as *mut _, n);
|
||||||
assert!(n == n_);
|
assert!(n == n_);
|
||||||
storage.truncate((n-1) as usize); // Strip trailing null
|
storage.truncate((n - 1) as usize); // Strip trailing null
|
||||||
Some(CString::from_vec_unchecked(storage))
|
Some(CString::from_vec_unchecked(storage))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
335
src/property.rs
335
src/property.rs
@ -1,123 +1,234 @@
|
|||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
|
|
||||||
use openvr_sys as sys;
|
|
||||||
use super::TrackedDeviceProperty;
|
use super::TrackedDeviceProperty;
|
||||||
|
use openvr_sys as sys;
|
||||||
|
|
||||||
pub const Invalid: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Invalid;
|
pub const Invalid: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Invalid;
|
||||||
pub const TrackingSystemName_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_TrackingSystemName_String;
|
pub const TrackingSystemName_String: TrackedDeviceProperty =
|
||||||
pub const ModelNumber_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ModelNumber_String;
|
sys::ETrackedDeviceProperty_Prop_TrackingSystemName_String;
|
||||||
pub const SerialNumber_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_SerialNumber_String;
|
pub const ModelNumber_String: TrackedDeviceProperty =
|
||||||
pub const RenderModelName_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_RenderModelName_String;
|
sys::ETrackedDeviceProperty_Prop_ModelNumber_String;
|
||||||
pub const WillDriftInYaw_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_WillDriftInYaw_Bool;
|
pub const SerialNumber_String: TrackedDeviceProperty =
|
||||||
pub const ManufacturerName_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ManufacturerName_String;
|
sys::ETrackedDeviceProperty_Prop_SerialNumber_String;
|
||||||
pub const TrackingFirmwareVersion_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_TrackingFirmwareVersion_String;
|
pub const RenderModelName_String: TrackedDeviceProperty =
|
||||||
pub const HardwareRevision_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_HardwareRevision_String;
|
sys::ETrackedDeviceProperty_Prop_RenderModelName_String;
|
||||||
pub const AllWirelessDongleDescriptions_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_AllWirelessDongleDescriptions_String;
|
pub const WillDriftInYaw_Bool: TrackedDeviceProperty =
|
||||||
pub const ConnectedWirelessDongle_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ConnectedWirelessDongle_String;
|
sys::ETrackedDeviceProperty_Prop_WillDriftInYaw_Bool;
|
||||||
pub const DeviceIsWireless_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DeviceIsWireless_Bool;
|
pub const ManufacturerName_String: TrackedDeviceProperty =
|
||||||
pub const DeviceIsCharging_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DeviceIsCharging_Bool;
|
sys::ETrackedDeviceProperty_Prop_ManufacturerName_String;
|
||||||
pub const DeviceBatteryPercentage_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DeviceBatteryPercentage_Float;
|
pub const TrackingFirmwareVersion_String: TrackedDeviceProperty =
|
||||||
pub const StatusDisplayTransform_Matrix34: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_StatusDisplayTransform_Matrix34;
|
sys::ETrackedDeviceProperty_Prop_TrackingFirmwareVersion_String;
|
||||||
pub const Firmware_UpdateAvailable_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Firmware_UpdateAvailable_Bool;
|
pub const HardwareRevision_String: TrackedDeviceProperty =
|
||||||
pub const Firmware_ManualUpdate_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Firmware_ManualUpdate_Bool;
|
sys::ETrackedDeviceProperty_Prop_HardwareRevision_String;
|
||||||
pub const Firmware_ManualUpdateURL_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Firmware_ManualUpdateURL_String;
|
pub const AllWirelessDongleDescriptions_String: TrackedDeviceProperty =
|
||||||
pub const HardwareRevision_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_HardwareRevision_Uint64;
|
sys::ETrackedDeviceProperty_Prop_AllWirelessDongleDescriptions_String;
|
||||||
pub const FirmwareVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_FirmwareVersion_Uint64;
|
pub const ConnectedWirelessDongle_String: TrackedDeviceProperty =
|
||||||
pub const FPGAVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_FPGAVersion_Uint64;
|
sys::ETrackedDeviceProperty_Prop_ConnectedWirelessDongle_String;
|
||||||
pub const VRCVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_VRCVersion_Uint64;
|
pub const DeviceIsWireless_Bool: TrackedDeviceProperty =
|
||||||
pub const RadioVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_RadioVersion_Uint64;
|
sys::ETrackedDeviceProperty_Prop_DeviceIsWireless_Bool;
|
||||||
pub const DongleVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DongleVersion_Uint64;
|
pub const DeviceIsCharging_Bool: TrackedDeviceProperty =
|
||||||
pub const BlockServerShutdown_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_BlockServerShutdown_Bool;
|
sys::ETrackedDeviceProperty_Prop_DeviceIsCharging_Bool;
|
||||||
pub const CanUnifyCoordinateSystemWithHmd_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_CanUnifyCoordinateSystemWithHmd_Bool;
|
pub const DeviceBatteryPercentage_Float: TrackedDeviceProperty =
|
||||||
pub const ContainsProximitySensor_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ContainsProximitySensor_Bool;
|
sys::ETrackedDeviceProperty_Prop_DeviceBatteryPercentage_Float;
|
||||||
pub const DeviceProvidesBatteryStatus_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DeviceProvidesBatteryStatus_Bool;
|
pub const StatusDisplayTransform_Matrix34: TrackedDeviceProperty =
|
||||||
pub const DeviceCanPowerOff_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DeviceCanPowerOff_Bool;
|
sys::ETrackedDeviceProperty_Prop_StatusDisplayTransform_Matrix34;
|
||||||
pub const Firmware_ProgrammingTarget_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Firmware_ProgrammingTarget_String;
|
pub const Firmware_UpdateAvailable_Bool: TrackedDeviceProperty =
|
||||||
pub const DeviceClass_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DeviceClass_Int32;
|
sys::ETrackedDeviceProperty_Prop_Firmware_UpdateAvailable_Bool;
|
||||||
|
pub const Firmware_ManualUpdate_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_Firmware_ManualUpdate_Bool;
|
||||||
|
pub const Firmware_ManualUpdateURL_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_Firmware_ManualUpdateURL_String;
|
||||||
|
pub const HardwareRevision_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_HardwareRevision_Uint64;
|
||||||
|
pub const FirmwareVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_FirmwareVersion_Uint64;
|
||||||
|
pub const FPGAVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_FPGAVersion_Uint64;
|
||||||
|
pub const VRCVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_VRCVersion_Uint64;
|
||||||
|
pub const RadioVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_RadioVersion_Uint64;
|
||||||
|
pub const DongleVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DongleVersion_Uint64;
|
||||||
|
pub const BlockServerShutdown_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_BlockServerShutdown_Bool;
|
||||||
|
pub const CanUnifyCoordinateSystemWithHmd_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_CanUnifyCoordinateSystemWithHmd_Bool;
|
||||||
|
pub const ContainsProximitySensor_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_ContainsProximitySensor_Bool;
|
||||||
|
pub const DeviceProvidesBatteryStatus_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DeviceProvidesBatteryStatus_Bool;
|
||||||
|
pub const DeviceCanPowerOff_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DeviceCanPowerOff_Bool;
|
||||||
|
pub const Firmware_ProgrammingTarget_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_Firmware_ProgrammingTarget_String;
|
||||||
|
pub const DeviceClass_Int32: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DeviceClass_Int32;
|
||||||
pub const HasCamera_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_HasCamera_Bool;
|
pub const HasCamera_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_HasCamera_Bool;
|
||||||
pub const DriverVersion_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DriverVersion_String;
|
pub const DriverVersion_String: TrackedDeviceProperty =
|
||||||
pub const Firmware_ForceUpdateRequired_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Firmware_ForceUpdateRequired_Bool;
|
sys::ETrackedDeviceProperty_Prop_DriverVersion_String;
|
||||||
pub const ViveSystemButtonFixRequired_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ViveSystemButtonFixRequired_Bool;
|
pub const Firmware_ForceUpdateRequired_Bool: TrackedDeviceProperty =
|
||||||
pub const ParentDriver_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ParentDriver_Uint64;
|
sys::ETrackedDeviceProperty_Prop_Firmware_ForceUpdateRequired_Bool;
|
||||||
pub const ResourceRoot_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ResourceRoot_String;
|
pub const ViveSystemButtonFixRequired_Bool: TrackedDeviceProperty =
|
||||||
pub const ReportsTimeSinceVSync_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ReportsTimeSinceVSync_Bool;
|
sys::ETrackedDeviceProperty_Prop_ViveSystemButtonFixRequired_Bool;
|
||||||
pub const SecondsFromVsyncToPhotons_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_SecondsFromVsyncToPhotons_Float;
|
pub const ParentDriver_Uint64: TrackedDeviceProperty =
|
||||||
pub const DisplayFrequency_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayFrequency_Float;
|
sys::ETrackedDeviceProperty_Prop_ParentDriver_Uint64;
|
||||||
pub const UserIpdMeters_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_UserIpdMeters_Float;
|
pub const ResourceRoot_String: TrackedDeviceProperty =
|
||||||
pub const CurrentUniverseId_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_CurrentUniverseId_Uint64;
|
sys::ETrackedDeviceProperty_Prop_ResourceRoot_String;
|
||||||
pub const PreviousUniverseId_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_PreviousUniverseId_Uint64;
|
pub const ReportsTimeSinceVSync_Bool: TrackedDeviceProperty =
|
||||||
pub const DisplayFirmwareVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayFirmwareVersion_Uint64;
|
sys::ETrackedDeviceProperty_Prop_ReportsTimeSinceVSync_Bool;
|
||||||
pub const IsOnDesktop_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_IsOnDesktop_Bool;
|
pub const SecondsFromVsyncToPhotons_Float: TrackedDeviceProperty =
|
||||||
pub const DisplayMCType_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayMCType_Int32;
|
sys::ETrackedDeviceProperty_Prop_SecondsFromVsyncToPhotons_Float;
|
||||||
pub const DisplayMCOffset_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayMCOffset_Float;
|
pub const DisplayFrequency_Float: TrackedDeviceProperty =
|
||||||
pub const DisplayMCScale_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayMCScale_Float;
|
sys::ETrackedDeviceProperty_Prop_DisplayFrequency_Float;
|
||||||
pub const EdidVendorID_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_EdidVendorID_Int32;
|
pub const UserIpdMeters_Float: TrackedDeviceProperty =
|
||||||
pub const DisplayMCImageLeft_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayMCImageLeft_String;
|
sys::ETrackedDeviceProperty_Prop_UserIpdMeters_Float;
|
||||||
pub const DisplayMCImageRight_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayMCImageRight_String;
|
pub const CurrentUniverseId_Uint64: TrackedDeviceProperty =
|
||||||
pub const DisplayGCBlackClamp_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayGCBlackClamp_Float;
|
sys::ETrackedDeviceProperty_Prop_CurrentUniverseId_Uint64;
|
||||||
pub const EdidProductID_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_EdidProductID_Int32;
|
pub const PreviousUniverseId_Uint64: TrackedDeviceProperty =
|
||||||
pub const CameraToHeadTransform_Matrix34: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_CameraToHeadTransform_Matrix34;
|
sys::ETrackedDeviceProperty_Prop_PreviousUniverseId_Uint64;
|
||||||
pub const DisplayGCType_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayGCType_Int32;
|
pub const DisplayFirmwareVersion_Uint64: TrackedDeviceProperty =
|
||||||
pub const DisplayGCOffset_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayGCOffset_Float;
|
sys::ETrackedDeviceProperty_Prop_DisplayFirmwareVersion_Uint64;
|
||||||
pub const DisplayGCScale_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayGCScale_Float;
|
pub const IsOnDesktop_Bool: TrackedDeviceProperty =
|
||||||
pub const DisplayGCPrescale_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayGCPrescale_Float;
|
sys::ETrackedDeviceProperty_Prop_IsOnDesktop_Bool;
|
||||||
pub const DisplayGCImage_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayGCImage_String;
|
pub const DisplayMCType_Int32: TrackedDeviceProperty =
|
||||||
pub const LensCenterLeftU_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_LensCenterLeftU_Float;
|
sys::ETrackedDeviceProperty_Prop_DisplayMCType_Int32;
|
||||||
pub const LensCenterLeftV_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_LensCenterLeftV_Float;
|
pub const DisplayMCOffset_Float: TrackedDeviceProperty =
|
||||||
pub const LensCenterRightU_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_LensCenterRightU_Float;
|
sys::ETrackedDeviceProperty_Prop_DisplayMCOffset_Float;
|
||||||
pub const LensCenterRightV_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_LensCenterRightV_Float;
|
pub const DisplayMCScale_Float: TrackedDeviceProperty =
|
||||||
pub const UserHeadToEyeDepthMeters_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_UserHeadToEyeDepthMeters_Float;
|
sys::ETrackedDeviceProperty_Prop_DisplayMCScale_Float;
|
||||||
pub const CameraFirmwareVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_CameraFirmwareVersion_Uint64;
|
pub const EdidVendorID_Int32: TrackedDeviceProperty =
|
||||||
pub const CameraFirmwareDescription_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_CameraFirmwareDescription_String;
|
sys::ETrackedDeviceProperty_Prop_EdidVendorID_Int32;
|
||||||
pub const DisplayFPGAVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayFPGAVersion_Uint64;
|
pub const DisplayMCImageLeft_String: TrackedDeviceProperty =
|
||||||
pub const DisplayBootloaderVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayBootloaderVersion_Uint64;
|
sys::ETrackedDeviceProperty_Prop_DisplayMCImageLeft_String;
|
||||||
pub const DisplayHardwareVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayHardwareVersion_Uint64;
|
pub const DisplayMCImageRight_String: TrackedDeviceProperty =
|
||||||
pub const AudioFirmwareVersion_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_AudioFirmwareVersion_Uint64;
|
sys::ETrackedDeviceProperty_Prop_DisplayMCImageRight_String;
|
||||||
pub const CameraCompatibilityMode_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_CameraCompatibilityMode_Int32;
|
pub const DisplayGCBlackClamp_Float: TrackedDeviceProperty =
|
||||||
pub const ScreenshotHorizontalFieldOfViewDegrees_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ScreenshotHorizontalFieldOfViewDegrees_Float;
|
sys::ETrackedDeviceProperty_Prop_DisplayGCBlackClamp_Float;
|
||||||
pub const ScreenshotVerticalFieldOfViewDegrees_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ScreenshotVerticalFieldOfViewDegrees_Float;
|
pub const EdidProductID_Int32: TrackedDeviceProperty =
|
||||||
pub const DisplaySuppressed_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplaySuppressed_Bool;
|
sys::ETrackedDeviceProperty_Prop_EdidProductID_Int32;
|
||||||
pub const DisplayAllowNightMode_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayAllowNightMode_Bool;
|
pub const CameraToHeadTransform_Matrix34: TrackedDeviceProperty =
|
||||||
pub const DisplayMCImageWidth_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayMCImageWidth_Int32;
|
sys::ETrackedDeviceProperty_Prop_CameraToHeadTransform_Matrix34;
|
||||||
pub const DisplayMCImageHeight_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayMCImageHeight_Int32;
|
pub const DisplayGCType_Int32: TrackedDeviceProperty =
|
||||||
pub const DisplayMCImageNumChannels_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayMCImageNumChannels_Int32;
|
sys::ETrackedDeviceProperty_Prop_DisplayGCType_Int32;
|
||||||
pub const DisplayMCImageData_Binary: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayMCImageData_Binary;
|
pub const DisplayGCOffset_Float: TrackedDeviceProperty =
|
||||||
pub const SecondsFromPhotonsToVblank_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_SecondsFromPhotonsToVblank_Float;
|
sys::ETrackedDeviceProperty_Prop_DisplayGCOffset_Float;
|
||||||
pub const DriverDirectModeSendsVsyncEvents_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DriverDirectModeSendsVsyncEvents_Bool;
|
pub const DisplayGCScale_Float: TrackedDeviceProperty =
|
||||||
pub const DisplayDebugMode_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayDebugMode_Bool;
|
sys::ETrackedDeviceProperty_Prop_DisplayGCScale_Float;
|
||||||
pub const GraphicsAdapterLuid_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_GraphicsAdapterLuid_Uint64;
|
pub const DisplayGCPrescale_Float: TrackedDeviceProperty =
|
||||||
pub const AttachedDeviceId_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_AttachedDeviceId_String;
|
sys::ETrackedDeviceProperty_Prop_DisplayGCPrescale_Float;
|
||||||
pub const SupportedButtons_Uint64: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_SupportedButtons_Uint64;
|
pub const DisplayGCImage_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayGCImage_String;
|
||||||
|
pub const LensCenterLeftU_Float: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_LensCenterLeftU_Float;
|
||||||
|
pub const LensCenterLeftV_Float: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_LensCenterLeftV_Float;
|
||||||
|
pub const LensCenterRightU_Float: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_LensCenterRightU_Float;
|
||||||
|
pub const LensCenterRightV_Float: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_LensCenterRightV_Float;
|
||||||
|
pub const UserHeadToEyeDepthMeters_Float: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_UserHeadToEyeDepthMeters_Float;
|
||||||
|
pub const CameraFirmwareVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_CameraFirmwareVersion_Uint64;
|
||||||
|
pub const CameraFirmwareDescription_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_CameraFirmwareDescription_String;
|
||||||
|
pub const DisplayFPGAVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayFPGAVersion_Uint64;
|
||||||
|
pub const DisplayBootloaderVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayBootloaderVersion_Uint64;
|
||||||
|
pub const DisplayHardwareVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayHardwareVersion_Uint64;
|
||||||
|
pub const AudioFirmwareVersion_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_AudioFirmwareVersion_Uint64;
|
||||||
|
pub const CameraCompatibilityMode_Int32: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_CameraCompatibilityMode_Int32;
|
||||||
|
pub const ScreenshotHorizontalFieldOfViewDegrees_Float: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_ScreenshotHorizontalFieldOfViewDegrees_Float;
|
||||||
|
pub const ScreenshotVerticalFieldOfViewDegrees_Float: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_ScreenshotVerticalFieldOfViewDegrees_Float;
|
||||||
|
pub const DisplaySuppressed_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplaySuppressed_Bool;
|
||||||
|
pub const DisplayAllowNightMode_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayAllowNightMode_Bool;
|
||||||
|
pub const DisplayMCImageWidth_Int32: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayMCImageWidth_Int32;
|
||||||
|
pub const DisplayMCImageHeight_Int32: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayMCImageHeight_Int32;
|
||||||
|
pub const DisplayMCImageNumChannels_Int32: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayMCImageNumChannels_Int32;
|
||||||
|
pub const DisplayMCImageData_Binary: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayMCImageData_Binary;
|
||||||
|
pub const SecondsFromPhotonsToVblank_Float: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_SecondsFromPhotonsToVblank_Float;
|
||||||
|
pub const DriverDirectModeSendsVsyncEvents_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DriverDirectModeSendsVsyncEvents_Bool;
|
||||||
|
pub const DisplayDebugMode_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayDebugMode_Bool;
|
||||||
|
pub const GraphicsAdapterLuid_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_GraphicsAdapterLuid_Uint64;
|
||||||
|
pub const AttachedDeviceId_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_AttachedDeviceId_String;
|
||||||
|
pub const SupportedButtons_Uint64: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_SupportedButtons_Uint64;
|
||||||
pub const Axis0Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis0Type_Int32;
|
pub const Axis0Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis0Type_Int32;
|
||||||
pub const Axis1Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis1Type_Int32;
|
pub const Axis1Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis1Type_Int32;
|
||||||
pub const Axis2Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis2Type_Int32;
|
pub const Axis2Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis2Type_Int32;
|
||||||
pub const Axis3Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis3Type_Int32;
|
pub const Axis3Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis3Type_Int32;
|
||||||
pub const Axis4Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis4Type_Int32;
|
pub const Axis4Type_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_Axis4Type_Int32;
|
||||||
pub const ControllerRoleHint_Int32: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ControllerRoleHint_Int32;
|
pub const ControllerRoleHint_Int32: TrackedDeviceProperty =
|
||||||
pub const FieldOfViewLeftDegrees_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_FieldOfViewLeftDegrees_Float;
|
sys::ETrackedDeviceProperty_Prop_ControllerRoleHint_Int32;
|
||||||
pub const FieldOfViewRightDegrees_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_FieldOfViewRightDegrees_Float;
|
pub const FieldOfViewLeftDegrees_Float: TrackedDeviceProperty =
|
||||||
pub const FieldOfViewTopDegrees_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_FieldOfViewTopDegrees_Float;
|
sys::ETrackedDeviceProperty_Prop_FieldOfViewLeftDegrees_Float;
|
||||||
pub const FieldOfViewBottomDegrees_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_FieldOfViewBottomDegrees_Float;
|
pub const FieldOfViewRightDegrees_Float: TrackedDeviceProperty =
|
||||||
pub const TrackingRangeMinimumMeters_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_TrackingRangeMinimumMeters_Float;
|
sys::ETrackedDeviceProperty_Prop_FieldOfViewRightDegrees_Float;
|
||||||
pub const TrackingRangeMaximumMeters_Float: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_TrackingRangeMaximumMeters_Float;
|
pub const FieldOfViewTopDegrees_Float: TrackedDeviceProperty =
|
||||||
pub const ModeLabel_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_ModeLabel_String;
|
sys::ETrackedDeviceProperty_Prop_FieldOfViewTopDegrees_Float;
|
||||||
pub const IconPathName_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_IconPathName_String;
|
pub const FieldOfViewBottomDegrees_Float: TrackedDeviceProperty =
|
||||||
pub const NamedIconPathDeviceOff_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceOff_String;
|
sys::ETrackedDeviceProperty_Prop_FieldOfViewBottomDegrees_Float;
|
||||||
pub const NamedIconPathDeviceSearching_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceSearching_String;
|
pub const TrackingRangeMinimumMeters_Float: TrackedDeviceProperty =
|
||||||
pub const NamedIconPathDeviceSearchingAlert_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceSearchingAlert_String;
|
sys::ETrackedDeviceProperty_Prop_TrackingRangeMinimumMeters_Float;
|
||||||
pub const NamedIconPathDeviceReady_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceReady_String;
|
pub const TrackingRangeMaximumMeters_Float: TrackedDeviceProperty =
|
||||||
pub const NamedIconPathDeviceReadyAlert_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceReadyAlert_String;
|
sys::ETrackedDeviceProperty_Prop_TrackingRangeMaximumMeters_Float;
|
||||||
pub const NamedIconPathDeviceNotReady_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceNotReady_String;
|
pub const ModeLabel_String: TrackedDeviceProperty =
|
||||||
pub const NamedIconPathDeviceStandby_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceStandby_String;
|
sys::ETrackedDeviceProperty_Prop_ModeLabel_String;
|
||||||
pub const NamedIconPathDeviceAlertLow_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceAlertLow_String;
|
pub const IconPathName_String: TrackedDeviceProperty =
|
||||||
pub const DisplayHiddenArea_Binary_Start: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayHiddenArea_Binary_Start;
|
sys::ETrackedDeviceProperty_Prop_IconPathName_String;
|
||||||
pub const DisplayHiddenArea_Binary_End: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_DisplayHiddenArea_Binary_End;
|
pub const NamedIconPathDeviceOff_String: TrackedDeviceProperty =
|
||||||
pub const UserConfigPath_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_UserConfigPath_String;
|
sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceOff_String;
|
||||||
pub const InstallPath_String: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_InstallPath_String;
|
pub const NamedIconPathDeviceSearching_String: TrackedDeviceProperty =
|
||||||
pub const HasDisplayComponent_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_HasDisplayComponent_Bool;
|
sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceSearching_String;
|
||||||
pub const HasControllerComponent_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_HasControllerComponent_Bool;
|
pub const NamedIconPathDeviceSearchingAlert_String: TrackedDeviceProperty =
|
||||||
pub const HasCameraComponent_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_HasCameraComponent_Bool;
|
sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceSearchingAlert_String;
|
||||||
pub const HasDriverDirectModeComponent_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_HasDriverDirectModeComponent_Bool;
|
pub const NamedIconPathDeviceReady_String: TrackedDeviceProperty =
|
||||||
pub const HasVirtualDisplayComponent_Bool: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_HasVirtualDisplayComponent_Bool;
|
sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceReady_String;
|
||||||
pub const VendorSpecific_Reserved_Start: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_VendorSpecific_Reserved_Start;
|
pub const NamedIconPathDeviceReadyAlert_String: TrackedDeviceProperty =
|
||||||
pub const VendorSpecific_Reserved_End: TrackedDeviceProperty = sys::ETrackedDeviceProperty_Prop_VendorSpecific_Reserved_End;
|
sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceReadyAlert_String;
|
||||||
|
pub const NamedIconPathDeviceNotReady_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceNotReady_String;
|
||||||
|
pub const NamedIconPathDeviceStandby_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceStandby_String;
|
||||||
|
pub const NamedIconPathDeviceAlertLow_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_NamedIconPathDeviceAlertLow_String;
|
||||||
|
pub const DisplayHiddenArea_Binary_Start: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayHiddenArea_Binary_Start;
|
||||||
|
pub const DisplayHiddenArea_Binary_End: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_DisplayHiddenArea_Binary_End;
|
||||||
|
pub const UserConfigPath_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_UserConfigPath_String;
|
||||||
|
pub const InstallPath_String: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_InstallPath_String;
|
||||||
|
pub const HasDisplayComponent_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_HasDisplayComponent_Bool;
|
||||||
|
pub const HasControllerComponent_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_HasControllerComponent_Bool;
|
||||||
|
pub const HasCameraComponent_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_HasCameraComponent_Bool;
|
||||||
|
pub const HasDriverDirectModeComponent_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_HasDriverDirectModeComponent_Bool;
|
||||||
|
pub const HasVirtualDisplayComponent_Bool: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_HasVirtualDisplayComponent_Bool;
|
||||||
|
pub const VendorSpecific_Reserved_Start: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_VendorSpecific_Reserved_Start;
|
||||||
|
pub const VendorSpecific_Reserved_End: TrackedDeviceProperty =
|
||||||
|
sys::ETrackedDeviceProperty_Prop_VendorSpecific_Reserved_End;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use std::{fmt, ptr, slice, mem};
|
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
|
use std::{fmt, mem, ptr, slice};
|
||||||
|
|
||||||
use openvr_sys as sys;
|
use openvr_sys as sys;
|
||||||
|
|
||||||
use {RenderModels, ControllerState, get_string};
|
use {get_string, ControllerState, RenderModels};
|
||||||
|
|
||||||
impl RenderModels {
|
impl RenderModels {
|
||||||
/// Loads and returns a render model for use in the application. `name` should be a render model name from the
|
/// Loads and returns a render model for use in the application. `name` should be a render model name from the
|
||||||
@ -13,11 +13,12 @@ impl RenderModels {
|
|||||||
/// it returns `Ok(Some(model))`.
|
/// it returns `Ok(Some(model))`.
|
||||||
pub fn load_render_model(&self, name: &CStr) -> Result<Option<Model>> {
|
pub fn load_render_model(&self, name: &CStr) -> Result<Option<Model>> {
|
||||||
let mut ptr = ptr::null_mut();
|
let mut ptr = ptr::null_mut();
|
||||||
let r = unsafe {
|
let r = unsafe { self.0.LoadRenderModel_Async.unwrap()(name.as_ptr() as *mut _, &mut ptr) };
|
||||||
self.0.LoadRenderModel_Async.unwrap()(name.as_ptr() as *mut _, &mut ptr)
|
|
||||||
};
|
|
||||||
match Error(r) {
|
match Error(r) {
|
||||||
error::NONE => Ok(Some(Model { ptr: ptr, sys: self.0 })),
|
error::NONE => Ok(Some(Model {
|
||||||
|
ptr: ptr,
|
||||||
|
sys: self.0,
|
||||||
|
})),
|
||||||
error::LOADING => Ok(None),
|
error::LOADING => Ok(None),
|
||||||
x => Err(x),
|
x => Err(x),
|
||||||
}
|
}
|
||||||
@ -40,13 +41,24 @@ impl RenderModels {
|
|||||||
/// `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.
|
/// components. If it's out of range, this function will return None.
|
||||||
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)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets all component names of a given model
|
/// Gets all component names of a given model
|
||||||
pub fn component_names(&self, model: &CStr) -> ::std::vec::IntoIter<CString> { // FIXME: impl Iterator rather than allocating
|
pub fn component_names(&self, model: &CStr) -> ::std::vec::IntoIter<CString> {
|
||||||
|
// FIXME: impl Iterator rather than allocating
|
||||||
let n = self.component_count(model);
|
let n = self.component_count(model);
|
||||||
(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 rendermodel/component combination, to be passed to
|
/// Use this to get the render model name for the specified rendermodel/component combination, to be passed to
|
||||||
@ -56,8 +68,14 @@ impl RenderModels {
|
|||||||
/// Otherwise, it will return the size of the buffer required for the name.
|
/// Otherwise, it will return the size of the buffer required for the name.
|
||||||
pub fn component_render_model_name(&self, model: &CStr, component: &CStr) -> Option<CString> {
|
pub fn component_render_model_name(&self, model: &CStr, component: &CStr) -> Option<CString> {
|
||||||
unsafe {
|
unsafe {
|
||||||
get_string(|ptr, n| self.0.GetComponentRenderModelName.unwrap()(
|
get_string(|ptr, n| {
|
||||||
model.as_ptr() as *mut _, component.as_ptr() as *mut _, ptr, n))
|
self.0.GetComponentRenderModelName.unwrap()(
|
||||||
|
model.as_ptr() as *mut _,
|
||||||
|
component.as_ptr() as *mut _,
|
||||||
|
ptr,
|
||||||
|
n,
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,12 +87,22 @@ impl RenderModels {
|
|||||||
///
|
///
|
||||||
/// For dynamic controller components (ex: trigger) values will reflect component motions.
|
/// For dynamic controller components (ex: trigger) values will reflect component motions.
|
||||||
/// For static components this will return a consistent value independent of the `ControllerState`.
|
/// 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();
|
||||||
if self.0.GetComponentState.unwrap()(model.as_ptr() as *mut _, component.as_ptr() as *mut _,
|
if self.0.GetComponentState.unwrap()(
|
||||||
state as *const _ as *mut _, mode as *const _ as *mut _,
|
model.as_ptr() as *mut _,
|
||||||
&mut out as *mut _ as *mut _) {
|
component.as_ptr() as *mut _,
|
||||||
|
state as *const _ as *mut _,
|
||||||
|
mode as *const _ as *mut _,
|
||||||
|
&mut out as *mut _ as *mut _,
|
||||||
|
) {
|
||||||
Some(out)
|
Some(out)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -89,11 +117,12 @@ impl RenderModels {
|
|||||||
/// returns `Ok(Some(texture))`.
|
/// returns `Ok(Some(texture))`.
|
||||||
pub fn load_texture(&self, id: TextureId) -> Result<Option<Texture>> {
|
pub fn load_texture(&self, id: TextureId) -> Result<Option<Texture>> {
|
||||||
let mut ptr = ptr::null_mut();
|
let mut ptr = ptr::null_mut();
|
||||||
let r = unsafe {
|
let r = unsafe { self.0.LoadTexture_Async.unwrap()(id, &mut ptr) };
|
||||||
self.0.LoadTexture_Async.unwrap()(id, &mut ptr)
|
|
||||||
};
|
|
||||||
match Error(r) {
|
match Error(r) {
|
||||||
error::NONE => Ok(Some(Texture { ptr: ptr, sys: self.0 })),
|
error::NONE => Ok(Some(Texture {
|
||||||
|
ptr: ptr,
|
||||||
|
sys: self.0,
|
||||||
|
})),
|
||||||
error::LOADING => Ok(None),
|
error::LOADING => Ok(None),
|
||||||
x => Err(x),
|
x => Err(x),
|
||||||
}
|
}
|
||||||
@ -108,17 +137,26 @@ pub mod error {
|
|||||||
|
|
||||||
pub const NONE: Error = Error(sys::EVRRenderModelError_VRRenderModelError_None);
|
pub const NONE: Error = Error(sys::EVRRenderModelError_VRRenderModelError_None);
|
||||||
pub const LOADING: Error = Error(sys::EVRRenderModelError_VRRenderModelError_Loading);
|
pub const LOADING: Error = Error(sys::EVRRenderModelError_VRRenderModelError_Loading);
|
||||||
pub const NOT_SUPPORTED: Error = Error(sys::EVRRenderModelError_VRRenderModelError_NotSupported);
|
pub const NOT_SUPPORTED: Error =
|
||||||
|
Error(sys::EVRRenderModelError_VRRenderModelError_NotSupported);
|
||||||
pub const INVALID_ARG: Error = Error(sys::EVRRenderModelError_VRRenderModelError_InvalidArg);
|
pub const INVALID_ARG: Error = Error(sys::EVRRenderModelError_VRRenderModelError_InvalidArg);
|
||||||
pub const INVALID_MODEL: Error = Error(sys::EVRRenderModelError_VRRenderModelError_InvalidModel);
|
pub const INVALID_MODEL: Error =
|
||||||
|
Error(sys::EVRRenderModelError_VRRenderModelError_InvalidModel);
|
||||||
pub const NO_SHAPES: Error = Error(sys::EVRRenderModelError_VRRenderModelError_NoShapes);
|
pub const NO_SHAPES: Error = Error(sys::EVRRenderModelError_VRRenderModelError_NoShapes);
|
||||||
pub const MULTIPLE_SHAPES: Error = Error(sys::EVRRenderModelError_VRRenderModelError_MultipleShapes);
|
pub const MULTIPLE_SHAPES: Error =
|
||||||
pub const TOO_MANY_VERTICES: Error = Error(sys::EVRRenderModelError_VRRenderModelError_TooManyVertices);
|
Error(sys::EVRRenderModelError_VRRenderModelError_MultipleShapes);
|
||||||
pub const MULTIPLE_TEXTURES: Error = Error(sys::EVRRenderModelError_VRRenderModelError_MultipleTextures);
|
pub const TOO_MANY_VERTICES: Error =
|
||||||
pub const BUFFER_TOO_SMALL: Error = Error(sys::EVRRenderModelError_VRRenderModelError_BufferTooSmall);
|
Error(sys::EVRRenderModelError_VRRenderModelError_TooManyVertices);
|
||||||
pub const NOT_ENOUGH_NORMALS: Error = Error(sys::EVRRenderModelError_VRRenderModelError_NotEnoughNormals);
|
pub const MULTIPLE_TEXTURES: Error =
|
||||||
pub const NOT_ENOUGH_TEX_COORDS: Error = Error(sys::EVRRenderModelError_VRRenderModelError_NotEnoughTexCoords);
|
Error(sys::EVRRenderModelError_VRRenderModelError_MultipleTextures);
|
||||||
pub const INVALID_TEXTURE: Error = Error(sys::EVRRenderModelError_VRRenderModelError_InvalidTexture);
|
pub const BUFFER_TOO_SMALL: Error =
|
||||||
|
Error(sys::EVRRenderModelError_VRRenderModelError_BufferTooSmall);
|
||||||
|
pub const NOT_ENOUGH_NORMALS: Error =
|
||||||
|
Error(sys::EVRRenderModelError_VRRenderModelError_NotEnoughNormals);
|
||||||
|
pub const NOT_ENOUGH_TEX_COORDS: Error =
|
||||||
|
Error(sys::EVRRenderModelError_VRRenderModelError_NotEnoughTexCoords);
|
||||||
|
pub const INVALID_TEXTURE: Error =
|
||||||
|
Error(sys::EVRRenderModelError_VRRenderModelError_InvalidTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Error {
|
impl fmt::Debug for Error {
|
||||||
@ -167,7 +205,10 @@ impl<'a> Model<'a> {
|
|||||||
pub fn vertices(&self) -> &[Vertex] {
|
pub fn vertices(&self) -> &[Vertex] {
|
||||||
unsafe {
|
unsafe {
|
||||||
let model = &*self.ptr;
|
let model = &*self.ptr;
|
||||||
slice::from_raw_parts(model.rVertexData as *mut Vertex, model.unVertexCount as usize)
|
slice::from_raw_parts(
|
||||||
|
model.rVertexData as *mut Vertex,
|
||||||
|
model.unVertexCount as usize,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,12 +221,18 @@ impl<'a> Model<'a> {
|
|||||||
|
|
||||||
pub fn diffuse_texture_id(&self) -> Option<TextureId> {
|
pub fn diffuse_texture_id(&self) -> Option<TextureId> {
|
||||||
let id = unsafe { (&*self.ptr).diffuseTextureId };
|
let id = unsafe { (&*self.ptr).diffuseTextureId };
|
||||||
if id < 0 { None } else { Some(id) }
|
if id < 0 {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Drop for Model<'a> {
|
impl<'a> Drop for Model<'a> {
|
||||||
fn drop(&mut self) { unsafe { self.sys.FreeRenderModel.unwrap()(self.ptr) } }
|
fn drop(&mut self) {
|
||||||
|
unsafe { self.sys.FreeRenderModel.unwrap()(self.ptr) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Texture<'a> {
|
pub struct Texture<'a> {
|
||||||
@ -203,13 +250,18 @@ impl<'a> Texture<'a> {
|
|||||||
pub fn data(&self) -> &[u8] {
|
pub fn data(&self) -> &[u8] {
|
||||||
unsafe {
|
unsafe {
|
||||||
let tex = &*self.ptr;
|
let tex = &*self.ptr;
|
||||||
slice::from_raw_parts(tex.rubTextureMapData, tex.unWidth as usize * tex.unHeight as usize * 4)
|
slice::from_raw_parts(
|
||||||
|
tex.rubTextureMapData,
|
||||||
|
tex.unWidth as usize * tex.unHeight as usize * 4,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Drop for Texture<'a> {
|
impl<'a> Drop for Texture<'a> {
|
||||||
fn drop(&mut self) { unsafe { self.sys.FreeTexture.unwrap()(self.ptr) } }
|
fn drop(&mut self) {
|
||||||
|
unsafe { self.sys.FreeTexture.unwrap()(self.ptr) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type TextureId = sys::TextureID_t;
|
pub type TextureId = sys::TextureID_t;
|
||||||
@ -229,7 +281,11 @@ pub struct ControllerMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ControllerMode {
|
impl Default for ControllerMode {
|
||||||
fn default() -> Self { ControllerMode { scroll_wheel_visible: false } }
|
fn default() -> Self {
|
||||||
|
ControllerMode {
|
||||||
|
scroll_wheel_visible: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@ -241,11 +297,21 @@ pub struct ComponentState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentState {
|
impl ComponentState {
|
||||||
pub fn is_static(&self) -> bool { self.properties & component_properties::IS_STATIC != 0 }
|
pub fn is_static(&self) -> bool {
|
||||||
pub fn is_visible(&self) -> bool { self.properties & component_properties::IS_VISIBLE != 0 }
|
self.properties & component_properties::IS_STATIC != 0
|
||||||
pub fn is_touched(&self) -> bool { self.properties & component_properties::IS_TOUCHED != 0 }
|
}
|
||||||
pub fn is_pressed(&self) -> bool { self.properties & component_properties::IS_PRESSED != 0 }
|
pub fn is_visible(&self) -> bool {
|
||||||
pub fn is_scrolled(&self) -> bool { self.properties & component_properties::IS_SCROLLED != 0 }
|
self.properties & component_properties::IS_VISIBLE != 0
|
||||||
|
}
|
||||||
|
pub fn is_touched(&self) -> bool {
|
||||||
|
self.properties & component_properties::IS_TOUCHED != 0
|
||||||
|
}
|
||||||
|
pub fn is_pressed(&self) -> bool {
|
||||||
|
self.properties & component_properties::IS_PRESSED != 0
|
||||||
|
}
|
||||||
|
pub fn is_scrolled(&self) -> bool {
|
||||||
|
self.properties & component_properties::IS_SCROLLED != 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ComponentProperties = sys::VRComponentProperties;
|
type ComponentProperties = sys::VRComponentProperties;
|
||||||
@ -253,25 +319,39 @@ type ComponentProperties = sys::VRComponentProperties;
|
|||||||
pub mod component_properties {
|
pub mod component_properties {
|
||||||
use super::{sys, ComponentProperties};
|
use super::{sys, ComponentProperties};
|
||||||
|
|
||||||
pub const IS_STATIC: ComponentProperties = sys::EVRComponentProperty_VRComponentProperty_IsStatic;
|
pub const IS_STATIC: ComponentProperties =
|
||||||
pub const IS_VISIBLE: ComponentProperties = sys::EVRComponentProperty_VRComponentProperty_IsVisible;
|
sys::EVRComponentProperty_VRComponentProperty_IsStatic as ComponentProperties;
|
||||||
pub const IS_TOUCHED: ComponentProperties = sys::EVRComponentProperty_VRComponentProperty_IsTouched;
|
pub const IS_VISIBLE: ComponentProperties =
|
||||||
pub const IS_PRESSED: ComponentProperties = sys::EVRComponentProperty_VRComponentProperty_IsPressed;
|
sys::EVRComponentProperty_VRComponentProperty_IsVisible as ComponentProperties;
|
||||||
pub const IS_SCROLLED: ComponentProperties = sys::EVRComponentProperty_VRComponentProperty_IsScrolled;
|
pub const IS_TOUCHED: ComponentProperties =
|
||||||
|
sys::EVRComponentProperty_VRComponentProperty_IsTouched as ComponentProperties;
|
||||||
|
pub const IS_PRESSED: ComponentProperties =
|
||||||
|
sys::EVRComponentProperty_VRComponentProperty_IsPressed as ComponentProperties;
|
||||||
|
pub const IS_SCROLLED: ComponentProperties =
|
||||||
|
sys::EVRComponentProperty_VRComponentProperty_IsScrolled as ComponentProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod component {
|
pub mod component {
|
||||||
pub mod controller {
|
pub mod controller {
|
||||||
use std::ffi::CStr;
|
|
||||||
use openvr_sys as sys;
|
use openvr_sys as sys;
|
||||||
|
use std::ffi::CStr;
|
||||||
|
|
||||||
// TODO: Real constants
|
// TODO: Real constants
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref GDC2015: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_GDC2015) };
|
pub static ref GDC2015: &'static CStr = unsafe {
|
||||||
pub static ref BASE: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_Base) };
|
CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_GDC2015)
|
||||||
pub static ref TIP: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_Tip) };
|
};
|
||||||
pub static ref HAND_GRIP: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_HandGrip) };
|
pub static ref BASE: &'static CStr = unsafe {
|
||||||
pub static ref STATUS: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_Status) };
|
CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_Base)
|
||||||
|
};
|
||||||
|
pub static ref TIP: &'static CStr =
|
||||||
|
unsafe { CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_Tip) };
|
||||||
|
pub static ref HAND_GRIP: &'static CStr = unsafe {
|
||||||
|
CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_HandGrip)
|
||||||
|
};
|
||||||
|
pub static ref STATUS: &'static CStr = unsafe {
|
||||||
|
CStr::from_bytes_with_nul_unchecked(sys::k_pch_Controller_Component_Status)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,12 @@ pub struct EventInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<sys::VREvent_t> for EventInfo {
|
impl From<sys::VREvent_t> for EventInfo {
|
||||||
|
#[allow(unused_unsafe)]
|
||||||
fn from(x: sys::VREvent_t) -> Self {
|
fn from(x: sys::VREvent_t) -> Self {
|
||||||
EventInfo {
|
EventInfo {
|
||||||
tracked_device_index: x.trackedDeviceIndex,
|
tracked_device_index: x.trackedDeviceIndex,
|
||||||
age: x.eventAgeSeconds,
|
age: x.eventAgeSeconds,
|
||||||
event: Event::from_sys(x.eventType, &x.data)
|
event: Event::from_sys(x.eventType as sys::EVREventType, unsafe { &x.data }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,7 +35,9 @@ pub struct Controller {
|
|||||||
|
|
||||||
impl FromEventData for Controller {
|
impl FromEventData for Controller {
|
||||||
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
||||||
Controller { button: x.controller.button }
|
Controller {
|
||||||
|
button: x.controller.button,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,23 +52,28 @@ pub struct Mouse {
|
|||||||
|
|
||||||
impl FromEventData for Mouse {
|
impl FromEventData for Mouse {
|
||||||
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
||||||
Mouse { position: (x.mouse.x, x.mouse.y), button: x.mouse.button }
|
Mouse {
|
||||||
|
position: (x.mouse.x, x.mouse.y),
|
||||||
|
button: x.mouse.button,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
/// Simulated mouse wheel scroll in overlay space
|
/// Simulated mouse wheel scroll in overlay space
|
||||||
///
|
///
|
||||||
/// Coordinates are fraction of the touchpad traversed since last scroll event.
|
/// Coordinates are fraction of the touchpad traversed since last scroll event.
|
||||||
pub struct Scroll {
|
pub struct Scroll {
|
||||||
pub delta: (f32, f32),
|
pub delta: (f32, f32),
|
||||||
pub repeat_count: u32,
|
pub viewportscale: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromEventData for Scroll {
|
impl FromEventData for Scroll {
|
||||||
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
||||||
Scroll { delta: (x.scroll.xdelta, x.scroll.ydelta), repeat_count: x.scroll.repeatCount }
|
Scroll {
|
||||||
|
delta: (x.scroll.xdelta, x.scroll.ydelta),
|
||||||
|
viewportscale: x.scroll.viewportscale,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,9 +93,12 @@ pub struct TouchPadMove {
|
|||||||
|
|
||||||
impl FromEventData for TouchPadMove {
|
impl FromEventData for TouchPadMove {
|
||||||
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
||||||
TouchPadMove { finger_down: x.touchPadMove.bFingerDown, seconds_finger_down: x.touchPadMove.flSecondsFingerDown,
|
TouchPadMove {
|
||||||
|
finger_down: x.touchPadMove.bFingerDown,
|
||||||
|
seconds_finger_down: x.touchPadMove.flSecondsFingerDown,
|
||||||
first: (x.touchPadMove.fValueXFirst, x.touchPadMove.fValueYFirst),
|
first: (x.touchPadMove.fValueXFirst, x.touchPadMove.fValueYFirst),
|
||||||
raw: (x.touchPadMove.fValueXRaw, x.touchPadMove.fValueYRaw) }
|
raw: (x.touchPadMove.fValueXRaw, x.touchPadMove.fValueYRaw),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +118,11 @@ pub struct Process {
|
|||||||
|
|
||||||
impl FromEventData for Process {
|
impl FromEventData for Process {
|
||||||
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
||||||
Process { pid: x.process.pid, old_pid: x.process.oldPid, forced: x.process.bForced }
|
Process {
|
||||||
|
pid: x.process.pid,
|
||||||
|
old_pid: x.process.oldPid,
|
||||||
|
forced: x.process.bForced,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +133,9 @@ pub struct Overlay {
|
|||||||
|
|
||||||
impl FromEventData for Overlay {
|
impl FromEventData for Overlay {
|
||||||
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
||||||
Overlay { overlay_handle: x.overlay.overlayHandle }
|
Overlay {
|
||||||
|
overlay_handle: x.overlay.overlayHandle,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +153,10 @@ pub struct Keyboard {
|
|||||||
impl FromEventData for Keyboard {
|
impl FromEventData for Keyboard {
|
||||||
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
unsafe fn from_event_data(x: &sys::VREvent_Data_t) -> Self {
|
||||||
let x = &*(&x.keyboard as *const _ as *const sys::VREvent_Keyboard_t_real);
|
let x = &*(&x.keyboard as *const _ as *const sys::VREvent_Keyboard_t_real);
|
||||||
Keyboard { new_input: *(x.cNewInput.as_ptr() as *const _), user_value: x.uUserValue }
|
Keyboard {
|
||||||
|
new_input: *(x.cNewInput.as_ptr() as *const _),
|
||||||
|
user_value: x.uUserValue,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,22 +202,31 @@ pub enum Event {
|
|||||||
WatchdogWakeUpRequested,
|
WatchdogWakeUpRequested,
|
||||||
LensDistortionChanged,
|
LensDistortionChanged,
|
||||||
PropertyChanged(Property),
|
PropertyChanged(Property),
|
||||||
|
WirelessDisconnect,
|
||||||
|
WirelessReconnect,
|
||||||
ButtonPress(Controller),
|
ButtonPress(Controller),
|
||||||
ButtonUnpress(Controller),
|
ButtonUnpress(Controller),
|
||||||
ButtonTouch(Controller),
|
ButtonTouch(Controller),
|
||||||
ButtonUntouch(Controller),
|
ButtonUntouch(Controller),
|
||||||
|
DualAnalog_Press,
|
||||||
|
DualAnalog_Unpress,
|
||||||
|
DualAnalog_Touch,
|
||||||
|
DualAnalog_Untouch,
|
||||||
|
DualAnalog_Move,
|
||||||
|
DualAnalog_ModeSwitch1,
|
||||||
|
DualAnalog_ModeSwitch2,
|
||||||
|
DualAnalog_Cancel,
|
||||||
MouseMove(Mouse),
|
MouseMove(Mouse),
|
||||||
MouseButtonDown(Mouse),
|
MouseButtonDown(Mouse),
|
||||||
MouseButtonUp(Mouse),
|
MouseButtonUp(Mouse),
|
||||||
FocusEnter(Overlay),
|
FocusEnter(Overlay),
|
||||||
FocusLeave(Overlay),
|
FocusLeave(Overlay),
|
||||||
Scroll(Scroll),
|
ScrollDiscrete(Scroll),
|
||||||
TouchPadMove(TouchPadMove),
|
TouchPadMove(TouchPadMove),
|
||||||
/// global event
|
/// global event
|
||||||
OverlayFocusChanged(Overlay),
|
OverlayFocusChanged(Overlay),
|
||||||
|
ReloadOverlays,
|
||||||
|
ScrollSmooth(Scroll),
|
||||||
#[deprecated]
|
#[deprecated]
|
||||||
InputFocusCaptured(Process),
|
InputFocusCaptured(Process),
|
||||||
#[deprecated]
|
#[deprecated]
|
||||||
@ -210,19 +239,19 @@ pub enum Event {
|
|||||||
SceneFocusChanged(Process),
|
SceneFocusChanged(Process),
|
||||||
InputFocusChanged(Process),
|
InputFocusChanged(Process),
|
||||||
SceneApplicationSecondaryRenderingStarted(Process),
|
SceneApplicationSecondaryRenderingStarted(Process),
|
||||||
|
SceneApplicationUsingWrongGraphicsAdapter,
|
||||||
|
ActionBindingReloaded,
|
||||||
/// Sent to the scene application to request hiding render models temporarily
|
/// Sent to the scene application to request hiding render models temporarily
|
||||||
HideRenderModels,
|
HideRenderModels,
|
||||||
/// Sent to the scene application to request restoring render model visibility
|
/// Sent to the scene application to request restoring render model visibility
|
||||||
ShowRenderModels,
|
ShowRenderModels,
|
||||||
|
ConsoleOpened,
|
||||||
|
ConsoleClosed,
|
||||||
OverlayShown,
|
OverlayShown,
|
||||||
OverlayHidden,
|
OverlayHidden,
|
||||||
DashboardActivated,
|
DashboardActivated,
|
||||||
DashboardDeactivated,
|
DashboardDeactivated,
|
||||||
/// Sent to the overlay manager - data is overlay
|
/// Sent to the overlay manager - data is overlay
|
||||||
DashboardThumbSelected,
|
|
||||||
/// Sent to the overlay manager - data is overlay
|
|
||||||
DashboardRequested,
|
DashboardRequested,
|
||||||
/// Send to the overlay manager
|
/// Send to the overlay manager
|
||||||
ResetDashboard,
|
ResetDashboard,
|
||||||
@ -239,14 +268,12 @@ pub enum Event {
|
|||||||
/// Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else
|
/// Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else
|
||||||
OverlayGamepadFocusLost,
|
OverlayGamepadFocusLost,
|
||||||
OverlaySharedTextureChanged,
|
OverlaySharedTextureChanged,
|
||||||
DashboardGuideButtonDown,
|
|
||||||
DashboardGuideButtonUp,
|
|
||||||
/// Screenshot button combo was pressed, Dashboard should request a screenshot
|
/// Screenshot button combo was pressed, Dashboard should request a screenshot
|
||||||
ScreenshotTriggered,
|
ScreenshotTriggered,
|
||||||
/// Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load
|
/// Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load
|
||||||
ImageFailed,
|
ImageFailed,
|
||||||
DashboardOverlayCreated,
|
DashboardOverlayCreated,
|
||||||
|
SwitchGamepadFocus,
|
||||||
/// Sent by vrclient application to compositor to take a screenshot
|
/// Sent by vrclient application to compositor to take a screenshot
|
||||||
RequestScreenshot,
|
RequestScreenshot,
|
||||||
/// Sent by compositor to the application that the screenshot has been taken
|
/// Sent by compositor to the application that the screenshot has been taken
|
||||||
@ -257,14 +284,15 @@ pub enum Event {
|
|||||||
SubmitScreenshotToDashboard,
|
SubmitScreenshotToDashboard,
|
||||||
/// Sent by compositor to the dashboard that a completed screenshot was submitted
|
/// Sent by compositor to the dashboard that a completed screenshot was submitted
|
||||||
ScreenshotProgressToDashboard,
|
ScreenshotProgressToDashboard,
|
||||||
|
|
||||||
PrimaryDashboardDeviceChanged,
|
PrimaryDashboardDeviceChanged,
|
||||||
|
RoomViewShown,
|
||||||
|
RoomViewHidden,
|
||||||
|
ShowUI,
|
||||||
|
ShowDevTools,
|
||||||
Notification_Shown,
|
Notification_Shown,
|
||||||
Notification_Hidden,
|
Notification_Hidden,
|
||||||
Notification_BeginInteraction,
|
Notification_BeginInteraction,
|
||||||
Notification_Destroyed,
|
Notification_Destroyed,
|
||||||
|
|
||||||
/// The application has been asked to quit
|
/// The application has been asked to quit
|
||||||
Quit(Process),
|
Quit(Process),
|
||||||
ProcessQuit(Process),
|
ProcessQuit(Process),
|
||||||
@ -272,34 +300,44 @@ pub enum Event {
|
|||||||
QuitAcknowledged(Process),
|
QuitAcknowledged(Process),
|
||||||
/// The driver has requested that SteamVR shut down
|
/// The driver has requested that SteamVR shut down
|
||||||
DriverRequestedQuit,
|
DriverRequestedQuit,
|
||||||
|
RestartRequested,
|
||||||
ChaperoneDataHasChanged,
|
ChaperoneDataHasChanged,
|
||||||
ChaperoneUniverseHasChanged,
|
ChaperoneUniverseHasChanged,
|
||||||
ChaperoneTempDataHasChanged,
|
ChaperoneTempDataHasChanged,
|
||||||
ChaperoneSettingsHaveChanged,
|
ChaperoneSettingsHaveChanged,
|
||||||
SeatedZeroPoseReset,
|
SeatedZeroPoseReset,
|
||||||
|
ChaperoneFlushCache,
|
||||||
|
ChaperoneRoomSetupStarting,
|
||||||
|
ChaperoneRoomSetupFinished,
|
||||||
AudioSettingsHaveChanged,
|
AudioSettingsHaveChanged,
|
||||||
|
|
||||||
BackgroundSettingHasChanged,
|
BackgroundSettingHasChanged,
|
||||||
CameraSettingsHaveChanged,
|
CameraSettingsHaveChanged,
|
||||||
ReprojectionSettingHasChanged,
|
ReprojectionSettingHasChanged,
|
||||||
ModelSkinSettingsHaveChanged,
|
ModelSkinSettingsHaveChanged,
|
||||||
EnvironmentSettingsHaveChanged,
|
EnvironmentSettingsHaveChanged,
|
||||||
|
EnableHomeAppSettingsHaveChanged,
|
||||||
PowerSettingsHaveChanged,
|
PowerSettingsHaveChanged,
|
||||||
|
SteamVRSectionSettingChanged,
|
||||||
|
LighthouseSectionSettingChanged,
|
||||||
|
NullSectionSettingChanged,
|
||||||
|
UserInterfaceSectionSettingChanged,
|
||||||
|
NotificationsSectionSettingChanged,
|
||||||
|
KeyboardSectionSettingChanged,
|
||||||
|
PerfSectionSettingChanged,
|
||||||
|
DashboardSectionSettingChanged,
|
||||||
|
WebInterfaceSectionSettingChanged,
|
||||||
|
TrackersSectionSettingChanged,
|
||||||
|
LastKnownSectionSettingChanged,
|
||||||
|
DismissedWarningsSectionSettingChanged,
|
||||||
StatusUpdate,
|
StatusUpdate,
|
||||||
|
WebInterface_InstallDriverCompleted,
|
||||||
MCImageUpdated,
|
MCImageUpdated,
|
||||||
|
|
||||||
FirmwareUpdateStarted,
|
FirmwareUpdateStarted,
|
||||||
FirmwareUpdateFinished,
|
FirmwareUpdateFinished,
|
||||||
|
|
||||||
KeyboardClosed,
|
KeyboardClosed,
|
||||||
KeyboardCharInput(Keyboard),
|
KeyboardCharInput(Keyboard),
|
||||||
/// Sent when DONE button clicked on keyboard
|
/// Sent when DONE button clicked on keyboard
|
||||||
KeyboardDone,
|
KeyboardDone,
|
||||||
|
|
||||||
ApplicationTransitionStarted,
|
ApplicationTransitionStarted,
|
||||||
ApplicationTransitionAborted,
|
ApplicationTransitionAborted,
|
||||||
ApplicationTransitionNewAppStarted,
|
ApplicationTransitionNewAppStarted,
|
||||||
@ -308,30 +346,46 @@ pub enum Event {
|
|||||||
ApplicationTransitionNewAppLaunchComplete,
|
ApplicationTransitionNewAppLaunchComplete,
|
||||||
ProcessConnected,
|
ProcessConnected,
|
||||||
ProcessDisconnected,
|
ProcessDisconnected,
|
||||||
|
|
||||||
Compositor_MirrorWindowShown,
|
Compositor_MirrorWindowShown,
|
||||||
Compositor_MirrorWindowHidden,
|
Compositor_MirrorWindowHidden,
|
||||||
Compositor_ChaperoneBoundsShown,
|
Compositor_ChaperoneBoundsShown,
|
||||||
Compositor_ChaperoneBoundsHidden,
|
Compositor_ChaperoneBoundsHidden,
|
||||||
|
Compositor_DisplayDisconnected,
|
||||||
|
Compositor_DisplayReconnected,
|
||||||
|
Compositor_HDCPError,
|
||||||
|
Compositor_ApplicationNotResponding,
|
||||||
|
Compositor_ApplicationResumed,
|
||||||
|
Compositor_OutOfVideoMemory,
|
||||||
TrackedCamera_StartVideoStream,
|
TrackedCamera_StartVideoStream,
|
||||||
TrackedCamera_StopVideoStream,
|
TrackedCamera_StopVideoStream,
|
||||||
TrackedCamera_PauseVideoStream,
|
TrackedCamera_PauseVideoStream,
|
||||||
TrackedCamera_ResumeVideoStream,
|
TrackedCamera_ResumeVideoStream,
|
||||||
TrackedCamera_EditingSurface,
|
TrackedCamera_EditingSurface,
|
||||||
|
|
||||||
PerformanceTest_EnableCapture,
|
PerformanceTest_EnableCapture,
|
||||||
PerformanceTest_DisableCapture,
|
PerformanceTest_DisableCapture,
|
||||||
PerformanceTest_FidelityLevel,
|
PerformanceTest_FidelityLevel,
|
||||||
|
|
||||||
MessageOverlay_Closed,
|
MessageOverlay_Closed,
|
||||||
|
MessageOverlayCloseRequested,
|
||||||
|
Input_HapticVibration,
|
||||||
|
Input_BindingLoadFailed,
|
||||||
|
Input_BindingLoadSuccessful,
|
||||||
|
Input_ActionManifestReloaded,
|
||||||
|
Input_ActionManifestLoadFailed,
|
||||||
|
Input_ProgressUpdate,
|
||||||
|
Input_TrackerActivated,
|
||||||
|
Input_BindingsUpdated,
|
||||||
|
SpatialAnchors_PoseUpdated,
|
||||||
|
SpatialAnchors_DescriptorUpdated,
|
||||||
|
SpatialAnchors_RequestPoseUpdate,
|
||||||
|
SpatialAnchors_RequestDescriptorUpdate,
|
||||||
|
SystemReport_Started,
|
||||||
|
|
||||||
VendorSpecific(u32),
|
VendorSpecific(sys::EVREventType),
|
||||||
Unknown(u32),
|
Unknown(sys::EVREventType),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Event {
|
impl Event {
|
||||||
fn from_sys(ty: u32, data: &sys::VREvent_Data_t) -> Self {
|
fn from_sys(ty: sys::EVREventType, data: &sys::VREvent_Data_t) -> Self {
|
||||||
use self::Event::*;
|
use self::Event::*;
|
||||||
|
|
||||||
fn get<T: FromEventData>(x: &sys::VREvent_Data_t) -> T {
|
fn get<T: FromEventData>(x: &sys::VREvent_Data_t) -> T {
|
||||||
@ -343,8 +397,12 @@ impl Event {
|
|||||||
sys::EVREventType_VREvent_TrackedDeviceActivated => TrackedDeviceActivated,
|
sys::EVREventType_VREvent_TrackedDeviceActivated => TrackedDeviceActivated,
|
||||||
sys::EVREventType_VREvent_TrackedDeviceDeactivated => TrackedDeviceDeactivated,
|
sys::EVREventType_VREvent_TrackedDeviceDeactivated => TrackedDeviceDeactivated,
|
||||||
sys::EVREventType_VREvent_TrackedDeviceUpdated => TrackedDeviceUpdated,
|
sys::EVREventType_VREvent_TrackedDeviceUpdated => TrackedDeviceUpdated,
|
||||||
sys::EVREventType_VREvent_TrackedDeviceUserInteractionStarted => TrackedDeviceUserInteractionStarted,
|
sys::EVREventType_VREvent_TrackedDeviceUserInteractionStarted => {
|
||||||
sys::EVREventType_VREvent_TrackedDeviceUserInteractionEnded => TrackedDeviceUserInteractionEnded,
|
TrackedDeviceUserInteractionStarted
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_TrackedDeviceUserInteractionEnded => {
|
||||||
|
TrackedDeviceUserInteractionEnded
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_IpdChanged => IpdChanged,
|
sys::EVREventType_VREvent_IpdChanged => IpdChanged,
|
||||||
sys::EVREventType_VREvent_EnterStandbyMode => EnterStandbyMode,
|
sys::EVREventType_VREvent_EnterStandbyMode => EnterStandbyMode,
|
||||||
sys::EVREventType_VREvent_LeaveStandbyMode => LeaveStandbyMode,
|
sys::EVREventType_VREvent_LeaveStandbyMode => LeaveStandbyMode,
|
||||||
@ -352,18 +410,30 @@ impl Event {
|
|||||||
sys::EVREventType_VREvent_WatchdogWakeUpRequested => WatchdogWakeUpRequested,
|
sys::EVREventType_VREvent_WatchdogWakeUpRequested => WatchdogWakeUpRequested,
|
||||||
sys::EVREventType_VREvent_LensDistortionChanged => LensDistortionChanged,
|
sys::EVREventType_VREvent_LensDistortionChanged => LensDistortionChanged,
|
||||||
sys::EVREventType_VREvent_PropertyChanged => PropertyChanged(get(data)),
|
sys::EVREventType_VREvent_PropertyChanged => PropertyChanged(get(data)),
|
||||||
|
sys::EVREventType_VREvent_WirelessDisconnect => WirelessDisconnect,
|
||||||
|
sys::EVREventType_VREvent_WirelessReconnect => WirelessReconnect,
|
||||||
sys::EVREventType_VREvent_ButtonPress => ButtonPress(get(data)),
|
sys::EVREventType_VREvent_ButtonPress => ButtonPress(get(data)),
|
||||||
sys::EVREventType_VREvent_ButtonUnpress => ButtonUnpress(get(data)),
|
sys::EVREventType_VREvent_ButtonUnpress => ButtonUnpress(get(data)),
|
||||||
sys::EVREventType_VREvent_ButtonTouch => ButtonTouch(get(data)),
|
sys::EVREventType_VREvent_ButtonTouch => ButtonTouch(get(data)),
|
||||||
sys::EVREventType_VREvent_ButtonUntouch => ButtonUntouch(get(data)),
|
sys::EVREventType_VREvent_ButtonUntouch => ButtonUntouch(get(data)),
|
||||||
|
sys::EVREventType_VREvent_DualAnalog_Press => DualAnalog_Press,
|
||||||
|
sys::EVREventType_VREvent_DualAnalog_Unpress => DualAnalog_Unpress,
|
||||||
|
sys::EVREventType_VREvent_DualAnalog_Touch => DualAnalog_Touch,
|
||||||
|
sys::EVREventType_VREvent_DualAnalog_Untouch => DualAnalog_Untouch,
|
||||||
|
sys::EVREventType_VREvent_DualAnalog_Move => DualAnalog_Move,
|
||||||
|
sys::EVREventType_VREvent_DualAnalog_ModeSwitch1 => DualAnalog_ModeSwitch1,
|
||||||
|
sys::EVREventType_VREvent_DualAnalog_ModeSwitch2 => DualAnalog_ModeSwitch2,
|
||||||
|
sys::EVREventType_VREvent_DualAnalog_Cancel => DualAnalog_Cancel,
|
||||||
sys::EVREventType_VREvent_MouseMove => MouseMove(get(data)),
|
sys::EVREventType_VREvent_MouseMove => MouseMove(get(data)),
|
||||||
sys::EVREventType_VREvent_MouseButtonDown => MouseButtonDown(get(data)),
|
sys::EVREventType_VREvent_MouseButtonDown => MouseButtonDown(get(data)),
|
||||||
sys::EVREventType_VREvent_MouseButtonUp => MouseButtonUp(get(data)),
|
sys::EVREventType_VREvent_MouseButtonUp => MouseButtonUp(get(data)),
|
||||||
sys::EVREventType_VREvent_FocusEnter => FocusEnter(get(data)),
|
sys::EVREventType_VREvent_FocusEnter => FocusEnter(get(data)),
|
||||||
sys::EVREventType_VREvent_FocusLeave => FocusLeave(get(data)),
|
sys::EVREventType_VREvent_FocusLeave => FocusLeave(get(data)),
|
||||||
sys::EVREventType_VREvent_Scroll => Scroll(get(data)),
|
sys::EVREventType_VREvent_ScrollDiscrete => ScrollDiscrete(get(data)),
|
||||||
sys::EVREventType_VREvent_TouchPadMove => TouchPadMove(get(data)),
|
sys::EVREventType_VREvent_TouchPadMove => TouchPadMove(get(data)),
|
||||||
sys::EVREventType_VREvent_OverlayFocusChanged => OverlayFocusChanged(get(data)),
|
sys::EVREventType_VREvent_OverlayFocusChanged => OverlayFocusChanged(get(data)),
|
||||||
|
sys::EVREventType_VREvent_ReloadOverlays => ReloadOverlays,
|
||||||
|
sys::EVREventType_VREvent_ScrollSmooth => ScrollSmooth(get(data)),
|
||||||
sys::EVREventType_VREvent_InputFocusCaptured => InputFocusCaptured(get(data)),
|
sys::EVREventType_VREvent_InputFocusCaptured => InputFocusCaptured(get(data)),
|
||||||
sys::EVREventType_VREvent_InputFocusReleased => InputFocusReleased(get(data)),
|
sys::EVREventType_VREvent_InputFocusReleased => InputFocusReleased(get(data)),
|
||||||
sys::EVREventType_VREvent_SceneFocusLost => SceneFocusLost(get(data)),
|
sys::EVREventType_VREvent_SceneFocusLost => SceneFocusLost(get(data)),
|
||||||
@ -371,14 +441,21 @@ impl Event {
|
|||||||
sys::EVREventType_VREvent_SceneApplicationChanged => SceneApplicationChanged(get(data)),
|
sys::EVREventType_VREvent_SceneApplicationChanged => SceneApplicationChanged(get(data)),
|
||||||
sys::EVREventType_VREvent_SceneFocusChanged => SceneFocusChanged(get(data)),
|
sys::EVREventType_VREvent_SceneFocusChanged => SceneFocusChanged(get(data)),
|
||||||
sys::EVREventType_VREvent_InputFocusChanged => InputFocusChanged(get(data)),
|
sys::EVREventType_VREvent_InputFocusChanged => InputFocusChanged(get(data)),
|
||||||
sys::EVREventType_VREvent_SceneApplicationSecondaryRenderingStarted => SceneApplicationSecondaryRenderingStarted(get(data)),
|
sys::EVREventType_VREvent_SceneApplicationSecondaryRenderingStarted => {
|
||||||
|
SceneApplicationSecondaryRenderingStarted(get(data))
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_SceneApplicationUsingWrongGraphicsAdapter => {
|
||||||
|
SceneApplicationUsingWrongGraphicsAdapter
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_ActionBindingReloaded => ActionBindingReloaded,
|
||||||
sys::EVREventType_VREvent_HideRenderModels => HideRenderModels,
|
sys::EVREventType_VREvent_HideRenderModels => HideRenderModels,
|
||||||
sys::EVREventType_VREvent_ShowRenderModels => ShowRenderModels,
|
sys::EVREventType_VREvent_ShowRenderModels => ShowRenderModels,
|
||||||
|
sys::EVREventType_VREvent_ConsoleOpened => ConsoleOpened,
|
||||||
|
sys::EVREventType_VREvent_ConsoleClosed => ConsoleClosed,
|
||||||
sys::EVREventType_VREvent_OverlayShown => OverlayShown,
|
sys::EVREventType_VREvent_OverlayShown => OverlayShown,
|
||||||
sys::EVREventType_VREvent_OverlayHidden => OverlayHidden,
|
sys::EVREventType_VREvent_OverlayHidden => OverlayHidden,
|
||||||
sys::EVREventType_VREvent_DashboardActivated => DashboardActivated,
|
sys::EVREventType_VREvent_DashboardActivated => DashboardActivated,
|
||||||
sys::EVREventType_VREvent_DashboardDeactivated => DashboardDeactivated,
|
sys::EVREventType_VREvent_DashboardDeactivated => DashboardDeactivated,
|
||||||
sys::EVREventType_VREvent_DashboardThumbSelected => DashboardThumbSelected,
|
|
||||||
sys::EVREventType_VREvent_DashboardRequested => DashboardRequested,
|
sys::EVREventType_VREvent_DashboardRequested => DashboardRequested,
|
||||||
sys::EVREventType_VREvent_ResetDashboard => ResetDashboard,
|
sys::EVREventType_VREvent_ResetDashboard => ResetDashboard,
|
||||||
sys::EVREventType_VREvent_RenderToast => RenderToast,
|
sys::EVREventType_VREvent_RenderToast => RenderToast,
|
||||||
@ -388,39 +465,92 @@ impl Event {
|
|||||||
sys::EVREventType_VREvent_OverlayGamepadFocusGained => OverlayGamepadFocusGained,
|
sys::EVREventType_VREvent_OverlayGamepadFocusGained => OverlayGamepadFocusGained,
|
||||||
sys::EVREventType_VREvent_OverlayGamepadFocusLost => OverlayGamepadFocusLost,
|
sys::EVREventType_VREvent_OverlayGamepadFocusLost => OverlayGamepadFocusLost,
|
||||||
sys::EVREventType_VREvent_OverlaySharedTextureChanged => OverlaySharedTextureChanged,
|
sys::EVREventType_VREvent_OverlaySharedTextureChanged => OverlaySharedTextureChanged,
|
||||||
sys::EVREventType_VREvent_DashboardGuideButtonDown => DashboardGuideButtonDown,
|
|
||||||
sys::EVREventType_VREvent_DashboardGuideButtonUp => DashboardGuideButtonUp,
|
|
||||||
sys::EVREventType_VREvent_ScreenshotTriggered => ScreenshotTriggered,
|
sys::EVREventType_VREvent_ScreenshotTriggered => ScreenshotTriggered,
|
||||||
sys::EVREventType_VREvent_ImageFailed => ImageFailed,
|
sys::EVREventType_VREvent_ImageFailed => ImageFailed,
|
||||||
sys::EVREventType_VREvent_DashboardOverlayCreated => DashboardOverlayCreated,
|
sys::EVREventType_VREvent_DashboardOverlayCreated => DashboardOverlayCreated,
|
||||||
|
sys::EVREventType_VREvent_SwitchGamepadFocus => SwitchGamepadFocus,
|
||||||
sys::EVREventType_VREvent_RequestScreenshot => RequestScreenshot,
|
sys::EVREventType_VREvent_RequestScreenshot => RequestScreenshot,
|
||||||
sys::EVREventType_VREvent_ScreenshotTaken => ScreenshotTaken,
|
sys::EVREventType_VREvent_ScreenshotTaken => ScreenshotTaken,
|
||||||
sys::EVREventType_VREvent_ScreenshotFailed => ScreenshotFailed,
|
sys::EVREventType_VREvent_ScreenshotFailed => ScreenshotFailed,
|
||||||
sys::EVREventType_VREvent_SubmitScreenshotToDashboard => SubmitScreenshotToDashboard,
|
sys::EVREventType_VREvent_SubmitScreenshotToDashboard => SubmitScreenshotToDashboard,
|
||||||
sys::EVREventType_VREvent_ScreenshotProgressToDashboard => ScreenshotProgressToDashboard,
|
sys::EVREventType_VREvent_ScreenshotProgressToDashboard => {
|
||||||
sys::EVREventType_VREvent_PrimaryDashboardDeviceChanged => PrimaryDashboardDeviceChanged,
|
ScreenshotProgressToDashboard
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_PrimaryDashboardDeviceChanged => {
|
||||||
|
PrimaryDashboardDeviceChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_RoomViewShown => RoomViewShown,
|
||||||
|
sys::EVREventType_VREvent_RoomViewHidden => RoomViewHidden,
|
||||||
|
sys::EVREventType_VREvent_ShowUI => ShowUI,
|
||||||
|
sys::EVREventType_VREvent_ShowDevTools => ShowDevTools,
|
||||||
sys::EVREventType_VREvent_Notification_Shown => Notification_Shown,
|
sys::EVREventType_VREvent_Notification_Shown => Notification_Shown,
|
||||||
sys::EVREventType_VREvent_Notification_Hidden => Notification_Hidden,
|
sys::EVREventType_VREvent_Notification_Hidden => Notification_Hidden,
|
||||||
sys::EVREventType_VREvent_Notification_BeginInteraction => Notification_BeginInteraction,
|
sys::EVREventType_VREvent_Notification_BeginInteraction => {
|
||||||
|
Notification_BeginInteraction
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_Notification_Destroyed => Notification_Destroyed,
|
sys::EVREventType_VREvent_Notification_Destroyed => Notification_Destroyed,
|
||||||
sys::EVREventType_VREvent_Quit => Quit(get(data)),
|
sys::EVREventType_VREvent_Quit => Quit(get(data)),
|
||||||
sys::EVREventType_VREvent_ProcessQuit => ProcessQuit(get(data)),
|
sys::EVREventType_VREvent_ProcessQuit => ProcessQuit(get(data)),
|
||||||
sys::EVREventType_VREvent_QuitAborted_UserPrompt => QuitAborted_UserPrompt(get(data)),
|
sys::EVREventType_VREvent_QuitAborted_UserPrompt => QuitAborted_UserPrompt(get(data)),
|
||||||
sys::EVREventType_VREvent_QuitAcknowledged => QuitAcknowledged(get(data)),
|
sys::EVREventType_VREvent_QuitAcknowledged => QuitAcknowledged(get(data)),
|
||||||
sys::EVREventType_VREvent_DriverRequestedQuit => DriverRequestedQuit,
|
sys::EVREventType_VREvent_DriverRequestedQuit => DriverRequestedQuit,
|
||||||
|
sys::EVREventType_VREvent_RestartRequested => RestartRequested,
|
||||||
sys::EVREventType_VREvent_ChaperoneDataHasChanged => ChaperoneDataHasChanged,
|
sys::EVREventType_VREvent_ChaperoneDataHasChanged => ChaperoneDataHasChanged,
|
||||||
sys::EVREventType_VREvent_ChaperoneUniverseHasChanged => ChaperoneUniverseHasChanged,
|
sys::EVREventType_VREvent_ChaperoneUniverseHasChanged => ChaperoneUniverseHasChanged,
|
||||||
sys::EVREventType_VREvent_ChaperoneTempDataHasChanged => ChaperoneTempDataHasChanged,
|
sys::EVREventType_VREvent_ChaperoneTempDataHasChanged => ChaperoneTempDataHasChanged,
|
||||||
sys::EVREventType_VREvent_ChaperoneSettingsHaveChanged => ChaperoneSettingsHaveChanged,
|
sys::EVREventType_VREvent_ChaperoneSettingsHaveChanged => ChaperoneSettingsHaveChanged,
|
||||||
sys::EVREventType_VREvent_SeatedZeroPoseReset => SeatedZeroPoseReset,
|
sys::EVREventType_VREvent_SeatedZeroPoseReset => SeatedZeroPoseReset,
|
||||||
|
sys::EVREventType_VREvent_ChaperoneFlushCache => ChaperoneFlushCache,
|
||||||
|
sys::EVREventType_VREvent_ChaperoneRoomSetupStarting => ChaperoneRoomSetupStarting,
|
||||||
|
sys::EVREventType_VREvent_ChaperoneRoomSetupFinished => ChaperoneRoomSetupFinished,
|
||||||
sys::EVREventType_VREvent_AudioSettingsHaveChanged => AudioSettingsHaveChanged,
|
sys::EVREventType_VREvent_AudioSettingsHaveChanged => AudioSettingsHaveChanged,
|
||||||
sys::EVREventType_VREvent_BackgroundSettingHasChanged => BackgroundSettingHasChanged,
|
sys::EVREventType_VREvent_BackgroundSettingHasChanged => BackgroundSettingHasChanged,
|
||||||
sys::EVREventType_VREvent_CameraSettingsHaveChanged => CameraSettingsHaveChanged,
|
sys::EVREventType_VREvent_CameraSettingsHaveChanged => CameraSettingsHaveChanged,
|
||||||
sys::EVREventType_VREvent_ReprojectionSettingHasChanged => ReprojectionSettingHasChanged,
|
sys::EVREventType_VREvent_ReprojectionSettingHasChanged => {
|
||||||
|
ReprojectionSettingHasChanged
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_ModelSkinSettingsHaveChanged => ModelSkinSettingsHaveChanged,
|
sys::EVREventType_VREvent_ModelSkinSettingsHaveChanged => ModelSkinSettingsHaveChanged,
|
||||||
sys::EVREventType_VREvent_EnvironmentSettingsHaveChanged => EnvironmentSettingsHaveChanged,
|
sys::EVREventType_VREvent_EnvironmentSettingsHaveChanged => {
|
||||||
|
EnvironmentSettingsHaveChanged
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_PowerSettingsHaveChanged => PowerSettingsHaveChanged,
|
sys::EVREventType_VREvent_PowerSettingsHaveChanged => PowerSettingsHaveChanged,
|
||||||
|
sys::EVREventType_VREvent_EnableHomeAppSettingsHaveChanged => {
|
||||||
|
EnableHomeAppSettingsHaveChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_SteamVRSectionSettingChanged => SteamVRSectionSettingChanged,
|
||||||
|
sys::EVREventType_VREvent_LighthouseSectionSettingChanged => {
|
||||||
|
LighthouseSectionSettingChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_NullSectionSettingChanged => NullSectionSettingChanged,
|
||||||
|
sys::EVREventType_VREvent_UserInterfaceSectionSettingChanged => {
|
||||||
|
UserInterfaceSectionSettingChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_NotificationsSectionSettingChanged => {
|
||||||
|
NotificationsSectionSettingChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_KeyboardSectionSettingChanged => {
|
||||||
|
KeyboardSectionSettingChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_PerfSectionSettingChanged => PerfSectionSettingChanged,
|
||||||
|
sys::EVREventType_VREvent_DashboardSectionSettingChanged => {
|
||||||
|
DashboardSectionSettingChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_WebInterfaceSectionSettingChanged => {
|
||||||
|
WebInterfaceSectionSettingChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_TrackersSectionSettingChanged => {
|
||||||
|
TrackersSectionSettingChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_LastKnownSectionSettingChanged => {
|
||||||
|
LastKnownSectionSettingChanged
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_DismissedWarningsSectionSettingChanged => {
|
||||||
|
DismissedWarningsSectionSettingChanged
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_StatusUpdate => StatusUpdate,
|
sys::EVREventType_VREvent_StatusUpdate => StatusUpdate,
|
||||||
|
sys::EVREventType_VREvent_WebInterface_InstallDriverCompleted => {
|
||||||
|
WebInterface_InstallDriverCompleted
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_MCImageUpdated => MCImageUpdated,
|
sys::EVREventType_VREvent_MCImageUpdated => MCImageUpdated,
|
||||||
sys::EVREventType_VREvent_FirmwareUpdateStarted => FirmwareUpdateStarted,
|
sys::EVREventType_VREvent_FirmwareUpdateStarted => FirmwareUpdateStarted,
|
||||||
sys::EVREventType_VREvent_FirmwareUpdateFinished => FirmwareUpdateFinished,
|
sys::EVREventType_VREvent_FirmwareUpdateFinished => FirmwareUpdateFinished,
|
||||||
@ -429,27 +559,90 @@ impl Event {
|
|||||||
sys::EVREventType_VREvent_KeyboardDone => KeyboardDone,
|
sys::EVREventType_VREvent_KeyboardDone => KeyboardDone,
|
||||||
sys::EVREventType_VREvent_ApplicationTransitionStarted => ApplicationTransitionStarted,
|
sys::EVREventType_VREvent_ApplicationTransitionStarted => ApplicationTransitionStarted,
|
||||||
sys::EVREventType_VREvent_ApplicationTransitionAborted => ApplicationTransitionAborted,
|
sys::EVREventType_VREvent_ApplicationTransitionAborted => ApplicationTransitionAborted,
|
||||||
sys::EVREventType_VREvent_ApplicationTransitionNewAppStarted => ApplicationTransitionNewAppStarted,
|
sys::EVREventType_VREvent_ApplicationTransitionNewAppStarted => {
|
||||||
|
ApplicationTransitionNewAppStarted
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_ApplicationListUpdated => ApplicationListUpdated,
|
sys::EVREventType_VREvent_ApplicationListUpdated => ApplicationListUpdated,
|
||||||
sys::EVREventType_VREvent_ApplicationMimeTypeLoad => ApplicationMimeTypeLoad,
|
sys::EVREventType_VREvent_ApplicationMimeTypeLoad => ApplicationMimeTypeLoad,
|
||||||
sys::EVREventType_VREvent_ApplicationTransitionNewAppLaunchComplete => ApplicationTransitionNewAppLaunchComplete,
|
sys::EVREventType_VREvent_ApplicationTransitionNewAppLaunchComplete => {
|
||||||
|
ApplicationTransitionNewAppLaunchComplete
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_ProcessConnected => ProcessConnected,
|
sys::EVREventType_VREvent_ProcessConnected => ProcessConnected,
|
||||||
sys::EVREventType_VREvent_ProcessDisconnected => ProcessDisconnected,
|
sys::EVREventType_VREvent_ProcessDisconnected => ProcessDisconnected,
|
||||||
sys::EVREventType_VREvent_Compositor_MirrorWindowShown => Compositor_MirrorWindowShown,
|
sys::EVREventType_VREvent_Compositor_MirrorWindowShown => Compositor_MirrorWindowShown,
|
||||||
sys::EVREventType_VREvent_Compositor_MirrorWindowHidden => Compositor_MirrorWindowHidden,
|
sys::EVREventType_VREvent_Compositor_MirrorWindowHidden => {
|
||||||
sys::EVREventType_VREvent_Compositor_ChaperoneBoundsShown => Compositor_ChaperoneBoundsShown,
|
Compositor_MirrorWindowHidden
|
||||||
sys::EVREventType_VREvent_Compositor_ChaperoneBoundsHidden => Compositor_ChaperoneBoundsHidden,
|
}
|
||||||
sys::EVREventType_VREvent_TrackedCamera_StartVideoStream => TrackedCamera_StartVideoStream,
|
sys::EVREventType_VREvent_Compositor_ChaperoneBoundsShown => {
|
||||||
sys::EVREventType_VREvent_TrackedCamera_StopVideoStream => TrackedCamera_StopVideoStream,
|
Compositor_ChaperoneBoundsShown
|
||||||
sys::EVREventType_VREvent_TrackedCamera_PauseVideoStream => TrackedCamera_PauseVideoStream,
|
}
|
||||||
sys::EVREventType_VREvent_TrackedCamera_ResumeVideoStream => TrackedCamera_ResumeVideoStream,
|
sys::EVREventType_VREvent_Compositor_ChaperoneBoundsHidden => {
|
||||||
|
Compositor_ChaperoneBoundsHidden
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_Compositor_DisplayDisconnected => {
|
||||||
|
Compositor_DisplayDisconnected
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_Compositor_DisplayReconnected => {
|
||||||
|
Compositor_DisplayReconnected
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_Compositor_HDCPError => Compositor_HDCPError,
|
||||||
|
sys::EVREventType_VREvent_Compositor_ApplicationNotResponding => {
|
||||||
|
Compositor_ApplicationNotResponding
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_Compositor_ApplicationResumed => {
|
||||||
|
Compositor_ApplicationResumed
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_Compositor_OutOfVideoMemory => Compositor_OutOfVideoMemory,
|
||||||
|
sys::EVREventType_VREvent_TrackedCamera_StartVideoStream => {
|
||||||
|
TrackedCamera_StartVideoStream
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_TrackedCamera_StopVideoStream => {
|
||||||
|
TrackedCamera_StopVideoStream
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_TrackedCamera_PauseVideoStream => {
|
||||||
|
TrackedCamera_PauseVideoStream
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_TrackedCamera_ResumeVideoStream => {
|
||||||
|
TrackedCamera_ResumeVideoStream
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_TrackedCamera_EditingSurface => TrackedCamera_EditingSurface,
|
sys::EVREventType_VREvent_TrackedCamera_EditingSurface => TrackedCamera_EditingSurface,
|
||||||
sys::EVREventType_VREvent_PerformanceTest_EnableCapture => PerformanceTest_EnableCapture,
|
sys::EVREventType_VREvent_PerformanceTest_EnableCapture => {
|
||||||
sys::EVREventType_VREvent_PerformanceTest_DisableCapture => PerformanceTest_DisableCapture,
|
PerformanceTest_EnableCapture
|
||||||
sys::EVREventType_VREvent_PerformanceTest_FidelityLevel => PerformanceTest_FidelityLevel,
|
}
|
||||||
|
sys::EVREventType_VREvent_PerformanceTest_DisableCapture => {
|
||||||
|
PerformanceTest_DisableCapture
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_PerformanceTest_FidelityLevel => {
|
||||||
|
PerformanceTest_FidelityLevel
|
||||||
|
}
|
||||||
sys::EVREventType_VREvent_MessageOverlay_Closed => MessageOverlay_Closed,
|
sys::EVREventType_VREvent_MessageOverlay_Closed => MessageOverlay_Closed,
|
||||||
|
sys::EVREventType_VREvent_MessageOverlayCloseRequested => MessageOverlayCloseRequested,
|
||||||
|
sys::EVREventType_VREvent_Input_HapticVibration => Input_HapticVibration,
|
||||||
|
sys::EVREventType_VREvent_Input_BindingLoadFailed => Input_BindingLoadFailed,
|
||||||
|
sys::EVREventType_VREvent_Input_BindingLoadSuccessful => Input_BindingLoadSuccessful,
|
||||||
|
sys::EVREventType_VREvent_Input_ActionManifestReloaded => Input_ActionManifestReloaded,
|
||||||
|
sys::EVREventType_VREvent_Input_ActionManifestLoadFailed => {
|
||||||
|
Input_ActionManifestLoadFailed
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_Input_ProgressUpdate => Input_ProgressUpdate,
|
||||||
|
sys::EVREventType_VREvent_Input_TrackerActivated => Input_TrackerActivated,
|
||||||
|
sys::EVREventType_VREvent_Input_BindingsUpdated => Input_BindingsUpdated,
|
||||||
|
sys::EVREventType_VREvent_SpatialAnchors_PoseUpdated => SpatialAnchors_PoseUpdated,
|
||||||
|
sys::EVREventType_VREvent_SpatialAnchors_DescriptorUpdated => {
|
||||||
|
SpatialAnchors_DescriptorUpdated
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_SpatialAnchors_RequestPoseUpdate => {
|
||||||
|
SpatialAnchors_RequestPoseUpdate
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_SpatialAnchors_RequestDescriptorUpdate => {
|
||||||
|
SpatialAnchors_RequestDescriptorUpdate
|
||||||
|
}
|
||||||
|
sys::EVREventType_VREvent_SystemReport_Started => SystemReport_Started,
|
||||||
x if x >= sys::EVREventType_VREvent_VendorSpecific_Reserved_Start
|
x if x >= sys::EVREventType_VREvent_VendorSpecific_Reserved_Start
|
||||||
&& x <= sys::EVREventType_VREvent_VendorSpecific_Reserved_End => VendorSpecific(x),
|
&& x <= sys::EVREventType_VREvent_VendorSpecific_Reserved_End =>
|
||||||
|
{
|
||||||
|
VendorSpecific(x)
|
||||||
|
}
|
||||||
x => Unknown(x),
|
x => Unknown(x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
//! The `System` interface provides access to display configuration information, tracking data, controller state,
|
//! The `System` interface provides access to display configuration information, tracking data, controller state,
|
||||||
//! events, and device properties. It is the main interface of OpenVR.
|
//! events, and device properties. It is the main interface of OpenVR.
|
||||||
|
|
||||||
use std::{mem, slice, ptr};
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
use std::{mem, ptr, slice};
|
||||||
|
|
||||||
use openvr_sys as sys;
|
use openvr_sys as sys;
|
||||||
|
|
||||||
@ -38,7 +38,13 @@ impl System {
|
|||||||
pub fn projection_raw(&self, eye: Eye) -> RawProjection {
|
pub fn projection_raw(&self, eye: Eye) -> RawProjection {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut result: RawProjection = mem::uninitialized();
|
let mut result: RawProjection = mem::uninitialized();
|
||||||
self.0.GetProjectionRaw.unwrap()(eye as sys::EVREye, &mut result.left, &mut result.right, &mut result.top, &mut result.bottom);
|
self.0.GetProjectionRaw.unwrap()(
|
||||||
|
eye as sys::EVREye,
|
||||||
|
&mut result.left,
|
||||||
|
&mut result.right,
|
||||||
|
&mut result.top,
|
||||||
|
&mut result.bottom,
|
||||||
|
);
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,11 +85,19 @@ impl System {
|
|||||||
/// to the chaperone soft bounds. TrackingUniverseRawAndUncalibrated should probably not be used unless the
|
/// to the chaperone soft bounds. TrackingUniverseRawAndUncalibrated should probably not be used unless the
|
||||||
/// application is the chaperone calibration tool itself, but will provide poses relative to the hardware-specific
|
/// application is the chaperone calibration tool itself, but will provide poses relative to the hardware-specific
|
||||||
/// coordinate system in the driver.
|
/// coordinate system in the driver.
|
||||||
pub fn device_to_absolute_tracking_pose(&self, origin: TrackingUniverseOrigin, predicted_seconds_to_photons_from_now: f32) -> TrackedDevicePoses {
|
pub fn device_to_absolute_tracking_pose(
|
||||||
|
&self,
|
||||||
|
origin: TrackingUniverseOrigin,
|
||||||
|
predicted_seconds_to_photons_from_now: f32,
|
||||||
|
) -> TrackedDevicePoses {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut result: TrackedDevicePoses = mem::uninitialized();
|
let mut result: TrackedDevicePoses = mem::uninitialized();
|
||||||
self.0.GetDeviceToAbsoluteTrackingPose.unwrap()(origin as sys::ETrackingUniverseOrigin, predicted_seconds_to_photons_from_now,
|
self.0.GetDeviceToAbsoluteTrackingPose.unwrap()(
|
||||||
result.as_mut().as_mut_ptr() as *mut _, result.len() as u32);
|
origin as sys::ETrackingUniverseOrigin,
|
||||||
|
predicted_seconds_to_photons_from_now,
|
||||||
|
result.as_mut().as_mut_ptr() as *mut _,
|
||||||
|
result.len() as u32,
|
||||||
|
);
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,13 +119,20 @@ impl System {
|
|||||||
unsafe { self.0.IsTrackedDeviceConnected.unwrap()(index) }
|
unsafe { self.0.IsTrackedDeviceConnected.unwrap()(index) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn poll_next_event_with_pose(&self, origin: TrackingUniverseOrigin) -> Option<(EventInfo, TrackedDevicePose)> {
|
pub fn poll_next_event_with_pose(
|
||||||
|
&self,
|
||||||
|
origin: TrackingUniverseOrigin,
|
||||||
|
) -> Option<(EventInfo, TrackedDevicePose)> {
|
||||||
let mut event = unsafe { mem::uninitialized() };
|
let mut event = unsafe { mem::uninitialized() };
|
||||||
let mut pose = unsafe { mem::uninitialized() };
|
let mut pose = unsafe { mem::uninitialized() };
|
||||||
if unsafe { self.0.PollNextEventWithPose.unwrap()(origin as sys::ETrackingUniverseOrigin,
|
if unsafe {
|
||||||
&mut event, mem::size_of_val(&event) as u32,
|
self.0.PollNextEventWithPose.unwrap()(
|
||||||
&mut pose as *mut _ as *mut _) }
|
origin as sys::ETrackingUniverseOrigin,
|
||||||
{
|
&mut event,
|
||||||
|
mem::size_of_val(&event) as u32,
|
||||||
|
&mut pose as *mut _ as *mut _,
|
||||||
|
)
|
||||||
|
} {
|
||||||
Some((event.into(), pose))
|
Some((event.into(), pose))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -122,11 +143,8 @@ impl System {
|
|||||||
/// Gets the result of a single distortion value for use in a distortion map. Input UVs are in a single eye's viewport, and output UVs are for the source render target in the distortion shader.
|
/// Gets the result of a single distortion value for use in a distortion map. Input UVs are in a single eye's viewport, and output UVs are for the source render target in the distortion shader.
|
||||||
pub fn compute_distortion(&self, eye: Eye, u: f32, v: f32) -> Option<DistortionCoordinates> {
|
pub fn compute_distortion(&self, eye: Eye, u: f32, v: f32) -> Option<DistortionCoordinates> {
|
||||||
let mut coord = unsafe { mem::uninitialized() };
|
let mut coord = unsafe { mem::uninitialized() };
|
||||||
let success = unsafe { self.0.ComputeDistortion.unwrap()(
|
let success =
|
||||||
eye as sys::EVREye,
|
unsafe { self.0.ComputeDistortion.unwrap()(eye as sys::EVREye, u, v, &mut coord) };
|
||||||
u, v,
|
|
||||||
&mut coord
|
|
||||||
) };
|
|
||||||
|
|
||||||
if !success {
|
if !success {
|
||||||
return None;
|
return None;
|
||||||
@ -135,78 +153,154 @@ impl System {
|
|||||||
Some(DistortionCoordinates {
|
Some(DistortionCoordinates {
|
||||||
red: coord.rfRed,
|
red: coord.rfRed,
|
||||||
blue: coord.rfBlue,
|
blue: coord.rfBlue,
|
||||||
green: coord.rfGreen
|
green: coord.rfGreen,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the device index associated with a specific role, for example the left hand or the right hand.
|
/// Returns the device index associated with a specific role, for example the left hand or the right hand.
|
||||||
pub fn tracked_device_index_for_controller_role(&self, role: TrackedControllerRole) -> Option<TrackedDeviceIndex> {
|
pub fn tracked_device_index_for_controller_role(
|
||||||
let x = unsafe { self.0.GetTrackedDeviceIndexForControllerRole.unwrap()(role as sys::ETrackedControllerRole) };
|
&self,
|
||||||
if x == tracked_device_index::INVALID { None } else { Some(x) }
|
role: TrackedControllerRole,
|
||||||
|
) -> Option<TrackedDeviceIndex> {
|
||||||
|
let x = unsafe {
|
||||||
|
self.0.GetTrackedDeviceIndexForControllerRole.unwrap()(
|
||||||
|
role as sys::ETrackedControllerRole,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
if x == tracked_device_index::INVALID {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(x)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the controller type associated with a device index.
|
/// Returns the controller type associated with a device index.
|
||||||
pub fn get_controller_role_for_tracked_device_index(&self, i: TrackedDeviceIndex) -> Option<TrackedControllerRole> {
|
pub fn get_controller_role_for_tracked_device_index(
|
||||||
|
&self,
|
||||||
|
i: TrackedDeviceIndex,
|
||||||
|
) -> Option<TrackedControllerRole> {
|
||||||
let x = unsafe { self.0.GetControllerRoleForTrackedDeviceIndex.unwrap()(i) };
|
let x = unsafe { self.0.GetControllerRoleForTrackedDeviceIndex.unwrap()(i) };
|
||||||
match x {
|
match x {
|
||||||
sys::ETrackedControllerRole_TrackedControllerRole_LeftHand => Some(TrackedControllerRole::LeftHand),
|
sys::ETrackedControllerRole_TrackedControllerRole_LeftHand => {
|
||||||
sys::ETrackedControllerRole_TrackedControllerRole_RightHand => Some(TrackedControllerRole::RightHand),
|
Some(TrackedControllerRole::LeftHand)
|
||||||
|
}
|
||||||
|
sys::ETrackedControllerRole_TrackedControllerRole_RightHand => {
|
||||||
|
Some(TrackedControllerRole::RightHand)
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vulkan_output_device(&self, instance: *mut VkInstance_T) -> Option<*mut VkPhysicalDevice_T> {
|
pub fn vulkan_output_device(
|
||||||
|
&self,
|
||||||
|
instance: *mut VkInstance_T,
|
||||||
|
) -> Option<*mut VkPhysicalDevice_T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut device = mem::uninitialized();
|
let mut device = mem::uninitialized();
|
||||||
self.0.GetOutputDevice.unwrap()(&mut device, sys::ETextureType_TextureType_Vulkan, instance);
|
self.0.GetOutputDevice.unwrap()(
|
||||||
if device == 0 { None } else { Some(device as usize as *mut _) }
|
&mut device,
|
||||||
|
sys::ETextureType_TextureType_Vulkan,
|
||||||
|
instance,
|
||||||
|
);
|
||||||
|
if device == 0 {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(device as usize as *mut _)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn bool_tracked_device_property(&self, device: TrackedDeviceIndex, property: TrackedDeviceProperty) -> Result<bool, TrackedPropertyError> {
|
pub fn bool_tracked_device_property(
|
||||||
|
&self,
|
||||||
|
device: TrackedDeviceIndex,
|
||||||
|
property: TrackedDeviceProperty,
|
||||||
|
) -> Result<bool, TrackedPropertyError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut error: TrackedPropertyError = mem::uninitialized();
|
let mut error: TrackedPropertyError = mem::uninitialized();
|
||||||
let r = self.0.GetBoolTrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
let r = self.0.GetBoolTrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
||||||
if error == tracked_property_error::SUCCESS { Ok(r) } else { Err(error) }
|
if error == tracked_property_error::SUCCESS {
|
||||||
|
Ok(r)
|
||||||
|
} else {
|
||||||
|
Err(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn float_tracked_device_property(&self, device: TrackedDeviceIndex, property: TrackedDeviceProperty) -> Result<f32, TrackedPropertyError> {
|
pub fn float_tracked_device_property(
|
||||||
|
&self,
|
||||||
|
device: TrackedDeviceIndex,
|
||||||
|
property: TrackedDeviceProperty,
|
||||||
|
) -> Result<f32, TrackedPropertyError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut error: TrackedPropertyError = mem::uninitialized();
|
let mut error: TrackedPropertyError = mem::uninitialized();
|
||||||
let r = self.0.GetFloatTrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
let r = self.0.GetFloatTrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
||||||
if error == tracked_property_error::SUCCESS { Ok(r) } else { Err(error) }
|
if error == tracked_property_error::SUCCESS {
|
||||||
|
Ok(r)
|
||||||
|
} else {
|
||||||
|
Err(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn int32_tracked_device_property(&self, device: TrackedDeviceIndex, property: TrackedDeviceProperty) -> Result<i32, TrackedPropertyError> {
|
pub fn int32_tracked_device_property(
|
||||||
|
&self,
|
||||||
|
device: TrackedDeviceIndex,
|
||||||
|
property: TrackedDeviceProperty,
|
||||||
|
) -> Result<i32, TrackedPropertyError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut error: TrackedPropertyError = mem::uninitialized();
|
let mut error: TrackedPropertyError = mem::uninitialized();
|
||||||
let r = self.0.GetInt32TrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
let r = self.0.GetInt32TrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
||||||
if error == tracked_property_error::SUCCESS { Ok(r) } else { Err(error) }
|
if error == tracked_property_error::SUCCESS {
|
||||||
|
Ok(r)
|
||||||
|
} else {
|
||||||
|
Err(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uint64_tracked_device_property(&self, device: TrackedDeviceIndex, property: TrackedDeviceProperty) -> Result<u64, TrackedPropertyError> {
|
pub fn uint64_tracked_device_property(
|
||||||
|
&self,
|
||||||
|
device: TrackedDeviceIndex,
|
||||||
|
property: TrackedDeviceProperty,
|
||||||
|
) -> Result<u64, TrackedPropertyError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut error: TrackedPropertyError = mem::uninitialized();
|
let mut error: TrackedPropertyError = mem::uninitialized();
|
||||||
let r = self.0.GetUint64TrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
let r = self.0.GetUint64TrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
||||||
if error == tracked_property_error::SUCCESS { Ok(r) } else { Err(error) }
|
if error == tracked_property_error::SUCCESS {
|
||||||
|
Ok(r)
|
||||||
|
} else {
|
||||||
|
Err(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn matrix34_tracked_device_property(&self, device: TrackedDeviceIndex, property: TrackedDeviceProperty) -> Result<[[f32; 4]; 3], TrackedPropertyError> {
|
pub fn matrix34_tracked_device_property(
|
||||||
|
&self,
|
||||||
|
device: TrackedDeviceIndex,
|
||||||
|
property: TrackedDeviceProperty,
|
||||||
|
) -> Result<[[f32; 4]; 3], TrackedPropertyError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut error: TrackedPropertyError = mem::uninitialized();
|
let mut error: TrackedPropertyError = mem::uninitialized();
|
||||||
let r = self.0.GetMatrix34TrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
let r =
|
||||||
if error == tracked_property_error::SUCCESS { Ok(r.m) } else { Err(error) }
|
self.0.GetMatrix34TrackedDeviceProperty.unwrap()(device, property, &mut error.0);
|
||||||
|
if error == tracked_property_error::SUCCESS {
|
||||||
|
Ok(r.m)
|
||||||
|
} else {
|
||||||
|
Err(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn string_tracked_device_property(&self, device: TrackedDeviceIndex, property: TrackedDeviceProperty) -> Result<CString, TrackedPropertyError> {
|
pub fn string_tracked_device_property(
|
||||||
|
&self,
|
||||||
|
device: TrackedDeviceIndex,
|
||||||
|
property: TrackedDeviceProperty,
|
||||||
|
) -> Result<CString, TrackedPropertyError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut error = mem::uninitialized();
|
let mut error = mem::uninitialized();
|
||||||
let res = get_string(|ptr, n| self.0.GetStringTrackedDeviceProperty.unwrap()(device, property, ptr, n, &mut error));
|
let res = get_string(|ptr, n| {
|
||||||
|
self.0.GetStringTrackedDeviceProperty.unwrap()(device, property, ptr, n, &mut error)
|
||||||
|
});
|
||||||
res.map_or(Err(TrackedPropertyError(error)), Ok)
|
res.map_or(Err(TrackedPropertyError(error)), Ok)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,8 +320,17 @@ impl System {
|
|||||||
/// full-screen quads. The visible area mesh covers all of the pixels the hidden area mesh does not cover.
|
/// full-screen quads. The visible area mesh covers all of the pixels the hidden area mesh does not cover.
|
||||||
// TODO: Handle line loops with a separate method and return type, since HiddenAreaMesh assumes triangles.
|
// TODO: Handle line loops with a separate method and return type, since HiddenAreaMesh assumes triangles.
|
||||||
pub fn hidden_area_mesh(&self, eye: Eye, ty: HiddenAreaMeshType) -> Option<HiddenAreaMesh> {
|
pub fn hidden_area_mesh(&self, eye: Eye, ty: HiddenAreaMeshType) -> Option<HiddenAreaMesh> {
|
||||||
let mesh = unsafe { self.0.GetHiddenAreaMesh.unwrap()(eye as sys::EVREye, ty as sys::EHiddenAreaMeshType) };
|
let mesh = unsafe {
|
||||||
if mesh.pVertexData == ptr::null_mut() { None } else { Some(HiddenAreaMesh { mesh, _phantom: PhantomData }) }
|
self.0.GetHiddenAreaMesh.unwrap()(eye as sys::EVREye, ty as sys::EHiddenAreaMeshType)
|
||||||
|
};
|
||||||
|
if mesh.pVertexData == ptr::null_mut() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(HiddenAreaMesh {
|
||||||
|
mesh,
|
||||||
|
_phantom: PhantomData,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Looks up the current input state of a controller.
|
/// Looks up the current input state of a controller.
|
||||||
@ -239,7 +342,11 @@ impl System {
|
|||||||
pub fn controller_state(&self, device: TrackedDeviceIndex) -> Option<ControllerState> {
|
pub fn controller_state(&self, device: TrackedDeviceIndex) -> Option<ControllerState> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut state = mem::uninitialized();
|
let mut state = mem::uninitialized();
|
||||||
if self.0.GetControllerState.unwrap()(device, &mut state as *mut _ as *mut _, mem::size_of_val(&state) as u32) {
|
if self.0.GetControllerState.unwrap()(
|
||||||
|
device,
|
||||||
|
&mut state as *mut _ as *mut _,
|
||||||
|
mem::size_of_val(&state) as u32,
|
||||||
|
) {
|
||||||
Some(state)
|
Some(state)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -248,14 +355,21 @@ impl System {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// See `controller_state`
|
/// See `controller_state`
|
||||||
pub fn controller_state_with_pose(&self, origin: TrackingUniverseOrigin, device: TrackedDeviceIndex) -> Option<(ControllerState, TrackedDevicePose)> {
|
pub fn controller_state_with_pose(
|
||||||
|
&self,
|
||||||
|
origin: TrackingUniverseOrigin,
|
||||||
|
device: TrackedDeviceIndex,
|
||||||
|
) -> Option<(ControllerState, TrackedDevicePose)> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut state = mem::uninitialized();
|
let mut state = mem::uninitialized();
|
||||||
let mut pose = mem::uninitialized();
|
let mut pose = mem::uninitialized();
|
||||||
if self.0.GetControllerStateWithPose.unwrap()(
|
if self.0.GetControllerStateWithPose.unwrap()(
|
||||||
origin as sys::ETrackingUniverseOrigin,
|
origin as sys::ETrackingUniverseOrigin,
|
||||||
device, &mut state as *mut _ as *mut _, mem::size_of_val(&state) as u32,
|
device,
|
||||||
&mut pose) {
|
&mut state as *mut _ as *mut _,
|
||||||
|
mem::size_of_val(&state) as u32,
|
||||||
|
&mut pose,
|
||||||
|
) {
|
||||||
Some((state, pose.into()))
|
Some((state, pose.into()))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -277,7 +391,9 @@ impl System {
|
|||||||
///
|
///
|
||||||
/// This extends the timeout until the process is killed.
|
/// This extends the timeout until the process is killed.
|
||||||
pub fn acknowledge_quit_exiting(&self) {
|
pub fn acknowledge_quit_exiting(&self) {
|
||||||
unsafe { self.0.AcknowledgeQuit_Exiting.unwrap()(); }
|
unsafe {
|
||||||
|
self.0.AcknowledgeQuit_Exiting.unwrap()();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Call this to tell the system that the user is being prompted to save data.
|
/// Call this to tell the system that the user is being prompted to save data.
|
||||||
@ -285,7 +401,9 @@ impl System {
|
|||||||
/// This halts the timeout and dismisses the dashboard (if it was up). Applications should be sure to actually
|
/// This halts the timeout and dismisses the dashboard (if it was up). Applications should be sure to actually
|
||||||
/// prompt the user to save and then exit afterward, otherwise the user will be left in a confusing state.
|
/// prompt the user to save and then exit afterward, otherwise the user will be left in a confusing state.
|
||||||
pub fn acknowledge_quit_user_prompt(&self) {
|
pub fn acknowledge_quit_user_prompt(&self) {
|
||||||
unsafe { self.0.AcknowledgeQuit_UserPrompt.unwrap()(); }
|
unsafe {
|
||||||
|
self.0.AcknowledgeQuit_UserPrompt.unwrap()();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the zero pose for the seated tracker coordinate system to the current position and yaw of the HMD.
|
/// Sets the zero pose for the seated tracker coordinate system to the current position and yaw of the HMD.
|
||||||
@ -299,7 +417,9 @@ impl System {
|
|||||||
/// NOTE: This function overrides the user's previously saved seated zero pose and should only be called as the
|
/// NOTE: This function overrides the user's previously saved seated zero pose and should only be called as the
|
||||||
/// result of a user action. Users are also able to set their seated zero pose via the OpenVR Dashboard.
|
/// result of a user action. Users are also able to set their seated zero pose via the OpenVR Dashboard.
|
||||||
pub fn reset_seated_zero_pose(&self) {
|
pub fn reset_seated_zero_pose(&self) {
|
||||||
unsafe { self.0.ResetSeatedZeroPose.unwrap()(); }
|
unsafe {
|
||||||
|
self.0.ResetSeatedZeroPose.unwrap()();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,18 +449,30 @@ pub struct TrackedPropertyError(sys::TrackedPropertyError);
|
|||||||
pub mod tracked_property_error {
|
pub mod tracked_property_error {
|
||||||
use super::{sys, TrackedPropertyError};
|
use super::{sys, TrackedPropertyError};
|
||||||
|
|
||||||
pub const SUCCESS: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_Success);
|
pub const SUCCESS: TrackedPropertyError =
|
||||||
pub const WRONG_DATA_TYPE: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_WrongDataType);
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_Success);
|
||||||
pub const WRONG_DEVICE_CLASS: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_WrongDeviceClass);
|
pub const WRONG_DATA_TYPE: TrackedPropertyError =
|
||||||
pub const BUFFER_TOO_SMALL: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_BufferTooSmall);
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_WrongDataType);
|
||||||
pub const UNKNOWN_PROPERTY: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_UnknownProperty);
|
pub const WRONG_DEVICE_CLASS: TrackedPropertyError =
|
||||||
pub const INVALID_DEVICE: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_InvalidDevice);
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_WrongDeviceClass);
|
||||||
pub const COULD_NOT_CONTACT_SERVER: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_CouldNotContactServer);
|
pub const BUFFER_TOO_SMALL: TrackedPropertyError =
|
||||||
pub const VALUE_NOT_PROVIDED_BY_DEVICE: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_ValueNotProvidedByDevice);
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_BufferTooSmall);
|
||||||
pub const STRING_EXCEEDS_MAXIMUM_LENGTH: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_StringExceedsMaximumLength);
|
pub const UNKNOWN_PROPERTY: TrackedPropertyError =
|
||||||
pub const NOT_YET_AVAILABLE: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_NotYetAvailable);
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_UnknownProperty);
|
||||||
pub const PERMISSION_DENIED: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_PermissionDenied);
|
pub const INVALID_DEVICE: TrackedPropertyError =
|
||||||
pub const INVALID_OPERATION: TrackedPropertyError = TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_InvalidOperation);
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_InvalidDevice);
|
||||||
|
pub const COULD_NOT_CONTACT_SERVER: TrackedPropertyError =
|
||||||
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_CouldNotContactServer);
|
||||||
|
pub const VALUE_NOT_PROVIDED_BY_DEVICE: TrackedPropertyError =
|
||||||
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_ValueNotProvidedByDevice);
|
||||||
|
pub const STRING_EXCEEDS_MAXIMUM_LENGTH: TrackedPropertyError =
|
||||||
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_StringExceedsMaximumLength);
|
||||||
|
pub const NOT_YET_AVAILABLE: TrackedPropertyError =
|
||||||
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_NotYetAvailable);
|
||||||
|
pub const PERMISSION_DENIED: TrackedPropertyError =
|
||||||
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_PermissionDenied);
|
||||||
|
pub const INVALID_OPERATION: TrackedPropertyError =
|
||||||
|
TrackedPropertyError(sys::ETrackedPropertyError_TrackedProp_InvalidOperation);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for TrackedPropertyError {
|
impl fmt::Debug for TrackedPropertyError {
|
||||||
@ -384,7 +516,9 @@ pub enum HiddenAreaMeshType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HiddenAreaMeshType {
|
impl Default for HiddenAreaMeshType {
|
||||||
fn default() -> Self { HiddenAreaMeshType::Standard }
|
fn default() -> Self {
|
||||||
|
HiddenAreaMeshType::Standard
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A triangle mesh containing geometry determined by `HiddenAreaMeshType`.
|
/// A triangle mesh containing geometry determined by `HiddenAreaMeshType`.
|
||||||
@ -399,6 +533,11 @@ pub struct HiddenAreaMesh<'a> {
|
|||||||
impl<'a> ::std::ops::Deref for HiddenAreaMesh<'a> {
|
impl<'a> ::std::ops::Deref for HiddenAreaMesh<'a> {
|
||||||
type Target = [[f32; 2]];
|
type Target = [[f32; 2]];
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
unsafe { slice::from_raw_parts(&(*self.mesh.pVertexData).v, self.mesh.unTriangleCount as usize * 3) }
|
unsafe {
|
||||||
|
slice::from_raw_parts(
|
||||||
|
&(*self.mesh.pVertexData).v,
|
||||||
|
self.mesh.unTriangleCount as usize * 3,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,15 @@ pub enum TrackingUniverseOrigin {
|
|||||||
pub struct TrackedDevicePose(sys::TrackedDevicePose_t);
|
pub struct TrackedDevicePose(sys::TrackedDevicePose_t);
|
||||||
|
|
||||||
impl TrackedDevicePose {
|
impl TrackedDevicePose {
|
||||||
pub fn device_to_absolute_tracking(&self) -> &[[f32; 4]; 3] { &self.0.mDeviceToAbsoluteTracking.m }
|
pub fn device_to_absolute_tracking(&self) -> &[[f32; 4]; 3] {
|
||||||
pub fn velocity(&self) -> &[f32; 3] { &self.0.vVelocity.v }
|
&self.0.mDeviceToAbsoluteTracking.m
|
||||||
pub fn angular_velocity(&self) -> &[f32; 3] { &self.0.vAngularVelocity.v }
|
}
|
||||||
|
pub fn velocity(&self) -> &[f32; 3] {
|
||||||
|
&self.0.vVelocity.v
|
||||||
|
}
|
||||||
|
pub fn angular_velocity(&self) -> &[f32; 3] {
|
||||||
|
&self.0.vAngularVelocity.v
|
||||||
|
}
|
||||||
pub fn tracking_result(&self) -> TrackingResult {
|
pub fn tracking_result(&self) -> TrackingResult {
|
||||||
use self::TrackingResult::*;
|
use self::TrackingResult::*;
|
||||||
match self.0.eTrackingResult {
|
match self.0.eTrackingResult {
|
||||||
@ -23,15 +29,21 @@ impl TrackedDevicePose {
|
|||||||
sys::ETrackingResult_TrackingResult_Calibrating_OutOfRange => CalibratingOutOfRange,
|
sys::ETrackingResult_TrackingResult_Calibrating_OutOfRange => CalibratingOutOfRange,
|
||||||
sys::ETrackingResult_TrackingResult_Running_OK => OK,
|
sys::ETrackingResult_TrackingResult_Running_OK => OK,
|
||||||
sys::ETrackingResult_TrackingResult_Running_OutOfRange => RunningOutOfRange,
|
sys::ETrackingResult_TrackingResult_Running_OutOfRange => RunningOutOfRange,
|
||||||
_ => panic!("unrecognized tracking result")
|
_ => panic!("unrecognized tracking result"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn pose_is_valid(&self) -> bool { self.0.bPoseIsValid }
|
pub fn pose_is_valid(&self) -> bool {
|
||||||
pub fn device_is_connected(&self) -> bool { self.0.bDeviceIsConnected }
|
self.0.bPoseIsValid
|
||||||
|
}
|
||||||
|
pub fn device_is_connected(&self) -> bool {
|
||||||
|
self.0.bDeviceIsConnected
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<sys::TrackedDevicePose_t> for TrackedDevicePose {
|
impl From<sys::TrackedDevicePose_t> for TrackedDevicePose {
|
||||||
fn from(x: sys::TrackedDevicePose_t) -> Self { TrackedDevicePose(x) }
|
fn from(x: sys::TrackedDevicePose_t) -> Self {
|
||||||
|
TrackedDevicePose(x)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||||
|
Reference in New Issue
Block a user