diff options
| author | 3gg <3gg@shellblade.net> | 2025-10-30 17:21:22 -0700 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-10-30 17:21:25 -0700 |
| commit | 440b292c39162284a447b34d3a692143af9fbc87 (patch) | |
| tree | b5f0adf047651a56eb74ba7b92fdf6ebe2bbc635 /src/memory.h | |
| parent | 643382dfd364a193686201e1c82b6fe7f351f068 (diff) | |
- Replace SceneCamera with Camera.
- Remove backpointer from scene types to node to decouple underlying types from the scene graph.
Diffstat (limited to 'src/memory.h')
| -rw-r--r-- | src/memory.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/memory.h b/src/memory.h index 366c6e4..624216d 100644 --- a/src/memory.h +++ b/src/memory.h | |||
| @@ -3,21 +3,23 @@ | |||
| 3 | 3 | ||
| 4 | #include "scene/types.h" | 4 | #include "scene/types.h" |
| 5 | 5 | ||
| 6 | typedef struct Camera Camera; | ||
| 7 | |||
| 6 | /// Initialize scene memory. | 8 | /// Initialize scene memory. |
| 7 | /// | 9 | /// |
| 8 | /// The scene memory guarantees that every object maps to an index different | 10 | /// The scene memory guarantees that every object maps to an index different |
| 9 | /// than 0. This way, 0 can be used as a special index to denote "no value". | 11 | /// than 0. This way, 0 can be used as a special index to denote "no value". |
| 10 | void scene_mem_init(); | 12 | void scene_mem_init(void); |
| 11 | 13 | ||
| 12 | /// Destroy the scene memory and all allocated objects. | 14 | /// Destroy the scene memory and all allocated objects. |
| 13 | void scene_mem_destroy(); | 15 | void scene_mem_destroy(void); |
| 14 | 16 | ||
| 15 | #define NAMED_INDEX(name) name##_idx | 17 | #define NAMED_INDEX(name) name##_idx |
| 16 | 18 | ||
| 17 | #define DECL_MEMORY(name, type) \ | 19 | #define DECL_MEMORY(name, type) \ |
| 18 | typedef struct type type; \ | 20 | typedef struct type type; \ |
| 19 | /* xyz* mem_alloc_xyz() */ \ | 21 | /* xyz* mem_alloc_xyz() */ \ |
| 20 | type* mem_alloc_##name(); \ | 22 | type* mem_alloc_##name(void); \ |
| 21 | /* mem_free_xyz(xyz**) */ \ | 23 | /* mem_free_xyz(xyz**) */ \ |
| 22 | void mem_free_##name(type**); \ | 24 | void mem_free_##name(type**); \ |
| 23 | /* xyz* mem_get_xyz(xyz_idx); */ \ | 25 | /* xyz* mem_get_xyz(xyz_idx); */ \ |
| @@ -27,7 +29,7 @@ void scene_mem_destroy(); | |||
| 27 | 29 | ||
| 28 | DECL_MEMORY(anima, Anima) | 30 | DECL_MEMORY(anima, Anima) |
| 29 | DECL_MEMORY(animation, Animation) | 31 | DECL_MEMORY(animation, Animation) |
| 30 | DECL_MEMORY(camera, SceneCamera) | 32 | DECL_MEMORY(camera, Camera) |
| 31 | DECL_MEMORY(light, Light) | 33 | DECL_MEMORY(light, Light) |
| 32 | DECL_MEMORY(material, Material) | 34 | DECL_MEMORY(material, Material) |
| 33 | DECL_MEMORY(mesh, Mesh) | 35 | DECL_MEMORY(mesh, Mesh) |
