From 9b4821a102ab60e9f3c006aeba8b1c02b000ccf3 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Mon, 22 Feb 2021 03:17:19 +0100 Subject: [PATCH] Make Frustum class handle Range class as input --- openVulkanoCpp/Math/Frustum.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openVulkanoCpp/Math/Frustum.hpp b/openVulkanoCpp/Math/Frustum.hpp index 9b9ff64..37c39d5 100644 --- a/openVulkanoCpp/Math/Frustum.hpp +++ b/openVulkanoCpp/Math/Frustum.hpp @@ -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& range) const + { + return IsBoxVisible(range.min, range.max); + } + private: template struct ij2k