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).
actorid
Chris Robinson 12 years ago
parent ac10c5f05c
commit 77ba0fbe73

@ -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…
Cancel
Save