mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Draw the celestial ring through the renderer's ports and take it off the Cesium list
The full-globe ring reads the eye from the camera port's pose, projects the Earth's centre through the query port, paints on the frame port's postRender and asks it for the frame that ends a focus flight, and flies out through the camera port with a geodetic destination. The sun and moon come from the shared planetary model in geo/celestial, rotated into the Earth-fixed frame: the precise ICRF frame once its tables have loaded, which the application shell supplies from the starry sky (icrfToFixedAxes), and the pseudo-fixed frame before, as Cesium's own fallback did. It still reads the viewer's canvas and container, which are DOM. projectEarthDiscToViewport keeps its scratch arguments: the eye-to-centre vector is still written before the facing test, which radio navigation reads after the call. The annotations entry loaded the Cesium port factories only through the ring; its world renderer, which stays on the list, now loads them.
This commit is contained in:
1 parent
be5a6f0fe5
commit
cdbbf8c705
9 files changed
+305
-99
No files matched your search
@@ -128,6 +128,29 @@ export function computeSkyRotation(time, result) {
|
||||
};
|
||||
}
|
||||
|
||||
const scratchIcrf = new Cesium.Matrix3();
|
||||
|
||||
/**
|
||||
* The precise ICRF-to-fixed rotation at `ms` (epoch milliseconds) as its
|
||||
* axes (the matrix's columns, the form `geo/frames` uses), or null while
|
||||
* Cesium's IAU 2006 tables for that time have not loaded (the sky loads
|
||||
* them while it shows). Callers fall back to `temeToPseudoFixed`.
|
||||
* @param {number} ms
|
||||
* @returns {{x: object, y: object, z: object} | null}
|
||||
*/
|
||||
export function icrfToFixedAxes(ms) {
|
||||
const m = Cesium.Transforms.computeIcrfToFixedMatrix(
|
||||
Cesium.JulianDate.fromDate(new Date(ms)),
|
||||
scratchIcrf,
|
||||
);
|
||||
if (!m) return null;
|
||||
return {
|
||||
x: { x: m[0], y: m[1], z: m[2] },
|
||||
y: { x: m[3], y: m[4], z: m[5] },
|
||||
z: { x: m[6], y: m[7], z: m[8] },
|
||||
};
|
||||
}
|
||||
|
||||
/** Whether a cached rotation at `cachedTime` still serves `time`. */
|
||||
export function isSkyRotationCurrent(cachedTime, time) {
|
||||
return (
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
SKY_ROTATION_EPSILON_SECONDS,
|
||||
StarrySky,
|
||||
computeSkyRotation,
|
||||
icrfToFixedAxes,
|
||||
isSkyRotationCurrent,
|
||||
} from './starrySky.js';
|
||||
|
||||
@@ -198,3 +199,25 @@ test('a render update uploads six opaque black environment faces only once', ()
|
||||
Cesium.ContextLimits._maximumCubeMapSize = previous;
|
||||
}
|
||||
});
|
||||
|
||||
test('the precise frame is given as its axes once its tables answer', (t) => {
|
||||
const matrix = Cesium.Matrix3.fromRowMajorArray([1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
||||
let asked = null;
|
||||
t.mock.method(Cesium.Transforms, 'computeIcrfToFixedMatrix', (time, out) => {
|
||||
asked = time;
|
||||
return Cesium.Matrix3.clone(matrix, out);
|
||||
});
|
||||
const ms = Date.UTC(2026, 10, 7);
|
||||
assert.deepEqual(icrfToFixedAxes(ms), {
|
||||
x: { x: 1, y: 4, z: 7 },
|
||||
y: { x: 2, y: 5, z: 8 },
|
||||
z: { x: 3, y: 6, z: 9 },
|
||||
});
|
||||
assert.ok(
|
||||
Cesium.JulianDate.equals(asked, Cesium.JulianDate.fromDate(new Date(ms))),
|
||||
);
|
||||
Cesium.Transforms.computeIcrfToFixedMatrix.mock.mockImplementation(
|
||||
() => undefined,
|
||||
);
|
||||
assert.equal(icrfToFixedAxes(ms), null);
|
||||
});
|
||||
Reference in new issue
Block a user