mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 17:26:38 +00:00 
			
		
		
		
	Prepare for creating particles
This adds a vector of ParticleSystems to the EntityList, and modifies corresponding code to handle it. It also loads the ParticleFX plugin so particles can be created (although they aren't yet).
This commit is contained in:
		
							parent
							
								
									ac10c5f05c
								
							
						
					
					
						commit
						77ba0fbe73
					
				
					 5 changed files with 22 additions and 5 deletions
				
			
		|  | @ -40,9 +40,12 @@ Animation::~Animation() | |||
|     if(mInsert) | ||||
|     { | ||||
|         Ogre::SceneManager *sceneMgr = mInsert->getCreator(); | ||||
|         for(size_t i = 0;i < mEntityList.mParticles.size();i++) | ||||
|             sceneMgr->destroyParticleSystem(mEntityList.mParticles[i]); | ||||
|         for(size_t i = 0;i < mEntityList.mEntities.size();i++) | ||||
|             sceneMgr->destroyEntity(mEntityList.mEntities[i]); | ||||
|     } | ||||
|     mEntityList.mParticles.clear(); | ||||
|     mEntityList.mEntities.clear(); | ||||
|     mEntityList.mSkelBase = NULL; | ||||
| } | ||||
|  |  | |||
|  | @ -363,11 +363,11 @@ void NpcAnimation::removeEntities(NifOgre::EntityList &entities) | |||
|     assert(&entities != &mEntityList); | ||||
| 
 | ||||
|     Ogre::SceneManager *sceneMgr = mInsert->getCreator(); | ||||
|     for(size_t i = 0;i < entities.mParticles.size();i++) | ||||
|         sceneMgr->destroyParticleSystem(entities.mParticles[i]); | ||||
|     for(size_t i = 0;i < entities.mEntities.size();i++) | ||||
|     { | ||||
|         entities.mEntities[i]->detachFromParent(); | ||||
|         sceneMgr->destroyEntity(entities.mEntities[i]); | ||||
|     } | ||||
|     entities.mParticles.clear(); | ||||
|     entities.mEntities.clear(); | ||||
|     entities.mSkelBase = NULL; | ||||
| } | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ | |||
| #include <OgreEntity.h> | ||||
| #include <OgreLight.h> | ||||
| #include <OgreSubEntity.h> | ||||
| #include <OgreParticleSystem.h> | ||||
| #include <OgreParticleEmitter.h> | ||||
| #include <OgreStaticGeometry.h> | ||||
| 
 | ||||
| #include <components/nifogre/ogrenifloader.hpp> | ||||
|  | @ -156,7 +158,8 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") || anyTransparency) | ||||
|     if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") || | ||||
|        anyTransparency || entities.mParticles.size() > 0) | ||||
|     { | ||||
|         for(size_t i = 0;i < entities.mEntities.size();i++) | ||||
|         { | ||||
|  | @ -169,6 +172,14 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool | |||
|             ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0); | ||||
|             ent->setVisibilityFlags(mIsStatic ? (small ? RV_StaticsSmall : RV_Statics) : RV_Misc); | ||||
|         } | ||||
|         for(size_t i = 0;i < entities.mParticles.size();i++) | ||||
|         { | ||||
|             Ogre::ParticleSystem *part = entities.mParticles[i]; | ||||
|             // TODO: Check the particle system's material for actual transparency
 | ||||
|             part->setRenderQueueGroup(RQG_Alpha); | ||||
|             part->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0); | ||||
|             part->setVisibilityFlags(mIsStatic ? (small ? RV_StaticsSmall : RV_Statics) : RV_Misc); | ||||
|         } | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|  |  | |||
|  | @ -40,8 +40,10 @@ namespace NifOgre | |||
| typedef std::multimap<float,std::string> TextKeyMap; | ||||
| static const char sTextKeyExtraDataID[] = "TextKeyExtraData"; | ||||
| struct EntityList { | ||||
|     std::vector<Ogre::Entity*> mEntities; | ||||
|     Ogre::Entity *mSkelBase; | ||||
|     std::vector<Ogre::Entity*> mEntities; | ||||
| 
 | ||||
|     std::vector<Ogre::ParticleSystem*> mParticles; | ||||
| 
 | ||||
|     EntityList() : mSkelBase(0) | ||||
|     { } | ||||
|  |  | |||
|  | @ -195,6 +195,7 @@ void OgreRenderer::configure(const std::string &logPath, | |||
|     Files::loadOgrePlugin(pluginDir, "RenderSystem_GL3Plus", *mRoot); | ||||
|     Files::loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mRoot); | ||||
|     Files::loadOgrePlugin(pluginDir, "Plugin_CgProgramManager", *mRoot); | ||||
|     Files::loadOgrePlugin(pluginDir, "Plugin_ParticleFX", *mRoot); | ||||
| 
 | ||||
|     RenderSystem* rs = mRoot->getRenderSystemByName(renderSystem); | ||||
|     if (rs == 0) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue