1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 13:19:54 +00:00
openmw-tes3mp/apps/openmw/mwrender/creatureanimation.cpp

58 lines
1.5 KiB
C++
Raw Normal View History

#include "creatureanimation.hpp"
#include <OgreEntity.h>
#include <OgreParticleSystem.h>
#include <OgreSceneManager.h>
#include <OgreSubEntity.h>
2012-04-03 13:13:47 +00:00
#include "renderconst.hpp"
#include "../mwbase/world.hpp"
namespace MWRender
{
2011-12-12 04:42:39 +00:00
CreatureAnimation::~CreatureAnimation()
{
2011-12-12 04:42:39 +00:00
}
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr)
: Animation(ptr)
{
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
2012-11-05 12:07:59 +00:00
assert (ref->mBase != NULL);
if(!ref->mBase->mModel.empty())
{
2013-02-23 11:34:03 +00:00
std::string model = "meshes\\"+ref->mBase->mModel;
2013-04-07 08:52:35 +00:00
createObjectList(mPtr.getRefData().getBaseNode(), model);
for(size_t i = 0;i < mObjectList.mEntities.size();i++)
2012-04-04 16:53:40 +00:00
{
2013-04-07 08:52:35 +00:00
Ogre::Entity *ent = mObjectList.mEntities[i];
2012-07-17 23:00:03 +00:00
ent->setVisibilityFlags(RV_Actors);
2012-07-17 18:23:34 +00:00
for(unsigned int j=0; j < ent->getNumSubEntities(); ++j)
2012-04-04 16:53:40 +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
}
for(size_t i = 0;i < mObjectList.mParticles.size();i++)
{
Ogre::ParticleSystem *part = mObjectList.mParticles[i];
part->setVisibilityFlags(RV_Actors);
part->setRenderQueueGroup(RQG_Alpha);
}
2013-02-23 11:34:03 +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);
setAnimationSources(names);
}
}
2012-01-17 14:10:53 +00:00
}