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-01 16:49:59 +00:00
|
|
|
void init();
|
|
|
|
void render(Level* level);
|
2014-11-14 15:47:47 +00:00
|
|
|
// to build the projection matrix:
|
|
|
|
glm::mat4 buildFrustum( float phiInDegree, float near, float far, float aspectRatio);
|
|
|
|
glm::mat4 buildViewMatrix(Level* level);
|
|
|
|
glm::uvec2 getWindowSize();
|
|
|
|
bool createWindow();
|
|
|
|
GLFWwindow* getWindow();
|
2014-12-04 00:13:59 +00:00
|
|
|
void resize(glm::uvec2 windowSize);
|
2014-11-21 01:38:03 +00:00
|
|
|
float getFarPlane();
|
2014-12-04 00:13:59 +00:00
|
|
|
ACGL::OpenGL::SharedFrameBufferObject framebuffer;
|
2014-11-14 15:47:47 +00:00
|
|
|
private:
|
|
|
|
void setGLFWHintsForOpenGLVersion( unsigned int _version );
|
|
|
|
glm::uvec2 windowSize;
|
|
|
|
float nearPlane;
|
|
|
|
float farPlane;
|
|
|
|
GLFWwindow* window;
|
2014-12-04 00:13:59 +00:00
|
|
|
ACGL::OpenGL::SharedShaderProgram lightingShader;
|
|
|
|
ACGL::OpenGL::SharedShaderProgram depthShader;
|
|
|
|
ACGL::OpenGL::SharedTexture2D depthTexture_depth;
|
|
|
|
ACGL::OpenGL::SharedTexture2D depthTexture_colour;
|
2014-11-14 15:47:47 +00:00
|
|
|
};
|
|
|
|
|
2014-10-20 16:49:10 +00:00
|
|
|
#endif
|