Add a substructure for shader states

This commit is contained in:
Dimitri Lozeve 2021-02-26 18:16:56 +01:00
parent bda5ebddca
commit ea6dfed522
3 changed files with 61 additions and 44 deletions

View file

@ -3,20 +3,26 @@
#include <GLFW/glfw3.h>
/**
* Structure representing the state of a shader.
*/
struct shader_state {
unsigned int program; /**< Shader program ID. */
const char *filename; /**< Shader file name. */
};
/**
* Structure representing the state of the renderer and associated
* shaders.
*/
struct renderer_state {
GLFWwindow *window; /**< GLFW window where the shaders are rendered. */
unsigned int screen_shader; /**< Shader for the main screen. */
const char *screen_shader_file; /**< Screen shader file name. */
unsigned int buffer_shader; /**< Shader for the background framebuffer. */
const char *buffer_shader_file; /**< Buffer shader file name. */
size_t frame_count; /**< Frame count since the beginning of the render loop. */
size_t prev_frame_count; /**< Frame count at the last log. */
double time; /**< Time in seconds since the beginning of the render loop. */
double prev_time; /**< Time in seconds at the last log. */
GLFWwindow *window; /**< GLFW window where the shaders are rendered. */
struct shader_state screen_shader; /**< Shader for the main screen. */
struct shader_state buffer_shader; /**< Shader for the framebuffer. */
size_t frame_count; /**< Frame count since the start of the render loop. */
size_t prev_frame_count; /**< Frame count at the last log. */
double time; /**< Time in seconds since the beginning of the render loop. */
double prev_time; /**< Time in seconds at the last log. */
};
GLFWwindow *initialize_window(int width, int height);