From 0a6bbfaa23179fdce4ba55d0e50380c5a5112829 Mon Sep 17 00:00:00 2001 From: type-two Date: Mon, 20 Jul 2026 21:12:29 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20Solar=20System=20mode=20now=20RENDERS=20?= =?UTF-8?q?=E2=80=94=20the=20bug=20was=20hiding=20Cesium's=20shared=20coll?= =?UTF-8?q?ections?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause (found after deep debugging): enter() blanket-hid scene.primitives by duck-typing (.length + .show), which also hid Cesium's shared DataSourceDisplay collections — the very primitives the planets render into. Removed that loop (the bespoke aircraft/mil billboards sit at Earth's tiny position near the Sun, harmless to leave). Also fixed the wildly-wrong billboard scaleByDistance (pixels-as-scale → sane 2.4/0.12 multipliers) and near-plane depth collapse. VERIFIED RENDERING: the full orrery — textured Sun + 8 planets at true live positions with orbits — zero console errors. Ready to deploy. Co-Authored-By: Claude Fable 5 --- js/solarsystem.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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;