summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asset_cache.h10
-rw-r--r--include/common.h41
-rw-r--r--include/error.h7
-rw-r--r--include/shader.h23
4 files changed, 54 insertions, 27 deletions
diff --git a/include/asset_cache.h b/include/asset_cache.h
deleted file mode 100644
index 8d18448..0000000
--- a/include/asset_cache.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef HONEY_ASSET_CACHE
-#define HONEY_ASSET_CACHE
-
-#ifndef HONEY_ASSET_CACHE_SIZE
-#define HONEY_ASSET_CACHE_SIZE 2048
-#endif
-
-
-
-#endif
diff --git a/include/common.h b/include/common.h
index e76d53c..f83acca 100644
--- a/include/common.h
+++ b/include/common.h
@@ -12,8 +12,49 @@
#include <cglm/cglm.h>
#include <cglm/call.h>
+#include <assimp/cimport.h>
+#include <assimp/scene.h>
+#include <assimp/postprocess.h>
+
#include "stb_image.h"
typedef GLFWwindow* honey_window;
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+typedef enum {
+ /* generic results */
+ HONEY_OK,
+ HONEY_MEMORY_ALLOCATION_ERROR,
+ HONEY_FILE_READ_ERROR,
+
+ /* shader errors */
+ HONEY_VERTEX_SHADER_COMPILATION_ERROR,
+ HONEY_FRAGMENT_SHADER_COMPILATION_ERROR,
+ HONEY_SHADER_LINK_ERROR,
+
+ /* mesh errors */
+ HONEY_MESH_BAD_VERTEX_DATA,
+ HONEY_MESH_BAD_INDEX_DATA,
+
+ HONEY_N_ERRORS } honey_error;
+
+#define HONEY_ERROR_DATA_STRING_LENGTH 512
+
+static struct {
+ char string1[HONEY_ERROR_DATA_STRING_LENGTH];
+ char string2[HONEY_ERROR_DATA_STRING_LENGTH];
+} honey_error_data;
+
+void honey_error_clear_strings();
+void honey_error_set_string1(char* string);
+void honey_error_set_string2(char* string);
+
+/** @brief Generate a human-readable error message.
+ *
+ * @param[out] error_string A string with at least 3*HONEY_ERROR_DATA_STRING_LENGTH characters to store the result
+ * @param[in] error The error to generate a message for
+ */
+void honey_human_readable_error(char* error_string, honey_error error);
+
#endif
diff --git a/include/error.h b/include/error.h
new file mode 100644
index 0000000..e456c88
--- /dev/null
+++ b/include/error.h
@@ -0,0 +1,7 @@
+#ifndef HONEY_ERROR_H
+#define HONEY_ERROR_H
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+
+#endif
diff --git a/include/shader.h b/include/shader.h
index 552af5d..9a567f5 100644
--- a/include/shader.h
+++ b/include/shader.h
@@ -8,17 +8,6 @@
#include "common.h"
-enum honey_shader_result {
- SHADER_OK,
- VERTEX_SHADER_NOT_FOUND,
- VERTEX_SHADER_TOO_LARGE,
- VERTEX_SHADER_FAILED,
- FRAGMENT_SHADER_NOT_FOUND,
- FRAGMENT_SHADER_TOO_LARGE,
- FRAGMENT_SHADER_FAILED,
- SHADER_LINK_FAILED,
- N_SHADER_STATES };
-
typedef int honey_shader;
/** @brief Load a shader.
@@ -30,9 +19,9 @@ typedef int honey_shader;
*
* @return The result of the shader load.
*/
-enum honey_shader_result honey_shader_load(honey_shader* shader,
- char* vertex_shader_path,
- char* fragment_shader_path);
+honey_error honey_shader_load(honey_shader* shader,
+ char* vertex_shader_path,
+ char* fragment_shader_path);
/** @brief Create a shader from code strings.
*
@@ -42,9 +31,9 @@ enum honey_shader_result honey_shader_load(honey_shader* shader,
*
* @return The result of the shader creation.
*/
-enum honey_shader_result honey_shader_new(honey_shader* shader,
- char* vertex_shader_code,
- char* fragment_shader_code);
+honey_error honey_shader_new(honey_shader* shader,
+ char* vertex_shader_code,
+ char* fragment_shader_code);
/** @brief Set an integer uniform.
*