de.rico.engine.effect.particle
Class AbstractParticle

java.lang.Object
  extended by de.rico.engine.effect.particle.AbstractParticle
Direct Known Subclasses:
DDParticle, DLParticle, PSParticle

public abstract class AbstractParticle
extends java.lang.Object

This class represents an abstract particle

Author:
Frank Bruns

Constructor Summary
AbstractParticle(float size, long maxAge)
          Creates a new particle
 
Method Summary
abstract  void draw(javax.media.opengl.GL gl, float x, float y, float z, com.sun.opengl.util.texture.Texture texture)
          Draws the particle to the scene
 float getAplha()
          Returns the alpha value of the particle
 float[] getColor()
          Returns the current RGBA color of the particle as an array of four values
 long getCurrentAge()
          Returns the current age of the particle
 float[] getEndColor()
          Returns the RGBA end color of the particle as an array of four values
 float getMass()
          Returns the mass value for the particle
 long getMaximumAge()
          Returns the maximum age of the particle
 Point3D getPosition()
          Returns the current position of the particle
 Point3D getRotation()
          Returns the rotation of the particle.
 float getSize()
          Returns the designated size of the particle
 float[] getStartColor()
          Returns the RGBA start color of the particle as an array of four values
 Point3D getVelocity()
          Returns the velocity of the particle as a directional vector
 void setAlpha(float alpha)
          Set the current alpha value of the particle to the specified parameter.
 void setColor(float red, float green, float blue, float alpha)
           
 void setCurrentAge(long age)
          Sets the current particle age to the specified value
 void setEndColor(float red, float green, float blue, float alpha)
          Sets the RGBA end color of the particle to the specified values
 void setMass(float mass)
          Sets the particle's mass to the specified value
 void setMaximumAge(long maxAge)
          Sets the maximum age of the particle to the specified value
 void setPosition(float x, float y, float z)
          Sets the particle to the specified coordinates
 void setPosition(Point3D position)
          Sets the particle to the specified coordinates
 void setRotation(float x, float y, float z)
          Sets the particle's rotation to the specified values
 void setRotation(Point3D rot)
          Sets the particle's rotation to the specified values
 void setRotationFactor(Point3D factor)
          Sets the rotation factor for the particle.
 void setSize(float size)
          Sets the particle size to the specified value
 void setStartColor(float red, float green, float blue, float alpha)
          Sets the RGBA start color of the particle to the specified values
 void setVelocity(float x, float y, float z)
          Sets the particle's velocity to the specified values
 void setVelocity(Point3D velocity)
          Sets the particle's velocity to the specified values
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractParticle

public AbstractParticle(float size,
                        long maxAge)
Creates a new particle

Parameters:
size - size of the particle
maxAge - maximum age the particle can reach (in miliseconds)
Method Detail

setStartColor

public void setStartColor(float red,
                          float green,
                          float blue,
                          float alpha)
Sets the RGBA start color of the particle to the specified values

Parameters:
red - amount of red
green - amount of green
blue - amount of blue
alpha - alpha value

getStartColor

public float[] getStartColor()
Returns the RGBA start color of the particle as an array of four values

Returns:
RGBA start color of the particle

setEndColor

public void setEndColor(float red,
                        float green,
                        float blue,
                        float alpha)
Sets the RGBA end color of the particle to the specified values

Parameters:
red - amount of red
green - amount of green
blue - amount of blue
alpha - alpha value

getEndColor

public float[] getEndColor()
Returns the RGBA end color of the particle as an array of four values

Returns:
RGBA end color of the particle

setColor

public void setColor(float red,
                     float green,
                     float blue,
                     float alpha)

getColor

public float[] getColor()
Returns the current RGBA color of the particle as an array of four values

Returns:
RGBA color of the particle

setAlpha

public void setAlpha(float alpha)
Set the current alpha value of the particle to the specified parameter.

Parameters:
alpha - new alpha value

getAplha

public float getAplha()
Returns the alpha value of the particle

Returns:
particle's alpha value

getSize

public float getSize()
Returns the designated size of the particle

Returns:
particle's size

setSize

public void setSize(float size)
Sets the particle size to the specified value

Parameters:
size - particle's size

getCurrentAge

public long getCurrentAge()
Returns the current age of the particle

Returns:
current particle age

setCurrentAge

public void setCurrentAge(long age)
Sets the current particle age to the specified value

Parameters:
age - the new current particle age

getMass

public float getMass()
Returns the mass value for the particle

Returns:
mass of the particle

setMass

public void setMass(float mass)
Sets the particle's mass to the specified value

Parameters:
mass - new particle mass

getMaximumAge

public long getMaximumAge()
Returns the maximum age of the particle

Returns:
particle's maximum age

setMaximumAge

public void setMaximumAge(long maxAge)
Sets the maximum age of the particle to the specified value

Parameters:
maxAge - new maximum age of the particle

getPosition

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

Returns:
particle's current position

setPosition

public void setPosition(Point3D position)
Sets the particle to the specified coordinates

Parameters:
position - new particle position

setPosition

public void setPosition(float x,
                        float y,
                        float z)
Sets the particle to the specified coordinates

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

getVelocity

public Point3D getVelocity()
Returns the velocity of the particle as a directional vector

Returns:
particle's velocity

setVelocity

public void setVelocity(Point3D velocity)
Sets the particle's velocity to the specified values

Parameters:
velocity - new particle velocity

setVelocity

public void setVelocity(float x,
                        float y,
                        float z)
Sets the particle's velocity to the specified values

Parameters:
x - x-velocity
y - y-velocity
z - z-velocity

getRotation

public Point3D getRotation()
Returns the rotation of the particle.

Returns:
particle's rotation vector.

setRotation

public void setRotation(Point3D rot)
Sets the particle's rotation to the specified values

Parameters:
rot - new particle rotation vector

setRotation

public void setRotation(float x,
                        float y,
                        float z)
Sets the particle's rotation to the specified values

Parameters:
x - x-rotation
y - y-rotation
z - z-rotation

setRotationFactor

public void setRotationFactor(Point3D factor)
Sets the rotation factor for the particle.

Parameters:
factor - rotation factor

draw

public abstract void draw(javax.media.opengl.GL gl,
                          float x,
                          float y,
                          float z,
                          com.sun.opengl.util.texture.Texture texture)
Draws the particle to the scene

Parameters:
gl -
x - x-coordinate
y - y-coordinate
z - z-coordinate
texture - texture to assign to the particle