1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00
OpenMW/apps/openmw/mwrender/creatureanimation.cpp

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