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

#include <TRenderInterface.h>

Inheritance diagram for TRenderInterface:
TObject TSingleton< TRenderInterface > TRefCounted TRenderD3DInterface

Classes

struct  DISPLAYPARAMS
 

Public Types

enum  ASPECT_RATIO_ : ASPECT_RATIO { ASPECT_RATIO_4_3 , ASPECT_RATIO_16_9 }
 
typedef TUINT32 ASPECT_RATIO
 
- Public Types inherited from TObject
enum  { IsTObject = TTRUE }
 

Public Member Functions

 TDECLARE_CLASS (TRenderInterface, TObject)
 
 TRenderInterface ()
 
virtual ~TRenderInterface ()
 
virtual TBOOL CreateDisplay (const DISPLAYPARAMS &a_rParams)
 
virtual TBOOL DestroyDisplay ()=0
 
virtual TBOOL Update (float a_fDeltaTime)=0
 
virtual TBOOL BeginScene ()
 
virtual TBOOL EndScene ()=0
 
virtual TRenderAdapter::Mode::DeviceGetCurrentDevice ()=0
 
virtual DISPLAYPARAMSGetCurrentDisplayParams ()=0
 
virtual TBOOL Create ()
 
virtual TBOOL Destroy ()
 
virtual void RenderIndexPrimitive (TINT param_2, TINT param_3, TINT param_4, TINT param_5, TINT param_6, TINT param_7)
 
virtual void DumpStats ()
 
virtual void GetScreenOffset (TVector2 &a_rVec)
 
virtual void SetScreenOffset (const TVector2 &a_rVec)
 
virtual float GetScreenAspectRatio ()
 
virtual float GetPixelAspectRatio ()
 
virtual TBOOL SetPixelAspectRatio (float a_fPixelAspectRatio)
 
virtual void FlushOrderTables ()
 
virtual TBOOL IsTextureFormatSupported (TINT a_eTextureFormat)
 
virtual TBOOL Supports32BitTextures ()
 
virtual TRenderContextCreateRenderContext ()=0
 
virtual TRenderCaptureCreateCapture ()=0
 
virtual void DestroyCapture (TRenderCapture *a_pRenderCapture)=0
 
virtual void SetLightDirectionMatrix (const TMatrix44 &a_rMatrix)
 
virtual void SetLightColourMatrix (const TMatrix44 &a_rMatrix)
 
virtual void Unknown1 (TViewport *a_pViewport)
 
virtual void * CreateUnknown (const TCHAR *a_szName, TINT a_iUnk1, TINT a_iUnk2, TINT a_iUnk3)=0
 
virtual TModelCreateModel (TTMD *a_pTMD, TBOOL a_bLoad)=0
 
virtual TModelCreateModel (const TCHAR *a_szFilePath, TBOOL a_bLoad)=0
 
virtual TModelCreateModel (const TCHAR *a_szFilePath, TBOOL a_bLoad, TTRB *a_pAssetTRB, TUINT8 a_ui8FileNameLen)=0
 
virtual void OnInitializationFailureDevice ()
 
virtual void OnInitializationFailureDisplay ()
 
virtual TDebugTextCreateDebugText ()=0
 
virtual void DestroyDebugText ()=0
 
virtual TBOOL CreateSystemResources ()
 
virtual void DestroySystemResources ()
 
TBOOL CreateDisplay ()
 
void DestroyResource (TResource *resource)
 
void DestroyResourceRecurse (TResource *resource)
 
template<class T>
T * GetSystemResource (SYSRESOURCE systemResource)
 
void SetResourceExplicit (TResource *resource, SYSRESOURCE systemResource)
 
TResourceCreateResource (TClass *pClass, const TCHAR *name, TResource *parent)
 
TRenderContextSetCurrentRenderContext (TRenderContext *a_pRenderContext)
 
void SetAutoCreateSystemResources (TBOOL a_bAutoCreate)
 
TBOOL IsInScene ()
 
TBOOL IsCreated ()
 
TBOOL IsDisplayCreated ()
 
const TMatrix44GetLightDirection () const
 
const TMatrix44GetLightColour () const
 
TRenderContextGetCurrentContext () const
 
TNodeList< TRenderAdapter > * GetAdapterList ()
 
TKeyframeLibraryManagerGetKeyframeLibraryManager ()
 
TStack< TMatrix44, 20 > & GetTransforms ()
 
TTextureGetInvalidTexture ()
 
void DestroyAllShaderResources ()
 
void FlushDyingResources ()
 
void DestroyDyingResources (TResource *resources)
 
void DeleteResource (TResource *resources)
 
void DeleteResourceRecurse (TResource *resources)
 
void DeleteResourceAtomic (TResource *resources)
 
TRenderAdapter::Mode::DeviceFindDevice (const DISPLAYPARAMS &a_rDisplayParams)
 
void BeginEndSceneHAL ()
 
