COGS
Computer Graphics Structures library
Frustum.h
1 #ifndef COGS_FRUSTUM_H
2 #define COGS_FRUSTUM_H
3 
4 #include <array>
5 #include <glm/glm.hpp>
6 
7 #include <Utils/GeometryStructures.h>
8 #include <Utils/Exceptions.h>
9 
10 #include <COGS/API.h>
11 
12 
13 
14 namespace cogs
15 {
16 
21  struct COGS_API Frustum
22  {
24  glm::vec3 position;
26  glm::vec3 forward;
28  glm::vec3 up;
29 
33  float far_distance;
34 
38  float vertical_fov;
39 
40 
41 
43  glm::vec3 Right() const;
44 
46  geom::Plane GetNearPlane() const;
47 
49  geom::Plane GetFarPlane() const;
50 
52  geom::Plane GetTopPlane() const;
53 
55  geom::Plane GetBottomPlane() const;
56 
58  geom::Plane GetRightPlane() const;
59 
61  geom::Plane GetLeftPlane() const;
62 
64  geom::Plane GetHorizontalPlane() const;
65 
67  geom::Plane GetVerticalPlane() const;
68 
70  std::array<glm::vec3, 4> GetSliceCorners(float slice_distance) const;
71 
73  std::array<glm::vec3, 4> GetNearCorners() const;
74 
76  std::array<glm::vec3, 4> GetFarCorners() const;
77  };
78 }
79 
80 #endif /* !COGS_FRUSTUM_H */
Namespace of "Computer Graphic Structures" library, which implement many core classes and structures...
Definition: AabbHierarchy.h:8
glm::vec3 position
Frustum position.
Definition: Frustum.h:24
Definition of a 3-dimensional view frustum - a square-based 3D pyramid truncated by parallel planes...
Definition: Frustum.h:21
glm::vec3 forward
Frustum forward vector. Points inside the Frustum from its position.
Definition: Frustum.h:26
float horizontal_fov
Full horizontal field of view angle.
Definition: Frustum.h:36
float far_distance
Distance of far plane from the Frustum&#39;s position in the direction of its forward vector...
Definition: Frustum.h:33
float vertical_fov
Full vertical field of view angle.
Definition: Frustum.h:38
glm::vec3 up
Frustum up vector.
Definition: Frustum.h:28
float near_distance
Distance of near plane from the Frustum&#39;s position in the direction of its forward vector...
Definition: Frustum.h:31