Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 36373d8ba6 | |||
| 8f4d935346 | |||
| 5544fcfd6c | |||
| 77e95c2826 | |||
| 786b41ddf1 | |||
| 39c9924042 | |||
|
|
1455988a83 | ||
| 08bf515997 | |||
| 683d3b92f8 |
5
.gitattributes
vendored
|
|
@ -1,5 +0,0 @@
|
||||||
# The ridge bake is addressed by its bytes (bake_id covers the manifest text and the tile files): public/ridge is checked out exactly as committed, whatever
|
|
||||||
# core.autocrlf says, so a Windows working tree serves the bytes its directory name was hashed from.
|
|
||||||
public/ridge/** -text
|
|
||||||
# The baker's inputs and schema are text, read the same everywhere.
|
|
||||||
scripts/ridge-bake/**/*.json text eol=lf
|
|
||||||
|
|
@ -6,11 +6,9 @@ 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/).
|
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
|
## Ends
|
||||||
- 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.
|
- 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.
|
||||||
- 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.
|
- 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.
|
- 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 the heading: it is unwrapped within a stretch of motion and `ridge/heading.ts` `normalize` brings it into [0, 360) before each one, so no angle or pixel position grows with uptime, while `ridge/ring.ts` is the one place that reasons about the wrap at 0 / 360.
|
|
||||||
- Motion is derived, not authored: a card's scale and shift come each second from the heading, the camera's angle on its circle and the viewer's offset (one pose, one owner: `ridge/heading.ts`, whose every change starts a segment from the pose the view has, and whose eases keep each pose inside the baked bound) 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.
|
- 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.
|
- 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.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,25 +21,11 @@ directory whose ancestors hold no empty `package.json` (esbuild reads them).
|
||||||
Timings from SwiftShader are CPU time: use them for the split between passes and for before and
|
Timings from SwiftShader are CPU time: use them for the split between passes and for before and
|
||||||
after of one change, never as a phone frame time.
|
after of one change, never as a phone frame time.
|
||||||
|
|
||||||
## Ridge live scene
|
|
||||||
|
|
||||||
`ridgeLive.html` is one live scene (tier 'full', the sky plate and the cards on the compositor) filling the window, for a driver to turn and screenshot: `?h=214&sun=232:22&speed=6` (start heading, the sun's azimuth and elevation, degrees a second of rotation),
|
|
||||||
`?sky=night&lines=1`. `window.live` offers `hold(h)`, `pose()`, `plate()`, `left()` (the plate's left edge on the page) and `plateCost()` (ms of main thread to paint one plate here); `window.longTasks` lists the tasks over 50 ms.
|
|
||||||
A held heading's sun lands within a tenth of a pixel of the column the heading owner says, across re-centres of the plate.
|
|
||||||
|
|
||||||
## Ridge look sheet
|
## Ridge look sheet
|
||||||
|
|
||||||
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)
|
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, drawn by the app's own still
|
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
|
||||||
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 (`makePhysicalSky` + `paintSky`, upscaled), without the sun disc, stars or clouds. Not shipped.
|
||||||
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)
|
|
||||||
|
|
||||||
`&sun=100:6` puts the sun of that sky at compass azimuth 100, 6 degrees up (the stars are those of the moment the sheet is opened): a sun at the heading's side shows where the turned sky puts it, `&sky=5&lines=1` is the night.
|
|
||||||
|
|
||||||
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 (phi 0: `camera.r_max_forward_m`, another phi: `camera.r_max_m`).
|
|
||||||
|
|
||||||
npx vite --port 5199 # from the repo root; the app's vite config serves the page and public/
|
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
|
http://localhost:5199/harness/scene/ridgeSheet.html # four presets x six skies
|
||||||
|
|
@ -60,4 +46,4 @@ Presets (`PRESETS` in `ridgeSheet.ts`; swiss and poster take every key not named
|
||||||
| painterly | DEFAULT_LOOK: groundNoise 0.35, cloudShadows 0.5, nearWarm 0.6, hazeScale 2, inkScale 0.4, celBands 3, celSoftness 0.05, celAmbientAway 0.7 |
|
| painterly | DEFAULT_LOOK: groundNoise 0.35, cloudShadows 0.5, nearWarm 0.6, hazeScale 2, inkScale 0.4, celBands 3, celSoftness 0.05, celAmbientAway 0.7 |
|
||||||
| painterly-cel-2 / -3 / -4 | painterly with celBands 2 / 3 / 4 |
|
| painterly-cel-2 / -3 / -4 | painterly with celBands 2 / 3 / 4 |
|
||||||
|
|
||||||
Named moments (`ridgeSheet.html?named=1`): the six moments of the Sky menu (dawn, morning, noon, golden hour, dusk, night) at the baked place on the December and June solstices, drawn from `momentFor` as the app draws them (`SKY_MOMENTS` in `ridge/skyMoment.ts` is the table tuned by eye from this sheet). Night sets (`ridgeSheet.html`): `?moments=2026-11-24T22:00Z,2026-12-09T20:00Z` pins explicit UTC moments (the sun, moon and stars are those of the moment); `?night=1` renders the next new moon, first quarter and full moon from today (`&from=YYYY-MM-DD`) at four hours each (`&hours=18,21,0,4`, UTC) plus deep dusk of the full-moon evening; `&lines=1` draws the constellation lines (the Sky menu's hidden toggle). Use `&w=300` for the 13-column set. The night look's knobs: `NIGHT_LOOK` in `ridge/nightSky.ts` (star point spread, contrast exponents, moon size, earthshine, line opacity), `NIGHT_CEILING` and `SCOTOPIC` in `ridge/toneMap.ts`, the night `Budget` (key, targets, partial adaptation).
|
Night sets (`ridgeSheet.html`): `?moments=2026-11-24T22:00Z,2026-12-09T20:00Z` pins explicit UTC moments (the sun, moon and stars are those of the moment); `?night=1` renders the next new moon, first quarter and full moon from today (`&from=YYYY-MM-DD`) at four hours each (`&hours=18,21,0,4`, UTC) plus deep dusk of the full-moon evening; `&lines=1` draws the constellation lines (the Sky menu's hidden toggle). Use `&w=300` for the 13-column set. The night look's knobs: `NIGHT_LOOK` in `ridge/nightSky.ts` (star point spread, contrast exponents, moon size, earthshine, line opacity), `NIGHT_CEILING` and `SCOTOPIC` in `ridge/toneMap.ts`, the night `Budget` (key, targets, partial adaptation).
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
||||||
<title>Ridge live scene</title>
|
|
||||||
<body style="margin:0;background:#111">
|
|
||||||
<div id="host" style="position:fixed;inset:0;overflow:hidden"><canvas id="c" style="position:absolute;left:0;top:0;width:100%;height:100%"></canvas></div>
|
|
||||||
<script type="module" src="./ridgeLive.ts"></script>
|
|
||||||
</body>
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
// One live ridge scene (tier 'full': the sky plate and the cards on the compositor) filling the window, for a driver to turn and screenshot. Not shipped.
|
|
||||||
// `?h=214` the heading the scene starts at; `?sun=232:22` the sun's compass azimuth and elevation (degrees); `?sky=night` the stars of now (sun below the horizon); `?lines=1` the constellation lines.
|
|
||||||
// `?speed=6` degrees a second the view turns (rotation mode 'both'); 0 holds it. The page offers `window.live`: `hold(h)` turns the view by hand, `pose()` is the heading owner's pose now,
|
|
||||||
// `plate()` the sky plate's element and `left()` its left edge and width on the page.
|
|
||||||
import { parseManifest } from '../../src/app/features/scene/ridge/manifest';
|
|
||||||
import { makePhysicalSky } from '../../src/app/features/scene/ridge/physicalSky';
|
|
||||||
import { createBackdrop } from '../../src/app/features/scene/ridge/Backdrop';
|
|
||||||
import { createRidgeScene } from '../../src/app/features/scene/ridge/Ridge';
|
|
||||||
import { anchor, hold, poseAt } from '../../src/app/features/scene/ridge/heading';
|
|
||||||
import { setCamera } from '../../src/app/features/scene/cameraState';
|
|
||||||
import { HFOV_MAX_DEG, windowFor } from '../../src/app/features/scene/ridge/view';
|
|
||||||
import { paintSky } from '../../src/app/features/scene/ridge/physicalSky';
|
|
||||||
import { nightBodies } from '../../src/app/features/scene/ridge/nightBodies';
|
|
||||||
import { plateCamera, plateSize, SLACK_MIN_DEG } from '../../src/app/features/scene/ridge/skyTurn';
|
|
||||||
|
|
||||||
const q = new URLSearchParams(location.search);
|
|
||||||
/** The main-thread tasks over 50 ms the page saw, ms: `window.longTasks`. */
|
|
||||||
const longTasks: number[] = [];
|
|
||||||
(window as unknown as { longTasks: number[] }).longTasks = longTasks;
|
|
||||||
try {
|
|
||||||
new PerformanceObserver((l) => l.getEntries().forEach((e) => longTasks.push(e.duration))).observe({ entryTypes: ['longtask'] });
|
|
||||||
} catch {
|
|
||||||
// No long-task entries in this browser.
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const index = await (await fetch('/public/ridge/index.json')).json();
|
|
||||||
const dir = `/public/ridge/${index.places[q.get('place') ?? index.default]}/`;
|
|
||||||
const manifest = parseManifest(await (await fetch(`${dir}manifest.json`)).json(), dir);
|
|
||||||
const { view } = manifest;
|
|
||||||
const [az, el] = (q.get('sun') ?? '232:22').split(':').map(Number);
|
|
||||||
const time = new Date();
|
|
||||||
const sun = q.get('sky') === 'night' ? { azimuth: 0, elevation: -30, time } : { azimuth: az, elevation: el, time };
|
|
||||||
const physical = makePhysicalSky(sun, 0, view);
|
|
||||||
const h0 = Number(q.get('h') ?? view.lookAzDeg);
|
|
||||||
anchor(view.place.id, h0, performance.now());
|
|
||||||
setCamera({ mode: 'both', speedDegPerS: Number(q.get('speed') ?? 0), offsetM: 200 });
|
|
||||||
const backdrop = createBackdrop(manifest, physical);
|
|
||||||
await backdrop.ensure({ fromDeg: h0 - HFOV_MAX_DEG, toDeg: h0 + HFOV_MAX_DEG });
|
|
||||||
const canvas = document.getElementById('c') as HTMLCanvasElement;
|
|
||||||
const scene = createRidgeScene({ canvas, tier: 'full', sky: { ...physical.stops, physical }, backdrop, lines: q.get('lines') === '1' });
|
|
||||||
const host = document.getElementById('host') as HTMLElement;
|
|
||||||
// The plate is the host's div whose first child is a canvas (the rig's first child is a div, the rain's has none).
|
|
||||||
const plate = () => [...host.children].find((c) => c.tagName === 'DIV' && c.firstElementChild?.tagName === 'CANVAS');
|
|
||||||
(window as unknown as { live: unknown }).live = {
|
|
||||||
scene,
|
|
||||||
hold: (h: number) => hold(h, performance.now()),
|
|
||||||
pose: () => poseAt(performance.now()),
|
|
||||||
plate,
|
|
||||||
/** Mean ms of the main-thread part of painting one plate here (the dome, its pixels and the bodies, not the canvas upscale), over `n` runs. */
|
|
||||||
plateCost: (n = 10) => {
|
|
||||||
const w = innerWidth;
|
|
||||||
const h = innerHeight;
|
|
||||||
const win = windowFor(view, w, h);
|
|
||||||
const { cssW } = plateSize(win, w, h, devicePixelRatio >= 2 ? 2 : 1, SLACK_MIN_DEG);
|
|
||||||
const t0 = performance.now();
|
|
||||||
for (let i = 0; i < n; i += 1) nightBodies(physical, paintSky(physical, cssW, h, plateCamera(win, 214 + i, SLACK_MIN_DEG)), true);
|
|
||||||
return (performance.now() - t0) / n;
|
|
||||||
},
|
|
||||||
left: () => {
|
|
||||||
const r = plate()?.getBoundingClientRect();
|
|
||||||
return r && { left: r.left, width: r.width };
|
|
||||||
},
|
|
||||||
};
|
|
||||||
document.title = 'ridge live: done';
|
|
||||||
}
|
|
||||||
|
|
||||||
main().catch((e) => {
|
|
||||||
console.error(e);
|
|
||||||
document.title = `ridge live: failed ${e}`;
|
|
||||||
});
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
// 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
|
// 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.
|
||||||
// (`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. `&sun=100:6` puts the sun of that sky at azimuth 100, 6 degrees up (the stars are always those of the moment the sheet is opened). The offset is clamped to the place's range as the app does (phi 0: the bake's forward bound, any other phi: the worst-case bound), 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=<JSON array, url-encoded or base64>` replaces the rows with
|
// `?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=<JSON array, url-encoded or base64>` 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 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`),
|
// The sky behind a cell is the app's own: `makePhysicalSky` + `paintSky` upscaled smoothly, with the real stars and the moon (`nightBodies`),
|
||||||
|
|
@ -12,21 +8,19 @@
|
||||||
// (`?hours=18,21,0,4` UTC), plus deep dusk (sun at -10 degrees) of the evening of the full moon
|
// (`?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)
|
// `?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)
|
// `?lines=1` constellation lines over the stars, as the Sky menu's hidden toggle does (night cells only)
|
||||||
import { DEFAULT_LOOK, PHYSICAL_LOOK, createLighter } from '../../src/app/features/scene/ridge/lightCards';
|
import { DEFAULT_LOOK, PHYSICAL_LOOK, lightCards } from '../../src/app/features/scene/ridge/lightCards';
|
||||||
import type { RidgeLook } from '../../src/app/features/scene/ridge/lightCards';
|
import type { RidgeLook } from '../../src/app/features/scene/ridge/lightCards';
|
||||||
import { parseIndex, parseManifest } from '../../src/app/features/scene/ridge/manifest';
|
import { parseManifest } from '../../src/app/features/scene/ridge/manifest';
|
||||||
import { makePhysicalSky } from '../../src/app/features/scene/ridge/physicalSky';
|
import { makePhysicalSky, paintSky } from '../../src/app/features/scene/ridge/physicalSky';
|
||||||
import { HFOV_MAX_DEG, windowFor } from '../../src/app/features/scene/ridge/view';
|
import { windowFor } from '../../src/app/features/scene/ridge/view';
|
||||||
import { onScreen } from '../../src/app/features/scene/ridge/nightBodies';
|
import { nightBodies, onScreen, paintNightBodies } 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 } 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 { sunAt } from '../../src/app/features/scene/ridge/sunAt';
|
||||||
import { linesAt } from '../../src/app/features/scene/ridge/starCatalogue';
|
import { linesAt } from '../../src/app/features/scene/ridge/starCatalogue';
|
||||||
import { moonPhase } from '../../src/sky/moon.js';
|
import { moonPhase } from '../../src/sky/moon.js';
|
||||||
import { MOMENT_IDS, momentFor } from '../../src/app/features/scene/ridge/skyMoment';
|
import { DAY_FROM } from '../../src/app/features/scene/skyState';
|
||||||
|
import type { FixedSkyState } from '../../src/app/features/scene/skyState';
|
||||||
|
|
||||||
|
const DIR = '/public/ridge/vienna-6815bb9dca99/';
|
||||||
|
|
||||||
type Override = Partial<Omit<RidgeLook, 'inkKeep' | 'reliefLight'>> & {
|
type Override = Partial<Omit<RidgeLook, 'inkKeep' | 'reliefLight'>> & {
|
||||||
label: string;
|
label: string;
|
||||||
|
|
@ -42,11 +36,9 @@ interface Column {
|
||||||
azimuth?: number;
|
azimuth?: number;
|
||||||
/** A moment: the sun is the real one of it. */
|
/** A moment: the sun is the real one of it. */
|
||||||
time?: Date;
|
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. */
|
/** Sun elevation and compass azimuth of each column; the cards look at 214 +- 36. Elevation picks the display budget (day from DAY_FROM, night below its negative). */
|
||||||
const SKIES: Column[] = [
|
const SKIES: Column[] = [
|
||||||
{ label: 'dawn 2 deg', elevation: 2, azimuth: 100 },
|
{ label: 'dawn 2 deg', elevation: 2, azimuth: 100 },
|
||||||
{ label: 'morning 15 deg', elevation: 15, azimuth: 135 },
|
{ label: 'morning 15 deg', elevation: 15, azimuth: 135 },
|
||||||
|
|
@ -146,14 +138,6 @@ function momentsFrom(params: URLSearchParams, place: Parameters<typeof sunAt>[0]
|
||||||
if (Number.isNaN(time.getTime())) throw new Error(`moments=: ${iso} is not a date`);
|
if (Number.isNaN(time.getTime())) throw new Error(`moments=: ${iso} is not a date`);
|
||||||
return { label: fmt(time), time };
|
return { label: fmt(time), time };
|
||||||
});
|
});
|
||||||
// `named=1`: the six named moments of the sky menu (`momentFor`, as the app draws them) on both solstices at the place: the look sheet the elevation table is tuned from.
|
|
||||||
if (params.get('named'))
|
|
||||||
return ['2026-12-21', '2026-06-21'].flatMap((day) =>
|
|
||||||
MOMENT_IDS.map((id) => {
|
|
||||||
const time = momentFor({ kind: 'named', id }, place, new Date(`${day}T12:00:00Z`));
|
|
||||||
return { label: `${id} ${day.slice(5)} ${fmt(time)}`, time };
|
|
||||||
})
|
|
||||||
);
|
|
||||||
if (!params.get('night')) return undefined;
|
if (!params.get('night')) return undefined;
|
||||||
const from = params.get('from') ? new Date(`${params.get('from')}T00:00:00Z`) : new Date();
|
const from = params.get('from') ? new Date(`${params.get('from')}T00:00:00Z`) : new Date();
|
||||||
const hours = (params.get('hours') ?? '18,21,0,4').split(',').map(Number);
|
const hours = (params.get('hours') ?? '18,21,0,4').split(',').map(Number);
|
||||||
|
|
@ -171,17 +155,6 @@ function momentsFrom(params: URLSearchParams, place: Parameters<typeof sunAt>[0]
|
||||||
});
|
});
|
||||||
return cols;
|
return cols;
|
||||||
}
|
}
|
||||||
/** `?views=h:phi:r,...`: one column per view, all at the sky `?sky=` (default noon), whose sun `?sun=az:el` may put elsewhere (compass degrees, degrees above the horizon). */
|
|
||||||
function viewsFrom(params: URLSearchParams): Column[] | undefined {
|
|
||||||
const list = params.get('views');
|
|
||||||
if (!list) return undefined;
|
|
||||||
const [az, el] = (params.get('sun') ?? '').split(':').map(Number);
|
|
||||||
const sky = { ...SKIES[Number(params.get('sky') ?? 2)], ...(Number.isFinite(az) && Number.isFinite(el) ? { azimuth: az, elevation: el } : {}) };
|
|
||||||
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 preset = q.get('preset');
|
||||||
const pinned = q.get('moments') || q.get('night');
|
const pinned = q.get('moments') || q.get('night');
|
||||||
const rows = (q.get('looks')
|
const rows = (q.get('looks')
|
||||||
|
|
@ -203,14 +176,23 @@ const W = Number(q.get('w') ?? 480);
|
||||||
const H = q.get('h') ? Number(q.get('h')) : Math.round((W * 9) / 16);
|
const H = q.get('h') ? Number(q.get('h')) : Math.round((W * 9) / 16);
|
||||||
const root = document.getElementById('sheet') as HTMLElement;
|
const root = document.getElementById('sheet') as HTMLElement;
|
||||||
|
|
||||||
|
const stateOf = (el: number): FixedSkyState =>
|
||||||
|
el >= DAY_FROM ? 'day' : el <= -DAY_FROM ? 'night' : 'dusk';
|
||||||
|
|
||||||
async function main() {
|
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 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 { view } = manifest;
|
||||||
const win = windowFor(view, W, H);
|
const win = windowFor(view, W, H);
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const columns = viewsFrom(q) ?? momentsFrom(q, view.place) ?? SKIES;
|
const columns = momentsFrom(q, view.place) ?? SKIES;
|
||||||
const ids = q.get('labels') === '1' ? await chainIds() : undefined;
|
const ids = q.get('labels') === '1' ? await chainIds() : undefined;
|
||||||
|
|
||||||
const table = document.createElement('table');
|
const table = document.createElement('table');
|
||||||
|
|
@ -231,33 +213,34 @@ async function main() {
|
||||||
col.time !== undefined
|
col.time !== undefined
|
||||||
? sunAt(view.place, col.time)
|
? sunAt(view.place, col.time)
|
||||||
: { elevation: col.elevation as number, azimuth: col.azimuth as number, time };
|
: { elevation: col.elevation as number, azimuth: col.azimuth as number, time };
|
||||||
const physical = makePhysicalSky(sun, 0, view);
|
const physical = makePhysicalSky(stateOf(sun.elevation), time, 0, view, sun);
|
||||||
const sky = { ...physical.stops, physical };
|
const px = paintSky(physical, W, H, win.camera);
|
||||||
const v = col.view ?? { h: view.lookAzDeg, phi: 0, r: 200 };
|
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);
|
||||||
|
|
||||||
for (let r = 0; r < rows.length; r += 1) {
|
for (let r = 0; r < rows.length; r += 1) {
|
||||||
// A host as the page has one: a positioned box of the cell's size holding the canvas the scene paints.
|
const bitmaps = await Promise.all(
|
||||||
const host = document.createElement('div');
|
blobs.map(async (b) => ({
|
||||||
Object.assign(host.style, { position: 'relative', width: `${W}px`, height: `${H}px`, overflow: 'hidden' });
|
colour: await decode(b.colour),
|
||||||
|
geometry: await decode(b.geometry),
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
const cards = lightCards(manifest, bitmaps, physical, rows[r].look);
|
||||||
const cell = document.createElement('canvas');
|
const cell = document.createElement('canvas');
|
||||||
Object.assign(cell.style, { position: 'absolute', left: '0', top: '0', width: '100%', height: '100%' });
|
cell.width = W;
|
||||||
host.append(cell);
|
cell.height = H;
|
||||||
tr[r].insertCell().append(host);
|
const ctx = cell.getContext('2d') as CanvasRenderingContext2D;
|
||||||
|
ctx.imageSmoothingQuality = 'high';
|
||||||
// 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.
|
ctx.drawImage(small, 0, 0, W, H);
|
||||||
const t0 = performance.now() - 3_600_000;
|
paintNightBodies(ctx, bodies, W, H, 1);
|
||||||
anchor(`sheet-${manifest.bakeId}-${columns.indexOf(col)}-${r}`, v.h, t0); // a key of its own: every cell starts from phi 0
|
|
||||||
setCamera({ mode: 'offset', speedDegPerS: 1, offsetM: v.r }, t0); // the offset-only rotation mode for phi seconds at 1 degree per second ...
|
|
||||||
hold(v.h, t0 + v.phi * 1000); // ... then the view is held at h: the mode is still, the camera stays at phi (phi 0 is the camera on its heading)
|
|
||||||
|
|
||||||
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) {
|
if (ids) {
|
||||||
// Debug labels: each chain's id at the mean of its vertices that lie in the frame.
|
// 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.font = '11px monospace';
|
||||||
ctx.fillStyle = '#ffd24a';
|
ctx.fillStyle = '#ffd24a';
|
||||||
linesAt(physical.sun.time, view.place.lat, view.place.lon).forEach((chain, i) => {
|
linesAt(physical.sun.time, view.place.lat, view.place.lon).forEach((chain, i) => {
|
||||||
|
|
@ -268,6 +251,26 @@ async function main() {
|
||||||
ctx.fillText(`${ids[i]} ${pts.length}/${chain.length}`, mx * W, my * H);
|
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';
|
document.title = 'ridge look sheet: done';
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@
|
||||||
"schema": 1,
|
"schema": 1,
|
||||||
"default": "vienna",
|
"default": "vienna",
|
||||||
"places": {
|
"places": {
|
||||||
"vienna": "vienna-2aac8e6fee59"
|
"vienna": "vienna-6815bb9dca99"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 842 B |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 702 B |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 634 B |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 600 B |
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 678 B |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 552 B |
|
Before Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 384 B |
|
Before Width: | Height: | Size: 7 KiB |
|
Before Width: | Height: | Size: 584 B |
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 728 B |
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 558 B |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 576 B |
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 1,002 B |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 758 B |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 582 B |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 684 B |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 810 B |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 684 B |
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 552 B |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 704 B |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 724 B |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 998 B |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 946 B |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 808 B |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 680 B |
|
Before Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 714 B |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 612 B |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 476 B |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 478 B |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 956 B |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 986 B |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1,008 B |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 498 B |
|
Before Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 514 B |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 700 B |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 876 B |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 938 B |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 544 B |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 520 B |
|
Before Width: | Height: | Size: 176 B |
|
Before Width: | Height: | Size: 952 B |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |