pslib
Class RibbonParticle

java.lang.Object
  extended by pslib.GenericParticle
      extended by pslib.DynamicParticle
          extended by pslib.BufferedParticle
              extended by pslib.RibbonParticle
All Implemented Interfaces:
PSConstants

public class RibbonParticle
extends BufferedParticle

Ribbon Class

The Ribbon object extends the functionality of the buffered particle, by incorporating ribbon rendering functionality.

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/.


Field Summary
 
Fields inherited from interface pslib.PSConstants
CAM2D_LOOK, CAM2D_RIGHT, CAM2D_UP, CORNER, INVERSE, INVERSE_TRIANGULAR, LEADING, LINEAR, MIDPOINT, NONE, STATIC, TRAILING, TRIANGULAR
 
Constructor Summary
RibbonParticle(int b)
          Create a new object instance with the specified buffer size
RibbonParticle(int b, int d)
          Create a new object instance with the specified buffer size and decay
 
Method Summary
 RibbonParticle copy()
          Return a copy of this particle
protected  PSVertex[] getRibbonVertices(PSVector cpv)
          Calculate the ribbon vertices and return as an array of PSVertex objects
 void map(RibbonParticle p)
          Map the properties of this particle to that specified preserving references
 void render(processing.opengl.PGraphicsOpenGL pgl)
          Render the ribbon to the specified OpenGL renderer
 void render(processing.opengl.PGraphicsOpenGL pgl, PSVector cpv, PSVector ctv, PSVector cuv)
          Render the ribbon to the specified OpenGL renderer
 void setAlphaTaper(float t)
          Set the ribbon alpha taper value
 void setAlphaTaperCurve(float c)
          Set the ribbon alpha taper curve
 void setCapSize(float l)
          Set the cap length multiplier
 void setSizeTaper(float t)
          Set the ribbon size taper value
 void setSizeTaperCurve(float c)
          Set the ribbon size taper curve
 
Methods inherited from class pslib.BufferedParticle
getBuffer, getBufferSize, getCumulativeLength, getCumulativePositions, getRelativePositions, getTaperValues, initialiseBuffer, isInitialised, map, resizeBuffer, setPosition, setSpacing
 
Methods inherited from class pslib.DynamicParticle
clearBehaviour, debug, debug, getBehaviour, getDecay, getDecayTime, getInitialDecayTime, getMass, getRenderAlpha, getRenderSize, getSnapshot, isDead, isDynamic, map, setAlphaEnvelope, setBehaviour, setBehaviour, setDecayTime, setMass, setSizeEnvelope, update
 
Methods inherited from class pslib.GenericParticle
getAlpha, getColour, getPosition, getSize, getVelocity, setAlpha, setColour, setColour, setSize, setVelocity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RibbonParticle

public RibbonParticle(int b)
Create a new object instance with the specified buffer size

Parameters:
b - buffer size

RibbonParticle

public RibbonParticle(int b,
                      int d)
Create a new object instance with the specified buffer size and decay

Parameters:
b - buffer size
d - decay (ms)
Method Detail

setSizeTaper

public final void setSizeTaper(float t)
Set the ribbon size taper value

Default = 1.0

Parameters:
t - taper

setSizeTaperCurve

public final void setSizeTaperCurve(float c)
Set the ribbon size taper curve

Default = 1.0

Parameters:
c - curve

setAlphaTaper

public final void setAlphaTaper(float t)
Set the ribbon alpha taper value

Default = 1.0

Parameters:
t - taper

setCapSize

public final void setCapSize(float l)
Set the cap length multiplier

Default = 0.25

Parameters:
l - length

setAlphaTaperCurve

public final void setAlphaTaperCurve(float c)
Set the ribbon alpha taper curve

Default = 1.0

Parameters:
c - curve

render

public void render(processing.opengl.PGraphicsOpenGL pgl)
Render the ribbon to the specified OpenGL renderer

Overrides:
render in class DynamicParticle
Parameters:
pgl - OpenGL renderer

render

public void render(processing.opengl.PGraphicsOpenGL pgl,
                   PSVector cpv,
                   PSVector ctv,
                   PSVector cuv)
Render the ribbon to the specified OpenGL renderer

Overrides:
render in class DynamicParticle
Parameters:
pgl - OpenGL renderer
cpv - camera position vector
ctv - camera target vector
cuv - camera up vector

copy

public RibbonParticle copy()
Return a copy of this particle

The returned copy will use the size and alpha taper variables of the source particle and will adhere to the rules defined in both BufferedParticle.map() and DynamicParticle.map().

Overrides:
copy in class BufferedParticle
Returns:
a copy of this particle
See Also:
BufferedParticle, DynamicParticle

map

public final void map(RibbonParticle p)
Map the properties of this particle to that specified preserving references

The returned object takes a copy of all ribbon particle variables. BufferedParticle and DynamicParticle variables are mapped based on the rules defined in BufferedParticle.map() and DynamicParticle.map() respectively.

Parameters:
p - particle
See Also:
BufferedParticle, DynamicParticle

getRibbonVertices

protected final PSVertex[] getRibbonVertices(PSVector cpv)
Calculate the ribbon vertices and return as an array of PSVertex objects

Parameters:
cpv - camera position vector
Returns:
the ribbon vertices as an array of PSVertex objects