perf(zones): debug

Iterate polygon userdata directly, instead of creating a new table each frame.
This commit is contained in:
Linden
2022-04-25 21:51:03 +10:00
parent 94a460903d
commit f651a91bf6

View File

@@ -6,16 +6,18 @@ local function removeZone(self)
end end
local function debug(self) local function debug(self)
local points = self.polygon() local polygon = self.polygon
for i = 1, #points do local polyCount = #self.polygon
if i == #points then
DrawPoly(points[i], points[1], self.centroid, 255, 0, 0, 50) for i = 1, polyCount do
DrawPoly(points[1], points[i], self.centroid, 255, 0, 0, 50) if i == polyCount then
else DrawPoly(polygon[i], polygon[1], self.centroid, 255, 0, 0, 50)
DrawPoly(points[i], points[i + 1], self.centroid, 255, 0, 0, 50) DrawPoly(polygon[1], polygon[i], self.centroid, 255, 0, 0, 50)
DrawPoly(points[i + 1], points[i], self.centroid, 255, 0, 0, 50) else
end DrawPoly(polygon[i], polygon[i + 1], self.centroid, 255, 0, 0, 50)
end DrawPoly(polygon[i + 1], polygon[i], self.centroid, 255, 0, 0, 50)
end
end
end end
local inside = {} local inside = {}