Implementing ECS SystemBase and updating slang

This commit is contained in:
Dynamitos
2022-11-15 12:19:11 +01:00
parent 05bc31a2b4
commit f635ee2100
106 changed files with 1083 additions and 1675 deletions
+17 -10
View File
@@ -2,6 +2,7 @@
#include <glm/gtx/quaternion.hpp>
using namespace Seele;
using namespace Seele::Math;
Transform::Transform()
: position(Vector4(0, 0, 0, 0)), rotation(Quaternion(1, 0, 0, 0)), scale(Vector4(1, 1, 1, 0))
@@ -44,7 +45,7 @@ Vector Transform::inverseTransformPosition(const Vector &v) const
{
return (unrotateVector(rotation, v - Vector(position))) * getSafeScaleReciprocal(scale);
}
Matrix4 Transform::toMatrix()
Matrix4 Transform::toMatrix() const
{
Matrix4 mat;
@@ -197,20 +198,26 @@ void Transform::add(Transform *outTransform, const Transform *a, const Transform
Transform &Transform::operator=(const Transform &other)
{
position = other.position;
rotation = other.rotation;
scale = other.scale;
if(&other != this)
{
position = other.position;
rotation = other.rotation;
scale = other.scale;
}
return *this;
}
Transform &Transform::operator=(Transform &&other)
{
position = other.position;
rotation = other.rotation;
scale = other.scale;
other.position = Vector4(0, 0, 0, 0);
other.rotation = Quaternion(1, 0, 0, 0);
other.scale = Vector4(0, 0, 0, 0);
if(&other != this)
{
position = other.position;
rotation = other.rotation;
scale = other.scale;
other.position = Vector4(0, 0, 0, 0);
other.rotation = Quaternion(1, 0, 0, 0);
other.scale = Vector4(0, 0, 0, 0);
}
return *this;
}