Light
Extends Clonable, IsNamed
A light source.
Constructors
Light:newLight(typ, position, color, brightness)
Creates new light source
Arguments
typ
(string) “point” or “sun”
position
(Vec3)
color
(number[])
brightness
(number)
Returns
(Light)
Methods
Light:setSize(size)
The size mostly affects smooth lighting
Arguments
size
(number)
Light:getSize()
Light:setAttenuation(attenuation)
The attenuation exponent should be 2.0 for realism, but higher values produce a more cozy, artistic result
Arguments
attenuation
(number)
Light:getAttenuation()
Light:setGodrays()
deprecated
Light:getGodrays()
deprecated
Light:setBrightness(brightness)
Arguments
brightness
(any)
Light:getBrightness()
Light:setColor(r, g, b)
Sets the color, should roughly be a unit vector
Arguments
r
(number)
g
(number)
b
(number)
Light:getColor()
Light:setPosition(x, y, z)
Set the position for point sources
Arguments
x
(number)
y
(number)
z
(number)
Light:getPosition()
Light:setDirection(x, y, z)
Set the direction for sun light sources
Arguments
x
(number)
y
(number)
z
(number)
Light:getDirection()
Light:addShadow(shadow)
Assign a shadow to this light source, a shadow can be shared by light sources if close to each other
Arguments
shadow
(Shadow)
Light:addNewShadow(resolution)
Creates a new shadow with given resolution
Arguments
resolution
(number)
Light:getShadow()
Returns
(Shadow)
Clonable:clone()
Slow and deep clone
Clonable:instance()
Creates an fast instance
IsNamed:setName(name)
A name has no influence other than being able to print more nicely
Arguments
name
(string)
IsNamed:getName()
Gets the name, or “unnamed”
Returns
(string)