pslib
Class GenericParticle

java.lang.Object
  extended by pslib.GenericParticle
Direct Known Subclasses:
DynamicParticle

public class GenericParticle
extends java.lang.Object

GenericParticle Class

The GenericParticle class allows the creation of a particle with position, velocity, colour, size and alpha variables. The class is primarily designed to be extended with custom rendering routines.

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.


Constructor Summary
GenericParticle()
          Create a new object instance with default values
 
Method Summary
 float getAlpha()
          Return the particle alpha multiplier
 PSColour getColour()
          Return the current particle colour
 PSVector getPosition()
          Return a reference to the particle position vector
 float getSize()
          Return the current particle size
 PSVector getVelocity()
          Return a reference to the particle velocity vector
 void render(processing.opengl.PGraphicsOpenGL pgl)
          Render the particle within two-dimensional space to the specified rendering context
 void render(processing.opengl.PGraphicsOpenGL pgl, PSVector cpv, PSVector ctv, PSVector cuv)
          Render the particle within three-dimensional space to the specified rendering context
 void setAlpha(float alpha)
          Set the particle alpha
 void setColour(PSColour colour)
          Set the particle colour
 void setColour(PSColour colour, int time)
          Set the particle colour
 void setPosition(PSVector position)
          Set the particle position
 void setSize(float size)
          Set the particle size
 void setVelocity(PSVector velocity)
          Set the particle velocity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericParticle

public GenericParticle()
Create a new object instance with default values

Method Detail

getPosition

public PSVector getPosition()
Return a reference to the particle position vector

Returns:
a reference to the particle position vector

setPosition

public void setPosition(PSVector position)
Set the particle position

Parameters:
position - position

getVelocity

public PSVector getVelocity()
Return a reference to the particle velocity vector

Returns:
a reference to the particle velocity vector

setVelocity

public void setVelocity(PSVector velocity)
Set the particle velocity

Parameters:
velocity - velocity

getSize

public float getSize()
Return the current particle size

Returns:
the current particle size

setSize

public void setSize(float size)
Set the particle size

Parameters:
size - size

getColour

public PSColour getColour()
Return the current particle colour

Returns:
the current particle colour

setColour

public void setColour(PSColour colour)
Set the particle colour

Parameters:
colour - colour

setColour

public void setColour(PSColour colour,
                      int time)
Set the particle colour

Parameters:
colour - colour
time - transform duration

setAlpha

public void setAlpha(float alpha)
Set the particle alpha

Parameters:
alpha - alpha

getAlpha

public float getAlpha()
Return the particle alpha multiplier

Returns:
the particle alpha multiplier

render

public void render(processing.opengl.PGraphicsOpenGL pgl)
Render the particle within two-dimensional space to the specified rendering context

Parameters:
pgl - OpenGL renderer

render

public void render(processing.opengl.PGraphicsOpenGL pgl,
                   PSVector cpv,
                   PSVector ctv,
                   PSVector cuv)
Render the particle within three-dimensional space to the specified rendering context

Parameters:
pgl - OpenGL renderer
cpv - camera position vector
ctv - camera target vector
cuv - camera up vector