summaryrefslogtreecommitdiffstats
path: root/libdimension/raytrace.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-12-23 02:04:32 -0500
committerTavian Barnes <tavianator@gmail.com>2009-12-23 02:04:32 -0500
commita9ce26a1cd786690b4b8f4b54fc7077b3d3569e5 (patch)
tree1d6e3676224699d828180a15edbca8a3ed39d75a /libdimension/raytrace.c
parentff44d1b89812c1c7ef86c848937f17a59c64a66e (diff)
downloaddimension-a9ce26a1cd786690b4b8f4b54fc7077b3d3569e5.tar.xz
Separate finishes into single-purpose finishes.
Diffstat (limited to 'libdimension/raytrace.c')
-rw-r--r--libdimension/raytrace.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c
index 71e60cd..594149c 100644
--- a/libdimension/raytrace.c
+++ b/libdimension/raytrace.c
@@ -359,8 +359,8 @@ dmnsn_raytrace_lighting(dmnsn_intersection *intersection, dmnsn_scene *scene,
/* The illuminated color */
dmnsn_color illum = dmnsn_black;
- if (finish)
- illum = dmnsn_color_mul(finish->ambient, color);
+ if (finish && finish->ambient_fn)
+ illum = (*finish->ambient_fn)(finish, color);
dmnsn_vector x0 = dmnsn_line_point(intersection->ray, intersection->t);
@@ -375,7 +375,9 @@ dmnsn_raytrace_lighting(dmnsn_intersection *intersection, dmnsn_scene *scene,
if (dmnsn_raytrace_light_ray(intersection, scene, kD_splay_tree, light,
&light_color))
{
- if (scene->quality >= DMNSN_RENDER_FINISH && finish) {
+ if (scene->quality >= DMNSN_RENDER_FINISH
+ && finish && finish->finish_fn)
+ {
dmnsn_vector ray = dmnsn_vector_normalize(
dmnsn_vector_sub(light->x0, x0)
);