mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Fixed large burst of particles when dramatically increasing the emission rate of a ParticleSystem. (fixes #1169)
This commit is contained in:
@@ -18,6 +18,7 @@ Released: N/A
|
||||
* Fixed gamma correction of ImageFonts and BMFonts with colored images.
|
||||
* Fixed the default shader improperly applying gamma correction to per-vertex colors when gamma correction is requested but not supported on OpenGL ES.
|
||||
* Fixed text coloring breaking because of an empty string.
|
||||
* Fixed large burst of particles when dramatically increasing the emission rate of a ParticleSystem.
|
||||
|
||||
* Improved performance of Channel methods by roughly 2x in many cases.
|
||||
|
||||
|
||||
@@ -437,6 +437,9 @@ void ParticleSystem::setEmissionRate(float rate)
|
||||
if (rate < 0.0f)
|
||||
throw love::Exception("Invalid emission rate");
|
||||
emissionRate = rate;
|
||||
|
||||
// Prevent an explosion when dramatically increasing the rate
|
||||
emitCounter = std::min(emitCounter, 1.0f/rate);
|
||||
}
|
||||
|
||||
float ParticleSystem::getEmissionRate() const
|
||||
@@ -932,9 +935,6 @@ void ParticleSystem::update(float dt)
|
||||
addParticle(1.0f - (emitCounter - rate) / total);
|
||||
emitCounter -= rate;
|
||||
}
|
||||
/*int particles = (int)(emissionRate * dt);
|
||||
for (int i = 0; i != particles; i++)
|
||||
add();*/
|
||||
|
||||
life -= dt;
|
||||
if (lifetime != -1 && life < 0)
|
||||
|
||||
Reference in New Issue
Block a user