Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
Loading...
Searching...
No Matches
icosphere.h
Go to the documentation of this file.
1
10#ifndef ICOSPHERE_H
11#define ICOSPHERE_H
12
13#include <cglm/cglm.h>
14#include <stddef.h>
15
20typedef struct {
21 vec3* data;
22 size_t size;
23 size_t capacity;
24} Vec3Array;
25
30typedef struct {
31 unsigned int* data;
32 size_t size;
33 size_t capacity;
34} UintArray;
35
45
46/* Array operations */
47
49void vec3array_init(Vec3Array* array);
51void vec3array_push(Vec3Array* array, vec3 vertex);
53void vec3array_free(Vec3Array* array);
54
56void uintarray_init(UintArray* array);
58void uintarray_push(UintArray* array, unsigned int value);
60void uintarray_free(UintArray* array);
61
62/* Icosphere operations */
63
69
76void icosphere_generate(IcosphereGeometry* geom, int subdivisions);
77
83
84#endif /* ICOSPHERE_H */
void vec3array_push(Vec3Array *array, vec3 vertex)
Appends a vec3 to the array, reallocating if necessary.
Definition icosphere.c:38
void icosphere_free(IcosphereGeometry *geom)
Frees all dynamic memory in the icosphere container.
Definition icosphere.c:269
void uintarray_init(UintArray *array)
Initializes a UintArray with zeroed fields.
Definition icosphere.c:65
void icosphere_generate(IcosphereGeometry *geom, int subdivisions)
Generates icosphere mesh data for a specified subdivision level.
Definition icosphere.c:242
void icosphere_init(IcosphereGeometry *geom)
Initializes icosphere geometry buffers.
Definition icosphere.c:235
void uintarray_push(UintArray *array, unsigned int value)
Appends an unsigned int to the array, reallocating if necessary.
Definition icosphere.c:72
void vec3array_init(Vec3Array *array)
Initializes a Vec3Array with zeroed fields.
Definition icosphere.c:31
void vec3array_free(Vec3Array *array)
Frees the internal buffer of a Vec3Array.
Definition icosphere.c:56
void uintarray_free(UintArray *array)
Frees the internal buffer of a UintArray.
Definition icosphere.c:90
Container for procedural mesh data.
Definition icosphere.h:40
UintArray indices
Definition icosphere.h:43
Vec3Array normals
Definition icosphere.h:42
Vec3Array vertices
Definition icosphere.h:41
Dynamic array for unsigned integers (mostly for mesh indices).
Definition icosphere.h:30
size_t size
Definition icosphere.h:32
size_t capacity
Definition icosphere.h:33
unsigned int * data
Definition icosphere.h:31
Dynamic array for cglm vec3 types.
Definition icosphere.h:20
size_t capacity
Definition icosphere.h:23
size_t size
Definition icosphere.h:22
vec3 * data
Definition icosphere.h:21