com.threerings.opengl.effect
Class PositionHistory

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

public final class PositionHistory
extends Object

Stores all of the positions occupied by a particle up to a maximum interval and provides a means of retrieving an interpolated historical position.


Nested Class Summary
protected static class PositionHistory.Entry
          An entry in the history.
 
Field Summary
protected  ArrayList<PositionHistory.Entry> _entries
          The entries in the history.
protected  float _length
          The current length.
protected  ArrayList<PositionHistory.Entry> _pool
          The pool of entries to reuse.
protected  float _time
          The last time value recorded.
protected  Transform3D _transform
          The transform to apply to new entries.
 
Constructor Summary
PositionHistory()
           
 
Method Summary
protected  void addEntry(Vector3f position, float time)
          Adds an entry for the specified values, fetching one from the pool if possible.
 Vector3f get(float t, Vector3f result)
          Computes the position at some point in the past.
 void init(Vector3f initial, Transform3D transform)
          (Re)initializes the history.
 void record(Vector3f position, float elapsed, float length)
          Records a position occupied by the particle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_time

protected float _time
The last time value recorded.


_length

protected float _length
The current length.


_transform

protected Transform3D _transform
The transform to apply to new entries.


_entries

protected ArrayList<PositionHistory.Entry> _entries
The entries in the history.


_pool

protected ArrayList<PositionHistory.Entry> _pool
The pool of entries to reuse.

Constructor Detail

PositionHistory

public PositionHistory()
Method Detail

init

public void init(Vector3f initial,
                 Transform3D transform)
(Re)initializes the history.

Parameters:
initial - the initial position.
transform - the transform to apply to new entries, or null for none.

record

public void record(Vector3f position,
                   float elapsed,
                   float length)
Records a position occupied by the particle.


get

public Vector3f get(float t,
                    Vector3f result)
Computes the position at some point in the past.

Parameters:
t - the time parameter: zero for the oldest location, one for the newest.

addEntry

protected void addEntry(Vector3f position,
                        float time)
Adds an entry for the specified values, fetching one from the pool if possible.