From 440b292c39162284a447b34d3a692143af9fbc87 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Thu, 30 Oct 2025 17:21:22 -0700 Subject: - Replace SceneCamera with Camera. - Remove backpointer from scene types to node to decouple underlying types from the scene graph. --- src/memory.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/memory.c') diff --git a/src/memory.c b/src/memory.c index a68bc2b..3481791 100644 --- a/src/memory.c +++ b/src/memory.c @@ -1,21 +1,22 @@ #include "memory.h" +#include #include #include "render/llr_impl.h" #include "scene/animation_impl.h" -#include "scene/camera_impl.h" #include "scene/model_impl.h" #include "scene/node_impl.h" #include "scene/object_impl.h" #include "scene/scene_impl.h" #include +#include #include DEF_MEMPOOL(anima_pool, Anima, GFX_MAX_NUM_ANIMAS) DEF_MEMPOOL(animation_pool, Animation, GFX_MAX_NUM_ANIMATIONS) -DEF_MEMPOOL(camera_pool, SceneCamera, GFX_MAX_NUM_CAMERAS) +DEF_MEMPOOL(camera_pool, Camera, GFX_MAX_NUM_CAMERAS) DEF_MEMPOOL(light_pool, Light, GFX_MAX_NUM_LIGHTS) DEF_MEMPOOL(material_pool, Material, GFX_MAX_NUM_MATERIALS) DEF_MEMPOOL(mesh_pool, Mesh, GFX_MAX_NUM_MESHES) @@ -56,7 +57,7 @@ static SceneMemory mem; #define PLURAL(name) name##s #define MEM_FIELD(name) mem.PLURAL(name) -void scene_mem_init() { +void scene_mem_init(void) { mempool_make(&mem.animas); mempool_make(&mem.animations); mempool_make(&mem.cameras); @@ -86,7 +87,7 @@ void scene_mem_init() { ALLOC_DUMMY(&mem.skeletons); } -void scene_mem_destroy() { +void scene_mem_destroy(void) { // NOTE: the dummy objects are not constructed, so the destruction code below // always skips index 0. (I don't really like the conditional inside the loop, // but this gets the job done without having to specialize the loop macro.) @@ -148,7 +149,7 @@ void scene_mem_destroy() { #define DEF_MEMORY(NAME, TYPE) \ /* xyz* mem_alloc_xyz(); */ \ - TYPE* mem_alloc_##NAME() { return mempool_alloc(&MEM_FIELD(NAME)); } \ + TYPE* mem_alloc_##NAME(void) { return mempool_alloc(&MEM_FIELD(NAME)); } \ /* void mem_free_xyz(xyz**); */ \ void mem_free_##NAME(TYPE** obj) { mempool_free(&MEM_FIELD(NAME), obj); } \ /* xyz* mem_get_xyz(xyz_idx); */ \ @@ -164,7 +165,7 @@ void scene_mem_destroy() { DEF_MEMORY(anima, Anima) DEF_MEMORY(animation, Animation) -DEF_MEMORY(camera, SceneCamera) +DEF_MEMORY(camera, Camera) DEF_MEMORY(light, Light) DEF_MEMORY(material, Material) DEF_MEMORY(mesh, Mesh) -- cgit v1.2.3