diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2017-02-09 04:59:05 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@gnugeneration.com> | 2017-02-09 04:59:05 -0800 |
commit | a4914d40fd9e25fa4c02af8d4c02d227064c1903 (patch) | |
tree | eeee7fbc6f382e6ef8e51fbd8f8823bd5d326584 | |
parent | 19dbf88c811c6f853566fda48ad100d1c29faf50 (diff) |
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.
-rw-r--r-- | src/modules/ray/ray_scene.c | 2 |
1 files changed, 1 insertions, 1 deletions
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 |