Gorilla.Context.Frustum
Unit Gorilla.Context.Frustum.pasRecords
- record TGorillaFrustum
Enumerations
- enum TGorillaContainmentType = ( Contains, Disjoint, Intersects ) ;
Constants
- const GORILLA_FRUSTUM_TOP : Integer = $0;
- const GORILLA_FRUSTUM_BOTTOM : Integer = $1;
- const GORILLA_FRUSTUM_LEFT : Integer = $2;
- const GORILLA_FRUSTUM_RIGHT : Integer = $3;
- const GORILLA_FRUSTUM_NEAR : Integer = $4;
- const GORILLA_FRUSTUM_FAR : Integer = $5;
- const GORILLA_FRUSTUM_A : Integer = $0;
- const GORILLA_FRUSTUM_B : Integer = $1;
- const GORILLA_FRUSTUM_C : Integer = $2;
- const GORILLA_FRUSTUM_D : Integer = $3;
- const GORILLA_FRUSTUM_CORNER_FTL : Integer = $0;
- const GORILLA_FRUSTUM_CORNER_FTR : Integer = $1;
- const GORILLA_FRUSTUM_CORNER_FBL : Integer = $2;
- const GORILLA_FRUSTUM_CORNER_FBR : Integer = $3;
- const GORILLA_FRUSTUM_CORNER_NTL : Integer = $4;
- const GORILLA_FRUSTUM_CORNER_NTR : Integer = $5;
- const GORILLA_FRUSTUM_CORNER_NBL : Integer = $6;
- const GORILLA_FRUSTUM_CORNER_NBR : Integer = $7;
Mics. types
- type TGorillaFrustumType = array [0..5] of TVector3D;
- type TFrustumCorners = array [0..7] of TPoint3D;
TGorillaFrustum
Fields
- private FFOV :
Single
- private FRatio :
Single
- private FNearD :
Single
- private FFarD :
Single
- private FPos :
TPoint3D
- private FDir :
TPoint3D
- private FUp :
TPoint3D
- private FRight :
TPoint3D
- private FNearH :
Single
- private FNearW :
Single
- private FFarH :
Single
- private FFarW :
Single
- private FCorners :
TFrustumCorners
- private FPlanes :
TGorillaFrustumType
Methods
- public constructor Create ( const AProjMatrix : TMatrix3D; const AViewMatrix : TMatrix3D; ACamPos : TPoint3D ) ; public constructor Create ( AFOV : Single; AAspectRatio : Single; ANearDist : Single; AFarDist : Single; ACameraPos : TPoint3D; ACameraDir : TPoint3D; AUp : TPoint3D; ARight : TPoint3D ) ; public constructor Create ( const AProjMatrix : TMatrix3D; ACameraPos : TPoint3D; ACameraDir : TPoint3D; AUp : TPoint3D; ARight : TPoint3D ) ;
- public procedure NormalizePlane ( var AFrustum : TGorillaFrustumType; const ASide : Integer ) ; static;
- public procedure Normalize
(
ASide :
Integer
)
;
This normalizes a plane (A side) from a given frustum.
- public procedure Calculate
(
AFOV :
Single; AAspectRatio :
Single; ANearDist :
Single; AFarDist :
Single; ACameraPos :
TPoint3D; ACameraDir :
TPoint3D; AUp :
TPoint3D; ARight :
TPoint3D
)
;
overload;
This extract our frustum from fov, aspect-ratio, near- and far distance values given by projection matrix. It also needs values from view matrix like camera position, direction, up- and right vector.
- public procedure Calculate
(
AProjMatrix :
TMatrix3D; AViewMatrix :
TMatrix3D
)
;
overload;
This extracts our frustum from the projection and modelview matrix.
- public procedure Calculate
(
AProjMatrix :
TMatrix3D; ACameraPos :
TPoint3D; ACameraDir :
TPoint3D; AUp :
TPoint3D; ARight :
TPoint3D
)
;
overload;
This extracts our frustum from the projection and camera settings.
- public function IsPointInFrustum
(
const
APoint :
TPoint3D
)
: Boolean
;
This determines if a point is inside of the frustum
- public function IsAABBInFrustum
(
const
ABox :
TBoundingBox
)
: Boolean
;
This determines if a axis aligned bounding box is inside of the frustum.
- public function IsSphereInFrustum
(
const
ACenter :
TPoint3D; const
ARadius :
Single
)
: Boolean
;
This determines if a sphere is inside of our frustum by it's center and radius.
- public function IsCubeInFrustum
(
const
ACenter :
TPoint3D; const
ASize :
Single
)
: Boolean
;
This determines if a cube is in or around our frustum by it's center and 1/2 it's length
- public function ToBoundingBox
(
)
: TBoundingBox
;
Returns the bounding box of the frustum planes.
Properties
- public FOV : Singleread FFOV
- public AspectRatio : Singleread FRatio
- public NearDistance : Singleread FNearD
- public FarDistance : Singleread FFarD
- public CameraPos : TPoint3Dread FPos
- public CameraDirection : TPoint3Dread FDir
- public Up : TPoint3Dread FUp
- public Right : TPoint3Dread FRight
- public Corners : TFrustumCornersread FCorners
- public Planes : TGorillaFrustumTyperead FPlanes