aboutsummaryrefslogtreecommitdiff
path: root/src/asset/asset_cache.h
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-06-27 10:18:39 -0700
committer3gg <3gg@shellblade.net>2025-06-27 10:18:39 -0700
commitbd57f345ed9dbed1d81683e48199626de2ea9044 (patch)
tree4221f2f2a7ad2244d2e93052bd68187ec91b8ea9 /src/asset/asset_cache.h
parent9a82ce0083437a4f9f58108b2c23b957d2249ad8 (diff)
Restructure projectHEADmain
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*);