fixed canvas needing stencil = true

This commit is contained in:
flamendless 2018-05-30 11:45:58 +08:00
parent 4e4d61f737
commit 1c69786386
2 changed files with 3 additions and 1 deletions

View File

@ -131,6 +131,7 @@ function light_world:drawShadows(l,t,w,h,s)
love.graphics.setCanvas( self.shadowMap )
love.graphics.clear()
love.graphics.setCanvas()
util.drawto(self.shadowMap, l, t, s, function()
--I dont know if it uses both or just calls both
love.graphics.stencil(function()
@ -154,6 +155,7 @@ function light_world:drawShadows(l,t,w,h,s)
end
end
end)
-- 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("lightPosition", {(light.x + l/s) * s, (light.y + t/s) * s, (light.z * 10) / 255.0})

View File

@ -51,7 +51,7 @@ function util.drawto(canvas, x, y, scale, cb)
local last_buffer = love.graphics.getCanvas()
love.graphics.push()
love.graphics.origin()
love.graphics.setCanvas(canvas)
love.graphics.setCanvas({canvas,stencil = true})
love.graphics.translate(x, y)
love.graphics.scale(scale)
cb()