From a4914d40fd9e25fa4c02af8d4c02d227064c1903 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 9 Feb 2017 04:59:05 -0800 Subject: ray: remove redundant recursion depth increment trace_ray() bumps the depth, the reflection ray trace_ray() call just needs to propagate the depth variable not advance it as well. This was probably vestigial from early development and never got taken out. This does mean more reflections now, and correspondingly slower rendering, but it at least makes MAX_RECURSION_DEPTH accurate. The define can be changed if the performance is too bad. --- src/modules/ray/ray_scene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules/ray') diff --git a/src/modules/ray/ray_scene.c b/src/modules/ray/ray_scene.c index e44990b..496c447 100644 --- a/src/modules/ray/ray_scene.c +++ b/src/modules/ray/ray_scene.c @@ -107,7 +107,7 @@ static inline ray_color_t shade_ray(ray_scene_t *scene, ray_ray_t *ray, ray_obje reflected_ray.origin = intersection; reflected_ray.direction = ray_3f_sub(&ray->direction, &reflected_ray.direction); - reflection = trace_ray(scene, &reflected_ray, depth + 1); + reflection = trace_ray(scene, &reflected_ray, depth); reflection = ray_3f_mult_scalar(&reflection, surface.specular); color = ray_3f_add(&color, &reflection); #endif -- cgit v1.2.3