summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/other.md3
-rw-r--r--world/src/mesh.rs35
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,