summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2020-06-01 22:33:43 -0500
committersanine-a <sanine.not@pm.me>2020-06-01 22:33:43 -0500
commite1935b6f7af6d036eb15c75c2a98bf43805c48fc (patch)
tree6e0078c4508347a8243ead80544353b859caf2b8 /include
parentea197a4459f3dc8ad885e5134e6358173650901f (diff)
add model loading
Diffstat (limited to 'include')
-rw-r--r--include/common.h3
-rw-r--r--include/honey.h1
-rw-r--r--include/model.h29
3 files changed, 33 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index f83acca..83934ac 100644
--- a/include/common.h
+++ b/include/common.h
@@ -36,6 +36,9 @@ typedef enum {
/* mesh errors */
HONEY_MESH_BAD_VERTEX_DATA,
HONEY_MESH_BAD_INDEX_DATA,
+
+ /* model errors */
+ HONEY_MODEL_LOAD_ERROR,
HONEY_N_ERRORS } honey_error;
diff --git a/include/honey.h b/include/honey.h
index ccbaf8f..1d45195 100644
--- a/include/honey.h
+++ b/include/honey.h
@@ -10,6 +10,7 @@
#include "common.h"
#include "input.h"
#include "mesh.h"
+#include "model.h"
#include "primitives.h"
#include "shader.h"
#include "texture.h"
diff --git a/include/model.h b/include/model.h
new file mode 100644
index 0000000..00d20b7
--- /dev/null
+++ b/include/model.h
@@ -0,0 +1,29 @@
+#ifndef HONEY_MODEL_H
+#define HONEY_MODEL_H
+
+#include "common.h"
+#include "mesh.h"
+#include "shader.h"
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+#define HONEY_MODEL_MAX_MESHES 32
+
+typedef struct {
+ mat4 model_matrix;
+ honey_mesh meshes[HONEY_MODEL_MAX_MESHES];
+ unsigned int n_meshes;
+} honey_model;
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+/** @brief Load a model.
+ *
+ * @param[out] model Pointer to the destination honey_model struct.
+ * @param[in] path Path of the model to be loaded.
+ */
+honey_error honey_model_load(honey_model* model, char* path);
+void honey_model_draw(honey_model* model, honey_shader shader);
+void honey_model_delete(honey_model* model);
+
+#endif