本文整理汇总了C++中ParticleEmitter::setEmitted方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEmitter::setEmitted方法的具体用法?C++ ParticleEmitter::setEmitted怎么用?C++ ParticleEmitter::setEmitted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter::setEmitted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialiseEmittedEmitterPool
void ParticleSystem::initialiseEmittedEmitterPool(void)
{
if (mEmittedEmitterPoolInitialised)
{
return;
}
// Run through mEmitters and add keys to the pool
ParticleEmitterList::iterator emitterIterator;
ParticleEmitterList::iterator emitterIteratorInner;
ParticleEmitter* emitter = 0;
ParticleEmitter* emitterInner = 0;
for (emitterIterator = mEmitters.begin(); emitterIterator != mEmitters.end(); ++emitterIterator)
{
// Determine the names of all emitters that are emitted
emitter = *emitterIterator ;
if (emitter && emitter->getEmittedEmitter() != BLANK)
{
// This one will be emitted, register its name and leave the vector empty!
EmittedEmitterList empty;
mEmittedEmitterPool.insert(make_pair(emitter->getEmittedEmitter(), empty));
}
// Determine whether the emitter itself will be emitted and set the 'mEmitted' attribute
for (emitterIteratorInner = mEmitters.begin(); emitterIteratorInner != mEmitters.end(); ++emitterIteratorInner)
{
emitterInner = *emitterIteratorInner;
if (emitter && emitterInner &&
emitter->getName() != BLANK &&
emitter->getName() == emitterInner->getEmittedEmitter())
{
emitter->setEmitted(true);
break;
}
else
{
// Set explicitly to 'false' although the default value is already 'false'
emitter->setEmitted(false);
}
}
}
mEmittedEmitterPoolInitialised = true;
}
示例2: increaseEmittedEmitterPool
void ParticleSystem::increaseEmittedEmitterPool(size_t size)
{
// Don't proceed if the pool doesn't contain any keys of emitted emitters
if (mEmittedEmitterPool.empty())
{
return;
}
EmittedEmitterPool::iterator emittedEmitterPoolIterator;
ParticleEmitterList::iterator emitterIterator;
ParticleEmitter* emitter = 0;
ParticleEmitter* clonedEmitter = 0;
String name = BLANK;
EmittedEmitterList* e = 0;
size_t maxNumberOfEmitters = size / mEmittedEmitterPool.size(); // equally distribute the number for each emitted emitter list
size_t oldSize = 0;
// Run through mEmittedEmitterPool and search for every key (=name) its corresponding emitter in mEmitters
for (emittedEmitterPoolIterator = mEmittedEmitterPool.begin(); emittedEmitterPoolIterator != mEmittedEmitterPool.end();
++emittedEmitterPoolIterator)
{
name = emittedEmitterPoolIterator->first;
e = &emittedEmitterPoolIterator->second;
// Search the correct emitter in the mEmitters vector
emitter = 0;
for (emitterIterator = mEmitters.begin(); emitterIterator != mEmitters.end(); ++emitterIterator)
{
emitter = *emitterIterator;
if (emitter && name != "" && name == emitter->getName())
{
// Found the right emitter, clone each emitter a number of times
oldSize = e->size();
for (size_t t = oldSize; t < maxNumberOfEmitters; ++t)
{
clonedEmitter = ParticleSystemManager::getSingleton()._createEmitter(emitter->getType(), this);
emitter->copyParametersTo(clonedEmitter);
clonedEmitter->setEmitted(emitter->isEmitted()); // is always 'true' by the way, but just in case
// Initially deactivate the emitted emitter if duration/repeat_delay are set
if (clonedEmitter->getDuration() > 0.0f && (clonedEmitter->getRepeatDelay() > 0.0f
|| clonedEmitter->getMinRepeatDelay() > 0.0f || clonedEmitter->getMinRepeatDelay() > 0.0f))
{
clonedEmitter->setEnabled(false);
}
// Add cloned emitters to the pool
e->push_back(clonedEmitter);
}
}
}
}
}