Blender V4.3
bmesh_mesh_tessellate.cc File Reference
#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)
 

Detailed Description

This file contains code for polygon tessellation (creating triangles from polygons).

See also
mesh_tessellate.cc for the Mesh equivalent of this file.

Definition in file bmesh_mesh_tessellate.cc.

Macro Definition Documentation

◆ BM_FACE_TESSELLATE_THREADED_LIMIT

#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().

Function Documentation

◆ BM_mesh_calc_tessellation()

void BM_mesh_calc_tessellation ( BMesh * bm,
MutableSpan< std::array< BMLoop *, 3 > > looptris )

◆ bm_mesh_calc_tessellation__multi_threaded()

static void bm_mesh_calc_tessellation__multi_threaded ( BMesh * bm,
MutableSpan< std::array< BMLoop *, 3 > > looptris,
const char face_normals )
static

◆ bm_mesh_calc_tessellation__single_threaded()

static void bm_mesh_calc_tessellation__single_threaded ( BMesh * bm,
MutableSpan< std::array< BMLoop *, 3 > > looptris,
const char face_normals )
static

BM_mesh_calc_tessellation get the looptris and its number from a certain bmesh.

Parameters
looptris
Note
looptris Must be pre-allocated to at least the size of given by: poly_to_tri_count

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().

◆ BM_mesh_calc_tessellation_beauty()

◆ BM_mesh_calc_tessellation_ex()

◆ BM_mesh_calc_tessellation_with_partial()

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().

◆ bm_mesh_calc_tessellation_with_partial__multi_threaded()

◆ bm_mesh_calc_tessellation_with_partial__single_threaded()

static void bm_mesh_calc_tessellation_with_partial__single_threaded ( MutableSpan< std::array< BMLoop *, 3 > > looptris,
const BMPartialUpdate * bmpinfo,
const BMeshCalcTessellation_Params * params )
static

◆ BM_mesh_calc_tessellation_with_partial_ex()

◆ bmesh_calc_tessellation_for_face()

static void bmesh_calc_tessellation_for_face ( std::array< BMLoop *, 3 > * looptris,
BMFace * efa,
MemArena ** pf_arena_p )
static

◆ bmesh_calc_tessellation_for_face_beauty()

◆ bmesh_calc_tessellation_for_face_fn()

static void bmesh_calc_tessellation_for_face_fn ( void *__restrict userdata,
MempoolIterData * mp_f,
const TaskParallelTLS *__restrict tls )
static

◆ bmesh_calc_tessellation_for_face_free_fn()

static void bmesh_calc_tessellation_for_face_free_fn ( const void * __restrict,
void *__restrict tls_v )
static

◆ bmesh_calc_tessellation_for_face_impl()

◆ bmesh_calc_tessellation_for_face_partial_fn()

static void bmesh_calc_tessellation_for_face_partial_fn ( void *__restrict userdata,
const int index,
const TaskParallelTLS *__restrict tls )
static

◆ bmesh_calc_tessellation_for_face_partial_free_fn()

static void bmesh_calc_tessellation_for_face_partial_free_fn ( const void * __restrict,
void *__restrict tls_v )
static

◆ bmesh_calc_tessellation_for_face_partial_with_normals_fn()

static void bmesh_calc_tessellation_for_face_partial_with_normals_fn ( void *__restrict userdata,
const int index,
const TaskParallelTLS *__restrict tls )
static

◆ bmesh_calc_tessellation_for_face_with_normal()

◆ bmesh_calc_tessellation_for_face_with_normals_fn()

static void bmesh_calc_tessellation_for_face_with_normals_fn ( void *__restrict userdata,
MempoolIterData * mp_f,
const TaskParallelTLS *__restrict tls )
static