GL Studio C++ Runtime API
ComponentLightMgr Class Reference

#include <component_light_mgr.h>

Public Member Functions

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

Static Public Member Functions

static ComponentLightMgrCreateInstance ()
 

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

◆ CleanupComponentLighting()

void CleanupComponentLighting ( )

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

◆ ClearRegisteredLights()

void ClearRegisteredLights ( )

Called before PreDraw() to clear the light list

◆ CreateInstance()

static ComponentLightMgr * CreateInstance ( )
static
Returns
A pointer to a new ComponentLightMgr instance.

◆ EnableNormalize() [1/2]

bool EnableNormalize ( )

Accessor method to get whether or not GL_NORMALIZE is enabled

Returns
Whether or not GL_NORMALIZE is enabled.

◆ EnableNormalize() [2/2]

void EnableNormalize ( bool  enableNormalize)

Sets whether GL_NORMALIZE is enabled. Default value is true.

Parameters
enableNormalizeSet GL_NORMALIZE to true or false

◆ GetActiveLightsBitMask()

unsigned int GetActiveLightsBitMask ( )

Get a bitmask of the active lights

Returns
An unsigned integer with each bit representing a light turned on/off

◆ GetActiveLightsMask()

bool * GetActiveLightsMask ( )

Get a boolean mask of the active lights

Returns
A boolean array with a bitmask of the currently active lights

◆ GetNumActiveLights()

unsigned int GetNumActiveLights ( )

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

◆ ReapplyLights()

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.

◆ ReapplyLightsForEyePoint()

void ReapplyLightsForEyePoint ( GlsEyePoint eyePoint)

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

Parameters
eyePointThe new GlsEyePoint to use, or NULL.

◆ RegisterLight()

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

◆ SetupComponentLighting()

void SetupComponentLighting ( )

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

◆ SetupLighting()

void SetupLighting ( DisplayObject object)

Called by lit objects to setup lights

Parameters
objectThe object to setup lighting for

◆ TopFrameInitialize()

void TopFrameInitialize ( )

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

◆ TopFrameRestore()

void TopFrameRestore ( )

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

◆ UseParentsLighting() [1/2]

bool UseParentsLighting ( )

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

◆ UseParentsLighting() [2/2]

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

Member Data Documentation

◆ _registeredLights

DynamicArray<GlsLightSource*> _registeredLights
protected

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

◆ _useParentsLighting

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: