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