|
Blender V4.3
|
#include "MEM_guardedalloc.h"#include "BLI_heap.h"#include "BLI_math_geom.h"#include "BLI_math_matrix.h"#include "BLI_memarena.h"#include "BLI_polyfill_2d.h"#include "BLI_polyfill_2d_beautify.h"#include "BLI_task.h"#include "bmesh.hh"Go to the source code of this file.
Classes | |
| struct | TessellationUserTLS |
| struct | PartialTessellationUserData |
| struct | PartialTessellationUserTLS |
Macros | |
| #define | BM_FACE_TESSELLATE_THREADED_LIMIT 1024 |
Functions | |
Default Mesh Tessellation | |
| BLI_INLINE void | bmesh_calc_tessellation_for_face_impl (std::array< BMLoop *, 3 > *looptris, BMFace *efa, MemArena **pf_arena_p, const bool face_normal) |
| static void | bmesh_calc_tessellation_for_face (std::array< BMLoop *, 3 > *looptris, BMFace *efa, MemArena **pf_arena_p) |
| static void | bmesh_calc_tessellation_for_face_with_normal (std::array< BMLoop *, 3 > *looptris, BMFace *efa, MemArena **pf_arena_p) |
| static void | bm_mesh_calc_tessellation__single_threaded (BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris, const char face_normals) |
| BM_mesh_calc_tessellation get the looptris and its number from a certain bmesh. | |
| static void | bmesh_calc_tessellation_for_face_fn (void *__restrict userdata, MempoolIterData *mp_f, const TaskParallelTLS *__restrict tls) |
| static void | bmesh_calc_tessellation_for_face_with_normals_fn (void *__restrict userdata, MempoolIterData *mp_f, const TaskParallelTLS *__restrict tls) |
| static void | bmesh_calc_tessellation_for_face_free_fn (const void *__restrict, void *__restrict tls_v) |
| static void | bm_mesh_calc_tessellation__multi_threaded (BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris, const char face_normals) |
| void | BM_mesh_calc_tessellation_ex (BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris, const BMeshCalcTessellation_Params *params) |
| void | BM_mesh_calc_tessellation (BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris) |
Default Tessellation (Partial Updates) | |
| static void | bmesh_calc_tessellation_for_face_partial_fn (void *__restrict userdata, const int index, const TaskParallelTLS *__restrict tls) |
| static void | bmesh_calc_tessellation_for_face_partial_with_normals_fn (void *__restrict userdata, const int index, const TaskParallelTLS *__restrict tls) |
| static void | bmesh_calc_tessellation_for_face_partial_free_fn (const void *__restrict, void *__restrict tls_v) |
| static void | bm_mesh_calc_tessellation_with_partial__multi_threaded (MutableSpan< std::array< BMLoop *, 3 > > looptris, const BMPartialUpdate *bmpinfo, const BMeshCalcTessellation_Params *params) |
| static void | bm_mesh_calc_tessellation_with_partial__single_threaded (MutableSpan< std::array< BMLoop *, 3 > > looptris, const BMPartialUpdate *bmpinfo, const BMeshCalcTessellation_Params *params) |
| void | BM_mesh_calc_tessellation_with_partial_ex (BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris, const BMPartialUpdate *bmpinfo, const BMeshCalcTessellation_Params *params) |
| void | BM_mesh_calc_tessellation_with_partial (BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris, const BMPartialUpdate *bmpinfo) |
Beauty Mesh Tessellation | |
Avoid degenerate triangles. | |
| static int | bmesh_calc_tessellation_for_face_beauty (std::array< BMLoop *, 3 > *looptris, BMFace *efa, MemArena **pf_arena_p, Heap **pf_heap_p) |
| void | BM_mesh_calc_tessellation_beauty (BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris) |
This file contains code for polygon tessellation (creating triangles from polygons).
Definition in file bmesh_mesh_tessellate.cc.
| #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.cc.
Referenced by BM_mesh_calc_tessellation_ex(), and BM_mesh_calc_tessellation_with_partial_ex().
| void BM_mesh_calc_tessellation | ( | BMesh * | bm, |
| MutableSpan< std::array< BMLoop *, 3 > > | looptris ) |
Definition at line 269 of file bmesh_mesh_tessellate.cc.
References bm, BM_mesh_calc_tessellation_ex(), and params.
Referenced by bpy_bmesh_calc_loop_triangles(), and C_BVHTree_FromBMesh().
|
static |
Definition at line 238 of file bmesh_mesh_tessellate.cc.
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(), and bmesh_calc_tessellation_for_face_with_normals_fn().
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 164 of file bmesh_mesh_tessellate.cc.
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, poly_to_tri_count(), BMesh::totface, and BMesh::totloop.
Referenced by BM_mesh_calc_tessellation_ex().
| void BM_mesh_calc_tessellation_beauty | ( | BMesh * | bm, |
| blender::MutableSpan< std::array< BMLoop *, 3 > > | looptris ) |
A version of BM_mesh_calc_tessellation that avoids degenerate triangles.
Definition at line 537 of file bmesh_mesh_tessellate.cc.
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, poly_to_tri_count(), BMesh::totface, and BMesh::totloop.
Referenced by blender::ed::sculpt_paint::trim::apply_trim(), BMD_mesh_intersection(), and blender::geometry::boolean::mesh_bm_concat().
| void BM_mesh_calc_tessellation_ex | ( | BMesh * | bm, |
| MutableSpan< std::array< BMLoop *, 3 > > | looptris, | ||
| const BMeshCalcTessellation_Params * | params ) |
Definition at line 257 of file bmesh_mesh_tessellate.cc.
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 BKE_editmesh_looptris_calc_ex(), and BM_mesh_calc_tessellation().
| void BM_mesh_calc_tessellation_with_partial | ( | BMesh * | bm, |
| MutableSpan< std::array< BMLoop *, 3 > > | looptris, | ||
| const BMPartialUpdate * | bmpinfo ) |
Definition at line 408 of file bmesh_mesh_tessellate.cc.
References bm, and BM_mesh_calc_tessellation_with_partial_ex().
|
static |
Definition at line 326 of file bmesh_mesh_tessellate.cc.
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(), BMPartialUpdate::faces, faces, PartialTessellationUserData::faces, BMPartialUpdate::faces_len, and params.
Referenced by BM_mesh_calc_tessellation_with_partial_ex().
|
static |
Definition at line 355 of file bmesh_mesh_tessellate.cc.
References BLI_memarena_free(), BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face(), bmesh_calc_tessellation_for_face_with_normal(), BMPartialUpdate::faces, BMPartialUpdate::faces_len, l, and params.
Referenced by BM_mesh_calc_tessellation_with_partial_ex().
| void BM_mesh_calc_tessellation_with_partial_ex | ( | BMesh * | bm, |
| MutableSpan< std::array< BMLoop *, 3 > > | looptris, | ||
| const BMPartialUpdate * | bmpinfo, | ||
| const BMeshCalcTessellation_Params * | params ) |
Definition at line 387 of file bmesh_mesh_tessellate.cc.
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_looptris_calc_with_partial_ex(), and BM_mesh_calc_tessellation_with_partial().
|
static |
Definition at line 144 of file bmesh_mesh_tessellate.cc.
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 423 of file bmesh_mesh_tessellate.cc.
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, BMLoop::prev, UNLIKELY, and BMLoop::v.
Referenced by BM_mesh_calc_tessellation_beauty().
|
static |
Definition at line 205 of file bmesh_mesh_tessellate.cc.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face(), l, and TessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation__multi_threaded().
|
static |
Definition at line 229 of file bmesh_mesh_tessellate.cc.
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 | ( | std::array< BMLoop *, 3 > * | looptris, |
| 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.cc.
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(), l, BMFace::len, mul_v2_m3v3(), BMLoop::next, BMFace::no, normal_quad_v3(), normal_tri_v3(), UNLIKELY, BMLoop::v, and v.
Referenced by bmesh_calc_tessellation_for_face(), and bmesh_calc_tessellation_for_face_with_normal().
|
static |
Definition at line 291 of file bmesh_mesh_tessellate.cc.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face(), l, and PartialTessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation_with_partial__multi_threaded().
|
static |
Definition at line 317 of file bmesh_mesh_tessellate.cc.
References BLI_memarena_free(), and PartialTessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation_with_partial__multi_threaded().
|
static |
Definition at line 304 of file bmesh_mesh_tessellate.cc.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face_with_normal(), l, and PartialTessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation_with_partial__multi_threaded().
|
static |
Definition at line 151 of file bmesh_mesh_tessellate.cc.
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 217 of file bmesh_mesh_tessellate.cc.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face_with_normal(), l, and TessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation__multi_threaded().