LightBase

This is the base class for light objects.

Inherit:
SceneObject

Description

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.

Methods

void LightBase::playAnimation()

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

Example:

// Play the animation assigned to this light
CrystalLight.playAnimation();
void LightBase::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

Example:

// Play the animation using a new LightAnimData datablock
CrystalLight.playAnimation(SubtlePulseLightAnim);
void LightBase::setLightEnabled(bool state)

Toggles the light on and off.

Parameters:state – Turns the light on (true) or off (false)

Example:

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

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

Fields

bool LightBase::animate

Toggles animation for the light on and off.

float LightBase::animationPeriod

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

float LightBase::animationPhase

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

LightAnimData LightBase::animationType

Datablock containing light animation information ( LightAnimData ).

Point3F LightBase::attenuationRatio

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

float LightBase::brightness

Adjusts the lights power, 0 being off completely.

bool LightBase::castShadows

Enables/disabled shadow casts by this light.

ColorF LightBase::color

Changes the base color hue of the light.

filename LightBase::cookie

A custom pattern texture which is projected from the light.

float LightBase::fadeStartDistance

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

float LightBase::flareScale

Globally scales all features of the light flare.

LightFlareData LightBase::flareType

Datablock containing light flare information ( LightFlareData ).

bool LightBase::includeLightmappedGeometryInShadow

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

bool LightBase::isEnabled

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

bool LightBase::lastSplitTerrainOnly

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

float LightBase::logWeight

The logrithmic PSSM split distance factor.

int LightBase::numSplits

The logrithmic PSSM split distance factor.

Point4F LightBase::overDarkFactor

The ESM shadow darkening factor.

void LightBase::pauseAnimation

Stops the light animation.

float LightBase::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.

bool LightBase::representedInLightmap

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

ColorF LightBase::shadowDarkenColor

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

float LightBase::shadowDistance

The distance from the camera to extend the PSSM shadow.

float LightBase::shadowSoftness
ShadowType LightBase::shadowType

The type of shadow to use on this light.

int LightBase::texSize

The texture size of the shadow map.