Light

Light is a type of representation that represents a light.
Lights can have three types: Point, Directional or Spotlight.
You can read about each type of light and their parameters in Ogre Wiki: http://www.ogre3d.org/wiki/index.php/Basic_Tutorial_2#Types_of_Lights.

Method Summary
 niladdRepresentation (representation toAdd)
 nilgetAperture (number in, number out)
 number, number, numbergetAttenuation ()
 number, number, numbergetDiffuseColour ()
 number, number, numbergetDirection ()
 stringgetID ()
 numbergetLightType ()
 stringgetName ()
 number, number, numbergetPosition ()
 numbergetRange ()
 representationgetRepresentation (string name, number type)
 representationgetRepresentationContainer ()
 array{}getRepresentations ()
 number, number, numbergetSpecularColour ()
 numbergetType ()
 booleanhasRepresentation (representation other)
 booleanhasRepresentation (string name, number type)
 booleanisEnabled ()
 booleanisShadowsCaster ()
 booleanisVisible ()
 nilprint ()
 nilremoveAllRepresentations ()
 nilremoveRepresentation (representation other)
 nilremoveRepresentation (string name, number type)
 nilgetAperture (number in, number out)
 nilsetAttenuation (number a, number b, number c)
 nilsetDiffuseColour (number r, number g, number b)
 nilsetDirection (number x, number y, number z)
 nilsetEnabled (boolean enable)
 nilsetLightType (number type)
 nilsetPosition (number x, number y, number z)
 nilsetRange (number range)
 nilsetShadowsCaster (boolean enable)
 nilsetSpecularColour (number r, number g, number b)
 nilsetVisible (boolean visible)

Method Detail

addRepresentation

nil addRepresentation (representation toAdd)
Adds another representation to this representation.

Parameters:
representation toAdd - Representation to be added to this representation.


getAperture

nil getAperture (number in, number out)
Sets the inner and outter cone of the 'spotlight'. Applicable only to 'spotlights'. The light will iluminate inside the Inner cone and fade towards the Outter cone.

Parameters:
number in - Inner cone of the spotlight.
number out - Outter cone of the spotlight.


getAttenuation

number, number, number getAttenuation ()
Returns the attenuation function. Not applicable to 'directional' lights.

Returns:
number - The 'a' in the attenuation function ax^2 + bx +c.
number - The 'b' in the attenuation function ax^2 + bx +c.
number - The 'c' in the attenuation function ax^2 + bx +c.


getDiffuseColour

number, number, number getDiffuseColour ()
Returns the diffuse colour of the light.

Returns:
number - Red colour (0-255).
number - Green colour (0-255).
number - Blue colour (0-255).


getDirection

number, number, number getDirection ()
Returns the direction of the light. Not applicable to 'point' lights.

Returns:
number - The direction of the light in the X coordinate.
number - The direction of the light in the Y coordinate.
number - The direction of the light in the Z coordinate.


getID

string getID ()
Returns the representation ID.

Returns:
string - Representation ID.


getLightType

number getLightType ()
Returns the type of the light.

Returns:
number - The type of the light: LT_LIGHT_POINT, LT_LIGHT_DIRECTIONAL or LT_LIGHT_SPOTLIGHT.


getName

string getName ()
Returns the name of the Light

Returns:
string - The name of the Light


getPosition

number, number, number getPosition ()
Returns the position of the Light.

Returns:
number - The position of the Light in the X coordinate.
number - The position of the Light in the Y coordinate.
number - The position of the Light in the Z coordinate.


getRange

number getRange ()
Returns the range of the light. Not applicable to 'spotlights'.

Returns:
number - The range of the light.


getRepresentation

representation getRepresentation (string name, number type)
Returns the contained representation with the specified name and type.

Parameters:
string name - The name of the contained representation.
number type - The type of the contained representation.

Returns:
representation - The contained representation with the specified name and type.


getRepresentationContainer

representation getRepresentationContainer ()
Returns the representation that contains this representation.

Returns:
representation - The representation that contains this representation.


getRepresentations

array{} getRepresentations ()
Returns an array of the contained representations.

Returns:
array{} - Array of the contained representations.


getSpecularColour

number, number, number getSpecularColour ()
Returns the specular colour of the light.

Returns:
number - Red colour (0-255).
number - Green colour (0-255).
number - Blue colour (0-255).


getType

