summaryrefslogtreecommitdiff
path: root/engine/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-05-22 19:23:19 +0200
committerHampusM <hampus@hampusmat.com>2024-05-22 19:23:19 +0200
commit0f53ae83a4d8da002850859fe0d010c5df4f2f57 (patch)
tree9dc72bd905ac1e6a5b272a63450b1f0265ac2253 /engine/src
parentf06880383420da3f8d14079817ff271e71791abb (diff)
refactor(engine): remove ambient color from shader Light struct
Diffstat (limited to 'engine/src')
-rw-r--r--engine/src/renderer/mod.rs15
1 files changed, 1 insertions, 14 deletions
diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs
index 4f9d7e6..d843020 100644
--- a/engine/src/renderer/mod.rs
+++ b/engine/src/renderer/mod.rs
@@ -372,16 +372,6 @@ fn apply_light(
);
gl_shader_program.set_uniform_vec_3fv(
- cstr!("light.ambient"),
- // There cannot be both a material ambient color and a global ambient color
- &if material_flags.use_ambient_color {
- Color::WHITE_F32.into()
- } else {
- global_light.ambient.clone().into()
- },
- );
-
- gl_shader_program.set_uniform_vec_3fv(
cstr!("light.diffuse"),
&light_source
.map_or(Color::WHITE_F32, |(light_source, _)| {
@@ -401,13 +391,10 @@ fn apply_light(
gl_shader_program.set_uniform_vec_3fv(
cstr!("material.ambient"),
- // When using the material ambient color is disabled, the ambient color has to be
- // white and not black since the material's ambient color is multiplied
- // with the global ambient light in the shader
&if material_flags.use_ambient_color {
material.ambient.clone()
} else {
- Color::WHITE_F32
+ global_light.ambient.clone().into()
}
.into(),
);