LightManager

Engine/source/lighting/lightManager.h

More...

Public Types

enum
SpecialLightTypesEnum {
  slSunLightType 
  slSpecialLightTypesCount 
}

Public Static Attributes

Signal< void(const char *, bool)>

The light manager activation signal.

Protected Static Attributes

The current active light manager.

Protected Attributes

The scene lighting interfaces for lightmap generation.

The root culling position used for special sun light placement.

A dummy default light used when no lights happen to be registered with the manager.

The constant light manager identifier initialized in the constructor.

bool

Is true if this light manager has been activated.

The constant light manager name initialized in the constructor.

The list of global registered lights which is initialized before the scene is rendered.

The scene graph the light manager is associated with.

mSpecialLights [slSpecialLightTypesCount]

The registered special light list.

Public Functions

LightManager(const char * name, const char * id)
activate(SceneManager * sceneManager)

Returns all unsorted and un-scored lights (both global and local).

const char *

Return an id string used to load different versions of light manager specific assets.

const char *

Return an id string used to load different versions of light manager specific assets.

getSpecialLight(SpecialLightTypesEnum type, bool useDefault)

Returns the special light or the default light if useDefault is true.

bool

Returns true if this light manager is active.

bool
bool
lightScene(const char * callback, const char * param)

Called when the static scene lighting (aka lightmaps) should be computed.

registerGlobalLights(const Frustum * frustum, bool staticlighting, bool enableZoneLightCulling)

Sets shader constants / textures for light infos.

Set a special light type.

bool
setTextureStage(const SceneData & sgData, const U32 currTexFlag, const U32 textureSlot, GFXShaderConstBuffer * shaderConsts, ShaderConstHandles * handles)

Allows us to set textures during the Material::setTextureStage call, return true if we've done work.

Public Static Functions

findByName(const char * name)

Returns the active LM.

Returns a tab seperated list of available light managers.

Protected Functions

Attaches any LightInfoEx data for this manager to the light info object.

Find the pre-pass render bin on the scene's default render pass.

Protected Static Functions

Returns the static light manager map.

_update4LightConsts(const SceneData & sgData, GFXShaderConstHandle * lightPositionSC, GFXShaderConstHandle * lightDiffuseSC, GFXShaderConstHandle * lightAmbientSC, GFXShaderConstHandle * lightInvRadiusSqSC, GFXShaderConstHandle * lightSpotDirSC, GFXShaderConstHandle * lightSpotParamsSC, GFXShaderConstHandle * hasVectorLightSC, GFXShaderConstHandle * vectorLightDirectionSC, GFXShaderConstHandle * vectorLightColorSC, GFXShaderConstHandle * vectorLightBrightnessSC, GFXShaderConstBuffer * shaderConsts)

This helper function sets the shader constansts for the stock 4 light forward lighting code.

Detailed Description

Public Types

SpecialLightTypesEnum

Enumerator

slSunLightType
slSpecialLightTypesCount

Public Static Attributes

Signal< void(const char *, bool)> smActivateSignal 

The light manager activation signal.

Protected Static Attributes

LightManager * smActiveLM 

The current active light manager.

Protected Attributes

AvailableSLInterfaces * mAvailableSLInterfaces 

The scene lighting interfaces for lightmap generation.

Point3F mCullPos 

The root culling position used for special sun light placement.

LightInfo * mDefaultLight 

A dummy default light used when no lights happen to be registered with the manager.

const String mId 

The constant light manager identifier initialized in the constructor.

bool mIsActive 

Is true if this light manager has been activated.

const String mName 

The constant light manager name initialized in the constructor.

LightInfoList mRegisteredLights 

The list of global registered lights which is initialized before the scene is rendered.

SceneManager * mSceneManager 

The scene graph the light manager is associated with.

LightInfo * mSpecialLights [slSpecialLightTypesCount]

The registered special light list.

Public Functions

LightManager(const char * name, const char * id)

~LightManager()

activate(SceneManager * sceneManager)

Reimplemented by: AdvancedLightManager, BasicLightManager

deactivate()

Reimplemented by: AdvancedLightManager, BasicLightManager

getAllUnsortedLights(Vector< LightInfo * > * list)

Returns all unsorted and un-scored lights (both global and local).

getDefaultLight()

getId()

Return an id string used to load different versions of light manager specific assets.

It shoud be short, contain no spaces, and be safe for filename use.

getName()

Return an id string used to load different versions of light manager specific assets.

It shoud be short, contain no spaces, and be safe for filename use.

getSceneLightingInterface()

getSceneManager()

getSpecialLight(SpecialLightTypesEnum type, bool useDefault)

Returns the special light or the default light if useDefault is true.

isActive()

Returns true if this light manager is active.

isCompatible()

Reimplemented by: AdvancedLightManager, BasicLightManager

lightScene(const char * callback, const char * param)

Called when the static scene lighting (aka lightmaps) should be computed.

registerGlobalLight(LightInfo * light, SimObject * obj)

Reimplemented by: AdvancedLightManager

registerGlobalLights(const Frustum * frustum, bool staticlighting, bool enableZoneLightCulling)

registerLocalLight(LightInfo * light)

setLightInfo(ProcessedMaterial * pmat, const Material * mat, const SceneData & sgData, const SceneRenderState * state, U32 pass, GFXShaderConstBuffer * shaderConsts)

Sets shader constants / textures for light infos.

Reimplemented by: AdvancedLightManager, BasicLightManager

setSpecialLight(SpecialLightTypesEnum type, LightInfo * light)

Set a special light type.

setTextureStage(const SceneData & sgData, const U32 currTexFlag, const U32 textureSlot, GFXShaderConstBuffer * shaderConsts, ShaderConstHandles * handles)

Allows us to set textures during the Material::setTextureStage call, return true if we've done work.

Reimplemented by: AdvancedLightManager, BasicLightManager

unregisterAllLights()

Reimplemented by: AdvancedLightManager

unregisterGlobalLight(LightInfo * light)

unregisterLocalLight(LightInfo * light)

Public Static Functions

createLightInfo(LightInfo * light)

findByName(const char * name)

getActiveLM()

Returns the active LM.

getLightManagerNames(String * outString)

Returns a tab seperated list of available light managers.

initLightFields()

Protected Functions

_addLightInfoEx(LightInfo * lightInfo)

Attaches any LightInfoEx data for this manager to the light info object.

Reimplemented by: AdvancedLightManager, BasicLightManager

_findDeferredRenderBin()

Find the pre-pass render bin on the scene's default render pass.

_initLightFields()

Reimplemented by: AdvancedLightManager, BasicLightManager

Protected Static Functions

_getLightManagers()

Returns the static light manager map.

_update4LightConsts(const SceneData & sgData, GFXShaderConstHandle * lightPositionSC, GFXShaderConstHandle * lightDiffuseSC, GFXShaderConstHandle * lightAmbientSC, GFXShaderConstHandle * lightInvRadiusSqSC, GFXShaderConstHandle * lightSpotDirSC, GFXShaderConstHandle * lightSpotParamsSC, GFXShaderConstHandle * hasVectorLightSC, GFXShaderConstHandle * vectorLightDirectionSC, GFXShaderConstHandle * vectorLightColorSC, GFXShaderConstHandle * vectorLightBrightnessSC, GFXShaderConstBuffer * shaderConsts)

This helper function sets the shader constansts for the stock 4 light forward lighting code.