ws-cleanup-types: containers, ops: type the tables and locals the solver cannot infer
This commit is contained in:
1 parent
f209801579
commit
cfe325dcf8
12 files changed
+37
-32
No files matched your search
@@ -97,7 +97,7 @@ function Greedy.run(data: buffer, sx: number, sy: number, sz: number, ox: number
|
||||
buffer.copy(nb, 0, b, 0, cap * per)
|
||||
return nb
|
||||
end
|
||||
pos, nrm, idx, tri = grow2(pos, 48), grow2(nrm, 48), grow2(idx, 4), grow2(tri, 24)
|
||||
pos, nrm, idx, tri = grow2(pos, 48), grow2(nrm, 48), grow2(idx, 4), grow2(tri, 24) :: buffer
|
||||
cap = ncap
|
||||
end
|
||||
corner[d + 1] = slice + 1
|
||||
|
||||
@@ -272,7 +272,7 @@ function MeshOps.triangulate(prim: Primitive, opts: { method: string? }?): (Prim
|
||||
table.insert(out, readu32(ib, (at + a + 1) * 4))
|
||||
end
|
||||
else
|
||||
local poly = table.create(k)
|
||||
local poly = table.create(k) :: { number }
|
||||
for a = 0, k - 1 do
|
||||
poly[a + 1] = readu32(ib, (at + a) * 4)
|
||||
end
|
||||
@@ -856,7 +856,7 @@ function MeshOps.merge(input: any, opts: { byMaterial: boolean?, method: string?
|
||||
end
|
||||
return out, nil
|
||||
end
|
||||
local all = groups[0] or {}
|
||||
local all: { Primitive } = groups[0] or {}
|
||||
local first = all[1]
|
||||
return concat(all, first and first.material), nil
|
||||
end
|
||||
@@ -1025,7 +1025,7 @@ function MeshOps.voxelsToPrimitive(v: Types.Voxels, opts: { pivot: string?, scal
|
||||
local col = buffer.create(nv * (if srgb then 4 else 16))
|
||||
local lut: { { number } } = {}
|
||||
for i = 1, 255 do
|
||||
local c = pal[i] or { 255, 255, 255, 255 }
|
||||
local c: { number } = pal[i] or { 255, 255, 255, 255 }
|
||||
if srgb then
|
||||
lut[i] = { c[1] or 0, c[2] or 0, c[3] or 0, c[4] or 255 }
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user