de.rico.engine.effect.particle
Class AbstractParticleEffect

java.lang.Object
  extended by de.rico.engine.effect.particle.AbstractParticleEffect
Direct Known Subclasses:
Explosion, Fire, FirePS, Rain, Smoke

public abstract class AbstractParticleEffect
extends java.lang.Object

This class represents an abstract particle effect. It uses particles and particle containers

Author:
Frank Bruns

Constructor Summary
AbstractParticleEffect(float x, float y, float z, float size, int numberOfParticles, long maxPartAge, long creationIntervall)
          Creates a new particle effect with the specified parameters
 
Method Summary
 void draw(javax.media.opengl.GL gl)
          Draws the particle effect to the scene.
 long getCreationInterval()
          Returns the particle creation interval.
 long getMaxPartAge()
          Returns the max particle age.
 int getMaxParticleCount()
          Returns the maximum number of particles for the effect at the same time.
 float getParticleSize()
          Returns the particle size.
 Point3D getPosition()
          Returns the position of the particle effect
 java.lang.String getTexturePath()
          Returns the path to the assigned texture, null else.
 void setEnabled(boolean enable)
          Sets whether the particle effect shall be drawn
 void setPosition(float x, float y, float z)
          Sets the position of the effect
 void setPosition(Point3D position)
          Sets the position of the effect
 void setTexture(java.lang.String path)
          Assigns the texture associated to the specified file path to the particle effect.
 void update(long elapsedTime)
          Updates the particles of the particle effect
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractParticleEffect

public AbstractParticleEffect(float x,
                              float y,
                              float z,
                              float size,
                              int numberOfParticles,
                              long maxPartAge,
                              long creationIntervall)
Creates a new particle effect with the specified parameters

Parameters:
x - x-coordinate
y - y-coordinate
z - z-coordinate
size - particle size
numberOfParticles - number of maximum particles to use
maxPartAge - maximum age of a particle
creationIntervall - intervall between the generation of two particles (in miliseconds)
Method Detail

getMaxPartAge

public long getMaxPartAge()
Returns the max particle age.

Returns:
the max particle age

getParticleSize

public float getParticleSize()
Returns the particle size.

Returns:
the particle size

getCreationInterval

public long getCreationInterval()
Returns the particle creation interval.

Returns:
particle creation interval

getMaxParticleCount

public int getMaxParticleCount()
Returns the maximum number of particles for the effect at the same time.

Returns:
max number of particles at same time

setPosition

public void setPosition(Point3D position)
Sets the position of the effect

Parameters:
position - effect's position

setPosition

public void setPosition(float x,
                        float y,
                        float z)
Sets the position of the effect

Parameters:
x - x-coordinate
y - y-coordinate
z - z-coordinate

getPosition

public Point3D getPosition()
Returns the position of the particle effect

Returns:
position of the particle effect

setTexture

public void setTexture(java.lang.String path)
Assigns the texture associated to the specified file path to the particle effect.
Note: The black colored area of the texture file will be transparent. Usually the edge areas of the texture are black colored, to get transparent.

Parameters:
path - path the texture

getTexturePath

public java.lang.String getTexturePath()
Returns the path to the assigned texture, null else.

Returns:
path to texture

setEnabled

public void setEnabled(boolean enable)
Sets whether the particle effect shall be drawn

Parameters:
enable - draw particle effect? --> true = yes, false = no

draw

public void draw(javax.media.opengl.GL gl)
Draws the particle effect to the scene. Particle effects are not affected by the the engines lighting system.

Parameters:
gl -

update

public void update(long elapsedTime)
Updates the particles of the particle effect

Parameters:
elapsedTime - time between two frames