From e541fdb578ee9755c78d4f835edf0fa6bf8aea92 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 9 Jan 2010 20:27:45 -0500 Subject: Calculate transformed surface normals correctly. --- libdimension/kD_splay_tree.c | 12 +++++++++--- 1 file 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 { -- cgit v1.2.3