(Matrix4) Renamed Destroy to Undefine, fixed bug

Fixed Transpose() not checking COW ownership


Former-commit-id: de2c64b9aef5abf2f73ce6cff2fe8442c1c382c5
This commit is contained in:
Lynix 2012-10-26 14:08:30 +02:00
parent 61c081ace3
commit 4c23ccf1c6
2 changed files with 12 additions and 8 deletions

View File

@ -43,8 +43,6 @@ class NzMatrix4
NzMatrix4 Concatenate(const NzMatrix4& matrix) const;
NzMatrix4 ConcatenateAffine(const NzMatrix4& matrix) const;
void Destroy();
T GetDeterminant() const;
NzMatrix4 GetInverse(bool* succeeded = nullptr) const;
NzMatrix4 GetInverseAffine(bool* succeeded = nullptr) const;
@ -94,6 +92,8 @@ class NzMatrix4
NzMatrix4& Transpose();
NzMatrix4& Undefine();
operator NzString() const;
operator T*();

View File

@ -98,12 +98,6 @@ NzMatrix4<T> NzMatrix4<T>::ConcatenateAffine(const NzMatrix4& matrix) const
return ConcatenateAffine(*this, matrix);
}
template<typename T>
void NzMatrix4<T>::Destroy()
{
ReleaseMatrix();
}
template<typename T>
T NzMatrix4<T>::GetDeterminant() const
{
@ -836,6 +830,8 @@ NzMatrix4<T>& NzMatrix4<T>::Transpose()
}
#endif
EnsureOwnership();
std::swap(m_sharedMatrix->m12, m_sharedMatrix->m21);
std::swap(m_sharedMatrix->m13, m_sharedMatrix->m31);
std::swap(m_sharedMatrix->m14, m_sharedMatrix->m41);
@ -846,6 +842,14 @@ NzMatrix4<T>& NzMatrix4<T>::Transpose()
return *this;
}
template<typename T>
NzMatrix4<T>& NzMatrix4<T>::Undefine()
{
ReleaseMatrix();
return *this;
}
template<typename T>
NzMatrix4<T>::operator NzString() const
{