Blender  V3.3
Classes | Macros
bmesh_mesh_tessellate.c File Reference
#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
 

Functions

Default Mesh Tessellation
BLI_INLINE void bmesh_calc_tessellation_for_face_impl (BMLoop *(*looptris)[3], BMFace *efa, MemArena **pf_arena_p, const bool face_normal)
 
static void bmesh_calc_tessellation_for_face (BMLoop *(*looptris)[3], BMFace *efa, MemArena **pf_arena_p)
 
static void bmesh_calc_tessellation_for_face_with_normal (BMLoop *(*looptris)[3], BMFace *efa, MemArena **pf_arena_p)
 
static void bm_mesh_calc_tessellation__single_threaded (BMesh *bm, BMLoop *(*looptris)[3], const char face_normals)
 BM_mesh_calc_tessellation get the looptris and its number from a certain bmesh. More...
 
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 UNUSED(userdata), void *__restrict tls_v)
 
static void bm_mesh_calc_tessellation__multi_threaded (BMesh *bm, BMLoop *(*looptris)[3], const char face_normals)
 
void BM_mesh_calc_tessellation_ex (BMesh *bm, BMLoop *(*looptris)[3], const struct BMeshCalcTessellation_Params *params)
 
void BM_mesh_calc_tessellation (BMesh *bm, BMLoop *(*looptris)[3])
 
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 UNUSED(userdata), void *__restrict tls_v)
 
static void bm_mesh_calc_tessellation_with_partial__multi_threaded (BMLoop *(*looptris)[3], const BMPartialUpdate *bmpinfo, const struct BMeshCalcTessellation_Params *params)
 
static void bm_mesh_calc_tessellation_with_partial__single_threaded (BMLoop *(*looptris)[3], const BMPartialUpdate *bmpinfo, const struct BMeshCalcTessellation_Params *params)
 
void BM_mesh_calc_tessellation_with_partial_ex (BMesh *bm, BMLoop *(*looptris)[3], const BMPartialUpdate *bmpinfo, const struct BMeshCalcTessellation_Params *params)
 
void BM_mesh_calc_tessellation_with_partial (BMesh *bm, BMLoop *(*looptris)[3], const BMPartialUpdate *bmpinfo)
 
Beauty Mesh Tessellation

Avoid degenerate triangles.

static int bmesh_calc_tessellation_for_face_beauty (BMLoop *(*looptris)[3], BMFace *efa, MemArena **pf_arena_p, Heap **pf_heap_p)
 
void BM_mesh_calc_tessellation_beauty (BMesh *bm, BMLoop *(*looptris)[3])
 

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.c.

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.c.

Function Documentation

◆ BM_mesh_calc_tessellation()

void BM_mesh_calc_tessellation ( BMesh bm,
BMLoop *(*)  looptris[3] 
)

◆ bm_mesh_calc_tessellation__multi_threaded()

static void bm_mesh_calc_tessellation__multi_threaded ( BMesh bm,
BMLoop *(*)  looptris[3],
const char  face_normals 
)
static

◆ bm_mesh_calc_tessellation__single_threaded()

static void bm_mesh_calc_tessellation__single_threaded ( BMesh bm,
BMLoop *(*)  looptris[3],
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 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().

◆ BM_mesh_calc_tessellation_beauty()

void BM_mesh_calc_tessellation_beauty ( BMesh bm,
BMLoop *(*)  looptris[3] 
)

◆ BM_mesh_calc_tessellation_ex()

void BM_mesh_calc_tessellation_ex ( BMesh bm,
BMLoop *(*)  looptris[3],
const struct BMeshCalcTessellation_Params params 
)

◆ BM_mesh_calc_tessellation_with_partial()

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

◆ bm_mesh_calc_tessellation_with_partial__multi_threaded()

static void bm_mesh_calc_tessellation_with_partial__multi_threaded ( BMLoop *(*)  looptris[3],
const BMPartialUpdate bmpinfo,
const struct BMeshCalcTessellation_Params params 
)
static

◆ bm_mesh_calc_tessellation_with_partial__single_threaded()

static void bm_mesh_calc_tessellation_with_partial__single_threaded ( BMLoop *(*)  looptris[3],
const BMPartialUpdate bmpinfo,
const struct BMeshCalcTessellation_Params params 
)
static

◆ 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 
)

◆ bmesh_calc_tessellation_for_face()

static void bmesh_calc_tessellation_for_face ( BMLoop *(*)  looptris[3],
BMFace efa,
MemArena **  pf_arena_p 
)
static

◆ bmesh_calc_tessellation_for_face_beauty()

static int bmesh_calc_tessellation_for_face_beauty ( BMLoop *(*)  looptris[3],
BMFace efa,
MemArena **  pf_arena_p,
Heap **  pf_heap_p 
)
static

◆ 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   UNUSEDuserdata,
void *__restrict  tls_v 
)
static

◆ bmesh_calc_tessellation_for_face_impl()

BLI_INLINE void bmesh_calc_tessellation_for_face_impl ( BMLoop *(*)  looptris[3],
BMFace efa,
MemArena **  pf_arena_p,
const bool  face_normal 
)

◆ 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   UNUSEDuserdata,
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()

static void bmesh_calc_tessellation_for_face_with_normal ( BMLoop *(*)  looptris[3],
BMFace efa,
MemArena **  pf_arena_p 
)
static

◆ 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