fix: Solar System mode now RENDERS — the bug was hiding Cesium's shared collections
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 <noreply@anthropic.com>
This commit is contained in:
parent
d0d3da116c
commit
0a6bbfaa23
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user