OpenBarnyard
 
Loading...
Searching...
No Matches
TIndexFactoryResource_DX8.cpp
Go to the documentation of this file.
1#include "ToshiPCH.h"
5#include "Toshi/T2Pair.h"
6
7//-----------------------------------------------------------------------------
8// Enables memory debugging.
9// Note: Should be the last include!
10//-----------------------------------------------------------------------------
11#include "Core/TMemoryDebugOn.h"
12
14
16
17// destructor
18// $Barnyard: FUNCTION 006d7b80
19
20// $Barnyard: FUNCTION 006d7a50
22{
23 if ( a_pResource->GetFlags() & 2 )
24 {
25 return TNULL;
26 }
27
29 Pair result = { TNULL, a_pResource };
30
32 []( TResource* a_pResource, void* a_pUserData ) {
33 auto pPair = TSTATICCAST( Pair, a_pUserData );
34
35 if ( a_pResource->IsA( &TGetClass( TIndexBlockResource ) ) )
36 {
37 auto pBlockResource = TSTATICCAST( TIndexBlockResource, a_pResource );
38
39 if ( pBlockResource->CanFit( pPair->second ) && !pBlockResource->IsDying() )
40 {
41 pPair->first = pBlockResource;
42 return TFALSE;
43 }
44 }
45
46 return TTRUE;
47 },
48 this,
49 &result
50 );
51
52 return result.first;
53}
54
55// $Barnyard: FUNCTION 006d7a90
57{
58 auto pIndexBlock = TSTATICCAST(
60 GetRenderer()->CreateResource( &TGetClass( TIndexBlockResource ), TNULL, this )
61 );
62
63 TVALIDPTR( pIndexBlock );
64
65 pIndexBlock->Create( this, a_uiMaxIndices, a_uiFlags );
66 return pIndexBlock;
67}
68
69// $Barnyard: FUNCTION 006d7ad0
71{
72 auto pIndexPool = TSTATICCAST(
74 GetRenderer()->CreateResource( &TGetClass( TIndexPoolResource ), TNULL, this )
75 );
76
77 TVALIDPTR( pIndexPool );
78
79 pIndexPool->Create( this, a_uiMaxStaticIndices, a_uiFlags );
80 CreatePool( a_uiMaxStaticIndices, a_uiFlags );
81
82 return pIndexPool;
83}
84
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
#define TVALIDPTR(PTR)
Definition Defines.h:139
#define TGetClass(CLASS)
Definition TObject.h:13
#define TDEFINE_CLASS(...)
Definition TObject.h:120
uint16_t TUINT16
Definition Typedefs.h:15
#define TNULL
Definition Typedefs.h:23
uint32_t TUINT32
Definition Typedefs.h:13
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25
TIndexBlockResource * FindBlockResource(TIndexPoolResource *a_pResource)
virtual TIndexPoolResourceInterface * CreatePoolResource(TUINT16 a_uiMaxStaticIndices, TUINT16 a_uiFlags)
TIndexBlockResource * CreateBlockResource(TUINT16 a_uiMaxIndices, TUINT32 a_uiFlags)
TIndexPoolResourceInterface * CreatePool(TUINT16 a_uiMaxStaticIndices, TUINT32 a_uiFlags)
TBOOL RecurseSimple(t_RecurseCb a_pCallback, TResource *a_pResource, void *a_pUserData)
TRenderInterface * GetRenderer() const
Definition T2Pair.h:8
First first
Definition T2Pair.h:9
TBOOL IsA(TClass *a_pClass)
Definition TObject.h:192