51 lines
1.1 KiB
Rust
51 lines
1.1 KiB
Rust
|
use self::rendering::Rendering;
|
||
|
|
||
|
mod rendering;
|
||
|
|
||
|
use anyhow::Result;
|
||
|
use std::sync::Arc;
|
||
|
use vulkan_rs::prelude::*;
|
||
|
|
||
|
#[derive(Default)]
|
||
|
pub struct Overlay {
|
||
|
instance: Option<Arc<Instance>>,
|
||
|
device: Option<Arc<Device>>,
|
||
|
rendering: Option<Rendering>,
|
||
|
}
|
||
|
|
||
|
impl Overlay {
|
||
|
pub const fn new() -> Self {
|
||
|
Self {
|
||
|
instance: None,
|
||
|
device: None,
|
||
|
rendering: None,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub fn set_instance(&mut self, instance: Arc<Instance>) {
|
||
|
self.instance = Some(instance);
|
||
|
}
|
||
|
|
||
|
pub fn instance(&self) -> Arc<Instance> {
|
||
|
self.instance.as_ref().unwrap().clone()
|
||
|
}
|
||
|
|
||
|
pub fn set_device(&mut self, device: Arc<Device>) {
|
||
|
self.device = Some(device);
|
||
|
}
|
||
|
|
||
|
pub fn device(&self) -> Arc<Device> {
|
||
|
self.device.as_ref().unwrap().clone()
|
||
|
}
|
||
|
|
||
|
pub fn create_rendering(&mut self, swapchain: Arc<Swapchain>) -> Result<()> {
|
||
|
self.rendering = Some(Rendering::new(swapchain));
|
||
|
|
||
|
Ok(())
|
||
|
}
|
||
|
|
||
|
pub fn render(&mut self) -> Result<VkSubmitInfo> {
|
||
|
self.rendering.as_mut().unwrap().render()
|
||
|
}
|
||
|
}
|