Blender
V3.3
|
#include "DNA_meshdata_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_heap.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_polyfill_2d.h"
#include "BLI_polyfill_2d_beautify.h"
#include "BLI_task.h"
#include "bmesh.h"
#include "bmesh_tools.h"
Go to the source code of this file.
Classes | |
struct | TessellationUserTLS |
struct | PartialTessellationUserData |
struct | PartialTessellationUserTLS |
Macros | |
#define | BM_FACE_TESSELLATE_THREADED_LIMIT 1024 |
This file contains code for polygon tessellation (creating triangles from polygons).
Definition in file bmesh_mesh_tessellate.c.
#define BM_FACE_TESSELLATE_THREADED_LIMIT 1024 |
On systems with 32+ cores, only a very small number of faces has any advantage single threading (in the 100's). Note that between 500-2000 quads, the difference isn't so much (tessellation isn't a bottleneck in this case anyway). Avoid the slight overhead of using threads in this case.
Definition at line 35 of file bmesh_mesh_tessellate.c.
Definition at line 272 of file bmesh_mesh_tessellate.c.
References bm, and BM_mesh_calc_tessellation_ex().
Referenced by bpy_bmesh_calc_loop_triangles(), and C_BVHTree_FromBMesh().
|
static |
Definition at line 240 of file bmesh_mesh_tessellate.c.
References BLI_parallel_mempool_settings_defaults(), bm, BM_FACE, BM_FACES_OF_MESH, BM_LOOP, BM_mesh_elem_index_ensure(), bmesh_calc_tessellation_for_face_fn(), bmesh_calc_tessellation_for_face_free_fn(), bmesh_calc_tessellation_for_face_with_normals_fn(), TaskParallelSettings::func_free, NULL, TaskParallelSettings::userdata_chunk, and TaskParallelSettings::userdata_chunk_size.
Referenced by BM_mesh_calc_tessellation_ex().
|
static |
BM_mesh_calc_tessellation get the looptris and its number from a certain bmesh.
looptris |
Definition at line 165 of file bmesh_mesh_tessellate.c.
References BLI_assert, BLI_memarena_free(), bm, BM_face_calc_normal(), BM_FACES_OF_MESH, BM_ITER_MESH, bmesh_calc_tessellation_for_face(), bmesh_calc_tessellation_for_face_with_normal(), BMFace::len, BMFace::no, NULL, poly_to_tri_count(), BMesh::totface, and BMesh::totloop.
Referenced by BM_mesh_calc_tessellation_ex().
A version of BM_mesh_calc_tessellation that avoids degenerate triangles.
Definition at line 538 of file bmesh_mesh_tessellate.c.
References BLI_assert, BLI_heap_free(), BLI_memarena_free(), bm, BM_FACES_OF_MESH, BM_ITER_MESH, bmesh_calc_tessellation_for_face_beauty(), BMFace::len, NULL, PartialTessellationUserTLS::pf_arena, poly_to_tri_count(), BMesh::totface, and BMesh::totloop.
Referenced by BMD_mesh_intersection(), and sculpt_gesture_apply_trim().
void BM_mesh_calc_tessellation_ex | ( | BMesh * | bm, |
BMLoop *(*) | looptris[3], | ||
const struct BMeshCalcTessellation_Params * | params | ||
) |
Definition at line 260 of file bmesh_mesh_tessellate.c.
References bm, BM_FACE_TESSELLATE_THREADED_LIMIT, bm_mesh_calc_tessellation__multi_threaded(), bm_mesh_calc_tessellation__single_threaded(), params, and BMesh::totface.
Referenced by BM_mesh_calc_tessellation(), and editmesh_tessface_calc_intern().
void BM_mesh_calc_tessellation_with_partial | ( | BMesh * | bm, |
BMLoop *(*) | looptris[3], | ||
const BMPartialUpdate * | bmpinfo | ||
) |
Definition at line 410 of file bmesh_mesh_tessellate.c.
References bm, and BM_mesh_calc_tessellation_with_partial_ex().
|
static |
Definition at line 328 of file bmesh_mesh_tessellate.c.
References BLI_parallel_range_settings_defaults(), BLI_task_parallel_range(), bmesh_calc_tessellation_for_face_partial_fn(), bmesh_calc_tessellation_for_face_partial_free_fn(), bmesh_calc_tessellation_for_face_partial_with_normals_fn(), data, faces, BMPartialUpdate::faces, BMPartialUpdate::faces_len, TaskParallelSettings::func_free, PartialTessellationUserData::looptris, NULL, params, TaskParallelSettings::use_threading, TaskParallelSettings::userdata_chunk, and TaskParallelSettings::userdata_chunk_size.
Referenced by BM_mesh_calc_tessellation_with_partial_ex().
|
static |
Definition at line 357 of file bmesh_mesh_tessellate.c.
References BLI_memarena_free(), BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face(), bmesh_calc_tessellation_for_face_with_normal(), faces, BMPartialUpdate::faces, BMPartialUpdate::faces_len, l, NULL, offset, params, and PartialTessellationUserTLS::pf_arena.
Referenced by BM_mesh_calc_tessellation_with_partial_ex().
void BM_mesh_calc_tessellation_with_partial_ex | ( | BMesh * | bm, |
BMLoop *(*) | looptris[3], | ||
const BMPartialUpdate * | bmpinfo, | ||
const struct BMeshCalcTessellation_Params * | params | ||
) |
Definition at line 389 of file bmesh_mesh_tessellate.c.
References BLI_assert, bm, BM_FACE, BM_FACE_TESSELLATE_THREADED_LIMIT, BM_LOOP, bm_mesh_calc_tessellation_with_partial__multi_threaded(), bm_mesh_calc_tessellation_with_partial__single_threaded(), BM_mesh_elem_index_ensure(), BMPartialUpdate_Params::do_tessellate, BMPartialUpdate::faces_len, BMPartialUpdate::params, params, and UNLIKELY.
Referenced by BKE_editmesh_looptri_calc_with_partial_ex(), and BM_mesh_calc_tessellation_with_partial().
|
static |
Definition at line 145 of file bmesh_mesh_tessellate.c.
References bmesh_calc_tessellation_for_face_impl().
Referenced by bm_mesh_calc_tessellation__single_threaded(), bm_mesh_calc_tessellation_with_partial__single_threaded(), bmesh_calc_tessellation_for_face_fn(), and bmesh_calc_tessellation_for_face_partial_fn().
|
static |
Definition at line 425 of file bmesh_mesh_tessellate.c.
References axis_dominant_v3_to_m3(), axis_dominant_v3_to_m3_negate(), BLI_heap_new_ex(), BLI_memarena_alloc(), BLI_memarena_clear(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, BLI_POLYFILL_ALLOC_NGON_RESERVE, BLI_polyfill_beautify(), BLI_polyfill_beautify_quad_rotate_calc, BLI_polyfill_calc_arena(), BM_FACE_FIRST_LOOP, BM_verts_calc_rotate_beauty(), BMVert::co, float(), l, BMFace::len, mul_v2_m3v3(), BMLoop::next, BMFace::no, NULL, PartialTessellationUserTLS::pf_arena, BMLoop::prev, UNLIKELY, and BMLoop::v.
Referenced by BM_mesh_calc_tessellation_beauty().
|
static |
Definition at line 207 of file bmesh_mesh_tessellate.c.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face(), l, offset, and TessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation__multi_threaded().
|
static |
Definition at line 231 of file bmesh_mesh_tessellate.c.
References BLI_memarena_free(), and TessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation__multi_threaded().
BLI_INLINE void bmesh_calc_tessellation_for_face_impl | ( | BMLoop *(*) | looptris[3], |
BMFace * | efa, | ||
MemArena ** | pf_arena_p, | ||
const bool | face_normal | ||
) |
face_normal | This will be optimized out as a constant. |
Definition at line 44 of file bmesh_mesh_tessellate.c.
References axis_dominant_v3_to_m3_negate(), BLI_assert, BLI_memarena_alloc(), BLI_memarena_clear(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, BLI_polyfill_calc_arena(), BM_face_calc_normal(), BM_FACE_FIRST_LOOP, BM_face_is_normal_valid(), BMVert::co, float(), is_quad_flip_v3_first_third_fast_with_normal(), l, BMFace::len, mul_v2_m3v3(), BMLoop::next, BMFace::no, normal_quad_v3(), normal_tri_v3(), NULL, UNLIKELY, BMLoop::v, and v.
Referenced by bmesh_calc_tessellation_for_face(), and bmesh_calc_tessellation_for_face_with_normal().
|
static |
Definition at line 296 of file bmesh_mesh_tessellate.c.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face(), data, l, offset, and PartialTessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation_with_partial__multi_threaded().
|
static |
Definition at line 319 of file bmesh_mesh_tessellate.c.
References BLI_memarena_free(), and PartialTessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation_with_partial__multi_threaded().
|
static |
Definition at line 308 of file bmesh_mesh_tessellate.c.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face_with_normal(), data, l, offset, and PartialTessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation_with_partial__multi_threaded().
|
static |
Definition at line 152 of file bmesh_mesh_tessellate.c.
References bmesh_calc_tessellation_for_face_impl().
Referenced by bm_mesh_calc_tessellation__single_threaded(), bm_mesh_calc_tessellation_with_partial__single_threaded(), bmesh_calc_tessellation_for_face_partial_with_normals_fn(), and bmesh_calc_tessellation_for_face_with_normals_fn().
|
static |
Definition at line 219 of file bmesh_mesh_tessellate.c.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face_with_normal(), l, offset, and TessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation__multi_threaded().