2013-01-16 14:37:32 -08:00
|
|
|
#include "activatoranimation.hpp"
|
|
|
|
|
2014-12-22 18:50:24 +01:00
|
|
|
#include <OgreSceneNode.h>
|
|
|
|
#include <OgreParticleSystem.h>
|
|
|
|
|
2014-02-23 20:11:05 +01:00
|
|
|
#include <components/esm/loadacti.hpp>
|
2013-01-16 14:37:32 -08:00
|
|
|
|
2014-02-23 20:11:05 +01:00
|
|
|
#include "renderconst.hpp"
|
|
|
|
|
2013-01-16 14:37:32 -08:00
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
|
|
|
|
ActivatorAnimation::~ActivatorAnimation()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-01-12 11:29:56 +01:00
|
|
|
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr, const std::string& model)
|
2013-08-06 01:41:47 -07:00
|
|
|
: Animation(ptr, ptr.getRefData().getBaseNode())
|
2013-01-16 14:37:32 -08:00
|
|
|
{
|
2014-12-05 20:58:33 +01:00
|
|
|
if(!model.empty())
|
2013-01-16 14:37:32 -08:00
|
|
|
{
|
2014-12-05 20:58:33 +01:00
|
|
|
setObjectRoot(model, false);
|
2013-05-06 23:11:26 -07:00
|
|
|
setRenderProperties(mObjectRoot, RV_Misc, RQG_Main, RQG_Alpha);
|
2013-05-07 16:59:32 -07:00
|
|
|
|
2014-12-05 20:58:33 +01:00
|
|
|
addAnimSource(model);
|
2013-01-16 14:37:32 -08:00
|
|
|
}
|
2014-12-22 18:50:24 +01:00
|
|
|
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();
|
|
|
|
}
|
2013-01-16 14:37:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|