diff --git a/js/solarsystem.js b/js/solarsystem.js index 54ac1b7..3de22ec 100644 --- a/js/solarsystem.js +++ b/js/solarsystem.js @@ -120,15 +120,15 @@ export default function initSolarSystem(ctx) { for (const b of BODIES) { const pos = posOf(b.key, d); const r = bodyRadius(b.km, b.sun); - // Billboard pixel size = the body's angular size at a reference distance, - // grown as you approach so a planet fills the view up close. - const px = Math.max(10, (r * 2) / 90000); // ~screen px at ~ the fly-to range + // The disc canvas is 256px; `scale` is a MULTIPLIER on that. Small values: + // ~2.4 when you're right at the planet (fills the view), ~0.12 far away (a + // dot). Per-body near distance = just outside its own radius. const ent = ds.entities.add({ name: b.name, position: pos, billboard: { image: makeDisc(b), - scaleByDistance: new Cesium.NearFarScalar(r * 3, px * 8, 2.5e9, Math.max(3, px * 0.05)), + scaleByDistance: new Cesium.NearFarScalar(r * 2.5, 2.4, 9e8, 0.12), disableDepthTestDistance: Number.POSITIVE_INFINITY, }, label: { @@ -191,11 +191,12 @@ export default function initSolarSystem(ctx) { if (s === ds) continue; saved.dataSources.push([s, s.show]); s.show = false; } + // NOTE: do NOT blanket-hide scene.primitives by duck-typing — that also hides + // Cesium's shared DataSourceDisplay collections (the very ones our planets + // render into). The bespoke billboard layers (aircraft/military/adsb/radius) + // sit at Earth-surface coords → a tiny speck near the Sun in the orrery, so + // leaving them visible is harmless. saved.primitives = []; - for (let i = 0; i < scene.primitives.length; i++) { - const p = scene.primitives.get(i); - if (p && typeof p.length === 'number' && 'show' in p) { saved.primitives.push([p, p.show]); p.show = false; } - } saved.globe = scene.globe.show; scene.globe.show = false; saved.atmo = scene.globe.showGroundAtmosphere; scene.globe.showGroundAtmosphere = false; saved.sky = scene.skyAtmosphere.show; scene.skyAtmosphere.show = false;