GL Studio C++ Runtime API
ComponentLightMgr Class Reference

#include <component_light_mgr.h>

Public Member Functions

void UseParentsLighting (bool useParentsLighting)
 
bool UseParentsLighting (void)
 
void EnableNormalize (bool enableNormalize)
 
void RegisterLight (GlsLightSource *light)
 
void ClearRegisteredLights (void)
 
void TopFrameInitialize (void)
 
void TopFrameRestore (void)
 
void SetupComponentLighting (void)
 
void CleanupComponentLighting (void)
 
void SetupLighting (DisplayObject *object)
 
void ReapplyLightsForEyePoint (GlsEyePoint *eyePoint)
 
void ReapplyLights ()
 
bool * GetActiveLightsMask (void)
 
unsigned int GetActiveLightsBitMask (void)
 
unsigned int GetNumActiveLights (void)
 

Protected Attributes

DynamicArray< GlsLightSource * > _registeredLights
 
bool _useParentsLighting
 

Detailed Description

This class is responsible for keeping track of the lights in a component and setting up lighting for the objects of the component.

Member Function Documentation

void CleanupComponentLighting ( void  )

Called at the end of DisplayFrame::Draw() to restore the original lighting state

void ClearRegisteredLights ( void  )

Called before PreDraw() to clear the light list

void EnableNormalize ( bool  enableNormalize)

Sets whether GL_NORMALIZE is enabled. Default value is true.

Parameters
enableNormalizeSet GL_NORMALIZE to true or false
unsigned int GetActiveLightsBitMask ( void  )

Get a bitmask of the active lights

Returns
An unsigned integer with each bit representing a light turned on/off
bool* GetActiveLightsMask ( void  )

Get a boolean mask of the active lights

Returns
A boolean array with a bitmask of the currently active lights
unsigned int GetNumActiveLights ( void  )

Get the number of active lights for this component. Will include parent lights. Really is the max index(+1) of lights that you need to cycle through to have taken all of them into account (in case of holes in the list created by an outside party).

Returns
An integer representing the number of currently active lights
void ReapplyLights ( )

Sets a flag to cause the lights to be reapplied when the next lit object draws. This may be necessary for special cases where the OpenGL matrices have changed during a traversel. This can happen when drawing multiple views of the same geometry.

void ReapplyLightsForEyePoint ( GlsEyePoint eyePoint)

Called to force all lights to be reapplied based on the modelview specified by the eyePoint. A value of NULL, reapplys the lights with their original modelview.

void RegisterLight ( GlsLightSource light)

Any light source in the component that wants to be enabled must call this during PreDraw().

Parameters
lightThe light to be enabled
void SetupComponentLighting ( void  )

Detemine the OpenGL lighting state for this component and push it onto the global lighting stack (called from DisplayFrame::Draw())

void SetupLighting ( DisplayObject object)

Called by lit objects to setup lights

Parameters
objectThe object to setup lighting for
void TopFrameInitialize ( void  )

Called by the the parent of the component to initialize lighting prior to drawing the component

void TopFrameRestore ( void  )

Called by the the parent of the component to restore lighting after drawing the component

void UseParentsLighting ( bool  useParentsLighting)

Accessor method to set whether or not to inherit lighting from the component's parent

Parameters
useParentsLightingWhether or not to inherit lighting from the component's parent
bool UseParentsLighting ( void  )

Accessor method to get whether or not to inherit lighting from the component's parent

Returns
Whether or not to inherit lighting from the component's parent

Member Data Documentation

DynamicArray<GlsLightSource*> _registeredLights
protected

List of active lights in the component. This list is reset and populated during the PreDraw() traversal

bool _useParentsLighting
protected

If UseParentsLighting is true, the component will add its lights to those already set by it's parent. If false, the component will only use it's own lights.


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