mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
- src/geo drops the ported debug argument checks and the tests that bitExact already covers; package boundaries accept a directory entry, so src/geo/ is listed once per group. - Cesium no longer carries movers and lines nobody draws with: they are optional engine capabilities. The fake engine and the Cesium camera use the shared cameraMath; unused contract tables, clock.ticked, the 'finest' surface detail and Navara click statistics are gone. - ALPR keeps one overlay core and one presentation model for both engines, bikeshare one station bookkeeping, the Navara ground effects one definition helper; image atlases, view centres, mover banks and colours are shared. - The legacy switch route, the clock offset and rate controls and other unused exports are removed. - The acceptance runs the Navara draw, geo import and scope checks; scenarios use the harness switch and page helpers; the main chunk check keeps the size budget only and runs once in CI.
69 lines
2.1 KiB
JavaScript
69 lines
2.1 KiB
JavaScript
// Between two globe engines the shell has no visual settings of its own:
|
|
// the outgoing ones are released and the incoming ones are not built yet.
|
|
// A choice the person makes meanwhile (a style key, a Display control, a
|
|
// voice command) is kept and applied to the next engine's settings once
|
|
// that engine has restored the address's view, so the person's choice wins.
|
|
// Reads answer from the outgoing settings' last state.
|
|
|
|
/** The visual choices kept for the next engine, by method name. */
|
|
const PENDING_VISUAL_CHOICES = Object.freeze(
|
|
new Set([
|
|
'setStyle',
|
|
'setBloom',
|
|
'setSharpen',
|
|
'setDetection',
|
|
'setCelestialRingEnabled',
|
|
'setStyleParameter',
|
|
'applyVisualState',
|
|
'applyCinematicPreset',
|
|
'_setBloomEnabled',
|
|
'_setBloomIntensity',
|
|
'_setSharpenEnabled',
|
|
'_setSharpenIntensity',
|
|
'_setScope',
|
|
'_setHudVariant',
|
|
'_setDetectionDensity',
|
|
'_setDetectionAllocation',
|
|
'_setDetectionFade',
|
|
'_setDetectionModeByLabel',
|
|
'_setCyberSonarEnabled',
|
|
'_setCyberSonarSetting',
|
|
]),
|
|
);
|
|
|
|
/**
|
|
* Stand in for released visual settings: choices are queued (`queue`),
|
|
* everything else reads the released settings.
|
|
* @param {object} released The outgoing engine's VisualSettings.
|
|
* @returns {{settings: object, queue: Array<[string, unknown[]]>}}
|
|
*/
|
|
export function pendingVisualSettings(released) {
|
|
const queue = [];
|
|
const settings = new Proxy(released, {
|
|
get(target, name) {
|
|
if (PENDING_VISUAL_CHOICES.has(name))
|
|
return (...args) => {
|
|
queue.push([name, args]);
|
|
return { ok: true, pending: true };
|
|
};
|
|
const value = Reflect.get(target, name, target);
|
|
return typeof value === 'function' ? value.bind(target) : value;
|
|
},
|
|
});
|
|
return { settings, queue };
|
|
}
|
|
|
|
/** Apply the queued choices, in order, to the next engine's settings. */
|
|
export function applyPendingVisualChoices(settings, queue) {
|
|
for (const [name, args] of queue.splice(0)) {
|
|
try {
|
|
settings[name]?.(...args);
|
|
} catch (error) {
|
|
console.error(
|
|
`A visual choice made during the switch failed (${name}):`,
|
|
error,
|
|
);
|
|
}
|
|
}
|
|
}
|