Assign an initial bounding box to particle systems

pull/638/head
scrawl 10 years ago
parent b5099324d1
commit 8d6620b074

@ -749,6 +749,10 @@ namespace NifOsg
created->setSizeRange(osgParticle::rangef(size, size));
}
osg::BoundingBox box;
box.expandBy(osg::BoundingSphere(osg::Vec3(0,0,0), particledata->radius));
partsys->setInitialBound(box);
}
static osg::ref_ptr<Emitter> handleParticleEmitter(const Nif::NiParticleSystemController* partctrl)

@ -14,6 +14,7 @@
#include <components/vfs/manager.hpp>
#include <components/sceneutil/clone.hpp>
#include <components/sceneutil/util.hpp>
namespace
{
@ -61,6 +62,13 @@ namespace
{
partsys->getParticle(i)->transformPositionVelocity(worldMat);
}
// transform initial bounds to worldspace
osg::BoundingSphere sphere(partsys->getInitialBound());
SceneUtil::transformBoundingSphere(worldMat, sphere);
osg::BoundingBox box;
box.expandBy(sphere);
partsys->setInitialBound(box);
}
};

Loading…
Cancel
Save