|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.scene.Controller
com.jme.effects.ParticleManager
ParticleManager
Example usage:
ParticleManager manager = new ParticleManager(300, display.getRenderer().getCamera());
manager.getParticles().addController(manager);
someNode.attachChild(manager.getParticles());
See the method comments for more usage information.
note: The idea of using one TriMesh to control particles and much of the code
related to picking starting angles was kindly donated by Java Cool Dude.
| Field Summary | |
static int |
GS_LINE
|
static int |
GS_MESH
|
static int |
GS_POINT
|
static int |
GS_RECTANGLE
|
| Fields inherited from class com.jme.scene.Controller |
RT_CLAMP, RT_CYCLE, RT_WRAP |
| Constructor Summary | |
ParticleManager(int noParticles,
Camera cam)
ParticleManager constructor |
|
| Method Summary | |
java.lang.Object |
clone()
Clones every aspect of this manager into a new manager |
void |
forceRespawn()
Force all dead particles back to life. |
Camera |
getCamera()
Get the currently set Camera used for billboad calcs. |
boolean |
getControlFlow()
Does this manager regulate the particle flow? |
Vector3f |
getEmissionDirection()
getEmissionDirection returns the emission direction. |
float |
getEmissionMaximumAngle()
getEmissionMaximumAngle returns the maximum emission angle. |
ColorRGBA |
getEndColor()
getEndColor returns the ending color. |
float |
getEndSize()
getEndSize returns the end size. |
Geometry |
getGeoMesh()
getGeoMesh returns the currently set geometry mesh. |
int |
getGeometry()
Get which Geometry method is being used by the underlying system. |
Vector3f |
getGravityForce()
getGravityForce returns the gravity force. |
float |
getInitialVelocity()
Get the acceleration set in this manager. |
int |
getIterations()
Return the number this manager has warmed up |
Line |
getLine()
getLine returns the currently set line segment. |
Particle[] |
getParticleArray()
|
TriMesh |
getParticles()
Get the TriMesh that holds all of the particle information for display. |
float |
getParticlesMinimumLifeTime()
getParticlesMinimumLifeTime returns the minimum life time of a particle. |
int |
getParticlesNumber()
Get the number of particles managed by this manager. |
Vector3f |
getParticlesOrigin()
Get the origin point set in this manager. |
float |
getParticleSpinSpeed()
getParticleSpinSpeed returns the current spin speed of particles. |
float |
getPrecision()
Get how soon after the last update the manager will send updates to the particles. |
float |
getRandomMod()
getRandomFactor returns the current randomness of particles. |
Rectangle |
getRectangle()
getRectangle returns the currently set rectangle segment. |
int |
getReleaseRate()
Get the number of particles the manager should release per second. |
float |
getReleaseVariance()
Get the variance possible on the release rate. |
ColorRGBA |
getStartColor()
getStartColor returns the starting color. |
float |
getStartSize()
getStartSize returns the start size. |
void |
setCamera(Camera cam)
Set the Camera whose position should be used to determine billboard facing direction. |
void |
setControlFlow(boolean regulate)
Set the regulate flow property on the manager. |
void |
setEmissionDirection(Vector3f direction)
Set the general direction that particles are emitted in. |
void |
setEmissionMaximumAngle(float f)
Set the maximum angle (in radians) that particles can be emitted away from the emission direction. |
void |
setEndColor(ColorRGBA color)
Set the end color for particles. |
void |
setEndSize(float size)
Set the size particles will approach as they age. |
void |
setGeometry(Geometry mesh)
Set a Geometry's verts to be the random emission points |
void |
setGeometry(int type)
Set which Geometry method is being used by the underlying system. |
void |
setGeometry(Line line)
Set a line segment to be used as the "emittor". |
void |
setGeometry(Rectangle rect)
Set a rectangular patch to be used as the "emittor". |
void |
setGravityForce(Vector3f force)
Set a vector describing the force of gravity on a particle. |
void |
setInitialVelocity(float velocity)
Set the acceleration for any new particles created (or recreated) by this manager. |
void |
setIterations(int iterations)
Sets the iterations for the warmup and calls warmUp with the number of iterations as the argument |
void |
setParticlesMinimumLifeTime(float lifeSpan)
Set the minimum lifespan of new particles (or recreated) managed by this manager. |
void |
setParticlesOrigin(Vector3f origin)
Set the origin for any new particles created (or recreated) by this manager. |
void |
setParticleSpinSpeed(float speed)
Set the spinSpeed of new particles managed by this manager. |
void |
setPrecision(float precision)
Set how soon after the last update the manager will send updates to the particles. |
void |
setRandomMod(float mod)
Set the "randomness" modifier. |
void |
setReleaseRate(int particlesPerSecond)
Set the number of particles the manager should release per second. |
void |
setReleaseVariance(float variance)
Set the variance possible on the release rate. |
void |
setStartColor(ColorRGBA color)
Set the start color for particles. |
void |
setStartSize(float size)
Set the size of the new particles generated by this manager. |
void |
update(float secondsPassed)
Update the particles managed by this manager. |
void |
updateRotationMatrix()
|
void |
warmUp(int iterations)
Runs the update method of this particle manager for iteration seconds with an update every .1 seconds (IE iterations * 10
update(.1f) calls). |
| Methods inherited from class com.jme.scene.Controller |
getMaxTime, getMinTime, getRepeatType, getSpeed, isActive, putClone, setActive, setMaxTime, setMinTime, setRepeatType, setSpeed |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int GS_POINT
public static final int GS_LINE
public static final int GS_RECTANGLE
public static final int GS_MESH
| Constructor Detail |
public ParticleManager(int noParticles,
Camera cam)
noParticles - Desired number of particles in this system.cam - The camera to have the billboarded particles face.| Method Detail |
public void update(float secondsPassed)
update in class ControllersecondsPassed - floatpublic void forceRespawn()
public void updateRotationMatrix()
public void setParticlesOrigin(Vector3f origin)
origin - new origin positionpublic Vector3f getParticlesOrigin()
public void setInitialVelocity(float velocity)
velocity - particle v0public float getInitialVelocity()
public void setStartColor(ColorRGBA color)
color - The start color.public ColorRGBA getStartColor()
getStartColor returns the starting color.
public void setEndColor(ColorRGBA color)
color - ColorRGBA The ending color.public ColorRGBA getEndColor()
public void setCamera(Camera cam)
cam - Camerapublic Camera getCamera()
public void setGravityForce(Vector3f force)
force - Vector3fpublic Vector3f getGravityForce()
public void setStartSize(float size)
size - Start size.public float getStartSize()
public void setEndSize(float size)
size - The ending size.public float getEndSize()
public void setEmissionDirection(Vector3f direction)
direction - Vector3fpublic Vector3f getEmissionDirection()
public void setEmissionMaximumAngle(float f)
f - The new emission maximum angle.public float getEmissionMaximumAngle()
public void setParticlesMinimumLifeTime(float lifeSpan)
lifeSpan - floatpublic float getParticlesMinimumLifeTime()
public void setParticleSpinSpeed(float speed)
speed - floatpublic float getParticleSpinSpeed()
public void setRandomMod(float mod)
mod - The new randomness of particle information.public float getRandomMod()
public int getParticlesNumber()
public int getReleaseRate()
public void setReleaseRate(int particlesPerSecond)
particlesPerSecond - number of particles per secondpublic float getPrecision()
public void setPrecision(float precision)
precision - in secondspublic float getReleaseVariance()
public void setReleaseVariance(float variance)
variance - release rate +/- variance as a percent (eg. .5 = 50%)public boolean getControlFlow()
public void setControlFlow(boolean regulate)
regulate - regulate particle flow.public TriMesh getParticles()
public int getGeometry()
public void setGeometry(int type)
type - Geometry type to usepublic void setGeometry(Line line)
line - New emittor line segment.public void setGeometry(Rectangle rect)
rect - New rectangular patch.public void setGeometry(Geometry mesh)
mesh - The new geometry random verts.public Line getLine()
public Rectangle getRectangle()
public Geometry getGeoMesh()
public int getIterations()
public void setIterations(int iterations)
iterations - public void warmUp(int iterations)
iterations * 10
update(.1f) calls). This is used to "warm up" and get the particle
manager going.
iterations - The number of iterations to warm up.public java.lang.Object clone()
public Particle[] getParticleArray()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||