j3d.org Code

org.j3d.geom.particle
Class ExplosionPointEmitter

java.lang.Object
  extended by org.j3d.geom.particle.BaseEmitter
      extended by org.j3d.geom.particle.ExplosionPointEmitter
All Implemented Interfaces:
ParticleInitializer

public class ExplosionPointEmitter
extends BaseEmitter

Generates particles that explode from a point in space, in any direction.

All particles are generated in the initial valuation and then no further particles are generated.

Version:
$Revision: 2.0 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.geom.particle.BaseEmitter
color, initialMass, lifetime, lifetimeVariation, particleCount, randomiser, speed, surfaceArea, variation
 
Constructor Summary
ExplosionPointEmitter()
          Construct a new default emitter.
ExplosionPointEmitter(int maxTime, int maxParticleCount, float[] position, float[] color, float speed, float variation)
          Construct a new emitter instance for a point emitter.
 
Method Summary
 boolean initialize(Particle particle)
          Initialize a particle based on the rules defined by this initializer.
 int numParticlesToCreate(int timeDelta)
          The number of particles that should be created and initialised this frame.
 void setPosition(float x, float y, float z)
          Change the basic position that the particles are being generated from.
 
Methods inherited from class org.j3d.geom.particle.BaseEmitter
getColor, getLifetimeVariation, getMass, getMaxParticleCount, getParticleLifetime, getParticleVariation, getSpeed, getSurfaceArea, setColor, setLifetimeVariation, setMass, setMaxParticleCount, setParticleLifetime, setParticleVariation, setSpeed, setSurfaceArea
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExplosionPointEmitter

public ExplosionPointEmitter()
Construct a new default emitter. All values are set to zero.


ExplosionPointEmitter

public ExplosionPointEmitter(int maxTime,
                             int maxParticleCount,
                             float[] position,
                             float[] color,
                             float speed,
                             float variation)
Construct a new emitter instance for a point emitter. The number of particles to create each frame is driven from the maximum particle count divided by the average lifetime.

Parameters:
maxTime - The time length of the particles to exist in milliseconds
maxParticleCount - The maximum number of particles to manage
position - The emitting position in the local space
color - The initial color of particles (4 component)
speed - The speed of the particls to start with
variation - The amount of variance for the initial values
Method Detail

numParticlesToCreate

public int numParticlesToCreate(int timeDelta)
The number of particles that should be created and initialised this frame. This is called once per frame by the particle system manager. Sends all particles initialially and nothing after that.

Parameters:
timeDelta - The delta between the last frame and this one in milliseconds
Returns:
The number of particles to create

initialize

public boolean initialize(Particle particle)
Initialize a particle based on the rules defined by this initializer. The particle system may choose to re-initialise previously dead particles. The implementation should not care whether the particle was previously in existance or not.

Parameters:
particle - The particle instance to initialize
Returns:
true if the ParticleSytem should keep running

setPosition

public void setPosition(float x,
                        float y,
                        float z)
Change the basic position that the particles are being generated from.

Parameters:
x - The x component of the location
y - The y component of the location
z - The z component of the location

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org