dave: switch to logical time
Some checks failed
CI / Rustfmt + Clippy (push) Has been cancelled
CI / Check (android) (push) Has been cancelled
CI / Test (Linux) (push) Has been cancelled
CI / Test (macOS) (push) Has been cancelled
CI / Test (Windows) (push) Has been cancelled
CI / rpm/deb (aarch64) (push) Has been cancelled
CI / rpm/deb (x86_64) (push) Has been cancelled
CI / macOS dmg (aarch64) (push) Has been cancelled
CI / macOS dmg (x86_64) (push) Has been cancelled
CI / Windows Installer (aarch64) (push) Has been cancelled
CI / Windows Installer (x86_64) (push) Has been cancelled
CI / Upload Artifacts to Server (push) Has been cancelled

this fixes jumpy animations when we stop rendering

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-08-04 11:35:22 -07:00
parent 0770bab37c
commit 3451206f1a

View File

@@ -13,6 +13,7 @@ use std::borrow::Cow;
pub struct DaveAvatar { pub struct DaveAvatar {
rotation: Quaternion, rotation: Quaternion,
rot_dir: Vec3, rot_dir: Vec3,
logical_time: f32,
} }
// Matrix utilities for perspective projection // Matrix utilities for perspective projection
@@ -246,6 +247,7 @@ impl DaveAvatar {
}; };
Self { Self {
logical_time: 0.0,
rotation: initial_rot, rotation: initial_rot,
rot_dir: Vec3::new(0.0, 0.0, 0.0), rot_dir: Vec3::new(0.0, 0.0, 0.0),
} }
@@ -354,6 +356,8 @@ impl DaveAvatar {
-1.0 -1.0
}; };
self.logical_time += ui.ctx().input(|i| i.stable_dt.min(0.1));
// Add paint callback // Add paint callback
ui.painter().add(egui_wgpu::Callback::new_paint_callback( ui.painter().add(egui_wgpu::Callback::new_paint_callback(
rect, rect,
@@ -361,7 +365,7 @@ impl DaveAvatar {
view_proj, view_proj,
model, model,
camera_pos, camera_pos,
time: ui.ctx().input(|i| i.time as f32), time: self.logical_time,
is_light: [is_light, 0.0, 0.0, 0.0], is_light: [is_light, 0.0, 0.0, 0.0],
}, },
)); ));