SetLightQuality

This function sets the world's light quality setting. This will effect the softness of shadow edges, and will also affect how far in the distance directional light shadows are visible.

Syntax

Parameters

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-8)

--Create a model
local model = Model:Box()
model:SetColor(0.0,1.0,0.0)
model:SetScale(10,1,10)

light = SpotLight:Create()
light:SetPosition(0,3,0)
light:Turn(90,0,0)
light:SetConeAngles(10,7.5)

world:SetLightQuality(1)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

local delta = ((window:KeyDown(Key.Up)and 1 or 0) - (window:KeyDown(Key.Down) and 1 or 0)) * Time:GetSpeed() * 0.1
local angles = light:GetConeAngles()
angles.x = angles.x + delta
angles.x = Math:Clamp(angles.x,1,45)
angles.y = angles.x * 0.75
light:SetConeAngles(angles.x,angles.y)

Time:Update()
world:Update()
world:Render()

context:SetBlendMode(Blend.Alpha)
context:DrawText("Cone angles: "..angles:ToString(),2,2)
context:DrawText("Light quality: "..world:GetLightQuality(),2,25)

context:Sync()

end