[Bf-blender-cvs] [86580c437bb] master: Cleanup: int->BVHCacheType enum

Jeroen Bakker noreply at git.blender.org
Fri May 15 13:57:32 CEST 2020


Commit: 86580c437bb51a5a9c5f7875ad414bd619083886
Author: Jeroen Bakker
Date:   Fri May 15 13:54:22 2020 +0200
Branches: master
https://developer.blender.org/rB86580c437bb51a5a9c5f7875ad414bd619083886

Cleanup: int->BVHCacheType enum

===================================================================

M	source/blender/blenkernel/BKE_bvhutils.h
M	source/blender/blenkernel/intern/bvhutils.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h
index b83ebf8ce09..458f1ab7a56 100644
--- a/source/blender/blenkernel/BKE_bvhutils.h
+++ b/source/blender/blenkernel/BKE_bvhutils.h
@@ -85,6 +85,21 @@ typedef struct BVHTreeFromMesh {
 
 } BVHTreeFromMesh;
 
+typedef enum BVHCacheType {
+  BVHTREE_FROM_VERTS,
+  BVHTREE_FROM_EDGES,
+  BVHTREE_FROM_FACES,
+  BVHTREE_FROM_LOOPTRI,
+  BVHTREE_FROM_LOOPTRI_NO_HIDDEN,
+
+  BVHTREE_FROM_LOOSEVERTS,
+  BVHTREE_FROM_LOOSEEDGES,
+
+  BVHTREE_FROM_EM_VERTS,
+  BVHTREE_FROM_EM_EDGES,
+  BVHTREE_FROM_EM_LOOPTRI,
+} BVHCacheType;
+
 /**
  * Builds a bvh tree where nodes are the relevant elements of the given mesh.
  * Configures #BVHTreeFromMesh.
@@ -106,7 +121,7 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data,
                                         float epsilon,
                                         int tree_type,
                                         int axis,
-                                        const int bvh_cache_type,
+                                        const BVHCacheType bvh_cache_type,
                                         BVHCache **bvh_cache);
 
 BVHTree *bvhtree_from_mesh_verts_ex(struct BVHTreeFromMesh *data,
@@ -118,7 +133,7 @@ BVHTree *bvhtree_from_mesh_verts_ex(struct BVHTreeFromMesh *data,
                                     float epsilon,
                                     int tree_type,
                                     int axis,
-                                    const int bvh_cache_type,
+                                    const BVHCacheType bvh_cache_type,
                                     BVHCache **bvh_cache);
 
 BVHTree *bvhtree_from_editmesh_edges(
@@ -131,7 +146,7 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data,
                                         float epsilon,
                                         int tree_type,
                                         int axis,
-                                        const int bvh_cache_type,
+                                        const BVHCacheType bvh_cache_type,
                                         BVHCache **bvh_cache);
 
 BVHTree *bvhtree_from_mesh_edges_ex(struct BVHTreeFromMesh *data,
@@ -145,7 +160,7 @@ BVHTree *bvhtree_from_mesh_edges_ex(struct BVHTreeFromMesh *data,
                                     float epsilon,
                                     int tree_type,
                                     int axis,
-                                    const int bvh_cache_type,
+                                    const BVHCacheType bvh_cache_type,
                                     BVHCache **bvh_cache);
 
 BVHTree *bvhtree_from_mesh_faces_ex(struct BVHTreeFromMesh *data,
@@ -159,7 +174,7 @@ BVHTree *bvhtree_from_mesh_faces_ex(struct BVHTreeFromMesh *data,
                                     float epsilon,
                                     int tree_type,
                                     int axis,
-                                    const int bvh_cache_type,
+                                    const BVHCacheType bvh_cache_type,
                                     BVHCache **bvh_cache);
 
 BVHTree *bvhtree_from_editmesh_looptri(
@@ -172,7 +187,7 @@ BVHTree *bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data,
                                           float epsilon,
                                           int tree_type,
                                           int axis,
-                                          const int bvh_cache_type,
+                                          const BVHCacheType bvh_cache_type,
                                           BVHCache **bvh_cache);
 
 BVHTree *bvhtree_from_mesh_looptri_ex(struct BVHTreeFromMesh *data,
@@ -188,18 +203,18 @@ BVHTree *bvhtree_from_mesh_looptri_ex(struct BVHTreeFromMesh *data,
                                       float epsilon,
                                       int tree_type,
                                       int axis,
-                                      const int bvh_cache_type,
+                                      const BVHCacheType bvh_cache_type,
                                       BVHCache **bvh_cache);
 
 BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
                                    struct Mesh *mesh,
-                                   const int type,
+                                   const BVHCacheType bvh_cache_type,
                                    const int tree_type);
 
 BVHTree *BKE_bvhtree_from_editmesh_get(BVHTreeFromEditMesh *data,
                                        struct BMEditMesh *em,
                                        const int tree_type,
-                                       const int bvh_cache_type,
+                                       const BVHCacheType bvh_cache_type,
                                        BVHCache **bvh_cache);
 
 /**
@@ -228,24 +243,10 @@ float bvhtree_sphereray_tri_intersection(const BVHTreeRay *ray,
  */
 
 /* Using local coordinates */
