From dba3ce51eeab2485f757143ab7560e89590824b8 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Wed, 2 Jul 2025 08:49:48 -0700 Subject: Add comments and TODOs --- src/asset/asset_cache.c | 2 ++ src/scene/object_impl.h | 5 +++-- src/scene/scene_memory.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/asset/asset_cache.c b/src/asset/asset_cache.c index 16c4d5c..727b63f 100644 --- a/src/asset/asset_cache.c +++ b/src/asset/asset_cache.c @@ -179,6 +179,7 @@ static Model* clone_model(const Model* model) { void gfx_init_asset_cache(AssetCache* cache) { assert(cache); + mempool_make(&cache->assets); // Allocate a dummy asset at index 0 to guarantee that no assets allocated by @@ -189,6 +190,7 @@ void gfx_init_asset_cache(AssetCache* cache) { void gfx_destroy_asset_cache(AssetCache* cache) { assert(cache); + // TODO: Destroy assets here. mempool_del(&cache->assets); } diff --git a/src/scene/object_impl.h b/src/scene/object_impl.h index 88f8e31..ead93f1 100644 --- a/src/scene/object_impl.h +++ b/src/scene/object_impl.h @@ -21,6 +21,7 @@ typedef struct MeshLink { typedef struct SceneObject { mesh_link_idx mesh_link; /// First MeshLink in the list. skeleton_idx skeleton; /// 0 for static objects. - node_idx parent; /// Parent SceneNode. - aabb3 box; + // TODO: Can we just store node indices in nodes, not the contained object? + node_idx parent; /// Parent SceneNode. + aabb3 box; } SceneObject; diff --git a/src/scene/scene_memory.c b/src/scene/scene_memory.c index d1d81a9..91880bb 100644 --- a/src/scene/scene_memory.c +++ b/src/scene/scene_memory.c @@ -73,7 +73,7 @@ void scene_mem_init() { mempool_make(&mem.skeletons); // Allocate dummy objects at index 0 to guarantee that no objects allocated by - // the caller map to index 0. + // the caller map to index 0. This allows 0 to be used as a sentinel. ALLOC_DUMMY(&mem.animas); ALLOC_DUMMY(&mem.animations); ALLOC_DUMMY(&mem.cameras); -- cgit v1.2.3