-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOrthographicCamera.hpp
52 lines (43 loc) · 1.58 KB
/
OrthographicCamera.hpp
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
#ifndef CSCI441_ORTHOGRAPHIC_CAMERA_HPP
#define CSCI441_ORTHOGRAPHIC_CAMERA_HPP
#include "Camera.hpp"
namespace CSCI441 {
/**
* @brief Abstract Class to represent an orthographic camera. Stores box clip planes
*/
class OrthographicCamera : public CSCI441::Camera {
public:
/**
* @brief initializes the OrthographicCamera
* @param minX left clipping plane (defaults to -1.0f)
* @param maxX right clipping plane (defaults to +1.0f)
* @param minY bottom clipping plane (defaults to -1.0f)
* @param maxY top clipping plane (defaults to +1.0f)
* @param minZ near clipping plane (defaults to -1.0f)
* @param maxZ far clipping plane (defaults to +1.0f)
*/
explicit OrthographicCamera(GLfloat minX = -1.0f, GLfloat maxX = 1.0f, GLfloat minY = -1.0f, GLfloat maxY = 1.0f, GLfloat minZ = -1.0f, GLfloat maxZ = 1.0f);
private:
void _updateProjectionMatrix();
GLfloat _minX;
GLfloat _maxX;
GLfloat _minY;
GLfloat _maxY;
GLfloat _minZ;
GLfloat _maxZ;
};
}
inline CSCI441::OrthographicCamera::OrthographicCamera(
GLfloat minX,
GLfloat maxX,
GLfloat minY,
GLfloat maxY,
GLfloat minZ,
GLfloat maxZ
) : _minX(minX), _maxX(maxX), _minY(minY), _maxY(maxY), _minZ(minZ), _maxZ(maxZ) {
_updateProjectionMatrix();
}
inline void CSCI441::OrthographicCamera::_updateProjectionMatrix() {
mProjectionMatrix = glm::ortho( _minX, _maxX, _minY, _maxY, _minZ, _maxZ );
}
#endif//CSCI441_ORTHOGRAPHIC_CAMERA_HPP