49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <d3d11.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct AssetManager AssetManager;
|
|
typedef struct Asset Asset;
|
|
|
|
typedef enum {
|
|
ASSET_MESH = 0,
|
|
ASSET_TEXTURE,
|
|
ASSET_SHADER,
|
|
ASSET_MATERIAL,
|
|
ASSET_COUNT
|
|
} AssetType;
|
|
|
|
struct Asset {
|
|
uint32_t id;
|
|
AssetType type;
|
|
int refcount;
|
|
char path[256];
|
|
void* data;
|
|
void (*destroy)(void* data);
|
|
Asset* next;
|
|
struct AssetManager* owner;
|
|
};
|
|
|
|
AssetManager* asset_manager_create(void);
|
|
void asset_manager_destroy(AssetManager* am);
|
|
|
|
Asset* asset_manager_load_mesh(AssetManager* am, ID3D11Device* dev, const char* path);
|
|
Asset* asset_manager_load_texture(AssetManager* am, ID3D11Device* dev, const char* path);
|
|
Asset* asset_manager_load_shader(AssetManager* am, ID3D11Device* dev, const char* vs_path, const char* ps_path);
|
|
|
|
Asset* asset_manager_find(AssetManager* am, const char* path);
|
|
Asset* asset_manager_get(AssetManager* am, uint32_t id);
|
|
|
|
void* asset_data(Asset* a);
|
|
void asset_acquire(Asset* a);
|
|
void asset_release(Asset* a);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|