|
|
|
@ -471,13 +471,15 @@ impl State {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn resize(&mut self, new_size: winit::dpi::PhysicalSize<u32>) {
|
|
|
|
|
self.camera.aspect = self.sc_desc.width as f32 / self.sc_desc.height as f32;
|
|
|
|
|
self.size = new_size;
|
|
|
|
|
self.sc_desc.width = new_size.width;
|
|
|
|
|
self.sc_desc.height = new_size.height;
|
|
|
|
|
self.swap_chain = self.device.create_swap_chain(&self.surface, &self.sc_desc);
|
|
|
|
|
self.depth_texture =
|
|
|
|
|
texture::Texture::create_depth_texture(&self.device, &self.sc_desc, "depth_texture");
|
|
|
|
|
if new_size.width > 0 && new_size.height > 0 {
|
|
|
|
|
self.camera.aspect = self.sc_desc.width as f32 / self.sc_desc.height as f32;
|
|
|
|
|
self.size = new_size;
|
|
|
|
|
self.sc_desc.width = new_size.width;
|
|
|
|
|
self.sc_desc.height = new_size.height;
|
|
|
|
|
self.swap_chain = self.device.create_swap_chain(&self.surface, &self.sc_desc);
|
|
|
|
|
self.depth_texture =
|
|
|
|
|
texture::Texture::create_depth_texture(&self.device, &self.sc_desc, "depth_texture");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fn input(&mut self, event: &WindowEvent) -> bool {
|
|
|
|
|
self.camera_controller.process_events(event)
|
|
|
|
|