fixed light position

This commit is contained in:
Tim Anema 2014-10-23 12:17:28 -04:00
parent 7325cf8499
commit 5e8ef63d6d
3 changed files with 3 additions and 3 deletions

View File

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

View File

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

View File

@ -38,4 +38,4 @@ vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords){
} }
return pixel; return pixel;
} }