H3D::X3DBackgroundNode Class Reference
[Abstract nodes.]

X3DBackgroundNode is the abstract type from which all backgrounds inherit. More...

#include <H3D/X3DBackgroundNode.h>

Inheritance diagram for H3D::X3DBackgroundNode:

Inheritance graph

List of all members.

Public Member Functions

 X3DBackgroundNode (Inst< SFSetBind > _set_bind=0, Inst< SFNode > _metadata=0, Inst< SFTime > _bindTime=0, Inst< SFBool > _isBound=0, Inst< DisplayList > _displayList=0, Inst< MFFloat > _groundAngle=0, Inst< MFColor > _groundColor=0, Inst< MFFloat > _skyAngle=0, Inst< MFColor > _skyColor=0)
 Constructor.
virtual void traverseSG (TraverseInfo &ti)
 Saves the accForwardMatrix for use in the render function.
virtual void renderBackground ()
 Renders the background with OpenGL.
virtual RGB glClearColor ()
 Returns the color that OpenGL should clear the buffer with before starting to render to it.
virtual void render ()
 Render the background.

Static Public Member Functions

static X3DBackgroundNodegetActive ()
 Convenience function to get the top of the X3DBackgroundNode stack.

Public Attributes

auto_ptr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
auto_ptr< MFFloatgroundAngle
 The groundAngle field specifies the angles from the nadir that the concentric circles of colour appear.
auto_ptr< MFColorgroundColor
 The groundColor field specifies the colour of the ground at the various angles on the ground partial sphere.
auto_ptr< MFFloatskyAngle
 The skyAngle field specifies the angles from the zenith in which concentric circles of colour appear.
auto_ptr< MFColorskyColor
 The skyColor field specifies the colour of the sky at various angles on the sky sphere.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.


Detailed Description

X3DBackgroundNode is the abstract type from which all backgrounds inherit.

X3DBackgroundNode is a bindable node that when bound to defines the panoramic background for the scene.

Background nodes are used to specify a colour backdrop that simulates ground and sky, as well as a background texture, or panorama, that is placed behind all geometry in the scene and in front of the ground and sky. Background nodes are specified in the local coordinate system and are affected by the accumulated rotation of their ancestors as described below. X3D supports two kinds of background nodes: a simple background node that contains a set of url fields for specifying static image files that compose the backdrop (see Background), and a complex background node containing arbitrary X3DTextureNode nodes that compose the backdrop (see TextureBackground). Both types of background node descend from the base type X3DBackgroundNode. Applications should use the Background node for simplicity, and the TextureBackground node for more flexibility and additional features.

Background nodes are bindable nodes. There exists a Background stack, in which the top-most Background on the stack is the currently active Background. To move a Background to the top of the stack, a TRUE value is sent to the set_bind field. Once active, the Background is then bound to the browsers view. A FALSE value sent to set_bind removes the Background from the stack and unbinds it from the browser's view.

The backdrop is conceptually a partial sphere (the ground) enclosed inside of a full sphere (the sky) in the local coordinate system with the viewer placed at the centre of the spheres. Both spheres have infinite radius and each is painted with concentric circles of interpolated colour perpendicular to the local Y-axis of the sphere. The Background node is subject to the accumulated rotations of its ancestors' transformations. Scaling and translation transformations are ignored. The sky sphere is always slightly farther away from the viewer than the ground partial sphere causing the ground to appear in front of the sky where they overlap.

The skyColor field specifies the colour of the sky at various angles on the sky sphere. The first value of the skyColor field specifies the colour of the sky at 0.0 radians representing the zenith (i.e., straight up from the viewer). The skyAngle field specifies the angles from the zenith in which concentric circles of colour appear. The zenith of the sphere is implicitly defined to be 0.0 radians, the natural horizon is at pi/2 radians, and the nadir (i.e., straight down from the viewer) is at pi radians. skyAngle is restricted to non-decreasing values in the range [0.0, pi]. There shall be one more skyColor value than there are skyAngle values. The first colour value is the colour at the zenith, which is not specified in the skyAngle field. If the last skyAngle is less than pi, then the colour band between the last skyAngle and the nadir is clamped to the last skyColor. The sky colour is linearly interpolated between the specified skyColor values.

