本文整理汇总了C++中CNewParticleEffect::DependsOnSystem方法的典型用法代码示例。如果您正苦于以下问题:C++ CNewParticleEffect::DependsOnSystem方法的具体用法?C++ CNewParticleEffect::DependsOnSystem怎么用?C++ CNewParticleEffect::DependsOnSystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNewParticleEffect
的用法示例。
在下文中一共展示了CNewParticleEffect::DependsOnSystem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReloadParticleDefintions
//-----------------------------------------------------------------------------
// Reload particle definitions
//-----------------------------------------------------------------------------
void CClientTools::ReloadParticleDefintions( const char *pFileName, const void *pBufData, int nLen )
{
MDLCACHE_CRITICAL_SECTION(); // Copying particle attachment control points may end up needing to evaluate skeletons
//////////////
// Find any systems that depend on any system in the buffer
// slow, but necessary if we want live reloads to work - and doesn't happen too often
CUtlVector<CUtlString> systemNamesToReload;
g_pParticleSystemMgr->GetParticleSystemsInBuffer( CUtlBuffer(pBufData, nLen, CUtlBuffer::READ_ONLY), &systemNamesToReload );
CUtlVector<CNewParticleEffect*> toReplaceEffects;
CUtlVector<CUtlString> toReplaceNames;
for( CNewParticleEffect *pEffect = ParticleMgr()->FirstNewEffect(); pEffect; pEffect = ParticleMgr()->NextNewEffect(pEffect) )
{
for( int i = 0; i < systemNamesToReload.Count(); ++i )
{
if ( pEffect->DependsOnSystem( systemNamesToReload[i] ) )
{
// only reload a given effect once
if ( -1 == toReplaceEffects.Find(pEffect) )
{
toReplaceNames.AddToTail( pEffect->GetName() );
toReplaceEffects.AddToTail( pEffect );
}
}
}
}
CUtlVector<CNonDrawingParticleSystem*> toReplaceEffectsNonDrawing;
CUtlVector<CUtlString> toReplaceNamesNonDrawing;
for( CNonDrawingParticleSystem *i = ParticleMgr()->m_NonDrawingParticleSystems.Head(); i ; i = i->m_pNext )
{
for( int j = 0; j < systemNamesToReload.Count(); ++j )
{
if ( i->Get()->DependsOnSystem( systemNamesToReload[j] ) )
{
if ( -1 == toReplaceEffectsNonDrawing.Find( i ) )
{
toReplaceNamesNonDrawing.AddToTail( i->Get()->GetName() );
toReplaceEffectsNonDrawing.AddToTail( i );
}
}
}
}
//////////////
// Load the data and stomp the old definitions
g_pParticleSystemMgr->ReadParticleConfigFile( CUtlBuffer(pBufData, nLen, CUtlBuffer::READ_ONLY), true );
//////////////
// Now replace all of the systems with their new versions
Assert( toReplaceEffects.Count() == toReplaceNames.Count() );
for( int i = 0; i < toReplaceNames.Count(); ++i )
{
CNewParticleEffect *pEffect = toReplaceEffects[i];
pEffect->ReplaceWith( toReplaceNames[i] );
}
// update all the non-drawings ones
for( int i = 0; i < toReplaceNamesNonDrawing.Count(); i++ )
{
CNonDrawingParticleSystem *pEffect = toReplaceEffectsNonDrawing[i];
delete pEffect->m_pSystem;
pEffect->m_pSystem = g_pParticleSystemMgr->CreateParticleCollection( toReplaceNamesNonDrawing[i] );
}
}