summaryrefslogtreecommitdiffstats
path: root/libdimension/raytrace.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-11-09 15:01:22 -0500
committerTavian Barnes <tavianator@gmail.com>2009-11-09 15:01:22 -0500
commit319491781c1389d82897075b6d890e74d82a08a9 (patch)
tree048b36a0fc9451db499f4f6c1d828814130a67fa /libdimension/raytrace.c
parent1044badd2e625c73eae616f6a0d10479dde54db5 (diff)
downloaddimension-319491781c1389d82897075b6d890e74d82a08a9.tar.xz
Calculate surface normals in intersection callbacks.
Diffstat (limited to 'libdimension/raytrace.c')
-rw-r--r--libdimension/raytrace.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c
index dc017f5..262929f 100644
--- a/libdimension/raytrace.c
+++ b/libdimension/raytrace.c
@@ -307,7 +307,7 @@ dmnsn_raytrace_shoot(dmnsn_line ray, dmnsn_scene *scene,
= dmnsn_kD_splay_search(kD_splay_tree, shadow_ray);
if (!shadow_caster || shadow_caster->t > 1.0) {
- dmnsn_vector object_normal = x0;
+ dmnsn_vector object_normal = intersection->normal;
dmnsn_vector normal = dmnsn_vector_normalize(
dmnsn_vector_add(
dmnsn_vector_normalize(dmnsn_vector_sub(ray.x0, x0)),
@@ -322,13 +322,6 @@ dmnsn_raytrace_shoot(dmnsn_line ray, dmnsn_scene *scene,
),
illum
);
- illum = dmnsn_color_add(
- dmnsn_color_mul(
- 0.1*dmnsn_vector_dot(normal, object_normal),
- dmnsn_color_illuminate((*light->light_fn)(light, x0), dmnsn_white)
- ),
- illum
- );
}
dmnsn_delete_intersection(shadow_caster);