summaryrefslogtreecommitdiff
path: root/world/src/mesh.rs
diff options
context:
space:
mode:
Diffstat (limited to 'world/src/mesh.rs')
-rw-r--r--world/src/mesh.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/world/src/mesh.rs b/world/src/mesh.rs
index 78ec919..4067fb8 100644
--- a/world/src/mesh.rs
+++ b/world/src/mesh.rs
@@ -38,6 +38,7 @@ pub fn import_mesh(
texture_cache: &TextureCache,
joint_index_map: &BTreeMap<(usize, u16), u32>,
vrm: &VrmInfo,
+ head_bones: &[u32],
) -> Result<()> {
for p in mesh.primitives() {
let name = mesh.name().or(node.name()).map(|e| e.to_owned());
@@ -80,6 +81,7 @@ pub fn import_mesh(
})
.transpose()?;
+ let mut many_head_bones = false;
let va_joint_index = reader
.read_joints(0)
.map(|iter| {
@@ -88,7 +90,17 @@ pub fn import_mesh(
.into_u16()
.map(|x| x.map(|x| joint_index_map[&(si, x)]))
.collect::<Vec<_>>();
+
+ let head_bone_count = a
+ .iter()
+ .flatten()
+ .filter(|b| head_bones.contains(*b))
+ .count();
+ many_head_bones |= head_bone_count > a.len() / 2;
debug!("{} vertex joint indecies", a.len());
+ if many_head_bones {
+ debug!("many joints are head bones");
+ }
if a.len() != num_vertex {
warn!("joint index count does not vertex count")
}
@@ -341,7 +353,7 @@ pub fn import_mesh(
let g_double_sided = bool_to_opt(p.material().double_sided(), "double sided");
let hint_hide_first_person = bool_to_opt(
- vrm.hide_first_person.contains(&node.index()),
+ many_head_bones | vrm.hide_first_person.contains(&node.index()),
"hide first person hint",
);