blob: 5ee7d2c3ffdedfa6241ba18a780013a8ffd33651 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#pragma once
#include "config/types.h"
#include <array>
#include <glm/mat4x4.hpp>
class AxisAlignedBoundingBox;
class Frustum {
public:
Frustum(const GlobalPosition3D & pos, const glm::mat4 & view, const glm::mat4 & projection);
[[nodiscard]] auto &
getFrustumPlanes() const
{
return planes;
}
[[nodiscard]] auto &
getViewProjection() const
{
return viewProjection;
}
[[nodiscard]] auto
getPosition() const
{
return position;
}
void updateView(const glm::mat4 & view);
[[nodiscard]] bool contains(const AxisAlignedBoundingBox &) const;
protected:
static constexpr size_t FACES = 6;
void updateCache();
GlobalPosition3D position;
glm::mat4 view, projection;
glm::mat4 viewProjection, inverseViewProjection;
std::array<glm::vec4, FACES> planes;
};
|