mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(alpr): anchors wait for the surface heights answer from, as before
The overlay replaced floor anchors with sampled surface heights only once the surface had settled. On Cesium that was the globe's terrain while the globe was shown, otherwise every shown 3D tileset; on the globe port it became the terrain and the drawn base tileset together. It now asks the globe port for 'surface', the same rule.
This commit is contained in:
1 parent
667ca632ed
commit
1c036957cd
2 files changed
+28
-1
No files matched your search
@@ -138,9 +138,10 @@ export function createAlprOverlay({
|
|||||||
/** Whether the visible photoreal tiles (or globe) have finished streaming. */
|
/** Whether the visible photoreal tiles (or globe) have finished streaming. */
|
||||||
function surfaceSettled() {
|
function surfaceSettled() {
|
||||||
const globe = rendererOf(state.viewer)?.globe;
|
const globe = rendererOf(state.viewer)?.globe;
|
||||||
|
// The globe's terrain while it is shown, otherwise the shown 3D tiles.
|
||||||
// A viewer with no renderer of its own cannot say; its samples are
|
// A viewer with no renderer of its own cannot say; its samples are
|
||||||
// still checked against the floor.
|
// still checked against the floor.
|
||||||
return !globe || (globe.isSettled('terrain') && globe.isSettled('tiles'));
|
return !globe || globe.isSettled('surface');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
import { alprMarkers, createAlprMarkerSet } from './markerState.js';
|
import { alprMarkers, createAlprMarkerSet } from './markerState.js';
|
||||||
import { fakeDrawPort } from '../../testSupport/fakeDrawPort.mjs';
|
import { fakeDrawPort } from '../../testSupport/fakeDrawPort.mjs';
|
||||||
import { bindFakeCesiumScene } from '../../testSupport/fakeCesiumScene.mjs';
|
import { bindFakeCesiumScene } from '../../testSupport/fakeCesiumScene.mjs';
|
||||||
|
import { rendererOf } from '../../render/rendererOf.js';
|
||||||
|
|
||||||
function harness(t, count = 2, { floor = null } = {}) {
|
function harness(t, count = 2, { floor = null } = {}) {
|
||||||
const previousImage = globalThis.Image;
|
const previousImage = globalThis.Image;
|
||||||
@@ -334,3 +335,28 @@ test('a bearing wedge is plain ECEF at the apex and its two far corners', () =>
|
|||||||
assert.ok(heights.some((h) => Math.abs(h - 160) < 1e-6));
|
assert.ok(heights.some((h) => Math.abs(h - 160) < 1e-6));
|
||||||
assert.ok(heights.slice(1).some((h) => Math.abs(h - 150) < 1e-6));
|
assert.ok(heights.slice(1).some((h) => Math.abs(h - 150) < 1e-6));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('anchors wait for the surface heights answer from: the globe’s terrain while shown, else the shown 3D tiles', (t) => {
|
||||||
|
const h = harness(t, 1, { floor: 150 });
|
||||||
|
const scene = h.state.viewer.scene;
|
||||||
|
h.state.viewer.camera.directionWC = Cesium.Cartesian3.UNIT_X;
|
||||||
|
scene.sampleHeightSupported = true;
|
||||||
|
scene.primitives = { length: 0, get: () => null };
|
||||||
|
let samples = 0;
|
||||||
|
scene.sampleHeight = () => (samples++, 172);
|
||||||
|
// The renderer's own `surface` rule; a non-base tileset still streaming
|
||||||
|
// over a hidden globe leaves it unsettled.
|
||||||
|
let surface = false;
|
||||||
|
const asked = new Set();
|
||||||
|
rendererOf(h.state.viewer).globe = {
|
||||||
|
isSettled: (kind) => (asked.add(kind), kind === 'surface' ? surface : true),
|
||||||
|
};
|
||||||
|
h.overlay.sync(h.records);
|
||||||
|
h.paint();
|
||||||
|
h.paint();
|
||||||
|
assert.equal(samples, 0, 'no samples while the surface streams');
|
||||||
|
assert.deepEqual([...asked], ['surface']);
|
||||||
|
surface = true;
|
||||||
|
h.paint();
|
||||||
|
assert.ok(samples > 0, 'sampled once it has loaded');
|
||||||
|
});
|
||||||
Reference in new issue
Block a user