MAGE  v0.171.0
Matthias Advanced Game Engine
mage::BoundingFrustum Class Reference

#include <bounding_volume.hpp>

Public Member Functions

 BoundingFrustum (CXMMATRIX transform) noexcept
 
 BoundingFrustum (const BoundingFrustum &frustum) noexcept=default
 
 BoundingFrustum (BoundingFrustum &&frustum) noexcept=default
 
 ~BoundingFrustum ()=default
 
BoundingFrustumoperator= (const BoundingFrustum &frustum) noexcept=default
 
BoundingFrustumoperator= (BoundingFrustum &&frustum) noexcept=default
 
bool Encloses (const Point3 &point) const noexcept
 
bool EnclosesStrict (const Point3 &point) const noexcept
 
bool XM_CALLCONV Encloses (FXMVECTOR point) const noexcept
 
bool XM_CALLCONV EnclosesStrict (FXMVECTOR point) const noexcept
 
bool Encloses (const AABB &aabb) const noexcept
 
bool EnclosesStrict (const AABB &aabb) const noexcept
 
bool Encloses (const BoundingSphere &sphere) const noexcept
 
bool EnclosesStrict (const BoundingSphere &sphere) const noexcept
 
bool Overlaps (const AABB &aabb) const noexcept
 
bool OverlapsStrict (const AABB &aabb) const noexcept
 
bool Overlaps (const BoundingSphere &sphere) const noexcept
 
bool OverlapsStrict (const BoundingSphere &sphere) const noexcept
 
bool operator== (const BoundingFrustum &frustum) const noexcept
 
bool operator!= (const BoundingFrustum &frustum) const noexcept
 

Static Public Member Functions

template<typename BoundingVolumeT >
static bool XM_CALLCONV Cull (FXMMATRIX object_to_projection, const BoundingVolumeT &volume) noexcept
 

Private Attributes

union {
   struct {
      XMVECTOR   m_left_plane
 
      XMVECTOR   m_right_plane
 
      XMVECTOR   m_bottom_plane
 
      XMVECTOR   m_top_plane
 
      XMVECTOR   m_near_plane
 
      XMVECTOR   m_far_plane
 
   } 
 
   XMVECTOR   m_planes [6]
 
}; 
 

Detailed Description

A class of bounding frustums.

Constructor & Destructor Documentation

◆ BoundingFrustum() [1/3]

mage::BoundingFrustum::BoundingFrustum ( CXMMATRIX  transform)
explicitnoexcept

Constructs a bounding frustum from the given transform.

If the given transform represents the view-to-projection transformation matrix, the planes of the bounding frustum are represented by view space coordinates.

If the given transform represents the world-(to-view)-to-projection transformation matrix, the planes of the bounding frustum are represented by world space coordinates.

If the given transform represents the object-(to-world-to-view)-to-projection transformation matrix, the planes of the bounding frustum are represented by object space coordinates.

Parameters
[in]transformThe transform.

◆ BoundingFrustum() [2/3]

mage::BoundingFrustum::BoundingFrustum ( const BoundingFrustum frustum)
defaultnoexcept

Constructs a bounding frustum from the given bounding frustum.

Parameters
[in]frustumA reference to the bounding frustum to copy.

◆ BoundingFrustum() [3/3]

mage::BoundingFrustum::BoundingFrustum ( BoundingFrustum &&  frustum)
defaultnoexcept

Constructs a bounding frustum by moving the given bounding frustum.

Parameters
[in]frustumA reference to the bounding frustum to move.

◆ ~BoundingFrustum()

mage::BoundingFrustum::~BoundingFrustum ( )
default

Destructs this bounding frustum.

Member Function Documentation

◆ Cull()

template<typename BoundingVolumeT >
static bool XM_CALLCONV mage::BoundingFrustum::Cull ( FXMMATRIX  object_to_projection,
const BoundingVolumeT &  volume 
)
staticnoexcept

Checks if the given bounding volume is culled by the bounding frustum constructed from the given object-to-projection transformation matrix.

Template Parameters
BoundingVolumeTThe bounding volume type.
Parameters
[in]object_to_projectionThe object-to-projection transformation matrix.
[in]volumeA reference to the bounding volume.
Returns
true if the given bounding volume is culled by the bounding frustum constructed from the given object-to-projection transformation matrix. false otherwise.

◆ Encloses() [1/4]

bool mage::BoundingFrustum::Encloses ( const Point3 point) const
noexcept

Checks whether this bounding frustum completely encloses the given point.

Parameters
[in]pointA reference to the point.
Returns
true if this bounding frustum completely encloses point. false otherwise.
Note
This is a full coverage test of a point with regard to a bounding frustum.

◆ Encloses() [2/4]

bool XM_CALLCONV mage::BoundingFrustum::Encloses ( FXMVECTOR  point) const
noexcept

Checks whether this bounding frustum completely encloses the given point.

Parameters
[in]pointThe point.
Returns
true if this bounding frustum completely encloses point. false otherwise.
Note
This is a full coverage test of a point with regard to a bounding frustum.

◆ Encloses() [3/4]

bool mage::BoundingFrustum::Encloses ( const AABB aabb) const
noexcept

Checks whether this bounding frustum completely encloses the given AABB.

Parameters
[in]aabbA reference to the AABB.
Returns
true if this bounding frustum completely encloses aabb. false otherwise.
Note
This is a full coverage test of an AABB with regard to a bounding frustum.

◆ Encloses() [4/4]

bool mage::BoundingFrustum::Encloses ( const BoundingSphere sphere) const
noexcept

