techkaczynski.dev / code

summaryrefslogtreecommitdiff
path: root/res.h
blob: 7fd2946217aada42566ab13d9c5c835ac6468377 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef RES_H
#define RES_H

#include "common.h"

typedef struct {
	Shader sdr;
	map_t(int) uniforms;
} FunShader;

typedef enum {
	ASSET_TAG_INVALID,
	ASSET_TAG_MODEL,
	ASSET_TAG_TEXTURE,
	ASSET_TAG_SOUND,
	ASSET_TAG_FONT,
} AssetTag;

typedef struct {
	AssetTag tag;
	union {
		Model mdl;
		Texture tex;
		Sound snd;
		Font fnt;
	};
	char *path;
	u32 path_strlen, ref_cnt;
	bool loaded;
} Asset;

void		res_init(void);
void		res_exit(void);
void		res_update(void);

char**		asset_mdl_keys(int *count);

Asset*		asset_get(cstr key);
FunShader*	shader_get(cstr key);


void		fun_shader_create(cstr key, cstr vpath, cstr fpath);
void		fun_shader_delete(FunShader*);
int		fun_shader_uniform(cstr skey, cstr ukey);

#endif