/** * THE ONE HACKY STEP. Delete this file the day gltf-transform can author an * external-URI texture in a GLB, and nothing else has to change. * * Why it exists. A texture shared by N meshes should be ONE file fetched once * and ONE GPU upload, not N copies. glTF supports exactly that -- `images[].uri` * is legal inside a .glb -- but gltf-transform v4 cannot author it: * * - `texture.setImage(bytes)` -> the payload is inlined into the BIN chunk. * - `texture.setURI(name)` with no image -> it emits `{"name":…,"mimeType":…}` * carrying NEITHER `uri` NOR `bufferView`, and the texture still points at * it. That is a dangling image: invalid glTF, and it renders as nothing. * * Both were verified by decoding the GLB JSON chunk, not inferred. * * The saving grace is how little is missing. gltf-transform already drops the * bufferView and re-indexes everything correctly; the ONLY absent field is the * `uri` string. So this does not rewrite buffer views or re-index anything -- * it decodes the JSON chunk, writes one field per image, and re-encodes. That * is the whole hack, and it is deliberately the whole hack: anything more * ambitious here would be a second glTF writer. * * Measured stakes for the Pacifica mall: 372 distinct textures shared is * 140.6 MB on the wire and 288.6 MiB of GPU. The same textures embedded per-GLB * is 1,390.3 MB and ~3,016 MiB -- 9.9x and 10.5x -- because every copy is a * distinct GPU image. */ /** * Gives every image named in `uriByImageName` an `images[].uri`, so the GLB * REFERENCES a shared texture file instead of carrying its bytes. * * Refuses rather than emits a broken asset: * - a named image that does not exist in the GLB is a caller bug (the name is * the only join key, so a typo would silently externalize nothing); * - an image that still has a `bufferView` would end up with both a uri and * inline bytes, which is ambiguous and means the payload was never removed; * - ANY image left with neither `uri` nor `bufferView` is a dangling * reference. This is checked across ALL images, not just the ones asked * for, because that is the exact state gltf-transform produces on its own * and it renders as nothing rather than failing loudly. */ export declare function externalizeGlbTextureUris(bytes: Uint8Array, uriByImageName: ReadonlyMap): Uint8Array;