Checks whether this bounding frustum completely encloses the given bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if this bounding frustum completely encloses sphere. false otherwise.
Note
This is a full coverage test of a bounding sphere with regard to a bounding frustum.

◆ EnclosesStrict() [1/4]

bool mage::BoundingFrustum::EnclosesStrict ( const Point3 point) const
noexcept

Checks whether this bounding frustum completely, strictly encloses the given point.

Parameters
[in]pointA reference to the point.
Returns
true if this bounding frustum completely, strictly encloses point. false otherwise.
Note
This is a full coverage test of a point with regard to a bounding frustum.

◆ EnclosesStrict() [2/4]

bool XM_CALLCONV mage::BoundingFrustum::EnclosesStrict ( FXMVECTOR  point) const
noexcept

Checks whether this bounding frustum completely, strictly encloses the given point.

Parameters
[in]pointThe point.
Returns
true if this bounding frustum completely, strictly encloses point. false otherwise.
Note
This is a full coverage test of a point with regard to a bounding frustum.

◆ EnclosesStrict() [3/4]

bool mage::BoundingFrustum::EnclosesStrict ( const AABB aabb) const
noexcept

Checks whether this bounding frustum completely, strictly encloses the given AABB.

Parameters
[in]aabbA reference to the AABB.
Returns
true if this bounding frustum completely, strictly encloses aabb. false otherwise.
Note
This is a full coverage test of an AABB with regard to a bounding frustum.

◆ EnclosesStrict() [4/4]

bool mage::BoundingFrustum::EnclosesStrict ( const BoundingSphere sphere) const
noexcept

Checks whether this bounding frustum completely, strictly encloses the given bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if this bounding frustum completely, strictly encloses sphere. false otherwise.
Note
This is a full coverage test of a bounding sphere with regard to a bounding frustum.

◆ operator!=()

bool mage::BoundingFrustum::operator!= ( const BoundingFrustum frustum) const
noexcept

Checks whether the given bounding frustum is not equal to this bounding frustum.

Parameters
[in]frustumA reference to the bounding frustum.
Returns
true if the given bounding frustum is equal to this bounding frustum. false otherwise.

◆ operator=() [1/2]

BoundingFrustum& mage::BoundingFrustum::operator= ( const BoundingFrustum frustum)
defaultnoexcept

Copies the given bounding frustum to this bounding frustum.

Parameters
[in]frustumA reference to the bounding frustum to copy.
Returns
A reference to the copy of the given bounding frustum (i.e. this bounding frustum).

◆ operator=() [2/2]

BoundingFrustum& mage::BoundingFrustum::operator= ( BoundingFrustum &&  frustum)
defaultnoexcept

Moves the given bounding frustum to this bounding frustum.

Parameters
[in]frustumA reference to the bounding frustum to move.
Returns
A reference to the moved bounding frustum (i.e. this bounding frustum).

◆ operator==()

bool mage::BoundingFrustum::operator== ( const BoundingFrustum frustum) const
noexcept

Checks whether the given bounding frustum is equal to this bounding frustum.

Parameters
[in]frustumA reference to the bounding frustum.
Returns
true if the given bounding frustum is equal to this bounding frustum. false otherwise.

◆ Overlaps() [1/2]

bool mage::BoundingFrustum::Overlaps ( const AABB aabb) const
noexcept

Checks whether this bounding frustum overlaps the given AABB.

Parameters
[in]aabbA reference to the AABB.
Returns
true if this bounding frustum overlaps aabb. false otherwise.
Note
This is a (partial or full) coverage test of an AABB with regard to a bounding frustum.

◆ Overlaps() [2/2]

bool mage::BoundingFrustum::Overlaps ( const BoundingSphere sphere) const
noexcept

Checks whether this bounding frustum overlaps the given bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if this bounding frustum overlaps sphere. false otherwise.
Note
This is a (partial or full) coverage test of a bounding sphere with regard to a bounding frustum.

◆ OverlapsStrict() [1/2]

bool mage::BoundingFrustum::OverlapsStrict ( const AABB aabb) const
noexcept

Checks whether this bounding frustum strictly overlaps the given AABB.

Parameters
[in]aabbA reference to the AABB.
Returns
true if this bounding frustum strictly overlaps aabb. false otherwise.
Note
This is a (partial or full) coverage test of an AABB with regard to a bounding frustum.

◆ OverlapsStrict() [2/2]

bool mage::BoundingFrustum::OverlapsStrict ( const BoundingSphere sphere) const
noexcept

Checks whether this bounding frustum strictly overlaps the given bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if this bounding frustum strictly overlaps sphere. false otherwise.
Note
This is a (partial or full) coverage test of a bounding sphere with regard to a bounding frustum.

Member Data Documentation

◆ @1

union { ... }

◆ m_bottom_plane

XMVECTOR mage::BoundingFrustum::m_bottom_plane

The bottom plane of this bounding frustum.

◆ m_far_plane

XMVECTOR mage::BoundingFrustum::m_far_plane

The far plane of this bounding frustum.

◆ m_left_plane

XMVECTOR mage::BoundingFrustum::m_left_plane

The left plane of this bounding frustum.

◆ m_near_plane

XMVECTOR mage::BoundingFrustum::m_near_plane

The near plane of this bounding frustum.

◆ m_planes

XMVECTOR mage::BoundingFrustum::m_planes[6]

The six planes of this bounding frustum.

◆ m_right_plane

XMVECTOR mage::BoundingFrustum::m_right_plane

The right plane of this bounding frustum.

◆ m_top_plane

XMVECTOR mage::BoundingFrustum::m_top_plane

The top plane of this bounding frustum.