diff options
author | Germano <germano.costa@ig.com.br> | 2018-05-01 16:03:28 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2018-05-01 16:03:28 +0300 |
commit | 522bee3fc838c83b377d0e05fef8299a29ae5a16 (patch) | |
tree | 6bfd84127fd6da9921b7d3e4136381e208900483 /source/blender/blenkernel/intern/bvhutils.c | |
parent | 2e98524b58a53f0d546e5f1e7d549d2f45815055 (diff) |
Refactoring: bvhutils: Use a function that gets the bvhtree through an identifier type.
Reviewed By: @campbellbarton
Differential Revision: https://developer.blender.org/D3192
Diffstat (limited to 'source/blender/blenkernel/intern/bvhutils.c')
-rw-r--r-- | source/blender/blenkernel/intern/bvhutils.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index cd2c7194237..90a75b8d3cc 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -501,7 +501,7 @@ BVHTree *bvhtree_from_editmesh_verts( /* Builds a bvh tree where nodes are the vertices of the given dm * and stores the BVHTree in dm->bvhCache */ -BVHTree *bvhtree_from_mesh_verts( +static BVHTree *bvhtree_from_mesh_verts( BVHTreeFromMesh *data, DerivedMesh *dm, float epsilon, int tree_type, int axis) { @@ -859,7 +859,7 @@ static void bvhtree_from_mesh_faces_setup_data( } /* Builds a bvh tree where nodes are the tesselated faces of the given dm */ -BVHTree *bvhtree_from_mesh_faces( +static BVHTree *bvhtree_from_mesh_faces( BVHTreeFromMesh *data, DerivedMesh *dm, float epsilon, int tree_type, int axis) { @@ -1225,6 +1225,25 @@ BVHTree *bvhtree_from_mesh_looptri_ex( return tree; } +/** + * 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) +{ + switch (type) { + case BVHTREE_FROM_VERTS: + return bvhtree_from_mesh_verts(data, mesh, 0.0f, 2, 6); + case BVHTREE_FROM_EDGES: + return bvhtree_from_mesh_edges(data, mesh, 0.0f, 2, 6); + case BVHTREE_FROM_FACES: + return bvhtree_from_mesh_faces(data, mesh, 0.0f, 2, 6); + case BVHTREE_FROM_LOOPTRI: + return bvhtree_from_mesh_looptri(data, mesh, 0.0f, 2, 6); + } + return NULL; +} + /** \} */ |