mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
Ensure non-negative particle life time, add size assertion
This commit is contained in:
parent
192d5ca08f
commit
1320ac6983
2 changed files with 6 additions and 2 deletions
|
@ -762,8 +762,8 @@ class NIFObjectLoader
|
||||||
else
|
else
|
||||||
emitter->setEmissionRate(partctrl->numParticles / (partctrl->lifetime + partctrl->lifetimeRandom/2));
|
emitter->setEmissionRate(partctrl->numParticles / (partctrl->lifetime + partctrl->lifetimeRandom/2));
|
||||||
|
|
||||||
emitter->setTimeToLive(partctrl->lifetime,
|
emitter->setTimeToLive(std::max(0.f, partctrl->lifetime),
|
||||||
partctrl->lifetime + partctrl->lifetimeRandom);
|
std::max(0.f, partctrl->lifetime + partctrl->lifetimeRandom));
|
||||||
emitter->setParameter("width", Ogre::StringConverter::toString(partctrl->offsetRandom.x));
|
emitter->setParameter("width", Ogre::StringConverter::toString(partctrl->offsetRandom.x));
|
||||||
emitter->setParameter("height", Ogre::StringConverter::toString(partctrl->offsetRandom.y));
|
emitter->setParameter("height", Ogre::StringConverter::toString(partctrl->offsetRandom.y));
|
||||||
emitter->setParameter("depth", Ogre::StringConverter::toString(partctrl->offsetRandom.z));
|
emitter->setParameter("depth", Ogre::StringConverter::toString(partctrl->offsetRandom.z));
|
||||||
|
|
|
@ -448,12 +448,14 @@ public:
|
||||||
if(life_time-particle_time < mGrowTime)
|
if(life_time-particle_time < mGrowTime)
|
||||||
{
|
{
|
||||||
Ogre::Real scale = (life_time-particle_time) / mGrowTime;
|
Ogre::Real scale = (life_time-particle_time) / mGrowTime;
|
||||||
|
assert (scale >= 0);
|
||||||
width *= scale;
|
width *= scale;
|
||||||
height *= scale;
|
height *= scale;
|
||||||
}
|
}
|
||||||
if(particle_time < mFadeTime)
|
if(particle_time < mFadeTime)
|
||||||
{
|
{
|
||||||
Ogre::Real scale = particle_time / mFadeTime;
|
Ogre::Real scale = particle_time / mFadeTime;
|
||||||
|
assert (scale >= 0);
|
||||||
width *= scale;
|
width *= scale;
|
||||||
height *= scale;
|
height *= scale;
|
||||||
}
|
}
|
||||||
|
@ -479,12 +481,14 @@ public:
|
||||||
if(life_time-particle_time < mGrowTime)
|
if(life_time-particle_time < mGrowTime)
|
||||||
{
|
{
|
||||||
Ogre::Real scale = (life_time-particle_time) / mGrowTime;
|
Ogre::Real scale = (life_time-particle_time) / mGrowTime;
|
||||||
|
assert (scale >= 0);
|
||||||
width *= scale;
|
width *= scale;
|
||||||
height *= scale;
|
height *= scale;
|
||||||
}
|
}
|
||||||
if(particle_time < mFadeTime)
|
if(particle_time < mFadeTime)
|
||||||
{
|
{
|
||||||
Ogre::Real scale = particle_time / mFadeTime;
|
Ogre::Real scale = particle_time / mFadeTime;
|
||||||
|
assert (scale >= 0);
|
||||||
width *= scale;
|
width *= scale;
|
||||||
height *= scale;
|
height *= scale;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue