|
Blender
V2.93
|
#include "MEM_guardedalloc.h"#include "BLI_buffer.h"#include "BLI_ghash.h"#include "BLI_heap_simple.h"#include "BLI_math.h"#include "BLI_memarena.h"#include "BLI_utildefines.h"#include "BKE_DerivedMesh.h"#include "BKE_ccg.h"#include "BKE_pbvh.h"#include "GPU_buffers.h"#include "bmesh.h"#include "pbvh_intern.h"#include "BKE_global.h"Go to the source code of this file.
Classes | |
| struct | EdgeQueue |
| struct | EdgeQueueContext |
| struct | FastNodeBuildInfo |
Macros | |
| #define | USE_EDGEQUEUE_EVEN_SUBDIV |
| #define | USE_EDGEQUEUE_FRONTFACE |
| #define | USE_EDGEQUEUE_TAG |
| #define | pbvh_bmesh_node_vert_use_count_is_equal(pbvh, node, v, n) (pbvh_bmesh_node_vert_use_count_at_most(pbvh, node, v, (n) + 1) == n) |
| #define | EDGE_QUEUE_TEST(e) (BM_elem_flag_test((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)) |
| #define | EDGE_QUEUE_ENABLE(e) BM_elem_flag_enable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG) |
| #define | EDGE_QUEUE_DISABLE(e) BM_elem_flag_disable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG) |
| #define | EVEN_EDGELEN_THRESHOLD 1.2f |
| #define | EVEN_GENERATION_SCALE 1.6f |
Typedefs | |
| typedef struct EdgeQueue | EdgeQueue |
Functions | |
| static void | pbvh_bmesh_node_finalize (PBVH *pbvh, const int node_index, const int cd_vert_node_offset, const int cd_face_node_offset) |
| static void | pbvh_bmesh_node_split (PBVH *pbvh, const BBC *bbc_array, int node_index) |
| static bool | pbvh_bmesh_node_limit_ensure (PBVH *pbvh, int node_index) |
| 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) |
| BLI_INLINE PBVHNode * | pbvh_bmesh_node_from_vert (PBVH *pbvh, const BMVert *key) |
| BLI_INLINE PBVHNode * | pbvh_bmesh_node_from_face (PBVH *pbvh, const BMFace *key) |
| 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) |
| static BMFace * | pbvh_bmesh_face_create (PBVH *pbvh, int node_index, BMVert *v_tri[3], BMEdge *e_tri[3], const BMFace *f_example) |
| static int | pbvh_bmesh_node_vert_use_count_at_most (PBVH *pbvh, PBVHNode *node, BMVert *v, const int count_max) |
| static PBVHNode * | pbvh_bmesh_vert_other_node_find (PBVH *pbvh, BMVert *v) |
| static void | pbvh_bmesh_vert_ownership_transfer (PBVH *pbvh, PBVHNode *new_owner, BMVert *v) |
| static void | pbvh_bmesh_vert_remove (PBVH *pbvh, BMVert *v) |
| static void | pbvh_bmesh_face_remove (PBVH *pbvh, BMFace *f) |
| static void | pbvh_bmesh_edge_loops (BLI_Buffer *buf, BMEdge *e) |
| static void | pbvh_bmesh_node_drop_orig (PBVHNode *node) |
| static bool | edge_queue_tri_in_sphere (const EdgeQueue *q, BMFace *f) |
| static bool | edge_queue_tri_in_circle (const EdgeQueue *q, BMFace *f) |
| static bool | check_mask (EdgeQueueContext *eq_ctx, BMVert *v) |
| static void | edge_queue_insert (EdgeQueueContext *eq_ctx, BMEdge *e, float priority) |
| static void | long_edge_queue_edge_add (EdgeQueueContext *eq_ctx, BMEdge *e) |
| 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 void | short_edge_queue_edge_add (EdgeQueueContext *eq_ctx, BMEdge *e) |
| static void | long_edge_queue_face_add (EdgeQueueContext *eq_ctx, BMFace *f) |
| static void | short_edge_queue_face_add (EdgeQueueContext *eq_ctx, BMFace *f) |
| 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 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_split_edge (EdgeQueueContext *eq_ctx, PBVH *pbvh, BMEdge *e, BLI_Buffer *edge_loops) |
| static bool | pbvh_bmesh_subdivide_long_edges (EdgeQueueContext *eq_ctx, PBVH *pbvh, BLI_Buffer *edge_loops) |
| static void | pbvh_bmesh_collapse_edge (PBVH *pbvh, BMEdge *e, BMVert *v1, BMVert *v2, GHash *deleted_verts, BLI_Buffer *deleted_faces, EdgeQueueContext *eq_ctx) |
| 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) |
| bool | BKE_pbvh_bmesh_node_raycast_detail (PBVHNode *node, const float ray_start[3], struct IsectRayPrecalc *isect_precalc, float *depth, float *r_edge_length) |
| 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) |
| void | pbvh_bmesh_normals_update (PBVHNode **nodes, int totnode) |
| static void | pbvh_bmesh_node_limit_ensure_fast (PBVH *pbvh, BMFace **nodeinfo, BBC *bbc_array, struct FastNodeBuildInfo *node, MemArena *arena) |
| static void | pbvh_bmesh_create_nodes_fast_recursive (PBVH *pbvh, BMFace **nodeinfo, BBC *bbc_array, struct FastNodeBuildInfo *node, int node_index) |
| 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) |
| 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) |
| void | BKE_pbvh_bmesh_node_save_orig (BMesh *bm, PBVHNode *node) |
| void | BKE_pbvh_bmesh_after_stroke (PBVH *pbvh) |
| void | BKE_pbvh_bmesh_detail_size_set (PBVH *pbvh, float detail_size) |
| void | BKE_pbvh_node_mark_topology_update (PBVHNode *node) |
| GSet * | BKE_pbvh_bmesh_node_unique_verts (PBVHNode *node) |
| GSet * | BKE_pbvh_bmesh_node_other_verts (PBVHNode *node) |
| struct GSet * | BKE_pbvh_bmesh_node_faces (PBVHNode *node) |
BMesh Utility API | |
Ensure we don't have dirty tags for the edge queue, and that they are left cleared. (slow, even for debug mode, so leave disabled for now). Use some local functions which assume triangles. | |
| #define | BM_LOOPS_OF_VERT_ITER_BEGIN(l_iter_radial_, v_) |
| #define | BM_LOOPS_OF_VERT_ITER_END |
| #define | BM_FACES_OF_VERT_ITER_BEGIN(f_iter_, v_) |
| #define | BM_FACES_OF_VERT_ITER_END |
| static void | bm_edges_from_tri (BMesh *bm, BMVert *v_tri[3], BMEdge *e_tri[3]) |
| BLI_INLINE void | bm_face_as_array_index_tri (BMFace *f, int r_index[3]) |
| static BMFace * | bm_face_exists_tri_from_loop_vert (BMLoop *l_radial_first, BMVert *v_opposite) |
| static BMVert * | bm_vert_hash_lookup_chain (GHash *deleted_verts, BMVert *v) |
| #define BM_FACES_OF_VERT_ITER_BEGIN | ( | f_iter_, | |
| v_ | |||
| ) |
Definition at line 109 of file pbvh_bmesh.c.
| #define BM_FACES_OF_VERT_ITER_END |
Definition at line 115 of file pbvh_bmesh.c.
| #define BM_LOOPS_OF_VERT_ITER_BEGIN | ( | l_iter_radial_, | |
| v_ | |||
| ) |
Typically using BM_LOOPS_OF_VERT and BM_FACES_OF_VERT iterators are fine, however this is an area where performance matters so do it in-line.
Take care since 'break' won't works as expected within these macros!
Definition at line 79 of file pbvh_bmesh.c.
| #define BM_LOOPS_OF_VERT_ITER_END |
Definition at line 96 of file pbvh_bmesh.c.
| #define EDGE_QUEUE_DISABLE | ( | e | ) | BM_elem_flag_disable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG) |
Definition at line 763 of file pbvh_bmesh.c.
| #define EDGE_QUEUE_ENABLE | ( | e | ) | BM_elem_flag_enable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG) |
Definition at line 761 of file pbvh_bmesh.c.
| #define EDGE_QUEUE_TEST | ( | e | ) | (BM_elem_flag_test((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)) |
Definition at line 760 of file pbvh_bmesh.c.
| #define EVEN_EDGELEN_THRESHOLD 1.2f |
| #define EVEN_GENERATION_SCALE 1.6f |
| #define pbvh_bmesh_node_vert_use_count_is_equal | ( | pbvh, | |
| node, | |||
| v, | |||
| n | |||
| ) | (pbvh_bmesh_node_vert_use_count_at_most(pbvh, node, v, (n) + 1) == n) |
Definition at line 562 of file pbvh_bmesh.c.
| #define USE_EDGEQUEUE_EVEN_SUBDIV |
Definition at line 40 of file pbvh_bmesh.c.
| #define USE_EDGEQUEUE_FRONTFACE |
Definition at line 46 of file pbvh_bmesh.c.
| #define USE_EDGEQUEUE_TAG |
Definition at line 49 of file pbvh_bmesh.c.
| void BKE_pbvh_bmesh_after_stroke | ( | PBVH * | pbvh | ) |
Definition at line 2095 of file pbvh_bmesh.c.
References PBVHNode::flag, PBVH::nodes, pbvh_bmesh_node_drop_orig(), pbvh_bmesh_node_limit_ensure(), PBVH_Leaf, and PBVH::totnode.
Referenced by SCULPT_flush_update_done().
Definition at line 2110 of file pbvh_bmesh.c.
References PBVH::bm_max_edge_len, and PBVH::bm_min_edge_len.
Referenced by BKE_pbvh_build_bmesh(), sculpt_detail_flood_fill_exec(), and sculpt_stroke_update_step().
Definition at line 2131 of file pbvh_bmesh.c.
References node.
Referenced by partialvis_update_bmesh(), and sculpt_undo_bmesh_push().
Definition at line 2126 of file pbvh_bmesh.c.
References node.
Referenced by partialvis_update_bmesh(), and pbvh_bmesh_node_visibility_update().
| bool BKE_pbvh_bmesh_node_raycast_detail | ( | PBVHNode * | node, |
| const float | ray_start[3], | ||
| struct IsectRayPrecalc * | isect_precalc, | ||
| float * | depth, | ||
| float * | r_edge_length | ||
| ) |
Definition at line 1572 of file pbvh_bmesh.c.
References BLI_assert, BLI_gsetIterator_getKey(), BM_elem_flag_test, BM_ELEM_HIDDEN, BM_face_as_array_vert_tri(), GSET_ITER, BMFace::len, len_squared_v3v3(), max_fff(), node, NULL, PBVH_FullyHidden, ray_face_intersection_tri(), and sqrtf.
Referenced by sculpt_raycast_detail_cb().
Definition at line 2038 of file pbvh_bmesh.c.
References BLI_gset_len(), BLI_gsetIterator_getKey(), bm, BM_elem_flag_test, BM_ELEM_HIDDEN, BM_elem_index_get, BM_elem_index_set, bm_face_as_array_index_tri(), BM_ITER_ELEM, BM_VERT, BM_VERTS_OF_FACE, BMVert::co, copy_v3_v3(), BMesh::elem_index_dirty, GSET_ITER, MEM_mallocN, node, and v.
Referenced by sculpt_topology_update().
Definition at line 2121 of file pbvh_bmesh.c.
References node.
Referenced by partialvis_update_bmesh(), and pbvh_bmesh_node_visibility_update().
| 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 | ||
| ) |
Definition at line 1957 of file pbvh_bmesh.c.
References BLI_assert, BLI_buffer_declare_static, BLI_buffer_free, BLI_BUFFER_NOP, BLI_heapsimple_free(), BLI_mempool_create(), BLI_mempool_destroy(), BLI_MEMPOOL_NOP, PBVH::bm, PBVH::cd_face_node_offset, CD_PAINT_MASK, PBVH::cd_vert_node_offset, center, CustomData_get_offset(), EdgeQueue::heap, len_squared_v3(), long_edge_queue_create(), node, PBVH::nodes, NULL, pbvh_bmesh_collapse_short_edges(), pbvh_bmesh_subdivide_long_edges(), PBVH_Collapse, PBVH_Leaf, PBVH_Subdivide, PBVH_UpdateTopology, short_edge_queue_create(), PBVH::totnode, and BMesh::vdata.
Referenced by sculpt_detail_flood_fill_exec(), and sculpt_topology_update().
| 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 | ||
| ) |
Definition at line 1879 of file pbvh_bmesh.c.
References BB_expand(), BB_reset(), BBC_update_centroid(), BKE_pbvh_bmesh_detail_size_set(), BLI_memarena_free(), BLI_memarena_new(), BLI_MEMARENA_STD_BUFSIZE, PBVH::bm, bm, BM_ELEM_CD_SET_INT, BM_elem_index_set, BM_FACE, BM_FACE_FIRST_LOOP, BM_FACES_OF_MESH, BM_ITER_MESH, BM_ITER_MESH_INDEX, PBVH::bm_log, BM_VERTS_OF_MESH, PBVH::cd_face_node_offset, PBVH::cd_vert_node_offset, BMVert::co, DYNTOPO_NODE_NONE, BMesh::elem_index_dirty, PBVH::flags, PBVH::leaf_limit, KDL::log(), MEM_callocN, MEM_freeN, MEM_mallocN, BMLoop::next, PBVH::nodes, PBVH_BMESH, pbvh_bmesh_create_nodes_fast_recursive(), pbvh_bmesh_node_limit_ensure_fast(), PBVH_DYNTOPO_SMOOTH_SHADING, FastNodeBuildInfo::totface, BMesh::totface, PBVH::totnode, PBVH::type, BMLoop::v, and v.
Referenced by build_pbvh_for_dynamic_topology().
| void BKE_pbvh_node_mark_topology_update | ( | PBVHNode * | node | ) |
Definition at line 2116 of file pbvh_bmesh.c.
References node, and PBVH_UpdateTopology.
Referenced by sculpt_detail_flood_fill_exec(), and sculpt_topology_update().
Definition at line 121 of file pbvh_bmesh.c.
References bm, BM_CREATE_NO_DOUBLE, BM_edge_create(), and NULL.
Referenced by pbvh_bmesh_collapse_edge(), and pbvh_bmesh_split_edge().
| BLI_INLINE void bm_face_as_array_index_tri | ( | BMFace * | f, |
| int | r_index[3] | ||
| ) |
Definition at line 128 of file pbvh_bmesh.c.
References BLI_assert, BM_elem_index_get, BM_FACE_FIRST_LOOP, l, BMFace::len, BMLoop::next, and BMLoop::v.
Referenced by BKE_pbvh_bmesh_node_save_orig().
|
static |
A version of BM_face_exists, optimized for triangles when we know the loop and the opposite vertex.
Check if any triangle is formed by (l_radial_first->v, l_radial_first->next->v, v_opposite), at either winding (since its a triangle no special checks are needed).
l_radial_first->v & l_radial_first->next->v +---+ | / | / + v_opposite
Its assumed that l_radial_first is never forming the target face.
Definition at line 158 of file pbvh_bmesh.c.
References BLI_assert, ELEM, BMLoop::f, BMFace::len, BMLoop::next, NULL, BMLoop::prev, BMLoop::radial_next, and BMLoop::v.
Referenced by pbvh_bmesh_collapse_edge().
Uses a map of vertices to lookup the final target. References can't point to previous items (would cause infinite loop).
Definition at line 178 of file pbvh_bmesh.c.
References BLI_ghash_lookup_p(), NULL, and v.
Referenced by pbvh_bmesh_collapse_short_edges().
|
static |
Definition at line 831 of file pbvh_bmesh.c.
References BM_ELEM_CD_GET_FLOAT, EdgeQueueContext::cd_vert_mask_offset, and v.
Referenced by edge_queue_insert().
|
static |
Definition at line 836 of file pbvh_bmesh.c.
References BLI_assert, BLI_heapsimple_insert(), BLI_mempool_alloc(), BM_elem_flag_test_bool, BM_ELEM_HIDDEN, EdgeQueueContext::cd_vert_mask_offset, check_mask(), e, EDGE_QUEUE_ENABLE, EDGE_QUEUE_TEST, EdgeQueue::heap, EdgeQueueContext::pool, and EdgeQueueContext::q.
Referenced by long_edge_queue_edge_add(), long_edge_queue_edge_add_recursive(), and short_edge_queue_edge_add().
Definition at line 811 of file pbvh_bmesh.c.
References BM_face_as_array_vert_tri(), Freestyle::c, EdgeQueue::center_proj, closest_on_tri_to_point_v3(), len_squared_v3v3(), project_plane_normalized_v3_v3v3(), EdgeQueue::radius_squared, and EdgeQueue::view_normal.
Referenced by long_edge_queue_create(), and short_edge_queue_create().
Definition at line 797 of file pbvh_bmesh.c.
References BM_face_as_array_vert_tri(), Freestyle::c, EdgeQueue::center, closest_on_tri_to_point_v3(), BMVert::co, len_squared_v3v3(), and EdgeQueue::radius_squared.
Referenced by long_edge_queue_create(), and short_edge_queue_create().
|
static |
Definition at line 1002 of file pbvh_bmesh.c.
References BLI_gsetIterator_getKey(), BLI_heapsimple_new(), PBVH::bm_max_edge_len, center, EdgeQueue::center, EdgeQueue::center_proj, edge_queue_tri_in_circle(), EdgeQueue::edge_queue_tri_in_range, edge_queue_tri_in_sphere(), GSET_ITER, EdgeQueue::heap, EdgeQueue::limit_len, EdgeQueue::limit_len_squared, long_edge_queue_face_add(), node, PBVH::nodes, PBVH_FullyHidden, PBVH_Leaf, PBVH_UpdateTopology, project_plane_normalized_v3_v3v3(), EdgeQueueContext::q, EdgeQueue::radius_squared, PBVH::totnode, UNUSED_VARS, EdgeQueue::use_view_normal, and EdgeQueue::view_normal.
Referenced by BKE_pbvh_bmesh_update_topology().
|
static |
Definition at line 859 of file pbvh_bmesh.c.
References BM_edge_calc_length_squared(), e, edge_queue_insert(), EDGE_QUEUE_TEST, EdgeQueue::limit_len_squared, and EdgeQueueContext::q.
Referenced by long_edge_queue_face_add(), and pbvh_bmesh_split_edge().
|
static |
Definition at line 873 of file pbvh_bmesh.c.
References ARRAY_SIZE, BLI_assert, BM_edge_calc_length_squared(), dot_v3v3(), BMLoop::e, e, edge_queue_insert(), EDGE_QUEUE_TEST, EVEN_EDGELEN_THRESHOLD, EVEN_GENERATION_SCALE, BMLoop::f, G, max_ff(), BMLoop::next, BMFace::no, BMLoop::prev, EdgeQueueContext::q, BMLoop::radial_next, square_f(), UNLIKELY, EdgeQueue::use_view_normal, and EdgeQueue::view_normal.
Referenced by long_edge_queue_face_add().
|
static |
Definition at line 943 of file pbvh_bmesh.c.
References BM_edge_calc_length_squared(), BM_FACE_FIRST_LOOP, dot_v3v3(), BMLoop::e, EdgeQueue::edge_queue_tri_in_range, EdgeQueue::limit_len, EdgeQueue::limit_len_squared, long_edge_queue_edge_add(), long_edge_queue_edge_add_recursive(), BMLoop::next, BMFace::no, EdgeQueueContext::q, BMLoop::radial_next, EdgeQueue::use_view_normal, and EdgeQueue::view_normal.
Referenced by long_edge_queue_create(), and pbvh_bmesh_split_edge().
|
static |
Definition at line 1288 of file pbvh_bmesh.c.
References add_v3_v3(), BLI_assert, BLI_buffer_append, BLI_buffer_at, BLI_buffer_clear, BLI_ghash_insert(), BLI_gset_add(), BLI_gset_haskey(), PBVH::bm, BM_edge_is_wire(), BM_edge_kill(), bm_edges_from_tri(), BM_ELEM_CD_GET_FLOAT, BM_face_as_array_vert_tri(), BM_face_exists(), bm_face_exists_tri_from_loop_vert(), BM_FACE_FIRST_LOOP, BM_face_kill(), PBVH::bm_log, BM_log_vert_before_modified(), BM_log_vert_removed(), BM_LOOPS_OF_VERT_ITER_BEGIN, BM_LOOPS_OF_VERT_ITER_END, PBVHNode::bm_other_verts, PBVHNode::bm_unique_verts, BM_vert_face_check(), BM_vert_kill(), EdgeQueueContext::cd_vert_mask_offset, BMVert::co, BLI_Buffer::count, BMLoop::e, e, BMLoop::f, PBVHNode::flag, l, BMFace::len, mid_v3_v3v3(), BMLoop::next, BMVert::no, PBVH::nodes, normalize_v3(), NULL, pbvh_bmesh_face_create(), pbvh_bmesh_face_remove(), pbvh_bmesh_node_from_face(), pbvh_bmesh_vert_remove(), PBVH_UpdateBB, PBVH_UpdateDrawBuffers, PBVH_UpdateNormals, BMLoop::prev, UNLIKELY, BMLoop::v, v1, and v2.
Referenced by pbvh_bmesh_collapse_short_edges().
|
static |
Definition at line 1455 of file pbvh_bmesh.c.
References BLI_ghash_free(), BLI_ghash_ptr_new(), BLI_heapsimple_is_empty(), BLI_heapsimple_pop_min(), BLI_mempool_free(), BM_edge_exists(), BM_ELEM_CD_GET_INT, PBVH::bm_min_edge_len, bm_vert_hash_lookup_chain(), EdgeQueueContext::cd_vert_node_offset, BMVert::co, DYNTOPO_NODE_NONE, e, EDGE_QUEUE_DISABLE, EdgeQueue::heap, len_squared_v3v3(), NULL, pbvh_bmesh_collapse_edge(), EdgeQueueContext::pool, EdgeQueueContext::q, v1, and v2.
Referenced by BKE_pbvh_bmesh_update_topology().
|
static |
Definition at line 1789 of file pbvh_bmesh.c.
References BB_expand_with_bb(), BB_reset(), BKE_pbvh_node_fully_hidden_set(), BKE_pbvh_node_mark_rebuild_draw(), BLI_assert, BLI_gset_add(), BLI_gset_haskey(), BLI_gset_insert(), BLI_gset_ptr_new(), BLI_gset_ptr_new_ex(), BM_ELEM_CD_GET_INT, BM_ELEM_CD_SET_INT, BM_elem_flag_test, BM_ELEM_HIDDEN, BM_elem_index_get, BM_FACE_FIRST_LOOP, PBVHNode::bm_faces, PBVHNode::bm_other_verts, PBVHNode::bm_unique_verts, BB::bmax, BB::bmin, PBVH::cd_face_node_offset, PBVH::cd_vert_node_offset, PBVHNode::children_offset, DYNTOPO_NODE_NONE, PBVHNode::flag, BMLoop::next, node, PBVH::nodes, PBVHNode::orig_vb, pbvh_grow_nodes(), PBVH_Leaf, PBVH_UpdateNormals, PBVH::totnode, BMLoop::v, v, and PBVHNode::vb.
Referenced by BKE_pbvh_build_bmesh().
|
static |
Definition at line 698 of file pbvh_bmesh.c.
References BLI_Buffer::alloc_count, BLI_assert, BLI_buffer_reinit(), BM_edge_face_count(), BM_edge_loop_pair(), BM_iter_as_array(), BM_LOOPS_OF_EDGE, BLI_Buffer::count, BLI_Buffer::data, data, e, LIKELY, and NULL.
Referenced by pbvh_bmesh_split_edge().
|
static |
Definition at line 519 of file pbvh_bmesh.c.
References BLI_assert, BLI_gset_insert(), PBVH::bm, BM_CREATE_NOP, BM_ELEM_CD_SET_INT, BM_face_create(), BM_face_exists(), PBVH::bm_log, BM_log_face_added(), PBVH::cd_face_node_offset, BMFace::head, BMHeader::hflag, node, PBVH::nodes, PBVH_FullyHidden, PBVH_UpdateDrawBuffers, and PBVH_UpdateNormals.
Referenced by pbvh_bmesh_collapse_edge(), and pbvh_bmesh_split_edge().
Definition at line 658 of file pbvh_bmesh.c.
References BLI_assert, BLI_gset_haskey(), BLI_gset_remove(), BM_ELEM_CD_SET_INT, BM_FACE_FIRST_LOOP, PBVHNode::bm_faces, PBVH::bm_log, BM_log_face_removed(), PBVHNode::bm_other_verts, PBVHNode::bm_unique_verts, BM_vert_face_count_is_equal, PBVH::cd_face_node_offset, DYNTOPO_NODE_NONE, PBVHNode::flag, BMLoop::next, NULL, pbvh_bmesh_node_from_face(), pbvh_bmesh_node_vert_use_count_is_equal, pbvh_bmesh_vert_other_node_find(), pbvh_bmesh_vert_ownership_transfer(), PBVH_UpdateDrawBuffers, PBVH_UpdateNormals, BMLoop::v, and v.
Referenced by pbvh_bmesh_collapse_edge(), and pbvh_bmesh_split_edge().
|
static |
Definition at line 714 of file pbvh_bmesh.c.
References MEM_freeN, node, and NULL.
Referenced by BKE_pbvh_bmesh_after_stroke().
|
static |
Definition at line 201 of file pbvh_bmesh.c.
References BB_expand(), BB_reset(), BKE_pbvh_node_fully_hidden_set(), BKE_pbvh_node_mark_rebuild_draw(), BLI_assert, BLI_gset_add(), BLI_gset_haskey(), BLI_gset_insert(), BLI_gset_ptr_new(), BLI_gsetIterator_getKey(), BM_ELEM_CD_GET_INT, BM_ELEM_CD_SET_INT, BM_elem_flag_test, BM_ELEM_HIDDEN, BM_FACE_FIRST_LOOP, PBVHNode::bm_faces, PBVHNode::bm_other_verts, PBVHNode::bm_unique_verts, BB::bmax, BB::bmin, BMVert::co, DYNTOPO_NODE_NONE, PBVHNode::flag, GSET_ITER, BMLoop::next, PBVH::nodes, PBVHNode::orig_vb, PBVH_UpdateNormals, BMLoop::v, v, and PBVHNode::vb.
Referenced by pbvh_bmesh_node_split().
| BLI_INLINE PBVHNode* pbvh_bmesh_node_from_face | ( | PBVH * | pbvh, |
| const BMFace * | key | ||
| ) |
Definition at line 483 of file pbvh_bmesh.c.
References PBVH::nodes, and pbvh_bmesh_node_index_from_face().
Referenced by pbvh_bmesh_collapse_edge(), pbvh_bmesh_face_remove(), pbvh_bmesh_node_vert_use_count_at_most(), and pbvh_bmesh_vert_other_node_find().
| BLI_INLINE PBVHNode* pbvh_bmesh_node_from_vert | ( | PBVH * | pbvh, |
| const BMVert * | key | ||
| ) |
Definition at line 478 of file pbvh_bmesh.c.
References PBVH::nodes, and pbvh_bmesh_node_index_from_vert().
Referenced by pbvh_bmesh_vert_other_node_find(), pbvh_bmesh_vert_ownership_transfer(), and pbvh_bmesh_vert_remove().
| BLI_INLINE int pbvh_bmesh_node_index_from_face | ( | PBVH * | pbvh, |
| const BMFace * | key | ||
| ) |
Definition at line 470 of file pbvh_bmesh.c.
References BLI_assert, BM_ELEM_CD_GET_INT, PBVH::cd_face_node_offset, and DYNTOPO_NODE_NONE.
Referenced by pbvh_bmesh_node_from_face(), and pbvh_bmesh_vert_remove().
| BLI_INLINE int pbvh_bmesh_node_index_from_vert | ( | PBVH * | pbvh, |
| const BMVert * | key | ||
| ) |
Definition at line 462 of file pbvh_bmesh.c.
References BLI_assert, BM_ELEM_CD_GET_INT, PBVH::cd_vert_node_offset, and DYNTOPO_NODE_NONE.
Referenced by pbvh_bmesh_node_from_vert().
|
static |
Definition at line 385 of file pbvh_bmesh.c.
References BB_expand(), BB_reset(), BBC_update_centroid(), BLI_gset_len(), BLI_gsetIterator_getKey(), PBVH::bm, BM_elem_index_set, BM_FACE, BM_FACE_FIRST_LOOP, PBVHNode::bm_faces, BMVert::co, BMesh::elem_index_dirty, GSET_ITER_INDEX, MEM_freeN, MEM_mallocN, BMLoop::next, PBVH::nodes, pbvh_bmesh_node_split(), and BMLoop::v.
Referenced by BKE_pbvh_bmesh_after_stroke().
|
static |
Recursively split the node if it exceeds the leaf_limit. This function is multi-thread-able since each invocation applies to a sub part of the arrays.
Definition at line 1694 of file pbvh_bmesh.c.
References BB_expand(), BB_reset(), BB_widest_axis(), BBC::bcentroid, BLI_assert, BLI_memarena_alloc(), BM_elem_index_get, BB::bmax, BB::bmin, FastNodeBuildInfo::child1, FastNodeBuildInfo::child2, PBVH::leaf_limit, node, NULL, FastNodeBuildInfo::start, and FastNodeBuildInfo::totface.
Referenced by BKE_pbvh_build_bmesh().
| 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 | ||
| ) |
Definition at line 1618 of file pbvh_bmesh.c.
References BLI_assert, BLI_gsetIterator_getKey(), BM_elem_flag_test, BM_ELEM_HIDDEN, BM_face_as_array_vert_tri(), GSET_ITER, BMFace::len, node, ray_face_nearest_tri(), and t.
Referenced by BKE_pbvh_node_find_nearest_to_ray().
| 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 | ||
| ) |
Definition at line 1510 of file pbvh_bmesh.c.
References BLI_assert, BLI_gsetIterator_getKey(), BM_elem_flag_test, BM_ELEM_HIDDEN, BM_elem_index_get, BM_face_as_array_vert_tri(), copy_v3_v3(), GSET_ITER, BMFace::len, len_squared_v3v3(), madd_v3_v3v3fl(), node, normal_tri_v3(), ray_face_intersection_tri(), and t.
Referenced by BKE_pbvh_node_raycast().
Definition at line 259 of file pbvh_bmesh.c.
References BB_expand(), BB_expand_with_bb(), BB_reset(), BB_widest_axis(), BBC::bcentroid, BLI_gset_free(), BLI_gset_insert(), BLI_gset_len(), BLI_gset_ptr_new_ex(), BLI_gset_remove(), BLI_gsetIterator_getKey(), BM_ELEM_CD_SET_INT, BM_elem_index_get, PBVHNode::bm_faces, PBVHNode::bm_other_verts, PBVHNode::bm_unique_verts, BB::bmax, BB::bmin, PBVH::cd_face_node_offset, PBVH::cd_vert_node_offset, PBVHNode::children_offset, PBVHNode::draw_buffers, DYNTOPO_NODE_NONE, PBVHNode::flag, GPU_pbvh_buffers_free(), GSET_ITER, PBVHNode::layer_disp, PBVH::leaf_limit, MEM_freeN, PBVH::nodes, NULL, PBVHNode::orig_vb, pbvh_bmesh_node_finalize(), pbvh_grow_nodes(), PBVH_Leaf, PBVH::totnode, v, and PBVHNode::vb.
Referenced by pbvh_bmesh_node_limit_ensure().
|
static |
Definition at line 565 of file pbvh_bmesh.c.
References BM_FACES_OF_VERT_ITER_BEGIN, BM_FACES_OF_VERT_ITER_END, count, node, pbvh_bmesh_node_from_face(), and v.
| void pbvh_bmesh_normals_update | ( | PBVHNode ** | nodes, |
| int | totnode | ||
| ) |
Definition at line 1659 of file pbvh_bmesh.c.
References BLI_gsetIterator_getKey(), BM_face_normal_update(), BM_vert_normal_update(), GSET_ITER, node, and PBVH_UpdateNormals.
Referenced by BKE_pbvh_update_normals().
|
static |
The 2 new faces created and assigned to f_new have their verts & edges shuffled around.
(v1, v2)(v1, v2, v3)
+ v3(v_opp)
/|\
/ | \
/ | \
e4/ | \ e3
/ |e5 \
/ | \
/ e1 | e2 \
+-------+-------+
v1 v4(v_new) v2
(first) (second)
v_tri=(v1, v4, v3), e_tri=(e1, e5, e4)v_tri=(v4, v2, v3), e_tri=(e2, e3, e5)Definition at line 1117 of file pbvh_bmesh.c.
References BLI_assert, BLI_buffer_at, BLI_gset_add(), BLI_gset_haskey(), PBVH::bm, BM_CREATE_NO_DOUBLE, BM_edge_create(), BM_edge_kill(), bm_edges_from_tri(), BM_EDGES_OF_VERT, BM_ELEM_CD_GET_FLOAT, BM_ELEM_CD_GET_INT, BM_ELEM_CD_SET_FLOAT, BM_face_kill(), BM_ITER_ELEM, PBVHNode::bm_other_verts, PBVHNode::bm_unique_verts, BM_vert_edge_count_is_over, EdgeQueueContext::cd_face_node_offset, EdgeQueueContext::cd_vert_mask_offset, EdgeQueueContext::cd_vert_node_offset, BMVert::co, BLI_Buffer::count, e, BMLoop::f, BMFace::len, long_edge_queue_edge_add(), long_edge_queue_face_add(), mid_v3_v3v3(), BMLoop::next, BMVert::no, PBVH::nodes, normalize_v3(), NULL, pbvh_bmesh_edge_loops(), pbvh_bmesh_face_create(), pbvh_bmesh_face_remove(), pbvh_bmesh_vert_create(), pbvh_bmesh_vert_ownership_transfer(), BMLoop::prev, BMLoop::v, v1, and v2.
Referenced by pbvh_bmesh_subdivide_long_edges().
|
static |
Definition at line 1235 of file pbvh_bmesh.c.
References BLI_assert, BLI_heapsimple_is_empty(), BLI_heapsimple_pop_min(), BLI_mempool_free(), BM_edge_exists(), BM_ELEM_CD_GET_INT, EdgeQueueContext::cd_vert_node_offset, BMVert::co, DYNTOPO_NODE_NONE, e, EDGE_QUEUE_DISABLE, EdgeQueue::heap, len_squared_v3v3(), EdgeQueue::limit_len_squared, NULL, pbvh_bmesh_split_edge(), EdgeQueueContext::pool, EdgeQueueContext::q, v1, and v2.
Referenced by BKE_pbvh_bmesh_update_topology().
|
static |
Definition at line 488 of file pbvh_bmesh.c.
References BLI_assert, BLI_gset_insert(), PBVH::bm, BM_CREATE_SKIP_CD, BM_ELEM_CD_SET_INT, PBVH::bm_log, BM_log_vert_added(), BM_vert_create(), PBVH::cd_vert_node_offset, copy_v3_v3(), CustomData_bmesh_set_default(), BMHeader::data, BMVert::head, BMVert::no, node, PBVH::nodes, NULL, PBVH_UpdateBB, PBVH_UpdateDrawBuffers, PBVH::totnode, v, and BMesh::vdata.
Referenced by pbvh_bmesh_split_edge().
Definition at line 588 of file pbvh_bmesh.c.
References BM_FACES_OF_VERT_ITER_BEGIN, BM_FACES_OF_VERT_ITER_END, NULL, pbvh_bmesh_node_from_face(), pbvh_bmesh_node_from_vert(), and v.
Referenced by pbvh_bmesh_face_remove().
|
static |
Definition at line 605 of file pbvh_bmesh.c.
References BLI_assert, BLI_gset_haskey(), BLI_gset_insert(), BLI_gset_remove(), BM_ELEM_CD_SET_INT, PBVHNode::bm_other_verts, PBVHNode::bm_unique_verts, PBVH::cd_vert_node_offset, PBVHNode::flag, PBVH::nodes, NULL, pbvh_bmesh_node_from_vert(), PBVH_UpdateBB, PBVH_UpdateDrawBuffers, and v.
Referenced by pbvh_bmesh_face_remove(), and pbvh_bmesh_split_edge().
Definition at line 626 of file pbvh_bmesh.c.
References BLI_assert, BLI_gset_haskey(), BLI_gset_remove(), BM_ELEM_CD_SET_INT, BM_FACES_OF_VERT_ITER_BEGIN, BM_FACES_OF_VERT_ITER_END, PBVHNode::bm_other_verts, PBVHNode::bm_unique_verts, PBVH::cd_vert_node_offset, DYNTOPO_NODE_NONE, PBVHNode::flag, PBVH::nodes, NULL, pbvh_bmesh_node_from_vert(), pbvh_bmesh_node_index_from_face(), PBVH_UpdateBB, PBVH_UpdateDrawBuffers, and v.
Referenced by pbvh_bmesh_collapse_edge().
|
static |
Definition at line 1065 of file pbvh_bmesh.c.
References BLI_gsetIterator_getKey(), BLI_heapsimple_new(), PBVH::bm_min_edge_len, center, EdgeQueue::center, EdgeQueue::center_proj, edge_queue_tri_in_circle(), EdgeQueue::edge_queue_tri_in_range, edge_queue_tri_in_sphere(), GSET_ITER, EdgeQueue::heap, EdgeQueue::limit_len, EdgeQueue::limit_len_squared, node, PBVH::nodes, PBVH_FullyHidden, PBVH_Leaf, PBVH_UpdateTopology, project_plane_normalized_v3_v3v3(), EdgeQueueContext::q, EdgeQueue::radius_squared, short_edge_queue_face_add(), PBVH::totnode, UNUSED_VARS, EdgeQueue::use_view_normal, and EdgeQueue::view_normal.
Referenced by BKE_pbvh_bmesh_update_topology().
|
static |
Definition at line 930 of file pbvh_bmesh.c.
References BM_edge_calc_length_squared(), e, edge_queue_insert(), and EDGE_QUEUE_TEST.
Referenced by short_edge_queue_face_add().
|
static |
Definition at line 971 of file pbvh_bmesh.c.
References BM_FACE_FIRST_LOOP, dot_v3v3(), BMLoop::e, EdgeQueue::edge_queue_tri_in_range, BMLoop::next, BMFace::no, EdgeQueueContext::q, short_edge_queue_edge_add(), EdgeQueue::use_view_normal, and EdgeQueue::view_normal.
Referenced by short_edge_queue_create().