OpenBarnyard
 
Loading...
Searching...
No Matches
Frustum Class Reference

#include <AWorld.h>

Public Member Functions

 Frustum ()
 
void InitReduce ()
 
FrustumIntersectSphereResult IntersectSphereReduce (const Toshi::TSphere &a_rSphere)
 
void Transform (const Frustum &a_rFrustum, const Toshi::TMatrix44 &a_rMatrix)
 

Public Attributes

TUINT16 aUnknown [6]
 
FrustumPlane aFrustumPlanes [6]
 
Toshi::TPlane * apActivePlanes [6]
 
TINT iActivePlaneCount
 

Detailed Description

Definition at line 44 of file AWorld.h.

Constructor & Destructor Documentation

◆ Frustum()

Frustum::Frustum ( )

Definition at line 12 of file AWorld.cpp.

13{
14 aFrustumPlanes[ 0 ].uiClipFlag = 0;
15 aFrustumPlanes[ 1 ].uiClipFlag = 0;
16 aFrustumPlanes[ 2 ].uiClipFlag = 0;
17 aFrustumPlanes[ 3 ].uiClipFlag = 0;
18 aFrustumPlanes[ 4 ].uiClipFlag = 0;
19 aFrustumPlanes[ 5 ].uiClipFlag = 0;
21}
TINT iActivePlaneCount
Definition AWorld.h:58
FrustumPlane aFrustumPlanes[6]
Definition AWorld.h:56

Member Function Documentation

◆ InitReduce()

void Frustum::InitReduce ( )

Definition at line 23 of file AWorld.cpp.

24{
26
27 for ( TINT i = 0; i < iActivePlaneCount; i++ )
28 {
29 apActivePlanes[ i ] = &aFrustumPlanes[ i ].oPlane;
30 }
31}
int TINT
Definition Typedefs.h:7
Toshi::TPlane * apActivePlanes[6]
Definition AWorld.h:57

◆ IntersectSphereReduce()

FrustumIntersectSphereResult Frustum::IntersectSphereReduce ( const Toshi::TSphere & a_rSphere)

Definition at line 33 of file AWorld.cpp.

34{
35 for ( TINT i = 0; i < iActivePlaneCount; )
36 {
37 TFLOAT fDistance = TVector4::DotProduct3( a_rSphere.AsVector4(), apActivePlanes[ i ]->AsVector4() ) - apActivePlanes[ i ]->GetD();
38
39 if ( a_rSphere.GetRadius() < fDistance )
40 return FISR_NOT_VISIBLE;
41
42 if ( a_rSphere.GetRadius() <= -fDistance )
43 {
46 }
47 else
48 {
49 i += 1;
50 }
51 }
52
53 if ( iActivePlaneCount == 0 )
54 return FISR_ALL_VISIBLE;
55
57}
TFORCEINLINE void TSwapValues(T &a, T &b)
Definition Helpers.h:7
float TFLOAT
Definition Typedefs.h:4
@ FISR_NOT_VISIBLE
Definition AWorld.h:40
@ FISR_PARTIALLY_VISIBLE
Definition AWorld.h:41
@ FISR_ALL_VISIBLE
Definition AWorld.h:39
TFLOAT constexpr DotProduct3(const TVector4 &vec) const
Definition TVector4.h:339

◆ Transform()

void Frustum::Transform ( const Frustum & a_rFrustum,
const Toshi::TMatrix44 & a_rMatrix )

Definition at line 59 of file AWorld.cpp.

60{
61 for ( TINT i = 0; i < 6; i++ )
62 {
64 aFrustumPlanes[ i ].oPlane,
65 a_rMatrix,
66 a_rFrustum.aFrustumPlanes[ i ].oPlane
67 );
68
69 aFrustumPlanes[ i ].uiClipFlag = a_rFrustum.aFrustumPlanes[ i ].uiClipFlag;
70 }
71}
static void TransformPlaneOrthogonal(TPlane &a_rOutPlane, const TMatrix44 &a_rMatrix, const TPlane &a_rcSourcePlane)
Definition TMatrix44.h:239
Toshi::TPlane oPlane
Definition AWorld.h:33
TUINT uiClipFlag
Definition AWorld.h:34

Member Data Documentation

◆ aFrustumPlanes

FrustumPlane Frustum::aFrustumPlanes[6]

Definition at line 56 of file AWorld.h.

◆ apActivePlanes

Toshi::TPlane* Frustum::apActivePlanes[6]

Definition at line 57 of file AWorld.h.

◆ aUnknown

TUINT16 Frustum::aUnknown[6]

Definition at line 55 of file AWorld.h.

◆ iActivePlaneCount

TINT Frustum::iActivePlaneCount

Definition at line 58 of file AWorld.h.


The documentation for this class was generated from the following files: