Hi all,

I needed a quick way to add many explosions to my system. So ive added a few methods in ParticleSystem to clone it quickly:

// how many times the manager has warmed up
private int iterations;

   * Return the number this manager has warmed
   * up
   * @return int
  public int getIterations() {
     return iterations;

   * Runs the update method of this particle manager for iteration seconds
   * with an update every .1 seconds (IE <code>iterations</code> * 10
   * update(.1f) calls).  This is used to "warm up" and get the particle
   * manager going.
   * @param iterations The number of iterations to warm up.
  public void warmUp(int iterations) {
     this.iterations = iterations;
    for (int i = iterations; --i>= 0; )

   * Sets the iterations for the warmup and calls
   * warmUp with the number of iterations as the argument
   * @param iterations
  public void setIterations(int iterations) {

And for the most important part:

    * Clones every aspect of this manager into a new manager
   public Object clone() {
      ParticleManager manager = new ParticleManager(getParticlesNumber(),
      manager.setEmissionDirection((Vector3f) getEmissionDirection().clone());
      manager.setEndColor((ColorRGBA) getEndColor().clone());
      manager.setGravityForce((Vector3f) getGravityForce().clone());
      manager.setParticlesOrigin((Vector3f) getParticlesOrigin().clone());
      manager.setStartColor((ColorRGBA) getStartColor().clone());


      for (int i = 0; i < getParticles().getRenderStateList().length; i++) {
         if (getParticles().getRenderStateList()[i] != null) {


      return manager;

What do you think?

Edit: The clone method definetly works now. And the brilliant thing is that you dont have to reload the textures and recreate the alpha states and zBufferStates :D


You will need a setIterations(int iterations).

that method (setIterations) comes in the form of warmUp(int iterations)

I suppose we could have a set iterations method and make warmUp a private method. So you set the iterations, and that will warm up the manager.


warmup should be public, it may be needed for the same reasons you have it in clone.

ive added and taken away a few lines in the clone() method to apply the render states of the current to the clone. Ive also added a setIterations(…) which automatically calls warmUp(…);


It looks pretty good to me although I would say that setting Iterations should only do that and not call warmup automatically. Warmup is already public and can be called in clone and also by the user as needed.

But other than that, looks like a simple add. This and the other add are fine by me but will of course need a sign off by Mojo.