mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
set direction fix for lights
This commit is contained in:
parent
3ad6703ef0
commit
d3358b0455
@ -123,7 +123,7 @@ function light_world:drawShadows(l,t,w,h,s)
|
|||||||
self.shadowMap:clear()
|
self.shadowMap:clear()
|
||||||
util.drawto(self.shadowMap, l, t, s, function()
|
util.drawto(self.shadowMap, l, t, s, function()
|
||||||
love.graphics.setStencil(function()
|
love.graphics.setStencil(function()
|
||||||
local angle = light.direction - (math.pi - light.angle / 2.0)
|
local angle = light.direction - (light.angle / 2.0)
|
||||||
love.graphics.arc("fill", light.x, light.y, light.range, angle, angle + light.angle)
|
love.graphics.arc("fill", light.x, light.y, light.range, angle, angle + light.angle)
|
||||||
end)
|
end)
|
||||||
for k = 1, #self.bodies do
|
for k = 1, #self.bodies do
|
||||||
@ -142,7 +142,7 @@ function light_world:drawShadows(l,t,w,h,s)
|
|||||||
blendmode = 'additive',
|
blendmode = 'additive',
|
||||||
shader = self.shadowShader,
|
shader = self.shadowShader,
|
||||||
stencil = function()
|
stencil = function()
|
||||||
local angle = light.direction - (math.pi - light.angle / 2.0)
|
local angle = light.direction - (light.angle / 2.0)
|
||||||
love.graphics.arc("fill", (light.x + l/s) * s, (light.y + t/s) * s, light.range, angle, angle + light.angle)
|
love.graphics.arc("fill", (light.x + l/s) * s, (light.y + t/s) * s, light.range, angle, angle + light.angle)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user