Antkeeper  0.0.1
Public Types | Public Member Functions | Public Attributes | List of all members
geom::primitives::view_frustum< T > Struct Template Reference

View frustum. More...

#include <view-frustum.hpp>

Public Types

using vector_type = math::vec3< T >
 Vector type. More...
 
using plane_type = geom::plane< T >
 Plane type. More...
 
using matrix_type = math::mat4< T >
 View-projection matrix type. More...
 
using box_type = geom::box< T >
 Box type. More...
 
using sphere_type = geom::sphere< T >
 Sphere type. More...
 

Public Member Functions

constexpr view_frustum () noexcept=default
 Constructs a view frustum. More...
 
constexpr view_frustum (const matrix_type &matrix) noexcept
 Constructs a view frustum by extracting planes from view-projection matrix. More...
 
void extract (const matrix_type &matrix) noexcept
 Extracts the view frustum planes from a view-projection matrix. More...
 
bool intersects (const box_type &box) const noexcept
 Tests for intersection between an axis-aligned box and the view frustum. More...
 
bool intersects (const sphere_type &sphere) const noexcept
 Tests for intersection between a sphere and the view frustum. More...
 
constexpr bool contains (const vector_type &point) const noexcept
 Tests whether a point is contained within this view frustum. More...
 
bool contains (const box_type &box) const noexcept
 Checks if an axis-aligned box is completely contained within the view frustum. More...
 
bool contains (const sphere_type &sphere) const noexcept
 Checks if a sphere is completely contained within the view frustum. More...
 
constexpr const plane_typeleft () const noexcept
 Returns the left clipping plane. More...
 
constexpr plane_typeleft () noexcept
 Returns the left clipping plane. More...
 
constexpr const plane_typeright () const noexcept
 Returns the right clipping plane. More...
 
constexpr plane_typeright () noexcept
 Returns the right clipping plane. More...
 
constexpr const plane_typebottom () const noexcept
 Returns the bottom clipping plane. More...
 
constexpr plane_typebottom () noexcept
 Returns the bottom clipping plane. More...
 
constexpr const plane_typetop () const noexcept
 Returns the top clipping plane. More...
 
constexpr plane_typetop () noexcept
 Returns the top clipping plane. More...
 
constexpr const plane_typenear () const noexcept
 Returns the near clipping plane. More...
 
constexpr plane_typenear () noexcept
 Returns the near clipping plane. More...
 
constexpr const plane_typefar () const noexcept
 Returns the far clipping plane. More...
 
constexpr plane_typefar () noexcept
 Returns the far clipping plane. More...
 

Public Attributes

plane_type planes [6]
 View frustum clipping planes. More...
 

Detailed Description

template<class T>
struct geom::primitives::view_frustum< T >

View frustum.

Template Parameters
TReal type.

Definition at line 38 of file view-frustum.hpp.

Member Typedef Documentation

◆ box_type

template<class T >
using geom::primitives::view_frustum< T >::box_type = geom::box<T>

Box type.

Definition at line 50 of file view-frustum.hpp.

◆ matrix_type

template<class T >
using geom::primitives::view_frustum< T >::matrix_type = math::mat4<T>

View-projection matrix type.

Definition at line 47 of file view-frustum.hpp.

◆ plane_type

template<class T >
using geom::primitives::view_frustum< T >::plane_type = geom::plane<T>

Plane type.

Definition at line 44 of file view-frustum.hpp.

◆ sphere_type

template<class T >
using geom::primitives::view_frustum< T >::sphere_type = geom::sphere<T>

Sphere type.

Definition at line 53 of file view-frustum.hpp.

◆ vector_type

template<class T >
using geom::primitives::view_frustum< T >::vector_type = math::vec3<T>

Vector type.

Definition at line 41 of file view-frustum.hpp.

Constructor & Destructor Documentation

◆ view_frustum() [1/2]

template<class T >
constexpr geom::primitives::view_frustum< T >::view_frustum ( )
constexprdefaultnoexcept

Constructs a view frustum.

◆ view_frustum() [2/2]

template<class T >
constexpr geom::primitives::view_frustum< T >::view_frustum ( const matrix_type matrix)
inlineexplicitconstexprnoexcept

Constructs a view frustum by extracting planes from view-projection matrix.

Parameters
matrixView-projection matrix from which to extract view frustum planes.

Definition at line 63 of file view-frustum.hpp.

Member Function Documentation

◆ bottom() [1/2]

template<class T >
constexpr const plane_type& geom::primitives::view_frustum< T >::bottom ( ) const
inlineconstexprnoexcept

Returns the bottom clipping plane.

Definition at line 94 of file view-frustum.hpp.

◆ bottom() [2/2]

template<class T >
constexpr plane_type& geom::primitives::view_frustum< T >::bottom ( )
inlineconstexprnoexcept

Returns the bottom clipping plane.

Definition at line 98 of file view-frustum.hpp.

◆ contains() [1/3]

