mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 02:32:18 +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
@@ -11,6 +11,7 @@ import {
|
||||
import { alprMarkers, createAlprMarkerSet } from './markerState.js';
|
||||
import { fakeDrawPort } from '../../testSupport/fakeDrawPort.mjs';
|
||||
import { bindFakeCesiumScene } from '../../testSupport/fakeCesiumScene.mjs';
|
||||
import { rendererOf } from '../../render/rendererOf.js';
|
||||
|
||||
function harness(t, count = 2, { floor = null } = {}) {
|
||||
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.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