#!/usr/bin/env python3 # Provenance generator for the DERIVED glTF test fixtures in this directory. # # This script is NOT part of the build or test path. The fixtures it produces are # committed as static files and read directly by the Rust tests (mirroring the # existing STL fixture tests that read public/models/*.stl). It exists only so the # derived binary/minified fixtures have clear, reproducible provenance. # # ── Canonical base fixtures (downloaded once, committed as-is) ──────────────── # box.glb, box.gltf, box.bin <- Khronos glTF-Sample-Assets "Box" # box_textured.glb <- Khronos glTF-Sample-Assets "BoxTextured" # Fetched from: # https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/Box/glTF-Binary/Box.glb # https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/Box/glTF/Box.gltf # https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/Box/glTF/Box0.bin (saved as box.bin; box.gltf buffer uri patched Box0.bin -> box.bin) # https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/BoxTextured/glTF-Binary/BoxTextured.glb # # ── Derived fixtures this script (re)generates ──────────────────────────────── # box_translated.glb Box + node x-translation(10) composed into the existing # rotation matrix, AND its single primitive duplicated -> # 2 primitives. Covers AC.3a: non-identity, nonzero- # determinant transform (translation makes baking # observable via the AABB x-shift) + multi-primitive # flattening with per-primitive index offsets. # box_embedded.gltf box.gltf with its external buffer inlined as a base64 # data URL. Covers AC.3b (embedded data-URL buffer). # box_textured.gltf box_textured.glb decomposed into separate companions: # + box_textured.bin the geometry buffer (external .bin) # + box_textured.png the embedded image extracted to an external PNG # Covers AC.3d (external texture companion, PNG decoded # then discarded) and multi-companion gathering. # # Re-run anytime with: python3 public/models/gen-derived-fixtures.py import base64 import json import struct def read_glb(path): data = open(path, "rb").read() assert data[:4] == b"glTF", path total = struct.unpack("