-
Notifications
You must be signed in to change notification settings - Fork 0
/
Camera.h
62 lines (38 loc) · 1.29 KB
/
Camera.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
57
58
59
60
61
62
#ifndef __CAMERA_H__
#define __CAMERA_H__
/**
* Basic camera class.
*/
class Camera {
public:
Camera();
Camera( int screenWidth, int screenHeight );
void SetViewport( int x, int y, int width, int height );
glm::vec4 GetViewport() const;
void SetProjectionRH( float fov, float aspectRatio, float zNear, float zFar );
void ApplyViewMatrix();
void SetPosition( const glm::vec3& pos );
glm::vec3 GetPosition() const;
// Translate the camera by some amount. If local is TRUE (default) then the translation should
// be applied in the local-space of the camera. If local is FALSE, then the translation is
// applied in world-space.
void Translate( const glm::vec3& delta, bool local = true );
void SetRotation( const glm::quat& rot );
glm::quat GetRotation() const;
void SetEulerAngles( const glm::vec3& eulerAngles );
glm::vec3 GetEulerAngles() const;
// Rotate the camera by some amount.
void Rotate( const glm::quat& rot );
glm::mat4 GetProjectionMatrix();
glm::mat4 GetViewMatrix();
protected:
void UpdateViewMatrix();
glm::vec4 m_Viewport;
glm::vec3 m_Position;
glm::quat m_Rotation;
glm::mat4 m_ViewMatrix;
glm::mat4 m_ProjectionMatrix;
private:
bool m_ViewDirty;
};
#endif // __CAMERA_H__