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

#include <TIndexFactoryResource_DX8.h>

Inheritance diagram for TIndexFactoryResource:
TIndexFactoryResourceInterface TResource TObject TNodeTree< T >::TNode

Public Member Functions

 TDECLARE_CLASS (TIndexFactoryResource, TIndexFactoryResourceInterface)
 
virtual TIndexPoolResourceInterfaceCreatePoolResource (TUINT16 a_uiMaxStaticIndices, TUINT16 a_uiFlags)
 
TIndexBlockResourceFindBlockResource (TIndexPoolResource *a_pResource)
 
TIndexBlockResourceCreateBlockResource (TUINT16 a_uiMaxIndices, TUINT32 a_uiFlags)
 
- Public Member Functions inherited from TIndexFactoryResourceInterface
 TDECLARE_CLASS (TIndexFactoryResourceInterface, TResource)
 
 TIndexFactoryResourceInterface ()
 
virtual TBOOL Create (TIndexFactoryFormat *a_pIndexFormat, TUINT16 a_uiMaxStaticIndices, TUINT32 a_uiFlags)
 
const TIndexFactoryFormatGetIndexFormat () const
 
TUINT16 GetMaxStaticIndices () 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 TIndexFactoryResourceInterface
friend TIndexPoolResourceInterface
 
- 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 TIndexFactoryResourceInterface
TIndexPoolResourceInterfaceCreatePool (TUINT16 a_uiMaxStaticIndices, TUINT32 a_uiFlags)
 
- Protected Member Functions inherited from TNodeTree< T >::TNode
 TNode ()
 
- Protected Attributes inherited from TIndexFactoryResourceInterface
TUINT m_uiNumPools
 
TIndexFactoryFormat m_IndexFormat
 
TUINT16 m_uiMaxStaticIndices
 
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 TIndexFactoryResource_DX8.h.

Member Function Documentation

◆ CreateBlockResource()

TIndexBlockResource * TIndexFactoryResource::CreateBlockResource ( TUINT16 a_uiMaxIndices,
TUINT32 a_uiFlags )

Definition at line 56 of file TIndexFactoryResource_DX8.cpp.

57{
58 auto pIndexBlock = TSTATICCAST(
59 TIndexBlockResource,
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}
#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()

TIndexPoolResourceInterface * TIndexFactoryResource::CreatePoolResource ( TUINT16 a_uiMaxStaticIndices,
TUINT16 a_uiFlags )
virtual

Implements TIndexFactoryResourceInterface.

Definition at line 70 of file TIndexFactoryResource_DX8.cpp.

71{
72 auto pIndexPool = TSTATICCAST(
73 TIndexPoolResource,
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}
TIndexPoolResourceInterface * CreatePool(TUINT16 a_uiMaxStaticIndices, TUINT32 a_uiFlags)

◆ FindBlockResource()

TIndexBlockResource * TIndexFactoryResource::FindBlockResource ( TIndexPoolResource * a_pResource)

Definition at line 21 of file TIndexFactoryResource_DX8.cpp.

22{
23 if ( a_pResource->GetFlags() & 2 )
24 {
25 return TNULL;
26 }
27
28 using Pair = T2Pair<TIndexBlockResource*, TIndexPoolResource*>;
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}
#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()

TIndexFactoryResource::TDECLARE_CLASS ( TIndexFactoryResource ,
TIndexFactoryResourceInterface  )

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