A frustum class that can be used for efficient primitive intersection tests. More...
#include <Frustum.h>
Public Types | |
enum | PlaneId { Near , Far , Left , Right , Top , Bottom , MAX } |
enum class | ReverseDepth { True , False } |
enum | CornerIndices { NearTopLeft , NearTopRight , NearBottomLeft , NearBottomRight , FarTopLeft , FarTopRight , FarBottomLeft , FarBottomRight , Count } |
using | CornerVertexArray = AZStd::array< AZ::Vector3, CornerIndices::Count > |
Public Member Functions | |
AZ_TYPE_INFO (Frustum, "{AE7D2ADA-0266-494A-98C4-699F099171C2}") | |
Frustum () | |
Default constructor, leaves members uninitialized for speed. | |
Frustum (const ViewFrustumAttributes &viewFrustumAttributes) | |
Frustum (const Plane &nearPlane, const Plane &farPlane, const Plane &leftPlane, const Plane &rightPlane, const Plane &topPlane, const Plane &bottomPlane) | |
Plane | GetPlane (PlaneId planeId) const |
void | SetPlane (PlaneId planeId, const Plane &plane) |
void | Set (const Frustum &frustum) |
IntersectResult | IntersectSphere (const Vector3 ¢er, float radius) const |
IntersectResult | IntersectSphere (const Sphere &sphere) const |
IntersectResult | IntersectAabb (const Vector3 &minimum, const Vector3 &maximum) const |
IntersectResult | IntersectAabb (const Aabb &aabb) const |
bool | IsClose (const Frustum &rhs, float tolerance=Constants::Tolerance) const |
bool | GetCorners (CornerVertexArray &corners) const |
ViewFrustumAttributes | CalculateViewFrustumAttributes () const |
Returns the corresponding view volume attributes for the frustum. | |
Static Public Member Functions | |
static void | Reflect (ReflectContext *context) |
static Frustum | CreateFromMatrixRowMajor (const Matrix4x4 &matrix, ReverseDepth reverseDepth=ReverseDepth::False) |
static Frustum | CreateFromMatrixColumnMajor (const Matrix4x4 &matrix, ReverseDepth reverseDepth=ReverseDepth::False) |
static Frustum | CreateFromMatrixRowMajorSymmetricZ (const Matrix4x4 &matrix, ReverseDepth reverseDepth=ReverseDepth::False) |
static Frustum | CreateFromMatrixColumnMajorSymmetricZ (const Matrix4x4 &matrix, ReverseDepth reverseDepth=ReverseDepth::False) |
A frustum class that can be used for efficient primitive intersection tests.
|
explicit |
Construct a view frustum from ViewFrustumAttributes.
viewFrustumAttributes | Attributes to build a Frustum from a view volume. |
|
static |
Extract frustum from matrix. Matrix Usage and Z conventions form the matrix of use cases. Symmetric-z (OpenGL convention) implies -w <= z <= w Non-symmetric (DirectX convention) implies 0 <= z <= w RowMajor implies x*M convention ColumnMajor implies M*x convention
bool AZ::Frustum::GetCorners | ( | CornerVertexArray & | corners | ) | const |
Fills an array with corner vertices and returns true for valid Frustums.
corners | The array of corner vertices to fill. |
AZ_MATH_INLINE Plane AZ::Frustum::GetPlane | ( | PlaneId | planeId | ) | const |
Returns the requested plane.
planeId | the index of the plane to retrieve |
AZ_MATH_INLINE IntersectResult AZ::Frustum::IntersectAabb | ( | const Aabb & | aabb | ) | const |
Intersects an axis-aligned bounding box.
aabb | the axis-aligned bounding box to test against |
AZ_MATH_INLINE IntersectResult AZ::Frustum::IntersectAabb | ( | const Vector3 & | minimum, |
const Vector3 & | maximum | ||
) | const |
Intersects an axis-aligned bounding box.
minimum | the smallest extents of the bounding volume to test against |
maximum | the largest extents of the bounding volume to test against |
AZ_MATH_INLINE IntersectResult AZ::Frustum::IntersectSphere | ( | const Sphere & | sphere | ) | const |
Intersects a sphere against the frustum.
sphere | the sphere to test against |
AZ_MATH_INLINE IntersectResult AZ::Frustum::IntersectSphere | ( | const Vector3 & | center, |
float | radius | ||
) | const |
Intersects a sphere against the frustum.
center | the center of the sphere to test against |
radius | the radius of the sphere to test against |
AZ_MATH_INLINE bool AZ::Frustum::IsClose | ( | const Frustum & | rhs, |
float | tolerance = Constants::Tolerance |
||
) | const |
Returns true if the current frustum and provided frustum are close to identical.
rhs | the frustum to compare against for closeness |
|
static |
AzCore Reflection.
context | reflection context |
void AZ::Frustum::Set | ( | const Frustum & | frustum | ) |
Clones the provided frustum.
frustum | the frustum instance to clone |
AZ_MATH_INLINE void AZ::Frustum::SetPlane | ( | PlaneId | planeId, |
const Plane & | plane | ||
) |
Sets the requested plane.
planeId | the index of the plane to set |
plane | the new plane value to set to |