# light

## Principle

Lights are number unlimited of objects constructed by:

### light(id)

Light identifier id.
At its inception light is active, to disable it, do: validate light(id)=0.
To reactivate it, do: validate light(id)=1.
properties can be assigned:
Real time:
The number must belong to the interval [1, n] (with n = maximum number of light (depending on the version of OpenGL).

### General properties

aim light(id)=x,y,z: defines a spot direction (x,y,z).
ambiance light(id)=r,v,b: defines an ambiance.
col light(id)=r,v,b: defines the color.
coe light(id)=c: attenuation function of distance.
ext light(id)=r,n: defines a luminous globe.
eye light(id)=x,y,z: defines the position.
foc light(id)=ouv: defines the opening of a spot.
law light
law light(id)=an: defines the variation of a spot (smoothing it).
meta light(id)=a,b; automatic calculation of roll based on the foc.
roll light(id)=c: the light intensity is multiplied by (cos (a)) ^ c, with a = angle (dir, LP), dir = aim light (id), L = poi (1) light (id) and the point P = illuminated (a good value is 10).
traj(ni)tran(...)light(id): trajectory of point 1 of light id.
type light(id)="eye": light positioned on eye.

## Procedural light

With local functions:
`local(0)obj(id_obj)="f";` treatment by a local fonction anyflo f().
`local(0)light(id)=num;` treatment by a local fonction written C language.

## light

### light(id)

Creats light id with default values:
top left position
white color
To change these values see:

### aim lightcol lightext lighteye lightfoc lightlaw lightmeta light(id)=a,b; automatic calculation of roll based on the foc.        roll lighttexture light       etc...

Example:
`light(1)eye(0,-1000,0)col(1,.8,.4)aim(0,1,0)foc(PI/4)roll(100);`
Builds the spot 1 located at (0, -1000.0), looking toward the origin, orange, opening PI / 4 and variation law 100.

## light motif vol

### light motif vol(id)

Returns the numbers of the lights illuminating the motifs of volume id.

### light motif vol(id)=n1

Changes these numbers.
Note:
If volume id has a motif vertex vol property, the motifs will be illuminated from the point in which they are displayed.

## spot

A spot is a light iilluminating in a cone opening ouv, positioned in eye(x, y, z), type:
aim:
type light(id)="aim"
aim point: aim light(id)=xa,ya,za
axis:
type light(id)="axis"
direction: axis light(id)=dx,dy,dz

attenuation coefficient coe light(id)=c between 1 and 100.
focal foc light(id)=ouv between 0 and PI.
exponent coefficient roll light(id)=r between 0 and 100.
meta light(id)=a,b; automatic calculation of the roll based on the focal.

Example:
`light(1)eye(0,-1000,0)col(1,.8,.4)aim(0,0,0)foc(PI/4)roll(100);`
Builds spot number 1 positioned at (0,-1000,0), aiming to origin, orange color, opening PI/4 and variation law 100.

## light vertex vol

### light vertex(s) vol(id)

Returns the number of the lights associated with vertex s of du volume id.

### light vertex(s) vol(id)=num

Changes these numbers.
Notes:
1) When displaying the volume id, light nums.
2) Il sera nécessaire de générer les normales aux sommets du volume id (see generate normal vertex vol)

## light vol

### light vol(id)

Returns the numbers of the lights associated to volume id.

### light vol(id)=expr

Changes these numbers.
Note: in a display with yes illum, volumes affected with lights will be illuminated by them only.