Cleanup: Specialize vert_is_boundary

Pull Request: https://projects.blender.org/blender/blender/pulls/125118
This commit is contained in:
Sean Kim
2024-07-20 02:14:08 +02:00
committed by Sean Kim
parent 9e1364fc04
commit 9c79acf9b8
2 changed files with 49 additions and 0 deletions

View File

@@ -915,6 +915,46 @@ bool vert_is_boundary(const SculptSession &ss, const PBVHVertRef vertex)
return false;
}
bool vert_is_boundary(const Span<bool> hide_poly,
const GroupedSpan<int> vert_to_face_map,
const BitSpan boundary,
const int vert)
{
if (!hide::vert_all_faces_visible_get(hide_poly, vert_to_face_map, vert)) {
return true;
}
return boundary[vert].test();
}
bool vert_is_boundary(const Span<bool> /*hide_poly*/,
const SubdivCCG &subdiv_ccg,
const Span<int> corner_verts,
const OffsetIndices<int> faces,
const BitSpan boundary,
const SubdivCCGCoord vert)
{
/* TODO: Unlike the base mesh implementation this method does NOT take into account face
* visibility. Either this should be noted as a intentional limitation or fixed.*/
int v1, v2;
const SubdivCCGAdjacencyType adjacency = BKE_subdiv_ccg_coarse_mesh_adjacency_info_get(
subdiv_ccg, vert, corner_verts, faces, v1, v2);
switch (adjacency) {
case SUBDIV_CCG_ADJACENT_VERTEX:
return boundary[v1].test();
case SUBDIV_CCG_ADJACENT_EDGE:
return boundary[v1].test() && boundary[v2].test();
case SUBDIV_CCG_ADJACENT_NONE:
return false;
}
}
bool vert_is_boundary(BMVert *vert)
{
/* TODO: Unlike the base mesh implementation this method does NOT take into account face
* visibility. Either this should be noted as a intentional limitation or fixed.*/
return BM_vert_is_boundary(vert);
}
} // namespace boundary
} // namespace blender::ed::sculpt_paint

View File

@@ -941,6 +941,15 @@ void ensure_boundary_info(Object &object);
* Requires #ensure_boundary_info to have been called.
*/
bool vert_is_boundary(const SculptSession &ss, PBVHVertRef vertex);
bool vert_is_boundary(Span<bool> hide_poly,
GroupedSpan<int> vert_to_face_map,
BitSpan boundary,
int vert);
bool vert_is_boundary(Span<bool> hide_poly,
const SubdivCCG &subdiv_ccg,
BitSpan boundary,
SubdivCCGCoord vert);
bool vert_is_boundary(BMVert *vert);
}