Cleanup: pass const arguments to BMBVHTree related functions

This commit is contained in:
Campbell Barton
2024-09-24 15:36:00 +10:00
parent 1ceab37693
commit 2ab800b685
4 changed files with 30 additions and 18 deletions

View File

@@ -42,7 +42,7 @@ BMBVHTree *BKE_bmbvh_new(struct BMesh *bm,
void BKE_bmbvh_free(BMBVHTree *tree);
struct BVHTree *BKE_bmbvh_tree_get(BMBVHTree *tree);
struct BMFace *BKE_bmbvh_ray_cast(BMBVHTree *tree,
struct BMFace *BKE_bmbvh_ray_cast(const BMBVHTree *tree,
const float co[3],
const float dir[3],
float radius,
@@ -50,7 +50,7 @@ struct BMFace *BKE_bmbvh_ray_cast(BMBVHTree *tree,
float r_hitout[3],
float r_cagehit[3]);
struct BMFace *BKE_bmbvh_ray_cast_filter(BMBVHTree *tree,
struct BMFace *BKE_bmbvh_ray_cast_filter(const BMBVHTree *tree,
const float co[3],
const float dir[3],
float radius,
@@ -63,8 +63,12 @@ struct BMFace *BKE_bmbvh_ray_cast_filter(BMBVHTree *tree,
/**
* Find a vert closest to co in a sphere of radius dist_max.
*/
struct BMVert *BKE_bmbvh_find_vert_closest(BMBVHTree *tree, const float co[3], float dist_max);
struct BMFace *BKE_bmbvh_find_face_closest(BMBVHTree *tree, const float co[3], float dist_max);
struct BMVert *BKE_bmbvh_find_vert_closest(const BMBVHTree *tree,
const float co[3],
float dist_max);
struct BMFace *BKE_bmbvh_find_face_closest(const BMBVHTree *tree,
const float co[3],
float dist_max);
/**
* Overlap indices reference the looptris.

View File

@@ -218,7 +218,7 @@ struct RayCastUserData {
float uv[2];
};
static BMFace *bmbvh_ray_cast_handle_hit(BMBVHTree *bmtree,
static BMFace *bmbvh_ray_cast_handle_hit(const BMBVHTree *bmtree,
RayCastUserData *bmcb_data,
const BVHTreeRayHit *hit,
float *r_dist,
@@ -286,7 +286,7 @@ static void bmbvh_ray_cast_cb(void *userdata, int index, const BVHTreeRay *ray,
}
}
BMFace *BKE_bmbvh_ray_cast(BMBVHTree *bmtree,
BMFace *BKE_bmbvh_ray_cast(const BMBVHTree *bmtree,
const float co[3],
const float dir[3],
const float radius,
@@ -344,7 +344,7 @@ static void bmbvh_ray_cast_cb_filter(void *userdata,
}
}
BMFace *BKE_bmbvh_ray_cast_filter(BMBVHTree *bmtree,
BMFace *BKE_bmbvh_ray_cast_filter(const BMBVHTree *bmtree,
const float co[3],
const float dir[3],
const float radius,
@@ -421,7 +421,9 @@ static void bmbvh_find_vert_closest_cb(void *userdata,
}
}
BMVert *BKE_bmbvh_find_vert_closest(BMBVHTree *bmtree, const float co[3], const float dist_max)
BMVert *BKE_bmbvh_find_vert_closest(const BMBVHTree *bmtree,
const float co[3],
const float dist_max)
{
BVHTreeNearest hit;
VertSearchUserData bmcb_data;
@@ -480,7 +482,9 @@ static void bmbvh_find_face_closest_cb(void *userdata,
}
}
BMFace *BKE_bmbvh_find_face_closest(BMBVHTree *bmtree, const float co[3], const float dist_max)
BMFace *BKE_bmbvh_find_face_closest(const BMBVHTree *bmtree,
const float co[3],
const float dist_max)
{
BVHTreeNearest hit;
FaceSearchUserData bmcb_data;

View File

@@ -173,12 +173,12 @@ UvVertMap *BM_uv_vert_map_create(BMesh *bm, bool use_select);
void EDBM_flag_enable_all(BMEditMesh *em, char hflag);
void EDBM_flag_disable_all(BMEditMesh *em, char hflag);
bool BMBVH_EdgeVisible(BMBVHTree *tree,
BMEdge *e,
Depsgraph *depsgraph,
ARegion *region,
View3D *v3d,
Object *obedit);
bool BMBVH_EdgeVisible(const BMBVHTree *tree,
const BMEdge *e,
const Depsgraph *depsgraph,
const ARegion *region,
const View3D *v3d,
const Object *obedit);
void EDBM_project_snap_verts(
bContext *C, Depsgraph *depsgraph, ARegion *region, Object *obedit, BMEditMesh *em);

View File

@@ -1825,7 +1825,7 @@ BMElem *EDBM_elem_from_index_any_multi(const Scene *scene,
* \{ */
static BMFace *edge_ray_cast(
BMBVHTree *tree, const float co[3], const float dir[3], float *r_hitout, BMEdge *e)
const BMBVHTree *tree, const float co[3], const float dir[3], float *r_hitout, const BMEdge *e)
{
BMFace *f = BKE_bmbvh_ray_cast(tree, co, dir, 0.0f, nullptr, r_hitout, nullptr);
@@ -1843,8 +1843,12 @@ static void scale_point(float c1[3], const float p[3], const float s)
add_v3_v3(c1, p);
}
bool BMBVH_EdgeVisible(
BMBVHTree *tree, BMEdge *e, Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obedit)
bool BMBVH_EdgeVisible(const BMBVHTree *tree,
const BMEdge *e,
const Depsgraph *depsgraph,
const ARegion *region,
const View3D *v3d,
const Object *obedit)
{
BMFace *f;
float co1[3], co2[3], co3[3], dir1[3], dir2[3], dir3[3];