mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
just playing around with a few things, narrowed down my last issues with scaling and translation just need to figure out a workaround
This commit is contained in:
parent
fe2a135663
commit
b976a90afe
@ -92,11 +92,8 @@ function love.draw()
|
||||
end
|
||||
|
||||
function drawBackground(l,t,w,h)
|
||||
love.graphics.push()
|
||||
love.graphics.origin()
|
||||
love.graphics.setColor(255, 255, 255)
|
||||
love.graphics.rectangle("fill", 0, 0, w, h)
|
||||
love.graphics.pop()
|
||||
love.graphics.setColor(255, 255, 255)
|
||||
love.graphics.rectangle("fill", -l, -t, w, h)
|
||||
end
|
||||
|
||||
function drawForground(l,t,w,h)
|
||||
|
@ -125,7 +125,10 @@ function light:setGlowStrength(strength)
|
||||
end
|
||||
|
||||
function light:inRange(l,t,w,h)
|
||||
return self.x + self.range > l and self.x - self.range < (l+w) and self.y + self.range > t and self.y - self.range < (t+h)
|
||||
return self.x + self.range > l and
|
||||
self.x - self.range < (l+w) and
|
||||
self.y + self.range > t and
|
||||
self.y - self.range < (t+h)
|
||||
end
|
||||
|
||||
function light:drawShadow(l,t,w,h,s,bodies, canvas)
|
||||
@ -153,7 +156,7 @@ function light:drawShadow(l,t,w,h,s,bodies, canvas)
|
||||
love.graphics.setShader(self.shader)
|
||||
love.graphics.setInvertedStencil(stencils.shadow(shadow_geometry, bodies))
|
||||
love.graphics.setBlendMode("additive")
|
||||
love.graphics.rectangle("fill", l,t,w,h)
|
||||
love.graphics.rectangle("fill", -l,-t,w,h)
|
||||
|
||||
-- draw color shadows
|
||||
love.graphics.setBlendMode("multiplicative")
|
||||
@ -174,13 +177,13 @@ function light:drawShadow(l,t,w,h,s,bodies, canvas)
|
||||
end
|
||||
end)
|
||||
|
||||
-- draw shine
|
||||
-- update shine
|
||||
util.drawto(self.shine, l, t, s, function()
|
||||
love.graphics.setShader(self.shader)
|
||||
self.shine:clear(255, 255, 255)
|
||||
love.graphics.setBlendMode("alpha")
|
||||
love.graphics.setStencil(stencils.colorShadow(bodies))
|
||||
love.graphics.rectangle("fill", 0,0,w,h)
|
||||
love.graphics.rectangle("fill", -l,-t,w,h)
|
||||
end)
|
||||
|
||||
love.graphics.setStencil()
|
||||
|
@ -96,7 +96,6 @@ end
|
||||
function light_world:draw(l,t,s)
|
||||
l,t,s = (l or 0), (t or 0), s or 1
|
||||
local w, h = love.graphics.getWidth(), love.graphics.getHeight()
|
||||
|
||||
util.drawto(self.render_buffer, l, t, s, function()
|
||||
self.drawBackground( l,t,w,h,s)
|
||||
self:drawShadow( l,t,w,h,s)
|
||||
|
Loading…
Reference in New Issue
Block a user