本文整理汇总了C++中CSmartPtr::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPtr::Release方法的具体用法?C++ CSmartPtr::Release怎么用?C++ CSmartPtr::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPtr
的用法示例。
在下文中一共展示了CSmartPtr::Release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddFlames
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_FireSmoke::AddFlames( void )
{
#if PARTICLE_FIRE
if ( ( gpGlobals->frametime != 0.0f ) && ( m_flScaleRegister > 0.0f ) )
{
Vector offset;
float scalar;
scalar = 32.0f*m_flScaleRegister;
offset[0] = Helper_RandomFloat( -scalar, scalar );
offset[1] = Helper_RandomFloat( -scalar, scalar );
offset[2] = 0.0f;
CSmartPtr<CSimpleEmitter> pEmitter = CSimpleEmitter::Create( "C_FireSmoke" );
pEmitter->SetSortOrigin( GetAbsOrigin()+offset );
SimpleParticle *sParticle;
//for ( int i = 0; i < 1; i++ )
{
scalar = 32.0f*m_flScaleRegister;
offset[0] = Helper_RandomFloat( -scalar, scalar );
offset[1] = Helper_RandomFloat( -scalar, scalar );
offset[2] = 12.0f*m_flScaleRegister;
sParticle = (SimpleParticle *) pEmitter->AddParticle( sizeof(SimpleParticle), pEmitter->GetPMaterial( VarArgs("sprites/flamelet%d", Helper_RandomInt( 1, 5 ) ) ), GetAbsOrigin()+offset );
if ( sParticle )
{
sParticle->m_flLifetime = 0.0f;
sParticle->m_flDieTime = 0.25f;
sParticle->m_flRoll = Helper_RandomInt( 0, 360 );
sParticle->m_flRollDelta = Helper_RandomFloat( -4.0f, 4.0f );
float alpha = Helper_RandomInt( 128, 255 );
sParticle->m_uchColor[0] = alpha;
sParticle->m_uchColor[1] = alpha;
sParticle->m_uchColor[2] = alpha;
sParticle->m_uchStartAlpha = 255;
sParticle->m_uchEndAlpha = 0;
sParticle->m_uchStartSize = 64.0f*m_flScaleRegister;
sParticle->m_uchEndSize = 0;
float speedScale = ((GetAbsOrigin()+offset)-GetAbsOrigin()).Length2D() / (32.0f*m_flScaleRegister);
sParticle->m_vecVelocity = Vector( Helper_RandomFloat( -32.0f, 32.0f ), Helper_RandomFloat( -32.0f, 32.0f ), Helper_RandomFloat( 32.0f, 128.0f )*speedScale );
}
}
pEmitter->Release();
}
#endif
//#if !PARTICLE_FIRE
float alpha = 1.0f;
//Update the child flame alpha
for ( int i = 0; i < NUM_CHILD_FLAMES; i++ )
{
if ( m_entFlames[i].GetScale() > 1e-3f )
{
m_entFlames[i].SetRenderColor( ( 255.0f * alpha ), ( 255.0f * alpha ), ( 255.0f * alpha ) );
m_entFlames[i].SetBrightness( 255.0f * alpha );
Assert( m_entFlames[i].GetRenderHandle() != INVALID_CLIENT_RENDER_HANDLE );
m_entFlames[i].AddToLeafSystem();
}
}
if ( m_nFlags & bitsFIRESMOKE_VISIBLE_FROM_ABOVE )
{
for ( int i = 0; i < NUM_CHILD_FLAMES; i++ )
{
if ( m_entFlamesFromAbove[i].GetScale() > 1e-3f )
{
m_entFlamesFromAbove[i].SetRenderColor( ( 255.0f * alpha ), ( 255.0f * alpha ), ( 255.0f * alpha ) );
m_entFlamesFromAbove[i].SetBrightness( 255.0f * alpha );
Assert( m_entFlamesFromAbove[i].GetRenderHandle() != INVALID_CLIENT_RENDER_HANDLE );
m_entFlamesFromAbove[i].AddToLeafSystem();
}
}
}
//#endif
}