Elevate Engine 1
Loading...
Searching...
No Matches
Frustum.h
Go to the documentation of this file.
1#include "glm/glm.hpp"
2
3namespace Elevate
4{
5 class Camera;
6
7 struct Plane
8 {
9 glm::vec3 normal = { 0.f, 1.f, 0.f };
10 float distance = 0.0f;
11
12 void Set(const glm::vec3& normal, const glm::vec3& point)
13 {
14 this->normal = glm::normalize(normal);
15 this->distance = -glm::dot(this->normal, point);
16 }
17
18 float DistanceToPoint(const glm::vec3& point) const
19 {
20 return glm::dot(normal, point) + distance;
21 }
22 };
23
33
34 struct Frustum
35 {
36 Frustum() = default;
37 Frustum(Camera& camera);
38
40 };
41}
42
FrustumPlane
Definition Frustum.h:25
@ RIGHT_PLANE
Definition Frustum.h:30
@ TOP_PLANE
Definition Frustum.h:28
@ FAR_PLANE
Definition Frustum.h:27
@ BOTTOM_PLANE
Definition Frustum.h:29
@ NEAR_PLANE
Definition Frustum.h:26
@ LEFT_PLANE
Definition Frustum.h:31
Frustum()=default
Plane planes[6]
Definition Frustum.h:39
float distance
Definition Frustum.h:10
float DistanceToPoint(const glm::vec3 &point) const
Definition Frustum.h:18
void Set(const glm::vec3 &normal, const glm::vec3 &point)
Definition Frustum.h:12
glm::vec3 normal
Definition Frustum.h:9