GCubeSDK
©2026 FenixFox®Studios

BufferGeometry

Representation of mesh, line, or point geometry with GPU-optimized buffers.

This class provides geometry data storage for rendering. It includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers.

  • Managing indexed and non-indexed geometry
  • Computing bounding volumes for culling
  • Organizing geometry into render groups
  • Applying geometric transformations
InheritanceDiagram node_BoxGeometry BoxGeometry node_BufferGeometry BufferGeometry node_BufferGeometry->node_BoxGeometry node_CircleGeometry CircleGeometry node_BufferGeometry->node_CircleGeometry node_CylinderGeometry CylinderGeometry node_BufferGeometry->node_CylinderGeometry node_PlaneGeometry PlaneGeometry node_BufferGeometry->node_PlaneGeometry node_PolyhedronGeometry PolyhedronGeometry node_BufferGeometry->node_PolyhedronGeometry node_RingGeometry RingGeometry node_BufferGeometry->node_RingGeometry node_SphereGeometry SphereGeometry node_BufferGeometry->node_SphereGeometry node_TorusGeometry TorusGeometry node_BufferGeometry->node_TorusGeometry node_WireframeGeometry WireframeGeometry node_BufferGeometry->node_WireframeGeometry node_ConeGeometry ConeGeometry node_CylinderGeometry->node_ConeGeometry node_IcosahedronGeometry IcosahedronGeometry node_OctahedronGeometry OctahedronGeometry node_PolyhedronGeometry->node_IcosahedronGeometry node_PolyhedronGeometry->node_OctahedronGeometry

Methods

BufferGeometry()

Default constructor: creates an empty geometry

BufferGeometry(const string& name)

Constructor with custom name

name Human-readable name for the geometry

BufferGeometry* clone() const

Creates a copy of this geometry

void copy(const BufferGeometry& geometry)

Copies properties from another geometry

geometry Source geometry to copy from

void setAttribute(const string& name, void* data, u32 itemSize, u32 count, u32 format)

Sets a geometry attribute

name Attribute name (position, normal, color, uv, etc.)
data Pointer to the attribute data
itemSize Number of components per vertex
count Number of vertices
format GX data format (GX_S16, GX_F32, etc.)

void* getAttribute(const string& name) const

Gets a geometry attribute

name Attribute name to retrieve

bool hasAttribute(const string& name) const

Checks if an attribute exists

name Attribute name to check

void deleteAttribute(const string& name)

Deletes an attribute

name Attribute name to delete

void setIndex(u16* indices, u32 count)

Sets the index buffer for indexed geometry

indices Pointer to index data
count Number of indices

u16* getIndex() const

Gets the index buffer

void addGroup(u32 start, u32 count, u32 materialIndex)

Adds a render group to the geometry

start Starting vertex/index for the group
count Number of vertices/indices in the group
materialIndex Material index to use for this group

void clearGroups()

Clears all render groups

void applyMatrix4(const Mtx& matrix)

Applies a 4x4 matrix transformation to the geometry

matrix Matrix to apply

void center()

Centers the geometry based on bounding box

void translate(f32 x, f32 y, f32 z)

Translates the geometry data

x Translation along X axis
y Translation along Y axis
z Translation along Z axis

void rotateX(f32 radians)

Rotates the geometry around X axis

radians Rotation angle in radians

void rotateY(f32 radians)

Rotates the geometry around Y axis

radians Rotation angle in radians

void rotateZ(f32 radians)

Rotates the geometry around Z axis

radians Rotation angle in radians

void scale(f32 x, f32 y, f32 z)

Scales the geometry data

x Scale factor for X axis
y Scale factor for Y axis
z Scale factor for Z axis

void computeBoundingBox()

Computes the bounding box of the geometry

void computeBoundingSphere()

Computes the bounding sphere of the geometry

void setupGX()

Sets up GX for rendering this geometry

void render()

Renders the geometry using GX

void dispose()

Frees GPU-related resources

Properties

isBufferGeometry bool Read
attributes map<string,void * > Hashmap of attributes (name
index u16 * Index buffer for indexed geometry
indexCount u32 Number of indices
boundingBox void * Bounding box (null = not computed)
boundingSphere void * Bounding sphere (null = not computed)
drawRangeStart u32 Start of draw range
drawRangeCount u32 Count of vertices/indices to render
groups vector Render groups for multiple materials
id u32 Unique identifier
name string Human
uuid string UUID string
userData void * Custom user data
vertexCount u32 Total number of vertices
primitiveType u32 GX primitive type (GX_QUADS 0x80, GX_TRIANGLES 0x90, etc.)
isIndexed bool Whether geometry uses indices