summaryrefslogtreecommitdiff
path: root/shared/src/resources.rs
diff options
context:
space:
mode:
Diffstat (limited to 'shared/src/resources.rs')
-rw-r--r--shared/src/resources.rs11
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: {:?}",