diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-01-09 20:27:45 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-01-09 20:27:45 -0500 |
commit | e541fdb578ee9755c78d4f835edf0fa6bf8aea92 (patch) | |
tree | 326b5839aea85895346d04e3a5f0e5b8a96f1276 /libdimension | |
parent | 426482f9848db956095943e9f0983db0d6ab1a0d (diff) | |
download | dimension-e541fdb578ee9755c78d4f835edf0fa6bf8aea92.tar.xz |
Calculate transformed surface normals correctly.
Diffstat (limited to 'libdimension')
-rw-r--r-- | libdimension/kD_splay_tree.c | 12 |
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 { |