mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
added back in shadow blur
This commit is contained in:
parent
0b3cc0e4a7
commit
1bbc80f04d
18
lib/init.lua
18
lib/init.lua
@ -106,6 +106,17 @@ function light_world:draw(cb)
|
||||
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)
|
||||
-- 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)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user