diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/common.h | 2 | ||||
-rw-r--r-- | include/honey.h | 1 | ||||
-rw-r--r-- | include/light.h | 33 | ||||
-rw-r--r-- | include/shader.h | 21 |
4 files changed, 56 insertions, 1 deletions
diff --git a/include/common.h b/include/common.h index 83934ac..680f097 100644 --- a/include/common.h +++ b/include/common.h @@ -42,7 +42,7 @@ typedef enum { HONEY_N_ERRORS } honey_error; -#define HONEY_ERROR_DATA_STRING_LENGTH 512 +#define HONEY_ERROR_DATA_STRING_LENGTH 4096 static struct { char string1[HONEY_ERROR_DATA_STRING_LENGTH]; diff --git a/include/honey.h b/include/honey.h index 1d45195..77dd678 100644 --- a/include/honey.h +++ b/include/honey.h @@ -9,6 +9,7 @@ #include "camera.h" #include "common.h" #include "input.h" +#include "light.h" #include "mesh.h" #include "model.h" #include "primitives.h" diff --git a/include/light.h b/include/light.h new file mode 100644 index 0000000..93fcfd1 --- /dev/null +++ b/include/light.h @@ -0,0 +1,33 @@ +#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/shader.h b/include/shader.h index 9a567f5..b502137 100644 --- a/include/shader.h +++ b/include/shader.h @@ -7,6 +7,7 @@ #define HONEY_SHADER_H #include "common.h" +#include "light.h" typedef int honey_shader; @@ -85,6 +86,26 @@ 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 |