- Public Member Functions inherited from TObject
virtual Toshi::TClass * GetClass ()
 
virtual void Delete ()
 
virtual ~TObject ()
 
TBOOL IsExactly (TClass *a_pClass)
 
TBOOL IsA (TClass *a_pClass)
 
- Public Member Functions inherited from TSingleton< TRenderInterface >
 TSingleton (const TSingleton &)=delete
 
 TSingleton (const TSingleton &&)=delete
 
TSingletonoperator= (const TSingleton &)=delete
 
TSingletonoperator= (const TSingleton &&)=delete
 
- Public Member Functions inherited from TRefCounted
 TRefCounted ()
 
 ~TRefCounted ()
 
TINT DecRefCount ()
 
TINT GetRefCount ()
 
TINT IncRefCount ()
 
TRefCountedoperator= (TRefCounted const &)
 

Static Public Attributes

static constexpr size_t MAXNUMRESOURCES = 6000
 
- Static Public Attributes inherited from TObject
static constexpr Toshi::TClass * PARENTCLASS = TNULL
 
static constinit Toshi::TClass ms_oClass = Toshi::TClass( "TObject", TObject::CreateTObject, TObject::CreateTObjectInPlace, TObject::InitialiseClass, TObject::DeinitialiseClass, 0, 2, sizeof( TObject ), alignof( TObject ) )
 

Protected Attributes

TBOOL m_bCreateSystemResources
 
TBOOL m_bInScene
 
TBOOL m_bCreated = false
 
TBOOL m_bDisplayCreated
 
TVector2 m_ScreenOffset
 
TRenderContextm_pCurrentContext
 
TRenderContextm_pCreatedContext
 
TResourcem_SystemResources [SYSRESOURCE_NUMOF]
 
TMatrix44 m_LightDirection
 
TMatrix44 m_LightColour
 
TDebugTextm_pDebugText
 
void * m_Unk2
 
TTexturem_pInvalidTexture
 
TNodeList< TRenderAdapterm_AdapterList
 
TNodeTree< TResourcem_Resources
 
TUINT32 m_ResourceCount = 0
 
TUINT32 m_iFrameCount = 0
 
TBOOL m_bHasDyingResources
 
TKeyframeLibraryManager m_KeyframeManager
 
TGenericEmitter m_BeginSceneEmitter
 
TGenericEmitter m_EndSceneEmitter
 
TStack< TMatrix44, 20 > m_Transforms
 
- Protected Attributes inherited from TRefCounted
TINT m_iRefCount
 

Additional Inherited Members

- Static Public Member Functions inherited from TObject
static Toshi::TObject * CreateTObject ()
 
static Toshi::TObject * CreateTObjectInPlace (void *a_pPtr)
 
static void InitialiseClass ()
 
static void DeinitialiseClass ()
 
static TFORCEINLINE TClassGetClassStatic ()
 
- Static Public Member Functions inherited from TSingleton< TRenderInterface >
static TFORCEINLINE TRenderInterfaceCreateSingleton (Args &&... args)
 
static TFORCEINLINE D * CreateSingleton (Args &&... args)
 
static TFORCEINLINE void DestroySingleton ()
 
static TFORCEINLINE TRenderInterfaceGetSingletonSafe ()
 
static TFORCEINLINE TBOOL IsSingletonCreated ()
 
static TFORCEINLINE TRenderInterfaceGetSingleton ()
 
- Protected Member Functions inherited from TSingleton< TRenderInterface >
TFORCEINLINE TSingleton ()
 
TFORCEINLINE ~TSingleton ()
 
- Static Protected Attributes inherited from TSingleton< TRenderInterface >
static TRenderInterfacems_pSingleton
 

Detailed Description

Definition at line 31 of file TRenderInterface.h.

Member Typedef Documentation

◆ ASPECT_RATIO

Definition at line 42 of file TRenderInterface.h.

Member Enumeration Documentation

◆ ASPECT_RATIO_

Enumerator
ASPECT_RATIO_4_3 
ASPECT_RATIO_16_9 

Definition at line 43 of file TRenderInterface.h.

Constructor & Destructor Documentation

◆ TRenderInterface()

TRenderInterface::TRenderInterface ( )

Definition at line 15 of file TRenderInterface.cpp.

16{
21 m_ScreenOffset.Set( 0.0f, 0.0f );
25 m_Unk2 = TNULL;
28 m_iFrameCount = 0;
30
31 m_Transforms.PushNull();
32 m_Transforms.Top().Identity();
33
35
36 m_LightColour.Set(
37 1.0f, 1.0f, 1.0f, 0.0f,
38 0.0f, 0.0f, 0.0f, 0.0f,
39 0.0f, 0.0f, 0.0f, 0.0f,
40 0.0f, 0.0f, 0.0f, 0.0f
41 );
42
44 -0.47f, -0.74f, 0.47f, 0.0f,
45 0.0f, 0.0f, 0.0f, 0.0f,
46 0.0f, 0.0f, 0.0f, 0.0f,
47 0.0f, 0.0f, 0.0f, 0.0f
48 );
49}
#define TNULL
Definition Typedefs.h:23
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25
TDebugText * m_pDebugText
TRenderContext * m_pCurrentContext
TResource * m_SystemResources[SYSRESOURCE_NUMOF]
TTexture * m_pInvalidTexture
TRenderContext * m_pCreatedContext
TStack< TMatrix44, 20 > m_Transforms
static void MemClear(void *ptr, TSIZE size)
Definition TUtil.h:91

◆ ~TRenderInterface()

TRenderInterface::~TRenderInterface ( )
virtual

Definition at line 51 of file TRenderInterface.cpp.

52{
53}

Member Function Documentation

◆ BeginEndSceneHAL()

void TRenderInterface::BeginEndSceneHAL ( )

Definition at line 30 of file TRenderInterface_DX8.cpp.

31{
32 auto pHAL = TSTATICCAST( TRenderD3DInterface, this );
33
34 if ( S_OK == pHAL->GetDirect3DDevice()->BeginScene() )
35 {
36 pHAL->GetDirect3DDevice()->EndScene();
37 }
38}
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69

◆ BeginScene()

TBOOL TRenderInterface::BeginScene ( )
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 112 of file TRenderInterface.cpp.

113{
114 m_iFrameCount += 1;
115 m_Transforms.Reset();
116 m_Transforms.PushNull().Identity();
117 return TTRUE;
118}

◆ Create()

TBOOL TRenderInterface::Create ( )
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 55 of file TRenderInterface.cpp.

56{
57 TASSERT( TFALSE == IsCreated(), "TRender already created" );
59
61 {
63 m_Unk2 = CreateUnknown( "Render", 0, 0, 10 );
65 return TTRUE;
66 }
67
68 return TFALSE;
69}
#define TASSERT(X,...)
Definition Defines.h:138
virtual TRenderContext * CreateRenderContext()=0
TRenderContext * SetCurrentRenderContext(TRenderContext *a_pRenderContext)
virtual void * CreateUnknown(const TCHAR *a_szName, TINT a_iUnk1, TINT a_iUnk2, TINT a_iUnk3)=0

◆ CreateCapture()

virtual TRenderCapture * TRenderInterface::CreateCapture ( )
pure virtual

Implemented in TRenderD3DInterface.

◆ CreateDebugText()

virtual TDebugText * TRenderInterface::CreateDebugText ( )
pure virtual

Implemented in TRenderD3DInterface.

◆ CreateDisplay() [1/2]

TBOOL TRenderInterface::CreateDisplay ( )

Definition at line 97 of file TRenderInterface.cpp.

98{
99 TASSERT( TTRUE == IsCreated(), "TRender must be created" );
100 TASSERT( TFALSE == IsDisplayCreated(), "Display already created" );
101
103 return TTRUE;
104}

◆ CreateDisplay() [2/2]

TBOOL TRenderInterface::CreateDisplay ( const DISPLAYPARAMS & a_rParams)
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 106 of file TRenderInterface.cpp.

107{
109 return TTRUE;
110}

◆ CreateModel() [1/3]

virtual TModel * TRenderInterface::CreateModel ( const TCHAR * a_szFilePath,
TBOOL a_bLoad )
pure virtual

Implemented in TRenderD3DInterface.

◆ CreateModel() [2/3]

virtual TModel * TRenderInterface::CreateModel ( const TCHAR * a_szFilePath,
TBOOL a_bLoad,
TTRB * a_pAssetTRB,
TUINT8 a_ui8FileNameLen )
pure virtual

Implemented in TRenderD3DInterface.

◆ CreateModel() [3/3]

virtual TModel * TRenderInterface::CreateModel ( TTMD * a_pTMD,
TBOOL a_bLoad )
pure virtual

Implemented in TRenderD3DInterface.

◆ CreateRenderContext()

virtual TRenderContext * TRenderInterface::CreateRenderContext ( )
pure virtual

Implemented in TRenderD3DInterface.

◆ CreateResource()

TResource * TRenderInterface::CreateResource ( TClass * pClass,
const TCHAR * name,
TResource * parent )

Definition at line 169 of file TRenderInterface.cpp.

170{
171 TASSERT( pClass != TNULL, "TResource class is TNULL" );
172 TASSERT( pClass->IsA( &TGetClass( TResource ) ), "TResource class is TNULL" );
173
174 TResource* pResource = static_cast<TResource*>( pClass->CreateObject() );
175 TASSERT( pResource != TNULL, "Couldn't create TResource" );
176
177 if ( pResource != TNULL )
178 {
179 m_Resources.Remove( *pResource, TFALSE );
180
181 if ( parent == TNULL )
182 {
183 parent = m_Resources.GetRoot();
184 }
185
186 m_Resources.Insert( parent, pResource );
187 pResource->SetUId( m_ResourceCount++ );
188 pResource->SetRenderer( this );
189 pResource->SetName( name );
190
191 return pResource;
192 }
193
194 return pResource;
195}
#define TGetClass(CLASS)
Definition TObject.h:13
TNodeTree< TResource > m_Resources
void SetUId(TUINT32 uid)
void SetRenderer(TRenderInterface *pRenderer)
void SetName(const TCHAR *name)
Definition TResource.cpp:94
class TObject * CreateObject() const
Definition TClass.cpp:116
TBOOL IsA(TClass *pClass)
Definition TClass.cpp:126

◆ CreateSystemResources()

TBOOL TRenderInterface::CreateSystemResources ( )
virtual

Definition at line 289 of file TRenderInterface.cpp.

290{
291 return TTRUE;
292}

◆ CreateUnknown()

virtual void * TRenderInterface::CreateUnknown ( const TCHAR * a_szName,
TINT a_iUnk1,
TINT a_iUnk2,
TINT a_iUnk3 )
pure virtual

Implemented in TRenderD3DInterface.

◆ DeleteResource()

void TRenderInterface::DeleteResource ( TResource * resources)

Definition at line 357 of file TRenderInterface.cpp.

358{
359 DeleteResourceRecurse( resources->Child() );
360 DeleteResourceAtomic( resources );
361}
void DeleteResourceRecurse(TResource *resources)
void DeleteResourceAtomic(TResource *resources)
T * Child() const
Definition TNodeTree.h:37

◆ DeleteResourceAtomic()

void TRenderInterface::DeleteResourceAtomic ( TResource * resources)

Definition at line 375 of file TRenderInterface.cpp.

376{
377 if ( a_pResource )
378 {
379 DeleteResourceRecurse( a_pResource->Child() );
380
381 TASSERT( TFALSE == a_pResource->IsValid() );
382
383 if ( a_pResource->IsCreated() )
384 {
385 a_pResource->OnDestroy();
386 }
387
388 m_Resources.Remove( a_pResource, TFALSE );
389
390 if ( a_pResource->IsExternal() )
391 {
392 a_pResource->~TResource();
393 }
394 else
395 {
396 delete a_pResource;
397 }
398 }
399}

◆ DeleteResourceRecurse()

void TRenderInterface::DeleteResourceRecurse ( TResource * resources)

Definition at line 363 of file TRenderInterface.cpp.

364{
365 while ( resource )
366 {
367 auto next = resource->Next();
368 if ( next == resource ) next = TNULL;
369
370 DeleteResourceAtomic( resource );
371 resource = next;
372 }
373}

◆ Destroy()

TBOOL TRenderInterface::Destroy ( )
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 71 of file TRenderInterface.cpp.

72{
73 TASSERT( TTRUE == IsCreated(), "TRender is not created" );
74
75 if ( m_Unk2 )
76 {
77 delete m_Unk2;
78 m_Unk2 = TNULL;
79 }
80
82 {
83 delete m_pCreatedContext;
85 }
86
89
90 return TTRUE;
91}

◆ DestroyAllShaderResources()

void TRenderInterface::DestroyAllShaderResources ( )

Definition at line 300 of file TRenderInterface.cpp.

301{
302 TIMPLEMENT();
303}
#define TIMPLEMENT()
Definition Defines.h:136

◆ DestroyCapture()

virtual void TRenderInterface::DestroyCapture ( TRenderCapture * a_pRenderCapture)
pure virtual

Implemented in TRenderD3DInterface.

◆ DestroyDebugText()

virtual void TRenderInterface::DestroyDebugText ( )
pure virtual

Implemented in TRenderD3DInterface.

◆ DestroyDisplay()

virtual TBOOL TRenderInterface::DestroyDisplay ( )
pure virtual

Implemented in TRenderD3DInterface.

◆ DestroyDyingResources()

void TRenderInterface::DestroyDyingResources ( TResource * resources)

Definition at line 305 of file TRenderInterface.cpp.

306{
307 // TODO: refactor
308 TResource* pTVar1;
309 TResource* next;
310 TResource* pRes1;
311 TResource* pRes2;
312
313 pRes1 = resources;
314 pRes2 = resources;
315 if ( resources != (TResource*)0x0 )
316 {
317 do {
318 next = pRes2->Next();
319 if ( next == pRes1 )
320 {
321 next = (TResource*)0x0;
322 }
323 if ( ( pRes2->m_State & 4 ) == 0 )
324 {
325 pRes2 = pRes2->Child();
326 if ( pRes2 != (TResource*)0x0 )
327 {
328 DestroyDyingResources( pRes2 );
329 }
330 }
331 else
332 {
333 if ( pRes2 == pRes1 )
334 {
335 pRes1 = next;
336 resources = next;
337 }
338 pTVar1 = pRes2->Child();
339 while ( pTVar1 != (TResource*)0x0 )
340 {
341 pRes1 = pTVar1->Next();
342 if ( pRes1 == pTVar1 )
343 {
344 pRes1 = (TResource*)0x0;
345 }
346 DeleteResourceAtomic( pTVar1 );
347 pTVar1 = pRes1;
348 pRes1 = resources;
349 }
350 DeleteResourceAtomic( pRes2 );
351 }
352 pRes2 = next;
353 } while ( next != (TResource*)0x0 );
354 }
355}
void DestroyDyingResources(TResource *resources)
T * Next() const
Definition TNodeTree.h:34

◆ DestroyResource()

void TRenderInterface::DestroyResource ( TResource * resource)

Definition at line 120 of file TRenderInterface.cpp.

121{
122 TASSERT( TNULL != resource->Tree(), "Resource doesn't have a tree" );
123 TASSERT( TFALSE == resource->IsDead(), "Resource is already dead" );
124
125 if ( resource->IsDying() == TFALSE )
126 {
128 resource->AddState( TResourceState_Dying );
129 DestroyResourceRecurse( resource->Child() );
130 resource->Invalidate();
131 }
132}
@ TResourceState_Dying
Definition TResource.h:13
void DestroyResourceRecurse(TResource *resource)
TBOOL IsDead() const
Definition TResource.h:42
virtual void Invalidate()
Definition TResource.cpp:47
TBOOL IsDying() const
Definition TResource.h:43
void AddState(TResourceState state)
Definition TResource.h:51
TNodeTree< T > * Tree() const
Definition TNodeTree.h:36

◆ DestroyResourceRecurse()

void TRenderInterface::DestroyResourceRecurse ( TResource * resource)

Definition at line 134 of file TRenderInterface.cpp.

135{
136 if ( resource != TNULL )
137 {
138 TResource* lastResource = resource->Prev();
139
140 while ( resource != TNULL )
141 {
142 TResource* nextResource = ( resource != lastResource ) ? resource->Next() : TNULL;
143
144 if ( resource->IsDying() == TFALSE )
145 {
147 resource->AddState( TResourceState_Dying );
148
149 if ( resource->Child() != TNULL )
150 {
151 DestroyResourceRecurse( resource->Child() );
152 }
153
154 resource->Invalidate();
155 }
156
157 resource = nextResource;
158 }
159 }
160}
T * Prev() const
Definition TNodeTree.h:35

◆ DestroySystemResources()

void TRenderInterface::DestroySystemResources ( )
virtual

Definition at line 294 of file TRenderInterface.cpp.

295{
296 DestroyResourceRecurse( m_Resources.ChildOfRoot() );
298}

◆ DumpStats()

void TRenderInterface::DumpStats ( )
virtual

Definition at line 197 of file TRenderInterface.cpp.

198{
199 TIMPLEMENT();
200
201 TFile* file = TFile::Create( "TRenderInterface.txt", TFILEMODE_CREATENEW );
202
203 if ( file != TNULL )
204 {
205 file->CPrintf( "-\r\n" );
206 TCHAR const* name = GetClass()->GetName();
207 uint16_t versionMajor = GetClass()->GetVersionMajor();
208 uint16_t versionMinor = GetClass()->GetVersionMinor();
209 file->CPrintf( "Toshi rendering interface through object[\"%s\"] Version : %u.%u\r\n", name, versionMajor, versionMinor );
210 file->CPrintf( "-\r\n" );
211
212 for ( auto it = m_AdapterList.Begin(); it != m_AdapterList.End(); it++ )
213 {
214 file->CPrintf( "Adapter : %d\r\n", it->GetAdapterIndex() );
215 file->CPrintf( " Driver : %s\r\n", it->GetDriver().GetString() );
216 file->CPrintf( " Description : %s\r\n", it->GetDriverDescription().GetString() );
217 file->CPrintf( " Product ID : %u\r\n", it->GetProductID() );
218 file->CPrintf( " Version : %u\r\n", it->GetVersion() );
219 file->CPrintf( " Sub-version : %u\r\n", it->GetSubVersion() );
220 file->CPrintf( " Build : %u\r\n", it->GetBuild() );
221 file->CPrintf( " Supports %d modes:\r\n", it->GetModeList()->Count() );
222 }
223
224 file->Destroy();
225 }
226}
@ TFILEMODE_CREATENEW
Definition TFile.h:41
char TCHAR
Definition Typedefs.h:20
void Destroy()
Definition TFile.cpp:184
static TFile * Create(const TString8 &a_rcFilename, TFILEMODE a_eMode=TFILEMODE_READ)
Definition TFile.cpp:29
virtual TINT CPrintf(const TCHAR *a_szFormat,...)=0
Analogue of printf but writes result to the file.
TNodeList< TRenderAdapter > m_AdapterList
virtual Toshi::TClass * GetClass()
Definition TObject.cpp:12

◆ EndScene()

virtual TBOOL TRenderInterface::EndScene ( )
pure virtual

Implemented in TRenderD3DInterface.