-enum {
-  BVHTREE_FROM_VERTS,
-  BVHTREE_FROM_EDGES,
-  BVHTREE_FROM_FACES,
-  BVHTREE_FROM_LOOPTRI,
-  BVHTREE_FROM_LOOPTRI_NO_HIDDEN,
-
-  BVHTREE_FROM_LOOSEVERTS,
-  BVHTREE_FROM_LOOSEEDGES,
-
-  BVHTREE_FROM_EM_VERTS,
-  BVHTREE_FROM_EM_EDGES,
-  BVHTREE_FROM_EM_LOOPTRI,
-};
 
-bool bvhcache_find(const BVHCache *cache, int type, BVHTree **r_tree);
+bool bvhcache_find(const BVHCache *cache, BVHCacheType type, BVHTree **r_tree);
 bool bvhcache_has_tree(const BVHCache *cache, const BVHTree *tree);
-void bvhcache_insert(BVHCache **cache_p, BVHTree *tree, int type);
+void bvhcache_insert(BVHCache **cache_p, BVHTree *tree, BVHCacheType type);
 void bvhcache_free(BVHCache **cache_p);
 
 #ifdef __cplusplus
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 8f6b8bd6980..cd90ebc2eed 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -517,7 +517,7 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data,
                                         float epsilon,
                                         int tree_type,
                                         int axis,
-                                        const int bvh_cache_type,
+                                        const BVHCacheType bvh_cache_type,
                                         BVHCache **bvh_cache)
 {
   BVHTree *tree = NULL;
@@ -581,7 +581,7 @@ BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data,
                                     float epsilon,
                                     int tree_type,
                                     int axis,
-                                    const int bvh_cache_type,
+                                    const BVHCacheType bvh_cache_type,
                                     BVHCache **bvh_cache)
 {
   bool in_cache = false;
@@ -734,7 +734,7 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data,
                                         float epsilon,
                                         int tree_type,
                                         int axis,
-                                        const int bvh_cache_type,
+                                        const BVHCacheType bvh_cache_type,
                                         BVHCache **bvh_cache)
 {
   BVHTree *tree = NULL;
@@ -801,7 +801,7 @@ BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data,
                                     float epsilon,
                                     int tree_type,
                                     int axis,
-                                    const int bvh_cache_type,
+                                    const BVHCacheType bvh_cache_type,
                                     BVHCache **bvh_cache)
 {
   bool in_cache = false;
@@ -936,7 +936,7 @@ BVHTree *bvhtree_from_mesh_faces_ex(BVHTreeFromMesh *data,
                                     float epsilon,
                                     int tree_type,
                                     int axis,
-                                    const int bvh_cache_type,
+                                    const BVHCacheType bvh_cache_type,
                                     BVHCache **bvh_cache)
 {
   bool in_cache = false;
@@ -1112,7 +1112,7 @@ BVHTree *bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data,
                                           float epsilon,
                                           int tree_type,
                                           int axis,
-                                          const int bvh_cache_type,
+                                          const BVHCacheType bvh_cache_type,
                                           BVHCache **bvh_cache)
 {
   /* BMESH specific check that we have tessfaces,
@@ -1176,7 +1176,7 @@ BVHTree *bvhtree_from_mesh_looptri_ex(BVHTreeFromMesh *data,
                                       float epsilon,
                                       int tree_type,
                                       int axis,
-                                      const int bvh_cache_type,
+                                      const BVHCacheType bvh_cache_type,
                                       BVHCache **bvh_cache)
 {
   bool in_cache = false;
@@ -1311,7 +1311,7 @@ static BLI_bitmap *looptri_no_hidden_map_get(const MPoly *mpoly,
  */
 BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
                                    struct Mesh *mesh,
-                                   const int bvh_cache_type,
+                                   const BVHCacheType bvh_cache_type,
                                    const int tree_type)
 {
   BVHTree *tree = NULL;
@@ -1492,7 +1492,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
 BVHTree *BKE_bvhtree_from_editmesh_get(BVHTreeFromEditMesh *data,
                                        struct BMEditMesh *em,
                                        const int tree_type,
-                                       const int bvh_cache_type,
+                                       const BVHCacheType bvh_cache_type,
                                        BVHCache **b

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list