forked from mirror/openmw-tes3mp
Assign an initial bounding box to particle systems
This commit is contained in:
parent
b5099324d1
commit
8d6620b074
2 changed files with 12 additions and 0 deletions
|
@ -749,6 +749,10 @@ namespace NifOsg
|
||||||
|
|
||||||
created->setSizeRange(osgParticle::rangef(size, size));
|
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)
|
static osg::ref_ptr<Emitter> handleParticleEmitter(const Nif::NiParticleSystemController* partctrl)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
|
|
||||||
#include <components/sceneutil/clone.hpp>
|
#include <components/sceneutil/clone.hpp>
|
||||||
|
#include <components/sceneutil/util.hpp>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -61,6 +62,13 @@ namespace
|
||||||
{
|
{
|
||||||
partsys->getParticle(i)->transformPositionVelocity(worldMat);
|
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…
Reference in a new issue