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:
Tim Anema 2014-10-22 21:55:15 -04:00
parent fe2a135663
commit b976a90afe
13 changed files with 9 additions and 10 deletions

View File

@ -92,11 +92,8 @@ function love.draw()
end end
function drawBackground(l,t,w,h) function drawBackground(l,t,w,h)
love.graphics.push()
love.graphics.origin()
love.graphics.setColor(255, 255, 255) love.graphics.setColor(255, 255, 255)
love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.rectangle("fill", -l, -t, w, h)
love.graphics.pop()
end end
function drawForground(l,t,w,h) function drawForground(l,t,w,h)

View File

@ -125,7 +125,10 @@ function light:setGlowStrength(strength)
end end
function light:inRange(l,t,w,h) 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 end
function light:drawShadow(l,t,w,h,s,bodies, canvas) 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.setShader(self.shader)
love.graphics.setInvertedStencil(stencils.shadow(shadow_geometry, bodies)) love.graphics.setInvertedStencil(stencils.shadow(shadow_geometry, bodies))
love.graphics.setBlendMode("additive") love.graphics.setBlendMode("additive")
love.graphics.rectangle("fill", l,t,w,h) love.graphics.rectangle("fill", -l,-t,w,h)
-- draw color shadows -- draw color shadows
love.graphics.setBlendMode("multiplicative") love.graphics.setBlendMode("multiplicative")
@ -174,13 +177,13 @@ function light:drawShadow(l,t,w,h,s,bodies, canvas)
end end
end) end)
-- draw shine -- update shine
util.drawto(self.shine, l, t, s, function() util.drawto(self.shine, l, t, s, function()
love.graphics.setShader(self.shader) love.graphics.setShader(self.shader)
self.shine:clear(255, 255, 255) self.shine:clear(255, 255, 255)
love.graphics.setBlendMode("alpha") love.graphics.setBlendMode("alpha")
love.graphics.setStencil(stencils.colorShadow(bodies)) love.graphics.setStencil(stencils.colorShadow(bodies))
love.graphics.rectangle("fill", 0,0,w,h) love.graphics.rectangle("fill", -l,-t,w,h)
end) end)
love.graphics.setStencil() love.graphics.setStencil()

View File

@ -96,7 +96,6 @@ end
function light_world:draw(l,t,s) function light_world:draw(l,t,s)
l,t,s = (l or 0), (t or 0), s or 1 l,t,s = (l or 0), (t or 0), s or 1
local w, h = love.graphics.getWidth(), love.graphics.getHeight() local w, h = love.graphics.getWidth(), love.graphics.getHeight()
util.drawto(self.render_buffer, l, t, s, function() util.drawto(self.render_buffer, l, t, s, function()
self.drawBackground( l,t,w,h,s) self.drawBackground( l,t,w,h,s)
self:drawShadow( l,t,w,h,s) self:drawShadow( l,t,w,h,s)