scene: keep the terrain sky and baked tables out of the main chunk (stacked on #47) #48
Loading…
Reference in a new issue
No description provided.
Delete branch "nibu/sky-bundle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Cuts the main-chunk cost of the sky consumer (#47, merged). Branch carries dev
913a66eb(merged in; includes #47 and #45).Entry chunk (
vite build, index-*.js,gzip -9), measured twice:a9a75fc6(before #47)913a66eb(#47 + #45 merged)a9a75fc6)a9a75fc6; -53.5 KB vs dev913a66eb)The +0.7 KB over
a9a75fc6includes #45's title-bar code, so the sky-state part of this PR is under that. Baked tables are in the lazyterrainSkychunk (117,567 raw / 50,056 gz), loaded with the scenes; the entry has none.Backdrop constants (skyBackdrop reads these; relative luminance, rounded outward to 6 places): Day 0.237309-0.928052, Dusk 0.016727-0.967912, Night 0.058099-0.077467, Auto 0.016727-0.967912. They come from
terrainDrawn, which now finds the sun-glow peak and the darkest patch by compass search from the best coarse samples (3 degree grid, 0.5 degree horizon ring, zenith, 0.25 degree sun patch); the old 3 degree grid gave Day max 0.9192 and Dusk 0.9647. Contrast table: the 3 passing cells (night Light/Silver/Dark/Butter 4.78 / 4.69, Midnight text 5.05) did not move; day Noonday is 3.71 / 2.56 as before; every other cell is 1.00 or as before.Drift test (skyForState.test.ts): the constants must bound the computed union, sit within 1e-5 of it, and bound an independent sweep (golden-angle spiral of 20,000 points plus a 0.05 degree grid around the sun) within 5e-4. Mutating the day top to the old value, the day bottom, the dusk top, and setting the refinement off each fail it. Scene suite 22 files / 364 tests pass; prettier and eslint clean on touched files.
Service-worker precache (Void's question): there is none.
vite.config.js:105-113runs VitePWA withstrategies: 'injectManifest'andinjectManifest: { injectionPoint: undefined }, so no manifest is injected, andsrc/sw.tshas no precache, no__WB_MANIFESTand no workbox import: it only proxies authenticated media (install, activate, message and fetch handlers). The builtsw.jsis 1,660 bytes on both dev913a66eband this PR, byte-identical, with noprecache/workbox/asset references. So the lazy terrainSky, Scene and Terrain chunks are not precached by the service worker on either; total precache size is 0 on dev and on this PR; they load over the network (and the browser HTTP cache) when the scene starts. No SW config was changed.Not measured: load time or first paint, brotli sizes, runtime caching by the browser or host (netlify.toml headers), the dev server, a deployed build, and anything in a browser. One build each; the dev builds used deps from
npm cion this lockfile.