diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-13 08:15:40 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-13 08:15:40 +0300 |
commit | ade37d8380728a8f40f05c971585f91325c8ad69 (patch) | |
tree | 510b73a6039441a75ae6d5c830dd2cfef9bec06e /source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc | |
parent | 2edb69f8a600847f195b88deceea5e980ecb61a7 (diff) |
Convert many more uses of MVert
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc index 476af3d95a4..e493e4556a4 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc @@ -63,7 +63,7 @@ static int sphere_face_total(const int segments, const int rings) * Also calculate vertex normals here, since the calculation is trivial, and it allows avoiding the * calculation later, if it's necessary. The vertex normals are just the normalized positions. */ -BLI_NOINLINE static void calculate_sphere_vertex_data(MutableSpan<MVert> verts, +BLI_NOINLINE static void calculate_sphere_vertex_data(MutableSpan<float3> positions, MutableSpan<float3> vert_normals, const float radius, const int segments, @@ -83,7 +83,7 @@ BLI_NOINLINE static void calculate_sphere_vertex_data(MutableSpan<MVert> verts, segment_sines[segment] = std::sin(phi); } - copy_v3_v3(verts[0].co, float3(0.0f, 0.0f, radius)); + positions[0] = float3(0.0f, 0.0f, radius); vert_normals.first() = float3(0.0f, 0.0f, 1.0f); int vert_index = 1; @@ -94,13 +94,13 @@ BLI_NOINLINE static void calculate_sphere_vertex_data(MutableSpan<MVert> verts, for (const int segment : IndexRange(1, segments)) { const float x = sin_theta * segment_cosines[segment]; const float y = sin_theta * segment_sines[segment]; - copy_v3_v3(verts[vert_index].co, float3(x, y, z) * radius); + positions[vert_index] = float3(x, y, z) * radius; vert_normals[vert_index] = float3(x, y, z); vert_index++; } } - copy_v3_v3(verts.last().co, float3(0.0f, 0.0f, -radius)); + positions.last() = float3(0.0f, 0.0f, -radius); vert_normals.last() = float3(0.0f, 0.0f, -1.0f); } @@ -301,7 +301,7 @@ static Mesh *create_uv_sphere_mesh(const float radius, const int segments, const sphere_corner_total(segments, rings), sphere_face_total(segments, rings)); BKE_id_material_eval_ensure_default_slot(&mesh->id); - MutableSpan<MVert> verts = mesh->positions_for_write(); + MutableSpan<float3> positions = mesh->positions_for_write(); MutableSpan<MEdge> edges = mesh->edges_for_write(); MutableSpan<MPoly> polys = mesh->polys_for_write(); MutableSpan<MLoop> loops = mesh->loops_for_write(); @@ -310,7 +310,7 @@ static Mesh *create_uv_sphere_mesh(const float radius, const int segments, const 1024 < segments * rings, [&]() { MutableSpan vert_normals{(float3 *)BKE_mesh_vertex_normals_for_write(mesh), mesh->totvert}; - calculate_sphere_vertex_data(verts, vert_normals, radius, segments, rings); + calculate_sphere_vertex_data(positions, vert_normals, radius, segments, rings); BKE_mesh_vertex_normals_clear_dirty(mesh); }, [&]() { calculate_sphere_edge_indices(edges, segments, rings); }, |