XdkWrl: SpotLight Class Reference

Home | Hierarchy | Members | Alphabetical | Related Pages

# SpotLight Class Reference
[Standard Node Types]

`#include <spotlight.h>`

Inherits Node.

List of all members.

## Public Member Functions
| SpotLight (const char *name="")
virtual | ~SpotLight ()
virtual unsigned int | nbFields () const
virtual FieldHandle | field (const std::string &n)
virtual FieldHandle | field (unsigned int i)
virtual bool | isSetToDefaultValue (unsigned int i) const
virtual unsigned int | nbEventsIn () const
virtual EventInHandle | eventIn (const std::string &n)
virtual EventInHandle | eventIn (unsigned int i)
virtual unsigned int | nbEventsOut () const
virtual EventOutHandle | eventOut (const std::string &n)
virtual EventOutHandle | eventOut (unsigned int i)
const char * | typeName () const
virtual Node * | duplicate () const
virtual Node * | duplicate (std::map< const Node *, Node * > &) const
## Public Attributes
Exposed Fields
A field that is capable of receiving events via an eventIn to change its value(s), and generating events via an eventOut when its value(s) change.
SFFloat | ambientIntensity
SFVec3f | attenuation
SFFloat | beamWidth
SFColor | color
SFFloat | cutOffAngle
SFVec3f | direction
SFFloat | intensity
SFVec3f | location
SFBool | on
SFFloat | radius
Events In
EventIn< SFFloat > | set_ambientIntensity
EventIn< SFVec3f > | set_attenuation
EventIn< SFFloat > | set_beamWidth
EventIn< SFColor > | set_color
EventIn< SFFloat > | set_cutOffAngle
EventIn< SFVec3f > | set_direction
EventIn< SFFloat > | set_intensity
EventIn< SFVec3f > | set_location
EventIn< SFBool > | set_on
EventIn< SFFloat > | set_radius
Events Out
EventOut< SFFloat > | ambientIntensity_changed
EventOut< SFVec3f > | attenuation_changed
EventOut< SFFloat > | beamWidth_changed
EventOut< SFColor > | color_changed
EventOut< SFFloat > | cutOffAngle_changed
EventOut< SFVec3f > | direction_changed
EventOut< SFFloat > | intensity_changed
EventOut< SFVec3f > | location_changed
EventOut< SFBool > | on_changed
EventOut< SFFloat > | radius_changed

## Detailed Description

Here is the documentation for this node type, from the ISO standard.

## 6.64 SpotLight

The SpotLight node defines a light source that emits light from a specific point along a specific direction vector and constrained within a solid angle. Spotlights may illuminate geometry nodes that respond to light sources and intersect the solid angle defined by the SpotLight. Spotlight nodes are specified in the local coordinate system and are affected by ancestors' transformations.

A detailed description of ambientIntensity, color, intensity, and VRML's lighting equations is provided in 4.6.6, Light sources. More information on lighting concepts can be found in 4.14, Lighting model, including a detailed description of the VRML lighting equations.

The location field specifies a translation offset of the centre point of the light source from the light's local coordinate system origin. This point is the apex of the solid angle which bounds light emission from the given light source. The direction field specifies the direction vector of the light's central axis defined in the local coordinate system.

The on field specifies whether the light source emits light. If on is TRUE, the light source is emitting light and may illuminate geometry in the scene. If on is FALSE, the light source does not emit light and does not illuminate any geometry.

The radius field specifies the radial extent of the solid angle and the maximum distance from location that may be illuminated by the light source. The light source does not emit light outside this radius. The radius shall be greater than or equal to zero.

Both radius and location are affected by ancestors' transformations (scales affect radius and transformations affect location).

The cutOffAngle field specifies the outer bound of the solid angle. The light source does not emit light outside of this solid angle. The beamWidth field specifies an inner solid angle in which the light source emits light at uniform full intensity. The light source's emission intensity drops off from the inner solid angle (beamWidth) to the outer solid angle (cutOffAngle) as described in the following equations:

        angle = the angle between the Spotlight's direction vector
                and the vector from the Spotlight location to the point
                to be illuminated

        if (angle >= cutOffAngle):
            multiplier = 0
        else if (angle <= beamWidth):
            multiplier = 1
        else:
            multiplier = (angle - cutOffAngle) / (beamWidth - cutOffAngle)

        intensity(angle) = SpotLight.intensity × multiplier

