本文整理汇总了C++中ParticleSystem::drawInstance方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSystem::drawInstance方法的具体用法?C++ ParticleSystem::drawInstance怎么用?C++ ParticleSystem::drawInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleSystem
的用法示例。
在下文中一共展示了ParticleSystem::drawInstance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderSelection
//.........这里部分代码省略.........
Vector3 vRenderOrigin = GetRenderOrigin();
int nPSInstancesCount = 0; // statistic:number of particles instances
int nParticlesCount = 0; // statistic:number of particles
SceneState::List_ParticleSystemPtr_Type::iterator itCurCP;
for (itCurCP = sceneState.listParticleSystems.begin(); itCurCP != sceneState.listParticleSystems.end();)
{
ParticleSystem* PS = (*itCurCP).get();
map <void*, ParticleList*>& instances = PS->m_instances;
map<void*, ParticleList*>::iterator iter;
bool bHasInstance = false;
for (iter = instances.begin(); iter!=instances.end();)
{
ParticleList* instancePS = iter->second;
if(instancePS->m_pSceneState == (&sceneState))
{
bHasInstance = true;
}
else
{
++iter;
continue;
}
if(instancePS->m_bUpdated == false)
{
if(instancePS->m_bUseAbsCord)
{ /// for globally un-updated instances, animate the remaining particles
Vector3 vRenderOriginOffset = (instancePS->m_vLastRenderOrigin) - vRenderOrigin;
instancePS->m_vLastRenderOrigin = (vRenderOrigin);// update render origin
if(PS->AnimateExistingParticles((float)dTimeDelta, vRenderOriginOffset, instancePS))
{
if(!bEffectSet){
CGlobals::GetEffectManager()->BeginEffect(TECH_PARTICLES, &(sceneState.m_pCurrentEffect));
bEffectSet = true;
}
PS->drawInstance(instancePS);
if(CGlobals::WillGenReport())
nParticlesCount += (int)instancePS->particles.size();
++iter;
}
else
{
// delete the particle system instance, if there is no particle instances left.
SAFE_DELETE(instancePS) ;
iter = instances.erase(iter);
}
}
else
{
/// for local un-updated instances, delete the instance.
SAFE_DELETE(instancePS) ;
iter = instances.erase(iter);
}
}
else
{
instancePS->m_bUpdated = false;
if(instancePS->m_bUseAbsCord)
{ /// for globally updated instances, just draw it.
if(instancePS->m_bRender)
{
if(!bEffectSet){
CGlobals::GetEffectManager()->BeginEffect(TECH_PARTICLES, &(sceneState.m_pCurrentEffect));
bEffectSet = true;
}
PS->drawInstance(instancePS);
instancePS->m_bRender = false;
if(CGlobals::WillGenReport())
nParticlesCount += (int)instancePS->particles.size();
}
++iter;
}
else
{
/// for local updated instances, ignore it, since it has already been draw with the model to which it is attached.
++iter;
if(CGlobals::WillGenReport())
nParticlesCount += (int)instancePS->particles.size();
}
}
}
// erase particle system from the list if there is no instance left.
if(!bHasInstance)
itCurCP = sceneState.listParticleSystems.erase(itCurCP);
else
{
++ itCurCP;
if(CGlobals::WillGenReport())
nPSInstancesCount += (int)instances.size();
}
}
nObjCount = nParticlesCount;
}
return nObjCount;
}