Coin
4.0.3
Coin3D core library
|
The SoVRMLSpotLight class defines a spot light source. More...
#include <Inventor/VRMLnodes/SoVRMLSpotLight.h>
Public Attributes | |
SoSFVec3f | attenuation |
SoSFFloat | beamWidth |
SoSFFloat | cutOffAngle |
SoSFVec3f | direction |
SoSFVec3f | location |
SoSFFloat | radius |
Public Attributes inherited from SoVRMLLight | |
SoSFFloat | ambientIntensity |
SoSFColor | color |
SoSFFloat | intensity |
SoSFBool | on |
Protected Member Functions | |
virtual | ~SoVRMLSpotLight () |
virtual const SoFieldData * | getFieldData (void) const |
Protected Member Functions inherited from SoVRMLLight | |
SoVRMLLight (void) | |
virtual | ~SoVRMLLight () |
Protected Member Functions inherited from SoNode | |
SoNode (void) | |
virtual | ~SoNode () |
virtual SbBool | readInstance (SoInput *in, unsigned short flags) |
Protected Member Functions inherited from SoFieldContainer | |
SoFieldContainer (void) | |
virtual | ~SoFieldContainer () |
Protected Member Functions inherited from SoBase | |
SoBase (void) | |
virtual | ~SoBase () |
virtual SoNotRec | createNotRec (void) |
virtual void | destroy (void) |
virtual const char * | getFileFormatName (void) const |
SbBool | hasMultipleWriteRefs (void) const |
void | writeFooter (SoOutput *out) const |
SbBool | writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) const |
Static Protected Member Functions | |
static const SoFieldData ** | getFieldDataPtr (void) |
Static Protected Member Functions inherited from SoVRMLLight | |
static const SoFieldData ** | getFieldDataPtr (void) |
Static Protected Member Functions inherited from SoNode | |
static const SoFieldData ** | getFieldDataPtr (void) |
static int | getNextActionMethodIndex (void) |
static void | incNextActionMethodIndex (void) |
static void | setCompatibilityTypes (const SoType &nodetype, const uint32_t bitmask) |
static void | setNextActionMethodIndex (int index) |
Static Protected Member Functions inherited from SoBase | |
static uint32_t | getCurrentWriteCounter (void) |
static void | staticDataLock (void) |
static void | staticDataUnlock (void) |
Additional Inherited Members | |
Public Types inherited from SoNode | |
enum | NodeType { INVENTOR = 0x0000 , VRML1 = 0x0001 , VRML2 = 0x0002 , INVENTOR_1 = 0x0004 , INVENTOR_2_0 = 0x0008 , INVENTOR_2_1 = 0x0010 , INVENTOR_2_5 = 0x0020 , INVENTOR_2_6 = 0x0040 , COIN_1_0 = 0x0080 , COIN_2_0 = 0x0100 , EXTENSION = 0x0200 , COIN_2_2 = 0x0400 , COIN_2_3 = 0x0800 , COIN_2_4 = 0x1000 , INVENTOR_5_0 = 0x2000 , COIN_2_5 = 0x4000 , COIN_3_0 = 0x8000 , INVENTOR_6_0 = 0x10000 , COIN_4_0 = 0x20000 } |
Protected Types inherited from SoBase | |
enum | BaseFlags { IS_ENGINE = 0x01 , IS_GROUP = 0x02 } |
Protected Attributes inherited from SoNode | |
SbUniqueId | uniqueId |
Protected Attributes inherited from SoFieldContainer | |
SbBool | isBuiltIn |
Static Protected Attributes inherited from SoNode | |
static int | nextActionMethodIndex = 0 |
static SbUniqueId | nextUniqueId = 1 |
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/documents/specifications/14772/V2.0/part1/concepts.html#4.6.6). More information on lighting concepts can be found in 4.14, Lighting model (http://www.web3d.org/documents/specifications/14772/V2.0/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 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/documents/specifications/14772/V2.0/part1/concepts.html#4.14).
SoVRMLSpotLight::SoVRMLSpotLight | ( | void | ) |
Constructor.
|
protectedvirtual |
Destructor.
This static method returns the SoType object associated with objects of this class.
|
protectedvirtual |
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL
.
Reimplemented from SoVRMLLight.
|
staticprotected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Returns the SoFieldData class which holds information about fields in this node.
Returns the type identification of an object derived from a class inheriting SoBase. This is used for runtime type checking and "downward" casting.
Reimplemented from SoVRMLLight.
|
virtual |
Action method for the SoGLRenderAction.
This is called during rendering traversals. Nodes influencing the rendering state in any way or want to throw geometry primitives at OpenGL override this method.
Reimplemented from SoVRMLLight.
SoSFVec3f SoVRMLSpotLight::attenuation |
The attenuiation vector. Default value is (1, 0, 0).
SoSFFloat SoVRMLSpotLight::beamWidth |
The spot beam width. Default value is PI/2.
SoSFFloat SoVRMLSpotLight::cutOffAngle |
The spot light cut off angle. Default value is PI/4.
SoSFVec3f SoVRMLSpotLight::direction |
The light direction. Default value is (0, 0, 1).
SoSFVec3f SoVRMLSpotLight::location |
The light position. Default value is (0, 0, 0).
SoSFFloat SoVRMLSpotLight::radius |
The light radius. Light is not emitted past it. Default value is 100.