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

#include <TVertexFactoryResource_DX8.h>

Inheritance diagram for TVertexFactoryResource:
TVertexFactoryResourceInterface TResource TObject TNodeTree< T >::TNode

Public Member Functions

 TDECLARE_CLASS (TVertexFactoryResource, TVertexFactoryResourceInterface)
 
virtual TVertexPoolResourceInterfaceCreatePoolResource (TUINT16 a_uiMaxStaticVertices, TUINT16 a_uiFlags)
 
TVertexBlockResourceFindBlockResource (TVertexPoolResource *a_pResource)
 
TVertexBlockResourceCreateBlockResource (TUINT16 a_uiMaxVertices, TUINT32 a_uiFlags)
 
- Public Member Functions inherited from TVertexFactoryResourceInterface
 TDECLARE_CLASS (TVertexFactoryResourceInterface, TResource)
 
 TVertexFactoryResourceInterface ()
 
virtual TBOOL Create (TVertexFactoryFormat *a_pVertexFormat, TUINT16 a_uiMaxStaticVertices, TUINT32 a_uiFlags)
 
const TVertexFactoryFormatGetVertexFormat () const
 
TUINT16 GetMaxStaticVertices () const
 
- Public Member Functions inherited from TResource
 TDECLARE_CLASS (TResource, TObject)
 
 TResource ()
 
 ~TResource ()
 
virtual TBOOL Create ()
 
virtual TBOOL Validate ()
 
virtual void Invalidate ()
 
virtual void DestroyResource ()
 
virtual TBOOL TryInvalidate ()
 
virtual TBOOL TryValidate ()
 
virtual void OnDestroy ()
 
TBOOL IsDead () const
 
TBOOL IsDying () const
 
TBOOL IsValid () const
 
TBOOL IsExternal () const
 
TBOOL IsCreated () const
 
TBOOL IsSceneObject () const
 
TBOOL IsInvalid () const
 
void SetState (TResourceState newState)
 
void AddState (TResourceState state)
 
void SetParent (TResource *a_pParent)
 
const TCHARGetName () const
 
void SetName (const TCHAR *name)
 
TBOOL RecurseSimple (t_RecurseCb a_pCallback, TResource *a_pResource, void *a_pUserData)
 
TRenderInterfaceGetRenderer () const
 
void SetRenderer (TRenderInterface *pRenderer)
 
TUINT32 GetUId () const
 
void SetUId (TUINT32 uid)
 
- 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 TNodeTree< T >::TNode
TBOOL IsChildOfDefaultRoot () const
 
TBOOL IsLinked () const
 
T * Parent () const
 
T * Next () const
 
T * Prev () const
 
TNodeTree< T > * Tree () const
 
T * Child () const
 

Additional Inherited Members

- Public Types inherited from TResource
using t_RecurseCb = TBOOL ( * )( TResource* a_pResource, void* a_pUserData )
 
- Public Types inherited from TObject
enum  { IsTObject = TTRUE }
 
- Static Public Member Functions inherited from TResource
static TBOOL Recurse (t_RecurseCb a_pCallback, TResource *a_pResource, TBOOL a_bFlag, void *a_pUserData)
 
- 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 ()
 
- Public Attributes inherited from TVertexFactoryResourceInterface
friend TVertexPoolResourceInterface
 
- Public Attributes inherited from TResource
friend TRenderInterface
 
- Public Attributes inherited from TNodeTree< T >::TNode
friend TNodeTree
 
- Static Public Attributes inherited from TResource
static constexpr size_t MAXNAMELEN = 14
 
- 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 Member Functions inherited from TVertexFactoryResourceInterface
TVertexPoolResourceInterfaceCreatePool (TUINT16 a_uiMaxStaticVertices, TUINT32 a_uiFlags)
 
- Protected Member Functions inherited from TNodeTree< T >::TNode
 TNode ()
 
- Protected Attributes inherited from TVertexFactoryResourceInterface
TUINT m_uiNumPools
 
TVertexFactoryFormat m_VertexFormat
 
TUINT16 m_uiMaxStaticVertices
 
TUINT m_uiFlags
 
- Protected Attributes inherited from TNodeTree< T >::TNode
TNodeTree< T > * m_Tree
 
T * m_Next
 
T * m_Prev
 
T * m_Parent
 
T * m_Child
 

Detailed Description

Definition at line 8 of file TVertexFactoryResource_DX8.h.

Member Function Documentation

◆ CreateBlockResource()

TVertexBlockResource * TVertexFactoryResource::CreateBlockResource ( TUINT16 a_uiMaxVertices,
TUINT32 a_uiFlags )

Definition at line 35 of file TVertexFactoryResource_DX8.cpp.

36{
37 auto pVertexBlock = TSTATICCAST(
38 TVertexBlockResource,
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}
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
#define TVALIDPTR(PTR)
Definition Defines.h:139
#define TGetClass(CLASS)
Definition TObject.h:13
#define TNULL
Definition Typedefs.h:23
TRenderInterface * GetRenderer() const

◆ CreatePoolResource()

TVertexPoolResourceInterface * TVertexFactoryResource::CreatePoolResource ( TUINT16 a_uiMaxStaticVertices,
TUINT16 a_uiFlags )
virtual

Implements TVertexFactoryResourceInterface.

Definition at line 19 of file TVertexFactoryResource_DX8.cpp.

20{
21 auto pVertexPool = TSTATICCAST(
22 TVertexPoolResource,
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}
TVertexPoolResourceInterface * CreatePool(TUINT16 a_uiMaxStaticVertices, TUINT32 a_uiFlags)

◆ FindBlockResource()

TVertexBlockResource * TVertexFactoryResource::FindBlockResource ( TVertexPoolResource * a_pResource)

Definition at line 49 of file TVertexFactoryResource_DX8.cpp.

50{
51 if ( a_pResource->GetFlags() & 2 )
52 {
53 return TNULL;
54 }
55
56 using Pair = T2Pair<TVertexBlockResource*, TVertexPoolResource*>;
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}
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25
TBOOL RecurseSimple(t_RecurseCb a_pCallback, TResource *a_pResource, void *a_pUserData)
TBOOL IsA(TClass *a_pClass)
Definition TObject.h:192

◆ TDECLARE_CLASS()

TVertexFactoryResource::TDECLARE_CLASS ( TVertexFactoryResource ,
TVertexFactoryResourceInterface  )

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