mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Run the submarine cables layer's sweep and render requests through the frame port
The cables lifecycle and ingestion parts had left the Cesium allow-list but still hooked the scene's preRender event and asked the scene for renders directly. They now use the frame port.
This commit is contained in:
1 parent
6fc3c78e70
commit
6386034add
3 files changed
+23
-20
No files matched your search
@@ -6,6 +6,7 @@ import { MAP_STACKS } from '../mapStackController.js';
|
|||||||
import { fromDegrees, toLonLatH } from '../geo/ellipsoid.js';
|
import { fromDegrees, toLonLatH } from '../geo/ellipsoid.js';
|
||||||
import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs';
|
import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs';
|
||||||
import { fakeCameraPort } from '../testSupport/fakeCameraPort.mjs';
|
import { fakeCameraPort } from '../testSupport/fakeCameraPort.mjs';
|
||||||
|
import { fakeSceneFrame } from '../testSupport/fakeCesiumScene.mjs';
|
||||||
import {
|
import {
|
||||||
CABLE_LABEL_DEPTH_DECISION,
|
CABLE_LABEL_DEPTH_DECISION,
|
||||||
CABLE_OVERLAY_COLLISION_CAPACITY,
|
CABLE_OVERLAY_COLLISION_CAPACITY,
|
||||||
@@ -586,7 +587,10 @@ function createCableHarness({
|
|||||||
camera.port.cancelFlight = () => flights.push('cancel');
|
camera.port.cancelFlight = () => flights.push('cancel');
|
||||||
camera.port.flyTo = (destination, options) =>
|
camera.port.flyTo = (destination, options) =>
|
||||||
flights.push({ destination, options });
|
flights.push({ destination, options });
|
||||||
const { draw } = bindFakeDraw(viewer, { camera: camera.port });
|
const { draw } = bindFakeDraw(viewer, {
|
||||||
|
camera: camera.port,
|
||||||
|
frame: fakeSceneFrame(viewer),
|
||||||
|
});
|
||||||
layer.init(viewer);
|
layer.init(viewer);
|
||||||
/** The layer's live set named `name` (`lines`, `pins`, …). */
|
/** The layer's live set named `name` (`lines`, `pins`, …). */
|
||||||
const set = (name) =>
|
const set = (name) =>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { msg, t } from '../../i18n/index.js';
|
import { msg, t } from '../../i18n/index.js';
|
||||||
|
import { findFrame } from '../../render/rendererOf.js';
|
||||||
import { normalizeFeatures } from './geometry.js';
|
import { normalizeFeatures } from './geometry.js';
|
||||||
|
|
||||||
export function createIngestion({ state, parts, source }) {
|
export function createIngestion({ state, parts, source }) {
|
||||||
@@ -54,7 +55,7 @@ export function createIngestion({ state, parts, source }) {
|
|||||||
state._loadingLabel = '';
|
state._loadingLabel = '';
|
||||||
parts.rendering.updateVisibility();
|
parts.rendering.updateVisibility();
|
||||||
state._referenceSweepGate.markDirty();
|
state._referenceSweepGate.markDirty();
|
||||||
viewer?.scene?.requestRender?.();
|
findFrame(viewer)?.requestRender('submarine-cables');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// A stale or aborted load reports nothing: its failure belongs to a
|
// A stale or aborted load reports nothing: its failure belongs to a
|
||||||
// lifecycle the user already left.
|
// lifecycle the user already left.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { cameraOf } from '../../render/rendererOf.js';
|
import { cameraOf, findFrame, frameOf } from '../../render/rendererOf.js';
|
||||||
import {
|
import {
|
||||||
cableClassificationTypeForScene,
|
cableClassificationTypeForScene,
|
||||||
cableClassificationTypeForStack,
|
cableClassificationTypeForStack,
|
||||||
@@ -38,27 +38,25 @@ export function createLifecycle({ state, parts, source, mapStackEventTarget }) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (!state._preRenderRemover) {
|
if (!state._preRenderRemover) {
|
||||||
state._preRenderRemover = viewer.scene.preRender.addEventListener(
|
state._preRenderRemover = frameOf(viewer).on('preRender', () => {
|
||||||
() => {
|
// The camera is handed to the gate so tracked/orbit cameras — which
|
||||||
// The camera is handed to the gate so tracked/orbit cameras — which
|
// never emit moveEnd — reach the motion fallback. No render is
|
||||||
// never emit moveEnd — reach the motion fallback. No render is
|
// requested for a fallback sweep: it only fires while the camera is
|
||||||
// requested for a fallback sweep: it only fires while the camera is
|
// already moving, so frames are flowing by construction.
|
||||||
// already moving, so frames are flowing by construction.
|
if (
|
||||||
if (
|
!state._enabled ||
|
||||||
!state._enabled ||
|
!state._loaded ||
|
||||||
!state._loaded ||
|
!state._referenceSweepGate.shouldRun(eye)
|
||||||
!state._referenceSweepGate.shouldRun(eye)
|
)
|
||||||
)
|
return;
|
||||||
return;
|
parts.rendering.updateReferenceVisibility();
|
||||||
parts.rendering.updateReferenceVisibility();
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (!state._moveEndRemover) {
|
if (!state._moveEndRemover) {
|
||||||
state._moveEndRemover = cameraOf(viewer).on('moveEnd', () => {
|
state._moveEndRemover = cameraOf(viewer).on('moveEnd', () => {
|
||||||
if (!state._enabled) return;
|
if (!state._enabled) return;
|
||||||
state._referenceSweepGate.markDirty();
|
state._referenceSweepGate.markDirty();
|
||||||
viewer.scene.requestRender?.();
|
findFrame(viewer)?.requestRender('submarine-cables');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -73,7 +71,7 @@ export function createLifecycle({ state, parts, source, mapStackEventTarget }) {
|
|||||||
state._referenceSweepGate.markDirty();
|
state._referenceSweepGate.markDirty();
|
||||||
// The gate is dirty-only; ask for the frame its sweep needs in case the
|
// The gate is dirty-only; ask for the frame its sweep needs in case the
|
||||||
// camera is parked and nothing else is rendering.
|
// camera is parked and nothing else is rendering.
|
||||||
(viewer || state._viewer)?.scene?.requestRender?.();
|
findFrame(viewer || state._viewer)?.requestRender('submarine-cables');
|
||||||
void parts.ingestion.load(viewer || state._viewer);
|
void parts.ingestion.load(viewer || state._viewer);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user