1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 09:45:36 +00:00

Assign an initial bounding box to particle systems

This commit is contained in:
scrawl 2015-06-11 02:37:49 +02:00
parent b5099324d1
commit 8d6620b074
2 changed files with 12 additions and 0 deletions

View file

@ -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)

View file

@ -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);
}
};