diff options
Diffstat (limited to 'client/src/armature.rs')
-rw-r--r-- | client/src/armature.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/client/src/armature.rs b/client/src/armature.rs index abfc455..daf2725 100644 --- a/client/src/armature.rs +++ b/client/src/armature.rs @@ -19,6 +19,7 @@ use std::sync::Arc; use weareshared::resources::Armature; use wgpu::{Buffer, BufferDescriptor, BufferUsages, Device, Queue}; +const MAX_JOINTS: usize = 128; pub struct RArmature { pub joint_mat_uniform_buffer: Arc<Buffer>, joint_mat: Vec<Mat4>, @@ -30,7 +31,7 @@ impl RArmature { Self { joint_mat_uniform_buffer: Arc::new(device.create_buffer(&BufferDescriptor { label: Some("joint uniform"), - size: (armature.parent.as_ref().unwrap().len() * size_of::<f32>() * 16) as u64, + size: (MAX_JOINTS * size_of::<f32>() * 16) as u64, usage: BufferUsages::COPY_DST | BufferUsages::UNIFORM, mapped_at_creation: false, })), @@ -38,7 +39,9 @@ impl RArmature { joint_mat: vec![], } } - pub fn update(&mut self) {} + pub fn update(&mut self) { + self.joint_mat.fill(Mat4::IDENTITY); + } pub fn write_uniform(&self, queue: &Queue) { queue.write_buffer( &self.joint_mat_uniform_buffer, |