|
|
|
@ -10,6 +10,8 @@
|
|
|
|
|
#include <osg/MatrixTransform>
|
|
|
|
|
#include <osg/Geode>
|
|
|
|
|
|
|
|
|
|
#include <osgParticle/ParticleSystem>
|
|
|
|
|
|
|
|
|
|
#include <components/nifosg/nifloader.hpp>
|
|
|
|
|
|
|
|
|
|
#include <components/resource/resourcesystem.hpp>
|
|
|
|
@ -1067,6 +1069,25 @@ namespace MWRender
|
|
|
|
|
attachTo->addChild(lightSource);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class DisableFreezeOnCullVisitor : public osg::NodeVisitor
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
DisableFreezeOnCullVisitor()
|
|
|
|
|
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void apply(osg::Geode &geode)
|
|
|
|
|
{
|
|
|
|
|
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
|
|
|
|
{
|
|
|
|
|
osg::Drawable* drw = geode.getDrawable(i);
|
|
|
|
|
if (osgParticle::ParticleSystem* partsys = dynamic_cast<osgParticle::ParticleSystem*>(drw))
|
|
|
|
|
partsys->setFreezeOnCull(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void Animation::addEffect (const std::string& model, int effectId, bool loop, const std::string& bonename, std::string texture)
|
|
|
|
|
{
|
|
|
|
|
if (!mObjectRoot.get())
|
|
|
|
@ -1099,6 +1120,10 @@ namespace MWRender
|
|
|
|
|
SceneUtil::FindMaxControllerLengthVisitor findMaxLengthVisitor;
|
|
|
|
|
node->accept(findMaxLengthVisitor);
|
|
|
|
|
|
|
|
|
|
// FreezeOnCull doesn't work so well with effect particles, that tend to have moving emitters
|
|
|
|
|
DisableFreezeOnCullVisitor disableFreezeOnCullVisitor;
|
|
|
|
|
node->accept(disableFreezeOnCullVisitor);
|
|
|
|
|
|
|
|
|
|
params.mMaxControllerLength = findMaxLengthVisitor.getMaxLength();
|
|
|
|
|
|
|
|
|
|
node->setNodeMask(Mask_Effect);
|
|
|
|
|