Merge branch 'master' into application

Former-commit-id: 38f719f531a5deadf35a4f16196f00a488c7827f
This commit is contained in:
Lynix 2016-03-25 23:18:09 +01:00
commit c22abcdc68
3 changed files with 49 additions and 1 deletions

View File

@ -8,9 +8,9 @@
#define NAZARA_ERROR_HPP #define NAZARA_ERROR_HPP
#include <Nazara/Prerequesites.hpp> #include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Enums.hpp>
#include <Nazara/Core/Config.hpp> #include <Nazara/Core/Config.hpp>
#include <Nazara/Core/Directory.hpp> #include <Nazara/Core/Directory.hpp>
#include <Nazara/Core/Enums.hpp>
#include <Nazara/Core/String.hpp> #include <Nazara/Core/String.hpp>
#if NAZARA_CORE_ENABLE_ASSERTS || defined(NAZARA_DEBUG) #if NAZARA_CORE_ENABLE_ASSERTS || defined(NAZARA_DEBUG)

View File

@ -30,6 +30,8 @@ namespace Nz
BoundingVolume(const BoundingVolume& volume) = default; BoundingVolume(const BoundingVolume& volume) = default;
~BoundingVolume() = default; ~BoundingVolume() = default;
BoundingVolume& ExtendTo(const BoundingVolume& volume);
bool IsFinite() const; bool IsFinite() const;
bool IsInfinite() const; bool IsInfinite() const;
bool IsNull() const; bool IsNull() const;

View File

@ -124,6 +124,52 @@ namespace Nz
Set(volume); 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>::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.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 * \brief Checks whether the volume is finite
* \return true if extend is Extend_Finite * \return true if extend is Extend_Finite