SoShadowLight Class Reference

List of all members.

Detailed Description

Class defining a light in a shadow scene.

An instance of this class is created for every light added into the Shadow Manager and id is appended to shadowLightsRoot. SoShadowLight contains a part of a final shadow rendering scene graph that renders shadows created by this light. If the light is turned off (i.e. casts no shadows) the scene graph below is not traversed.

Definition at line 94 of file SoShadowLight.h.

Public Member Functions

 SoShadowLight (CShadowManager *sm, SoLight *l)
 Constructor.
 ~SoShadowLight ()
 Destructor.
void addVolume (SoSeparator *volume)
 Add a new shadow volume to the light.
SoSeparator * getVolume (int i)
 Get shadow volume i.
int getNumVolumes ()
 Get number of shadow volumes under this light.
void deleteVolumes ()
 Deletes all shadow volumes under this light.
void deleteVolume (int casterName)
 Deletes shadow volumes i under this light.
CShadowManagergetManager ()
 Returns pointer to the Shadow Manager.
SoLight * getLight ()
 Returns pointer to the light node.
void setLightName (int lightIndex)
 Sets caster name index and the name of the node.
int getLightName ()
 Gets caster name index.
void setSensor (SoNodeSensor *sensor)
 Sets light sensor.
SoNodeSensor * getSensor ()
 Gets light sensor.
void createShadowVolumes ()
 Creates all shadow volumes of all objects for this light.
void createShadowVolumes (int caster)
 Creates all shadow volumes of all objects for this light.

Public Attributes

SbBool status
 Saved light status.
SbBool * pstatus
 Pointer to saved light status.

Private Member Functions

void init ()
 Shadow light object initialization.

Static Private Member Functions

static void checkStencilExt ()
 Checks if GL_EXT_stencil_wrap is present in run-time.
static GLboolean CheckExtension (char *extName)
 Run-time check if an OpenGL extension is present at the renderer.
static void incrementStencilCB (void *userdata, SoAction *action)
 Rendering ++ CB.
static void decrementStencilCB (void *userdata, SoAction *action)
 Rendering -- CB.
static void litStencilCB (void *userdata, SoAction *action)
 Rendering lit CB.
static void finishStencilCB (void *userdata, SoAction *action)
 Rendering finish CB.

Private Attributes

CShadowManagermanager
 Pointer to shadow manager.
SoLight * light
 Light.
SoSeparator * lightRenderRoot
 Light render root.
SoSeparator * volumesRoot
 Shadow volumes root node (vol.
SoNodeSensor * sensor
 Sensor of light movement or change.
int nameIndex
 Object name index.

Static Private Attributes

static float envIntensity = 0.0f
 Ambient light intensity saved value.
static GLenum incValue = GL_INCR
 OpenGL enum for incrementing stencil buf.
static GLenum decValue = GL_DECR
 OpenGL enum for decrementing stencil buf.


Constructor & Destructor Documentation

SoShadowLight::SoShadowLight CShadowManager sm,
SoLight *  l
 

Constructor.

Parameters:
sm Pointer connection to the Shadow Manager.
l Pointer connection to the light node.

Definition at line 115 of file SoShadowLight.cpp.

References init(), lightRenderRoot, nameIndex, pstatus, status, and volumesRoot.

SoShadowLight::~SoShadowLight  ) 
 

Destructor.

Definition at line 141 of file SoShadowLight.cpp.

References lightRenderRoot, sensor, and volumesRoot.


Member Function Documentation

void SoShadowLight::checkStencilExt  )  [static, private]
 

Checks if GL_EXT_stencil_wrap is present in run-time.

Definition at line 80 of file SoShadowLight.cpp.

References CheckExtension(), decValue, GL_DECR_WRAP_EXT, GL_INCR_WRAP_EXT, and incValue.

Referenced by incrementStencilCB().

GLboolean SoShadowLight::CheckExtension char *  extName  )  [static, private]
 

Run-time check if an OpenGL extension is present at the renderer.

Parameters:
extName Extension name string.
Returns:
True if extension is found, false otherwise.

Definition at line 45 of file SoShadowLight.cpp.

Referenced by checkStencilExt().

void SoShadowLight::init  )  [private]
 

Shadow light object initialization.

Creates shadow rendering subgraph.

