diff options
author | quou <quou@disroot.org> | 2024-07-13 23:46:14 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-07-13 23:46:31 +1000 |
commit | d7160d62b5d78e9191b4d61d7f491deb728cb478 (patch) | |
tree | 0bbb087df0fa32b2e47f00d8fc602f4921eec5a7 /asset.h | |
parent | a43eb70ebe7844db0a4ffece47c22ae12384781b (diff) |
Model loading and basic lighting.
Diffstat (limited to 'asset.h')
-rw-r--r-- | asset.h | 60 |
1 files changed, 60 insertions, 0 deletions
@@ -0,0 +1,60 @@ +#ifndef asset_h +#define asset_h + +#include "memory.h" + +struct Mesh; + +#define assets_xmacro() \ + x( \ + asset_id_cube, \ + asset_type_mesh, \ + "cube.msh" \ + ) \ + x( \ + asset_id_monkey, \ + asset_type_mesh, \ + "monkey.msh" \ + ) \ + +typedef enum { +#define x(id, type, path) id, + assets_xmacro() +#undef x + asset_id_count +} Asset_ID; + +typedef enum { + asset_type_mesh +} Asset_Type; + +typedef struct { + Asset_ID id; + Asset_Type type; + const void* payload; + int payload_size; +} Asset; + +typedef struct { + Asset_Type type; + const char* name; +} Asset_Meta; + +typedef struct { + int size; + int offset; + char* buffer; +} Asset_Data; + +void preload_assets(Arena* mem); +const Asset* get_asset(Asset_ID id); +const Asset_Meta* get_asset_meta(Asset_ID id); + +Asset_Data* read_asset_data( + const char* name, + Arena* arena +); + +const struct Mesh* get_mesh(Asset_ID id); + +#endif |