Struct Frustum¶
Namespace: Apogee.Core.Numerics
Assembly: Apogee.Core.dll
The view volume of a perspective camera with an infinite far plane, as five planes (left, right, bottom, top, near) in the camera-relative
space the renderer works in. A plane is (nx, ny, nz, d) and a point is inside when n·p + d >= 0 for all five. The four side planes
pass through the camera, which is the origin, so their d is zero; forward * tan + right); the culling kernel takes that into account.
public readonly struct Frustum
Inherited Members¶
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors¶
Frustum(Vector4, Vector4, Vector4, Vector4, Vector4)¶
public Frustum(Vector4 left, Vector4 right, Vector4 bottom, Vector4 top, Vector4 near)
Parameters¶
left Vector4
right Vector4
bottom Vector4
top Vector4
near Vector4
Fields¶
PlaneCount¶
public const int PlaneCount = 5
Field Value¶
Properties¶
Bottom¶
public Vector4 Bottom { get; }
Property Value¶
Left¶
public Vector4 Left { get; }
Property Value¶
Near¶
public Vector4 Near { get; }
Property Value¶
Right¶
public Vector4 Right { get; }
Property Value¶
Top¶
public Vector4 Top { get; }
Property Value¶
this[int]¶
public Vector4 this[int plane] { get; }
Property Value¶
Methods¶
FromCamera(Vector3, Vector3, Vector3, float, float, float)¶
The frustum of a camera at the origin looking along forward, from its basis (as in the rows of a view matrix).
tanHalfFovY is the tangent of half the vertical field of view and aspect is width over height.
public static Frustum FromCamera(Vector3 right, Vector3 up, Vector3 forward, float tanHalfFovY, float aspect, float near)
Parameters¶
right Vector3
up Vector3
forward Vector3
tanHalfFovY float
aspect float
near float
Returns¶
Intersects(Vector3, Vector3)¶
Whether a box (center and half extents along the axes) is at least partly inside. Exact for the planes, so a box near a corner can still be
reported inside without being visible. The arithmetic is in the same order as
public bool Intersects(Vector3 center, Vector3 extents)
Parameters¶
center Vector3
extents Vector3
Returns¶
Offset(Vector3)¶
The same volume for boxes given relative to a point origin away from the camera: d absorbs n·origin.
public Frustum Offset(Vector3 origin)
Parameters¶
origin Vector3