Molecule Viewer
 All Classes Functions Variables Enumerations Pages
Camera.cpp
1 #include "Camera.hpp"
2 #include "common.hpp"
3 
4 
6  : SceneObject(),_projectionMatrix(new glm::mat4(glm::perspective(60.0f,4.0f/3.0f, 0.1f, 400.f)))
7 {
8 }
9 
10 Camera::Camera(int windowWidth, int windowHeight)
11  : SceneObject(),_projectionMatrix(new glm::mat4(glm::perspective(60.0f,(float)windowWidth/windowHeight, 0.1f, 400.f)))
12 {
13 }
14 
15 void Camera::SetViewMatrix(glm::mat4 viewMatrix) {
16 // _modelMatrix = &viewMatrix._inverse();
17 // _modelMatrix->_inverse();
18  *_inverseModelMatrix = viewMatrix;
19 }
20 
21 void Camera::SetModelMatrix(glm::mat4 modelMatrix) {
22  *_modelMatrix = modelMatrix;
23 // _inverseModelMatrix = &modelMatrix._inverse();
24 }
25 
26 
27 glm::mat4 Camera::GetViewMatrix() const {
28  return *_inverseModelMatrix;
29 }
30 
31 glm::mat4 Camera::GetProjectionMatrix() const {
32  return *_projectionMatrix;
33 }
34 
35 void Camera::UpdateProjectionMatrix(int windowWidth, int windowHeight, float f) {
36  delete _projectionMatrix;
37  _projectionMatrix = new glm::mat4(glm::perspective(60.0f,(float)windowWidth/windowHeight, 0.1f, f));
38 }
39 
40 
41 Camera::~Camera()
42 {
43 delete _projectionMatrix;
44 }
45 
46 
47