From c6ec37cd355b313083af5be3435162224020fe5e Mon Sep 17 00:00:00 2001 From: sanine-a Date: Wed, 20 May 2020 21:29:09 -0500 Subject: add honey_texture --- include/honey.h | 1 + include/texture.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 include/texture.h (limited to 'include') diff --git a/include/honey.h b/include/honey.h index 251881e..9b048c0 100644 --- a/include/honey.h +++ b/include/honey.h @@ -4,6 +4,7 @@ #include "common.h" #include "mesh.h" #include "shader.h" +#include "texture.h" typedef GLFWwindow* honey_window; diff --git a/include/texture.h b/include/texture.h new file mode 100644 index 0000000..ee367ba --- /dev/null +++ b/include/texture.h @@ -0,0 +1,32 @@ +#ifndef HONEY_TEXTURE_H +#define HONEY_TEXTURE_H + +/** @file 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); + +#endif -- cgit v1.2.1