diff options
author | Jacques Lucke <jacques@blender.org> | 2022-09-24 12:41:08 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-09-24 12:41:08 +0300 |
commit | c25df02ac3036449081701349d36d2f16b2c92f2 (patch) | |
tree | 29603afd3baced747546f4a841cbd4ab73bc7052 /source/blender/blenkernel/intern/mesh_sample.cc | |
parent | 8422da13c929f65850a723794a27baa924929377 (diff) |
Cleanup: simplify accessing mesh looptris
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_sample.cc')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_sample.cc | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/mesh_sample.cc b/source/blender/blenkernel/intern/mesh_sample.cc index 1ddac19304d..ed7ae8113a7 100644 --- a/source/blender/blenkernel/intern/mesh_sample.cc +++ b/source/blender/blenkernel/intern/mesh_sample.cc @@ -22,8 +22,7 @@ BLI_NOINLINE static void sample_point_attribute(const Mesh &mesh, const MutableSpan<T> dst) { const Span<MLoop> loops = mesh.loops(); - const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&mesh), - BKE_mesh_runtime_looptri_len(&mesh)}; + const Span<MLoopTri> looptris = mesh.looptris(); for (const int i : mask) { const int looptri_index = looptri_indices[i]; @@ -69,8 +68,7 @@ BLI_NOINLINE static void sample_corner_attribute(const Mesh &mesh, const IndexMask mask, const MutableSpan<T> dst) { - const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&mesh), - BKE_mesh_runtime_looptri_len(&mesh)}; + const Span<MLoopTri> looptris = mesh.looptris(); for (const int i : mask) { const int looptri_index = looptri_indices[i]; @@ -115,8 +113,7 @@ void sample_face_attribute(const Mesh &mesh, const IndexMask mask, const MutableSpan<T> dst) { - const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&mesh), - BKE_mesh_runtime_looptri_len(&mesh)}; + const Span<MLoopTri> looptris = mesh.looptris(); for (const int i : mask) { const int looptri_index = looptri_indices[i]; @@ -161,8 +158,7 @@ Span<float3> MeshAttributeInterpolator::ensure_barycentric_coords() const Span<MVert> verts = mesh_->verts(); const Span<MLoop> loops = mesh_->loops(); - const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(mesh_), - BKE_mesh_runtime_looptri_len(mesh_)}; + const Span<MLoopTri> looptris = mesh_->looptris(); for (const int i : mask_) { const int looptri_index = looptri_indices_[i]; @@ -191,8 +187,7 @@ Span<float3> MeshAttributeInterpolator::ensure_nearest_weights() const Span<MVert> verts = mesh_->verts(); const Span<MLoop> loops = mesh_->loops(); - const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(mesh_), - BKE_mesh_runtime_looptri_len(mesh_)}; + const Span<MLoopTri> looptris = mesh_->looptris(); for (const int i : mask_) { const int looptri_index = looptri_indices_[i]; @@ -265,8 +260,7 @@ int sample_surface_points_spherical(RandomNumberGenerator &rng, { const Span<MVert> verts = mesh.verts(); const Span<MLoop> loops = mesh.loops(); - const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&mesh), - BKE_mesh_runtime_looptri_len(&mesh)}; + const Span<MLoopTri> looptris = mesh.looptris(); const float sample_radius_sq = pow2f(sample_radius); const float sample_plane_area = M_PI * sample_radius_sq; @@ -363,8 +357,7 @@ int sample_surface_points_projected( { const Span<MVert> verts = mesh.verts(); const Span<MLoop> loops = mesh.loops(); - const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&mesh), - BKE_mesh_runtime_looptri_len(&mesh)}; + const Span<MLoopTri> looptris = mesh.looptris(); int point_count = 0; for ([[maybe_unused]] const int _ : IndexRange(tries_num)) { |