just a few refactors and simplified the short version to be optimal

This commit is contained in:
Tim Anema 2014-12-13 23:41:57 -05:00
parent 41058d5d5b
commit 6ae929fbeb
2 changed files with 3 additions and 14 deletions

View File

@ -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)

View File

@ -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})