mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
fixed the shadows of polygons without 8 vertices
This commit is contained in:
parent
691da848de
commit
2ccda79969
@ -649,7 +649,7 @@ function body:drawPolyShadow(light)
|
|||||||
|
|
||||||
for i = 1, #self.data, 2 do
|
for i = 1, #self.data, 2 do
|
||||||
local vertex = vector(self.data[i], self.data[i + 1])
|
local vertex = vector(self.data[i], self.data[i + 1])
|
||||||
local nextVertex = vector(self.data[(i + 2) % 8], self.data[(i + 2) % 8 + 1])
|
local nextVertex = vector(self.data[(i + 2) % #self.data], self.data[(i + 2) % #self.data + 1])
|
||||||
local startToEnd = nextVertex - vertex
|
local startToEnd = nextVertex - vertex
|
||||||
if vector(startToEnd.y, -startToEnd.x) * (vertex - lightPosition) > 0 then
|
if vector(startToEnd.y, -startToEnd.x) * (vertex - lightPosition) > 0 then
|
||||||
local point1 = (lh - (vertex * light.z))/height_diff
|
local point1 = (lh - (vertex * light.z))/height_diff
|
||||||
|
Loading…
Reference in New Issue
Block a user