diff options
-rw-r--r-- | ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java index 0cee691..aaa5e6d 100644 --- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java +++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java @@ -39,6 +39,7 @@ public class ParticleController extends ComplexSpatialController<ParticleSystem> private double _precision; private boolean _controlFlow; private boolean _updateOnlyInView; + private boolean _spawnEnabled = true; private Camera _viewCamera; private int iterations; @@ -191,24 +192,26 @@ public class ParticleController extends ComplexSpatialController<ParticleSystem> // We plan to reuse the particle } else { - // Not all particles are dead (this one will be reused) - dead = false; - - // If we are doing flow control, decrement - // particlesToCreate, since we are about to create - // one - if (_controlFlow) { - _particlesToCreate--; + if (_spawnEnabled) { + // Not all particles are dead (this one will be reused) + dead = false; + + // If we are doing flow control, decrement + // particlesToCreate, since we are about to create + // one + if (_controlFlow) { + _particlesToCreate--; + } + + // Recreate the particle + p.recreateParticle(particles.getRandomLifeSpan()); + p.setStatus(Particle.Status.Alive); + // in case of ramp time 0 entries. + p.updateAndCheck(0); + particles.initParticleLocation(i); + particles.resetParticleVelocity(i); + p.updateVerts(null); } - - // Recreate the particle - p.recreateParticle(particles.getRandomLifeSpan()); - p.setStatus(Particle.Status.Alive); - // in case of ramp time 0 entries. - p.updateAndCheck(0); - particles.initParticleLocation(i); - particles.resetParticleVelocity(i); - p.updateVerts(null); } } else if (!reuse || (_controlFlow && particles.getReleaseRate() > 0)) { @@ -520,4 +523,8 @@ public class ParticleController extends ComplexSpatialController<ParticleSystem> public void resetFlowCount() { _releaseParticles = 0; } + + public void setSpawnEnabled(final boolean spawnEnabled) { + _spawnEnabled = spawnEnabled; + } } |