ws-3d2/3mf: model/3mf read / write (core, materials extension: base / colour / texture2d groups, composite, multiproperties; components, production p:path parts, units, metadata); tests against lib3mf 2.5 (its test suite), assimp, trimesh, our output read back by all three; bench lines

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
4DBugandClaude Opus 5.5 committed 2026-10-31 09:33:43 -05:00
1 parent 75c677074a
commit e87102202e
10 files changed
+1805

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
-- tools/fixtures/_3mf_encode: run by tools/fixtures/3mf.py (luau CLI, repo root): decodes every 3MF case that lib3mf
-- reads with our reader and encodes it with our writer, printing "rt_<case>.3mf\t<hex>" lines for the reference tools
-- (lib3mf, assimp, trimesh) to read back.
local ThreeMf = require("@formats/model/3mf")
local Bytes = require("@formats/core/Bytes")
local Cases = require("@tests/gen/3mf_cases")
local HEX = {}
for i = 0, 255 do
HEX[i] = string.format("%02x", i)
end
local function hex(s: string): string
local out = table.create(#s)
for i = 1, #s do
out[i] = HEX[string.byte(s, i)]
end
return table.concat(out)
end
for i, c in Cases do
if not c.lib3mf.failed then
local scene = ThreeMf.decode(Bytes.reader(buffer.fromstring(c.data)))
if scene then
local out = assert(ThreeMf.encode(scene))
print(string.format("rt_%d.3mf\t%s", i, hex(buffer.tostring(out))))
end
end
end