evan 2026.1.4
Evan
Loading...
Searching...
No Matches
Frustum.hpp
1/*
2** ETIB PROJECT, 2026
3** evan
4** File description:
5** Frustum
6*/
7
8#pragma once
9
10#include <utility/math/aabb.hpp>
11
12#include <glm/glm.hpp>
13
14#include <array>
15#include <cstddef>
16
17namespace evan
18{
26 struct Plane {
27 glm::vec3 normal { 0.0f };
28 float distance = 0.0f;
29 };
30
40 class Frustum
41 {
42 public:
49 static Frustum fromViewProjection(const glm::mat4 &viewProjection);
50
62 bool intersects(const utility::math::AabbF &box) const;
63
71 bool intersects(const glm::vec3 &center, float radius) const;
72
73 private:
74 std::array<Plane, 6> _planes;
75 };
76} // namespace evan
A view frustum represented by its six bounding planes.
Definition Frustum.hpp:41
bool intersects(const glm::vec3 &center, float radius) const
Test whether a bounding sphere intersects the frustum.
bool intersects(const utility::math::AabbF &box) const
Test whether an axis-aligned bounding box intersects the frustum.
static Frustum fromViewProjection(const glm::mat4 &viewProjection)
Build a frustum from a combined projection × view matrix.
A plane in 3D space in Hessian normal form.
Definition Frustum.hpp:26