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

@ -106,6 +106,17 @@ function light_world:draw(cb)
self.post_shader:drawWith(self.render_buffer, self.l, self.t, self.s) self.post_shader:drawWith(self.render_buffer, self.l, self.t, self.s)
end 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 -- draw normal shading
function light_world:drawNormalShading(l,t,w,h,s) function light_world:drawNormalShading(l,t,w,h,s)
-- create normal map -- create normal map
@ -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) love.graphics.rectangle("fill", -l/s, -t/s, w/s,h/s)
end) 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"}) util.drawCanvasToCanvas(self.normal, self.render_buffer, {blendmode = "multiplicative"})
end end
@ -178,11 +190,7 @@ function light_world:drawGlow(l,t,w,h,s)
end end
end) end)
self.glowMap2:clear() light_world:drawBlur("alpha", self.glowBlur, self.glowMap, self.glowMap2, l, t, w, h, s)
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"})
util.drawCanvasToCanvas(self.glowMap, self.render_buffer, {blendmode = "additive"}) util.drawCanvasToCanvas(self.glowMap, self.render_buffer, {blendmode = "additive"})
end end
-- draw refraction -- draw refraction