template<class T >
bool geom::primitives::view_frustum< T >::contains ( const box_type box) const
inlinenoexcept

Checks if an axis-aligned box is completely contained within the view frustum.

Parameters
boxBox to test for containment within the view frustum.
Returns
true if the axis-aligned box is completely contained within the view frustum, false otherwise.

Definition at line 249 of file view-frustum.hpp.

◆ contains() [2/3]

template<class T >
bool geom::primitives::view_frustum< T >::contains ( const sphere_type sphere) const
inlinenoexcept

Checks if a sphere is completely contained within the view frustum.

Parameters
sphereSphere to test for containment within the view frustum.
Returns
true if the sphere is completely contained within the view frustum, false otherwise.

Definition at line 283 of file view-frustum.hpp.

◆ contains() [3/3]

template<class T >
constexpr bool geom::primitives::view_frustum< T >::contains ( const vector_type point) const
inlineconstexprnoexcept

Tests whether a point is contained within this view frustum.

Parameters
pointPoint to test for containment.
Returns
true if the point is contained within this view frustum, false otherwise.

Definition at line 229 of file view-frustum.hpp.

◆ extract()

template<class T >
void geom::primitives::view_frustum< T >::extract ( const matrix_type matrix)
inlinenoexcept

Extracts the view frustum planes from a view-projection matrix.

Parameters
matrixView-projection matrix from which to extract view frustum planes.

Definition at line 145 of file view-frustum.hpp.

◆ far() [1/2]

template<class T >
constexpr const plane_type& geom::primitives::view_frustum< T >::far ( ) const
inlineconstexprnoexcept

Returns the far clipping plane.

Definition at line 130 of file view-frustum.hpp.

◆ far() [2/2]

template<class T >
constexpr plane_type& geom::primitives::view_frustum< T >::far ( )
inlineconstexprnoexcept

Returns the far clipping plane.

Definition at line 134 of file view-frustum.hpp.

◆ intersects() [1/2]

template<class T >
bool geom::primitives::view_frustum< T >::intersects ( const box_type box) const
inlinenoexcept

Tests for intersection between an axis-aligned box and the view frustum.

Parameters
boxBox to test for intersection with the view frustum.
Returns
true if the axis-aligned box intersects the view frustum, false otherwise.

Definition at line 182 of file view-frustum.hpp.

◆ intersects() [2/2]

template<class T >
bool geom::primitives::view_frustum< T >::intersects ( const sphere_type sphere) const
inlinenoexcept

Tests for intersection between a sphere and the view frustum.

Parameters
sphereSphere to test for intersection with the view frustum.
Returns
true if the sphere intersects the view frustum, false otherwise.

Definition at line 209 of file view-frustum.hpp.

◆ left() [1/2]

template<class T >
constexpr const plane_type& geom::primitives::view_frustum< T >::left ( ) const
inlineconstexprnoexcept

Returns the left clipping plane.

Definition at line 70 of file view-frustum.hpp.

◆ left() [2/2]

template<class T >
constexpr plane_type& geom::primitives::view_frustum< T >::left ( )
inlineconstexprnoexcept

Returns the left clipping plane.

Definition at line 74 of file view-frustum.hpp.

◆ near() [1/2]

template<class T >
constexpr const plane_type& geom::primitives::view_frustum< T >::near ( ) const
inlineconstexprnoexcept

Returns the near clipping plane.

Definition at line 118 of file view-frustum.hpp.

◆ near() [2/2]

template<class T >
constexpr plane_type& geom::primitives::view_frustum< T >::near ( )
inlineconstexprnoexcept

Returns the near clipping plane.

Definition at line 122 of file view-frustum.hpp.

◆ right() [1/2]

template<class T >
constexpr const plane_type& geom::primitives::view_frustum< T >::right ( ) const
inlineconstexprnoexcept

Returns the right clipping plane.

Definition at line 82 of file view-frustum.hpp.

◆ right() [2/2]

template<class T >
constexpr plane_type& geom::primitives::view_frustum< T >::right ( )
inlineconstexprnoexcept

Returns the right clipping plane.

Definition at line 86 of file view-frustum.hpp.

◆ top() [1/2]

template<class T >
constexpr const plane_type& geom::primitives::view_frustum< T >::top ( ) const
inlineconstexprnoexcept

Returns the top clipping plane.

Definition at line 106 of file view-frustum.hpp.

◆ top() [2/2]

template<class T >
constexpr plane_type& geom::primitives::view_frustum< T >::top ( )
inlineconstexprnoexcept

Returns the top clipping plane.

Definition at line 110 of file view-frustum.hpp.

Member Data Documentation

◆ planes

template<class T >
plane_type geom::primitives::view_frustum< T >::planes[6]

View frustum clipping planes.

Clipping planes are stored in the following order:

  1. left
  2. right
  3. bottom
  4. top
  5. near
  6. far

Definition at line 308 of file view-frustum.hpp.


The documentation for this struct was generated from the following file: