summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.h4
-rw-r--r--include/mesh.h21
-rw-r--r--include/model.h2
-rw-r--r--include/primitives.h31
-rw-r--r--include/scene.h27
-rw-r--r--include/shader.h4
6 files changed, 62 insertions, 27 deletions
diff --git a/include/common.h b/include/common.h
index 680f097..56c1634 100644
--- a/include/common.h
+++ b/include/common.h
@@ -40,7 +40,7 @@ typedef enum {
/* model errors */
HONEY_MODEL_LOAD_ERROR,
- HONEY_N_ERRORS } honey_error;
+ HONEY_N_ERRORS } honey_result;
#define HONEY_ERROR_DATA_STRING_LENGTH 4096
@@ -58,6 +58,6 @@ void honey_error_set_string2(char* string);
* @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);
+void honey_human_readable_error(char* error_string, honey_result error);
#endif
diff --git a/include/mesh.h b/include/mesh.h
index e3b5c39..de2370f 100644
--- a/include/mesh.h
+++ b/include/mesh.h
@@ -11,13 +11,6 @@
#include "common.h"
#include "shader.h"
-enum honey_mesh_result {
- MESH_OK,
- MEMORY_ERROR,
- BAD_VERTEX_DATA,
- BAD_INDEX_DATA,
- N_MESH_RESULTS };
-
typedef struct {
float* vertices;
unsigned int n_vertices;
@@ -39,13 +32,13 @@ typedef struct {
* @param[in] indices Array of vertex indices
* @param[in] n_indices The number of elements in the index array
*/
-enum honey_mesh_result honey_mesh_new(honey_mesh* mesh,
- float* vertices,
- unsigned int n_vertices,
- unsigned int n_attributes,
- unsigned int* attribute_sizes,
- unsigned int* indices,
- unsigned int n_indices);
+honey_result honey_mesh_new(honey_mesh* mesh,
+ float* vertices,
+ unsigned int n_vertices,
+ unsigned int n_attributes,
+ unsigned int* attribute_sizes,
+ unsigned int* indices,
+ unsigned int n_indices);
/** @brief Draw a mesh on screen.
*
diff --git a/include/model.h b/include/model.h
index 00d20b7..d210792 100644
--- a/include/model.h
+++ b/include/model.h
@@ -22,7 +22,7 @@ typedef struct {
* @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);
+honey_result 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);
diff --git a/include/primitives.h b/include/primitives.h
index a7e4ccb..58e9dd3 100644
--- a/include/primitives.h
+++ b/include/primitives.h
@@ -9,6 +9,21 @@
#include "common.h"
#include "mesh.h"
+/** @brief Create a textured plane.
+ *
+ * This function creates a plane with vertex positions in attribute 0,
+ * vertex normals in attribute 1, and UV coordinates in attribute 2.
+ *
+ * @param[out] mesh Pointer to the destination mesh
+ * @param[in] width Desired width of the plane (x-axis)
+ * @param[in] height Desired height of the plane (y-axis)
+ *
+ * @return 0 (HONEY_OK) on success, and an error code otherwise.
+ */
+honey_result honey_mesh_new_textured_plane(honey_mesh* mesh,
+ float width,
+ float height);
+
/** @brief Create a cube.
*
* This function creates a cube with vertex positions in attribute 0.
@@ -20,10 +35,10 @@
*
* @return Success or failure code
*/
-enum honey_mesh_result honey_mesh_new_cube(honey_mesh* mesh,
- float width,
- float height,
- float depth);
+honey_result honey_mesh_new_cube(honey_mesh* mesh,
+ float width,
+ float height,
+ float depth);
/** @brief Create a textured cube.
*
* This function creates a cube with vertex positions in attribute 0,
@@ -36,9 +51,9 @@ enum honey_mesh_result honey_mesh_new_cube(honey_mesh* mesh,
*
* @return Success or failure code
*/
-enum honey_mesh_result honey_mesh_new_textured_cube(honey_mesh* mesh,
- float width,
- float height,
- float depth);
+honey_result honey_mesh_new_textured_cube(honey_mesh* mesh,
+ float width,
+ float height,
+ float depth);
#endif
diff --git a/include/scene.h b/include/scene.h
new file mode 100644
index 0000000..c998af9
--- /dev/null
+++ b/include/scene.h
@@ -0,0 +1,27 @@
+#ifndef HONEY_SCENE_H
+#define HONEY_SCENE_H
+
+#include "common.h"
+#include "light.h"
+#include "model.h"
+#include "texture.h"
+
+#define HONEY_SCENE_MAX_POINT_LIGHTS 8
+#define HONEY_SCENE_MAX_DIRECTIONAL_LIGHTS 8
+#define HONEY_SCENE_MAX_MODELS 8
+#define HONEY_SCENE_MAX_TEXTURES 8
+
+typedef struct {
+ honey_point_light point_lights[HONEY_SCENE_MAX_POINT_LIGHTS];
+ unsigned int n_point_lights;
+
+ honey_directional_light directional_lights[HONEY_SCENE_MAX_DIRECTIONAL_LIGHTS];
+ unsigned int n_directional_lights;
+
+ honey_mode models[HONEY_SCENE_MAX_MODELS];
+ unsigned int n_models;
+} honey_scene;
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+#endif
diff --git a/include/shader.h b/include/shader.h
index b502137..cca8ab9 100644
--- a/include/shader.h
+++ b/include/shader.h
@@ -20,7 +20,7 @@ typedef int honey_shader;
*
* @return The result of the shader load.
*/
-honey_error honey_shader_load(honey_shader* shader,
+honey_result honey_shader_load(honey_shader* shader,
char* vertex_shader_path,
char* fragment_shader_path);
@@ -32,7 +32,7 @@ honey_error honey_shader_load(honey_shader* shader,
*
* @return The result of the shader creation.
*/
-honey_error honey_shader_new(honey_shader* shader,
+honey_result honey_shader_new(honey_shader* shader,
char* vertex_shader_code,
char* fragment_shader_code);