number getType ()
Returns the representation type:
2 - MODEL,
3 - LIGHT,
4 - EFFECT,
5 - PLANE,
6 - WATER,
7 - SOUND,
8 - TERRAIN_MESH_DECAL,
9 - TERRAIN_HIGHLIGHTING_DECAL,
10 - BILLBOARD,
11 - OVERLAY

Returns:
number - The type of the representation.


hasRepresentation

boolean hasRepresentation (representation other)
Returns 'true' if this representation has the other representation, otherwise 'false'.

Parameters:
representation other - The other representation.

Returns:
boolean - 'True' if this representation has the other representation, otherwise 'false'.


hasRepresentation

boolean hasRepresentation (string name, number type)
Returns 'true' if this representation has another representation with the specified name and type, otherwise 'false'.

Parameters:
string name - Name of the representation.
number type - Type of the representation

Returns:
boolean - 'True' if this representation has another representation with the specified name and type, otherwise 'false'.


isEnabled

boolean isEnabled ()
Returns 'true' if the light is enabled, otherwise 'false'.

Returns:
boolean - enable 'True' if the light is enables, otherwise 'false'.


isShadowsCaster

boolean isShadowsCaster ()
Returns 'true' if the light casts shadows, otherwise 'false'.

Returns:
boolean - enable 'True' if the light casts shadows, otherwise 'false'.


isVisible

boolean isVisible ()
Returns 'true' if the representation is visible, 'false' otherwise.

Returns:
boolean - Whether the Light is visible or not.


print

nil print ()
Prints the Light data and attributes to the console.


removeAllRepresentations

nil removeAllRepresentations ()
Removes all representations contained in this representation.


removeRepresentation

nil removeRepresentation (representation other)
Removes a representation from this representation.

Parameters:
representation other - The representation to be removed.


removeRepresentation

nil removeRepresentation (string name, number type)
Removes a representation with the specified name and type from this representation.

Parameters:
string name - Name of the representation.
number type - Type of the representation


getAperture

nil getAperture (number in, number out)
Sets the inner and outter cone of the 'spotlight'. Applicable only to 'spotlights'. The light will iluminate inside the Inner cone and fade towards the Outter cone.

Parameters:
number in - Inner cone of the spotlight.
number out - Outter cone of the spotlight.


setAttenuation

nil setAttenuation (number a, number b, number c)
Sets the attenuation function in the light. Not applicable to 'directional' lights.

Parameters:
number a - The 'a' in the attenuation function ax^2 + bx +c.
number b - The 'b' in the attenuation function ax^2 + bx +c.
number c - The 'c' in the attenuation function ax^2 + bx +c.


setDiffuseColour

nil setDiffuseColour (number r, number g, number b)
Sets the diffuse colour of the light.

Parameters:
number r - Red colour (0-255).
number g - Green colour (0-255).
number b - Blue colour (0-255).


setDirection

nil setDirection (number x, number y, number z)
Sets the direction of the light. Not applicable to 'point' lights.

Parameters:
number x - The direction of the light in the X coordinate.
number y - The direction of the light in the Y coordinate.
number z - The direction of the light in the Z coordinate.


setEnabled

nil setEnabled (boolean enable)
Sets whether the light is enabled or not.

Parameters:
boolean enable - Whether the light is enabled or not.


setLightType

nil setLightType (number type)
Sets the light as 'point' and initialises its position, range and attenuation function.

Parameters:
number type - Type of the Light: LT_LIGHT_DIRECTIONAL, LT_LIGHT_POINT, LT_LIGHTSPOTLIGHT.


setPosition

nil setPosition (number x, number y, number z)
Sets the position of the Light in the 3D space (x,y,z).

Parameters:
number x - New position in the X axis.
number y - New position in the Y axis.
number z - New position in the Z axis.


setRange

nil setRange (number range)
The range of the light. Not applicable to 'directional' lights.

Parameters:
number range - The range or the light.


setShadowsCaster

nil setShadowsCaster (boolean enable)
Sets whether the light casts shadows or not.

Parameters:
boolean enable - Whether the light casts shadows or not.


setSpecularColour

nil setSpecularColour (number r, number g, number b)
Sets the specular colour of the light.

Parameters:
number r - Red colour (0-255).
number g - Green colour (0-255).
number b - Blue colour (0-255).


setVisible

nil setVisible (boolean visible)
Makes the Light visible or invisible.

Parameters:
boolean visible - Whether the Light is visible or not.