SphereGeometry
SphereGeometry ⟵ BufferGeometry
A geometry class for a sphere with given radius and segment
counts.
SphereGeometry creates a sphere geometry that is centered on the origin,
with customizable radius and segment counts for smoothness. The sphere
is created by sweeping vertices around the Y axis (horizontal) and Z
axis (vertical).
Methods
SphereGeometry(f32 radius, u32 widthSegments, u32 heightSegments, f32 phiStart, f32 phiLength, f32 thetaStart, f32 thetaLength, const Color& color)
Universal constructor - covers all cases with smart defaults
| radius | Sphere radius | 1.0f |
| widthSegments | Number of horizontal segments (minimum 3) | 32 |
| heightSegments | Number of vertical segments (minimum 2) | 16 |
| phiStart | Horizontal starting angle | 0.0f |
| phiLength | Horizontal sweep angle size | 2π |
| thetaStart | Vertical starting angle | 0.0f |
| thetaLength | Vertical sweep angle size | π |
| color | RGBA color for all vertices | 0xFFFFFFFF (white) |
SphereGeometry* clone(bool recursive = false) const
Creates a copy of this geometry
| recursive | Whether to clone descendants as well |
void copy(const SphereGeometry& geometry)
Copies properties from another geometry
| geometry | Source geometry to copy from |
void buildSphere()
Builds the sphere geometry with vertices, indices, and colors
Properties
| color | Color | RGBA color for all vertices |
| heightSegments | u32 | Number of vertical segments |
| phiLength | f32 | Horizontal sweep angle size |
| phiStart | f32 | Horizontal starting angle |
| radius | f32 | Radius of the sphere |
| thetaLength | f32 | Vertical sweep angle size |
| thetaStart | f32 | Vertical starting angle |
| widthSegments | u32 | Number of horizontal segments |