Coin Logo http://www.sim.no/
http://www.coin3d.org/

Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions

SoVRMLSpotLight Class Reference

The SoVRMLSpotLight class defines a spot light source.The detailed class documentation is taken verbatim from the VRML97 standard (ISO/IEC 14772-1:1997). It is copyright The Web3D Consortium, and is used by permission of the Consortium: More...

#include <Inventor/VRMLnodes/SoVRMLSpotLight.h>

Inheritance diagram for SoVRMLSpotLight:
SoVRMLLight SoNode SoFieldContainer SoBase

List of all members.

Public Member Functions

 SoVRMLSpotLight (void)
virtual void GLRender (SoGLRenderAction *action)

Static Public Member Functions

static void initClass (void)

Public Attributes

SoSFVec3f location
SoSFVec3f direction
SoSFFloat beamWidth
SoSFFloat cutOffAngle
SoSFFloat radius
SoSFVec3f attenuation

Protected Member Functions

virtual ~SoVRMLSpotLight ()

Detailed Description

The SoVRMLSpotLight class defines a spot light source.

The detailed class documentation is taken verbatim from the VRML97 standard (ISO/IEC 14772-1:1997). It is copyright The Web3D Consortium, and is used by permission of the Consortium:

  SpotLight {
    exposedField SFFloat ambientIntensity  0         # [0,1]
    exposedField SFVec3f attenuation       1 0 0     # [0,inf)
    exposedField SFFloat beamWidth         1.570796  # (0,pi/2]
    exposedField SFColor color             1 1 1     # [0,1]
    exposedField SFFloat cutOffAngle       0.785398  # (0,pi/2]
    exposedField SFVec3f direction         0 0 -1    # (-inf, inf)
    exposedField SFFloat intensity         1         # [0,1]
    exposedField SFVec3f location          0 0 0     # (-inf, inf)
    exposedField SFBool  on                TRUE
    exposedField SFFloat radius            100       # [0, inf)
  }
  

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 (<http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/concepts.html#4.6.6>). More information on lighting concepts can be found in 4.14, Lighting model (<http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/concepts.html#4.14>), 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 pi/2.

Figure 6.16 depicts the beamWidth, cutOffAngle, direction, location, and radius fields of the SpotLight node.

spotlight.gif

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]×r^2 , 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 (<http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/concepts.html#4.14>).


Constructor & Destructor Documentation

SoVRMLSpotLight::SoVRMLSpotLight ( void  )

Constructor.

SoVRMLSpotLight::~SoVRMLSpotLight ( ) [protected, virtual]

Destructor.


Member Function Documentation

void SoVRMLSpotLight::initClass ( void  ) [static]

Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.

Reimplemented from SoVRMLLight.

void SoVRMLSpotLight::GLRender ( SoGLRenderAction action) [virtual]

Action method for the SoGLRenderAction.

This is called during rendering traversals. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method.

Reimplemented from SoVRMLLight.


Member Data Documentation

The light position. Default value is (0, 0, 0).

The light direction. Default value is (0, 0, 1).

The spot beam width. Default value is PI/2.

The spot light cut off angle. Default value is PI/4.

The light radius. Light is not emitted past it. Default value is 100.

The attenuiation vector. Default value is (1, 0, 0).


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

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Sun May 1 2011 02:58:40 for Coin by Doxygen 1.7.3.