mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
took care of default polygon normal map problems show up at edges
This commit is contained in:
parent
3f62fde726
commit
5cbca9f63c
@ -1,6 +1,5 @@
|
||||
:todoing
|
||||
-make sure all draw calls check if the object is within range
|
||||
-refactor rectablges to be polygons to reduce code
|
||||
-optimize shadow body calculations and drawing methods
|
||||
|
||||
# light_world.lua
|
||||
|
@ -31,7 +31,12 @@ function love.load()
|
||||
-- create shadow bodys
|
||||
circleTest = lightWorld:newCircle(256, 256, 16)
|
||||
rectangleTest = lightWorld:newRectangle(512, 512, 64, 64)
|
||||
polygonTest = lightWorld:newPolygon(100, 200, 120, 200, 150, 250, 100, 250)
|
||||
local px, py, pw, ph = 100, 200, 20, 50
|
||||
polygonTest = lightWorld:newPolygon(
|
||||
px, py,
|
||||
px+pw, py,
|
||||
px+pw, py+ph,
|
||||
px-50, py+ph)
|
||||
|
||||
imageTest = lightWorld:newImage(image, 64, 64, 24, 6)
|
||||
imageTest:setNormalMap(image_normal)
|
||||
@ -160,6 +165,7 @@ function love.draw()
|
||||
end)
|
||||
love.graphics.pop()
|
||||
|
||||
|
||||
love.graphics.setBlendMode("alpha")
|
||||
love.graphics.setColor(0, 0, 0, 191)
|
||||
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), 24)
|
||||
|
@ -244,6 +244,7 @@ function body:setPoints(...)
|
||||
self.height = self.height - self.y
|
||||
for i = 1, #points, 2 do
|
||||
points[i], points[i+1] = points[i] - self.x, points[i+1] - self.y
|
||||
print(points[i], points[i+1])
|
||||
end
|
||||
|
||||
poly_canvas = love.graphics.newCanvas(self.width, self.height)
|
||||
@ -256,6 +257,9 @@ function body:setPoints(...)
|
||||
self.ix = self.imgWidth * 0.5
|
||||
self.iy = self.imgHeight * 0.5
|
||||
self:generateNormalMapFlat("top")
|
||||
--wrapping with polygon normals causes edges to show
|
||||
--also we do not need wrapping for this default normal map
|
||||
self.normal:setWrap("clamp", "clamp")
|
||||
self.nx, self.ny = 0, 0
|
||||
|
||||
self:setShadowType('polygon', ...)
|
||||
|
Loading…
Reference in New Issue
Block a user