From f3bfbd9d84f79bf0533957aec617ad5b360de342 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Sun, 3 Dec 2023 17:37:57 -0500 Subject: [PATCH] Cleanup: Use const arguments to PBVH functions --- source/blender/blenkernel/BKE_pbvh_api.hh | 20 +++++++++---------- source/blender/blenkernel/intern/pbvh.cc | 24 +++++++++++------------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/source/blender/blenkernel/BKE_pbvh_api.hh b/source/blender/blenkernel/BKE_pbvh_api.hh index 2691ba889f3..35ff294c9fc 100644 --- a/source/blender/blenkernel/BKE_pbvh_api.hh +++ b/source/blender/blenkernel/BKE_pbvh_api.hh @@ -368,11 +368,11 @@ void BKE_pbvh_node_mark_redraw(PBVHNode *node); void BKE_pbvh_node_mark_normals_update(PBVHNode *node); void BKE_pbvh_node_mark_topology_update(PBVHNode *node); void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden); -bool BKE_pbvh_node_fully_hidden_get(PBVHNode *node); +bool BKE_pbvh_node_fully_hidden_get(const PBVHNode *node); void BKE_pbvh_node_fully_masked_set(PBVHNode *node, int fully_masked); -bool BKE_pbvh_node_fully_masked_get(PBVHNode *node); +bool BKE_pbvh_node_fully_masked_get(const PBVHNode *node); void BKE_pbvh_node_fully_unmasked_set(PBVHNode *node, int fully_masked); -bool BKE_pbvh_node_fully_unmasked_get(PBVHNode *node); +bool BKE_pbvh_node_fully_unmasked_get(const PBVHNode *node); void BKE_pbvh_mark_rebuild_pixels(PBVH *pbvh); void BKE_pbvh_vert_tag_update_normal(PBVH *pbvh, PBVHVertRef vertex); @@ -386,7 +386,7 @@ void BKE_pbvh_node_num_verts(const PBVH *pbvh, int BKE_pbvh_node_num_unique_verts(const PBVH &pbvh, const PBVHNode &node); blender::Span BKE_pbvh_node_get_vert_indices(const PBVHNode *node); blender::Span BKE_pbvh_node_get_unique_vert_indices(const PBVHNode *node); -void BKE_pbvh_node_get_loops(PBVHNode *node, const int **r_loop_indices); +void BKE_pbvh_node_get_loops(const PBVHNode *node, const int **r_loop_indices); blender::Vector BKE_pbvh_node_calc_face_indices(const PBVH &pbvh, const PBVHNode &node); /* Get number of faces in the mesh; for PBVH_GRIDS the @@ -394,19 +394,19 @@ blender::Vector BKE_pbvh_node_calc_face_indices(const PBVH &pbvh, const PBV */ int BKE_pbvh_num_faces(const PBVH *pbvh); -void BKE_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3]); -void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3]); +void BKE_pbvh_node_get_BB(const PBVHNode *node, float bb_min[3], float bb_max[3]); +void BKE_pbvh_node_get_original_BB(const PBVHNode *node, float bb_min[3], float bb_max[3]); -float BKE_pbvh_node_get_tmin(PBVHNode *node); +float BKE_pbvh_node_get_tmin(const PBVHNode *node); /** * Test if AABB is at least partially inside the #PBVHFrustumPlanes volume. */ -bool BKE_pbvh_node_frustum_contain_AABB(PBVHNode *node, PBVHFrustumPlanes *frustum); +bool BKE_pbvh_node_frustum_contain_AABB(const PBVHNode *node, const PBVHFrustumPlanes *frustum); /** * Test if AABB is at least partially outside the #PBVHFrustumPlanes volume. */ -bool BKE_pbvh_node_frustum_exclude_AABB(PBVHNode *node, PBVHFrustumPlanes *frustum); +bool BKE_pbvh_node_frustum_exclude_AABB(const PBVHNode *node, const PBVHFrustumPlanes *frustum); const blender::Set &BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node); const blender::Set &BKE_pbvh_bmesh_node_other_verts(PBVHNode *node); @@ -436,7 +436,7 @@ void BKE_pbvh_grids_update(PBVH *pbvh, CCGKey *key); void BKE_pbvh_subdiv_cgg_set(PBVH *pbvh, SubdivCCG *subdiv_ccg); void BKE_pbvh_vert_coords_apply(PBVH *pbvh, blender::Span vert_positions); -bool BKE_pbvh_is_deformed(PBVH *pbvh); +bool BKE_pbvh_is_deformed(const PBVH *pbvh); /* Vertex Iterator. */ diff --git a/source/blender/blenkernel/intern/pbvh.cc b/source/blender/blenkernel/intern/pbvh.cc index 0d8c2e222de..32dcc4c54d5 100644 --- a/source/blender/blenkernel/intern/pbvh.cc +++ b/source/blender/blenkernel/intern/pbvh.cc @@ -1182,7 +1182,7 @@ static void free_tree(node_tree *tree) free(tree); } -float BKE_pbvh_node_get_tmin(PBVHNode *node) +float BKE_pbvh_node_get_tmin(const PBVHNode *node) { return node->tmin; } @@ -1884,7 +1884,7 @@ void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden) } } -bool BKE_pbvh_node_fully_hidden_get(PBVHNode *node) +bool BKE_pbvh_node_fully_hidden_get(const PBVHNode *node) { return (node->flag & PBVH_Leaf) && (node->flag & PBVH_FullyHidden); } @@ -1901,7 +1901,7 @@ void BKE_pbvh_node_fully_masked_set(PBVHNode *node, int fully_masked) } } -bool BKE_pbvh_node_fully_masked_get(PBVHNode *node) +bool BKE_pbvh_node_fully_masked_get(const PBVHNode *node) { return (node->flag & PBVH_Leaf) && (node->flag & PBVH_FullyMasked); } @@ -1918,7 +1918,7 @@ void BKE_pbvh_node_fully_unmasked_set(PBVHNode *node, int fully_masked) } } -bool BKE_pbvh_node_fully_unmasked_get(PBVHNode *node) +bool BKE_pbvh_node_fully_unmasked_get(const PBVHNode *node) { return (node->flag & PBVH_Leaf) && (node->flag & PBVH_FullyUnmasked); } @@ -1929,7 +1929,7 @@ void BKE_pbvh_vert_tag_update_normal(PBVH *pbvh, PBVHVertRef vertex) pbvh->vert_bitmap[vertex.i] = true; } -void BKE_pbvh_node_get_loops(PBVHNode *node, const int **r_loop_indices) +void BKE_pbvh_node_get_loops(const PBVHNode *node, const int **r_loop_indices) { if (r_loop_indices) { *r_loop_indices = node->loop_indices.data(); @@ -2052,13 +2052,13 @@ Span BKE_pbvh_node_get_grid_indices(const PBVHNode &node) return node.prim_indices; } -void BKE_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3]) +void BKE_pbvh_node_get_BB(const PBVHNode *node, float bb_min[3], float bb_max[3]) { copy_v3_v3(bb_min, node->vb.bmin); copy_v3_v3(bb_max, node->vb.bmax); } -void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3]) +void BKE_pbvh_node_get_original_BB(const PBVHNode *node, float bb_min[3], float bb_max[3]) { copy_v3_v3(bb_min, node->orig_vb.bmin); copy_v3_v3(bb_max, node->orig_vb.bmax); @@ -2761,10 +2761,10 @@ enum PlaneAABBIsect { */ static PlaneAABBIsect test_frustum_aabb(const float bb_min[3], const float bb_max[3], - PBVHFrustumPlanes *frustum) + const PBVHFrustumPlanes *frustum) { PlaneAABBIsect ret = ISECT_INSIDE; - float(*planes)[4] = frustum->planes; + const float(*planes)[4] = frustum->planes; for (int i = 0; i < frustum->num_planes; i++) { float vmin[3], vmax[3]; @@ -2791,7 +2791,7 @@ static PlaneAABBIsect test_frustum_aabb(const float bb_min[3], return ret; } -bool BKE_pbvh_node_frustum_contain_AABB(PBVHNode *node, PBVHFrustumPlanes *data) +bool BKE_pbvh_node_frustum_contain_AABB(const PBVHNode *node, const PBVHFrustumPlanes *data) { const float *bb_min, *bb_max; /* BKE_pbvh_node_get_BB */ @@ -2801,7 +2801,7 @@ bool BKE_pbvh_node_frustum_contain_AABB(PBVHNode *node, PBVHFrustumPlanes *data) return test_frustum_aabb(bb_min, bb_max, data) != ISECT_OUTSIDE; } -bool BKE_pbvh_node_frustum_exclude_AABB(PBVHNode *node, PBVHFrustumPlanes *data) +bool BKE_pbvh_node_frustum_exclude_AABB(const PBVHNode *node, const PBVHFrustumPlanes *data) { const float *bb_min, *bb_max; /* BKE_pbvh_node_get_BB */ @@ -2981,7 +2981,7 @@ void BKE_pbvh_vert_coords_apply(PBVH *pbvh, const Span vert_positions) } } -bool BKE_pbvh_is_deformed(PBVH *pbvh) +bool BKE_pbvh_is_deformed(const PBVH *pbvh) { return pbvh->deformed; }