summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-01-09 20:27:45 -0500
committerTavian Barnes <tavianator@gmail.com>2010-01-09 20:27:45 -0500
commite541fdb578ee9755c78d4f835edf0fa6bf8aea92 (patch)
tree326b5839aea85895346d04e3a5f0e5b8a96f1276 /libdimension
parent426482f9848db956095943e9f0983db0d6ab1a0d (diff)
downloaddimension-e541fdb578ee9755c78d4f835edf0fa6bf8aea92.tar.xz
Calculate transformed surface normals correctly.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/kD_splay_tree.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libdimension/kD_splay_tree.c b/libdimension/kD_splay_tree.c
index ca31b86..b6be801 100644
--- a/libdimension/kD_splay_tree.c
+++ b/libdimension/kD_splay_tree.c
@@ -359,9 +359,15 @@ dmnsn_kD_splay_search_recursive(dmnsn_kD_splay_node *node, dmnsn_line ray,
/* Transform the intersection back to the observer's view */
result.intersection->ray = ray;
result.intersection->normal = dmnsn_vector_normalize(
- dmnsn_matrix_vector_mul(
- node->object->trans,
- result.intersection->normal
+ dmnsn_vector_sub(
+ dmnsn_matrix_vector_mul(
+ node->object->trans,
+ result.intersection->normal
+ ),
+ dmnsn_matrix_vector_mul(
+ node->object->trans,
+ dmnsn_zero
+ )
)
);
} else {