diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2022-07-28 12:33:49 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2022-07-28 12:33:49 +0300 |
commit | 739aee0db3ec6c74f2d34b7d8822c6b0c9dbe319 (patch) | |
tree | 99b5dec89fa20150f953fac52514aac81e113cda /source | |
parent | f4281b33f8fde0740b169f79af8f588eb1233b59 (diff) |
Use mutable span for mesh elements in test.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/curves_constraints_test.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/curves_constraints_test.cc b/source/blender/blenkernel/intern/curves_constraints_test.cc index 5a70905deab..55211ffe754 100644 --- a/source/blender/blenkernel/intern/curves_constraints_test.cc +++ b/source/blender/blenkernel/intern/curves_constraints_test.cc @@ -123,7 +123,7 @@ TEST(curves_constraints, LengthAndRootConstraint) EXPECT_V3_NEAR(positions[8], float3(0.213f, 0.009f, 2.0f), eps); } -#define DO_PERF_TESTS 0 +#define DO_PERF_TESTS 1 #if DO_PERF_TESTS @@ -144,9 +144,9 @@ static Mesh *create_noise_grid(const float noise = 0.1f, const int resolution = const int tot_polys = (resolution - 1) * (resolution - 1); const int tot_loops = tot_polys * 4; Mesh *mesh = BKE_mesh_new_nomain(tot_verts, 0, 0, tot_loops, tot_polys); - MVert *mvert = mesh->mvert; - MPoly *mpoly = mesh->mpoly; - MLoop *mloop = mesh->mloop; + const MutableSpan<MVert> mverts(mesh->mvert, mesh->totvert); + const MutableSpan<MPoly> mpolys(mesh->mpoly, mesh->totpoly); + const MutableSpan<MLoop> mloops(mesh->mloop, mesh->totloop); for (const int i : IndexRange(resolution)) { for (const int j : IndexRange(resolution)) { @@ -155,7 +155,7 @@ static Mesh *create_noise_grid(const float noise = 0.1f, const int resolution = co += noise * (offset - float3(0.5f)); const int vert_i = i * resolution + j; - copy_v3_v3(mvert[vert_i].co, co); + copy_v3_v3(mverts[vert_i].co, co); } } @@ -165,13 +165,13 @@ static Mesh *create_noise_grid(const float noise = 0.1f, const int resolution = const int poly_i = i * (resolution - 1) + j; const int loop_i = poly_i * 4; - mpoly[poly_i].loopstart = loop_i; - mpoly[poly_i].totloop = 4; + mpolys[poly_i].loopstart = loop_i; + mpolys[poly_i].totloop = 4; - mloop[loop_i + 0].v = vert_i; - mloop[loop_i + 1].v = vert_i + 1; - mloop[loop_i + 2].v = vert_i + resolution + 1; - mloop[loop_i + 3].v = vert_i + resolution; + mloops[loop_i + 0].v = vert_i; + mloops[loop_i + 1].v = vert_i + 1; + mloops[loop_i + 2].v = vert_i + resolution + 1; + mloops[loop_i + 3].v = vert_i + resolution; } } |