From 8e9aa452bb7b295fba170001be900feff29858be Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 8 Oct 2013 19:28:11 +0000 Subject: Triangulate Modifier changes - using scanfill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- source/blender/bmesh/tools/bmesh_triangulate.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source/blender/bmesh/tools') 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); } -- cgit v1.2.3