kitgit

tirbofish/dropbear · diff

f4471a7 · Thribhu K

refactor: main shader, bind groups and textures. jarvis, run github actions

Unverified

diff --git a/crates/dropbear-engine/src/animation.rs b/crates/dropbear-engine/src/animation.rs
index 70da035..6701251 100644
--- a/crates/dropbear-engine/src/animation.rs
+++ b/crates/dropbear-engine/src/animation.rs
@@ -86,10 +86,12 @@ impl AnimationComponent {
         self.available_animations = model.animations.iter().map(|v| v.name.clone()).collect::<Vec<_>>();
 
         let Some(anim_idx) = self.active_animation_index else {
+            self.reset_to_bind_pose(model);
             return;
         };
 
         if anim_idx >= model.animations.len() {
+            self.reset_to_bind_pose(model);
             return;
         }
 
@@ -108,6 +110,7 @@ impl AnimationComponent {
             self.speed = settings.speed;
             self.looping = settings.looping;
             self.is_playing = settings.is_playing;
+            self.reset_to_bind_pose(model);
             return;
         }
         let animation = &model.animations[anim_idx];
@@ -129,6 +132,11 @@ impl AnimationComponent {
         self.looping = settings.looping;
         self.is_playing = settings.is_playing;
 
+        if !settings.is_playing {
+            self.reset_to_bind_pose(model);
+            return;
+        }
+
         for channel in &animation.channels {
             let count = channel.times.len();
             if count == 0 { continue; }
@@ -275,6 +283,11 @@ impl AnimationComponent {
         self.update_matrices(model);
     }
 
+    fn reset_to_bind_pose(&mut self, model: &Model) {
+        self.local_pose.clear();
+        self.update_matrices(model);
+    }
+
     fn apply_single_keyframe(
         channel: &crate::model::AnimationChannel,
         index: usize,
diff --git a/crates/dropbear-engine/src/asset.rs b/crates/dropbear-engine/src/asset.rs

Large diffs are not rendered by default. Showing the first 50 of 1592 lines. Show full diff