Merge branch 'master' of https://github.com/DigitalPulseSoftware/NazaraEngine
Former-commit-id: 157536817615de91c7bea1920d706c356d858216
This commit is contained in:
@@ -30,6 +30,8 @@ namespace Nz
|
||||
BoundingVolume(const BoundingVolume& volume) = default;
|
||||
~BoundingVolume() = default;
|
||||
|
||||
BoundingVolume& ExtendTo(const BoundingVolume& volume);
|
||||
|
||||
bool IsFinite() const;
|
||||
bool IsInfinite() const;
|
||||
bool IsNull() const;
|
||||
|
||||
@@ -124,6 +124,52 @@ namespace Nz
|
||||
Set(volume);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Extends the bounding volume to contain another bounding volume
|
||||
* \return A reference to the the bounding volume
|
||||
*
|
||||
* \param volume Other volume to contain
|
||||
*
|
||||
* \remark Extending to a null bounding volume has no effect while extending to a infinite bounding volume will set it as infinite
|
||||
*/
|
||||
template<typename T>
|
||||
BoundingVolume<T>& BoundingVolume<T>::ExtendTo(const BoundingVolume& volume)
|
||||
{
|
||||
switch (extend)
|
||||
{
|
||||
case Extend_Finite:
|
||||
{
|
||||
switch (volume.extend)
|
||||
{
|
||||
case Extend_Finite:
|
||||
{
|
||||
// Extend the OBB local box
|
||||
obb.localBox.ExtendTo(volume.obb.localBox);
|
||||
break;
|
||||
}
|
||||
|
||||
case Extend_Infinite:
|
||||
MakeInfinite();
|
||||
break;
|
||||
|
||||
case Extend_Null:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Extend_Infinite:
|
||||
break; //< We already contain the bounding volume
|
||||
|
||||
case Extend_Null:
|
||||
Set(volume);
|
||||
break;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether the volume is finite
|
||||
* \return true if extend is Extend_Finite
|
||||
|
||||
Reference in New Issue
Block a user