$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
icosphere.h File Reference

Procedural icosphere geometry generation. More...

#include <cglm/cglm.h>
#include <stddef.h>
Include dependency graph for icosphere.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Vec3Array
 Dynamic array for cglm vec3 types. More...
 
struct  UintArray
 Dynamic array for unsigned integers (mostly for mesh indices). More...
 
struct  IcosphereGeometry
 Container for procedural mesh data. More...
 

Functions

void vec3array_init (Vec3Array *array)
 Initializes a Vec3Array with zeroed fields. More...
 
void vec3array_push (Vec3Array *array, vec3 vertex)
 Appends a vec3 to the array, reallocating if necessary. More...
 
void vec3array_free (Vec3Array *array)
 Frees the internal buffer of a Vec3Array. More...
 
void uintarray_init (UintArray *array)
 Initializes a UintArray with zeroed fields. More...
 
void uintarray_push (UintArray *array, unsigned int value)
 Appends an unsigned int to the array, reallocating if necessary. More...
 
void uintarray_free (UintArray *array)
 Frees the internal buffer of a UintArray. More...
 
void icosphere_init (IcosphereGeometry *geom)
 Initializes icosphere geometry buffers. More...
 
void icosphere_generate (IcosphereGeometry *geom, int subdivisions)
 Generates icosphere mesh data for a specified subdivision level. More...
 
void icosphere_free (IcosphereGeometry *geom)
 Frees all dynamic memory in the icosphere container. More...
 

Detailed Description

Procedural icosphere geometry generation.

This module provides utilities for generating smooth, subdivided spheres starting from an icosahedron. It includes dynamic arrays for internal geometry processing.

Function Documentation

◆ icosphere_free()

void icosphere_free ( IcosphereGeometry geom)

Frees all dynamic memory in the icosphere container.

Parameters
geomPointer to the geometry container.
Here is the call graph for this function:

◆ icosphere_generate()

void icosphere_generate ( IcosphereGeometry geom,
int  subdivisions 
)

Generates icosphere mesh data for a specified subdivision level.

Parameters
geomPointer to the geometry container.
subdivisionsNumber of times to split each triangle face (0-6).
See also
app_settings.h (MAX_SUBDIV)
Here is the call graph for this function:

◆ icosphere_init()

void icosphere_init ( IcosphereGeometry geom)

Initializes icosphere geometry buffers.

Parameters
geomPointer to the geometry container.
Here is the call graph for this function:

◆ uintarray_free()

void uintarray_free ( UintArray array)

Frees the internal buffer of a UintArray.

◆ uintarray_init()

void uintarray_init ( UintArray array)

Initializes a UintArray with zeroed fields.

◆ uintarray_push()

void uintarray_push ( UintArray array,
unsigned int  value 
)

Appends an unsigned int to the array, reallocating if necessary.

◆ vec3array_free()

void vec3array_free ( Vec3Array array)

Frees the internal buffer of a Vec3Array.

◆ vec3array_init()

void vec3array_init ( Vec3Array array)

Initializes a Vec3Array with zeroed fields.

◆ vec3array_push()

void vec3array_push ( Vec3Array array,
vec3  vertex 
)

Appends a vec3 to the array, reallocating if necessary.