From d7fdcfd791f011e33fb9720e7451e56410411e4f Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 7 Feb 2025 15:25:00 +0100 Subject: fix armature duplication --- shared/src/helper.rs | 21 +++++++++++++++++++++ shared/src/resources.rs | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'shared/src') diff --git a/shared/src/helper.rs b/shared/src/helper.rs index 873c9d8..d6fbe66 100644 --- a/shared/src/helper.rs +++ b/shared/src/helper.rs @@ -180,6 +180,27 @@ impl ReadWrite for Vec<[u32; 3]> { .collect()) } } +impl ReadWrite for Vec<[u32; 4]> { + fn write(&self, w: &mut dyn Write) -> Result<()> { + for e in self { + w.write_all(&e[0].to_le_bytes())?; + w.write_all(&e[1].to_le_bytes())?; + w.write_all(&e[2].to_le_bytes())?; + w.write_all(&e[3].to_le_bytes())?; + } + Ok(()) + } + fn read(r: &mut dyn Read) -> Result { + let mut buf = Vec::new(); + r.read_to_end(&mut buf)?; + Ok(buf + .into_iter() + .array_chunks::<{ size_of::() }>() + .map(u32::from_le_bytes) + .array_chunks::<4>() + .collect()) + } +} impl ReadWrite for Vec<[u16; 4]> { fn write(&self, w: &mut dyn Write) -> Result<()> { for e in self { diff --git a/shared/src/resources.rs b/shared/src/resources.rs index 654bfc6..b3d9414 100644 --- a/shared/src/resources.rs +++ b/shared/src/resources.rs @@ -74,7 +74,7 @@ pub struct MeshPart { pub va_transmission: Option>>, pub va_alpha: Option>>, pub va_emission: Option>>, - pub va_joint_index: Option>>, + pub va_joint_index: Option>>, pub va_joint_weight: Option>>, pub tex_normal: Option>>, pub tex_roughness: Option>>, -- cgit v1.2.3-70-g09d2