# Class: l3dlight

Lights illuminate models that have the lit renderflag set. There is one sunlight either global default or l3dset specific, just like cameras.Additionally there can be multiple FX lights in the world. All lights are pointlights without shadowing.The FX lights should have a smaller effective range, so that the engine can pick closest light to a node, becausethe number of lights at the same time is limited to 4 (1 sun, 3 fxlights).
Priority of FX lights will make no influence yet.
Lighting is done in hardware and uses following attenation formula:
1/(const+linear*distance+quadratic*distance*distance).
All lights' intensities are summed up and then multiplied with the vertexcolor.

## Hierarchy

    o-+ l3dlist
      o-+ l3dnode
        o-+ l3dlight

## Methods:

### Method overview:

- activate
- ambient
- attenuateconst
- attenuatelinear
- attenuatequadratic
- deactivate
- diffuse
- fxnonsunlit
- makesun
- new
- rangeattenuate

new (string name,l3dlayerid layer)
  returns: ([l3dlight])
  creates new light
activate (l3dlight,int priority,float range,int duration)
  returns: ()
  adds light to FX light list, if duration is passed it will get auto deactivated. Priority is unused for now
ambient (l3dlight,[float r,g,b,[a]])
  returns: ([float r,g,b,a])
  returns or sets ambient intensity. Intensities can be negative and exceed 0-1. This way you can creater steeper falloffs.
attenuateconst (l3dlight,[float])
  returns: ([float])
  returns or sets constant attenuation
attenuatelinear (l3dlight,[float])
  returns: ([float])
  returns or sets linear attenuation
attenuatequadratic (l3dlight,[float])
  returns: ([float])
  returns or sets quadratic attenuation
deactivate (l3dlight)
  returns: ()
  removes light from FX light list
diffuse (l3dlight,[float r,g,b,[a]])
  returns: ([float r,g,b,a])
  returns or sets diffuse intensity. Intensities can be negative and exceed 0-1. This way you can creater steeper falloffs.
fxnonsunlit (l3dlight,[boolean])
  returns: ([boolean])
  returns or sets if the fxlight should affect nodes that are not sunlit (default is true). Can be useful to split lights into 2 categories: one affect all nodes (static scenery & moveable), and the other just fully dynamic lit nodes (moveable nodes). Be aware that l3dnodes will pick the lights per full node, not on a per mesh basis, if the first drawnode is just fxlit, we will use the nonsun lights.
makesun (l3dlight)
  returns: ()
  makes it the default sun light
rangeattenuate (l3dlight,[boolean])
  returns: ([boolean])
  returns or sets state of automatic range based attenuation

## Inherited Methods:

### From l3dnode

cambox, camsphere, camvolumedelete, color, delete, isanimateable, lightmap, lightmaptexmatrix, linkinterface, localmatrix, localpos, localrotaxis, localrotdeg, localrotquat, localrotrad, name, novistest, parent, parentbone, renderscale, rotationlock, setlayer, unlink, unparentbone, uselocal, uselookat, usemanualworld, visflag, worldmatrix, worldpos, worldrotaxis, worldrotdeg, worldrotquat, worldrotrad

### From l3dlist