use crate::core::{RaylibHandle, RaylibThread};
use crate::ffi;
make_thin_wrapper!(
VrStereoConfig,
ffi::VrStereoConfig,
ffi::UnloadVrStereoConfig
);
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct VrDeviceInfo {
pub h_resolution: i32, pub v_esolution: i32, pub h_screen_size: f32, pub v_screen_size: f32, pub eye_to_screen_distance: f32, pub lens_separation_distance: f32, pub interpupillary_distance: f32, pub lens_distortion_values: [f32; 4], pub chroma_ab_correction: [f32; 4], }
impl From<ffi::VrDeviceInfo> for VrDeviceInfo {
fn from(v: ffi::VrDeviceInfo) -> VrDeviceInfo {
unsafe { std::mem::transmute(v) }
}
}
impl Into<ffi::VrDeviceInfo> for VrDeviceInfo {
fn into(self) -> ffi::VrDeviceInfo {
unsafe { std::mem::transmute(self) }
}
}
impl Into<ffi::VrDeviceInfo> for &VrDeviceInfo {
fn into(self) -> ffi::VrDeviceInfo {
ffi::VrDeviceInfo {
hResolution: self.h_resolution, vResolution: self.v_esolution, hScreenSize: self.h_screen_size, vScreenSize: self.v_screen_size, eyeToScreenDistance: self.eye_to_screen_distance, lensSeparationDistance: self.lens_separation_distance, interpupillaryDistance: self.interpupillary_distance, lensDistortionValues: self.lens_distortion_values, chromaAbCorrection: self.chroma_ab_correction,
}
}
}
impl RaylibHandle {
pub fn load_vr_stereo_config(
&mut self,
_: &RaylibThread,
device: impl Into<ffi::VrDeviceInfo>,
) -> VrStereoConfig {
VrStereoConfig(unsafe { ffi::LoadVrStereoConfig(device.into()) })
}
}