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


C++ ParticleSystem::_setMarkedForEmission方法代码示例

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


在下文中一共展示了ParticleSystem::_setMarkedForEmission方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _increaseParticleSystemPool

	//-----------------------------------------------------------------------
	void ParticlePool::_increaseParticleSystemPool(size_t size, 
		Particle::ParticleBehaviourList& behaviours, 
		ParticleTechnique* technique)
	{
		size_t oldSize = mSystems.size();
		if (size < oldSize)
			return;

		// Run through all emitters in the technique and check which one emits a particle system
		size_t numberOfEmitters = technique->getNumEmitters();
		if (numberOfEmitters == 0)
			return;

		ParticleSystem* system = 0;
		ParticleSystem* clonedSystem = 0;
		ParticleEmitter* emitter = 0;
		size_t numberOfEmittedSystems = 0;
		size_t systemCount = 0;

		// First determine the number of emitted particle systems.
		for (systemCount = 0; systemCount < numberOfEmitters; systemCount++)
		{
			emitter = technique->getEmitter(systemCount);
			if (emitter->getEmitsType() == Particle::PT_SYSTEM)
			{
				numberOfEmittedSystems++;
			}
		}

		if (numberOfEmittedSystems == 0)
			return;

		// Distribute size equally
		size_t increment = (size-oldSize) / numberOfEmittedSystems;

		// Fill the pool
		for (systemCount = 0; systemCount < numberOfEmitters; systemCount++)
		{
			emitter = technique->getEmitter(systemCount);
			if (emitter->getEmitsType() == Particle::PT_SYSTEM)
			{
				system = ParticleSystemManager::getSingletonPtr()->getParticleSystemTemplate(emitter->getEmitsName());
				if (system)
				{
					// Create 'increment' ParticleSystems and add to the pool
					std::stringstream ss; 
					ss << this;
					for (size_t i = 0; i < increment; i++)
					{
						clonedSystem = ParticleSystemManager::getSingletonPtr()->createParticleSystem(
							emitter->getEmitsName()+ ss.str() + StringConverter::toString(i), 
							emitter->getEmitsName(),
							technique->getParentSystem()->getSceneManager());
						clonedSystem->_setMarkedForEmission(true);
						mParticleSystemPool.addElement(emitter->getEmitsName(), clonedSystem);
						mSystems.push_back(clonedSystem->getName());

						// Attach the Particle System to a SceneNode
						Ogre::SceneNode* parentNode = technique->getParentSystem()->getParentSceneNode();
						Ogre::SceneNode* node = parentNode->createChildSceneNode();
						node->attachObject(clonedSystem);
						node->setVisible(false);
					}
				}
			}
		}
	}
开发者ID:Ketzer2002,项目名称:meridian59-engine,代码行数:68,代码来源:ParticleUniverseParticlePool.cpp


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