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
@@ -9,11 +9,11 @@ import { toCesium2, toCesium3, toGeo3 } from './convert.js';
|
||||
import { createCesiumFollow } from './follow.js';
|
||||
|
||||
const { math } = geo;
|
||||
const EASINGS = {
|
||||
const easings = () => ({
|
||||
cubicInOut: Cesium.EasingFunction.CUBIC_IN_OUT,
|
||||
sinusoidalInOut: Cesium.EasingFunction.SINUSOIDAL_IN_OUT,
|
||||
linear: Cesium.EasingFunction.LINEAR_NONE,
|
||||
};
|
||||
});
|
||||
|
||||
// Cesium reports heading and roll in [0, 2π]; the contract wants [0, 2π).
|
||||
function wrapAngle(angle) {
|
||||
@@ -43,7 +43,7 @@ const cesiumDestination = (destination) =>
|
||||
)
|
||||
: toCesium3(destination);
|
||||
|
||||
const cesiumEasing = (easing) => (easing ? EASINGS[easing] : undefined);
|
||||
const cesiumEasing = (easing) => (easing ? easings()[easing] : undefined);
|
||||
|
||||
// A HeadingPitchRange or a Cartesian offset, as Cesium's lookAt takes them.
|
||||
const cesiumOffset = (offset) =>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { bridgeEvent } from './events.js';
|
||||
|
||||
const scratchGregorian = new Cesium.GregorianDate();
|
||||
let scratchGregorian;
|
||||
|
||||
// JulianDate.toDate(time).getTime() without the Date: frame events must not
|
||||
// allocate. A raise without a time (not Cesium's own) reads the clock.
|
||||
@@ -27,6 +27,7 @@ function unixMilliseconds(scene, time) {
|
||||
* @returns {{ frames: object, destroy: () => void }}
|
||||
*/
|
||||
export function createCesiumFrames(viewer) {
|
||||
scratchGregorian ??= new Cesium.GregorianDate();
|
||||
const { scene } = viewer;
|
||||
const bridges = ['preUpdate', 'preRender', 'postRender'].map((name) => [
|
||||
name,
|
||||
|
||||
+13
-13
@@ -6,19 +6,6 @@ import { normalizeInputOptions } from '../contract.js';
|
||||
import { createPickDelivery } from '../pickDelivery.js';
|
||||
import { toGeo2 } from './convert.js';
|
||||
|
||||
const TYPES = {
|
||||
click: Cesium.ScreenSpaceEventType.LEFT_CLICK,
|
||||
doubleClick: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
|
||||
move: Cesium.ScreenSpaceEventType.MOUSE_MOVE,
|
||||
down: Cesium.ScreenSpaceEventType.LEFT_DOWN,
|
||||
up: Cesium.ScreenSpaceEventType.LEFT_UP,
|
||||
};
|
||||
const KEYS = {
|
||||
ctrl: Cesium.KeyboardEventModifier.CTRL,
|
||||
shift: Cesium.KeyboardEventModifier.SHIFT,
|
||||
alt: Cesium.KeyboardEventModifier.ALT,
|
||||
};
|
||||
|
||||
// Cesium reuses its event objects; listeners get geo copies.
|
||||
const toEvent = (event) => {
|
||||
const result = {};
|
||||
@@ -44,6 +31,19 @@ export function createCesiumInput(
|
||||
scheduleFrame = (run) => requestAnimationFrame(run),
|
||||
} = {},
|
||||
) {
|
||||
const TYPES = {
|
||||
click: Cesium.ScreenSpaceEventType.LEFT_CLICK,
|
||||
doubleClick: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
|
||||
move: Cesium.ScreenSpaceEventType.MOUSE_MOVE,
|
||||
down: Cesium.ScreenSpaceEventType.LEFT_DOWN,
|
||||
up: Cesium.ScreenSpaceEventType.LEFT_UP,
|
||||
};
|
||||
const KEYS = {
|
||||
ctrl: Cesium.KeyboardEventModifier.CTRL,
|
||||
shift: Cesium.KeyboardEventModifier.SHIFT,
|
||||
alt: Cesium.KeyboardEventModifier.ALT,
|
||||
};
|
||||
|
||||
const { scene } = viewer;
|
||||
let handler = null;
|
||||
let destroyed = false;
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { createMoverRegistry } from '../movers.js';
|
||||
|
||||
const scratchPosition = new Cesium.Cartesian3();
|
||||
const scratchColor = new Cesium.Color();
|
||||
const scratchQuaternion = new Cesium.Quaternion();
|
||||
const scratchRotation = new Cesium.Matrix3();
|
||||
let scratchPosition;
|
||||
let scratchColor;
|
||||
let scratchQuaternion;
|
||||
let scratchRotation;
|
||||
// Model.modelMatrix and Model.color copy what they are given.
|
||||
const scratchModelMatrix = new Cesium.Matrix4();
|
||||
let scratchModelMatrix;
|
||||
|
||||
/** The atlas cells as canvases, by key (a DOM canvas or image source). */
|
||||
async function cropAtlasCells(atlas, keys) {
|
||||
@@ -287,6 +287,11 @@ export function createCesiumMovers(
|
||||
viewer,
|
||||
{ requestRender = () => viewer.scene.requestRender(), factories = {} } = {},
|
||||
) {
|
||||
scratchPosition ??= new Cesium.Cartesian3();
|
||||
scratchColor ??= new Cesium.Color();
|
||||
scratchQuaternion ??= new Cesium.Quaternion();
|
||||
scratchRotation ??= new Cesium.Matrix3();
|
||||
scratchModelMatrix ??= new Cesium.Matrix4();
|
||||
const make = { ...DEFAULT_FACTORIES, ...factories };
|
||||
const { scene } = viewer;
|
||||
let root = null;
|
||||
|
||||
Reference in new issue
Block a user