|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.geom.particle.ParticleSystem
public abstract class ParticleSystem
Abstract representation of a ParticleSystem.
A ParticleSystem manages a List of Particles created by a ParticleFactory. It applies changes to the Particles using a List of ParticleFunctions and a a single emitter.
A ParticleSystem can be represented in any way appropriate, the only requirement is that is create a Node to be added to the scenegraph.
Internationalisation Resource Names
Field Summary | |
---|---|
protected ErrorReporter |
errorReporter
Local reporter to put errors in |
protected int |
frameTime
Inter-frame time delta. |
protected boolean |
genTexCoords
Flag indicating that texture coordinate values should be generated for the particles |
protected int |
maxParticleCount
Maximum number of particles this system can handle |
protected int |
particleCount
Current number of live particles |
protected ParticleList |
particleList
List of currently active particle instances |
protected TexCoordInterpolator |
texCoordInterp
Interpolator of texture coordinate handling |
protected long |
timeNow
The time of this frame. |
Constructor Summary | |
---|---|
ParticleSystem(java.lang.String name,
int maxParticleCount)
Create a new ParticleSystem. |
Method Summary | |
---|---|
void |
addParticleFunction(ParticleFunction function)
Append a new particle function to the list. |
void |
enableParticleCreation(boolean state)
Change the state about whether new particles should be created from this point onwards. |
void |
enableTextureCoordinates(boolean state)
Set a flag to say whether texture coordinates should be generated for this system. |
int |
getMaxParticleCount()
Get the current maximum number of particles that should be created. |
ParticleInitializer |
getParticleInitializer()
Fetch the currently set initializer for particles. |
java.lang.String |
getSystemName()
Gets the currently set systemName. |
void |
initialize(long time)
Run the initial particle setup for the first frame now. |
void |
insertParticleFunction(int index,
ParticleFunction function)
Insert a particle function at a specific place in the list. |
boolean |
isParticleCreationEnabled()
Fetch the current particle creation state. |
boolean |
isTextureCoordinateEnabled()
Get the current value of the texture coordinate generation state. |
abstract void |
onRemove()
Notification that this particle system has been removed from the scene graph and it cleanup anything needed right now. |
void |
removeParticleFunction(ParticleFunction function)
Remove the first instance of the function defined. |
void |
setErrorReporter(ErrorReporter reporter)
Register an error reporter with the object so that any errors generated by the object can be reported in a nice, pretty fashion. |
void |
setMaxParticleCount(int maxCount)
Change the maximum number of particles that can be generated. |
void |
setParticleInitializer(ParticleInitializer emitter)
Set the emitter used to initialise particles. |
void |
setSystemName(java.lang.String systemName)
Sets the system name to a new value. |
void |
setTexCoordFunction(float[] times,
int numEntries,
float[] texCoords)
Set the keys and texture coordinates to use for geometry that wishes to change the texture coordinates over the lifetime of the particle. |
boolean |
update(long timestamp)
Inform each of the ParticleFunctions so they can do any processing. |
protected abstract void |
updateGeometry()
Update the arrays for the geometry object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.j3d.geom.particle.ParticleFactory |
---|
coordinatesPerParticle, createParticle, numColorComponents, numTexCoordComponents |
Field Detail |
---|
protected ErrorReporter errorReporter
protected int maxParticleCount
protected int particleCount
protected int frameTime
protected long timeNow
protected ParticleList particleList
protected TexCoordInterpolator texCoordInterp
protected boolean genTexCoords
Constructor Detail |
---|
public ParticleSystem(java.lang.String name, int maxParticleCount) throws java.lang.IllegalArgumentException
name
- An arbitrary string name for ID purposesmaxParticleCount
- The maximum number of particles allowed to exist
java.lang.IllegalArgumentException
- The particle count was negativeMethod Detail |
---|
public void setErrorReporter(ErrorReporter reporter)
reporter
- The instance to use or nullpublic void initialize(long time)
time
- The time to start executing forpublic abstract void onRemove()
protected abstract void updateGeometry()
public void enableParticleCreation(boolean state)
state
- true to enable particle creation, false to stoppublic boolean isParticleCreationEnabled()
public void setParticleInitializer(ParticleInitializer emitter)
emitter
- the ParticleInitializer instance to usepublic ParticleInitializer getParticleInitializer()
public void addParticleFunction(ParticleFunction function)
function
- The function to addpublic void insertParticleFunction(int index, ParticleFunction function)
index
- The position in the list to insert it onfunction
- The function to be addedpublic void removeParticleFunction(ParticleFunction function)
function
- The function instance to removepublic void enableTextureCoordinates(boolean state)
state
- True to enable tex Coord generationpublic boolean isTextureCoordinateEnabled()
public void setTexCoordFunction(float[] times, int numEntries, float[] texCoords)
It is up to the caller to determine both the ordering and the number of texture coordinate values to use.
Makes an internal copy of the values.
times
- The list of time keys to use in millisecondsnumEntries
- The number of keys/keyValue pairstexCoords
- The raw texture coordinatespublic boolean update(long timestamp)
timestamp
- The time for this frame
public java.lang.String getSystemName()
public void setSystemName(java.lang.String systemName)
systemName
- The new name to setpublic void setMaxParticleCount(int maxCount) throws java.lang.IllegalArgumentException
maxCount
- The new maximum particle count to use
java.lang.IllegalArgumentException
- The particle count was negativepublic int getMaxParticleCount()
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |