You.i Engine
YiTransform.h
Go to the documentation of this file.
1 #ifndef _YI_TRANSFORM_H_
2 #define _YI_TRANSFORM_H_
3 
5 
6 #include <glm/glm.hpp>
7 #include <glm/gtc/quaternion.hpp>
8 
10 class CYITransformSystem;
11 
22 {
23 public:
24  CYITransform();
25  CYITransform(CYITransformSystem *pTransformSystem, CYIComponentPoolUID transformID);
26  ~CYITransform() = default;
27 
28  bool IsValid() const;
29 
35 
40 
45 
51  bool SetParent(const CYITransform *pTransform);
52 
58  bool GetParent(CYITransform &parent) const;
59 
64  bool SetPosition(glm::vec3 position);
65 
70  bool SetRotation(glm::vec3 eulerAngles);
71 
76  bool SetScale(glm::vec3 scale);
77 
82  bool SetAnchorPoint(glm::vec3 anchorPoint);
83 
88  bool SetOrientation(glm::quat orientation);
89 
90  const glm::vec3 &GetPosition() const;
91 
95  const glm::vec3 &GetRotation() const;
96  const glm::vec3 &GetScale() const;
97  const glm::vec3 &GetAnchorPoint() const;
98  const glm::quat &GetOrientation() const;
99 
105  glm::mat4x4 GetLocalMatrix() const;
106 
112  glm::mat4x4 GetWorldMatrix() const;
113 
118 
124 
125 private:
126  bool ApplyCombinedRotation() const;
127 
128  mutable CYITransformSystem *m_pTransformSystem;
129  CYIComponentPoolUID m_transformID;
130 
131  glm::vec3 m_rotation; // euler angles in degrees
132  glm::quat m_orientation;
133 };
134 
137 #include "scenetree/YiTransform.inl"
138 
139 #endif // _YI_TRANSFORM_H_
glm::mat4x4 GetWorldMatrix() const
bool SetParent(const CYITransform *pTransform)
bool SetOrientation(glm::quat orientation)
bool IsValid() const
const glm::vec3 & GetScale() const
CYITransformComponent * GetTransformComponent()
bool SetScale(glm::vec3 scale)
const glm::vec3 & GetRotation() const
const glm::vec3 & GetPosition() const
CYIComponentPoolUID GetTransformID() const
glm::mat4x4 GetLocalMatrix() const
The transform system maintains a component pool of CYITransformComponent data.
Definition: YiTransformSystem.h:21
An identifier for an element in a CYIComponentPool object.
Definition: YiComponentPoolUID.h:19
Provides transformation APIs.
Definition: YiTransform.h:21
A minimal transform component.
Definition: YiTransformComponent.h:18
bool SetPosition(glm::vec3 position)
~CYITransform()=default
void RemoveFromTransformSystem()
CYITransformSystem * GetTransformSystem()
const glm::quat & GetOrientation() const
bool SetAnchorPoint(glm::vec3 anchorPoint)
void RemoveDescendantsFromTransformSystem()
bool SetRotation(glm::vec3 eulerAngles)
const glm::vec3 & GetAnchorPoint() const
bool GetParent(CYITransform &parent) const