Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
Transform.hpp
Go to the documentation of this file.
1/*
2Copyright (C) 2013-2019,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGAMES_TRANSFORM_H
17#define AEONGAMES_TRANSFORM_H
23
25#include "aeongames/Vector3.hpp"
27
28namespace AeonGames
29{
30 class AABB;
33 class Transform
34 {
35 public:
36 DLL Transform();
42 DLL Transform ( const Vector3& aScale, const Quaternion& aRotation, const Vector3& aTranslation );
48 DLL Transform ( const Vector3& aScale, const Vector3& aRotation, const Vector3& aTranslation );
52 DLL Transform ( const float* aData );
56 DLL void Get ( float* aData ) const;
57
61 DLL const Vector3& GetScale() const;
65 DLL const Quaternion& GetRotation() const;
69 DLL const Vector3& GetTranslation() const;
70
72 DLL void SetScale ( const Vector3& aScale );
76 DLL void SetRotation ( const Quaternion& aRotation );
80 DLL void SetTranslation ( const Vector3& aTranslation );
81
87 DLL void Move ( float x, float y, float z );
88
94 DLL void MoveInObjectSpace ( float x, float y, float z );
95
103 DLL void RotateObjectSpace ( float angle, float x, float y, float z );
111 DLL void RotateInertialSpace ( float angle, float x, float y, float z );
112
113 // This should be a message
114 //void ApplyLinearVelocityInObjectSpace ( Velocity& velocity, float delta );
115
117 DLL void ResetRotation();
118
123 DLL const Matrix4x4 GetMatrix() const;
124
129 DLL const Matrix3x3 GetScaleRotationMatrix() const;
130
136 DLL const Matrix4x4 GetInvertedMatrix() const;
140 DLL Transform& Invert();
144 DLL const Transform GetInverted() const;
145
148
149 DLL Transform& operator*= ( const Transform& lhs );
151
152 protected:
154 Vector3 mScale{1, 1, 1};
155 Quaternion mRotation{1, 0, 0, 0};
157 };
158
163 DLL const Transform operator* ( const Transform& lhs, const Transform& rhs );
169 DLL const AABB operator* ( const Transform& lhs, const AABB& rhs );
175 DLL const bool operator== ( const Transform& lhs, const Transform& rhs );
177 DLL const Transform Interpolate ( const Transform& aTransform0, const Transform& aTransform1, const Transform& aTransform2, const Transform& aTransform3, double aInterpolation );
178}
179#endif
Platform-specific macros, includes, and DLL export/import definitions.
Header for the quaternion class.
Header for the 3D vector class.
Axis Aligned Bounding Box class.
Definition AABB.hpp:34
3 by 3 matrix in colum mayor order.
Definition Matrix3x3.hpp:33
4 by 4 matrix in colum mayor order.
Definition Matrix4x4.hpp:35
Quaternion class.
DLL void SetRotation(const Quaternion &aRotation)
Set the rotation quaternion.
Definition Transform.cpp:67
DLL const Vector3 & GetScale() const
Get the scale vector.
Definition Transform.cpp:49
DLL void ResetRotation()
Clear rotation.
Definition Transform.cpp:94
DLL const Vector3 & GetTranslation() const
Get the translation vector.
Definition Transform.cpp:57
DLL const Matrix4x4 GetInvertedMatrix() const
Constructs an inverted transformation matrix from the SRT variables.
DLL Transform & Invert()
Invert this transform in place.
DLL void Move(float x, float y, float z)
Adds the provided vector to the position vector.
Definition Transform.cpp:87
DLL const Matrix4x4 GetMatrix() const
Constructs a transformation matrix from the SRT variables.
Vector3 mTranslation
Translation vector.
DLL const Transform GetInverted() const
Get the inverted transform.
Vector3 mScale
Scale rotation and translation.
DLL void SetScale(const Vector3 &aScale)
Set transform scale vector.
Definition Transform.cpp:62
DLL const Matrix3x3 GetScaleRotationMatrix() const
Constructs a transformation matrix from only the SR variables.
DLL const Quaternion & GetRotation() const
Get the rotation quaternion.
Definition Transform.cpp:53
DLL void Get(float *aData) const
Copy the transform data to a float array.
Definition Transform.cpp:42
DLL void MoveInObjectSpace(float x, float y, float z)
Moves the transfrom relative to its own axes.
Quaternion mRotation
Rotation quaternion.
DLL void RotateObjectSpace(float angle, float x, float y, float z)
Rotate in Object Space.
Definition Transform.cpp:77
DLL void RotateInertialSpace(float angle, float x, float y, float z)
Rotate in Inertial Space.
Definition Transform.cpp:82
DLL Transform & operator*=(const Transform &lhs)
Combine this transform with another transform.
DLL void SetTranslation(const Vector3 &aTranslation)
Set the translation vector.
Definition Transform.cpp:72
3D vector class.
Definition Vector3.hpp:32
<- This is here just for the literals
Definition AABB.hpp:31
DLL const Matrix3x3 operator*(const Matrix3x3 &lhs, const Matrix3x3 &rhs)
Multiplies two 3x3 matrices. Multiplies two 3x3 matrices.
DLL const Transform Interpolate(const Transform &aTransform0, const Transform &aTransform1, const Transform &aTransform2, const Transform &aTransform3, double aInterpolation)
Interpolate transforms using spline and mlerp methods.
DLL const bool operator==(const Matrix3x3 &lhs, const Matrix3x3 &rhs)
Compare two 3x3 matrices for equality.