From 4e10d57f83f719e02005fe41e70fe1a4721a9439 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 5 Mar 2025 23:52:18 +0000 Subject: Split core view definition out of Camera into Frustum --- gfx/frustum.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 gfx/frustum.h (limited to 'gfx/frustum.h') diff --git a/gfx/frustum.h b/gfx/frustum.h new file mode 100644 index 0000000..25dcc18 --- /dev/null +++ b/gfx/frustum.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include + +class Frustum { +public: + Frustum(const glm::mat4 & view, const glm::mat4 & projection); + + [[nodiscard]] auto & + getFrustumPlanes() const + { + return planes; + } + + [[nodiscard]] auto & + getViewProjection() const + { + return viewProjection; + } + + void updateView(const glm::mat4 & view); + +protected: + static constexpr size_t FACES = 6; + void updateCache(); + + glm::mat4 view, projection; + glm::mat4 viewProjection, inverseViewProjection; + std::array planes; +}; -- cgit v1.2.3