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:
authorHallam Roberts <MysteryPancake>2022-03-08 23:39:58 +0300
committerHans Goudey <h.goudey@me.com>2022-03-08 23:39:58 +0300
commit156e07232e79d53fa3f43d4bcfc4b0c4061331e5 (patch)
tree2b94cbe020d51871e8a79063120d3991dfe65075 /source/blender
parentd09695b4dd0eca917004177d30df9e09d9f8732d (diff)
Geometry Nodes: Tiny optimization to UV Sphere primitive
Prevents a few unneeded calls to `std::sin`, with an observed performance improvement of about 1 percent. Differential Revision: https://developer.blender.org/D14279
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc2
1 files changed, 1 insertions, 1 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 4a09fd8d1d2..4e0e5c7c912 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
@@ -76,10 +76,10 @@ static void calculate_sphere_vertex_data(MutableSpan<MVert> verts,
int vert_index = 1;
for (const int ring : IndexRange(1, rings - 1)) {
const float theta = ring * delta_theta;
+ const float sin_theta = std::sin(theta);
const float z = std::cos(theta);
for (const int segment : IndexRange(1, segments)) {
const float phi = segment * delta_phi;
- const float sin_theta = std::sin(theta);
const float x = sin_theta * std::cos(phi);
const float y = sin_theta * std::sin(phi);
copy_v3_v3(verts[vert_index].co, float3(x, y, z) * radius);