Unravel Engine C++ Reference
|
Storage for frustum planes / values and wraps up common functionality. More...
#include <frustum.h>
Public Member Functions | |
frustum () | |
Default constructor. | |
frustum (const transform &view, const transform &proj, bool homogeneousDepth) | |
Constructs a frustum from view and projection matrices. | |
frustum (const bbox &sourceBounds) | |
Constructs a frustum from an axis-aligned bounding box. | |
void | update (const transform &view, const transform &proj, bool _oglNDC) |
Updates the frustum based on the specified view and projection matrices. | |
void | set_planes (const std::array< plane, 6 > &new_planes) |
Sets the frustum planes. | |
void | recompute_points () |
Recomputes the frustum's corner points based on its planes. | |
auto | classify_vertices (const vec3 *vertices, size_t count) const -> volume_query |
Classifies vertices with respect to the frustum. | |
auto | classify_aabb (const bbox &bounds) const -> volume_query |
Classifies an axis-aligned bounding box (AABB) with respect to the frustum. | |
auto | classify_aabb (const bbox &bounds, unsigned int &frustumBits, int &lastOutside) const -> volume_query |
Classifies an axis-aligned bounding box (AABB) with respect to the frustum. | |
auto | classify_obb (const bbox &bounds, const transform &t) const -> volume_query |
Classifies an oriented bounding box (OBB) with respect to the frustum. | |
auto | classify_sphere (const bsphere &sphere) const -> volume_query |
Classifies a sphere with respect to the frustum. | |
auto | classify_plane (const plane &plane) const -> volume_query |
Classifies a plane with respect to the frustum. | |
auto | test_vertices (const vec3 *vertices, size_t count) const -> bool |
Tests if vertices are inside or intersect the frustum. | |
auto | test_point (const vec3 &point) const -> bool |
Tests if a point is inside or intersecting the frustum. | |
auto | test_aabb (const bbox &bounds) const -> bool |
Tests if an axis-aligned bounding box (AABB) is inside or intersecting the frustum. | |
auto | test_obb (const bbox &bounds, const transform &t) const -> bool |
Tests if an oriented bounding box (OBB) is inside or intersecting the frustum. | |
auto | test_sphere (const bsphere &sphere) const -> bool |
Tests if a sphere is inside or intersecting the frustum. | |
auto | test_sphere (const bsphere &sphere, const transform &t) const -> bool |
Tests if a transformed sphere is inside or intersecting the frustum. | |
auto | test_swept_sphere (const bsphere &sphere, const vec3 &sweepDirection) const -> bool |
Determine whether or not the specified sphere, swept along the provided direction vector, intersects the frustum in some way. | |
auto | test_frustum (const frustum &frustum) const -> bool |
Tests if another frustum intersects this frustum. | |
auto | test_line (const vec3 &v1, const vec3 &v2) const -> bool |
Tests if a line intersects the frustum. | |
auto | mul (const transform &t) -> frustum & |
Multiplies the frustum by a transform. | |
auto | operator== (const frustum &f) const -> bool |
Equality operator. | |
Public Attributes | |
std::array< plane, 6 > | planes |
< The 6 planes of the frustum. | |
std::array< vec3, 8 > | points |
The originating position of the frustum. | |
vec3 | position = {0.0f, 0.0f, 0.0f} |
float | near_distance_ {} |
float | far_distance_ {} |
Storage for frustum planes / values and wraps up common functionality.
math::frustum::frustum | ( | ) |
Default constructor.
Definition at line 29 of file frustum.cpp.
Constructs a frustum from view and projection matrices.
view | The view transform. |
proj | The projection transform. |
homogeneousDepth | True when NDC depth is in [-1, 1] range, otherwise its [0, 1]. |
Definition at line 37 of file frustum.cpp.
math::frustum::frustum | ( | const bbox & | sourceBounds | ) |
Constructs a frustum from an axis-aligned bounding box.
sourceBounds | The bounding box to construct the frustum from. |
Definition at line 42 of file frustum.cpp.
auto math::frustum::classify_aabb | ( | const bbox & | bounds | ) | const -> volume_query |
Classifies an axis-aligned bounding box (AABB) with respect to the frustum.
bounds | The bounding box to classify. |
Definition at line 227 of file frustum.cpp.
auto math::frustum::classify_aabb | ( | const bbox & | bounds, |
unsigned int & | frustumBits, | ||
int & | lastOutside ) const -> volume_query |
Classifies an axis-aligned bounding box (AABB) with respect to the frustum.
bounds | The bounding box to classify. |
frustumBits | Bits representing the frustum planes. |
lastOutside | Index of the last outside plane. |
Definition at line 263 of file frustum.cpp.
auto math::frustum::classify_obb | ( | const bbox & | bounds, |
const transform & | t ) const -> volume_query |
Classifies an oriented bounding box (OBB) with respect to the frustum.
bounds | The bounding box to classify. |
t | The transform to apply to the bounding box. |
Definition at line 257 of file frustum.cpp.
auto math::frustum::classify_plane | ( | const plane & | plane | ) | const -> volume_query |
Classifies a plane with respect to the frustum.
plane | The plane to classify. |
Definition at line 581 of file frustum.cpp.
auto math::frustum::classify_sphere | ( | const bsphere & | sphere | ) | const -> volume_query |
Classifies a sphere with respect to the frustum.
sphere | The sphere to classify. |
Definition at line 390 of file frustum.cpp.
auto math::frustum::classify_vertices | ( | const vec3 * | vertices, |
size_t | count ) const -> volume_query |
Classifies vertices with respect to the frustum.
vertices | The vertices to classify. |
count | The number of vertices. |
Definition at line 184 of file frustum.cpp.
Multiplies the frustum by a transform.
t | The transform to multiply by. |
Definition at line 687 of file frustum.cpp.
auto math::frustum::operator== | ( | const frustum & | f | ) | const -> bool |
Equality operator.
f | The frustum to compare with. |
Definition at line 710 of file frustum.cpp.
void math::frustum::recompute_points | ( | ) |
Recomputes the frustum's corner points based on its planes.
Definition at line 153 of file frustum.cpp.
void math::frustum::set_planes | ( | const std::array< plane, 6 > & | new_planes | ) |
Sets the frustum planes.
new_planes | The new planes to set. |
Definition at line 140 of file frustum.cpp.
auto math::frustum::test_aabb | ( | const bbox & | bounds | ) | const -> bool |
Tests if an axis-aligned bounding box (AABB) is inside or intersecting the frustum.
bounds | The bounding box to test. |
Definition at line 334 of file frustum.cpp.
auto math::frustum::test_frustum | ( | const frustum & | frustum | ) | const -> bool |
Tests if another frustum intersects this frustum.
frustum | The other frustum to test. |
Definition at line 617 of file frustum.cpp.
auto math::frustum::test_line | ( | const vec3 & | v1, |
const vec3 & | v2 ) const -> bool |
Tests if a line intersects the frustum.
v1 | The start point of the line. |
v2 | The end point of the line. |
Definition at line 526 of file frustum.cpp.
Tests if an oriented bounding box (OBB) is inside or intersecting the frustum.
bounds | The bounding box to test. |
t | The transform to apply to the bounding box. |
Definition at line 384 of file frustum.cpp.
auto math::frustum::test_point | ( | const vec3 & | point | ) | const -> bool |
Tests if a point is inside or intersecting the frustum.
point | The point to test. |
Definition at line 521 of file frustum.cpp.
auto math::frustum::test_sphere | ( | const bsphere & | sphere | ) | const -> bool |
Tests if a sphere is inside or intersecting the frustum.
sphere | The sphere to test. |
Definition at line 417 of file frustum.cpp.
Tests if a transformed sphere is inside or intersecting the frustum.
sphere | The sphere to test. |
t | The transform to apply to the sphere. |
Definition at line 436 of file frustum.cpp.
auto math::frustum::test_swept_sphere | ( | const bsphere & | sphere, |
const vec3 & | sweepDirection ) const -> bool |
Determine whether or not the specified sphere, swept along the provided direction vector, intersects the frustum in some way.
sphere | The sphere to test. |
sweepDirection | The direction to sweep the sphere. |
Definition at line 475 of file frustum.cpp.
auto math::frustum::test_vertices | ( | const vec3 * | vertices, |
size_t | count ) const -> bool |
Tests if vertices are inside or intersect the frustum.
vertices | The vertices to test. |
count | The number of vertices. |
Definition at line 357 of file frustum.cpp.
Updates the frustum based on the specified view and projection matrices.
view | The view transform. |
proj | The projection transform. |
_oglNDC | Whether the frustum uses OpenGL's NDC. |
Definition at line 66 of file frustum.cpp.
std::array<plane, 6> math::frustum::planes |
std::array<vec3, 8> math::frustum::points |