com.jmex.effects.particles
Class ParticleInfluence

java.lang.Object
  extended by com.jmex.effects.particles.ParticleInfluence
All Implemented Interfaces:
Savable
Direct Known Subclasses:
FloorInfluence, SimpleParticleInfluenceFactory.BasicDrag, SimpleParticleInfluenceFactory.BasicGravity, SimpleParticleInfluenceFactory.BasicVortex, SimpleParticleInfluenceFactory.BasicWind, SwarmInfluence, WanderInfluence

public abstract class ParticleInfluence
extends java.lang.Object
implements Savable

ParticleInfluence is an abstract class defining an external influence to be used with the ParticleMesh class.

Version:
$Id: ParticleInfluence.java 4133 2009-03-19 20:40:11Z blaine.dev $
Author:
Joshua Slack

Constructor Summary
ParticleInfluence()
           
 
Method Summary
abstract  void apply(float dt, Particle particle, int index)
          Apply the influence defined by this class on a given particle.
 java.lang.Class getClassTag()
           
 boolean isEnabled()
          Return whether or not this influence is enabled.
 void prepare(ParticleSystem particleGeom)
          Gives the influence a chance to perform any necessary initialization immediately before apply(float, com.jmex.effects.particles.Particle, int) is called on each particle for the current frame.
 void read(JMEImporter e)
           
 void setEnabled(boolean enabled)
          Set this influence enabled or not.
 void write(JMEExporter e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParticleInfluence

public ParticleInfluence()
Method Detail

setEnabled

public void setEnabled(boolean enabled)
Set this influence enabled or not.

Parameters:
enabled - boolean

isEnabled

public boolean isEnabled()
Return whether or not this influence is enabled.

Returns:
boolean

prepare

public void prepare(ParticleSystem particleGeom)
Gives the influence a chance to perform any necessary initialization immediately before apply(float, com.jmex.effects.particles.Particle, int) is called on each particle for the current frame.

Parameters:
particleGeom - the particle system containing the influence

apply

public abstract void apply(float dt,
                           Particle particle,
                           int index)
Apply the influence defined by this class on a given particle. Should probably do this by making a call to particle.getSpeed().addLocal(....); etc.

Parameters:
dt - amount of time since last apply call in ms.
particle - the particle to apply the influence to.
index - the index of the particle we are working with. This is useful for adding small steady amounts of variation, or remembering information.

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

getClassTag

public java.lang.Class getClassTag()
Specified by:
getClassTag in interface Savable