2014-10-20 16:23:25 +00:00
|
|
|
#ifndef GRAPHICS_HH_INCLUDED
|
|
|
|
#define GRAPHICS_HH_INCLUDED
|
2014-11-14 15:47:47 +00:00
|
|
|
#include <ACGL/OpenGL/GL.hh>
|
2014-10-20 16:23:25 +00:00
|
|
|
|
2014-11-14 15:47:47 +00:00
|
|
|
#include <GLFW/glfw3.h>
|
2014-10-20 16:49:10 +00:00
|
|
|
#include <ACGL/Math/Math.hh>
|
2014-12-04 00:13:59 +00:00
|
|
|
#include <ACGL/OpenGL/Objects/FrameBufferObject.hh>
|
|
|
|
|
2014-11-14 15:47:47 +00:00
|
|
|
#include "level.hh"
|
|
|
|
|
|
|
|
class Graphics {
|
|
|
|
public:
|
|
|
|
Graphics(glm::uvec2 windowSize, float nearPlane, float farPlane);
|
|
|
|
Graphics();
|
2014-12-15 00:05:46 +00:00
|
|
|
void init(Level* level);
|
2015-01-25 23:06:31 +00:00
|
|
|
void render(double time);
|
2014-11-14 15:47:47 +00:00
|
|
|
glm::mat4 buildViewMatrix(Level* level);
|
|
|
|
glm::uvec2 getWindowSize();
|
2014-12-04 00:13:59 +00:00
|
|
|
void resize(glm::uvec2 windowSize);
|
2014-11-21 01:38:03 +00:00
|
|
|
float getFarPlane();
|
2014-11-14 15:47:47 +00:00
|
|
|
private:
|
2015-01-25 23:06:31 +00:00
|
|
|
void updateLights();
|
2015-01-27 10:14:00 +00:00
|
|
|
void saveDepthBufferToDisk(int face, std::string);
|
2015-01-25 23:06:31 +00:00
|
|
|
double lastUpdate;
|
2014-11-14 15:47:47 +00:00
|
|
|
glm::uvec2 windowSize;
|
|
|
|
float nearPlane;
|
|
|
|
float farPlane;
|
2014-12-04 00:13:59 +00:00
|
|
|
ACGL::OpenGL::SharedShaderProgram lightingShader;
|
|
|
|
ACGL::OpenGL::SharedShaderProgram depthShader;
|
2015-01-18 23:52:57 +00:00
|
|
|
ACGL::OpenGL::SharedTexture2D depthTexture;
|
|
|
|
ACGL::OpenGL::SharedFrameBufferObject framebuffer;
|
2014-12-15 01:09:33 +00:00
|
|
|
std::vector<ACGL::OpenGL::SharedTextureCubeMap> depth_cubeMaps;
|
|
|
|
ACGL::OpenGL::SharedFrameBufferObject framebuffer_cube;
|
|
|
|
static const int cube_size;
|
2014-12-15 00:05:46 +00:00
|
|
|
Level* level;
|
2015-02-09 13:26:04 +00:00
|
|
|
int number_of_texture_units = 0;
|
2014-11-14 15:47:47 +00:00
|
|
|
};
|
|
|
|
|
2014-10-20 16:49:10 +00:00
|
|
|
#endif
|