forked from mirror/openmw-tes3mp
Use initial particle state to compute the initial bounding box (Fixes #3500)
This commit is contained in:
parent
dda5bfbc9f
commit
341e3846c0
1 changed files with 7 additions and 2 deletions
|
@ -868,6 +868,8 @@ namespace NifOsg
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
osg::BoundingBox box;
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
for (std::vector<Nif::NiParticleSystemController::Particle>::const_iterator it = partctrl->particles.begin();
|
for (std::vector<Nif::NiParticleSystemController::Particle>::const_iterator it = partctrl->particles.begin();
|
||||||
i<particledata->activeCount && it != partctrl->particles.end(); ++it, ++i)
|
i<particledata->activeCount && it != partctrl->particles.end(); ++it, ++i)
|
||||||
|
@ -882,7 +884,8 @@ namespace NifOsg
|
||||||
// Note this position and velocity is not correct for a particle system with absolute reference frame,
|
// Note this position and velocity is not correct for a particle system with absolute reference frame,
|
||||||
// which can not be done in this loader since we are not attached to the scene yet. Will be fixed up post-load in the SceneManager.
|
// which can not be done in this loader since we are not attached to the scene yet. Will be fixed up post-load in the SceneManager.
|
||||||
created->setVelocity(particle.velocity);
|
created->setVelocity(particle.velocity);
|
||||||
created->setPosition(particledata->vertices->at(particle.vertex));
|
const osg::Vec3f& position = particledata->vertices->at(particle.vertex);
|
||||||
|
created->setPosition(position);
|
||||||
|
|
||||||
osg::Vec4f partcolor (1.f,1.f,1.f,1.f);
|
osg::Vec4f partcolor (1.f,1.f,1.f,1.f);
|
||||||
if (particle.vertex < int(particledata->colors->size()))
|
if (particle.vertex < int(particledata->colors->size()))
|
||||||
|
@ -891,10 +894,12 @@ namespace NifOsg
|
||||||
float size = particledata->sizes.at(particle.vertex) * partctrl->size;
|
float size = particledata->sizes.at(particle.vertex) * partctrl->size;
|
||||||
|
|
||||||
created->setSizeRange(osgParticle::rangef(size, size));
|
created->setSizeRange(osgParticle::rangef(size, size));
|
||||||
|
box.expandBy(osg::BoundingSphere(position, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::BoundingBox box;
|
// radius may be used to force a larger bounding box
|
||||||
box.expandBy(osg::BoundingSphere(osg::Vec3(0,0,0), particledata->radius));
|
box.expandBy(osg::BoundingSphere(osg::Vec3(0,0,0), particledata->radius));
|
||||||
|
|
||||||
partsys->setInitialBound(box);
|
partsys->setInitialBound(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue