mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
fix(navara): batch contours and order ground overlays
Batch consecutive disjoint installation outlines to avoid three stencil draws per feature. Preserve overlapping volumes, material order and local precision. Delete the public effect handle correctly during teardown. Keep imagery below ground classifications and glyphs in every activation order, including minimal mode without tone mapping. Exclude fully offscreen ground volumes from the screen candidate grid. Full unit/allocation, boundaries, formatting and keyless builds pass. Browser checks cover contour coverage, bounded colour differences, a missing-contour negative control, real pass order, sprite alpha and FIRMS glows. Whole-wave performance acceptance remains separate from this implementation checkpoint.
This commit is contained in:
1 parent
9ba5a3aba9
commit
8328aab779
12 files changed
+320
-31
No files matched your search
@@ -19,10 +19,10 @@ export function viewFrame(frame, matrix, out) {
|
||||
/** Conservative clip bounds, including a camera inside/crossing the volume. */
|
||||
export function groundClipBounds(frame, view, projection, out) {
|
||||
const p = projection.elements;
|
||||
let x0 = 1,
|
||||
y0 = 1,
|
||||
x1 = -1,
|
||||
y1 = -1,
|
||||
let x0 = Infinity,
|
||||
y0 = Infinity,
|
||||
x1 = -Infinity,
|
||||
y1 = -Infinity,
|
||||
front = 0,
|
||||
behind = 0;
|
||||
for (let i = 0; i < 8; i++) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { PerspectiveCamera } from 'three';
|
||||
import { groundClipBounds } from './navaraGroundGeometry.js';
|
||||
|
||||
test('ground volumes wholly outside a screen edge do not enter the candidate grid', () => {
|
||||
const camera = new PerspectiveCamera(60, 1.6, 1, 1000);
|
||||
const frame = { radius: 1, floor: -1, ceiling: 1 };
|
||||
for (const [x, y] of [
|
||||
[100, 0],
|
||||
[-100, 0],
|
||||
[0, 100],
|
||||
[0, -100],
|
||||
]) {
|
||||
const view = new Float64Array([x, y, -10, 1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
||||
assert.deepEqual(
|
||||
[
|
||||
...groundClipBounds(
|
||||
frame,
|
||||
view,
|
||||
camera.projectionMatrix,
|
||||
new Float64Array(4),
|
||||
),
|
||||
],
|
||||
[2, 2, 2, 2],
|
||||
`offscreen volume at ${x}, ${y}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs/promises';
|
||||
|
||||
// EffectDesc gives insertAfter priority, then tries insertBefore. Check the
|
||||
// actual renderer declarations under every activation order, including the
|
||||
// minimal look, whose pipeline has no toneMapping anchor.
|
||||
const declarations = [
|
||||
['gevRecentImagery', '../../recentImagery/render/navaraGround.js'],
|
||||
['gevEarthquakeGround', '../../earthquakes/render/navara.js'],
|
||||
['gevFirmsGround', '../../firms/render/navara.js'],
|
||||
['gevPreSharpenOverlay', '../../../globe/navara/overlay.js'],
|
||||
];
|
||||
const specs = await Promise.all(
|
||||
declarations.map(async ([key, path]) => {
|
||||
let source = await fs.readFile(new URL(path, import.meta.url), 'utf8');
|
||||
if (key === 'gevPreSharpenOverlay')
|
||||
source = source.split('class GevPreSharpenOverlayEffectDesc')[1];
|
||||
const anchors = (name) =>
|
||||
[
|
||||
...source
|
||||
.match(new RegExp(`static ${name} = \\[([^\\]]*)\\]`))[1]
|
||||
.matchAll(/'([^']+)'/g),
|
||||
].map((m) => m[1]);
|
||||
return {
|
||||
key,
|
||||
after: anchors('insertAfter'),
|
||||
before: anchors('insertBefore'),
|
||||
};
|
||||
}),
|
||||
);
|
||||
const permutations = (items) =>
|
||||
items.length
|
||||
? items.flatMap((item, i) =>
|
||||
permutations(items.filter((_, j) => i !== j)).map((rest) => [
|
||||
item,
|
||||
...rest,
|
||||
]),
|
||||
)
|
||||
: [[]];
|
||||
|
||||
test('all ground/glyph activation orders preserve imagery, classification and marker stages', () => {
|
||||
for (const toneMapping of [false, true])
|
||||
for (const activation of permutations(specs)) {
|
||||
const order = [
|
||||
'mrt',
|
||||
...(toneMapping ? ['toneMapping'] : []),
|
||||
'gevSharpen',
|
||||
'smaa',
|
||||
'gevOverlay',
|
||||
'final',
|
||||
];
|
||||
for (const spec of activation) {
|
||||
const after = spec.after.find((key) => order.includes(key));
|
||||
const before = spec.before.find((key) => order.includes(key));
|
||||
const index = after
|
||||
? order.indexOf(after) + 1
|
||||
: before
|
||||
? order.indexOf(before)
|
||||
: order.length;
|
||||
order.splice(index, 0, spec.key);
|
||||
}
|
||||
assert.deepEqual(
|
||||
order.filter((key) => specs.some((s) => s.key === key)),
|
||||
declarations.map(([key]) => key),
|
||||
`${toneMapping}: ${activation.map((s) => s.key)}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user