Class ParticleController

java.lang.Object
com.ardor3d.scenegraph.controller.ComplexSpatialController<ParticleSystem>
com.ardor3d.extension.effect.particle.ParticleController
All Implemented Interfaces:
SpatialController<ParticleSystem>, Savable, Serializable

public class ParticleController extends ComplexSpatialController<ParticleSystem>
ParticleController controls and maintains the parameters of a particle system over time.
See Also:
  • Field Details

  • Constructor Details

    • ParticleController

      public ParticleController()
      ParticleController constructor
  • Method Details

    • ignoreNextUpdate

      protected void ignoreNextUpdate()
    • update

      public void update(double secondsPassed, ParticleSystem particles)
      Update the particles managed by this manager. If any particles are "dead" recreate them at the origin position (which may be a point, line or rectangle.)
      Specified by:
      update in interface SpatialController<ParticleSystem>
      Specified by:
      update in class ComplexSpatialController<ParticleSystem>
      Parameters:
      secondsPassed - double precision time
      particles - the particles we are updating
    • getPrecision

      public double getPrecision()
      Get how soon after the last update the manager will send updates to the particles.
      Returns:
      The precision.
    • setPrecision

      public void setPrecision(double precision)
      Set how soon after the last update the manager will send updates to the particles. Defaults to .01f (10ms)

      This means that if an update is called every 2ms (e.g. running at 500 FPS) the particles position and stats will be updated every fifth frame with the elapsed time (in this case, 10ms) since previous update.
      Parameters:
      precision - in seconds
    • getReleaseVariance

      public double getReleaseVariance()
      Get the variance possible on the release rate. 0.0f = no variance 0.5f = between releaseRate / 2f and 1.5f * releaseRate
      Returns:
      release variance as a percent.
    • setReleaseVariance

      public void setReleaseVariance(double variance)
      Set the variance possible on the release rate.
      Parameters:
      variance - release rate +/- variance as a percent (eg. .5 = 50%)
    • isControlFlow

      public boolean isControlFlow()
      Does this manager regulate the particle flow?
      Returns:
      true if this manager regulates how many particles per sec are emitted.
    • setControlFlow

      public void setControlFlow(boolean regulate)
      Set the regulate flow property on the manager.
      Parameters:
      regulate - regulate particle flow.
    • isUpdateOnlyInView

      public boolean isUpdateOnlyInView()
      Does this manager use the particle's bounding volume to limit updates?
      Returns:
      true if this manager only updates the particles when they are in view.
    • setUpdateOnlyInView

      public void setUpdateOnlyInView(boolean updateOnlyInView)
      Set the updateOnlyInView property on the manager.
      Parameters:
      updateOnlyInView - use the particle's bounding volume to limit updates.
    • getViewCamera

      public Camera getViewCamera()
      Returns:
      the camera to be used in updateOnlyInView situations. If null, the current displaySystem's renderer camera is used.
    • setViewCamera

      public void setViewCamera(Camera viewCamera)
      Parameters:
      viewCamera - sets the camera to be used in updateOnlyInView situations. If null, the current displaySystem's renderer camera is used.
    • getIterations

      public int getIterations()
      Return the number this manager has warmed up
      Returns:
      int
    • setIterations

      public void setIterations(int iterations)
      Sets the iterations for the warmup and calls warmUp with the number of iterations as the argument
      Parameters:
      iterations - the iterations for the warmup
    • addInfluence

      public void addInfluence(ParticleInfluence influence)
      Add an external influence to this particle controller.
      Parameters:
      influence - ParticleInfluence
    • removeInfluence

      public boolean removeInfluence(ParticleInfluence influence)
      Remove an influence from this particle controller.
      Parameters:
      influence - ParticleInfluence
      Returns:
      true if found and removed.
    • getInfluences

      public List<ParticleInfluence> getInfluences()
      Returns the list of influences acting on this particle controller.
      Returns:
      ArrayList
    • clearInfluences

      public void clearInfluences()
    • addListener

      public void addListener(ParticleControllerListener listener)
      Subscribe a listener to receive mouse events. Enable event generation.
      Parameters:
      listener - to be subscribed
    • removeListener

      public void removeListener(ParticleControllerListener listener)
      Unsubscribe a listener. Disable event generation if no more listeners.
      Parameters:
      listener - to be unsuscribed
      See Also:
    • removeListeners

      public void removeListeners()
      Remove all listeners and disable event generation.
    • containsListener

      public boolean containsListener(ParticleControllerListener listener)
      Check if a listener is allready added to this ParticleController
      Parameters:
      listener - listener to check for
      Returns:
      true if listener is contained in the listenerlist
    • getListeners

      public List<ParticleControllerListener> getListeners()
      Get all added ParticleController listeners
      Returns:
      ArrayList of listeners added to this ParticleController
    • warmUp

      public void warmUp(int iterations, ParticleSystem particles)
      Runs the update method of this particle manager X number of times passing .1 seconds for each call. This is used to "warm up" and get the particle manager going.
      Parameters:
      iterations - The number of iterations to warm up.
      particles - the particle system
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class ComplexSpatialController<ParticleSystem>
      Throws:
      IOException
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class ComplexSpatialController<ParticleSystem>
      Throws:
      IOException
    • resetFlowCount

      public void resetFlowCount()
    • setSpawnEnabled

      public void setSpawnEnabled(boolean spawnEnabled)