Math/OrientedBox: Add Update(Vector3) overload
Former-commit-id: 3d9e75d78d1242b4ee75500c2b9ef4e38b2a7453
This commit is contained in:
parent
f82446dda3
commit
41afb3a3a1
|
|
@ -44,6 +44,7 @@ class NzBoundingVolume
|
|||
NzString ToString() const;
|
||||
|
||||
void Update(const NzMatrix4<T>& transformMatrix);
|
||||
void Update(const NzVector3<T>& translation);
|
||||
|
||||
NzBoundingVolume operator*(T scalar) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -181,6 +181,16 @@ void NzBoundingVolume<T>::Update(const NzMatrix4<T>& transformMatrix)
|
|||
aabb.ExtendTo(obb(i));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void NzBoundingVolume<T>::Update(const NzVector3<T>& translation)
|
||||
{
|
||||
obb.Update(translation);
|
||||
|
||||
aabb.Set(obb(0), obb(1));
|
||||
for (unsigned int i = 2; i < 8; ++i)
|
||||
aabb.ExtendTo(obb(i));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzBoundingVolume<T> NzBoundingVolume<T>::operator*(T scalar) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class NzOrientedBox
|
|||
NzString ToString() const;
|
||||
|
||||
void Update(const NzMatrix4<T>& transformMatrix);
|
||||
void Update(const NzVector3<T>& transformMatrix);
|
||||
|
||||
operator NzVector3<T>*();
|
||||
operator const NzVector3<T>*() const;
|
||||
|
|
|
|||
|
|
@ -132,6 +132,13 @@ void NzOrientedBox<T>::Update(const NzMatrix4<T>& transformMatrix)
|
|||
m_corners[i] = transformMatrix.Transform(localBox.GetCorner(static_cast<nzBoxCorner>(i)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void NzOrientedBox<T>::Update(const NzVector3<T>& translation)
|
||||
{
|
||||
for (unsigned int i = 0; i <= nzBoxCorner_Max; ++i)
|
||||
m_corners[i] = localBox.GetCorner(static_cast<nzBoxCorner>(i)) + translation;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzOrientedBox<T>::operator NzVector3<T>*()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue