diff --git a/light.lua b/light.lua index 8ab5551..f16d440 100644 --- a/light.lua +++ b/light.lua @@ -827,7 +827,7 @@ function love.light.newImage(p, img, x, y, width, height, ox, oy) o.normal = love.graphics.newImage(imgNormalData) end -- generate faded normal map - o.generateNormalMapFade = function(horizontalFade, verticalFade) + o.generateNormalMapGradient = function(horizontalGradient, verticalGradient) local imgData = o.img:getData() local imgNormalData = love.image.newImageData(o.imgWidth, o.imgHeight) local dx = 255.0 / o.imgWidth @@ -840,18 +840,18 @@ function love.light.newImage(p, img, x, y, width, height, ox, oy) for k = 0, o.imgHeight - 1 do local r, g, b, a = imgData:getPixel(i, k) if a > 0 then - if horizontalFade == "fade" then + if horizontalGradient == "gradient" then nx = i * dx - elseif horizontalFade == "inverse" then + elseif horizontalGradient == "inverse" then nx = 255 - i * dx else nx = 127 end - if verticalFade == "fade" then + if verticalGradient == "gradient" then ny = 127 + k * dy * 0.5 nz = 255 - k * dy * 0.5 - elseif verticalFade == "inverse" then + elseif verticalGradient == "inverse" then ny = 127 - k * dy * 0.5 nz = 127 - k * dy * 0.25 else diff --git a/main.lua b/main.lua index 8dc5a56..81894e7 100644 --- a/main.lua +++ b/main.lua @@ -436,7 +436,7 @@ function love.keypressed(k, u) -- add image phyCnt = phyCnt + 1 phyLight[phyCnt] = lightWorld.newImage(blopp, mx, my, 42, 16, 21, 20) - phyLight[phyCnt].generateNormalMapFade("fade", "fade") + phyLight[phyCnt].generateNormalMapGradient("gradient", "gradient") phyBody[phyCnt] = love.physics.newBody(physicWorld, mx, my, "dynamic") phyShape[phyCnt] = love.physics.newRectangleShape(0, 0, 42, 29) phyFixture[phyCnt] = love.physics.newFixture(phyBody[phyCnt], phyShape[phyCnt])