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

#include <TOrderTable.h>

Inheritance diagram for TOrderTable:

Public Types

using t_PreFlushCallback = void ( * )( void* a_pCustomData )
 
using t_PostFlushCallback = void ( * )( void* a_pCustomData )
 

Public Member Functions

 TOrderTable ()
 
 ~TOrderTable ()
 
void Render ()
 
void Flush ()
 
TRegMaterialRegisterMaterial (TMaterial *a_pMat)
 
void UseMaterial (TRegMaterial *a_pRegMat)
 
TBOOL Create (TShader *a_pShader, TINT a_iPriority)
 
TShaderGetShader () const
 

Static Public Member Functions

static void DeregisterMaterial (TRegMaterial *a_pRegMat)
 
static void DeregisterAllMaterials ()
 
static void CreateStaticData (TUINT a_uiMaxMaterials, TUINT a_uiMaxRenderPackets)
 
static void DestroyStaticData ()
 
static TRenderPacketAllocRenderPacket ()
 

Static Public Attributes

static TUINT s_uiMaxRenderPackets = 0
 
static TUINT s_uiNumRenderPackets = 0
 
static TUINT s_uiMaxNumRenderPackets = 0
 
static TUINT s_uiOrigMaxRenderPackets = 0
 
static TRenderPackets_pRenderPackets
 
static TUINT s_uiMaxMaterials = 0
 
static TUINT s_uiNumRegisteredMaterials = 0
 
static TRegMaterials_pRegMaterials
 
static TNodeList< TRegMaterials_llRegMatRegisteredList
 
static TNodeList< TRegMaterials_llRegMatFreeList
 

Detailed Description

Definition at line 64 of file TOrderTable.h.

Member Typedef Documentation

◆ t_PostFlushCallback

using TOrderTable::t_PostFlushCallback = void ( * )( void* a_pCustomData )

Definition at line 68 of file TOrderTable.h.

◆ t_PreFlushCallback

using TOrderTable::t_PreFlushCallback = void ( * )( void* a_pCustomData )

Definition at line 67 of file TOrderTable.h.

Constructor & Destructor Documentation

◆ TOrderTable()

TOrderTable::TOrderTable ( )

Definition at line 39 of file TOrderTable.cpp.

40{
41 m_pLastRegMat = TNULL;
42 m_pShader = TNULL;
43}
#define TNULL
Definition Typedefs.h:23

◆ ~TOrderTable()

TOrderTable::~TOrderTable ( )

Definition at line 46 of file TOrderTable.cpp.

47{
49}
static void DestroyStaticData()

Member Function Documentation

◆ AllocRenderPacket()

TRenderPacket * TOrderTable::AllocRenderPacket ( )
static

Definition at line 31 of file TOrderTable.cpp.

32{
34 TRenderPacket* packet = &s_pRenderPackets[ s_uiNumRenderPackets++ ];
36}
#define TASSERT(X,...)
Definition Defines.h:138
static TRenderPacket * s_pRenderPackets
static TUINT s_uiNumRenderPackets
static TUINT s_uiMaxRenderPackets

◆ Create()

TBOOL TOrderTable::Create ( TShader * a_pShader,
TINT a_iPriority )

Definition at line 14 of file TOrderTable_DX8.cpp.

15{
16 m_pLastRegMat = TNULL;
17 m_pShader = a_pShader;
18
19 TNode::SetPriority( a_iPriority );
21
22 return TTRUE;
23}
#define TTRUE
Definition Typedefs.h:25
void RegisterOrderTable(TOrderTable *a_pOrderTable)
Registers an order table.
static TFORCEINLINE TRenderD3DInterface * Interface()
Gets the render interface singleton.

◆ CreateStaticData()

void TOrderTable::CreateStaticData ( TUINT a_uiMaxMaterials,
TUINT a_uiMaxRenderPackets )
static

Definition at line 13 of file TOrderTable.cpp.

14{
15 s_uiMaxRenderPackets = a_uiMaxRenderPackets;
17
18 s_pRenderPackets = new TRenderPacket[ a_uiMaxRenderPackets ];
19 s_uiOrigMaxRenderPackets = a_uiMaxRenderPackets;
20
21 s_pRegMaterials = new TRegMaterial[ a_uiMaxMaterials ];
22 s_uiMaxMaterials = a_uiMaxMaterials;
23
24 for ( TSIZE i = 0; i < s_uiMaxMaterials; i++ )
25 {
26 s_pRegMaterials[ i ].SetOrderTable( TNULL );
27 s_llRegMatFreeList.InsertTail( &s_pRegMaterials[ i ] );
28 }
29}
size_t TSIZE
Definition Typedefs.h:9
static TUINT s_uiMaxMaterials
static TUINT s_uiOrigMaxRenderPackets
static TNodeList< TRegMaterial > s_llRegMatFreeList
static TRegMaterial * s_pRegMaterials

◆ DeregisterAllMaterials()

void TOrderTable::DeregisterAllMaterials ( )
static

Definition at line 135 of file TOrderTable.cpp.

136{
137 while ( !s_llRegMatRegisteredList.IsEmpty() )
138 {
140 }
141}
static TNodeList< TRegMaterial > s_llRegMatRegisteredList
static void DeregisterMaterial(TRegMaterial *a_pRegMat)

◆ DeregisterMaterial()

void TOrderTable::DeregisterMaterial ( TRegMaterial * a_pRegMat)
static

Definition at line 115 of file TOrderTable.cpp.

116{
117 if ( HASANYFLAG( pRegMat->GetFlags(), TRegMaterial::State_Registered ) )
118 {
120
121 TMaterial* pMaterial = pRegMat->GetMaterial();
122
123 pRegMat->Remove();
124 s_llRegMatFreeList.InsertHead( pRegMat );
126
127 pRegMat->SetFlags( 0 );
128 pRegMat->SetMaterial( TNULL );
129 pRegMat->SetOrderTable( TNULL );
130 pMaterial->SetRegMaterial( TNULL );
131 }
132}
#define HASANYFLAG(STATE, FLAG)
Definition Defines.h:5
void SetRegMaterial(TRegMaterial *a_pRegMaterial)
static TUINT s_uiNumRegisteredMaterials

◆ DestroyStaticData()

void TOrderTable::DestroyStaticData ( )
static

Definition at line 153 of file TOrderTable.cpp.

154{
155 if ( s_pRegMaterials )
156 {
158 s_llRegMatFreeList.RemoveAll();
159
160 delete[] s_pRegMaterials;
162 }
163
164 delete[] s_pRenderPackets;
166}
static void DeregisterAllMaterials()

◆ Flush()

void TOrderTable::Flush ( )

Definition at line 66 of file TOrderTable.cpp.

67{
69
71 {
73 }
74
75 m_pShader->StartFlush();
76
77 for ( auto it = m_pLastRegMat; it != TNULL; it = it->GetNextRegMat() )
78 {
79 it->Render();
80 }
81
82 m_pShader->EndFlush();
83
85 m_pLastRegMat = TNULL;
86}
#define TPROFILER_SCOPE()
Definition Profiler.h:17
static TUINT s_uiMaxNumRenderPackets

◆ GetShader()

TShader * TOrderTable::GetShader ( ) const
inline

Definition at line 103 of file TOrderTable.h.

103{ return m_pShader; }

◆ RegisterMaterial()

TRegMaterial * TOrderTable::RegisterMaterial ( TMaterial * a_pMat)

Definition at line 89 of file TOrderTable.cpp.

90{
92
93 TRegMaterial* pCurrentRegMat = pMat->GetRegMaterial();
94 if ( pCurrentRegMat != TNULL )
95 return pCurrentRegMat;
96
97 TASSERT( TFALSE == s_llRegMatFreeList.IsEmpty() );
98
99 if ( s_llRegMatFreeList.IsEmpty() )
100 return TNULL;
101
102 TRegMaterial* pRegMat = s_llRegMatFreeList.RemoveHead();
103 s_llRegMatRegisteredList.InsertTail( pRegMat );
105
107 pRegMat->SetMaterial( pMat );
108 pRegMat->SetOrderTable( this );
109 pMat->SetRegMaterial( pRegMat );
110
111 return pRegMat;
112}
#define TFALSE
Definition Typedefs.h:24
void SetMaterial(TMaterial *a_pMaterial)
Definition TOrderTable.h:45
void SetFlags(State a_eFlags)
Definition TOrderTable.h:39
void SetOrderTable(TOrderTable *a_pOrderTable)
Definition TOrderTable.h:42

◆ Render()

void TOrderTable::Render ( )

Definition at line 52 of file TOrderTable.cpp.

53{
55
56 for ( auto it = m_pLastRegMat; it != TNULL; it = it->GetNextRegMat() )
57 {
58 it->Render();
59 }
60
62 m_pLastRegMat = TNULL;
63}

◆ UseMaterial()

void TOrderTable::UseMaterial ( TRegMaterial * a_pRegMat)

Definition at line 143 of file TOrderTable.cpp.

144{
145 if ( !HASANYFLAG( a_pRegMat->GetFlags(), TRegMaterial::State_Used ) )
146 {
147 a_pRegMat->SetFlags( a_pRegMat->GetFlags() | TRegMaterial::State_Used );
148 a_pRegMat->SetNextRegMat( m_pLastRegMat );
149 m_pLastRegMat = a_pRegMat;
150 }
151}
State GetFlags() const
Definition TOrderTable.h:38
void SetNextRegMat(TRegMaterial *a_pRegMat)
Definition TOrderTable.h:48

Member Data Documentation

◆ s_llRegMatFreeList

TNodeList<TRegMaterial> TOrderTable::s_llRegMatFreeList
inlinestatic

Definition at line 116 of file TOrderTable.h.

◆ s_llRegMatRegisteredList

TNodeList<TRegMaterial> TOrderTable::s_llRegMatRegisteredList
inlinestatic

Definition at line 115 of file TOrderTable.h.

◆ s_pRegMaterials

TRegMaterial* TOrderTable::s_pRegMaterials
inlinestatic

Definition at line 114 of file TOrderTable.h.

◆ s_pRenderPackets

TRenderPacket* TOrderTable::s_pRenderPackets
inlinestatic

Definition at line 110 of file TOrderTable.h.

◆ s_uiMaxMaterials

TUINT TOrderTable::s_uiMaxMaterials = 0
inlinestatic

Definition at line 112 of file TOrderTable.h.

◆ s_uiMaxNumRenderPackets

TUINT TOrderTable::s_uiMaxNumRenderPackets = 0
inlinestatic

Definition at line 108 of file TOrderTable.h.

◆ s_uiMaxRenderPackets

TUINT TOrderTable::s_uiMaxRenderPackets = 0
inlinestatic

Definition at line 106 of file TOrderTable.h.

◆ s_uiNumRegisteredMaterials

TUINT TOrderTable::s_uiNumRegisteredMaterials = 0
inlinestatic

Definition at line 113 of file TOrderTable.h.

◆ s_uiNumRenderPackets

TUINT TOrderTable::s_uiNumRenderPackets = 0
inlinestatic

Definition at line 107 of file TOrderTable.h.

◆ s_uiOrigMaxRenderPackets

TUINT TOrderTable::s_uiOrigMaxRenderPackets = 0
inlinestatic

Definition at line 109 of file TOrderTable.h.


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