UV: cleanup

Cleanup ahead of D16992

Changes in `seam_connected_recursive`:

- Remove redundant `anchor` parameter.
- Improve const correctness

No functional changes.
This commit is contained in:
Chris Blackbourn 2023-01-14 11:21:31 +13:00
parent e35053d369
commit 326e1eeb56
1 changed files with 10 additions and 11 deletions

View File

@ -899,18 +899,17 @@ static bool loop_uv_match(BMLoop *loop,
compare_v2v2(luv_b, luv_d, STD_UV_CONNECT_LIMIT);
}
/* Given `anchor` and `edge`, return true if there are edges that fan between them that are
/* Given `luv_anchor` and `needle`, return true if there are edges that fan between them that are
* seam-free. */
static bool seam_connected_recursive(BMVert *anchor,
BMEdge *edge,
float luv_anchor[2],
float luv_fan[2],
static bool seam_connected_recursive(BMEdge *edge,
const float luv_anchor[2],
const float luv_fan[2],
BMLoop *needle,
GSet *visited,
int cd_loop_uv_offset)
{
BMVert *anchor = needle->v;
BLI_assert(edge->v1 == anchor || edge->v2 == anchor);
BLI_assert(needle->v == anchor || needle->next->v == anchor);
if (BM_elem_flag_test(edge, BM_ELEM_SEAM)) {
return false; /* Edge is a seam, don't traverse. */
@ -934,7 +933,7 @@ static bool seam_connected_recursive(BMVert *anchor,
float *luv_far = BM_ELEM_CD_GET_FLOAT_P(loop->prev, cd_loop_uv_offset);
if (seam_connected_recursive(
anchor, loop->prev->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) {
loop->prev->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) {
return true;
}
}
@ -950,7 +949,7 @@ static bool seam_connected_recursive(BMVert *anchor,
float *luv_far = BM_ELEM_CD_GET_FLOAT_P(loop->next->next, cd_loop_uv_offset);
if (seam_connected_recursive(
anchor, loop->next->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) {
loop->next->e, luv_anchor, luv_far, needle, visited, cd_loop_uv_offset)) {
return true;
}
}
@ -971,10 +970,10 @@ static bool seam_connected(BMLoop *loop_a, BMLoop *loop_b, GSet *visited, int cd
BLI_gset_clear(visited, NULL);
float *luv_anchor = BM_ELEM_CD_GET_FLOAT_P(loop_a, cd_loop_uv_offset);
float *luv_fan = BM_ELEM_CD_GET_FLOAT_P(loop_a->next, cd_loop_uv_offset);
const float *luv_anchor = BM_ELEM_CD_GET_FLOAT_P(loop_a, cd_loop_uv_offset);
const float *luv_fan = BM_ELEM_CD_GET_FLOAT_P(loop_a->next, cd_loop_uv_offset);
const bool result = seam_connected_recursive(
loop_a->v, loop_a->e, luv_anchor, luv_fan, loop_b, visited, cd_loop_uv_offset);
loop_a->e, luv_anchor, luv_fan, loop_b, visited, cd_loop_uv_offset);
return result;
}