# DirectX .x fixtures (tools/fixtures.py): assimp's X test models (text, binary 32-bit, MSZIP-compressed binary; # models and models-nonbsd, read from the nixpkgs assimp source, never committed), plus variants made here from the # text ones: binary with 64-bit floats ("bin 0064") and MSZIP-compressed text ("tzip", per-block raw deflate with # the previous block as dictionary, as D3DX writes). Reference: assimp (`assimp info -r`: meshes, faces, corners, # materials, nodes, animations, bones; world bounds from its PreTransformVertices export), on the variants too. # tests/gen/x_cases.luau { name, data, assimp = { ... } } import importlib.util, os, re, struct, zlib INPUTS = ["src/Formats/model/x", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py"] def module(ctx, name): spec = importlib.util.spec_from_file_location(name, os.path.join(ctx.root, "tools", "fixtures", name + ".py")) m = importlib.util.module_from_spec(spec) spec.loader.exec_module(m) return m TOKEN = re.compile(rb'\s+|//[^\n]*|#[^\n]*|"[^"]*"|<[^>]*>|[{}]|[;,]|[^\s;,{}"]+') def to_binary64(text): """a text .x file -> binary tokens with 64-bit floats (templates dropped; numbers with . or e are floats)""" body = text[16:] out = bytearray(b"xof 0303bin 0064") toks = [t for t in TOKEN.findall(body) if t.strip() and not t.startswith((b"//", b"#"))] i, nums = 0, [] def flush(): while nums: isf = nums[0][0] run = [] while nums and nums[0][0] == isf: run.append(nums.pop(0)[1]) if isf: out.extend(struct.pack(" "tzip": MSZIP blocks of 32 KiB, each raw deflate with the previous block as dictionary""" body = text[16:] out = bytearray(b"xof 0303tzip0032") + struct.pack("