3D engine that AI agents drive
Pass the meshopt decoder to the showcase glTF loader (part of #435)
Nguyen Xuan An014e46dd1dd1
diff --git a/changes/435.md b/changes/435.mdnew file mode 100644index 00000000..e3f5a9f1--- /dev/null+++ b/changes/435.md@@ -0,0 +1 @@+- Load the container port showcase faster (closes #435): its `scene.glb` is now meshopt-compressed, 24.3 MB to 11.9 MB with identical vertex data, textures and pixels, and the showcase page passes the meshopt decoder to the glTF loader. On a 7.4 Mbps link (the speed the live site delivered, throttled in headless Chrome) the scene is ready in 16.9 s instead of 29.5 s; the decode costs about 0.8 s on a fast link (1.6 s to 2.5 s with the file on localhost). Before this change the live site served the GLB uncompressed (`model/gltf-binary` is not compressed in transit): 22.6 s to ready, 25.5 MB over 23 requests, 92% of it waiting on the network and about 1.7 s on glTF decode and scene build.diff --git a/src/showcase.js b/src/showcase.jsindex 983e8db9..54cbcbe6 100644--- a/src/showcase.js+++ b/src/showcase.js@@ -259,9 +259,10 @@ async function selectScene(id) {try {const description = await readDescription(id);const glbUrl = new URL(description.glb, location.href);- const [model, map] = await Promise.all([+ const [model, map, decoders] = await Promise.all([downloadWithProgress(glbUrl.href, fraction => { if (request === loadingRequest) showProgress(id, fraction); }),loadHdri(description.hdri, description.hdriOptions ?? {}),+ loadDecoders(),]);const asset = await loadGltf(model, { baseUrl: new URL('.', glbUrl).href, decoders, ...(description.gltfOptions ?? {}) });if (request !== loadingRequest) return;