mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
Bugfixes
This commit is contained in:
parent
560463fdbe
commit
b27fbb57f9
12
light.lua
12
light.lua
@ -212,7 +212,7 @@ function love.light.newWorld()
|
|||||||
love.graphics.draw(o.pixelShadow2, LOVE_LIGHT_TRANSLATE_X, LOVE_LIGHT_TRANSLATE_Y)
|
love.graphics.draw(o.pixelShadow2, LOVE_LIGHT_TRANSLATE_X, LOVE_LIGHT_TRANSLATE_Y)
|
||||||
love.graphics.setBlendMode("additive")
|
love.graphics.setBlendMode("additive")
|
||||||
love.graphics.setColor({o.ambient[1], o.ambient[2], o.ambient[3]})
|
love.graphics.setColor({o.ambient[1], o.ambient[2], o.ambient[3]})
|
||||||
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
love.graphics.rectangle("fill", LOVE_LIGHT_TRANSLATE_X, LOVE_LIGHT_TRANSLATE_Y, love.graphics.getWidth(), love.graphics.getHeight())
|
||||||
love.graphics.setBlendMode("alpha")
|
love.graphics.setBlendMode("alpha")
|
||||||
|
|
||||||
-- create glow map
|
-- create glow map
|
||||||
@ -221,7 +221,7 @@ function love.light.newWorld()
|
|||||||
love.graphics.setCanvas(o.glowMap)
|
love.graphics.setCanvas(o.glowMap)
|
||||||
for i = 1, #o.circle do
|
for i = 1, #o.circle do
|
||||||
if o.circle[i].glowStrength > 0.0 then
|
if o.circle[i].glowStrength > 0.0 then
|
||||||
love.graphics.setColor(o.circle[i].glowRed, o.circle[i].glowGreen, o.circle[i].glowBlue)
|
love.graphics.setColor(o.circle[i].glowRed * o.circle[i].glowStrength, o.circle[i].glowGreen * o.circle[i].glowStrength, o.circle[i].glowBlue * o.circle[i].glowStrength)
|
||||||
love.graphics.circle("fill", o.circle[i].x, o.circle[i].y, o.circle[i].radius)
|
love.graphics.circle("fill", o.circle[i].x, o.circle[i].y, o.circle[i].radius)
|
||||||
else
|
else
|
||||||
love.graphics.setColor(0, 0, 0)
|
love.graphics.setColor(0, 0, 0)
|
||||||
@ -230,7 +230,7 @@ function love.light.newWorld()
|
|||||||
end
|
end
|
||||||
for i = 1, #o.poly do
|
for i = 1, #o.poly do
|
||||||
if o.poly[i].glowStrength > 0.0 then
|
if o.poly[i].glowStrength > 0.0 then
|
||||||
love.graphics.setColor(o.poly[i].glowRed, o.poly[i].glowGreen, o.poly[i].glowBlue)
|
love.graphics.setColor(o.poly[i].glowRed * o.poly[i].glowStrength, o.poly[i].glowGreen * o.poly[i].glowStrength, o.poly[i].glowBlue * o.poly[i].glowStrength)
|
||||||
love.graphics.polygon("fill", unpack(o.poly[i].data))
|
love.graphics.polygon("fill", unpack(o.poly[i].data))
|
||||||
else
|
else
|
||||||
love.graphics.setColor(0, 0, 0)
|
love.graphics.setColor(0, 0, 0)
|
||||||
@ -372,8 +372,8 @@ function love.light.newWorld()
|
|||||||
o.changed = true
|
o.changed = true
|
||||||
end
|
end
|
||||||
-- set glow blur
|
-- set glow blur
|
||||||
o.setGlowBlur = function(blur)
|
o.setGlowStrength = function(strength)
|
||||||
o.glowBlur = blur
|
o.glowBlur = strength
|
||||||
o.changed = true
|
o.changed = true
|
||||||
end
|
end
|
||||||
-- new rectangle
|
-- new rectangle
|
||||||
@ -1165,6 +1165,8 @@ end
|
|||||||
shadowStencil = function()
|
shadowStencil = function()
|
||||||
for i = 1,#LOVE_LIGHT_SHADOW_GEOMETRY do
|
for i = 1,#LOVE_LIGHT_SHADOW_GEOMETRY do
|
||||||
if LOVE_LIGHT_SHADOW_GEOMETRY[i].alpha == 1.0 then
|
if LOVE_LIGHT_SHADOW_GEOMETRY[i].alpha == 1.0 then
|
||||||
|
--love.graphics.setBlendMode("replace")
|
||||||
|
--love.graphics.setColor(0,0,0)
|
||||||
love.graphics.polygon("fill", unpack(LOVE_LIGHT_SHADOW_GEOMETRY[i]))
|
love.graphics.polygon("fill", unpack(LOVE_LIGHT_SHADOW_GEOMETRY[i]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
3
main.lua
3
main.lua
@ -185,6 +185,7 @@ function love.draw()
|
|||||||
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- draw lightmap shadows
|
-- draw lightmap shadows
|
||||||
if lightOn and not normalOn then
|
if lightOn and not normalOn then
|
||||||
lightWorld.drawShadow()
|
lightWorld.drawShadow()
|
||||||
@ -390,7 +391,7 @@ function love.keypressed(k, u)
|
|||||||
if glowBlur > 8.0 then
|
if glowBlur > 8.0 then
|
||||||
glowBlur = 0.0
|
glowBlur = 0.0
|
||||||
end
|
end
|
||||||
lightWorld.setGlowBlur(glowBlur)
|
lightWorld.setGlowStrength(glowBlur)
|
||||||
elseif k == "f11" then
|
elseif k == "f11" then
|
||||||
physicWorld:destroy()
|
physicWorld:destroy()
|
||||||
lightWorld.clearObjects()
|
lightWorld.clearObjects()
|
||||||
|
Loading…
Reference in New Issue
Block a user