Files
Seele/src/Engine/Math/Transform.h
T

52 lines
1.5 KiB
C++
Raw Normal View History

2020-04-15 02:03:56 +02:00
#pragma once
#include "Math/Matrix.h"
2024-06-09 12:20:04 +02:00
#include "Math/Vector.h"
2020-04-15 02:03:56 +02:00
2024-06-09 12:20:04 +02:00
namespace Seele {
namespace Math {
class Transform {
public:
2020-04-15 02:03:56 +02:00
Transform();
2024-06-09 12:20:04 +02:00
Transform(const Transform& other);
Transform(Transform&& other);
2021-03-31 12:18:16 +02:00
explicit Transform(Vector position);
2020-04-15 02:03:56 +02:00
Transform(Vector position, Quaternion rotation);
Transform(Vector position, Quaternion rotation, Vector scale);
Transform(Quaternion rotation, Vector scale);
~Transform();
Matrix4 toMatrix() const;
2024-06-09 12:20:04 +02:00
Vector transformPosition(const Vector& v) const;
2020-04-15 02:03:56 +02:00
2020-05-05 01:51:13 +02:00
Vector getPosition() const;
Quaternion getRotation() const;
Vector getScale() const;
2022-11-29 16:34:42 +01:00
2023-01-21 18:43:21 +01:00
void setPosition(Vector pos);
void setRotation(Quaternion quat);
void setScale(Vector scale);
2022-11-29 16:34:42 +01:00
2022-03-19 22:45:30 +01:00
Vector getForward() const;
Vector getRight() const;
Vector getUp() const;
2020-04-15 02:03:56 +02:00
2025-05-06 19:36:43 +02:00
constexpr static Vector FORWARD = Vector(0, 0, 1);
constexpr static Vector RIGHT = Vector(-1, 0, 0);
constexpr static Vector UP = Vector(0, 1, 0);
2024-06-09 12:20:04 +02:00
bool equals(const Transform& other, float tolerance = 0.000000001f);
static void multiply(Transform* outTransform, const Transform* a, const Transform* b);
static void add(Transform* outTransform, const Transform* a, const Transform* b);
2020-04-15 02:03:56 +02:00
2024-06-09 12:20:04 +02:00
Transform& operator=(const Transform& other);
Transform& operator=(Transform&& other);
2022-03-19 22:45:30 +01:00
Transform operator+(const Transform& other) const;
2024-06-09 12:20:04 +02:00
Transform operator*(const Transform& other) const;
2020-04-15 02:03:56 +02:00
2024-06-09 12:20:04 +02:00
private:
2020-04-15 02:03:56 +02:00
Vector4 position;
Quaternion rotation;
Vector4 scale;
};
} // namespace Math
2020-04-15 02:03:56 +02:00
} // namespace Seele