summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/resources.md3
-rw-r--r--shared/src/resources.rs1
-rw-r--r--world/src/mesh.rs8
3 files changed, 12 insertions, 0 deletions
diff --git a/doc/resources.md b/doc/resources.md
index d3d33eb..61a5781 100644
--- a/doc/resources.md
+++ b/doc/resources.md
@@ -48,6 +48,7 @@ white except normals are zero.
| `g_dispersion` | `Float` | |
| `g_thickness` | `Float` | |
| `g_unlit` | | |
+| `g_double_sided` | | |
| `va_position` | `Res<[Vec3]>` | |
| `va_normal` | `Res<[Vec3]>` | |
| `va_texcoord` | `Res<[Vec2]>` | |
@@ -79,6 +80,8 @@ white except normals are zero.
[KHR_materials_dispersion].
- **Unlit**: Directly transfers \*_albedo to the screen if set. No lighting
shaders are applied. See [KHR_materials_unlit]
+- **Double Sided**: Disable backface culling for this mesh. Equivalent to
+ `material.doubleSided` of glTF 2.0.
## LightPart
diff --git a/shared/src/resources.rs b/shared/src/resources.rs
index f9e7242..ba45284 100644
--- a/shared/src/resources.rs
+++ b/shared/src/resources.rs
@@ -59,6 +59,7 @@ pub struct MeshPart {
pub g_attenuation: Option<Vec3A>,
pub g_dispersion: Option<f32>,
pub g_unlit: Option<()>,
+ pub g_double_sided: Option<()>,
pub va_position: Option<Resource<Vec<Vec3A>>>,
pub va_normal: Option<Resource<Vec<Vec3A>>>,
pub va_texcoord: Option<Resource<Vec<Vec2>>>,
diff --git a/world/src/mesh.rs b/world/src/mesh.rs
index f66be82..fd6b6ae 100644
--- a/world/src/mesh.rs
+++ b/world/src/mesh.rs
@@ -298,6 +298,13 @@ pub fn import_mesh(
None
};
+ let g_double_sided = if p.material().double_sided() {
+ info!("double sided");
+ Some(())
+ } else {
+ None
+ };
+
let mesh = store.set(&MeshPart {
name,
index,
@@ -312,6 +319,7 @@ pub fn import_mesh(
g_refractive_index,
g_dispersion,
g_unlit,
+ g_double_sided,
va_position,
va_normal,
va_texcoord,