If the beamWidth is greater than the cutOffAngle, beamWidth is defined to be equal to the cutOffAngle and the light source emits full intensity within the entire solid angle defined by cutOffAngle. Both beamWidth and cutOffAngle shall be greater than 0.0 and less than or equal to /2. Figure 6.16 depicts the beamWidth, cutOffAngle, direction, location, and radius fields of the SpotLight node.

####

#### Figure 6.16 -- SpotLight node

SpotLight illumination falls off with distance as specified by three attenuation coefficients. The attenuation factor is 1/max(attenuation[0] + attenuation[1]×r + attenuation[2]×r2 , 1), where r is the distance from the light to the surface being illuminated. The default is no attenuation. An attenuation value of (0, 0, 0) is identical to (1, 0, 0). Attenuation values shall be greater than or equal to zero. A detailed description of VRML's lighting equations is contained in 4.14, Lighting model.

## Constructor & Destructor Documentation

SpotLight | ( | const char * | name = `""` | ) |

Construct a node with all its fields set to default value, which is equivalent to the code below:

      ambientIntensity = 0.0f;
      attenuation.setXYZ(1,0,0);
      beamWidth = 1.5708f;
      color.setRGB(1,1,1);
      cutOffAngle = 0.785398f;
      direction.setXYZ(0,0,-1);
      intensity = 1.0f;
      location.setXYZ(0,0,0);
      on = true;
      radius = 100.0f;

~SpotLight | ( |  | ) | `[virtual]`

Virtual destructor, does nothing

## Member Function Documentation

unsigned int nbFields | ( |  | ) | const`[inline, virtual]`

Returns the number of fields (exposed or not) for this node type.

Implements Node.

wrl::Node::FieldHandle field | ( | const std::string & | n | ) | `[virtual]`

Return a handle on the field named `n` of the node or a "unknown" typed handle if there is no such field. Valid names are:

- ambientIntensity
- attenuation
- beamWidth
- color
- cutOffAngle
- direction
- intensity
- location
- on
- radius

Implements Node.

wrl::Node::FieldHandle field | ( | unsigned int | n | ) | `[virtual]`

Return a handle on the `i` th field of the node or a "unknown" typed handle if there is no such node. Here is how `i` is related to fields:

- 0 : ambientIntensity
- 1 : attenuation
- 2 : beamWidth
- 3 : color
- 4 : cutOffAngle
- 5 : direction
- 6 : intensity
- 7 : location
- 8 : on
- 9 : radius This function is useful, with nbFields() if you want to traverse all fields of a Node.

Implements Node.

bool isSetToDefaultValue | ( | unsigned int | i | ) | const`[virtual]`

Implements Node.

unsigned int nbEventsIn | ( |  | ) | const`[inline, virtual]`

Returns the number of events in for this node type.

Implements Node.

wrl::Node::EventInHandle eventIn | ( | const std::string & | n | ) | `[virtual]`

Return a handle on the event in named `n` of the node or a "unknown" typed handle if there is no such event. Valid names are:

- set_ambientIntensity
- set_attenuation
- set_beamWidth
- set_color
- set_cutOffAngle
- set_direction
- set_intensity
- set_location
- set_on
- set_radius

Implements Node.

wrl::Node::EventInHandle eventIn | ( | unsigned int | n | ) | `[virtual]`

Return a handle on the `i` th event in of the node or a "unknown" typed handle if there is no such node. emarks This class has no eventIn. This function is useful, with nbEventsIn() if you want to traverse all events in of a Node.

Implements Node.

unsigned int nbEventsOut | ( |  | ) | const`[inline, virtual]`

Returns the number of events out for this node type.

Implements Node.

wrl::Node::EventOutHandle eventOut | ( | const std::string & | n | ) | `[virtual]`

Return a handle on the event out named `n` of the node or a "unknown" typed handle if there is no such event. Valid names are:

