-
Notifications
You must be signed in to change notification settings - Fork 10
Light
- Lights and stars use two canvases, one that contains all the shadows and another that contains the final generated light texture.
- The width and height of the light's canvases are two times the radius.
- The size of the star's canvases are the size of the love2d window graphics.
- Canvases use shaders for soft shadow effects.
- Using high radius on normal lights with shaders activated produces bad performance due to the size of the light's canvases.
- Using high radius on stars with shaders activated has a static performance per star, since the radius does not affect the size of the star's canvases.
- Lights can illuminate rooms, stars cannot illuminate rooms.
- Lights have a softness shader that is applied to every particular light, this costs a lot of performance, and can be disabled by setting the Light.Blur attribute to false.
local Light = require("shadows.Light")
local Star = require("shadows.Star")
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)
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.