Skip to content
Matías Hermosilla edited this page Oct 3, 2018 · 21 revisions

The 'Light' Object

Importing

local Light = require("shadows.Light")
local Star = require("shadows.Star")
  • Lights use two canvases, one that contains all the shadows and another that contains the final generated light texture.
  • The width and height of the canvases are two times the radius.
  • Canvases use shaders for soft shadow effects, using high light radius with the shaders activated produces bad performance due to the size of the canvases.
  • Lights can illuminate rooms.

Functions

Light = Light:new(LightWorld World, number Radius)
Light = Star:new(LightWorld World, number Radius)

local newLightWorld = LightWorld:new()
local newLight = Light:new(newLightWorld, 300)
local newStart = Star:new(newLightWorld, 5000)

Methods

Light:SetAngle(number Angle)
Description: Changes the angle of the light.

number Angle = Light:GetAngle()
Description: Gets the angle of the light.

Light:SetPosition(number x, number y[, number z])
Description: Sets the position of the light, z is a optional height value.

number x, number y, number z = Light:GetPosition()
Description: Gets the position of the light.

Light:SetColor(number R, number G, number B)
Description: Changes the color of the light.

number R, number G, number B = Light:GetColor()
Description: Gets the color of the light.

Light:SetImage(Image Image)
Description: Uses a custom image as light.

Image Image = Light:GetImage()
Description: Gets the custom image of the light.

Light:SetRadius(number Radius)
Description: Changes the radius of the light.

Light:Remove()
Description: Removes the light.

Transform transform = Light:GetTransform()
Description: Gets the transform associated with the light.

Clone this wiki locally