Class ParticleController
java.lang.Object
com.ardor3d.scenegraph.controller.ComplexSpatialController<ParticleSystem>
com.ardor3d.extension.effect.particle.ParticleController
- All Implemented Interfaces:
SpatialController<ParticleSystem>
,Savable
,Serializable
ParticleController
controls and maintains the parameters of a particle system over time.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ardor3d.scenegraph.controller.ComplexSpatialController
ComplexSpatialController.RepeatType
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addInfluence
(ParticleInfluence influence) Add an external influence to this particle controller.void
addListener
(ParticleControllerListener listener) Subscribe a listener to receive mouse events.void
boolean
containsListener
(ParticleControllerListener listener) Check if a listener is allready added to this ParticleControllerReturns the list of influences acting on this particle controller.int
Return the number this manager has warmed upGet all added ParticleController listenersdouble
Get how soon after the last update the manager will send updates to the particles.double
Get the variance possible on the release rate. 0.0f = no variance 0.5f = between releaseRate / 2f and 1.5f * releaseRateprotected void
boolean
Does this manager regulate the particle flow?boolean
Does this manager use the particle's bounding volume to limit updates?void
read
(InputCapsule capsule) boolean
removeInfluence
(ParticleInfluence influence) Remove an influence from this particle controller.void
removeListener
(ParticleControllerListener listener) Unsubscribe a listener.void
Remove all listeners and disable event generation.void
void
setControlFlow
(boolean regulate) Set the regulate flow property on the manager.void
setIterations
(int iterations) Sets the iterations for the warmup and calls warmUp with the number of iterations as the argumentvoid
setPrecision
(double precision) Set how soon after the last update the manager will send updates to the particles.void
setReleaseVariance
(double variance) Set the variance possible on the release rate.void
setSpawnEnabled
(boolean spawnEnabled) void
setUpdateOnlyInView
(boolean updateOnlyInView) Set the updateOnlyInView property on the manager.void
setViewCamera
(Camera viewCamera) void
update
(double secondsPassed, ParticleSystem particles) Update the particles managed by this manager.void
warmUp
(int iterations, ParticleSystem particles) Runs the update method of this particle manager X number of times passing .1 seconds for each call.void
write
(OutputCapsule capsule) Methods inherited from class com.ardor3d.scenegraph.controller.ComplexSpatialController
getClassTag, getControllerValues, getMaxTime, getMinTime, getRepeatType, getSpeed, isActive, isRepeatTypeClamp, isRepeatTypeCycle, isRepeatTypeWrap, setActive, setControllerValues, setMaxTime, setMinTime, setRepeatType, setSpeed
-
Field Details
-
listeners
-
_ignoreOneUpdate
protected boolean _ignoreOneUpdate
-
-
Constructor Details
-
ParticleController
public ParticleController()ParticleController constructor
-
-
Method Details
-
ignoreNextUpdate
protected void ignoreNextUpdate() -
update
Update the particles managed by this manager. If any particles are "dead" recreate them at the origin position (which may be a point, line or rectangle.)- Specified by:
update
in interfaceSpatialController<ParticleSystem>
- Specified by:
update
in classComplexSpatialController<ParticleSystem>
- Parameters:
secondsPassed
- double precision timeparticles
- the particles we are updating
-
getPrecision
public double getPrecision()Get how soon after the last update the manager will send updates to the particles.- Returns:
- The precision.
-
setPrecision
public void setPrecision(double precision) Set how soon after the last update the manager will send updates to the particles. Defaults to .01f (10ms)
This means that if an update is called every 2ms (e.g. running at 500 FPS) the particles position and stats will be updated every fifth frame with the elapsed time (in this case, 10ms) since previous update.- Parameters:
precision
- in seconds
-
getReleaseVariance
public double getReleaseVariance()Get the variance possible on the release rate. 0.0f = no variance 0.5f = between releaseRate / 2f and 1.5f * releaseRate- Returns:
- release variance as a percent.
-
setReleaseVariance
public void setReleaseVariance(double variance) Set the variance possible on the release rate.- Parameters:
variance
- release rate +/- variance as a percent (eg. .5 = 50%)
-
isControlFlow
public boolean isControlFlow()Does this manager regulate the particle flow?- Returns:
- true if this manager regulates how many particles per sec are emitted.
-
setControlFlow
public void setControlFlow(boolean regulate) Set the regulate flow property on the manager.- Parameters:
regulate
- regulate particle flow.
-
isUpdateOnlyInView
public boolean isUpdateOnlyInView()Does this manager use the particle's bounding volume to limit updates?- Returns:
- true if this manager only updates the particles when they are in view.
-
setUpdateOnlyInView
public void setUpdateOnlyInView(boolean updateOnlyInView) Set the updateOnlyInView property on the manager.- Parameters:
updateOnlyInView
- use the particle's bounding volume to limit updates.
-
getViewCamera
- Returns:
- the camera to be used in updateOnlyInView situations. If null, the current displaySystem's renderer camera is used.
-
setViewCamera
- Parameters:
viewCamera
- sets the camera to be used in updateOnlyInView situations. If null, the current displaySystem's renderer camera is used.
-
getIterations
public int getIterations()Return the number this manager has warmed up- Returns:
- int
-
setIterations
public void setIterations(int iterations) Sets the iterations for the warmup and calls warmUp with the number of iterations as the argument- Parameters:
iterations
- the iterations for the warmup
-
addInfluence
Add an external influence to this particle controller.- Parameters:
influence
- ParticleInfluence
-
removeInfluence
Remove an influence from this particle controller.- Parameters:
influence
- ParticleInfluence- Returns:
- true if found and removed.
-
getInfluences
Returns the list of influences acting on this particle controller.- Returns:
- ArrayList
-
clearInfluences
public void clearInfluences() -
addListener
Subscribe a listener to receive mouse events. Enable event generation.- Parameters:
listener
- to be subscribed
-
removeListener
Unsubscribe a listener. Disable event generation if no more listeners.- Parameters:
listener
- to be unsuscribed- See Also:
-
removeListeners
public void removeListeners()Remove all listeners and disable event generation. -
containsListener
Check if a listener is allready added to this ParticleController- Parameters:
listener
- listener to check for- Returns:
- true if listener is contained in the listenerlist
-
getListeners
Get all added ParticleController listeners- Returns:
- ArrayList of listeners added to this ParticleController
-
warmUp
Runs the update method of this particle manager X number of times passing .1 seconds for each call. This is used to "warm up" and get the particle manager going.- Parameters:
iterations
- The number of iterations to warm up.particles
- the particle system
-
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classComplexSpatialController<ParticleSystem>
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classComplexSpatialController<ParticleSystem>
- Throws:
IOException
-
resetFlowCount
public void resetFlowCount() -
setSpawnEnabled
public void setSpawnEnabled(boolean spawnEnabled)
-