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


C++ ParticleEmitter::isEmitted方法代码示例

本文整理汇总了C++中ParticleEmitter::isEmitted方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEmitter::isEmitted方法的具体用法?C++ ParticleEmitter::isEmitted怎么用?C++ ParticleEmitter::isEmitted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParticleEmitter的用法示例。


在下文中一共展示了ParticleEmitter::isEmitted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
		}
	    }
	}
    }
}
开发者ID:26597925,项目名称:3DHome,代码行数:53,代码来源:SE_ParticleSystem.cpp


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