OpenBarnyard
 
Loading...
Searching...
No Matches
TVertexFactoryResource_DX8.cpp
Go to the documentation of this file.
1#include "ToshiPCH.h"
5
6#include "Toshi/T2Pair.h"
7
8//-----------------------------------------------------------------------------
9// Enables memory debugging.
10// Note: Should be the last include!
11//-----------------------------------------------------------------------------
12#include "Core/TMemoryDebugOn.h"
13
15
17
18// $Barnyard: FUNCTION 006d7910
20{
21 auto pVertexPool = TSTATICCAST(
23 GetRenderer()->CreateResource( &TGetClass( TVertexPoolResource ), TNULL, this )
24 );
25
26 TVALIDPTR( pVertexPool );
27
28 pVertexPool->Create( this, a_uiMaxStaticVertices, a_uiFlags );
29 CreatePool( a_uiMaxStaticVertices, a_uiFlags );
30
31 return pVertexPool;
32}
33
34// $Barnyard: FUNCTION 006d78d0
36{
37 auto pVertexBlock = TSTATICCAST(
39 GetRenderer()->CreateResource( &TGetClass( TVertexBlockResource ), TNULL, this )
40 );
41
42 TVALIDPTR( pVertexBlock );
43
44 pVertexBlock->Create( this, a_uiMaxVertices, a_uiFlags );
45 return pVertexBlock;
46}
47
48// $Barnyard: FUNCTION 006d7890
50{
51 if ( a_pResource->GetFlags() & 2 )
52 {
53 return TNULL;
54 }
55
57 Pair result = { TNULL, a_pResource };
58
59 // $Barnyard: FUNCTION 006d7850
61 []( TResource* a_pResource, void* a_pUserData ) {
62 auto pPair = TSTATICCAST( Pair, a_pUserData );
63
64 if ( a_pResource->IsA( &TGetClass( TVertexBlockResource ) ) )
65 {
66 auto pBlockResource = TSTATICCAST( TVertexBlockResource, a_pResource );
67
68 if ( pBlockResource->CanFit( pPair->second ) && !pBlockResource->IsDying() )
69 {
70 pPair->first = pBlockResource;
71 return TFALSE;
72 }
73 }
74
75 return TTRUE;
76 },
77 this,
78 &result
79 );
80
81 return result.first;
82}
83
#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
virtual TVertexPoolResourceInterface * CreatePoolResource(TUINT16 a_uiMaxStaticVertices, TUINT16 a_uiFlags)
TVertexBlockResource * CreateBlockResource(TUINT16 a_uiMaxVertices, TUINT32 a_uiFlags)
TVertexBlockResource * FindBlockResource(TVertexPoolResource *a_pResource)
TBOOL RecurseSimple(t_RecurseCb a_pCallback, TResource *a_pResource, void *a_pUserData)
TRenderInterface * GetRenderer() const
TVertexPoolResourceInterface * CreatePool(TUINT16 a_uiMaxStaticVertices, TUINT32 a_uiFlags)
Definition T2Pair.h:8
First first
Definition T2Pair.h:9
TBOOL IsA(TClass *a_pClass)
Definition TObject.h:192