本文整理汇总了C++中CSmartPtr::SetAttractorOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPtr::SetAttractorOrigin方法的具体用法?C++ CSmartPtr::SetAttractorOrigin怎么用?C++ CSmartPtr::SetAttractorOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPtr
的用法示例。
在下文中一共展示了CSmartPtr::SetAttractorOrigin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateParticles_Active
void C_EnvPortalPathTrack::UpdateParticles_Active ( void )
{
// Emitters must be valid
if ( SetupEmitters() == false )
return;
// Reset our sort origin
m_pSimpleEmitter->SetSortOrigin( GetAbsOrigin() );
SimpleParticle *sParticle;
// Do the charging particles
m_pAttractorEmitter->SetAttractorOrigin( GetAbsOrigin() );
Vector forward, right, up;
AngleVectors( GetAbsAngles(), &forward, &right, &up );
Vector offset;
float dist;
int numParticles = floor( 4.0f );
for ( int i = 0; i < numParticles; i++ )
{
dist = random->RandomFloat( 4.0f, 64.0f );
offset = forward * dist;
dist = RemapValClamped( dist, 4.0f, 64.0f, 6.0f, 1.0f );
offset += right * random->RandomFloat( -4.0f * dist, 4.0f * dist );
offset += up * random->RandomFloat( -4.0f * dist, 4.0f * dist );
offset += GetAbsOrigin();
sParticle = (SimpleParticle *) m_pAttractorEmitter->AddParticle( sizeof(SimpleParticle), m_pAttractorEmitter->GetPMaterial( "effects/strider_muzzle" ), offset );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = Vector(0,0,8);
sParticle->m_flDieTime = 0.5f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
float alpha = 255;
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_uchStartSize = random->RandomFloat( 1, 2 );
sParticle->m_uchEndSize = 0;
}
}
示例2: DrawModel
//.........这里部分代码省略.........
sParticle->m_uchColor[1] = alpha;
sParticle->m_uchColor[2] = alpha;
sParticle->m_uchStartAlpha = alpha;
sParticle->m_uchEndAlpha = 0;
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 2;
}
}
}
}
int attachment = LookupAttachment( "core" );
Vector coreOrigin;
QAngle coreAngles;
GetAttachment( attachment, coreOrigin, coreAngles );
SimpleParticle *sParticle;
// Do the core effects
for ( int i = 0; i < 4; i++ )
{
sParticle = (SimpleParticle *) m_pLocalEmitter->AddParticle( sizeof(SimpleParticle), m_pLocalEmitter->GetPMaterial( "effects/strider_muzzle" ), vec3_origin );
if ( sParticle == NULL )
return 1;
sParticle->m_vecVelocity = vec3_origin;
sParticle->m_flDieTime = 0.1f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
float alpha = 255;
sParticle->m_uchColor[0] = alpha;
sParticle->m_uchColor[1] = alpha;
sParticle->m_uchColor[2] = alpha;
sParticle->m_uchStartAlpha = alpha;
sParticle->m_uchEndAlpha = 0;
if ( i < 2 )
{
sParticle->m_uchStartSize = random->RandomFloat( 1, 2 ) * (i+1);
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 2.0f;
}
else
{
if ( random->RandomInt( 0, 20 ) == 0 )
{
sParticle->m_uchStartSize = random->RandomFloat( 1, 2 ) * (i+1);
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 4.0f;
sParticle->m_flDieTime = 0.25f;
}
else
{
sParticle->m_uchStartSize = random->RandomFloat( 1, 2 ) * (i+1);
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 2.0f;
}
}
}
if ( m_bWasUpgraded && m_bIsCurrentlyUpgrading )
{
// Update our attractor point
m_pAttractor->SetAttractorOrigin( coreOrigin );
Vector offset;
for ( int i = 0; i < 4; i++ )
{
offset = coreOrigin + RandomVector( -32.0f, 32.0f );
sParticle = (SimpleParticle *) m_pAttractor->AddParticle( sizeof(SimpleParticle), m_pAttractor->GetPMaterial( "effects/strider_muzzle" ), offset );
if ( sParticle == NULL )
return 1;
sParticle->m_vecVelocity = Vector(0,0,8);
sParticle->m_flDieTime = 0.5f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
float alpha = 255;
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_uchStartSize = random->RandomFloat( 1, 2 );
sParticle->m_uchEndSize = 0;
}
}
return BaseClass::DrawModel( flags );
}
示例3: AddParticles
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_HopwireExplosion::AddParticles( void )
{
// Make sure the emitters are setup properly
if ( SetupEmitters() == false )
return;
float tempDelta = gpGlobals->frametime;
while( m_ParticleTimer.NextEvent( tempDelta ) )
{
// ========================
// Attracted dust particles
// ========================
// Update our attractor point
m_pAttractorEmitter->SetAttractorOrigin( GetRenderOrigin() );
Vector offset;
SimpleParticle *sParticle;
offset = GetRenderOrigin() + RandomVector( -256.0f, 256.0f );
sParticle = (SimpleParticle *) m_pAttractorEmitter->AddParticle( sizeof(SimpleParticle), g_Mat_Fleck_Cement[0], offset );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = Vector(0,0,8);
sParticle->m_flDieTime = 0.5f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 1.0f;
float alpha = random->RandomFloat( 128.0f, 200.0f );
sParticle->m_uchColor[0] = alpha;
sParticle->m_uchColor[1] = alpha;
sParticle->m_uchColor[2] = alpha;
sParticle->m_uchStartAlpha = alpha;
sParticle->m_uchEndAlpha = alpha;
sParticle->m_uchStartSize = random->RandomInt( 1, 4 );
sParticle->m_uchEndSize = 0;
// ========================
// Core effects
// ========================
// Reset our sort origin
m_pSimpleEmitter->SetSortOrigin( GetRenderOrigin() );
// Base of the core effect
sParticle = (SimpleParticle *) m_pSimpleEmitter->AddParticle( sizeof(SimpleParticle), m_pSimpleEmitter->GetPMaterial( "effects/strider_muzzle" ), GetRenderOrigin() );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = vec3_origin;
sParticle->m_flDieTime = 0.2f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 4.0f;
alpha = random->RandomInt( 32, 200 );
sParticle->m_uchColor[0] = alpha;
sParticle->m_uchColor[1] = alpha;
sParticle->m_uchColor[2] = alpha;
sParticle->m_uchStartAlpha = 0;
sParticle->m_uchEndAlpha = alpha;
sParticle->m_uchStartSize = 255;
sParticle->m_uchEndSize = 0;
// Make sure we encompass the complete particle here!
m_pSimpleEmitter->SetParticleCullRadius( sParticle->m_uchEndSize );
// =========================
// Dust ring effect
// =========================
if ( random->RandomInt( 0, 5 ) != 1 )
return;
Vector vecDustColor;
vecDustColor.x = 0.35f;
vecDustColor.y = 0.3f;
vecDustColor.z = 0.25f;
Vector color;
int numRingSprites = 8;
float yaw;
Vector forward, vRight, vForward;
vForward = Vector( 0, 1, 0 );
//.........这里部分代码省略.........
示例4: UpdateDischarging
//.........这里部分代码省略.........
// Base of the core effect
sParticle = (SimpleParticle *) m_pSimpleEmitter->AddParticle( sizeof(SimpleParticle), m_pSimpleEmitter->GetPMaterial( EMP_PARTICLES ), GetAbsOrigin() );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = vec3_origin;
sParticle->m_flDieTime = 0.1f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
alpha = 128;
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_uchStartSize = 0.0f;
sParticle->m_uchEndSize = flScale * 2.0f;
// Make sure we encompass the complete particle here!
m_pSimpleEmitter->SetParticleCullRadius( sParticle->m_uchEndSize );
// Do the core effects
sParticle = (SimpleParticle *) m_pSimpleEmitter->AddParticle( sizeof(SimpleParticle), m_pSimpleEmitter->GetPMaterial( EMP_PARTICLES ), GetAbsOrigin() );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = RandomVector( -32.0f, 32.0f );
sParticle->m_flDieTime = 0.2f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
alpha = 255;
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_uchStartSize = flScale;
sParticle->m_uchEndSize = 0.0f;
}
#if 0
// Do the charging particles
m_pAttractorEmitter->SetAttractorOrigin( GetAbsOrigin() );
Vector offset;
float dist;
for ( i = 0; i < 4; i++ )
{
dist = random->RandomFloat( 4.0f, 64.0f );
offset = forward * dist;
dist = RemapValClamped( dist, 4.0f, 64.0f, 6.0f, 1.0f );
offset += right * random->RandomFloat( -2.0f * dist, 2.0f * dist );
offset += up * random->RandomFloat( -2.0f * dist, 2.0f * dist );
offset += GetAbsOrigin();
sParticle = (SimpleParticle *) m_pAttractorEmitter->AddParticle( sizeof(SimpleParticle), m_pAttractorEmitter->GetPMaterial( "effects/combinemuzzle2_dark" ), offset );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = Vector(0,0,2);
sParticle->m_flDieTime = 0.5f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
float alpha = 255;
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_uchStartSize = 1;
sParticle->m_uchEndSize = 0;
}
#endif
}
示例5: UpdateCharging
//-----------------------------------------------------------------------------
// Purpose:
// Input : percentage -
//-----------------------------------------------------------------------------
void C_AlyxEmpEffect::UpdateCharging( float percentage )
{
// Emitters must be valid
if ( SetupEmitters() == false )
return;
if ( percentage <= 0.0f )
return;
// Reset our sort origin
m_pSimpleEmitter->SetSortOrigin( GetAbsOrigin() );
float flScale = 4.0f * EMP_SCALE * percentage;
SimpleParticle *sParticle;
float dTime = gpGlobals->frametime;
while ( m_tParticleSpawn.NextEvent( dTime ) )
{
// Do the core effects
sParticle = (SimpleParticle *) m_pSimpleEmitter->AddParticle( sizeof(SimpleParticle), m_pSimpleEmitter->GetPMaterial( EMP_PARTICLES ), GetAbsOrigin() );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = vec3_origin;
sParticle->m_flDieTime = 0.1f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
float alpha = 255 * percentage;
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_uchStartSize = flScale;
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 2.0f;
}
#if 0
// Do the charging particles
m_pAttractorEmitter->SetAttractorOrigin( GetAbsOrigin() );
Vector forward, right, up;
AngleVectors( GetAbsAngles(), &forward, &right, &up );
Vector offset;
float dist;
int numParticles = floor( 4.0f * percentage );
for ( i = 0; i < numParticles; i++ )
{
dist = random->RandomFloat( 4.0f * percentage, 64.0f * percentage );
offset = forward * dist;
dist = RemapValClamped( dist, 4.0f * percentage, 64.0f * percentage, 6.0f, 1.0f );
offset += right * random->RandomFloat( -4.0f * dist, 4.0f * dist );
offset += up * random->RandomFloat( -4.0f * dist, 4.0f * dist );
offset += GetAbsOrigin();
sParticle = (SimpleParticle *) m_pAttractorEmitter->AddParticle( sizeof(SimpleParticle), m_pAttractorEmitter->GetPMaterial( EMP_PARTICLES ), offset );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = Vector(0,0,8);
sParticle->m_flDieTime = 0.5f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
float alpha = 255 * percentage;
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_uchStartSize = random->RandomFloat( 1, 2 );
sParticle->m_uchEndSize = 0;
}
#endif
//.........这里部分代码省略.........
示例6: UpdateDischarging
//-----------------------------------------------------------------------------
// Purpose:
// Input : percentage -
//-----------------------------------------------------------------------------
void C_CitadelEnergyCore::UpdateDischarging( void )
{
// Emitters must be valid
if ( SetupEmitters() == false )
return;
// Reset our sort origin
m_pSimpleEmitter->SetSortOrigin( GetAbsOrigin() );
float flScale = 8.0f * m_flScale;
Vector forward, right, up;
AngleVectors( GetAbsAngles(), &forward, &right, &up );
SimpleParticle *sParticle;
// Base of the core effect
sParticle = (SimpleParticle *) m_pSimpleEmitter->AddParticle( sizeof(SimpleParticle), m_pSimpleEmitter->GetPMaterial( "effects/strider_muzzle" ), GetAbsOrigin() );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = forward * 32.0f;
sParticle->m_flDieTime = 0.2f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
float alpha = 128;
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_uchStartSize = flScale * 2.0f;
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 2.0f;
// Make sure we encompass the complete particle here!
m_pSimpleEmitter->SetParticleCullRadius( sParticle->m_uchEndSize );
// Do the core effects
for ( int i = 0; i < 2; i++ )
{
sParticle = (SimpleParticle *) m_pSimpleEmitter->AddParticle( sizeof(SimpleParticle), m_pSimpleEmitter->GetPMaterial( "effects/combinemuzzle2" ), GetAbsOrigin() );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = forward * ( 32.0f * (i+1) );
sParticle->m_flDieTime = 0.2f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
float alpha = 100;
sParticle->m_uchColor[0] = alpha;
sParticle->m_uchColor[1] = alpha;
sParticle->m_uchColor[2] = alpha;
sParticle->m_uchStartAlpha = alpha;
sParticle->m_uchEndAlpha = 0;
if ( i < 1 )
{
sParticle->m_uchStartSize = flScale * (i+1);
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 2.0f;
}
else
{
if ( random->RandomInt( 0, 20 ) == 0 )
{
sParticle->m_uchStartSize = flScale * (i+1);
sParticle->m_uchEndSize = 0.0f;
sParticle->m_flDieTime = 0.25f;
}
else
{
sParticle->m_uchStartSize = flScale * (i+1);
sParticle->m_uchEndSize = 0.0f;
}
}
}
// Only do these particles if required
if ( m_spawnflags & SF_ENERGYCORE_NO_PARTICLES )
return;
// Do the charging particles
m_pAttractorEmitter->SetAttractorOrigin( GetAbsOrigin() );
Vector offset;
float dist;
//.........这里部分代码省略.........
示例7: UpdateCharging
//-----------------------------------------------------------------------------
// Purpose:
// Input : percentage -
//-----------------------------------------------------------------------------
void C_CitadelEnergyCore::UpdateCharging( float percentage )
{
// Emitters must be valid
if ( SetupEmitters() == false )
return;
if ( percentage <= 0.0f )
return;
// Reset our sort origin
m_pSimpleEmitter->SetSortOrigin( GetAbsOrigin() );
float flScale = 4.0f * m_flScale * percentage;
SimpleParticle *sParticle;
// Do the core effects
for ( int i = 0; i < 2; i++ )
{
sParticle = (SimpleParticle *) m_pSimpleEmitter->AddParticle( sizeof(SimpleParticle), m_pSimpleEmitter->GetPMaterial( "effects/strider_muzzle" ), GetAbsOrigin() );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = vec3_origin;
sParticle->m_flDieTime = 0.1f;
sParticle->m_flLifetime = 0.0f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = 0.0f;
float alpha = 255;
sParticle->m_uchColor[0] = alpha;
sParticle->m_uchColor[1] = alpha;
sParticle->m_uchColor[2] = alpha;
sParticle->m_uchStartAlpha = alpha;
sParticle->m_uchEndAlpha = 0;
if ( i < 2 )
{
sParticle->m_uchStartSize = flScale * (i+1);
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 2.0f;
}
else
{
if ( random->RandomInt( 0, 20 ) == 0 )
{
sParticle->m_uchStartSize = flScale * (i+1);
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 4.0f;
sParticle->m_flDieTime = 0.25f;
}
else
{
sParticle->m_uchStartSize = flScale * (i+1);
sParticle->m_uchEndSize = sParticle->m_uchStartSize * 2.0f;
}
}
}
// Only do these particles if required
if ( m_spawnflags & SF_ENERGYCORE_NO_PARTICLES )
return;
// Do the charging particles
m_pAttractorEmitter->SetAttractorOrigin( GetAbsOrigin() );
Vector forward, right, up;
AngleVectors( GetAbsAngles(), &forward, &right, &up );
Vector offset;
float dist;
int numParticles = floor( 4.0f * percentage );
for ( int i = 0; i < numParticles; i++ )
{
dist = random->RandomFloat( 4.0f * percentage, 64.0f * percentage );
offset = forward * dist;
dist = RemapValClamped( dist, 4.0f * percentage, 64.0f * percentage, 6.0f, 1.0f );
offset += right * random->RandomFloat( -4.0f * dist, 4.0f * dist );
offset += up * random->RandomFloat( -4.0f * dist, 4.0f * dist );
offset += GetAbsOrigin();
sParticle = (SimpleParticle *) m_pAttractorEmitter->AddParticle( sizeof(SimpleParticle), m_pAttractorEmitter->GetPMaterial( "effects/strider_muzzle" ), offset );
if ( sParticle == NULL )
return;
sParticle->m_vecVelocity = Vector(0,0,8);
sParticle->m_flDieTime = 0.5f;
sParticle->m_flLifetime = 0.0f;
//.........这里部分代码省略.........