diff --git a/Source/Public/Aurora.Math/Quaternion.hpp b/Source/Public/Aurora.Math/Quaternion.hpp index 3af5e63..cf8738c 100644 --- a/Source/Public/Aurora.Math/Quaternion.hpp +++ b/Source/Public/Aurora.Math/Quaternion.hpp @@ -22,7 +22,7 @@ inline namespace Math { // -=(Undocumented)=- template - class Quaternion final + class Quaternion final : public Serializable> { public: @@ -160,6 +160,14 @@ inline namespace Math return (* this); } + // \see Serializable::OnSerialize + template + void OnSerialize(Stream Archive) + { + Archive.SerializeObject(mComplexes); + Archive.SerializeNumber(mReal); + } + public: // -=(Undocumented)=- diff --git a/Source/Public/Aurora.Math/Transform.hpp b/Source/Public/Aurora.Math/Transform.hpp index 71500f8..20248a4 100644 --- a/Source/Public/Aurora.Math/Transform.hpp +++ b/Source/Public/Aurora.Math/Transform.hpp @@ -22,7 +22,7 @@ inline namespace Math { // -=(Undocumented)=- template - class Transform final + class Transform final : public Serializable> { public: @@ -50,7 +50,6 @@ inline namespace Math Ref SetPosition(Ref> Position) { mPosition = Position; - return (* this); } @@ -70,7 +69,6 @@ inline namespace Math Ref SetScale(Ref> Scale) { mScale = Scale; - return (* this); } @@ -84,7 +82,6 @@ inline namespace Math Ref SetRotation(Ref> Rotation) { mRotation = Rotation; - return (* this); } @@ -131,30 +128,27 @@ inline namespace Math Ref Rotate(Ref> Rotation) { mRotation = mRotation * Rotation; - return (* this); } // -=(Undocumented)=- Ref Rotate(Ref> Angles) { - const Quaternionf XAxis(Vector3(1, 0, 0), Angles.GetX()); - const Quaternionf YAxis(Vector3(0, 1, 0), Angles.GetY()); - - mRotation = YAxis * mRotation * XAxis; + const Quaternionf XAxis(Quaternion::FromAngles(Angles.GetX(), Vector3(1, 0, 0))); + const Quaternionf YAxis(Quaternion::FromAngles(Angles.GetY(), Vector3(0, 1, 0))); + mRotation = mRotation * XAxis * YAxis; return (* this); } // -=(Undocumented)=- Ref Rotate(Ref> Angles) { - const Quaternionf XAxis(Vector3(1, 0, 0), Angles.GetX()); - const Quaternionf YAxis(Vector3(0, 1, 0), Angles.GetY()); - const Quaternionf ZAxis(Vector3(0, 0, 1), Angles.GetZ()); + const Quaternionf XAxis(Quaternion::FromAngles(Angles.GetX(), Vector3(1, 0, 0))); + const Quaternionf YAxis(Quaternion::FromAngles(Angles.GetY(), Vector3(0, 1, 0))); + const Quaternionf ZAxis(Quaternion::FromAngles(Angles.GetZ(), Vector3(0, 0, 1))); mRotation = mRotation * XAxis * YAxis * ZAxis; - return (* this); } @@ -173,6 +167,15 @@ inline namespace Math return Translation * Rotation * Scale; } + // \see Serializable::OnSerialize + template + void OnSerialize(Stream Archive) + { + Archive.SerializeObject(mPosition); + Archive.SerializeObject(mScale); + Archive.SerializeObject(mRotation); + } + private: // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-