LightBase

consoledoc.h

This is the base class for light objects.

More...

Light

bool

Enables/Disables the object rendering and functionality in the scene.

LinearColorF

Changes the base color hue of the light.

float

Adjusts the lights power, 0 being off completely.

bool

Enables/disabled shadow casts by this light.

float

Used for sorting of lights by the light manager. Priority determines if a light has a stronger effect than, those with a lower value.

Light Animation

bool

Toggles animation for the light on and off.

Datablock containing light animation information (LightAnimData)

float

The length of time in seconds for a single playback of the light animation (must be > 0)

float

The phase used to offset the animation start time to vary the animation of nearby lights.

Misc

Datablock containing light flare information (LightFlareData)

float

Globally scales all features of the light flare.

Advanced Lighting

Point3F

The proportions of constant, linear, and quadratic attenuation to use for the falloff for point and spot lights.

The type of shadow to use on this light.

filename

A custom pattern texture which is projected from the light.

int

The texture size of the shadow map.

Point4F

The ESM shadow darkening factor.

float

The distance from the camera to extend the PSSM shadow.

int

The logrithmic PSSM split distance factor.

float

The logrithmic PSSM split distance factor.

float

Start fading shadows out at this distance. 0 = auto calculate this distance.

bool

This toggles only terrain being rendered to the last split of a PSSM shadow map.

Advanced Lighting Lightmap

bool

This light is represented in lightmaps (static light, default: false)

LinearColorF

The color that should be used to multiply-blend dynamic shadows onto lightmapped geometry (ignored if 'representedInLightmap' is false)

bool

This light should render lightmapped geometry during its shadow-map update (ignored if 'representedInLightmap' is false)

Public Static Attributes

bool

Disables rendering of all instances of this type.

bool

Disables selection of all instances of this type.

Public Functions

void

Stops the light animation.

void

Plays the light animation assigned to this light with the existing LightAnimData datablock.

void

Plays the light animation on this light using a new LightAnimData. If no LightAnimData is passed the existing one is played.

void
setLightEnabled(bool state)

Toggles the light on and off.

Detailed Description

This is the base class for light objects.

It is NOT intended to be used directly in script, but exists to provide the base member variables and generic functionality. You should be using the derived classes PointLight and SpotLight, which can be declared in TorqueScript or added from the World Editor.

For this class, we only add basic lighting options that all lighting systems would use. The specific lighting system options are injected at runtime by the lighting system itself.

Light

bool isEnabled 

Enables/Disables the object rendering and functionality in the scene.

LinearColorF color 

Changes the base color hue of the light.

float brightness 

Adjusts the lights power, 0 being off completely.

bool castShadows 

Enables/disabled shadow casts by this light.

float priority 

Used for sorting of lights by the light manager. Priority determines if a light has a stronger effect than, those with a lower value.

Light Animation

bool animate 

Toggles animation for the light on and off.

LightAnimData animationType 

Datablock containing light animation information (LightAnimData)

float animationPeriod 

The length of time in seconds for a single playback of the light animation (must be > 0)

float animationPhase 

The phase used to offset the animation start time to vary the animation of nearby lights.

Misc

LightFlareData flareType 

Datablock containing light flare information (LightFlareData)

float flareScale 

Globally scales all features of the light flare.

Advanced Lighting

Point3F attenuationRatio 

The proportions of constant, linear, and quadratic attenuation to use for the falloff for point and spot lights.

ShadowType shadowType 

The type of shadow to use on this light.

filename cookie 

A custom pattern texture which is projected from the light.

int texSize 

The texture size of the shadow map.

Point4F overDarkFactor 

The ESM shadow darkening factor.

float shadowDistance 

The distance from the camera to extend the PSSM shadow.

float shadowSoftness 
int numSplits 

The logrithmic PSSM split distance factor.

float logWeight 

The logrithmic PSSM split distance factor.

float fadeStartDistance 

Start fading shadows out at this distance. 0 = auto calculate this distance.

bool lastSplitTerrainOnly 

This toggles only terrain being rendered to the last split of a PSSM shadow map.

Advanced Lighting Lightmap

bool representedInLightmap 

This light is represented in lightmaps (static light, default: false)

LinearColorF shadowDarkenColor 

The color that should be used to multiply-blend dynamic shadows onto lightmapped geometry (ignored if 'representedInLightmap' is false)

bool includeLightmappedGeometryInShadow 

This light should render lightmapped geometry during its shadow-map update (ignored if 'representedInLightmap' is false)

Public Static Attributes

bool isRenderable 

Disables rendering of all instances of this type.

bool isSelectable 

Disables selection of all instances of this type.

Public Functions

pauseAnimation()

Stops the light animation.

playAnimation()

Plays the light animation assigned to this light with the existing LightAnimData datablock.

// Play the animation assigned to this light
CrystalLight.playAnimation();

playAnimation(LightAnimData anim)

Plays the light animation on this light using a new LightAnimData. If no LightAnimData is passed the existing one is played.

Parameters:

anim

Name of the LightAnimData datablock to be played

// Play the animation using a new LightAnimData datablock
CrystalLight.playAnimation(SubtlePulseLightAnim);

setLightEnabled(bool state)

Toggles the light on and off.

Parameters:

state

Turns the light on (true) or off (false)

// Disable the light
CrystalLight.setLightEnabled(false);

// Renable the light
CrystalLight.setLightEnabled(true);