#include <AModelRepos.h>
|
using | ModelsMap = Toshi::T2Map<Toshi::TPString8, AModel*, Toshi::TPString8::Comparator> |
|
Definition at line 7 of file AModelRepos.h.
◆ ModelsMap
◆ AModelRepos()
AModelRepos::AModelRepos |
( |
| ) |
|
Definition at line 16 of file AModelRepos.cpp.
18{
19}
static Toshi::T2Allocator * GetAllocator(POOL a_ePool)
◆ ~AModelRepos()
AModelRepos::~AModelRepos |
( |
| ) |
|
Definition at line 23 of file AModelRepos.cpp.
24{
27 MarkAllModelsUnused();
29}
void UnloadUnusedModels()
◆ DestroyModelInstance()
void AModelRepos::DestroyModelInstance |
( |
AModelInstance * | a_pInstance | ) |
|
Definition at line 214 of file AModelRepos.cpp.
215{
216 {
217
219
221 {
222 AModel* pModel = it->GetSecond();
224 }
225 }
226
227 {
228
230
232 {
233 AModel* pModel = it->GetSecond();
235
237 {
238 MarkModelUnused( pModel );
239 }
240 }
241 }
242}
AModel * GetModel() const
void DestroyInstance(AModelInstance *a_pInstance)
TSIZE GetNumInstances() const
◆ GetModel()
AModel * AModelRepos::GetModel |
( |
const Toshi::TPString8 & | a_rcName | ) |
|
Definition at line 44 of file AModelRepos.cpp.
45{
46 {
47
49 if (
m_AllModels.IsValid( pRes ) )
return pRes->GetSecond();
50 }
51
52 {
53
55 if (
m_UsedModels.IsValid( pRes ) )
return pRes->GetSecond();
56 }
57
59}
◆ GetUnusedModel()
AModel * AModelRepos::GetUnusedModel |
( |
const Toshi::TPString8 & | a_rName | ) |
|
Definition at line 62 of file AModelRepos.cpp.
63{
65 {
66 if ( it->GetName() == a_rName )
67 {
68 return it;
69 }
70 }
71
73}
#define T2_FOREACH(vecName, iteratorName)
Toshi::T2DList< AModel > m_UnusedModels
◆ InstantiateModel()
Definition at line 177 of file AModelRepos.cpp.
178{
181}
AModelInstanceRef CreateInstance()
◆ InstantiateNewModel()
AModelInstance * AModelRepos::InstantiateNewModel |
( |
const Toshi::TPString8 & | a_rName, |
|
|
Toshi::TTRB * | a_pTRB ) |
Definition at line 184 of file AModelRepos.cpp.
185{
186 AModel* pModel =
TNULL;
187 ModelsMap::Iterator pModels2Res =
m_AllModels.Find( a_rName );
188
190 {
191 pModel = pModels2Res->GetSecond();
192 }
193 else
194 {
195 ModelsMap::Iterator pUsedModelsRes =
m_UsedModels.Find( a_rName );
196
198 {
199 pModel = pUsedModelsRes->GetSecond();
200 }
201 }
202
203 if ( !pModel )
204 {
205 pModel = AllocateAModel( a_rName, a_pTRB );
207 }
208
211}
AModelInstance * InstantiateModel(AModel *a_pModel)
◆ LoadModel()
void AModelRepos::LoadModel |
( |
const Toshi::TPString8 & | a_rcName, |
|
|
Toshi::TTRB * | a_pTRB ) |
Definition at line 245 of file AModelRepos.cpp.
246{
248 {
249 AModel* pModel =
TNULL;
251
253 {
255
256 if ( pModel )
257 {
258 pModel->Remove();
259 }
260 else
261 {
262 pModel = AllocateAModel( a_rName, a_pTRB );
263 }
264 }
265 else
266 {
267 pModel = pUsedModelsRes->GetSecond();
269 }
270
273 }
274}
AModel * GetUnusedModel(const Toshi::TPString8 &a_rName)
◆ RenderModels()
void AModelRepos::RenderModels |
( |
TUINT | a_uiMask | ) |
|
Definition at line 90 of file AModelRepos.cpp.
91{
92
94 {
96 it->GetSecond()->Render( 1 );
97
99 it->GetSecond()->Render( 0 );
100 }
101
102
104 {
106 it->GetSecond()->Render( 1 );
107
109 it->GetSecond()->Render( 0 );
110 }
111}
#define HASANYFLAG(STATE, FLAG)
◆ TDECLARE_CLASS()
AModelRepos::TDECLARE_CLASS |
( |
AModelRepos | , |
|
|
Toshi::TObject | ) |
◆ UnloadAllModels()
void AModelRepos::UnloadAllModels |
( |
| ) |
|
Definition at line 158 of file AModelRepos.cpp.
159{
161 {
162 ModelsMap::Iterator next = it.Next();
163 AModel* pModel = it->GetSecond();
164
166 {
168
170 }
171
172 it = next;
173 }
174}
◆ UnloadModel()
void AModelRepos::UnloadModel |
( |
const Toshi::TPString8 & | a_rcName, |
|
|
TBOOL | a_bDestroy ) |
Definition at line 277 of file AModelRepos.cpp.
278{
280
281 if (
m_AllModels.IsValid( pModelNode ) && pModelNode->GetSecond()->GetNumInstances() == 0 )
282 {
283 AModel* pModel = pModelNode->GetSecond();
285
286 if ( a_bDestroy )
287 {
288 if ( pModel->IsLinked() )
289 pModel->Remove();
290
291 delete pModel;
292 }
293 else
294 {
296 }
297 }
298}
◆ UnloadUnusedModels()
void AModelRepos::UnloadUnusedModels |
( |
| ) |
|
Definition at line 32 of file AModelRepos.cpp.
33{
35 {
37
38 pModel->Remove();
39 delete pModel;
40 }
41}
◆ Update()
void AModelRepos::Update |
( |
TFLOAT | a_fDeltaTime | ) |
|
Definition at line 76 of file AModelRepos.cpp.
77{
79 {
80 it->GetSecond()->Update( a_fDeltaTime );
81 }
82
84 {
85 it->GetSecond()->Update( a_fDeltaTime );
86 }
87}
◆ m_AllModels
◆ m_UnusedModels
Toshi::T2DList<AModel> AModelRepos::m_UnusedModels |
|
protected |
◆ m_UsedModels
◆ MAX_UNUSED_MODELS_NUM
TSIZE AModelRepos::MAX_UNUSED_MODELS_NUM = 9 |
|
staticconstexpr |
The documentation for this class was generated from the following files:
- D:/_dev/OpenBarnyard/Source/OpenBarnyard/Source/Animation/AModelRepos.h
- D:/_dev/OpenBarnyard/Source/OpenBarnyard/Source/Animation/AModelRepos.cpp