2017-10-31 17:12:50 +00:00
|
|
|
#pragma once
|
|
|
|
#ifndef ES_CORE_MATH_TRANSFORM4X4F_H
|
|
|
|
#define ES_CORE_MATH_TRANSFORM4X4F_H
|
2017-10-28 20:24:35 +00:00
|
|
|
|
2017-10-30 19:43:58 +00:00
|
|
|
#include "math/Vector4f.h"
|
|
|
|
#include "math/Vector3f.h"
|
2017-10-28 20:24:35 +00:00
|
|
|
|
2017-10-30 19:43:58 +00:00
|
|
|
class Transform4x4f
|
2017-10-28 20:24:35 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2017-11-13 22:16:38 +00:00
|
|
|
Transform4x4f() { }
|
|
|
|
Transform4x4f(const Vector4f& _r0, const Vector4f& _r1, const Vector4f& _r2, const Vector4f& _r3) : mR0(_r0), mR1(_r1), mR2(_r2), mR3(_r3) { }
|
2017-10-28 20:24:35 +00:00
|
|
|
|
2017-11-22 21:29:52 +00:00
|
|
|
const Transform4x4f operator* (const Transform4x4f& _other) const;
|
|
|
|
const Vector3f operator* (const Vector3f& _other) const;
|
|
|
|
Transform4x4f& operator*=(const Transform4x4f& _other) { *this = *this * _other; return *this; }
|
2017-10-28 20:24:35 +00:00
|
|
|
|
2017-10-30 19:43:58 +00:00
|
|
|
inline Vector4f& r0() { return mR0; }
|
|
|
|
inline Vector4f& r1() { return mR1; }
|
|
|
|
inline Vector4f& r2() { return mR2; }
|
|
|
|
inline Vector4f& r3() { return mR3; }
|
|
|
|
inline const Vector4f& r0() const { return mR0; }
|
|
|
|
inline const Vector4f& r1() const { return mR1; }
|
|
|
|
inline const Vector4f& r2() const { return mR2; }
|
|
|
|
inline const Vector4f& r3() const { return mR3; }
|
|
|
|
|
2017-11-22 21:29:52 +00:00
|
|
|
Transform4x4f& invert (const Transform4x4f& _other);
|
|
|
|
Transform4x4f& scale (const Vector3f& _scale);
|
|
|
|
Transform4x4f& rotate (const float _angle, const Vector3f& _axis);
|
|
|
|
Transform4x4f& rotateX (const float _angle);
|
|
|
|
Transform4x4f& rotateY (const float _angle);
|
|
|
|
Transform4x4f& rotateZ (const float _angle);
|
2017-11-13 22:16:38 +00:00
|
|
|
Transform4x4f& translate(const Vector3f& _translation);
|
2017-11-22 21:29:52 +00:00
|
|
|
Transform4x4f& round ();
|
2017-10-28 20:24:35 +00:00
|
|
|
|
2017-10-30 19:43:58 +00:00
|
|
|
inline Vector3f& translation() { return mR3.v3(); }
|
|
|
|
inline const Vector3f& translation() const { return mR3.v3(); }
|
|
|
|
|
|
|
|
static const Transform4x4f Identity() { return { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } }; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
Vector4f mR0;
|
|
|
|
Vector4f mR1;
|
|
|
|
Vector4f mR2;
|
|
|
|
Vector4f mR3;
|
|
|
|
|
2017-11-13 22:16:38 +00:00
|
|
|
}; // Transform4x4f
|
2017-10-28 20:24:35 +00:00
|
|
|
|
2017-10-31 17:12:50 +00:00
|
|
|
#endif // ES_CORE_MATH_TRANSFORM4X4F_H
|