espresso3d.engine.world.sector.particle
Class E3DSprite

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.renderer.base.E3DTexturedRenderable
              extended byespresso3d.engine.renderer.base.E3DAnimatedTextureRenderable
                  extended byespresso3d.engine.world.sector.base.E3DPortalEnabledAnimatedTextureRenderable
                      extended byespresso3d.engine.world.sector.particle.E3DSprite
All Implemented Interfaces:
E3DCollisionDetectableObject, E3DPortalEnabledItem
Direct Known Subclasses:
E3DBillboardSprite

public abstract class E3DSprite
extends E3DPortalEnabledAnimatedTextureRenderable
implements E3DCollisionDetectableObject

Author:
Curt A sprite is a texture mapped quad. TODO: Alpha blending & masking is currently not supported, but will be. Collision detection for particles is based on its bounding quad.

Constructor Summary
E3DSprite(E3DEngine engine, E3DVector3F position, double size, E3DAnimatedTextureFrame[] animatedTextureFrames, int animationLoops)
           
E3DSprite(E3DEngine engine, E3DVector3F position, double size, E3DAnimatedTextureFrame[] animatedTextureFrames, int animationLoops, int blendMode)
           
E3DSprite(E3DEngine engine, E3DVector3F position, double size, java.lang.String textureName)
           
E3DSprite(E3DEngine engine, E3DVector3F position, double size, java.lang.String textureName, int blendMode)
           
E3DSprite(E3DEngine engine, E3DVector3F position, E3DVector3F forward, E3DVector3F up, double size, E3DAnimatedTextureFrame[] animatedTextureFrames, int animationLoops)
           
E3DSprite(E3DEngine engine, E3DVector3F position, E3DVector3F forward, E3DVector3F up, double size, E3DAnimatedTextureFrame[] animatedTextureFrames, int animationLoops, int blendMode)
           
E3DSprite(E3DEngine engine, E3DVector3F position, E3DVector3F forward, E3DVector3F up, double size, java.lang.String textureName)
          Create a sprite Defaults rendering blendMode to BLENDMODE_BLEND
E3DSprite(E3DEngine engine, E3DVector3F position, E3DVector3F forward, E3DVector3F up, double size, java.lang.String textureName, int blendMode)
           
 
Method Summary
 E3DBoundingObject getBoundingObject()
          Return the bounding object or null for bounding collision tests
 java.lang.String getKey()
          Key For Sorting
 E3DOrientation getOrientation()
           
 E3DQuad getQuad()
           
 double getSize()
           
 java.util.ArrayList getTriangleList()
          Must return an ArrayList of E3DTriangles that make up the geometry of the object.
 java.util.ArrayList getUniqueVertexPositionList()
          This will ideally only return unique vertices that the object has.
abstract  void onCollisionActor(E3DCollision collision)
          This is called when another actor collides with this object
abstract  void onCollisionSprite(E3DCollision collision)
          This is called when a sprite collides with this object
 void render()
           
 void rotate(double angle, E3DVector3F upVec)
          Rotate the sprite around upVec angle amount
 void scale(double scaleAmt)
           
 void setBoundingObject(E3DBoundingObject boundingObject)
           
 void setPosition(E3DVector3F position)
           
 void setQuad(E3DQuad quad)
           
 void setRenderMode(int renderMode)
          If a sprite's rendermode is set, so is the the rendermode for the quad it contains
 void translate(E3DVector3F translationAmt)
           
 boolean update(E3DActor lookAtActor, double lastFrameTimeSeconds)
          Called by the engine after each frame to update the sprites animation (if necessary)
 
Methods inherited from class espresso3d.engine.world.sector.base.E3DPortalEnabledAnimatedTextureRenderable
checkSectorChangeDuringMovement, getSector, setSector
 
Methods inherited from class espresso3d.engine.renderer.base.E3DAnimatedTextureRenderable
getAnimatedTexture, setAnimatedTexture, update
 
Methods inherited from class espresso3d.engine.renderer.base.E3DTexturedRenderable
getTexture, getTextureDetail0, getTextureDetail1, isTextureAvailable, isTextureDetail0Available, isTextureDetail1Available, setTexture, setTextureDetail0, setTextureDetail1
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
getBlendMode, getRenderMode, initCorrectGeometryRenderer, isKeyChanged, setBlendMode, setKeyChanged
 
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
 
Methods inherited from interface espresso3d.engine.collision.base.E3DCollisionDetectableObject
getEngine, getSector, isCollideable
 

Constructor Detail

E3DSprite

public E3DSprite(E3DEngine engine,
                 E3DVector3F position,
                 double size,
                 java.lang.String textureName)

E3DSprite

public E3DSprite(E3DEngine engine,
                 E3DVector3F position,
                 double size,
                 E3DAnimatedTextureFrame[] animatedTextureFrames,
                 int animationLoops)

E3DSprite

public E3DSprite(E3DEngine engine,
                 E3DVector3F position,
                 double size,
                 java.lang.String textureName,
                 int blendMode)

E3DSprite

public E3DSprite(E3DEngine engine,
                 E3DVector3F position,
                 double size,
                 E3DAnimatedTextureFrame[] animatedTextureFrames,
                 int animationLoops,
                 int blendMode)

E3DSprite

public E3DSprite(E3DEngine engine,
                 E3DVector3F position,
                 E3DVector3F forward,
                 E3DVector3F up,
                 double size,
                 java.lang.String textureName)
Create a sprite Defaults rendering blendMode to BLENDMODE_BLEND

Parameters:
engine -
position -
forward -
up -
size -
textureName -

E3DSprite

public E3DSprite(E3DEngine engine,
                 E3DVector3F position,
                 E3DVector3F forward,
                 E3DVector3F up,
                 double size,
                 E3DAnimatedTextureFrame[] animatedTextureFrames,
                 int animationLoops)

E3DSprite

public E3DSprite(E3DEngine engine,
                 E3DVector3F position,
                 E3DVector3F forward,
                 E3DVector3F up,
                 double size,
                 java.lang.String textureName,
                 int blendMode)

E3DSprite

public E3DSprite(E3DEngine engine,
                 E3DVector3F position,
                 E3DVector3F forward,
                 E3DVector3F up,
                 double size,
                 E3DAnimatedTextureFrame[] animatedTextureFrames,
                 int animationLoops,
                 int blendMode)
Method Detail

onCollisionActor

public abstract void onCollisionActor(E3DCollision collision)
Description copied from interface: E3DCollisionDetectableObject
This is called when another actor collides with this object

Specified by:
onCollisionActor in interface E3DCollisionDetectableObject
Parameters:
collision -

onCollisionSprite

public abstract void onCollisionSprite(E3DCollision collision)
Description copied from interface: E3DCollisionDetectableObject
This is called when a sprite collides with this object

Specified by:
onCollisionSprite in interface E3DCollisionDetectableObject
Parameters:
collision -

render

public void render()
Specified by:
render in class E3DAnimatedTextureRenderable

setPosition

public void setPosition(E3DVector3F position)

scale

public void scale(double scaleAmt)

translate

public void translate(E3DVector3F translationAmt)

rotate

public void rotate(double angle,
                   E3DVector3F upVec)
Rotate the sprite around upVec angle amount

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

getSize

public double getSize()

getQuad

public E3DQuad getQuad()

setQuad

public void setQuad(E3DQuad quad)

getTriangleList

public java.util.ArrayList getTriangleList()
Description copied from interface: E3DCollisionDetectableObject
Must return an ArrayList of E3DTriangles that make up the geometry of the object. This is used for direct triangle collisions

Specified by:
getTriangleList in interface E3DCollisionDetectableObject
Returns:

getUniqueVertexPositionList

public java.util.ArrayList getUniqueVertexPositionList()
Description copied from interface: E3DCollisionDetectableObject
This will ideally only return unique vertices that the object has.

Specified by:
getUniqueVertexPositionList in interface E3DCollisionDetectableObject
Returns:

getBoundingObject

public E3DBoundingObject getBoundingObject()
Description copied from interface: E3DCollisionDetectableObject
Return the bounding object or null for bounding collision tests

Specified by:
getBoundingObject in interface E3DCollisionDetectableObject
Returns:

setBoundingObject

public void setBoundingObject(E3DBoundingObject boundingObject)

setRenderMode

public void setRenderMode(int renderMode)
If a sprite's rendermode is set, so is the the rendermode for the quad it contains

Overrides:
setRenderMode in class E3DRenderable

update

public boolean update(E3DActor lookAtActor,
                      double lastFrameTimeSeconds)
Called by the engine after each frame to update the sprites animation (if necessary)

Returns:
Returns false if the sprite should be removed from the engine lookAtActor is ignored and only used for classes that extend this

getOrientation

public E3DOrientation getOrientation()
Specified by:
getOrientation in interface E3DCollisionDetectableObject

getKey

public java.lang.String getKey()
Description copied from class: E3DTexturedRenderable
Key For Sorting

Overrides:
getKey in class E3DTexturedRenderable