diff options
-rw-r--r-- | engine/light.glsl | 6 | ||||
-rw-r--r-- | engine/src/renderer/mod.rs | 15 |
2 files changed, 2 insertions, 19 deletions
diff --git a/engine/light.glsl b/engine/light.glsl index 46105e9..49026ec 100644 --- a/engine/light.glsl +++ b/engine/light.glsl @@ -15,8 +15,6 @@ struct Material { struct Light { vec3 position; - - vec3 ambient; vec3 diffuse; vec3 specular; }; @@ -26,9 +24,7 @@ uniform Light light; vec3 calc_ambient_light(in vec2 texture_coords) { - return light.ambient * ( - vec3(texture(material.ambient_map, texture_coords)) * material.ambient - ); + return vec3(texture(material.ambient_map, texture_coords)) * material.ambient; } vec3 calc_diffuse_light(in vec3 light_dir, in vec3 norm, in vec2 texture_coords) 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(), ); |