From d2e3bb36a640bff91d90ad55992f9650c6f19943 Mon Sep 17 00:00:00 2001 From: Lynix Date: Tue, 15 Mar 2016 23:00:58 +0100 Subject: [PATCH 1/2] Alphabetical commit Former-commit-id: 4277d1fdc84af2031faa826520fcc442edb47a10 --- include/Nazara/Core/Error.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Nazara/Core/Error.hpp b/include/Nazara/Core/Error.hpp index b210c2e1d..b71bc8cf3 100644 --- a/include/Nazara/Core/Error.hpp +++ b/include/Nazara/Core/Error.hpp @@ -8,9 +8,9 @@ #define NAZARA_ERROR_HPP #include +#include #include #include -#include #include #if NAZARA_CORE_ENABLE_ASSERTS || defined(NAZARA_DEBUG) From b28ab414c9c91ccacc8e48b28531c538011869cc Mon Sep 17 00:00:00 2001 From: Lynix Date: Fri, 25 Mar 2016 23:07:59 +0100 Subject: [PATCH 2/2] Math/BoundingVolume: Add ExtendTo method Former-commit-id: 5cfd681d5cd7adcc2bcf16184a2da821bf4eb477 --- include/Nazara/Math/BoundingVolume.hpp | 2 ++ include/Nazara/Math/BoundingVolume.inl | 46 ++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/include/Nazara/Math/BoundingVolume.hpp b/include/Nazara/Math/BoundingVolume.hpp index 60a16c260..6f1f4b804 100644 --- a/include/Nazara/Math/BoundingVolume.hpp +++ b/include/Nazara/Math/BoundingVolume.hpp @@ -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; diff --git a/include/Nazara/Math/BoundingVolume.inl b/include/Nazara/Math/BoundingVolume.inl index 03e6476bc..ac03268ed 100644 --- a/include/Nazara/Math/BoundingVolume.inl +++ b/include/Nazara/Math/BoundingVolume.inl @@ -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 + BoundingVolume& BoundingVolume::BoundingVolume::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 * \return true if extend is Extend_Finite