|
Blender V5.0
|
#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 33 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 267 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 236 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(), bmesh_calc_tessellation_for_face_with_normals_fn(), TaskParallelSettings::func_free, 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 162 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(), i, BMFace::len, BMFace::no, and poly_to_tri_count().
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 535 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(), i, BMFace::len, and poly_to_tri_count().
Referenced by 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 255 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(), and params.
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 406 of file bmesh_mesh_tessellate.cc.
References bm, and BM_mesh_calc_tessellation_with_partial_ex().
|
static |
Definition at line 324 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(), data, Vector< T, InlineBufferCapacity, Allocator >::data(), BMPartialUpdate::faces, faces, TaskParallelSettings::func_free, params, Vector< T, InlineBufferCapacity, Allocator >::size(), TaskParallelSettings::use_threading, TaskParallelSettings::userdata_chunk, and TaskParallelSettings::userdata_chunk_size.
Referenced by BM_mesh_calc_tessellation_with_partial_ex().
|
static |
Definition at line 353 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(), Vector< T, InlineBufferCapacity, Allocator >::data(), BMPartialUpdate::faces, faces, l, params, and Vector< T, InlineBufferCapacity, Allocator >::size().
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 385 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, Vector< T, InlineBufferCapacity, Allocator >::is_empty(), BMPartialUpdate::params, params, Vector< T, InlineBufferCapacity, Allocator >::size(), and UNLIKELY.
Referenced by BKE_editmesh_looptris_calc_with_partial_ex(), and BM_mesh_calc_tessellation_with_partial().
|
static |
Definition at line 142 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 421 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, i, 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 203 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 227 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 42 of file bmesh_mesh_tessellate.cc.
References axis_dominant_v3_to_m3_negate(), BLI_assert, BLI_INLINE, 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, i, 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 289 of file bmesh_mesh_tessellate.cc.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face(), data, l, and PartialTessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation_with_partial__multi_threaded().
|
static |
Definition at line 315 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 302 of file bmesh_mesh_tessellate.cc.
References BM_elem_index_get, BM_FACE_FIRST_LOOP, bmesh_calc_tessellation_for_face_with_normal(), data, l, and PartialTessellationUserTLS::pf_arena.
Referenced by bm_mesh_calc_tessellation_with_partial__multi_threaded().
|
static |
Definition at line 149 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 215 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().