summaryrefslogtreecommitdiffstats
path: root/libdimension/raytrace.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-02-25 22:03:11 -0500
committerTavian Barnes <tavianator@gmail.com>2010-02-25 22:03:11 -0500
commit40b180db2833e4e6ef835a463ca15ff865ce0d18 (patch)
treeebb3f808374d653cd150852e252e68b9addca8d0 /libdimension/raytrace.c
parentb27ad82573bc70d84bc4213ba00771f4746b36bc (diff)
downloaddimension-40b180db2833e4e6ef835a463ca15ff865ce0d18.tar.xz
Point the normal vectors away from the object.
Diffstat (limited to 'libdimension/raytrace.c')
-rw-r--r--libdimension/raytrace.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c
index 3fa873c..826cc58 100644
--- a/libdimension/raytrace.c
+++ b/libdimension/raytrace.c
@@ -323,7 +323,8 @@ dmnsn_raytrace_light_ray(const dmnsn_raytrace_state *state,
shadow_ray = dmnsn_line_add_epsilon(shadow_ray);
/* Check if we're casting a shadow on ourself */
- if (dmnsn_vector_dot(shadow_ray.n, state->intersection->normal) < 0.0)
+ if (dmnsn_vector_dot(shadow_ray.n, state->intersection->normal)
+ * dmnsn_vector_dot(state->viewer, state->intersection->normal) < 0.0)
return dmnsn_black;
dmnsn_color color = (*light->light_fn)(light, state->r);