Cleanup: int->BVHCacheType enum
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 **bvh_cache)
|
||||
{
|
||||
BVHTree *tree = NULL;
|
||||
@@ -1621,7 +1621,7 @@ void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
|
||||
* \{ */
|
||||
|
||||
typedef struct BVHCacheItem {
|
||||
int type;
|
||||
BVHCacheType type;
|
||||
BVHTree *tree;
|
||||
|
||||
} BVHCacheItem;
|
||||
@@ -1629,7 +1629,7 @@ typedef struct BVHCacheItem {
|
||||
/**
|
||||
* Queries a bvhcache for the cache bvhtree of the request type
|
||||
*/
|
||||
bool bvhcache_find(const BVHCache *cache, int type, BVHTree **r_tree)
|
||||
bool bvhcache_find(const BVHCache *cache, BVHCacheType type, BVHTree **r_tree)
|
||||
{
|
||||
while (cache) {
|
||||
const BVHCacheItem *item = cache->link;
|
||||
@@ -1662,7 +1662,7 @@ bool bvhcache_has_tree(const BVHCache *cache, const BVHTree *tree)
|
||||
* A call to this assumes that there was no previous cached tree of the given type
|
||||
* \warning The #BVHTree can be NULL.
|
||||
*/
|
||||
void bvhcache_insert(BVHCache **cache_p, BVHTree *tree, int type)
|
||||
void bvhcache_insert(BVHCache **cache_p, BVHTree *tree, BVHCacheType type)
|
||||
{
|
||||
BVHCacheItem *item = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user