org.xith3d.scenegraph.primitives
Class TextBillboard

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.Leaf
              extended by org.xith3d.scenegraph.Shape3D
                  extended by org.xith3d.scenegraph.primitives.Quad
                      extended by org.xith3d.scenegraph.primitives.Rectangle
                          extended by org.xith3d.scenegraph.primitives.TextRectangle
                              extended by org.xith3d.scenegraph.primitives.TextBillboard
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode, Billboard

public class TextBillboard
extends TextRectangle
implements Billboard

The TextBillboard is a Rectangle with a text-Texture on it, that's always facing the camera.
The Texture is created by TextureCreator.createTexture(String, Colorf, java.awt.Font, int).

See Also:
TextureCreator.createTexture(String, Colorf, java.awt.Font, int)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.xith3d.scenegraph.primitives.Rectangle
Rectangle.ZeroPointLocation
 
Field Summary
protected  org.openmali.vecmath2.Point3f[] transformedVertices
           
protected  org.openmali.vecmath2.Tuple3f[] zeroVertices
           
 
Fields inherited from class org.xith3d.scenegraph.primitives.TextRectangle
TEXT_ALIGNMENT_HORIZONTAL_CENTER, TEXT_ALIGNMENT_HORIZONTAL_LEFT, TEXT_ALIGNMENT_HORIZONTAL_RIGHT
 
Fields inherited from class org.xith3d.scenegraph.Node
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, transformGroup, untransformedBounds
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
protected TextBillboard(float width, float height, Rectangle.ZeroPointLocation zpl, float zOffset, Texture texture)
          Creates a TextBillboard.
protected TextBillboard(float width, float height, org.openmali.vecmath2.Tuple3f position, Texture texture)
          Creates a TextBillboard.
 
