mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +00:00
Fix the review findings across the engines, layers, data and QA
Navara now matches Cesium where the review found it diverging: a flight holds the camera inputs, camera.changed counts turns as Cesium does, render requests made during a frame survive it, follow pinches zoom, ground widths follow the pixel ratio and Cyber sonar reaches glyph caches and models. On Cesium, a staged imagery swap keeps loading tiles, setView replaces a running flight, and a cleared weather detail goes away. The contract gains MoverSet.failed, maps.terrainRevision, render.maxTextureSize and surface.sampleTerrainMostDetailed on every engine, so layers retry failed models, key road heights by terrain, size weather textures to the GPU and place Bhote Koshi cards on detailed terrain. Engine switches keep the live view, follows, focus, layer options and cards: a pick hands over the exact pose, applies no address options and pans no carried-over card; a history visit still applies its entry. Layers put GhostMaps pins, cable landings, OSM Places and directions on the measured surface without per-frame sampling, draw the Cockpit contact dot, hide disabled CCTV on attach, and keep ALPR running outside secure contexts. KML imports draw raised polygon fills, rotated and coloured ground overlays and north-referenced icon headings, and report files with nothing to draw. QA scripts read the contract instead of Cesium internals (test:track is 109/109 again), wait for the camera to rest before clicking, and give cold switches and parked engines realistic time. Docs follow the code.
This commit is contained in:
1 parent
69fbf5b38d
commit
0ef29781e5
276 files changed
+7217
-1517
No files matched your search
+48
-12
@@ -44,6 +44,8 @@ const SCENE_REVEAL_RENDER_HOLD = 'bhote-koshi-scene-beat-reveal';
|
||||
const SCENE_PATH_RENDER_HOLD = 'bhote-koshi-scene-path-travel';
|
||||
const SCENE_MEDIA_MIN_PLAYBACK_SECONDS = 6;
|
||||
const SCENE_MEDIA_EXIT_SECONDS = 0.65;
|
||||
// A camera this near an evidence anchor has the valley's terrain loaded.
|
||||
const EVIDENCE_REFINE_M = 25_000;
|
||||
const BHOTE_EVENT_ACCENT = WORLD_OVERLAY_STYLE.accent;
|
||||
const FLOOD_COLOR = () =>
|
||||
Cesium.Color.fromCssColorString('#d8954e').withAlpha(0.68);
|
||||
@@ -1050,6 +1052,9 @@ export function createBhoteKoshiEventLayer({
|
||||
let _evidenceTimeline = [];
|
||||
let _evidenceAnchors = [];
|
||||
let _evidenceFrameSlots = [];
|
||||
let _evidenceEntries = [];
|
||||
// Evidence anchors at the pack's elevations (no terrain sample).
|
||||
const _fallbackAnchors = new WeakSet();
|
||||
let _evidenceVideo = null;
|
||||
let _evidenceVideoIndex = -1;
|
||||
let _evidenceVideoReady = false;
|
||||
@@ -1198,14 +1203,17 @@ export function createBhoteKoshiEventLayer({
|
||||
: [];
|
||||
let sampled = null;
|
||||
try {
|
||||
sampled =
|
||||
_engine && !_viewer
|
||||
? observations.map(({ lon, lat }) => ({
|
||||
height: _engine.surface.terrainHeight(
|
||||
Cesium.Cartographic.fromDegrees(lon, lat),
|
||||
),
|
||||
}))
|
||||
: await terrainSampler(_viewer, observations, { signal });
|
||||
if (_engine && !_viewer) {
|
||||
const revision = _engine.maps.terrainRevision();
|
||||
const heights = await _engine.surface.sampleTerrainMostDetailed(
|
||||
observations.map(({ lon, lat }) =>
|
||||
Cesium.Cartographic.fromDegrees(lon, lat),
|
||||
),
|
||||
);
|
||||
// Heights of a terrain replaced meanwhile are not the one shown.
|
||||
if (_engine.maps.terrainRevision() === revision)
|
||||
sampled = heights.map((height) => ({ height }));
|
||||
} else sampled = await terrainSampler(_viewer, observations, { signal });
|
||||
} catch (error) {
|
||||
if (error?.name === 'AbortError') throw error;
|
||||
console.warn(
|
||||
@@ -1217,14 +1225,35 @@ export function createBhoteKoshiEventLayer({
|
||||
return observations.map((observation, index) => {
|
||||
const sampledHeight = Number(sampled?.[index]?.height);
|
||||
const fallbackHeight = Number(observation.fallbackElevationM) || 0;
|
||||
return Cesium.Cartesian3.fromDegrees(
|
||||
const anchor = Cesium.Cartesian3.fromDegrees(
|
||||
observation.lon,
|
||||
observation.lat,
|
||||
(Number.isFinite(sampledHeight) ? sampledHeight : fallbackHeight) + 18,
|
||||
);
|
||||
if (!Number.isFinite(sampledHeight)) _fallbackAnchors.add(anchor);
|
||||
return anchor;
|
||||
});
|
||||
}
|
||||
|
||||
// An anchor at the pack's elevation, on Navara, moves onto the terrain
|
||||
// loaded under a near camera (the valley's, not an overview tile's), in
|
||||
// place, so the card's cull position follows.
|
||||
function refineEvidenceAnchor(index) {
|
||||
const anchor = _evidenceAnchors[index];
|
||||
if (!anchor || _viewer || !_engine || !_fallbackAnchors.has(anchor))
|
||||
return anchor || null;
|
||||
const live = _engine.camera.livePosition;
|
||||
if (!live || Cesium.Cartesian3.distance(live, anchor) > EVIDENCE_REFINE_M)
|
||||
return anchor;
|
||||
const { lon, lat } = _evidenceTimeline[index]?.observation ?? {};
|
||||
const height = Number.isFinite(lon)
|
||||
? _engine.surface.terrainHeight(Cesium.Cartographic.fromDegrees(lon, lat))
|
||||
: undefined;
|
||||
if (Number.isFinite(height))
|
||||
Cesium.Cartesian3.fromDegrees(lon, lat, height + 18, undefined, anchor);
|
||||
return anchor;
|
||||
}
|
||||
|
||||
function evidencePositionGetter(index, breadcrumb = false) {
|
||||
return () => {
|
||||
if (!_enabled) return null;
|
||||
@@ -1245,13 +1274,13 @@ export function createBhoteKoshiEventLayer({
|
||||
_sceneMediaPlaybackCompletedBeatId
|
||||
)
|
||||
return null;
|
||||
return _evidenceAnchors[index] || null;
|
||||
return refineEvidenceAnchor(index);
|
||||
}
|
||||
const activeIndex = activeEvidenceIndex(_progress, _evidenceTimeline);
|
||||
if (breadcrumb ? index >= activeIndex : index !== activeIndex)
|
||||
return null;
|
||||
if (!breadcrumb && index === _embeddedEvidenceIndex) return null;
|
||||
return _evidenceAnchors[index] || null;
|
||||
return refineEvidenceAnchor(index);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2448,7 +2477,12 @@ export function createBhoteKoshiEventLayer({
|
||||
placement: 'above',
|
||||
});
|
||||
}
|
||||
overlayHost.setEntries(BHOTE_KOSHI_OVERLAY_SOURCE_ID, entries, {
|
||||
_evidenceEntries = entries;
|
||||
restoreEvidenceEntries();
|
||||
}
|
||||
|
||||
function restoreEvidenceEntries() {
|
||||
overlayHost.setEntries(BHOTE_KOSHI_OVERLAY_SOURCE_ID, _evidenceEntries, {
|
||||
cohortLimit: 16,
|
||||
collisionCapacity: 12,
|
||||
moving: false,
|
||||
@@ -3557,6 +3591,7 @@ export function createBhoteKoshiEventLayer({
|
||||
return;
|
||||
}
|
||||
createSplitControl(_event);
|
||||
restoreEvidenceEntries();
|
||||
syncPresentationMode();
|
||||
attachCameraInputRelease();
|
||||
attachEvidenceCardActivation();
|
||||
@@ -3739,6 +3774,7 @@ export function createBhoteKoshiEventLayer({
|
||||
_corridorPositionCache = { visibleCount: -1, positions: [] };
|
||||
_evidenceTimeline = [];
|
||||
_evidenceAnchors = [];
|
||||
_evidenceEntries = [];
|
||||
_cinematicKeyframes = [];
|
||||
for (const slot of _evidenceFrameSlots) {
|
||||
closeFrame(slot.frame);
|
||||
|
||||
Reference in new issue
Block a user