6#include <glm/gtc/quaternion.hpp>
8#include <glm/gtx/euler_angles.hpp>
12#define KR_SMALL_NUMBER (1.e-8f)
80 inline glm::vec3 operator*(
const glm::vec3& Translation)
const
82 glm::mat4 transform = glm::eulerAngleYXZ(m_Pitch, m_Yaw, m_Roll);
83 glm::vec4 tempResult = transform * glm::vec4(Translation.x, Translation.y, Translation.z, 1.0f);
85 glm::vec3 returnVector(tempResult.x, tempResult.y, tempResult.z);
110 FTransform(glm::vec3 rotation, glm::vec3 translation, glm::vec3 scale3D);
112 inline const glm::vec3& GetLocation() {
return GetTranslation(); }
113 inline const TRotator& GetRotation()
const {
return m_Rotation; }
114 inline const glm::vec3& GetTranslation()
const {
return m_Translation; }
115 inline const glm::vec3& GetScale3D()
const {
return m_Scale3D; }
119 inline void SetScale3D(
const glm::vec3& newScale)
121 m_Scale3D = newScale;
124 inline void SetRotation(
const TRotator& newRotation)
126 m_Rotation = newRotation;
129 inline void SetTranslation(
const glm::vec3& newTranslation)
131 m_Translation = newTranslation;
156 inline bool AnyHasNegativeScale(
const glm::vec3& InScale3D,
const glm::vec3& InOtherScale3D)
const
158 return (InScale3D.x < 0.f || InScale3D.y < 0.f || InScale3D.z < 0.f
159 || InOtherScale3D.x < 0.f || InOtherScale3D.y < 0.f || InOtherScale3D.z < 0.f);
171 glm::vec3 SafeReciprocalScale;
173 if (glm::abs(InScale.x) <= Tolerance)
175 SafeReciprocalScale.x = 0.f;
179 SafeReciprocalScale.x = 1 / InScale.x;
182 if (glm::abs(InScale.y) <= Tolerance)
184 SafeReciprocalScale.y = 0.f;
188 SafeReciprocalScale.y = 1 / InScale.y;
191 if (glm::abs(InScale.z) <= Tolerance)
193 SafeReciprocalScale.z = 0.f;
197 SafeReciprocalScale.z = 1 / InScale.z;
200 return SafeReciprocalScale;
206 m_Translation = Other.GetTranslation();
212 m_Rotation = Other.GetRotation();
218 m_Scale3D = Other.GetScale3D();
228 glm::vec3 m_Translation;
Definition Transform.h:26
glm::vec1 Y
Definition Transform.h:32
glm::vec1 Z
Definition Transform.h:35
glm::vec1 X
Definition Transform.h:29
glm::vec1 W
Definition Transform.h:38
Definition Transform.h:56
float m_Roll
Definition Transform.h:67
float m_Pitch
Definition Transform.h:61
float m_Yaw
Definition Transform.h:64