diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/bmesh/tools/bmesh_triangulate.c | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_triangulate.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_triangulate.c | 224 |
1 files changed, 122 insertions, 102 deletions
diff --git a/source/blender/bmesh/tools/bmesh_triangulate.c b/source/blender/bmesh/tools/bmesh_triangulate.c index 3209732ba66..5c13292e556 100644 --- a/source/blender/bmesh/tools/bmesh_triangulate.c +++ b/source/blender/bmesh/tools/bmesh_triangulate.c @@ -20,7 +20,7 @@ * Triangulate. */ -#include "DNA_modifier_types.h" /* for MOD_TRIANGULATE_NGON_BEAUTY only */ +#include "DNA_modifier_types.h" /* for MOD_TRIANGULATE_NGON_BEAUTY only */ #include "MEM_guardedalloc.h" @@ -36,113 +36,133 @@ #include "bmesh.h" -#include "bmesh_triangulate.h" /* own include */ +#include "bmesh_triangulate.h" /* own include */ /** * a version of #BM_face_triangulate that maps to #BMOpSlot */ -static void bm_face_triangulate_mapping( - BMesh *bm, BMFace *face, - const int quad_method, const int ngon_method, - const bool use_tag, - BMOperator *op, BMOpSlot *slot_facemap_out, BMOpSlot *slot_facemap_double_out, - - MemArena *pf_arena, - /* use for MOD_TRIANGULATE_NGON_BEAUTY only! */ - struct Heap *pf_heap) +static void bm_face_triangulate_mapping(BMesh *bm, + BMFace *face, + const int quad_method, + const int ngon_method, + const bool use_tag, + BMOperator *op, + BMOpSlot *slot_facemap_out, + BMOpSlot *slot_facemap_double_out, + + MemArena *pf_arena, + /* use for MOD_TRIANGULATE_NGON_BEAUTY only! */ + struct Heap *pf_heap) { - int faces_array_tot = face->len - 3; - BMFace **faces_array = BLI_array_alloca(faces_array, faces_array_tot); - LinkNode *faces_double = NULL; - BLI_assert(face->len > 3); - - BM_face_triangulate( - bm, face, - faces_array, &faces_array_tot, - NULL, NULL, - &faces_double, - quad_method, ngon_method, use_tag, - pf_arena, - pf_heap); - - if (faces_array_tot) { - int i; - BMO_slot_map_elem_insert(op, slot_facemap_out, face, face); - for (i = 0; i < faces_array_tot; i++) { - BMO_slot_map_elem_insert(op, slot_facemap_out, faces_array[i], face); - } - - while (faces_double) { - LinkNode *next = faces_double->next; - BMO_slot_map_elem_insert(op, slot_facemap_double_out, faces_double->link, face); - MEM_freeN(faces_double); - faces_double = next; - } - } + int faces_array_tot = face->len - 3; + BMFace **faces_array = BLI_array_alloca(faces_array, faces_array_tot); + LinkNode *faces_double = NULL; + BLI_assert(face->len > 3); + + BM_face_triangulate(bm, + face, + faces_array, + &faces_array_tot, + NULL, + NULL, + &faces_double, + quad_method, + ngon_method, + use_tag, + pf_arena, + pf_heap); + + if (faces_array_tot) { + int i; + BMO_slot_map_elem_insert(op, slot_facemap_out, face, face); + for (i = 0; i < faces_array_tot; i++) { + BMO_slot_map_elem_insert(op, slot_facemap_out, faces_array[i], face); + } + + while (faces_double) { + LinkNode *next = faces_double->next; + BMO_slot_map_elem_insert(op, slot_facemap_double_out, faces_double->link, face); + MEM_freeN(faces_double); + faces_double = next; + } + } } - -void BM_mesh_triangulate( - BMesh *bm, const int quad_method, const int ngon_method, const int min_vertices, - const bool tag_only, BMOperator *op, BMOpSlot *slot_facemap_out, - BMOpSlot *slot_facemap_double_out) +void BM_mesh_triangulate(BMesh *bm, + const int quad_method, + const int ngon_method, + const int min_vertices, + const bool tag_only, + BMOperator *op, + BMOpSlot *slot_facemap_out, + BMOpSlot *slot_facemap_double_out) { - BMIter iter; - BMFace *face; - MemArena *pf_arena; - Heap *pf_heap; - - pf_arena = BLI_memarena_new(BLI_POLYFILL_ARENA_SIZE, __func__); - - if (ngon_method == MOD_TRIANGULATE_NGON_BEAUTY) { - pf_heap = BLI_heap_new_ex(BLI_POLYFILL_ALLOC_NGON_RESERVE); - } - else { - pf_heap = NULL; - } - - 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 >= min_vertices) { - if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) { - bm_face_triangulate_mapping( - bm, face, - quad_method, ngon_method, tag_only, - op, slot_facemap_out, slot_facemap_double_out, - pf_arena, pf_heap); - } - } - } - } - else { - LinkNode *faces_double = NULL; - - BM_ITER_MESH (face, &iter, bm, BM_FACES_OF_MESH) { - if (face->len >= min_vertices) { - if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) { - BM_face_triangulate( - bm, face, - NULL, NULL, - NULL, NULL, - &faces_double, - quad_method, ngon_method, tag_only, - pf_arena, pf_heap); - } - } - } - - while (faces_double) { - LinkNode *next = faces_double->next; - BM_face_kill(bm, faces_double->link); - MEM_freeN(faces_double); - faces_double = next; - } - } - - BLI_memarena_free(pf_arena); - - if (ngon_method == MOD_TRIANGULATE_NGON_BEAUTY) { - BLI_heap_free(pf_heap, NULL); - } + BMIter iter; + BMFace *face; + MemArena *pf_arena; + Heap *pf_heap; + + pf_arena = BLI_memarena_new(BLI_POLYFILL_ARENA_SIZE, __func__); + + if (ngon_method == MOD_TRIANGULATE_NGON_BEAUTY) { + pf_heap = BLI_heap_new_ex(BLI_POLYFILL_ALLOC_NGON_RESERVE); + } + else { + pf_heap = NULL; + } + + 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 >= min_vertices) { + if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) { + bm_face_triangulate_mapping(bm, + face, + quad_method, + ngon_method, + tag_only, + op, + slot_facemap_out, + slot_facemap_double_out, + pf_arena, + pf_heap); + } + } + } + } + else { + LinkNode *faces_double = NULL; + + BM_ITER_MESH (face, &iter, bm, BM_FACES_OF_MESH) { + if (face->len >= min_vertices) { + if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) { + BM_face_triangulate(bm, + face, + NULL, + NULL, + NULL, + NULL, + &faces_double, + quad_method, + ngon_method, + tag_only, + pf_arena, + pf_heap); + } + } + } + + while (faces_double) { + LinkNode *next = faces_double->next; + BM_face_kill(bm, faces_double->link); + MEM_freeN(faces_double); + faces_double = next; + } + } + + BLI_memarena_free(pf_arena); + + if (ngon_method == MOD_TRIANGULATE_NGON_BEAUTY) { + BLI_heap_free(pf_heap, NULL); + } } |