From 9cc3fef27ba1c23b2b935b6f81cf15dc9159fe3a Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 20 Apr 2011 22:39:41 -0400 Subject: Cache previous intersections in dmnsn_prtree_intersection(). Due to geometric locality of rays, this provides a very large speedup for most scenes. --- libdimension/prtree.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libdimension/prtree.h') diff --git a/libdimension/prtree.h b/libdimension/prtree.h index 86707cf..26d6c1e 100644 --- a/libdimension/prtree.h +++ b/libdimension/prtree.h @@ -37,6 +37,7 @@ typedef struct dmnsn_prtree { dmnsn_bounding_box bounding_box; /**< The bounding box for the whole scene. */ dmnsn_array *unbounded; /**< The unbounded objects. */ dmnsn_array *bounded; /**< A PR-tree of the bounded objects. */ + size_t id; /**< A unique ID for the PR-tree. */ } dmnsn_prtree; /** Create a PR-tree. */ @@ -46,7 +47,7 @@ void dmnsn_delete_prtree(dmnsn_prtree *tree); /** Find the closest ray-object intersection in the tree. */ bool dmnsn_prtree_intersection(const dmnsn_prtree *tree, dmnsn_line ray, - dmnsn_intersection *intersection); + dmnsn_intersection *intersection, bool reset); /** Determine whether a point is inside any object in the tree. */ bool dmnsn_prtree_inside(const dmnsn_prtree *tree, dmnsn_vector point); -- cgit v1.2.3