|
Blender
V2.93
|
#include <math.h>#include <stdio.h>#include <string.h>#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_pointcloud_types.h"#include "BLI_linklist.h"#include "BLI_math.h"#include "BLI_threads.h"#include "BLI_utildefines.h"#include "BKE_bvhutils.h"#include "BKE_editmesh.h"#include "BKE_mesh.h"#include "BKE_mesh_runtime.h"#include "MEM_guardedalloc.h"Go to the source code of this file.
Classes | |
| struct | BVHCacheItem |
| struct | BVHCache |
Functions | |
| void | free_bvhtree_from_editmesh (struct BVHTreeFromEditMesh *data) |
| void | free_bvhtree_from_mesh (struct BVHTreeFromMesh *data) |
Local Callbacks | |
| float | bvhtree_ray_tri_intersection (const BVHTreeRay *ray, const float UNUSED(m_dist), const float v0[3], const float v1[3], const float v2[3]) |
| float | bvhtree_sphereray_tri_intersection (const BVHTreeRay *ray, float radius, const float m_dist, const float v0[3], const float v1[3], const float v2[3]) |
| static void | mesh_faces_nearest_point (void *userdata, int index, const float co[3], BVHTreeNearest *nearest) |
| static void | mesh_looptri_nearest_point (void *userdata, int index, const float co[3], BVHTreeNearest *nearest) |
| static void | editmesh_looptri_nearest_point (void *userdata, int index, const float co[3], BVHTreeNearest *nearest) |
| static void | mesh_faces_spherecast (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) |
| static void | mesh_looptri_spherecast (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) |
| static void | editmesh_looptri_spherecast (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) |
| static void | mesh_edges_nearest_point (void *userdata, int index, const float co[3], BVHTreeNearest *nearest) |
| static void | mesh_verts_spherecast_do (int index, const float v[3], const BVHTreeRay *ray, BVHTreeRayHit *hit) |
| static void | editmesh_verts_spherecast (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) |
| static void | mesh_verts_spherecast (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) |
| static void | mesh_edges_spherecast (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) |
Vertex Builder | |
| static BVHTree * | bvhtree_from_editmesh_verts_create_tree (float epsilon, int tree_type, int axis, BMEditMesh *em, const BLI_bitmap *verts_mask, int verts_num_active) |
| static BVHTree * | bvhtree_from_mesh_verts_create_tree (float epsilon, int tree_type, int axis, const MVert *vert, const int verts_num, const BLI_bitmap *verts_mask, int verts_num_active) |
| static void | bvhtree_from_mesh_verts_setup_data (BVHTreeFromMesh *data, BVHTree *tree, const bool is_cached, const MVert *vert, const bool vert_allocated) |
| BVHTree * | bvhtree_from_editmesh_verts_ex (BVHTreeFromEditMesh *data, BMEditMesh *em, const BLI_bitmap *verts_mask, int verts_num_active, float epsilon, int tree_type, int axis, const BVHCacheType bvh_cache_type, BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex) |
| BVHTree * | bvhtree_from_editmesh_verts (BVHTreeFromEditMesh *data, BMEditMesh *em, float epsilon, int tree_type, int axis) |
| BVHTree * | bvhtree_from_mesh_verts_ex (BVHTreeFromMesh *data, const MVert *vert, const int verts_num, const bool vert_allocated, const BLI_bitmap *verts_mask, int verts_num_active, float epsilon, int tree_type, int axis, const BVHCacheType bvh_cache_type, BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex) |
Edge Builder | |
| static BVHTree * | bvhtree_from_editmesh_edges_create_tree (float epsilon, int tree_type, int axis, BMEditMesh *em, const BLI_bitmap *edges_mask, int edges_num_active) |
| static BVHTree * | bvhtree_from_mesh_edges_create_tree (const MVert *vert, const MEdge *edge, const int edge_num, const BLI_bitmap *edges_mask, int edges_num_active, float epsilon, int tree_type, int axis) |
| static void | bvhtree_from_mesh_edges_setup_data (BVHTreeFromMesh *data, BVHTree *tree, const bool is_cached, const MVert *vert, const bool vert_allocated, const MEdge *edge, const bool edge_allocated) |
| BVHTree * | bvhtree_from_editmesh_edges_ex (BVHTreeFromEditMesh *data, BMEditMesh *em, const BLI_bitmap *edges_mask, int edges_num_active, float epsilon, int tree_type, int axis, const BVHCacheType bvh_cache_type, BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex) |
| BVHTree * | bvhtree_from_editmesh_edges (BVHTreeFromEditMesh *data, BMEditMesh *em, float epsilon, int tree_type, int axis) |
| BVHTree * | bvhtree_from_mesh_edges_ex (BVHTreeFromMesh *data, const MVert *vert, const bool vert_allocated, const MEdge *edge, const int edges_num, const bool edge_allocated, const BLI_bitmap *edges_mask, int edges_num_active, float epsilon, int tree_type, int axis, const BVHCacheType bvh_cache_type, BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex) |
Tessellated Face Builder | |
| static BVHTree * | bvhtree_from_mesh_faces_create_tree (float epsilon, int tree_type, int axis, const MVert *vert, const MFace *face, const int faces_num, const BLI_bitmap *faces_mask, int faces_num_active) |
| static void | bvhtree_from_mesh_faces_setup_data (BVHTreeFromMesh *data, BVHTree *tree, const bool is_cached, const MVert *vert, const bool vert_allocated, const MFace *face, const bool face_allocated) |
| BVHTree * | bvhtree_from_mesh_faces_ex (BVHTreeFromMesh *data, const MVert *vert, const bool vert_allocated, const MFace *face, const int numFaces, const bool face_allocated, const BLI_bitmap *faces_mask, int faces_num_active, float epsilon, int tree_type, int axis, const BVHCacheType bvh_cache_type, BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex) |
LoopTri Face Builder | |
| static BVHTree * | bvhtree_from_editmesh_looptri_create_tree (float epsilon, int tree_type, int axis, BMEditMesh *em, const BLI_bitmap *looptri_mask, int looptri_num_active) |
| static BVHTree * | bvhtree_from_mesh_looptri_create_tree (float epsilon, int tree_type, int axis, const MVert *vert, const MLoop *mloop, const MLoopTri *looptri, const int looptri_num, const BLI_bitmap *looptri_mask, int looptri_num_active) |
| static void | bvhtree_from_mesh_looptri_setup_data (BVHTreeFromMesh *data, BVHTree *tree, const bool is_cached, const MVert *vert, const bool vert_allocated, const MLoop *mloop, const bool loop_allocated, const MLoopTri *looptri, const bool looptri_allocated) |
| BVHTree * | bvhtree_from_editmesh_looptri_ex (BVHTreeFromEditMesh *data, BMEditMesh *em, const BLI_bitmap *looptri_mask, int looptri_num_active, float epsilon, int tree_type, int axis, const BVHCacheType bvh_cache_type, BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex) |
| BVHTree * | bvhtree_from_editmesh_looptri (BVHTreeFromEditMesh *data, BMEditMesh *em, float epsilon, int tree_type, int axis) |
| BVHTree * | bvhtree_from_mesh_looptri_ex (BVHTreeFromMesh *data, const struct MVert *vert, const bool vert_allocated, const struct MLoop *mloop, const bool loop_allocated, const struct MLoopTri *looptri, const int looptri_num, const bool looptri_allocated, const BLI_bitmap *looptri_mask, int looptri_num_active, float epsilon, int tree_type, int axis, const BVHCacheType bvh_cache_type, BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex) |
| static BLI_bitmap * | loose_verts_map_get (const MEdge *medge, int edges_num, const MVert *UNUSED(mvert), int verts_num, int *r_loose_vert_num) |
| static BLI_bitmap * | loose_edges_map_get (const MEdge *medge, const int edges_len, int *r_loose_edge_len) |
| static BLI_bitmap * | looptri_no_hidden_map_get (const MPoly *mpoly, const int looptri_len, int *r_looptri_active_len) |
| BVHTree * | BKE_bvhtree_from_mesh_get (struct BVHTreeFromMesh *data, struct Mesh *mesh, const BVHCacheType bvh_cache_type, const int tree_type) |
| BVHTree * | BKE_bvhtree_from_editmesh_get (BVHTreeFromEditMesh *data, struct BMEditMesh *em, const int tree_type, const BVHCacheType bvh_cache_type, BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex) |
Point Cloud BVH Building | |
| BVHTree * | BKE_bvhtree_from_pointcloud_get (BVHTreeFromPointCloud *data, const PointCloud *pointcloud, const int tree_type) |
| void | free_bvhtree_from_pointcloud (BVHTreeFromPointCloud *data) |
BVHCache | |
| typedef struct BVHCacheItem | BVHCacheItem |
| typedef struct BVHCache | BVHCache |
| static bool | bvhcache_find (BVHCache **bvh_cache_p, BVHCacheType type, BVHTree **r_tree, bool *r_locked, ThreadMutex *mesh_eval_mutex) |
| static void | bvhcache_unlock (BVHCache *bvh_cache, bool lock_started) |
| bool | bvhcache_has_tree (const BVHCache *bvh_cache, const BVHTree *tree) |
| BVHCache * | bvhcache_init (void) |
| static void | bvhcache_insert (BVHCache *bvh_cache, BVHTree *tree, BVHCacheType type) |
| void | bvhcache_free (BVHCache *bvh_cache) |
| typedef struct BVHCacheItem BVHCacheItem |
| BVHTree* BKE_bvhtree_from_editmesh_get | ( | BVHTreeFromEditMesh * | data, |
| struct BMEditMesh * | em, | ||
| const int | tree_type, | ||
| const BVHCacheType | bvh_cache_type, | ||
| BVHCache ** | bvh_cache_p, | ||
| ThreadMutex * | mesh_eval_mutex | ||
| ) |
Builds or queries a bvhcache for the cache bvhtree of the request type.
Definition at line 1599 of file bvhutils.c.
References BLI_assert, BLI_bvhtree_get_tree_type(), bvhcache_find(), BVHTREE_FROM_EDGES, bvhtree_from_editmesh_edges_ex(), bvhtree_from_editmesh_looptri_ex(), bvhtree_from_editmesh_verts_ex(), BVHTREE_FROM_EM_EDGES, BVHTREE_FROM_EM_LOOPTRI, BVHTREE_FROM_EM_VERTS, BVHTREE_FROM_FACES, BVHTREE_FROM_LOOPTRI, BVHTREE_FROM_LOOPTRI_NO_HIDDEN, BVHTREE_FROM_LOOSEEDGES, BVHTREE_FROM_LOOSEVERTS, BVHTREE_FROM_VERTS, BVHTREE_MAX_ITEM, data, editmesh_looptri_nearest_point(), editmesh_looptri_spherecast(), editmesh_verts_spherecast(), free_bvhtree_from_editmesh(), NULL, and tree.
Referenced by raycastEditMesh(), and snapEditMesh().
| BVHTree* BKE_bvhtree_from_mesh_get | ( | struct BVHTreeFromMesh * | data, |
| struct Mesh * | mesh, | ||
| const BVHCacheType | bvh_cache_type, | ||
| const int | tree_type | ||
| ) |
Builds or queries a bvhcache for the cache bvhtree of the request type.
Definition at line 1413 of file bvhutils.c.
References BKE_mesh_runtime_looptri_ensure(), BKE_mesh_runtime_looptri_len(), BLI_assert, BLI_bvhtree_get_tree_type(), Mesh_Runtime::bvh_cache, bvhcache_find(), BVHTREE_FROM_EDGES, BVHTREE_FROM_EM_EDGES, BVHTREE_FROM_EM_LOOPTRI, BVHTREE_FROM_EM_VERTS, BVHTREE_FROM_FACES, BVHTREE_FROM_LOOPTRI, BVHTREE_FROM_LOOPTRI_NO_HIDDEN, BVHTREE_FROM_LOOSEEDGES, BVHTREE_FROM_LOOSEVERTS, bvhtree_from_mesh_edges_ex(), bvhtree_from_mesh_edges_setup_data(), bvhtree_from_mesh_faces_ex(), bvhtree_from_mesh_faces_setup_data(), bvhtree_from_mesh_looptri_ex(), bvhtree_from_mesh_looptri_setup_data(), bvhtree_from_mesh_verts_ex(), bvhtree_from_mesh_verts_setup_data(), BVHTREE_FROM_VERTS, BVHTREE_MAX_ITEM, data, Mesh_Runtime::eval_mutex, free_bvhtree_from_mesh(), looptri_no_hidden_map_get(), loose_edges_map_get(), loose_verts_map_get(), Mesh::medge, MEM_freeN, mesh, Mesh::mface, Mesh::mloop, Mesh::mpoly, Mesh::mvert, NULL, Mesh::runtime, Mesh::totedge, Mesh::totface, Mesh::totpoly, Mesh::totvert, and tree.
Referenced by BKE_mesh_remap_calc_difference_from_mesh(), BKE_mesh_remap_calc_edges_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_mesh_remap_calc_polys_from_mesh(), BKE_mesh_remap_calc_verts_from_mesh(), BKE_mesh_remesh_reproject_paint_mask(), BKE_remesh_reproject_sculpt_face_sets(), BKE_remesh_reproject_vertex_paint(), BKE_shrinkwrap_init_tree(), blender::nodes::bvh_from_mesh(), cloth_build_springs(), deformVerts(), dynamicPaint_paintMesh(), followtrack_project_to_depth_object_if_needed(), get_vert2geom_distance(), harmonic_coordinates_bind(), PE_create_shape_tree(), raycastMesh(), RE_bake_pixels_populate_from_objects(), remap_hair_emitter(), snapMesh(), statvis_calc_intersect(), statvis_calc_thickness(), and surfacedeformBind().
| BVHTree* BKE_bvhtree_from_pointcloud_get | ( | BVHTreeFromPointCloud * | data, |
| const PointCloud * | pointcloud, | ||
| const int | tree_type | ||
| ) |
Definition at line 1732 of file bvhutils.c.
References BLI_assert, BLI_bvhtree_balance(), BLI_bvhtree_get_len(), BLI_bvhtree_insert(), BLI_bvhtree_new(), PointCloud::co, data, NULL, PointCloud::totpoint, and tree.
|
static |
Queries a bvhcache for the cache bvhtree of the request type
When the r_locked is filled and the tree could not be found the caches mutex will be locked. This mutex can be unlocked by calling bvhcache_unlock.
When r_locked is used the mesh_eval_mutex must contain the Mesh_Runtime.eval_mutex.
Definition at line 66 of file bvhutils.c.
References BLI_mutex_lock(), BLI_mutex_unlock(), bvhcache_init(), BVHCacheItem::is_filled, BVHCache::items, BVHCache::mutex, NULL, BVHCacheItem::tree, and type.
Referenced by BKE_bvhtree_from_editmesh_get(), BKE_bvhtree_from_mesh_get(), bvhtree_from_editmesh_edges_ex(), bvhtree_from_editmesh_looptri_ex(), bvhtree_from_editmesh_verts_ex(), bvhtree_from_mesh_edges_ex(), bvhtree_from_mesh_faces_ex(), bvhtree_from_mesh_looptri_ex(), and bvhtree_from_mesh_verts_ex().
| void bvhcache_free | ( | BVHCache * | bvh_cache | ) |
frees a bvhcache
Definition at line 152 of file bvhutils.c.
References BLI_bvhtree_free(), BLI_mutex_end(), BVHTREE_MAX_ITEM, BVHCache::items, MEM_freeN, BVHCache::mutex, NULL, and BVHCacheItem::tree.
Referenced by BKE_mesh_runtime_clear_geometry().
Definition at line 113 of file bvhutils.c.
References BVHTREE_MAX_ITEM, BVHCache::items, NULL, BVHCacheItem::tree, and tree.
| BVHCache* bvhcache_init | ( | void | ) |
Definition at line 127 of file bvhutils.c.
References BLI_mutex_init(), MEM_callocN, and BVHCache::mutex.
Referenced by bvhcache_find().
|
static |
Inserts a BVHTree of the given type under the cache After that the caller no longer needs to worry when to free the BVHTree as that will be done when the cache is freed.
A call to this assumes that there was no previous cached tree of the given type
Definition at line 141 of file bvhutils.c.
References BLI_assert, BVHCacheItem::is_filled, BVHCache::items, BVHCacheItem::tree, tree, and type.
Referenced by bvhtree_from_editmesh_edges_ex(), bvhtree_from_editmesh_looptri_ex(), bvhtree_from_editmesh_verts_ex(), bvhtree_from_mesh_edges_ex(), bvhtree_from_mesh_faces_ex(), bvhtree_from_mesh_looptri_ex(), and bvhtree_from_mesh_verts_ex().
|
static |
Definition at line 106 of file bvhutils.c.
References BLI_mutex_unlock(), and BVHCache::mutex.
Referenced by bvhtree_from_editmesh_edges_ex(), bvhtree_from_editmesh_looptri_ex(), bvhtree_from_editmesh_verts_ex(), bvhtree_from_mesh_edges_ex(), bvhtree_from_mesh_faces_ex(), bvhtree_from_mesh_looptri_ex(), and bvhtree_from_mesh_verts_ex().
| BVHTree* bvhtree_from_editmesh_edges | ( | BVHTreeFromEditMesh * | data, |
| BMEditMesh * | em, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis | ||
| ) |
Definition at line 889 of file bvhutils.c.
References bvhtree_from_editmesh_edges_ex(), data, blender::robust_pred::epsilon, and NULL.
|
static |
Definition at line 740 of file bvhutils.c.
References BLI_assert, BLI_BITMAP_TEST_BOOL, BLI_bvhtree_balance(), BLI_bvhtree_get_len(), BLI_bvhtree_insert(), BLI_bvhtree_new(), BMEditMesh::bm, BM_EDGE, BM_EDGES_OF_MESH, BM_ITER_MESH_INDEX, BM_mesh_elem_table_ensure(), BMVert::co, copy_v3_v3(), blender::robust_pred::epsilon, IN_RANGE_INCL, BMesh::totedge, tree, BMEdge::v1, and BMEdge::v2.
Referenced by bvhtree_from_editmesh_edges_ex().
| BVHTree* bvhtree_from_editmesh_edges_ex | ( | BVHTreeFromEditMesh * | data, |
| BMEditMesh * | em, | ||
| const BLI_bitmap * | edges_mask, | ||
| int | edges_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis, | ||
| const BVHCacheType | bvh_cache_type, | ||
| BVHCache ** | bvh_cache_p, | ||
| ThreadMutex * | mesh_eval_mutex | ||
| ) |
Definition at line 843 of file bvhutils.c.
References bvhcache_find(), bvhcache_insert(), bvhcache_unlock(), bvhtree_from_editmesh_edges_create_tree(), data, blender::robust_pred::epsilon, NULL, and tree.
Referenced by BKE_bvhtree_from_editmesh_get(), bvhtree_from_editmesh_edges(), and snapEditMesh().
| BVHTree* bvhtree_from_editmesh_looptri | ( | BVHTreeFromEditMesh * | data, |
| BMEditMesh * | em, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis | ||
| ) |
Definition at line 1258 of file bvhutils.c.
References bvhtree_from_editmesh_looptri_ex(), data, blender::robust_pred::epsilon, and NULL.
|
static |
Definition at line 1087 of file bvhutils.c.
References BLI_assert, BLI_BITMAP_TEST_BOOL, BLI_bvhtree_balance(), BLI_bvhtree_get_len(), BLI_bvhtree_insert(), BLI_bvhtree_new(), BMVert::co, copy_v3_v3(), blender::robust_pred::epsilon, IN_RANGE_INCL, insert(), BMEditMesh::looptris, NULL, BMEditMesh::tottri, tree, and v.
Referenced by bvhtree_from_editmesh_looptri_ex().
| BVHTree* bvhtree_from_editmesh_looptri_ex | ( | BVHTreeFromEditMesh * | data, |
| BMEditMesh * | em, | ||
| const BLI_bitmap * | looptri_mask, | ||
| int | looptri_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis, | ||
| const BVHCacheType | bvh_cache_type, | ||
| BVHCache ** | bvh_cache_p, | ||
| ThreadMutex * | mesh_eval_mutex | ||
| ) |
Builds a bvh tree where nodes are the looptri faces of the given bm
Definition at line 1212 of file bvhutils.c.
References bvhcache_find(), bvhcache_insert(), bvhcache_unlock(), bvhtree_from_editmesh_looptri_create_tree(), data, editmesh_looptri_nearest_point(), editmesh_looptri_spherecast(), blender::robust_pred::epsilon, NULL, and tree.
Referenced by BKE_bvhtree_from_editmesh_get(), bvhtree_from_editmesh_looptri(), and raycastEditMesh().
| BVHTree* bvhtree_from_editmesh_verts | ( | BVHTreeFromEditMesh * | data, |
| struct BMEditMesh * | em, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis | ||
| ) |
Builds a bvh tree where nodes are the relevant elements of the given mesh. Configures BVHTreeFromMesh.
The tree is build in mesh space coordinates, this means special care must be made on queries so that the coordinates and rays are first translated on the mesh local coordinates. Reason for this is that bvh_from_mesh_* can use a cache in some cases and so it becomes possible to reuse a BVHTree.
free_bvhtree_from_mesh should be called when the tree is no longer needed.
Definition at line 677 of file bvhutils.c.
References bvhtree_from_editmesh_verts_ex(), data, blender::robust_pred::epsilon, and NULL.
|
static |
Definition at line 542 of file bvhutils.c.
References BLI_assert, BLI_BITMAP_TEST_BOOL, BLI_bvhtree_balance(), BLI_bvhtree_get_len(), BLI_bvhtree_insert(), BLI_bvhtree_new(), BMEditMesh::bm, BM_mesh_elem_table_ensure(), BM_VERT, BM_vert_at_index(), BMVert::co, blender::robust_pred::epsilon, IN_RANGE_INCL, BMesh::totvert, and tree.
Referenced by bvhtree_from_editmesh_verts_ex().
| BVHTree* bvhtree_from_editmesh_verts_ex | ( | BVHTreeFromEditMesh * | data, |
| BMEditMesh * | em, | ||
| const BLI_bitmap * | verts_mask, | ||
| int | verts_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis, | ||
| const BVHCacheType | bvh_cache_type, | ||
| BVHCache ** | bvh_cache_p, | ||
| ThreadMutex * | mesh_eval_mutex | ||
| ) |
Definition at line 631 of file bvhutils.c.
References bvhcache_find(), bvhcache_insert(), bvhcache_unlock(), bvhtree_from_editmesh_verts_create_tree(), data, editmesh_verts_spherecast(), blender::robust_pred::epsilon, NULL, and tree.
Referenced by BKE_bvhtree_from_editmesh_get(), bvhtree_from_editmesh_verts(), and snapEditMesh().
|
static |
Definition at line 780 of file bvhutils.c.
References BLI_assert, BLI_BITMAP_TEST_BOOL, BLI_bvhtree_balance(), BLI_bvhtree_insert(), BLI_bvhtree_new(), copy_v3_v3(), blender::robust_pred::epsilon, IN_RANGE_INCL, NULL, tree, v1, and v2.
Referenced by bvhtree_from_mesh_edges_ex().
| BVHTree* bvhtree_from_mesh_edges_ex | ( | BVHTreeFromMesh * | data, |
| const MVert * | vert, | ||
| const bool | vert_allocated, | ||
| const MEdge * | edge, | ||
| const int | edges_num, | ||
| const bool | edge_allocated, | ||
| const BLI_bitmap * | edges_mask, | ||
| int | edges_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis, | ||
| const BVHCacheType | bvh_cache_type, | ||
| BVHCache ** | bvh_cache_p, | ||
| ThreadMutex * | mesh_eval_mutex | ||
| ) |
Builds a bvh tree where nodes are the given edges .
| vert,vert_allocated | if true, elem freeing will be done when freeing data. |
| edge,edge_allocated | if true, elem freeing will be done when freeing data. |
| edges_mask | if not null, true elements give which vert to add to BVH tree. |
| edges_num_active | if >= 0, number of active edges to add to BVH tree (else will be computed from mask). |
Definition at line 904 of file bvhutils.c.
References bvhcache_find(), bvhcache_insert(), bvhcache_unlock(), bvhtree_from_mesh_edges_create_tree(), bvhtree_from_mesh_edges_setup_data(), data, blender::robust_pred::epsilon, NULL, and tree.
Referenced by BKE_bvhtree_from_mesh_get().
|
static |
Definition at line 819 of file bvhutils.c.
References data, mesh_edges_nearest_point(), mesh_edges_spherecast(), and tree.
Referenced by BKE_bvhtree_from_mesh_get(), and bvhtree_from_mesh_edges_ex().
|
static |
Definition at line 956 of file bvhutils.c.
References BLI_assert, BLI_BITMAP_TEST_BOOL, BLI_bvhtree_balance(), BLI_bvhtree_get_len(), BLI_bvhtree_insert(), BLI_bvhtree_new(), copy_v3_v3(), blender::robust_pred::epsilon, IN_RANGE_INCL, NULL, tree, v1, and v2.
Referenced by bvhtree_from_mesh_faces_ex().
| BVHTree* bvhtree_from_mesh_faces_ex | ( | BVHTreeFromMesh * | data, |
| const MVert * | vert, | ||
| const bool | vert_allocated, | ||
| const MFace * | face, | ||
| const int | numFaces, | ||
| const bool | face_allocated, | ||
| const BLI_bitmap * | faces_mask, | ||
| int | faces_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis, | ||
| const BVHCacheType | bvh_cache_type, | ||
| BVHCache ** | bvh_cache_p, | ||
| ThreadMutex * | mesh_eval_mutex | ||
| ) |
Builds a bvh tree where nodes are the given tessellated faces (note: does not copy given mfaces!).
| vert_allocated | if true, vert freeing will be done when freeing data. |
| face_allocated | if true, face freeing will be done when freeing data. |
| faces_mask | if not null, true elements give which faces to add to BVH tree. |
| faces_num_active | if >= 0, number of active faces to add to BVH tree (else will be computed from mask). |
Definition at line 1035 of file bvhutils.c.
References bvhcache_find(), bvhcache_insert(), bvhcache_unlock(), bvhtree_from_mesh_faces_create_tree(), bvhtree_from_mesh_faces_setup_data(), data, blender::robust_pred::epsilon, NULL, and tree.
Referenced by BKE_bvhtree_from_mesh_get().
|
static |
Definition at line 1004 of file bvhutils.c.
References data, mesh_faces_nearest_point(), mesh_faces_spherecast(), and tree.
Referenced by BKE_bvhtree_from_mesh_get(), and bvhtree_from_mesh_faces_ex().
|
static |
Definition at line 1137 of file bvhutils.c.
References BLI_assert, BLI_BITMAP_TEST_BOOL, BLI_bvhtree_balance(), BLI_bvhtree_get_len(), BLI_bvhtree_insert(), BLI_bvhtree_new(), copy_v3_v3(), blender::robust_pred::epsilon, IN_RANGE_INCL, NULL, tree, and v.
Referenced by bvhtree_from_mesh_looptri_ex().
| BVHTree* bvhtree_from_mesh_looptri_ex | ( | BVHTreeFromMesh * | data, |
| const struct MVert * | vert, | ||
| const bool | vert_allocated, | ||
| const struct MLoop * | mloop, | ||
| const bool | loop_allocated, | ||
| const struct MLoopTri * | looptri, | ||
| const int | looptri_num, | ||
| const bool | looptri_allocated, | ||
| const BLI_bitmap * | looptri_mask, | ||
| int | looptri_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis, | ||
| const BVHCacheType | bvh_cache_type, | ||
| BVHCache ** | bvh_cache_p, | ||
| ThreadMutex * | mesh_eval_mutex | ||
| ) |
Builds a bvh tree where nodes are the looptri faces of the given dm
Definition at line 1270 of file bvhutils.c.
References bvhcache_find(), bvhcache_insert(), bvhcache_unlock(), bvhtree_from_mesh_looptri_create_tree(), bvhtree_from_mesh_looptri_setup_data(), data, blender::robust_pred::epsilon, NULL, and tree.
Referenced by BKE_bvhtree_from_mesh_get(), and BKE_mesh_remap_calc_loops_from_mesh().
|
static |
Definition at line 1183 of file bvhutils.c.
References data, mesh_looptri_nearest_point(), mesh_looptri_spherecast(), and tree.
Referenced by BKE_bvhtree_from_mesh_get(), and bvhtree_from_mesh_looptri_ex().
|
static |
Definition at line 575 of file bvhutils.c.
References BLI_assert, BLI_BITMAP_TEST_BOOL, BLI_bvhtree_balance(), BLI_bvhtree_get_len(), BLI_bvhtree_insert(), BLI_bvhtree_new(), blender::robust_pred::epsilon, IN_RANGE_INCL, NULL, and tree.
Referenced by bvhtree_from_mesh_verts_ex().
| BVHTree* bvhtree_from_mesh_verts_ex | ( | BVHTreeFromMesh * | data, |
| const MVert * | vert, | ||
| const int | verts_num, | ||
| const bool | vert_allocated, | ||
| const BLI_bitmap * | verts_mask, | ||
| int | verts_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis, | ||
| const BVHCacheType | bvh_cache_type, | ||
| BVHCache ** | bvh_cache_p, | ||
| ThreadMutex * | mesh_eval_mutex | ||
| ) |
Builds a bvh tree where nodes are the given vertices (note: does not copy given mverts!).
| vert_allocated | if true, vert freeing will be done when freeing data. |
| verts_mask | if not null, true elements give which vert to add to BVH tree. |
| verts_num_active | if >= 0, number of active verts to add to BVH tree (else will be computed from mask). |
Definition at line 691 of file bvhutils.c.
References bvhcache_find(), bvhcache_insert(), bvhcache_unlock(), bvhtree_from_mesh_verts_create_tree(), bvhtree_from_mesh_verts_setup_data(), data, blender::robust_pred::epsilon, NULL, and tree.
Referenced by BKE_bvhtree_from_mesh_get().
|
static |
Definition at line 610 of file bvhutils.c.
References data, mesh_verts_spherecast(), NULL, and tree.
Referenced by BKE_bvhtree_from_mesh_get(), and bvhtree_from_mesh_verts_ex().
| float bvhtree_ray_tri_intersection | ( | const BVHTreeRay * | ray, |
| const float | UNUSEDm_dist, | ||
| const float | v0[3], | ||
| const float | v1[3], | ||
| const float | v2[3] | ||
| ) |
Definition at line 170 of file bvhutils.c.
References BVHTreeRay::direction, BVHTreeRay::isect_precalc, isect_ray_tri_epsilon_v3(), isect_ray_tri_watertight_v3(), NULL, BVHTreeRay::origin, v1, and v2.
Referenced by editmesh_looptri_spherecast(), mesh_faces_spherecast(), and mesh_looptri_spherecast().
| float bvhtree_sphereray_tri_intersection | ( | const BVHTreeRay * | ray, |
| float | radius, | ||
| const float | m_dist, | ||
| const float | v0[3], | ||
| const float | v1[3], | ||
| const float | v2[3] | ||
| ) |
Definition at line 190 of file bvhutils.c.
References BVHTreeRay::direction, isect_sweeping_sphere_tri_v3(), madd_v3_v3v3fl(), BVHTreeRay::origin, v1, and v2.
Referenced by editmesh_looptri_spherecast(), mesh_faces_spherecast(), and mesh_looptri_spherecast().
|
static |
Definition at line 277 of file bvhutils.c.
References closest_on_tri_to_point_v3(), BVHTreeNearest::co, BMVert::co, copy_v3_v3(), data, BVHTreeNearest::dist_sq, BVHTreeNearest::index, len_squared_v3v3(), BMEditMesh::looptris, BVHTreeNearest::no, normal_tri_v3(), and BMLoop::v.
Referenced by BKE_bvhtree_from_editmesh_get(), and bvhtree_from_editmesh_looptri_ex().
|
static |
Definition at line 378 of file bvhutils.c.
References bvhtree_ray_tri_intersection(), bvhtree_sphereray_tri_intersection(), BVHTreeRayHit::co, BMVert::co, data, BVHTreeRay::direction, BVHTreeRayHit::dist, if(), BVHTreeRayHit::index, BMEditMesh::looptris, madd_v3_v3v3fl(), BVHTreeRayHit::no, normal_tri_v3(), BVHTreeRay::origin, BVHTreeRay::radius, and BMLoop::v.
Referenced by BKE_bvhtree_from_editmesh_get(), and bvhtree_from_editmesh_looptri_ex().
|
static |
Definition at line 461 of file bvhutils.c.
References BM_vert_at_index(), BMVert::co, data, and mesh_verts_spherecast_do().
Referenced by BKE_bvhtree_from_editmesh_get(), and bvhtree_from_editmesh_verts_ex().
| void free_bvhtree_from_editmesh | ( | struct BVHTreeFromEditMesh * | data | ) |
Frees data allocated by a call to bvhtree_from_mesh_*.
Definition at line 1690 of file bvhutils.c.
References BLI_bvhtree_free(), and data.
Referenced by BKE_bvhtree_from_editmesh_get(), and snap_object_data_editmesh_clear().
| void free_bvhtree_from_mesh | ( | struct BVHTreeFromMesh * | data | ) |
Definition at line 1701 of file bvhutils.c.
References BLI_bvhtree_free(), data, and MEM_freeN.
Referenced by blender::nodes::attribute_calc_proximity(), BKE_bvhtree_from_mesh_get(), BKE_mesh_remap_calc_edges_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_mesh_remap_calc_polys_from_mesh(), BKE_mesh_remap_calc_verts_from_mesh(), BKE_mesh_remesh_reproject_paint_mask(), BKE_remesh_reproject_sculpt_face_sets(), BKE_remesh_reproject_vertex_paint(), BKE_shrinkwrap_free_tree(), cloth_build_springs(), deformVerts(), dynamicPaint_paintMesh(), followtrack_project_to_depth_object_if_needed(), freeData(), get_vert2geom_distance(), harmonic_coordinates_bind(), PE_free_shape_tree(), raycastMesh(), RE_bake_pixels_populate_from_objects(), remap_hair_emitter(), snap_object_data_mesh_clear(), snapMesh(), surfacedeformBind(), and weldModifier_doWeld().
| void free_bvhtree_from_pointcloud | ( | BVHTreeFromPointCloud * | data | ) |
Definition at line 1754 of file bvhutils.c.
References BLI_bvhtree_free(), and data.
Referenced by blender::nodes::attribute_calc_proximity().
|
static |
Definition at line 1381 of file bvhutils.c.
References BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, MPoly::flag, ME_HIDE, and MPoly::totloop.
Referenced by BKE_bvhtree_from_mesh_get().
|
static |
Definition at line 1358 of file bvhutils.c.
References BLI_BITMAP_DISABLE, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, e, and ME_LOOSEEDGE.
Referenced by BKE_bvhtree_from_mesh_get().
|
static |
Definition at line 1331 of file bvhutils.c.
References BLI_BITMAP_DISABLE, BLI_BITMAP_NEW, BLI_bitmap_set_all(), BLI_BITMAP_TEST, and e.
Referenced by BKE_bvhtree_from_mesh_get().
|
static |
Definition at line 413 of file bvhutils.c.
References closest_to_line_segment_v3(), BVHTreeNearest::co, MVert::co, copy_v3_v3(), data, BVHTreeNearest::dist_sq, BVHTreeNearest::index, len_squared_v3v3(), BVHTreeNearest::no, normalize_v3(), sub_v3_v3v3(), MEdge::v1, and MEdge::v2.
Referenced by bvhtree_from_mesh_edges_setup_data().
|
static |
Definition at line 487 of file bvhutils.c.
References add_v3_v3v3(), BVHTreeRayHit::co, MVert::co, copy_v3_v3(), data, BVHTreeRay::direction, BVHTreeRayHit::dist, dot_v3v3v3(), equals_v3v3(), i1, BVHTreeRayHit::index, isect_line_line_v3(), len_squared_v3v3(), len_v3v3(), line_point_factor_v3(), mesh_verts_spherecast_do(), BVHTreeRay::origin, BVHTreeRay::radius, square_f(), v1, MEdge::v1, v2, and MEdge::v2.
Referenced by bvhtree_from_mesh_edges_setup_data().
|
static |
Definition at line 216 of file bvhutils.c.
References closest_on_tri_to_point_v3(), BVHTreeNearest::co, MVert::co, copy_v3_v3(), data, BVHTreeNearest::dist_sq, BVHTreeNearest::index, len_squared_v3v3(), BVHTreeNearest::no, normal_tri_v3(), NULL, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by bvhtree_from_mesh_faces_setup_data().
|
static |
Definition at line 308 of file bvhutils.c.
References bvhtree_ray_tri_intersection(), bvhtree_sphereray_tri_intersection(), BVHTreeRayHit::co, MVert::co, data, BVHTreeRay::direction, BVHTreeRayHit::dist, BVHTreeRayHit::index, madd_v3_v3v3fl(), BVHTreeRayHit::no, normal_tri_v3(), NULL, BVHTreeRay::origin, BVHTreeRay::radius, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by bvhtree_from_mesh_faces_setup_data().
|
static |
Definition at line 251 of file bvhutils.c.
References closest_on_tri_to_point_v3(), BVHTreeNearest::co, MVert::co, copy_v3_v3(), data, BVHTreeNearest::dist_sq, BVHTreeNearest::index, len_squared_v3v3(), BVHTreeNearest::no, normal_tri_v3(), MLoopTri::tri, and UNPACK3.
Referenced by bvhtree_from_mesh_looptri_setup_data().
|
static |
Definition at line 347 of file bvhutils.c.
References bvhtree_ray_tri_intersection(), bvhtree_sphereray_tri_intersection(), BVHTreeRayHit::co, MVert::co, data, BVHTreeRay::direction, BVHTreeRayHit::dist, BVHTreeRayHit::index, madd_v3_v3v3fl(), BVHTreeRayHit::no, normal_tri_v3(), BVHTreeRay::origin, BVHTreeRay::radius, MLoopTri::tri, and UNPACK3.
Referenced by bvhtree_from_mesh_looptri_setup_data().
|
static |
Definition at line 474 of file bvhutils.c.
References data, mesh_verts_spherecast_do(), and v.
Referenced by bvhtree_from_mesh_verts_setup_data().
|
static |
Definition at line 440 of file bvhutils.c.
References add_v3_v3v3(), closest_to_line_segment_v3(), BVHTreeRayHit::co, copy_v3_v3(), BVHTreeRay::direction, BVHTreeRayHit::dist, dot_v3v3v3(), i1, BVHTreeRayHit::index, len_v3v3(), BVHTreeRay::origin, and v.
Referenced by editmesh_verts_spherecast(), mesh_edges_spherecast(), and mesh_verts_spherecast().