diff options
-rw-r--r-- | world/src/mesh.rs | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/world/src/mesh.rs b/world/src/mesh.rs index ebecfa5..78ec919 100644 --- a/world/src/mesh.rs +++ b/world/src/mesh.rs @@ -331,29 +331,24 @@ pub fn import_mesh( } let g_thickness = p.material().volume().map(|v| v.thickness_factor()); - let g_unlit = if p - .material() - .extension_value("KHR_materials_unlit") - .is_some() - { - debug!("unlit"); - Some(()) - } else { - None - }; + let g_unlit = bool_to_opt( + p.material() + .extension_value("KHR_materials_unlit") + .is_some(), + "unlit", + ); - let g_double_sided = if p.material().double_sided() { - debug!("double sided"); - Some(()) - } else { - None - }; + let g_double_sided = bool_to_opt(p.material().double_sided(), "double sided"); - let hint_hide_first_person = if vrm.hide_first_person.contains(&node.index()) { - Some(()) - } else { - None - }; + let hint_hide_first_person = bool_to_opt( + vrm.hide_first_person.contains(&node.index()), + "hide first person hint", + ); + + let hint_mirror = bool_to_opt( + node.name().unwrap_or_default().ends_with("-mirror"), + "mirror hint", + ); let armature = node.skin().map(|_| 0); @@ -391,8 +386,8 @@ pub fn import_mesh( tex_thickness, tex_occlusion, hint_hide_first_person, + hint_mirror, // not supported by gltf - hint_mirror: None, // TODO hint_static: None, // TODO Set when instancing va_transmission: None, va_emission: None, @@ -404,3 +399,12 @@ pub fn import_mesh( } Ok(()) } + +fn bool_to_opt(b: bool, log: &str) -> Option<()> { + if b { + debug!("{log}"); + Some(()) + } else { + None + } +} |