GCubeSDK
©2026 FenixFox®Studios

PolyhedronGeometry

PolyhedronGeometry ⟵ BufferGeometry

A geometry class for polyhedrons with custom vertices and faces.
PolyhedronGeometry creates a polyhedron geometry from custom vertex and face data. Vertices are projected onto a sphere and subdivided to create smooth shapes. This class serves as the base for regular polyhedrons like octahedron, icosahedron, dodecahedron, and tetrahedron.

Methods

PolyhedronGeometry(const vector<f32>& vertices, const vector<u32>& indices, f32 radius, u32 detail, const Color& color)

Universal constructor - covers all cases with smart defaults

vertices Array of vertex coordinates (x,y,z,x,y,z,...)
indices Array of face indices (a,b,c,a,b,c,...)
radius Radius of the final shape 1.0f
detail Number of subdivision levels (0 = original shape) 0
color RGBA color for all vertices 0xFFFFFFFF

PolyhedronGeometry* clone(bool recursive = false) const

Creates a copy of this geometry

recursive Whether to clone descendants as well

void copy(const PolyhedronGeometry& geometry)

Copies properties from another geometry

geometry Source geometry to copy from

void buildPolyhedron()

Builds the polyhedron geometry with vertices, indices, and colors

Properties

color Color RGBA color for all vertices
detail u32 Number of subdivision levels
radius f32 Radius of the final shape