Struct BoundingFrustum
Defines a frustum which can be used in frustum culling, zoom to Extents (zoom to fit) operations, (matrix, frustum, camera) interchange, and many kind of intersection testing.
Assembly: FlaxEngine.dll
File: Engine/Core/Math/BoundingFrustum.h
Syntax
public struct BoundingFrustum
Constructors
BoundingFrustum()
Empty constructor.
Declaration
public BoundingFrustum() = default
BoundingFrustum(const Matrix& matrix)
Initializes a new instance of the BoundingFrustum struct.
Declaration
public BoundingFrustum(const Matrix& matrix)
Parameters
|
Matrix
matrix
The combined matrix that usually takes View * Projection matrix. |
Fields
_pBottom
_pFar
_planes
_pLeft
_pNear
_pRight
_pTop
CollisionsHelper
Declaration
public friend CollisionsHelper
Field Value
|
friend
|
Methods
Contains(const BoundingBox& box)
Determines the intersection relationship between the frustum and a bounding box.
Declaration
public ContainmentType Contains(const BoundingBox& box) const
Parameters
|
BoundingBox
box
The box. |
Returns
|
ContainmentType
The type of the containment. |
Contains(const BoundingSphere& sphere)
Determines the intersection relationship between the frustum and a bounding sphere.
Declaration
public ContainmentType Contains(const BoundingSphere& sphere) const
Parameters
|
BoundingSphere
sphere
The sphere. |
Returns
|
ContainmentType
The type of the containment. |
Contains(const Vector3& point)
Checks whether a point lays inside, intersects or lays outside the frustum.
Declaration
public ContainmentType Contains(const Vector3& point) const
Parameters
|
Vector3
point
The point. |
Returns
|
ContainmentType
The type of the containment. |
GetBottom()
GetBox(BoundingBox& result)
Gets bounding box that contains whole frustum.
Declaration
public void GetBox(BoundingBox& result) const
Parameters
|
BoundingBox
result
The result box. |
GetCorners(Double3 corners[8])
Gets the 8 corners of the frustum: Near1 (near right down corner), Near2 (near right top corner), Near3 (near Left top corner), Near4 (near Left down corner), Far1 (far right down corner), Far2 (far right top corner), Far3 (far left top corner), Far4 (far left down corner).
Declaration
public void GetCorners(Double3 corners[8]) const
Parameters
|
Double3
corners
The corners. |
GetCorners(Float3 corners[8])
Gets the 8 corners of the frustum: Near1 (near right down corner), Near2 (near right top corner), Near3 (near Left top corner), Near4 (near Left down corner), Far1 (far right down corner), Far2 (far right top corner), Far3 (far left top corner), Far4 (far left down corner).
Declaration
public void GetCorners(Float3 corners[8]) const
Parameters
|
Float3
corners
The corners. |
GetFar()
GetHeightAtDepth(float depth)
Gets the height of the frustum at specified depth.
Declaration
public float GetHeightAtDepth(float depth) const
Parameters
|
float
depth
The depth at which to calculate frustum height. |
Returns
|
float
The height of the frustum at the specified depth. |
GetInvMatrix(Matrix& result)
Gets the inverted matrix to that describes this bounding frustum.
Declaration
public void GetInvMatrix(Matrix& result) const
Parameters
|
Matrix
result
The result matrix. |
Returns
|
void
|
GetLeft()
GetMatrix()
Gets the matrix that describes this bounding frustum.
Declaration
public Matrix GetMatrix() const
Returns
|
Matrix
|
GetNear()
GetPlane(int32 index)
Gets the one of the 6 planes related to this frustum.
Declaration
public Plane GetPlane(int32 index) const
Parameters
|
int32
index
The index where 0 for Left, 1 for Right, 2 for Top, 3 for Bottom, 4 for Near, 5 for Far. |
Returns
|
Plane
The plane. |
GetRight()
GetSphere(BoundingSphere& result)
Gets bounding sphere that contains whole frustum.
Declaration
public void GetSphere(BoundingSphere& result) const
Parameters
|
BoundingSphere
result
The result sphere. |
GetTop()
GetWidthAtDepth(float depth)
Gets the width of the frustum at specified depth.
Declaration
public float GetWidthAtDepth(float depth) const
Parameters
|
float
depth
The depth at which to calculate frustum width. |
Returns
|
float
The width of the frustum at the specified depth. |
Intersects(const BoundingBox& box)
Checks whether the current frustum intersects a box.
Declaration
public bool Intersects(const BoundingBox& box) const
Parameters
|
BoundingBox
box
The box |
Returns
|
bool
True if the current frustum intersects a box, otherwise false. |
Intersects(const BoundingSphere& sphere)
Checks whether the current frustum intersects a sphere.
Declaration
public bool Intersects(const BoundingSphere& sphere) const
Parameters
|
BoundingSphere
sphere
The sphere. |
Returns
|
bool
True if the current frustum intersects a sphere, otherwise false. |
IsOrthographic()
Determines whether this frustum is orthographic.
Declaration
public bool IsOrthographic() const
Returns
|
bool
|
operator!=(const BoundingFrustum& other)
Declaration
public bool operator!=(const BoundingFrustum& other) const
Parameters
|
BoundingFrustum
other
|
Returns
|
bool
|
operator==(const BoundingFrustum& other)
Declaration
public bool operator==(const BoundingFrustum& other) const
Parameters
|
BoundingFrustum
other
|
Returns
|
bool
|
SetMatrix(const Matrix& matrix)
Sets the matrix that describes this bounding frustum.
Declaration
public void SetMatrix(const Matrix& matrix)
Parameters
|
Matrix
matrix
The matrix (View*Projection). |
SetMatrix(const Matrix& view, const Matrix& projection)
Sets the matrix (made from view and projection matrices) that describes this bounding frustum.
Declaration
public void SetMatrix(const Matrix& view, const Matrix& projection)
Parameters
|
Matrix
view
The view matrix. |
|
Matrix
projection
The projection matrix. |