mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Draw the Bhote Koshi event through the renderer's ports and take it off the Cesium list
The flood is two draw sets per layer: the corridor's dashed halo and glowing core as draped lines (on tiles too under photoreal, on terrain otherwise), moved in the frame the event moves them, and the surge front as a clamped point. Only what changed is drawn again. Neither set is pickable, and height queries see through both, so the shot paths no longer list them to exclude. The before/after images are globe-port layers on either side of the split, over every layer drawn when they are added and draped on the globe's surface only, as before. The divider moves the globe port's split. An image that fails to load now takes the comparison (the pair, the divider and its labels) down and leaves the event on, where a failed provider used to fail the enable. Evidence heights come through heightsOf, whose batch can now count an answer from the bare ellipsoid as a miss, so points still fall back to their authored elevations without terrain. The camera, canvas and the event's vector maths go through the camera port, the renderer and src/geo (lerp joins geo/vector).
This commit is contained in:
1 parent
bddb890326
commit
6bbe35f232
6 files changed
+570
-312
No files matched your search
+10
-5
@@ -95,9 +95,10 @@ function portOptions({ against, exclude } = NO_OPTIONS, extra) {
|
||||
* @property {(position: {x: number, y: number, z: number}, options?: {exclude?: string[]}) => {x: number, y: number, z: number}|null} clampNow
|
||||
* `position` (ECEF) moved onto the drawn surface along the ellipsoid
|
||||
* normal, or null.
|
||||
* @property {(points: HeightPoint[], options?: HeightOptions) => Promise<Array<number|null>>} batch
|
||||
* @property {(points: HeightPoint[], options?: HeightOptions & {ellipsoidMisses?: boolean}) => Promise<Array<number|null>>} batch
|
||||
* Heights once the most detailed data has loaded; null per miss. A failed
|
||||
* query rejects.
|
||||
* query rejects. With `ellipsoidMisses`, an answer from the bare
|
||||
* ellipsoid (no terrain loaded there, or none at all) is a miss too.
|
||||
* @property {(positions: Array<{x: number, y: number, z: number}>, options?: {exclude?: string[]}) => Promise<Array<{x: number, y: number, z: number}|null>>} clampBatch
|
||||
* Clamped copies of `positions`; null per miss, rejecting as `batch` does.
|
||||
* @property {() => {surface: boolean, clamp: boolean}} supported
|
||||
@@ -163,9 +164,13 @@ function createHeights(host) {
|
||||
portOptions(options, { mostDetailed: true }),
|
||||
);
|
||||
let next = 0;
|
||||
return at.map((point) =>
|
||||
point ? metres(samples[next++]?.height) : null,
|
||||
);
|
||||
return at.map((point) => {
|
||||
if (!point) return null;
|
||||
const sample = samples[next++];
|
||||
if (options.ellipsoidMisses && sample?.source === 'ellipsoid')
|
||||
return null;
|
||||
return metres(sample?.height);
|
||||
});
|
||||
},
|
||||
|
||||
async clampBatch(positions, { exclude } = NO_OPTIONS) {
|
||||
|
||||
@@ -135,6 +135,31 @@ test('batch asks for the finest heights, null per miss and per bad point', async
|
||||
assert.deepEqual(options, { exclude: ['own:1'], mostDetailed: true });
|
||||
});
|
||||
|
||||
test('batch can count an answer from the bare ellipsoid as a miss', async () => {
|
||||
const sources = ['terrain', 'ellipsoid'];
|
||||
const { viewer, calls } = bound({
|
||||
async sampleHeight(points, options) {
|
||||
calls.push(['sample', points, options]);
|
||||
return points.map((_, i) => ({
|
||||
height: 120,
|
||||
confidence: 1,
|
||||
source: sources[i],
|
||||
lod: 'finest',
|
||||
}));
|
||||
},
|
||||
});
|
||||
const points = [AUSTIN, { lon: 0, lat: 0 }];
|
||||
assert.deepEqual(await heightsOf(viewer).batch(points), [120, 120]);
|
||||
assert.deepEqual(
|
||||
await heightsOf(viewer).batch(points, {
|
||||
against: 'terrain',
|
||||
ellipsoidMisses: true,
|
||||
}),
|
||||
[120, null],
|
||||
);
|
||||
assert.deepEqual(calls.at(-1)[2], { against: 'terrain', mostDetailed: true });
|
||||
});
|
||||
|
||||
test('batch misses everything without a renderer, and rejects when the query fails', async () => {
|
||||
assert.deepEqual(await heightsOf({}).batch([AUSTIN]), [null]);
|
||||
assert.deepEqual(await heightsOf({}).clampBatch([{ x: 1, y: 0, z: 0 }]), [
|
||||
|
||||
Reference in new issue
Block a user