blob: c5d4e07b45d73eacfb7232ae6a8ae59e5487320c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Deals with precaching requests from client effects
//
// $Revision: $
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "fx.h"
#include "clienteffectprecachesystem.h"
#include "particles/particles.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//Global singelton accessor
CClientEffectPrecacheSystem *ClientEffectPrecacheSystem( void )
{
static CClientEffectPrecacheSystem s_ClientEffectPrecacheSystem;
return &s_ClientEffectPrecacheSystem;
}
//-----------------------------------------------------------------------------
// Purpose: Precache all the registered effects
//-----------------------------------------------------------------------------
void CClientEffectPrecacheSystem::LevelInitPreEntity( void )
{
//Precache all known effects
for ( int i = 0; i < m_Effects.Size(); i++ )
{
m_Effects[i]->Cache();
}
//FIXME: Double check this
//Finally, force the cache of these materials
materials->CacheUsedMaterials();
// Now, cache off our material handles
FX_CacheMaterialHandles();
}
//-----------------------------------------------------------------------------
// Purpose: Nothing to do here
//-----------------------------------------------------------------------------
void CClientEffectPrecacheSystem::LevelShutdownPreEntity( void )
{
}
//-----------------------------------------------------------------------------
// Purpose: Dereference all the registered effects
//-----------------------------------------------------------------------------
void CClientEffectPrecacheSystem::LevelShutdownPostEntity( void )
{
// mark all known effects as free
for ( int i = 0; i < m_Effects.Size(); i++ )
{
m_Effects[i]->Cache( false );
}
}
//-----------------------------------------------------------------------------
// Purpose: Purges the effect list
//-----------------------------------------------------------------------------
void CClientEffectPrecacheSystem::Shutdown( void )
{
//Release all effects
m_Effects.Purge();
}
//-----------------------------------------------------------------------------
// Purpose: Adds the effect to the list to be precached
// Input : *effect - system to precache
//-----------------------------------------------------------------------------
void CClientEffectPrecacheSystem::Register( IClientEffect *effect )
{
//Hold onto this effect for precaching later
m_Effects.AddToTail( effect );
}
|