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

52 lines
1.4 KiB
C++
Raw Normal View History

#include "activatoranimation.hpp"
#include <OgreSceneNode.h>
#include <OgreParticleSystem.h>
2014-02-23 19:11:05 +00:00
#include <components/esm/loadacti.hpp>
2014-02-23 19:11:05 +00:00
#include "renderconst.hpp"
namespace MWRender
{
ActivatorAnimation::~ActivatorAnimation()
{
}
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr, const std::string& model)
: Animation(ptr, ptr.getRefData().getBaseNode())
{
2014-12-05 19:58:33 +00:00
if(!model.empty())
{
2014-12-05 19:58:33 +00:00
setObjectRoot(model, false);
setRenderProperties(mObjectRoot, RV_Misc, RQG_Main, RQG_Alpha);
2014-12-05 19:58:33 +00:00
addAnimSource(model);
}
else
{
// No model given. Create an object root anyway, so that lights can be added to it if needed.
mObjectRoot = NifOgre::ObjectScenePtr (new NifOgre::ObjectScene(mInsert->getCreator()));
}
}
void ActivatorAnimation::addLight(const ESM::Light *light)
{
addExtraLight(mInsert->getCreator(), mObjectRoot, light);
}
void ActivatorAnimation::removeParticles()
{
for (unsigned int i=0; i<mObjectRoot->mParticles.size(); ++i)
{
// Don't destroyParticleSystem, the ParticleSystemController is still holding a pointer to it.
// Don't setVisible, this could conflict with a VisController.
// The following will remove all spawned particles, then set the speed factor to zero so that no new ones will be spawned.
mObjectRoot->mParticles[i]->setSpeedFactor(0.f);
mObjectRoot->mParticles[i]->clear();
}
}
}