H3D::Billboard Class Reference
[X3D node classes.]

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. More...

#include <H3D/Billboard.h>

Inheritance diagram for H3D::Billboard:

Inheritance graph

List of all members.

Classes

class  SFMatrix4f
 Specialize the SFMatrix4f to update the matrix from the fields in the Billboard node. More...

Public Member Functions

 Billboard (Inst< MFChild > _addChildren=0, Inst< MFChild > _removeChildren=0, Inst< MFChild > _children=0, Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0, Inst< SFTransformedBound > _transformedBound=0, Inst< SFMatrix4f > _matrix=0, Inst< SFVec3f > _axisOfRotation=0)
 Constructor.
virtual void traverseSG (TraverseInfo &ti)
 Set the matrix field in order to set the matrix field to perform the rotation required by the Billboard.

Public Attributes

auto_ptr< SFVec3faxisOfRotation
 The axisOfRotation field specifies which axis to use to perform the rotation.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.


Detailed Description

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 children nodes.

The axisOfRotation field specifies which axis to use to perform the rotation. This axis is defined in the local coordinate system. When the axisOfRotation field is not (0, 0, 0), the following steps describe how to rotate the billboard to face the viewer:

  1. Compute the vector from the Billboard node's origin to the viewer's position. This vector is called the billboard-to-viewer vector.

  2. Compute the plane defined by the axisOfRotation and the billboard-to-viewer vector.

  3. Rotate the local Z-axis of the billboard into the plane from b., pivoting around the axisOfRotation.
When the axisOfRotation field is set to (0, 0, 0), the special case of viewer-alignment is indicated. In this case, the object rotates to keep the billboard's local Y-axis parallel with the Y-axis of the viewer. This special case is distinguished by setting the axisOfRotation to (0, 0, 0). The following steps describe how to align the billboard's Y-axis to the Y-axis of the viewer:

  1. Compute the billboard-to-viewer vector.

  2. Rotate the Z-axis of the billboard to be collinear with the billboard-to-viewer vector and pointing towards the viewer's position.

  3. Rotate the Y-axis of the billboard to be parallel and oriented in the same direction as the Y-axis of the viewer.
If the axisOfRotation and the billboard-to-viewer line are coincident, the plane cannot be established and the resulting rotation of the billboard is 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 Billboard nodes (DEF/USE) operate as expected: each instance rotates in its unique coordinate system to face the viewer.

The bboxCenter and bboxSize fields specify a bounding box that encloses the Billboard node's children. This is a hint that may be used for optimization purposes. The results are undefined if the specified bounding box is smaller than the actual bounding box of the children at any time. A default bboxSize value, (-1, -1, -1), implies that the bounding box is not specified and if needed shall be calculated by the browser.

Internal routes:
Billboard.dot

Member Function Documentation

void Billboard::traverseSG ( TraverseInfo ti  )  [virtual]

Set the matrix field in order to set the matrix field to perform the rotation required by the Billboard.

Parameters:
ti The TraverseInfo object containing information about the traversal.

Reimplemented from H3D::MatrixTransform.

References H3D::X3DViewpointNode::accForwardMatrix, H3D::TraverseInfo::getAccInverseMatrix(), H3D::X3DViewpointNode::getActive(), H3D::X3DViewpointNode::totalOrientation, and H3D::X3DViewpointNode::totalPosition.


Member Data Documentation

The axisOfRotation field specifies which axis to use to perform the rotation.

This axis is defined in the local coordinate system. When the axisOfRotation field is set to (0, 0, 0), the special case of viewer-alignment is indicated.

Access type: inputOutput
Default value: Vec3f( 0, 1, 0 )

Billboard_axisOfRotation.dot

Referenced by Billboard().


The documentation for this class was generated from the following files:

Generated on Fri Nov 7 10:29:19 2008 for H3D API by  doxygen 1.5.7