From 6ae929fbeb79a2becdc8fd9fe2456a02bdba7de0 Mon Sep 17 00:00:00 2001 From: Tim Anema Date: Sat, 13 Dec 2014 23:41:57 -0500 Subject: [PATCH] just a few refactors and simplified the short version to be optimal --- examples/short.lua | 10 +--------- lib/init.lua | 7 ++----- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/examples/short.lua b/examples/short.lua index c238cba..ada3dc8 100644 --- a/examples/short.lua +++ b/examples/short.lua @@ -18,11 +18,7 @@ function love.load() glow = love.graphics.newImage("examples/gfx/machine2_glow.png") -- create light world - lightWorld = LightWorld({ - ambient = {55,55,55}, - refractionStrength = 32.0, - reflectionVisibility = 0.75, - }) + lightWorld = LightWorld({ambient = {55,55,55}}) -- create light lightMouse = lightWorld:newLight(0, 0, 255, 127, 63, 300) @@ -43,10 +39,6 @@ function love.load() imageTest:setNormalMap(image_normal) imageTest:setGlowMap(glow) imageTest:setOffset(12, -10) - - -- create body object - objectTest = lightWorld:newRefraction(normal, 64, 64, 128, 128) - objectTest:setReflection(true) end function love.keypressed(k) diff --git a/lib/init.lua b/lib/init.lua index 74a1912..09619ac 100644 --- a/lib/init.lua +++ b/lib/init.lua @@ -76,7 +76,6 @@ function light_world:refreshScreenSize(w, h) self.glowMap = love.graphics.newCanvas(w, h) self.glowMap2 = love.graphics.newCanvas(w, h) self.refractionMap = love.graphics.newCanvas(w, h) - self.refractionMap2 = love.graphics.newCanvas(w, h) self.reflectionMap = love.graphics.newCanvas(w, h) self.reflectionMap2 = love.graphics.newCanvas(w, h) @@ -220,8 +219,7 @@ function light_world:drawRefraction(l,t,w,h,s) end end) - util.drawCanvasToCanvas(self.render_buffer, self.refractionMap2) - self.refractionShader:send("backBuffer", self.refractionMap2) + self.refractionShader:send("backBuffer", self.render_buffer) self.refractionShader:send("refractionStrength", self.refractionStrength) util.drawCanvasToCanvas(self.refractionMap, self.render_buffer, {shader = self.refractionShader}) end @@ -238,8 +236,7 @@ function light_world:drawReflection(l,t,w,h,s) end end) - util.drawCanvasToCanvas(self.render_buffer, self.reflectionMap2) - self.reflectionShader:send("backBuffer", self.reflectionMap2) + self.reflectionShader:send("backBuffer", self.render_buffer) self.reflectionShader:send("reflectionStrength", self.reflectionStrength) self.reflectionShader:send("reflectionVisibility", self.reflectionVisibility) util.drawCanvasToCanvas(self.reflectionMap, self.render_buffer, {shader = self.reflectionShader})