engine/presentation/src/xri/mod.rs
2024-08-23 13:22:09 +02:00

140 lines
3.3 KiB
Rust

#[cfg(feature = "OpenXR")]
pub mod openxrintegration;
#[cfg(not(feature = "OpenXR"))]
pub mod openxrintegration {
use crate::Result;
use vulkan_rs::prelude::*;
use std::sync::Arc;
use crate::prelude::*;
pub struct OpenXRIntegration;
impl OpenXRIntegration {
pub fn new(_: ApplicationInfo) -> Result<Self> {
panic!("Feature OpenXR is not enabled!")
}
pub fn activate_vulkan_instance_extensions(
&self,
_: &mut InstanceExtensions,
) -> Result<()> {
unimplemented!()
}
pub fn activate_vulkan_device_extensions(&self, _: &mut DeviceExtensions) -> Result<()> {
unimplemented!()
}
pub fn physical_device(&self, _: &Arc<Instance>) -> Result<VkPhysicalDevice> {
unimplemented!()
}
}
impl std::fmt::Debug for OpenXRIntegration {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "OpenXRIntegration {{ }}")
}
}
}
#[cfg(feature = "OpenXR")]
pub mod openxrrendercore;
#[cfg(not(feature = "OpenXR"))]
pub mod openxrrendercore {
use crate::Result;
use ui::prelude::*;
use vulkan_rs::prelude::*;
use std::sync::{Arc, Mutex};
use super::openxrintegration::OpenXRIntegration;
use crate::prelude::*;
use crate::RenderCoreCreateInfo;
pub struct OpenXRRenderCore {
_dummy: u32,
}
impl OpenXRRenderCore {
pub fn new(
_: &OpenXRIntegration,
_: &Arc<Device>,
_: &Arc<Mutex<Queue>>,
_: RenderCoreCreateInfo,
) -> Result<(Self, TargetMode<()>)> {
panic!("Feature OpenXR is not enabled!")
}
}
impl RenderCore for OpenXRRenderCore {
fn format(&self) -> VkFormat {
unimplemented!()
}
fn resize(&mut self, _: u32, _: u32) -> Result<()> {
unimplemented!()
}
fn next_frame(&mut self) -> Result<bool> {
unimplemented!()
}
fn set_clear_color(&self, _: [f32; 4]) {
unimplemented!()
}
// scene handling
fn scene(&self) -> &Box<dyn TScene> {
unimplemented!()
}
fn scene_mut(&mut self) -> &mut Box<dyn TScene> {
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 OpenXRRenderCore {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "OpenXRRenderCore {{ }}")
}
}
}