diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-10-22 17:15:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-10-22 17:40:03 +0300 |
commit | 6dfe4cbc6b8717223c631e80af6c7552576966e1 (patch) | |
tree | 5fb0e2103cc6e8926370a5b1cee9a95fff4726a0 /source/blender/bmesh/tools/bmesh_decimate_collapse.c | |
parent | 57a0cb797d60024357a3e3a64c1873844b0178bd (diff) |
Polyfill Beautify: half-edge optimization
Was using an edge hash for triangle -> edge lookups,
updating triangle indices for each edge-rotation.
Replace this with half-edge which can rotate edges much more simply,
writing triangles back once the solution has been calculated.
Gives ~33% speedup in own tests.
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_decimate_collapse.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_collapse.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index 36ae7231f94..d734d9b6ae1 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -497,7 +497,7 @@ static bool bm_face_triangulate( MemArena *pf_arena, /* use for MOD_TRIANGULATE_NGON_BEAUTY only! */ - struct Heap *pf_heap, struct EdgeHash *pf_ehash) + struct Heap *pf_heap) { const int f_base_len = f_base->len; int faces_array_tot = f_base_len - 3; @@ -516,8 +516,7 @@ static bool bm_face_triangulate( edges_array, &edges_array_tot, r_faces_double, quad_method, ngon_method, false, - pf_arena, - pf_heap, pf_ehash); + pf_arena, pf_heap); for (int i = 0; i < edges_array_tot; i++) { BMLoop *l_iter, *l_first; @@ -567,19 +566,16 @@ static bool bm_decim_triangulate_begin(BMesh *bm, int *r_edges_tri_tot) { MemArena *pf_arena; Heap *pf_heap; - EdgeHash *pf_ehash; LinkNode *faces_double = NULL; if (has_ngon) { pf_arena = BLI_memarena_new(BLI_POLYFILL_ARENA_SIZE, __func__); pf_heap = BLI_heap_new_ex(BLI_POLYFILL_ALLOC_NGON_RESERVE); - pf_ehash = BLI_edgehash_new_ex(__func__, BLI_POLYFILL_ALLOC_NGON_RESERVE); } else { pf_arena = NULL; pf_heap = NULL; - pf_ehash = NULL; } /* adding new faces as we loop over faces @@ -591,8 +587,7 @@ static bool bm_decim_triangulate_begin(BMesh *bm, int *r_edges_tri_tot) bm, f, &faces_double, r_edges_tri_tot, - pf_arena, - pf_heap, pf_ehash); + pf_arena, pf_heap); } } @@ -606,7 +601,6 @@ static bool bm_decim_triangulate_begin(BMesh *bm, int *r_edges_tri_tot) if (has_ngon) { BLI_memarena_free(pf_arena); BLI_heap_free(pf_heap, NULL); - BLI_edgehash_free(pf_ehash, NULL); } BLI_assert((bm->elem_index_dirty & BM_VERT) == 0); |