mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +00:00
Run the Navara paths without the Cesium SDK, and load it on demand for the features that still build on it
Every Cesium read that a Navara page made was surveyed with the strict acceptance (GEV_QA_CESIUM_TRAP=record). Math on those paths now uses src/geo: screen annotations, weather and wind center readings, cyclone picks, scene data pack polygons and images (new navaraGeometry.js), the awareness subject, the orbit offset of camera verbs, voice frame_overhead, the agent world packet and Directions colours and ground picks. The celestial ring's Sun and Moon come from a bit-identical port of Cesium's Simon1994 model, JulianDate and TEME rotation (src/geo/simon1994.js, julianDate.js, transforms.js); a Cesium globe still applies its ICRF rotation once loaded. Traffic, Street Level, the Nepal event and locator and geo import build on Cesium's math or entity model on either globe; their enable (or the import) now loads the SDK first through src/app/loadCesium.js, synchronously when it is already there. A production page guards the global so a missed read is reported and starts the load. No module reads Cesium while it loads (scripts/check-cesium-load-time.mjs, run by npm test). Cesium.js is still loaded by index.html here.
This commit is contained in:
1 parent
f87da8523e
commit
b8305de14b
58 files changed
+2130
-325
No files matched your search
@@ -67,7 +67,7 @@ export function createCyclonesLayer({
|
||||
feed,
|
||||
hitTestOverlay = hitTestWorldOverlay,
|
||||
overlayHost,
|
||||
cesium = Cesium,
|
||||
cesium = null,
|
||||
createRendering = createCycloneRendering,
|
||||
createNativeRendering = null,
|
||||
matchMedia = globalThis.matchMedia?.bind(globalThis),
|
||||
@@ -99,24 +99,27 @@ export function createCyclonesLayer({
|
||||
selectedId = id;
|
||||
rendering?.setSelection(id);
|
||||
}
|
||||
// The SDK, on Cesium only: the production build's Cesium global loads with
|
||||
// the first Cesium globe, so a Navara page has none.
|
||||
const sdk = () => cesium ?? (engine?.kind === 'navara' ? null : Cesium);
|
||||
// Photorealistic 3D Tiles pick as tileset content without an entity id;
|
||||
// that is empty map, the same as no pick at all on the globe.
|
||||
const isSurfacePick = (picked) =>
|
||||
!picked ||
|
||||
(picked.id === undefined &&
|
||||
(picked.content !== undefined ||
|
||||
(typeof cesium.Cesium3DTileset === 'function' &&
|
||||
picked.primitive instanceof cesium.Cesium3DTileset)));
|
||||
(typeof sdk()?.Cesium3DTileset === 'function' &&
|
||||
picked.primitive instanceof sdk().Cesium3DTileset)));
|
||||
function installSelection() {
|
||||
const canvas = engine?.host.canvas ?? viewer?.scene?.canvas;
|
||||
const native = engine?.kind === 'navara';
|
||||
if (
|
||||
clickHandler ||
|
||||
!canvas ||
|
||||
(!native && typeof cesium.ScreenSpaceEventHandler !== 'function')
|
||||
(!native && typeof sdk()?.ScreenSpaceEventHandler !== 'function')
|
||||
)
|
||||
return;
|
||||
const owner = native ? {} : new cesium.ScreenSpaceEventHandler(canvas);
|
||||
const owner = native ? {} : new (sdk().ScreenSpaceEventHandler)(canvas);
|
||||
clickHandler = owner;
|
||||
let capturedHit = null;
|
||||
const overlayHit = (x, y) => {
|
||||
@@ -192,7 +195,7 @@ export function createCyclonesLayer({
|
||||
};
|
||||
if (native)
|
||||
owner.destroy = engine.input.on('click', onClick, { pick: true });
|
||||
else owner.setInputAction(onClick, cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
else owner.setInputAction(onClick, sdk().ScreenSpaceEventType.LEFT_CLICK);
|
||||
}
|
||||
function removeSelection() {
|
||||
const owner = clickHandler;
|
||||
@@ -217,7 +220,7 @@ export function createCyclonesLayer({
|
||||
rendering =
|
||||
engine?.kind === 'navara'
|
||||
? createNativeRendering(engine, { overlayHost })
|
||||
: createRendering({ viewer, cesium, overlayHost });
|
||||
: createRendering({ viewer, cesium: sdk(), overlayHost });
|
||||
if (!enabled) return;
|
||||
installSelection();
|
||||
if (snapshot && !snapshot.unavailable) {
|
||||
|
||||
Reference in new issue
Block a user