[Bf-blender-cvs] [9a501e1eced] geometry-nodes-mesh-primitives: Continue working on sphere node

Hans Goudey noreply at git.blender.org
Thu Mar 11 23:15:09 CET 2021


Commit: 9a501e1eceda0dbbc2ef18a78f2460ef16a8c100
Author: Hans Goudey
Date:   Wed Feb 24 08:48:14 2021 -0600
Branches: geometry-nodes-mesh-primitives
https://developer.blender.org/rB9a501e1eceda0dbbc2ef18a78f2460ef16a8c100

Continue working on sphere node

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc

===================================================================

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 8a7e57239d8..feef6a6a4a3 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
@@ -45,22 +45,26 @@ namespace blender::nodes {
 
 static int vert_total(const int segments, const int rings)
 {
-  return 0;
+  return segments * (rings - 1) + 2;
 }
 
 static int edge_total(const int segments, const int rings)
 {
-  return 0;
+  return segments * (rings + 2);
 }
 
 static int corner_total(const int segments, const int rings)
 {
-  return 0;
+  const int quad_corners = 4 * segments * (rings - 2);
+  const int tri_corners = 3 * segments * 2;
+  return quad_corners + tri_corners;
 }
 
 static int face_total(const int segments, const int rings)
 {
-  return 0;
+  const int quads = segments * (rings - 2);
+  const int triangles = segments * 2;
+  return quads + triangles;
 }
 
 static Mesh *create_uv_sphere_mesh(const float3 location,



More information about the Bf-blender-cvs mailing list