- ambientIntensity_changed
- attenuation_changed
- beamWidth_changed
- color_changed
- cutOffAngle_changed
- direction_changed
- intensity_changed
- location_changed
- on_changed
- radius_changed

Implements Node.

wrl::Node::EventOutHandle eventOut | ( | unsigned int | n | ) | `[virtual]`

Return a handle on the `i` th event out of the node or a "unknown" typed handle if there is no such node. Here is how `i` is related to fields:

- 0 : ambientIntensity_changed
- 1 : attenuation_changed
- 2 : beamWidth_changed
- 3 : color_changed
- 4 : cutOffAngle_changed
- 5 : direction_changed
- 6 : intensity_changed
- 7 : location_changed
- 8 : on_changed
- 9 : radius_changed This function is useful, with nbEventsOut() if you want to traverse all events in of a Node.

Implements Node.

const char * typeName | ( |  | ) | const`[inline, virtual]`

Returns `"SpotLight"`. Useful for printing.

Implements Node.

wrl::Node * duplicate | ( |  | ) | const`[virtual]`

Returns a deep copy of this node, that is a fully independant node with all children (if any) also copied. This is mainly useful for instanciating protos.

Implements Node.

virtual Node* duplicate | ( | std::map< const Node *, Node * > & |  | ) | const`[virtual]`

Implements Node.

## Member Data Documentation

SFFloat ambientIntensity

See Detailed Description for meaning of this field. Default value is set to

           ambientIntensity = 0.0f;

SFVec3f attenuation

See Detailed Description for meaning of this field. Default value is set to

           attenuation.setXYZ(1,0,0);

SFFloat beamWidth

See Detailed Description for meaning of this field. Default value is set to

           beamWidth = 1.5708f;

SFColor color

See Detailed Description for meaning of this field. Default value is set to

           color.setRGB(1,1,1);

SFFloat cutOffAngle

See Detailed Description for meaning of this field. Default value is set to

           cutOffAngle = 0.785398f;

SFVec3f direction

See Detailed Description for meaning of this field. Default value is set to

           direction.setXYZ(0,0,-1);

SFFloat intensity

See Detailed Description for meaning of this field. Default value is set to

           intensity = 1.0f;

SFVec3f location

See Detailed Description for meaning of this field. Default value is set to

           location.setXYZ(0,0,0);

SFBool on

See Detailed Description for meaning of this field. Default value is set to

           on = true;

SFFloat radius

See Detailed Description for meaning of this field. Default value is set to

           radius = 100.0f;

EventIn<SFFloat> set_ambientIntensity

Set event associated to exposedField ambientIntensity

EventIn<SFVec3f> set_attenuation

Set event associated to exposedField attenuation

EventIn<SFFloat> set_beamWidth

Set event associated to exposedField beamWidth

EventIn<SFColor> set_color

Set event associated to exposedField color

EventIn<SFFloat> set_cutOffAngle

Set event associated to exposedField cutOffAngle

EventIn<SFVec3f> set_direction

Set event associated to exposedField direction

EventIn<SFFloat> set_intensity

Set event associated to exposedField intensity

EventIn<SFVec3f> set_location

Set event associated to exposedField location

EventIn<SFBool> set_on

Set event associated to exposedField on

EventIn<SFFloat> set_radius

Set event associated to exposedField radius

EventOut<SFFloat> ambientIntensity_changed

Changed event associated to exposedField ambientIntensity

EventOut<SFVec3f> attenuation_changed

Changed event associated to exposedField attenuation

EventOut<SFFloat> beamWidth_changed

Changed event associated to exposedField beamWidth

EventOut<SFColor> color_changed

Changed event associated to exposedField color

EventOut<SFFloat> cutOffAngle_changed

Changed event associated to exposedField cutOffAngle

EventOut<SFVec3f> direction_changed

Changed event associated to exposedField direction

EventOut<SFFloat> intensity_changed

Changed event associated to exposedField intensity

EventOut<SFVec3f> location_changed

Changed event associated to exposedField location

EventOut<SFBool> on_changed

Changed event associated to exposedField on

EventOut<SFFloat> radius_changed

Changed event associated to exposedField radius

Generated on 5 Jan 2007 with version 1.5.1. |