Method Summary
static TextBillboard createFixedHeight(float height, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextBillboard.
static TextBillboard createFixedHeight(float height, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextBillboard.
static TextBillboard createFixedHeight(float height, Rectangle.ZeroPointLocation zpl, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextBillboard.
static TextBillboard createFixedHeight(float height, Rectangle.ZeroPointLocation zpl, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextBillboard.
static TextBillboard createFixedHeight(float height, Rectangle.ZeroPointLocation zpl, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextBillboard.
static TextBillboard createFixedHeight(float height, Rectangle.ZeroPointLocation zpl, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextBillboard.
static TextBillboard createFixedHeight(float height, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextBillboard.
static TextBillboard createFixedHeight(float height, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextBillboard.
static TextBillboard createFixedHeight(float height, org.openmali.vecmath2.Tuple3f position, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextBillboard.
static TextBillboard createFixedHeight(float height, org.openmali.vecmath2.Tuple3f position, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextBillboard.
static TextBillboard createFixedWidth(float width, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextBillboard.
static TextBillboard createFixedWidth(float width, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextBillboard.
static TextBillboard createFixedWidth(float width, Rectangle.ZeroPointLocation zpl, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextBillboard.
static TextBillboard createFixedWidth(float width, Rectangle.ZeroPointLocation zpl, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextBillboard.
static TextBillboard createFixedWidth(float width, Rectangle.ZeroPointLocation zpl, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextBillboard.
static TextBillboard createFixedWidth(float width, Rectangle.ZeroPointLocation zpl, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextBillboard.
static TextBillboard createFixedWidth(float width, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextBillboard createFixedWidth(float width, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextBillboard createFixedWidth(float width, org.openmali.vecmath2.Tuple3f position, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextBillboard.
static TextBillboard createFixedWidth(float width, org.openmali.vecmath2.Tuple3f position, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextBillboard.
 org.openmali.types.twodee.Sized2iRO getSizeOnScreen()
          Returns the Billboard desired on screen dimensions.
 void updateFaceToCamera(org.openmali.vecmath2.Matrix3f viewRotation, long frameId, long nanoTime, long nanoStep)
          This method is called by the renderer each frame, the BillBoard is rendered.
 void updateOriginalVertexCoordinates()
           
 
Methods inherited from class org.xith3d.scenegraph.primitives.TextRectangle
createFixedHeight, getHeightFromFixedWidth, getText, getTextAlignment, getTextColor, getTextFont, getWidthFromFixedHeight, setText, setText
 
Methods inherited from class org.xith3d.scenegraph.primitives.Rectangle
createPosition, createPosition, createTextureCoordinates, createVertexCoords, createVertexCoords, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, getHeight, getSize, getTexture, getWidth, resize, resize, resize, resize, resize, resize, setTexture, setTexture, setTexture, setTexturePosition, setTexturePosition
 
Methods inherited from class org.xith3d.scenegraph.primitives.Quad
createGeometry, generateNormals, getAlpha, getColor, getGeometry, setAlpha, setColor, setTexture, setTexture, setTexture, setTextureCoordinates, setTexturePosition, setVertexCoords, setVertexCoords, setVertexCoords, update, update
 
Methods inherited from class org.xith3d.scenegraph.Shape3D
absorbDetails, copy, freeOpenGLResources, getAppearance, getAppearance, getCustomComparable, isBumpMappingEnabled, isShadowReceiver, isVisible, newAppearance, newInstance, setAppearance, setBounds, setBumpMappingEnabled, setBumpMappingEnabled, setCustomComparable, setGeometry, setIsShadowReceiver, setModListener, setVisible, sharedCopy, sharedCopy, traverse, updateBounds, updateBoundsCheap, updateWorldTransform, verifyAppChange
 
Methods inherited from class org.xith3d.scenegraph.Leaf
dump, getPickHost, setPickHost
 
Methods inherited from class org.xith3d.scenegraph.Node
cloneNode, detach, duplicateNode, freeOpenGLResources, getBounds, getBoundsAutoCompute, getBoundsType, getBoundsTypeHint, getDefaultPickable, getIndentString, getInheritedNodeAttributes, getModListener, getOrderedChild, getOrderedState, getParent, getRoot, getShadowAttachment, getShowBounds, getTransformGroup, getTreeCell, getWorldBounds, getWorldTransform, getWorldTransform, isBillboard, isIgnoreBounds, isOccluder, isPickable, isRenderable, isUpdatableNode, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBoundsAutoCompute, setBoundsDirty, setBoundsDirtyUpward, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setOrderedChild, setParent, setPickable, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, traverse, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateOrderedChild, updateTransformGroup
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

zeroVertices

protected org.openmali.vecmath2.Tuple3f[] zeroVertices

transformedVertices

protected org.openmali.vecmath2.Point3f[] transformedVertices
Constructor Detail

TextBillboard

protected TextBillboard(float width,
                        float height,
                        org.openmali.vecmath2.Tuple3f position,
                        Texture texture)
Creates a TextBillboard.

Parameters:
width - width of the Rectangle
height - height of the Rectangle
position - relative Location of the Rectangle
texture - the text-texture to apply

TextBillboard

protected TextBillboard(float width,
                        float height,
                        Rectangle.ZeroPointLocation zpl,
                        float zOffset,
                        Texture texture)
Creates a TextBillboard.

Parameters:
width - width of the Rectangle
height - height of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
texture - the text-texture to apply
Method Detail

updateOriginalVertexCoordinates

public void updateOriginalVertexCoordinates()

getSizeOnScreen

public org.openmali.types.twodee.Sized2iRO getSizeOnScreen()
Returns the Billboard desired on screen dimensions. For the default Billboard implementation, this method should return null, as the on-screen dimension is dependant on the distance between the Billboard and the camera. If the desired effect is a Billboard having a constant size on screen (usefull for icons, or textual information that should be readable at any distance), then this method should return the desired size in pixels. In this case, the Sized2iRO returned will generally be a constant. This method is called by the renderer each frame the Billboard is rendered. Note to implementers: for this behaviour to work properly, the unmodified geometry should of course have a unit size, ie: the width and the height should should be equal to 1f. Else the effective desired size on screen will be scaled accordingly.

Specified by:
getSizeOnScreen in interface Billboard
Returns:
the desired size on screen, or null for a standard billboard.

updateFaceToCamera

public void updateFaceToCamera(org.openmali.vecmath2.Matrix3f viewRotation,
                               long frameId,
                               long nanoTime,
                               long nanoStep)
This method is called by the renderer each frame, the BillBoard is rendered.

Specified by:
updateFaceToCamera in interface Billboard
Parameters:
viewRotation - the camera's rotation
frameId - the current rendered frame's id

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             org.openmali.vecmath2.Tuple3f position,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextBillboard.

Parameters:
width - (fixed) width of the Rectangle
position - relative Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             float zOffset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextBillboard.

Parameters:
width - (fixed) width of the Rectangle
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextRectangle.

Parameters:
alignment - the text horizontal alignment
width - (fixed) width of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             Rectangle.ZeroPointLocation zpl,
                                             float zOffset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextBillboard.

Parameters:
width - (fixed) width of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             Rectangle.ZeroPointLocation zpl,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextBillboard.

Parameters:
width - (fixed) width of the Rectangle
zpl - the location of the point (0, 0, 0)
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             org.openmali.vecmath2.Tuple3f position,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextBillboard.

Parameters:
width - (fixed) width of the Rectangle
position - relative Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             float zOffset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextBillboard.

Parameters:
width - (fixed) width of the Rectangle
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextRectangle.

Parameters:
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
width - (fixed) width of the Rectangle

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             Rectangle.ZeroPointLocation zpl,
                                             float zOffset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextBillboard.

Parameters:
width - (fixed) width of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedWidth

public static TextBillboard createFixedWidth(float width,
                                             Rectangle.ZeroPointLocation zpl,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextBillboard.

Parameters:
width - (fixed) width of the Rectangle
zpl - the location of the point (0, 0, 0)
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              org.openmali.vecmath2.Tuple3f position,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
position - relative Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              float zOffset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              Rectangle.ZeroPointLocation zpl,
                                              float zOffset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              Rectangle.ZeroPointLocation zpl,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
zpl - the location of the point (0, 0, 0)
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              org.openmali.vecmath2.Tuple3f position,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
position - relative Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              float zOffset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              Rectangle.ZeroPointLocation zpl,
                                              float zOffset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextBillboard createFixedHeight(float height,
                                              Rectangle.ZeroPointLocation zpl,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font)
Creates a TextBillboard.

Parameters:
height - (fixed) height of the Rectangle
zpl - the location of the point (0, 0, 0)
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text