j3d.org Code

org.j3d.geom.particle
Class MaxTimePointEmitter

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

public class MaxTimePointEmitter
extends BaseEmitter

Emitter that limits the maximum age based on wall-clock existance time.

Generates particles that emit in a specific direction with varying velocity

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
MaxTimePointEmitter(int maxTime, int maxParticleCount, float[] position, float[] color, float[] direction, 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 setDirection(float x, float y, float z)
          Change the initial velocity that the particles are endowed with by modifying the direction.
 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 setPosition(float x, float y, float z)
          Change the basic position that the particles are being generated from.
 void setSpeed(float speed)
          Change the initial speed that the particles are endowed with.
 
Methods inherited from class org.j3d.geom.particle.BaseEmitter
getColor, getLifetimeVariation, getMass, getMaxParticleCount, getParticleLifetime, getParticleVariation, getSpeed, getSurfaceArea, setColor, setLifetimeVariation, setMass, setParticleVariation, setSurfaceArea
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaxTimePointEmitter

public MaxTimePointEmitter(int maxTime,
                           int maxParticleCount,
                           float[] position,
                           float[] color,
                           float[] direction,
                           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)
direction - The initial direction the particles are sent
speed - The speed of the particls to start with
variation - The amount of variance for the initial values
Method Detail

setMaxParticleCount

public void setMaxParticleCount(int maxCount)
Adjust the maximum number of particles that this initializer is going to work with. This should not normally be called by the end user. The particle system that this initializer is registered with will call this method when it's corresponding method is called.

Specified by:
setMaxParticleCount in interface ParticleInitializer
Overrides:
setMaxParticleCount in class BaseEmitter
Parameters:
maxCount - The new maximum particle count to use

setParticleLifetime

public void setParticleLifetime(int time)
                         throws java.lang.IllegalArgumentException
Change the maximum lifetime of the particles. The lifetime of particles is defined in milliseconds, and must be positive.

Specified by:
setParticleLifetime in interface ParticleInitializer
Overrides:
setParticleLifetime in class BaseEmitter
Parameters:
time - The new lifetime, in milliseconds
Throws:
java.lang.IllegalArgumentException - The lifetime is zero or negative

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.

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

setSpeed

public void setSpeed(float speed)
Change the initial speed that the particles are endowed with.

Specified by:
setSpeed in interface ParticleInitializer
Overrides:
setSpeed in class BaseEmitter
Parameters:
speed - The magnitude of the speed to use

setDirection

public void setDirection(float x,
                         float y,
                         float z)
Change the initial velocity that the particles are endowed with by modifying the direction. Speed still stays the same. The direction value will be normalised to a unit length vector before being applied to the velocity calculation.

Parameters:
x - The x component of the velocity direction
y - The y component of the velocity direction
z - The z component of the velocity direction

j3d.org Code

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