26 #define USE_EDGEQUEUE_EVEN_SUBDIV
27 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
32 #define USE_EDGEQUEUE_FRONTFACE
35 #define USE_EDGEQUEUE_TAG
40 #if defined(USE_EDGEQUEUE_TAG) && 0
42 # define USE_EDGEQUEUE_TAG_VERIFY
49 static void pbvh_bmesh_verify(
PBVH *pbvh);
65 #define BM_LOOPS_OF_VERT_ITER_BEGIN(l_iter_radial_, v_) \
69 BMEdge *e_iter, *e_first; \
70 BMLoop *l_iter_radial; \
74 _iter.e_iter = _iter.e_first = _iter.v->e; \
76 if (_iter.e_iter->l) { \
77 _iter.l_iter_radial = _iter.e_iter->l; \
79 if (_iter.l_iter_radial->v == _iter.v) { \
80 l_iter_radial_ = _iter.l_iter_radial;
82 #define BM_LOOPS_OF_VERT_ITER_END \
85 while ((_iter.l_iter_radial = _iter.l_iter_radial->radial_next) != _iter.e_iter->l) \
89 while ((_iter.e_iter = BM_DISK_EDGE_NEXT(_iter.e_iter, _iter.v)) != _iter.e_first) \
95 #define BM_FACES_OF_VERT_ITER_BEGIN(f_iter_, v_) \
97 BMLoop *l_iter_radial_; \
98 BM_LOOPS_OF_VERT_ITER_BEGIN (l_iter_radial_, v_) { \
99 f_iter_ = l_iter_radial_->f;
101 #define BM_FACES_OF_VERT_ITER_END \
103 BM_LOOPS_OF_VERT_ITER_END; \
147 !
ELEM(v_opposite, l_radial_first->
v, l_radial_first->
next->
v, l_radial_first->
prev->
v));
148 if (l_radial_first->
radial_next != l_radial_first) {
152 if (l_radial_iter->
prev->
v == v_opposite) {
153 return l_radial_iter->
f;
155 }
while ((l_radial_iter = l_radial_iter->
radial_next) != l_radial_first);
168 if (v_next_p ==
NULL) {
172 if (*v_next_p ==
NULL) {
188 const int node_index,
189 const int cd_vert_node_offset,
190 const int cd_face_node_offset)
194 bool has_visible =
false;
225 }
while ((l_iter = l_iter->
next) != l_first);
270 const float mid = (cb.
bmax[axis] + cb.
bmin[axis]) * 0.5f;
273 const int children = pbvh->
totnode;
278 n = &pbvh->
nodes[node_index];
304 other = c2->bm_faces;
307 empty = c2->bm_faces;
360 n = &pbvh->
nodes[node_index];
374 if (bm_faces_size <= pbvh->leaf_limit) {
389 BBC *bbc = &bbc_array[i];
396 }
while ((l_iter = l_iter->
next) != l_first);
415 static int pbvh_bmesh_node_offset_from_elem(
PBVH *pbvh,
BMElem *ele)
426 static int pbvh_bmesh_node_index_from_elem(
PBVH *pbvh,
void *key)
428 const int cd_node_offset = pbvh_bmesh_node_offset_from_elem(pbvh, key);
438 static PBVHNode *pbvh_bmesh_node_from_elem(
PBVH *pbvh,
void *key)
440 return &pbvh->
nodes[pbvh_bmesh_node_index_from_elem(pbvh, key)];
444 # define pbvh_bmesh_node_index_from_elem(pbvh, key) \
445 (CHECK_TYPE_ANY(key, BMFace *, BMVert *), pbvh_bmesh_node_index_from_elem(pbvh, key))
446 # define pbvh_bmesh_node_from_elem(pbvh, key) \
447 (CHECK_TYPE_ANY(key, BMFace *, BMVert *), pbvh_bmesh_node_from_elem(pbvh, key))
480 const int cd_vert_mask_offset)
540 if (f_node ==
node) {
550 #define pbvh_bmesh_node_vert_use_count_is_equal(pbvh, node, v, n) \
551 (pbvh_bmesh_node_vert_use_count_at_most(pbvh, node, v, (n) + 1) == n)
563 if (f_node ==
node) {
565 if (
count == count_max) {
584 if (f_node != current_node) {
630 if (f_node_index_prev != f_node_index) {
631 f_node_index_prev = f_node_index;
673 }
while ((l_iter = l_iter->
next) != l_first);
707 if (
node->bm_ortri) {
712 node->bm_tot_ortri = 0;
725 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
732 #ifdef USE_EDGEQUEUE_FRONTFACE
747 #ifdef USE_EDGEQUEUE_TAG
748 # define EDGE_QUEUE_TEST(e) (BM_elem_flag_test((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG))
749 # define EDGE_QUEUE_ENABLE(e) \
750 BM_elem_flag_enable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)
751 # define EDGE_QUEUE_DISABLE(e) \
752 BM_elem_flag_disable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)
755 #ifdef USE_EDGEQUEUE_TAG_VERIFY
758 static void pbvh_bmesh_edge_tag_verify(
PBVH *pbvh)
760 for (
int n = 0; n < pbvh->
totnode; n++) {
762 if (
node->bm_faces) {
771 e_tri[0] = l_iter->
e;
772 l_iter = l_iter->
next;
773 e_tri[1] = l_iter->
e;
774 l_iter = l_iter->
next;
775 e_tri[2] = l_iter->
e;
803 float tri_proj[3][3];
840 #ifdef USE_EDGEQUEUE_TAG
849 #ifdef USE_EDGEQUEUE_TAG
860 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
866 # ifdef USE_EDGEQUEUE_FRONTFACE
874 # ifdef USE_EDGEQUEUE_TAG
889 # define EVEN_EDGELEN_THRESHOLD 1.2f
892 # define EVEN_GENERATION_SCALE 1.6f
897 const float limit_len_sq =
square_f(limit_len);
902 for (
int i = 0; i <
ARRAY_SIZE(l_adjacent); i++) {
904 if (len_sq_other >
max_ff(len_sq_cmp, limit_len_sq)) {
907 eq_ctx, l_adjacent[i]->radial_next, l_adjacent[i], len_sq_other, limit_len);
912 # undef EVEN_EDGELEN_THRESHOLD
913 # undef EVEN_GENERATION_SCALE
920 #ifdef USE_EDGEQUEUE_TAG
925 if (len_sq < eq_ctx->q->limit_len_squared) {
933 #ifdef USE_EDGEQUEUE_FRONTFACE
946 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
955 }
while ((l_iter = l_iter->
next) != l_first);
961 #ifdef USE_EDGEQUEUE_FRONTFACE
977 }
while ((l_iter = l_iter->
next) != l_first);
993 const float view_normal[3],
995 const bool use_frontface,
996 const bool use_projected)
1002 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
1008 #ifdef USE_EDGEQUEUE_FRONTFACE
1014 if (use_projected) {
1022 #ifdef USE_EDGEQUEUE_TAG_VERIFY
1023 pbvh_bmesh_edge_tag_verify(pbvh);
1026 for (
int n = 0; n < pbvh->
totnode; n++) {
1056 const float view_normal[3],
1058 const bool use_frontface,
1059 const bool use_projected)
1065 #ifdef USE_EDGEQUEUE_EVEN_SUBDIV
1071 #ifdef USE_EDGEQUEUE_FRONTFACE
1077 if (use_projected) {
1085 for (
int n = 0; n < pbvh->
totnode; n++) {
1110 float co_mid[3], no_mid[3];
1128 float mask_v_new = 0.5f * (mask_v1 + mask_v2);
1134 for (
int i = 0; i < edge_loops->
count; i++) {
1146 v_opp = l_adj->
prev->
v;
1154 if (ni != node_index && i == 0) {
1196 e_tri[2] = e_tri[1];
1227 bool any_subdivided =
false;
1241 #ifdef USE_EDGEQUEUE_TAG
1264 any_subdivided =
true;
1269 #ifdef USE_EDGEQUEUE_TAG_VERIFY
1270 pbvh_bmesh_edge_tag_verify(pbvh);
1273 return any_subdivided;
1280 GHash *deleted_verts,
1302 while ((l_adj =
e->l)) {
1331 for (
int i = 0; i < 3; i++) {
1332 if (v_tri[i] == v_del) {
1357 int ni = n - pbvh->
nodes;
1372 for (
int i = 0; i < deleted_faces->
count; i++) {
1380 v_tri[0] = l_iter->
v;
1381 e_tri[0] = l_iter->
e;
1382 l_iter = l_iter->
next;
1383 v_tri[1] = l_iter->
v;
1384 e_tri[1] = l_iter->
e;
1385 l_iter = l_iter->
next;
1386 v_tri[2] = l_iter->
v;
1387 e_tri[2] = l_iter->
e;
1395 for (
int j = 0; j < 3; j++) {
1403 for (
int j = 0; j < 3; j++) {
1404 if ((v_tri[j] != v_del) && (v_tri[j]->
e ==
NULL)) {
1409 if (v_tri[j] == v_conn) {
1420 if (v_conn !=
NULL) {
1448 bool any_collapsed =
false;
1469 #ifdef USE_EDGEQUEUE_TAG
1486 any_collapsed =
true;
1493 return any_collapsed;
1499 const float ray_start[3],
1500 const float ray_normal[3],
1504 int *r_active_vertex_index,
1505 float *r_face_normal)
1508 float nearest_vertex_co[3] = {0.0f};
1510 if (use_original &&
node->bm_tot_ortri) {
1511 for (
int i = 0; i <
node->bm_tot_ortri; i++) {
1512 const int *
t =
node->bm_ortri[i];
1515 node->bm_orco[
t[0]],
1516 node->bm_orco[
t[1]],
1517 node->bm_orco[
t[2]],
1534 ray_start, isect_precalc, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co, depth)) {
1537 if (r_face_normal) {
1538 normal_tri_v3(r_face_normal, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co);
1541 if (r_active_vertex_index) {
1542 float location[3] = {0.0f};
1544 for (
int j = 0; j < 3; j++) {
1561 const float ray_start[3],
1564 float *r_edge_length)
1583 ray_start, isect_precalc, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co, depth);
1607 const float ray_start[3],
1608 const float ray_normal[3],
1615 if (use_original &&
node->bm_tot_ortri) {
1616 for (
int i = 0; i <
node->bm_tot_ortri; i++) {
1617 const int *
t =
node->bm_ortri[i];
1620 node->bm_orco[
t[0]],
1621 node->bm_orco[
t[1]],
1622 node->bm_orco[
t[2]],
1639 ray_start, ray_normal, v_tri[0]->co, v_tri[1]->co, v_tri[2]->co, depth, dist_sq);
1649 for (
int n = 0; n < totnode; n++) {
1694 for (
int i = 0; i <
node->totface; i++) {
1705 const float mid = (cb.
bmax[axis] + cb.
bmin[axis]) * 0.5f;
1707 int num_child1 = 0, num_child2 = 0;
1710 const int end =
node->start +
node->totface;
1711 for (
int i =
node->start; i < end - num_child2; i++) {
1716 int i_iter = end - num_child2 - 1;
1720 for (; i_iter > i; i_iter--) {
1721 BMFace *f_iter = nodeinfo[i_iter];
1731 if (candidate != -1) {
1732 BMFace *tmp = nodeinfo[i];
1733 nodeinfo[i] = nodeinfo[candidate];
1734 nodeinfo[candidate] = tmp;
1751 if (num_child2 == 0) {
1755 else if (num_child1 == 0) {
1783 int children_offset = pbvh->
totnode;
1788 pbvh, nodeinfo, bbc_array,
node->child1, children_offset);
1790 pbvh, nodeinfo, bbc_array,
node->child2, children_offset + 1);
1792 n = &pbvh->
nodes[node_index];
1806 bool has_visible =
false;
1817 const int end =
node->start +
node->totface;
1819 for (
int i =
node->start; i < end; i++) {
1829 BMLoop *l_iter = l_first;
1842 }
while ((l_iter = l_iter->
next) != l_first);
1868 bool smooth_shading,
1870 const int cd_vert_node_offset,
1871 const int cd_face_node_offset)
1885 if (smooth_shading) {
1898 BBC *bbc = &bbc_array[i];
1900 BMLoop *l_iter = l_first;
1905 }
while ((l_iter = l_iter->
next) != l_first);
1946 const float view_normal[3],
1948 const bool use_frontface,
1949 const bool use_projected)
1958 bool modified =
false;
1971 cd_vert_mask_offset,
1972 cd_vert_node_offset,
1973 cd_face_node_offset,
1977 &eq_ctx, pbvh,
center, view_normal, radius, use_frontface, use_projected);
1990 cd_vert_mask_offset,
1991 cd_vert_node_offset,
1992 cd_face_node_offset,
1996 &eq_ctx, pbvh,
center, view_normal, radius, use_frontface, use_projected);
2003 for (
int n = 0; n < pbvh->
totnode; n++) {
2014 pbvh_bmesh_verify(pbvh);
2023 if (
node->bm_orco) {
2074 node->bm_tot_ortri = i;
2079 for (
int i = 0; i < pbvh->
totnode; i++) {
2105 return node->bm_unique_verts;
2110 return node->bm_other_verts;
2115 return node->bm_faces;
2122 static void pbvh_bmesh_print(
PBVH *pbvh)
2124 fprintf(stderr,
"\npbvh=%p\n", pbvh);
2125 fprintf(stderr,
"bm_face_to_node:\n");
2133 fprintf(stderr,
"bm_vert_to_node:\n");
2139 for (
int n = 0; n < pbvh->
totnode; n++) {
2146 fprintf(stderr,
"node %d\n faces:\n", n);
2149 fprintf(stderr, " unique
verts:\n");
2152 fprintf(stderr, " other
verts:\n");
2158 static
void print_flag_factors(
int flag)
2160 printf(
"flag=0x%x:\n", flag);
2161 for (
int i = 0; i < 32; i++) {
2162 if (flag & (1 << i)) {
2163 printf(
" %d (1 << %d)\n", 1 << i, i);
2171 static void pbvh_bmesh_verify(
PBVH *pbvh)
2197 int totface = 0, totvert = 0;
2198 for (
int i = 0; i < pbvh->
totnode; i++) {
2213 PBVHNode *n = pbvh_bmesh_node_lookup(pbvh, f);
2229 nv = pbvh_bmesh_node_lookup(pbvh,
v);
2249 PBVHNode *n = pbvh_bmesh_node_lookup(pbvh,
v);
2266 if (pbvh_bmesh_node_lookup(pbvh, f) == n) {
2276 for (
int i = 0; i < pbvh->
totnode; i++) {
2290 bool has_unique =
false;
2291 for (
int i = 0; i < pbvh->
totnode; i++) {
2306 for (
int i = 0; i < pbvh->
totnode; i++) {
2313 PBVHNode *n_other = pbvh_bmesh_node_lookup(pbvh, f);
2320 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_)
void BLI_buffer_reinit(BLI_Buffer *buffer, size_t new_count)
#define BLI_buffer_at(buffer_, type_, index_)
#define BLI_buffer_declare_static(type_, name_, flag_, static_count_)
#define BLI_buffer_clear(buffer_)
#define BLI_buffer_free(name_)
#define GSET_ITER_INDEX(gs_iter_, gset_, i_)
bool BLI_gset_haskey(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT
GSet * BLI_gset_ptr_new(const char *info)
unsigned int BLI_gset_len(const GSet *gs) ATTR_WARN_UNUSED_RESULT
void BLI_gset_insert(GSet *gs, void *key)
GSet * BLI_gset_ptr_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
#define GSET_ITER(gs_iter_, gset_)
void BLI_ghash_insert(GHash *gh, void *key, void *val)
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)
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 BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int elem_num, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
#define DYNTOPO_NODE_NONE
NSNotificationCenter * center
_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
SyclQueue void void size_t num_bytes void
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
ccl_device_inline float3 log(float3 v)
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 pbvh_free_draw_buffers(PBVH *pbvh, PBVHNode *node)
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