40 #define USE_EDGEQUEUE_EVEN_SUBDIV
41 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
46 #define USE_EDGEQUEUE_FRONTFACE
49 #define USE_EDGEQUEUE_TAG
54 #if defined(USE_EDGEQUEUE_TAG) && 0
56 # define USE_EDGEQUEUE_TAG_VERIFY
63 static void pbvh_bmesh_verify(
PBVH *pbvh);
79 #define BM_LOOPS_OF_VERT_ITER_BEGIN(l_iter_radial_, v_) \
83 BMEdge *e_iter, *e_first; \
84 BMLoop *l_iter_radial; \
88 _iter.e_iter = _iter.e_first = _iter.v->e; \
90 if (_iter.e_iter->l) { \
91 _iter.l_iter_radial = _iter.e_iter->l; \
93 if (_iter.l_iter_radial->v == _iter.v) { \
94 l_iter_radial_ = _iter.l_iter_radial;
96 #define BM_LOOPS_OF_VERT_ITER_END \
99 while ((_iter.l_iter_radial = _iter.l_iter_radial->radial_next) != _iter.e_iter->l) \
103 while ((_iter.e_iter = BM_DISK_EDGE_NEXT(_iter.e_iter, _iter.v)) != _iter.e_first) \
109 #define BM_FACES_OF_VERT_ITER_BEGIN(f_iter_, v_) \
111 BMLoop *l_iter_radial_; \
112 BM_LOOPS_OF_VERT_ITER_BEGIN (l_iter_radial_, v_) { \
113 f_iter_ = l_iter_radial_->f;
115 #define BM_FACES_OF_VERT_ITER_END \
117 BM_LOOPS_OF_VERT_ITER_END; \
161 !
ELEM(v_opposite, l_radial_first->
v, l_radial_first->
next->
v, l_radial_first->
prev->
v));
162 if (l_radial_first->
radial_next != l_radial_first) {
166 if (l_radial_iter->
prev->
v == v_opposite) {
167 return l_radial_iter->
f;
169 }
while ((l_radial_iter = l_radial_iter->
radial_next) != l_radial_first);
182 if (v_next_p ==
NULL) {
186 if (*v_next_p ==
NULL) {
202 const int node_index,
203 const int cd_vert_node_offset,
204 const int cd_face_node_offset)
208 bool has_visible =
false;
239 }
while ((l_iter = l_iter->
next) != l_first);
284 const float mid = (cb.
bmax[axis] + cb.
bmin[axis]) * 0.5f;
287 const int children = pbvh->
totnode;
292 n = &pbvh->
nodes[node_index];
318 other = c2->bm_faces;
321 empty = c2->bm_faces;
375 n = &pbvh->
nodes[node_index];
389 if (bm_faces_size <= pbvh->leaf_limit) {
401 BBC *bbc = &bbc_array[i];
408 }
while ((l_iter = l_iter->
next) != l_first);
427 static int pbvh_bmesh_node_offset_from_elem(
PBVH *pbvh,
BMElem *ele)
438 static int pbvh_bmesh_node_index_from_elem(
PBVH *pbvh,
void *key)
440 const int cd_node_offset = pbvh_bmesh_node_offset_from_elem(pbvh, key);
450 static PBVHNode *pbvh_bmesh_node_from_elem(
PBVH *pbvh,
void *key)
452 return &pbvh->
nodes[pbvh_bmesh_node_index_from_elem(pbvh, key)];
456 # define pbvh_bmesh_node_index_from_elem(pbvh, key) \
457 (CHECK_TYPE_ANY(key, BMFace *, BMVert *), pbvh_bmesh_node_index_from_elem(pbvh, key))
458 # define pbvh_bmesh_node_from_elem(pbvh, key) \
459 (CHECK_TYPE_ANY(key, BMFace *, BMVert *), pbvh_bmesh_node_from_elem(pbvh, key))
492 const int cd_vert_mask_offset)
552 if (f_node ==
node) {
562 #define pbvh_bmesh_node_vert_use_count_is_equal(pbvh, node, v, n) \
563 (pbvh_bmesh_node_vert_use_count_at_most(pbvh, node, v, (n) + 1) == n)
575 if (f_node ==
node) {
577 if (
count == count_max) {
596 if (f_node != current_node) {
642 if (f_node_index_prev != f_node_index) {
643 f_node_index_prev = f_node_index;
685 }
while ((l_iter = l_iter->
next) != l_first);
719 if (
node->bm_ortri) {
724 node->bm_tot_ortri = 0;
737 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
744 #ifdef USE_EDGEQUEUE_FRONTFACE
759 #ifdef USE_EDGEQUEUE_TAG
760 # define EDGE_QUEUE_TEST(e) (BM_elem_flag_test((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG))
761 # define EDGE_QUEUE_ENABLE(e) \
762 BM_elem_flag_enable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)
763 # define EDGE_QUEUE_DISABLE(e) \
764 BM_elem_flag_disable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)
767 #ifdef USE_EDGEQUEUE_TAG_VERIFY
770 static void pbvh_bmesh_edge_tag_verify(
PBVH *pbvh)
772 for (
int n = 0; n < pbvh->
totnode; n++) {
774 if (
node->bm_faces) {
783 e_tri[0] = l_iter->
e;
784 l_iter = l_iter->
next;
785 e_tri[1] = l_iter->
e;
786 l_iter = l_iter->
next;
787 e_tri[2] = l_iter->
e;
815 float tri_proj[3][3];
852 #ifdef USE_EDGEQUEUE_TAG
861 #ifdef USE_EDGEQUEUE_TAG
872 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
878 # ifdef USE_EDGEQUEUE_FRONTFACE
886 # ifdef USE_EDGEQUEUE_TAG
901 # define EVEN_EDGELEN_THRESHOLD 1.2f
904 # define EVEN_GENERATION_SCALE 1.6f
909 const float limit_len_sq =
square_f(limit_len);
914 for (
int i = 0; i <
ARRAY_SIZE(l_adjacent); i++) {
916 if (len_sq_other >
max_ff(len_sq_cmp, limit_len_sq)) {
919 eq_ctx, l_adjacent[i]->radial_next, l_adjacent[i], len_sq_other, limit_len);
924 # undef EVEN_EDGELEN_THRESHOLD
925 # undef EVEN_GENERATION_SCALE
932 #ifdef USE_EDGEQUEUE_TAG
937 if (len_sq < eq_ctx->q->limit_len_squared) {
945 #ifdef USE_EDGEQUEUE_FRONTFACE
958 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
967 }
while ((l_iter = l_iter->
next) != l_first);
973 #ifdef USE_EDGEQUEUE_FRONTFACE
989 }
while ((l_iter = l_iter->
next) != l_first);
1005 const float view_normal[3],
1007 const bool use_frontface,
1008 const bool use_projected)
1014 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
1020 #ifdef USE_EDGEQUEUE_FRONTFACE
1026 if (use_projected) {
1034 #ifdef USE_EDGEQUEUE_TAG_VERIFY
1035 pbvh_bmesh_edge_tag_verify(pbvh);
1038 for (
int n = 0; n < pbvh->
totnode; n++) {
1068 const float view_normal[3],
1070 const bool use_frontface,
1071 const bool use_projected)
1077 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
1083 #ifdef USE_EDGEQUEUE_FRONTFACE
1089 if (use_projected) {
1097 for (
int n = 0; n < pbvh->
totnode; n++) {
1122 float co_mid[3], no_mid[3];
1140 float mask_v_new = 0.5f * (mask_v1 + mask_v2);
1146 for (
int i = 0; i < edge_loops->
count; i++) {
1158 v_opp = l_adj->
prev->
v;
1166 if (ni != node_index && i == 0) {
1208 e_tri[2] = e_tri[1];
1239 bool any_subdivided =
false;
1253 #ifdef USE_EDGEQUEUE_TAG
1276 any_subdivided =
true;
1281 #ifdef USE_EDGEQUEUE_TAG_VERIFY
1282 pbvh_bmesh_edge_tag_verify(pbvh);
1285 return any_subdivided;
1292 GHash *deleted_verts,
1314 while ((l_adj =
e->l)) {
1343 for (
int i = 0; i < 3; i++) {
1344 if (v_tri[i] == v_del) {
1369 int ni = n - pbvh->
nodes;
1384 for (
int i = 0; i < deleted_faces->
count; i++) {
1392 v_tri[0] = l_iter->
v;
1393 e_tri[0] = l_iter->
e;
1394 l_iter = l_iter->
next;
1395 v_tri[1] = l_iter->
v;
1396 e_tri[1] = l_iter->
e;
1397 l_iter = l_iter->
next;
1398 v_tri[2] = l_iter->
v;
1399 e_tri[2] = l_iter->
e;
1407 for (
int j = 0; j < 3; j++) {
1415 for (
int j = 0; j < 3; j++) {
1416 if ((v_tri[j] != v_del) && (v_tri[j]->
e ==
NULL)) {
1421 if (v_tri[j] == v_conn) {
1432 if (v_conn !=
NULL) {
1460 bool any_collapsed =
false;
1481 #ifdef USE_EDGEQUEUE_TAG
1498 any_collapsed =
true;
1505 return any_collapsed;
1511 const float ray_start[3],
1512 const float ray_normal[3],
1516 int *r_active_vertex_index,
1517 float *r_face_normal)
1520 float nearest_vertex_co[3] = {0.0f};
1522 if (use_original &&
node->bm_tot_ortri) {
1523 for (
int i = 0; i <
node->bm_tot_ortri; i++) {
1524 const int *
t =
node->bm_ortri[i];
1527 node->bm_orco[
t[0]],
1528 node->bm_orco[
t[1]],
1529 node->bm_orco[
t[2]],
1546 ray_start, isect_precalc, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co, depth)) {
1549 if (r_face_normal) {
1550 normal_tri_v3(r_face_normal, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co);
1553 if (r_active_vertex_index) {
1554 float location[3] = {0.0f};
1556 for (
int j = 0; j < 3; j++) {
1573 const float ray_start[3],
1576 float *r_edge_length)
1595 ray_start, isect_precalc, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co, depth);
1619 const float ray_start[3],
1620 const float ray_normal[3],
1627 if (use_original &&
node->bm_tot_ortri) {
1628 for (
int i = 0; i <
node->bm_tot_ortri; i++) {
1629 const int *
t =
node->bm_ortri[i];
1632 node->bm_orco[
t[0]],
1633 node->bm_orco[
t[1]],
1634 node->bm_orco[
t[2]],
1651 ray_start, ray_normal, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co, depth, dist_sq);
1661 for (
int n = 0; n < totnode; n++) {
1706 for (
int i = 0; i <
node->totface; i++) {
1717 const float mid = (cb.
bmax[axis] + cb.
bmin[axis]) * 0.5f;
1719 int num_child1 = 0, num_child2 = 0;
1722 const int end =
node->start +
node->totface;
1723 for (
int i =
node->start; i < end - num_child2; i++) {
1728 int i_iter = end - num_child2 - 1;
1732 for (; i_iter > i; i_iter--) {
1733 BMFace *f_iter = nodeinfo[i_iter];
1743 if (candidate != -1) {
1744 BMFace *tmp = nodeinfo[i];
1745 nodeinfo[i] = nodeinfo[candidate];
1746 nodeinfo[candidate] = tmp;
1763 if (num_child2 == 0) {
1767 else if (num_child1 == 0) {
1795 int children_offset = pbvh->
totnode;
1800 pbvh, nodeinfo, bbc_array,
node->child1, children_offset);
1802 pbvh, nodeinfo, bbc_array,
node->child2, children_offset + 1);
1804 n = &pbvh->
nodes[node_index];
1818 bool has_visible =
false;
1829 const int end =
node->start +
node->totface;
1831 for (
int i =
node->start; i < end; i++) {
1841 BMLoop *l_iter = l_first;
1854 }
while ((l_iter = l_iter->
next) != l_first);
1881 bool smooth_shading,
1883 const int cd_vert_node_offset,
1884 const int cd_face_node_offset)
1898 if (smooth_shading) {
1911 BBC *bbc = &bbc_array[i];
1913 BMLoop *l_iter = l_first;
1918 }
while ((l_iter = l_iter->
next) != l_first);
1960 const float view_normal[3],
1962 const bool use_frontface,
1963 const bool use_projected)
1972 bool modified =
false;
1985 cd_vert_mask_offset,
1986 cd_vert_node_offset,
1987 cd_face_node_offset,
1991 &eq_ctx, pbvh,
center, view_normal, radius, use_frontface, use_projected);
2004 cd_vert_mask_offset,
2005 cd_vert_node_offset,
2006 cd_face_node_offset,
2010 &eq_ctx, pbvh,
center, view_normal, radius, use_frontface, use_projected);
2017 for (
int n = 0; n < pbvh->
totnode; n++) {
2028 pbvh_bmesh_verify(pbvh);
2041 if (
node->bm_orco) {
2092 node->bm_tot_ortri = i;
2097 for (
int i = 0; i < pbvh->
totnode; i++) {
2123 return node->bm_unique_verts;
2128 return node->bm_other_verts;
2133 return node->bm_faces;
2140 static void pbvh_bmesh_print(
PBVH *pbvh)
2142 fprintf(stderr,
"\npbvh=%p\n", pbvh);
2143 fprintf(stderr,
"bm_face_to_node:\n");
2151 fprintf(stderr,
"bm_vert_to_node:\n");
2157 for (
int n = 0; n < pbvh->
totnode; n++) {
2164 fprintf(stderr,
"node %d\n faces:\n", n);
2167 fprintf(stderr, " unique
verts:\n");
2170 fprintf(stderr, " other
verts:\n");
2176 static
void print_flag_factors(
int flag)
2178 printf(
"flag=0x%x:\n", flag);
2179 for (
int i = 0; i < 32; i++) {
2180 if (flag & (1 << i)) {
2181 printf(
" %d (1 << %d)\n", 1 << i, i);
2189 static void pbvh_bmesh_verify(
PBVH *pbvh)
2215 int totface = 0, totvert = 0;
2216 for (
int i = 0; i < pbvh->
totnode; i++) {
2231 PBVHNode *n = pbvh_bmesh_node_lookup(pbvh, f);
2247 nv = pbvh_bmesh_node_lookup(pbvh,
v);
2267 PBVHNode *n = pbvh_bmesh_node_lookup(pbvh,
v);
2284 if (pbvh_bmesh_node_lookup(pbvh, f) == n) {
2294 for (
int i = 0; i < pbvh->
totnode; i++) {
2308 bool has_unique =
false;
2309 for (
int i = 0; i < pbvh->
totnode; i++) {
2324 for (
int i = 0; i < pbvh->
totnode; i++) {
2331 PBVHNode *n_other = pbvh_bmesh_node_lookup(pbvh, f);
2338 PBVHNode *n_other = pbvh_bmesh_node_lookup(pbvh,
v);
void CustomData_bmesh_set_default(struct CustomData *data, void **block)
int CustomData_get_offset(const struct CustomData *data, int type)
A BVH for high poly meshes.
void BKE_pbvh_node_mark_rebuild_draw(PBVHNode *node)
void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
#define BLI_buffer_append(buffer_, type_, val_)
#define BLI_buffer_at(buffer_, type_, index_)
#define BLI_buffer_declare_static(type_, name_, flag_, static_count_)
void BLI_buffer_reinit(BLI_Buffer *buffer, const size_t new_count)
#define BLI_buffer_clear(buffer_)
#define BLI_buffer_free(name_)
#define GSET_ITER_INDEX(gs_iter_, gset_, i_)
unsigned int BLI_gset_len(GSet *gs) ATTR_WARN_UNUSED_RESULT
GSet * BLI_gset_ptr_new(const char *info)
void BLI_gset_insert(GSet *gs, void *key)
#define GSET_ITER(gs_iter_, gset_)
bool BLI_gset_haskey(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
GSet * BLI_gset_ptr_new_ex(const char *info, const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void ** BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
BLI_INLINE void * BLI_gsetIterator_getKey(GSetIterator *gsi)
bool BLI_gset_add(GSet *gs, void *key)
bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp)
A min-heap / priority queue ADT.
void BLI_heapsimple_free(HeapSimple *heap, HeapSimpleFreeFP ptrfreefp) ATTR_NONNULL(1)
HeapSimple * BLI_heapsimple_new(void) ATTR_WARN_UNUSED_RESULT
void * BLI_heapsimple_pop_min(HeapSimple *heap) ATTR_NONNULL(1)
bool BLI_heapsimple_is_empty(const HeapSimple *heap) ATTR_NONNULL(1)
void BLI_heapsimple_insert(HeapSimple *heap, float value, void *ptr) ATTR_NONNULL(1)
MINLINE float max_fff(float a, float b, float c)
MINLINE float max_ff(float a, float b)
MINLINE float square_f(float a)
void closest_on_tri_to_point_v3(float r[3], const float p[3], const float v1[3], const float v2[3], const float v3[3])
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_v3(float r[3], const float a[3])
void project_plane_normalized_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
#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)
struct MemArena * BLI_memarena_new(const size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2) ATTR_MALLOC
void BLI_mempool_free(BLI_mempool *pool, void *addr) 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)
#define DYNTOPO_NODE_NONE
NSNotificationCenter * center
void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers)
_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 GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_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.
#define BM_ELEM_CD_SET_FLOAT(ele, offset, f)
#define BM_ELEM_CD_GET_FLOAT(ele, offset)
#define BM_ELEM_CD_GET_INT(ele, offset)
#define BM_ELEM_CD_SET_INT(ele, offset, f)
#define BM_FACE_FIRST_LOOP(p)
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.
void BM_vert_kill(BMesh *bm, BMVert *v)
void BM_face_kill(BMesh *bm, BMFace *f)
void BM_edge_kill(BMesh *bm, BMEdge *e)
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_elem_flag_test_bool(ele, hflag)
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_log_face_added(BMLog *log, BMFace *f)
void BM_log_face_removed(BMLog *log, BMFace *f)
void BM_log_vert_added(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
void BM_log_vert_removed(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
void BM_log_vert_before_modified(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
void BM_vert_normal_update(BMVert *v)
void BM_face_normal_update(BMFace *f)
void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[3])
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
float BM_edge_calc_length_squared(const BMEdge *e)
int BM_edge_face_count(const BMEdge *e)
BMFace * BM_face_exists(BMVert **varr, int len)
bool BM_vert_face_check(const BMVert *v)
#define BM_vert_face_count_is_equal(v, n)
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define BM_vert_edge_count_is_over(v, n)
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
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
INLINE Rall1d< T, V, S > log(const Rall1d< T, V, S > &arg)
bool ray_face_nearest_tri(const float ray_start[3], const float ray_normal[3], const float t0[3], const float t1[3], const float t2[3], float *depth, float *dist_sq)
void BB_expand_with_bb(BB *bb, BB *bb2)
int BB_widest_axis(const BB *bb)
void pbvh_grow_nodes(PBVH *pbvh, int totnode)
bool ray_face_intersection_tri(const float ray_start[3], struct IsectRayPrecalc *isect_precalc, const float t0[3], const float t1[3], const float t2[3], float *depth)
void BBC_update_centroid(BBC *bbc)
void BB_expand(BB *bb, const float co[3])
BLI_INLINE int pbvh_bmesh_node_index_from_vert(PBVH *pbvh, const BMVert *key)
BLI_INLINE int pbvh_bmesh_node_index_from_face(PBVH *pbvh, const BMFace *key)
#define BM_LOOPS_OF_VERT_ITER_END
#define BM_FACES_OF_VERT_ITER_BEGIN(f_iter_, v_)
void BKE_pbvh_bmesh_node_save_orig(BMesh *bm, PBVHNode *node)
static void long_edge_queue_edge_add_recursive(EdgeQueueContext *eq_ctx, BMLoop *l_edge, BMLoop *l_end, const float len_sq, float limit_len)
static bool pbvh_bmesh_node_limit_ensure(PBVH *pbvh, int node_index)
static void edge_queue_insert(EdgeQueueContext *eq_ctx, BMEdge *e, float priority)
static void pbvh_bmesh_collapse_edge(PBVH *pbvh, BMEdge *e, BMVert *v1, BMVert *v2, GHash *deleted_verts, BLI_Buffer *deleted_faces, EdgeQueueContext *eq_ctx)
#define BM_LOOPS_OF_VERT_ITER_BEGIN(l_iter_radial_, v_)
static BMFace * bm_face_exists_tri_from_loop_vert(BMLoop *l_radial_first, BMVert *v_opposite)
bool pbvh_bmesh_node_nearest_to_ray(PBVHNode *node, const float ray_start[3], const float ray_normal[3], float *depth, float *dist_sq, bool use_original)
static void pbvh_bmesh_node_split(PBVH *pbvh, const BBC *bbc_array, int node_index)
GSet * BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node)
static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, PBVH *pbvh, BMEdge *e, BLI_Buffer *edge_loops)
GSet * BKE_pbvh_bmesh_node_other_verts(PBVHNode *node)
BLI_INLINE PBVHNode * pbvh_bmesh_node_from_face(PBVH *pbvh, const BMFace *key)
static void long_edge_queue_face_add(EdgeQueueContext *eq_ctx, BMFace *f)
static void pbvh_bmesh_node_limit_ensure_fast(PBVH *pbvh, BMFace **nodeinfo, BBC *bbc_array, struct FastNodeBuildInfo *node, MemArena *arena)
static bool pbvh_bmesh_collapse_short_edges(EdgeQueueContext *eq_ctx, PBVH *pbvh, BLI_Buffer *deleted_faces)
bool pbvh_bmesh_node_raycast(PBVHNode *node, const float ray_start[3], const float ray_normal[3], struct IsectRayPrecalc *isect_precalc, float *depth, bool use_original, int *r_active_vertex_index, float *r_face_normal)
static void long_edge_queue_edge_add(EdgeQueueContext *eq_ctx, BMEdge *e)
static void pbvh_bmesh_edge_loops(BLI_Buffer *buf, BMEdge *e)
static void pbvh_bmesh_node_drop_orig(PBVHNode *node)
bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh, PBVHTopologyUpdateMode mode, const float center[3], const float view_normal[3], float radius, const bool use_frontface, const bool use_projected)
#define EVEN_GENERATION_SCALE
static void long_edge_queue_create(EdgeQueueContext *eq_ctx, PBVH *pbvh, const float center[3], const float view_normal[3], float radius, const bool use_frontface, const bool use_projected)
static BMVert * bm_vert_hash_lookup_chain(GHash *deleted_verts, BMVert *v)
#define EVEN_EDGELEN_THRESHOLD
static void short_edge_queue_face_add(EdgeQueueContext *eq_ctx, BMFace *f)
BLI_INLINE PBVHNode * pbvh_bmesh_node_from_vert(PBVH *pbvh, const BMVert *key)
static void pbvh_bmesh_vert_ownership_transfer(PBVH *pbvh, PBVHNode *new_owner, BMVert *v)
void BKE_pbvh_build_bmesh(PBVH *pbvh, BMesh *bm, bool smooth_shading, BMLog *log, const int cd_vert_node_offset, const int cd_face_node_offset)
static bool edge_queue_tri_in_sphere(const EdgeQueue *q, BMFace *f)
static BMFace * pbvh_bmesh_face_create(PBVH *pbvh, int node_index, BMVert *v_tri[3], BMEdge *e_tri[3], const BMFace *f_example)
static void pbvh_bmesh_face_remove(PBVH *pbvh, BMFace *f)
static void short_edge_queue_create(EdgeQueueContext *eq_ctx, PBVH *pbvh, const float center[3], const float view_normal[3], float radius, const bool use_frontface, const bool use_projected)
static void pbvh_bmesh_create_nodes_fast_recursive(PBVH *pbvh, BMFace **nodeinfo, BBC *bbc_array, struct FastNodeBuildInfo *node, int node_index)
static bool check_mask(EdgeQueueContext *eq_ctx, BMVert *v)
bool BKE_pbvh_bmesh_node_raycast_detail(PBVHNode *node, const float ray_start[3], struct IsectRayPrecalc *isect_precalc, float *depth, float *r_edge_length)
struct EdgeQueue EdgeQueue
#define pbvh_bmesh_node_vert_use_count_is_equal(pbvh, node, v, n)
#define BM_FACES_OF_VERT_ITER_END
struct GSet * BKE_pbvh_bmesh_node_faces(PBVHNode *node)
static bool edge_queue_tri_in_circle(const EdgeQueue *q, BMFace *f)
static void pbvh_bmesh_vert_remove(PBVH *pbvh, BMVert *v)
static void bm_edges_from_tri(BMesh *bm, BMVert *v_tri[3], BMEdge *e_tri[3])
#define EDGE_QUEUE_DISABLE(e)
#define EDGE_QUEUE_ENABLE(e)
void pbvh_bmesh_normals_update(PBVHNode **nodes, int totnode)
void BKE_pbvh_bmesh_after_stroke(PBVH *pbvh)
static PBVHNode * pbvh_bmesh_vert_other_node_find(PBVH *pbvh, BMVert *v)
static void pbvh_bmesh_node_finalize(PBVH *pbvh, const int node_index, const int cd_vert_node_offset, const int cd_face_node_offset)
#define EDGE_QUEUE_TEST(e)
static int pbvh_bmesh_node_vert_use_count_at_most(PBVH *pbvh, PBVHNode *node, BMVert *v, const int count_max)
static void short_edge_queue_edge_add(EdgeQueueContext *eq_ctx, BMEdge *e)
void BKE_pbvh_bmesh_detail_size_set(PBVH *pbvh, float detail_size)
void BKE_pbvh_node_mark_topology_update(PBVHNode *node)
static BMVert * pbvh_bmesh_vert_create(PBVH *pbvh, int node_index, const float co[3], const float no[3], const int cd_vert_mask_offset)
BLI_INLINE void bm_face_as_array_index_tri(BMFace *f, int r_index[3])
static bool pbvh_bmesh_subdivide_long_edges(EdgeQueueContext *eq_ctx, PBVH *pbvh, BLI_Buffer *edge_loops)
@ PBVH_DYNTOPO_SMOOTH_SHADING
struct BMLoop * radial_next
unsigned int use_view_normal
bool(* edge_queue_tri_in_range)(const struct EdgeQueue *q, BMFace *f)
const float * view_normal
struct FastNodeBuildInfo * child2
struct FastNodeBuildInfo * child1
struct GPU_PBVH_Buffers * draw_buffers