espresso3d.engine.viewport.image
Class E3DImage

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.renderer.base.E3DBlendedRenderable
              extended byespresso3d.engine.renderer.base.E3DBlendedAnimatedTextureRenderable
                  extended byespresso3d.engine.viewport.image.E3DImage
Direct Known Subclasses:
E3DFixedSizeImage, E3DVariableSizeImage

public abstract class E3DImage
extends E3DBlendedAnimatedTextureRenderable

Author:
cmoxley Abstract class that allows you to create a 2D image that is displayed in a viewport - essentially blit an image to the screen. This class cannot be directly used - it must be extended. The engine provides you with E3DFixedSizeImage and E3DVariableSizeImage implementations of this class which should be able to handle most image types you would want. The image will always face the user and always be in the same position in the viewport. The image will also scale with the viewport as its size changes After creating an E3DImage, add it to a viewport in the engine to have it rendered. E3DImages can be either solid (can't be seen through at all) or blended which will allow transparent sections of an image to be seen through if the image used has alpha information (PNG image format supports this as well as others). E3DImages must be loaded ahead of time via a definition in a textureset file and loaded either with a map, actor, or explicitly calling world.loadTextureSet

Field Summary
 
Fields inherited from class espresso3d.engine.renderer.base.E3DBlendedRenderable
BLENDMODE_BLEND, BLENDMODE_SOLID
 
Fields inherited from class espresso3d.engine.renderer.base.E3DRenderable
RENDERMODE_SOLID, RENDERMODE_TEXTURED, RENDERMODE_WIREFRAME
 
Constructor Summary
E3DImage(E3DEngine engine, java.lang.String imageID, E3DAnimatedTextureFrame[] animatedTextureFrames, int animationLoops, E3DVector2I position, int life)
          Construct an image with an animated texture
E3DImage(E3DEngine engine, java.lang.String imageID, E3DAnimatedTextureFrame[] animatedTextureFrames, int animationLoops, E3DVector2I position, int life, int blendMode)
          Construct an image with an animated texture
E3DImage(E3DEngine engine, java.lang.String imageID, java.lang.String textureName, E3DVector2I position, int life)
          Create a new viewport image.
E3DImage(E3DEngine engine, java.lang.String imageID, java.lang.String textureName, E3DVector2I position, int life, int blendMode)
          Create a new viewport image.
E3DImage(E3DImage toCopyImage, java.lang.String imageID)
          Make a copy of an image
 
Method Summary
 double getAge()
          Returns the age of the image, or, how many seconds it has already been rendered.
 java.lang.String getImageID()
          Return the ID of the image
 double getLife()
          Get the life of the image or length of time in secodns it will be renderered in the engine.
 E3DVector2I getPosition()
          Get the 2D position of the image (Viewport coords with (0,0) in the bottom left)
abstract  E3DQuad getPositionedQuad()
          Return a copy of this quad and position and size the copy as necessary
 E3DQuad getQuad()
          Return the quad that makes up the image.
 E3DViewport getViewport()
          The viewport this image is in.
 void renderAtPosition(E3DVector3F position)
           
abstract  void scale(double scaleAmt)
          Implementing class must specify a way to scale itself
 void setImageID(java.lang.String imageID)
          Set the ID of the image
 void setLife(double life)
          Set the life of the image or length of time in secodns it will be renderered in the engine.
 void setPosition(E3DVector2I position)
          Set the 2D position of the image (Viewport coords with (0,0) in the bottom left)
 void setQuad(E3DQuad quad)
          Set a quad for hte image to use.
 void setVertexColor(E3DVector3F vertexColorA, E3DVector3F vertexColorB, E3DVector3F vertexColorC, E3DVector3F vertexColorD)
          Set the color of the 4 vertices that make up the corners of the image
 void setViewport(E3DViewport viewport)
          This is handled automatically by the viewport when added
 void translate(E3DVector2I translationAmt)
          Translate the image
 boolean update(double lastFrameTimeSeconds)
          Called by the printer to update its life
 
Methods inherited from class espresso3d.engine.renderer.base.E3DBlendedAnimatedTextureRenderable
getAnimatedTexture, getRenderableOptionsKey, setAnimatedTexture
 
Methods inherited from class espresso3d.engine.renderer.base.E3DBlendedRenderable
getBlendMode, initCorrectGeometryRenderer, setBlendMode
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
getRenderMode, render, setRenderMode
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DImage

public E3DImage(E3DEngine engine,
                java.lang.String imageID,
                java.lang.String textureName,
                E3DVector2I position,
                int life)
Create a new viewport image. This will be a 2D image that is always at the same (x,y) coords in a viewport. As a viewport scales, it will scale with it as well once added to the viewport. Essentially, this is like a 2D image that will overlay the window used for things like HUDS and menus.

Parameters:
engine -
imageID - The ID this image will be. This can be any string that uniquely identifies this image once added to the viewport.
textureName - The name of the texture that will make up the graphic
position - The position (X,Y) on the screen that the bottom left corner of the image is at. (0,0) is at the bottom left corner of the viewport.

E3DImage

public E3DImage(E3DEngine engine,
                java.lang.String imageID,
                java.lang.String textureName,
                E3DVector2I position,
                int life,
                int blendMode)
Create a new viewport image. This will be a 2D image that is always at the same (x,y) coords in a viewport. As a viewport scales, it will scale with it as well once added to the viewport. Essentially, this is like a 2D image that will overlay the window used for things like HUDS and menus.

Parameters:
engine -
imageID - The ID this image will be. This can be any string that uniquely identifies this image once added to the viewport.
textureName - The name of the texture that will make up the graphic
position - The position (X,Y) on the screen that the bottom left corner of the image is at. (0,0) is at the bottom left corner of the viewport.
life - How long the image should be rendered (in seconds). -1 will render forever (or until removed programmatically from the viewport)
blendMode - The blending mode used for the image during render time. Default is BLENDMODE_SOLID

E3DImage

public E3DImage(E3DEngine engine,
                java.lang.String imageID,
                E3DAnimatedTextureFrame[] animatedTextureFrames,
                int animationLoops,
                E3DVector2I position,
                int life,
                int blendMode)
Construct an image with an animated texture

Parameters:
engine -
imageID -
animatedTextureFrames -
animationLoops -
position -
life -
blendMode -

E3DImage

public E3DImage(E3DEngine engine,
                java.lang.String imageID,
                E3DAnimatedTextureFrame[] animatedTextureFrames,
                int animationLoops,
                E3DVector2I position,
                int life)
Construct an image with an animated texture

Parameters:
engine -
imageID -
animatedTextureFrames -
animationLoops -
position -
life -

E3DImage

public E3DImage(E3DImage toCopyImage,
                java.lang.String imageID)
Make a copy of an image

Parameters:
toCopyImage -
Method Detail

renderAtPosition

public void renderAtPosition(E3DVector3F position)
Specified by:
renderAtPosition in class E3DBlendedAnimatedTextureRenderable

scale

public abstract void scale(double scaleAmt)
Implementing class must specify a way to scale itself

Parameters:
scaleAmt -

getPositionedQuad

public abstract E3DQuad getPositionedQuad()
Return a copy of this quad and position and size the copy as necessary

Returns:

getViewport

public E3DViewport getViewport()
The viewport this image is in. This will be modified automatically if it is added to another viewport.a

Returns:

getImageID

public java.lang.String getImageID()
Return the ID of the image

Returns:

setImageID

public void setImageID(java.lang.String imageID)
Set the ID of the image

Parameters:
imageID -

getQuad

public E3DQuad getQuad()
Return the quad that makes up the image. This is NOT positioned as it should be. getPositionedQuad should be used for that.

Returns:

setQuad

public void setQuad(E3DQuad quad)
Set a quad for hte image to use.

Parameters:
quad -

translate

public void translate(E3DVector2I translationAmt)
Translate the image

Parameters:
translationAmt -

setVertexColor

public void setVertexColor(E3DVector3F vertexColorA,
                           E3DVector3F vertexColorB,
                           E3DVector3F vertexColorC,
                           E3DVector3F vertexColorD)
Set the color of the 4 vertices that make up the corners of the image

Parameters:
vertexColorA -
vertexColorB -
vertexColorC -
vertexColorD -

getPosition

public E3DVector2I getPosition()
Get the 2D position of the image (Viewport coords with (0,0) in the bottom left)

Returns:

setPosition

public void setPosition(E3DVector2I position)
Set the 2D position of the image (Viewport coords with (0,0) in the bottom left)

Parameters:
position -

setViewport

public void setViewport(E3DViewport viewport)
This is handled automatically by the viewport when added

Parameters:
viewport -

update

public boolean update(double lastFrameTimeSeconds)
Called by the printer to update its life

Returns:

getLife

public double getLife()
Get the life of the image or length of time in secodns it will be renderered in the engine. -1 is forever.

Returns:

setLife

public void setLife(double life)
Set the life of the image or length of time in secodns it will be renderered in the engine. -1 is forever.

Parameters:
life -

getAge

public double getAge()
Returns the age of the image, or, how many seconds it has already been rendered.

Returns: