This commit is contained in:
2026-03-10 07:25:37 -07:00
parent 935cc87663
commit 3f0acaae30
2 changed files with 42 additions and 11 deletions

View File

@@ -2,14 +2,5 @@ pub mod bot;
pub mod head;
pub mod time;
pub mod state;
// pub mod surface;
pub mod surface;
pub mod graphics;
// Create Surface
// Create Graphics from map file and with surface as sample
// Create bot from bot file
// Create playback head
// loop{
// advance head
// render frame
// }

View File

@@ -1,2 +1,42 @@
/// A texture view which can be targetted by draw calls in the command buffer, and then presented to the surface texture.
pub struct Frame{
surface_texture:wgpu::SurfaceTexture,
view:wgpu::TextureView,
}
impl Frame{
pub const fn view(&self)->&wgpu::TextureView{
&self.view
}
pub fn present(self){
self.surface_texture.present();
}
}
/// A render surface configuration, containing information such as resolution and pixel format
pub struct Surface{}
pub struct Surface<'window>{
surface:wgpu::Surface<'window>,
config:wgpu::SurfaceConfiguration,
}
impl Surface<'_>{
#[must_use]
pub fn new_frame(&self,device:&wgpu::Device)->Frame{
let frame=match self.surface.get_current_texture(){
Ok(frame)=>frame,
Err(_)=>{
self.surface.configure(device,&self.config);
self.surface
.get_current_texture()
.expect("Failed to acquire next surface texture!")
}
};
let view=frame.texture.create_view(&wgpu::TextureViewDescriptor{
format:Some(self.config.view_formats[0]),
..wgpu::TextureViewDescriptor::default()
});
Frame{
surface_texture:frame,
view,
}
}
}