本文整理汇总了C++中ParticleEmitter::copyParametersTo方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEmitter::copyParametersTo方法的具体用法?C++ ParticleEmitter::copyParametersTo怎么用?C++ ParticleEmitter::copyParametersTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter::copyParametersTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
}
}
示例2: removeAllEmitters
ParticleSystem& ParticleSystem::operator=(const ParticleSystem& rhs)
{
// Blank this system's emitters & affectors
removeAllEmitters();
removeAllEmittedEmitters();
removeAllAffectors();
// Copy emitters
for (unsigned short i = 0; i < rhs.getNumEmitters(); ++i)
{
ParticleEmitter* rhsEm = rhs.getEmitter(i);
ParticleEmitter* newEm = addEmitter(rhsEm->getType());
rhsEm->copyParametersTo(newEm);
}
// Copy affectors
/*for(unsigned short i = 0; i < rhs.getNumAffectors(); ++i)
{
ParticleAffector* rhsAf = rhs.getAffector(i);
ParticleAffector* newAf = addAffector(rhsAf->getType());
//rhsAf->copyParametersTo(newAf);
}*/
setParticleQuota(rhs.getParticleQuota());
setEmittedEmitterQuota(rhs.getEmittedEmitterQuota());
setDefaultDimensions(rhs.mDefaultWidth, rhs.mDefaultHeight);
mCullIndividual = rhs.mCullIndividual;
mSorted = rhs.mSorted;
mLocalSpace = rhs.mLocalSpace;
mIterationInterval = rhs.mIterationInterval;
mIterationIntervalSet = rhs.mIterationIntervalSet;
mNonvisibleTimeout = rhs.mNonvisibleTimeout;
mNonvisibleTimeoutSet = rhs.mNonvisibleTimeoutSet;
// last frame visible and time since last visible should be left default
setRenderer(rhs.getRendererName());
// Copy settings
/*if (mRenderer && rhs.getRenderer())
{
//rhs.getRenderer()->copyParametersTo(mRenderer);
}*/
return *this;
}