Represent a 3D frustum, volume defined by the intersection of six planes.
More...
#include <Bounds.hpp>
|
static glm::mat4 | perspective (float fov, float ratio, float near, float far) |
|
static glm::mat4 | ortho (float left, float right, float bottom, float top, float near, float far) |
|
|
enum | FrustumPlane : uint {
LEFT = 0
, RIGHT = 1
, TOP = 2
, BOTTOM = 3
,
NEAR = 4
, FAR = 5
, COUNT = 6
} |
|
|
std::array< glm::vec4, FrustumPlane::COUNT > | _planes |
| Frustum hyperplane coefficients.
|
|
std::array< glm::vec3, 8 > | _corners |
| Frustum corners.
|
|
Represent a 3D frustum, volume defined by the intersection of six planes.
◆ FrustumPlane
Helper enum for the frustum plane locations.
◆ Frustum()
Frustum::Frustum |
( |
const glm::mat4 & |
vp | ) |
|
Create a frustum from a view-projection matrix.
- Parameters
-
vp | the matrix defining the frustum |
◆ intersects()
bool Frustum::intersects |
( |
const BoundingBox & |
box | ) |
const |
Indicate if a bounding box intersect this frustum.
- Parameters
-
box | the bounding box to test |
- Returns
- true if the bounding box intersects the frustum.
- Todo:
- Implement frustum corner checks to weed out more false positives.
◆ ortho()
glm::mat4 Frustum::ortho |
( |
float |
left, |
|
|
float |
right, |
|
|
float |
bottom, |
|
|
float |
top, |
|
|
float |
near, |
|
|
float |
far |
|
) |
| |
|
static |
Generate an orthographic projection matrix, correctly oriented for the rendering API.
- Parameters
-
left | left plane distance from the center |
right | right plane distance from the center |
bottom | bottom plane distance from the center |
top | top plane distance from the center |
near | the near plane distance |
far | the far plane distance |
- Returns
- the projection matrix
◆ perspective()
glm::mat4 Frustum::perspective |
( |
float |
fov, |
|
|
float |
ratio, |
|
|
float |
near, |
|
|
float |
far |
|
) |
| |
|
static |
Generate a perspective projection matrix, correctly oriented for the rendering API.
- Parameters
-
fov | vertical field of view in radians |
ratio | aspect ratio |
near | the near plane distance |
far | the far plane distance |
- Returns
- the projection matrix
The documentation for this class was generated from the following files:
- src/engine/resources/Bounds.hpp
- src/engine/resources/Bounds.cpp