kitgit

tirbofish/dropbear · commit

f5747595dd9ab1056f5109e38e2acfe3f71a804d

wip: morph targets im trying to get them to work (and they do morph), except all other animated meshrenderers get their vertices manipulated for some reason.

Unverified

Thribhu K <4tkbytes@pm.me> · 2026-02-25 11:53

view full diff

diff --git a/crates/dropbear-engine/src/animation.rs b/crates/dropbear-engine/src/animation.rs
index 5380ef8..8644870 100644
--- a/crates/dropbear-engine/src/animation.rs
+++ b/crates/dropbear-engine/src/animation.rs
@@ -8,9 +8,12 @@ use std::sync::Arc;
 #[repr(C)]
 #[derive(Copy, Clone, Default, Debug, bytemuck::Pod, bytemuck::Zeroable)]
 pub struct MorphTargetInfo {
-    num_vertices: u32,
-    num_targets: u32,
-    _padding: [u32; 2],
+    pub num_vertices: u32,
+    pub num_targets: u32,
+    pub base_offset: u32,
+    pub weight_offset: u32,
+    pub uses_morph: u32, // 0,1 bool
+    pub _padding: [u32; 3],
 }
 
 #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
@@ -51,6 +54,9 @@ pub struct AnimationComponent {
 
     #[serde(skip)]
     pub morph_weights: HashMap<usize, Vec<f32>>,
+
+    #[serde(skip)]
+    pub morph_weight_count: u32,
 }
 
 #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
@@ -90,6 +96,7 @@ impl Default for AnimationComponent {
             available_animations: vec![],
             last_animation_index: None,
             morph_weights: HashMap::new(),
+            morph_weight_count: 0,
             skinning_buffer: None,
             morph_deltas_buffer: None,
             morph_weights_buffer: None,
@@ -146,6 +153,8 @@ impl AnimationComponent {
             return;
         }
         let animation = &model.animations[anim_idx];
+        self.morph_weights.clear();
+        self.morph_weight_count = 0;
 
         settings.time += dt * settings.speed;
         if settings.looping {
@@ -357,6 +366,8 @@ impl AnimationComponent {
 
     fn reset_to_bind_pose(&mut self, model: &Model) {

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