Place every surface-bound layer through the shared placement

Import pins, infrastructure, ALPR, directions markers, bikeshare and the
Bhote Koshi story use createSurfacePoints instead of their own sampling,
budgets and partial triggers; ground snap, the mesh floor sampler,
traffic, transit, Street Level, the camera ground guard, wildlife and the
cockpit host read heights through readSurface or surfaceTriggers.
Per-layer offsets and floor policies stay as options. The import no
longer re-places pins on every camera move from the UI.

Calls to engine.surface outside src/globe go from 41 sampling calls to
10, each a raycast, a one-shot fly-to height or an asynchronous detailed
sample.
This commit is contained in:
German Khokhlov committed 2026-11-10 16:13:06 +04:00
1 parent ef104aaac3
commit 82ed68f443
31 files changed
+530 -568

No files matched your search

+6 -3
View File
@@ -1,3 +1,4 @@
import { readSurface } from '../globe/surfacePlacement.js';
import { bindOverlayHost } from '../overlays/bindOverlayHost.js';
import { worldOverlayFor } from '../overlays/worldOverlay.js';
import { waitForSignal } from '../sources/requestDeadline.js';
@@ -1250,7 +1251,9 @@ export function createBhoteKoshiEventLayer({
return anchor;
const { lon, lat } = _evidenceTimeline[index]?.observation ?? {};
const height = Number.isFinite(lon)
? _engine.surface.terrainHeight(Cesium.Cartographic.fromDegrees(lon, lat))
? readSurface(_engine, Cesium.Cartographic.fromDegrees(lon, lat), {
prefer: 'terrain',
})
: undefined;
if (Number.isFinite(height))
Cesium.Cartesian3.fromDegrees(lon, lat, height + 18, undefined, anchor);
@@ -1626,7 +1629,7 @@ export function createBhoteKoshiEventLayer({
// Sample once while preparing the shot, never from an animation frame.
try {
height =
_engine?.surface?.sampleHeight?.(position) ??
readSurface(_engine, position, { prefer: 'scene' }) ??
_viewer?.scene?.sampleHeight?.(
position,
[_floodCore, _floodHalo, _surgePoint].filter(Boolean),
@@ -1634,7 +1637,7 @@ export function createBhoteKoshiEventLayer({
} catch {}
if (!Number.isFinite(height))
height =
_engine?.surface?.terrainHeight(position) ??
readSurface(_engine, position, { prefer: 'terrain' }) ??
_viewer?.scene?.globe?.getHeight?.(position);
}
if (!Number.isFinite(height)) height = point.fallbackElevationM;