49 int i, i_prev =
len - 1;
50 for (i = 0; i <
len; i++) {
52 if (vert_arr[i] ==
NULL) {
67 int i, i_prev =
len - 1;
68 for (i = 0; i <
len; i++) {
70 if (edge_arr[i_prev] ==
NULL) {
84 int i, i_prev =
len - 1;
85 for (i = 0; i <
len; i++) {
141 }
while ((l_iter = l_iter->
next) != l_first);
148 if (l_other && l_other != l_iter) {
153 if (l_other->
v == l_iter->
v) {
155 l_src[1] = l_other->
next;
158 l_src[0] = l_other->
next;
162 for (j = 0; j < 2; j++) {
172 }
while ((l_iter = l_iter->
next) != l_first);
177 }
while ((l_iter = l_iter->
next) != l_first);
199 for (i = 0; i <
len; i++) {
208 e_iter = e_first =
v1->e;
229 edges_sort[i] = e_iter;
232 verts_sort[i] = v_iter;
239 if (
UNLIKELY(v_iter != verts_sort[0])) {
254 for (i = 0; i <
len; i++) {
310 const bool calc_winding,
311 const bool create_edges)
314 uint winding[2] = {0, 0};
315 int i, i_prev =
len - 1;
316 BMVert *v_winding[2] = {vert_arr[i_prev], vert_arr[0]};
320 for (i = 0; i <
len; i++) {
326 if (edge_arr[i] ==
NULL) {
334 if (edge_arr[i]->
l) {
335 BMVert *test_v1, *test_v2;
338 winding[(vert_arr[i_prev] == test_v2)]++;
349 if (winding[0] < winding[1]) {
367 bm, v_winding[winding[0]], v_winding[winding[1]], edge_arr,
len, f_example, create_flag);
391 float nor[3], cent[3];
392 int index_tangent = 0;
394 const float *far = vert_arr[index_tangent]->
co;
397 for (
int i = 0; i <
len; i++) {
400 vert_arr_map[i] = vert_arr[i];
408 for (
int i = 0; i <
len; i++) {
409 vert_arr[i] = vert_arr_map[vang[i].
data];
418 if ((bm_src == bm_dst) && (v_src == v_dst)) {
419 BLI_assert(!
"BMVert: source and target match");
433 if ((bm_src == bm_dst) && (e_src == e_dst)) {
434 BLI_assert(!
"BMEdge: source and target match");
445 if ((bm_src == bm_dst) && (l_src == l_dst)) {
446 BLI_assert(!
"BMLoop: source and target match");
457 if ((bm_src == bm_dst) && (f_src == f_dst)) {
458 BLI_assert(!
"BMFace: source and target match");
479 const void *ele_src_v,
481 const char hflag_mask,
484 const BMHeader *ele_src = ele_src_v;
498 if (hflag_mask == 0) {
501 else if (hflag_mask == 0xff) {
505 ele_dst->
hflag = ((ele_dst->
hflag & hflag_mask) | (ele_src->
hflag & ~hflag_mask));
509 switch (ele_dst->
htype) {
512 bm_src, bm_dst, (
const BMVert *)ele_src, (
BMVert *)ele_dst, cd_mask_exclude);
516 bm_src, bm_dst, (
const BMEdge *)ele_src, (
BMEdge *)ele_dst, cd_mask_exclude);
520 bm_src, bm_dst, (
const BMLoop *)ele_src, (
BMLoop *)ele_dst, cd_mask_exclude);
524 bm_src, bm_dst, (
const BMFace *)ele_src, (
BMFace *)ele_dst, cd_mask_exclude);
541 const BMHeader *ele_src = ele_src_v;
569 }
while ((l_iter = l_iter->
next) != l_first);
588 }
while ((l_iter = l_iter->
next) != l_first);
597 if (allocsize ==
NULL) {
614 if (allocsize ==
NULL) {
643 if (allocsize ==
NULL) {
655 for (
int i = 0; i < 4; i++) {
656 if (!(htypes[i] & htype)) {
755 switch (ese->
htype) {
757 eletable = (
BMElem **)vtable;
760 eletable = (
BMElem **)etable;
763 eletable = (
BMElem **)ftable;
CustomData interface, see also DNA_customdata_types.h.
void CustomData_bmesh_copy_data_exclude_by_type(const struct CustomData *source, struct CustomData *dest, void *src_block, void **dest_block, const CustomDataMask mask_exclude)
void * CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem, const char *name)
void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, const char htype)
const CustomData_MeshMasks CD_MASK_BMESH
void CustomData_bmesh_free_block_data_exclude_by_type(struct CustomData *data, void *block, const CustomDataMask mask_exclude)
void CustomData_copy(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
#define BLI_array_alloca(arr, realsize)
float angle_signed_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_v3(float r[3], const float a[3])
int BLI_sortutil_cmp_float(const void *a_, const void *b_)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
bool(* BMLoopFilterFunc)(const BMLoop *, void *user_data)
#define BM_FACE_FIRST_LOOP(p)
void BM_mesh_copy_init_customdata(BMesh *bm_dst, BMesh *bm_src, const BMAllocTemplate *allocsize)
BMFace * BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool calc_winding, const bool create_edges)
void BM_verts_sort_radial_plane(BMVert **vert_arr, int len)
static bool bm_edges_sort_winding(BMVert *v1, BMVert *v2, BMEdge **edges, const int len, BMEdge **edges_sort, BMVert **verts_sort)
void BM_face_copy_shared(BMesh *bm, BMFace *f, BMLoopFilterFunc filter_fn, void *user_data)
copies face loop data from shared adjacent faces.
bool BM_verts_from_edges(BMVert **vert_arr, BMEdge **edge_arr, const int len)
void BM_elem_attrs_copy_ex(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v, const char hflag_mask, const uint64_t cd_mask_exclude)
char BM_face_flag_from_mflag(const char mflag)
static void bm_loop_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const BMLoop *l_src, BMLoop *l_dst, CustomDataMask mask_exclude)
static void bm_vert_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const BMVert *v_src, BMVert *v_dst, CustomDataMask mask_exclude)
static void bm_face_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const BMFace *f_src, BMFace *f_dst, CustomDataMask mask_exclude)
void BM_elem_select_copy(BMesh *bm_dst, void *ele_dst_v, const void *ele_src_v)
void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src, void *ele_dst)
BMFace * BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, const BMFace *f_example, const eBMCreateFlag create_flag)
Make Quad/Triangle.
char BM_face_flag_to_mflag(BMFace *f)
void BM_mesh_copy_init_customdata_from_mesh(BMesh *bm_dst, const Mesh *me_src, const BMAllocTemplate *allocsize)
void BM_edges_from_verts_ensure(BMesh *bm, BMEdge **edge_arr, BMVert **vert_arr, const int len)
BMFace * BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, const int len, const BMFace *f_example, const eBMCreateFlag create_flag)
Make NGon.
static void bm_edge_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const BMEdge *e_src, BMEdge *e_dst, CustomDataMask mask_exclude)
short BM_edge_flag_to_mflag(BMEdge *e)
char BM_vert_flag_from_mflag(const char mflag)
char BM_edge_flag_from_mflag(const short mflag)
void BM_mesh_copy_init_customdata_all_layers(BMesh *bm_dst, BMesh *bm_src, const char htype, const BMAllocTemplate *allocsize)
char BM_vert_flag_to_mflag(BMVert *v)
static BMFace * bm_mesh_copy_new_face(BMesh *bm_new, BMesh *bm_old, BMVert **vtable, BMEdge **etable, BMFace *f)
BMesh * BM_mesh_copy(BMesh *bm_old)
bool BM_edges_from_verts(BMEdge **edge_arr, BMVert **vert_arr, const int len)
BMVert * BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, const eBMCreateFlag create_flag)
Main function for creating a new vertex.
BMFace * BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
BMFace * BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, const BMFace *f_example, const eBMCreateFlag create_flag)
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
#define BM_elem_index_get(ele)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select)
#define BM_select_history_store(bm, ele)
const BMAllocTemplate bm_mesh_allocsize_default
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const struct BMeshCreateParams *params)
BMesh Make Mesh.
#define BMALLOC_TEMPLATE_FROM_BM(bm)
void BM_verts_calc_normal_from_cloud_ex(BMVert **varr, int varr_len, float r_normal[3], float r_center[3], int *r_index_tangent)
#define BM_ELEM_API_FLAG_DISABLE(element, f)
#define BM_ELEM_API_FLAG_TEST(element, f)
#define BM_ELEM_API_FLAG_ENABLE(element, f)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
void BM_edge_ordered_verts(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
BMVert * BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
BLI_INLINE BMEdge * bmesh_disk_edge_next(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
static void error(const char *str)
unsigned __int64 uint64_t
struct BMEditSelection * next
struct BMLoop * radial_next
struct CustomData pdata ldata