-- tools/fixtures/_3ds_encode: run by tools/fixtures/3ds.py (luau CLI, repo root): decodes every 3DS case and every -- glTF sample model with our readers and writes them with our 3DS writer, printing "\t" lines for assimp -- to read back. Files: case_.3ds, gltf_.3ds. local ThreeDs = require("@rosetta/model/3ds") local Gltf = require("@rosetta/model/gltf") local Bytes = require("@rosetta/core/Bytes") local Cases = require("@tests/gen/3ds_cases") local Picks = require("@tests/gen/3ds_gltf") local HEX = {} for i = 0, 255 do HEX[i] = string.format("%02x", i) end local function hex(b: buffer): string local out = table.create(buffer.len(b)) for i = 0, buffer.len(b) - 1 do out[i + 1] = HEX[buffer.readu8(b, i)] end return table.concat(out) end local function emit(name: string, scene: any) local out, err = ThreeDs.encode(scene) if out then print(name .. "\t" .. hex(out)) else print("encode failed " .. name .. ": " .. tostring(err)) end end for i, c in Cases do local scene, err = ThreeDs.decode(Bytes.reader(buffer.fromstring(c.data))) if scene then emit(string.format("case_%d.3ds", i), scene) else print("skipped " .. c.name .. ": " .. tostring(err)) end end for i, g in Picks do local scene = Gltf.decode(Bytes.reader(buffer.fromstring(g.data)), { files = g.files }) if scene then emit(string.format("gltf_%d.3ds", i), scene) end end