natiny_mesh_sphere

C
NatinyMesh natiny_mesh_sphere(float radius, uint32_t segments, uint32_t rings);

Builds a one-part sphere centred on the origin. The generated mesh has normals and UV coordinates but no texture.

Parameters

Name Type Description
radius float Radius
segments uint32_t Meridians - the detail around the Y axis; clamped up to 3
rings uint32_t Rings - the detail from pole to pole; clamped up to 2

Returns

Type Description
NatinyMesh Mesh handle

Example

C
NatinyMesh sphere = natiny_mesh_sphere(0.5f, 32, 16);

Notes

  • segments is clamped to at least 3 and rings to at least 2.
  • UVs are equirectangular: u wraps around Y and v runs from the +Y pole to -Y. Normals point outward from the center.