Some cleanup

master
Wynd 2024-11-08 13:08:12 +02:00
parent 9127c4ddac
commit 5e8716acf0
4 changed files with 3 additions and 22 deletions

View File

@ -27,12 +27,6 @@ cgmath = "0.18"
[profile.dev] [profile.dev]
codegen-backend = "cranelift" codegen-backend = "cranelift"
opt-level = 0
lto = false
incremental = true
[profile.release] [profile.release]
opt-level = 3
strip = true strip = true
lto = true
codegen-units = 1

View File

@ -59,9 +59,9 @@ impl<'a> ApplicationHandler for App<'a> {
event_loop.exit(); event_loop.exit();
} }
WindowEvent::RedrawRequested => { WindowEvent::RedrawRequested => {
state.window.request_redraw();
state.update(); state.update();
state.render().unwrap(); state.render().unwrap();
state.window.request_redraw();
} }
WindowEvent::Resized(new_size) => { WindowEvent::Resized(new_size) => {
state.resize(new_size); state.resize(new_size);

View File

@ -11,18 +11,9 @@ pub mod vertex;
pub fn capture() -> anyhow::Result<()> { pub fn capture() -> anyhow::Result<()> {
let event_loop = EventLoop::new()?; let event_loop = EventLoop::new()?;
event_loop.set_control_flow(ControlFlow::Wait); event_loop.set_control_flow(ControlFlow::Poll);
let mut app = App::default(); let mut app = App::default();
Ok(event_loop.run_app(&mut app)?) Ok(event_loop.run_app(&mut app)?)
} }
pub fn ease_in_out_cubic(x: f32) -> f32 {
if x < 0.5 {
4.0 * x * x * x
}
else {
1.0 - (-2.0 * x + 2.0).powf(3.0) / 2.0
}
}

View File

@ -6,7 +6,7 @@ use winit::{
keyboard::{Key, NamedKey}, keyboard::{Key, NamedKey},
}; };
use crate::{controller::CameraController, ease_in_out_cubic}; use crate::controller::CameraController;
const REFRESH_RATE: f32 = 1.0 / 60.0; const REFRESH_RATE: f32 = 1.0 / 60.0;
@ -14,12 +14,10 @@ pub struct Spotlight {
window: Arc<winit::window::Window>, window: Arc<winit::window::Window>,
cursor_position: (f32, f32), cursor_position: (f32, f32),
accel: f32,
size: f32, size: f32,
delta_size: f32, delta_size: f32,
is_ctrl_pressed: bool, is_ctrl_pressed: bool,
scrolling: f32,
} }
pub struct SpotlightInfo { pub struct SpotlightInfo {
@ -35,12 +33,10 @@ impl Spotlight {
window, window,
cursor_position: (960.0, 540.0), cursor_position: (960.0, 540.0),
accel: 0.0,
size: 50.0, size: 50.0,
delta_size: 0.0, delta_size: 0.0,
is_ctrl_pressed: false, is_ctrl_pressed: false,
scrolling: 0.0,
}; };
let layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { let layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {