hx3d  1
2D/3D Simple Game Framework
transform.hpp
1 /*
2  Transform.
3  Copyright (C) 2015 Denis BOURGE
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
21 #ifndef HX3D_GRAPHICS_TRANSFORM
22 #define HX3D_GRAPHICS_TRANSFORM
23 
24 #include <glm/vec3.hpp>
25 #include <glm/mat2x2.hpp>
26 
27 #include <glm/gtx/transform.hpp>
28 
29 namespace hx3d {
30 namespace graphics {
31 
35 class Transform {
36 
37 public:
38  Transform();
39  Transform& operator=(const Transform& transform);
40 
46  glm::mat4 compute();
47 
56  Transform add(const Transform& transform);
57 
63  glm::vec3 realSize();
64 
72  bool contains(glm::vec2 point);
73 
77  void show();
78 
80  glm::vec3 position;
82  glm::vec3 scale;
84  glm::vec3 size;
86  glm::vec3 rotation;
87 };
88 
89 } /* graphics */
90 } /* hx3d */
91 
92 #endif
2D/3D transform.
Definition: transform.hpp:35
glm::vec3 position
Position.
Definition: transform.hpp:80
hx3d framework namespace
Definition: audio.hpp:26
Transform add(const Transform &transform)
Add a transform to another.
Definition: transform.cpp:55
bool contains(glm::vec2 point)
Check a point in the transform.
Definition: transform.cpp:80
glm::mat4 compute()
Build the model matrix using the position, scale, size and rotation.
Definition: transform.cpp:43
glm::vec3 rotation
Rotation.
Definition: transform.hpp:86
glm::vec3 size
Size.
Definition: transform.hpp:84
void show()
Show the transform information. (Debug)
Definition: transform.cpp:93
glm::vec3 realSize()
Get the real size (size * scale).
Definition: transform.cpp:76
glm::vec3 scale
Scale.
Definition: transform.hpp:82