diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-09 22:45:13 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-09 22:45:13 +0100 |
commit | 77486da1c97c988205c8bb117b1168a1a0ef6a46 (patch) | |
tree | 5a172db8537087645c4b5bc401c5019fa76dd330 /world/src/mesh.rs | |
parent | 1aca139c985cb71be90da1de6d65adc3c7d0d073 (diff) | |
download | weareserver-77486da1c97c988205c8bb117b1168a1a0ef6a46.tar weareserver-77486da1c97c988205c8bb117b1168a1a0ef6a46.tar.bz2 weareserver-77486da1c97c988205c8bb117b1168a1a0ef6a46.tar.zst |
occlusion
Diffstat (limited to 'world/src/mesh.rs')
-rw-r--r-- | world/src/mesh.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/world/src/mesh.rs b/world/src/mesh.rs index 1f19c28..7d17cc9 100644 --- a/world/src/mesh.rs +++ b/world/src/mesh.rs @@ -211,6 +211,17 @@ pub fn import_mesh( webp, )?); } + let mut tex_occlusion = None; + if let Some(tex) = p.material().occlusion_texture() { + tex_occlusion = Some(load_texture( + "occlusion", + &store, + path_base, + &buffers, + &tex.texture().source().source(), + webp, + )?); + } let mut tex_roughness = None; let mut tex_metallic = None; if let Some(tex) = p @@ -295,10 +306,12 @@ pub fn import_mesh( let g_attenuation = p.material().volume().map(|v| { let ref_dist = v.attenuation_distance(); - Vec3A::from_array(v.attenuation_color().map( + let att = Vec3A::from_array(v.attenuation_color().map( // manually derived from attenuation coefficient formula. i hope this is correct. |factor| -(factor.powf(1. / ref_dist)).ln(), - )) + )); + info!("attenuation is {att}"); + att }); let g_refractive_index = p.material().ior(); let g_thickness = p.material().volume().map(|v| v.thickness_factor()); @@ -314,6 +327,7 @@ pub fn import_mesh( .map(|e| e.contains_key("KHR_materials_unlit")) .unwrap_or(false) { + info!("unlit"); Some(()) } else { None @@ -346,6 +360,7 @@ pub fn import_mesh( tex_emission, tex_transmission, tex_thickness, + tex_occlusion, // not supported by gltf va_transmission: None, va_emission: None, |