summaryrefslogtreecommitdiff
path: root/src/modules/ray/ray_scene.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2017-06-02 10:20:35 -0700
committerVito Caputo <vcaputo@pengaru.com>2017-06-02 10:20:35 -0700
commit69e3a23a89b0b4567de92c004946113ce2db0151 (patch)
treee96bfb95a6cba9cef77af77413a0c1763e038fc3 /src/modules/ray/ray_scene.c
parent2878f5ca93eb04239f30312a927fd9e8c4aaf5e4 (diff)
ray: simplify trace_ray inner loop slightly
Remove unnecessary nearest_object check, the distance comparison alone is sufficient when initialized to INFINITY.
Diffstat (limited to 'src/modules/ray/ray_scene.c')
-rw-r--r--src/modules/ray/ray_scene.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/modules/ray/ray_scene.c b/src/modules/ray/ray_scene.c
index eb18d08..50da28a 100644
--- a/src/modules/ray/ray_scene.c
+++ b/src/modules/ray/ray_scene.c
@@ -155,8 +155,7 @@ static ray_color_t trace_ray(ray_scene_t *scene, ray_ray_t *ray, unsigned depth)
if (ray_object_intersects_ray(&scene->objects[i], ray, &distance)) {
/* Is it the nearest intersection? */
- if (!nearest_object ||
- distance < nearest_object_distance) {
+ if (distance < nearest_object_distance) {
nearest_object = &scene->objects[i];
nearest_object_distance = distance;
}
© All Rights Reserved