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"
|
|
|
|
|
2015-03-03 22:27:41 +00:00
|
|
|
using namespace ACGL::OpenGL;
|
|
|
|
|
2014-11-14 15:47:47 +00:00
|
|
|
class Graphics {
|
|
|
|
public:
|
2015-02-13 15:20:22 +00:00
|
|
|
Graphics(glm::uvec2 windowSize, float nearPlane, float farPlane, int cube_size, unsigned int maxShadowRenderCount);
|
2014-11-14 15:47:47 +00:00
|
|
|
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-02-24 22:30:59 +00:00
|
|
|
void updateLights();
|
2015-02-12 00:13:26 +00:00
|
|
|
void updateClosestLights();
|
|
|
|
bool compareLightDistances(Light a, Light b);
|
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;
|
2015-02-13 16:09:25 +00:00
|
|
|
std::vector<Light> closestLights;
|
2015-03-03 22:27:41 +00:00
|
|
|
SharedShaderProgram lightingShader;
|
2015-03-04 15:08:03 +00:00
|
|
|
SharedShaderProgram skydomeShader;
|
2015-03-03 22:27:41 +00:00
|
|
|
SharedShaderProgram depthCubeShader;
|
2015-03-05 15:21:30 +00:00
|
|
|
SharedShaderProgram gaussShader;
|
2015-03-03 22:27:41 +00:00
|
|
|
SharedShaderProgram depthShader;
|
|
|
|
SharedShaderProgram flameShader;
|
|
|
|
SharedShaderProgram flamePostShader;
|
|
|
|
std::vector<SharedTexture2D> depth_directionalMaps;
|
|
|
|
std::vector<SharedFrameBufferObject> framebuffer_directional;
|
|
|
|
std::vector<SharedTextureCubeMap> depth_cubeMaps;
|
2015-03-05 15:21:30 +00:00
|
|
|
SharedFrameBufferObject framebuffer_cube_blurred;
|
2015-03-03 23:55:01 +00:00
|
|
|
SharedFrameBufferObject framebuffer_light;
|
|
|
|
SharedTexture2D light_fbo_color_texture;
|
|
|
|
SharedTexture2D light_fbo_depth_texture;
|
2015-03-05 15:21:30 +00:00
|
|
|
SharedFrameBufferObject framebuffer_cube;
|
|
|
|
SharedTexture2D framebuffer_cube_texture;
|
2015-03-03 22:27:41 +00:00
|
|
|
SharedVertexArrayObject flame_positions;
|
|
|
|
SharedArrayBuffer flame_positions_ab;
|
|
|
|
SharedVertexArrayObject fullscreen_quad;
|
|
|
|
SharedArrayBuffer fullscreen_quad_ab;
|
2015-02-07 19:24:11 +00:00
|
|
|
int cube_size;
|
2015-02-13 15:20:22 +00:00
|
|
|
unsigned int maxShadowRenderCount;
|
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
|