diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-09 17:13:38 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-09 17:13:38 +0100 |
commit | 6ed9af8a3e59fa07f27a17bbfcd1dbee87ed2d6c (patch) | |
tree | 3e39721314bebe343a9dbc873470f14f10c69426 | |
parent | 1c1c2a06b5cb7ce1473a2e6961565275accf50bb (diff) | |
download | weareserver-6ed9af8a3e59fa07f27a17bbfcd1dbee87ed2d6c.tar weareserver-6ed9af8a3e59fa07f27a17bbfcd1dbee87ed2d6c.tar.bz2 weareserver-6ed9af8a3e59fa07f27a17bbfcd1dbee87ed2d6c.tar.zst |
other gltf features
-rw-r--r-- | doc/other.md | 3 | ||||
-rw-r--r-- | world/src/mesh.rs | 35 |
2 files changed, 32 insertions, 6 deletions
diff --git a/doc/other.md b/doc/other.md index 4634bbc..74f9665 100644 --- a/doc/other.md +++ b/doc/other.md @@ -17,7 +17,7 @@ | KHR_lights_punctual | Supported | | KHR_materials_anisotropy | Todo | | KHR_materials_clearcoat | Todo | -| KHR_materials_dispersion | Supported | +| KHR_materials_dispersion | Format only (2) | | KHR_materials_emissive_strength | Supported | | KHR_materials_ior | Supported | | KHR_materials_iridescence | Todo | @@ -36,3 +36,4 @@ | EXT_texture_webp | Supported | 1. We can do the same by sharing subresources. +2. gltf rust crate does not support that extension diff --git a/world/src/mesh.rs b/world/src/mesh.rs index 216f8f3..7352583 100644 --- a/world/src/mesh.rs +++ b/world/src/mesh.rs @@ -195,6 +195,22 @@ pub fn import_mesh( webp, )?); } + let mut tex_thickness = None; + if let Some(tex) = p + .material() + .volume() + .map(|t| t.thickness_texture()) + .flatten() + { + tex_thickness = Some(load_texture( + "thickness", + &store, + path_base, + &buffers, + &tex.texture().source().source(), + webp, + )?); + } let mut tex_roughness = None; let mut tex_metallic = None; if let Some(tex) = p @@ -263,13 +279,26 @@ pub fn import_mesh( None }; + let g_attenuation = p.material().volume().map(|v| { + let ref_dist = v.attenuation_distance(); + Vec3A::from_array(v.attenuation_color().map( + |factor| factor * ref_dist, // TODO figure out how that is converted + )) + }); + let g_refractive_index = p.material().ior(); + let g_thickness = p.material().volume().map(|v| v.thickness_factor()); + let mesh = store.set(&MeshPart { + index, g_albedo, g_alpha, g_metallic, g_roughness, g_emission, g_transmission, + g_attenuation, + g_thickness, + g_refractive_index, va_position, va_normal, va_texcoord, @@ -282,13 +311,9 @@ pub fn import_mesh( tex_alpha, tex_emission, tex_transmission, - index, + tex_thickness, // not yet implemented - g_attenuation: None, g_dispersion: None, - g_refractive_index: None, - g_thickness: None, - tex_thickness: None, // not supported by gltf va_transmission: None, va_emission: None, |