1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-15 10:13:34 +00:00
lovr/src/modules/math/pool.h
2021-02-08 11:16:00 -07:00

33 lines
598 B
C

#include <stdint.h>
#include <stddef.h>
#pragma once
typedef enum {
V_NONE,
V_VEC2,
V_VEC3,
V_VEC4,
V_QUAT,
V_MAT4,
MAX_VECTOR_TYPES
} VectorType;
typedef union {
void* pointer;
struct {
uint8_t type;
uint8_t generation;
uint16_t index;
uint32_t padding;
} handle;
} Vector;
typedef struct Pool Pool;
Pool* lovrPoolCreate(void);
void lovrPoolDestroy(void* ref);
void lovrPoolGrow(Pool* pool, size_t count);
Vector lovrPoolAllocate(Pool* pool, VectorType type, float** data);
float* lovrPoolResolve(Pool* pool, Vector vector);
void lovrPoolDrain(Pool* pool);