Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-08-20 10:32:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-08-20 10:52:26 +0300
commit176b806626ed62cb1bb9f609f927dc27e6e9c268 (patch)
tree7967f49985257e4b3ddd0a247157a2c46f0223ef /source/blender/blenlib/BLI_kdopbvh.h
parent67e32b31951b8b570148bd8b456afac27bb9645a (diff)
BVH-overlap: add callback to BLI_bvhtree_overlap
The callback checks if 2 nodes intersect (not just their AABB). Advantages: - theres no need to allocate overlaps which are later ignored. - expensive intersection tests will run multi-threaded. Currently only used for Python API.
Diffstat (limited to 'source/blender/blenlib/BLI_kdopbvh.h')
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index 9f16b02da33..6fc93ca9cdb 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -74,6 +74,9 @@ typedef void (*BVHTree_NearestPointCallback)(void *userdata, int index, const fl
/* callback must update hit in case it finds a nearest successful hit */
typedef void (*BVHTree_RayCastCallback)(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit);
+/* callback to check if 2 nodes overlap (use thread if intersection results need to be stored) */
+typedef bool (*BVHTree_OverlapCallback)(void *userdata, int index_a, int index_b, unsigned int thread);
+
/* callback to range search query */
typedef void (*BVHTree_RangeQuery)(void *userdata, int index, float dist_sq);
@@ -88,8 +91,12 @@ void BLI_bvhtree_balance(BVHTree *tree);
bool BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints);
void BLI_bvhtree_update_tree(BVHTree *tree);
+unsigned int BLI_bvhtree_overlap_thread_num(const BVHTree *tree);
+
/* collision/overlap: check two trees if they overlap, alloc's *overlap with length of the int return value */
-BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int *r_overlap_tot);
+BVHTreeOverlap *BLI_bvhtree_overlap(
+ const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_tot,
+ BVHTree_OverlapCallback callback, void *userdata);
float BLI_bvhtree_getepsilon(const BVHTree *tree);