diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-24 21:18:55 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-24 21:18:55 +0100 |
commit | 006ad7ce6d30d764411dcf8c2527f2c80e722491 (patch) | |
tree | 957b60eec535ddcea4f842919a99f806b6d55217 /client/src/armature.rs | |
parent | b4aaaae52b3b746a5e1ef8a98151c627f2787e38 (diff) | |
download | weareserver-006ad7ce6d30d764411dcf8c2527f2c80e722491.tar weareserver-006ad7ce6d30d764411dcf8c2527f2c80e722491.tar.bz2 weareserver-006ad7ce6d30d764411dcf8c2527f2c80e722491.tar.zst |
minimal progress but diffuse lighting works again
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, |