The sky background is exported: the star catalogue, the Milky Way's faces and the star vertex builder from gods-eye-view/sky

This commit is contained in:
Sameh Khamis committed 2026-11-10 23:29:40 -08:00
1 parent cd44d5c4d8
commit fa2e8e8551
6 files changed
+90 -34

No files matched your search

+1
View File
@@ -306,6 +306,7 @@
"./view": "./src/view/index.js", "./view": "./src/view/index.js",
"./agent/world-packet": "./src/agent/worldPacket.js", "./agent/world-packet": "./src/agent/worldPacket.js",
"./geo": "./src/geo/index.js", "./geo": "./src/geo/index.js",
"./sky": "./src/sky/index.js",
"./render/contract": "./src/render/contract/index.js", "./render/contract": "./src/render/contract/index.js",
"./render/stub": "./src/render/stub/index.js", "./render/stub": "./src/render/stub/index.js",
"./render/occlusion": "./src/render/occlusion/index.js", "./render/occlusion": "./src/render/occlusion/index.js",
+13
View File
@@ -232,6 +232,7 @@
"src/data/bundledJson.js", "src/data/bundledJson.js",
"src/renderGovernor.js", "src/renderGovernor.js",
"src/sky/icrf.js", "src/sky/icrf.js",
"src/sky/assets.js",
"src/globeInView.js", "src/globeInView.js",
"src/render/cesium/imageryLookAhead.js", "src/render/cesium/imageryLookAhead.js",
"src/cockpitOrbital.js" "src/cockpitOrbital.js"
@@ -2148,6 +2149,7 @@
"src/renderGovernor.js", "src/renderGovernor.js",
"src/sky/icrf.js", "src/sky/icrf.js",
"src/sky/stars.js", "src/sky/stars.js",
"src/sky/assets.js",
"src/render/cesium/starrySky.js", "src/render/cesium/starrySky.js",
"src/render/applicationHooks.js", "src/render/applicationHooks.js",
"src/maps/globeEngine.js", "src/maps/globeEngine.js",
@@ -4695,6 +4697,7 @@
"src/maps/attribution.js", "src/maps/attribution.js",
"src/render/cesium/mapEngine.js", "src/render/cesium/mapEngine.js",
"src/sky/icrf.js", "src/sky/icrf.js",
"src/sky/assets.js",
"src/app/panelRendering.js", "src/app/panelRendering.js",
"src/render/cesium/application.js", "src/render/cesium/application.js",
"src/sources/osmFeatures.js", "src/sources/osmFeatures.js",
@@ -7187,6 +7190,16 @@
], ],
"external": [] "external": []
}, },
"sky": {
"exports": ["./sky"],
"modules": [
"src/sky/index.js",
"src/sky/assets.js",
"src/sky/stars.js",
"src/sky/icrf.js"
],
"external": []
},
"render": { "render": {
"exports": [ "exports": [
"./render/contract", "./render/contract",
+2 -1
View File
@@ -1,6 +1,7 @@
# Sky background # Sky background
Catalogue stars over a soft Milky Way, drawn by `src/render/cesium/starrySky.js` in Catalogue stars over a soft Milky Way, exported Cesium-free by `src/sky/index.js`
(`@gods-eye-view/core/sky`) and drawn on Cesium by `src/render/cesium/starrySky.js` in
place of Cesium's blocky Tycho-2 sky box. place of Cesium's blocky Tycho-2 sky box.
| File | Content | Size | | File | Content | Size |
+7 -33
View File
@@ -3,6 +3,11 @@ import { loadBundledJson } from '../../data/bundledJson.js';
import { governorRequestRender } from '../../renderGovernor.js'; import { governorRequestRender } from '../../renderGovernor.js';
import { buildStarVertices, STAR_VERTEX_FLOATS } from '../../sky/stars.js'; import { buildStarVertices, STAR_VERTEX_FLOATS } from '../../sky/stars.js';
import { provideIcrfToFixed } from '../../sky/icrf.js'; import { provideIcrfToFixed } from '../../sky/icrf.js';
import {
MILKY_WAY_FACE_URLS,
MILKY_WAY_INTENSITY,
STAR_CATALOGUE_URL,
} from '../../sky/assets.js';
/** /**
* Space background in the `Scene#skyBox` slot: catalogue stars as point * Space background in the `Scene#skyBox` slot: catalogue stars as point
@@ -14,41 +19,10 @@ import { provideIcrfToFixed } from '../../sky/icrf.js';
export const STARRY_SKY_CESIUM_VERSION = '1.138.0'; export const STARRY_SKY_CESIUM_VERSION = '1.138.0';
/** Brightness of the Milky Way glow; the stars carry the sky. */ /** Brightness of the Milky Way glow; the stars carry the sky. */
export const MILKY_WAY_INTENSITY = 0.4; export { MILKY_WAY_INTENSITY };
/** Clock change, in seconds, below which the sky rotation is reused. */ /** Clock change, in seconds, below which the sky rotation is reused. */
export const SKY_ROTATION_EPSILON_SECONDS = 1; export const SKY_ROTATION_EPSILON_SECONDS = 1;
const STAR_PACK_URL = new URL(
'../../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',
import.meta.url,
),
negativeX: new URL(
'../../data/local_data/sky/milkyway_nx.webp',
import.meta.url,
),
positiveY: new URL(
'../../data/local_data/sky/milkyway_py.webp',
import.meta.url,
),
negativeY: new URL(
'../../data/local_data/sky/milkyway_ny.webp',
import.meta.url,
),
positiveZ: new URL(
'../../data/local_data/sky/milkyway_pz.webp',
import.meta.url,
),
negativeZ: new URL(
'../../data/local_data/sky/milkyway_nz.webp',
import.meta.url,
),
});
// Directions, not points: w = 0 drops the camera translation, and z just // Directions, not points: w = 0 drops the camera translation, and z just
// under w keeps every fragment at the far plane, inside any frustum. // under w keeps every fragment at the far plane, inside any frustum.
const SKY_DIRECTION_GLSL = ` const SKY_DIRECTION_GLSL = `
@@ -222,7 +196,7 @@ export class StarrySky {
_load() { _load() {
if (this._loading) return; if (this._loading) return;
this._loading = true; this._loading = true;
loadBundledJson(STAR_PACK_URL) loadBundledJson(STAR_CATALOGUE_URL)
.then((pack) => { .then((pack) => {
if (this._destroyed) return; if (this._destroyed) return;
this._starData = buildStarVertices(pack); this._starData = buildStarVertices(pack);
+48
View File
@@ -0,0 +1,48 @@
/**
* @module sky/assets
* @description The sky background's bundled data, Cesium-free: the
* bright-star catalogue (`buildStarVertices` in `./stars.js` decodes it) and
* the Milky Way glow's six cube faces, both in ICRF/J2000. See
* `src/data/local_data/sky/README.md` for their sources and licences.
*/
/** The bright-star catalogue pack (`{ stars: [raDeg, decDeg, vmag, bv, …] }`). */
export const STAR_CATALOGUE_URL = new URL(
'../data/local_data/sky/bright_stars.json',
import.meta.url,
);
/**
* The Milky Way's cube faces in the WebGL face order and layout: +X toward
* the March equinox, +Z toward the north celestial pole, uploaded without
* flipping.
*/
export const MILKY_WAY_FACE_URLS = Object.freeze({
positiveX: new URL(
'../data/local_data/sky/milkyway_px.webp',
import.meta.url,
),
negativeX: new URL(
'../data/local_data/sky/milkyway_nx.webp',
import.meta.url,
),
positiveY: new URL(
'../data/local_data/sky/milkyway_py.webp',
import.meta.url,
),
negativeY: new URL(
'../data/local_data/sky/milkyway_ny.webp',
import.meta.url,
),
positiveZ: new URL(
'../data/local_data/sky/milkyway_pz.webp',
import.meta.url,
),
negativeZ: new URL(
'../data/local_data/sky/milkyway_nz.webp',
import.meta.url,
),
});
/** The Milky Way glow's brightness at `SkySettings.milkyWay` 1: the stars carry the sky. */
export const MILKY_WAY_INTENSITY = 0.4;
+19
View File
@@ -0,0 +1,19 @@
/**
* @module sky
* @description The sky background, Cesium-free: catalogue stars over a
* soft Milky Way, both in ICRF/J2000, and the precise ICRF-to-fixed rotation
* a renderer may provide for the rest of the application.
*/
export {
STAR_CATALOGUE_URL,
MILKY_WAY_FACE_URLS,
MILKY_WAY_INTENSITY,
} from './assets.js';
export {
STAR_VERTEX_FLOATS,
STAR_LIMIT_MAGNITUDE,
buildStarVertices,
raDecToUnitVector,
} from './stars.js';
export { provideIcrfToFixed, icrfToFixedAxes } from './icrf.js';