Commit current work
This commit is contained in:
committed by
Jérôme Leclercq
parent
a7ab2fbaf4
commit
b8ea79c40e
@@ -132,7 +132,7 @@ namespace Nz
|
||||
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 TransformInverse(const Vector3<T>& translation, const Quaternion<T>& rotation);
|
||||
static Matrix4 TransformInverse(const Vector3<T>& translation, const Quaternion<T>& rotation, const Vector3<T>&scale);
|
||||
static Matrix4 TransformInverse(const Vector3<T>& translation, const Quaternion<T>& rotation, const Vector3<T>& scale);
|
||||
static Matrix4 Zero();
|
||||
|
||||
T m11, m12, m13, m14,
|
||||
|
||||
@@ -1031,6 +1031,16 @@ namespace Nz
|
||||
return MakeTransform(-(invRot * translation), invRot);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Matrix4<T>& Matrix4<T>::MakeTransformInverse(const Vector3<T>& translation, const Quaternion<T>& rotation, const Vector3<T>& scale)
|
||||
{
|
||||
// A view matrix must apply an inverse transformation of the 'world' matrix
|
||||
Quaternion<T> invRot = rotation.GetConjugate(); // Inverse of the rotation
|
||||
Vector3<T> invScale = T(1.0) / scale;
|
||||
|
||||
return MakeTransform(-(invScale * (invRot * translation)), invRot, invScale);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Makes the matrix an inverse transform matrix (aka view matrix)
|
||||
* \return A reference to this matrix
|
||||
@@ -1696,6 +1706,15 @@ namespace Nz
|
||||
return mat;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Matrix4<T> Matrix4<T>::TransformInverse(const Vector3<T>& translation, const Quaternion<T>& rotation, const Vector3<T>& scale)
|
||||
{
|
||||
Matrix4 mat;
|
||||
mat.MakeTransformInverse(translation, rotation, scale);
|
||||
|
||||
return mat;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shorthand for the 'view' matrix
|
||||
* \return A Matrix4 which is the 'view matrix'
|
||||
|
||||
Reference in New Issue
Block a user