aboutsummaryrefslogtreecommitdiff
path: root/src/asset/asset_cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/asset/asset_cache.h')
-rw-r--r--src/asset/asset_cache.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/asset/asset_cache.h b/src/asset/asset_cache.h
new file mode 100644
index 0000000..b2a35ed
--- /dev/null
+++ b/src/asset/asset_cache.h
@@ -0,0 +1,37 @@
1#pragma once
2
3#include <gfx/sizes.h>
4
5#include <cstring.h>
6#include <mempool.h>
7
8typedef struct Model Model;
9typedef struct Texture Texture;
10
11typedef uint64_t Hash;
12
13typedef enum AssetType {
14 ModelAsset,
15 TextureAsset,
16} AssetType;
17
18typedef struct Asset {
19 AssetType type;
20 Hash hash;
21 union {
22 Model* model;
23 const Texture* texture;
24 };
25} Asset;
26
27DEF_MEMPOOL(asset_pool, Asset, GFX_MAX_NUM_ASSETS)
28
29typedef struct AssetCache {
30 asset_pool assets;
31} AssetCache;
32
33/// Create a new asset cache.
34void gfx_init_asset_cache(AssetCache*);
35
36/// Destroy the asset cache.
37void gfx_destroy_asset_cache(AssetCache*);