» Back To Index
Demoniak3D/LUA API: Lights Management library
The
HYP_Lighting allows to control the light parameters.
HYP_Lighting.GetAmbient
HYP_Lighting.GetDiffuse
HYP_Lighting.GetSpecular
HYP_Lighting.SetAmbient
HYP_Lighting.SetDiffuse
HYP_Lighting.SetSpecular
HYP_Lighting.SetConstantAttFactor
HYP_Lighting.SetLinearAttFactor
HYP_Lighting.SetQuadraticAttFactor
HYP_Lighting.Create
HYP_Lighting.Destroy
HYP_Lighting.SetType
HYP_Lighting.SetSpotCutOff
HYP_Lighting.GetSpotCutOff
HYP_Lighting.GetNumLights
HYP_Lighting.GetIdByIndex
HYP_Lighting.GetNameByIndex
HYP_Lighting.GetId
HYP_Lighting.GetName
HYP_Lighting.SetShadowEmitterState
SetAmbient
SetAmbient allows to change the value of the light ambient component passed as parameter.
Syntax
HYP_Lighting.SetAmbient( name, r, g, b );
- name - [STR127] - name of the light as specified in the XML script by the name attribute.
- r - [CLAMPED_REAL] - red component of the color.
- g - [CLAMPED_REAL] - green component of the color.
- b - [CLAMPED_REAL] - blue component of the color.
- a - [CLAMPED_REAL] - alpha component of the color.
SetDiffuse
SetDiffuse allows to change the value of the light diffuse component passed as parameter.
Syntax
HYP_Lighting.SetDiffuse( name, r, g, b );
- name - [STR127] - name of the light as specified in the XML script by the name attribute.
- r - [CLAMPED_REAL] - red component of the color.
- g - [CLAMPED_REAL] - green component of the color.
- b - [CLAMPED_REAL] - blue component of the color.
- a - [CLAMPED_REAL] - alpha component of the color.
SetSpecular
SetSpecular allows to change the value of the light specular component passed as parameter.
Syntax
HYP_Lighting.SetSpecular( name, r, g, b );
- name - [STR127] - name of the light as specified in the XML script by the "name" attribute
- r - [CLAMPED_REAL] - red component of the color.
- g - [CLAMPED_REAL] - green component of the color.
- b - [CLAMPED_REAL] - blue component of the color.
- a - [CLAMPED_REAL] - alpha component of the color.
GetAmbient
GetAmbient allows to get back the value of the light ambient component passed as parameter.
Syntax
r, g, b = HYP_Lighting.GetAmbient( name );
- name - [STR127] - name of the light as specified in the XML script by the "name" attribute
- r - [CLAMPED_REAL] - red component of the color.
- g - [CLAMPED_REAL] - green component of the color.
- b - [CLAMPED_REAL] - blue component of the color.
GetDiffuse
GetDiffuse allows to get back the value of the light diffuse component passed as parameter.
Syntax
r, g, b = HYP_Lighting.GetDiffuse( name );
- name - [STR127] - name of the light as specified in the XML script by the "name" attribute
- r - [CLAMPED_REAL] - red component of the color.
- g - [CLAMPED_REAL] - green component of the color.
- b - [CLAMPED_REAL] - blue component of the color.
GetSpecular
GetSpecular allows to get back the value of the light specular component passed as parameter.
Syntax
r, g, b = HYP_Lighting.GetSpecular( name );
- name - [STR127] - name of the light as specified in the XML script by the "name" attribute
- r - [CLAMPED_REAL] - red component of the color.
- g - [CLAMPED_REAL] - green component of the color.
- b - [CLAMPED_REAL] - blue component of the color.
SetConstantAttFactor
SetConstantAttFactor allows to change the value of the light constant attenuation factor proportionately
to the distance from the vertex being currently processed.
Syntax
HYP_Lighting.SetConstantAttFactor( name, f );
- name - [STR127] - name of the light as specified in the XML script by the "name" attribute
- f - [REAL] - constant attenuation factor - default value: 1.0.
SetLinearAttFactor
SetLinearAttFactor allows to change the value of the light linear attenuation factor proportionately to
the distance from the vertex being currently processed.
Syntax
HYP_Lighting.SetLinearAttFactor( name, f );
- name - [STR127] - name of the light as specified in the XML script by the "name" attribute
- f - [REAL] - linear attenuation factor - default value: 0.0.
SetQuadraticAttFactor
SetQuadraticAttFactor allows to change the value of the light quadratic attenuation factor proportionately the
distance from the vertex being currently processed.
Syntax
HYP_Lighting.SetQuadraticAttFactor( name, f );
- name - [STR127] - name of the light as specified in the XML script by the "name" attribute
- f - [REAL] - quadratic attenuation factor - default value: 0.0.
Create
Create will generate a dynamic light.
Syntax
id = HYP_Lighting.Create( [name] );
- name - [STR127] - string character representing the name of the light. Optional.
- id - [INTEGER] - numerical identifier of the created light.
Destroy
Destroy allows to destroy a dynamic une light.
Syntax
HYP_Lighting.Destroy( name|id );
- name - [STR127] - character string representing the name of the light.
- id - [INTEGER] - numerical identifier of the light.
SetType
SetType allows to set the type of a dynamic light.
Syntax
HYP_Lighting.SetType( name|id, type );
- name - [STR127] - character string representing the name of the light. Optional.
- id - [INTEGER] - numerical identifier of the created light.
- type - [INTEGER] - type of the light: POINT=1, SPOT=2 or DIRECTIONAL=3.
SetSpotCutOff
SetSpotCutOff allows to set the aperture angle of the light cone in case of a SPOT type light.
Syntax
HYP_Lighting.SetSpotCutOff( name|id, angle );
- name - [STR127] - character string representing the name of the light. Optional.
- id - [INTEGER] - numerical identifier of the created light.
- angle - [REAL] - angle in degrees of the light cone aperture.
GetSpotCutOff
GetSpotCutOff allows to get the angle of the light cone aperture in case of a SPOT type light.
Syntax
angle = HYP_Lighting.GetSpotCutOff( name|id );
- name - [STR127] - character string representing the name of the light. Optional.
- id - [INTEGER] - numerical identifier of the created light.
- angle - [REAL] - angle in degrees of the light cone aperture.
GetNumLights
GetNumLights returns the number of dynamic lights listed among the lights list of the scene at a given time.
Syntax
n = HYP_Lighting.GetNumLights();
- n - [INTEGER] - number of lights in the scene.
GetIdByIndex
GetIdByIndex allows to know the identifier of a light according to its position in the
lights list of the scene.
Syntax
id = HYP_Lighting.GetIdByIndex( index );
- index - [INTEGER] - index of the light in the lights list of the scene.
- id - [INTEGER] - identifier of the light.
GetNameByIndex
GetNameByIndex allows to know the name of a light according to its position in the
lights list of the scene.
Syntax
name = HYP_Lighting.GetNameByIndex( index );
- index - [INTEGER] - index of the light in the lights list of the scene.
- name - [STR64] - name of the light.
GetId
GetId allows to know the identifier of a light according to its name.
Syntax
id = HYP_Lighting.GetId( name );
- name - [STR64] - name of the light.
- id - [INTEGER] - identifier of the light.
GetName
GetName allows to know the name of a light according to its identifier.
Syntax
name = HYP_Lighting.GetName( id );
- id - [INTEGER] - identifier of the light.
- name - [STR64] - name of the light.
SetShadowEmitterState
SetShadowEmitterState allows to specify whether a light is a source for shadow or not.
Syntax
HYP_Lighting.SetShadowEmitterState( id|name, state );
- id - [INTEGER] - identifier of the light.
- name - [STR64] - name of the light.
- state - [INTEGER] - state: 1 or 0.