Removed euler, only quaternion and dirty flag

This commit is contained in:
a.pilote
2022-07-14 17:45:06 -04:00
parent fb6080d734
commit 249e26dcd5
15 changed files with 203 additions and 66 deletions

View File

@@ -18,13 +18,67 @@ namespace Nuake
GlobalTransform = Matrix4(1);
}
void TransformComponent::SetRotation(float x, float y, float z)
void TransformComponent::SetLocalRotation(const Quat& quat)
{
Quat QuatAroundX = Quat(1.0, 0.0, 0.0, x);
Quat QuatAroundY = Quat(0.0, 1.0, 0.0, y);
Quat QuatAroundZ = Quat(0.0, 0.0, 1.0, z);
Quat finalOrientation = QuatAroundX * QuatAroundY * QuatAroundZ;
Rotation = finalOrientation;
Rotation = quat;
Dirty = true;
}
Quat TransformComponent::GetLocalRotation() const
{
return Rotation;
}
Quat TransformComponent::GetGlobalRotation() const
{
return GlobalRotation;
}
void TransformComponent::SetGlobalRotation(const Quat& rotation)
{
GlobalRotation = rotation;
}
Vector3 TransformComponent::GetLocalPosition() const
{
return Translation;
}
void TransformComponent::SetLocalPosition(const Vector3& position)
{
Translation = position;
Dirty = true;
}
Vector3 TransformComponent::GetGlobalPosition() const
{
return GlobalTranslation;
}
void TransformComponent::SetGlobalPosition(const Vector3& position)
{
GlobalTranslation = position;
}
Vector3 TransformComponent::GetLocalScale() const
{
return Scale;
}
void TransformComponent::SetLocalScale(const Vector3& scale)
{
Scale = scale;
Dirty = true;
}
Vector3 TransformComponent::GetGlobalScale() const
{
return GlobalScale;
}
void TransformComponent::SetGlobalScale(const Vector3& scale)
{
GlobalScale = scale;
}
Matrix4 TransformComponent::GetGlobalTransform() const
@@ -32,8 +86,18 @@ namespace Nuake
return GlobalTransform;
}
void TransformComponent::SetGlobalTransform(const Matrix4& transform)
{
GlobalTransform = transform;
}
Matrix4 TransformComponent::GetLocalTransform() const
{
return LocalTransform;
}
void TransformComponent::SetLocalTransform(const Matrix4& transform)
{
LocalTransform = transform;
}
}