com.threerings.opengl.effect
Class Particle

java.lang.Object
  extended by com.threerings.opengl.effect.Particle

public final class Particle
extends Object

Contains the state of a single particle.


Field Summary
protected  float _age
          The particle's proportional age (0 to 1).
protected  AlphaMode _alphaMode
          The particle's alpha mode.
protected  Vector3f _angularVelocity
          The particle's angular velocity.
protected  Color4f _color
          The particle's current color.
protected  ColorFunction _colorfunc
          The particle's color as a function of its proportional age.
protected  float _frame
          The particle's current texture frame.
protected  FloatFunction _framefunc
          The particle's texture frame as a function of its proportional age.
protected  PositionHistory _history
          The particle's position history.
protected  float _length
          The particle's current length.
protected  FloatFunction _lengthfunc
          The particle's length as a function of its proportional age.
protected  float _lifescale
          The reciprocal of the particle's lifespan.
protected  Quaternion _orientation
          The particle's orientation.
protected  Vector3f _position
          The particle's position.
protected  float _size
          The particle's current size.
protected  FloatFunction _sizefunc
          The particle's size as a function of its proportional age.
protected  Vector3f _velocity
          The particle's (linear) velocity.
 float depth
          The depth of the particle (used for depth sorting).
 
Constructor Summary
Particle()
           
 
Method Summary
 Vector3f getAngularVelocity()
          Returns a reference to the particle's angular velocity.
 Color4f getColor()
          Returns a reference to the particle's color.
 float getFrame()
          Returns the particle's texture frame.
 Quaternion getOrientation()
          Returns a reference to the particle's orientation.
 Vector3f getPosition()
          Returns a reference to the particle's position.
 Vector3f getPosition(float t, Vector3f result)
          Computes the particle's position at some point in its past (where 0 is the oldest position and 1 is the newest).
 float getSize()
          Returns the particle's size.
 float getSize(float t)
          Computes the particle's size at some point in its past.
 Vector3f getVelocity()
          Returns a reference to the particle's (linear) velocity.
 void init(float lifespan, AlphaMode alphaMode, ColorFunctionVariable color, FloatFunctionVariable size, FloatFunctionVariable length, FloatFunctionVariable frame, Transform3D historyTransform)
          Initializes the particle.
 void setSize(float size)
          Sets the particle's size.
 boolean tick(float elapsed)
          Updates the particle state based on the elapsed time in seconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

depth

public float depth
The depth of the particle (used for depth sorting).


_age

protected float _age
The particle's proportional age (0 to 1).


_lifescale

protected float _lifescale
The reciprocal of the particle's lifespan.


_position

protected Vector3f _position
The particle's position.


_history

protected PositionHistory _history
The particle's position history.


_velocity

protected Vector3f _velocity
The particle's (linear) velocity.


_orientation

protected Quaternion _orientation
The particle's orientation.


_angularVelocity

protected Vector3f _angularVelocity
The particle's angular velocity.


_alphaMode

protected AlphaMode _alphaMode
The particle's alpha mode.


_colorfunc

protected ColorFunction _colorfunc
The particle's color as a function of its proportional age.


_color

protected Color4f _color
The particle's current color.


_sizefunc

protected FloatFunction _sizefunc
The particle's size as a function of its proportional age.


_size

protected float _size
The particle's current size.


_lengthfunc

protected FloatFunction _lengthfunc
The particle's length as a function of its proportional age.


_length

protected float _length
The particle's current length.


_framefunc

protected FloatFunction _framefunc
The particle's texture frame as a function of its proportional age.


_frame

protected float _frame
The particle's current texture frame.

Constructor Detail

Particle

public Particle()
Method Detail

getPosition

public Vector3f getPosition()
Returns a reference to the particle's position.


getPosition

public Vector3f getPosition(float t,
                            Vector3f result)
Computes the particle's position at some point in its past (where 0 is the oldest position and 1 is the newest).


getSize

public float getSize(float t)
Computes the particle's size at some point in its past.


getVelocity

public Vector3f getVelocity()
Returns a reference to the particle's (linear) velocity.


getOrientation

public Quaternion getOrientation()
Returns a reference to the particle's orientation.


getAngularVelocity

public Vector3f getAngularVelocity()
Returns a reference to the particle's angular velocity.


getColor

public Color4f getColor()
Returns a reference to the particle's color.


setSize

public void setSize(float size)
Sets the particle's size.


getSize

public float getSize()
Returns the particle's size.


getFrame

public float getFrame()
Returns the particle's texture frame.


init

public void init(float lifespan,
                 AlphaMode alphaMode,
                 ColorFunctionVariable color,
                 FloatFunctionVariable size,
                 FloatFunctionVariable length,
                 FloatFunctionVariable frame,
                 Transform3D historyTransform)
Initializes the particle.


tick

public boolean tick(float elapsed)
Updates the particle state based on the elapsed time in seconds.

Returns:
true if the particle is still alive, false if it is dead.