Destroy entities when they're done with.

This commit is contained in:
Chris Robinson 2012-07-18 00:17:39 -07:00
parent 4109d0d923
commit 02d39080c8
3 changed files with 25 additions and 1 deletions

View file

@ -5,6 +5,7 @@
#include <OgreEntity.h>
#include <OgreBone.h>
#include <OgreSubMesh.h>
#include <OgreSceneManager.h>
namespace MWRender
{
@ -28,6 +29,10 @@ Animation::Animation(OEngine::Render::OgreRenderer& _rend)
Animation::~Animation()
{
Ogre::SceneManager *sceneMgr = mInsert->getCreator();
for(size_t i = 0;i < mEntityList.mEntities.size();i++)
sceneMgr->destroyEntity(mEntityList.mEntities[i]);
mEntityList.mEntities.clear();
}
void Animation::startScript(std::string groupname, int mode, int loops)

View file

@ -17,6 +17,26 @@ using namespace NifOgre;
namespace MWRender{
NpcAnimation::~NpcAnimation()
{
removeEntities(head);
removeEntities(hair);
removeEntities(neck);
removeEntities(groin);
removeEntities(rWrist);
removeEntities(lWrist);
removeEntities(rForearm);
removeEntities(lForearm);
removeEntities(rupperArm);
removeEntities(lupperArm);
removeEntities(rfoot);
removeEntities(lfoot);
removeEntities(rAnkle);
removeEntities(lAnkle);
removeEntities(rKnee);
removeEntities(lKnee);
removeEntities(rUpperLeg);
removeEntities(lUpperLeg);
removeEntities(rclavicle);
removeEntities(lclavicle);
}

View file

@ -40,7 +40,6 @@ private:
std::vector<Ogre::Entity*> hair;
std::vector<Ogre::Entity*> head;
Ogre::SceneNode* mInsert;
bool isBeast;
bool isFemale;
std::string headModel;