engine/presentation/src/vri/mod.rs
2025-02-26 14:51:44 +01:00

134 lines
3.2 KiB
Rust

#[cfg(feature = "OpenVR")]
pub mod openvrintegration;
#[cfg(not(feature = "OpenVR"))]
pub mod openvrintegration {
use crate::Result;
use vulkan_rs::prelude::*;
use std::sync::Arc;
pub struct OpenVRIntegration;
impl OpenVRIntegration {
pub fn new() -> Result<Self> {
panic!("Feature OpenVR is not enabled!")
}
pub fn activate_vulkan_instance_extensions(
&self,
_: &mut InstanceExtensions,
) -> Result<()> {
unimplemented!()
}
pub fn activate_vulkan_device_extensions(
&self,
_: &mut DeviceExtensions,
_: &Arc<PhysicalDevice>,
) -> Result<()> {
unimplemented!()
}
pub fn physical_device(&self, _: &Arc<Instance>) -> Option<VkPhysicalDevice> {
unimplemented!()
}
}
impl std::fmt::Debug for OpenVRIntegration {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "OpenVRIntegration {{ }}")
}
}
}
#[cfg(feature = "OpenVR")]
pub mod openvrrendercore;
#[cfg(not(feature = "OpenVR"))]
pub mod openvrrendercore {
use crate::Result;
use ecs::World;
use ui::prelude::*;
use vulkan_rs::prelude::*;
use std::sync::{Arc, Mutex};
use super::openvrintegration::OpenVRIntegration;
use crate::RenderCoreCreateInfo;
use crate::prelude::*;
pub struct OpenVRRenderCore {
_dummy: u32,
}
impl OpenVRRenderCore {
pub fn new(
_: &OpenVRIntegration,
_: &Arc<Device>,
_: &Arc<Mutex<Queue>>,
_: RenderCoreCreateInfo,
) -> Result<(Self, TargetMode<()>)> {
panic!("Feature OpenVR is not enabled!")
}
}
impl RenderCore for OpenVRRenderCore {
fn format(&self) -> VkFormat {
unimplemented!()
}
fn resize(&mut self, _: &mut World, _: u32, _: u32) -> Result<()> {
unimplemented!()
}
fn next_frame(&mut self, _: &mut World) -> Result<bool> {
unimplemented!()
}
fn set_clear_color(&self, _: [f32; 4]) {
unimplemented!()
}
// post process handling
fn add_post_processing_routine(&self, _post_process: Arc<dyn PostProcess>) {
unimplemented!()
}
fn remove_post_processing_routine(&self, _post_process: Arc<dyn PostProcess>) {
unimplemented!()
}
fn clear_post_processing_routines(&self) {
unimplemented!()
}
// getter
fn image_count(&self) -> usize {
unimplemented!()
}
fn images(&self) -> TargetMode<Vec<Arc<Image>>> {
unimplemented!()
}
fn width(&self) -> u32 {
unimplemented!()
}
fn height(&self) -> u32 {
unimplemented!()
}
fn transformations(&self) -> Option<(VRTransformations, VRTransformations)> {
unimplemented!()
}
}
impl std::fmt::Debug for OpenVRRenderCore {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "OpenVRRenderCore {{ }}")
}
}
}