H3D API
2.4.1
|
X3DBackgroundNode is the abstract type from which all backgrounds inherit. More...
#include <H3D/X3DBackgroundNode.h>
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, Inst< SFFloat > _transparency=0) | |
Constructor. | |
virtual void | traverseSG (TraverseInfo &ti) |
Saves the accForwardMatrix for use in the render function. | |
virtual void | renderBackground () |
Renders the background with OpenGL. More... | |
virtual RGBA | glClearColor () |
Returns the color that OpenGL should clear the buffer with before starting to render to it. More... | |
virtual void | render () |
Render the background. More... | |
![]() | |
X3DBindableNode (const string &_bindable_stack_name, Inst< SFSetBind > _set_bind=0, Inst< SFNode > _metadata=0, Inst< SFTime > _bindTime=0, Inst< SFBool > _isBound=0) | |
Constructor. | |
virtual | ~X3DBindableNode () |
Destructor. | |
virtual void | initialize () |
Initialize this bindable stack, toStackTop is done. | |
virtual void | toStackTop () |
Move this instance to the stack top. | |
virtual void | removeFromStack () |
Remove the bindable node from the stack. | |
bool | isStackTop () |
Is this node at the top of the stack. | |
![]() | |
X3DChildNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
![]() | |
X3DNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
X3DMetadataObject * | getMetadataByName (const string &_name) |
Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More... | |
![]() | |
Node () | |
Constructor. | |
virtual Node * | clone (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. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
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 bool | lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result) |
Detect intersection between a line segment and the 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... | |
virtual string | defaultXMLContainerField () |
Returns the default xml containerField attribute value. More... | |
virtual Field * | getField (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... | |
Static Public Member Functions | |
static X3DBackgroundNode * | getActive () |
Convenience function to get the top of the X3DBackgroundNode stack. | |
![]() | |
static X3DBindableNode * | getActive (const string &bindable_stack_name) |
Returns the active bindable instance, i.e. More... | |
static const StackType & | getStack (const string &bindable_stack_name) |
Get the stack for a given name. | |
static const StackMapType & | getStackMap () |
Return the map of all bindable nodes available. | |
![]() | |
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. | |
Public Attributes | |
H3DUniquePtr< DisplayList > | displayList |
The DisplayList instance handling the OpenGL caching of this object. | |
H3DUniquePtr< MFFloat > | groundAngle |
The groundAngle field specifies the angles from the nadir that the concentric circles of colour appear. More... | |
H3DUniquePtr< MFColor > | groundColor |
The groundColor field specifies the colour of the ground at the various angles on the ground partial sphere. More... | |
H3DUniquePtr< MFFloat > | skyAngle |
The skyAngle field specifies the angles from the zenith in which concentric circles of colour appear. More... | |
H3DUniquePtr< MFColor > | skyColor |
The skyColor field specifies the colour of the sky at various angles on the sky sphere. More... | |
H3DUniquePtr< SFFloat > | transparency |
The transparency field simply specifies the transparency for the sky and ground. More... | |
![]() | |
H3DUniquePtr< SFSetBind > | set_bind |
Input field to bind or unbind the node. More... | |
H3DUniquePtr< SFTime > | bindTime |
The bindTime field is the time at which the Viewpoint node is bound or unbound. More... | |
H3DUniquePtr< SFBool > | isBound |
Output field telling if this node is bound or not. More... | |
![]() | |
H3DUniquePtr< SFNode > | metadata |
Meta data about the node. More... | |
Static Public Attributes | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodedatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
Protected Attributes | |
H3DUniquePtr< SFMatrix4f > | localToGlobal |
A field that transforms from local to global space. More... | |
H3DUniquePtr< SFMatrix4d > | projectionMatrix |
Projection matrix for background C++ field only. | |
Additional Inherited Members | |
![]() | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
![]() | |
static StackMapType | stack |
The bindable stack. | |
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.
|
inlinevirtual |
Returns the color that OpenGL should clear the buffer with before starting to render to it.
Referenced by H3D::FrameBufferTextureGenerator::render(), and H3D::H3DWindowNode::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::TextureBackground, and H3D::Background.
References groundAngle, groundColor, H3DCos(), H3DSin(), localToGlobal, projectionMatrix, skyAngle, skyColor, and transparency.
Referenced by H3D::Background::render(), and H3D::TextureBackground::render().
|
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.
References displayList, and projectionMatrix.
Referenced by H3D::FrameBufferTextureGenerator::render(), H3D::H3DWindowNode::render(), H3D::PlanarReflector::renderPostViewpoint(), and H3D::GeneratedCubeMapTexture::updateCubeMap().
H3DUniquePtr< MFFloat > H3D::X3DBackgroundNode::groundAngle |
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
Referenced by render(), and X3DBackgroundNode().
H3DUniquePtr< MFColor > H3D::X3DBackgroundNode::groundColor |
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
Referenced by render(), and X3DBackgroundNode().
|
protected |
A field that transforms from local to global space.
C++ field only.
Referenced by H3D::Background::render(), H3D::TextureBackground::render(), render(), and X3DBackgroundNode().
H3DUniquePtr< MFFloat > H3D::X3DBackgroundNode::skyAngle |
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
Referenced by render(), and X3DBackgroundNode().
H3DUniquePtr< MFColor > H3D::X3DBackgroundNode::skyColor |
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
Referenced by render(), and X3DBackgroundNode().
H3DUniquePtr< SFFloat > H3D::X3DBackgroundNode::transparency |
The transparency field simply specifies the transparency for the sky and ground.
Access type: inputOutput
Referenced by render(), and X3DBackgroundNode().