Saxum/graphics.hh

46 lines
1.6 KiB
C++
Raw Permalink Normal View History

2014-10-20 16:23:25 +00:00
#ifndef GRAPHICS_HH_INCLUDED
#define GRAPHICS_HH_INCLUDED
#include <ACGL/OpenGL/GL.hh>
2014-10-20 16:23:25 +00:00
#include <GLFW/glfw3.h>
2014-10-20 16:49:10 +00:00
#include <ACGL/Math/Math.hh>
#include <ACGL/OpenGL/Objects/FrameBufferObject.hh>
#include "level.hh"
class Graphics {
public:
Graphics(glm::uvec2 windowSize, float nearPlane, float farPlane);
Graphics();
void init(Level* level);
void render(double time);
glm::mat4 buildViewMatrix(Level* level);
glm::uvec2 getWindowSize();
void resize(glm::uvec2 windowSize);
float getFarPlane();
private:
void updateShaderLights();
void updateClosestLights();
bool compareLightDistances(Light a, Light b);
2015-01-27 10:14:00 +00:00
void saveDepthBufferToDisk(int face, std::string);
double lastUpdate;
glm::uvec2 windowSize;
float nearPlane;
float farPlane;
// pointer to either use the vector from the level or from here
std::vector<Light>* closestLights;
std::vector<Light> closestLightsVector; // contains the 32 closest lights
ACGL::OpenGL::SharedShaderProgram lightingShader;
2015-02-09 23:27:13 +00:00
ACGL::OpenGL::SharedShaderProgram depthCubeShader;
ACGL::OpenGL::SharedShaderProgram depthShader;
ACGL::OpenGL::SharedTexture2D depthTexture;
ACGL::OpenGL::SharedFrameBufferObject framebuffer;
std::vector<ACGL::OpenGL::SharedTextureCubeMap> depth_cubeMaps;
ACGL::OpenGL::SharedFrameBufferObject framebuffer_cube;
static const int cube_size;
Level* level;
int number_of_texture_units = 0;
};
2014-10-20 16:49:10 +00:00
#endif