org.xith3d.scenegraph.primitives
Class FixedSizedBillboard

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.FixedSizedBillboard
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode, Billboard

public class FixedSizedBillboard
extends Shape3D
implements Billboard

A simple implementation for the Billboard interface. It does not inherit from Rectangle or TextRectangle as RectBillboard and TextBillboard do to avoid geometry duplication. Moreover, features like creating a text Billboard should go into a factory class and not clutter this class with numerous constructors.

See Also:
FixedSizedBillboardFactory

Field Summary
 
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
FixedSizedBillboard(org.openmali.vecmath2.Tuple3f center, float width, float height)
          Constructor.
 
Method Summary
 TriangleStripArray getGeometry()
           
 org.openmali.types.twodee.Sized2iRO getSizeOnScreen()
          Returns the desired size on screen for this billboard, in pixels.
 void setSizeOnScreen(int width, int height)
          Sets the desired size on screen in pixels.
 void setTexture(Texture texture, org.openmali.vecmath2.Tuple2f texLowerLeft, org.openmali.vecmath2.Tuple2f texUpperRight)
          Sets the texture used by this billboard.
 void setTexturePosition(org.openmali.vecmath2.Tuple2f texLowerLeft, org.openmali.vecmath2.Tuple2f texUpperRight)
          Sets the new texture-coordinates for this Rectangle.
 void updateFaceToCamera(org.openmali.vecmath2.Matrix3f viewRotation, long frameId, long nanoTime, long nanoStep)
          Interface implementation.
 
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
 

Constructor Detail

FixedSizedBillboard

public FixedSizedBillboard(org.openmali.vecmath2.Tuple3f center,
                           float width,
                           float height)
Constructor.

Parameters:
center - the billboard center. Can be null, and will usually be.
width - the billboard width.
height - the billboard height.
Method Detail

setTexture

public void setTexture(Texture texture,
                       org.openmali.vecmath2.Tuple2f texLowerLeft,
                       org.openmali.vecmath2.Tuple2f texUpperRight)
Sets the texture used by this billboard.

Parameters:
texture - the texture to use, or null to remove the texture.
texLowerLeft - the texture lower left coordinate. It can be null in which case the (0f;0f) value is assumed.
texUpperRight - the texture upper right coordinate. It can be null in which case the (1f;1f) value is assumed.

setTexturePosition

public void setTexturePosition(org.openmali.vecmath2.Tuple2f texLowerLeft,
                               org.openmali.vecmath2.Tuple2f texUpperRight)
Sets the new texture-coordinates for this Rectangle.

Parameters:
texLowerLeft - the texture lower left coordinate. It can be null in which case the (0f;0f) value is assumed.
texUpperRight - the texture upper right coordinate. It can be null in which case the (1f;1f) value is assumed.

getSizeOnScreen

public org.openmali.types.twodee.Sized2iRO getSizeOnScreen()
Returns the desired size on screen for this billboard, in pixels.

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

setSizeOnScreen

public void setSizeOnScreen(int width,
                            int height)
Sets the desired size on screen in pixels. If any of the given values are negative or zero, the getSizeOnScreen() method will return null.

Parameters:
width - the desired width in pixels.
height - the desired height in pixels.

updateFaceToCamera

public void updateFaceToCamera(org.openmali.vecmath2.Matrix3f viewRotation,
                               long frameId,
                               long nanoTime,
                               long nanoStep)
Interface implementation.

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

getGeometry

public TriangleStripArray getGeometry()
Overrides:
getGeometry in class Shape3D
Returns:
the Geometry for this object.