OpenBarnyard
 
Loading...
Searching...
No Matches
AModelRepos.h
Go to the documentation of this file.
1#pragma once
2#include "AModel.h"
3
4#include <Toshi/TPString8.h>
5#include <Toshi/T2Map.h>
6
7class AModelRepos : public Toshi::TObject
8 , public Toshi::TSingleton<AModelRepos>
9{
10public:
11 TDECLARE_CLASS( AModelRepos, Toshi::TObject );
12
13 using ModelsMap = Toshi::T2Map<Toshi::TPString8, AModel*, Toshi::TPString8::Comparator>;
14
15 static constexpr TSIZE MAX_UNUSED_MODELS_NUM = 9;
16
17public:
20
21 AModel* GetModel( const Toshi::TPString8& a_rcName );
22 AModel* GetUnusedModel( const Toshi::TPString8& a_rName );
23
25 AModelInstance* InstantiateNewModel( const Toshi::TPString8& a_rName, Toshi::TTRB* a_pTRB );
26 void DestroyModelInstance( AModelInstance* a_pInstance );
27
28 void LoadModel( const Toshi::TPString8& a_rcName, Toshi::TTRB* a_pTRB );
29 void UnloadModel( const Toshi::TPString8& a_rcName, TBOOL a_bDestroy );
30
31 void Update( TFLOAT a_fDeltaTime );
32 void RenderModels( TUINT a_uiMask );
33
34 void UnloadAllModels();
35 void UnloadUnusedModels();
36
37private:
38 AModel* AllocateAModel( const Toshi::TPString8& a_rcName, Toshi::TTRB* a_pTRB );
39
40 void MarkAllModelsUnused();
41 void MarkModelUnused( AModel* a_pModel );
42
43protected:
44 Toshi::T2DList<AModel> m_UnusedModels;
47};
unsigned int TUINT
Definition Typedefs.h:8
size_t TSIZE
Definition Typedefs.h:9
float TFLOAT
Definition Typedefs.h:4
bool TBOOL
Definition Typedefs.h:6
AModel * GetUnusedModel(const Toshi::TPString8 &a_rName)
void Update(TFLOAT a_fDeltaTime)
ModelsMap m_AllModels
Definition AModelRepos.h:46
AModelInstance * InstantiateNewModel(const Toshi::TPString8 &a_rName, Toshi::TTRB *a_pTRB)
void LoadModel(const Toshi::TPString8 &a_rcName, Toshi::TTRB *a_pTRB)
Toshi::T2Map< Toshi::TPString8, AModel *, Toshi::TPString8::Comparator > ModelsMap
Definition AModelRepos.h:13
AModelInstance * InstantiateModel(AModel *a_pModel)
Toshi::T2DList< AModel > m_UnusedModels
Definition AModelRepos.h:44
ModelsMap m_UsedModels
Definition AModelRepos.h:45
TDECLARE_CLASS(AModelRepos, Toshi::TObject)
void UnloadUnusedModels()
void UnloadModel(const Toshi::TPString8 &a_rcName, TBOOL a_bDestroy)
void DestroyModelInstance(AModelInstance *a_pInstance)
void UnloadAllModels()
static constexpr TSIZE MAX_UNUSED_MODELS_NUM
Definition AModelRepos.h:15
void RenderModels(TUINT a_uiMask)
AModel * GetModel(const Toshi::TPString8 &a_rcName)