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:
authorGermano <germano.costa@ig.com.br>2018-05-03 20:26:39 +0300
committerGermano <germano.costa@ig.com.br>2018-05-03 20:26:39 +0300
commitac19483e632bd3e2388a6a0de2db753efe33a860 (patch)
treea7b7433b51a8501875ab142658749b3ded6b224d /source/blender/blenkernel/intern/bvhutils.c
parenta5d0597b927d90c3621f8a40b0703cc158800fb8 (diff)
BKE bvhtree: Add `tree_type` parameter to `bvhtree_from_mesh_get`.
This will allow greater control of the bvhtrees that are obtained, and helps identify problems. It is also an additional step to unify the functions.
Diffstat (limited to 'source/blender/blenkernel/intern/bvhutils.c')
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 90a75b8d3cc..7f50fcfcb2b 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -1229,19 +1229,30 @@ BVHTree *bvhtree_from_mesh_looptri_ex(
* Builds or queries a bvhcache for the cache bvhtree of the request type.
*/
BVHTree *bvhtree_from_mesh_get(
- struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, int type)
+ struct BVHTreeFromMesh *data, struct DerivedMesh *mesh,
+ const int type, const int tree_type)
{
+ BVHTree *tree = NULL;
switch (type) {
case BVHTREE_FROM_VERTS:
- return bvhtree_from_mesh_verts(data, mesh, 0.0f, 2, 6);
+ tree = bvhtree_from_mesh_verts(data, mesh, 0.0f, tree_type, 6);
+ break;
case BVHTREE_FROM_EDGES:
- return bvhtree_from_mesh_edges(data, mesh, 0.0f, 2, 6);
+ tree = bvhtree_from_mesh_edges(data, mesh, 0.0f, tree_type, 6);
+ break;
case BVHTREE_FROM_FACES:
- return bvhtree_from_mesh_faces(data, mesh, 0.0f, 2, 6);
+ tree = bvhtree_from_mesh_faces(data, mesh, 0.0f, tree_type, 6);
+ break;
case BVHTREE_FROM_LOOPTRI:
- return bvhtree_from_mesh_looptri(data, mesh, 0.0f, 2, 6);
+ tree = bvhtree_from_mesh_looptri(data, mesh, 0.0f, tree_type, 6);
+ break;
}
- return NULL;
+#ifdef DEBUG
+ if (BLI_bvhtree_get_tree_type(tree) != tree_type) {
+ printf("tree_type %d obtained instead of %d\n", BLI_bvhtree_get_tree_type(tree), tree_type);
+ }
+#endif
+ return tree;
}
/** \} */