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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-01-29 14:31:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-29 14:31:05 +0400
commit37489d71c7f0007ffc3aa252a4cc63d1aa903399 (patch)
tree8d535c6ff229d8a30855a88a8cb3e2051e0485e8 /source/blender/bmesh/operators/bmo_triangulate.c
parent97a5cd92bc807a03c4983ec70b1b961491062b13 (diff)
Triangulate modifier no longer uses bmesh operator api call, instead add a BM_mesh_triangulate() function. Gives ~2x speedup in my tests on an optimized build.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_triangulate.c')
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 744f706681d..c4d15034c0f 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -37,45 +37,21 @@
#include "intern/bmesh_operators_private.h" /* own include */
-#define EDGE_NEW 1
-#define FACE_NEW 1
-
#define ELE_NEW 1
#define FACE_MARK 2
#define EDGE_MARK 4
void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
{
- BMOIter siter;
- BMFace *face, **newfaces = NULL;
- BLI_array_declare(newfaces);
- float (*projectverts)[3] = NULL;
- BLI_array_declare(projectverts);
- int i;
const bool use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
- BMOpSlot *slot_facemap_out = BMO_slot_get(op->slots_out, "face_map.out");
-
- for (face = BMO_iter_new(&siter, op->slots_in, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
-
- BLI_array_empty(projectverts);
- BLI_array_empty(newfaces);
- BLI_array_grow_items(projectverts, face->len * 3);
- BLI_array_grow_items(newfaces, face->len);
+ BM_mesh_elem_hflag_disable_all(bm, BM_FACE | BM_EDGE, BM_ELEM_TAG, false);
+ BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false);
- BM_face_triangulate(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces, use_beauty);
+ BM_mesh_triangulate(bm, use_beauty, true);
- BMO_slot_map_elem_insert(op, slot_facemap_out, face, face);
- for (i = 0; newfaces[i]; i++) {
- BMO_slot_map_elem_insert(op, slot_facemap_out, newfaces[i], face);
- }
- }
-
- BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_NEW);
- BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_NEW);
-
- BLI_array_free(projectverts);
- BLI_array_free(newfaces);
+ BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_TAG);
+ BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
}
void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)