summaryrefslogtreecommitdiff
path: root/shared/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-02-07 15:25:00 +0100
committermetamuffin <metamuffin@disroot.org>2025-02-07 15:25:00 +0100
commitd7fdcfd791f011e33fb9720e7451e56410411e4f (patch)
tree7db39bb3e9d99ecba7761e8be3d7ae35b288ce2f /shared/src
parent92ab896339692c7dab300ad4d11a94fa03ee3ef4 (diff)
downloadweareserver-d7fdcfd791f011e33fb9720e7451e56410411e4f.tar
weareserver-d7fdcfd791f011e33fb9720e7451e56410411e4f.tar.bz2
weareserver-d7fdcfd791f011e33fb9720e7451e56410411e4f.tar.zst
fix armature duplication
Diffstat (limited to 'shared/src')
-rw-r--r--shared/src/helper.rs21
-rw-r--r--shared/src/resources.rs2
2 files changed, 22 insertions, 1 deletions
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<Self> {
+ let mut buf = Vec::new();
+ r.read_to_end(&mut buf)?;
+ Ok(buf
+ .into_iter()
+ .array_chunks::<{ size_of::<u32>() }>()
+ .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<Resource<Vec<f32>>>,
pub va_alpha: Option<Resource<Vec<f32>>>,
pub va_emission: Option<Resource<Vec<Vec3A>>>,
- pub va_joint_index: Option<Resource<Vec<[u16; 4]>>>,
+ pub va_joint_index: Option<Resource<Vec<[u32; 4]>>>,
pub va_joint_weight: Option<Resource<Vec<[f32; 4]>>>,
pub tex_normal: Option<Resource<Image<'static>>>,
pub tex_roughness: Option<Resource<Image<'static>>>,