-
Notifications
You must be signed in to change notification settings - Fork 1
/
glmCamera.h
56 lines (46 loc) · 1.36 KB
/
glmCamera.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef _GLM_CAMERA_H_
#define _GLM_CAMERA_H_
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
/// \brief A simple camera class that uses glm as a backend
///
/// \detail Everything is public because I am going to leave it up to the
/// programmer to not screw themselves or others
///
class glmCamera {
public:
//Construction/Destruction
glmCamera();
//Nothing to clean up
//View settings
void setCameraPos(const glm::vec3& v);
void setCameraFocus(const glm::vec3& v);
void setCameraUpVec(const glm::vec3& v);
//Projection settings
void setAspectRatio(const float ar);
void setViewAngle(const float a);
void setNearClipDist(const float d);
void setFarClipDist(const float d);
//Get matrix data
glm::mat4 getViewMat();
float* getViewMatRef();
glm::mat4 getProjMat();
float* getProjMatRef();
//Create matrices
void genViewMat();
void genProjMat();
//View matrix variables
glm::vec3 pos; ///< position of the camera
glm::vec3 fp; ///< focal point of the camera
glm::vec3 up; ///< the up direction for the camera
//Projection matrix variables
float ar; ///< aspect ratio
float angle; ///< angle in radians
float near; ///< near clipping distance
float far; ///< far clipping distance
//functional matrices
glm::mat4 view; ///< View matrix for OpenGL
glm::mat4 proj; ///< Projection matrix for OpenGL
};
#endif