◆ FindDevice()

TRenderAdapter::Mode::Device * TRenderInterface::FindDevice ( const DISPLAYPARAMS & a_rDisplayParams)

Definition at line 401 of file TRenderInterface.cpp.

402{
403 auto pAdapter = GetAdapterList()->Begin();
404
405 while ( TTRUE )
406 {
407 if ( pAdapter == GetAdapterList()->End() )
408 {
409 TString8 errorString = "Unable to find the passed device!\n";
410#ifdef TOSHI_DEBUG
411 OutputDebugStringA( errorString );
412#endif
413 return TNULL;
414 }
415
416 for ( auto pMode = pAdapter->GetModeList()->Begin(); pMode != pAdapter->GetModeList()->End(); pMode++ )
417 {
418 auto uiNumSupportedDevices = pAdapter->GetNumSupportedDevices();
419
420 for ( TUINT32 i = 0; i < uiNumSupportedDevices; i++ )
421 {
422 auto pDevice = pMode->GetDevice( i );
423
424 if ( pDevice->IsSoftware() ) continue;
425
426 TBOOL bPassedColourDepth = TTRUE;
427
428 if ( a_rDisplayParams.uiColourDepth == 32 )
429 {
430 if ( !pDevice->GetMode()->Is32Bit() )
431 {
432 bPassedColourDepth = TFALSE;
433 }
434 }
435 else if ( a_rDisplayParams.uiColourDepth == 16 )
436 {
437 if ( !pDevice->GetMode()->Is16Bit() )
438 {
439 bPassedColourDepth = TFALSE;
440 }
441 }
442
443 TBOOL bPassedWindowed = TTRUE;
444
445 if ( a_rDisplayParams.bWindowed && !pDevice->CanRenderWindowed() )
446 {
447 bPassedWindowed = TFALSE;
448 }
449
450 auto uiWidth = pDevice->GetMode()->GetWidth();
451 auto uiHeight = pDevice->GetMode()->GetHeight();
452
453 if ( uiHeight < uiWidth || !a_rDisplayParams.bWindowed || a_rDisplayParams.uiWidth <= a_rDisplayParams.uiHeight )
454 {
455 if ( uiWidth == a_rDisplayParams.uiWidth && uiHeight == a_rDisplayParams.uiHeight )
456 {
457 if ( pDevice->IsDepthStencilFormatSupported( a_rDisplayParams.eDepthStencilFormat ) &&
458 bPassedColourDepth && bPassedWindowed )
459 {
460 return pDevice;
461 }
462 }
463 }
464 else
465 {
466 if ( a_rDisplayParams.uiWidth <= uiWidth )
467 {
468 if ( uiHeight < a_rDisplayParams.uiHeight ) continue;
469
470 if ( pDevice->IsDepthStencilFormatSupported( a_rDisplayParams.eDepthStencilFormat ) &&
471 bPassedColourDepth && bPassedWindowed )
472 {
473 return pDevice;
474 }
475 }
476 }
477 }
478 }
479
480 pAdapter++;
481 }
482}
uint32_t TUINT32
Definition Typedefs.h:13
bool TBOOL
Definition Typedefs.h:6
TNodeList< TRenderAdapter > * GetAdapterList()
Iterator Begin() const
Definition TNodeList.h:230

◆ FlushDyingResources()

void TRenderInterface::FlushDyingResources ( )

Definition at line 484 of file TRenderInterface.cpp.

485{
486 while ( m_bHasDyingResources )
487 {
489 DestroyDyingResources( m_Resources.ChildOfRoot() );
490 }
491}

◆ FlushOrderTables()

void TRenderInterface::FlushOrderTables ( )
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 253 of file TRenderInterface.cpp.

254{
255}

◆ GetAdapterList()

TNodeList< TRenderAdapter > * TRenderInterface::GetAdapterList ( )
inline

Definition at line 137 of file TRenderInterface.h.

137{ return &m_AdapterList; }

◆ GetCurrentContext()

TRenderContext * TRenderInterface::GetCurrentContext ( ) const
inline

Definition at line 136 of file TRenderInterface.h.

136{ return m_pCurrentContext; }

◆ GetCurrentDevice()

virtual TRenderAdapter::Mode::Device * TRenderInterface::GetCurrentDevice ( )
pure virtual

Implemented in TRenderD3DInterface.

◆ GetCurrentDisplayParams()

virtual DISPLAYPARAMS * TRenderInterface::GetCurrentDisplayParams ( )
pure virtual

Implemented in TRenderD3DInterface.

◆ GetInvalidTexture()

TTexture * TRenderInterface::GetInvalidTexture ( )
inline

Definition at line 140 of file TRenderInterface.h.

140{ return m_pInvalidTexture; }

◆ GetKeyframeLibraryManager()

TKeyframeLibraryManager & TRenderInterface::GetKeyframeLibraryManager ( )
inline

Definition at line 138 of file TRenderInterface.h.

