forked from mirror/openmw-tes3mp
Store the entity list in the object
This commit is contained in:
parent
a590db2cf4
commit
94f3e7a6c0
4 changed files with 15 additions and 18 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
#include <components/nif/node.hpp>
|
||||
|
@ -39,7 +40,7 @@ protected:
|
|||
|
||||
std::vector<Nif::NiKeyframeData>* mTransformations;
|
||||
std::map<std::string,float>* mTextmappings;
|
||||
std::vector<Ogre::Entity*> mBase;
|
||||
NifOgre::EntityList mEntityList;
|
||||
void handleAnimationTransforms();
|
||||
bool timeIndex( float time, const std::vector<float> & times, int & i, int & j, float & x );
|
||||
|
||||
|
|
|
@ -26,16 +26,16 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr, OEngine::Render::O
|
|||
{
|
||||
std::string mesh = "meshes\\" + ref->base->model;
|
||||
|
||||
NifOgre::EntityList entities = NifOgre::NIFLoader::createEntities(mInsert, mesh);
|
||||
mBase = entities.mEntities;
|
||||
for(size_t i = 0;i < mBase.size();i++)
|
||||
mEntityList = NifOgre::NIFLoader::createEntities(mInsert, mesh);
|
||||
for(size_t i = 0;i < mEntityList.mEntities.size();i++)
|
||||
{
|
||||
mBase[i]->setVisibilityFlags(RV_Actors);
|
||||
Ogre::Entity *ent = mEntityList.mEntities[i];
|
||||
ent->setVisibilityFlags(RV_Actors);
|
||||
|
||||
bool transparent = false;
|
||||
for (unsigned int j=0;j < mBase[i]->getNumSubEntities() && !transparent; ++j)
|
||||
for (unsigned int j=0;j < ent->getNumSubEntities() && !transparent; ++j)
|
||||
{
|
||||
Ogre::MaterialPtr mat = mBase[i]->getSubEntity(j)->getMaterial();
|
||||
Ogre::MaterialPtr mat = ent->getSubEntity(j)->getMaterial();
|
||||
Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
|
||||
while (techIt.hasMoreElements() && !transparent)
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr, OEngine::Render::O
|
|||
}
|
||||
}
|
||||
}
|
||||
mBase[i]->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRendere
|
|||
leftpauldron(mInv.end()), rightpauldron(mInv.end()),
|
||||
boots(mInv.end()),
|
||||
leftglove(mInv.end()), rightglove(mInv.end()), skirtiter(mInv.end()),
|
||||
pants(mInv.end()),
|
||||
mSkelBase(0)
|
||||
pants(mInv.end())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
||||
|
||||
|
@ -65,12 +64,10 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRendere
|
|||
|
||||
std::string smodel = (!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif");
|
||||
|
||||
NifOgre::EntityList entities = NifOgre::NIFLoader::createEntities(mInsert, smodel);
|
||||
mBase = entities.mEntities;
|
||||
mSkelBase = entities.mSkelBase;
|
||||
for(size_t i = 0;i < mBase.size();i++)
|
||||
mEntityList = NifOgre::NIFLoader::createEntities(mInsert, smodel);
|
||||
for(size_t i = 0;i < mEntityList.mEntities.size();i++)
|
||||
{
|
||||
Ogre::Entity *base = mBase[i];
|
||||
Ogre::Entity *base = mEntityList.mEntities[i];
|
||||
|
||||
base->setVisibilityFlags(RV_Actors);
|
||||
bool transparent = false;
|
||||
|
@ -376,7 +373,7 @@ std::vector<Ogre::Entity*> NpcAnimation::insertBoundedPart(const std::string &me
|
|||
Ogre::Entity *part = parts.back();
|
||||
|
||||
part->setVisibilityFlags(RV_Actors);
|
||||
mSkelBase->attachObjectToBone(bonename, part);
|
||||
mEntityList.mSkelBase->attachObjectToBone(bonename, part);
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
@ -415,7 +412,7 @@ void NpcAnimation::runAnimation(float timepassed)
|
|||
void NpcAnimation::removeEntities(std::vector<Ogre::Entity*> &entities)
|
||||
{
|
||||
for(size_t i = 0;i < entities.size();i++)
|
||||
mSkelBase->detachObjectFromBone(entities[i]);
|
||||
mEntityList.mSkelBase->detachObjectFromBone(entities[i]);
|
||||
entities.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ private:
|
|||
std::vector<Ogre::Entity*> head;
|
||||
|
||||
Ogre::SceneNode* mInsert;
|
||||
Ogre::Entity *mSkelBase; // Entity with the base skeleton (temporary)
|
||||
bool isBeast;
|
||||
bool isFemale;
|
||||
std::string headModel;
|
||||
|
|
Loading…
Reference in a new issue