diff --git a/docs/gamecult/ridge-backdrop-target.md b/docs/gamecult/ridge-backdrop-target.md index a2529901..68dab09b 100644 --- a/docs/gamecult/ridge-backdrop-target.md +++ b/docs/gamecult/ridge-backdrop-target.md @@ -6,9 +6,11 @@ The scene's bottom silhouette is replaced by baked A+D ridge planes. The baker i The live noise ridge is nearly invisible on a phone (about 1.35:1 against the darkest sky) because every ridge pixel is lifted to the text-contrast floor, and the star dots show between nav and header glyphs because the shell is transparent. Meta, 2026-11-13: do not polish the old backdrop; ship the A+D ridge pipeline (round 2 mockup: https://minds.gamecult.org/nibu/ridge-mockups-ad/). ## Ends -- One owner per decision: the baker owns ridge geometry and shading; the runtime owns only frame choice, blending, camera drift and compositing. No ridge geometry is computed in the browser. +- One owner per decision: the baker owns ridge geometry and shading; the runtime owns only the ring's residency, the camera's pose against its heading, blending and compositing. No ridge geometry is computed in the browser. - Nothing from the scene paints above app content: the scene is one stacking context at the back of the app, and nothing it creates has its own z-index or lives outside it. - Phone cost is bounded: no per-frame script for the ridge, decoded size and fetched size gated in CI. +- The ring is the bake and the heading is unbounded: the whole 360 degrees ships as azimuth tiles, the client holds only the arc it is about to need and fetches more as the view turns, and nothing caps or wraps the heading but `ridge/ring.ts`. +- Motion is derived, not authored: a card's scale and shift come each second from the heading, the camera's angle on its circle, the viewer's offset and the card's distance (`ridge/view.ts` `cardPose`), and ride the compositor as one animation per card. - The baker has fixtures with known right answers (the far-plateau spike, chain-end taper, slot union, seam) and a mutation runner that must kill each re-introduced cause. - A baked asset names its baker version, DEM source and licence in a validated manifest; the credits shown in the Sky menu come from the manifest. diff --git a/harness/scene/README.md b/harness/scene/README.md index 0871a6f6..b641bc92 100644 --- a/harness/scene/README.md +++ b/harness/scene/README.md @@ -23,9 +23,15 @@ after of one change, never as a phone frame time. ## Ridge look sheet -Renders the Vienna cards (`public/ridge/vienna-6815bb9dca99`) lit for six sky states (dawn 2, morning 15, noon 55, golden 6, dusk -3, night -30 degrees of sun) -by a set of looks (`RidgeLook`, `src/app/features/scene/ridge/lightCards.ts`, the one owner of look values), one 480x270 canvas per cell at heading 0. The sky -behind a cell is the app's own (`makePhysicalSky` + `paintSky`, upscaled), without the sun disc, stars or clouds. Not shipped. +Renders a baked place (`?place=`, the index default otherwise) lit for six sky states (dawn 2, morning 15, noon 55, golden 6, dusk -3, night -30 degrees of sun) +by a set of looks (`RidgeLook`, `src/app/features/scene/ridge/lightCards.ts`, the one owner of look values), one 480x270 canvas per cell, drawn by the app's own still +path (`createRidgeScene` at tier 'still' over a `createBackdrop` of the tiles round the heading), at the rest azimuth unless `?views=` says otherwise. The sky +behind a cell is the app's own, without clouds. Not shipped. + + ...ridgeSheet.html?views=214:0:200,0:0:200,214:90:98.2&sky=2 # one column per view heading:phi:offset (degrees, degrees, metres) at one sky (an index of SKIES) + +A heading of 0 or 360 is across north; a phi other than 0 is the offset-only rotation mode (the camera circling the centre, the view direction staying); the offset is +clamped to the place's range as the app does. npx vite --port 5199 # from the repo root; the app's vite config serves the page and public/ http://localhost:5199/harness/scene/ridgeSheet.html # four presets x six skies diff --git a/harness/scene/ridgeSheet.ts b/harness/scene/ridgeSheet.ts index 9cb4b42b..262c2f3d 100644 --- a/harness/scene/ridgeSheet.ts +++ b/harness/scene/ridgeSheet.ts @@ -1,4 +1,8 @@ -// Look sheet for the lit ridge cards: the Vienna bake lit for a grid of sky states (or pinned moments) x looks, each cell a small canvas at heading 0. Not shipped. +// Look sheet for the lit ridge cards: a baked place lit for a grid of sky states (or pinned moments) x looks, each cell a small canvas drawn by the app's own still path +// (`createRidgeScene` at tier 'still', the tiles of the arc round the heading, each card at `cardPose`). Not shipped. +// `?views=214:0:200,0:0:200,100:0:200,214:90:98.2` one column per view `heading:phi:offset` (degrees, degrees, metres) at one sky (`?sky=2`, an index of SKIES, noon by default); a heading +// of 360 or 0 is across north. The offset is clamped to the place's range as the app does, and a phi other than 0 is the offset-only rotation mode, the camera circling the centre. +// `?place=vienna` the baked place (index.json's default if absent) // `?preset=all|physical|swiss|poster|painterly|painterly-cel-2|painterly-cel-3|painterly-cel-4` (default all: one row each; painterly is DEFAULT_LOOK); `?looks=` replaces the rows with // the given `{label, ...partial RidgeLook}` entries (inkKeep and reliefLight merge by key). `?w=480` sets the cell width, 16:9 unless `?h=` gives the height (`?w=375&h=812` is a phone). // The sky behind a cell is the app's own: `makePhysicalSky` + `paintSky` upscaled smoothly, with the real stars and the moon (`nightBodies`), @@ -8,18 +12,21 @@ // (`?hours=18,21,0,4` UTC), plus deep dusk (sun at -10 degrees) of the evening of the full moon // `?labels=1` DEBUG: label each constellation chain in frame with its d3-celestial abbreviation (fetched from the source repository at run time; not shipped) // `?lines=1` constellation lines over the stars, as the Sky menu's hidden toggle does (night cells only) -import { DEFAULT_LOOK, PHYSICAL_LOOK, lightCards } from '../../src/app/features/scene/ridge/lightCards'; +import { DEFAULT_LOOK, PHYSICAL_LOOK, createLighter } from '../../src/app/features/scene/ridge/lightCards'; import type { RidgeLook } from '../../src/app/features/scene/ridge/lightCards'; -import { parseManifest } from '../../src/app/features/scene/ridge/manifest'; -import { makePhysicalSky, paintSky } from '../../src/app/features/scene/ridge/physicalSky'; -import { windowFor } from '../../src/app/features/scene/ridge/view'; -import { nightBodies, onScreen, paintNightBodies } from '../../src/app/features/scene/ridge/nightBodies'; +import { parseIndex, parseManifest } from '../../src/app/features/scene/ridge/manifest'; +import { makePhysicalSky } from '../../src/app/features/scene/ridge/physicalSky'; +import { HFOV_MAX_DEG, windowFor } from '../../src/app/features/scene/ridge/view'; +import { onScreen } from '../../src/app/features/scene/ridge/nightBodies'; +import { createBackdrop } from '../../src/app/features/scene/ridge/Backdrop'; +import { createRidgeScene } from '../../src/app/features/scene/ridge/Ridge'; +import { anchor, hold, setMode, setRate } from '../../src/app/features/scene/ridge/heading'; +import { setCamera } from '../../src/app/features/scene/cameraState'; import { sunAt } from '../../src/app/features/scene/ridge/sunAt'; import { linesAt } from '../../src/app/features/scene/ridge/starCatalogue'; import { moonPhase } from '../../src/sky/moon.js'; import { MOMENT_IDS, momentFor } from '../../src/app/features/scene/ridge/skyMoment'; -const DIR = '/public/ridge/vienna-6815bb9dca99/'; type Override = Partial> & { label: string; @@ -35,6 +42,8 @@ interface Column { azimuth?: number; /** A moment: the sun is the real one of it. */ time?: Date; + /** Where the view faces and the camera stands: heading and phi in degrees, offset in metres. Absent: the rest azimuth, phi 0, the app's default offset. */ + view?: { h: number; phi: number; r: number }; } /** Sun elevation and compass azimuth of each column; the cards look at 214 +- 36. The band of the elevation (`skyBand`) picks the display budget. */ @@ -162,6 +171,16 @@ function momentsFrom(params: URLSearchParams, place: Parameters[0] }); return cols; } +/** `?views=h:phi:r,...`: one column per view, all at the sky `?sky=` (default noon). */ +function viewsFrom(params: URLSearchParams): Column[] | undefined { + const list = params.get('views'); + if (!list) return undefined; + const sky = SKIES[Number(params.get('sky') ?? 2)]; + return list.split(',').map((v) => { + const [h, phi, r] = v.split(':').map(Number); + return { ...sky, label: `h ${h} phi ${phi} r ${r}`, view: { h, phi, r } }; + }); +} const preset = q.get('preset'); const pinned = q.get('moments') || q.get('night'); const rows = (q.get('looks') @@ -184,19 +203,13 @@ const H = q.get('h') ? Number(q.get('h')) : Math.round((W * 9) / 16); const root = document.getElementById('sheet') as HTMLElement; async function main() { + const index = parseIndex(await (await fetch('/public/ridge/index.json')).json()); + const DIR = `/public/ridge/${index.places[q.get('place') ?? index.default] ?? index.places[index.default]}/`; const manifest = parseManifest(await (await fetch(`${DIR}manifest.json`)).json(), DIR); - const blobs = await Promise.all( - manifest.cards.map(async (c) => ({ - colour: await (await fetch(`${DIR}${c.colour}`)).blob(), - geometry: await (await fetch(`${DIR}${c.geometry}`)).blob(), - })) - ); - const decode = (b: Blob) => - createImageBitmap(b, { premultiplyAlpha: 'none', colorSpaceConversion: 'none' }); const { view } = manifest; const win = windowFor(view, W, H); const now = new Date(); - const columns = momentsFrom(q, view.place) ?? SKIES; + const columns = viewsFrom(q) ?? momentsFrom(q, view.place) ?? SKIES; const ids = q.get('labels') === '1' ? await chainIds() : undefined; const table = document.createElement('table'); @@ -218,33 +231,34 @@ async function main() { ? sunAt(view.place, col.time) : { elevation: col.elevation as number, azimuth: col.azimuth as number, time }; const physical = makePhysicalSky(sun, 0, view); - const px = paintSky(physical, W, H, win.camera); - const bodies = nightBodies(physical, px, withLines); - const small = document.createElement('canvas'); - small.width = px.w; - small.height = px.h; - const sctx = small.getContext('2d') as CanvasRenderingContext2D; - const img = sctx.createImageData(px.w, px.h); - img.data.set(px.data); - sctx.putImageData(img, 0, 0); + const sky = { ...physical.stops, physical }; + const v = col.view ?? { h: view.lookAzDeg, phi: 0, r: 200 }; for (let r = 0; r < rows.length; r += 1) { - const bitmaps = await Promise.all( - blobs.map(async (b) => ({ - colour: await decode(b.colour), - geometry: await decode(b.geometry), - })) - ); - const cards = lightCards(manifest, bitmaps, physical, rows[r].look); + // A host as the page has one: a positioned box of the cell's size holding the canvas the scene paints. + const host = document.createElement('div'); + Object.assign(host.style, { position: 'relative', width: `${W}px`, height: `${H}px`, overflow: 'hidden' }); const cell = document.createElement('canvas'); - cell.width = W; - cell.height = H; - const ctx = cell.getContext('2d') as CanvasRenderingContext2D; - ctx.imageSmoothingQuality = 'high'; - ctx.drawImage(small, 0, 0, W, H); - paintNightBodies(ctx, bodies, W, H, 1); + Object.assign(cell.style, { position: 'absolute', left: '0', top: '0', width: '100%', height: '100%' }); + host.append(cell); + tr[r].insertCell().append(host); + + // The heading owner as the app leaves it: this view's heading, the camera on its circle at phi (offset-only rotation), the offset the viewer chose. + const t0 = performance.now(); + anchor(`sheet-${manifest.bakeId}-${columns.indexOf(col)}-${r}`, v.h, t0 - 1); // a key of its own: every cell starts from phi 0 + setMode('offset', t0 - 3_600_000); + setRate(1, t0 - 3_600_000); + hold(v.h, t0 - 3_600_000 + v.phi * 1000); // phi seconds of offset rotation, at 1 degree per second, then the view is held at h + setCamera({ offsetM: v.r, mode: 'still' }); + + const backdrop = createBackdrop(manifest, physical, { lighter: (m, s) => createLighter(m, s, rows[r].look) }); + await backdrop.ensure({ fromDeg: v.h - HFOV_MAX_DEG, toDeg: v.h + HFOV_MAX_DEG }); + const scene = createRidgeScene({ canvas: cell, tier: 'still', sky, backdrop, lines: withLines }); + scene?.dispose(); + if (ids) { // Debug labels: each chain's id at the mean of its vertices that lie in the frame. + const ctx = cell.getContext('2d') as CanvasRenderingContext2D; ctx.font = '11px monospace'; ctx.fillStyle = '#ffd24a'; linesAt(physical.sun.time, view.place.lat, view.place.lon).forEach((chain, i) => { @@ -255,26 +269,6 @@ async function main() { ctx.fillText(`${ids[i]} ${pts.length}/${chain.length}`, mx * W, my * H); }); } - // As Ridge.ts paintCards at heading 0: farthest first, each card at its own scale about the horizon row of the plane. - const s = win.plane.scale; - const x0 = (W - win.plane.w) / 2; - const planeTop = H - (win.plane.h + win.plane.bottom); - const ox = x0 + win.plane.w / 2; - const oy = planeTop + view.horizonRow * s; - for (let k = cards.length - 1; k >= 0; k -= 1) { - ctx.save(); - ctx.translate(ox, oy); - ctx.scale(cards[k].scale, cards[k].scale); - ctx.drawImage( - cards[k].canvas, - x0 - ox, - planeTop + cards[k].top * s - oy, - win.plane.w, - cards[k].h * s - ); - ctx.restore(); - } - tr[r].insertCell().append(cell); } } document.title = 'ridge look sheet: done'; diff --git a/src/app/features/scene/README.md b/src/app/features/scene/README.md index 0f9f9e14..090e78d2 100644 --- a/src/app/features/scene/README.md +++ b/src/app/features/scene/README.md @@ -19,20 +19,25 @@ means "keep the CSS ground". Everything below this section describes the opt-in - `ridge/skyColour.ts` `skyColours()` is the fallback three-stop palette (top, mid, horizon) a scene gets with no `sky` option; the host passes `ridgeSkyFor` (skyForState.ts) instead. - Ridge cards: `ridge/manifest.ts` `loadManifest` reads `${BASE_URL}public/ridge/index.json` (config `backgroundScene.place` picks the entry, - unknown or absent: the index default), then the place's `manifest.json` (schema 2, written by `scripts/ridge-bake/export.py`; it is the one JSON - the backdrop reads): K G-buffer cards, nearest first, each a colour WebP (albedo, straight alpha) and a geometry WebP (the normal as 'rt8', the - log-distance, and the wall code R = G = 255 for the extruded face under a ridge). `index.ts` `prepare()` loads the manifest and, with the scene chunk, - `ridge/Backdrop.ts` `loadBackdrop`: every card's two files fetched and decoded straight (no premultiply, no colour management), then - `ridge/lightCards.ts` lights each card once in WebGL2 for the sky of this build (sun and ambient from the atmosphere, aerial perspective from the - geometry's distance, ink on occluding edges and creases, the sky's own display so terrain and sky share an exposure) into a 2D canvas, and releases - the context. A sky change is a rebuild, so it lights again; nothing is lit per frame, and the host canvas is only ever asked for 2d. - `createRidgeScene({ backdrop })` stays synchronous, and a rebuild keeps the old scene up until the new one's cards are lit, then swaps. The rig - is one div of K card elements (farthest first; DOM order is paint order; no z-index, no fixed position, nothing outside the scene's parent), - each placed at its rows of the plane and moved by `view.ts` `cardMotion`: the camera turns through the baker's heading range (capped so every card still covers - the viewport) and card i pans `scale_i` x heading and is drawn `scale_i` times its bake, about the horizon centre, as a camera pushed forward on a circle - round the bake centre sees it (ruling ridge-camera-on-circle); the scales come from the manifest. It drifts on `Element.animate` (transform only, 150 s loop, - paused when the tab is hidden, motion is reduced or the scene is still); a still draws the same cards at heading 0 into the host canvas. A failure - anywhere (404, a manifest that is not schema 2, a card that will not decode, no WebGL2, a lighting pass that throws) is the sky-only scene on `FALLBACK_VIEW`, + unknown or absent: the index default), then the place's `manifest.json` (schema 3, written by `scripts/ridge-bake/export.py`; it is the one JSON + the backdrop reads): the whole 360 degree ring, K G-buffer cards nearest first, each cut into azimuth tiles (32 of 11.25 degrees) of a colour WebP (albedo, + straight alpha) and a geometry WebP (the normal as 'rt8', the log-distance, and the wall code R = G = 255 for the extruded face under a ridge), each tile + with the card's distance there; `camera.r_max_m` bounds the parallax offset. Schema 2 is refused with a message naming the stale deploy. `index.ts` + `prepare()` loads the manifest, anchors the heading (`ridge/heading.ts`) and, with the scene chunk, `ridge/Backdrop.ts` `createBackdrop`: `ensure(arc)` + fetches and decodes the tiles of an arc of azimuth it does not hold, one tile at a time (no premultiply, no colour management), and `ridge/lightCards.ts` + `createLighter` lights each card of a tile in WebGL2 for the sky of this build (sun and ambient from the atmosphere in absolute azimuth, aerial perspective from the + geometry's distance, ink on occluding edges and creases, the sky's own display so terrain and sky share an exposure) into a 2D canvas of the tile's interior and one + overlap column each side. The backdrop holds the arc ahead and two tiles beyond and lets go of the rest; a tile that fails is absent and tried again. A sky change is a + rebuild, so it makes a new lighter; nothing is lit per frame, and the host canvas is only ever asked for 2d. + `createRidgeScene({ backdrop })` stays synchronous (`prepare()` awaits the first arc), and a rebuild keeps the old scene up until the new one is lit, then swaps; the + heading survives it. The rig is one div of K boxes, one per card (farthest first; DOM order is paint order; no z-index, no fixed position, nothing outside the scene's + parent), each holding that card's resident tiles at their unwrapped azimuth. A card's pose (scale and shift) is derived by `view.ts` `cardPose` from its distance at + the heading (`ring.ts`), the viewer's offset and the camera's angle on its circle, as a camera on a circle round the bake centre sees it (ruling ridge-camera-on-circle; + the offset is signed and clamped by `offsetRange`, the one clamp). `heading.ts` owns the view direction and the camera's angle (unwrapped degrees, module state, a manual + `hold` stops the rotation); `cameraState.ts` holds the viewer's mode, speed and offset in `ratatoskr.camera`. The motion is one `Element.animate` per card (transform only, a + keyframe each second for 30 s, reissued at 80% and on any change; paused when the tab is hidden or motion is reduced, then constant); a 500 ms timer asks the backdrop for + the arc ahead and mounts the tiles it has made. A still draws the tiles of the arc into the host canvas at the heading now. The sky does not turn with the heading. A failure + anywhere (404, a manifest that is not schema 3, no tile that will decode, no WebGL2, a lighting pass that throws) is the sky-only scene on `FALLBACK_VIEW`, told to the host by the live scene alone, through `onPlanesFail` when the live scene has no cards and `onPlanesOk` when a later one has them (never from a stale or disposed build); it is never `onCompileFail`. `vite.config.js` copies `public/ridge` into `dist/public/`. - `harness/scene/bundle.cjs ridge` builds a standalone page (`?tier=`, `?probe=1`). @@ -65,7 +70,7 @@ named moments draw today's weather; a free moment draws a clear sky. `skyState.ts` holds the stores (choice, place, constellation lines) and tells listeners; the choice persists in `ratatoskr.skyChoice`. The key of the old four-state menu is read once by `skyState.ts` (Day became Noon) and removed. `skyPlace.ts` is the one writer of the place: a scene start loads the manifest of the configured place (nothing else fetches it, so a page with no scene fetches nothing) and the build -settles what it draws, the manifest's place when the cards load, `FALLBACK_VIEW`'s when they do not (a failed manifest, a card that will not decode), so the sky, the weather, the ink and the Auto +settles what it draws, the manifest's place when the cards load, `FALLBACK_VIEW`'s when they do not (a failed manifest, no tile that will decode), so the sky, the weather, the ink and the Auto timer read the place that is drawn. Until a scene has settled it no sky is drawn for ink and the theme's own ink stands. The one timer (Auto, a named moment) tells listeners when the band changes or a named moment's place-local day rolls over. diff --git a/src/app/features/scene/cameraState.test.ts b/src/app/features/scene/cameraState.test.ts index 6634cef7..e489ef23 100644 --- a/src/app/features/scene/cameraState.test.ts +++ b/src/app/features/scene/cameraState.test.ts @@ -22,7 +22,9 @@ beforeEach(() => { }); vi.stubGlobal('window', { matchMedia: () => reduced }); }); -afterEach(() => vi.unstubAllGlobals()); +afterEach(() => { + vi.unstubAllGlobals(); +}); describe('the viewer camera', () => { it('starts at the defaults: both, a turn in ten minutes, 200 m forward', () => { diff --git a/src/app/features/scene/ridge/Backdrop.test.ts b/src/app/features/scene/ridge/Backdrop.test.ts index 9cbd39f9..1160cc0f 100644 --- a/src/app/features/scene/ridge/Backdrop.test.ts +++ b/src/app/features/scene/ridge/Backdrop.test.ts @@ -1,6 +1,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; +import type { Mock } from 'vitest'; import { createBackdrop, KEEP_MARGIN_TILES, LOAD_MARGIN_TILES } from './Backdrop'; -import type { Lighter } from './lightCards'; +import type { CardBitmaps, Lighter } from './lightCards'; import { parseManifest } from './manifest'; import { wireManifest } from './manifest.fixture'; import type { PhysicalSky } from './physicalSky'; @@ -22,22 +23,23 @@ const rig = (fail: (url: string) => boolean = () => false) => { if (fail(url)) throw new Error('ridge: 404'); return { url } as unknown as Blob; }); - const decode = vi.fn(async (blob: Blob & { url: string }) => { - const t = tileOf(blob.url); + const decode = vi.fn(async (blob: Blob) => { + const { url } = blob as unknown as { url: string }; + const t = tileOf(url); inFlight.set(t, (inFlight.get(t) ?? 0) + 1); mostTiles = Math.max(mostTiles, inFlight.size); await new Promise((r) => setTimeout(r, 0)); inFlight.set(t, (inFlight.get(t) ?? 1) - 1); if (inFlight.get(t) === 0) inFlight.delete(t); - const b = { url: blob.url, closed: false, close: () => (b.closed = true) }; + const b = { url, closed: false, close: () => (b.closed = true) }; bitmaps.push(b); return b as unknown as ImageBitmap; }); const canvases: { tile: number; card: number; width: number; height: number }[] = []; - const lighter = (): Lighter & { light: ReturnType } => ({ + const lighter = (): Lighter & { light: Mock<[CardBitmaps, number, number], HTMLCanvasElement> } => ({ lost: false, release: vi.fn(), - light: vi.fn((_b: unknown, tile: number, card: number) => { + light: vi.fn((_b: CardBitmaps, tile: number, card: number) => { const c = { tile, card, width: 202, height: 100 }; canvases.push(c); return c as unknown as HTMLCanvasElement; @@ -52,7 +54,9 @@ const urlsOfTiles = (tiles: number[]) => ); const arc72 = (centre: number) => ({ fromDeg: centre - 36, toDeg: centre + 36 }); -afterEach(() => vi.useRealTimers()); +afterEach(() => { + vi.useRealTimers(); +}); describe('createBackdrop', () => { it('fetches nothing until it is asked, and then the files of the tiles of the arc and one tile beyond it, straight, and no others', async () => { diff --git a/src/app/features/scene/ridge/Ridge.test.ts b/src/app/features/scene/ridge/Ridge.test.ts index fefd69fc..bbc92d72 100644 --- a/src/app/features/scene/ridge/Ridge.test.ts +++ b/src/app/features/scene/ridge/Ridge.test.ts @@ -10,7 +10,8 @@ import { sunOfBand } from './skyTestkit'; import { startBackgroundScene } from '../index'; import { parseManifest } from './manifest'; import { ELSEWHERE_VIEW, wireManifest } from './manifest.fixture'; -import type { Backdrop, LitTile } from './Backdrop'; +import type { Arc, Backdrop, LitTile } from './Backdrop'; +import type { Mock } from 'vitest'; import { cardPose, FALLBACK_VIEW, offsetRange, windowFor } from './view'; import { anchor, getMode, headingAt, hold, phiAt, resetHeading } from './heading'; import { getCamera, resetCamera, setCamera } from '../cameraState'; @@ -560,11 +561,11 @@ describe('the ridge cards in the scene', () => { return [{ tile, card, canvas: canvas as unknown as HTMLCanvasElement }]; }) ); - const litCards = (): Backdrop & { ensure: ReturnType; dispose: ReturnType } => { + const litCards = (): Backdrop & { ensure: Mock<[Arc], Promise>; dispose: Mock<[], void> } => { const lit = tilesOf(); return { manifest, - ensure: vi.fn(async () => undefined), + ensure: vi.fn(async (_arc: Arc): Promise => undefined), litTiles: () => lit, dispose: vi.fn(), }; @@ -594,7 +595,9 @@ describe('the ridge cards in the scene', () => { vi.spyOn(performance, 'now').mockReturnValue(T0); anchor(view.place.id, view.lookAzDeg, T0); // what index.ts prepare does before the scene is made }); - afterEach(() => vi.restoreAllMocks()); + afterEach(() => { + vi.restoreAllMocks(); + }); it('lays the night bodies (lines, stars, moon) in the sky before any card, so the cards occlude them', () => { const { canvas } = host();