H3D::X3DLightNode Class Reference
[Abstract nodes.]

The X3DLightNode abstract node type is the base type from which all node types that serve as light sources are derived. More...

#include <H3D/X3DLightNode.h>

Inheritance diagram for H3D::X3DLightNode:

Inheritance graph

List of all members.

Public Member Functions

 X3DLightNode (Inst< SFNode > _metadata=0, Inst< SFFloat > _ambientIntensity=0, Inst< SFColor > _color=0, Inst< SFBool > _global=0, Inst< SFFloat > _intensity=0, Inst< SFBool > _on=0)
 Constructor.
virtual void enableGraphicsState ()
 Turn the light on.
virtual void disableGraphicsState ()
 Turn the light off.
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph.

Static Public Member Functions

static GLuint getLightIndex (string name_for_error)
 returns an index that can be used to enable light.
static void decreaseLightIndex ()
 must be called if getLightIndex have been called outside X3DLightNode.

Public Attributes

auto_ptr< SFFloatambientIntensity
 Specifies the intensity of the ambient emission from the light.
auto_ptr< SFColorcolor
 The color field specifies the spectral colour properties of both the direct and ambient light emission as an RGB value.
auto_ptr< SFBoolglobal
 The global field specifies whether the X3DLightNode affects all geometries in the scene or only those geometries that are in the same parent group or any descendant to the parent group.
auto_ptr< SFFloatintensity
 The intensity field specifies the brightness of the direct emission from the light.
auto_ptr< SFBoolon
 The on field specifies whether the light is enabled or disabled.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.

Protected Attributes

GLuint light_index
 Light index for this node, used to enable light.
TraverseInfolast_ti_ptr
 only interested in adress, what it points to will be invalid
H3DInt32 traverse_sg_counter
 count how many times this X3DLightNodes traverseSG function is called.
H3DInt32 graphics_state_counter
 count nr of times enableGraphicsState is called.
bool act_global
 used if the light should act as a global light.
list< bool > had_light_index
 true if a light index was created for each call to enableGraphicsState for this X3DLightNode


Detailed Description

The X3DLightNode abstract node type is the base type from which all node types that serve as light sources are derived.

Any node used as a source of illumination is derived from X3DLightNode. All light sources contain an intensity, a color, and an ambientIntensity field. The intensity field specifies the brightness of the direct emission from the light, and the ambientIntensity specifies the intensity of the ambient emission from the light. Light intensity may range from 0.0 (no light emission) to 1.0 (full intensity). The color field specifies the spectral colour properties of both the direct and ambient light emission as an RGB value. The on field specifies whether the light is enabled or disabled. If the value is FALSE, then the light is disabled and will not affect any nodes in the scene. If the value is TRUE, then the light will affect other nodes.

Each light type defines a global field that determines whether the light is global or scoped. Global lights illuminate all objects that fall within their volume of lighting influence. Scoped lights only illuminate objects that are in the same transformation hierarchy as the light; i.e., only the children and descendants of its enclosing parent group are illuminated. This allows the creation of realistic effects such as lights that illuminate a single room.

Internal routes:
X3DLightNode.dot

Member Function Documentation

static void H3D::X3DLightNode::decreaseLightIndex (  )  [inline, static]

must be called if getLightIndex have been called outside X3DLightNode.

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

GLuint X3DLightNode::getLightIndex ( string  name_for_error  )  [static]

returns an index that can be used to enable light.

Parameters:
name_for_error contains the name to print in case the light index should be ignored.

Referenced by enableGraphicsState(), and H3D::H3DWindowNode::render().

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

Traverse the scenegraph.

Stores pointer to X3DLightNode and transformation matrices for those that are global.

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

Reimplemented from H3D::Node.

References act_global, H3D::TraverseInfo::getAccForwardMatrix(), global, graphics_state_counter, had_light_index, last_ti_ptr, on, traverse_sg_counter, and H3D::TraverseInfo::x3dlightnode_vector.


Member Data Documentation

Specifies the intensity of the ambient emission from the light.

Access type: inputOutput
Default value: 0
Valid range: [0-1]

X3DLightNode_ambientIntensity.dot

Referenced by H3D::DirectionalLight::DirectionalLight(), enableGraphicsState(), and X3DLightNode().

The color field specifies the spectral colour properties of both the direct and ambient light emission as an RGB value.

Access type: inputOutput
Default value: RGB( 1, 1, 1 )
Valid range: [0-1]

X3DLightNode_color.dot

Referenced by H3D::DirectionalLight::DirectionalLight(), enableGraphicsState(), and X3DLightNode().

The global field specifies whether the X3DLightNode affects all geometries in the scene or only those geometries that are in the same parent group or any descendant to the parent group.

Access type: inputOutput
Default value: FALSE

X3DLightNode_global.dot

Referenced by H3D::SpotLight::enableGraphicsState(), H3D::PointLight::enableGraphicsState(), H3D::DirectionalLight::enableGraphicsState(), H3D::PointLight::PointLight(), H3D::SpotLight::SpotLight(), traverseSG(), and X3DLightNode().

The intensity field specifies the brightness of the direct emission from the light.

Access type: inputOutput
Default value: 1
Valid range: [0-1]

X3DLightNode_intensity.dot

Referenced by H3D::DirectionalLight::DirectionalLight(), enableGraphicsState(), and X3DLightNode().

The on field specifies whether the light is enabled or disabled.

If the value is FALSE, then the light is disabled and will not affect any nodes in the scene.

Access type: inputOutput
Default value: TRUE

X3DLightNode_on.dot

Referenced by H3D::DirectionalLight::DirectionalLight(), H3D::SpotLight::enableGraphicsState(), H3D::PointLight::enableGraphicsState(), H3D::DirectionalLight::enableGraphicsState(), traverseSG(), and X3DLightNode().

count how many times this X3DLightNodes traverseSG function is called.

Referenced by H3D::SpotLight::enableGraphicsState(), H3D::PointLight::enableGraphicsState(), H3D::DirectionalLight::enableGraphicsState(), and traverseSG().


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

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