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
Transform.hpp
Go to the documentation of this file.
1 #ifndef RADIX_COMPONENT_TRANSFORM_HPP
2 #define RADIX_COMPONENT_TRANSFORM_HPP
3 
8 
9 namespace radix {
10 
11 class Transform : public Component {
12 protected:
15 
16 public:
17  inline void privSetPosition(const Vector3f &v) {
18  position = v;
19  }
20  inline void privSetScale(const Vector3f &v) {
21  scale = v;
22  }
23  inline void privSetOrientation(const Quaternion &v) {
24  orientation = v;
25  }
26 
27  Transform(Entity &ent) :
28  Component(ent), scale(1, 1, 1) {}
29 
30  const char* getName() const {
31  return "Transform";
32  }
33 
34  TypeId getTypeId() const {
35  return Component::getTypeId<std::remove_reference<decltype(*this)>::type>();
36  }
37 
38  void serialize(serine::Archiver&);
39 
40  inline const Vector3f& getPosition() const {
41  return position;
42  }
43  void setPosition(const Vector3f&);
44 
45  inline const Vector3f& getScale() const {
46  return scale;
47  }
48  void setScale(const Vector3f&);
49 
50  inline const Quaternion& getOrientation() const {
51  return orientation;
52  }
53  void setOrientation(const Quaternion&);
54 
55  void applyModelMtx(Matrix4f&) const;
56  void getModelMtx(Matrix4f&) const;
57 };
58 
59 } /* namespace radix */
60 
61 #endif /* RADIX_COMPONENT_TRANSFORM_HPP */
Definition: GameController.hpp:7
const Vector3f & getScale() const
Definition: Transform.hpp:45
void getModelMtx(Matrix4f &) const
Definition: Transform.cpp:51
void privSetOrientation(const Quaternion &v)
Definition: Transform.hpp:23
const Vector3f & getPosition() const
Definition: Transform.hpp:40
void serialize(serine::Archiver &)
Definition: Transform.cpp:11
ECS entity, Component container It is created like this:
Definition: Entity.hpp:23
Definition: Vector4f.hpp:117
const Quaternion & getOrientation() const
Definition: Transform.hpp:50
Quaternion orientation
Definition: Transform.hpp:14
void applyModelMtx(Matrix4f &) const
Definition: Transform.cpp:45
TypeId getTypeId() const
Definition: Transform.hpp:34
Base class to create entity components.
Definition: Component.hpp:25
Vector3f position
Definition: Transform.hpp:13
void setScale(const Vector3f &)
Definition: Transform.cpp:31
ComponentTypeId TypeId
Definition: Component.hpp:35
Definition: Matrix4f.hpp:25
Transform(Entity &ent)
Definition: Transform.hpp:27
void setPosition(const Vector3f &)
Definition: Transform.cpp:19
void privSetPosition(const Vector3f &v)
Definition: Transform.hpp:17
const char * getName() const
Definition: Transform.hpp:30
Vector3f scale
Definition: Transform.hpp:13
Definition: Transform.hpp:11
3-dimensional float-based vector/point storage and manipulation struct
Definition: Vector3f.hpp:27
void setOrientation(const Quaternion &)
Definition: Transform.cpp:35
void privSetScale(const Vector3f &v)
Definition: Transform.hpp:20