27 MarkAllModelsUnused();
49 if (
m_AllModels.IsValid( pRes ) )
return pRes->GetSecond();
55 if (
m_UsedModels.IsValid( pRes ) )
return pRes->GetSecond();
66 if ( it->GetName() == a_rName )
80 it->GetSecond()->Update( a_fDeltaTime );
85 it->GetSecond()->Update( a_fDeltaTime );
96 it->GetSecond()->Render( 1 );
99 it->GetSecond()->Render( 0 );
106 it->GetSecond()->Render( 1 );
109 it->GetSecond()->Render( 0 );
114AModel* AModelRepos::AllocateAModel(
const Toshi::TPString8& a_rName, Toshi::TTRB* a_pTRB )
122 return new AModel( a_rName, a_pTRB );
126void AModelRepos::MarkAllModelsUnused()
130 ModelsMap::Iterator next = it.Next();
132 MarkModelUnused( it->GetSecond() );
138void AModelRepos::MarkModelUnused(
AModel* a_pModel )
140 ModelsMap::Iterator modelIt =
m_UsedModels.FindByValue( a_pModel );
141 AModel* pModel = modelIt->GetSecond();
151 pOldestUnusedModel->Remove();
153 delete pOldestUnusedModel;
162 ModelsMap::Iterator next = it.Next();
163 AModel* pModel = it->GetSecond();
187 ModelsMap::Iterator pModels2Res =
m_AllModels.Find( a_rName );
191 pModel = pModels2Res->GetSecond();
195 ModelsMap::Iterator pUsedModelsRes =
m_UsedModels.Find( a_rName );
199 pModel = pUsedModelsRes->GetSecond();
205 pModel = AllocateAModel( a_rName, a_pTRB );
222 AModel* pModel = it->GetSecond();
233 AModel* pModel = it->GetSecond();
238 MarkModelUnused( pModel );
262 pModel = AllocateAModel( a_rName, a_pTRB );
267 pModel = pUsedModelsRes->GetSecond();
281 if (
m_AllModels.IsValid( pModelNode ) && pModelNode->GetSecond()->GetNumInstances() == 0 )
283 AModel* pModel = pModelNode->GetSecond();
288 if ( pModel->IsLinked() )
#define HASANYFLAG(STATE, FLAG)
#define TOSHI_NAMESPACE_USING
#define T2_FOREACH(vecName, iteratorName)
#define TDEFINE_CLASS(...)
AModel * GetModel() const
void DestroyInstance(AModelInstance *a_pInstance)
AModelInstanceRef CreateInstance()
TSIZE GetNumInstances() const
AModel * GetUnusedModel(const Toshi::TPString8 &a_rName)
void Update(TFLOAT a_fDeltaTime)
AModelInstance * InstantiateNewModel(const Toshi::TPString8 &a_rName, Toshi::TTRB *a_pTRB)
void LoadModel(const Toshi::TPString8 &a_rcName, Toshi::TTRB *a_pTRB)
AModelInstance * InstantiateModel(AModel *a_pModel)
Toshi::T2DList< AModel > m_UnusedModels
void UnloadUnusedModels()
void UnloadModel(const Toshi::TPString8 &a_rcName, TBOOL a_bDestroy)
void DestroyModelInstance(AModelInstance *a_pInstance)
static constexpr TSIZE MAX_UNUSED_MODELS_NUM
void RenderModels(TUINT a_uiMask)
AModel * GetModel(const Toshi::TPString8 &a_rcName)
static Toshi::TTRB * GetAssetTRB(AAssetType a_eAssetType)