diff options
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 |