All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----dnx.util.DNXObject | +----dnx.lr.Node | +----dnx.lr.GroupingNode | +----dnx.lr.TransformGroupingNode | +----dnx.lr.node.BillboardNode
Billboard { eventIn MFNode addChildren eventIn MFNode removeChildren exposedField SFVec3f axisOfRotation 0 1 0 exposedField MFNode children [] field SFVec3f bboxCenter 0 0 0 field SFVec3f bboxSize -1 -1 -1 }
The Billboard node is a grouping node which modifies its coordinate system so that the billboard node's local Z-axis turns to point at the viewer. The Billboard node has children which may be other grouping or leaf nodes.
The axisOfRotation field specifies which axis to use to perform the rotation. This axis is defined in the local coordinates of the Billboard node. The default (0,1,0) is useful for objects such as images of trees and lamps positioned on a ground plane. But when an object is oriented at an angle, for example, on the incline of a mountain, then the axisOfRotation may also need to be oriented at a similar angle.
A special case of billboarding is screen-alignment -- the object rotates to always stay aligned with the viewer even when the viewer elevates, pitches and rolls. This special case is distinguished by setting the axisOfRotation to (0, 0, 0).
To rotate the Billboard to face the viewer, determine the line between the Billboard's origin and the viewer's position; call this the billboard-to-viewer line. The axisOfRotation and the billboard-to-viewer line define a plane. The local z-axis of the Billboard is then rotated into that plane, pivoting around the axisOfRotation.
If the axisOfRotation and the billboard-to-viewer line are coincident (the same line), then the plane cannot be established, and the rotation results of the Billboard are undefined. For example, if the axisOfRotation is set to (0,1,0) (Y-axis) and the viewer flies over the Billboard and peers directly down the Y-axis the results are undefined.
Multiple instances of Billboards (DEF/USE) operate as expected - each instance rotates in its unique coordinate system to face the viewer.
See the "Concepts - Grouping and Children Nodes" section for a description the children, addChildren, and removeChildren fields and eventIns.
The bboxCenter and bboxSize fields specify a bounding box that encloses the Billboard's children. This is a hint that may be used for optimization purposes. If the specified bounding box is smaller than the actual bounding box of the children at any time, then the results are undefined. A default bboxSize value, (-1 -1 -1), implies that the bounding box is not specified and if needed must be calculated by the browser. See "Concepts - Bounding Boxes" for a description of bboxCenter and bboxSize fields.
public SFVec3f axisOfRotationchildren
public MFNode childrenbboxCenter
public SFVec3f bboxCenterbboxSize
public SFVec3f bboxSize
public BillboardNode()
protected void createNodeDefinition(NodeDefinition def)
protected void initFields()
public void transform(Matrix4 objectToViewerMatrix)
public MFNode getChildren()
protected void handleEvent(SceneEvent ev)
public void recomputeBoundingBox(BoundingBox3 box)
protected boolean boundingBoxHasChanged(Field f)
All Packages Class Hierarchy This Package Previous Next Index