H3D API  2.4.1
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
H3D::Billboard Class Reference

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

Classes

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

Public Member Functions

 Billboard (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _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. More...
 
- Public Member Functions inherited from H3D::MatrixTransform
 MatrixTransform (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _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< SFMatrix4f > _accumulatedForward=0, Inst< SFMatrix4f > _accumulatedInverse=0)
 Constructor.
 
virtual void render ()
 Render the children.
 
void multiplyGLMatrix ()
 Multiply the currently active OpenGL matrix with the matrix of this node.
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and this Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
- Public Member Functions inherited from H3D::X3DGroupingNode
 X3DGroupingNode (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _removeChildren=0, Inst< MFChild > _children=0, Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0)
 Constructor.
 
virtual ~X3DGroupingNode ()
 Destructor.
 
virtual void initialize ()
 Sets up the bound field using the bboxCenter and bboxSize fields. More...
 
- Public Member Functions inherited from H3D::X3DChildNode
 X3DChildNode (Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::H3DBoundedObject
 H3DBoundedObject (Inst< SFBound > _bound=0)
 Constructor.
 
- Public Member Functions inherited from H3D::H3DDisplayListObject
 H3DDisplayListObject (Inst< DisplayList > _displayList=0)
 Constructor.
 

Public Attributes

H3DUniquePtr< SFVec3faxisOfRotation
 The axisOfRotation field specifies which axis to use to perform the rotation. More...
 
- Public Attributes inherited from H3D::MatrixTransform
H3DUniquePtr< SFMatrix4fmatrix
 The transformation matrix. More...
 
H3DUniquePtr< SFMatrix4faccumulatedForward
 The accumulated forward transform matrix, i.e. More...
 
H3DUniquePtr< SFMatrix4faccumulatedInverse
 The accumulated inverse transform matrix, i.e. More...
 
H3DUniquePtr< SFTransformedBoundtransformedBound
 This is the same as the bound field, but with the transformation applied to the bound. More...
 
- Public Attributes inherited from H3D::X3DGroupingNode
bool use_union_bound
 if true a route will be set up between the bound field of the nodes in children and the bound field of the grouping node. More...
 
H3DUniquePtr< AddChildrenaddChildren
 The addChildren event appends nodes to the children field of a grouping node. More...
 
H3DUniquePtr< RemoveChildrenremoveChildren
 The removeChildren event removes nodes from the children field of the grouping node . More...
 
H3DUniquePtr< MFChildchildren
 The nodes that are grouped together by this node. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::X3DBoundedObject
H3DUniquePtr< SFVec3fbboxCenter
 Specifies a the center of an axis-aligned bounding box enclosing the node. More...
 
H3DUniquePtr< SFVec3fbboxSize
 Specifies a the size of an axis-aligned bounding box enclosing the node. More...
 
- Public Attributes inherited from H3D::H3DBoundedObject
H3DUniquePtr< SFBoundbound
 The field containing the bound object. More...
 
- Public Attributes inherited from H3D::H3DDisplayListObject
H3DUniquePtr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::MatrixTransform
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DGroupingNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Protected Attributes

H3DUniquePtr< SFVec3fvpPosition
 The position of the viewpoint in local coordinates of the Billboard node. More...
 
H3DUniquePtr< SFVec3fvpUp
 The up vector of the viewpoint in local coordinates of the Billboard node. More...
 
- Protected Attributes inherited from H3D::X3DGroupingNode
bool children_multi_pass_transparency
 Will be set in traverseSG to indicate if any of the children enables multi-pass transparency. More...
 
vector< H3DRenderStateObject * > render_states
 A vector of all the H3DRenderStatesObject within this X3DGroupingNode.
 
vector< ClipPlane * > clip_planes
 A vector of only ClipPlane children of this X3DGroupingNode.
 

Additional Inherited Members

- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 

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.

Examples:

Internal routes:

Member Function Documentation

◆ traverseSG()

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
tiThe TraverseInfo object containing information about the traversal.

Reimplemented from H3D::MatrixTransform.

References H3D::X3DViewpointNode::accForwardMatrix, H3D::TraverseInfo::getAccInverseMatrix(), H3D::X3DViewpointNode::getActive(), H3D::X3DViewpointNode::totalOrientation, H3D::X3DViewpointNode::totalPosition, H3D::MatrixTransform::traverseSG(), vpPosition, and vpUp.

Member Data Documentation

◆ axisOfRotation

H3DUniquePtr< SFVec3f > H3D::Billboard::axisOfRotation

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 )

Referenced by Billboard().

◆ vpPosition

H3DUniquePtr< SFVec3f > H3D::Billboard::vpPosition
protected

The position of the viewpoint in local coordinates of the Billboard node.

This field will be set in traverseSG(). C++ only field

Referenced by Billboard(), and traverseSG().

◆ vpUp

H3DUniquePtr< SFVec3f > H3D::Billboard::vpUp
protected

The up vector of the viewpoint in local coordinates of the Billboard node.

This field will be set in traverseSG(). C++ only field

Referenced by Billboard(), and traverseSG().


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