GlPortal Class Reference  0.1.1
Source code documentation of the free and open 3D action puzzle game.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Camera.hpp
Go to the documentation of this file.
1 #ifndef RADIX_CAMERA_HPP
2 #define RADIX_CAMERA_HPP
3 
8 
9 namespace radix {
10 
11 class Camera {
12 public:
13  static constexpr const float DEFAULT_FOVY = rad(60);
14  static constexpr const float DEFAULT_ASPECT = 1;
15  static constexpr const float DEFAULT_ZNEAR = 0.1f;
16  static constexpr const float DEFAULT_ZFAR = 100;
17  static constexpr const bool DEFAULT_PERSPECTIVE = true;
18  static constexpr const float DEFAULT_TOP = 0.5f;
19  static constexpr const float DEFAULT_BOTTOM = -0.5f;
20  static constexpr const float DEFAULT_LEFT = -0.5f;
21  static constexpr const float DEFAULT_RIGHT = 0.5f;
22 
23  Camera() {}
24  Camera(float fovy, float aspect, float zNear, float zFar);
25 
26  void getProjMatrix(Matrix4f &m) const;
27  void setProjMatrix(const Matrix4f &m);
28  void getViewMatrix(Matrix4f &m) const;
29  void setViewMatrix(const Matrix4f &m);
30  void getInvViewMatrix(Matrix4f &m) const;
31 
32  void setFovy(float fovy);
33  float getFovy() const;
34  void setAspect(float aspect);
35  float getAspect() const;
36  void setZNear(float zNear);
37  float getZNear() const;
38  void setZFar(float zFar);
39  float getZFar() const;
40  void setPerspective();
41  void setOrthographic();
42  void setBounds(float left, float right, float bottom, float top);
43 
44  Vector3f getPosition() const;
45  void setPosition(const Vector3f&);
46  Quaternion getOrientation() const;
47  void setOrientation(const Quaternion&);
48 
49 private:
52 
53  void calcProj();
54  void calcView();
58 
60  float fovy = DEFAULT_FOVY;
63  float zFar = DEFAULT_ZFAR;
64 
65  float top = DEFAULT_TOP;
67  float left = DEFAULT_LEFT;
69 };
70 
71 } /* namespace radix */
72 
73 #endif /* RADIX_CAMERA_HPP */
Matrix4f viewMatrix
Definition: Camera.hpp:56
float getZNear() const
Definition: Camera.cpp:87
Definition: GameController.hpp:7
void setProjMatrix(const Matrix4f &m)
Definition: Camera.cpp:47
float aspect
Definition: Camera.hpp:61
float bottom
Definition: Camera.hpp:66
static constexpr const float DEFAULT_RIGHT
Definition: Camera.hpp:21
static constexpr const float DEFAULT_LEFT
Definition: Camera.hpp:20
constexpr float rad(float deg)
Definition: Math.hpp:58
float zNear
Definition: Camera.hpp:62
Definition: Vector4f.hpp:117
float getZFar() const
Definition: Camera.cpp:96
void setZFar(float zFar)
Definition: Camera.cpp:91
void calcProj()
Definition: Camera.cpp:15
float top
Definition: Camera.hpp:65
float getAspect() const
Definition: Camera.cpp:78
void setOrthographic()
Definition: Camera.cpp:105
void getInvViewMatrix(Matrix4f &m) const
Definition: Camera.cpp:60
static constexpr const float DEFAULT_FOVY
Definition: Camera.hpp:13
void setOrientation(const Quaternion &)
Definition: Camera.cpp:131
Matrix4f invViewMatrix
Definition: Camera.hpp:57
void setViewMatrix(const Matrix4f &m)
Definition: Camera.cpp:55
float zFar
Definition: Camera.hpp:63
static constexpr const float DEFAULT_ZFAR
Definition: Camera.hpp:16
Vector3f position
Definition: Camera.hpp:50
void setAspect(float aspect)
Definition: Camera.cpp:73
void getProjMatrix(Matrix4f &m) const
Definition: Camera.cpp:43
Definition: Camera.hpp:11
float left
Definition: Camera.hpp:67
Matrix4f projMatrix
Definition: Camera.hpp:55
void setBounds(float left, float right, float bottom, float top)
Definition: Camera.cpp:110
static constexpr const float DEFAULT_BOTTOM
Definition: Camera.hpp:19
void calcView()
Definition: Camera.cpp:36
float right
Definition: Camera.hpp:68
void getViewMatrix(Matrix4f &m) const
Definition: Camera.cpp:51
bool perspective
Definition: Camera.hpp:59
Quaternion orientation
Definition: Camera.hpp:51
Quaternion getOrientation() const
Definition: Camera.cpp:127
Camera()
Definition: Camera.hpp:23
Vector3f getPosition() const
Definition: Camera.cpp:118
float fovy
Definition: Camera.hpp:60
Definition: Matrix4f.hpp:25
float getFovy() const
Definition: Camera.cpp:69
void setZNear(float zNear)
Definition: Camera.cpp:82
static constexpr const float DEFAULT_ZNEAR
Definition: Camera.hpp:15
static constexpr const bool DEFAULT_PERSPECTIVE
Definition: Camera.hpp:17
static constexpr const float DEFAULT_TOP
Definition: Camera.hpp:18
void setPosition(const Vector3f &)
Definition: Camera.cpp:122
void setPerspective()
Definition: Camera.cpp:100
static constexpr const float DEFAULT_ASPECT
Definition: Camera.hpp:14
3-dimensional float-based vector/point storage and manipulation struct
Definition: Vector3f.hpp:27
void setFovy(float fovy)
Definition: Camera.cpp:64