|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpslib.GenericParticle
pslib.DynamicParticle
pslib.ParentParticle
public class ParentParticle
ParentParticle Class
The ParentParticle object allows multiple DynamicParticle objects to be attached to a single parent particle. Attached objects inherit the position and velocity properties of the parent.
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 | |
---|---|
ParentParticle(int b)
Create a new object instance with the specified buffer size |
|
ParentParticle(int b,
int d)
Create a new object instance with the specified buffer size and decay time |
Method Summary | |
---|---|
int |
activeParticles()
Return the amount of active particles |
boolean |
attach(DynamicParticle p)
Attach a particle to the buffer |
int |
attach(DynamicParticle[] p)
Attach an array of particles to the buffer |
int |
attachedParticles()
Return the total attached particles |
void |
clear()
Clear the buffer |
ParentParticle |
copy()
Return a copy of this particle |
void |
debug(processing.opengl.PGraphicsOpenGL pgl)
Render the particle location to the specified OpenGL renderer |
void |
debug(processing.opengl.PGraphicsOpenGL pgl,
PSVector cpv,
PSVector ctv,
PSVector cuv)
Render the particle location to the specified OpenGL renderer |
int |
getBufferSize()
Return the buffer size |
boolean |
isDead()
Return true if this particle and all attached particles are dead |
void |
map(ParentParticle p)
Map the properties of this particle to that specified. |
boolean |
remove(DynamicParticle p)
Remove a particle from the buffer |
void |
render(processing.opengl.PGraphicsOpenGL pgl)
Render all attached particles to the specified OpenGL renderer |
void |
render(processing.opengl.PGraphicsOpenGL pgl,
PSVector cpv,
PSVector ctv,
PSVector cuv)
Render all attached particles to the specified OpenGL renderer |
void |
setAlpha(float a)
Set the alpha value of all attached particles |
void |
setBufferSize(int s)
Set the buffer size |
void |
setColour(PSColour c)
Set the colour of all attached particles |
void |
setColour(PSColour c,
int t)
Set the colour of all attached particles with the specified fade time |
void |
setColour(WeightedList<PSColour> c)
Set the colour of all attached particles |
void |
setColour(WeightedList<PSColour> c,
int t)
Set the colour of all attached particles with the specified fade time |
void |
setPosition(PSVector v)
Set the position of this particle and any attached particles |
void |
setVelocity(PSVector v)
Set the velocity of this particle and any attached particles |
DynamicParticle[] |
toArray()
Return all active particles as an array |
void |
update()
Update this and all attached particles |
Methods inherited from class pslib.DynamicParticle |
---|
clearBehaviour, getBehaviour, getDecay, getDecayTime, getInitialDecayTime, getMass, getRenderAlpha, getRenderSize, getSnapshot, isDynamic, map, setAlphaEnvelope, setBehaviour, setBehaviour, setDecayTime, setMass, setSizeEnvelope |
Methods inherited from class pslib.GenericParticle |
---|
getAlpha, getColour, getPosition, getSize, getVelocity, setSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParentParticle(int b)
b
- buffer sizepublic ParentParticle(int b, int d)
b
- buffer sized
- decay (ms)Method Detail |
---|
public void setPosition(PSVector v)
setPosition
in class GenericParticle
v
- position vectorpublic void setVelocity(PSVector v)
setVelocity
in class GenericParticle
v
- velocity vectorpublic void setColour(PSColour c)
setColour
in class GenericParticle
c
- colourpublic void setColour(PSColour c, int t)
setColour
in class GenericParticle
c
- colourt
- fade time (ms)public void setColour(WeightedList<PSColour> c)
Particle colour will be assigned at random from the specified WeightedList
c
- colour listpublic void setColour(WeightedList<PSColour> c, int t)
Particle colour will be assigned at random from the specified WeightedList
c
- colour listt
- fade time (ms)public void setAlpha(float a)
setAlpha
in class GenericParticle
a
- alphapublic final int getBufferSize()
public final int attachedParticles()
public final void setBufferSize(int s)
If the new size is less than the current active particle count, particles will be culled eldest first.
s
- buffer sizepublic final int activeParticles()
public final DynamicParticle[] toArray()
public boolean isDead()
isDead
in class DynamicParticle
public boolean attach(DynamicParticle p)
p
- particle
public int attach(DynamicParticle[] p)
p
- particle
public boolean remove(DynamicParticle p)
If multiple references to the particle exist, they will all be removed.
p
- DynamicParticle
public final void clear()
public void update()
update
in class DynamicParticle
public void render(processing.opengl.PGraphicsOpenGL pgl)
render
in class DynamicParticle
pgl
- OpenGL rendererpublic void render(processing.opengl.PGraphicsOpenGL pgl, PSVector cpv, PSVector ctv, PSVector cuv)
render
in class DynamicParticle
pgl
- OpenGL renderercpv
- camera position vectorctv
- camera target vectorcuv
- camera up vector;public void debug(processing.opengl.PGraphicsOpenGL pgl)
debug
in class DynamicParticle
pgl
- OpenGL rendererpublic void debug(processing.opengl.PGraphicsOpenGL pgl, PSVector cpv, PSVector ctv, PSVector cuv)
debug
in class DynamicParticle
pgl
- OpenGL renderercpv
- camera position vectorctv
- camera target vectorcuv
- camera up vectorpublic ParentParticle copy()
The returned object will contain a copy of all attached particles within
this object and will adhere to the rules defined in the
copy
in class DynamicParticle
DynamicParticle
public final void map(ParentParticle p)
The returned object takes a copy of all attached particles within this
object. DynamicParticle variables are mapped based on the rules defined in
DynamicParticle.map()
.
p
- particleDynamicParticle
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |