|
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.BaseEmitter
public abstract class BaseEmitter
Common base class that implements the ParticleInitializer
interface
for all emitters.
Mass and surface area are initialised to be zero. Lifetime variation is always set to zero, unless changed by the user.
Internationalisation Resource Names
Field Summary | |
---|---|
protected float[] |
color
Initial colour to make all particles |
protected float |
initialMass
Initial mass that is imparted to all particles |
protected int |
lifetime
Base lifetime in milliseconds |
protected float |
lifetimeVariation
The amount of lifetime variation permitted |
protected int |
particleCount
The maximum number of particles to generate |
protected java.util.Random |
randomiser
Random number generator for sign values |
protected float |
speed
The initial speed of the particles. |
protected float |
surfaceArea
Initial surface area given to all particles |
protected float |
variation
Amount of variation on the randomness |
Constructor Summary | |
---|---|
protected |
BaseEmitter()
Construct a new default emitter, with everything initialized to zeroes, except colour, which is white. |
protected |
BaseEmitter(int maxTime,
int maxParticleCount,
float[] color,
float speed,
float variation)
Construct a new emitter instance for a point emitter. |
Method Summary | |
---|---|
void |
getColor(float[] val)
Get the value of the initial colour that particles are set to. |
float |
getLifetimeVariation()
Get the amount of variation in the lifetime of the particles generated. |
float |
getMass()
Get the current mass assigned to each particle. |
int |
getMaxParticleCount()
Fetch the current value of the maximum particle count. |
int |
getParticleLifetime()
Get the current maximum lifetime of the particles. |
float |
getParticleVariation()
Get the amount of variation currently permitted in the particles. |
float |
getSpeed()
Get the current speed that particles are initialised with. |
float |
getSurfaceArea()
Get the current surface area assigned to particles. |
void |
setColor(float r,
float g,
float b,
float alpha)
Set the initial color that that the particle is given. |
void |
setLifetimeVariation(float variation)
Change the variation factor for the emitted particles. |
void |
setMass(float mass)
Change the mass of the particle. |
void |
setMaxParticleCount(int maxCount)
Adjust the maximum number of particles that this initializer is going to work with. |
void |
setParticleLifetime(int time)
Change the maximum lifetime of the particles. |
void |
setParticleVariation(float variation)
Change the variation factor for the emitted particles. |
void |
setSpeed(float speed)
Change the initial speed that the particles are endowed with. |
void |
setSurfaceArea(float area)
Change the apparent surface area. |
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.ParticleInitializer |
---|
initialize, numParticlesToCreate |
Field Detail |
---|
protected int lifetime
protected int particleCount
protected float[] color
protected float speed
protected float variation
protected float lifetimeVariation
protected float initialMass
protected float surfaceArea
protected java.util.Random randomiser
Constructor Detail |
---|
protected BaseEmitter()
protected BaseEmitter(int maxTime, int maxParticleCount, float[] color, float speed, float variation)
maxTime
- The time length of the particles to exist in millisecondsmaxParticleCount
- The maximum number of particles to managecolor
- The initial color of particles (4 component)speed
- The speed of the particls to start withvariation
- The amount of variance for the initial valuesMethod Detail |
---|
public void setMaxParticleCount(int maxCount)
setMaxParticleCount
in interface ParticleInitializer
maxCount
- The new maximum particle count to usepublic int getMaxParticleCount()
getMaxParticleCount
in interface ParticleInitializer
public void setParticleLifetime(int time) throws java.lang.IllegalArgumentException
setParticleLifetime
in interface ParticleInitializer
time
- The new lifetime, in milliseconds
java.lang.IllegalArgumentException
- The lifetime is zero or negativepublic int getParticleLifetime()
getParticleLifetime
in interface ParticleInitializer
public void setLifetimeVariation(float variation) throws java.lang.IllegalArgumentException
setLifetimeVariation
in interface ParticleInitializer
variation
- The new variation amount
java.lang.IllegalArgumentException
- The variation amount was within [0,1]public float getLifetimeVariation()
getLifetimeVariation
in interface ParticleInitializer
public void setParticleVariation(float variation)
setParticleVariation
in interface ParticleInitializer
variation
- The new variation amountpublic float getParticleVariation()
getParticleVariation
in interface ParticleInitializer
public void setColor(float r, float g, float b, float alpha)
setColor
in interface ParticleInitializer
r
- The red component of the colorg
- The green component of the colorb
- The blue component of the coloralpha
- The alpha component of the colorpublic void getColor(float[] val)
getColor
in interface ParticleInitializer
val
- An array of length 4 to copy the internal values intopublic void setSurfaceArea(float area) throws java.lang.IllegalArgumentException
setSurfaceArea
in interface ParticleInitializer
area
- The new surface area value to use, in metres squared
java.lang.IllegalArgumentException
- The surface area value was negativepublic float getSurfaceArea()
getSurfaceArea
in interface ParticleInitializer
public void setMass(float mass) throws java.lang.IllegalArgumentException
setMass
in interface ParticleInitializer
mass
- The mass of an individual particle
java.lang.IllegalArgumentException
- The mass value was negativepublic float getMass()
getMass
in interface ParticleInitializer
public void setSpeed(float speed)
setSpeed
in interface ParticleInitializer
speed
- The magnitude of the speed to usepublic float getSpeed()
getSpeed
in interface ParticleInitializer
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |