From e00950c7e54825afed4c7e67d64da2879a07597d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 19 Mar 2020 18:21:32 +0100 Subject: [PATCH] library: render: scene: fix spatial lighting The spatial lighting did not take into account the object's color when calculating the amount of diffuse and specular light that was emitted. --- src/render/scene.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/scene.rs b/src/render/scene.rs index 578ea48..9d113a3 100644 --- a/src/render/scene.rs +++ b/src/render/scene.rs @@ -162,9 +162,9 @@ impl Scene { normal: Vector, reflected: Vector, ) -> LinearColor { - let ambient = self.illuminate_ambient(object_color); + let ambient = self.illuminate_ambient(object_color.clone()); let spatial = self.illuminate_spatial(point, properties, normal, reflected); - ambient + spatial + ambient + object_color * spatial } fn illuminate_ambient(&self, color: LinearColor) -> LinearColor {