1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 18:19:55 +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);
}
};