| Home | zeGraph lib | Lua lib | Custom lib | Tutorials | Notes | XML Script | C-Talk | Z-Script |
Graph
   axis
   blend
   color
   color bar
   fog
   freetype
   light
   line
   material
   node
   point
   plot
   polygon
   render
   scene
   stencil
   texcoord
   text
   texture
   vertex
Utility
   array
   bio
   hdf
   make
   math
   netcdf
Auxiliary
   curl
   expact
   sqlite
   window

zeLight

Use .new("light") to create the object. An enabled light will affect all objects after it in the tree of a scene structure unless the node containing the light saves and restores OpenGL attributes of its predecessor.

:set{...}

Sets light properties with a Lua table. Valid key-value pairs in the Lua table are listed as follows.

Key Value Type Remark
ambient {r, g, b, a} Numbers (0 to 1) in table Sets the ambient color of the light in red, green, blue ,and alpha.
diffuse {r, g, b, a} Numbers (0 to 1)in table Sets the diffuse color of the light in red, green, blue ,and alpha.
specular {r, g, b, a} Numbers (0 to 1) in table Sets the specular color of the light in red, green, blue ,and alpha.
attenuation {constant, linear, quadratic} Numbers in table Sets the constant, linear, and quadratic attenuation parameters of the light.
local flag Boolean If true, sets the light as local; otherwise as directional (default).
lightmodel flag Boolean If true, uses ligh model; otherwise, use material color (default).
eye flag Boolean If true, sets the GL_LIGHT_MODEL_LOCAL_VIEWER parameter to 1; otherwise to zero.
twoside flag Boolean Sets the GL_LIGHT_MODEL_TWO_SIDE parameter to 1; otherwise to 0.
spotdirection {x, y, z} Numbers in table Sets spot light direction.
spotexponent value Number Sets the intensity distribution of the spot light.
spotcutoff value Number Sets the cutoff angle (GL_SPOT_CUTOFF) of the spot light.
enable flag Boolean Enables (default) and disables the object
position {x, y, z} Numbers in table Sets the light postion.