summaryrefslogtreecommitdiff
path: root/world/src/main.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-07 18:13:42 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-07 18:13:42 +0100
commitd3e2f02f5f75afb6d6c62e77577452224e4a34a4 (patch)
tree6a180eeb4c3f70f5f122325a590d1ac098a11f23 /world/src/main.rs
parent4032ef64aa33f616a2009ad1e6270cdf646242e7 (diff)
downloadweareserver-d3e2f02f5f75afb6d6c62e77577452224e4a34a4.tar
weareserver-d3e2f02f5f75afb6d6c62e77577452224e4a34a4.tar.bz2
weareserver-d3e2f02f5f75afb6d6c62e77577452224e4a34a4.tar.zst
emission
Diffstat (limited to 'world/src/main.rs')
-rw-r--r--world/src/main.rs27
1 files changed, 26 insertions, 1 deletions
diff --git a/world/src/main.rs b/world/src/main.rs
index 81d411e..2014996 100644
--- a/world/src/main.rs
+++ b/world/src/main.rs
@@ -177,6 +177,16 @@ fn main() -> Result<()> {
&tex.texture().source().source(),
)?);
}
+ let mut tex_emission = None;
+ if let Some(tex) = p.material().emissive_texture() {
+ tex_emission = Some(load_texture(
+ "emission",
+ &store,
+ path_base,
+ &buffers,
+ &tex.texture().source().source(),
+ )?);
+ }
let mut tex_roughness = None;
let mut tex_metallic = None;
if let Some(tex) = p
@@ -203,7 +213,7 @@ fn main() -> Result<()> {
let g_albedo = if base_color[0] != 1. || base_color[1] != 1. || base_color[2] != 1.
{
info!(
- "global albedo is r={},g={},b={}",
+ "global albedo is r={},g={},b={}",
base_color[0], base_color[1], base_color[2]
);
Some(Vec3A::new(base_color[0], base_color[1], base_color[2]))
@@ -219,12 +229,25 @@ fn main() -> Result<()> {
None
};
+ let emission = p.material().emissive_factor();
+ let g_emission = if emission[0] != 0. || emission[1] != 0. || emission[2] != 0. {
+ info!(
+ "global emission is r={},g={},b={}",
+ base_color[0], base_color[1], base_color[2]
+ );
+ Some(Vec3A::new(emission[0], emission[1], emission[2]))
+ } else {
+ debug!("global emission pruned");
+ None
+ };
+
let part = store.set(
&Part {
g_albedo,
g_transmission,
g_metallic,
g_roughness,
+ g_emission,
va_position,
va_normal,
va_texcoord,
@@ -235,7 +258,9 @@ fn main() -> Result<()> {
tex_roughness,
tex_metallic,
tex_transmission,
+ tex_emission,
index,
+ va_emission: None, // not supported by gltf
va_metallic: None, // not supported by gltf
va_roughness: None, // not supported by gltf
}