You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

55 lines
3.2 KiB

#ifndef RENDERING_WINDOW_H
#define RENDERING_WINDOW_H
#include "ShaderProgram.h"
#include "ExternalLib/tinydir.h"
#include "ExternalLib/glad.h"
#include "GLFW/glfw3.h"
#include "Camera.h"
/*****************************************************************************
* RenderingWindow is the heart of the engine, it is storing every *
* OpenGL context related information as well as glfw informations *
* ATM, it is also storing Scene informations (Objects, ShaderPrograms, etc) *
*****************************************************************************/
class RenderingWindow
{
private:
/***** Members *****/
GLFWwindow* window; // glfw window
float executionTime; // Just a float keeping track of how long the program has been running (useful for funky shaders and rotation)
float deltaTime; // time between each frame
float lastTime; // variable used to compute deltaTime
public:
/***** Members *****/
int width, height;
// TODO Find a proper way to store ShaderPrograms
ShaderProgram mainShaderProgram; // default ShaderProgram used to render every object
// Required to be public due to key_callback
// indirect access .... like the rest of the vars
// TODO : find a proper way to put it back in private
ShaderProgram skyboxShaderProgram; // skybox ShaderProgram
ShaderProgram floorShaderProgram; // floor ShaderProgram
Camera mainCamera; // Camera used to render the scene (storing view and projection matrix)
tinydir_dir shaderBaseDirectory; // directory containing the base Shader folder containing
// every Shader folder (subfolders)
std::list<std::string> shaderFolderPathList;
// list of path containing every Shader folder
std::list<std::string>::const_iterator currentShaderFolderPath;
// iterator pointing to the currently used Shader Folder Path
// Path of the current Shader Folder Path
/***** Constructor *****/
RenderingWindow(const int width, const int height); // Initialize the glfw window, shaders, setup OpenGL global variables, etc
/***** Methods *****/
void init(); // Initialize everything OpenGL context related
void show(); // Launches the OpenGL loop
void render(); // Part of the OpenGL Loop handles input, time and uniform management
// also calls the scene rendering method
void drawScene(Camera& camera, int nbRecursions); // Simili GraphScene draw method, iterate over Objects,
// bind their VAO, shaders, uniforms and draw them
void handleKeyInputs(); // key listener
};
#endif /* RENDERING_WINDOW_H */