feat: real fire on the boards, the LA office as a twin, and a night sky worth reading
The world stops being a simulation of California and starts being California. **THE PROMOTION GATE WAS THE FIRST COMMIT, BEFORE ANY ORANGE PIXEL EXISTED.** On today's live store the SoCal board contains 22 incidents. Every one has NULL acreage and fifteen are nameless LA County dispatch numbers. Drawn naively that is 22 orange marks over Los Angeles on a day nothing is burning — in a frame that contains no other warm colour, so one glyph would be the most salient object on the board and twenty-two would spend its credibility permanently. `acres >= 10 AND contained < 80 AND type != 'RX' AND last_seen = max(last_seen)` returns 0 on SoCal, exactly 5 on California, 0 on the Bay — same body, same day, three correct answers. The empty board is a deliverable, not a fallback: it says "No active fire on this board — CAL FIRE and WFIGS, just now", states that 21 records were gated and why, lists the largest fires burning OUTSIDE the frame with distances, and counts the hot pixels it is deliberately not drawing. **The privacy leak is structurally impossible rather than carefully avoided.** cloud-1 serves a projection; the four home-relative columns never leave that box. `observations.threat` was the one that nearly got through — it is `(16/distance)^2 x log10(acres) x momentum x containment x wind-alignment`, so with acreage and containment public it inverts to a distance circle around a house and three fires give an intersection. A grep of the built bundle for distance_km, bearing_deg, threat, 7762 and the street name returns nothing. **Deliberately not used, and both would have produced a confident wrong answer:** the store's `air` table retains only the last parameter of each poll, so all 78 rows read "Good" while the live feed reports ozone 101 "Unhealthy for Sensitive Groups" — haze driven off it would clear the sky during a smoke event. And `weather` is written only inside the NWS alerts loop, so a quiet day stores no wind at all. Tera's own per-region NWS wind is already correct and already what the clouds drift on. Satellite detections are drawn as evidence and never as incidents. The permanent industrial heat source 4.7 km from the owner's house is flagged persistent and dropped, asserted by a test that first proves it is present in the fixture. MODIS integer confidence and VIIRS string confidence are branched on `sat`. **The LA office is a twin.** Its entire authored second storey — Model Loft, Model Bay, The Materials Room, 430 lines nobody had ever stood in — is reachable on foot: a walker crosses level-1 to level-2 in 73 fixed steps, floorY 0 to 5, verified against the real pack rather than a synthetic plan. Its two studio devices read real hardware through a field-allowlisted bridge: mute, volume and reachability only. Never level, because there is no passive level upstream and obtaining one would record a room with people in it. Never dB, because upstream is gainPct across four different native scales. The bridge refuses all writes. Fixed at its root: an anonymous visitor was getting permanently at-rest instruments backing off against a 401. The tier moves into `createDeviceSource`, so anon gets the living simulator three file headers already promised. **Item 8 is closed, not fixed, and the correction is the point.** The Bay Area "stutter" was GPU power management — the card sat at 500 MHz of 2725 through every run that reproduced it, 4096/2048/1024/256 shadow maps all render in 1.21-1.31 ms, and two consecutive runs over a byte-identical dist gave 33.4 then 16.7. The allowance is removed and the cell is back to 16.7. Geometry is the gate; frame time is advisory. Item 7 was re-scoped after measuring: 1,069,006 of the Bay Area's 2,265,056 triangles were the second submission of the same buildings into the shadow pass. Mobile now has its own triangle caps and bay-area mobile draws 1,266,096. Also: bridges and the freeway corridor light up at night as emission, not lights — 1,614 deck lamps and 18 tower heads on the Bay in two draw calls. The single change that made US-101 legible was moving its edge lines from the lit material to the unlit one: retroreflective paint, the argument the SFO night frame already makes. California went 21,991 lamps to 4,051, clustered at the 17 town districts, because a rural interurban corridor genuinely is unlit. Tests 1137 -> 1340, server 280. All ten budget cells pass on first attempt with no cap raised. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+108
-4
@@ -818,6 +818,27 @@ export interface FlightLayer {
|
||||
* up advancing time twice as fast.
|
||||
*/
|
||||
tick(): void;
|
||||
/**
|
||||
* How far the camera is from **what it is looking at**, in scene units.
|
||||
*
|
||||
* The missing input, and the one that turns the glyph's ceiling from a
|
||||
* constant into a rule. `glyphScale` is handed the distance to the *aircraft*,
|
||||
* which is the right ruler only when everything in frame is equally far away;
|
||||
* at a chapter pose the landmark is a few units off and the traffic is a few
|
||||
* thousand, so the floor fires hard on the aeroplane and not at all on the
|
||||
* thing beside it. See `GLYPH_FOCUS_HEADROOM`.
|
||||
*
|
||||
* A setter and not an `OrbitControls` reference, deliberately. This layer must
|
||||
* keep working in an office sky, in a chase camera and under a test with no
|
||||
* controls at all, and a layer that reaches into the camera rig is a layer
|
||||
* that can only be used by the rig it was written against. The caller already
|
||||
* has the number: `camera.position.distanceTo(controls.target)`.
|
||||
*
|
||||
* Not calling it at all is a supported state and reproduces exactly the
|
||||
* behaviour this layer had before it existed — the ceiling stays the flat
|
||||
* `GLYPH_MAX_SCALE`.
|
||||
*/
|
||||
setFocusDistance(distance: number): void;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
@@ -994,6 +1015,44 @@ const GLYPH_MIN_SCREEN_FRACTION = 0.016;
|
||||
*/
|
||||
const GLYPH_MAX_SCALE = 52;
|
||||
|
||||
/**
|
||||
* How many times larger than legible-at-the-focus-distance an aeroplane may be
|
||||
* drawn.
|
||||
*
|
||||
* This is the complete fix the paragraph above defers, and it is the same rule
|
||||
* as the floor with the ruler corrected. The floor asks "how big does this have
|
||||
* to be to read from `distance`"; the ceiling now asks "how big is anything the
|
||||
* viewer is actually looking at", and lets the glyph collapse toward its
|
||||
* authored size whenever the answer is "very close", at any aircraft range.
|
||||
*
|
||||
* What that does at the two poses that matter, at a 42-degree field:
|
||||
*
|
||||
* - **Whole board, California corridor.** The camera is ~1,160 units out and
|
||||
* the aircraft are 900-1,400 away, so the focus distance and the aircraft
|
||||
* distance are the same number to within a third. The ceiling lands near
|
||||
* 34 x HEADROOM, far above the ~34 the floor asks for, and the glyph is
|
||||
* untouched — which is required, because at a whole-board pose the floor is
|
||||
* right about everything in frame.
|
||||
* - **The Golden Gate chapter.** The camera settles ten to twenty units off
|
||||
* the bridge while the traffic over the Pacific is two thousand away.
|
||||
* `legible(focus)` is under 1, the ceiling collapses to HEADROOM itself, and
|
||||
* the airliner is drawn at a few times its authored 0.42 units instead of
|
||||
* 52 x it. That is the two-and-a-half-times-the-main-span defect, gone
|
||||
* rather than merely reduced.
|
||||
*
|
||||
* 3 rather than 2 or 4, chosen by shooting the four framings this has to serve
|
||||
* and reading the pictures. At 2 the aeroplanes over the Bay are present but
|
||||
* their heading stops being readable at chapter zoom, which is half of what the
|
||||
* glyph is for. At 4 the aircraft is still visibly larger than a container ship
|
||||
* beside it at the SoMa chapter. 3 keeps the heading legible and puts the glyph
|
||||
* under the landmarks it shares a frame with.
|
||||
*
|
||||
* `GLYPH_MAX_SCALE` stays as an absolute backstop above this: a caller that
|
||||
* never sets a focus distance, or one that sets a nonsensical one, still cannot
|
||||
* produce a state-sized aeroplane.
|
||||
*/
|
||||
const GLYPH_FOCUS_HEADROOM = 3;
|
||||
|
||||
/**
|
||||
* The radius of the sphere a pointer actually has to hit, in glyph lengths.
|
||||
*
|
||||
@@ -1393,6 +1452,13 @@ export function createFlightLayer(world: World): FlightLayer {
|
||||
* authored size, which is the size they were before any of this existed.
|
||||
*/
|
||||
let viewer: THREE.PerspectiveCamera | null = null;
|
||||
/**
|
||||
* The camera's distance to what it is looking at, in scene units, or `null`
|
||||
* until a caller says. `null` reproduces the behaviour this layer had before
|
||||
* the setter existed — the ceiling is the flat `GLYPH_MAX_SCALE` — which is
|
||||
* what an office sky, a chase camera and every test with no controls get.
|
||||
*/
|
||||
let focusDistance: number | null = null;
|
||||
|
||||
/**
|
||||
* One material per altitude band, built on demand.
|
||||
@@ -1886,7 +1952,9 @@ export function createFlightLayer(world: World): FlightLayer {
|
||||
* geometry file drew, held at a legible size, and not a stretched one.
|
||||
*/
|
||||
if (viewer !== null) {
|
||||
track.mesh.scale.setScalar(glyphScale(viewer.position.distanceTo(track.head), viewer.fov));
|
||||
track.mesh.scale.setScalar(
|
||||
glyphScale(viewer.position.distanceTo(track.head), viewer.fov, focusDistance ?? undefined),
|
||||
);
|
||||
}
|
||||
// A heading of 0 is north, and north is -z, so an aircraft whose nose is
|
||||
// modelled along +z has to be turned all the way round before the compass
|
||||
@@ -2055,6 +2123,9 @@ export function createFlightLayer(world: World): FlightLayer {
|
||||
pickables,
|
||||
update,
|
||||
tick,
|
||||
setFocusDistance(distance) {
|
||||
focusDistance = Number.isFinite(distance) && distance > 0 ? distance : null;
|
||||
},
|
||||
dispose() {
|
||||
geo.dispose();
|
||||
for (const m of materials.values()) m.dispose();
|
||||
@@ -2090,12 +2161,45 @@ export function createFlightLayer(world: World): FlightLayer {
|
||||
* caller in the middle of setting one up, and neither is a reason for the sky
|
||||
* to disappear.
|
||||
*/
|
||||
export function glyphScale(distance: number, fovDegrees: number): number {
|
||||
export function glyphScale(
|
||||
distance: number,
|
||||
fovDegrees: number,
|
||||
focusDistance?: number,
|
||||
): number {
|
||||
if (!Number.isFinite(distance) || !Number.isFinite(fovDegrees)) return 1;
|
||||
if (distance <= 0 || fovDegrees <= 0 || fovDegrees >= 180) return 1;
|
||||
const legible = legibleScale(distance, fovDegrees);
|
||||
/*
|
||||
* The third argument is optional and omitting it must reproduce the previous
|
||||
* answer exactly — not approximately. Twenty existing assertions in
|
||||
* `src/test/render/glyphScale.test.ts` pin the two-argument behaviour, and a
|
||||
* ceiling that moved by a hair under a refactor would be the kind of silent
|
||||
* visual drift this whole function exists to prevent. So the focus-aware
|
||||
* ceiling is computed only when a focus distance was actually supplied, and
|
||||
* `GLYPH_MAX_SCALE` remains the backstop above it either way.
|
||||
*/
|
||||
const ceiling =
|
||||
focusDistance !== undefined && Number.isFinite(focusDistance) && focusDistance > 0
|
||||
? Math.min(
|
||||
GLYPH_MAX_SCALE,
|
||||
Math.max(1, legibleScale(focusDistance, fovDegrees) * GLYPH_FOCUS_HEADROOM),
|
||||
)
|
||||
: GLYPH_MAX_SCALE;
|
||||
return Math.min(ceiling, Math.max(1, legible));
|
||||
}
|
||||
|
||||
/**
|
||||
* How many times the authored glyph a distance of `d` needs to hold
|
||||
* `GLYPH_MIN_SCREEN_FRACTION` of the frame. Unclamped on purpose: the floor and
|
||||
* the ceiling clamp it in opposite directions and both want the raw number.
|
||||
*
|
||||
* `2·d·tan(fov/2)` is the world-space height of the frustum at that distance —
|
||||
* the ruler the frame is measured with — so the glyph's share of the screen is
|
||||
* its length over that.
|
||||
*/
|
||||
function legibleScale(distance: number, fovDegrees: number): number {
|
||||
const frustumHeight = 2 * distance * Math.tan((fovDegrees * Math.PI) / 360);
|
||||
const legible = (GLYPH_MIN_SCREEN_FRACTION * frustumHeight) / AIRLINER_LENGTH;
|
||||
return Math.min(GLYPH_MAX_SCALE, Math.max(1, legible));
|
||||
return (GLYPH_MIN_SCREEN_FRACTION * frustumHeight) / AIRLINER_LENGTH;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user