Definition at line 158 of file SoShadowLight.cpp.

References decrementStencilCB(), finishStencilCB(), CShadowManager::getEnvironmentNode(), TLightInfo::globEnv, incrementStencilCB(), light, TLightInfo::light, lightRenderRoot, litStencilCB(), manager, pstatus, and TLightInfo::status.

Referenced by SoShadowLight().

void SoShadowLight::incrementStencilCB void *  userdata,
SoAction *  action
[static, private]
 

Rendering ++ CB.

Sets stencil test according to the chosen algorithm.

Parameters:
userdata Pointer to TShadowAlgorithm.
action Pointer to the callback action.

Definition at line 483 of file SoShadowLight.cpp.

References checkStencilExt(), incValue, ONDEBUG, and zfailAlg.

Referenced by init().

void SoShadowLight::decrementStencilCB void *  userdata,
SoAction *  action
[static, private]
 

Rendering -- CB.

Sets stencil test according to the chosen algorithm.

Parameters:
userdata Pointer to TShadowAlgorithm.
action Pointer to the callback action.

Definition at line 534 of file SoShadowLight.cpp.

References decValue, ONDEBUG, and zfailAlg.

Referenced by init().

void SoShadowLight::litStencilCB void *  userdata,
SoAction *  action
[static, private]
 

Rendering lit CB.

Turns off ambient light and draws the user scene beside shadowed regions with one active light turned on. Shadow volumes of this light are tested with stencil buffer.

Parameters:
userdata Pointer to the pair of active light, all others lights, and ambient intensity field.
action Pointer to the callback action.

Definition at line 570 of file SoShadowLight.cpp.

References envIntensity, TLightInfo::globEnv, TLightInfo::light, ONDEBUG, and TLightInfo::status.

Referenced by init().

void SoShadowLight::finishStencilCB void *  userdata,
SoAction *  action
[static, private]
 

Rendering finish CB.

Turns on ambient light and turns off the active light.

Parameters:
userdata Pointer to the pair of active light, all others lights, and ambient intensity field.
action Pointer to the callback action.

Definition at line 624 of file SoShadowLight.cpp.

References envIntensity, TLightInfo::globEnv, TLightInfo::light, and ONDEBUG.

Referenced by init().

void SoShadowLight::addVolume SoSeparator *  volume  ) 
 

Add a new shadow volume to the light.

Parameters:
volume A separator node of the shadow volume.

Definition at line 327 of file SoShadowLight.cpp.

References ONDEBUG, and volumesRoot.

Referenced by CShadowManager::addObject().

SoSeparator * SoShadowLight::getVolume int  i  ) 
 

Get shadow volume i.

Parameters:
i Index of volume node to return.
Returns:
Pointer to the shadow volume node.

Definition at line 386 of file SoShadowLight.cpp.

References volumesRoot.

Referenced by CShadowManager::createCasterVolumes().

int SoShadowLight::getNumVolumes  ) 
 

Get number of shadow volumes under this light.

Returns:
Number of shadow volumes.

Definition at line 373 of file SoShadowLight.cpp.

References volumesRoot.

Referenced by CShadowManager::createCasterVolumes().

void SoShadowLight::deleteVolumes  ) 
 

Deletes all shadow volumes under this light.

Definition at line 337 of file SoShadowLight.cpp.

References ONDEBUG, and volumesRoot.

void SoShadowLight::deleteVolume int  casterName  ) 
 

Deletes shadow volumes i under this light.

Parameters:
casterName Caster index name.

Definition at line 349 of file SoShadowLight.cpp.

References ONDEBUG, and volumesRoot.

Referenced by CShadowManager::removeObject().

CShadowManager * SoShadowLight::getManager  ) 
 

Returns pointer to the Shadow Manager.

Returns:
Pointer to the Shadow Manager.

Definition at line 255 of file SoShadowLight.cpp.

References manager.

SoLight * SoShadowLight::getLight  ) 
 

Returns pointer to the light node.

Returns:
Pointer to the light node.

Definition at line 266 of file SoShadowLight.cpp.

References light.

Referenced by CShadowManager::checkLights(), CShadowManager::endCB(), CShadowManager::initCB(), CShadowManager::nslightsOffCB(), CShadowManager::nslightsOnCB(), CShadowManager::removeLight(), and SoShadowVolume::SoShadowVolume().

