50 const bool use_toolflags,
56 size_t vert_size, edge_size, loop_size, face_size;
58 if (use_toolflags ==
true) {
61 loop_size =
sizeof(
BMLoop);
65 vert_size =
sizeof(
BMVert);
66 edge_size =
sizeof(
BMEdge);
67 loop_size =
sizeof(
BMLoop);
68 face_size =
sizeof(
BMFace);
93 #ifdef USE_BMESH_HOLES
210 if (is_ldata_free || is_pdata_free) {
262 #ifdef USE_BMESH_HOLES
327 #define BM_LNORSPACE_UPDATE _FLAG_MF
378 #define FLT_EQ_NONAN(_fa, _fb) (*((const uint32_t *)&_fa) == *((const uint32_t *)&_fb))
388 const float *e1diff, *e2diff;
401 if ((l_iter->
prev->
e->
v1 == l_iter->
prev->
v) ^ (l_iter->
e->
v1 == l_iter->
v)) {
420 float virtual_lock = v_no[0];
435 virtual_lock += f_no[0] * fac;
436 v_no[1] += f_no[1] * fac;
437 v_no[2] += f_no[2] * fac;
445 }
while ((l_iter = l_iter->
next) != l_first);
463 const float (*edgevec)[3],
464 const float (*fnos)[3],
465 const float (*vcos)[3],
539 const float (*fnos)[3],
540 const float (*vcos)[3],
559 const float (*vnos)[3],
560 const float (*fnos)[3],
562 const float split_angle,
563 const bool do_sharp_edges_tag)
569 const bool check_angle = (split_angle < (
float)
M_PI);
570 const float split_angle_cos = check_angle ?
cosf(split_angle) : -1.0f;
590 bool is_angle_smooth =
true;
594 is_angle_smooth = (
dot_v3v3(no_a, no_b) >= split_angle_cos);
606 if (is_angle_smooth) {
618 else if (do_sharp_edges_tag) {
638 BMLoop *lfan_pivot_next = l_curr;
654 if (lfan_pivot_next == l_curr) {
677 const float (*vcos)[3],
678 const float (*fnos)[3],
681 const short (*clnors_data)[2],
682 const int cd_loop_clnors_offset,
683 const bool do_rebuild)
687 const bool has_clnors = clnors_data || (cd_loop_clnors_offset != -1);
707 if (!r_lnors_spacearr && has_clnors) {
709 r_lnors_spacearr = &_lnors_spacearr;
711 if (r_lnors_spacearr) {
717 int index_face, index_loop = 0;
727 }
while ((l_curr = l_curr->
next) != l_first);
767 if (r_lnors_spacearr) {
768 float vec_curr[3], vec_prev[3];
772 const BMVert *v_pivot = l_curr->
v;
791 const short(*clnor)[2] = clnors_data ? &clnors_data[l_curr_index] :
793 l_curr, cd_loop_clnors_offset);
818 const BMEdge *e_org = l_curr->
e;
819 BMLoop *lfan_pivot, *lfan_pivot_next;
820 int lfan_pivot_index;
821 float lnor[3] = {0.0f, 0.0f, 0.0f};
822 float vec_curr[3], vec_next[3], vec_org[3];
825 int clnors_avg[2] = {0, 0};
826 const short(*clnor_ref)[2] =
NULL;
828 bool clnors_invalid =
false;
839 e_next = lfan_pivot->
e;
851 if (r_lnors_spacearr) {
859 if (lfan_pivot_next) {
864 e_next = (lfan_pivot->
e == e_next) ? lfan_pivot->
prev->
e : lfan_pivot->
e;
884 const BMFace *f = lfan_pivot->
f;
892 const short(*clnor)[2] = clnors_data ? &clnors_data[lfan_pivot_index] :
894 lfan_pivot, cd_loop_clnors_offset);
896 clnors_invalid |= ((*clnor_ref)[0] != (*clnor)[0] ||
897 (*clnor_ref)[1] != (*clnor)[1]);
902 clnors_avg[0] += (*clnor)[0];
903 clnors_avg[1] += (*clnor)[1];
913 if (r_lnors_spacearr) {
916 r_lnors_spacearr, lnor_space, lfan_pivot_index, lfan_pivot,
false);
917 if (e_next != e_org) {
931 lfan_pivot = lfan_pivot_next;
939 if (r_lnors_spacearr) {
949 if (clnors_invalid) {
952 clnors_avg[0] /= clnors_nbr;
953 clnors_avg[1] /= clnors_nbr;
961 clnor[0] = (short)clnors_avg[0];
962 clnor[1] = (short)clnors_avg[1];
977 if (
LIKELY(lnor_len != 0.0f)) {
995 if (r_lnors_spacearr) {
999 }
while ((l_curr = l_curr->
next) != l_first);
1002 if (r_lnors_spacearr) {
1004 if (r_lnors_spacearr == &_lnors_spacearr) {
1011 #define LNOR_SPACE_TRIGO_THRESHOLD (1.0f - 1e-4f)
1019 const float (*new_lnors)[3])
1022 bool changed =
false;
1034 printf(
"WARNING! Getting invalid NULL loop space for loop %d!\n", i);
1056 const float *org_nor =
NULL;
1061 const float *
nor = new_lnors[lidx];
1081 loops = loops->
next;
1090 if (loops && org_nor) {
1093 const float *
nor = new_lnors[lidx];
1115 short (*r_clnors_data)[2],
1116 const int cd_loop_clnors_offset,
1117 const float (*new_lnors)[3])
1129 printf(
"WARNING! Still getting invalid NULL loop space in second loop for loop %d!\n", i);
1147 const float *
nor = new_lnors[lidx];
1148 short *clnor = r_clnors_data ? &r_clnors_data[lidx] :
1157 short clnor_data_tmp[2], *clnor_data;
1164 const float *
nor = new_lnors[lidx];
1165 short *clnor = r_clnors_data ? &r_clnors_data[lidx] :
1172 loops = loops->
next;
1176 mul_v3_fl(avg_nor, 1.0f / (
float)nbr_nors);
1178 lnors_spacearr->
lspacearr[i], avg_nor, clnor_data_tmp);
1181 clnor_data[0] = clnor_data_tmp[0];
1182 clnor_data[1] = clnor_data_tmp[1];
1199 const float (*vcos)[3],
1200 const float (*vnos)[3],
1201 const float (*fnos)[3],
1203 short (*r_clnors_data)[2],
1204 const int cd_loop_clnors_offset,
1205 float (*new_lnors)[3],
1206 const int cd_new_lnors_offset,
1223 bm, vcos, fnos, cur_lnors, r_lnors_spacearr, r_clnors_data, cd_loop_clnors_offset,
false);
1226 float(*custom_lnors)[3] = new_lnors;
1228 if (new_lnors ==
NULL) {
1257 bm, vcos, fnos, cur_lnors, r_lnors_spacearr, r_clnors_data, cd_loop_clnors_offset,
false);
1263 bm, r_lnors_spacearr, r_clnors_data, cd_loop_clnors_offset, custom_lnors);
1267 if (custom_lnors != new_lnors) {
1273 const float (*vnos)[3],
1274 const float (*fnos)[3],
1292 BMLoop *l_curr, *l_first;
1301 }
while ((l_curr = l_curr->
next) != l_first);
1312 void BM_mesh_loop_normals_update(
BMesh *
bm,
1313 const bool use_split_normals,
1314 const float split_angle,
1317 const short (*clnors_data)[2],
1318 const int cd_loop_clnors_offset)
1320 const bool has_clnors = clnors_data || (cd_loop_clnors_offset != -1);
1322 if (use_split_normals) {
1330 bm,
NULL,
NULL, r_lnos, r_lnors_spacearr, clnors_data, cd_loop_clnors_offset);
1347 const float (*vcos)[3],
1348 const float (*vnos)[3],
1349 const float (*fnos)[3],
1350 const bool use_split_normals,
1351 const float split_angle,
1354 short (*clnors_data)[2],
1355 const int cd_loop_clnors_offset,
1356 const bool do_rebuild)
1358 const bool has_clnors = clnors_data || (cd_loop_clnors_offset != -1);
1360 if (use_split_normals) {
1368 bm, vcos, fnos, r_lnos, r_lnors_spacearr, clnors_data, cd_loop_clnors_offset, do_rebuild);
1384 if (split_angle >= (
float)
M_PI) {
1411 cd_loop_clnors_offset,
1416 #define CLEAR_SPACEARRAY_THRESHOLD(x) ((x) / 2)
1505 if (preserve_clnor) {
1534 cd_loop_clnors_offset,
1542 if (preserve_clnor) {
1587 BMLoop *l_curr, *l_first;
1605 int index_face, index_loop = 0;
1612 }
while ((l_curr = l_curr->
next) != l_first);
1636 bm,
NULL,
NULL,
NULL,
true,
M_PI, lnors, temp,
NULL, cd_loop_clnors_offset,
true);
1669 const bool do_all_loops_of_vert)
1679 if (do_all_loops_of_vert) {
1718 const bool use_sel_face_history = sel_faces && (sel_edges || sel_verts);
1725 if (use_sel_face_history) {
1735 for (ese_prev = ese->
prev; ese_prev; ese_prev = ese_prev->
prev) {
1742 do_all_loops_of_vert);
1750 do_all_loops_of_vert);
1756 do_all_loops_of_vert);
1833 float custom_normal[3];
1845 const bool do_all_loops_of_vert)
1873 sizeof(*lnor_ed) * totloopsel, __func__);
1884 lnors_ed_arr->
totloop = totloopsel;
1889 return lnors_ed_arr;
1960 cd_custom_normal_offset,
1982 #ifdef BMOP_UNTAN_MULTIRES_ENABLED
1986 bmesh_mdisps_space_set(
bm, MULTIRES_SPACE_TANGENT, MULTIRES_SPACE_ABSOLUTE);
1989 bmesh_rationalize_normals(
bm, 0);
2003 #ifdef BMOP_UNTAN_MULTIRES_ENABLED
2007 bmesh_rationalize_normals(
bm, 1);
2008 bmesh_mdisps_space_set(
bm, MULTIRES_SPACE_ABSOLUTE, MULTIRES_SPACE_TANGENT);
2010 else if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
2011 bmesh_rationalize_normals(
bm, 1);
2048 if (htype_needed == 0) {
2103 BMLoop *l_iter, *l_first;
2108 }
while ((l_iter = l_iter->
next) != l_first);
2170 BMesh *
bm,
const char *location,
const char *func,
const char *msg_a,
const char *msg_b)
2175 const char *type_names[3] = {
"vert",
"edge",
"face"};
2180 bool is_any_error = 0;
2182 for (i = 0; i < 3; i++) {
2185 bool is_error =
false;
2201 if ((is_error ==
true) && (is_dirty ==
false)) {
2202 is_any_error =
true;
2204 "Invalid Index: at %s, %s, %s[%d] invalid index %d, '%s', '%s'\n",
2213 else if ((is_error ==
false) && (is_dirty ==
true)) {
2219 "Invalid Dirty: at %s, %s (%s), dirty flag was set but all index values are "
2220 "correct, '%s', '%s'\n",
2232 if (is_any_error == 0) {
2233 fprintf(stderr,
"Valid Index Success: at %s, %s, '%s', '%s'\n", location, func, msg_a, msg_b);
2279 const char htype_needed =
2290 if (htype_needed == 0) {
2398 BMLoop *l_first, *l_iter;
2405 }
while ((l_iter = l_iter->
next) != l_first);
2420 return (index < bm->totvert) ?
bm->
vtable[index] :
NULL;
2428 return (index < bm->totedge) ?
bm->
etable[index] :
NULL;
2436 return (index < bm->totface) ?
bm->
ftable[index] :
NULL;
2486 if (!(vert_idx || edge_idx || face_idx)) {
2495 BMVert **verts_pool, *verts_copy, **vep;
2497 const uint *new_idx;
2508 void **pyptrs = (cd_vert_pyptr != -1) ?
MEM_mallocN(
sizeof(
void *) * totvert, __func__) :
NULL;
2509 for (i = totvert, ve = verts_copy + totvert - 1, vep = verts_pool + totvert - 1; i--;
2513 if (cd_vert_pyptr != -1) {
2520 new_idx = vert_idx + totvert - 1;
2521 ve = verts_copy + totvert - 1;
2522 vep = verts_pool + totvert - 1;
2523 for (i = totvert; i--; new_idx--, ve--, vep--) {
2524 BMVert *new_vep = verts_pool[*new_idx];
2528 "mapping vert from %d to %d (%p/%p to %p)\n", i, *new_idx, *vep, verts_pool[i], new_vep);
2531 if (cd_vert_pyptr != -1) {
2533 *pyptr = pyptrs[*new_idx];
2547 BMEdge **edges_pool, *edges_copy, **edp;
2549 const uint *new_idx;
2560 void **pyptrs = (cd_edge_pyptr != -1) ?
MEM_mallocN(
sizeof(
void *) * totedge, __func__) :
NULL;
2561 for (i = totedge, ed = edges_copy + totedge - 1, edp = edges_pool + totedge - 1; i--;
2564 if (cd_edge_pyptr != -1) {
2571 new_idx = edge_idx + totedge - 1;
2572 ed = edges_copy + totedge - 1;
2573 edp = edges_pool + totedge - 1;
2574 for (i = totedge; i--; new_idx--, ed--, edp--) {
2575 BMEdge *new_edp = edges_pool[*new_idx];
2580 "mapping edge from %d to %d (%p/%p to %p)\n", i, *new_idx, *edp, edges_pool[i], new_edp);
2582 if (cd_edge_pyptr != -1) {
2584 *pyptr = pyptrs[*new_idx];
2598 BMFace **faces_pool, *faces_copy, **fap;
2600 const uint *new_idx;
2611 void **pyptrs = (cd_poly_pyptr != -1) ?
MEM_mallocN(
sizeof(
void *) * totface, __func__) :
NULL;
2612 for (i = totface, fa = faces_copy + totface - 1, fap = faces_pool + totface - 1; i--;
2615 if (cd_poly_pyptr != -1) {
2622 new_idx = face_idx + totface - 1;
2623 fa = faces_copy + totface - 1;
2624 fap = faces_pool + totface - 1;
2625 for (i = totface; i--; new_idx--, fa--, fap--) {
2626 BMFace *new_fap = faces_pool[*new_idx];
2629 if (cd_poly_pyptr != -1) {
2631 *pyptr = pyptrs[*new_idx];
2659 if (vptr_map || eptr_map) {
2715 switch (ese->
htype) {
2769 const char remap = (vpool_dst ?
BM_VERT : 0) | (epool_dst ?
BM_EDGE : 0) |
2781 const bool use_toolflags =
params->use_toolflags;
2789 memcpy(v_dst, v_src,
sizeof(
BMVert));
2790 if (use_toolflags) {
2796 vtable_dst[index] = v_dst;
2807 memcpy(e_dst, e_src,
sizeof(
BMEdge));
2808 if (use_toolflags) {
2814 etable_dst[index] = e_dst;
2821 int index, index_loop = 0;
2827 memcpy(f_dst, f_src,
sizeof(
BMFace));
2828 if (use_toolflags) {
2834 ftable_dst[index] = f_dst;
2840 BMLoop *l_iter_src, *l_first_src;
2844 memcpy(l_dst, l_iter_src,
sizeof(
BMLoop));
2845 ltable_dst[index_loop] = l_dst;
2847 }
while ((l_iter_src = l_iter_src->
next) != l_first_src);
2852 #define MAP_VERT(ele) vtable_dst[BM_elem_index_get(ele)]
2853 #define MAP_EDGE(ele) etable_dst[BM_elem_index_get(ele)]
2854 #define MAP_LOOP(ele) ltable_dst[BM_elem_index_get(ele)]
2855 #define MAP_FACE(ele) ftable_dst[BM_elem_index_get(ele)]
2857 #define REMAP_VERT(ele) \
2859 if (remap & BM_VERT) { \
2860 ele = MAP_VERT(ele); \
2864 #define REMAP_EDGE(ele) \
2866 if (remap & BM_EDGE) { \
2867 ele = MAP_EDGE(ele); \
2871 #define REMAP_LOOP(ele) \
2873 if (remap & BM_LOOP) { \
2874 ele = MAP_LOOP(ele); \
2878 #define REMAP_FACE(ele) \
2880 if (remap & BM_FACE) { \
2881 ele = MAP_FACE(ele); \
2915 BMFace *f = ftable_dst[i];
2919 BMLoop *l_iter, *l_first;
2930 }
while ((l_iter = l_iter->
next) != l_first);
2936 switch (ese->htype) {
3030 if (use_toolflags ==
false) {
3042 .use_toolflags = use_toolflags,
3085 const float (*vert_coords)[3],
3086 const float mat[4][4])
typedef float(TangentPoint)[2]
void CustomData_free(struct CustomData *data, int totelem)
bool CustomData_has_layer(const struct CustomData *data, int type)
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
bool CustomData_bmesh_has_free(const struct CustomData *data)
int CustomData_get_offset(const struct CustomData *data, int type)
void CustomData_bmesh_free_block(struct CustomData *data, void **block)
void CustomData_reset(struct CustomData *data)
MLoopNorSpace * BKE_lnor_space_create(MLoopNorSpaceArray *lnors_spacearr)
@ MLNOR_SPACEARR_BMLOOP_PTR
void BKE_lnor_space_define(MLoopNorSpace *lnor_space, const float lnor[3], float vec_ref[3], float vec_other[3], struct BLI_Stack *edge_vectors)
void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr, const int numLoops, const char data_type)
void BKE_lnor_spacearr_clear(MLoopNorSpaceArray *lnors_spacearr)
void BKE_lnor_spacearr_free(MLoopNorSpaceArray *lnors_spacearr)
void BKE_lnor_space_custom_data_to_normal(MLoopNorSpace *lnor_space, const short clnor_data[2], float r_custom_lnor[3])
void BKE_lnor_space_add_loop(MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpace *lnor_space, const int ml_index, void *bm_loop, const bool is_single)
void BKE_lnor_space_custom_normal_to_data(MLoopNorSpace *lnor_space, const float custom_lnor[3], short r_clnor_data[2])
#define BLI_BITMAP_TEST(_bitmap, _index)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
#define BLI_BITMAP_NEW(_tot, _alloc_string)
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
GHash * BLI_ghash_ptr_new_ex(const char *info, const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
BLI_LINKSTACK_*** wrapper macros for using a LinkNode to store a stack of pointers,...
#define BLI_SMALLSTACK_DECLARE(var, type)
#define BLI_SMALLSTACK_POP(var)
#define BLI_SMALLSTACK_PUSH(var, data)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
MINLINE float saacos(float fac)
MINLINE int compare_ff(float a, float b, const float max_diff)
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE bool compare_v3v3(const float a[3], const float b[3], const float limit) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
void * BLI_mempool_calloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int totelem, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
void * BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL()
bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_stack_free(BLI_Stack *stack) ATTR_NONNULL()
#define BLI_stack_new(esize, descr)
struct MempoolIterData MempoolIterData
These structs are the foundation for all linked lists in the library system.
#define SCE_SELECT_VERTEX
Read Guarded memory(de)allocation.
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
ATOMIC_INLINE float atomic_cas_float(float *v, float old, float _new)
struct BMFace_OFlag BMFace_OFlag
struct BMVert_OFlag BMVert_OFlag
#define BM_FACE_FIRST_LOOP(p)
struct BMEdge_OFlag BMEdge_OFlag
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
void BMO_error_clear(BMesh *bm)
#define BM_ELEM_INDEX_VALIDATE(_bm, _msg_a, _msg_b)
#define BM_elem_index_get(ele)
#define BM_elem_flag_disable(ele, hflag)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_enable(ele, hflag)
void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len)
Iterator as Array.
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_select_mode_flush(BMesh *bm)
void BM_mesh_elem_toolflags_clear(BMesh *bm)
void BM_mesh_vert_coords_apply_with_mat4(BMesh *bm, const float(*vert_coords)[3], const float mat[4][4])
static void bm_mesh_loops_assign_normal_data(BMesh *bm, MLoopNorSpaceArray *lnors_spacearr, short(*r_clnors_data)[2], const int cd_loop_clnors_offset, const float(*new_lnors)[3])
const BMAllocTemplate bm_mesh_allocsize_default
static void mesh_verts_calc_normals_normalize_cb(void *userdata, MempoolIterData *mp_v)
void BM_lnorspacearr_store(BMesh *bm, float(*r_lnors)[3])
BMFace * BM_face_at_index_find(BMesh *bm, const int index)
void BM_mesh_toolflags_set(BMesh *bm, bool use_toolflags)
void BM_mesh_data_free(BMesh *bm)
BMesh Free Mesh Data.
struct BMVertsCalcNormalsData BMVertsCalcNormalsData
static void bm_mempool_init_ex(const BMAllocTemplate *allocsize, const bool use_toolflags, BLI_mempool **r_vpool, BLI_mempool **r_epool, BLI_mempool **r_lpool, BLI_mempool **r_fpool)
void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const uint *face_idx)
#define CLEAR_SPACEARRAY_THRESHOLD(x)
void BM_mesh_vert_coords_apply(BMesh *bm, const float(*vert_coords)[3])
void BM_mesh_clear(BMesh *bm)
BMesh Clear Mesh.
void BM_lnorspace_update(BMesh *bm)
static void bm_mesh_verts_calc_normals(BMesh *bm, const float(*edgevec)[3], const float(*fnos)[3], const float(*vcos)[3], float(*vnos)[3])
#define BM_LNORSPACE_UPDATE
const BMAllocTemplate bm_mesh_chunksize_default
static void bm_mesh_edges_sharp_tag(BMesh *bm, const float(*vnos)[3], const float(*fnos)[3], float(*r_lnos)[3], const float split_angle, const bool do_sharp_edges_tag)
void BM_lnorspace_invalidate(BMesh *bm, const bool do_invalidate_all)
void BM_normals_loops_edges_tag(BMesh *bm, const bool do_edges)
BMEdge * BM_edge_at_index_find_or_table(BMesh *bm, const int index)
static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize, const bool use_toolflags)
#define FLT_EQ_NONAN(_fa, _fb)
void BM_mesh_elem_toolflags_ensure(BMesh *bm)
void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor)
bool BM_custom_loop_normals_to_vector_layer(BMesh *bm)
static bool bm_mesh_loops_split_lnor_fans(BMesh *bm, MLoopNorSpaceArray *lnors_spacearr, const float(*new_lnors)[3])
BMEdge * BM_edge_at_index_find(BMesh *bm, const int index)
struct BMEdgesCalcVectorsData BMEdgesCalcVectorsData
static void bm_mesh_loops_custom_normals_set(BMesh *bm, const float(*vcos)[3], const float(*vnos)[3], const float(*fnos)[3], MLoopNorSpaceArray *r_lnors_spacearr, short(*r_clnors_data)[2], const int cd_loop_clnors_offset, float(*new_lnors)[3], const int cd_new_lnors_offset, bool do_split_fans)
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
void BM_mesh_rebuild(BMesh *bm, const struct BMeshCreateParams *params, BLI_mempool *vpool_dst, BLI_mempool *epool_dst, BLI_mempool *lpool_dst, BLI_mempool *fpool_dst)
BMFace * BM_face_at_index_find_or_table(BMesh *bm, const int index)
BMVert * BM_vert_at_index_find_or_table(BMesh *bm, const int index)
static void mesh_faces_calc_normals_cb(void *UNUSED(userdata), MempoolIterData *mp_f)
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const struct BMeshCreateParams *params)
BMesh Make Mesh.
void bmesh_edit_begin(BMesh *UNUSED(bm), BMOpTypeFlag UNUSED(type_flag))
BMesh Begin Edit.
void BM_loops_calc_normal_vcos(BMesh *bm, const float(*vcos)[3], const float(*vnos)[3], const float(*fnos)[3], const bool use_split_normals, const float split_angle, float(*r_lnos)[3], MLoopNorSpaceArray *r_lnors_spacearr, short(*clnors_data)[2], const int cd_loop_clnors_offset, const bool do_rebuild)
BMesh Compute Loop Normals from/to external data.
static void bm_loop_normal_mark_indiv_do_loop(BMLoop *l, BLI_bitmap *loops, MLoopNorSpaceArray *lnor_spacearr, int *totloopsel, const bool do_all_loops_of_vert)
void BM_mesh_normals_update(BMesh *bm)
BMesh Compute Normals.
void BM_mesh_elem_table_free(BMesh *bm, const char htype)
#define LNOR_SPACE_TRIGO_THRESHOLD
BMVert * BM_vert_at_index_find(BMesh *bm, const int index)
void BM_lnorspace_err(BMesh *bm)
BMLoopNorEditDataArray * BM_loop_normal_editdata_array_init(BMesh *bm, const bool do_all_loops_of_vert)
static void loop_normal_editdata_init(BMesh *bm, BMLoopNorEditData *lnor_ed, BMVert *v, BMLoop *l, const int offset)
int BM_mesh_elem_count(BMesh *bm, const char htype)
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
void BM_mesh_elem_table_init(BMesh *bm, const char htype)
void BM_loop_normal_editdata_array_free(BMLoopNorEditDataArray *lnors_ed_arr)
float(* BM_mesh_vert_coords_alloc(BMesh *bm, int *r_vert_len))[3]
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
static void mesh_verts_calc_normals_accum_cb(void *userdata, MempoolIterData *mp_f)
static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops, const bool do_all_loops_of_vert)
void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func, const char *msg_a, const char *msg_b)
static void bm_mesh_edges_calc_vectors(BMesh *bm, float(*edgevec)[3], const float(*vcos)[3])
BMLoop * BM_loop_at_index_find(BMesh *bm, const int index)
void bmesh_edit_end(BMesh *bm, BMOpTypeFlag type_flag)
BMesh End Edit.
bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
bool BM_mesh_elem_table_check(BMesh *bm)
void BM_mesh_vert_coords_get(BMesh *bm, float(*vert_coords)[3])
void BM_verts_calc_normal_vcos(BMesh *bm, const float(*fnos)[3], const float(*vcos)[3], float(*vnos)[3])
BMesh Compute Normals from/to external data.
void BM_edges_sharp_from_angle_set(BMesh *bm, const float split_angle)
static void bm_mesh_loops_calc_normals(BMesh *bm, const float(*vcos)[3], const float(*fnos)[3], float(*r_lnos)[3], MLoopNorSpaceArray *r_lnors_spacearr, const short(*clnors_data)[2], const int cd_loop_clnors_offset, const bool do_rebuild)
void BM_custom_loop_normals_from_vector_layer(BMesh *bm, bool add_sharp_edges)
static void bm_mesh_loops_calc_normals_no_autosmooth(BMesh *bm, const float(*vnos)[3], const float(*fnos)[3], float(*r_lnos)[3])
void BM_mesh_elem_index_ensure_ex(BMesh *bm, const char htype, int elem_offset[4])
static void mesh_edges_calc_vectors_cb(void *userdata, MempoolIterData *mp_e)
#define BMALLOC_TEMPLATE_FROM_BM(bm)
@ BMO_OPTYPE_FLAG_INVALIDATE_CLNOR_ALL
@ BMO_OPTYPE_FLAG_SELECT_VALIDATE
@ BMO_OPTYPE_FLAG_UNTAN_MULTIRES
@ BMO_OPTYPE_FLAG_NORMALS_CALC
@ BMO_OPTYPE_FLAG_SELECT_FLUSH
void BM_face_normal_update(BMFace *f)
#define BM_ELEM_API_FLAG_DISABLE(element, f)
#define BM_ELEM_API_FLAG_TEST(element, f)
#define BM_ELEM_API_FLAG_ENABLE(element, f)
bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
BMLoop * BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step)
BMLoop * BM_face_vert_share_loop(BMFace *f, BMVert *v)
Return the Loop Shared by Face and Vertex.
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_vert_in_edge(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
ATTR_WARN_UNUSED_RESULT const BMVert * v
void bpy_bm_generic_invalidate(struct BPy_BMGeneric *UNUSED(self))
static int elem_offset(const SDNA *sdna, const char *type, const char *name, const SDNA_Struct *old)
IconTextureDrawCall normal
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
static void clear(Message *msg)
struct BMFlagLayer * oflags
struct BMEditSelection * next
struct BMEditSelection * prev
struct BMFlagLayer * oflags
BMLoopNorEditData ** lidx_to_lnor_editdata
BMLoopNorEditData * lnor_editdata
int cd_custom_normal_offset
struct BMLoop * radial_prev
struct BMLoop * radial_next
struct BMFlagLayer * oflags
const float(* edgevec)[3]
struct BLI_mempool * epool
struct MLoopNorSpaceArray * lnor_spacearr
struct BLI_mempool * vtoolflagpool
struct BLI_mempool * etoolflagpool
struct BLI_mempool * ftoolflagpool
struct BLI_mempool * fpool
struct BLI_mempool * vpool
struct BLI_mempool * lpool
struct BLI_mempool * pool
MLoopNorSpace ** lspacearr