diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/camera.h | 132 | ||||
-rw-r--r-- | include/common.h | 63 | ||||
-rw-r--r-- | include/error.h | 7 | ||||
-rw-r--r-- | include/honey.h | 53 | ||||
-rw-r--r-- | include/input.h | 186 | ||||
-rw-r--r-- | include/keycodes.txt | 121 | ||||
-rw-r--r-- | include/light.h | 33 | ||||
-rw-r--r-- | include/mesh.h | 57 | ||||
-rw-r--r-- | include/model.h | 29 | ||||
-rw-r--r-- | include/primitives.h | 59 | ||||
-rw-r--r-- | include/scene.h | 27 | ||||
-rw-r--r-- | include/shader.h | 117 | ||||
-rw-r--r-- | include/texture.h | 42 |
13 files changed, 0 insertions, 926 deletions
diff --git a/include/camera.h b/include/camera.h deleted file mode 100644 index b3b9eed..0000000 --- a/include/camera.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef HONEY_CAMERA_H -#define HONEY_CAMERA_H - -/** @file camera.h - * - * @brief Define the basic honey_camera struct, associated functions, - * and common camera variants. - */ - -#include "common.h" - -enum honey_camera_projection { - HONEY_PERSPECTIVE, - HONEY_ORTHOGRAPHIC, -}; - -typedef struct { - vec3 position; - vec3 angle; /* pitch, yaw, roll */ - vec3 look_direction; - vec3 up; - vec3 right; - mat4 view; - mat4 projection; - enum honey_camera_projection projection_type; - float aspect_ratio; - float near, far; - float fov; - float ortho_left; - float ortho_right; - float ortho_top; - float ortho_bottom; -} honey_camera; - -/** @brief Create a new camera. - * - * The full camera creation function. Most of the time, you will probably use either - * honey_camera_new_perspective() or honey_camera_new_projection() instead. - * - * @param[out] camera Pointer to the destination honey_camera. - * @param[in] position The position of the camera. - * @param[in] angle The Euler angles (pitch, yaw, roll) of the camera. - * @param[in] projection_type The type of projection to use. - * @param[in] aspect_ratio The aspect ratio of the camera. Set to zero if using orthographic projection. - * @param[in] near The distance of the near plane. - * @param[in] far The distance of the far plane. - * @param[in] fov The field of view. Set to zero if using orthographic projection. - * @param[in] left The leftmost distance. Set to zero if using perspective projection. - * @param[in] right The rightmost distance. Set to zero if using perspective projection. - * @param[in] top The uppermost distance. Set to zero if using perspective projection. - * @param[in] bottom The lowest distance. Set to zero if using perspective projection. - */ -void honey_camera_new(honey_camera* camera, - vec3 position, - vec3 angle, - enum honey_camera_projection projection_type, - float aspect_ratio, - float near, float far, - float fov, - float left, float right, float top, float bottom); - -/** @brief Create a camera with a perspective projection matrix. - * - * @param[out] camera Pointer to the destination honey_camera. - * @param[in] position The position of the camera. - * @param[in] angle The Euler angles (pitch, yaw, roll) of the camera. - * @param[in] aspect_ratio The aspect ratio of the camera. - * @param[in] near The distance of the near plane. - * @param[in] far The distance of the far plane. - * @param[in] fov The field of view. - */ -void honey_camera_new_perspective(honey_camera* camera, - vec3 position, - vec3 angle, - float aspect_ratio, - float near, float far, - float fov); - -/** @brief Create a camera with an orthographic projection matrix. - * - * @param[out] camera Pointer to the destination honey_camera. - * @param[in] position The position of the camera. - * @param[in] angle The Euler angles (pitch, yaw, roll) of the camera. - * @param[in] near The distance of the near plane. - * @param[in] far The distance of the far plane. - * @param[in] left The leftmost distance. - * @param[in] right The rightmost distance. - * @param[in] top The uppermost distance. - * @param[in] bottom The lowest distance. - */ -void honey_camera_new_orthographic(honey_camera* camera, - vec3 position, - vec3 angle, - float near, float far, - float left, float right, float top, float bottom); - -/** @brief (Re-)Calculate a camera's look_direction. - * - * @param[in] Pointer to the camera to re-calculate. - */ -void honey_camera_calculate_look_direction(honey_camera* camera); - -/** @brief (Re-)Calculate a camera's up vector. - * - * @param[in] Pointer to the camera to re-calculate. - */ -void honey_camera_calculate_up(honey_camera* camera); - -/** @brief (Re-)Calculate a camera's right vector. - * - * @param[in] Pointer to the camera to re-calculate. - */ -void honey_camera_calculate_right(honey_camera* camera); - -/** @brief (Re-)Calculate a camera's view matrix. - * - * This function need only be called when the camera has been moved in some way. - * - * @param[in] camera Pointer to the camera to re-calculate. - */ -void honey_camera_calculate_view(honey_camera* camera); - -/** @brief (Re-)Calculate a camera's projection matrix. - * - * This function need only be called when the projection has changes in some way. - * Most commonly, this would be changing the FOV. - * - * @param[in] camera Pointer to the camera to re-calculate. - */ -void honey_camera_calculate_projection(honey_camera* camera); - -#endif diff --git a/include/common.h b/include/common.h deleted file mode 100644 index 56c1634..0000000 --- a/include/common.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef HONEY_COMMON_H -#define HONEY_COMMON_H - -#include <stdio.h> -#include <stdlib.h> -#include <stdbool.h> -#include <string.h> - -#include "glad.h" -#include <GLFW/glfw3.h> - -#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, - - /* model errors */ - HONEY_MODEL_LOAD_ERROR, - - HONEY_N_ERRORS } honey_result; - -#define HONEY_ERROR_DATA_STRING_LENGTH 4096 - -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_result error); - -#endif diff --git a/include/error.h b/include/error.h deleted file mode 100644 index e456c88..0000000 --- a/include/error.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef HONEY_ERROR_H -#define HONEY_ERROR_H - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - - -#endif diff --git a/include/honey.h b/include/honey.h deleted file mode 100644 index 77dd678..0000000 --- a/include/honey.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef HONEY_ENGINE_H -#define HONEY_ENGINE_H - -/** @file honey.h - * - * @brief Defines the basic loading and callback functions. -*/ - -#include "camera.h" -#include "common.h" -#include "input.h" -#include "light.h" -#include "mesh.h" -#include "model.h" -#include "primitives.h" -#include "shader.h" -#include "texture.h" - -/** @brief Initialize Honey. - * - * @param[in] screen_width The desired width of the screen in pixels - * @param[in] screen_height The desired height of the screen in pixels - * @param[in] window_title Title to use for the window. - */ -honey_window honey_setup(int screen_width, int screen_height, char* window_title); - -static void (*honey_update_callback)(float dt); -static void (*honey_draw_callback)(); - -/** @brief Set the main update function. - * - * @param[in] update_callback The function to call every loop - */ -void honey_set_update_callback(void (*update_callback)(float)); - -/** @brief Set the main draw function - * - * @param[in] draw_callback The function to call every draw cycle - */ -void honey_set_draw_callback(void (*draw_callback)()); - -/** @brief The main game loop. - * - * @param[in] window The window the game is running in, created with honey_setup() - */ -void honey_run(honey_window window); - -#define honey_set_resize_callback glfwSetFramebufferSizeCallback -#define honey_set_mouse_move_callback glfwSetCursorPosCallback - -#define honey_quit glfwTerminate - -#endif diff --git a/include/input.h b/include/input.h deleted file mode 100644 index 91c250f..0000000 --- a/include/input.h +++ /dev/null @@ -1,186 +0,0 @@ -#ifndef HONEY_INPUT_H -#define HONEY_INPUT_H - -/** @file input.h - * - * @brief Wrap GLFW input functions for honey. - */ - -#include "common.h" - -#define HONEY_KEY_UNKNOWN 0 -#define HONEY_KEY_SPACE 1 -#define HONEY_KEY_APOSTROPHE 2 -#define HONEY_KEY_COMMA 3 -#define HONEY_KEY_MINUS 4 -#define HONEY_KEY_PERIOD 5 -#define HONEY_KEY_SLASH 6 -#define HONEY_KEY_0 7 -#define HONEY_KEY_1 8 -#define HONEY_KEY_2 9 -#define HONEY_KEY_3 10 -#define HONEY_KEY_4 11 -#define HONEY_KEY_5 12 -#define HONEY_KEY_6 13 -#define HONEY_KEY_7 14 -#define HONEY_KEY_8 15 -#define HONEY_KEY_9 16 -#define HONEY_KEY_SEMICOLON 17 -#define HONEY_KEY_EQUAL 18 -#define HONEY_KEY_A 19 -#define HONEY_KEY_B 20 -#define HONEY_KEY_C 21 -#define HONEY_KEY_D 22 -#define HONEY_KEY_E 23 -#define HONEY_KEY_F 24 -#define HONEY_KEY_G 25 -#define HONEY_KEY_H 26 -#define HONEY_KEY_I 27 -#define HONEY_KEY_J 28 -#define HONEY_KEY_K 29 -#define HONEY_KEY_L 30 -#define HONEY_KEY_M 31 -#define HONEY_KEY_N 32 -#define HONEY_KEY_O 33 -#define HONEY_KEY_P 34 -#define HONEY_KEY_Q 35 -#define HONEY_KEY_R 36 -#define HONEY_KEY_S 37 -#define HONEY_KEY_T 38 -#define HONEY_KEY_U 39 -#define HONEY_KEY_V 40 -#define HONEY_KEY_W 41 -#define HONEY_KEY_X 42 -#define HONEY_KEY_Y 43 -#define HONEY_KEY_Z 44 -#define HONEY_KEY_LEFT_BRACKET 45 -#define HONEY_KEY_BACKSLASH 46 -#define HONEY_KEY_RIGHT_BRACKET 47 -#define HONEY_KEY_GRAVE_ACCENT 48 -#define HONEY_KEY_WORLD_1 49 -#define HONEY_KEY_WORLD_2 50 -#define HONEY_KEY_ESCAPE 51 -#define HONEY_KEY_ENTER 52 -#define HONEY_KEY_TAB 53 -#define HONEY_KEY_BACKSPACE 54 -#define HONEY_KEY_INSERT 55 -#define HONEY_KEY_DELETE 56 -#define HONEY_KEY_RIGHT 57 -#define HONEY_KEY_LEFT 58 -#define HONEY_KEY_DOWN 59 -#define HONEY_KEY_UP 60 -#define HONEY_KEY_PAGE_UP 61 -#define HONEY_KEY_PAGE_DOWN 62 -#define HONEY_KEY_HOME 63 -#define HONEY_KEY_END 64 -#define HONEY_KEY_CAPS_LOCK 65 -#define HONEY_KEY_SCROLL_LOCK 66 -#define HONEY_KEY_NUM_LOCK 67 -#define HONEY_KEY_PRINT_SCREEN 68 -#define HONEY_KEY_PAUSE 69 -#define HONEY_KEY_F1 70 -#define HONEY_KEY_F2 71 -#define HONEY_KEY_F3 72 -#define HONEY_KEY_F4 73 -#define HONEY_KEY_F5 74 -#define HONEY_KEY_F6 75 -#define HONEY_KEY_F7 76 -#define HONEY_KEY_F8 77 -#define HONEY_KEY_F9 78 -#define HONEY_KEY_F10 79 -#define HONEY_KEY_F11 80 -#define HONEY_KEY_F12 81 -#define HONEY_KEY_F13 82 -#define HONEY_KEY_F14 83 -#define HONEY_KEY_F15 84 -#define HONEY_KEY_F16 85 -#define HONEY_KEY_F17 86 -#define HONEY_KEY_F18 87 -#define HONEY_KEY_F19 88 -#define HONEY_KEY_F20 89 -#define HONEY_KEY_F21 90 -#define HONEY_KEY_F22 91 -#define HONEY_KEY_F23 92 -#define HONEY_KEY_F24 93 -#define HONEY_KEY_F25 94 -#define HONEY_KEY_KP_0 95 -#define HONEY_KEY_KP_1 96 -#define HONEY_KEY_KP_2 97 -#define HONEY_KEY_KP_3 98 -#define HONEY_KEY_KP_4 99 -#define HONEY_KEY_KP_5 100 -#define HONEY_KEY_KP_6 101 -#define HONEY_KEY_KP_7 102 -#define HONEY_KEY_KP_8 103 -#define HONEY_KEY_KP_9 104 -#define HONEY_KEY_KP_DECIMAL 105 -#define HONEY_KEY_KP_DIVIDE 106 -#define HONEY_KEY_KP_MULTIPLY 107 -#define HONEY_KEY_KP_SUBTRACT 108 -#define HONEY_KEY_KP_ADD 109 -#define HONEY_KEY_KP_ENTER 110 -#define HONEY_KEY_KP_EQUAL 111 -#define HONEY_KEY_LEFT_SHIFT 112 -#define HONEY_KEY_LEFT_CONTROL 113 -#define HONEY_KEY_LEFT_ALT 114 -#define HONEY_KEY_LEFT_SUPER 115 -#define HONEY_KEY_RIGHT_SHIFT 116 -#define HONEY_KEY_RIGHT_CONTROL 117 -#define HONEY_KEY_RIGHT_ALT 118 -#define HONEY_KEY_RIGHT_SUPER 119 -#define HONEY_KEY_MENU 120 - -#define HONEY_N_KEYS 121 - -#define HONEY_KEY_PRESS GLFW_PRESS -#define HONEY_KEY_RELEASE GLFW_RELEASE - -unsigned int honey_key_states[HONEY_N_KEYS]; -static void (*honey_key_callbacks[HONEY_N_KEYS])(void*, int); -static void* honey_key_callbacks_data[HONEY_N_KEYS]; -static void (*honey_keyboard_callback)(honey_window window, int key, int scancode, int action, int mods); - -/** @brief Initializes Honey's internal keyboard states. - * - * This function is called by honey_setup, so you shouldn't need - * to manually call it in most cases. - */ -void honey_setup_keyboard(); - -/** @brief Check if a key is down. - * - * @param[in] key The key to query. - * - * @return TRUE if the key is presently held down; FALSE if it is not, or if the keycode was out of bounds. - */ -bool honey_key_down(int key); - -/** @brief Bind a callback to a key. - * - * The callback must have signature (void*, int), where the first argument is supplied by the - * void* supplied with this function, and the int is one of HONEY_KEY_PRESS or HONEY_KEY_RELEASE, - * depending on the action that triggered the callback. - * - * @param[in] key The key to bind the callback to. - * @param[in] callback The callback function to bind. - * @param[in] data Data to pass to the callback function upon triggering. - */ -void honey_key_bind(int key, void (*callback)(void*, int), void* data); - -/** @brief Unbind a key callback. - * - * THIS FUNCTION DOES NOT FREE MEMORY! If you allocated any, be sure to free it yourself! - * - * @param[in] key The key to unbind a callback from. - */ -void honey_key_unbind(int key); - -/** @brief Unbind all key callbacks. - * - * THIS FUNCTION DOES NOT FREE MEMORY! If you allocated any, be sure to free it yourself! - */ -void honey_key_unbind_all(); - -void default_honey_keyboard_callback(honey_window window, int key, int scancode, int action, int mods); - -#endif diff --git a/include/keycodes.txt b/include/keycodes.txt deleted file mode 100644 index 12f35b3..0000000 --- a/include/keycodes.txt +++ /dev/null @@ -1,121 +0,0 @@ -GLFW_KEY_UNKNOWN -GLFW_KEY_SPACE -GLFW_KEY_APOSTROPHE -GLFW_KEY_COMMA -GLFW_KEY_MINUS -GLFW_KEY_PERIOD -GLFW_KEY_SLASH -GLFW_KEY_0 -GLFW_KEY_1 -GLFW_KEY_2 -GLFW_KEY_3 -GLFW_KEY_4 -GLFW_KEY_5 -GLFW_KEY_6 -GLFW_KEY_7 -GLFW_KEY_8 -GLFW_KEY_9 -GLFW_KEY_SEMICOLON -GLFW_KEY_EQUAL -GLFW_KEY_A -GLFW_KEY_B -GLFW_KEY_C -GLFW_KEY_D -GLFW_KEY_E -GLFW_KEY_F -GLFW_KEY_G -GLFW_KEY_H -GLFW_KEY_I -GLFW_KEY_J -GLFW_KEY_K -GLFW_KEY_L -GLFW_KEY_M -GLFW_KEY_N -GLFW_KEY_O -GLFW_KEY_P -GLFW_KEY_Q -GLFW_KEY_R -GLFW_KEY_S -GLFW_KEY_T -GLFW_KEY_U -GLFW_KEY_V -GLFW_KEY_W -GLFW_KEY_X -GLFW_KEY_Y -GLFW_KEY_Z -GLFW_KEY_LEFT_BRACKET -GLFW_KEY_BACKSLASH -GLFW_KEY_RIGHT_BRACKET -GLFW_KEY_GRAVE_ACCENT -GLFW_KEY_WORLD_1 -GLFW_KEY_WORLD_2 -GLFW_KEY_ESCAPE -GLFW_KEY_ENTER -GLFW_KEY_TAB -GLFW_KEY_BACKSPACE -GLFW_KEY_INSERT -GLFW_KEY_DELETE -GLFW_KEY_RIGHT -GLFW_KEY_LEFT -GLFW_KEY_DOWN -GLFW_KEY_UP -GLFW_KEY_PAGE_UP -GLFW_KEY_PAGE_DOWN -GLFW_KEY_HOME -GLFW_KEY_END -GLFW_KEY_CAPS_LOCK -GLFW_KEY_SCROLL_LOCK -GLFW_KEY_NUM_LOCK -GLFW_KEY_PRINT_SCREEN -GLFW_KEY_PAUSE -GLFW_KEY_F1 -GLFW_KEY_F2 -GLFW_KEY_F3 -GLFW_KEY_F4 -GLFW_KEY_F5 -GLFW_KEY_F6 -GLFW_KEY_F7 -GLFW_KEY_F8 -GLFW_KEY_F9 -GLFW_KEY_F10 -GLFW_KEY_F11 -GLFW_KEY_F12 -GLFW_KEY_F13 -GLFW_KEY_F14 -GLFW_KEY_F15 -GLFW_KEY_F16 -GLFW_KEY_F17 -GLFW_KEY_F18 -GLFW_KEY_F19 -GLFW_KEY_F20 -GLFW_KEY_F21 -GLFW_KEY_F22 -GLFW_KEY_F23 -GLFW_KEY_F24 -GLFW_KEY_F25 -GLFW_KEY_KP_0 -GLFW_KEY_KP_1 -GLFW_KEY_KP_2 -GLFW_KEY_KP_3 -GLFW_KEY_KP_4 -GLFW_KEY_KP_5 -GLFW_KEY_KP_6 -GLFW_KEY_KP_7 -GLFW_KEY_KP_8 -GLFW_KEY_KP_9 -GLFW_KEY_KP_DECIMAL -GLFW_KEY_KP_DIVIDE -GLFW_KEY_KP_MULTIPLY -GLFW_KEY_KP_SUBTRACT -GLFW_KEY_KP_ADD -GLFW_KEY_KP_ENTER -GLFW_KEY_KP_EQUAL -GLFW_KEY_LEFT_SHIFT -GLFW_KEY_LEFT_CONTROL -GLFW_KEY_LEFT_ALT -GLFW_KEY_LEFT_SUPER -GLFW_KEY_RIGHT_SHIFT -GLFW_KEY_RIGHT_CONTROL -GLFW_KEY_RIGHT_ALT -GLFW_KEY_RIGHT_SUPER -GLFW_KEY_MENU diff --git a/include/light.h b/include/light.h deleted file mode 100644 index 93fcfd1..0000000 --- a/include/light.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef HONEY_LIGHT_H -#define HONEY_LIGHT_H - -#include "common.h" - -#define HONEY_MAX_LIGHT_NAME_LENGTH 64 - -typedef struct { - vec3 position; - vec3 color; - - float constant; - float linear; - float quadratic; -} honey_point_light; - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - -typedef struct { - vec3 direction; - vec3 color; -} honey_directional_light; - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - -void honey_point_light_new(honey_point_light* light, - float x, float y, float z, - float r, float g, float b, - float constant, - float linear, - float quadratic); - -#endif diff --git a/include/mesh.h b/include/mesh.h deleted file mode 100644 index de2370f..0000000 --- a/include/mesh.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef HONEY_MESH_H -#define HONEY_MESH_H - -/** @file mesh.h - * - * @brief Defines the honey_mesh struct and related basic mesh functions. -*/ - - - -#include "common.h" -#include "shader.h" - -typedef struct { - float* vertices; - unsigned int n_vertices; - unsigned int* indices; - unsigned int n_indices; - unsigned int vertex_array, vertex_buffer, element_buffer; -} honey_mesh; - -/** @brief Create a new mesh from vertex and index arrays. - * - * Note that this function creates copies of the vertex and index arrays, - * so you can deallocate those immediately. - * - * @param[out] mesh Pointer to the destination honey_mesh struct - * @param[in] vertices Array of floats representing the vertices - * @param[in] n_attributes The number of attributes per vertex - * @param[in] attribute_sizes An array containing for each attribute how many floats it contains - * @param[in] n_vertices The number of vertices (NOT the number of floats in the vertex array) - * @param[in] indices Array of vertex indices - * @param[in] n_indices The number of elements in the index array - */ -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. - * - * @param[in] mesh The mesh to draw - * @param[in] shader The shader to use when drawing the mesh - */ -void honey_mesh_draw(honey_mesh mesh, - honey_shader shader); - -/** @brief Delete a mesh. - * - * @param[in] mesh The mesh to delete - */ -void honey_mesh_delete(honey_mesh mesh); - -#endif diff --git a/include/model.h b/include/model.h deleted file mode 100644 index d210792..0000000 --- a/include/model.h +++ /dev/null @@ -1,29 +0,0 @@ -#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_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); - -#endif diff --git a/include/primitives.h b/include/primitives.h deleted file mode 100644 index 58e9dd3..0000000 --- a/include/primitives.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef HONEY_PRIMITIVES_H -#define HONEY_PRIMITIVES H - -/** @file primitives.h - * - * @brief Define various common primitive objects. - */ - -#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. - * - * @param[out] mesh Pointer to the destination mesh - * @param[in] width Desired width of the cube (x-axis) - * @param[in] height Desired height of the cube (y-axis) - * @param[in] depth Desired depth of the cube (z-axis) - * - * @return Success or failure code - */ -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, - * and texture coordinates in attribute 1. - * - * @param[out] mesh Pointer to the destination mesh - * @param[in] width Desired width of the cube (x-axis) - * @param[in] height Desired height of the cube (y-axis) - * @param[in] depth Desired depth of the cube (z-axis) - * - * @return Success or failure code - */ -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 deleted file mode 100644 index c998af9..0000000 --- a/include/scene.h +++ /dev/null @@ -1,27 +0,0 @@ -#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 deleted file mode 100644 index cca8ab9..0000000 --- a/include/shader.h +++ /dev/null @@ -1,117 +0,0 @@ -/** @file shader.h - * - * @brief Functions to create, manipulate, and destroy GLSL shaders. - */ - -#ifndef HONEY_SHADER_H -#define HONEY_SHADER_H - -#include "common.h" -#include "light.h" - -typedef int honey_shader; - -/** @brief Load a shader. - * - * @param[out] shader Pointer to the shader destination - * - * @param[in] vertex_shader_path The path to the vertex shader source code - * @param[in] fragment_shader_path The path to the fragment shader source code - * - * @return The result of the shader load. - */ -honey_result honey_shader_load(honey_shader* shader, - char* vertex_shader_path, - char* fragment_shader_path); - -/** @brief Create a shader from code strings. - * - * @param[out] shader Pointer to the shader destination. - * @param[in] vertex_shader_code Zero-terminated string containing the vertex shader code to compile - * @param[in] fragment_shader_code Zero-terminated string containing the fragment shader code to compile - * - * @return The result of the shader creation. - */ -honey_result honey_shader_new(honey_shader* shader, - char* vertex_shader_code, - char* fragment_shader_code); - -/** @brief Set an integer uniform. - * - * @param[in] shader The shader to which the uniform belongs - * @param[in] int_name The name of the integer uniform - * @param[in] value The value of the integer uniform - */ -void honey_shader_set_int(honey_shader shader, - char* int_name, - int value); - -/** @brief Set a float uniform. - * - * @param[in] shader The shader to which the uniform belongs - * @param[in] float_name The name of the float uniform - * @param[in] value The value of the float uniform - */ -void honey_shader_set_float(honey_shader shader, - char* float_name, - float value); - -/** @brief Set a vec3 uniform. - * @param[in] shader The shader to which the uniform belongs - * @param[in] vector_name The name of the vec3 uniform - * @param[in] value The value of the vector uniform - */ -void honey_shader_set_vec3(honey_shader shader, - char* vector_name, - vec3 value); - - -/** @brief Set a mat3 uniform. - * - * @param[in] shader The shader to which the uniform belongs - * @param[in] matrix_name The name of the matrix uniform - * @param[in] value The value of the matrix uniform - */ -void honey_shader_set_mat3(honey_shader shader, - char* matrix_name, - mat3 value); - -/** @brief Set a mat4 uniform. - * - * @param[in] shader The shader to which the uniform belongs - * @param[in] matrix_name The name of the matrix uniform - * @param[in] value The value of the matrix uniform - */ -void honey_shader_set_mat4(honey_shader shader, - char* matrix_name, - mat4 value); - -/** @brief Set a point_light uniform. - * - * @param[in] shader The shader to which the uniform belongs - * @param[in] point_light_index The index of the light to set - * @param[in] light The honey_point_light to set - */ -void honey_shader_set_point_light(honey_shader shader, - int point_light_index, - honey_point_light light); - -/** @brief Set a directional_light uniform. - * - * @param[in] shader The shader to which the uniform belongs - * @param[in] directional_light_index The index of the light to set - * @param[in] light The honey_directional_light to set - */ -void honey_shader_set_directional_light(honey_shader shader, - int directional_light_index, - honey_directional_light light); - -/** @brief Use a shader. - */ -#define honey_shader_use glUseProgram - -/** @brief delete a shader. - */ -#define honey_shader_delete glDeleteProgram - -#endif diff --git a/include/texture.h b/include/texture.h deleted file mode 100644 index 4caeebf..0000000 --- a/include/texture.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef HONEY_TEXTURE_H -#define HONEY_TEXTURE_H - -/** @file texture.h - * - *@brief Defines the honey_texture struct and associated functions. -*/ - -#include "common.h" - -enum honey_texture_result { - TEXTURE_OK, - TEXTURE_FAILED, - N_TEXTURE_RESULTS }; - -typedef struct { - unsigned int texture_id; - int width; - int height; - int channels; -} honey_texture; - -/** @brief Load a texture from disk. - * - * @param[out] texture Pointer to the destination texture - * @param[in] texture_path Path to the location of the texture - * @param[in] alpha_channel Set to true if the target image contains an alpha channel - * - * @return Success or failure type - */ -enum honey_texture_result honey_texture_new(honey_texture* texture, - char* texture_path, - bool alpha_channel); - -/** @brief Load a texture into a texture unit. - * - * @param[in] texture The texture to use - * @param[in] texture_unit The texture unit to put the texture in - */ -void honey_texture_use(honey_texture texture, int texture_unit); - -#endif |