summaryrefslogtreecommitdiff
path: root/src/resource.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/resource.h')
-rw-r--r--src/resource.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/resource.h b/src/resource.h
new file mode 100644
index 0000000..1e6a354
--- /dev/null
+++ b/src/resource.h
@@ -0,0 +1,55 @@
+#ifndef ANIMTOOL_RESOURCE_H_
+#define ANIMTOOL_RESOURCE_H_
+
+#include "util/container.h"
+#include "draw.h"
+#include "source.h"
+
+struct texture_source
+{
+ enum texture_type type;
+ struct loc_str path;
+};
+
+struct texture
+{
+ union {
+ texture_id id;
+ struct texture_source source;
+ };
+};
+
+enum mesh_source_type
+{
+ MESH_OBJ,
+ MESH_CUBE,
+};
+
+struct mesh_source {
+ enum mesh_source_type type;
+ union {
+ struct loc_str path;
+ };
+};
+
+struct mesh
+{
+ union {
+ mesh_id id;
+ struct mesh_source source;
+ };
+};
+
+struct cache
+{
+ option(mesh_id) cube_mesh;
+ map(texture_id) textures[2];
+ map(mesh_id) meshes;
+};
+
+void texture_load(struct texture *tex, struct source *src, struct draw_backend *draw, struct cache *cache);
+void mesh_load(struct mesh *mesh, struct source *src, struct draw_backend *draw, struct cache *cache);
+
+void cache_free(struct cache *cache);
+
+#endif