diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-04-20 22:39:41 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-04-20 22:43:17 -0400 |
commit | 9cc3fef27ba1c23b2b935b6f81cf15dc9159fe3a (patch) | |
tree | f31cf4d59c104fff165177b4881175bf77b03aba /libdimension/prtree.h | |
parent | 5c9680634b2999afdf43eaef5f367e98d3888f96 (diff) | |
download | dimension-9cc3fef27ba1c23b2b935b6f81cf15dc9159fe3a.tar.xz |
Cache previous intersections in dmnsn_prtree_intersection().
Due to geometric locality of rays, this provides a very large speedup for
most scenes.
Diffstat (limited to 'libdimension/prtree.h')
-rw-r--r-- | libdimension/prtree.h | 3 |
1 files changed, 2 insertions, 1 deletions
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); |