Class BillboardNode

java.lang.Object
com.ardor3d.scenegraph.Spatial
com.ardor3d.scenegraph.Node
com.ardor3d.scenegraph.extension.BillboardNode
All Implemented Interfaces:
Hintable, Savable

public class BillboardNode extends Node

BillboardNode defines a node that will attempt to orient itself in relation to the current camera. The way it does this depends on the alignment type set via setAlignment(BillboardAlignment).

BillboardNode is often a useful way fake complex distant geometry using a single quad that has an image applied to it. This quad, with the texture, will appear to be a full model at great distances, and save on rendering and memory.

It is also worth noting that you can use any geometry with this node, not just quads.

  • Constructor Details

    • BillboardNode

      public BillboardNode()
    • BillboardNode

      public BillboardNode(String name)
      Constructor instantiates a new BillboardNode. The name of the node is supplied during construction.
      Parameters:
      name - the name of the node.
  • Method Details

    • draw

      public void draw(Renderer r)
      draw updates the billboards orientation then renders the billboard's children.
      Overrides:
      draw in class Node
      Parameters:
      r - the renderer used to draw.
      See Also:
    • setUpdateBounds

      public void setUpdateBounds(boolean doUpdate)
      Normally a billboard triggers transform and bounds updates on its children. Setting this to false will only trigger dirty flags for transform, potentially saving some expensive bounds calculations if those are deemed unnecessary (for example, when using sphere bounds and quad billboards. Setting to false may cause odd culling behavior.
      Parameters:
      doUpdate - true (the default) if we should request bounds updates for children, false if not.
    • isUpdateBounds

      public boolean isUpdateBounds()
      Returns:
      true if bounds are dirtied for children each frame.
      See Also:
    • setLocalRotation

      public void setLocalRotation(Matrix3 rot)
    • getLocalRotation

      public ReadOnlyMatrix3 getLocalRotation()
    • rotateBillboard

      public void rotateBillboard()
      Rotate the billboard based on the type set and the currently set camera.
      See Also:
    • getAlignment

      public BillboardNode.BillboardAlignment getAlignment()
      Returns the alignment this BillboardNode is set to.
      Returns:
      The alignment of rotation.
    • setAlignment

      public void setAlignment(BillboardNode.BillboardAlignment alignment)
      Sets the type of rotation this BillboardNode will have. The alignment can be ScreenAligned, CameraAligned, AxialY or AxialZ. Invalid alignments will assume no billboard rotation.
      Parameters:
      alignment - The alignment of rotation
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class Node
      Parameters:
      capsule - the capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also:
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class Node
      Parameters:
      capsule - the input capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also: