mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Starry sky and the application viewer move into the Cesium adapter
src/sky/starrySky.js and src/app/viewer.js are Cesium through and through, so they move into the adapter as src/render/cesium/starrySky.js and applicationViewer.js; the ./application/viewer export points there. The celestial ring's precise ICRF rotation reaches the shell through a Cesium-free registry (src/sky/icrf.js) that the sky provides as it loads; the application's renderer loads it, and so does ./render/cesium/unbound. Both files leave the Cesium allow-list.
This commit is contained in:
1 parent
a8a9cc73a4
commit
e6d9ec0636
17 files changed
+110
-38
No files matched your search
@@ -468,6 +468,10 @@ release listeners; pending action feedback is limited to its current owner.
|
||||
rendering, HUD and share operations. `src/standalone/controls.js` provides the running
|
||||
application's instances. The shell
|
||||
imports no standalone bootstrap or concrete live layer implementation.
|
||||
The celestial ring's precise ICRF rotation comes from the renderer
|
||||
(`src/sky/icrf.js`): the application's renderer provides it; a shell given a
|
||||
viewer with no renderer bound gets it once `./render/cesium/unbound` has loaded, and
|
||||
falls back to the TEME approximation until then.
|
||||
Panel layout, position/drag, notices, recording and deferred UI work have separate
|
||||
owners with synchronous cleanup. Existing scene, share and HUD engines retain
|
||||
their entry points. `ui/styles` loads the ordered stylesheet entry; component
|
||||
|
||||
@@ -1502,10 +1502,11 @@ The clear control presents busy state while its existing action owns the transac
|
||||
|
||||
## Sky background
|
||||
|
||||
`src/sky/starrySky.js` fills Cesium's `Scene#skyBox` slot with 9,096 Yale
|
||||
`src/render/cesium/starrySky.js` fills Cesium's `Scene#skyBox` slot with 9,096 Yale
|
||||
Bright Star Catalogue stars and a soft ESO/S. Brunier Milky Way. Both layers
|
||||
rotate from ICRF/J2000 into the Earth-fixed frame at the scene clock, with
|
||||
a TEME fallback while Cesium's IAU 2006 tables load. Bundled assets and
|
||||
a TEME fallback while Cesium's IAU 2006 tables load. The precise rotation reaches
|
||||
Cesium-free code (the celestial ring) through `src/sky/icrf.js`. Bundled assets and
|
||||
their provenance are documented in `src/data/local_data/sky/README.md`.
|
||||
|
||||
Anime fades out the Milky Way with its style intensity to avoid cel-shaded
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@
|
||||
"./infrastructure/geojson": "./src/data/localGeojsonCore.js",
|
||||
"./infrastructure/lod": "./src/data/localGeojsonLod.js",
|
||||
"./application": "./src/app/application.js",
|
||||
"./application/viewer": "./src/app/viewer.js",
|
||||
"./application/viewer": "./src/render/cesium/applicationViewer.js",
|
||||
"./build/vite": {
|
||||
"node": "./build/vite.js"
|
||||
},
|
||||
|
||||
@@ -84,7 +84,8 @@
|
||||
"src/app/application.test.mjs",
|
||||
"src/app/mapLifecycle.test.mjs",
|
||||
"src/app/startupCamera.test.mjs",
|
||||
"src/app/viewer.js",
|
||||
"src/render/cesium/applicationViewer.js",
|
||||
"src/sky/icrf.js",
|
||||
"src/app/atmosphereCompat.test.mjs",
|
||||
"src/standalone/application.js",
|
||||
"src/standalone/controls.js",
|
||||
@@ -1145,7 +1146,7 @@
|
||||
"scripts/build-bright-stars.mjs",
|
||||
"scripts/build-milky-way.mjs",
|
||||
"src/sky/stars.test.mjs",
|
||||
"src/sky/starrySky.test.mjs",
|
||||
"src/render/cesium/starrySky.test.mjs",
|
||||
"src/tooling/skyAssets.test.mjs",
|
||||
"src/tooling/skyAssets.paintOut.test.mjs",
|
||||
"scripts/qa-anime-sky.mjs",
|
||||
|
||||
@@ -204,12 +204,13 @@
|
||||
"viewer": {
|
||||
"exports": ["./application/viewer"],
|
||||
"modules": [
|
||||
"src/app/viewer.js",
|
||||
"src/render/cesium/applicationViewer.js",
|
||||
"src/app/atmosphereCompat.js",
|
||||
"src/sky/starrySky.js",
|
||||
"src/render/cesium/starrySky.js",
|
||||
"src/sky/stars.js",
|
||||
"src/data/bundledJson.js",
|
||||
"src/renderGovernor.js"
|
||||
"src/renderGovernor.js",
|
||||
"src/sky/icrf.js"
|
||||
],
|
||||
"external": ["cesium"]
|
||||
},
|
||||
@@ -1045,7 +1046,6 @@
|
||||
"src/styles/surveillance.js",
|
||||
"src/styles/thermal.js",
|
||||
"src/ui/applicationShell.js",
|
||||
"src/sky/starrySky.js",
|
||||
"src/render/cesium/effects.js",
|
||||
"src/render/cesium/screenModulation.js",
|
||||
"src/render/cesium/globe.js",
|
||||
@@ -1286,7 +1286,8 @@
|
||||
"src/render/cesium/input.js",
|
||||
"src/render/input/wheel.js",
|
||||
"src/render/cesium/ctrlWheelZoom.js",
|
||||
"src/render/input/router.js"
|
||||
"src/render/input/router.js",
|
||||
"src/sky/icrf.js"
|
||||
],
|
||||
"external": ["cesium", "vue", "pinia", "vue-i18n"]
|
||||
},
|
||||
@@ -1900,7 +1901,12 @@
|
||||
"src/render/cesium/mapImagery.js",
|
||||
"src/maps/terrainRetry.js",
|
||||
"src/render/cesium/mapTerrain.js",
|
||||
"src/render/cesium/mapEngine.js"
|
||||
"src/render/cesium/mapEngine.js",
|
||||
"src/data/bundledJson.js",
|
||||
"src/renderGovernor.js",
|
||||
"src/sky/icrf.js",
|
||||
"src/sky/stars.js",
|
||||
"src/render/cesium/starrySky.js"
|
||||
],
|
||||
"external": ["cesium"]
|
||||
},
|
||||
@@ -3342,9 +3348,9 @@
|
||||
"src/app/surfaceServices.js",
|
||||
"src/app/tools.js",
|
||||
"src/data/followed.js",
|
||||
"src/app/viewer.js",
|
||||
"src/render/cesium/applicationViewer.js",
|
||||
"src/render/cesium/ctrlWheelZoom.js",
|
||||
"src/sky/starrySky.js",
|
||||
"src/render/cesium/starrySky.js",
|
||||
"src/sky/stars.js",
|
||||
"src/app/atmosphereCompat.js",
|
||||
"src/bloom.js",
|
||||
@@ -4288,7 +4294,8 @@
|
||||
"src/maps/startupRoute.js",
|
||||
"src/maps/engine.js",
|
||||
"src/maps/attribution.js",
|
||||
"src/render/cesium/mapEngine.js"
|
||||
"src/render/cesium/mapEngine.js",
|
||||
"src/sky/icrf.js"
|
||||
],
|
||||
"external": [
|
||||
"hls.js",
|
||||
|
||||
@@ -32,13 +32,15 @@ try {
|
||||
const results = await page.evaluate(async () => {
|
||||
window.CESIUM_BASE_URL = '/cesium/';
|
||||
// Use StarrySky's exact Vite dependency URL, including its version query.
|
||||
const source = await fetch('/src/sky/starrySky.js').then((r) => r.text());
|
||||
const source = await fetch('/src/render/cesium/starrySky.js').then((r) =>
|
||||
r.text(),
|
||||
);
|
||||
const cesiumUrl = source.match(
|
||||
/from ["']([^"']*\/cesium\.js[^"']*)["']/,
|
||||
)?.[1];
|
||||
if (!cesiumUrl) throw new Error('run against the Vite dev server');
|
||||
const C = await import(cesiumUrl);
|
||||
const { StarrySky } = await import('/src/sky/starrySky.js');
|
||||
const { StarrySky } = await import('/src/render/cesium/starrySky.js');
|
||||
const time = C.JulianDate.fromIso8601('2026-10-19T00:00:00Z');
|
||||
const results = {};
|
||||
for (const kind of ['black', 'starry', 'white']) {
|
||||
|
||||
@@ -222,8 +222,9 @@ test('the separate viewer export imports without constructing a browser viewer',
|
||||
});
|
||||
|
||||
test('the viewer gets the starry sky as an option, which keeps the Sun and Moon', async () => {
|
||||
const { applicationViewerOptions } = await import('./viewer.js');
|
||||
const { StarrySky } = await import('../sky/starrySky.js');
|
||||
const { applicationViewerOptions } =
|
||||
await import('../render/cesium/applicationViewer.js');
|
||||
const { StarrySky } = await import('../render/cesium/starrySky.js');
|
||||
const creditContainer = {};
|
||||
const options = applicationViewerOptions(creditContainer);
|
||||
// CesiumWidget skips scene.sun and scene.moon when skyBox is false.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Sky background
|
||||
|
||||
Catalogue stars over a soft Milky Way, drawn by `src/sky/starrySky.js` in
|
||||
Catalogue stars over a soft Milky Way, drawn by `src/render/cesium/starrySky.js` in
|
||||
place of Cesium's blocky Tycho-2 sky box.
|
||||
|
||||
| File | Content | Size |
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* crosses the contract and each call marks code still to port. Ported code
|
||||
* that still holds the viewer reaches the renderer through `rendererOf`.
|
||||
*/
|
||||
import { createApplicationViewer } from '../../app/viewer.js';
|
||||
import { createApplicationViewer } from './applicationViewer.js';
|
||||
import { CONTRACT_VERSION } from '../contract/index.js';
|
||||
import { bindRenderer } from '../rendererOf.js';
|
||||
import { createCesiumInput } from './input.js';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { applyModelAtmosphereWorkaround } from './atmosphereCompat.js';
|
||||
import { StarrySky } from '../sky/starrySky.js';
|
||||
import { applyModelAtmosphereWorkaround } from '../../app/atmosphereCompat.js';
|
||||
import { StarrySky } from './starrySky.js';
|
||||
|
||||
// Dev convenience: expose the app's Cesium instance for console/preview probing
|
||||
// (single shared module instance — avoids dual-Cesium state bugs when testing).
|
||||
@@ -1,7 +1,8 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { loadBundledJson } from '../data/bundledJson.js';
|
||||
import { governorRequestRender } from '../renderGovernor.js';
|
||||
import { buildStarVertices, STAR_VERTEX_FLOATS } from './stars.js';
|
||||
import { loadBundledJson } from '../../data/bundledJson.js';
|
||||
import { governorRequestRender } from '../../renderGovernor.js';
|
||||
import { buildStarVertices, STAR_VERTEX_FLOATS } from '../../sky/stars.js';
|
||||
import { provideIcrfToFixed } from '../../sky/icrf.js';
|
||||
|
||||
/**
|
||||
* Space background in the `Scene#skyBox` slot: catalogue stars as point
|
||||
@@ -18,32 +19,32 @@ export const MILKY_WAY_INTENSITY = 0.4;
|
||||
export const SKY_ROTATION_EPSILON_SECONDS = 1;
|
||||
|
||||
const STAR_PACK_URL = new URL(
|
||||
'../data/local_data/sky/bright_stars.json',
|
||||
'../../data/local_data/sky/bright_stars.json',
|
||||
import.meta.url,
|
||||
);
|
||||
const MILKY_WAY_FACE_URLS = Object.freeze({
|
||||
positiveX: new URL(
|
||||
'../data/local_data/sky/milkyway_px.webp',
|
||||
'../../data/local_data/sky/milkyway_px.webp',
|
||||
import.meta.url,
|
||||
),
|
||||
negativeX: new URL(
|
||||
'../data/local_data/sky/milkyway_nx.webp',
|
||||
'../../data/local_data/sky/milkyway_nx.webp',
|
||||
import.meta.url,
|
||||
),
|
||||
positiveY: new URL(
|
||||
'../data/local_data/sky/milkyway_py.webp',
|
||||
'../../data/local_data/sky/milkyway_py.webp',
|
||||
import.meta.url,
|
||||
),
|
||||
negativeY: new URL(
|
||||
'../data/local_data/sky/milkyway_ny.webp',
|
||||
'../../data/local_data/sky/milkyway_ny.webp',
|
||||
import.meta.url,
|
||||
),
|
||||
positiveZ: new URL(
|
||||
'../data/local_data/sky/milkyway_pz.webp',
|
||||
'../../data/local_data/sky/milkyway_pz.webp',
|
||||
import.meta.url,
|
||||
),
|
||||
negativeZ: new URL(
|
||||
'../data/local_data/sky/milkyway_nz.webp',
|
||||
'../../data/local_data/sky/milkyway_nz.webp',
|
||||
import.meta.url,
|
||||
),
|
||||
});
|
||||
@@ -151,6 +152,9 @@ export function icrfToFixedAxes(ms) {
|
||||
};
|
||||
}
|
||||
|
||||
// Cesium-free code asks for it through `src/sky/icrf.js`.
|
||||
provideIcrfToFixed(icrfToFixedAxes);
|
||||
|
||||
/** Whether a cached rotation at `cachedTime` still serves `time`. */
|
||||
export function isSkyRotationCurrent(cachedTime, time) {
|
||||
return (
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
icrfToFixedAxes,
|
||||
isSkyRotationCurrent,
|
||||
} from './starrySky.js';
|
||||
import * as neutral from '../../sky/icrf.js';
|
||||
|
||||
const close = (actual, expected, epsilon = 1e-9) =>
|
||||
assert.ok(Math.abs(actual - expected) <= epsilon, `${actual} vs ${expected}`);
|
||||
@@ -221,3 +222,26 @@ test('the precise frame is given as its axes once its tables answer', (t) => {
|
||||
);
|
||||
assert.equal(icrfToFixedAxes(ms), null);
|
||||
});
|
||||
|
||||
test('loading the sky provides its precise rotation to Cesium-free code', () => {
|
||||
const ms = Date.parse('2026-10-19T00:00:00Z');
|
||||
const original = Cesium.Transforms.computeIcrfToFixedMatrix;
|
||||
Cesium.Transforms.computeIcrfToFixedMatrix = (_time, result) =>
|
||||
Cesium.Matrix3.clone(Cesium.Matrix3.fromRotationZ(0.3), result);
|
||||
try {
|
||||
const axes = neutral.icrfToFixedAxes(ms);
|
||||
assert.notEqual(axes, null);
|
||||
assert.deepEqual(axes, icrfToFixedAxes(ms));
|
||||
} finally {
|
||||
Cesium.Transforms.computeIcrfToFixedMatrix = original;
|
||||
}
|
||||
});
|
||||
|
||||
test('the neutral rotation answers null with nothing provided', () => {
|
||||
neutral.provideIcrfToFixed(null);
|
||||
try {
|
||||
assert.equal(neutral.icrfToFixedAxes(0), null);
|
||||
} finally {
|
||||
neutral.provideIcrfToFixed(icrfToFixedAxes);
|
||||
}
|
||||
});
|
||||
@@ -4,8 +4,9 @@
|
||||
* layers a Cesium viewer with no renderer bound: the factories
|
||||
* that build a camera, credits, effects, draw, frame, globe, input and query
|
||||
* port over such a viewer when code first asks for one, a click's own
|
||||
* Cesium picks (`rendererOf.js`), and the map engine the map stacks switch
|
||||
* through (`src/maps/engine.js`).
|
||||
* Cesium picks (`rendererOf.js`), the map engine the map stacks switch
|
||||
* through (`src/maps/engine.js`), and the sky's precise ICRF rotation
|
||||
* (`src/sky/icrf.js`).
|
||||
*/
|
||||
import './camera.js';
|
||||
import './effects.js';
|
||||
@@ -15,3 +16,4 @@ import './input.js';
|
||||
import './mapEngine.js';
|
||||
import './nativeClick.js';
|
||||
import './query.js';
|
||||
import './starrySky.js';
|
||||
@@ -2,8 +2,6 @@
|
||||
"dev/conformance/main.js",
|
||||
"src/app/embed.js",
|
||||
"src/app/scene.js",
|
||||
"src/app/viewer.js",
|
||||
"src/data/geoImportPins.js",
|
||||
"src/sky/starrySky.js",
|
||||
"src/ui/applicationShell.js"
|
||||
]
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @module sky/icrf
|
||||
* @description The precise ICRF-to-fixed rotation, from the renderer that
|
||||
* has the tables for it (the Cesium adapter's starry sky provides it as it
|
||||
* loads, `src/render/cesium/starrySky.js`). Cesium-free: with none
|
||||
* provided, or before its tables load, it answers null and callers fall
|
||||
* back to `temeToPseudoFixed` (`src/geo/frames.js`).
|
||||
*/
|
||||
|
||||
let provided = null;
|
||||
|
||||
/**
|
||||
* Provide the precise rotation; a later call replaces it.
|
||||
* @param {(ms: number) => ({x: object, y: object, z: object} | null)} axesAt
|
||||
*/
|
||||
export function provideIcrfToFixed(axesAt) {
|
||||
provided = axesAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* The precise ICRF-to-fixed rotation at `ms` (epoch milliseconds) as its
|
||||
* axes (the matrix's columns), or null while it is unknown.
|
||||
* @param {number} ms
|
||||
* @returns {{x: object, y: object, z: object} | null}
|
||||
*/
|
||||
export function icrfToFixedAxes(ms) {
|
||||
return provided ? provided(ms) : null;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ import { applicationPinia, createUiRuntime } from './vueRuntime.js';
|
||||
import { useContextStore } from './stores/context.js';
|
||||
import { useMissionReplayStore } from './stores/missionReplay.js';
|
||||
import { useCelestialRingStore } from './stores/celestialRing.js';
|
||||
import { icrfToFixedAxes } from '../sky/starrySky.js';
|
||||
import { icrfToFixedAxes } from '../sky/icrf.js';
|
||||
import { useWorldOverlayActionsStore } from './stores/worldOverlayActions.js';
|
||||
import { useAwarenessDirectionStore } from './stores/awarenessDirection.js';
|
||||
import { useHudStore } from './stores/hud.js';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { VisualEffects } from './visualEffects.js';
|
||||
import { createCesiumEffects } from '../render/cesium/effects.js';
|
||||
import { styleStagesOf } from '../styles/styleStages.js';
|
||||
import { createCesiumGlobe } from '../render/cesium/globe.js';
|
||||
import { MILKY_WAY_INTENSITY, StarrySky } from '../sky/starrySky.js';
|
||||
import { MILKY_WAY_INTENSITY, StarrySky } from '../render/cesium/starrySky.js';
|
||||
import {
|
||||
GLOBAL_POST_DEFAULTS,
|
||||
STYLE_PRESET_DEFAULTS,
|
||||
|
||||
Reference in new issue
Block a user