GCubeSDK
©2026 FenixFox®Studios

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).

InheritanceDiagram node_BufferGeometry BufferGeometry node_SphereGeometry SphereGeometry node_BufferGeometry->node_SphereGeometry

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
thetaStart Vertical starting angle 0.0f
thetaLength Vertical sweep angle size π
color RGBA color for all vertices 0xFFFFFFFF (white)

SphereGeometry* clone(bool recursive) const

Creates a copy of this geometry

recursive Whether to clone descendants as well false

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

void dispose()

Frees GPU-related resources

Properties

radius f32 Radius of the sphere
widthSegments u32 Number of horizontal segments
heightSegments u32 Number of vertical segments
phiStart f32 Horizontal starting angle
phiLength f32 Horizontal sweep angle size
thetaStart f32 Vertical starting angle
thetaLength f32 Vertical sweep angle size
color Color RGBA color for all vertices