Mesh loader refactor

This commit is contained in:
Nikita Kruglickiy
2021-03-20 00:14:24 +06:00
parent 2cc5e11db5
commit 492cd3027c
10 changed files with 190 additions and 418 deletions

19
koptilnya/libs/table.txt Normal file
View File

@@ -0,0 +1,19 @@
function table.chunk(tbl, size)
size = size or 1
size = size > 0 and size or 1
local result = {}
local tblKeys = table.getKeys(tbl)
for k, v in pairs(tblKeys) do
local chunkId = math.ceil(k / size)
if not result[chunkId] then
result[chunkId] = {}
end
result[chunkId][v] = tbl[v]
end
return result
end