Class Effector

java.lang.Object
tripleplay.particle.Effector
Direct Known Subclasses:
Drag, Gravity, Move

public abstract class Effector extends Object
Encapsulates a single effect on a particle, for example, moving it based on its current velocity.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    apply(int index, float[] data, int start, float now, float dt)
    Applies this effector to the indexth particle in the supplied buffer.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Effector

      public Effector()
  • Method Details

    • apply

      public abstract void apply(int index, float[] data, int start, float now, float dt)
      Applies this effector to the indexth particle in the supplied buffer. The effector must use the ParticleBuffer offsets to extract fields from data, for example: float x = data[start+ParticleBuffer.POS_X].
      Parameters:
      index - the index of the particle, which can be used to index into other per-particle data arrays.
      data - the particle field data.
      start - the offset into data at which the particle's fields start.
      now - the number of seconds elapsed since the emitter came into being. Can be used to compute a particle's age.
      dt - the amount of time (in fractions of a second) that has elapsed since the last update.