PrecacheModel: Difference between revisions
Jump to navigation
Jump to search

Biohazard 90 (talk | contribs) mNo edit summary |
m (Added {{lang}}.) |
||
Line 1: | Line 1: | ||
{{lang|PrecacheModel}} | |||
PrecacheModel is a [[function]] provided to [[precache]] [[model|models]] or [[material|materials]] by [[string]]. | PrecacheModel is a [[function]] provided to [[precache]] [[model|models]] or [[material|materials]] by [[string]]. | ||
Latest revision as of 15:03, 29 August 2021


PrecacheModel is a function provided to precache models or materials by string.
Usage
//-----------------------------------------------------------------------------
// Purpose: Add model to level precache list
// Input : *name - model name
// Output : int -- model index for model
//-----------------------------------------------------------------------------
int CBaseEntity::PrecacheModel( const char *name )
Examples
#define PROP_COMBINE_BALL_MODEL "models/effects/combineball.mdl"
#define PROP_COMBINE_BALL_SPRITE_TRAIL "sprites/combineball_trail_black_1.vmt"
//-----------------------------------------------------------------------------
// Precache
//-----------------------------------------------------------------------------
void MyEntity::Precache( void )
{
BaseClass::Precache( );
PrecacheModel( PROP_COMBINE_BALL_MODEL );
PrecacheModel( PROP_COMBINE_BALL_SPRITE_TRAIL );
}
//This example loops through an array of possible models
//And precaches each one.
void CSDKPlayer::Precache()
{
int i = 0;
while( pszPossiblePlayerModels[i] != NULL )
{
PrecacheModel( pszPossiblePlayerModels[i] );
i++;
}
BaseClass::Precache();
}