From b976a90afec23f4b367774e4517c42d96c3e91eb Mon Sep 17 00:00:00 2001 From: Tim Anema Date: Wed, 22 Oct 2014 21:55:15 -0400 Subject: [PATCH] just playing around with a few things, narrowed down my last issues with scaling and translation just need to figure out a workaround --- examples/short.lua | 7 ++----- lib/light.lua | 11 +++++++---- lib/light_world.lua | 1 - .../{black_and_white.frag => black_and_white.glsl} | 0 .../test/{curvature.frag => curvature.glsl} | 0 .../postshaders/test/{edges.frag => edges.glsl} | 0 .../postshaders/test/{HDR-TV.frag => hdr_tv.glsl} | 0 .../postshaders/test/{phosphor.frag => phosphor.glsl} | 0 .../test/{phosphorish.frag => phosphorish.glsl} | 0 lib/shaders/postshaders/test/{pip.frag => pip.glsl} | 0 .../test/{pixellate.frag => pixellate.glsl} | 0 .../test/{radialblur.frag => radialblur.glsl} | 0 .../test/{waterpaint.frag => waterpaint.glsl} | 0 13 files changed, 9 insertions(+), 10 deletions(-) rename lib/shaders/postshaders/test/{black_and_white.frag => black_and_white.glsl} (100%) rename lib/shaders/postshaders/test/{curvature.frag => curvature.glsl} (100%) rename lib/shaders/postshaders/test/{edges.frag => edges.glsl} (100%) rename lib/shaders/postshaders/test/{HDR-TV.frag => hdr_tv.glsl} (100%) rename lib/shaders/postshaders/test/{phosphor.frag => phosphor.glsl} (100%) rename lib/shaders/postshaders/test/{phosphorish.frag => phosphorish.glsl} (100%) rename lib/shaders/postshaders/test/{pip.frag => pip.glsl} (100%) rename lib/shaders/postshaders/test/{pixellate.frag => pixellate.glsl} (100%) rename lib/shaders/postshaders/test/{radialblur.frag => radialblur.glsl} (100%) rename lib/shaders/postshaders/test/{waterpaint.frag => waterpaint.glsl} (100%) diff --git a/examples/short.lua b/examples/short.lua index 7b4fc27..b2abe93 100644 --- a/examples/short.lua +++ b/examples/short.lua @@ -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) diff --git a/lib/light.lua b/lib/light.lua index a0b1871..436cd65 100644 --- a/lib/light.lua +++ b/lib/light.lua @@ -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() diff --git a/lib/light_world.lua b/lib/light_world.lua index b91a33f..b404379 100644 --- a/lib/light_world.lua +++ b/lib/light_world.lua @@ -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) diff --git a/lib/shaders/postshaders/test/black_and_white.frag b/lib/shaders/postshaders/test/black_and_white.glsl similarity index 100% rename from lib/shaders/postshaders/test/black_and_white.frag rename to lib/shaders/postshaders/test/black_and_white.glsl diff --git a/lib/shaders/postshaders/test/curvature.frag b/lib/shaders/postshaders/test/curvature.glsl similarity index 100% rename from lib/shaders/postshaders/test/curvature.frag rename to lib/shaders/postshaders/test/curvature.glsl diff --git a/lib/shaders/postshaders/test/edges.frag b/lib/shaders/postshaders/test/edges.glsl similarity index 100% rename from lib/shaders/postshaders/test/edges.frag rename to lib/shaders/postshaders/test/edges.glsl diff --git a/lib/shaders/postshaders/test/HDR-TV.frag b/lib/shaders/postshaders/test/hdr_tv.glsl similarity index 100% rename from lib/shaders/postshaders/test/HDR-TV.frag rename to lib/shaders/postshaders/test/hdr_tv.glsl diff --git a/lib/shaders/postshaders/test/phosphor.frag b/lib/shaders/postshaders/test/phosphor.glsl similarity index 100% rename from lib/shaders/postshaders/test/phosphor.frag rename to lib/shaders/postshaders/test/phosphor.glsl diff --git a/lib/shaders/postshaders/test/phosphorish.frag b/lib/shaders/postshaders/test/phosphorish.glsl similarity index 100% rename from lib/shaders/postshaders/test/phosphorish.frag rename to lib/shaders/postshaders/test/phosphorish.glsl diff --git a/lib/shaders/postshaders/test/pip.frag b/lib/shaders/postshaders/test/pip.glsl similarity index 100% rename from lib/shaders/postshaders/test/pip.frag rename to lib/shaders/postshaders/test/pip.glsl diff --git a/lib/shaders/postshaders/test/pixellate.frag b/lib/shaders/postshaders/test/pixellate.glsl similarity index 100% rename from lib/shaders/postshaders/test/pixellate.frag rename to lib/shaders/postshaders/test/pixellate.glsl diff --git a/lib/shaders/postshaders/test/radialblur.frag b/lib/shaders/postshaders/test/radialblur.glsl similarity index 100% rename from lib/shaders/postshaders/test/radialblur.frag rename to lib/shaders/postshaders/test/radialblur.glsl diff --git a/lib/shaders/postshaders/test/waterpaint.frag b/lib/shaders/postshaders/test/waterpaint.glsl similarity index 100% rename from lib/shaders/postshaders/test/waterpaint.frag rename to lib/shaders/postshaders/test/waterpaint.glsl