GCubeSDK
©2026 FenixFox®Studios

BoxGeometry

BoxGeometry ⟵ BufferGeometry

A geometry class for a rectangular cuboid with given width, height, and depth.
BoxGeometry creates a rectangular cuboid geometry that is centered on the origin, with each edge parallel to one of the axes. This eliminates the need for manual vertex and index setup when creating basic box shapes.

Methods

BoxGeometry(f32 width, f32 height, f32 depth, Color color, u32 widthSegments, u32 heightSegments, u32 depthSegments)

Universal constructor covers all cases with defaults

width Width (X axis) 1.0f
height Height (Y axis) 1.0f
depth Depth (Z axis) 1.0f
color RGBA color for all vertices Color()
widthSegments Segements along width 1
heightSegments Segements along height 1
depthSegments Segements along depth 1

BoxGeometry* clone(bool recursive = false) const

Creates a copy of this geometry

recursive Whether to clone descendants as well

void copy(const BoxGeometry& geometry)

Copies properties from another geometry

geometry Source geometry to copy from

void buildBox()

Builds the box geometry with vertices, indices, and colors

Properties

color Color RGBA color for all vertices
depth f32 Depth of the box
depthSegments u32 Number of segments along depth
height f32 Height of the box
heightSegments u32 Number of segments along height
width f32 Width of the box
widthSegments u32 Number of segments along width