Cut duplicated and dead code across the engines, the layers and the QA scripts

- src/geo drops the ported debug argument checks and the tests that
  bitExact already covers; package boundaries accept a directory entry,
  so src/geo/ is listed once per group.
- Cesium no longer carries movers and lines nobody draws with: they are
  optional engine capabilities. The fake engine and the Cesium camera use
  the shared cameraMath; unused contract tables, clock.ticked, the
  'finest' surface detail and Navara click statistics are gone.
- ALPR keeps one overlay core and one presentation model for both
  engines, bikeshare one station bookkeeping, the Navara ground effects
  one definition helper; image atlases, view centres, mover banks and
  colours are shared.
- The legacy switch route, the clock offset and rate controls and other
  unused exports are removed.
- The acceptance runs the Navara draw, geo import and scope checks;
  scenarios use the harness switch and page helpers; the main chunk
  check keeps the size budget only and runs once in CI.
This commit is contained in:
German Khokhlov committed 2026-11-05 13:32:39 +04:00
1 parent c502404e1d
commit 7abf74518f
272 files changed
+4828 -10213

No files matched your search

-2
View File
@@ -9,8 +9,6 @@ export function createFirmsNavaraRenderer(
engine,
{ view: nativeView, EffectDesc, NavaraEffect, id = 'local-firms' } = {},
) {
if (!engine?.movers || !nativeView?.camera || !EffectDesc || !NavaraEffect)
throw new TypeError('FIRMS requires a Navara view');
const display = createGroundCellDisplay(
engine,
{ view: nativeView, EffectDesc, NavaraEffect },
+41 -59
View File
@@ -3,7 +3,6 @@
// visible terrain and 3D tiles by one non-pickable classification pass. Only
// surface pixels take it, so the fire markers above stay untouched. The
// adapter has heatImagery.js's interface, so the layer drives both alike.
import { Effect, EffectAttribute } from 'postprocessing';
import {
DataTexture,
LinearFilter,
@@ -18,9 +17,9 @@ import {
groundSurfaceUniforms,
updateGroundSurface,
} from '../../shared/render/navaraGroundSurface.js';
import { defineGroundEffect } from '../../shared/render/navaraGroundEffect.js';
const KEY = 'gevFirmsHeat';
const registeredViews = new WeakSet();
// Row 0 of the raster is the north edge and column 0 is 180°W; the texture
// keeps that order (no flip), so v = 0 is north.
@@ -63,59 +62,45 @@ void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor) {
}
`;
function heatEffectClass(EffectDesc, NavaraEffect) {
return class FirmsHeatEffectDesc extends EffectDesc {
static key = KEY;
// Under the heat cells' and markers' place in the chain: after the other
// surface drapes, before sharpening, anti-aliasing and overlays.
static insertAfter = [
'gevEarthquakeGround',
'gevObservedWeather',
'gevNepalEvent',
'gevRecentImagery',
'toneMapping',
];
static insertBefore = [
'gevFirmsGround',
'gevPreSharpenOverlay',
'gevSharpen',
'smaa',
'fxaa',
'gevOverlay',
'final',
];
constructor(view, context, config) {
super(view, context, config);
this.owner = config[KEY].owner;
}
createPass() {
this.effect = new Effect('GevFirmsHeat', fragmentShader, {
attributes: EffectAttribute.CONVOLUTION,
uniforms: new Map([
...groundSurfaceUniforms(),
['tHeat', new Uniform(null)],
['uOpacity', new Uniform(1)],
['uInverseView', new Uniform(new Matrix4())],
]),
});
return new NavaraEffect(this.view.camera.raw, this.effect);
}
updateFrame() {
const owner = this.owner,
camera = this.view.camera.raw;
if (!this.effect || !owner.texture || !camera) return;
updateGroundSurface(this.effect, camera, this.ctx, this.find('mrt'));
const u = this.effect.uniforms;
u.get('tHeat').value = owner.texture;
u.get('uOpacity').value = owner.opacity;
u.get('uInverseView').value.copy(camera.matrixWorld);
}
onDestroy() {
this.effect?.dispose();
super.onDestroy();
}
};
}
const heatEffect = defineGroundEffect({
key: KEY,
name: 'GevFirmsHeat',
fragmentShader,
// Under the heat cells' and markers' place in the chain: after the other
// surface drapes, before sharpening, anti-aliasing and overlays.
insertAfter: [
'gevEarthquakeGround',
'gevObservedWeather',
'gevNepalEvent',
'gevRecentImagery',
'toneMapping',
],
insertBefore: [
'gevFirmsGround',
'gevPreSharpenOverlay',
'gevSharpen',
'smaa',
'fxaa',
'gevOverlay',
'final',
],
uniforms: () => [
...groundSurfaceUniforms(),
['tHeat', new Uniform(null)],
['uOpacity', new Uniform(1)],
['uInverseView', new Uniform(new Matrix4())],
],
update() {
const owner = this.owner,
camera = this.view.camera.raw;
if (!this.effect || !owner.texture || !camera) return;
updateGroundSurface(this.effect, camera, this.ctx, this.find('mrt'));
const u = this.effect.uniforms;
u.get('tHeat').value = owner.texture;
u.get('uOpacity').value = owner.opacity;
u.get('uInverseView').value.copy(camera.matrixWorld);
},
});
/**
* The raster as a texture: linear between pixels, wrapping across 180°. Its
@@ -148,10 +133,7 @@ export function createFirmsHeatDrape(
engine,
{ view, EffectDesc, NavaraEffect },
) {
if (!registeredViews.has(view)) {
view.registerEffect(KEY, heatEffectClass(EffectDesc, NavaraEffect));
registeredViews.add(view);
}
heatEffect.register(view, { EffectDesc, NavaraEffect });
const owner = { texture: null, opacity: 1 };
let raster = null,
show = true,
+11 -20
View File
@@ -1,4 +1,6 @@
// The real FIRMS PNGs in one engine mover atlas.
import { packImageAtlas } from '../../shared/render/imageAtlas.js';
const WHITE = Object.freeze([1, 1, 1, 1]);
const CELL = 60,
PAD = 2,
@@ -61,33 +63,22 @@ export function createFirmsSpriteBank(
}
};
function buildAtlas() {
const entries = [...loaded],
side = Math.ceil(Math.sqrt(entries.length));
const canvas = createCanvas();
canvas.width = side * CELL;
canvas.height = Math.ceil(entries.length / side) * CELL;
const context = canvas.getContext('2d');
if (!context) throw new Error('FIRMS atlas requires a canvas');
const cells = {},
lookup = new Map();
entries.forEach(([url, image], index) => {
const lookup = new Map();
const entries = [...loaded].map(([url, image], index) => {
const width = image.naturalWidth ?? image.width,
height = image.naturalHeight ?? image.height;
if (!(width > 0 && width <= BASE_SIZE && height === width))
throw new Error('FIRMS sprite dimensions are invalid');
const x = (index % side) * CELL + PAD,
y = Math.floor(index / side) * CELL + PAD;
context.drawImage(image, x, y);
const key = String(index);
cells[key] = [
x / canvas.width,
y / canvas.height,
(x + width) / canvas.width,
(y + height) / canvas.height,
];
lookup.set(url, { key, scale: width / BASE_SIZE });
return { key, image, width, height };
});
return { canvas, cells, lookup };
const atlas = packImageAtlas(entries, {
canvas: createCanvas(),
cell: CELL,
pad: PAD,
});
return { ...atlas, lookup };
}
async function flush() {
if (destroyed) return;