void SoShadowLight::setLightName int  lightIndex  ) 
 

Sets caster name index and the name of the node.

Parameters:
lightIndex Auto increment index name.

Definition at line 277 of file SoShadowLight.cpp.

References nameIndex, and ONDEBUG.

int SoShadowLight::getLightName  ) 
 

Gets caster name index.

Returns:
int Index (name) of the object.

Definition at line 293 of file SoShadowLight.cpp.

References nameIndex.

Referenced by CShadowManager::addObject().

void SoShadowLight::setSensor SoNodeSensor *  sensor  ) 
 

Sets light sensor.

Parameters:
sensor Pointer to the PathSensor to the light node.

Definition at line 304 of file SoShadowLight.cpp.

SoNodeSensor * SoShadowLight::getSensor  ) 
 

Gets light sensor.

Returns:
SoPathSensor * Pointer to the light sensor.

Definition at line 315 of file SoShadowLight.cpp.

References sensor.

void SoShadowLight::createShadowVolumes  ) 
 

Creates all shadow volumes of all objects for this light.

Definition at line 396 of file SoShadowLight.cpp.

References ONDEBUG, and volumesRoot.

Referenced by CShadowManager::lightMoveCallback().

void SoShadowLight::createShadowVolumes int  caster  ) 
 

Creates all shadow volumes of all objects for this light.

Parameters:
caster Caster index name.

Definition at line 416 of file SoShadowLight.cpp.

References ONDEBUG, and volumesRoot.


Member Data Documentation

CShadowManager* SoShadowLight::manager [private]
 

Pointer to shadow manager.

Definition at line 98 of file SoShadowLight.h.

Referenced by getManager(), and init().

SoLight* SoShadowLight::light [private]
 

Light.

Definition at line 100 of file SoShadowLight.h.

Referenced by getLight(), and init().

SoSeparator* SoShadowLight::lightRenderRoot [private]
 

Light render root.

Definition at line 102 of file SoShadowLight.h.

Referenced by init(), SoShadowLight(), and ~SoShadowLight().

SoSeparator* SoShadowLight::volumesRoot [private]
 

Shadow volumes root node (vol.

created by this light).

Definition at line 104 of file SoShadowLight.h.

Referenced by addVolume(), createShadowVolumes(), deleteVolume(), deleteVolumes(), getNumVolumes(), getVolume(), SoShadowLight(), and ~SoShadowLight().

SoNodeSensor* SoShadowLight::sensor [private]
 

Sensor of light movement or change.

Definition at line 108 of file SoShadowLight.h.

Referenced by getSensor(), and ~SoShadowLight().

int SoShadowLight::nameIndex [private]
 

Object name index.

Definition at line 110 of file SoShadowLight.h.

Referenced by getLightName(), setLightName(), and SoShadowLight().

float SoShadowLight::envIntensity = 0.0f [static, private]
 

Ambient light intensity saved value.

Definition at line 112 of file SoShadowLight.h.

Referenced by finishStencilCB(), and litStencilCB().

GLenum SoShadowLight::incValue = GL_INCR [static, private]
 

OpenGL enum for incrementing stencil buf.

Depends on if EXT_stencil_wrap extension is present.

Definition at line 114 of file SoShadowLight.h.

Referenced by checkStencilExt(), and incrementStencilCB().

GLenum SoShadowLight::decValue = GL_DECR [static, private]
 

OpenGL enum for decrementing stencil buf.

Depends on if EXT_stencil_wrap extension is present.

Definition at line 116 of file SoShadowLight.h.

Referenced by checkStencilExt(), and decrementStencilCB().

SbBool SoShadowLight::status
 

Saved light status.

Definition at line 132 of file SoShadowLight.h.

Referenced by CShadowManager::endCB(), CShadowManager::initCB(), CShadowManager::nslightsOffCB(), CShadowManager::nslightsOnCB(), and SoShadowLight().

SbBool* SoShadowLight::pstatus
 

Pointer to saved light status.

Definition at line 134 of file SoShadowLight.h.

Referenced by init(), and SoShadowLight().


The documentation for this class was generated from the following files:
Generated on Wed May 17 17:27:52 2006 for Shadow Engine by  doxygen 1.4.6-NO