void C_SmokeStack::RenderParticles( CParticleRenderIterator *pIterator ) { const SmokeStackParticle *pParticle = (const SmokeStackParticle*)pIterator->GetFirst(); while ( pParticle ) { // Transform. Vector tPos; TransformParticle( m_pParticleMgr->GetModelView(), pParticle->m_Pos, tPos ); // Figure out its alpha. Squaring it after it gets halfway through its lifetime // makes it get translucent and fade out for a longer time. //float alpha = cosf( -M_PI_F + tLifetime * M_PI_F * 2.f ) * 0.5f + 0.5f; float tLifetime = pParticle->m_Lifetime * m_InvLifetime; float alpha = TableCos( -M_PI_F + tLifetime * M_PI_F * 2.f ) * 0.5f + 0.5f; if( tLifetime > 0.5f ) alpha *= alpha; m_Renderer.RenderParticle( pIterator->GetParticleDraw(), pParticle->m_Pos, tPos, alpha * m_flAlphaScale, FLerp(m_StartSize, m_EndSize, tLifetime), DEG2RAD( pParticle->m_flAngle ) ); pParticle = (const SmokeStackParticle*)pIterator->GetNext( pParticle->m_flSortPos ); } }