mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 10:42:22 +00:00
Hand features the engine instead of guessing it from a viewer
No code outside src/globe calls isGlobeEngine or engineFromViewer any more (14 calls left before this). The features that still sniffed take the engine from their caller: - Projection and surface helpers (focus de-emphasis, icon orientation, ground snap, the mesh floor sampler, ground picks) take the engine; the engine view's scene carries its projector instead of registering itself as a viewer. - Credits go only through engine.credits, so annotations and layers share one OSM credit state on Cesium too (it could show twice). - The annotation board and the resolver work on the engine: camera assists, visibility and picks go through engine.camera, engine.projector and src/geo, without Cesium. - The Recent Imagery box tool has one implementation for both engines, on capture-phase canvas pointer events with the layer's engine.ground preview; the Navara copy goes. On Cesium the preview outline is solid now, as on Navara. - Scene interactions take the engine, and the render governor has an engine variant beside the Cesium one. Remaining engine-specific features stay behind explicit seams until the contract covers them: the draw tool's Cesium surface (stock click actions cannot be suspended), the annotation drapes (animated materials), share follow, Cesium post effects and cyber sonar, and data packs (meshes). Coupling: Cesium-importing files fall from 31 to 27, `viewer` lines from 1367 to 1234, engine sniffing calls from 14 to 0.
This commit is contained in:
1 parent
406dd9122e
commit
f1ec9d4a22
61 files changed
+823
-1230
No files matched your search
@@ -291,7 +291,6 @@ export function createBhoteKoshiLocatorLayer({
|
||||
let _native = null;
|
||||
let _pausedApproach = null;
|
||||
const cameraForScene = () => _engine?.camera ?? _viewer?.camera;
|
||||
const creditTarget = () => _engine ?? _viewer;
|
||||
const requestRender = (reason) =>
|
||||
_engine?.kind === 'navara'
|
||||
? _engine.render.request(reason)
|
||||
@@ -1049,8 +1048,8 @@ export function createBhoteKoshiLocatorLayer({
|
||||
if (!_dataSource) return;
|
||||
if (_viewer) _viewer.dataSources.add(_dataSource);
|
||||
else if (_engine) _native = createNativeRenderer(_engine, _dataSource);
|
||||
registerDynamicCredit(creditTarget(), BHOTE_KOSHI_LOCATOR_CREDIT);
|
||||
showOsmCredit(creditTarget(), BHOTE_KOSHI_LOCATOR_LAYER_ID);
|
||||
registerDynamicCredit(_engine, BHOTE_KOSHI_LOCATOR_CREDIT);
|
||||
showOsmCredit(_engine, BHOTE_KOSHI_LOCATOR_LAYER_ID);
|
||||
}
|
||||
|
||||
function attachRenderer(viewer, { engine = null } = {}) {
|
||||
@@ -1080,7 +1079,7 @@ export function createBhoteKoshiLocatorLayer({
|
||||
_native?.destroy();
|
||||
_native = null;
|
||||
if (_viewer && _dataSource) _viewer.dataSources.remove(_dataSource, false);
|
||||
hideOsmCredit(creditTarget(), BHOTE_KOSHI_LOCATOR_LAYER_ID);
|
||||
hideOsmCredit(_engine, BHOTE_KOSHI_LOCATOR_LAYER_ID);
|
||||
_engine = _viewer = null;
|
||||
}
|
||||
|
||||
@@ -1137,7 +1136,7 @@ export function createBhoteKoshiLocatorLayer({
|
||||
}
|
||||
|
||||
async function disable() {
|
||||
hideOsmCredit(creditTarget(), BHOTE_KOSHI_LOCATOR_LAYER_ID);
|
||||
hideOsmCredit(_engine, BHOTE_KOSHI_LOCATOR_LAYER_ID);
|
||||
_pausedApproach = null;
|
||||
_enabled = false;
|
||||
_boundaryReady = false;
|
||||
|
||||
Reference in new issue
Block a user