Files
4DBug c3711a7ab1 ws-3d3: model/gltf: KHR_draco_mesh_compression through codecs/model/Draco
Draco primitives decode on load (attributes as their accessors declare them,
u32 indices), written back uncompressed without the extension; meshopt stays
UNSUPPORTED. Tests: transcoded Khronos samples (two quantizations), Draco's and
assimp's Draco glTF files, each Draco primitive byte for byte against libdraco,
against the uncompressed sources, round trips. Draco bench line; scene.md section.
2026-10-31 14:29:54 -05:00

18 lines
1.2 KiB
Python

# Docs inputs for the Draco section of docs/guide/scene.md (tools/fixtures.py, tools/docs_check.py): the Khronos Box
# sample (tests/fixtures/gltf) compressed with KHR_draco_mesh_compression by draco_transcoder 1.5.7 (nix).
# tests/gen/docs_draco.luau { files = { [name] = bytes }, vars = { dracoGlbBytes = "Box_draco.glb" } }
import importlib.util, os, subprocess, tempfile
INPUTS = ["tools/docs_check.py", "tests/fixtures/gltf/Box"]
def generate(ctx):
spec = importlib.util.spec_from_file_location("docs_check", os.path.join(ctx.root, "tools", "docs_check.py"))
dc = importlib.util.module_from_spec(spec)
spec.loader.exec_module(dc)
draco = subprocess.run(["nix", "build", "nixpkgs#draco", "--no-link", "--print-out-paths"], capture_output=True, check=True).stdout.decode().strip().split("\n")[-1]
out = os.path.join(tempfile.mkdtemp(prefix="formats-docs-draco-"), "Box_draco.glb")
subprocess.run([os.path.join(draco, "bin", "draco_transcoder"), "-i", os.path.join(ctx.root, "tests", "fixtures", "gltf", "Box", "glTF-Binary", "Box.glb"), "-o", out],
capture_output=True, check=True)
dc.emit_inputs(ctx, {"Box_draco.glb": open(out, "rb").read()}, {"dracoGlbBytes": "Box_draco.glb"})