diff options
author | metamuffin <metamuffin@disroot.org> | 2025-02-03 21:46:29 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-02-03 21:46:29 +0100 |
commit | ae14c194a25e258659104e89553ad48a8ae9ca3b (patch) | |
tree | 793b73af2c045d7acf218912afbc182a6720436f /shared/src/resources.rs | |
parent | 163e10c9f618f0e4cd7b4456476ad1c2322db5d7 (diff) | |
download | weareserver-ae14c194a25e258659104e89553ad48a8ae9ca3b.tar weareserver-ae14c194a25e258659104e89553ad48a8ae9ca3b.tar.bz2 weareserver-ae14c194a25e258659104e89553ad48a8ae9ca3b.tar.zst |
armatures in prefab
Diffstat (limited to 'shared/src/resources.rs')
-rw-r--r-- | shared/src/resources.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/shared/src/resources.rs b/shared/src/resources.rs index c96621d..654bfc6 100644 --- a/shared/src/resources.rs +++ b/shared/src/resources.rs @@ -30,6 +30,7 @@ pub struct Prefab { pub mesh: Vec<(Affine3A, Resource<MeshPart>)>, pub collision: Vec<(Affine3A, Resource<CollisionPart>)>, pub light: Vec<(Vec3A, Resource<LightPart>)>, + pub armature: Vec<Resource<ArmaturePart>>, pub environment: Option<Resource<EnvironmentPart>>, } @@ -50,7 +51,7 @@ pub struct EnvironmentPart { pub struct MeshPart { pub name: Option<String>, pub index: Option<Resource<Vec<[u32; 3]>>>, - pub armature: Option<Resource<Armature>>, + pub armature: Option<u32>, pub g_metallic: Option<f32>, pub g_roughness: Option<f32>, pub g_albedo: Option<Vec3A>, @@ -89,7 +90,7 @@ pub struct MeshPart { } #[derive(Debug, Default, Clone)] -pub struct Armature { +pub struct ArmaturePart { pub parent: Option<Vec<u16>>, pub transform: Option<Vec<Affine3A>>, pub name: Option<Vec<String>>, @@ -134,7 +135,7 @@ impl ReadWrite for PrefabIndex { } } -impl ReadWrite for Armature { +impl ReadWrite for ArmaturePart { fn write(&self, w: &mut dyn Write) -> Result<()> { write_kv_opt(w, b"parent", &self.parent)?; write_kv_opt(w, b"transform", &self.transform)?; @@ -200,6 +201,9 @@ impl ReadWrite for Prefab { for x in &self.light { write_kv_opt(w, b"light", &Some(x.clone()))?; } + for x in &self.armature { + write_kv_opt(w, b"armature", &Some(x.clone()))?; + } write_kv_opt(w, b"environment", &self.environment)?; Ok(()) } @@ -210,6 +214,7 @@ impl ReadWrite for Prefab { b"mesh" => Ok(s.mesh.push(read_slice(v)?)), b"collision" => Ok(s.collision.push(read_slice(v)?)), b"light" => Ok(s.light.push(read_slice(v)?)), + b"armature" => Ok(s.armature.push(read_slice(v)?)), b"environment" => Ok(s.environment = Some(read_slice(v)?)), x => Ok(warn!( "unknown prefab key: {:?}", |