Difference between revisions of "PrecacheMaterial"

From Valve Developer Community
Jump to: navigation, search
(Created page with 'PrecacheMaterial is a function provided to Precache materials by string. It is generally used to Precache assets used by an entity. == Usage == <source lang=cpp> //------------…')
 
Line 1: Line 1:
PrecacheMaterial is a function provided to Precache materials by string. It is generally used to Precache assets used by an entity.
+
PrecacheMaterial is a function provided to Precache materials by string. It is generally used to Precache assets used by an entity. File paths are relative to the mod's "Materials" folder.
  
  

Revision as of 09:20, 10 April 2011

PrecacheMaterial is a function provided to Precache materials by string. It is generally used to Precache assets used by an entity. File paths are relative to the mod's "Materials" folder.


Usage

//-----------------------------------------------------------------------------
// Purpose: Add material to precache
// Input  : *pMaterialName - material name
// Output : 
//-----------------------------------------------------------------------------
void PrecacheMaterial( const char *pMaterialName )


Examples

void CFireTrail::Precache( void )
{
	PrecacheMaterial( "sprites/flamelet1" );
	PrecacheMaterial( "sprites/flamelet2" );
	PrecacheMaterial( "particle/particle_smokegrenade" );
	PrecacheMaterial( "particle/particle_noisesphere" );
}
void CCitadelEnergyCore::Precache()
{
	BaseClass::Precache();
	PrecacheMaterial( "effects/combinemuzzle2_dark" ); 
}