Ensure non-negative particle life time, add size assertion

deque
scrawl 11 years ago
parent 192d5ca08f
commit 1320ac6983

@ -762,8 +762,8 @@ class NIFObjectLoader
else
emitter->setEmissionRate(partctrl->numParticles / (partctrl->lifetime + partctrl->lifetimeRandom/2));
emitter->setTimeToLive(partctrl->lifetime,
partctrl->lifetime + partctrl->lifetimeRandom);
emitter->setTimeToLive(std::max(0.f, partctrl->lifetime),
std::max(0.f, partctrl->lifetime + partctrl->lifetimeRandom));
emitter->setParameter("width", Ogre::StringConverter::toString(partctrl->offsetRandom.x));
emitter->setParameter("height", Ogre::StringConverter::toString(partctrl->offsetRandom.y));
emitter->setParameter("depth", Ogre::StringConverter::toString(partctrl->offsetRandom.z));

@ -448,12 +448,14 @@ public:
if(life_time-particle_time < mGrowTime)
{
Ogre::Real scale = (life_time-particle_time) / mGrowTime;
assert (scale >= 0);
width *= scale;
height *= scale;
}
if(particle_time < mFadeTime)
{
Ogre::Real scale = particle_time / mFadeTime;
assert (scale >= 0);
width *= scale;
height *= scale;
}
@ -479,12 +481,14 @@ public:
if(life_time-particle_time < mGrowTime)
{
Ogre::Real scale = (life_time-particle_time) / mGrowTime;
assert (scale >= 0);
width *= scale;
height *= scale;
}
if(particle_time < mFadeTime)
{
Ogre::Real scale = particle_time / mFadeTime;
assert (scale >= 0);
width *= scale;
height *= scale;
}

Loading…
Cancel
Save