kitgit

tirbofish/dropbear · diff

fa395da · Thribhu K

wip: morph targets refactor: changed my mess of bind groups into one clean and organised thing :)

Unverified

diff --git a/crates/dropbear-engine/src/animation.rs b/crates/dropbear-engine/src/animation.rs
index b812f40..e067bef 100644
--- a/crates/dropbear-engine/src/animation.rs
+++ b/crates/dropbear-engine/src/animation.rs
@@ -28,14 +28,18 @@ pub struct AnimationComponent {
 
     #[serde(skip)]
     pub bone_buffer: Option<wgpu::Buffer>,
-    #[serde(skip)]
-    pub bind_group: Option<wgpu::BindGroup>,
 
     #[serde(skip)]
     pub available_animations: Vec<String>,
 
     #[serde(skip)]
     pub last_animation_index: Option<usize>,
+
+    #[serde(skip)]
+    pub morph_weights: HashMap<usize, Vec<f32>>,
+
+    #[serde(skip)]
+    pub morph_buffer: Option<wgpu::Buffer>,
 }
 
 #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
@@ -73,9 +77,10 @@ impl Default for AnimationComponent {
             local_pose: HashMap::new(),
             skinning_matrices: Vec::new(),
             bone_buffer: None,
-            bind_group: None,
             available_animations: vec![],
             last_animation_index: None,
+            morph_weights: HashMap::new(),
+            morph_buffer: None,
         }
     }
 }
@@ -95,6 +100,7 @@ impl AnimationComponent {
 
         if self.active_animation_index != self.last_animation_index {
             self.local_pose.clear();
+            self.morph_weights.clear();
             self.last_animation_index = self.active_animation_index;
         }
 
@@ -157,11 +163,11 @@ impl AnimationComponent {
             }
 
             if count == 1 || settings.time <= channel.times[0] {
-                Self::apply_single_keyframe(channel, 0, &mut self.local_pose, model);

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