natiny.mesh.sphere
Lua
natiny.mesh.sphere([radius [, segments [, rings]]]) -> mesh
Builds a one-part sphere centred on the origin. The generated mesh has normals
and UV coordinates but no texture.
Parameters
| Name |
Type |
Default |
Description |
radius |
number |
1 |
Radius |
segments |
integer |
32 |
Meridians around Y; values below 3 are clamped |
rings |
integer |
16 |
Rings from pole to pole; values below 2 are clamped |
Returns
| Type |
Description |
number |
Mesh handle |
Example
Lua
local sphere = natiny.mesh.sphere(0.5, 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.