-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.h
More file actions
27 lines (21 loc) · 773 Bytes
/
renderer.h
File metadata and controls
27 lines (21 loc) · 773 Bytes
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
#ifndef _CSCI441_RENDERER_H_
#define _CSCI441_RENDERER_H_
#include <csci441/matrix3.h>
class Renderer {
Matrix3 itModel_tmp;
public:
void render(const Camera& camera, Model& m, const Vector& light) {
itModel_tmp.inverse_transpose(m.model);
m.shader.use();
Uniform::set(m.shader.id(), "model", m.model);
Uniform::set(m.shader.id(), "projection", camera.projection);
Uniform::set(m.shader.id(), "camera", camera.look_at());
Uniform::set(m.shader.id(), "eye", camera.eye);
Uniform::set(m.shader.id(), "lightPos", light);
Uniform::set(m.shader.id(), "itModel", itModel_tmp);
// render the cube
glBindVertexArray(m.vao);
glDrawArrays(GL_TRIANGLES, 0, m.size);
}
};
#endif