summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-21 23:03:37 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-21 23:03:37 +0100
commit13eb6abfe0e766e432a2f08d58fa9f5a6c5026e7 (patch)
treefd82c7e200cb7ccef437c596e5d537cae96303c5
parenta3621790a6f4466daab0f38f5eaf57fe064b2e92 (diff)
downloadweareserver-13eb6abfe0e766e432a2f08d58fa9f5a6c5026e7.tar
weareserver-13eb6abfe0e766e432a2f08d58fa9f5a6c5026e7.tar.bz2
weareserver-13eb6abfe0e766e432a2f08d58fa9f5a6c5026e7.tar.zst
hint_static
-rw-r--r--doc/resources.md3
-rw-r--r--shared/src/resources.rs3
-rw-r--r--world/src/mesh.rs1
3 files changed, 7 insertions, 0 deletions
diff --git a/doc/resources.md b/doc/resources.md
index c015ab7..4fbc54f 100644
--- a/doc/resources.md
+++ b/doc/resources.md
@@ -78,6 +78,7 @@ white except normals are zero.
| `tex_thickness` | `Res<Texture>` | Use green channel |
| `tex_occlusion` | `Res<Texture>` | Use red channel |
| `hint_mirror` | | |
+| `hint_static` | | |
- **Attenuation**: Attenuation coefficient for each color channel due to
scattering within the material volume expressed as e-folding distance (m^-1).
@@ -96,6 +97,8 @@ white except normals are zero.
- **Mirror Hint**: Suggest a client to render reflections of this surface
properly e.g. show use a texture that shows output of another render pass from
the mirrors perspective. It can be assumed that the mesh is on a single plane.
+- **Static Hint**: Object will not move often. This allows implementations to
+ choose instanced rending when MeshPart are added more than once.
## Armature
diff --git a/shared/src/resources.rs b/shared/src/resources.rs
index 5901eb1..6c71adc 100644
--- a/shared/src/resources.rs
+++ b/shared/src/resources.rs
@@ -85,6 +85,7 @@ pub struct MeshPart {
pub tex_thickness: Option<Resource<Image<'static>>>,
pub tex_occlusion: Option<Resource<Image<'static>>>,
pub hint_mirror: Option<()>,
+ pub hint_static: Option<()>,
}
#[derive(Debug, Default, Clone)]
@@ -292,6 +293,7 @@ impl ReadWrite for MeshPart {
write_kv_opt(w, b"tex_emission", &self.tex_emission)?;
write_kv_opt(w, b"tex_occlusion", &self.tex_occlusion)?;
write_kv_opt(w, b"hint_mirror", &self.hint_mirror)?;
+ write_kv_opt(w, b"hint_static", &self.hint_static)?;
Ok(())
}
fn read(r: &mut dyn Read) -> Result<Self> {
@@ -328,6 +330,7 @@ impl ReadWrite for MeshPart {
b"tex_emission" => Ok(s.tex_emission = Some(read_slice(v)?)),
b"tex_occlusion" => Ok(s.tex_occlusion = Some(read_slice(v)?)),
b"hint_mirror" => Ok(s.hint_mirror = Some(read_slice(v)?)),
+ b"hint_static" => Ok(s.hint_static = Some(read_slice(v)?)),
x => Ok(warn!(
"unknown mesh part key: {:?}",
String::from_utf8_lossy(x)
diff --git a/world/src/mesh.rs b/world/src/mesh.rs
index 3d71939..b8dc0c3 100644
--- a/world/src/mesh.rs
+++ b/world/src/mesh.rs
@@ -383,6 +383,7 @@ pub fn import_mesh(
tex_occlusion,
// not supported by gltf
hint_mirror: None, // TODO
+ hint_static: None, // TODO Set when instancing
va_transmission: None,
va_emission: None,
va_metallic: None,