diff options
Diffstat (limited to 'libdimension/object.c')
-rw-r--r-- | libdimension/object.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/libdimension/object.c b/libdimension/object.c index 56e25c3..b118835 100644 --- a/libdimension/object.c +++ b/libdimension/object.c @@ -87,39 +87,3 @@ dmnsn_initialize_object(dmnsn_object *object) dmnsn_initialize_texture(object->texture); } } - -/* Helper function to transform a normal vector */ -static inline dmnsn_vector -dmnsn_transform_normal(dmnsn_matrix trans, dmnsn_vector normal) -{ - return dmnsn_vector_normalize( - dmnsn_vector_sub( - dmnsn_transform_vector(trans, normal), - /* Optimized form of dmnsn_transform_vector(trans, dmnsn_zero) */ - dmnsn_new_vector(trans.n[0][3], trans.n[1][3], trans.n[2][3]) - ) - ); -} - -bool -dmnsn_object_intersection(const dmnsn_object *object, dmnsn_line line, - dmnsn_intersection *intersection) -{ - dmnsn_line line_trans = dmnsn_transform_line(object->trans_inv, line); - if ((*object->intersection_fn)(object, line_trans, intersection)) { - /* Get us back into world coordinates */ - intersection->ray = line; - intersection->normal = dmnsn_transform_normal(object->trans, - intersection->normal); - return true; - } else { - return false; - } -} - -bool -dmnsn_object_inside(const dmnsn_object *object, dmnsn_vector point) -{ - point = dmnsn_transform_vector(object->trans_inv, point); - return (*object->inside_fn)(object, point); -} |