added back in shadow blur

This commit is contained in:
Tim Anema 2014-12-05 17:50:33 -05:00
parent 0b3cc0e4a7
commit 1bbc80f04d

View File

@ -105,6 +105,17 @@ function light_world:draw(cb)
end)
self.post_shader:drawWith(self.render_buffer, self.l, self.t, self.s)
end
function light_world:drawBlur(blendmode, blur, canvas, canvas2, l, t, w, h, s)
if blur <= 0 then
return
end
canvas2:clear()
self.blurv:send("steps", blur)
self.blurh:send("steps", blur)
util.drawCanvasToCanvas(canvas, canvas2, {shader = self.blurv, blendmode = blendmode})
util.drawCanvasToCanvas(canvas2, canvas, {shader = self.blurh, blendmode = blendmode})
end
-- draw normal shading
function light_world:drawNormalShading(l,t,w,h,s)
@ -144,6 +155,7 @@ function light_world:drawNormalShading(l,t,w,h,s)
love.graphics.rectangle("fill", -l/s, -t/s, w/s,h/s)
end)
light_world:drawBlur("alpha", self.blur, self.normal, self.normal2, l, t, w, h, s)
util.drawCanvasToCanvas(self.normal, self.render_buffer, {blendmode = "multiplicative"})
end
@ -178,11 +190,7 @@ function light_world:drawGlow(l,t,w,h,s)
end
end)
self.glowMap2:clear()
self.blurv:send("steps", self.glowBlur)
self.blurh:send("steps", self.glowBlur)
util.drawCanvasToCanvas(self.glowMap, self.glowMap2, {shader = self.blurv, blendmode = "alpha"})
util.drawCanvasToCanvas(self.glowMap2, self.glowMap, {shader = self.blurh, blendmode = "alpha"})
light_world:drawBlur("alpha", self.glowBlur, self.glowMap, self.glowMap2, l, t, w, h, s)
util.drawCanvasToCanvas(self.glowMap, self.render_buffer, {blendmode = "additive"})
end
-- draw refraction