本文整理汇总了C++中CSmartPtr::GetPMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPtr::GetPMaterial方法的具体用法?C++ CSmartPtr::GetPMaterial怎么用?C++ CSmartPtr::GetPMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPtr
的用法示例。
在下文中一共展示了CSmartPtr::GetPMaterial方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Start
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_ExtinguisherJet::Start( void )
{
SetupEntityRenderHandle( RENDER_GROUP_TRANSLUCENT_ENTITY );
m_ParticleSpawn.Init( 100 ); //Events per second
//Create the basic emitter
m_pEmitter = CSimpleEmitter::Create("C_ExtinguisherJet::m_pEmitter");
Assert( m_pEmitter.IsValid() );
if ( m_pEmitter.IsValid() )
{
m_MaterialHandle = m_pEmitter->GetPMaterial( "particle/particle_smokegrenade" );
m_pEmitter->SetSortOrigin( GetAbsOrigin() );
}
//Create the "ember" emitter for the smaller flecks
m_pEmberEmitter = CEmberEffect::Create( "C_ExtinguisherJet::m_pEmberEmitter" );
Assert( m_pEmberEmitter.IsValid() );
if ( m_pEmberEmitter.IsValid() )
{
m_EmberMaterialHandle = m_pEmberEmitter->GetPMaterial( "particle/particle_smokegrenade" );
m_pEmberEmitter->SetSortOrigin( GetAbsOrigin() );
}
}
示例2: ClientThink
//-----------------------------------------------------------------------------
// Purpose: Trail smoke
//-----------------------------------------------------------------------------
void CASW_Shotgun_Pellet_Predicted::ClientThink( void )
{
return;
CSmartPtr<CSimpleEmitter> pEmitter = CSimpleEmitter::Create( "CASW_Shotgun_Pellet_Predicted::Effect" );
PMaterialHandle hSphereMaterial = pEmitter->GetPMaterial( "sprites/chargeball" );
// Add particles at the target.
float flCur = gpGlobals->frametime;
while ( m_ParticleEvent.NextEvent( flCur ) )
{
Vector vecOrigin = GetAbsOrigin() + RandomVector( -2,2 );
pEmitter->SetSortOrigin( vecOrigin );
SimpleParticle *pParticle = (SimpleParticle *) pEmitter->AddParticle( sizeof(SimpleParticle), hSphereMaterial, vecOrigin );
if ( pParticle == NULL )
return;
pParticle->m_flLifetime = 0.0f;
pParticle->m_flDieTime = random->RandomFloat( 0.1f, 0.3f );
pParticle->m_uchStartSize = random->RandomFloat(2,4);
pParticle->m_uchEndSize = pParticle->m_uchStartSize + 2;
pParticle->m_vecVelocity = vec3_origin;
pParticle->m_uchStartAlpha = 128;
pParticle->m_uchEndAlpha = 0;
pParticle->m_flRoll = random->RandomFloat( 180, 360 );
pParticle->m_flRollDelta = random->RandomFloat( -1, 1 );
pParticle->m_uchColor[0] = 128;
pParticle->m_uchColor[1] = 128;
pParticle->m_uchColor[2] = 128;
}
}
示例3: OnDataChanged
//-----------------------------------------------------------------------------
// Purpose:
// Input : bnewentity -
//-----------------------------------------------------------------------------
void C_EntityFlame::OnDataChanged( DataUpdateType_t updateType )
{
if ( updateType == DATA_UPDATE_CREATED )
{
SetupEntityRenderHandle( RENDER_GROUP_TRANSLUCENT_ENTITY );
C_BaseEntity *pEnt = m_hEntAttached;
// FIXME: this should be IsBaseAnimating
if (pEnt->IsBaseCombatCharacter())
{
AttachToHitBoxes();
}
else
{
m_ParticleSpawn.Init( 60 ); //Events per second
m_pEmitter = CEmberEffect::Create("C_EntityFlame::Create");
Assert( m_pEmitter.IsValid() );
if ( m_pEmitter.IsValid() )
{
for ( int i = 1; i < NUM_FLAMELETS+1; i++ )
{
m_MaterialHandle[i-1] = m_pEmitter->GetPMaterial( VarArgs( "sprites/flamelet%d", i ) );
}
m_pEmitter->SetSortOrigin( GetAbsOrigin() );
}
}
}
}
示例4: sizeof
//-----------------------------------------------------------------------------
// Purpose:
// Input : &origin -
// &velocity -
// scale -
// numParticles -
// *pColor -
// iAlpha -
// *pMaterial -
// flRoll -
// flRollDelta -
//-----------------------------------------------------------------------------
CSmartPtr<CSimpleEmitter> FX_Smoke( const Vector &origin, const Vector &velocity, float scale, int numParticles, float flDietime, unsigned char *pColor, int iAlpha, const char *pMaterial, float flRoll, float flRollDelta )
{
VPROF_BUDGET( "FX_Smoke", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
CSmartPtr<CSimpleEmitter> pSimple = CSimpleEmitter::Create( "FX_Smoke" );
pSimple->SetSortOrigin( origin );
SimpleParticle *pParticle;
// Smoke
for ( int i = 0; i < numParticles; i++ )
{
PMaterialHandle hMaterial = pSimple->GetPMaterial( pMaterial );
pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), hMaterial, origin );
if ( pParticle == NULL )
return NULL;
pParticle->m_flLifetime = 0.0f;
pParticle->m_flDieTime = flDietime;
pParticle->m_vecVelocity = velocity;
for( int i = 0; i < 3; ++i )
{
pParticle->m_uchColor[i] = pColor[i];
}
pParticle->m_uchStartAlpha = iAlpha;
pParticle->m_uchEndAlpha = 0;
pParticle->m_uchStartSize = scale;
pParticle->m_uchEndSize = pParticle->m_uchStartSize*2;
pParticle->m_flRoll = flRoll;
pParticle->m_flRollDelta = flRollDelta;
}
return pSimple;
}
示例5: SparkleCallback
//-----------------------------------------------------------------------------
// Purpose: Callback to create a sparkle effect on the client
// Input : &data - information about the effect
//-----------------------------------------------------------------------------
void SparkleCallback( const CEffectData &data )
{
// Create a simple particle emitter
CSmartPtr<CSimpleEmitter> pSparkleEmitter = CSimpleEmitter::Create( "Sparkle" );
if ( pSparkleEmitter == NULL )
return;
// Make local versions of our passed in data
Vector origin = data.m_vOrigin;
float scale = data.m_flScale;
// Set our sort origin to make the system cull properly
pSparkleEmitter->SetSortOrigin( origin );
// Find the material handle we wish to use for these particles
PMaterialHandle hMaterial = pSparkleEmitter->GetPMaterial( "effects/yellowflare" );
SimpleParticle *pParticle;
// Make a group of particles in the world
for ( int i = 0; i < 64; i++ )
{
// Create a particle
pParticle = pSparkleEmitter->AddSimpleParticle( hMaterial, origin );
if ( pParticle == NULL )
return;
// Set our sizes
pParticle->m_uchStartSize = (unsigned char) scale;
pParticle->m_uchEndSize = 0;
// Set our roll
pParticle->m_flRoll = random->RandomFloat( 0, 2*M_PI );
pParticle->m_flRollDelta = random->RandomFloat( -DEG2RAD( 180 ), DEG2RAD( 180 ) );
// Set our color
pParticle->m_uchColor[0] = 255; // Red
pParticle->m_uchColor[1] = 255; // Green
pParticle->m_uchColor[2] = 255; // Blue
// Set our alpha
pParticle->m_uchStartAlpha = 0;
pParticle->m_uchEndAlpha = 255;
// Create a random vector
Vector velocity = RandomVector( -1.0f, 1.0f );
VectorNormalize( velocity );
// Find a random speed for the particle
float speed = random->RandomFloat( 4.0f, 8.0f ) * scale;
// Build and set the velocity of the particle
pParticle->m_vecVelocity = velocity * speed;
// Declare our lifetime
pParticle->m_flDieTime = 1.0f;
}
}
示例6: FX_MetalScrape
void FX_MetalScrape(Vector &position, Vector &normal)
{
VPROF_BUDGET("FX_MetalScrape", VPROF_BUDGETGROUP_PARTICLE_RENDERING);
Vector offset = position + (normal * 1.0f);
CSmartPtr<CTrailParticles> sparkEmitter = CTrailParticles::Create("FX_MetalScrape 1");
if (!sparkEmitter)
return;
sparkEmitter->SetSortOrigin(offset);
//Setup our collision information
sparkEmitter->Setup(offset,
&normal,
METAL_SCRAPE_SPREAD,
METAL_SCRAPE_MINSPEED,
METAL_SCRAPE_MAXSPEED,
METAL_SCRAPE_GRAVITY,
METAL_SCRAPE_DAMPEN,
bitsPARTICLE_TRAIL_VELOCITY_DAMPEN);
int numSparks = random->RandomInt(4, 8);
if (g_Material_Spark == NULL)
{
g_Material_Spark = sparkEmitter->GetPMaterial("effects/spark");
}
Vector dir;
TrailParticle *pParticle;
float length = 0.06f;
//Dump out sparks
for (int i = 0; i < numSparks; i++)
{
pParticle = (TrailParticle *) sparkEmitter->AddParticle(sizeof(TrailParticle), g_Material_Spark, offset);
if (pParticle == NULL)
return;
pParticle->m_flLifetime = 0.0f;
float spreadOfs = random->RandomFloat(0.0f, 2.0f);
dir[0] = normal[0] + random->RandomFloat(-(METAL_SCRAPE_SPREAD*spreadOfs), (METAL_SCRAPE_SPREAD*spreadOfs));
dir[1] = normal[1] + random->RandomFloat(-(METAL_SCRAPE_SPREAD*spreadOfs), (METAL_SCRAPE_SPREAD*spreadOfs));
dir[2] = normal[2] + random->RandomFloat(-(METAL_SCRAPE_SPREAD*spreadOfs), (METAL_SCRAPE_SPREAD*spreadOfs));
pParticle->m_flWidth = random->RandomFloat(2.0f, 5.0f);
pParticle->m_flLength = random->RandomFloat(length*0.25f, length);
pParticle->m_flDieTime = random->RandomFloat(2.0f, 2.0f);
pParticle->m_vecVelocity = dir * random->RandomFloat((METAL_SCRAPE_MINSPEED*(2.0f - spreadOfs)), (METAL_SCRAPE_MAXSPEED*(2.0f - spreadOfs)));
Color32Init(pParticle->m_color, 255, 255, 255, 255);
}
}
示例7: OnDataChanged
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_ObjectEMPGenerator::OnDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnDataChanged( updateType );
if ( updateType == DATA_UPDATE_CREATED )
{
m_pEmitter = CSimpleEmitter::Create( "C_ObjectEMPGenerator" );
m_hParticleMaterial = m_pEmitter->GetPMaterial( "sprites/chargeball" );
}
}
示例8: MuzzleFlash_Chopper
//-----------------------------------------------------------------------------
// Chopper muzzle flashes
//-----------------------------------------------------------------------------
void MuzzleFlash_Chopper( ClientEntityHandle_t hEntity, int attachmentIndex )
{
VPROF_BUDGET( "MuzzleFlash_Chopper", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
matrix3x4_t matAttachment;
// If the client hasn't seen this entity yet, bail.
if ( !FX_GetAttachmentTransform( hEntity, attachmentIndex, matAttachment ) )
return;
CSmartPtr<CLocalSpaceEmitter> pSimple = CLocalSpaceEmitter::Create( "MuzzleFlash", hEntity, attachmentIndex );
SimpleParticle *pParticle;
Vector forward(1,0,0), offset; //NOTENOTE: All coords are in local space
float flScale = random->RandomFloat( 2.5f, 4.5f );
// Flash
for ( int i = 1; i < 7; i++ )
{
offset = (forward * (i*2.0f*flScale));
pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), pSimple->GetPMaterial( VarArgs( "effects/combinemuzzle%d", random->RandomInt(1,2) ) ), offset );
if ( pParticle == NULL )
return;
pParticle->m_flLifetime = 0.0f;
pParticle->m_flDieTime = random->RandomFloat( 0.05f, 0.1f );
pParticle->m_vecVelocity.Init();
pParticle->m_uchColor[0] = 255;
pParticle->m_uchColor[1] = 255;
pParticle->m_uchColor[2] = 255;
pParticle->m_uchStartAlpha = 255;
pParticle->m_uchEndAlpha = 128;
pParticle->m_uchStartSize = ( (random->RandomFloat( 6.0f, 8.0f ) * (10-(i))/7) * flScale );
pParticle->m_uchEndSize = pParticle->m_uchStartSize;
pParticle->m_flRoll = random->RandomInt( 0, 360 );
pParticle->m_flRollDelta = 0.0f;
}
// Grab the origin out of the transform for the attachment
Vector origin;
MatrixGetColumn( matAttachment, 3, &origin );
CreateMuzzleflashELight( origin, 6, 128, 256, hEntity );
}
示例9: ClientThink
//------------------------------------------------------------------------------
// Purpose :
// Input :
// Output :
//------------------------------------------------------------------------------
void C_PlasmaBeamNode::ClientThink(void)
{
if (!m_bSprayOn)
{
return;
}
trace_t trace;
Vector vEndTrace = GetAbsOrigin() + (0.3*GetAbsVelocity());
UTIL_TraceLine( GetAbsOrigin(), vEndTrace, MASK_SHOT, NULL, COLLISION_GROUP_NONE, &trace );
if ( trace.fraction != 1.0f || trace.startsolid)
{
m_bSprayOn = false;
return;
}
PMaterialHandle handle = m_pFirePlasmaSpray->GetPMaterial( "sprites/plasmaember" );
for (int i=0;i<SPRAYS_PER_THINK;i++)
{
SimpleParticle *sParticle;
//Make a new particle
if ( random->RandomInt( 0, 2 ) == 0 )
{
float ranx = random->RandomFloat( -28.0f, 28.0f );
float rany = random->RandomFloat( -28.0f, 28.0f );
float ranz = random->RandomFloat( -28.0f, 28.0f );
Vector vNewPos = GetAbsOrigin();
Vector vAdd = Vector(GetAbsAngles().x,GetAbsAngles().y,GetAbsAngles().z)*random->RandomFloat(-60,120);
vNewPos += vAdd;
sParticle = (SimpleParticle *) m_pFirePlasmaSpray->AddParticle( sizeof(SimpleParticle), handle, vNewPos );
sParticle->m_flLifetime = 0.0f;
sParticle->m_flDieTime = PLASMASPARK_LIFETIME;
sParticle->m_vecVelocity = GetAbsVelocity();
sParticle->m_vecVelocity.x += ranx;
sParticle->m_vecVelocity.y += rany;
sParticle->m_vecVelocity.z += ranz;
m_pFirePlasmaSpray->m_pOwner = this;
}
}
SetNextClientThink(gpGlobals->curtime + 0.05);
}
示例10: AddRisingParticles
//-----------------------------------------------------------------------------
// Purpose:
// Input : flPerc -
//-----------------------------------------------------------------------------
void C_MortarShell::AddRisingParticles( float flPerc )
{
SimpleParticle *sParticle;
Vector offset;
float radius = m_flRadius * 0.25f * flPerc;
float val = RemapValClamped( gpGlobals->curtime, m_flStarttime, m_flStarttime + m_flLifespan, 0.0f, 1.0f );
float flCur = gpGlobals->frametime;
// Anime ground effects
while ( m_ParticleEvent.NextEvent( flCur ) )
{
offset.x = random->RandomFloat( -radius, radius );
offset.y = random->RandomFloat( -radius, radius );
offset.z = random->RandomFloat( -8.0f, 8.0f );
offset += GetAbsOrigin();
sParticle = (SimpleParticle *) m_pEmitter->AddParticle( sizeof(SimpleParticle), m_pEmitter->GetPMaterial( "effects/spark" ), offset );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = Vector( Helper_RandomFloat( -4.0f, 4.0f ), Helper_RandomFloat( -4.0f, 4.0f ), Helper_RandomFloat( 32.0f, 256.0f ) * Bias( val, 0.25f ) );
sParticle->m_uchStartSize = random->RandomFloat( 4, 8 ) * flPerc;
sParticle->m_flDieTime = random->RandomFloat( 0.5f, 1.0f );
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
float alpha = 255 * flPerc;
sParticle->m_flRollDelta = Helper_RandomFloat( -8.0f * flPerc, 8.0f * flPerc );
sParticle->m_uchColor[0] = alpha;
sParticle->m_uchColor[1] = alpha;
sParticle->m_uchColor[2] = alpha;
sParticle->m_uchStartAlpha = alpha;
sParticle->m_uchEndAlpha = 0;
sParticle->m_uchEndSize = 0;
}
}
示例11: ClientThink
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_EnvStarfield::ClientThink( void )
{
if ( !m_bOn || !m_flDensity )
return;
PMaterialHandle hParticleMaterial = m_pEmitter->GetPMaterial( "effects/spark_noz" );
// Find a start & end point for the particle
// Start particles straight ahead of the client
Vector vecViewOrigin = MainViewOrigin(engine->GetActiveSplitScreenPlayerSlot());
// Determine the number of particles
m_flNumParticles += 1.0 * (m_flDensity);
int iNumParticles = floor(m_flNumParticles);
m_flNumParticles -= iNumParticles;
// Add particles
for ( int i = 0; i < iNumParticles; i++ )
{
float flDiameter = cl_starfield_diameter.GetFloat();
Vector vecStart = vecViewOrigin + (MainViewForward(engine->GetActiveSplitScreenPlayerSlot()) * cl_starfield_distance.GetFloat() );
Vector vecEnd = vecViewOrigin + (MainViewRight(engine->GetActiveSplitScreenPlayerSlot()) * RandomFloat(-flDiameter,flDiameter)) + (MainViewUp(engine->GetActiveSplitScreenPlayerSlot()) * RandomFloat(-flDiameter,flDiameter));
Vector vecDir = (vecEnd - vecStart);
float flDistance = VectorNormalize( vecDir );
float flTravelTime = 2.0;
// Start a random amount along the path
vecStart += vecDir * ( RandomFloat(0.1,0.3) * flDistance );
TrailParticle *pParticle = (TrailParticle *) m_pEmitter->AddParticle( sizeof(TrailParticle), hParticleMaterial, vecStart );
if ( pParticle )
{
pParticle->m_vecVelocity = vecDir * (flDistance / flTravelTime);
pParticle->m_flDieTime = flTravelTime;
pParticle->m_flLifetime = 0;
pParticle->m_flWidth = RandomFloat( 1, 3 );
pParticle->m_flLength = RandomFloat( 0.05, 0.4 );
pParticle->m_color.r = 255;
pParticle->m_color.g = 255;
pParticle->m_color.b = 255;
pParticle->m_color.a = 255;
}
}
}
示例12: AddExplodingParticles
//-----------------------------------------------------------------------------
// Purpose:
// Input : flPerc -
//-----------------------------------------------------------------------------
void C_MortarShell::AddExplodingParticles( float flPerc )
{
SimpleParticle *sParticle;
Vector offset;
float radius = 48.0f * flPerc;
float flCur = gpGlobals->frametime;
// Anime ground effects
while ( m_ParticleEvent.NextEvent( flCur ) )
{
offset.x = random->RandomFloat( -radius, radius );
offset.y = random->RandomFloat( -radius, radius );
offset.z = random->RandomFloat( -8.0f, 8.0f );
offset += GetAbsOrigin();
sParticle = (SimpleParticle *) m_pEmitter->AddParticle( sizeof(SimpleParticle), m_pEmitter->GetPMaterial( "effects/spark" ), offset );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = RandomVector( -1.0f, 1.0f ) + Vector( 0, 0, 1 );
sParticle->m_vecVelocity *= ( 750.0f * flPerc );
sParticle->m_uchStartSize = random->RandomFloat( 2, 4 ) * flPerc;
sParticle->m_flDieTime = random->RandomFloat( 0.25f, 0.5f );
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
float alpha = 255 * flPerc;
sParticle->m_flRollDelta = Helper_RandomFloat( -8.0f * flPerc, 8.0f * flPerc );
sParticle->m_uchColor[0] = alpha;
sParticle->m_uchColor[1] = alpha;
sParticle->m_uchColor[2] = alpha;
sParticle->m_uchStartAlpha = alpha;
sParticle->m_uchEndAlpha = 0;
sParticle->m_uchEndSize = 0;
}
}
示例13: FX_GunshipMuzzleEffect
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void FX_GunshipMuzzleEffect( const Vector &origin, const QAngle &angles, float scale, ClientEntityHandle_t hEntity, unsigned char *pFlashColor )
{
VPROF_BUDGET( "FX_GunshipMuzzleEffect", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
CSmartPtr<CSimpleEmitter> pSimple = CSimpleEmitter::Create( "MuzzleFlash" );
pSimple->SetSortOrigin( origin );
SimpleParticle *pParticle;
Vector forward, offset;
AngleVectors( angles, &forward );
//
// Flash
//
offset = origin;
pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), pSimple->GetPMaterial( "effects/gunshipmuzzle" ), offset );
if ( pParticle == NULL )
return;
pParticle->m_flLifetime = 0.0f;
pParticle->m_flDieTime = 0.15f;
pParticle->m_vecVelocity.Init();
pParticle->m_uchStartSize = random->RandomFloat( 40.0, 50.0 );
pParticle->m_uchEndSize = pParticle->m_uchStartSize;
pParticle->m_flRoll = random->RandomInt( 0, 360 );
pParticle->m_flRollDelta = 0.15f;
pParticle->m_uchColor[0] = 255;
pParticle->m_uchColor[1] = 255;
pParticle->m_uchColor[2] = 255;
pParticle->m_uchStartAlpha = 255;
pParticle->m_uchEndAlpha = 255;
}
示例14: FX_BuildWarpSuck
//-----------------------------------------------------------------------------
// Purpose: Warp effect that looks like it's sucking things to it
//-----------------------------------------------------------------------------
void FX_BuildWarpSuck( Vector &vecOrigin, QAngle &vecAngles, float flScale )
{
CSmartPtr<CTrailParticles> pEmitter = CTrailParticles::Create( "BuildWarpSuck" );
PMaterialHandle hParticleMaterial = pEmitter->GetPMaterial( "effects/bluespark" );
pEmitter->Setup( (Vector &) vecOrigin,
NULL,
0.0,
0,
64,
0,
0,
bitsPARTICLE_TRAIL_VELOCITY_DAMPEN | bitsPARTICLE_TRAIL_FADE );
// Add particles
int iNumParticles = 60;
for ( int i = 0; i < iNumParticles; i++ )
{
Vector vOffset = RandomVector( -1, 1 );
VectorNormalize( vOffset );
float flDistance = RandomFloat( 16, 64 ) * flScale;
Vector vPos = vecOrigin + (vOffset * flDistance);
TrailParticle *pParticle = (TrailParticle *) pEmitter->AddParticle( sizeof(TrailParticle), hParticleMaterial, vPos );
if ( pParticle )
{
float flSpeed = RandomFloat(8,16) * (flScale * flScale * flScale);
pParticle->m_vecVelocity = vOffset * -flSpeed;
pParticle->m_flDieTime = min( 3, (flDistance / flSpeed) + RandomFloat(0.0, 0.2) );
pParticle->m_flLifetime = 0;
pParticle->m_flWidth = RandomFloat( 2, 3 ) * flScale;
pParticle->m_flLength = RandomFloat( 1, 2 ) * flScale;
pParticle->m_color.r = 1.0f;
pParticle->m_color.g = 1.0f;
pParticle->m_color.b = 1.0f;
pParticle->m_color.a = 1.0f;
}
}
}
示例15: OnDataChanged
//-----------------------------------------------------------------------------
// Purpose: Called when data changes on the server
//-----------------------------------------------------------------------------
void C_Sparkler::OnDataChanged( DataUpdateType_t updateType )
{
// NOTE: We MUST call the base classes' implementation of this function
BaseClass::OnDataChanged( updateType );
// Setup our entity's particle system on creation
if ( updateType == DATA_UPDATE_CREATED )
{
// Creat the emitter
m_hEmitter = CSimpleEmitter::Create( "env_sparkler" );
// Obtain a reference handle to our particle's desired material
if ( m_hEmitter.IsValid() )
{
m_hMaterial = m_hEmitter->GetPMaterial( "effects/yellowflare" );
}
// Spawn 128 particles per second
m_tParticleTimer.Init( 128 );
// Call our ClientThink() function once every client frame
SetNextClientThink( CLIENT_THINK_ALWAYS );
}
}