From 40573e5c32e7560554b49aed46c4f05f81aff1db Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 23 Nov 2026 00:53:07 +0100 Subject: [PATCH] ridge assets: Vienna rebaked with camera.r_max_forward_m (205.4 m, r_max_m 98.2 m); the manifest and the gate read it The tile files are unchanged (same bake id); the manifest gains the forward offset bound. The assets gate recomputes the resident run at the larger of the two offsets. Co-Authored-By: Claude Sonnet 5.5 --- public/ridge/vienna-64118fed28c7/manifest.json | 5 +++-- src/app/features/scene/ridge/manifest.fixture.ts | 2 +- src/app/features/scene/ridge/manifest.test.ts | 9 ++++++--- src/app/features/scene/ridge/manifest.ts | 15 +++++++++++---- src/app/features/scene/ridge/ridgeAssets.test.ts | 9 +++++---- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/public/ridge/vienna-64118fed28c7/manifest.json b/public/ridge/vienna-64118fed28c7/manifest.json index 86bf4696..75f07d26 100644 --- a/public/ridge/vienna-64118fed28c7/manifest.json +++ b/public/ridge/vienna-64118fed28c7/manifest.json @@ -1,6 +1,6 @@ { "schema": 3, - "baker_version": 4, + "baker_version": 5, "bake_id": "64118fed28c7", "place": { "id": "vienna", @@ -35,7 +35,8 @@ "normal": "rt8" }, "camera": { - "r_max_m": 98.2 + "r_max_m": 98.2, + "r_max_forward_m": 205.4 }, "cards": [ { diff --git a/src/app/features/scene/ridge/manifest.fixture.ts b/src/app/features/scene/ridge/manifest.fixture.ts index 95a7f5de..673b1bd3 100644 --- a/src/app/features/scene/ridge/manifest.fixture.ts +++ b/src/app/features/scene/ridge/manifest.fixture.ts @@ -43,7 +43,7 @@ export const wireManifest = ( }, curvature: { r_earth_m: 6371000, k_ref: 0.13 }, encoding: { log_d_min: 4.6, log_d_max: 11.5, normal: 'rt8' }, - camera: { r_max_m: 100 }, + camera: { r_max_m: 100, r_max_forward_m: 180 }, cards: Array.from({ length: k }, (_, i) => ({ near_m: i ? 1000 * 10 ** (i - 1) * 4 : null, far_m: i < k - 1 ? 4000 * 10 ** i : null, diff --git a/src/app/features/scene/ridge/manifest.test.ts b/src/app/features/scene/ridge/manifest.test.ts index cbbd9a2c..2ac2e85c 100644 --- a/src/app/features/scene/ridge/manifest.test.ts +++ b/src/app/features/scene/ridge/manifest.test.ts @@ -25,7 +25,7 @@ describe('parseManifest', () => { tz: 'Europe/Vienna', }); expect(m.encoding).toEqual({ logDMin: 4.6, logDMax: 11.5 }); - expect(m.camera).toEqual({ rMaxM: 100 }); + expect(m.camera).toEqual({ rMaxM: 100, rMaxForwardM: 180 }); expect(m.cards).toEqual([ { nearM: null, farM: 4000 }, { nearM: 4000, farM: 40000 }, @@ -72,7 +72,9 @@ describe('parseManifest', () => { expect(() => parseManifest(withTile({ ...t, distance_m: 0 }), '/')).toThrow(/distance/); expect(() => parseManifest(withTile({ ...t, distance_m: Infinity }), '/')).toThrow(/distance/); expect(() => parseManifest({ ...w, camera: undefined }, '/')).toThrow(/camera/); - expect(() => parseManifest({ ...w, camera: { r_max_m: 0 } }, '/')).toThrow(/r_max_m/); + expect(() => parseManifest({ ...w, camera: { r_max_m: 0, r_max_forward_m: 0 } }, '/')).toThrow(/r_max_m/); + expect(() => parseManifest({ ...w, camera: { r_max_m: 100 } }, '/')).toThrow(/r_max_forward_m/); + expect(() => parseManifest({ ...w, camera: { r_max_m: 100, r_max_forward_m: 99 } }, '/')).toThrow(/r_max_forward_m/); }); it('rejects a missing field, a normal that is not rt8 and a backwards encoding', () => { @@ -109,7 +111,8 @@ describe('parseManifest', () => { }; for (const bad of [ { ...w, schema: 'SECRET-VALUE-42' }, - { ...w, camera: { r_max_m: 'SECRET-VALUE-42' } }, + { ...w, camera: { r_max_m: 'SECRET-VALUE-42', r_max_forward_m: 180 } }, + { ...w, camera: { r_max_m: 100, r_max_forward_m: 'SECRET-VALUE-42' } }, { ...w, tiles: [[{ ...w.tiles[0][0], distance_m: 'SECRET-VALUE-42' }, ...w.tiles[0].slice(1)], ...w.tiles.slice(1)] }, ]) { const msg = refusal(bad); diff --git a/src/app/features/scene/ridge/manifest.ts b/src/app/features/scene/ridge/manifest.ts index 9700e621..a54deb2b 100644 --- a/src/app/features/scene/ridge/manifest.ts +++ b/src/app/features/scene/ridge/manifest.ts @@ -33,8 +33,12 @@ export interface RidgeManifest { view: View; /** How the geometry file's blue channel maps to ln metres: `logD = logDMin + b x (logDMax - logDMin)`, b in 0..1. The red and green channels are the 'rt8' normal. */ encoding: { logDMin: number; logDMax: number }; - /** The largest camera offset from the bake centre the cards' linear slide fits, metres (ruling ridge-offset-range-fit). */ - camera: { rMaxM: number }; + /** + * The largest camera offset from the bake centre the cards' linear slide fits, metres (ruling ridge-offset-range-fit): `rMaxM` over every angle of the camera + * on its circle (the offset-only rotation mode), `rMaxForwardM` with the camera pushed forward along the view direction alone (the modes where the offset + * turns with the view), so never below `rMaxM`. + */ + camera: { rMaxM: number; rMaxForwardM: number }; /** Nearest first. */ cards: CardEntry[]; /** `tiles[t][i]` is card i in tile t, or null where the card holds nothing there. */ @@ -138,8 +142,11 @@ export function parseManifest(raw: unknown, dir: string): RidgeManifest { const logDMin = num(e.log_d_min, 'encoding.log_d_min'); const logDMax = num(e.log_d_max, 'encoding.log_d_max'); if (!(logDMax > logDMin)) fail('encoding', 'log_d_max not above log_d_min'); - const rMaxM = num(rec(r.camera, 'camera').r_max_m, 'camera.r_max_m'); + const cam = rec(r.camera, 'camera'); + const rMaxM = num(cam.r_max_m, 'camera.r_max_m'); if (!(rMaxM > 0)) fail('camera.r_max_m', 'not above 0'); + const rMaxForwardM = num(cam.r_max_forward_m, 'camera.r_max_forward_m'); + if (!(rMaxForwardM >= rMaxM)) fail('camera.r_max_forward_m', 'below camera.r_max_m'); const a = rec(r.attribution, 'attribution'); const id = str(p.id, 'place.id'); return { @@ -165,7 +172,7 @@ export function parseManifest(raw: unknown, dir: string): RidgeManifest { horizonRow: num(v.horizon_row, 'view.horizon_row'), }, encoding: { logDMin, logDMax }, - camera: { rMaxM }, + camera: { rMaxM, rMaxForwardM }, cards, tiles: grid, attribution: { diff --git a/src/app/features/scene/ridge/ridgeAssets.test.ts b/src/app/features/scene/ridge/ridgeAssets.test.ts index 7a062dda..6bca57de 100644 --- a/src/app/features/scene/ridge/ridgeAssets.test.ts +++ b/src/app/features/scene/ridge/ridgeAssets.test.ts @@ -31,7 +31,7 @@ export interface WireManifest { schema: number; bake_id: string; view: { ring_w: number; tile_w: number; tiles: number; apron: number }; - camera: { r_max_m: number }; + camera: { r_max_m: number; r_max_forward_m: number }; cards: unknown[]; tiles: (WireTile | null)[][]; } @@ -42,12 +42,12 @@ const bytesOf = (row: (WireTile | null)[]): number => /** * N and the lit bytes of the worst run of N consecutive tiles (4 bytes x (tile_w + 2) x band rows, per card), cyclic: the same N and the same sum as - * export.py `run_tiles` and `resident_bytes`, recomputed from the manifest alone. The nearest distance is card 0's smallest over the tiles. + * export.py `run_tiles` and `resident_bytes`, recomputed from the manifest alone, at the larger of the two offsets the bake ships. The nearest distance is card 0's smallest over the tiles. */ export function residentBytes(m: WireManifest): { n: number; bytes: number } { const { tiles, tile_w } = m.view; const rmin = Math.min(...m.tiles.flatMap((row) => (row[0] ? [row[0].distance_m] : []))); - const n = runTiles({ tiles }, HFOV_MAX_DEG, m.camera.r_max_m, rmin); + const n = runTiles({ tiles }, HFOV_MAX_DEG, Math.max(m.camera.r_max_m, m.camera.r_max_forward_m), rmin); const per = m.tiles.map((row) => row.reduce((a, e) => a + (e ? 4 * (tile_w + 2) * e.h : 0), 0)); let worst = 0; for (let t = 0; t < tiles; t += 1) { @@ -178,6 +178,7 @@ describe('the committed ridge assets', () => { it('carries the offset bound and a distance for every tile a card holds', () => { expect(raw.camera.r_max_m).toBeGreaterThan(0); + expect(raw.camera.r_max_forward_m).toBeGreaterThanOrEqual(raw.camera.r_max_m); raw.tiles.forEach((row) => row.forEach((e) => e && expect(e.distance_m).toBeGreaterThan(0))); raw.cards.forEach((_, i) => expect(raw.tiles.some((row) => row[i] !== null)).toBe(true)); }); @@ -252,7 +253,7 @@ describe('sizeGate', () => { schema: 3, bake_id: 'x', view: { ring_w: 6400, tile_w: 6400 / tiles, tiles, apron: 2 }, - camera: { r_max_m: 50 }, + camera: { r_max_m: 50, r_max_forward_m: 50 }, cards: Array.from({ length: cards }, () => ({})), tiles: Array.from({ length: tiles }, () => Array.from({ length: cards }, () => entry(perTile / cards, h))