com.jmex.effects.particles
Class SwarmInfluence

java.lang.Object
  extended by com.jmex.effects.particles.ParticleInfluence
      extended by com.jmex.effects.particles.SwarmInfluence
All Implemented Interfaces:
Savable

public class SwarmInfluence
extends ParticleInfluence

Simple swarming influence for use with particles.

Author:
Joshua Slac

Field Summary
static float DEFAULT_DEVIANCE
           
static float DEFAULT_MAX_SPEED
           
static float DEFAULT_SPEED_BUMP
           
static float DEFAULT_SWARM_RANGE_SQ
           
static float DEFAULT_TURN_SPEED
           
 
Constructor Summary
SwarmInfluence()
           
SwarmInfluence(Vector3f offset, float swarmRange)
           
 
Method Summary
 void apply(float dt, Particle particle, int index)
          Apply the influence defined by this class on a given particle.
 float getDeviance()
           
 float getMaxSpeed()
           
 float getSpeedBump()
           
 Vector3f getSwarmOffset()
           
 float getSwarmRange()
           
 float getTurnSpeed()
           
 void prepare(ParticleSystem system)
          Gives the influence a chance to perform any necessary initialization immediately before ParticleInfluence.apply(float, com.jmex.effects.particles.Particle, int) is called on each particle for the current frame.
 void read(JMEImporter e)
           
 void setDeviance(float deviance)
           
 void setMaxSpeed(float maxSpeed)
           
 void setSpeedBump(float speedVariance)
           
 void setSwarmOffset(Vector3f offset)
           
 void setSwarmRange(float swarmRange)
           
 void setTurnSpeed(float turnSpeed)
           
 void write(JMEExporter e)
           
 
Methods inherited from class com.jmex.effects.particles.ParticleInfluence
getClassTag, isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SWARM_RANGE_SQ

public static final float DEFAULT_SWARM_RANGE_SQ
See Also:
Constant Field Values

DEFAULT_DEVIANCE

public static final float DEFAULT_DEVIANCE
See Also:
Constant Field Values

DEFAULT_TURN_SPEED

public static final float DEFAULT_TURN_SPEED
See Also:
Constant Field Values

DEFAULT_SPEED_BUMP

public static final float DEFAULT_SPEED_BUMP
See Also:
Constant Field Values

DEFAULT_MAX_SPEED

public static final float DEFAULT_MAX_SPEED
See Also:
Constant Field Values
Constructor Detail

SwarmInfluence

public SwarmInfluence()

SwarmInfluence

public SwarmInfluence(Vector3f offset,
                      float swarmRange)
Method Detail

prepare

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

Overrides:
prepare in class ParticleInfluence
Parameters:
system - the particle system containing the influence

apply

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

Specified by:
apply in class ParticleInfluence
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.

getSwarmRange

public float getSwarmRange()

setSwarmRange

public void setSwarmRange(float swarmRange)

getSwarmOffset

public Vector3f getSwarmOffset()

setSwarmOffset

public void setSwarmOffset(Vector3f offset)

getDeviance

public float getDeviance()

setDeviance

public void setDeviance(float deviance)

getSpeedBump

public float getSpeedBump()

setSpeedBump

public void setSpeedBump(float speedVariance)

getTurnSpeed

public float getTurnSpeed()

setTurnSpeed

public void setTurnSpeed(float turnSpeed)

getMaxSpeed

public float getMaxSpeed()

setMaxSpeed

public void setMaxSpeed(float maxSpeed)

write

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

read

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