Math/Matrix4: Add TransformInverse(translation, rotation, scale)
This commit is contained in:
@@ -1031,6 +1031,25 @@ namespace Nz
|
||||
return MakeTransform(-(invRot * translation), invRot);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Makes the matrix an inverse transform matrix (aka view matrix)
|
||||
* \return A reference to this matrix
|
||||
*
|
||||
* \param translation Vector3 representing the translation
|
||||
* \param rotation Quaternion representing a rotation of space
|
||||
* \param scale Vector3 representing the scale
|
||||
*
|
||||
* \see InverseTransformMatrix
|
||||
*/
|
||||
template<typename T>
|
||||
Matrix4<T>& Matrix4<T>::MakeTransformInverse(const Vector3<T>& translation, const Quaternion<T>& rotation, const Vector3<T>& scale)
|
||||
{
|
||||
MakeTransformInverse(translation, rotation);
|
||||
ConcatenateTransform(Scale(T(1.0) / scale));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Makes the matrix zero (with 0 everywhere)
|
||||
* \return A reference to this matrix with components (0 everywhere)
|
||||
@@ -1677,6 +1696,25 @@ namespace Nz
|
||||
return mat;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shorthand for the 'view' matrix
|
||||
* \return A Matrix4 which is the 'view matrix'
|
||||
*
|
||||
* \param translation Vector3 representing the translation
|
||||
* \param rotation Quaternion representing a rotation of space
|
||||
* \param scale Vector3 representing the scale
|
||||
*
|
||||
* \see MakeInverseTransformMatrix
|
||||
*/
|
||||
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 'zero' matrix
|
||||
* \return A Matrix4 with components (0 everywhere)
|
||||
|
||||
Reference in New Issue
Block a user