32 #define MESH_FACE_TESSELLATE_THREADED_LIMIT 4096
49 const bool face_normal,
50 const float normal_precalc[3])
52 const uint mp_loopstart = (
uint)mpoly[poly_index].loopstart;
53 const uint mp_totloop = (
uint)mpoly[poly_index].totloop;
55 #define ML_TO_MLT(i1, i2, i3) \
57 ARRAY_SET_ITEMS(mlt->tri, mp_loopstart + i1, mp_loopstart + i2, mp_loopstart + i3); \
58 mlt->poly = poly_index; \
75 mvert[mloop[mlt_a->
tri[0]].
v].
co,
76 mvert[mloop[mlt_a->
tri[1]].v].
co,
77 mvert[mloop[mlt_a->
tri[2]].v].
co,
78 mvert[mloop[mlt_b->
tri[2]].v].
co,
82 mvert[mloop[mlt_a->
tri[0]].v].
co,
83 mvert[mloop[mlt_a->
tri[1]].v].
co,
84 mvert[mloop[mlt_a->
tri[2]].v].
co,
85 mvert[mloop[mlt_b->
tri[2]].v].
co))) {
87 mlt_a->
tri[2] = mlt_b->
tri[2];
88 mlt_b->
tri[0] = mlt_a->
tri[1];
97 if (face_normal ==
false) {
99 const float *co_curr, *co_prev;
104 ml = mloop + mp_loopstart;
105 co_prev = mvert[ml[mp_totloop - 1].
v].
co;
106 for (
uint j = 0; j < mp_totloop; j++, ml++) {
107 co_curr = mvert[ml->
v].
co;
120 const uint totfilltri = mp_totloop - 2;
123 if (
UNLIKELY(pf_arena ==
nullptr)) {
127 uint(*tris)[3] =
static_cast<uint(*)[3]
>(
129 float(*projverts)[2] =
static_cast<float(*)[2]
>(
132 ml = mloop + mp_loopstart;
133 for (
uint j = 0; j < mp_totloop; j++, ml++) {
140 for (
uint j = 0; j < totfilltri; j++, mlt++) {
141 const uint *tri = tris[j];
161 mloop, mpoly, mvert, poly_index, mlt, pf_arena_p,
false,
nullptr);
170 const float normal_precalc[3])
173 mloop, mpoly, mvert, poly_index, mlt, pf_arena_p,
true, normal_precalc);
182 const float (*poly_normals)[3])
185 const MPoly *mp = mpoly;
188 if (poly_normals !=
nullptr) {
189 for (
uint poly_index = 0; poly_index < (
uint)totpoly; poly_index++, mp++) {
194 &mlooptri[tri_index],
196 poly_normals[poly_index]);
201 for (
uint poly_index = 0; poly_index < (
uint)totpoly; poly_index++, mp++) {
203 mloop, mpoly, mvert, poly_index, &mlooptri[tri_index], &pf_arena);
243 &
data->mlooptri[tri_index],
260 &
data->mlooptri[tri_index],
263 data->poly_normals[index]);
267 void *__restrict tls_v)
281 const float (*poly_normals)[3])
290 data.mlooptri = mlooptri;
291 data.poly_normals = poly_normals;
330 const float (*poly_normals)[3])
335 mloop, mpoly, mvert, totloop, totpoly, mlooptri, poly_normals);
339 mloop, mpoly, mvert, totloop, totpoly, mlooptri, poly_normals);
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
bool is_quad_flip_v3_first_third_fast_with_normal(const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float normal[3])
bool is_quad_flip_v3_first_third_fast(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
void axis_dominant_v3_to_m3_negate(float r_mat[3][3], const float normal[3])
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
MINLINE float normalize_v3(float r[3])
MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3])
MINLINE void zero_v3(float r[3])
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
#define BLI_MEMARENA_STD_BUFSIZE
void * BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
void BLI_polyfill_calc_arena(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3], struct MemArena *arena)
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
#define UNUSED_VARS_NDEBUG(...)
Read Guarded memory(de)allocation.
IconTextureDrawCall normal
void BKE_mesh_recalc_looptri(const MLoop *mloop, const MPoly *mpoly, const MVert *mvert, int totloop, int totpoly, MLoopTri *mlooptri)
static void mesh_calc_tessellation_for_face_with_normal_fn(void *__restrict userdata, const int index, const TaskParallelTLS *__restrict tls)
static void mesh_recalc_looptri__multi_threaded(const MLoop *mloop, const MPoly *mpoly, const MVert *mvert, int UNUSED(totloop), int totpoly, MLoopTri *mlooptri, const float(*poly_normals)[3])
#define ML_TO_MLT(i1, i2, i3)
static void mesh_calc_tessellation_for_face_with_normal(const MLoop *mloop, const MPoly *mpoly, const MVert *mvert, uint poly_index, MLoopTri *mlt, MemArena **pf_arena_p, const float normal_precalc[3])
static void mesh_calc_tessellation_for_face_fn(void *__restrict userdata, const int index, const TaskParallelTLS *__restrict tls)
#define MESH_FACE_TESSELLATE_THREADED_LIMIT
static void mesh_calc_tessellation_for_face_free_fn(const void *__restrict UNUSED(userdata), void *__restrict tls_v)
BLI_INLINE void mesh_calc_tessellation_for_face_impl(const MLoop *mloop, const MPoly *mpoly, const MVert *mvert, uint poly_index, MLoopTri *mlt, MemArena **pf_arena_p, const bool face_normal, const float normal_precalc[3])
void BKE_mesh_recalc_looptri_with_normals(const MLoop *mloop, const MPoly *mpoly, const MVert *mvert, int totloop, int totpoly, MLoopTri *mlooptri, const float(*poly_normals)[3])
static void mesh_recalc_looptri__single_threaded(const MLoop *mloop, const MPoly *mpoly, const MVert *mvert, int totloop, int totpoly, MLoopTri *mlooptri, const float(*poly_normals)[3])
static void mesh_calc_tessellation_for_face(const MLoop *mloop, const MPoly *mpoly, const MVert *mvert, uint poly_index, MLoopTri *mlt, MemArena **pf_arena_p)
TaskParallelFreeFunc func_free
size_t userdata_chunk_size
const float(* poly_normals)[3]