espresso3d.engine.world.sector.particle
Class E3DParticleSystem

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.world.sector.base.E3DPortalEnabledRenderableItem
              extended byespresso3d.engine.world.sector.particle.E3DParticleSystem
Direct Known Subclasses:
BluePlasmaParticleFountain, RedPlasmaParticleFountain

public abstract class E3DParticleSystem
extends E3DPortalEnabledRenderableItem

Author:
Curt A particle system is a grouping of particles used for creating animated particle systems in a world/sector.

Constructor Summary
E3DParticleSystem(E3DEngine engine)
          Create a new unnamed particle system (can't be quickly accessed from a map once its added).
E3DParticleSystem(E3DEngine engine, double lifeSeconds)
          Create a named particle system.
E3DParticleSystem(E3DEngine engine, E3DVector3F gravityDirection, double gravityStrength)
          Create an unnamed particle system with gravity.
E3DParticleSystem(E3DEngine engine, E3DVector3F gravityDirection, double gravityStrength, double lifeSeconds)
          Create an named particle system with gravity.
E3DParticleSystem(E3DParticleSystem toCopy)
          Create a new particle system as a copy of the old
 
Method Summary
 void addParticle(E3DParticle particle)
          This will add a particle to the system.
 E3DVector3F getForward()
          Get the particle systems forward vec.
 E3DVector3F getGravityDirection()
          Get the normalised direciton vector of gravity for this system
 double getGravityStrength()
          Get the strength of gravity for the system
 double getLifeSeconds()
           
 java.util.ArrayList getParticleList()
          Get the list of all the particles in the system
 E3DVector3F getPosition()
          Get the position of the particle system This is origin of the positions of all the particles are based around.
 java.util.ArrayList getQuadList()
          Returns the list of all the quads of all the particles in it
 E3DTextureSortedObjectMap getTextureSortedQuadMap()
          Get the list of particle's quads sorted by texture name.
 E3DVector3F getUp()
          Get the particle systems up vec.
 boolean isAlive()
          Returns false if the engine has expired its lifespan
abstract  boolean isCollideable()
          If any of the particles are needing to be collision detected, set this to true.
abstract  boolean isCollisionCausedByMovement()
          Set this to true if any particles in the system need to cause collisions when they move.
abstract  E3DParticleSystem onGetClone()
          This method must be overriden to return a clone of the particle system.
 void renderAtPosition(E3DVector3F atPosition)
          This will render this particle system individually.
 void rotate(double angle, E3DVector3F upVec)
          Rotate all particles, and movement directions(permanently) in the system around upVec by angle amount
 void setGravityDirection(E3DVector3F gravityDirection)
          Set the direction of the gravity vector for this system.
 void setGravityStrength(double gravityStrength)
          Set the strength of gravity for the system.
 void setLifeSeconds(double lifeSeconds)
           
 void setPosition(E3DVector3F position)
          Set the position of the particle system This is origin of the positions of all the particles are based around.
 void setSector(E3DSector sector)
          Override setSector to automatically set the sector the particles are in as well as the system.
 void translate(E3DVector3F translationAmt)
          Translate the particleSystem by translationVec amt.
 void updateParticles(E3DActor curActor)
          This updates the particles in the system (makes them all move 1 unit)
 
Methods inherited from class espresso3d.engine.world.sector.base.E3DPortalEnabledRenderableItem
checkSectorChangeDuringMovement, getSector
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
render
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DParticleSystem

public E3DParticleSystem(E3DEngine engine)
Create a new unnamed particle system (can't be quickly accessed from a map once its added). Very useful for temporary systems)

Parameters:
engine -

E3DParticleSystem

public E3DParticleSystem(E3DEngine engine,
                         double lifeSeconds)
Create a named particle system. This is useful for quick access to the system from the sectors map or particle systems.

Parameters:
engine -

E3DParticleSystem

public E3DParticleSystem(E3DEngine engine,
                         E3DVector3F gravityDirection,
                         double gravityStrength)
Create an unnamed particle system with gravity.

Parameters:
engine -
gravityDirection - Normalised direction of gravity
gravityStrength - strenth of the gravity

E3DParticleSystem

public E3DParticleSystem(E3DEngine engine,
                         E3DVector3F gravityDirection,
                         double gravityStrength,
                         double lifeSeconds)
Create an named particle system with gravity.

Parameters:
engine -
gravityDirection - Normalised direction of gravity
gravityStrength - strenth of the gravity
lifeSeconds - number of seconds for the particle system to stay around. -1 for infinite

E3DParticleSystem

public E3DParticleSystem(E3DParticleSystem toCopy)
Create a new particle system as a copy of the old

Parameters:
toCopy -
Method Detail

addParticle

public void addParticle(E3DParticle particle)
This will add a particle to the system.

Parameters:
particle -

getParticleList

public java.util.ArrayList getParticleList()
Get the list of all the particles in the system

Returns:

updateParticles

public void updateParticles(E3DActor curActor)
This updates the particles in the system (makes them all move 1 unit)


isAlive

public boolean isAlive()
Returns false if the engine has expired its lifespan

Returns:

renderAtPosition

public void renderAtPosition(E3DVector3F atPosition)
This will render this particle system individually. However, it will be taken care of in a better fashion by the engine so shouldn't be called under normal circumstances

Specified by:
renderAtPosition in class E3DRenderable

getQuadList

public java.util.ArrayList getQuadList()
Returns the list of all the quads of all the particles in it

Returns:

setSector

public void setSector(E3DSector sector)
Override setSector to automatically set the sector the particles are in as well as the system. This is done automatically when adding it to a sector so normally should be modified.

Overrides:
setSector in class E3DPortalEnabledRenderableItem
Parameters:
sector -

getTextureSortedQuadMap

public E3DTextureSortedObjectMap getTextureSortedQuadMap()
Get the list of particle's quads sorted by texture name. Each entry of the map is keyed off texture name and contains an ArrayList of quads for that texture as the value

Returns:

getGravityDirection

public E3DVector3F getGravityDirection()
Get the normalised direciton vector of gravity for this system

Returns:
Gravity direciton. Can be null.

setGravityDirection

public void setGravityDirection(E3DVector3F gravityDirection)
Set the direction of the gravity vector for this system. It is automatically noramlised.

Parameters:
gravityDirection -

getGravityStrength

public double getGravityStrength()
Get the strength of gravity for the system

Returns:

setGravityStrength

public void setGravityStrength(double gravityStrength)
Set the strength of gravity for the system. This value scales the gravityDirection vector

Parameters:
gravityStrength -

getPosition

public E3DVector3F getPosition()
Get the position of the particle system This is origin of the positions of all the particles are based around. It begins at 0, 0, 0

Returns:

setPosition

public void setPosition(E3DVector3F position)
Set the position of the particle system This is origin of the positions of all the particles are based around. It begins at 0, 0, 0. Changing the position will translate particles currently in the system. It will NOT translate particles that are added after the translation. New particles will be assumed to know it is at its position when they're startPositions are set

Returns:

translate

public void translate(E3DVector3F translationAmt)
Translate the particleSystem by translationVec amt. Translating will translate particles currently in the system. It will NOT translate particles that are added after the translation. New particles will be assumed to know it is at its position when they're startPositions are set

Returns:

rotate

public void rotate(double angle,
                   E3DVector3F upVec)
Rotate all particles, and movement directions(permanently) in the system around upVec by angle amount

Parameters:
angle - Radian angle
upVec - Normalised up vector to use as the rotation axis

onGetClone

public abstract E3DParticleSystem onGetClone()
                                      throws java.lang.Exception
This method must be overriden to return a clone of the particle system. This normally gets called when a specific actor in the preloadedActorMap of the world is specified in a world's map that is getting loaded What it wants is a clone of the preloaded actor returned (CLONE, not ref to the same object!). This is exposed to you so you can modify the actor if necessary when cloning it.

Throws:
java.lang.Exception

getForward

public E3DVector3F getForward()
Get the particle systems forward vec. It starts at (0, 0, 1). All rotations to the particle system apply to this vector.


getUp

public E3DVector3F getUp()
Get the particle systems up vec. It starts at (0, 1, 0). All rotations to the particle system apply to this vector.


getLifeSeconds

public double getLifeSeconds()

setLifeSeconds

public void setLifeSeconds(double lifeSeconds)

isCollideable

public abstract boolean isCollideable()
If any of the particles are needing to be collision detected, set this to true. If set to false, its a shortcut to disable all collision detection for particles in the system This does not automatically make particles stop causing collisions with their own movement, it just keeps the particles from being run into by other object's movement.

Returns:

isCollisionCausedByMovement

public abstract boolean isCollisionCausedByMovement()
Set this to true if any particles in the system need to cause collisions when they move. If set to false, its a shortcut to disable all collisions caused by particles in the system. This does not automatically make particles uncollideable. It just keeps the particles from causing collisions with their own movement.

Returns: