Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-07-14 07:18:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-07-14 07:22:13 +0300
commit6644e96f01da353de1dba8c3e38c61de83a8d516 (patch)
tree14017f6f964e20560e1834b55d2aee50032e58ee /source
parentae379714e4f1eca74f5f77532a6e959f29445236 (diff)
Cleanup: use BMLoop.next/prev for BMesh auto-smooth logic
Use more direct access to next/previous vertices. - `BM_edge_other_vert(l_curr->e, l_curr->v)` -> `l_curr->next->v`. - `BM_edge_other_vert(l_curr->prev->e, l_curr->v)` -> `l_curr->prev->v`. Add asserts to keep the intention clear.
Diffstat (limited to 'source')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_normals.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.c b/source/blender/bmesh/intern/bmesh_mesh_normals.c
index f13b9a19533..dea6561fe9a 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_normals.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_normals.c
@@ -631,11 +631,14 @@ static void bm_mesh_loops_calc_normals(BMesh *bm,
{
const BMVert *v_pivot = l_curr->v;
const float *co_pivot = vcos ? vcos[BM_elem_index_get(v_pivot)] : v_pivot->co;
- const BMVert *v_1 = BM_edge_other_vert(l_curr->e, v_pivot);
+ const BMVert *v_1 = l_curr->next->v;
const float *co_1 = vcos ? vcos[BM_elem_index_get(v_1)] : v_1->co;
- const BMVert *v_2 = BM_edge_other_vert(l_curr->prev->e, v_pivot);
+ const BMVert *v_2 = l_curr->prev->v;
const float *co_2 = vcos ? vcos[BM_elem_index_get(v_2)] : v_2->co;
+ BLI_assert(v_1 == BM_edge_other_vert(l_curr->e, v_pivot));
+ BLI_assert(v_2 == BM_edge_other_vert(l_curr->prev->e, v_pivot));
+
sub_v3_v3v3(vec_curr, co_1, co_pivot);
normalize_v3(vec_curr);
sub_v3_v3v3(vec_prev, co_2, co_pivot);
@@ -701,9 +704,11 @@ static void bm_mesh_loops_calc_normals(BMesh *bm,
/* Only need to compute previous edge's vector once,
* then we can just reuse old current one! */
{
- const BMVert *v_2 = BM_edge_other_vert(e_next, v_pivot);
+ const BMVert *v_2 = lfan_pivot->next->v;
const float *co_2 = vcos ? vcos[BM_elem_index_get(v_2)] : v_2->co;
+ BLI_assert(v_2 == BM_edge_other_vert(e_next, v_pivot));
+
sub_v3_v3v3(vec_org, co_2, co_pivot);
normalize_v3(vec_org);
copy_v3_v3(vec_curr, vec_org);