138{ return m_KeyframeManager; }
TKeyframeLibraryManager m_KeyframeManager

◆ GetLightColour()

const TMatrix44 & TRenderInterface::GetLightColour ( ) const
inline

Definition at line 134 of file TRenderInterface.h.

134{ return m_LightColour; }

◆ GetLightDirection()

const TMatrix44 & TRenderInterface::GetLightDirection ( ) const
inline

Definition at line 133 of file TRenderInterface.h.

133{ return m_LightDirection; }

◆ GetPixelAspectRatio()

TFLOAT TRenderInterface::GetPixelAspectRatio ( )
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 243 of file TRenderInterface.cpp.

244{
245 return 1.0f;
246}

◆ GetScreenAspectRatio()

TFLOAT TRenderInterface::GetScreenAspectRatio ( )
virtual

Definition at line 238 of file TRenderInterface.cpp.

239{
240 return 4.0f / 3.0f;
241}

◆ GetScreenOffset()

void TRenderInterface::GetScreenOffset ( TVector2 & a_rVec)
virtual

Definition at line 228 of file TRenderInterface.cpp.

229{
230 a_rVec.Set( m_ScreenOffset );
231}
constexpr void Set(TFLOAT x, TFLOAT y)
Definition TVector2.h:13

◆ GetSystemResource()

template<class T>
T * TRenderInterface::GetSystemResource ( SYSRESOURCE systemResource)
inline

Definition at line 109 of file TRenderInterface.h.

110 {
111 TASSERT( systemResource >= 0 && systemResource < SYSRESOURCE_NUMOF, "Unknown resource" );
112 return TSTATICCAST( T, m_SystemResources[ systemResource ] );
113 }
@ SYSRESOURCE_NUMOF
Definition TRender.h:21

◆ GetTransforms()

TStack< TMatrix44, 20 > & TRenderInterface::GetTransforms ( )
inline

Definition at line 139 of file TRenderInterface.h.

139{ return m_Transforms; }

◆ IsCreated()

TBOOL TRenderInterface::IsCreated ( )
inline

Definition at line 130 of file TRenderInterface.h.

130{ return m_bCreated; }

◆ IsDisplayCreated()

TBOOL TRenderInterface::IsDisplayCreated ( )
inline

Definition at line 131 of file TRenderInterface.h.

131{ return m_bDisplayCreated; }

◆ IsInScene()

TBOOL TRenderInterface::IsInScene ( )
inline

Definition at line 129 of file TRenderInterface.h.

129{ return m_bInScene; }

◆ IsTextureFormatSupported()

TBOOL TRenderInterface::IsTextureFormatSupported ( TINT a_eTextureFormat)
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 257 of file TRenderInterface.cpp.

258{
259 return TTRUE;
260}

◆ OnInitializationFailureDevice()

void TRenderInterface::OnInitializationFailureDevice ( )
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 281 of file TRenderInterface.cpp.

282{
283}

◆ OnInitializationFailureDisplay()

void TRenderInterface::OnInitializationFailureDisplay ( )
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 285 of file TRenderInterface.cpp.

286{
287}

◆ RenderIndexPrimitive()

void TRenderInterface::RenderIndexPrimitive ( TINT param_2,
TINT param_3,
TINT param_4,
TINT param_5,
TINT param_6,
TINT param_7 )
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 93 of file TRenderInterface.cpp.

94{
95}

◆ SetAutoCreateSystemResources()

void TRenderInterface::SetAutoCreateSystemResources ( TBOOL a_bAutoCreate)
inline

Definition at line 127 of file TRenderInterface.h.

127{ m_bCreateSystemResources = a_bAutoCreate; }

◆ SetCurrentRenderContext()

TRenderContext * TRenderInterface::SetCurrentRenderContext ( TRenderContext * a_pRenderContext)
inline

Definition at line 122 of file TRenderInterface.h.

123 {
124 return std::exchange( m_pCurrentContext, a_pRenderContext );
125 }

◆ SetLightColourMatrix()

void TRenderInterface::SetLightColourMatrix ( const TMatrix44 & a_rMatrix)
virtual

Definition at line 272 of file TRenderInterface.cpp.

273{
274 m_LightColour = a_rMatrix;
275}

◆ SetLightDirectionMatrix()

void TRenderInterface::SetLightDirectionMatrix ( const TMatrix44 & a_rMatrix)
virtual

Definition at line 267 of file TRenderInterface.cpp.

268{
269 m_LightDirection = a_rMatrix;
270}

◆ SetPixelAspectRatio()

TBOOL TRenderInterface::SetPixelAspectRatio ( float a_fPixelAspectRatio)
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 248 of file TRenderInterface.cpp.

249{
250 return TFALSE;
251}

◆ SetResourceExplicit()

void TRenderInterface::SetResourceExplicit ( TResource * resource,
SYSRESOURCE systemResource )

Definition at line 162 of file TRenderInterface.cpp.

