Added Matrix4::Apply[Rotation|Translation]

Former-commit-id: 1c59aa48f057d4bdc4b4413e349d2b4290dec055
This commit is contained in:
Lynix 2013-06-03 12:57:20 +02:00
parent f712ed1c73
commit a3f1417abd
2 changed files with 19 additions and 0 deletions

View File

@ -31,7 +31,9 @@ class NzMatrix4
NzMatrix4(const NzMatrix4& matrix) = default; NzMatrix4(const NzMatrix4& matrix) = default;
~NzMatrix4() = default; ~NzMatrix4() = default;
NzMatrix4& ApplyRotation(const NzQuaternion<T>& rotation);
NzMatrix4& ApplyScale(const NzVector3<T>& scale); NzMatrix4& ApplyScale(const NzVector3<T>& scale);
NzMatrix4& ApplyTranslation(const NzVector3<T>& translation);
NzMatrix4& Concatenate(const NzMatrix4& matrix); NzMatrix4& Concatenate(const NzMatrix4& matrix);
NzMatrix4& ConcatenateAffine(const NzMatrix4& matrix); NzMatrix4& ConcatenateAffine(const NzMatrix4& matrix);

View File

@ -43,6 +43,12 @@ NzMatrix4<T>::NzMatrix4(const NzMatrix4<U>& matrix)
Set(matrix); Set(matrix);
} }
template<typename T>
NzMatrix4<T>& NzMatrix4<T>::ApplyRotation(const NzQuaternion<T>& rotation)
{
return Concatenate(NzMatrix4f::Rotate(rotation));
}
template<typename T> template<typename T>
NzMatrix4<T>& NzMatrix4<T>::ApplyScale(const NzVector3<T>& scale) NzMatrix4<T>& NzMatrix4<T>::ApplyScale(const NzVector3<T>& scale)
{ {
@ -62,6 +68,17 @@ NzMatrix4<T>& NzMatrix4<T>::ApplyScale(const NzVector3<T>& scale)
return *this; return *this;
} }
template<typename T>
NzMatrix4<T>& NzMatrix4<T>::ApplyTranslation(const NzVector3<T>& translation)
{
m41 += translation.x;
m42 += translation.y;
m43 += translation.z;
m_isIdentity = false;
return *this;
}
template<typename T> template<typename T>
NzMatrix4<T>& NzMatrix4<T>::Concatenate(const NzMatrix4& matrix) NzMatrix4<T>& NzMatrix4<T>::Concatenate(const NzMatrix4& matrix)
{ {