Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/bvhutils.cc')
-rw-r--r--source/blender/blenkernel/intern/bvhutils.cc40
1 files changed, 26 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/bvhutils.cc b/source/blender/blenkernel/intern/bvhutils.cc
index d0b57b45d35..9bea8a0d6d3 100644
--- a/source/blender/blenkernel/intern/bvhutils.cc
+++ b/source/blender/blenkernel/intern/bvhutils.cc
@@ -15,6 +15,7 @@
#include "BLI_linklist.h"
#include "BLI_math.h"
+#include "BLI_span.hh"
#include "BLI_task.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
@@ -27,6 +28,7 @@
#include "MEM_guardedalloc.h"
+using blender::Span;
using blender::VArray;
/* -------------------------------------------------------------------- */
@@ -1229,14 +1231,17 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
looptri = BKE_mesh_runtime_looptri_ensure(mesh);
looptri_len = BKE_mesh_runtime_looptri_len(mesh);
}
+ const Span<MVert> verts = mesh->verts();
+ const Span<MEdge> edges = mesh->edges();
+ const Span<MLoop> loops = mesh->loops();
/* Setup BVHTreeFromMesh */
bvhtree_from_mesh_setup_data(nullptr,
bvh_cache_type,
- mesh->mvert,
- mesh->medge,
- mesh->mface,
- mesh->mloop,
+ verts.data(),
+ edges.data(),
+ (const MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE),
+ loops.data(),
looptri,
BKE_mesh_vertex_normals_ensure(mesh),
data);
@@ -1260,31 +1265,38 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
switch (bvh_cache_type) {
case BVHTREE_FROM_LOOSEVERTS:
mask = loose_verts_map_get(
- mesh->medge, mesh->totedge, mesh->mvert, mesh->totvert, &mask_bits_act_len);
+ edges.data(), mesh->totedge, verts.data(), mesh->totvert, &mask_bits_act_len);
ATTR_FALLTHROUGH;
case BVHTREE_FROM_VERTS:
data->tree = bvhtree_from_mesh_verts_create_tree(
- 0.0f, tree_type, 6, mesh->mvert, mesh->totvert, mask, mask_bits_act_len);
+ 0.0f, tree_type, 6, verts.data(), mesh->totvert, mask, mask_bits_act_len);
break;
case BVHTREE_FROM_LOOSEEDGES:
- mask = loose_edges_map_get(mesh->medge, mesh->totedge, &mask_bits_act_len);
+ mask = loose_edges_map_get(edges.data(), mesh->totedge, &mask_bits_act_len);
ATTR_FALLTHROUGH;
case BVHTREE_FROM_EDGES:
data->tree = bvhtree_from_mesh_edges_create_tree(
- mesh->mvert, mesh->medge, mesh->totedge, mask, mask_bits_act_len, 0.0f, tree_type, 6);
+ verts.data(), edges.data(), mesh->totedge, mask, mask_bits_act_len, 0.0f, tree_type, 6);
break;
case BVHTREE_FROM_FACES:
BLI_assert(!(mesh->totface == 0 && mesh->totpoly != 0));
data->tree = bvhtree_from_mesh_faces_create_tree(
- 0.0f, tree_type, 6, mesh->mvert, mesh->mface, mesh->totface, nullptr, -1);
+ 0.0f,
+ tree_type,
+ 6,
+ verts.data(),
+ (const MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE),
+ mesh->totface,
+ nullptr,
+ -1);
break;
case BVHTREE_FROM_LOOPTRI_NO_HIDDEN: {
- blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*mesh);
+ blender::bke::AttributeAccessor attributes = mesh->attributes();
mask = looptri_no_hidden_map_get(
- mesh->mpoly,
+ mesh->polys().data(),
attributes.lookup_or_default(".hide_poly", ATTR_DOMAIN_FACE, false),
looptri_len,
&mask_bits_act_len);
@@ -1294,8 +1306,8 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
data->tree = bvhtree_from_mesh_looptri_create_tree(0.0f,
tree_type,
6,
- mesh->mvert,
- mesh->mloop,
+ verts.data(),
+ loops.data(),
looptri,
looptri_len,
mask,
@@ -1442,7 +1454,7 @@ BVHTree *BKE_bvhtree_from_pointcloud_get(BVHTreeFromPointCloud *data,
return nullptr;
}
- blender::bke::AttributeAccessor attributes = blender::bke::pointcloud_attributes(*pointcloud);
+ blender::bke::AttributeAccessor attributes = pointcloud->attributes();
blender::VArraySpan<blender::float3> positions = attributes.lookup_or_default<blender::float3>(
"position", ATTR_DOMAIN_POINT, blender::float3(0));