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