build engine: docs/guide sections (ART tiles, Build maps) with inputs from tools/fixtures/docs_build.py, bench lines, type fixes; bundles rebuilt

This commit is contained in:
4DBug committed 2026-11-01 18:46:54 -06:00
1 parent aacc78fac2
commit 082ea2019e
10 files changed
+3575 -1085

No files matched your search

+30
View File
@@ -1902,3 +1902,33 @@ do
jitTune(false)
end
end
do
-- Build engine (ws-build): an ART of 64 random 128 x 128 tiles to rgba8 through a palette (MB/s of rgba8 output),
-- and the two-room map of tools/fixtures/buildmap.py to a Scene (MB/s of map bytes)
local Art = require("@rosetta/image/art")
local BuildMap = require("@rosetta/model/buildmap")
local AF = require("@tests/gen/art")
local BF = require("@tests/gen/buildmap")
local rnd = 12345
local frames: { Types.Frame } = {}
for i = 1, 64 do
local img = Types.Image.new(128, 128, "gray8")
for k = 0, 128 * 128 - 1 do
rnd = (rnd * 1103515245 + 12345) % 2147483648
buffer.writeu8(img.pixels, k, rnd % 256)
end
img.meta.tile = i - 1
frames[i] = { image = img, delay = 0, x = 0, y = 0, dispose = "none", blend = "source" }
end
local top = Types.Image.new(1, 1, "gray8")
top.frames = frames
local art = assert(Art.encode(top))
local pal = buffer.fromstring(AF.palette)
bench("art decode 64 x 128x128 -> rgba8", 3, 64 * 128 * 128 * 4, function()
Art.decode(Bytes.reader(art), { palette = pal })
end)
local map = buffer.fromstring(BF.maps[1].data)
bench("buildmap rooms -> Scene", 20, buffer.len(map), function()
BuildMap.decode(Bytes.reader(map))
end)
end