forked from sksullivan/Visualizations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
renderer.h
42 lines (34 loc) · 1.04 KB
/
renderer.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
#import "lib/geometry.h"
#import "lib/RenderObject.h"
#import <glm/gtc/matrix_transform.hpp>
#import "common.h"
#import "lib/utils.h"
class Renderer {
private:
GLFWwindow* setupWindow(int width, int height);
void setupRenderer();
GLint setupShaders();
void runMainLoop(GLFWwindow*, GLint);
void terminate();
void populateUniforms(GLuint shader_program);
int setupGL();
GLFWwindow* _window;
GLint _shaderProgram;
GLuint _vao;
// float elapsedSteps;
std::vector<RenderObject*> objects;
std::string vertexShaderPath, fragmentShaderPath;
float lastMouseX, lastMouseY;
float setCenterX, setCenterY;
// void mouseWheelCallback(GLFWwindow* window, double scrollX, double scrollY);
std::vector<void (*)(int)>* updateFunctions;
public:
Renderer(int width, int height);
void addRenderObject(RenderObject* renderObject);
void setShaders(std::string vertPath, std::string fragPath);
int begin();
void addUpdateFunction(void (*f)(int));
struct {
GLuint transform;
} uniforms;
};