Main Page Modules Class Hierarchy Alphabetical List Compound List File List Compound Members

# SoVRMLBillboard Class Reference
[VRML97 classes]

The SoVRMLBillboard class is used for rotating geometry towards the viewpoint. More...

`#include <Inventor/VRMLnodes/SoVRMLBillboard.h>`

Inheritance diagram for SoVRMLBillboard:

List of all members.

## Public Methods
| SoVRMLBillboard (void)
| SoVRMLBillboard (int numchildren)
virtual void | doAction (SoAction *action)
virtual void | callback (SoCallbackAction *action)
virtual void | GLRender (SoGLRenderAction *action)
virtual void | getBoundingBox (SoGetBoundingBoxAction *action)
virtual void | getMatrix (SoGetMatrixAction *action)
virtual void | pick (SoPickAction *action)
virtual void | search (SoSearchAction *action)
virtual void | GLRenderBelowPath (SoGLRenderAction *action)
virtual void | GLRenderInPath (SoGLRenderAction *action)
virtual void | GLRenderOffPath (SoGLRenderAction *action)
virtual void | notify (SoNotList *list)
## Static Public Methods
void | initClass (void)
## Public Attributes
SoSFVec3f | axisOfRotation
SoSFVec3f | bboxCenter
SoSFVec3f | bboxSize
## Protected Methods
virtual | ~SoVRMLBillboard ()

## Detailed Description

The SoVRMLBillboard class is used for rotating geometry towards the viewpoint.

The detailed class documentation is taken verbatim from the VRML97 standard (ISO/IEC 14772-1:1997). It is copyright The Web3D Consortium, and is used by permission of the Consortium:

      Billboard {
        eventIn      MFNode   addChildren
        eventIn      MFNode   removeChildren
        exposedField SFVec3f  axisOfRotation 0 1 0     # (-inf, inf)
        exposedField MFNode   children       []
        field        SFVec3f  bboxCenter     0 0 0     # (-inf, inf)
        field        SFVec3f  bboxSize       -1 -1 -1  # (0, inf) or -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 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:

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

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

- c. 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:

- d. Compute the billboard-to-viewer vector.

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

- f. 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. Subclause 4.6.5, Grouping and children nodes (<http://www.web3d.org/technicalinfo/specifications/vrml97/part1/concepts.html#4.6.5>), provides a description of the children, addChildren, and removeChildren fields and eventIns. 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. A description of the bboxCenter and bboxSize fields is contained in 4.6.4, Bounding boxes (<http://www.web3d.org/technicalinfo/specifications/vrml97/part1/concepts.html#4.6.4>),

## Constructor & Destructor Documentation

SoVRMLBillboard::SoVRMLBillboard | ( | void |  | ) |

| Constructor.

SoVRMLBillboard::SoVRMLBillboard | ( | int | numchildren | ) |

| Constructor. numchildren is the expected number of children.

SoVRMLBillboard::~SoVRMLBillboard | ( |  | ) | `[protected, virtual]`

| Destructor.

## Member Function Documentation

void SoVRMLBillboard::initClass | ( | void |  | ) | `[static]`

| Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system. Reimplemented from SoVRMLParent.

void SoVRMLBillboard::doAction | ( | SoAction * | action | ) | `[virtual]`

| This function performs the typical operation of a node for any action. Reimplemented from SoVRMLParent.

void SoVRMLBillboard::callback | ( | SoCallbackAction * | action | ) | `[virtual]`

| Action method for SoCallbackAction. Simply updates the state according to how the node behaves for the render action, so the application programmer can use the SoCallbackAction for extracting information about the scene graph. Reimplemented from SoGroup.

void SoVRMLBillboard::GLRender | ( | SoGLRenderAction * | action | ) | `[virtual]`

| Action method for the SoGLRenderAction. This is called during rendering traversals. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method. Reimplemented from SoGroup.

void SoVRMLBillboard::getBoundingBox | ( | SoGetBoundingBoxAction * | action | ) | `[virtual]`

| Action method for the SoGetBoundingBoxAction. Calculates bounding box and center coordinates for node and modifies the values of the action to encompass the bounding box for this node and to shift the center point for the scene more towards the one for this node. Nodes influencing how geometry nodes calculates their bounding box also overrides this method to change the relevant state variables. Reimplemented from SoGroup.

void SoVRMLBillboard::getMatrix | ( | SoGetMatrixAction * | action | ) | `[virtual]`

| Action method for SoGetMatrixAction. Updates action by accumulating with the transformation matrix of this node (if any). Reimplemented from SoGroup.

void SoVRMLBillboard::pick | ( | SoPickAction * | action | ) | `[virtual]`

| Action method for SoPickAction. Does common processing for SoPickAction action instances. Reimplemented from SoGroup.

void SoVRMLBillboard::search | ( | SoSearchAction * | action | ) | `[virtual]`

| Action method for SoSearchAction. Compares the search criteria from the action to see if this node is a match. Searching is done by matching up all criteria set up in the SoSearchAction -- if any of the requested criteria is a miss, the search is not deemed successful for the node. See also: SoSearchAction Reimplemented from SoVRMLParent.

void SoVRMLBillboard::GLRenderBelowPath | ( | SoGLRenderAction * | action | ) | `[virtual]`

| Implements the SoAction::BELOW_PATH traversal method for the rendering action. Reimplemented from SoNode.

void SoVRMLBillboard::GLRenderInPath | ( | SoGLRenderAction * | action | ) | `[virtual]`

| Implements the SoAction::IN_PATH traversal method for the rendering action. Reimplemented from SoNode.

void SoVRMLBillboard::GLRenderOffPath | ( | SoGLRenderAction * | action | ) | `[virtual]`

| Implements the SoAction::OFF_PATH traversal method for the rendering action. Reimplemented from SoNode.

void SoVRMLBillboard::notify | ( | SoNotList * | list | ) | `[virtual]`

| Notifies all auditors for this instance when changes are made. Reimplemented from SoVRMLParent.

## Member Data Documentation

SoSFVec3f SoVRMLBillboard::axisOfRotation

| The axis of rotation for the geometry.

SoSFVec3f SoVRMLBillboard::bboxCenter

| The bounding box center hint. Default value is (0, 0, 0).

SoSFVec3f SoVRMLBillboard::bboxSize

| The bounding box size hint. Default value is (-1, -1, -1).

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

- SoVRMLBillboard.h
- Billboard.cpp