diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2013-10-08 23:28:11 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2013-10-08 23:28:11 +0400 |
commit | 8e9aa452bb7b295fba170001be900feff29858be (patch) | |
tree | 68bb5ff843f9162a4cc373012f66195c89291c93 /source/blender/bmesh/tools/bmesh_triangulate.c | |
parent | 0973270fbf43c8ab85423a0dd0dcab39d434e644 (diff) |
Triangulate Modifier changes - using scanfill
The ear loop method is potentially too slow (OˆN).
We are not using the 'beauty' option at the moment.
I'll incorporate that next.
(and later specific methods for quad splitting)
Patch done in collaboration (and reviewed by) with Campbell Barton.
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_triangulate.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_triangulate.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/bmesh/tools/bmesh_triangulate.c b/source/blender/bmesh/tools/bmesh_triangulate.c index 2eacf62d68a..34ff493a026 100644 --- a/source/blender/bmesh/tools/bmesh_triangulate.c +++ b/source/blender/bmesh/tools/bmesh_triangulate.c @@ -31,6 +31,9 @@ #include "BLI_utildefines.h" #include "BLI_alloca.h" +#include "BLI_memarena.h" +#include "BLI_listbase.h" +#include "BLI_scanfill.h" #include "bmesh.h" @@ -39,14 +42,14 @@ /** * a version of #BM_face_triangulate that maps to #BMOpSlot */ -static void bm_face_triangulate_mapping(BMesh *bm, BMFace *face, const bool use_beauty, const bool use_tag, +static void bm_face_triangulate_mapping(BMesh *bm, BMFace *face, MemArena *sf_arena, const bool use_beauty, const bool use_tag, BMOperator *op, BMOpSlot *slot_facemap_out) { const int faces_array_tot = face->len - 3; BMFace **faces_array = BLI_array_alloca(faces_array, faces_array_tot); BLI_assert(face->len > 3); - BM_face_triangulate(bm, face, faces_array, use_beauty, use_tag); + BM_face_triangulate(bm, face, faces_array, sf_arena, use_beauty, use_tag); if (faces_array) { int i; @@ -63,13 +66,16 @@ void BM_mesh_triangulate(BMesh *bm, const bool use_beauty, const bool tag_only, { BMIter iter; BMFace *face; + MemArena *sf_arena; + + sf_arena = BLI_memarena_new(BLI_SCANFILL_ARENA_SIZE, __func__); if (slot_facemap_out) { /* same as below but call: bm_face_triangulate_mapping() */ BM_ITER_MESH (face, &iter, bm, BM_FACES_OF_MESH) { if (face->len > 3) { if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) { - bm_face_triangulate_mapping(bm, face, use_beauty, tag_only, + bm_face_triangulate_mapping(bm, face, sf_arena, use_beauty, tag_only, op, slot_facemap_out); } } @@ -79,9 +85,11 @@ void BM_mesh_triangulate(BMesh *bm, const bool use_beauty, const bool tag_only, BM_ITER_MESH (face, &iter, bm, BM_FACES_OF_MESH) { if (face->len > 3) { if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) { - BM_face_triangulate(bm, face, NULL, use_beauty, tag_only); + BM_face_triangulate(bm, face, NULL, sf_arena, use_beauty, tag_only); } } } } + + BLI_memarena_free(sf_arena); } |