$darkmode
#include "icosphere.h"#include <cglm/types.h>#include <cglm/vec3.h>#include <stdint.h>#include <stdlib.h>Data Structures | |
| struct | EdgeEntry |
| struct | EdgeHash |
Macros | |
| #define | X 0.525731112119133606F |
| #define | Z 0.850650808352039932F |
Enumerations | |
| enum | { INITIAL_VEC3_CAPACITY = 128 , INITIAL_UINT_CAPACITY = 256 , ICOSAHEDRON_VERTEX_COUNT = 12 , ICOSAHEDRON_INDEX_COUNT = 60 , INDEX_SHIFT = 32 } |
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... | |
| static void | normalize_vec3 (vec3 vertex, vec3 out) |
| static void | edge_hash_init (EdgeHash *hash, size_t capacity) |
| static void | edge_hash_free (EdgeHash *hash) |
| static unsigned int | get_midpoint (unsigned int point1, unsigned int point2, Vec3Array *vertices, EdgeHash *hash) |
| static void | subdivide (Vec3Array *vertices, UintArray *indices, int depth) |
| static void | compute_normals (const Vec3Array *vertices, Vec3Array *normals) |
| 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... | |
Variables | |
| static const vec3 | icosahedron_vertices [ICOSAHEDRON_VERTEX_COUNT] |
| static const unsigned int | icosahedron_indices [ICOSAHEDRON_INDEX_COUNT] |
| #define X 0.525731112119133606F |
| #define Z 0.850650808352039932F |
| anonymous enum |
|
static |
|
static |
|
static |
| void icosphere_free | ( | IcosphereGeometry * | geom | ) |
Frees all dynamic memory in the icosphere container.
| geom | Pointer to the geometry container. |
| void icosphere_generate | ( | IcosphereGeometry * | geom, |
| int | subdivisions | ||
| ) |
Generates icosphere mesh data for a specified subdivision level.
| geom | Pointer to the geometry container. |
| subdivisions | Number of times to split each triangle face (0-6). |
| void icosphere_init | ( | IcosphereGeometry * | geom | ) |
Initializes icosphere geometry buffers.
| geom | Pointer to the geometry container. |
|
static |
| void uintarray_push | ( | UintArray * | array, |
| unsigned int | value | ||
| ) |
Appends an unsigned int to the array, reallocating if necessary.
| void vec3array_push | ( | Vec3Array * | array, |
| vec3 | vertex | ||
| ) |
Appends a vec3 to the array, reallocating if necessary.
|
static |
|
static |