163{
164 TASSERT( systemResource >= 0 && systemResource < SYSRESOURCE_NUMOF, "Unknown resource" );
165 TASSERT( m_SystemResources[ systemResource ] == TNULL, "This resource has already been assigned!" );
166 m_SystemResources[ systemResource ] = resource;
167}

◆ SetScreenOffset()

void TRenderInterface::SetScreenOffset ( const TVector2 & a_rVec)
virtual

Definition at line 233 of file TRenderInterface.cpp.

234{
235 m_ScreenOffset.Set( a_rVec );
236}

◆ Supports32BitTextures()

TBOOL TRenderInterface::Supports32BitTextures ( )
virtual

Reimplemented in TRenderD3DInterface.

Definition at line 262 of file TRenderInterface.cpp.

263{
264 return TFALSE;
265}

◆ TDECLARE_CLASS()

TRenderInterface::TDECLARE_CLASS ( TRenderInterface ,
TObject  )

◆ Unknown1()

void TRenderInterface::Unknown1 ( TViewport * a_pViewport)
virtual

Definition at line 277 of file TRenderInterface.cpp.

278{
279}

◆ Update()

virtual TBOOL TRenderInterface::Update ( float a_fDeltaTime)
pure virtual

Implemented in TRenderD3DInterface.

Member Data Documentation

◆ m_AdapterList

TNodeList<TRenderAdapter> TRenderInterface::m_AdapterList
protected

Definition at line 170 of file TRenderInterface.h.

◆ m_bCreated

TBOOL TRenderInterface::m_bCreated = false
protected

Definition at line 159 of file TRenderInterface.h.

◆ m_bCreateSystemResources

TBOOL TRenderInterface::m_bCreateSystemResources
protected

Definition at line 157 of file TRenderInterface.h.

◆ m_bDisplayCreated

TBOOL TRenderInterface::m_bDisplayCreated
protected

Definition at line 160 of file TRenderInterface.h.

◆ m_BeginSceneEmitter

TGenericEmitter TRenderInterface::m_BeginSceneEmitter
protected

Definition at line 176 of file TRenderInterface.h.

◆ m_bHasDyingResources

TBOOL TRenderInterface::m_bHasDyingResources
protected

Definition at line 174 of file TRenderInterface.h.

◆ m_bInScene

TBOOL TRenderInterface::m_bInScene
protected

Definition at line 158 of file TRenderInterface.h.

◆ m_EndSceneEmitter

TGenericEmitter TRenderInterface::m_EndSceneEmitter
protected

Definition at line 177 of file TRenderInterface.h.

◆ m_iFrameCount

TUINT32 TRenderInterface::m_iFrameCount = 0
protected

Definition at line 173 of file TRenderInterface.h.

◆ m_KeyframeManager

TKeyframeLibraryManager TRenderInterface::m_KeyframeManager
protected

Definition at line 175 of file TRenderInterface.h.

◆ m_LightColour

TMatrix44 TRenderInterface::m_LightColour
protected

Definition at line 166 of file TRenderInterface.h.

◆ m_LightDirection

TMatrix44 TRenderInterface::m_LightDirection
protected

Definition at line 165 of file TRenderInterface.h.

◆ m_pCreatedContext

TRenderContext* TRenderInterface::m_pCreatedContext
protected

Definition at line 163 of file TRenderInterface.h.

◆ m_pCurrentContext

TRenderContext* TRenderInterface::m_pCurrentContext
protected

Definition at line 162 of file TRenderInterface.h.

◆ m_pDebugText

TDebugText* TRenderInterface::m_pDebugText
protected

Definition at line 167 of file TRenderInterface.h.

◆ m_pInvalidTexture

TTexture* TRenderInterface::m_pInvalidTexture
protected

Definition at line 169 of file TRenderInterface.h.

◆ m_ResourceCount

TUINT32 TRenderInterface::m_ResourceCount = 0
protected

Definition at line 172 of file TRenderInterface.h.

◆ m_Resources

TNodeTree<TResource> TRenderInterface::m_Resources
protected

Definition at line 171 of file TRenderInterface.h.

◆ m_ScreenOffset

TVector2 TRenderInterface::m_ScreenOffset
protected

Definition at line 161 of file TRenderInterface.h.

◆ m_SystemResources

TResource* TRenderInterface::m_SystemResources[SYSRESOURCE_NUMOF]
protected

Definition at line 164 of file TRenderInterface.h.

◆ m_Transforms

TStack<TMatrix44, 20> TRenderInterface::m_Transforms
protected

Definition at line 178 of file TRenderInterface.h.

◆ m_Unk2

void* TRenderInterface::m_Unk2
protected

Definition at line 168 of file TRenderInterface.h.

◆ MAXNUMRESOURCES

size_t TRenderInterface::MAXNUMRESOURCES = 6000
staticconstexpr

Definition at line 40 of file TRenderInterface.h.


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