mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 16:45:32 +00:00
1b1f9f7921
addObjectList may not currently be called outside of the related constructor.
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#include "activatoranimation.hpp"
|
|
|
|
#include <OgreEntity.h>
|
|
#include <OgreParticleSystem.h>
|
|
#include <OgreSceneManager.h>
|
|
#include <OgreSubEntity.h>
|
|
|
|
#include "renderconst.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
namespace MWRender
|
|
{
|
|
|
|
ActivatorAnimation::~ActivatorAnimation()
|
|
{
|
|
}
|
|
|
|
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
|
|
: Animation(ptr)
|
|
{
|
|
MWWorld::LiveCellRef<ESM::Activator> *ref = mPtr.get<ESM::Activator>();
|
|
|
|
assert (ref->mBase != NULL);
|
|
if(!ref->mBase->mModel.empty())
|
|
{
|
|
const std::string name = "meshes\\"+ref->mBase->mModel;
|
|
|
|
addObjectList(mPtr.getRefData().getBaseNode(), name, false);
|
|
const NifOgre::ObjectList &objlist = mObjectLists.back();
|
|
for(size_t i = 0;i < objlist.mEntities.size();i++)
|
|
{
|
|
Ogre::Entity *ent = objlist.mEntities[i];
|
|
ent->setVisibilityFlags(RV_Misc);
|
|
|
|
for(unsigned int j=0; j < ent->getNumSubEntities(); ++j)
|
|
{
|
|
Ogre::SubEntity* subEnt = ent->getSubEntity(j);
|
|
subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? RQG_Alpha : RQG_Main);
|
|
}
|
|
}
|
|
for(size_t i = 0;i < objlist.mParticles.size();i++)
|
|
{
|
|
Ogre::ParticleSystem *part = objlist.mParticles[i];
|
|
part->setVisibilityFlags(RV_Misc);
|
|
part->setRenderQueueGroup(RQG_Alpha);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|