Project

General

Profile

Scol standard library package  0.3.1
Common and usefull functions for all Scol applications
The library : 3d light API

Functions

 b3d_lightAdd (strSession, name, type, father)
 Create (add) a new light.
 b3d_lightAmbiantGet (strSession)
 Get the 3d ambiant light.
 b3d_lightAmbiantSet (strSession, color)
 Set the 3d ambiant light.
 b3d_lightGetAttenuation (light)
 Get the attenuation coefficients of a light.
 b3d_lightGetColors (light)
 Get the diffuse and specular colors of a light.
 b3d_lightGetType (light)
 Get the type of a light.
 b3d_lightGetVisible (light)
 Get the visibility of a light.
 b3d_lightSetAttenuation (light, tuple)
 Set the attenuation coefficients of a light.
 b3d_lightSetColorDiffuse (light, color)
 Set the diffuse color of a light.
 b3d_lightSetColors (light, tuple)
 Set the specular color of a light.
 b3d_lightSetColorSpecular (light, color)
 Set the specular color of a light.
 b3d_lightSetType (light, type)
 Set the type of a light.
 b3d_lightSetVisible (light, state)
 Set the visibility of a light.

Detailed Description

Function Documentation

b3d_lightAmbiantSet ( strSession  ,
color   
)

Set the 3d ambiant light.

Prototype : fun [LIB3D_Session I] I

Parameters
LIB3D_Session: a session object
I: a RGBA color
Returns
I : 0 if success, another positive value if error
  • 1 : the given 3d session object is nil
  • 2 : the light has not been set, for an internal reason
b3d_lightAmbiantGet ( strSession  )

Get the 3d ambiant light.

Prototype : fun [LIB3D_Session] I

Parameters
LIB3D_Session: a session object
Returns
I : the RGBA color if success, nil if error
b3d_lightAdd ( strSession  ,
name  ,
type  ,
father   
)

Create (add) a new light.

Prototype : fun [LIB3D_Session S I SO3_OBJECT] SO3_OBJECT

Parameters
LIB3D_Session: a session object
S: a name
I: the type of light, one of these following types :
  • SO3_POINT_LIGHT (default)
  • SO3_DIRECTIONAL_LIGHT
  • SO3_SPOT_LIGHT
SO3_OBJECT: a father, a 3d object to link the light. Can be nil.
Returns
SO3_OBJECT : the new light if success, nil if error The new light will be automatically destroyed if the type can be set or the father (which it is not nil) can be linked. In these cases, the return will be nil too.
Examples:
3d_test/test_3d.pkg_.
b3d_lightSetType ( light  ,
type   
)

Set the type of a light.

Prototype : fun [SO3_OBJECT I] I

Parameters
SO3_OBJECT: a light
I: the type of light, one of these following types :
  • SO3_POINT_LIGHT (default)
  • SO3_DIRECTIONAL_LIGHT
  • SO3_SPOT_LIGHT
Returns
I : 0 if success, a positive value if error :
  • 1 : the 3d light is nil
  • 2 : the type can not be set
b3d_lightGetType ( light  )

Get the type of a light.

Prototype : fun [SO3_OBJECT] I

Parameters
SO3_OBJECT: a light
Returns
I : the type if success, nil if error.
  • SO3_POINT_LIGHT (default)
  • SO3_DIRECTIONAL_LIGHT
  • SO3_SPOT_LIGHT
b3d_lightSetColorDiffuse ( light  ,
color   
)

Set the diffuse color of a light.

Prototype : fun [SO3_OBJECT I] I

Parameters
SO3_OBJECT: a light
I: the rgba color to set
Returns
I : 0 if success, a positive value if error :
  • 1 : the 3d light is nil
  • 2 : the color can not be set
b3d_lightSetColorSpecular ( light  ,
color   
)

Set the specular color of a light.

Prototype : fun [SO3_OBJECT I] I

Parameters
SO3_OBJECT: a light
I: the rgba color to set
Returns
I : 0 if success, a positive value if error :
  • 1 : the 3d light is nil
  • 2 : the color can not be set
b3d_lightSetColors ( light  ,
tuple   
)

Set the specular color of a light.

Prototype : fun [SO3_OBJECT [I I]] I

Parameters
SO3_OBJECT: a light
[II] : the rgba diffuse color and the rgba specular color
Returns
I : 0 if success, a positive value if error :
  • 1 : the 3d light is nil
  • 3 : the diffuse color can not be set
  • 7 : the specular color can not be set
  • 9 : all given colors are nil
Examples:
3d_test/test_3d.pkg_.
b3d_lightGetColors ( light  )

Get the diffuse and specular colors of a light.

Prototype : fun [SO3_OBJECT] [I I]

Parameters
SO3_OBJECT: a light
Returns
[I I] : the diffuse and specular colors if success, nil if error.
b3d_lightSetVisible ( light  ,
state   
)

Set the visibility of a light.

Prototype : fun [SO3_OBJECT I] I

Parameters
SO3_OBJECT: a light
I: the state : 1 to enable the visibility, 0 to disable the visibility
Returns
I : 0 if success, a positive value if error :
  • 1 : the 3d light is nil
  • 2 : the visibility can not be set
b3d_lightGetVisible ( light  )

Get the visibility of a light.

Prototype : fun [SO3_OBJECT] I

Parameters
SO3_OBJECT: a light
Returns
I : 1 if enabled, 0 if disabled if success, nil if error.
b3d_lightSetAttenuation ( light  ,
tuple   
)

Set the attenuation coefficients of a light.

Prototype : fun [SO3_OBJECT [F F F F]] I

Parameters
SO3_OBJECT: a light
[FF F F] : light range coefficient, constant attenuation value, linear attenuation coefficient and quadratic attenuation coefficient
Returns
I : 0 if success, a positive value if error :
  • 1 : the 3d light is nil
  • 2 the tuple or one (or more) of its items is nil
  • 3 : the attenuation can not be set
b3d_lightGetAttenuation ( light  )

Get the attenuation coefficients of a light.

Prototype : fun [SO3_OBJECT] [F F F F]

Parameters
SO3_OBJECT: a light
Returns
[F F F F] : light range coefficient, constant attenuation value, linear attenuation coefficient if success, nil if error.