当前位置: 首页>>代码示例>>C++>>正文


C++ CNewParticleEffect::DependsOnSystem方法代码示例

本文整理汇总了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] );
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:72,代码来源:entity_client_tools.cpp


注:本文中的CNewParticleEffect::DependsOnSystem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。