rename: src/Formats -> src/Rosetta, @formats -> @rosetta requires, build/luajit/rosetta + rosetta._compat, build/roblox/Rosetta, ROSETTA_* env/globals, writer vendor strings

This commit is contained in:
4DBug committed 2026-11-01 01:19:16 -05:00
1 parent 2956576d7f
commit 22ddcd78fa
941 files changed
+3364 -3364

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
--!strict
--!native
-- model/vox/Grid: the voxel loops of the VOX format: XYZI records into a dense grid, and a dense grid back into XYZI
-- records. Callers check every range first; nothing here throws.
local Grid = {}
local readu8, writeu8 = buffer.readu8, buffer.writeu8
-- fill(dst, sx, sy, sz, src, off, n) -> skipped: writes n XYZI records (x, y, z, index bytes at src[off ..]) into the
-- dense grid dst (cell x + sx * (y + sy * z)); records outside the grid or with index 0 are skipped and counted.
-- The caller guarantees off + 4 * n <= buffer.len(src) and buffer.len(dst) >= sx * sy * sz.
function Grid.fill(dst: buffer, sx: number, sy: number, sz: number, src: buffer, off: number, n: number): number
local skipped = 0
local sxy = sx * sy
for k = 0, n - 1 do
local p = off + k * 4
local x, y, z, i = readu8(src, p), readu8(src, p + 1), readu8(src, p + 2), readu8(src, p + 3)
if x < sx and y < sy and z < sz and i ~= 0 then
writeu8(dst, x + sx * y + sxy * z, i)
else
skipped += 1
end
end
return skipped
end
-- count(data, cells) -> the number of non-empty cells in data[0, cells)
function Grid.count(data: buffer, cells: number): number
local n = 0
for k = 0, cells - 1 do
if readu8(data, k) ~= 0 then
n += 1
end
end
return n
end
-- write(dst, at, data, sx, sy, sz) -> the offset after the last record: one XYZI record per non-empty cell (x fastest).
-- The caller sizes dst with count() (sx, sy, sz <= 256).
function Grid.write(dst: buffer, at: number, data: buffer, sx: number, sy: number, sz: number): number
local p = at
local k = 0
for z = 0, sz - 1 do
for y = 0, sy - 1 do
for x = 0, sx - 1 do
local i = readu8(data, k)
if i ~= 0 then
writeu8(dst, p, x)
writeu8(dst, p + 1, y)
writeu8(dst, p + 2, z)
writeu8(dst, p + 3, i)
p += 4
end
k += 1
end
end
end
return p
end
return Grid