diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-24 04:04:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-24 04:13:58 +0400 |
commit | 04a902965e5e226e69c5c6e912dd2f513448d2ac (patch) | |
tree | c65a2c9613f5a336f6c2739b5dabc5fbad348230 /source/blender/bmesh/intern/bmesh_polygon.c | |
parent | d94db03ac8ef9f6a10e42f01d622421fe3f216bb (diff) |
BMesh optimize face splitting by taking loops rather then verts
- add BM_vert_pair_share_face
- add BM_loop_is_adjacent
- remove BM_verts_connect
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_polygon.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 7a625840891..a3aaea9e257 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -800,67 +800,67 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, BLI_assert((r_faces_new == NULL) == (r_faces_new_tot == NULL)); if (f->len == 4) { - BMVert *v1, *v2; + BMLoop *l_v1, *l_v2; l_first = BM_FACE_FIRST_LOOP(f); switch (quad_method) { case MOD_TRIANGULATE_QUAD_FIXED: { - v1 = l_first->v; - v2 = l_first->next->next->v; + l_v1 = l_first; + l_v2 = l_first->next->next; break; } case MOD_TRIANGULATE_QUAD_ALTERNATE: { - v1 = l_first->next->v; - v2 = l_first->prev->v; + l_v1 = l_first->next; + l_v2 = l_first->prev; break; } case MOD_TRIANGULATE_QUAD_SHORTEDGE: { - BMVert *v3, *v4; + BMLoop *l_v3, *l_v4; float d1, d2; - v1 = l_first->v; - v2 = l_first->next->next->v; - v3 = l_first->next->v; - v4 = l_first->prev->v; + l_v1 = l_first; + l_v2 = l_first->next->next; + l_v3 = l_first->next; + l_v4 = l_first->prev; - d1 = len_squared_v3v3(v1->co, v2->co); - d2 = len_squared_v3v3(v3->co, v4->co); + d1 = len_squared_v3v3(l_v1->v->co, l_v2->v->co); + d2 = len_squared_v3v3(l_v3->v->co, l_v4->v->co); if (d2 < d1) { - v1 = v3; - v2 = v4; + l_v1 = l_v3; + l_v2 = l_v4; } break; } case MOD_TRIANGULATE_QUAD_BEAUTY: default: { - BMVert *v3, *v4; + BMLoop *l_v3, *l_v4; float cost; - v1 = l_first->next->v; - v2 = l_first->next->next->v; - v3 = l_first->prev->v; - v4 = l_first->v; + l_v1 = l_first->next; + l_v2 = l_first->next->next; + l_v3 = l_first->prev; + l_v4 = l_first; - cost = BM_verts_calc_rotate_beauty(v1, v2, v3, v4, 0, 0); + cost = BM_verts_calc_rotate_beauty(l_v1->v, l_v2->v, l_v3->v, l_v4->v, 0, 0); if (cost < 0.0f) { - v1 = v4; - //v2 = v2; + l_v1 = l_v4; + //l_v2 = l_v2; } else { - //v1 = v1; - v2 = v3; + //l_v1 = l_v1; + l_v2 = l_v3; } break; } } - f_new = BM_face_split(bm, f, v1, v2, &l_new, NULL, false); + f_new = BM_face_split(bm, f, l_v1, l_v2, &l_new, NULL, false); copy_v3_v3(f_new->no, f->no); if (use_tag) { |