|
Constant values for type_of_light (The values could be ored together e.g LIGHT_DIRECTIONAL | LIGHT_AMBIENT
#define LIGHT_DIRECTIONAL 1
#define LIGHT_EFFECTED_BY_DISTANCE_LINEAR 2
#define LIGHT_EFFECTED_BY_DISTANCE_SQUARE 4
#define LIGHT_AMBIENT 8
#define LIGHT_DIFFUSE 16
#define LIGHT_SPECULAR 32
In most cases you will probably use one of the two combinations below
#define LIGHT_DEFAULT (LIGHT_EFFECTED_BY_DISTANCE_LINEAR | LIGHT_AMBIENT |LIGHT_DIFFUSE | LIGHT_SPECULAR)
#define LIGHT_DEFAULT_POINTED_LIGHT (LIGHT_DIRECTIONAL | LIGHT_EFFECTED_BY_DISTANCE_LINEAR | LIGHT_AMBIENT |LIGHT_DIFFUSE | LIGHT_SPECULAR)
#define LIGHT_DEFAULT_FAST (LIGHT_EFFECTED_BY_DISTANCE_LINEAR | LIGHT_AMBIENT |LIGHT_DIFFUSE )
#define LIGHT_DEFAULT_SUPER_FAST (LIGHT_EFFECTED_BY_DISTANCE_LINEAR | LIGHT_AMBIENT)
The type of light can be combined from the following options
LIGHT_DIRECTIONAL
Denote that the light is directional. The direction could be set by STATE_light_set_direction()
LIGHT_EFFECTED_BY_DISTANCE_LINEAR
The light is reduced according to the distance from the light source location
The reduction is linear
This flag is included in the default light type though
NOTE that in order to feel its effect you have first to define the light source
maximum reach. Do that with STATE_light_set_distance_reach()
LIGHT_EFFECTED_BY_DISTANCE_SQUARE
The effect is that the light reduction is small near the light sourse and very strong
near the end of the light reach area
LIGHT_AMBIENT 8
If this flag is not set then the ambient light component will not be used
LIGHT_DIFFUSE 16
If this flag is not set then the diffuse light component will not be used
LIGHT_SPECULAR 32
If this flag is not set then the ambient light component will not be used
In most cases you will probably use one of the two combinations below
LIGHT_DEFAULT (LIGHT_EFFECTED_BY_DISTANCE_LINEAR | LIGHT_AMBIENT |LIGHT_DIFFUSE | LIGHT_SPECULAR)
LIGHT_DEFAULT_POINTED_LIGHT (LIGHT_DIRECTIONAL | LIGHT_EFFECTED_BY_DISTANCE_LINEAR | LIGHT_AMBIENT |LIGHT_DIFFUSE | LIGHT_SPECULAR)
The default light type is LIGHT_DEFAULT
Example A:
Setting a directional light
STATE_light_set_type_of_light(my_light,LIGHT_DEFAULT_POINTED_LIGHT);
Example B:
using LIGHT_EFFECTED_BY_DISTANCE_SQUARE
STATE_light_set_type_of_light(my_light, LIGHT_DIRECTIONAL | LIGHT_EFFECTED_BY_DISTANCE_SQUARE | LIGHT_AMBIENT |LIGHT_DIFFUSE | LIGHT_SPECULAR);
|