Switch from Nz prefix to namespace Nz
What a huge commit Former-commit-id: 38ac5eebf70adc1180f571f6006192d28fb99897
This commit is contained in:
@@ -12,134 +12,138 @@
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Config.hpp>
|
||||
|
||||
template<typename T> class NzEulerAngles;
|
||||
template<typename T> class NzQuaternion;
|
||||
template<typename T> class NzVector2;
|
||||
template<typename T> class NzVector3;
|
||||
template<typename T> class NzVector4;
|
||||
|
||||
template<typename T>
|
||||
class NzMatrix4
|
||||
namespace Nz
|
||||
{
|
||||
public:
|
||||
NzMatrix4() = default;
|
||||
NzMatrix4(T r11, T r12, T r13, T r14,
|
||||
T r21, T r22, T r23, T r24,
|
||||
T r31, T r32, T r33, T r34,
|
||||
T r41, T r42, T r43, T r44);
|
||||
//NzMatrix4(const NzMatrix3<T>& matrix);
|
||||
NzMatrix4(const T matrix[16]);
|
||||
template<typename U> explicit NzMatrix4(const NzMatrix4<U>& matrix);
|
||||
NzMatrix4(const NzMatrix4& matrix) = default;
|
||||
~NzMatrix4() = default;
|
||||
template<typename T> class EulerAngles;
|
||||
template<typename T> class Quaternion;
|
||||
template<typename T> class Vector2;
|
||||
template<typename T> class Vector3;
|
||||
template<typename T> class Vector4;
|
||||
|
||||
NzMatrix4& ApplyRotation(const NzQuaternion<T>& rotation);
|
||||
NzMatrix4& ApplyScale(const NzVector3<T>& scale);
|
||||
NzMatrix4& ApplyTranslation(const NzVector3<T>& translation);
|
||||
template<typename T>
|
||||
class Matrix4
|
||||
{
|
||||
public:
|
||||
Matrix4() = default;
|
||||
Matrix4(T r11, T r12, T r13, T r14,
|
||||
T r21, T r22, T r23, T r24,
|
||||
T r31, T r32, T r33, T r34,
|
||||
T r41, T r42, T r43, T r44);
|
||||
//Matrix4(const Matrix3<T>& matrix);
|
||||
Matrix4(const T matrix[16]);
|
||||
template<typename U> explicit Matrix4(const Matrix4<U>& matrix);
|
||||
Matrix4(const Matrix4& matrix) = default;
|
||||
~Matrix4() = default;
|
||||
|
||||
NzMatrix4& Concatenate(const NzMatrix4& matrix);
|
||||
NzMatrix4& ConcatenateAffine(const NzMatrix4& matrix);
|
||||
Matrix4& ApplyRotation(const Quaternion<T>& rotation);
|
||||
Matrix4& ApplyScale(const Vector3<T>& scale);
|
||||
Matrix4& ApplyTranslation(const Vector3<T>& translation);
|
||||
|
||||
NzVector4<T> GetColumn(unsigned int column) const;
|
||||
T GetDeterminant() const;
|
||||
T GetDeterminantAffine() const;
|
||||
bool GetInverse(NzMatrix4* dest) const;
|
||||
bool GetInverseAffine(NzMatrix4* dest) const;
|
||||
NzQuaternion<T> GetRotation() const;
|
||||
//NzMatrix3 GetRotationMatrix() const;
|
||||
NzVector4<T> GetRow(unsigned int row) const;
|
||||
NzVector3<T> GetScale() const;
|
||||
NzVector3<T> GetSquaredScale() const;
|
||||
NzVector3<T> GetTranslation() const;
|
||||
void GetTransposed(NzMatrix4* dest) const;
|
||||
Matrix4& Concatenate(const Matrix4& matrix);
|
||||
Matrix4& ConcatenateAffine(const Matrix4& matrix);
|
||||
|
||||
bool HasNegativeScale() const;
|
||||
bool HasScale() const;
|
||||
Vector4<T> GetColumn(unsigned int column) const;
|
||||
T GetDeterminant() const;
|
||||
T GetDeterminantAffine() const;
|
||||
bool GetInverse(Matrix4* dest) const;
|
||||
bool GetInverseAffine(Matrix4* dest) const;
|
||||
Quaternion<T> GetRotation() const;
|
||||
//Matrix3 GetRotationMatrix() const;
|
||||
Vector4<T> GetRow(unsigned int row) const;
|
||||
Vector3<T> GetScale() const;
|
||||
Vector3<T> GetSquaredScale() const;
|
||||
Vector3<T> GetTranslation() const;
|
||||
void GetTransposed(Matrix4* dest) const;
|
||||
|
||||
NzMatrix4& Inverse(bool* succeeded = nullptr);
|
||||
NzMatrix4& InverseAffine(bool* succeeded = nullptr);
|
||||
bool HasNegativeScale() const;
|
||||
bool HasScale() const;
|
||||
|
||||
bool IsAffine() const;
|
||||
bool IsIdentity() const;
|
||||
Matrix4& Inverse(bool* succeeded = nullptr);
|
||||
Matrix4& InverseAffine(bool* succeeded = nullptr);
|
||||
|
||||
NzMatrix4& MakeIdentity();
|
||||
NzMatrix4& MakeLookAt(const NzVector3<T>& eye, const NzVector3<T>& target, const NzVector3<T>& up = NzVector3<T>::Up());
|
||||
NzMatrix4& MakeOrtho(T left, T right, T top, T bottom, T zNear = -1.0, T zFar = 1.0);
|
||||
NzMatrix4& MakePerspective(T angle, T ratio, T zNear, T zFar);
|
||||
NzMatrix4& MakeRotation(const NzQuaternion<T>& rotation);
|
||||
NzMatrix4& MakeScale(const NzVector3<T>& scale);
|
||||
NzMatrix4& MakeTranslation(const NzVector3<T>& translation);
|
||||
NzMatrix4& MakeTransform(const NzVector3<T>& translation, const NzQuaternion<T>& rotation);
|
||||
NzMatrix4& MakeTransform(const NzVector3<T>& translation, const NzQuaternion<T>& rotation, const NzVector3<T>& scale);
|
||||
NzMatrix4& MakeViewMatrix(const NzVector3<T>& translation, const NzQuaternion<T>& rotation);
|
||||
NzMatrix4& MakeZero();
|
||||
bool IsAffine() const;
|
||||
bool IsIdentity() const;
|
||||
|
||||
NzMatrix4& Set(T r11, T r12, T r13, T r14,
|
||||
T r21, T r22, T r23, T r24,
|
||||
T r31, T r32, T r33, T r34,
|
||||
T r41, T r42, T r43, T r44);
|
||||
NzMatrix4& Set(const T matrix[16]);
|
||||
//NzMatrix4(const NzMatrix3<T>& matrix);
|
||||
NzMatrix4& Set(const NzMatrix4& matrix);
|
||||
template<typename U> NzMatrix4& Set(const NzMatrix4<U>& matrix);
|
||||
NzMatrix4& SetRotation(const NzQuaternion<T>& rotation);
|
||||
NzMatrix4& SetScale(const NzVector3<T>& scale);
|
||||
NzMatrix4& SetTranslation(const NzVector3<T>& translation);
|
||||
Matrix4& MakeIdentity();
|
||||
Matrix4& MakeLookAt(const Vector3<T>& eye, const Vector3<T>& target, const Vector3<T>& up = Vector3<T>::Up());
|
||||
Matrix4& MakeOrtho(T left, T right, T top, T bottom, T zNear = -1.0, T zFar = 1.0);
|
||||
Matrix4& MakePerspective(T angle, T ratio, T zNear, T zFar);
|
||||
Matrix4& MakeRotation(const Quaternion<T>& rotation);
|
||||
Matrix4& MakeScale(const Vector3<T>& scale);
|
||||
Matrix4& MakeTranslation(const Vector3<T>& translation);
|
||||
Matrix4& MakeTransform(const Vector3<T>& translation, const Quaternion<T>& rotation);
|
||||
Matrix4& MakeTransform(const Vector3<T>& translation, const Quaternion<T>& rotation, const Vector3<T>& scale);
|
||||
Matrix4& MakeViewMatrix(const Vector3<T>& translation, const Quaternion<T>& rotation);
|
||||
Matrix4& MakeZero();
|
||||
|
||||
NzString ToString() const;
|
||||
Matrix4& Set(T r11, T r12, T r13, T r14,
|
||||
T r21, T r22, T r23, T r24,
|
||||
T r31, T r32, T r33, T r34,
|
||||
T r41, T r42, T r43, T r44);
|
||||
Matrix4& Set(const T matrix[16]);
|
||||
//Matrix4(const Matrix3<T>& matrix);
|
||||
Matrix4& Set(const Matrix4& matrix);
|
||||
template<typename U> Matrix4& Set(const Matrix4<U>& matrix);
|
||||
Matrix4& SetRotation(const Quaternion<T>& rotation);
|
||||
Matrix4& SetScale(const Vector3<T>& scale);
|
||||
Matrix4& SetTranslation(const Vector3<T>& translation);
|
||||
|
||||
NzVector2<T> Transform(const NzVector2<T>& vector, T z = 0.0, T w = 1.0) const;
|
||||
NzVector3<T> Transform(const NzVector3<T>& vector, T w = 1.0) const;
|
||||
NzVector4<T> Transform(const NzVector4<T>& vector) const;
|
||||
String ToString() const;
|
||||
|
||||
NzMatrix4& Transpose();
|
||||
Vector2<T> Transform(const Vector2<T>& vector, T z = 0.0, T w = 1.0) const;
|
||||
Vector3<T> Transform(const Vector3<T>& vector, T w = 1.0) const;
|
||||
Vector4<T> Transform(const Vector4<T>& vector) const;
|
||||
|
||||
operator T*();
|
||||
operator const T*() const;
|
||||
Matrix4& Transpose();
|
||||
|
||||
T& operator()(unsigned int x, unsigned int y);
|
||||
T operator()(unsigned int x, unsigned int y) const;
|
||||
operator T*();
|
||||
operator const T*() const;
|
||||
|
||||
NzMatrix4& operator=(const NzMatrix4& matrix) = default;
|
||||
T& operator()(unsigned int x, unsigned int y);
|
||||
T operator()(unsigned int x, unsigned int y) const;
|
||||
|
||||
NzMatrix4 operator*(const NzMatrix4& matrix) const;
|
||||
NzVector2<T> operator*(const NzVector2<T>& vector) const;
|
||||
NzVector3<T> operator*(const NzVector3<T>& vector) const;
|
||||
NzVector4<T> operator*(const NzVector4<T>& vector) const;
|
||||
NzMatrix4 operator*(T scalar) const;
|
||||
Matrix4& operator=(const Matrix4& matrix) = default;
|
||||
|
||||
NzMatrix4& operator*=(const NzMatrix4& matrix);
|
||||
NzMatrix4& operator*=(T scalar);
|
||||
Matrix4 operator*(const Matrix4& matrix) const;
|
||||
Vector2<T> operator*(const Vector2<T>& vector) const;
|
||||
Vector3<T> operator*(const Vector3<T>& vector) const;
|
||||
Vector4<T> operator*(const Vector4<T>& vector) const;
|
||||
Matrix4 operator*(T scalar) const;
|
||||
|
||||
bool operator==(const NzMatrix4& mat) const;
|
||||
bool operator!=(const NzMatrix4& mat) const;
|
||||
Matrix4& operator*=(const Matrix4& matrix);
|
||||
Matrix4& operator*=(T scalar);
|
||||
|
||||
static NzMatrix4 Concatenate(const NzMatrix4& left, const NzMatrix4& right);
|
||||
static NzMatrix4 ConcatenateAffine(const NzMatrix4& left, const NzMatrix4& right);
|
||||
static NzMatrix4 Identity();
|
||||
static NzMatrix4 LookAt(const NzVector3<T>& eye, const NzVector3<T>& target, const NzVector3<T>& up = NzVector3<T>::Up());
|
||||
static NzMatrix4 Ortho(T left, T right, T top, T bottom, T zNear = -1.0, T zFar = 1.0);
|
||||
static NzMatrix4 Perspective(T angle, T ratio, T zNear, T zFar);
|
||||
static NzMatrix4 Rotate(const NzQuaternion<T>& rotation);
|
||||
static NzMatrix4 Scale(const NzVector3<T>& scale);
|
||||
static NzMatrix4 Translate(const NzVector3<T>& translation);
|
||||
static NzMatrix4 Transform(const NzVector3<T>& translation, const NzQuaternion<T>& rotation);
|
||||
static NzMatrix4 Transform(const NzVector3<T>& translation, const NzQuaternion<T>& rotation, const NzVector3<T>& scale);
|
||||
static NzMatrix4 ViewMatrix(const NzVector3<T>& translation, const NzQuaternion<T>& rotation);
|
||||
static NzMatrix4 Zero();
|
||||
bool operator==(const Matrix4& mat) const;
|
||||
bool operator!=(const Matrix4& mat) const;
|
||||
|
||||
T m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
m31, m32, m33, m34,
|
||||
m41, m42, m43, m44;
|
||||
};
|
||||
static Matrix4 Concatenate(const Matrix4& left, const Matrix4& right);
|
||||
static Matrix4 ConcatenateAffine(const Matrix4& left, const Matrix4& right);
|
||||
static Matrix4 Identity();
|
||||
static Matrix4 LookAt(const Vector3<T>& eye, const Vector3<T>& target, const Vector3<T>& up = Vector3<T>::Up());
|
||||
static Matrix4 Ortho(T left, T right, T top, T bottom, T zNear = -1.0, T zFar = 1.0);
|
||||
static Matrix4 Perspective(T angle, T ratio, T zNear, T zFar);
|
||||
static Matrix4 Rotate(const Quaternion<T>& rotation);
|
||||
static Matrix4 Scale(const Vector3<T>& scale);
|
||||
static Matrix4 Translate(const Vector3<T>& translation);
|
||||
static Matrix4 Transform(const Vector3<T>& translation, const Quaternion<T>& rotation);
|
||||
static Matrix4 Transform(const Vector3<T>& translation, const Quaternion<T>& rotation, const Vector3<T>& scale);
|
||||
static Matrix4 ViewMatrix(const Vector3<T>& translation, const Quaternion<T>& rotation);
|
||||
static Matrix4 Zero();
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const NzMatrix4<T>& matrix);
|
||||
T m11, m12, m13, m14,
|
||||
m21, m22, m23, m24,
|
||||
m31, m32, m33, m34,
|
||||
m41, m42, m43, m44;
|
||||
};
|
||||
|
||||
template<typename T> NzMatrix4<T> operator*(T scale, const NzMatrix4<T>& matrix);
|
||||
typedef Matrix4<double> Matrix4d;
|
||||
typedef Matrix4<float> Matrix4f;
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Matrix4<T>& matrix);
|
||||
|
||||
template<typename T> Nz::Matrix4<T> operator*(T scale, const Nz::Matrix4<T>& matrix);
|
||||
|
||||
typedef NzMatrix4<double> NzMatrix4d;
|
||||
typedef NzMatrix4<float> NzMatrix4f;
|
||||
|
||||
#include <Nazara/Math/Matrix4.inl>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user