From a3bdc01d45cd9d1e96c7ffd5f22e39f0d03a4977 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 11 Sep 2013 22:11:56 -0700 Subject: [PATCH] Compact some normalization and stuff --- src/scene.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/scene.cc b/src/scene.cc index 085e881..dc46e9e 100644 --- a/src/scene.cc +++ b/src/scene.cc @@ -175,9 +175,7 @@ Scene::trace_ray(const Ray &ray, const int depth) Vector3 normal = intersected_shape->compute_normal(intersection); for (Light *l : lights) { - Vector3 light_direction = intersection - l->get_origin(); - light_direction.normalize(); - + Vector3 light_direction = (intersection - l->get_origin()).normalize(); float ldotn = light_direction.dot(normal); out_color.red *= ((ldotn >= 0.0) ? ldotn : 0.0) * l->get_intensity(); out_color.green *= ((ldotn >= 0.0) ? ldotn : 0.0) * l->get_intensity();