diff options
author | metamuffin <metamuffin@disroot.org> | 2025-02-11 00:18:11 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-02-11 00:18:11 +0100 |
commit | 81a191e702abcf77b73b9163ce43c4527a01ce13 (patch) | |
tree | 1f0d0dfbea037a11e041295a0dea22f0c5a67a72 /world/src/main.rs | |
parent | 847542d358e65ea850cfeebdd92218aa60e34261 (diff) | |
download | weareserver-81a191e702abcf77b73b9163ce43c4527a01ce13.tar weareserver-81a191e702abcf77b73b9163ce43c4527a01ce13.tar.bz2 weareserver-81a191e702abcf77b73b9163ce43c4527a01ce13.tar.zst |
rushed implementation of VRM thirdPersonOnly
Diffstat (limited to 'world/src/main.rs')
-rw-r--r-- | world/src/main.rs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/world/src/main.rs b/world/src/main.rs index 055be47..e3c365a 100644 --- a/world/src/main.rs +++ b/world/src/main.rs @@ -42,7 +42,7 @@ use std::{ thread::{self, sleep}, time::Duration, }; -use vrm::{Vrm, Vrmc}; +use vrm::extract_vrm_data; use weareshared::{ Affine3A, Vec3A, helper::ReadWrite, @@ -137,6 +137,8 @@ fn main() -> Result<()> { traverse(&mut nodes, node, root_affine); } + let vrm = extract_vrm_data(&gltf)?; + let mut skin_index_to_arm_index = BTreeMap::new(); let armature = { let mut joint_index_to_arm_index = BTreeMap::new(); @@ -176,19 +178,9 @@ fn main() -> Result<()> { }) .collect::<Vec<_>>(); - if let Some(vrm) = gltf.extension_value("VRM") { - let vrm: Vrm = serde_json::from_value(vrm.clone())?; - for bone in vrm.humanoid.human_bones { - let ind = joint_index_to_arm_index[&bone.node]; - name[ind] = bone.bone; - } - } - if let Some(vrm) = gltf.extension_value("VRMC_vrm") { - let vrm: Vrmc = serde_json::from_value(vrm.clone())?; - for (bname, bone) in vrm.humanoid.human_bones { - let ind = joint_index_to_arm_index[&bone.node]; - name[ind] = bname; - } + for (node, bname) in &vrm.bone_node_names { + let ind = joint_index_to_arm_index[node]; + name[ind] = bname.to_owned(); } for (i, (name, tr)) in name.iter().zip(transform.iter()).enumerate() { @@ -226,6 +218,7 @@ fn main() -> Result<()> { &args, &texture_cache, &skin_index_to_arm_index, + &vrm, )?; } } |