mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
fixed light position
This commit is contained in:
parent
7325cf8499
commit
5e8ef63d6d
@ -80,7 +80,7 @@ function love.update(dt)
|
|||||||
scale = scale + 0.01
|
scale = scale + 0.01
|
||||||
end
|
end
|
||||||
|
|
||||||
lightMouse:setPosition(love.mouse.getX(), love.mouse.getY())
|
lightMouse:setPosition(love.mouse.getX()/scale, love.mouse.getY()/scale)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.draw()
|
function love.draw()
|
||||||
|
@ -145,7 +145,7 @@ function light:drawShadow(l,t,w,h,s,bodies, canvas)
|
|||||||
-- draw shadow
|
-- draw shadow
|
||||||
self.shadow:clear()
|
self.shadow:clear()
|
||||||
util.drawto(self.shadow, l, t, s, function()
|
util.drawto(self.shadow, l, t, s, function()
|
||||||
self.shader:send("lightPosition", {self.x + l, h - (self.y + t), self.z})
|
self.shader:send("lightPosition", {self.x*s, (h/s - self.y)*s, self.z})
|
||||||
self.shader:send("lightRange", self.range)
|
self.shader:send("lightRange", self.range)
|
||||||
self.shader:send("lightColor", {self.red / 255.0, self.green / 255.0, self.blue / 255.0})
|
self.shader:send("lightColor", {self.red / 255.0, self.green / 255.0, self.blue / 255.0})
|
||||||
self.shader:send("lightSmooth", self.smooth)
|
self.shader:send("lightSmooth", self.smooth)
|
||||||
|
@ -38,4 +38,4 @@ vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return pixel;
|
return pixel;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user