50 lines
1.4 KiB
C
50 lines
1.4 KiB
C
#ifndef _PIUMA_ASSETS_H_
|
|
#define _PIUMA_ASSETS_H_
|
|
|
|
#include "lib/types.h"
|
|
#include "render/render.h"
|
|
#include "platform.h"
|
|
|
|
|
|
struct asset_manager
|
|
{
|
|
r_shader **shaders;
|
|
u32 shaders_count;
|
|
|
|
r_mesh **models;
|
|
u32 models_count;
|
|
|
|
r_texture **textures;
|
|
u32 textures_count;
|
|
|
|
r_material **materials;
|
|
u32 materials_count;
|
|
|
|
r_object **objects;
|
|
u32 objects_count;
|
|
|
|
void **allocations;
|
|
u32 allocations_count;
|
|
};
|
|
|
|
|
|
// @TODO: return pointer to loaded asset, instead of copying data into *result
|
|
bool assets_load_object_obj(asset_manager *am, const char *filename, r_object *result); // Models, textures, materials get inserted in the gamestate arrays
|
|
bool assets_load_object_gltf(asset_manager *am, const char *filename, r_object *result);
|
|
bool assets_load_audio(asset_manager *am, const char *name, p_audio_buffer *result);
|
|
bool assets_load_cubemap(asset_manager *am, const char *px, const char *nx, const char *py, const char *ny, const char *pz, const char *nz, r_cubemap *result);
|
|
|
|
|
|
void assets_init(asset_manager *am);
|
|
void assets_free(asset_manager *am);
|
|
|
|
r_shader *assets_new_shaders (asset_manager *am, u32 count);
|
|
r_mesh *assets_new_models (asset_manager *am, u32 count);
|
|
r_texture *assets_new_textures (asset_manager *am, u32 count);
|
|
r_material *assets_new_materials(asset_manager *am, u32 count);
|
|
r_object *assets_new_objects (asset_manager *am, u32 count);
|
|
|
|
// @Feature: remove/free single assets
|
|
|
|
#endif
|