spacemap 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/spacemap.iife.js +3 -3
- package/dist/spacemap.js +3 -3
- package/index.js +54 -18
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8967,6 +8967,12 @@ var ChunkWindow = class {
|
|
|
8967
8967
|
done
|
|
8968
8968
|
};
|
|
8969
8969
|
}
|
|
8970
|
+
request(jd) {
|
|
8971
|
+
for (const [zone, params] of this.zoneParams) {
|
|
8972
|
+
const idx = chunkIndexForJd(params, jd);
|
|
8973
|
+
if (this.isLoadable(params, idx)) this.loadChunk(zone, params, idx, "high")?.catch(() => {});
|
|
8974
|
+
}
|
|
8975
|
+
}
|
|
8970
8976
|
loadingAt(jd, zone) {
|
|
8971
8977
|
if (this.inflight.size === 0) return false;
|
|
8972
8978
|
for (const [name, params] of this.zoneParams) {
|
|
@@ -10378,7 +10384,7 @@ function dedupeById(bodies) {
|
|
|
10378
10384
|
async function loadScene(ctx, date, targetId) {
|
|
10379
10385
|
performance.mark("sm-load-start");
|
|
10380
10386
|
loadProgress.reset();
|
|
10381
|
-
loadSystemsGlobal().catch((e) => console.warn("scene-load: systems-global (GMs/nutation) failed to load:", e));
|
|
10387
|
+
const systemsGlobalPromise = loadSystemsGlobal().catch((e) => console.warn("scene-load: systems-global (GMs/nutation) failed to load:", e));
|
|
10382
10388
|
const atmospheresPromise = loadAtmospheres().catch((e) => console.warn("scene-load: atmospheres failed to load — rendering without shells:", e));
|
|
10383
10389
|
const jd = dateToJD(date);
|
|
10384
10390
|
const metadataPromise = fetchMetadata();
|
|
@@ -10410,6 +10416,7 @@ async function loadScene(ctx, date, targetId) {
|
|
|
10410
10416
|
loadProgress.reach("ephemeris");
|
|
10411
10417
|
const loader = new ChunkLoader(ctx.chebStore);
|
|
10412
10418
|
if (ctx.probeStore) ctx.probeStore.fitCenterUsable = (id) => (ctx.chebStore?.has(id) ?? false) || ctx.getBody(id) !== void 0;
|
|
10419
|
+
await systemsGlobalPromise;
|
|
10413
10420
|
const major = await loadMajorBodies(ctx, loader, metadata, date, jd, await passengerPromise);
|
|
10414
10421
|
loadProgress.reach("majors");
|
|
10415
10422
|
await atmospheresPromise;
|
|
@@ -21895,10 +21902,11 @@ var Placer = class {
|
|
|
21895
21902
|
ride = planRideMarkers([], void 0, () => void 0);
|
|
21896
21903
|
rideJd = NaN;
|
|
21897
21904
|
rideFocus;
|
|
21898
|
-
constructor(ctx, bodyObjects, diagnostics) {
|
|
21905
|
+
constructor(ctx, bodyObjects, diagnostics, held = () => false) {
|
|
21899
21906
|
this.ctx = ctx;
|
|
21900
21907
|
this.bodyObjects = bodyObjects;
|
|
21901
21908
|
this.diagnostics = diagnostics;
|
|
21909
|
+
this.held = held;
|
|
21902
21910
|
}
|
|
21903
21911
|
begin(jd, focusedId, frame) {
|
|
21904
21912
|
this.passJd = jd;
|
|
@@ -21922,6 +21930,7 @@ var Placer = class {
|
|
|
21922
21930
|
this.place(body, this.passJd);
|
|
21923
21931
|
}
|
|
21924
21932
|
place(body, jd) {
|
|
21933
|
+
if (jd !== this.passJd && this.held()) jd = this.passJd;
|
|
21925
21934
|
const id = body.data.id;
|
|
21926
21935
|
if (jd === this.passJd && this.settled.has(id)) return body.position;
|
|
21927
21936
|
if (this.settling.has(id)) {
|
|
@@ -24169,6 +24178,8 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24169
24178
|
disposed = false;
|
|
24170
24179
|
lastDataVersion = -1;
|
|
24171
24180
|
dateHolds = 0;
|
|
24181
|
+
seenJumps = 0;
|
|
24182
|
+
jumpJd = null;
|
|
24172
24183
|
focusWasOutOfRange = false;
|
|
24173
24184
|
seekAwaitsData = false;
|
|
24174
24185
|
frameIndex = 0;
|
|
@@ -24224,6 +24235,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24224
24235
|
this.ctx = ctx;
|
|
24225
24236
|
ctx.hasMeshBody = (id) => this.bodyObjects.has(id);
|
|
24226
24237
|
this.clock = clock;
|
|
24238
|
+
this.seenJumps = clock.jumps;
|
|
24227
24239
|
this.callbacks = callbacks;
|
|
24228
24240
|
this.outOfRange = new OutOfRangeNotifier(callbacks.notices);
|
|
24229
24241
|
this.labelContainer = labelContainer;
|
|
@@ -24273,7 +24285,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24273
24285
|
this.orbitPreview.setLayer(SceneRenderer.MAP_LAYER);
|
|
24274
24286
|
this.skyboxAdjuster.set(0, 0, 0);
|
|
24275
24287
|
loadSkybox(this.scene, this.renderer, ctx, () => this.disposed);
|
|
24276
|
-
this.placer = new Placer(ctx, this.bodyObjects, this.positionDiagnostics);
|
|
24288
|
+
this.placer = new Placer(ctx, this.bodyObjects, this.positionDiagnostics, () => this.dateHeld());
|
|
24277
24289
|
ctx.placer = this.placer;
|
|
24278
24290
|
const focusBody = [
|
|
24279
24291
|
ctx.getBody(initialView.id),
|
|
@@ -24413,7 +24425,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24413
24425
|
return;
|
|
24414
24426
|
}
|
|
24415
24427
|
this.travelPath.setVisible(true);
|
|
24416
|
-
this.travelPath.setClock(this.
|
|
24428
|
+
this.travelPath.setClock(this.sceneJd);
|
|
24417
24429
|
this.travelPath.reposition(center, this.focus.focusTruePos, (id) => this.where(id));
|
|
24418
24430
|
this.travelPath.updateCameraOffset(this.camera.position);
|
|
24419
24431
|
this.reserveTravelLabelSpace();
|
|
@@ -24545,10 +24557,10 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24545
24557
|
return this.focus.focusDurationMs;
|
|
24546
24558
|
}
|
|
24547
24559
|
where(id) {
|
|
24548
|
-
return this.placer.at(id, this.
|
|
24560
|
+
return this.placer.at(id, this.sceneJd);
|
|
24549
24561
|
}
|
|
24550
24562
|
whereBody(body) {
|
|
24551
|
-
return this.placer.place(body, this.
|
|
24563
|
+
return this.placer.place(body, this.sceneJd);
|
|
24552
24564
|
}
|
|
24553
24565
|
repositionBodies() {
|
|
24554
24566
|
const [fx, fy, fz] = this.focus.focusTruePos;
|
|
@@ -24566,7 +24578,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24566
24578
|
if (!line) continue;
|
|
24567
24579
|
const trailBuffer = line.userData.trailBuffer;
|
|
24568
24580
|
if (trailBuffer) {
|
|
24569
|
-
refreshBufferTrail(bo.body, line, trailBuffer, basis, this.
|
|
24581
|
+
refreshBufferTrail(bo.body, line, trailBuffer, basis, this.sceneJd);
|
|
24570
24582
|
continue;
|
|
24571
24583
|
}
|
|
24572
24584
|
const localPositions = line.userData.trailLocalPositions;
|
|
@@ -24581,7 +24593,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24581
24593
|
const nowMs = performance.now();
|
|
24582
24594
|
const frameDtMs = this.lastTickMs ? nowMs - this.lastTickMs : 0;
|
|
24583
24595
|
this.lastTickMs = nowMs;
|
|
24584
|
-
if (!this.holdingCamera) this.cameraUp.update(this.
|
|
24596
|
+
if (!this.holdingCamera) this.cameraUp.update(this.sceneJd);
|
|
24585
24597
|
if (this.firstFrame) {
|
|
24586
24598
|
this.firstFrame = false;
|
|
24587
24599
|
this.controls.target.set(0, 0, 0);
|
|
@@ -24608,7 +24620,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24608
24620
|
this.lastRenderedCamQuat.copy(this.camera.quaternion);
|
|
24609
24621
|
this.applyJdUpdate(true);
|
|
24610
24622
|
this.refreshTravelFocus();
|
|
24611
|
-
this.callbacks.onFrame?.(this.
|
|
24623
|
+
this.callbacks.onFrame?.(this.sceneJd, renderedDtMs);
|
|
24612
24624
|
const controlsSettled = this.holdingCamera ? this.applyHeldCamera() : stepFocusAnimation(this.focus, this.camera, this.controls, () => this.repositionAll(), () => this.pointClouds.rebuildBasis());
|
|
24613
24625
|
this.applyReaderLimits(nowMs);
|
|
24614
24626
|
const focused = this.holdingCamera ? void 0 : this.focusController.current;
|
|
@@ -24631,13 +24643,13 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24631
24643
|
if (this.systemData.hasPendingUnloads() && performance.now() - this.focus.focusStartTime >= this.focus.focusDurationMs) this.systemData.drainPendingUnloads();
|
|
24632
24644
|
const { distance } = this.getCameraState();
|
|
24633
24645
|
this.updateTravelCraftSystem();
|
|
24634
|
-
this.ctx.visibility.updateCamera(distance, this.
|
|
24646
|
+
this.ctx.visibility.updateCamera(distance, this.sceneJd);
|
|
24635
24647
|
this.updateTightFar(distance);
|
|
24636
24648
|
this.systemData.syncToFocus();
|
|
24637
24649
|
this.refreshTravelPath();
|
|
24638
24650
|
this.refreshOrbitPreview();
|
|
24639
24651
|
this.extensions.update({
|
|
24640
|
-
jd: this.
|
|
24652
|
+
jd: this.sceneJd,
|
|
24641
24653
|
basis: this.focus.focusTruePos,
|
|
24642
24654
|
camera: this.camera,
|
|
24643
24655
|
viewportPx: this.viewportH,
|
|
@@ -24648,7 +24660,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24648
24660
|
refreshDeferredTrails(this.bodyObjects, this.focus, this.lastUpdatedJd, this.trailView());
|
|
24649
24661
|
updateRingShaders(this.bodyObjects, this.focus.focusTruePos, sceneSettings().realisticLighting, sceneSettings().overexposeRings, this.camera.position, this.pxPerRad());
|
|
24650
24662
|
updateEclipseUniforms(this.bodyObjects, this.focus.focusTruePos);
|
|
24651
|
-
const atmoState = updateAtmosphereShaders(this.bodyObjects, this.camera.position, sceneSettings().showAtmospheres, sceneSettings().realisticLighting, this.sunIntensityScale, currentAtmosphereConfig(), this.
|
|
24663
|
+
const atmoState = updateAtmosphereShaders(this.bodyObjects, this.camera.position, sceneSettings().showAtmospheres, sceneSettings().realisticLighting, this.sunIntensityScale, currentAtmosphereConfig(), this.sceneJd);
|
|
24652
24664
|
recordAtmospherePerf(renderedDtMs, atmoState.shellProminent);
|
|
24653
24665
|
this.scene.backgroundIntensity = atmoState.skyboxIntensity;
|
|
24654
24666
|
this.applyLayerChrome();
|
|
@@ -24665,7 +24677,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24665
24677
|
for (const light of this.ambientLights) light.intensity = ambient;
|
|
24666
24678
|
updateUserLocationOcclusion(this.userLocationMarker, this.bodyObjects, this.camera);
|
|
24667
24679
|
const focusedIdLod = nomenclatureBodyId(this.focusController.current, this.bodyObjects);
|
|
24668
|
-
updateTextureLOD(this.bodyObjects, this.camera, this.renderer, this.ctx, this.textureLoader, focusedIdLod, this.
|
|
24680
|
+
updateTextureLOD(this.bodyObjects, this.camera, this.renderer, this.ctx, this.textureLoader, focusedIdLod, this.sceneJd, this.appearances, this.invalidate);
|
|
24669
24681
|
updateSphereLOD(this.bodyObjects, this.camera, this.renderer, this.ctx, focusedIdLod);
|
|
24670
24682
|
updateSunShadowLight(this.bodyObjects, this.focus.focusTruePos, this.ctx, this.shadowLight, this.sunPointLight, distance, this._tmpV3, sceneSettings().realisticLighting, this.sunIntensityScale);
|
|
24671
24683
|
this.updateModelMounts();
|
|
@@ -24792,7 +24804,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
24792
24804
|
};
|
|
24793
24805
|
if (!seated || !body.orientation) return void 0;
|
|
24794
24806
|
return {
|
|
24795
|
-
invQuat: bodyQuaternion(body.orientation, this.
|
|
24807
|
+
invQuat: bodyQuaternion(body.orientation, this.sceneJd, body.nutPrec).invert(),
|
|
24796
24808
|
seated,
|
|
24797
24809
|
radialKm: (dir) => renderedSurfaceRadialKm(bo, body.data.id, body.data.radiusKm, dir)
|
|
24798
24810
|
};
|
|
@@ -25048,7 +25060,7 @@ var SceneRenderer = class SceneRenderer {
|
|
|
25048
25060
|
}
|
|
25049
25061
|
applyHeldCamera() {
|
|
25050
25062
|
const pose = this.cameraHold;
|
|
25051
|
-
const resolved = pose && resolvePose(pose, this.ctx, this.
|
|
25063
|
+
const resolved = pose && resolvePose(pose, this.ctx, this.sceneJd);
|
|
25052
25064
|
if (!resolved) return true;
|
|
25053
25065
|
const basis = this.focus.focusTruePos;
|
|
25054
25066
|
this.camera.up.set(resolved.up[0], resolved.up[1], resolved.up[2]).normalize();
|
|
@@ -25081,10 +25093,10 @@ var SceneRenderer = class SceneRenderer {
|
|
|
25081
25093
|
maybeLoadTexture(body) {
|
|
25082
25094
|
const bo = this.bodyObjects.get(body.data.id);
|
|
25083
25095
|
if (!bo) return;
|
|
25084
|
-
loadBodyTexture(bo, this.textureLoader, this.
|
|
25096
|
+
loadBodyTexture(bo, this.textureLoader, this.sceneJd, this.scene, this.renderer.capabilities.maxTextureSize, this.ctx).then(() => {
|
|
25085
25097
|
if (this.focusController.current?.data.id !== body.data.id) return;
|
|
25086
25098
|
if (body.orientation && bo.mesh) {
|
|
25087
|
-
applyOrientation(bo.mesh, body.orientation, this.
|
|
25099
|
+
applyOrientation(bo.mesh, body.orientation, this.sceneJd, body.nutPrec);
|
|
25088
25100
|
this.focusController.reapplyInitialViewIfPending();
|
|
25089
25101
|
}
|
|
25090
25102
|
});
|
|
@@ -25171,8 +25183,32 @@ var SceneRenderer = class SceneRenderer {
|
|
|
25171
25183
|
held = false;
|
|
25172
25184
|
};
|
|
25173
25185
|
}
|
|
25186
|
+
jumpLoads() {
|
|
25187
|
+
const { clock, ctx } = this;
|
|
25188
|
+
if (clock.jumps !== this.seenJumps) {
|
|
25189
|
+
this.seenJumps = clock.jumps;
|
|
25190
|
+
this.jumpJd = clock.jd;
|
|
25191
|
+
ctx.refreshTick(jdToDate(clock.jd));
|
|
25192
|
+
ctx.chebStore?.request(clock.jd);
|
|
25193
|
+
ctx.probeStore?.request(clock.jd);
|
|
25194
|
+
}
|
|
25195
|
+
const jd = this.jumpJd;
|
|
25196
|
+
if (jd === null) return false;
|
|
25197
|
+
if (!ctx.chebStore?.loadingAt(jd) && !ctx.probeStore?.loadingAt(jd)) {
|
|
25198
|
+
this.jumpJd = null;
|
|
25199
|
+
return false;
|
|
25200
|
+
}
|
|
25201
|
+
this.invalidate();
|
|
25202
|
+
return true;
|
|
25203
|
+
}
|
|
25204
|
+
dateHeld() {
|
|
25205
|
+
return !Number.isNaN(this.lastUpdatedJd) && (this.dateHolds > 0 || this.jumpLoads());
|
|
25206
|
+
}
|
|
25207
|
+
get sceneJd() {
|
|
25208
|
+
return this.dateHeld() ? this.lastUpdatedJd : this.clock.jd;
|
|
25209
|
+
}
|
|
25174
25210
|
applyJdUpdate(allowOorRefocus = false) {
|
|
25175
|
-
if (this.dateHolds > 0) return;
|
|
25211
|
+
if (this.dateHolds > 0 || this.jumpLoads()) return;
|
|
25176
25212
|
this.ensureFocusedProbeTarget();
|
|
25177
25213
|
const systemId = this.ctx.visibility.focusedSystemId;
|
|
25178
25214
|
const seatKey = this.focusedSeatConfigKey();
|
package/package.json
CHANGED