The OLight class
An 'OLight' instance is an light object in a scene which can be
manipulated. The 'OLight' class is mostly used to manage lights in your
3D scene.
See also: Widget
OLight(object3d)
Create a new OLight object with the given Object3d
as the base. Will return 'nil' if the given object is not of type 'Light'.
If you give 'nil' as the base object it will create a new light in the current scene and
Return: the new OLight object.
function OLight:getIntensity()
Returns the intensity of the light object.
Return: The intensity as a number.
function OLight:setIntensity(intensity)
Sets the intensity of the light source
You will be going for an intensity between 0.0 and 1.0 most of the time
to prevent over saturation.
Parameter
intensity
function OLight:setColor(color)
Sets the light color
Parameter
color
function OLight:getColor()
Gets the light color
Return: The color as a vec3
function OLight:setRadius(r)
Sets the light radius in unit
Parameter
r
function OLight:getRadius()
Gets the light radius
Parameter
return
function OLight:enableShadows()
Enables shadows
function OLight:disableShadows()
Disables shadows
function OLight:hasShadows()
Checks if the light has shadows enabled.
Return: A boolean value.
function OLight:setShadowBlur(b)
Sets the shadow blur.
Keep in mind that higher values are slower to calculate
since they cause more blur iterations in the GLSL shader!
The value has to be be bigger than 0!
Parameter
b
function OLight:getShadowBlur()
Returns the the shadow blur.
Parameter
return
function OLight:setShadowBias(b)
Sets the shadow bias
Parameter
b
function OLight:getShadowBias()
Gets the shadow bias.
Return: The bias as a number.
function OLight:setSpotAngle(angle)
Sets the spot angle.
The angle needs to be given in degrees and
should be in the range 0 <= angle < 180.
A value of 0° turns the light into a directional
light source.
A value of 180° turns the light into a point light.
Parameter
angle
function OLight:getSpotAngle()
Gets the spot angle
Return: The angle as a number in degrees.
function OLight:makeDirectional()
Turns the light into a directional light
function OLight:makePointLight()
Turns the light into a point light.