-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera.cpp
More file actions
35 lines (29 loc) · 719 Bytes
/
Copy pathcamera.cpp
File metadata and controls
35 lines (29 loc) · 719 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
28
29
30
31
32
33
34
35
#include <glm/gtc/type_ptr.hpp>
#include "camera.h"
glm::mat4 Camera::lookMatrix() {
if (dirty) {
computeMatrix();
}
return this->look_matrix;
}
const GLfloat* Camera::lookMatrixGl() {
return glm::value_ptr(this->lookMatrix());
}
void Camera::lookAt(glm::vec3 position) {
this->look = position;
this->dirty = true;
}
void Camera::lookInDirection(glm::vec3 direction) {
this->look = this->eye + direction;
this->dirty = true;
}
void Camera::setEye(glm::vec3 position) {
this->eye = position;
this->dirty = true;
}
void Camera::computeMatrix() {
this->look_matrix = glm::lookAt(this->eye,
this->look,
this->up);
this->dirty = false;
}