The groundColor field specifies the colour of the ground at the various angles on the ground partial sphere. The first value of the groundColor field specifies the colour of the ground at 0.0 radians representing the nadir (i.e., straight down from the user). The groundAngle field specifies the angles from the nadir that the concentric circles of colour appear. The nadir of the sphere is implicitly defined at 0.0 radians. groundAngle is restricted to non-decreasing values in the range [0.0, pi/2]. There shall be one more groundColor value than there are groundAngle values. The first colour value is for the nadir which is not specified in the groundAngle field. If the last groundAngle is less than pi/2, the region between the last groundAngle and the equator is non-existant. The ground colour is linearly interpolated between the specified groundColor values.

Ground colours, sky colours, and panoramic images do not translate with respect to the viewer, though they do rotate with respect to the viewer. That is, the viewer can never get any closer to the background, but can turn to examine all sides of the panorama cube, and can look up and down to see the concentric rings of ground and sky (if visible).

Background nodes are not affected by Fog nodes. Therefore, if a Background node is active (i.e., bound) while a Fog node is active, then the Background node will be displayed with no fogging effects. It is the author's responsibility to set the Background values to match the Fog values (e.g. ground colours fade to fog colour with distance and panorama images tinted with fog colour). Background nodes are not affected by light sources.

Internal routes:
X3DBackgroundNode.dot

Member Function Documentation

virtual RGB H3D::X3DBackgroundNode::glClearColor (  )  [inline, virtual]

Returns the color that OpenGL should clear the buffer with before starting to render to it.

Referenced by H3D::H3DWindowNode::render().

void X3DBackgroundNode::render (  )  [virtual]

Render the background.

It will render one sphere with radius 0.05 for the sky and one half sphere with radius 0.95 * 0.05 for the ground.

Reimplemented from H3D::Node.

Reimplemented in H3D::Background, and H3D::TextureBackground.

References groundAngle, groundColor, H3DCos(), H3DSin(), skyAngle, and skyColor.

virtual void H3D::X3DBackgroundNode::renderBackground (  )  [inline, virtual]

Renders the background with OpenGL.

Have to have a special call to be used by GLWindow instead of render() to avoid the background node to be rendered as part of the scene graph.

Referenced by H3D::H3DWindowNode::render(), H3D::PlanarReflector::renderPostViewpoint(), and H3D::GeneratedCubeMapTexture::updateCubeMap().


Member Data Documentation

The groundAngle field specifies the angles from the nadir that the concentric circles of colour appear.

The nadir of the sphere is implicitly defined at 0.0 radians. groundAngle is restricted to non-decreasing values in the range [0.0, p/2].

Access type: inputOutput

X3DBackgroundNode_groundAngle.dot

Referenced by render(), and X3DBackgroundNode().

The groundColor field specifies the colour of the ground at the various angles on the ground partial sphere.

The first value of the groundColor field specifies the colour of the ground at 0.0 radians representing the nadir (i.e., straight down from the user). There shall be one more groundColor value than there are groundAngle values. The first colour value is for the nadir which is not specified in the groundAngle field. If the last groundAngle is less than p/2, the region between the last groundAngle and the equator is non-existant. The ground colour is linearly interpolated between the specified groundColor values.

Access type: inputOutput

X3DBackgroundNode_groundAngle.dot

Referenced by render(), and X3DBackgroundNode().

The skyAngle field specifies the angles from the zenith in which concentric circles of colour appear.

The zenith of the sphere is implicitly defined to be 0.0 radians, the natural horizon is at pi/2 radians, and the nadir (i.e., straight down from the viewer) is at pi radians. skyAngle is restricted to non-decreasing values in the range [0.0, pi].

Access type: inputOutput

X3DBackgroundNode_skyAngle.dot

Referenced by render(), and X3DBackgroundNode().

The skyColor field specifies the colour of the sky at various angles on the sky sphere.

The first value of the skyColor field specifies the colour of the sky at 0.0 radians representing the zenith (i.e., straight up from the viewer). There shall be one more skyColor value than there are skyAngle values. The first colour value is the colour at the zenith, which is not specified in the skyAngle field. If the last skyAngle is less than pi, then the colour band between the last skyAngle and the nadir is clamped to the last skyColor. The sky colour is linearly interpolated between the specified skyColor values.

Access type: inputOutput

X3DBackgroundNode_groundAngle.dot

Referenced by render(), and X3DBackgroundNode().


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

Generated on Fri Nov 7 10:31:23 2008 for H3D API by  doxygen 1.5.7