|
Blender V4.3
|
#include <mutex>#include "BLI_bit_span.hh"#include "BLI_index_mask_fwd.hh"#include "BLI_kdopbvh.h"#include "BLI_math_vector_types.hh"#include "BLI_span.hh"Go to the source code of this file.
Classes | |
| struct | BVHTreeFromMesh |
| struct | BVHTreeFromPointCloud |
This header encapsulates necessary code to build a BVH.
Definition in file BKE_bvhutils.hh.
| enum BVHCacheType |
Definition at line 48 of file BKE_bvhutils.hh.
| void BKE_bvhtree_from_mesh_edges_init | ( | const Mesh & | mesh, |
| const blender::IndexMask & | edges_mask, | ||
| BVHTreeFromMesh & | r_data ) |
Build a bvh tree containing the given edges.
Definition at line 1086 of file bvhutils.cc.
References BKE_bvhtree_from_mesh_get(), BLI_bvhtree_balance(), BLI_bvhtree_insert(), BVHTREE_FROM_EDGES, bvhtree_from_mesh_setup_data(), bvhtree_new_common(), copy_v3_v3(), blender::index_mask::IndexMask::foreach_index(), blender::index_mask::IndexMask::size(), BVHTreeFromMesh::tree, and tree.
Referenced by blender::nodes::node_geo_proximity_cc::ProximityFunction::init_for_mesh().
| BVHTree * BKE_bvhtree_from_mesh_get | ( | BVHTreeFromMesh * | data, |
| const Mesh * | mesh, | ||
| BVHCacheType | bvh_cache_type, | ||
| int | tree_type ) |
Builds or queries a BVH-cache for the cache BVH-tree of the request type.
Definition at line 899 of file bvhutils.cc.
References BLI_assert, BLI_assert_unreachable, BLI_bvhtree_get_tree_type(), bvhcache_find(), bvhcache_insert(), bvhcache_unlock(), bvhtree_balance(), BVHTREE_FROM_CORNER_TRIS, BVHTREE_FROM_CORNER_TRIS_NO_HIDDEN, BVHTREE_FROM_EDGES, BVHTREE_FROM_FACES, BVHTREE_FROM_LOOSEEDGES, BVHTREE_FROM_LOOSEEDGES_NO_HIDDEN, BVHTREE_FROM_LOOSEVERTS, BVHTREE_FROM_LOOSEVERTS_NO_HIDDEN, bvhtree_from_mesh_corner_tris_create_tree(), bvhtree_from_mesh_edges_create_tree(), bvhtree_from_mesh_faces_create_tree(), bvhtree_from_mesh_setup_data(), bvhtree_from_mesh_verts_create_tree(), BVHTREE_FROM_VERTS, BVHTREE_MAX_ITEM, CD_MFACE, corner_tris_no_hidden_map_get(), blender::bke::LooseGeomCache::count, CustomData_get_layer(), ELEM, blender::bke::LooseGeomCache::is_loose_bits, loose_edges_no_hidden_mask_get(), loose_verts_no_hidden_mask_get(), printf, and blender::Span< T >::size().
Referenced by BKE_bvhtree_from_mesh_edges_init(), BKE_bvhtree_from_mesh_tris_init(), BKE_bvhtree_from_mesh_verts_init(), BKE_mesh_remap_calc_difference_from_mesh(), BKE_mesh_remap_calc_edges_from_mesh(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_mesh_remap_calc_verts_from_mesh(), BKE_shrinkwrap_init_tree(), cloth_build_springs(), deform_verts(), dynamicPaint_paintMesh(), blender::ed::sculpt_paint::AddOperationExecutor::execute(), blender::ed::sculpt_paint::DensityAddOperationExecutor::execute(), blender::ed::sculpt_paint::DensitySubtractOperationExecutor::execute(), blender::ed::sculpt_paint::PuffOperationExecutor::execute(), blender::ed::sculpt_paint::SlideOperationExecutor::execute(), followtrack_project_to_depth_object_if_needed(), blender::nodes::node_geo_sample_nearest_cc::get_closest_mesh_edges(), blender::nodes::node_geo_sample_nearest_cc::get_closest_mesh_points(), blender::nodes::node_geo_sample_nearest_cc::get_closest_mesh_tris(), get_vert2geom_distance(), harmonic_coordinates_bind(), imapaint_pick_face(), blender::bke::mesh_remesh_reproject_attributes(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_invoke(), PE_create_shape_tree(), blender::nodes::node_geo_raycast_cc::raycast_to_mesh(), RE_bake_pixels_populate_from_objects(), remap_hair_emitter(), blender::ed::sculpt_paint::sample_curves_3d_brush(), blender::ed::curves::snap_curves_to_surface::snap_curves_to_surface_exec_object(), snap_object_data_mesh_get(), snapMesh(), blender::geometry::curve_constraints::solve_length_and_collision_constraints(), blender::draw::statvis_calc_intersect(), blender::draw::statvis_calc_thickness(), surfacedeformBind(), blender::ed::curves::convert_to_particle_system::try_convert_single_object(), and blender::ed::sculpt_paint::use_add_density_mode().
| void BKE_bvhtree_from_mesh_tris_init | ( | const Mesh & | mesh, |
| const blender::IndexMask & | faces_mask, | ||
| BVHTreeFromMesh & | r_data ) |
Build a bvh tree from the triangles in the mesh that correspond to the faces in the given mask.
Definition at line 1033 of file bvhutils.cc.
References BKE_bvhtree_from_mesh_get(), BLI_bvhtree_balance(), BLI_bvhtree_insert(), BVHTREE_FROM_CORNER_TRIS, bvhtree_from_mesh_setup_data(), bvhtree_new_common(), copy_v3_v3(), blender::index_mask::IndexMask::foreach_index(), blender::index_mask::IndexMask::size(), size(), BVHTreeFromMesh::tree, and tree.
Referenced by blender::nodes::node_geo_proximity_cc::ProximityFunction::init_for_mesh(), and blender::nodes::node_geo_sample_nearest_surface_cc::SampleNearestSurfaceFunction::SampleNearestSurfaceFunction().
| void BKE_bvhtree_from_mesh_verts_init | ( | const Mesh & | mesh, |
| const blender::IndexMask & | verts_mask, | ||
| BVHTreeFromMesh & | r_data ) |
Build a bvh tree containing the given vertices.
Definition at line 1122 of file bvhutils.cc.
References BKE_bvhtree_from_mesh_get(), BLI_bvhtree_balance(), BLI_bvhtree_insert(), bvhtree_from_mesh_setup_data(), BVHTREE_FROM_VERTS, bvhtree_new_common(), blender::index_mask::IndexMask::foreach_index(), blender::index_mask::IndexMask::size(), BVHTreeFromMesh::tree, and tree.
Referenced by blender::nodes::node_geo_proximity_cc::ProximityFunction::init_for_mesh().
| void BKE_bvhtree_from_pointcloud_get | ( | const PointCloud & | pointcloud, |
| const blender::IndexMask & | points_mask, | ||
| BVHTreeFromPointCloud & | r_data ) |
Definition at line 1175 of file bvhutils.cc.
References BLI_bvhtree_balance(), BLI_bvhtree_insert(), bvhtree_new_common(), BVHTreeFromPointCloud::coords, float, blender::index_mask::IndexMask::foreach_index(), BVHTreeFromPointCloud::nearest_callback, blender::index_mask::IndexMask::size(), BVHTreeFromPointCloud::tree, and tree.
Referenced by blender::nodes::node_geo_sample_nearest_cc::get_closest_pointcloud_points(), and blender::nodes::node_geo_proximity_cc::ProximityFunction::init_for_pointcloud().
| void bvhcache_free | ( | BVHCache * | bvh_cache | ) |
Frees a BVH-cache.
Definition at line 132 of file bvhutils.cc.
References BLI_bvhtree_free(), BLI_mutex_end(), BVHTREE_MAX_ITEM, BVHCache::items, MEM_freeN(), BVHCache::mutex, and BVHCacheItem::tree.
Referenced by blender::bke::free_bvh_cache().
Definition at line 96 of file bvhutils.cc.
References BVHTREE_MAX_ITEM, BVHCache::items, BVHCacheItem::tree, and tree.
| BVHCache * bvhcache_init | ( | ) |
Definition at line 110 of file bvhutils.cc.
References BLI_mutex_init(), and BVHCache::mutex.
Referenced by bvhcache_find().
| BVHTree * bvhtree_from_mesh_corner_tris_ex | ( | BVHTreeFromMesh * | data, |
| blender::Span< blender::float3 > | vert_positions, | ||
| blender::Span< int > | corner_verts, | ||
| blender::Span< blender::int3 > | corner_tris, | ||
| blender::BitSpan | corner_tris_mask, | ||
| int | corner_tris_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis ) |
Builds a BVH-tree where nodes are the triangle faces (#Mesh::corner_tris()) of the given mesh.
Referenced by BKE_mesh_remap_calc_loops_from_mesh().
| BVHTree * bvhtree_from_mesh_edges_ex | ( | BVHTreeFromMesh * | data, |
| blender::Span< blender::float3 > | vert_positions, | ||
| blender::Span< blender::int2 > | edges, | ||
| blender::BitSpan | edges_mask, | ||
| int | edges_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis ) |
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 edges_mask). |
| BVHTree * bvhtree_from_mesh_verts_ex | ( | BVHTreeFromMesh * | data, |
| blender::Span< blender::float3 > | vert_positions, | ||
| blender::BitSpan | verts_mask, | ||
| int | verts_num_active, | ||
| float | epsilon, | ||
| int | tree_type, | ||
| int | axis ) |
Builds a BVH-tree where nodes are the given vertices (NOTE: does not copy given vert!).
| 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 verts_mask). |
Referenced by BKE_mesh_remap_calc_loops_from_mesh().
| float bvhtree_ray_tri_intersection | ( | const BVHTreeRay * | ray, |
| float | m_dist, | ||
| const float | v0[3], | ||
| const float | v1[3], | ||
| const float | v2[3] ) |
Math functions used by callbacks
Definition at line 173 of file bvhutils.cc.
References FLT_MAX, isect_ray_tri_epsilon_v3(), isect_ray_tri_watertight_v3(), and v2.
Referenced by mesh_corner_tris_raycast_backface_culling_cb(), mesh_corner_tris_spherecast(), mesh_faces_spherecast(), mesh_tris_spherecast_dp(), and py_bvhtree_raycast_cb().
| float bvhtree_sphereray_tri_intersection | ( | const BVHTreeRay * | ray, |
| float | radius, | ||
| float | m_dist, | ||
| const float | v0[3], | ||
| const float | v1[3], | ||
| const float | v2[3] ) |
Definition at line 194 of file bvhutils.cc.
References FLT_MAX, isect_sweeping_sphere_tri_v3(), madd_v3_v3v3fl(), and v2.
Referenced by mesh_corner_tris_spherecast(), mesh_faces_spherecast(), and py_bvhtree_raycast_cb().
| void free_bvhtree_from_mesh | ( | BVHTreeFromMesh * | data | ) |
Frees data allocated by a call to bvhtree_from_mesh_*.
Definition at line 1160 of file bvhutils.cc.
References BLI_bvhtree_free().
Referenced by BKE_mesh_remap_calc_edges_from_mesh(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_mesh_remap_calc_verts_from_mesh(), BKE_shrinkwrap_free_tree(), cloth_build_springs(), deform_verts(), dynamicPaint_paintMesh(), blender::ed::sculpt_paint::AddOperationExecutor::execute(), blender::ed::sculpt_paint::DensityAddOperationExecutor::execute(), blender::ed::sculpt_paint::DensitySubtractOperationExecutor::execute(), blender::ed::sculpt_paint::PuffOperationExecutor::execute(), blender::ed::sculpt_paint::SlideOperationExecutor::execute(), followtrack_project_to_depth_object_if_needed(), free_data(), blender::nodes::node_geo_sample_nearest_cc::get_closest_mesh_edges(), blender::nodes::node_geo_sample_nearest_cc::get_closest_mesh_points(), blender::nodes::node_geo_sample_nearest_cc::get_closest_mesh_tris(), get_vert2geom_distance(), harmonic_coordinates_bind(), imapaint_pick_face(), blender::bke::mesh_remesh_reproject_attributes(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_invoke(), PE_free_shape_tree(), blender::nodes::node_geo_raycast_cc::raycast_to_mesh(), RE_bake_pixels_populate_from_objects(), remap_hair_emitter(), blender::ed::sculpt_paint::sample_curves_3d_brush(), blender::ed::curves::snap_curves_to_surface::snap_curves_to_surface_exec_object(), blender::geometry::curve_constraints::solve_length_and_collision_constraints(), surfacedeformBind(), blender::ed::curves::convert_to_particle_system::try_convert_single_object(), blender::ed::sculpt_paint::use_add_density_mode(), blender::nodes::node_geo_proximity_cc::ProximityFunction::~ProximityFunction(), and blender::nodes::node_geo_sample_nearest_surface_cc::SampleNearestSurfaceFunction::~SampleNearestSurfaceFunction().
| void free_bvhtree_from_pointcloud | ( | BVHTreeFromPointCloud * | data | ) |
Definition at line 1196 of file bvhutils.cc.
References BLI_bvhtree_free().
Referenced by blender::nodes::node_geo_sample_nearest_cc::get_closest_pointcloud_points(), and blender::nodes::node_geo_proximity_cc::ProximityFunction::~ProximityFunction().