aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-effects
diff options
context:
space:
mode:
authorRenanse <[email protected]>2013-03-16 13:59:36 -0500
committerRenanse <[email protected]>2013-03-16 13:59:36 -0500
commitb17dfb029e3074902c5b0db2989af85164ddebb8 (patch)
tree0de22eda4c3fdbc638975c810443c9dce7a430ce /ardor3d-effects
parent4d26ccc727bdc59cc4d5404852aefd9f42a7ed11 (diff)
Update to allow cutting off particle spawning immediately
Diffstat (limited to 'ardor3d-effects')
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java41
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;
+ }
}