-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphics.h
61 lines (44 loc) · 1.46 KB
/
graphics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include "shader.h"
#include "glHelper.h"
#include "camera.h"
#include "mesh.h"
#include "terrain.h"
#include "pool.h"
#include "skybox.h"
const GLuint BLUR_DOWNSAMPLE = 2;
class Graphics {
public:
Graphics();
Graphics(sf::RenderWindow& window);
~Graphics();
void renderScene(Camera& cam, Terrain& terrain, bool toFrameBuffer);
void resize(int width, int height);
void finalProcessing(Camera& cam, bool blurring);
static Transform* registerTransform(Shape shape = Shape::CUBE_GRID);
static void returnTransform(Transform* transform);
static Transform* getTransform(int id);
// TODO generic mesh registration and handling
//static void registerMesh(Mesh<Vertex>* mesh);
static void addToStream(Shape shape, glm::mat4& model, glm::vec3& color);
static void addToStream(Shape shape, std::vector<glm::mat4>& models, std::vector<glm::vec3>& colors);
static bool DEBUG;
private:
GLuint WIDTH, HEIGHT;
void initGL(sf::RenderWindow& window);
void blurColorBuffer(GLuint sceneIn, GLuint frameOut, GLuint iters, Shader screen, Shader blur);
void renderQuad();
void buildBuffers();
void destroyBuffers();
void uploadTransforms();
void printGLErrors();
FBO sceneBuffer, blurResult, blurBuffers[2];
GLuint quadVAO;
PIMesh* solidStream;
TIMesh* gridStream;
TIMesh* pyrStream;
TIMesh* buildingCube;
Skybox* skybox;
};