mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
fixed canvas needing stencil = true
This commit is contained in:
parent
4e4d61f737
commit
1c69786386
@ -131,6 +131,7 @@ function light_world:drawShadows(l,t,w,h,s)
|
|||||||
love.graphics.setCanvas( self.shadowMap )
|
love.graphics.setCanvas( self.shadowMap )
|
||||||
love.graphics.clear()
|
love.graphics.clear()
|
||||||
love.graphics.setCanvas()
|
love.graphics.setCanvas()
|
||||||
|
|
||||||
util.drawto(self.shadowMap, l, t, s, function()
|
util.drawto(self.shadowMap, l, t, s, function()
|
||||||
--I dont know if it uses both or just calls both
|
--I dont know if it uses both or just calls both
|
||||||
love.graphics.stencil(function()
|
love.graphics.stencil(function()
|
||||||
@ -154,6 +155,7 @@ function light_world:drawShadows(l,t,w,h,s)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- draw scene for this light using normals and shadowmap
|
-- draw scene for this light using normals and shadowmap
|
||||||
self.shadowShader:send('lightColor', {light.red / 255.0, light.green / 255.0, light.blue / 255.0})
|
self.shadowShader:send('lightColor', {light.red / 255.0, light.green / 255.0, light.blue / 255.0})
|
||||||
self.shadowShader:send("lightPosition", {(light.x + l/s) * s, (light.y + t/s) * s, (light.z * 10) / 255.0})
|
self.shadowShader:send("lightPosition", {(light.x + l/s) * s, (light.y + t/s) * s, (light.z * 10) / 255.0})
|
||||||
|
@ -51,7 +51,7 @@ function util.drawto(canvas, x, y, scale, cb)
|
|||||||
local last_buffer = love.graphics.getCanvas()
|
local last_buffer = love.graphics.getCanvas()
|
||||||
love.graphics.push()
|
love.graphics.push()
|
||||||
love.graphics.origin()
|
love.graphics.origin()
|
||||||
love.graphics.setCanvas(canvas)
|
love.graphics.setCanvas({canvas,stencil = true})
|
||||||
love.graphics.translate(x, y)
|
love.graphics.translate(x, y)
|
||||||
love.graphics.scale(scale)
|
love.graphics.scale(scale)
|
||||||
cb()
|
cb()
|
||||||
|
Loading…
Reference in New Issue
Block a user