OpenBarnyard
 
Loading...
Searching...
No Matches
TRenderContext Class Referenceabstract

#include <TRenderContext.h>

Inheritance diagram for TRenderContext:
TRenderContextD3D

Classes

struct  PROJECTIONPARAMS
 
struct  VIEWPORTPARAMS
 

Public Types

enum  FLAG_ : FLAG {
  FLAG_DIRTY = BITFLAG( 0 ) , FLAG_FOG = BITFLAG( 1 ) , FLAG_HAS_MODELWORLDMATRIX = BITFLAG( 2 ) , FLAG_HAS_VIEWWORLDMATRIX = BITFLAG( 3 ) ,
  FLAG_UNK3 = BITFLAG( 4 ) , FLAG_UNK4 = BITFLAG( 5 ) , FLAG_HAS_WORLDPLANES = BITFLAG( 6 ) , FLAG_UNK6 = BITFLAG( 7 ) ,
  FLAG_DIRTY_WORLDMODELMATRIX = BITFLAG( 8 ) , FLAG_DIRTY_VIEWMODELMATRIX = BITFLAG( 9 )
}
 
enum  CameraMode_ : CameraMode { CameraMode_Perspective , CameraMode_Orthographic }
 
typedef TUINT32 FLAG
 
typedef TUINT32 CameraMode
 

Public Member Functions

 TRenderContext (TRenderInterface *pRender)
 
virtual ~TRenderContext ()
 
virtual void SetModelViewMatrix (const TMatrix44 &a_rMatrix)
 
virtual void SetWorldViewMatrix (const TMatrix44 &a_rMatrix)
 
virtual void Update ()=0
 
void ClearLightIDs ()
 
void AddLight (TLightID a_iLightId)
 
const PROJECTIONPARAMSGetProjectionParams () const
 
void SetProjectionParams (const PROJECTIONPARAMS &a_rParams)
 
const VIEWPORTPARAMSGetViewportParameters () const
 
void SetViewportParameters (const VIEWPORTPARAMS &a_rParams)
 
CameraMode GetCameraMode ()
 
void SetCameraMode (CameraMode a_eCameraMode)
 
void EnableFog (TBOOL a_bEnable)
 
void SetFogDistance (TFLOAT a_fStart, TFLOAT a_fEnd)
 
TFLOAT GetX () const
 
TFLOAT GetY () const
 
TFLOAT GetWidth () const
 
TFLOAT GetHeight () const
 
TBOOL IsFogEnabled () const
 
TBOOL IsDirty () const
 
TSkeletonInstanceGetSkeletonInstance () const
 
void SetSkeletonInstance (TSkeletonInstance *a_pSkeletonInstance)
 
TUINT GetClipFlags () const
 
TUINT SetClipFlags (TUINT a_uiClipFlags)
 
const TPlaneGetWorldPlanes ()
 
const TMatrix44GetViewWorldMatrix ()
 
const TMatrix44GetWorldModelMatrix ()
 
const TMatrix44GetModelWorldMatrix ()
 
const TMatrix44GetViewModelMatrix ()
 
TMatrix44GetModelViewMatrix ()
 
TMatrix44GetWorldViewMatrix ()
 
const TPlaneGetFrustumPlanes () const
 
void SetCameraObject (TCameraObject *a_pCameraObject)
 
TCameraObjectGetCameraObject () const
 
TFLOAT GetAlphaBlend () const
 
void SetAlphaBlend (TFLOAT val)
 
TFLOAT GetShadeCoeff () const
 
void SetShadeCoeff (TFLOAT val)
 
const TVector4GetAmbientColour () const
 

Static Public Member Functions

