Skip to main content

uv_sphere

Function uv_sphere 

Source
pub fn uv_sphere(radius: f32, slices: usize, stacks: usize) -> OwnedLitMeshDesc
Expand description

A lat-long sphere: positions, uvs, opaque white colors and indices.

The triangles are wound CCW as seen from outside, matching the back-face culling of the unlit pipeline: stacks grow downward and slices counterclockwise, so each quad reads (top, top-next, bottom) and (top-next, bottom-next, bottom) against the outward direction.

ยงPanics

Panics when slices or stacks is zero: the sphere would divide by zero and carry NaN positions.