aboutsummaryrefslogtreecommitdiff
path: root/src/memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/memory.h')
-rw-r--r--src/memory.h10
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
6typedef 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".
10void scene_mem_init(); 12void scene_mem_init(void);
11 13
12/// Destroy the scene memory and all allocated objects. 14/// Destroy the scene memory and all allocated objects.
13void scene_mem_destroy(); 15void 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
28DECL_MEMORY(anima, Anima) 30DECL_MEMORY(anima, Anima)
29DECL_MEMORY(animation, Animation) 31DECL_MEMORY(animation, Animation)
30DECL_MEMORY(camera, SceneCamera) 32DECL_MEMORY(camera, Camera)
31DECL_MEMORY(light, Light) 33DECL_MEMORY(light, Light)
32DECL_MEMORY(material, Material) 34DECL_MEMORY(material, Material)
33DECL_MEMORY(mesh, Mesh) 35DECL_MEMORY(mesh, Mesh)