com.jme.effects
Class Particle

java.lang.Object
  extended bycom.jme.effects.Particle

public class Particle
extends java.lang.Object

Particle defines a single Particle of a Particle system. Generally, you would not interact with this class directly.

Version:
$Id: Particle.java,v 1.16 2005/03/28 17:58:13 renanse Exp $
Author:
Joshua Slack

Field Summary
static int ALIVE
          Particle is currently active.
static int AVAILABLE
          Particle is available for spawning.
static int DEAD
          Particle is dead -- not in play.
 
Constructor Summary
Particle(ParticleManager parent, Vector3f speed, Vector3f iLocation, float lifeSpan)
          Particle constructor
 
Method Summary
 Vector3f getPosition()
           
 int getStatus()
           
 void recreateParticle(Vector3f speed, float lifeSpan)
          Reset particle conditions.
 void resetAge()
          Resets current age to 0
 boolean updateAndCheck(float secondsPassed)
          update position (using current location, speed and gravity), color (interpolating between start and end color), size (interpolating between start and end size) and current age of particle.
 void updateVerts()
          Update the vertices for this particle, taking size, direction of viewer and current location into account.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEAD

public static final int DEAD
Particle is dead -- not in play.

See Also:
Constant Field Values

ALIVE

public static final int ALIVE
Particle is currently active.

See Also:
Constant Field Values

AVAILABLE

public static final int AVAILABLE
Particle is available for spawning.

See Also:
Constant Field Values
Constructor Detail

Particle

public Particle(ParticleManager parent,
                Vector3f speed,
                Vector3f iLocation,
                float lifeSpan)
Particle constructor

Parameters:
parent - ParticleManager parent of this particle
speed - initial velocity of the particle in the x,y and z directions
iLocation - initial location of the particle
lifeSpan - how long the particle should live for
Method Detail

recreateParticle

public void recreateParticle(Vector3f speed,
                             float lifeSpan)
Reset particle conditions. Besides the passed in speeds and lifespan, we also reset color and size to their starting values (as given by parent.)

Parameters:
speed - initial velocity of recreated particle
lifeSpan - the recreated particle's new lifespan

updateVerts

public void updateVerts()
Update the vertices for this particle, taking size, direction of viewer and current location into account.


updateAndCheck

public boolean updateAndCheck(float secondsPassed)
update position (using current location, speed and gravity), color (interpolating between start and end color), size (interpolating between start and end size) and current age of particle. After updating the above, updateVerts() is called. if this particle's age is greater than its lifespan, it is considered dead.

Parameters:
secondsPassed - number of seconds passed since last update.
Returns:
true if this particle is not ALIVE

resetAge

public void resetAge()
Resets current age to 0


getPosition

public Vector3f getPosition()

getStatus

public int getStatus()