SimpleGL  1.1.0
A framework for platform independent rendering
transform.hpp
Go to the documentation of this file.
1 
8 #ifndef TRANSFORM_HPP
9 #define TRANSFORM_HPP
10 
11 #include "SimpleGL_Export.h"
12 
13 #define GLM_FORCE_RADIANS
14 #include <glm/glm.hpp>
15 
16 namespace sgl {
17 
23  struct SIMPLEGL_EXPORT Camera {
24 
26  glm::vec3 position;
27 
29  glm::vec3 front;
30 
32  glm::vec3 up;
33  };
34 
40  struct SIMPLEGL_EXPORT Transformation {
41 
43  glm::mat4 model;
44 
46  glm::mat4 view;
47 
49  glm::mat4 projection;
50 
52  glm::mat4 clip;
53 
58  bool changed;
59  };
60 
66  class SIMPLEGL_EXPORT Model {
67 
68  private:
70  Model(void);
71 
72  public:
78  static glm::mat4 identity();
79 
89  static glm::mat4 scale(float x, float y, float z);
90 
98  static glm::mat4 scale(glm::vec3 vector);
99 
110  static glm::mat4 scale(glm::mat4 matrix, float x, float y, float z);
111 
120  static glm::mat4 scale(glm::mat4 matrix, glm::vec3 vector);
121 
131  static glm::mat4 translate(float x, float y, float z);
132 
140  static glm::mat4 translate(glm::vec3 vector);
141 
152  static glm::mat4 translate(glm::mat4 matrix, float x, float y, float z);
153 
162  static glm::mat4 translate(glm::mat4 matrix, glm::vec3 vector);
163 
174  static glm::mat4 rotate(float angle, float x, float y, float z);
175 
184  static glm::mat4 rotate(float angle, glm::vec3 vector);
185 
197  static glm::mat4 rotate(glm::mat4 matrix, float angle, float x, float y, float z);
198 
208  static glm::mat4 rotate(glm::mat4 matrix, float angle, glm::vec3 vector);
209  };
210 
216  class SIMPLEGL_EXPORT View {
217 
218  private:
220  View(void);
221 
222  public:
228  static glm::mat4 identity();
229 
239  static glm::mat4 lookAt(glm::vec3 eye, glm::vec3 center, glm::vec3 up);
240 
256  static glm::mat4 lookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ);
257 
263  static glm::mat4 lookAt(Camera camera);
264  };
265 
271  class SIMPLEGL_EXPORT Projection {
272 
273  private:
275  Projection(void);
276 
277  public:
283  static glm::mat4 identity();
284 
297  static glm::mat4 ortho(float left, float right, float bottom, float top, float zNear, float zFar);
298 
311  static glm::mat4 frustum(float left, float right, float bottom, float top, float zNear, float zFar);
312 
323  static glm::mat4 perspective(float fovy, float aspect, float zNear, float zFar);
324  };
325 }
326 
327 #endif /* TRANSFORM_HPP */
glm::vec3 front
The front side direction of the camera.
Definition: transform.hpp:29
This class contains static methods to calculate view matrices.
Definition: transform.hpp:216
glm::mat4 projection
The projection matrix.
Definition: transform.hpp:49
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
glm::mat4 view
The view matrix.
Definition: transform.hpp:46
This class contains static methods to calculate projection matrices.
Definition: transform.hpp:271
This struct contains information to calculate the Model-View-Projection-Matrix.
Definition: transform.hpp:40
This struct defines a camera.
Definition: transform.hpp:23
glm::vec3 position
The position of the camera.
Definition: transform.hpp:26
This class contains static methods to calculate model matrices.
Definition: transform.hpp:66
bool changed
Tells if the transformation has changed.
Definition: transform.hpp:58
glm::vec3 up
The up vector if the camera.
Definition: transform.hpp:32
glm::mat4 clip
The clip matrix.
Definition: transform.hpp:52
glm::mat4 model
The model matrix.
Definition: transform.hpp:43