BLI_kdopbvh: Pass center to to range callback
Useful when BLI_bvhtree_range_query callback calculates a new position to measure from.
This commit is contained in:
@@ -102,7 +102,7 @@ typedef void (*BVHTree_NearestToRayCallback)(void *userdata, int index, const BV
|
||||
typedef bool (*BVHTree_OverlapCallback)(void *userdata, int index_a, int index_b, int thread);
|
||||
|
||||
/* callback to range search query */
|
||||
typedef void (*BVHTree_RangeQuery)(void *userdata, int index, float dist_sq);
|
||||
typedef void (*BVHTree_RangeQuery)(void *userdata, int index, const float co[3], float dist_sq);
|
||||
|
||||
|
||||
/* callbacks to BLI_bvhtree_walk_dfs */
|
||||
|
||||
@@ -2009,7 +2009,7 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
|
||||
/* Its a leaf.. call the callback */
|
||||
if (node->children[i]->totnode == 0) {
|
||||
data->hits++;
|
||||
data->callback(data->userdata, node->children[i]->index, dist_sq);
|
||||
data->callback(data->userdata, node->children[i]->index, data->center, dist_sq);
|
||||
}
|
||||
else
|
||||
dfs_range_query(data, node->children[i]);
|
||||
@@ -2040,7 +2040,7 @@ int BLI_bvhtree_range_query(
|
||||
/* Its a leaf.. call the callback */
|
||||
if (root->totnode == 0) {
|
||||
data.hits++;
|
||||
data.callback(data.userdata, root->index, dist_sq);
|
||||
data.callback(data.userdata, root->index, co, dist_sq);
|
||||
}
|
||||
else
|
||||
dfs_range_query(&data, root);
|
||||
|
||||
Reference in New Issue
Block a user