static void ComputePerspectiveProjection (TMatrix44 &a_rOutProjection, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
 
static void ComputeOrthographicProjection (TMatrix44 &a_rOutProjection, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
 
static void ComputePerspectiveFrustum (TFrustum &a_rcFrustum, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
 
static void ComputeOrthographicFrustum (TFrustum &a_rcFrustum, const VIEWPORTPARAMS &a_rViewportParams, const PROJECTIONPARAMS &a_rProjParams)
 
static TBOOL CullSphereToFrustumSimple (const TSphere &a_rSphere, const TPlane *a_pPlanes, TINT a_iNumPlanes)
 
static TINT CullSphereToFrustum (const TSphere &a_rSphere, const TPlane *a_pPlanes, TINT a_iClipFlags, TINT a_iClipFlagsMask)
 

Protected Member Functions

void SetDirty (TBOOL a_bDirty)
 
void SetFlag (FLAG a_eFlag, TBOOL a_bEnable)
 

Protected Attributes

TRenderInterfacem_pRenderer
 
FLAG m_eFlags
 
TUINT m_eClipFlags
 
TUINT m_Unk
 
CameraMode m_eCameraMode
 
VIEWPORTPARAMS m_oViewportParams
 
PROJECTIONPARAMS m_oProjParams
 
TSkeletonInstancem_pCurrentSkeletonInstance
 
TMatrix44 m_oModelViewMatrix
 
TMatrix44 m_oWorldViewMatrix
 
TMatrix44 m_oModelWorldMatrix
 
TMatrix44 m_oViewWorldMatrix
 
TVector4 m_AmbientColor
 
TVector4 m_FogColor
 
TFLOAT m_fFogDistanceStart
 
TFLOAT m_fFogDistanceEnd
 
TFrustum m_aFrustumPlanes1
 
TFrustum m_aWorldPlanes
 
TFrustum m_aFrustumPlanes2
 
TMatrix44 m_oWorldModelMatrix
 
TMatrix44 m_oViewModelMatrix
 
TFLOAT m_fAlphaBlend
 
TFLOAT m_fShadeCoeff
 
TLightIDList m_oLightIds
 
TCameraObjectm_pCurrentCameraObject
 

Detailed Description

Definition at line 40 of file TRenderContext.h.

Member Typedef Documentation

◆ CameraMode

Definition at line 58 of file TRenderContext.h.

◆ FLAG

Definition at line 43 of file TRenderContext.h.

Member Enumeration Documentation

◆ CameraMode_

Enumerator
CameraMode_Perspective 
CameraMode_Orthographic 

Definition at line 59 of file TRenderContext.h.

◆ FLAG_

Enumerator
FLAG_DIRTY 
FLAG_FOG 
FLAG_HAS_MODELWORLDMATRIX 
FLAG_HAS_VIEWWORLDMATRIX 
FLAG_UNK3 
FLAG_UNK4 
FLAG_HAS_WORLDPLANES 
FLAG_UNK6 
FLAG_DIRTY_WORLDMODELMATRIX 
FLAG_DIRTY_VIEWMODELMATRIX 

Definition at line 44 of file TRenderContext.h.

Constructor & Destructor Documentation

◆ TRenderContext()

TRenderContext::TRenderContext ( TRenderInterface * pRender)

Definition at line 42 of file TRenderContext.cpp.

43 : m_pRenderer( a_pRenderer ), m_eFlags( FLAG_DIRTY ), m_eClipFlags( 0x3F ), m_eCameraMode( CameraMode_Perspective ), m_pCurrentSkeletonInstance( TNULL ), m_pCurrentCameraObject( TNULL ), m_AmbientColor( 1.0f, 1.0f, 1.0f, 0.0f ), m_FogColor( 1.0f, 1.0f, 1.0f, 0.0f ), m_fFogDistanceStart( 10.0f ), m_fFogDistanceEnd( 1000.0f ), m_fAlphaBlend( 1.0f ), m_fShadeCoeff( 0.0f )
44{
45 TIMPLEMENT();
46
47 // Setup viewport parameters
48 if ( m_pRenderer->GetCurrentDevice() != TNULL )
49 {
50 auto pDevice = m_pRenderer->GetCurrentDevice();
51 auto pMode = pDevice->GetMode();
52 m_oViewportParams.fWidth = TFLOAT( pMode->GetWidth() );
53 m_oViewportParams.fHeight = TFLOAT( pMode->GetHeight() );
54 }
55 else
56 {
57 m_oViewportParams.fWidth = 640.0f;
58 m_oViewportParams.fHeight = 480.0f;
59 }
60
61 m_oViewportParams.fX = 0;
62 m_oViewportParams.fY = 0;
63 m_oViewportParams.fMaxZ = 1.0f;
64 m_oViewportParams.fMinZ = 1.0f;
65
66 // Setup projection parameters
67 m_oProjParams.SetFromFOV( m_oViewportParams.fWidth, m_oViewportParams.fHeight, TMath::DegToRad( 45.0f ), 1.0f, 1000.0f );
68
69 m_oModelViewMatrix.Identity();
70 m_oWorldViewMatrix.Identity();
72
73 m_AmbientColor.Set( 0.0f, 0.0f, 0.0f, 0.0f );
75}
#define TIMPLEMENT()
Definition Defines.h:136
float TFLOAT
Definition Typedefs.h:4
#define TNULL
Definition Typedefs.h:23
TFORCEINLINE constexpr TFLOAT DegToRad(TFLOAT fDeg)
Definition TMathInline.h:64
PROJECTIONPARAMS m_oProjParams
TVector4 m_AmbientColor
CameraMode m_eCameraMode
TFLOAT m_fFogDistanceStart
VIEWPORTPARAMS m_oViewportParams
TMatrix44 m_oWorldViewMatrix
TMatrix44 m_oModelViewMatrix
TRenderInterface * m_pRenderer
TSkeletonInstance * m_pCurrentSkeletonInstance
TCameraObject * m_pCurrentCameraObject

◆ ~TRenderContext()

TRenderContext::~TRenderContext ( )
virtual

Definition at line 77 of file TRenderContext.cpp.

78{
79}

Member Function Documentation

◆ AddLight()

void TRenderContext::AddLight ( TLightID a_iLightId)

Definition at line 293 of file TRenderContext.cpp.

294{
295 m_oLightIds.Add( a_iLightId );
296}
TLightIDList m_oLightIds

◆ ClearLightIDs()

void TRenderContext::ClearLightIDs ( )

Definition at line 288 of file TRenderContext.cpp.

289{
290 m_oLightIds.Reset();
291}

◆ ComputeOrthographicFrustum()

void TRenderContext::ComputeOrthographicFrustum ( TFrustum & a_rcFrustum,
const VIEWPORTPARAMS & a_rViewportParams,
const PROJECTIONPARAMS & a_rProjParams )
static

Definition at line 332 of file TRenderContext.cpp.

333{
334 TASSERT( a_rProjParams.m_Proj.x != 0.0f );
335 TASSERT( a_rProjParams.m_Proj.y != 0.0f );
336 TASSERT( a_rViewportParams.fWidth != 0.0f );
337 TASSERT( a_rViewportParams.fHeight != 0.0f );
338
339 TASSERT( TMath::IsFinite( a_rProjParams.m_Proj.x ) && ( !TMath::IsNaN( a_rProjParams.m_Proj.x ) ) );
340 TASSERT( TMath::IsFinite( a_rProjParams.m_Proj.y ) && ( !TMath::IsNaN( a_rProjParams.m_Proj.y ) ) );
341 TASSERT( TMath::IsFinite( a_rProjParams.m_Centre.x ) && ( !TMath::IsNaN( a_rProjParams.m_Centre.x ) ) );
342 TASSERT( TMath::IsFinite( a_rProjParams.m_Centre.y ) && ( !TMath::IsNaN( a_rProjParams.m_Centre.y ) ) );
343
344 TFLOAT fWidth = a_rViewportParams.fWidth;
345 TFLOAT fHeight = a_rViewportParams.fHeight;
346 TFLOAT fCentreX = a_rProjParams.m_Centre.x;
347 TFLOAT fCentreY = a_rProjParams.m_Centre.y;
348 TFLOAT fProjXOverOne = 1.0f / a_rProjParams.m_Proj.x;
349 TFLOAT fProjYOverOne = 1.0f / a_rProjParams.m_Proj.y;
350
351 // Setup planes
352 a_rcFrustum[ WORLDPLANE_LEFT ].Set( -1.0f, 0.0f, 0.0f, fCentreX * fProjXOverOne );
353 a_rcFrustum[ WORLDPLANE_RIGHT ].Set( 1.0f, 0.0f, 0.0f, ( fWidth - fCentreX ) * fProjXOverOne );
354 a_rcFrustum[ WORLDPLANE_BOTTOM ].Set( 0.0f, -1.0f, 0.0f, fCentreY * fProjYOverOne );
355 a_rcFrustum[ WORLDPLANE_TOP ].Set( 0.0f, 1.0f, 0.0f, ( fHeight - fCentreY ) * fProjYOverOne );
356 a_rcFrustum[ WORLDPLANE_NEAR ].Set( 0.0f, 0.0f, -1.0f, -a_rProjParams.m_fNearClip );
357 a_rcFrustum[ WORLDPLANE_FAR ].Set( 0.0f, 0.0f, 1.0f, a_rProjParams.m_fFarClip );
358}
@ WORLDPLANE_BOTTOM
@ WORLDPLANE_TOP
@ WORLDPLANE_RIGHT
@ WORLDPLANE_FAR
@ WORLDPLANE_NEAR
@ WORLDPLANE_LEFT
#define TASSERT(X,...)
Definition Defines.h:138
TFORCEINLINE TBOOL IsFinite(TFLOAT fVal)
Definition TMathInline.h:41
TFORCEINLINE TBOOL IsNaN(TFLOAT fVal)

◆ ComputeOrthographicProjection()

void TRenderContext::ComputeOrthographicProjection ( TMatrix44 & a_rOutProjection,
const VIEWPORTPARAMS & a_rViewportParams,
const PROJECTIONPARAMS & a_rProjParams )
static

Definition at line 140 of file TRenderContext.cpp.

141{
142 TASSERT( a_rProjParams.m_Proj.x != 0.0f );
143 TASSERT( a_rProjParams.m_Proj.y != 0.0f );
144 TASSERT( a_rViewportParams.fWidth != 0.0f );
145 TASSERT( a_rViewportParams.fHeight != 0.0f );
146
147 TASSERT( TMath::IsFinite( a_rProjParams.m_Proj.x ) && ( !TMath::IsNaN( a_rProjParams.m_Proj.x ) ) );
148 TASSERT( TMath::IsFinite( a_rProjParams.m_Proj.y ) && ( !TMath::IsNaN( a_rProjParams.m_Proj.y ) ) );
149 TASSERT( TMath::IsFinite( a_rProjParams.m_Centre.x ) && ( !TMath::IsNaN( a_rProjParams.m_Centre.x ) ) );
150 TASSERT( TMath::IsFinite( a_rProjParams.m_Centre.y ) && ( !TMath::IsNaN( a_rProjParams.m_Centre.y ) ) );
151
152 a_rOutProjection.m_f11 = ( a_rProjParams.m_Proj.x * 2.0f ) / a_rViewportParams.fWidth;
153 a_rOutProjection.m_f12 = 0.0f;
154 a_rOutProjection.m_f13 = 0.0f;
155 a_rOutProjection.m_f14 = 0.0f;
156 a_rOutProjection.m_f21 = 0.0f;
157 a_rOutProjection.m_f22 = -( ( a_rProjParams.m_Proj.y * 2.0f ) / a_rViewportParams.fHeight );
158 a_rOutProjection.m_f23 = 0.0f;
159 a_rOutProjection.m_f24 = 0.0f;
160 a_rOutProjection.m_f31 = 0.0f;
161 a_rOutProjection.m_f32 = 0.0f;
162 a_rOutProjection.m_f33 = 1.0f / ( a_rProjParams.m_fFarClip - a_rProjParams.m_fNearClip );
163 a_rOutProjection.m_f34 = 0.0f;
164 a_rOutProjection.m_f41 = ( a_rProjParams.m_Centre.x * 2.0f ) / a_rViewportParams.fWidth - 1.0f;
165 a_rOutProjection.m_f42 = -( ( a_rProjParams.m_Centre.y * 2.0f ) / a_rViewportParams.fHeight - 1.0f );
166 a_rOutProjection.m_f43 = -( a_rProjParams.m_fNearClip / ( a_rProjParams.m_fFarClip - a_rProjParams.m_fNearClip ) );
167 a_rOutProjection.m_f44 = 1.0f;
168}
TFLOAT m_f21
Definition TMatrix44.h:361
TFLOAT m_f12
Definition TMatrix44.h:360
TFLOAT m_f44
Definition TMatrix44.h:363
TFLOAT m_f43
Definition TMatrix44.h:363
TFLOAT m_f32
Definition TMatrix44.h:362
TFLOAT m_f13
Definition TMatrix44.h:360
TFLOAT m_f14
Definition TMatrix44.h:360
TFLOAT m_f11
Definition TMatrix44.h:360
TFLOAT m_f23
Definition TMatrix44.h:361
TFLOAT m_f22
Definition TMatrix44.h:361
TFLOAT m_f41
Definition TMatrix44.h:363
TFLOAT m_f31
Definition TMatrix44.h:362
TFLOAT m_f24
Definition TMatrix44.h:361
TFLOAT m_f34
Definition TMatrix44.h:362
TFLOAT m_f42
Definition TMatrix44.h:363
TFLOAT m_f33
Definition TMatrix44.h:362

◆ ComputePerspectiveFrustum()

void TRenderContext::ComputePerspectiveFrustum ( TFrustum & a_rcFrustum,
const VIEWPORTPARAMS & a_rViewportParams,
const PROJECTIONPARAMS & a_rProjParams )
static

Definition at line 298 of file TRenderContext.cpp.

299{
300 TASSERT( a_rProjParams.m_Proj.x != 0.0f );
301 TASSERT( a_rProjParams.m_Proj.y != 0.0f );
302
303 TASSERT( TMath::IsFinite( a_rProjParams.m_Proj.x ) && ( !TMath::IsNaN( a_rProjParams.m_Proj.x ) ) );
304 TASSERT( TMath::IsFinite( a_rProjParams.m_Proj.y ) && ( !TMath::IsNaN( a_rProjParams.m_Proj.y ) ) );
305 TASSERT( TMath::IsFinite( a_rProjParams.m_Centre.x ) && ( !TMath::IsNaN( a_rProjParams.m_Centre.x ) ) );
306 TASSERT( TMath::IsFinite( a_rProjParams.m_Centre.y ) && ( !TMath::IsNaN( a_rProjParams.m_Centre.y ) ) );
307
308 TFLOAT fVal1 = 1.0f / a_rProjParams.m_Proj.x;
309 TFLOAT fVal2 = 1.0f / a_rProjParams.m_Proj.y;
310 TVector4 vec1 = TVector4( -a_rProjParams.m_Centre.x * fVal1, ( a_rViewportParams.fHeight - a_rProjParams.m_Centre.y ) * fVal2, 1.0f, 0.0f );
311 TVector4 vec2 = TVector4( ( a_rViewportParams.fWidth - a_rProjParams.m_Centre.x ) * fVal1, vec1.y, 1.0f, 0.0f );
312 TVector4 vec3 = TVector4( vec2.x, -a_rProjParams.m_Centre.y * fVal2, 1.0f, 0.0f );
313 TVector4 vec4 = TVector4( vec1.x, vec3.y, 1.0f, 0.0f );
314
315 // Setup planes
316 a_rcFrustum[ WORLDPLANE_LEFT ].AsVector4().CrossProduct( vec4, vec1 );
317 a_rcFrustum[ WORLDPLANE_RIGHT ].AsVector4().CrossProduct( vec2, vec3 );
318 a_rcFrustum[ WORLDPLANE_BOTTOM ].AsVector4().CrossProduct( vec3, vec4 );
319 a_rcFrustum[ WORLDPLANE_TOP ].AsVector4().CrossProduct( vec1, vec2 );
320
321 // Normalize each plane
322 a_rcFrustum[ WORLDPLANE_LEFT ].AsNormal().Normalize();
323 a_rcFrustum[ WORLDPLANE_RIGHT ].AsNormal().Normalize();
324 a_rcFrustum[ WORLDPLANE_BOTTOM ].AsNormal().Normalize();
325 a_rcFrustum[ WORLDPLANE_TOP ].AsNormal().Normalize();
326
327 // Setup near and far planes
328 a_rcFrustum[ WORLDPLANE_NEAR ].Set( 0.0f, 0.0f, -1.0f, -a_rProjParams.m_fNearClip );
329 a_rcFrustum[ WORLDPLANE_FAR ].Set( 0.0f, 0.0f, 1.0f, a_rProjParams.m_fFarClip );
330}
TFLOAT x
Definition TVector4.h:367
TFLOAT y
Definition TVector4.h:367

◆ ComputePerspectiveProjection()

void TRenderContext::ComputePerspectiveProjection ( TMatrix44 & a_rOutProjection,
const VIEWPORTPARAMS & a_rViewportParams,
const PROJECTIONPARAMS & a_rProjParams )
static

Definition at line 120 of file TRenderContext.cpp.

121{
122 a_rOutProjection.m_f11 = ( a_rProjParams.m_Proj.x * 2.0f ) / a_rViewportParams.fWidth;
123 a_rOutProjection.m_f12 = 0.0f;
124 a_rOutProjection.m_f13 = 0.0f;
125 a_rOutProjection.m_f14 = 0.0f;
126 a_rOutProjection.m_f21 = 0.0f;
127 a_rOutProjection.m_f22 = -( ( a_rProjParams.m_Proj.y * 2.0f ) / a_rViewportParams.fHeight );
128 a_rOutProjection.m_f23 = 0.0f;
129 a_rOutProjection.m_f24 = 0.0f;
130 a_rOutProjection.m_f31 = ( a_rProjParams.m_Centre.x * 2.0f ) / a_rViewportParams.fWidth - 1.0f;
131 a_rOutProjection.m_f32 = -( ( a_rProjParams.m_Centre.y * 2.0f ) / a_rViewportParams.fHeight - 1.0f );
132 a_rOutProjection.m_f33 = a_rProjParams.m_fFarClip / ( a_rProjParams.m_fFarClip - a_rProjParams.m_fNearClip );
133 a_rOutProjection.m_f34 = 1.0f;
134 a_rOutProjection.m_f41 = 0.0f;
135 a_rOutProjection.m_f42 = 0.0f;
136 a_rOutProjection.m_f43 = -( ( a_rProjParams.m_fNearClip * a_rProjParams.m_fFarClip ) / ( a_rProjParams.m_fFarClip - a_rProjParams.m_fNearClip ) );
137 a_rOutProjection.m_f44 = 0.0f;
138}

◆ CullSphereToFrustum()

TINT TRenderContext::CullSphereToFrustum ( const TSphere & a_rSphere,
const TPlane * a_pPlanes,
TINT a_iClipFlags,
TINT a_iClipFlagsMask )
static

Definition at line 210 of file TRenderContext.cpp.

211{
212 TINT iLeftPlanes = a_iClipFlags & a_iClipFlagsMask;
213 TINT iPlaneFlag = 1;
214
215 do {
216 if ( iLeftPlanes == 0 )
217 {
218 return a_iClipFlags;
219 }
220
221 if ( iLeftPlanes & iPlaneFlag )
222 {
223 TFLOAT fDist = TVector4::DotProduct3( a_rSphere.AsVector4(), a_pPlanes->AsVector4() ) - a_pPlanes->GetD();
224
225 if ( a_rSphere.GetRadius() < fDist )
226 {
227 return -1;
228 }
229
230 if ( fDist < -a_rSphere.GetRadius() )
231 {
232 a_iClipFlags &= ~iPlaneFlag;
233 }
234
235 iLeftPlanes &= ~iPlaneFlag;
236 }
237
238 iPlaneFlag = iPlaneFlag << 1;
239 a_pPlanes++;
240
241 } while ( TTRUE );
242}
int TINT
Definition Typedefs.h:7
#define TTRUE
Definition Typedefs.h:25
TFORCEINLINE TVector4 & AsVector4()
Definition TPlane.h:124
TFORCEINLINE constexpr TFLOAT GetD() const
Definition TPlane.h:69
TFORCEINLINE TVector4 & AsVector4()
Definition TSphere.h:111
constexpr TFORCEINLINE TFLOAT GetRadius() const
Definition TSphere.h:106
TFLOAT constexpr DotProduct3(const TVector4 &vec) const
Definition TVector4.h:339

◆ CullSphereToFrustumSimple()

TBOOL TRenderContext::CullSphereToFrustumSimple ( const TSphere & a_rSphere,
const TPlane * a_pPlanes,
TINT a_iNumPlanes )
static

Definition at line 197 of file TRenderContext.cpp.

198{
199 for ( TSIZE i = 0; i < WORLDPLANE_NUMOF; i++ )
200 {
201 TFLOAT fDist = TVector4::DotProduct3( a_rSphere.AsVector4(), a_pPlanes[ i ].AsVector4() );
202
203 if ( a_rSphere.GetRadius() < fDist - a_pPlanes[ i ].GetD() )
204 return TFALSE;
205 }
206
207 return TTRUE;
208}
@ WORLDPLANE_NUMOF
size_t TSIZE
Definition Typedefs.h:9
#define TFALSE
Definition Typedefs.h:24

◆ EnableFog()

void TRenderContext::EnableFog ( TBOOL a_bEnable)

Definition at line 27 of file TRenderContext.cpp.

28{
29 if ( a_bEnable ) m_eFlags |= FLAG_FOG;
30 else
32}

◆ GetAlphaBlend()

TFLOAT TRenderContext::GetAlphaBlend ( ) const
inline

Definition at line 143 of file TRenderContext.h.

143{ return m_fAlphaBlend; }

◆ GetAmbientColour()

const TVector4 & TRenderContext::GetAmbientColour ( ) const
inline

Definition at line 149 of file TRenderContext.h.

149{ return m_AmbientColor; }

◆ GetCameraMode()

CameraMode TRenderContext::GetCameraMode ( )
inline

Definition at line 109 of file TRenderContext.h.

109{ return m_eCameraMode; }

◆ GetCameraObject()

TCameraObject * TRenderContext::GetCameraObject ( ) const
inline

Definition at line 141 of file TRenderContext.h.

141{ return m_pCurrentCameraObject; }

◆ GetClipFlags()

TUINT TRenderContext::GetClipFlags ( ) const

Definition at line 170 of file TRenderContext.cpp.

171{
172 return m_eClipFlags;
173}

◆ GetFrustumPlanes()

const TPlane * TRenderContext::GetFrustumPlanes ( ) const
inline

Definition at line 138 of file TRenderContext.h.

138{ return m_aFrustumPlanes1; }
TFrustum m_aFrustumPlanes1

◆ GetHeight()

TFLOAT TRenderContext::GetHeight ( ) const
inline

Definition at line 118 of file TRenderContext.h.

118{ return m_oViewportParams.fHeight; }

◆ GetModelViewMatrix()

TMatrix44 & TRenderContext::GetModelViewMatrix ( )
inline

Definition at line 135 of file TRenderContext.h.

135{ return m_oModelViewMatrix; }

◆ GetModelWorldMatrix()

const TMatrix44 & TRenderContext::GetModelWorldMatrix ( )

Definition at line 255 of file TRenderContext.cpp.

256{
258 {
261 }
262
263 return m_oModelWorldMatrix;
264}
#define HASANYFLAG(STATE, FLAG)
Definition Defines.h:5
TMatrix44 m_oModelWorldMatrix
const TMatrix44 & GetViewWorldMatrix()

◆ GetProjectionParams()

const PROJECTIONPARAMS & TRenderContext::GetProjectionParams ( ) const
inline

Definition at line 103 of file TRenderContext.h.

103{ return m_oProjParams; }

◆ GetShadeCoeff()

TFLOAT TRenderContext::GetShadeCoeff ( ) const
inline

Definition at line 146 of file TRenderContext.h.

146{ return m_fShadeCoeff; }

◆ GetSkeletonInstance()

TSkeletonInstance * TRenderContext::GetSkeletonInstance ( ) const
inline

Definition at line 123 of file TRenderContext.h.

◆ GetViewModelMatrix()

const TMatrix44 & TRenderContext::GetViewModelMatrix ( )

Definition at line 266 of file TRenderContext.cpp.

267{
269 {
272 }
273
274 return m_oViewModelMatrix;
275}
TMatrix44 m_oViewModelMatrix

◆ GetViewportParameters()

const VIEWPORTPARAMS & TRenderContext::GetViewportParameters ( ) const
inline

Definition at line 106 of file TRenderContext.h.

106{ return m_oViewportParams; }

◆ GetViewWorldMatrix()

const TMatrix44 & TRenderContext::GetViewWorldMatrix ( )

Definition at line 244 of file TRenderContext.cpp.

245{
247 {
248 m_oViewWorldMatrix.InvertOrthogonal( m_oWorldViewMatrix );
250 }
251
252 return m_oViewWorldMatrix;
253}
TMatrix44 m_oViewWorldMatrix

◆ GetWidth()

TFLOAT TRenderContext::GetWidth ( ) const
inline

Definition at line 117 of file TRenderContext.h.

117{ return m_oViewportParams.fWidth; }

◆ GetWorldModelMatrix()

const TMatrix44 & TRenderContext::GetWorldModelMatrix ( )

Definition at line 277 of file TRenderContext.cpp.

◆ GetWorldPlanes()

const TPlane * TRenderContext::GetWorldPlanes ( )

Definition at line 180 of file TRenderContext.cpp.

181{
183 {
184 auto& viewWorld = GetViewWorldMatrix();
185
186 for ( TSIZE i = 0; i < WORLDPLANE_NUMOF; i++ )
187 {
189 }
190
192 }
193
194 return m_aWorldPlanes;
195}
static void TransformPlaneOrthogonal(TPlane &a_rOutPlane, const TMatrix44 &a_rMatrix, const TPlane &a_rcSourcePlane)
Definition TMatrix44.h:239
TFrustum m_aWorldPlanes

◆ GetWorldViewMatrix()

TMatrix44 & TRenderContext::GetWorldViewMatrix ( )
inline

Definition at line 136 of file TRenderContext.h.

136{ return m_oWorldViewMatrix; }

◆ GetX()

TFLOAT TRenderContext::GetX ( ) const
inline

Definition at line 115 of file TRenderContext.h.

115{ return m_oViewportParams.fX; }

◆ GetY()

TFLOAT TRenderContext::GetY ( ) const
inline

Definition at line 116 of file TRenderContext.h.

116{ return m_oViewportParams.fY; }

◆ IsDirty()

TBOOL TRenderContext::IsDirty ( ) const
inline

Definition at line 121 of file TRenderContext.h.

121{ return m_eFlags & FLAG_DIRTY; }

◆ IsFogEnabled()

TBOOL TRenderContext::IsFogEnabled ( ) const
inline

Definition at line 120 of file TRenderContext.h.

120{ return m_eFlags & FLAG_FOG; }

◆ SetAlphaBlend()

void TRenderContext::SetAlphaBlend ( TFLOAT val)
inline

Definition at line 144 of file TRenderContext.h.

144{ m_fAlphaBlend = val; }

◆ SetCameraMode()

void TRenderContext::SetCameraMode ( CameraMode a_eCameraMode)

Definition at line 114 of file TRenderContext.cpp.

115{
116 m_eCameraMode = cameraMode;
118}

◆ SetCameraObject()

void TRenderContext::SetCameraObject ( TCameraObject * a_pCameraObject)
inline

Definition at line 140 of file TRenderContext.h.

140{ m_pCurrentCameraObject = a_pCameraObject; }

◆ SetClipFlags()

TUINT TRenderContext::SetClipFlags ( TUINT a_uiClipFlags)

Definition at line 175 of file TRenderContext.cpp.

176{
177 return std::exchange( m_eClipFlags, a_uiClipFlags );
178}

◆ SetDirty()

void TRenderContext::SetDirty ( TBOOL a_bDirty)
protected

Definition at line 13 of file TRenderContext.cpp.

14{
15 if ( a_bDirty ) m_eFlags |= FLAG_DIRTY;
16 else
18}

◆ SetFlag()

void TRenderContext::SetFlag ( FLAG a_eFlag,
TBOOL a_bEnable )
protected

Definition at line 20 of file TRenderContext.cpp.

21{
22 if ( a_bEnable ) m_eFlags |= a_eFlag;
23 else
24 m_eFlags &= ~a_eFlag;
25}

◆ SetFogDistance()

void TRenderContext::SetFogDistance ( TFLOAT a_fStart,
TFLOAT a_fEnd )

Definition at line 34 of file TRenderContext.cpp.

◆ SetModelViewMatrix()

void TRenderContext::SetModelViewMatrix ( const TMatrix44 & a_rMatrix)
virtual

◆ SetProjectionParams()

void TRenderContext::SetProjectionParams ( const PROJECTIONPARAMS & a_rParams)

Definition at line 95 of file TRenderContext.cpp.

96{
97 TASSERT( params.m_Proj.x != 0.0f );
98 TASSERT( params.m_Proj.y != 0.0f );
99 TASSERT( TMath::IsFinite( params.m_Proj.x ) && ( !TMath::IsNaN( params.m_Proj.x ) ) );
100 TASSERT( TMath::IsFinite( params.m_Proj.y ) && ( !TMath::IsNaN( params.m_Proj.y ) ) );
101 TASSERT( TMath::IsFinite( params.m_Centre.x ) && ( !TMath::IsNaN( params.m_Centre.x ) ) );
102 TASSERT( TMath::IsFinite( params.m_Centre.y ) && ( !TMath::IsNaN( params.m_Centre.y ) ) );
103
104 m_oProjParams = params;
106}

◆ SetShadeCoeff()

void TRenderContext::SetShadeCoeff ( TFLOAT val)
inline

Definition at line 147 of file TRenderContext.h.

147{ m_fShadeCoeff = val; }

◆ SetSkeletonInstance()

void TRenderContext::SetSkeletonInstance ( TSkeletonInstance * a_pSkeletonInstance)
inline

Definition at line 124 of file TRenderContext.h.

124{ m_pCurrentSkeletonInstance = a_pSkeletonInstance; }

◆ SetViewportParameters()

void TRenderContext::SetViewportParameters ( const VIEWPORTPARAMS & a_rParams)

Definition at line 108 of file TRenderContext.cpp.

109{
110 m_oViewportParams = params;
112}

◆ SetWorldViewMatrix()

void TRenderContext::SetWorldViewMatrix ( const TMatrix44 & a_rMatrix)
virtual

◆ Update()

virtual void TRenderContext::Update ( )
pure virtual

Implemented in TRenderContextD3D.

Member Data Documentation

◆ m_aFrustumPlanes1

TFrustum TRenderContext::m_aFrustumPlanes1
protected

Definition at line 181 of file TRenderContext.h.

◆ m_aFrustumPlanes2

TFrustum TRenderContext::m_aFrustumPlanes2
protected

Definition at line 183 of file TRenderContext.h.

◆ m_AmbientColor

TVector4 TRenderContext::m_AmbientColor
protected

Definition at line 176 of file TRenderContext.h.

◆ m_aWorldPlanes

TFrustum TRenderContext::m_aWorldPlanes
protected

Definition at line 182 of file TRenderContext.h.

◆ m_eCameraMode

CameraMode TRenderContext::m_eCameraMode
protected

Definition at line 168 of file TRenderContext.h.

◆ m_eClipFlags

TUINT TRenderContext::m_eClipFlags
protected

Definition at line 166 of file TRenderContext.h.

◆ m_eFlags

FLAG TRenderContext::m_eFlags
protected

Definition at line 165 of file TRenderContext.h.

◆ m_fAlphaBlend

TFLOAT TRenderContext::m_fAlphaBlend
protected

Definition at line 187 of file TRenderContext.h.

◆ m_fFogDistanceEnd

TFLOAT TRenderContext::m_fFogDistanceEnd
protected

Definition at line 180 of file TRenderContext.h.

◆ m_fFogDistanceStart

TFLOAT TRenderContext::m_fFogDistanceStart
protected

Definition at line 179 of file TRenderContext.h.

◆ m_FogColor

TVector4 TRenderContext::m_FogColor
protected

Definition at line 177 of file TRenderContext.h.

◆ m_fShadeCoeff

TFLOAT TRenderContext::m_fShadeCoeff
protected

Definition at line 189 of file TRenderContext.h.

◆ m_oLightIds

TLightIDList TRenderContext::m_oLightIds
protected

Definition at line 191 of file TRenderContext.h.

◆ m_oModelViewMatrix

TMatrix44 TRenderContext::m_oModelViewMatrix
protected

Definition at line 172 of file TRenderContext.h.

◆ m_oModelWorldMatrix

TMatrix44 TRenderContext::m_oModelWorldMatrix
protected

Definition at line 174 of file TRenderContext.h.

◆ m_oProjParams

PROJECTIONPARAMS TRenderContext::m_oProjParams
protected

Definition at line 170 of file TRenderContext.h.

◆ m_oViewModelMatrix

TMatrix44 TRenderContext::m_oViewModelMatrix
protected

Definition at line 186 of file TRenderContext.h.

◆ m_oViewportParams

VIEWPORTPARAMS TRenderContext::m_oViewportParams
protected

Definition at line 169 of file TRenderContext.h.

◆ m_oViewWorldMatrix

TMatrix44 TRenderContext::m_oViewWorldMatrix
protected

Definition at line 175 of file TRenderContext.h.

◆ m_oWorldModelMatrix

TMatrix44 TRenderContext::m_oWorldModelMatrix
protected

Definition at line 185 of file TRenderContext.h.

◆ m_oWorldViewMatrix

TMatrix44 TRenderContext::m_oWorldViewMatrix
protected

Definition at line 173 of file TRenderContext.h.

◆ m_pCurrentCameraObject

TCameraObject* TRenderContext::m_pCurrentCameraObject
protected

Definition at line 192 of file TRenderContext.h.

◆ m_pCurrentSkeletonInstance

TSkeletonInstance* TRenderContext::m_pCurrentSkeletonInstance
protected

Definition at line 171 of file TRenderContext.h.

◆ m_pRenderer

TRenderInterface* TRenderContext::m_pRenderer
protected

Definition at line 164 of file TRenderContext.h.

◆ m_Unk

TUINT TRenderContext::m_Unk
protected

Definition at line 167 of file TRenderContext.h.


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