Make Frustum class handle Range class as input

This commit is contained in:
2021-02-22 03:17:19 +01:00
parent 5cc0ce9433
commit 9b4821a102

View File

@@ -7,6 +7,7 @@
#pragma once
#include "Math.hpp"
#include "Range.hpp"
#ifdef NEAR
#undef NEAR
@@ -76,7 +77,7 @@ namespace openVulkanoCpp::Math
}
// http://iquilezles.org/www/articles/frustumcorrect/frustumcorrect.htm
bool IsBoxVisible(const Math::Vector3f& minp, const Math::Vector3f& maxp) const
[[nodiscard]] bool IsBoxVisible(const Math::Vector3f& minp, const Math::Vector3f& maxp) const
{ // http://iquilezles.org/www/articles/frustumcorrect/frustumcorrect.htm
// check box outside/inside of frustum
for (int i = 0; i < COUNT; i++)
@@ -118,11 +119,16 @@ namespace openVulkanoCpp::Math
return true;
}
bool IsBoxVisible(const Math::Vector4f& minp, const Math::Vector4f& maxp) const
[[nodiscard]] bool IsBoxVisible(const Math::Vector4f& minp, const Math::Vector4f& maxp) const
{
return IsBoxVisible(Math::Vector3f(minp), Math::Vector3f(maxp));
}
[[nodiscard]] bool IsBoxVisible(const Range<Math::Vector3f>& range) const
{
return IsBoxVisible(range.min, range.max);
}
private:
template<Planes i, Planes j>
struct ij2k