Blender V4.3
BKE_bvhutils.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
12#include <mutex>
13
14#include "BLI_bit_span.hh"
15#include "BLI_index_mask_fwd.hh"
16#include "BLI_kdopbvh.h"
18#include "BLI_span.hh"
19
20struct BVHCache;
21struct BVHTree;
22struct MFace;
23struct Mesh;
24struct PointCloud;
25
47
54
57
58 /* These types consider geometry visibility when getting loose elements.
59 * NOTE: If the element is linked to a face or edge that is hidden, but the element itself is not
60 * hidden, it is considered a loose element. */
63
64 /* Keep `BVHTREE_MAX_ITEM` as last item. */
66};
67
76 blender::Span<blender::float3> vert_positions,
77 blender::BitSpan verts_mask,
78 int verts_num_active,
79 float epsilon,
80 int tree_type,
81 int axis);
82
92 blender::Span<blender::float3> vert_positions,
94 blender::BitSpan edges_mask,
95 int edges_num_active,
96 float epsilon,
97 int tree_type,
98 int axis);
99
104 blender::Span<blender::float3> vert_positions,
105 blender::Span<int> corner_verts,
107 blender::BitSpan corner_tris_mask,
108 int corner_tris_num_active,
109 float epsilon,
110 int tree_type,
111 int axis);
112
120 const Mesh *mesh,
121 BVHCacheType bvh_cache_type,
122 int tree_type);
123
128 const blender::IndexMask &faces_mask,
129 BVHTreeFromMesh &r_data);
130
135 const blender::IndexMask &edges_mask,
136 BVHTreeFromMesh &r_data);
137
142 const blender::IndexMask &verts_mask,
143 BVHTreeFromMesh &r_data);
144
149
154 const BVHTreeRay *ray, float m_dist, const float v0[3], const float v1[3], const float v2[3]);
156 float radius,
157 float m_dist,
158 const float v0[3],
159 const float v1[3],
160 const float v2[3]);
161
169
170void BKE_bvhtree_from_pointcloud_get(const PointCloud &pointcloud,
171 const blender::IndexMask &points_mask,
172 BVHTreeFromPointCloud &r_data);
173
175
180/* Using local coordinates */
181
182bool bvhcache_has_tree(const BVHCache *bvh_cache, const BVHTree *tree);
187void bvhcache_free(BVHCache *bvh_cache);
bool bvhcache_has_tree(const BVHCache *bvh_cache, const BVHTree *tree)
Definition bvhutils.cc:96
void free_bvhtree_from_mesh(BVHTreeFromMesh *data)
Definition bvhutils.cc:1160
BVHTree * BKE_bvhtree_from_mesh_get(BVHTreeFromMesh *data, const Mesh *mesh, BVHCacheType bvh_cache_type, int tree_type)
Definition bvhutils.cc:899
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)
BVHCache * bvhcache_init()
Definition bvhutils.cc:110
void BKE_bvhtree_from_pointcloud_get(const PointCloud &pointcloud, const blender::IndexMask &points_mask, BVHTreeFromPointCloud &r_data)
Definition bvhutils.cc:1175
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)
void free_bvhtree_from_pointcloud(BVHTreeFromPointCloud *data)
Definition bvhutils.cc:1196
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)
BVHCacheType
@ BVHTREE_FROM_CORNER_TRIS
@ BVHTREE_FROM_EDGES
@ BVHTREE_FROM_CORNER_TRIS_NO_HIDDEN
@ BVHTREE_FROM_FACES
@ BVHTREE_FROM_LOOSEEDGES
@ BVHTREE_FROM_LOOSEVERTS
@ BVHTREE_FROM_LOOSEEDGES_NO_HIDDEN
@ BVHTREE_FROM_LOOSEVERTS_NO_HIDDEN
@ BVHTREE_MAX_ITEM
@ BVHTREE_FROM_VERTS
float bvhtree_ray_tri_intersection(const BVHTreeRay *ray, float m_dist, const float v0[3], const float v1[3], const float v2[3])
Definition bvhutils.cc:173
void BKE_bvhtree_from_mesh_verts_init(const Mesh &mesh, const blender::IndexMask &verts_mask, BVHTreeFromMesh &r_data)
Definition bvhutils.cc:1122
void BKE_bvhtree_from_mesh_edges_init(const Mesh &mesh, const blender::IndexMask &edges_mask, BVHTreeFromMesh &r_data)
Definition bvhutils.cc:1086
void bvhcache_free(BVHCache *bvh_cache)
Definition bvhutils.cc:132
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 bvhutils.cc:194
void BKE_bvhtree_from_mesh_tris_init(const Mesh &mesh, const blender::IndexMask &faces_mask, BVHTreeFromMesh &r_data)
Definition bvhutils.cc:1033
void(* BVHTree_RayCastCallback)(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
void(* BVHTree_NearestPointCallback)(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
Definition BLI_kdopbvh.h:97
ATTR_WARN_UNUSED_RESULT const BMVert * v2
KDTree_3d * tree
draw_view in_light_buf[] float
blender::Span< blender::int3 > corner_tris
BVHTree_RayCastCallback raycast_callback
blender::Span< blender::float3 > vert_positions
blender::Span< blender::int2 > edges
blender::Span< int > corner_verts
BVHTree_NearestPointCallback nearest_callback
BVHTree_NearestPointCallback nearest_callback
const float(* coords)[3]