本文整理汇总了C++中CSmartPtr::SetClipHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPtr::SetClipHeight方法的具体用法?C++ CSmartPtr::SetClipHeight怎么用?C++ CSmartPtr::SetClipHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPtr
的用法示例。
在下文中一共展示了CSmartPtr::SetClipHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateMisc
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_WaterExplosionEffect::CreateMisc( void )
{
Vector offset;
float colorRamp;
int i;
float flScale = 2.0f;
PMaterialHandle hMaterial = ParticleMgr()->GetPMaterial( "effects/splash2" );
#ifndef _XBOX
int numDrops = 32;
float length = 0.1f;
Vector vForward, vRight, vUp;
Vector offDir;
TrailParticle *tParticle;
CSmartPtr<CTrailParticles> sparkEmitter = CTrailParticles::Create( "splash" );
if ( !sparkEmitter )
return;
sparkEmitter->SetSortOrigin( m_vecWaterSurface );
sparkEmitter->m_ParticleCollision.SetGravity( 800.0f );
sparkEmitter->SetFlag( bitsPARTICLE_TRAIL_VELOCITY_DAMPEN );
sparkEmitter->SetVelocityDampen( 2.0f );
//Dump out drops
for ( i = 0; i < numDrops; i++ )
{
offset = m_vecWaterSurface;
offset[0] += random->RandomFloat( -16.0f, 16.0f ) * flScale;
offset[1] += random->RandomFloat( -16.0f, 16.0f ) * flScale;
tParticle = (TrailParticle *) sparkEmitter->AddParticle( sizeof(TrailParticle), hMaterial, offset );
if ( tParticle == NULL )
break;
tParticle->m_flLifetime = 0.0f;
tParticle->m_flDieTime = random->RandomFloat( 0.5f, 1.0f );
offDir = Vector(0,0,1) + RandomVector( -1.0f, 1.0f );
tParticle->m_vecVelocity = offDir * random->RandomFloat( 50.0f * flScale * 2.0f, 100.0f * flScale * 2.0f );
tParticle->m_vecVelocity[2] += random->RandomFloat( 32.0f, 128.0f ) * flScale;
tParticle->m_flWidth = clamp( random->RandomFloat( 1.0f, 3.0f ) * flScale, 0.1f, 4.0f );
tParticle->m_flLength = random->RandomFloat( length*0.25f, length )/* * flScale*/;
colorRamp = random->RandomFloat( 1.5f, 2.0f );
FloatToColor32( tParticle->m_color, min( 1.0f, m_vecColor[0] * colorRamp ), min( 1.0f, m_vecColor[1] * colorRamp ), min( 1.0f, m_vecColor[2] * colorRamp ), m_flLuminosity );
}
//Dump out drops
for ( i = 0; i < 4; i++ )
{
offset = m_vecWaterSurface;
offset[0] += random->RandomFloat( -16.0f, 16.0f ) * flScale;
offset[1] += random->RandomFloat( -16.0f, 16.0f ) * flScale;
tParticle = (TrailParticle *) sparkEmitter->AddParticle( sizeof(TrailParticle), hMaterial, offset );
if ( tParticle == NULL )
break;
tParticle->m_flLifetime = 0.0f;
tParticle->m_flDieTime = random->RandomFloat( 0.5f, 1.0f );
offDir = Vector(0,0,1) + RandomVector( -0.2f, 0.2f );
tParticle->m_vecVelocity = offDir * random->RandomFloat( 50 * flScale * 3.0f, 100 * flScale * 3.0f );
tParticle->m_vecVelocity[2] += random->RandomFloat( 32.0f, 128.0f ) * flScale;
tParticle->m_flWidth = clamp( random->RandomFloat( 2.0f, 3.0f ) * flScale, 0.1f, 4.0f );
tParticle->m_flLength = random->RandomFloat( length*0.25f, length )/* * flScale*/;
colorRamp = random->RandomFloat( 1.5f, 2.0f );
FloatToColor32( tParticle->m_color, min( 1.0f, m_vecColor[0] * colorRamp ), min( 1.0f, m_vecColor[1] * colorRamp ), min( 1.0f, m_vecColor[2] * colorRamp ), m_flLuminosity );
}
#endif
CSmartPtr<CSplashParticle> pSimple = CSplashParticle::Create( "splish" );
pSimple->SetSortOrigin( m_vecWaterSurface );
pSimple->SetClipHeight( m_vecWaterSurface.z );
pSimple->GetBinding().SetBBox( m_vecWaterSurface-(Vector(32.0f, 32.0f, 32.0f)*flScale), m_vecWaterSurface+(Vector(32.0f, 32.0f, 32.0f)*flScale) );
SimpleParticle *pParticle;
for ( i = 0; i < 16; i++ )
{
pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), hMaterial, m_vecWaterSurface );
//.........这里部分代码省略.........
示例2: FX_GunshotSlimeSplash
//-----------------------------------------------------------------------------
// Purpose:
// Input : &origin -
// &normal -
// scale -
// *pColor -
//-----------------------------------------------------------------------------
void FX_GunshotSlimeSplash( const Vector &origin, const Vector &normal, float scale )
{
if ( cl_show_splashes.GetBool() == false )
return;
VPROF_BUDGET( "FX_GunshotSlimeSplash", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
float colorRamp;
float flScale = MIN( 1.0f, scale / 8.0f );
PMaterialHandle hMaterial = ParticleMgr()->GetPMaterial( "effects/slime1" );
PMaterialHandle hMaterial2 = ParticleMgr()->GetPMaterial( "effects/splash4" );
Vector color;
float luminosity;
// Get our lighting information
FX_GetSplashLighting( origin + ( normal * scale ), &color, &luminosity );
Vector offDir;
Vector offset;
TrailParticle *tParticle;
CSmartPtr<CTrailParticles> sparkEmitter = CTrailParticles::Create( "splash" );
if ( !sparkEmitter )
return;
sparkEmitter->SetSortOrigin( origin );
sparkEmitter->m_ParticleCollision.SetGravity( 800.0f );
sparkEmitter->SetFlag( bitsPARTICLE_TRAIL_VELOCITY_DAMPEN );
sparkEmitter->SetVelocityDampen( 2.0f );
if ( IsXbox() )
{
sparkEmitter->GetBinding().SetBBox( origin - Vector( 32, 32, 64 ), origin + Vector( 32, 32, 64 ) );
}
//Dump out drops
for ( int i = 0; i < 24; i++ )
{
offset = origin;
offset[0] += random->RandomFloat( -16.0f, 16.0f ) * flScale;
offset[1] += random->RandomFloat( -16.0f, 16.0f ) * flScale;
tParticle = (TrailParticle *) sparkEmitter->AddParticle( sizeof(TrailParticle), hMaterial, offset );
if ( tParticle == NULL )
break;
tParticle->m_flLifetime = 0.0f;
tParticle->m_flDieTime = random->RandomFloat( 0.25f, 0.5f );
offDir = normal + RandomVector( -0.6f, 0.6f );
tParticle->m_vecVelocity = offDir * random->RandomFloat( SPLASH_MIN_SPEED * flScale * 3.0f, SPLASH_MAX_SPEED * flScale * 3.0f );
tParticle->m_vecVelocity[2] += random->RandomFloat( 32.0f, 64.0f ) * flScale;
tParticle->m_flWidth = random->RandomFloat( 3.0f, 6.0f ) * flScale;
tParticle->m_flLength = random->RandomFloat( 0.025f, 0.05f ) * flScale;
colorRamp = random->RandomFloat( 0.75f, 1.25f );
tParticle->m_color.r = MIN( 1.0f, color.x * colorRamp ) * 255;
tParticle->m_color.g = MIN( 1.0f, color.y * colorRamp ) * 255;
tParticle->m_color.b = MIN( 1.0f, color.z * colorRamp ) * 255;
tParticle->m_color.a = 255 * luminosity;
}
// Setup splash emitter
CSmartPtr<CSplashParticle> pSimple = CSplashParticle::Create( "splish" );
pSimple->SetSortOrigin( origin );
pSimple->SetClipHeight( origin.z );
pSimple->SetParticleCullRadius( scale * 2.0f );
if ( IsXbox() )
{
pSimple->GetBinding().SetBBox( origin - Vector( 32, 32, 64 ), origin + Vector( 32, 32, 64 ) );
}
SimpleParticle *pParticle;
// Tint
colorRamp = random->RandomFloat( 0.75f, 1.0f );
color = Vector( 1.0f, 0.8f, 0.0f ) * color * colorRamp;
//Main gout
for ( int i = 0; i < 8; i++ )
{
pParticle = (SimpleParticle *) pSimple->AddParticle( sizeof( SimpleParticle ), hMaterial2, origin );
if ( pParticle == NULL )
break;
//.........这里部分代码省略.........