2011-12-11 22:40:00 -05:00
|
|
|
#include "creatureanimation.hpp"
|
2012-07-03 15:32:38 +02:00
|
|
|
|
|
|
|
#include <OgreEntity.h>
|
2013-04-07 02:08:33 -07:00
|
|
|
#include <OgreParticleSystem.h>
|
2012-07-03 15:32:38 +02:00
|
|
|
#include <OgreSceneManager.h>
|
|
|
|
#include <OgreSubEntity.h>
|
|
|
|
|
2012-04-03 15:13:47 +02:00
|
|
|
#include "renderconst.hpp"
|
2011-12-11 22:40:00 -05:00
|
|
|
|
2012-07-03 12:30:50 +02:00
|
|
|
#include "../mwbase/world.hpp"
|
2011-12-11 22:40:00 -05:00
|
|
|
|
2013-01-18 16:21:29 -08:00
|
|
|
namespace MWRender
|
|
|
|
{
|
2011-12-11 23:42:39 -05:00
|
|
|
|
2012-07-12 20:12:18 -07:00
|
|
|
CreatureAnimation::~CreatureAnimation()
|
|
|
|
{
|
2011-12-11 23:42:39 -05:00
|
|
|
}
|
2012-07-12 20:12:18 -07:00
|
|
|
|
2013-01-06 17:05:48 -08:00
|
|
|
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr)
|
|
|
|
: Animation(ptr)
|
2012-07-12 20:12:18 -07:00
|
|
|
{
|
2013-01-06 17:05:48 -08:00
|
|
|
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
2011-12-11 22:40:00 -05:00
|
|
|
|
2012-11-05 16:07:59 +04:00
|
|
|
assert (ref->mBase != NULL);
|
|
|
|
if(!ref->mBase->mModel.empty())
|
2012-07-12 20:12:18 -07:00
|
|
|
{
|
2013-02-23 03:34:03 -08:00
|
|
|
std::string model = "meshes\\"+ref->mBase->mModel;
|
2012-07-12 20:12:18 -07:00
|
|
|
|
2013-04-14 17:58:21 -07:00
|
|
|
std::vector<std::string> names;
|
|
|
|
if((ref->mBase->mFlags&ESM::Creature::Biped))
|
|
|
|
names.push_back("meshes\\base_anim.nif");
|
|
|
|
names.push_back(model);
|
|
|
|
|
|
|
|
createObjectList(mPtr.getRefData().getBaseNode(), model/*names*/);
|
|
|
|
for(size_t i = 0;i < mObjectLists[0].mEntities.size();i++)
|
2012-04-04 18:53:40 +02:00
|
|
|
{
|
2013-04-14 17:58:21 -07:00
|
|
|
Ogre::Entity *ent = mObjectLists[0].mEntities[i];
|
2012-07-17 16:00:03 -07:00
|
|
|
ent->setVisibilityFlags(RV_Actors);
|
2012-07-17 11:23:34 -07:00
|
|
|
|
2013-03-04 16:57:00 +01:00
|
|
|
for(unsigned int j=0; j < ent->getNumSubEntities(); ++j)
|
2012-04-04 18:53:40 +02:00
|
|
|
{
|
2013-03-04 16:57:00 +01:00
|
|
|
Ogre::SubEntity* subEnt = ent->getSubEntity(j);
|
|
|
|
subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? RQG_Alpha : RQG_Main);
|
2012-04-04 18:53:40 +02:00
|
|
|
}
|
2012-07-17 11:23:34 -07:00
|
|
|
}
|
2013-04-14 17:58:21 -07:00
|
|
|
for(size_t i = 0;i < mObjectLists[0].mParticles.size();i++)
|
2013-04-07 02:08:33 -07:00
|
|
|
{
|
2013-04-14 17:58:21 -07:00
|
|
|
Ogre::ParticleSystem *part = mObjectLists[0].mParticles[i];
|
2013-04-07 02:08:33 -07:00
|
|
|
part->setVisibilityFlags(RV_Actors);
|
|
|
|
|
|
|
|
part->setRenderQueueGroup(RQG_Alpha);
|
|
|
|
}
|
2011-12-11 22:40:00 -05:00
|
|
|
}
|
|
|
|
}
|
2011-12-25 22:37:26 -05:00
|
|
|
|
2012-01-17 15:10:53 +01:00
|
|
|
}
|