GameEngine/source/core_data.c
2026-02-20 16:12:16 +01:00

70 lines
1.2 KiB
C

#include <core.h>
#define QUEUE_IMPLEMENTATION
#include <data_struct/queue.h>
//#define OCTREE_IMPLEMENTATION
//#include <data_struct/octree.h>
// Frame Allocator
__thread static char* frame_buffer = 0x00;
__thread static char* current_position = 0x00;
__thread static int buffer_size;
void* MemSet(void *dst, const char data, const size_t length) {
for (size_t i = 0; i < length; i++) {
*((char *)dst + i) = data;
}
return (dst);
}
void InitFrameAllocator(size_t n) {
frame_buffer = malloc(n);
current_position = frame_buffer;
}
void *FrameAlloc(size_t n) {
void* ret = 0x00;
if (current_position - frame_buffer + n < buffer_size) {
}
ret = current_position;
current_position += n;
return (ret);
}
void FrameReset() {
current_position = frame_buffer;
MemSet(frame_buffer, 0, buffer_size);
}
void DeleteFrameAllocator() {
current_position = NULL;
free(frame_buffer);
}
//should put my unitest here
int Unitest() {
}
// Ressource Allocator (PreComputed);
// Fast Allocator; when the fram allocator is too short lived
//QuickSort
//RadixSort
//DepthSort used for transparancy in the scene
//List
//DAG
//BinaryTree
//QuadTree
//OcTree
//K-Tree
//HashMap