GL Studio C++ Runtime API
GlobalLightMgr Class Referencefinal

Public Types

typedef DynamicArray< GlsLightSource * > LightingState
 

Public Member Functions

void PushLightingState ()
 
void PopLightingState ()
 
void ReapplyLights ()
 
void SetLightingState (const LightingState &newState)
 
void SetLightingState (LightingState &&newState)
 
const LightingStateGetLightingState () const
 
void SetupLighting (GlsEyePoint *relativeToEyepoint=NULL)
 
void InitializeStateFromOpenGL ()
 
void RestoreOpenGLState ()
 
bool * GetActiveLightsMask ()
 
unsigned int GetActiveLightsBitMask ()
 
unsigned int GetNumActiveLights ()
 

Static Public Member Functions

static GlobalLightMgrInstance ()
 
static unsigned int GlMaxLights ()
 
static void EnableNormalize (bool enableNormalize)
 
static bool EnableNormalize ()
 

Protected Attributes

LightingState _currentOpenGLState
 
LightingState _currentState
 
DynamicArray< GlsLightSource * > _tempOpenGLLights
 
DynamicArray< LightingState_lightingStateStack
 
bool _reapplyLights
 

Friends

class GlobalLightMgrThreadMap
 

Member Typedef Documentation

List of the currently active lights The number of the light is equal to it's array index. (i.e. The light at index 0 is GL_LIGHT0)

Member Function Documentation

static void EnableNormalize ( bool  enableNormalize)
static

Set whether or not GL_NORMALIZE is enabled

Parameters
enableNormalizeSet GL_NORMALIZE to true or false
static bool EnableNormalize ( )
static

Get the state of whether GL_NORMALIZE is enabled

Returns
Whether or not GL_NORMALIZE is enabled
unsigned int GetActiveLightsBitMask ( )

Get a bitmask of the active lights

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

Get a boolean mask of the active lights

Returns
A boolean array with a bitmask of the currently active lights
const LightingState& GetLightingState ( ) const

Get the current lighting state

Returns
The current lighting state
unsigned int GetNumActiveLights ( )

Get the number of active 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 (max) number of currently active lights
static unsigned int GlMaxLights ( )
inlinestatic
Returns
The value of GL_MAX_LIGHTS
void InitializeStateFromOpenGL ( )

Clear the lighting stack, create GlsLightSource objects based on the current OpenGL lighting state and store them as the current state.

static GlobalLightMgr& Instance ( )
static
Returns
The singleton to the one instance of GlobalLightMgr
void PopLightingState ( )

Push the current lighting state off the stack

void PushLightingState ( )

Push the current lighting state onto the stack

void ReapplyLights ( )
inline

Flags the need to reapply the lights. 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 RestoreOpenGLState ( )

Restore the OpenGL state to what it was at the last call to InitializeStateFromOpenGL()

void SetLightingState ( const LightingState newState)

Set the current lighting state to a new state

Parameters
newStateThe new lighting state
void SetLightingState ( LightingState &&  newState)
inline

Set the current lighting state to a new state

Parameters
newStateThe new lighting state
void SetupLighting ( GlsEyePoint relativeToEyepoint = NULL)

Set OpenGL lighting state to match the current state. If relativeToEyepoint is set, the light will be applied using the modelview matrix calculated from the eyepoint to the light.

Friends And Related Function Documentation

friend class GlobalLightMgrThreadMap
friend

helper class for maintaining one global light mgr per calling thread

Member Data Documentation

LightingState _currentOpenGLState
protected

The value of glGetIntegerv(GL_MAX_LIGHTS);

LightingState _currentState
protected

The current OpenGL lighting state

DynamicArray<LightingState> _lightingStateStack
protected

Store temporary light source pointers (only used in InitializeStateFromOpenGL)

bool _reapplyLights
protected

As each component draws it will push it's lighting state on the stack

DynamicArray<GlsLightSource*> _tempOpenGLLights
protected

This will become the _currentOpenglState when a lit object draws


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