@johnmorrisdotca/chikyu-earth 0.49.0 → 0.51.0
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/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/dist/realistic/earth.d.ts +3 -0
- package/dist/realistic/earth.js +19 -3
- package/dist/realistic/element-base.d.ts +13 -0
- package/dist/realistic/element-base.js +23 -6
- package/dist/realistic/light-fade.d.ts +22 -0
- package/dist/realistic/light-fade.js +36 -0
- package/dist/satellites/catalogue.d.ts +1 -1
- package/dist/satellites/catalogue.js +5 -4
- package/dist/satellites/index.d.ts +1 -0
- package/dist/satellites/index.js +1 -0
- package/dist/satellites/kana.d.ts +16 -0
- package/dist/satellites/kana.js +24 -0
- package/dist/space/element-base.d.ts +13 -0
- package/dist/space/element-base.js +23 -7
- package/dist/space/generic-satellite.d.ts +6 -1
- package/dist/space/generic-satellite.js +16 -4
- package/dist/space/index.d.ts +1 -0
- package/dist/space/index.js +1 -0
- package/dist/space/model-lights.d.ts +14 -0
- package/dist/space/model-lights.js +19 -0
- package/dist/space/path-controls.d.ts +4 -1
- package/dist/space/path-controls.js +13 -6
- package/dist/space/path-ribbons.d.ts +13 -0
- package/dist/space/path-ribbons.js +38 -4
- package/dist/space/satellite-layer.d.ts +1 -0
- package/dist/space/satellite-layer.js +64 -10
- package/dist/space/scene.d.ts +3 -0
- package/dist/space/scene.js +33 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.51.0 - 2026-11-13
|
|
4
|
+
|
|
5
|
+
- **The ridden satellite's own orbit grows out of the camera** (MODULES-1340). In Ride along the orbit ahead, seen edge-on, was a hard bright stroke. Its opacity now rises from nothing at the camera to the path's whole look about 300 km along it (`RIDE_PATH_FADE_KM`, a smooth rise worked out in the ribbon shader from each point's distance to the camera: no extra draw, nothing drawn at rest, and every other path unchanged). The ribbon now reaches the camera for it instead of stopping 64 km short.
|
|
6
|
+
- **The ridden satellite's group orbit line is left out** (MODULES-1340). While a satellite is ridden, the group's own orbit line for it is not drawn, nor the lines of objects on the same orbit (the modules of the ISS), because the ribbon draws its path in the `selected` look; with `selected-path` off the ridden satellite has no orbit line, which is what that switch means. The other satellites keep their lines, and all of them come back when the ride ends. `stats.satellites.orbitLines` counts the group orbit lines drawn.
|
|
7
|
+
- **A test that a painter's model brings no light of its own** (MODULES-1293). The ISS model test now counts the lights each live GL program was made for and wants every lit one made for the scene's one Sun; with the strip switched off it fails. Test only.
|
|
8
|
+
|
|
9
|
+
## 0.50.0 - 2026-11-13
|
|
10
|
+
|
|
11
|
+
- **The catalogue search folds kana** (MODULES-1268). `findInCatalogue` folds hiragana to katakana and small kana to full-size on both sides of the comparison (and half-width katakana by NFKC), so `はっぶる` finds `ハッブル`, in satellite names and group labels; the long-vowel mark is left alone. `foldKana(text)` is the same fold, exported from `@johnmorrisdotca/chikyu-earth/satellites` for a page's own search box.
|
|
12
|
+
- **A painter's model no longer adds a program to every lit material** (MODULES-1293). The scene now owns one Sun light, always there, and a satellite model made by `setSatellitePainter` is lit by it: a light the model carries (directional, point, spot, hemisphere, area) is switched off when the model is added, and its colour and strength are worn by the scene's Sun while the model is shown (an ambient light is left). Before, a model with its own light changed the number of lights in the scene the first time a ride showed it, and three kept a second program of the same code for each lit material (the clouds, the plain bodies) until it was let go: one more program at the end of a long run than at the start. The ride-along guide says a painter must not add lights and what to do to keep its look. The soak's warm-up now rides the ISS outside until its model is drawn, runs a clock past the satellites' speed limit and shows the package's own drawing once.
|
|
13
|
+
- **A short cross-fade when `light` changes to or from `lit`.** The Earth's night lights, and in the realistic view the direction of its light, move between the two looks over 300 ms instead of cutting, in the frames of one loop that ends by itself (nothing is drawn at rest). A reader who asked for reduced motion gets the cut. `stats.lightFade` is `{ mix, fading }`.
|
|
14
|
+
- **`path-priority` says whether a dot or a path is heard first** (MODULES-1332). Where a satellite's dot and a path lie under the pointer, `dots` (the default, as before) is the dot's, which at the Low level, with thousands of dots crowding a line, can leave a path unheard. `path-priority="paths"` (the property `pathPriority`) hears a path of the page's before a dot, except a dot of a satellite whose path is listed or that is chosen or ridden, which still wins. Press and hover follow the same order, and one press still has one meaning. On both elements.
|
|
15
|
+
|
|
3
16
|
## 0.49.0 - 2026-11-13
|
|
4
17
|
|
|
5
18
|
- **Satellites far from today, as an estimate** (MODULES-1296). `estimate-far` (the property `estimateFar`, or `createSatellites(sets, { estimateFar: true })`; off by default) keeps placing a satellite beyond 30 days from its elements: the same elements carried forward or back by the same SGP4 code, drawn lighter than a dimmed one, with `estimated: true` and `estimatedDays` (how far the moment is from the elements', in days) in `placeSatellite`, `satelliteInfo` and the details of `chikyu-satellite-click` and `chikyu-satellite-visibility`, and `stats.satellites.estimated`. The docs say what an estimate is (where it would be had its orbit not changed) and where it is worst (low orbits, months away). Never before an element set's `LAUNCH_DATE` (else the year of its `OBJECT_ID`) or after its `DECAY_DATE`, both new optional fields that `parseElements` keeps; a satellite SGP4 cannot carry that far, or brings below about 120 km, is left out and not counted as placed.
|
package/README.md
CHANGED
|
@@ -612,7 +612,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
612
612
|
|
|
613
613
|
## How to cite
|
|
614
614
|
|
|
615
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.
|
|
615
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.51.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
616
616
|
|
|
617
617
|
GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA. Cite the version you used (`npm ls @johnmorrisdotca/chikyu-earth`), and credit the sources behind the numbers and pictures: [NOTICE.md](NOTICE.md) says who made each one and under what terms.
|
|
618
618
|
|
|
@@ -3,6 +3,7 @@ import type { AssetCache, Item3D } from "@johnmorrisdotca/kazoku-ui/renderer";
|
|
|
3
3
|
import type { GeoPoint, GlobeView } from "../types.ts";
|
|
4
4
|
import type { SatelliteRef } from "../satellites/types.ts";
|
|
5
5
|
import { lookAt } from "../view.ts";
|
|
6
|
+
import { type LightFade } from "./light-fade.ts";
|
|
6
7
|
import type { PathHit } from "../space/paths.ts";
|
|
7
8
|
import { type SatelliteScreen, type SatelliteState } from "../space/satellite-layer.ts";
|
|
8
9
|
import type { Layer } from "./tiers.ts";
|
|
@@ -65,6 +66,8 @@ export interface EarthModel {
|
|
|
65
66
|
lights: boolean;
|
|
66
67
|
/** How the Earth is lit (see `LightMode`). */
|
|
67
68
|
light: LightMode;
|
|
69
|
+
/** The cross-fade between the true light and `lit`, stepped at each draw (src/realistic/light-fade.ts). */
|
|
70
|
+
lightFade: LightFade;
|
|
68
71
|
/** How the camera is held (see `CameraMode`). */
|
|
69
72
|
camera: CameraMode;
|
|
70
73
|
/** How many times its real thickness the air is drawn, 1 to 5 (`AIR_THICKNESS_DEFAULT` until the element says otherwise); read at every draw. */
|
package/dist/realistic/earth.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { HOME_VIEW, lookAt } from "../view.js";
|
|
2
2
|
import { AIR_QUALITY, AIR_THICKNESS_DEFAULT, AIR_VERT, airFrag, airTop } from "./air.js";
|
|
3
3
|
import { CLOUD_FRAG, SURFACE_FRAG, SURFACE_VERT } from "./shaders.js";
|
|
4
|
+
import { newLightFade, stepLightFade } from "./light-fade.js";
|
|
5
|
+
import { prefersLessMotion } from "../meteors/note.js";
|
|
4
6
|
import { greenwichSidereal, subsolarPoint, unitVector } from "./sun.js";
|
|
5
7
|
import { createSatelliteLayer, newSatelliteState } from "../space/satellite-layer.js";
|
|
6
8
|
import { createTextureSet } from "./textures.js";
|
|
@@ -35,6 +37,7 @@ export const newModel = () => ({
|
|
|
35
37
|
clouds: true,
|
|
36
38
|
lights: true,
|
|
37
39
|
light: "sun",
|
|
40
|
+
lightFade: newLightFade(),
|
|
38
41
|
camera: "space",
|
|
39
42
|
airThickness: AIR_THICKNESS_DEFAULT,
|
|
40
43
|
cloudDrift: 0,
|
|
@@ -220,13 +223,26 @@ export function createEarthItem(model, deps) {
|
|
|
220
223
|
const [sx, sy, sz] = unitVector(subsolarPoint(model.time));
|
|
221
224
|
sunLocal.value.set(sx, sy, sz);
|
|
222
225
|
sunDir.value.set(sx, sy, sz).applyEuler(turned.rotation);
|
|
223
|
-
|
|
224
|
-
|
|
226
|
+
const fade = stepLightFade(model.lightFade, model.light === "lit", performance.now(), prefersLessMotion());
|
|
227
|
+
// one more frame while it moves, and none once it has arrived
|
|
228
|
+
if (fade.fading)
|
|
229
|
+
deps.invalidate();
|
|
230
|
+
if (fade.mix > 0) {
|
|
231
|
+
// between the true light and daylight from the camera's side: the direction is mixed, and a mix that cancels (the Sun straight behind) is the camera's side
|
|
232
|
+
const x = sunDir.value.x * (1 - fade.mix);
|
|
233
|
+
const y = sunDir.value.y * (1 - fade.mix);
|
|
234
|
+
const z = sunDir.value.z * (1 - fade.mix) + fade.mix;
|
|
235
|
+
const length = Math.hypot(x, y, z);
|
|
236
|
+
if (length > 1e-6)
|
|
237
|
+
sunDir.value.set(x / length, y / length, z / length);
|
|
238
|
+
else
|
|
239
|
+
sunDir.value.set(0, 0, 1);
|
|
240
|
+
}
|
|
225
241
|
cloudShift.value = -(((model.time / 3_600_000) * model.cloudDrift) % 360) / 360;
|
|
226
242
|
clouds.visible = model.clouds;
|
|
227
243
|
atmosphere.uniforms["thick"].value = model.airThickness;
|
|
228
244
|
glow.scale.setScalar(airTop(model.airThickness));
|
|
229
|
-
surface.uniforms["lights"].value = model.lights
|
|
245
|
+
surface.uniforms["lights"].value = model.lights ? 1 - fade.mix : 0;
|
|
230
246
|
surface.uniforms["boost"].value = model.light === "boost" ? 1 : 0;
|
|
231
247
|
const radius = discRadius(size.width, size.height, view.zoom);
|
|
232
248
|
camera.left = (-size.width / 2 - view.panX) / radius;
|
|
@@ -61,6 +61,7 @@ type SatelliteStats = {
|
|
|
61
61
|
hoverPath: boolean;
|
|
62
62
|
hoverOpacity: number;
|
|
63
63
|
selectedOpacity: number;
|
|
64
|
+
orbitLines: number;
|
|
64
65
|
estimated: number;
|
|
65
66
|
};
|
|
66
67
|
/**
|
|
@@ -376,6 +377,11 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
376
377
|
tiers: Record<EarthLayer, number>;
|
|
377
378
|
tiles: TileStats;
|
|
378
379
|
satellites: SatelliteStats;
|
|
380
|
+
/** The cross-fade when `light` changes to or from `lit` (300 ms, a cut under reduced motion): `mix` is 0 for the true light and 1 for `lit`, and `fading` is true while it moves and another frame is wanted. */
|
|
381
|
+
lightFade: {
|
|
382
|
+
mix: number;
|
|
383
|
+
fading: boolean;
|
|
384
|
+
};
|
|
379
385
|
/** The page's paths: asked for, drawn (with the chosen satellite's own), left out over the cap of 16, unmatched, whether the chosen satellite's own orbit is drawn, draw calls they took at the last draw (0 or 1), the path under the mouse and the `chikyu-path-click` events sent. */
|
|
380
386
|
paths: PathStats;
|
|
381
387
|
draws: number;
|
|
@@ -636,6 +642,13 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
636
642
|
*/
|
|
637
643
|
get pathHit(): number;
|
|
638
644
|
set pathHit(value: number);
|
|
645
|
+
/**
|
|
646
|
+
* Which is heard first where a satellite's dot and a path lie under the pointer (the attribute `path-priority`): `dots`, the default, or `paths`. With `dots` a press or a hover is the dot's, and a path is heard only where no dot is within 12 px: at the Low level, with thousands of dots crowding a line, a path can go unheard.
|
|
647
|
+
* With `paths` a path of the page's (`setPaths`, or the chosen satellite's own orbit) is heard before a dot, **except** a dot of a satellite that is itself one of the paths' satellites or the chosen or ridden one: that satellite's own dot still wins, and a press on it is `chikyu-satellite-click`.
|
|
648
|
+
* Either way one press has one meaning, in this order. `dots`: any dot, then a path, then the sky. `paths`: a listed or chosen satellite's dot, then a path, then any other dot, then the sky. Anything but `paths` reads as `dots`.
|
|
649
|
+
*/
|
|
650
|
+
get pathPriority(): "dots" | "paths";
|
|
651
|
+
set pathPriority(value: "dots" | "paths");
|
|
639
652
|
/**
|
|
640
653
|
* The path under a point of the element, from the last draw: its id as given, the satellite (`ref`, the same shape as in `chikyu-satellite-click`), the name of its look, the nearest point on it and the distance to it, or `null`.
|
|
641
654
|
*
|
|
@@ -11,7 +11,7 @@ import { createPaintState, paintedGround, paintedPeriod } from "../paint/buffer.
|
|
|
11
11
|
import { MAX_ORBIT_GROUP, readStreakMax } from "../space/satellite-layer.js";
|
|
12
12
|
import { applySatelliteFocus, satelliteEmphasis, satelliteGroupRows, shellRadiusOf, zoomForOrthographicShell } from "../space/satellite-focus.js";
|
|
13
13
|
import { claimPress } from "../sky/claim.js";
|
|
14
|
-
import { bindPaths, emptyPathStats, pointerOf } from "../space/path-controls.js";
|
|
14
|
+
import { bindPaths, emptyPathStats, pointerOf, readPathPriority } from "../space/path-controls.js";
|
|
15
15
|
import { styleTable } from "../space/paths.js";
|
|
16
16
|
import { bindSatelliteHover, hoverPathOn, hoverStyleOf, namesOnHover as namesHoverOn } from "../space/satellite-hover.js";
|
|
17
17
|
import { readMeteorStrength } from "../meteors/strength.js";
|
|
@@ -165,7 +165,7 @@ export const readTime = (value) => {
|
|
|
165
165
|
* ```
|
|
166
166
|
*/
|
|
167
167
|
export class ChikyuEarthRealistic extends HTMLElement {
|
|
168
|
-
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max", "hover-path", "names-on-hover", "selected-path", "path-hit", "estimate-far"];
|
|
168
|
+
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max", "hover-path", "names-on-hover", "selected-path", "path-hit", "path-priority", "estimate-far"];
|
|
169
169
|
#model = newModel();
|
|
170
170
|
#paint = createPaintState();
|
|
171
171
|
#mode = "now";
|
|
@@ -1219,6 +1219,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1219
1219
|
state: this.#state,
|
|
1220
1220
|
tiers: { ...this.#tiers },
|
|
1221
1221
|
satellites: this.#satelliteStats(),
|
|
1222
|
+
lightFade: { mix: this.#model.lightFade.mix, fading: this.#model.lightFade.fading },
|
|
1222
1223
|
paths: this.#pathControls?.stats() ?? emptyPathStats(),
|
|
1223
1224
|
tiles: this.#model.tiles?.stats ?? { ready: false, level: null, held: 0, shown: 0, loading: 0, failed: 0, requested: 0, heldBytes: 0, refused: 0, used: {}, finer: null, fading: false },
|
|
1224
1225
|
draws: stats?.draws ?? 0,
|
|
@@ -1574,6 +1575,20 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1574
1575
|
else
|
|
1575
1576
|
this.removeAttribute("path-hit");
|
|
1576
1577
|
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Which is heard first where a satellite's dot and a path lie under the pointer (the attribute `path-priority`): `dots`, the default, or `paths`. With `dots` a press or a hover is the dot's, and a path is heard only where no dot is within 12 px: at the Low level, with thousands of dots crowding a line, a path can go unheard.
|
|
1580
|
+
* With `paths` a path of the page's (`setPaths`, or the chosen satellite's own orbit) is heard before a dot, **except** a dot of a satellite that is itself one of the paths' satellites or the chosen or ridden one: that satellite's own dot still wins, and a press on it is `chikyu-satellite-click`.
|
|
1581
|
+
* Either way one press has one meaning, in this order. `dots`: any dot, then a path, then the sky. `paths`: a listed or chosen satellite's dot, then a path, then any other dot, then the sky. Anything but `paths` reads as `dots`.
|
|
1582
|
+
*/
|
|
1583
|
+
get pathPriority() {
|
|
1584
|
+
return readPathPriority(this.getAttribute("path-priority"));
|
|
1585
|
+
}
|
|
1586
|
+
set pathPriority(value) {
|
|
1587
|
+
if (value === "paths")
|
|
1588
|
+
this.setAttribute("path-priority", "paths");
|
|
1589
|
+
else
|
|
1590
|
+
this.removeAttribute("path-priority");
|
|
1591
|
+
}
|
|
1577
1592
|
/**
|
|
1578
1593
|
* The path under a point of the element, from the last draw: its id as given, the satellite (`ref`, the same shape as in `chikyu-satellite-click`), the name of its look, the nearest point on it and the distance to it, or `null`.
|
|
1579
1594
|
*
|
|
@@ -1610,7 +1625,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1610
1625
|
let epochMs = 0;
|
|
1611
1626
|
for (const group of this.#model.satellites.groups.values())
|
|
1612
1627
|
epochMs = Math.max(epochMs, group.satellites.newestEpochMs);
|
|
1613
|
-
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity, estimated: drawn.estimated };
|
|
1628
|
+
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity, orbitLines: drawn.orbitLines, estimated: drawn.estimated };
|
|
1614
1629
|
}
|
|
1615
1630
|
// A press that does not turn the view (under 6 pixels) on a satellite tells the page, which chooses it with `selectSatellite` if it likes.
|
|
1616
1631
|
#downX = 0;
|
|
@@ -1626,14 +1641,16 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1626
1641
|
if (Math.hypot(event.clientX - this.#downX, event.clientY - this.#downY) > 6)
|
|
1627
1642
|
return;
|
|
1628
1643
|
const rect = this.getBoundingClientRect();
|
|
1644
|
+
// one press, one meaning: the paths decide first, since which of a dot and a path wins depends on `path-priority` (a dot wins in the default, and the paths say so by answering no)
|
|
1645
|
+
if (this.#pathControls?.press(event.clientX - rect.left, event.clientY - rect.top, pointerOf(event))) {
|
|
1646
|
+
claimPress(event);
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1629
1649
|
const satellite = this.#model.pick?.(event.clientX - rect.left, event.clientY - rect.top, 12);
|
|
1630
1650
|
if (satellite) {
|
|
1631
1651
|
claimPress(event);
|
|
1632
1652
|
this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite), ...this.#estimateOf(satellite) }, bubbles: true, composed: true }));
|
|
1633
|
-
return;
|
|
1634
1653
|
}
|
|
1635
|
-
if (this.#pathControls?.press(event.clientX - rect.left, event.clientY - rect.top, pointerOf(event)))
|
|
1636
|
-
claimPress(event);
|
|
1637
1654
|
};
|
|
1638
1655
|
#wheel = (event) => immersiveWheel(this, event);
|
|
1639
1656
|
/** The view as it is (for a page that wants to read it back). */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** How long the cross-fade takes, in milliseconds. */
|
|
2
|
+
export declare const LIGHT_FADE_MS = 300;
|
|
3
|
+
/** Where the fade is: `mix` is 0 for the true light and 1 for `lit`. */
|
|
4
|
+
export interface LightFade {
|
|
5
|
+
mix: number;
|
|
6
|
+
target: number;
|
|
7
|
+
from: number;
|
|
8
|
+
started: number;
|
|
9
|
+
/** Whether the last step left it still moving, so another draw is wanted. */
|
|
10
|
+
fading: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const newLightFade: (lit?: boolean) => LightFade;
|
|
13
|
+
/**
|
|
14
|
+
* Step the fade to `now`. `lit` is where it is going. A change of `lit` starts a fade from where the mix is now (a fade turned round half way goes back from there); with `reduced` it jumps. Returns the same object, updated.
|
|
15
|
+
*
|
|
16
|
+
* @param fade - The fade to step.
|
|
17
|
+
* @param lit - Whether the light is `lit` now.
|
|
18
|
+
* @param now - The clock, in milliseconds.
|
|
19
|
+
* @param reduced - Whether the reader asked for less motion.
|
|
20
|
+
* @returns The fade: `mix` for this frame and `fading` true while another frame is wanted.
|
|
21
|
+
*/
|
|
22
|
+
export declare function stepLightFade(fade: LightFade, lit: boolean, now: number, reduced: boolean): LightFade;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// A short cross-fade when `light` changes to or from `lit`: the Earth's night lights and (in the realistic view) the direction of its light move from one look to the other over 300 ms instead of cutting. A reader who asked for reduced motion
|
|
2
|
+
// gets the cut. The fade is a state the draw steps: each draw asks for the next while it moves, and when it has arrived nothing is asked for, so at rest nothing is drawn.
|
|
3
|
+
/** How long the cross-fade takes, in milliseconds. */
|
|
4
|
+
export const LIGHT_FADE_MS = 300;
|
|
5
|
+
export const newLightFade = (lit = false) => ({ mix: lit ? 1 : 0, target: lit ? 1 : 0, from: lit ? 1 : 0, started: 0, fading: false });
|
|
6
|
+
/** A smooth start and end: 0 to 1 over `t` from 0 to 1. */
|
|
7
|
+
const ease = (t) => t * t * (3 - 2 * t);
|
|
8
|
+
/**
|
|
9
|
+
* Step the fade to `now`. `lit` is where it is going. A change of `lit` starts a fade from where the mix is now (a fade turned round half way goes back from there); with `reduced` it jumps. Returns the same object, updated.
|
|
10
|
+
*
|
|
11
|
+
* @param fade - The fade to step.
|
|
12
|
+
* @param lit - Whether the light is `lit` now.
|
|
13
|
+
* @param now - The clock, in milliseconds.
|
|
14
|
+
* @param reduced - Whether the reader asked for less motion.
|
|
15
|
+
* @returns The fade: `mix` for this frame and `fading` true while another frame is wanted.
|
|
16
|
+
*/
|
|
17
|
+
export function stepLightFade(fade, lit, now, reduced) {
|
|
18
|
+
const target = lit ? 1 : 0;
|
|
19
|
+
if (target !== fade.target) {
|
|
20
|
+
fade.target = target;
|
|
21
|
+
fade.from = fade.mix;
|
|
22
|
+
fade.started = now;
|
|
23
|
+
}
|
|
24
|
+
if (reduced || fade.mix === target) {
|
|
25
|
+
fade.mix = target;
|
|
26
|
+
fade.from = target;
|
|
27
|
+
fade.fading = false;
|
|
28
|
+
return fade;
|
|
29
|
+
}
|
|
30
|
+
const t = Math.min(1, Math.max(0, (now - fade.started) / LIGHT_FADE_MS));
|
|
31
|
+
fade.mix = fade.from + (target - fade.from) * ease(t);
|
|
32
|
+
if (t >= 1)
|
|
33
|
+
fade.mix = target;
|
|
34
|
+
fade.fading = fade.mix !== target;
|
|
35
|
+
return fade;
|
|
36
|
+
}
|
|
@@ -130,7 +130,7 @@ export interface CatalogueRow {
|
|
|
130
130
|
export declare function catalogueRows(lang?: "en" | "ja"): CatalogueRow[];
|
|
131
131
|
/**
|
|
132
132
|
* Find catalogue entries by name, group name, NORAD number, Japanese name or a group's Japanese label: "hubble", "hst", "25544", "weather" or "ハッブル".
|
|
133
|
-
* An English or numeric query ignores case, spaces and punctuation, as before.
|
|
133
|
+
* An English or numeric query ignores case, spaces and punctuation, as before. Japanese is folded on both sides: letter case, character width (NFKC) and kana (`foldKana`: hiragana to katakana, small kana to full-size, the long-vowel mark left alone), so `はっぶる` finds `ハッブル`; kanji are matched as typed. The width fold is applied before the English comparison too.
|
|
134
134
|
* A name that starts with the text comes before one that only has it inside.
|
|
135
135
|
*
|
|
136
136
|
* @param text - What the reader typed.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// A small curated catalogue of satellites worth following: the groups the demo offers as buttons and the famous ones by name. Facts (names, NORAD numbers, orbit types) and our own words;
|
|
2
2
|
// no orbital elements are here, and nothing is fetched. The elements come from the page (see docs/satellite-sources.md for the sources and their terms).
|
|
3
|
+
import { foldKana } from "./kana.js";
|
|
3
4
|
import { SHORT_NAMES } from "./names.js";
|
|
4
5
|
/**
|
|
5
6
|
* The groups, in the order the demo shows them. Each one is a CelesTrak list or a few single numbers; the elements are fetched by the page (or the demo's scheduled build), never by the package.
|
|
@@ -285,7 +286,7 @@ export function catalogueRows(lang) {
|
|
|
285
286
|
}
|
|
286
287
|
/**
|
|
287
288
|
* Find catalogue entries by name, group name, NORAD number, Japanese name or a group's Japanese label: "hubble", "hst", "25544", "weather" or "ハッブル".
|
|
288
|
-
* An English or numeric query ignores case, spaces and punctuation, as before.
|
|
289
|
+
* An English or numeric query ignores case, spaces and punctuation, as before. Japanese is folded on both sides: letter case, character width (NFKC) and kana (`foldKana`: hiragana to katakana, small kana to full-size, the long-vowel mark left alone), so `はっぶる` finds `ハッブル`; kanji are matched as typed. The width fold is applied before the English comparison too.
|
|
289
290
|
* A name that starts with the text comes before one that only has it inside.
|
|
290
291
|
*
|
|
291
292
|
* @param text - What the reader typed.
|
|
@@ -302,7 +303,7 @@ export function catalogueRows(lang) {
|
|
|
302
303
|
export function findInCatalogue(text, limit = 8) {
|
|
303
304
|
const source = text.normalize("NFKC");
|
|
304
305
|
const wanted = squash(source);
|
|
305
|
-
const folded = source.toLowerCase().trim();
|
|
306
|
+
const folded = foldKana(source).toLowerCase().trim();
|
|
306
307
|
const japanese = /[-ヿ一-鿿]/.test(source);
|
|
307
308
|
if (!wanted && !japanese)
|
|
308
309
|
return [];
|
|
@@ -312,8 +313,8 @@ export function findInCatalogue(text, limit = 8) {
|
|
|
312
313
|
const name = squash(entry.name);
|
|
313
314
|
const englishStart = wanted !== "" && (String(entry.noradId) === wanted || name.startsWith(wanted));
|
|
314
315
|
const englishInside = wanted !== "" && (name.includes(wanted) || squash(entry.group).includes(wanted) || squash(entry.about).includes(wanted));
|
|
315
|
-
const jaName = japanese ? (SHORT_NAMES[entry.noradId]?.ja ?? entry.name).
|
|
316
|
-
const labelJa = japanese ? (GROUPS_BY_ID.get(entry.group)?.labelJa ?? "").
|
|
316
|
+
const jaName = japanese ? foldKana(SHORT_NAMES[entry.noradId]?.ja ?? entry.name).toLowerCase() : "";
|
|
317
|
+
const labelJa = japanese ? foldKana(GROUPS_BY_ID.get(entry.group)?.labelJa ?? "").toLowerCase() : "";
|
|
317
318
|
const jaStart = japanese && folded !== "" && jaName.startsWith(folded);
|
|
318
319
|
const jaInside = japanese && folded !== "" && (jaName.includes(folded) || labelJa.includes(folded));
|
|
319
320
|
if (englishStart || jaStart)
|
|
@@ -3,6 +3,7 @@ export { NEAREST_COUNT, closeApproach, nearest, overheadKm, within, type Neighbo
|
|
|
3
3
|
export { DEFAULT_DIM_AFTER_DAYS, DEFAULT_MAX_AGE_DAYS, MAX_SATELLITE_SPEED } from "./limits.ts";
|
|
4
4
|
export type { ElementSet, RefusedElementSet, SatelliteInfo, SatelliteRef, Satellites } from "./types.ts";
|
|
5
5
|
export { SHORT_NAMES } from "./names.ts";
|
|
6
|
+
export { foldKana } from "./kana.ts";
|
|
6
7
|
export { OWNER_COUNTRIES, ownerCountry } from "./owners.ts";
|
|
7
8
|
export { CATALOGUE, SATELLITE_GROUPS, catalogueEntry, catalogueRows, findInCatalogue, type CatalogueEntry, type CatalogueRow, type OrbitKind, type SatelliteGroupInfo } from "./catalogue.ts";
|
|
8
9
|
export { ElementSourceError, fetchElements, forgetElements, parseElements, type ElementFormat, type ElementSource, type FetchElementsOptions, type ParsedElements } from "./source.ts";
|
package/dist/satellites/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { createSatellites } from "./track.js";
|
|
|
3
3
|
export { NEAREST_COUNT, closeApproach, nearest, overheadKm, within } from "./nearest.js";
|
|
4
4
|
export { DEFAULT_DIM_AFTER_DAYS, DEFAULT_MAX_AGE_DAYS, MAX_SATELLITE_SPEED } from "./limits.js";
|
|
5
5
|
export { SHORT_NAMES } from "./names.js";
|
|
6
|
+
export { foldKana } from "./kana.js";
|
|
6
7
|
export { OWNER_COUNTRIES, ownerCountry } from "./owners.js";
|
|
7
8
|
export { CATALOGUE, SATELLITE_GROUPS, catalogueEntry, catalogueRows, findInCatalogue } from "./catalogue.js";
|
|
8
9
|
export { ElementSourceError, fetchElements, forgetElements, parseElements } from "./source.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fold text for a Japanese search: width and compatibility forms (NFKC: half-width katakana becomes full-width), hiragana to katakana, and a small kana (`ッ`, `ャ`, `ァ`) to its full-size one. The long-vowel mark `ー` is left as it is, and so is everything that is not kana
|
|
3
|
+
* (letter case is the caller's, as it is for any search). Put it on both sides of a comparison: `foldKana("はっぶる") === foldKana("ハッブル")`, and `ハッブル` is also `ハツブル` after it, so a reader who types a small kana as a full-size one still finds it.
|
|
4
|
+
*
|
|
5
|
+
* @param text - What was typed, or a name to compare it with.
|
|
6
|
+
* @returns The folded text.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { foldKana } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
11
|
+
*
|
|
12
|
+
* console.log(foldKana("はっぶる") === foldKana("ハッブル"));
|
|
13
|
+
* console.log(foldKana("ほし ー"));
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function foldKana(text: string): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Kana folding for a search: hiragana and katakana are the same sounds, so a name typed in one is found in the other. Pure text, no dependency; imports on a server.
|
|
2
|
+
/** The small kana and the full-size kana they fold to. */
|
|
3
|
+
const SMALL = { ァ: "ア", ィ: "イ", ゥ: "ウ", ェ: "エ", ォ: "オ", ッ: "ツ", ャ: "ヤ", ュ: "ユ", ョ: "ヨ", ヮ: "ワ", ヵ: "カ", ヶ: "ケ" };
|
|
4
|
+
/**
|
|
5
|
+
* Fold text for a Japanese search: width and compatibility forms (NFKC: half-width katakana becomes full-width), hiragana to katakana, and a small kana (`ッ`, `ャ`, `ァ`) to its full-size one. The long-vowel mark `ー` is left as it is, and so is everything that is not kana
|
|
6
|
+
* (letter case is the caller's, as it is for any search). Put it on both sides of a comparison: `foldKana("はっぶる") === foldKana("ハッブル")`, and `ハッブル` is also `ハツブル` after it, so a reader who types a small kana as a full-size one still finds it.
|
|
7
|
+
*
|
|
8
|
+
* @param text - What was typed, or a name to compare it with.
|
|
9
|
+
* @returns The folded text.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { foldKana } from "@johnmorrisdotca/chikyu-earth/satellites";
|
|
14
|
+
*
|
|
15
|
+
* console.log(foldKana("はっぶる") === foldKana("ハッブル"));
|
|
16
|
+
* console.log(foldKana("ほし ー"));
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export function foldKana(text) {
|
|
20
|
+
return text
|
|
21
|
+
.normalize("NFKC")
|
|
22
|
+
.replace(/[ぁ-ゖゝゞ]/g, (ch) => String.fromCharCode(ch.charCodeAt(0) + 0x60))
|
|
23
|
+
.replace(/[ァィゥェォッャュョヮヵヶ]/g, (ch) => SMALL[ch] ?? ch);
|
|
24
|
+
}
|
|
@@ -173,6 +173,7 @@ type SatelliteStats = {
|
|
|
173
173
|
hoverPath: boolean;
|
|
174
174
|
hoverOpacity: number;
|
|
175
175
|
selectedOpacity: number;
|
|
176
|
+
orbitLines: number;
|
|
176
177
|
estimated: number;
|
|
177
178
|
};
|
|
178
179
|
/**
|
|
@@ -784,6 +785,13 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
784
785
|
*/
|
|
785
786
|
get pathHit(): number;
|
|
786
787
|
set pathHit(value: number);
|
|
788
|
+
/**
|
|
789
|
+
* Which is heard first where a satellite's dot and a path lie under the pointer (the attribute `path-priority`): `dots`, the default, or `paths`. With `dots` a press or a hover is the dot's, and a path is heard only where no dot is within 12 px: at the Low level, with thousands of dots crowding a line, a path can go unheard.
|
|
790
|
+
* With `paths` a path of the page's (`setPaths`, or the chosen satellite's own orbit) is heard before a dot, **except** a dot of a satellite that is itself one of the paths' satellites or the chosen or ridden one: that satellite's own dot still wins, and a press on it is `chikyu-satellite-click`.
|
|
791
|
+
* Either way one press has one meaning, in this order. `dots`: any dot, then a path, then the sky. `paths`: a listed or chosen satellite's dot, then a path, then any other dot, then the sky. Anything but `paths` reads as `dots`.
|
|
792
|
+
*/
|
|
793
|
+
get pathPriority(): "dots" | "paths";
|
|
794
|
+
set pathPriority(value: "dots" | "paths");
|
|
787
795
|
/**
|
|
788
796
|
* The path under a point of the element, from the last draw: its id as given, the satellite (`ref`, the same shape as in `chikyu-satellite-click`), the name of its look, the nearest point on it and the distance to it, or `null`.
|
|
789
797
|
*
|
|
@@ -858,6 +866,11 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
858
866
|
time: number;
|
|
859
867
|
lookups: number;
|
|
860
868
|
satellites: SatelliteStats;
|
|
869
|
+
/** The cross-fade when `light` changes to or from `lit` (300 ms, a cut under reduced motion): `mix` is 0 for the true light and 1 for `lit`, and `fading` is true while it moves and another frame is wanted. */
|
|
870
|
+
lightFade: {
|
|
871
|
+
mix: number;
|
|
872
|
+
fading: boolean;
|
|
873
|
+
};
|
|
861
874
|
/** The page's paths: asked for, drawn (with the chosen satellite's own), left out over the cap of 16, unmatched, whether the chosen satellite's own orbit is drawn, draw calls they took at the last draw (0 or 1), the path under the mouse and the `chikyu-path-click` events sent. */
|
|
862
875
|
paths: PathStats;
|
|
863
876
|
ride: {
|
|
@@ -33,7 +33,7 @@ import { AU_IN_EARTH_RADII, EARTH_RADIUS_KM, frameAt } from "./ephemeris.js";
|
|
|
33
33
|
import { MAX_ORBIT_GROUP, readStreakMax } from "./satellite-layer.js";
|
|
34
34
|
import { applySatelliteFocus, satelliteEmphasis, satelliteGroupRows, shellRadiusOf, zoomForPerspectiveShell } from "./satellite-focus.js";
|
|
35
35
|
import { claimPress } from "../sky/claim.js";
|
|
36
|
-
import { bindPaths, emptyPathStats, pointerOf } from "./path-controls.js";
|
|
36
|
+
import { bindPaths, emptyPathStats, pointerOf, readPathPriority } from "./path-controls.js";
|
|
37
37
|
import { styleTable } from "./paths.js";
|
|
38
38
|
import { bindSatelliteHover, hoverPathOn, hoverStyleOf, namesOnHover as namesHoverOn } from "./satellite-hover.js";
|
|
39
39
|
import { clampFollow, retargetFollow } from "./follow.js";
|
|
@@ -177,7 +177,7 @@ const STYLE = `:host{display:block;aspect-ratio:1/1;position:relative;overflow:h
|
|
|
177
177
|
* ```
|
|
178
178
|
*/
|
|
179
179
|
export class ChikyuSpace extends HTMLElement {
|
|
180
|
-
static observedAttributes = ["cloud-drift", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...BEAM_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "bodies-credit", "satellite-tint", "satellite-streak-max", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "ride-viewpoint", "ride-model-size", "hover-path", "names-on-hover", "selected-path", "path-hit", "estimate-far", "follow", "follow-ease", "dim-occluded", "ride-model-share", "ride-model-seat", "ride-zoom"];
|
|
180
|
+
static observedAttributes = ["cloud-drift", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...BEAM_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "bodies-credit", "satellite-tint", "satellite-streak-max", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "ride-viewpoint", "ride-model-size", "hover-path", "names-on-hover", "selected-path", "path-hit", "path-priority", "estimate-far", "follow", "follow-ease", "dim-occluded", "ride-model-share", "ride-model-seat", "ride-zoom"];
|
|
181
181
|
#model = newSpaceModel();
|
|
182
182
|
/** The finer imagery (NASA's tile service), one source while the attributes stay the same. Off unless `tiles-finer="gibs"`. */
|
|
183
183
|
#finerHold = createFinerHolder(() => new Date(this.#model.time), () => this.#gate?.request());
|
|
@@ -2131,6 +2131,20 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
2131
2131
|
else
|
|
2132
2132
|
this.removeAttribute("path-hit");
|
|
2133
2133
|
}
|
|
2134
|
+
/**
|
|
2135
|
+
* Which is heard first where a satellite's dot and a path lie under the pointer (the attribute `path-priority`): `dots`, the default, or `paths`. With `dots` a press or a hover is the dot's, and a path is heard only where no dot is within 12 px: at the Low level, with thousands of dots crowding a line, a path can go unheard.
|
|
2136
|
+
* With `paths` a path of the page's (`setPaths`, or the chosen satellite's own orbit) is heard before a dot, **except** a dot of a satellite that is itself one of the paths' satellites or the chosen or ridden one: that satellite's own dot still wins, and a press on it is `chikyu-satellite-click`.
|
|
2137
|
+
* Either way one press has one meaning, in this order. `dots`: any dot, then a path, then the sky. `paths`: a listed or chosen satellite's dot, then a path, then any other dot, then the sky. Anything but `paths` reads as `dots`.
|
|
2138
|
+
*/
|
|
2139
|
+
get pathPriority() {
|
|
2140
|
+
return readPathPriority(this.getAttribute("path-priority"));
|
|
2141
|
+
}
|
|
2142
|
+
set pathPriority(value) {
|
|
2143
|
+
if (value === "paths")
|
|
2144
|
+
this.setAttribute("path-priority", "paths");
|
|
2145
|
+
else
|
|
2146
|
+
this.removeAttribute("path-priority");
|
|
2147
|
+
}
|
|
2134
2148
|
/**
|
|
2135
2149
|
* The path under a point of the element, from the last draw: its id as given, the satellite (`ref`, the same shape as in `chikyu-satellite-click`), the name of its look, the nearest point on it and the distance to it, or `null`.
|
|
2136
2150
|
*
|
|
@@ -2311,6 +2325,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
2311
2325
|
time: this.#model.time,
|
|
2312
2326
|
lookups: this.#model.lookups,
|
|
2313
2327
|
satellites: this.#satelliteStats(),
|
|
2328
|
+
lightFade: { mix: this.#model.lightFade.mix, fading: this.#model.lightFade.fading },
|
|
2314
2329
|
paths: this.#pathControls?.stats() ?? emptyPathStats(),
|
|
2315
2330
|
ride: { riding: this.#model.ride !== null, lost: this.#model.rideLost, gliding: this.#model.transition !== null || this.#model.rideFrame.moving, facing: this.facing, groundKm: this.#model.rideFrame.groundKm },
|
|
2316
2331
|
camera: { position: [this.#model.pose.p[0], this.#model.pose.p[1], this.#model.pose.p[2]], quaternion: [this.#model.pose.q[0], this.#model.pose.q[1], this.#model.pose.q[2], this.#model.pose.q[3]], fov: this.#model.pose.fov },
|
|
@@ -2344,7 +2359,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
2344
2359
|
let epochMs = 0;
|
|
2345
2360
|
for (const group of this.#model.satellites.groups.values())
|
|
2346
2361
|
epochMs = Math.max(epochMs, group.satellites.newestEpochMs);
|
|
2347
|
-
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity, estimated: drawn.estimated };
|
|
2362
|
+
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity, orbitLines: drawn.orbitLines, estimated: drawn.estimated };
|
|
2348
2363
|
}
|
|
2349
2364
|
// --- the game clock ----------------------------------------------------------------------------------------------------------------------------
|
|
2350
2365
|
#readSpeed() {
|
|
@@ -2471,14 +2486,15 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
2471
2486
|
const rect = this.getBoundingClientRect();
|
|
2472
2487
|
const x = event.clientX - rect.left;
|
|
2473
2488
|
const y = event.clientY - rect.top;
|
|
2474
|
-
|
|
2475
|
-
if (
|
|
2489
|
+
// one press, one meaning: the paths decide first, since which of a dot and a path wins depends on `path-priority` (a dot wins in the default, and the paths say so by answering no)
|
|
2490
|
+
if (this.#pathControls?.press(x, y, pointerOf(event))) {
|
|
2476
2491
|
claimPress(event);
|
|
2477
|
-
this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite), ...this.#estimateOf(satellite) }, bubbles: true, composed: true }));
|
|
2478
2492
|
return;
|
|
2479
2493
|
}
|
|
2480
|
-
|
|
2494
|
+
const satellite = this.#model.pick?.(x, y, 12);
|
|
2495
|
+
if (satellite) {
|
|
2481
2496
|
claimPress(event);
|
|
2497
|
+
this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite), ...this.#estimateOf(satellite) }, bubbles: true, composed: true }));
|
|
2482
2498
|
return;
|
|
2483
2499
|
}
|
|
2484
2500
|
if (!this.#places)
|
|
@@ -26,11 +26,14 @@ export type SatelliteKind = "bus" | "communications" | "flat" | "station" | "cub
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
export declare function satelliteKind(name: string): SatelliteKind;
|
|
29
|
+
/** How bright the Sun is on a generic drawing. */
|
|
30
|
+
export declare const SUN_INTENSITY = 3.2;
|
|
29
31
|
/**
|
|
30
32
|
* A generic satellite as a drawing of radius 1 about the origin, its long axis along +x (the way it flies), its top along +z and its left along +y, the family's convention for a model, with its own light that `light(toSun)` turns to the Sun. One group of a few meshes, made once and disposed with `dispose`.
|
|
31
33
|
*
|
|
32
34
|
* @param three - three.js (the parts the demo's subset holds: `Group`, `Mesh`, `BoxGeometry`, `CylinderGeometry`, `MeshLambertMaterial`, `DirectionalLight`, `AmbientLight`).
|
|
33
35
|
* @param kind - What to draw.
|
|
36
|
+
* @param shared - A Sun light the scene owns (`{ sun }`), in the scene's own axes: the drawing then makes none of its own and `light` points that one. A scene with the light always in it keeps the same number of lights whether or not a drawing is shown, so three keeps one program for each material, not one for each state of the lights.
|
|
34
37
|
* @returns The drawing, with `light` and `dispose`.
|
|
35
38
|
*
|
|
36
39
|
* @example
|
|
@@ -43,4 +46,6 @@ export declare function satelliteKind(name: string): SatelliteKind;
|
|
|
43
46
|
* drawing.dispose();
|
|
44
47
|
* ```
|
|
45
48
|
*/
|
|
46
|
-
export declare function genericSatellite(three: typeof THREE, kind: SatelliteKind
|
|
49
|
+
export declare function genericSatellite(three: typeof THREE, kind: SatelliteKind, shared?: {
|
|
50
|
+
sun: THREE.DirectionalLight;
|
|
51
|
+
}): BodyDrawing;
|
|
@@ -23,11 +23,14 @@ export function satelliteKind(name) {
|
|
|
23
23
|
return "communications";
|
|
24
24
|
return "bus";
|
|
25
25
|
}
|
|
26
|
+
/** How bright the Sun is on a generic drawing. */
|
|
27
|
+
export const SUN_INTENSITY = 3.2;
|
|
26
28
|
/**
|
|
27
29
|
* A generic satellite as a drawing of radius 1 about the origin, its long axis along +x (the way it flies), its top along +z and its left along +y, the family's convention for a model, with its own light that `light(toSun)` turns to the Sun. One group of a few meshes, made once and disposed with `dispose`.
|
|
28
30
|
*
|
|
29
31
|
* @param three - three.js (the parts the demo's subset holds: `Group`, `Mesh`, `BoxGeometry`, `CylinderGeometry`, `MeshLambertMaterial`, `DirectionalLight`, `AmbientLight`).
|
|
30
32
|
* @param kind - What to draw.
|
|
33
|
+
* @param shared - A Sun light the scene owns (`{ sun }`), in the scene's own axes: the drawing then makes none of its own and `light` points that one. A scene with the light always in it keeps the same number of lights whether or not a drawing is shown, so three keeps one program for each material, not one for each state of the lights.
|
|
31
34
|
* @returns The drawing, with `light` and `dispose`.
|
|
32
35
|
*
|
|
33
36
|
* @example
|
|
@@ -40,7 +43,7 @@ export function satelliteKind(name) {
|
|
|
40
43
|
* drawing.dispose();
|
|
41
44
|
* ```
|
|
42
45
|
*/
|
|
43
|
-
export function genericSatellite(three, kind) {
|
|
46
|
+
export function genericSatellite(three, kind, shared) {
|
|
44
47
|
const group = new three.Group();
|
|
45
48
|
const materials = [];
|
|
46
49
|
const geometries = [];
|
|
@@ -115,11 +118,20 @@ export function genericSatellite(three, kind) {
|
|
|
115
118
|
add(box(0.06, 0.06, 0.1), 0xb4b9c2, [-0.2, 0, -0.26]);
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
|
-
const
|
|
119
|
-
|
|
121
|
+
const own = shared ? null : new three.DirectionalLight(0xfff4e0, SUN_INTENSITY);
|
|
122
|
+
const sun = shared?.sun ?? own;
|
|
123
|
+
group.add(new three.AmbientLight(0x6f86a8, 0.9));
|
|
124
|
+
if (own)
|
|
125
|
+
group.add(own);
|
|
120
126
|
return {
|
|
121
127
|
object: group,
|
|
122
128
|
light(toSun) {
|
|
129
|
+
if (shared) {
|
|
130
|
+
// the scene's light lives in the scene's axes, where the Sun's direction is already: point it and switch it on (the scene switches it off when no drawing is shown)
|
|
131
|
+
sun.position.set(toSun[0], toSun[1], toSun[2]);
|
|
132
|
+
sun.intensity = SUN_INTENSITY;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
123
135
|
// the model's axes are the columns of the matrix the view set: the direction to the Sun in them is the dot with each
|
|
124
136
|
const m = group.matrix.elements;
|
|
125
137
|
const length = Math.hypot(m[0], m[1], m[2]) || 1;
|
|
@@ -130,7 +142,7 @@ export function genericSatellite(three, kind) {
|
|
|
130
142
|
material.dispose();
|
|
131
143
|
for (const geometry of geometries)
|
|
132
144
|
geometry.dispose();
|
|
133
|
-
|
|
145
|
+
own?.dispose?.();
|
|
134
146
|
},
|
|
135
147
|
};
|
|
136
148
|
}
|
package/dist/space/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { ABOVE_MODEL_KM, ABOVE_MODEL_SHARE, aboveAxes, aboveModelShare, MODEL_FA
|
|
|
7
7
|
export { genericSatellite, satelliteKind, type SatelliteKind } from "./generic-satellite.ts";
|
|
8
8
|
export { BEAM_ATTRIBUTES, BEAM_COLOUR, BEAM_ELEVATION, beamCells, footprintAngle, footprintKm, readBeam, type BeamCells, type BeamOptions } from "../beam/geometry.ts";
|
|
9
9
|
export type { BeamStats } from "../beam/layer.ts";
|
|
10
|
+
export { RIDE_PATH_FADE_KM } from "./path-ribbons.ts";
|
package/dist/space/index.js
CHANGED
|
@@ -8,3 +8,4 @@ export { earthHides } from "./satellite-layer.js";
|
|
|
8
8
|
export { ABOVE_MODEL_KM, ABOVE_MODEL_SHARE, aboveAxes, aboveModelShare, MODEL_FADE_FROM_KM, MODEL_FADE_TO_KM, MODEL_HANDOVER_PX, MODEL_RADIUS_SHARE, modelMatrix, modelRadius, satelliteAxes } from "./satellite-model.js";
|
|
9
9
|
export { genericSatellite, satelliteKind } from "./generic-satellite.js";
|
|
10
10
|
export { BEAM_ATTRIBUTES, BEAM_COLOUR, BEAM_ELEVATION, beamCells, footprintAngle, footprintKm, readBeam } from "../beam/geometry.js";
|
|
11
|
+
export { RIDE_PATH_FADE_KM } from "./path-ribbons.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as THREE from "three";
|
|
2
|
+
/** The look of the light a model brought: the colour (a number such as 0xfff4e0) and the strength, for the scene's Sun to take on while the model is shown. */
|
|
3
|
+
export interface ModelSun {
|
|
4
|
+
color: number;
|
|
5
|
+
intensity: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Switch off every light in a model that would count in the scene's lights (directional, point, spot, hemisphere and area lights; an ambient light does not change a program and is left), and say what the first directional one looked like.
|
|
9
|
+
* The lights are switched off, not taken out, so a painter that disposes of them or aims them in its `light` hook finds them where it left them.
|
|
10
|
+
*
|
|
11
|
+
* @param object - The model.
|
|
12
|
+
* @returns The first directional light's colour and strength, or `null` when the model had none.
|
|
13
|
+
*/
|
|
14
|
+
export declare function stripLights(object: THREE.Object3D): ModelSun | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Switch off every light in a model that would count in the scene's lights (directional, point, spot, hemisphere and area lights; an ambient light does not change a program and is left), and say what the first directional one looked like.
|
|
3
|
+
* The lights are switched off, not taken out, so a painter that disposes of them or aims them in its `light` hook finds them where it left them.
|
|
4
|
+
*
|
|
5
|
+
* @param object - The model.
|
|
6
|
+
* @returns The first directional light's colour and strength, or `null` when the model had none.
|
|
7
|
+
*/
|
|
8
|
+
export function stripLights(object) {
|
|
9
|
+
let sun = null;
|
|
10
|
+
object.traverse((part) => {
|
|
11
|
+
const light = part;
|
|
12
|
+
if (!light.isLight || light.isAmbientLight === true || light.isLightProbe === true)
|
|
13
|
+
return;
|
|
14
|
+
if (light.isDirectionalLight === true && sun === null)
|
|
15
|
+
sun = { color: light.color.getHex(), intensity: light.intensity };
|
|
16
|
+
light.visible = false;
|
|
17
|
+
});
|
|
18
|
+
return sun;
|
|
19
|
+
}
|
|
@@ -2,7 +2,10 @@ import type { SatelliteRef } from "../satellites/types.ts";
|
|
|
2
2
|
import type { SatelliteState } from "./satellite-layer.ts";
|
|
3
3
|
import { MAX_PATHS, type PathHit, type PathRequest, type PathStyle } from "./paths.ts";
|
|
4
4
|
/** The attributes the paths add to an element. */
|
|
5
|
-
export declare const PATH_ATTRIBUTES: readonly ["selected-path", "path-hit"];
|
|
5
|
+
export declare const PATH_ATTRIBUTES: readonly ["selected-path", "path-hit", "path-priority"];
|
|
6
|
+
/** Which comes first under a pointer: a satellite's `dots` (the default), or `paths` (a path of the page's, unless the dot is of a satellite whose path is listed or that is chosen). Anything else is `dots`. */
|
|
7
|
+
export type PathPriority = "dots" | "paths";
|
|
8
|
+
export declare const readPathPriority: (value: string | null) => PathPriority;
|
|
6
9
|
/** What the element hands the paths. */
|
|
7
10
|
export interface PathHost {
|
|
8
11
|
element: HTMLElement;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { capPaths, hitRadius, MAX_PATHS, readPathHit, styleTable } from "./paths.js";
|
|
2
2
|
/** The attributes the paths add to an element. */
|
|
3
|
-
export const PATH_ATTRIBUTES = ["selected-path", "path-hit"];
|
|
3
|
+
export const PATH_ATTRIBUTES = ["selected-path", "path-hit", "path-priority"];
|
|
4
|
+
export const readPathPriority = (value) => (value === "paths" ? "paths" : "dots");
|
|
4
5
|
export const pointerOf = (event) => (event.pointerType === "touch" ? "touch" : event.pointerType === "pen" ? "pen" : "mouse");
|
|
5
6
|
export function bindPaths(host) {
|
|
6
7
|
const { element, state } = host;
|
|
@@ -18,14 +19,22 @@ export function bindPaths(host) {
|
|
|
18
19
|
const found = host.pathAt(x, y, radius);
|
|
19
20
|
return found ? { ...found, pointer } : null;
|
|
20
21
|
};
|
|
22
|
+
/** Whether a dot belongs to a satellite the page has made much of: one whose path is drawn (listed, or the chosen or ridden one's own), or the chosen one. Its dot is its own under either priority. */
|
|
23
|
+
const listed = (ref) => state.paths.info.some((one) => one.ref.group === ref.group && one.ref.index === ref.index) || (state.selected?.group === ref.group && state.selected.index === ref.index) || (state.ridden?.group === ref.group && state.ridden.index === ref.index);
|
|
24
|
+
/** The path a pointer at a point is on, once the dots have had their say: under `dots` a dot hides the paths; under `paths` only a listed satellite's own dot does. */
|
|
25
|
+
const choose = (x, y, pointer) => {
|
|
26
|
+
const dot = host.pick(x, y);
|
|
27
|
+
if (dot && (readPathPriority(element.getAttribute("path-priority")) === "dots" || listed(dot)))
|
|
28
|
+
return null;
|
|
29
|
+
return at(x, y, undefined, pointer);
|
|
30
|
+
};
|
|
21
31
|
const detail = (hit) => ({ ...hit, ref: { ...hit.ref } });
|
|
22
32
|
const sameHit = (a, b) => (a === null && b === null) || (a !== null && b !== null && a.id === b.id && a.style === b.style && a.ref.group === b.ref.group && a.ref.index === b.ref.index);
|
|
23
33
|
const apply = () => {
|
|
24
34
|
queued = false;
|
|
25
35
|
if (!point)
|
|
26
36
|
return;
|
|
27
|
-
const
|
|
28
|
-
const hit = dot ? null : at(point.x, point.y, undefined, "mouse");
|
|
37
|
+
const hit = choose(point.x, point.y, "mouse");
|
|
29
38
|
if (sameHit(hit, hovered)) {
|
|
30
39
|
hovered = hit;
|
|
31
40
|
return;
|
|
@@ -95,9 +104,7 @@ export function bindPaths(host) {
|
|
|
95
104
|
},
|
|
96
105
|
at,
|
|
97
106
|
press(x, y, pointer) {
|
|
98
|
-
|
|
99
|
-
return false;
|
|
100
|
-
const hit = at(x, y, undefined, pointer);
|
|
107
|
+
const hit = choose(x, y, pointer);
|
|
101
108
|
if (!hit)
|
|
102
109
|
return false;
|
|
103
110
|
hits += 1;
|
|
@@ -6,10 +6,23 @@ type Three = ThreeParts;
|
|
|
6
6
|
export declare const PATH_POINTS = 120;
|
|
7
7
|
/** The paths the mesh can hold: those of the page and the chosen satellite's own. */
|
|
8
8
|
export declare const PATH_SLOTS: number;
|
|
9
|
+
/**
|
|
10
|
+
* The distance, in kilometres, over which the orbit of a satellite being ridden grows out of the camera: nothing at the camera, all of its look by this far along the path (a smooth step in between).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { RIDE_PATH_FADE_KM } from "@johnmorrisdotca/chikyu-earth/space";
|
|
15
|
+
*
|
|
16
|
+
* console.log(RIDE_PATH_FADE_KM); // 300
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const RIDE_PATH_FADE_KM = 300;
|
|
9
20
|
/** What one slot is told: the loop's points (3 numbers each, {@link PATH_POINTS} of them) and its look. */
|
|
10
21
|
export interface RibbonPath {
|
|
11
22
|
positions: Float32Array;
|
|
12
23
|
style: PathStyle;
|
|
24
|
+
/** Earth radii from the camera over which the path fades in (nothing at the camera, all of its opacity at this distance); 0 or missing draws it at its look everywhere. */
|
|
25
|
+
fade?: number;
|
|
13
26
|
}
|
|
14
27
|
export interface PathRibbons {
|
|
15
28
|
/** Write the paths into the buffers, none for an empty list. Costs nothing on the GPU until the next draw, and nothing is drawn while there are no paths. */
|
|
@@ -11,6 +11,9 @@ attribute vec2 corner;
|
|
|
11
11
|
attribute vec4 ink;
|
|
12
12
|
attribute vec4 look;
|
|
13
13
|
attribute float span;
|
|
14
|
+
attribute float grow;
|
|
15
|
+
varying vec3 vWorld;
|
|
16
|
+
varying float vGrow;
|
|
14
17
|
varying vec4 vInk;
|
|
15
18
|
varying float vEdge;
|
|
16
19
|
varying float vHalf;
|
|
@@ -20,13 +23,23 @@ void main() {
|
|
|
20
23
|
mat4 m = projectionMatrix * modelViewMatrix;
|
|
21
24
|
vec4 a = m * vec4(position, 1.0);
|
|
22
25
|
vec4 b = m * vec4(other, 1.0);
|
|
23
|
-
|
|
26
|
+
vec3 wa = position;
|
|
27
|
+
vec3 wb = other;
|
|
28
|
+
// a path that grows out of the camera is drawn right up to it (the camera of a ride is a few kilometres from the craft); the others stop 64 km short of it, as they always have
|
|
29
|
+
float near = grow > 0.0 ? 0.00002 : 0.01;
|
|
24
30
|
if (a.w < near && b.w < near) {
|
|
25
31
|
gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
|
|
26
32
|
return;
|
|
27
33
|
}
|
|
28
|
-
if (a.w < near)
|
|
29
|
-
|
|
34
|
+
if (a.w < near) {
|
|
35
|
+
float t = (near - a.w) / (b.w - a.w);
|
|
36
|
+
a = mix(a, b, t);
|
|
37
|
+
wa = mix(wa, wb, t);
|
|
38
|
+
} else if (b.w < near) {
|
|
39
|
+
float t = (near - b.w) / (a.w - b.w);
|
|
40
|
+
b = mix(b, a, t);
|
|
41
|
+
wb = mix(wb, wa, t);
|
|
42
|
+
}
|
|
30
43
|
vec2 hres = res * 0.5;
|
|
31
44
|
vec2 sa = a.xy / a.w * hres;
|
|
32
45
|
vec2 sb = b.xy / b.w * hres;
|
|
@@ -41,12 +54,16 @@ void main() {
|
|
|
41
54
|
vec2 at = s + normal * corner.y * reach;
|
|
42
55
|
gl_Position = vec4(at / hres * p.w, p.z, p.w);
|
|
43
56
|
vInk = ink;
|
|
57
|
+
vWorld = atB ? wb : wa;
|
|
58
|
+
vGrow = grow;
|
|
44
59
|
vEdge = corner.y * reach;
|
|
45
60
|
vHalf = look.x * 0.5;
|
|
46
61
|
vAlong = (look.w + (atB ? span : 0.0)) * dashScale;
|
|
47
62
|
vDash = look.yz;
|
|
48
63
|
}`;
|
|
49
64
|
const FRAG = /* glsl */ `
|
|
65
|
+
varying vec3 vWorld;
|
|
66
|
+
varying float vGrow;
|
|
50
67
|
varying vec4 vInk;
|
|
51
68
|
varying float vEdge;
|
|
52
69
|
varying float vHalf;
|
|
@@ -60,10 +77,24 @@ void main() {
|
|
|
60
77
|
float inside = m < vDash.x ? min(m, vDash.x - m) : -min(m - vDash.x, period - m);
|
|
61
78
|
cover *= clamp(inside + 0.5, 0.0, 1.0);
|
|
62
79
|
}
|
|
80
|
+
// a path being ridden grows out of the camera: the distance is the point's own on the chord (the loop is 120 points, some 350 km apart, so a fade taken at the ends alone would not reach nothing at the craft)
|
|
81
|
+
float grown = vGrow > 0.0 ? smoothstep(0.0, vGrow, distance(vWorld, cameraPosition)) : 1.0;
|
|
82
|
+
cover *= grown;
|
|
63
83
|
if (cover <= 0.0) discard;
|
|
64
84
|
gl_FragColor = vec4(vInk.rgb, vInk.a * cover);
|
|
65
85
|
#include <colorspace_fragment>
|
|
66
86
|
}`;
|
|
87
|
+
/**
|
|
88
|
+
* The distance, in kilometres, over which the orbit of a satellite being ridden grows out of the camera: nothing at the camera, all of its look by this far along the path (a smooth step in between).
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* import { RIDE_PATH_FADE_KM } from "@johnmorrisdotca/chikyu-earth/space";
|
|
93
|
+
*
|
|
94
|
+
* console.log(RIDE_PATH_FADE_KM); // 300
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export const RIDE_PATH_FADE_KM = 300;
|
|
67
98
|
export function createPathRibbons(three, scene) {
|
|
68
99
|
// The quads face either way (a segment's left and right turn with its direction on the screen), so neither side is culled.
|
|
69
100
|
const verts = PATH_SLOTS * PATH_POINTS * 4;
|
|
@@ -73,6 +104,7 @@ export function createPathRibbons(three, scene) {
|
|
|
73
104
|
const ink = new Float32Array(verts * 4);
|
|
74
105
|
const look = new Float32Array(verts * 4);
|
|
75
106
|
const span = new Float32Array(verts);
|
|
107
|
+
const grow = new Float32Array(verts);
|
|
76
108
|
const index = new Uint16Array(PATH_SLOTS * PATH_POINTS * 6);
|
|
77
109
|
for (let q = 0; q < PATH_SLOTS * PATH_POINTS; q += 1) {
|
|
78
110
|
const v = q * 4;
|
|
@@ -87,6 +119,7 @@ export function createPathRibbons(three, scene) {
|
|
|
87
119
|
ink: new three.BufferAttribute(ink, 4),
|
|
88
120
|
look: new three.BufferAttribute(look, 4),
|
|
89
121
|
span: new three.BufferAttribute(span, 1),
|
|
122
|
+
grow: new three.BufferAttribute(grow, 1),
|
|
90
123
|
};
|
|
91
124
|
for (const [name, attribute] of Object.entries(attributes))
|
|
92
125
|
geometry.setAttribute(name, attribute);
|
|
@@ -106,7 +139,7 @@ export function createPathRibbons(three, scene) {
|
|
|
106
139
|
set(paths) {
|
|
107
140
|
count = Math.min(PATH_SLOTS, paths.length);
|
|
108
141
|
for (let p = 0; p < count; p += 1) {
|
|
109
|
-
const { positions, style } = paths[p];
|
|
142
|
+
const { positions, style, fade = 0 } = paths[p];
|
|
110
143
|
colour.set(style.color);
|
|
111
144
|
// the arc length at each point, in Earth radii, for the dashes
|
|
112
145
|
let along = 0;
|
|
@@ -137,6 +170,7 @@ export function createPathRibbons(three, scene) {
|
|
|
137
170
|
look[v * 4 + 2] = style.dash ? style.dash[1] : 0;
|
|
138
171
|
look[v * 4 + 3] = along;
|
|
139
172
|
span[v] = length;
|
|
173
|
+
grow[v] = fade;
|
|
140
174
|
}
|
|
141
175
|
along += length;
|
|
142
176
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MAX_SATELLITE_SPEED } from "../satellites/limits.js";
|
|
2
2
|
import { satelliteEmphasis } from "./satellite-focus.js";
|
|
3
3
|
import { BUILT_IN_PATH_STYLES, capPaths, nearestLoop, resolvePathId, styleOf, styleTable } from "./paths.js";
|
|
4
|
-
import { createPathRibbons } from "./path-ribbons.js";
|
|
4
|
+
import { createPathRibbons, RIDE_PATH_FADE_KM } from "./path-ribbons.js";
|
|
5
5
|
/**
|
|
6
6
|
* The longest a streak may be along its orbit, in Earth radii: 0.025, about 160 km, which is what a low satellite covers in a frame at 10 minutes a second (150 km). On the screen that is a share of the Earth's drawn radius, so a streak
|
|
7
7
|
* is a few millimetres when the Earth fills the view, half as long when the Earth is half as large, and a dot when the Earth is tiny. A cap of so many pixels alone would leave the same length on a small Earth, where it looks long.
|
|
@@ -56,10 +56,12 @@ export function longestStreak(segments, count, earthPx) {
|
|
|
56
56
|
}
|
|
57
57
|
return longest * earthPx;
|
|
58
58
|
}
|
|
59
|
-
export const newSatelliteState = () => ({ groups: new Map(), selected: null, marked: new Set(), pinned: [], orbitTint: false, focus: null, modelOver: null, hover: { ref: null, fade: 0, enabled: true, color: "#ffffff", opacity: HOVER_PATH_OPACITY }, paths: { requests: [], overrides: {}, selectedOn: true, version: 0, info: [], dropped: 0, unresolved: 0 }, ridden: null, streakMax: DEFAULT_STREAK_MAX, drawn: { placed: 0, segments: 0, tooFast: false, dotScale: 1, longestStreakPx: 0, streakCapPx: 0, weight: 1, fade: 1, earthPx: 0, updateMs: 0, maxUpdateMs: 0, updates: 0, totalMs: 0, selectedRing: false, hoverPath: false, hoverOpacity: 0, selectedOpacity: 0, pathsDrawn: 0, pathDraws: 0, estimated: 0 } });
|
|
59
|
+
export const newSatelliteState = () => ({ groups: new Map(), selected: null, marked: new Set(), pinned: [], orbitTint: false, focus: null, modelOver: null, hover: { ref: null, fade: 0, enabled: true, color: "#ffffff", opacity: HOVER_PATH_OPACITY }, paths: { requests: [], overrides: {}, selectedOn: true, version: 0, info: [], dropped: 0, unresolved: 0 }, ridden: null, streakMax: DEFAULT_STREAK_MAX, drawn: { placed: 0, segments: 0, tooFast: false, dotScale: 1, longestStreakPx: 0, streakCapPx: 0, weight: 1, fade: 1, earthPx: 0, updateMs: 0, maxUpdateMs: 0, updates: 0, totalMs: 0, selectedRing: false, hoverPath: false, hoverOpacity: 0, selectedOpacity: 0, orbitLines: 0, pathsDrawn: 0, pathDraws: 0, estimated: 0 } });
|
|
60
60
|
/** The most orbits a group may draw all at once, one line each. */
|
|
61
61
|
export const MAX_ORBIT_GROUP = 40;
|
|
62
62
|
const ORBIT_POINTS = 120;
|
|
63
|
+
/** The Earth's radius in kilometres: the unit of a position is one radius. */
|
|
64
|
+
const EARTH_KM = 6371;
|
|
63
65
|
/** How bright the chosen satellite's orbit is. The orbit under the pointer is about a third of this, so the two are told apart at a glance. */
|
|
64
66
|
export const SELECTED_PATH_OPACITY = BUILT_IN_PATH_STYLES["selected"].opacity;
|
|
65
67
|
/** The orbit under the pointer, before it fades. A page may set another with `--chikyu-hover-path-opacity`. */
|
|
@@ -278,7 +280,7 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
278
280
|
line.loop.material.dispose();
|
|
279
281
|
}
|
|
280
282
|
};
|
|
281
|
-
const
|
|
283
|
+
const placeOrbits = (entry, group, time, wall) => {
|
|
282
284
|
const wanted = group.orbits && group.satellites.count <= MAX_ORBIT_GROUP;
|
|
283
285
|
if (!wanted) {
|
|
284
286
|
for (const line of entry.lines)
|
|
@@ -312,6 +314,48 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
312
314
|
entry.linesAt = time;
|
|
313
315
|
entry.linesWall = wall;
|
|
314
316
|
};
|
|
317
|
+
/** The orbit of a line as a plane and a size: the unit normal of the plane (from two points a quarter of a loop apart) and the mean distance from the centre. */
|
|
318
|
+
const planeOf = (positions) => {
|
|
319
|
+
const q = (ORBIT_POINTS / 4) * 3;
|
|
320
|
+
const [ax, ay, az, bx, by, bz] = [positions[0], positions[1], positions[2], positions[q], positions[q + 1], positions[q + 2]];
|
|
321
|
+
const [nx, ny, nz] = [ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx];
|
|
322
|
+
const n = Math.hypot(nx, ny, nz) || 1;
|
|
323
|
+
return { nx: nx / n, ny: ny / n, nz: nz / n, r: (Math.hypot(ax, ay, az) + Math.hypot(bx, by, bz)) / 2 };
|
|
324
|
+
};
|
|
325
|
+
/** Two lines are one orbit when their planes are within half a degree and their sizes within 20 km: the modules of a station, each its own object, are one line drawn several times. */
|
|
326
|
+
const COPLANAR = Math.cos((0.5 * Math.PI) / 180);
|
|
327
|
+
const SAME_SIZE = 20 / EARTH_KM;
|
|
328
|
+
/**
|
|
329
|
+
* The group's own orbit lines, but not the ridden satellite's, nor any line that lies on it (the modules of a station are objects of their own with one orbit): its path is drawn by the ribbons in the `selected` look, with the fade
|
|
330
|
+
* out of the camera (and by nothing at all when the page has that off), and the line would lie over it as a hard stroke. The other satellites keep theirs, and the lines come back when the ride ends.
|
|
331
|
+
*/
|
|
332
|
+
const orbitsOf = (entry, group, name, time, wall) => {
|
|
333
|
+
const ridden = state.ridden !== null && state.ridden.group === name ? state.ridden.index : -1;
|
|
334
|
+
const wanted = group.orbits && group.satellites.count <= MAX_ORBIT_GROUP;
|
|
335
|
+
placeOrbits(entry, group, time, wall);
|
|
336
|
+
const mine = ridden >= 0 ? entry.lines[ridden] : undefined;
|
|
337
|
+
const left = [];
|
|
338
|
+
if (mine) {
|
|
339
|
+
const own = planeOf(mine.positions);
|
|
340
|
+
entry.lines.forEach((line, i) => {
|
|
341
|
+
if (i === ridden)
|
|
342
|
+
left.push(i);
|
|
343
|
+
else if (own.r > 0) {
|
|
344
|
+
const other = planeOf(line.positions);
|
|
345
|
+
if (other.r > 0 && Math.abs(other.nx * own.nx + other.ny * own.ny + other.nz * own.nz) > COPLANAR && Math.abs(other.r - own.r) < SAME_SIZE)
|
|
346
|
+
left.push(i);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
for (const i of entry.hid) {
|
|
351
|
+
const back = entry.lines[i];
|
|
352
|
+
if (back && !left.includes(i))
|
|
353
|
+
back.loop.visible = wanted && (group.satellites.visible(i) || back.positions.some((v) => v !== 0));
|
|
354
|
+
}
|
|
355
|
+
for (const i of left)
|
|
356
|
+
entry.lines[i].loop.visible = false;
|
|
357
|
+
entry.hid = left;
|
|
358
|
+
};
|
|
315
359
|
const find = (ref) => state.groups.get(ref.group)?.satellites;
|
|
316
360
|
const refKey = (ref) => `${ref.group}:${ref.index}`;
|
|
317
361
|
const cleanRef = (ref) => {
|
|
@@ -350,9 +394,10 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
350
394
|
if (!ref)
|
|
351
395
|
continue;
|
|
352
396
|
const look = styleOf(one.request, table);
|
|
353
|
-
wanted.push({ id: one.request.id, ref, name: look.name, style: look.style });
|
|
397
|
+
wanted.push({ id: one.request.id, ref, name: look.name, style: look.style, fade: 0 });
|
|
354
398
|
}
|
|
355
399
|
if (pathState.selectedOn) {
|
|
400
|
+
const ridingRef = cleanRef(state.ridden);
|
|
356
401
|
const own = [chosen, state.ridden].map(cleanRef);
|
|
357
402
|
const seen = new Set();
|
|
358
403
|
for (const ref of own) {
|
|
@@ -360,10 +405,12 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
360
405
|
continue;
|
|
361
406
|
seen.add(refKey(ref));
|
|
362
407
|
const norad = find(ref)?.sets[ref.index]?.NORAD_CAT_ID;
|
|
363
|
-
|
|
408
|
+
// the orbit of the satellite being ridden, seen from it, is a line from the craft to the edge of the picture: it grows out of the camera instead
|
|
409
|
+
const riding = ridingRef !== null && refKey(ridingRef) === refKey(ref);
|
|
410
|
+
wanted.push({ id: norad ?? refKey(ref), ref, name: "selected", style: table["selected"], fade: riding ? RIDE_PATH_FADE_KM / EARTH_KM : 0 });
|
|
364
411
|
}
|
|
365
412
|
}
|
|
366
|
-
const signature = wanted.map((w) => `${refKey(w.ref)}|${w.name}|${w.style.color}|${w.style.width}|${w.style.opacity}|${w.style.dash ? w.style.dash.join(",") : "-"}`).join(";");
|
|
413
|
+
const signature = wanted.map((w) => `${refKey(w.ref)}|${w.name}|${w.style.color}|${w.style.width}|${w.style.opacity}|${w.style.dash ? w.style.dash.join(",") : "-"}|${w.fade}`).join(";");
|
|
367
414
|
let dirty = signature !== slotsSignature;
|
|
368
415
|
const old = new Map(slots.map((slot) => [slot.key, slot]));
|
|
369
416
|
let empty = 0;
|
|
@@ -373,12 +420,13 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
373
420
|
let slot = old.get(key);
|
|
374
421
|
const set = find(w.ref);
|
|
375
422
|
if (!slot) {
|
|
376
|
-
slot = { key, info: { id: w.id, ref: w.ref, style: w.name }, style: w.style, positions: new Float32Array(ORBIT_POINTS * 3), screen: new Float32Array(ORBIT_POINTS * 2), seen: new Uint8Array(ORBIT_POINTS), at: Number.NaN, wall: 0, empty: false };
|
|
423
|
+
slot = { key, info: { id: w.id, ref: w.ref, style: w.name }, style: w.style, fade: w.fade, positions: new Float32Array(ORBIT_POINTS * 3), screen: new Float32Array(ORBIT_POINTS * 2), seen: new Uint8Array(ORBIT_POINTS), at: Number.NaN, wall: 0, empty: false };
|
|
377
424
|
dirty = true;
|
|
378
425
|
}
|
|
379
426
|
old.delete(key);
|
|
380
427
|
slot.info = { id: w.id, ref: w.ref, style: w.name };
|
|
381
428
|
slot.style = w.style;
|
|
429
|
+
slot.fade = w.fade;
|
|
382
430
|
if (Number.isNaN(slot.at) || (Math.abs(time - slot.at) > ORBIT_REFRESH_GAME_MS && wall - slot.wall > ORBIT_REFRESH_WALL_MS)) {
|
|
383
431
|
slot.at = time;
|
|
384
432
|
slot.wall = wall;
|
|
@@ -393,7 +441,7 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
393
441
|
slots = next;
|
|
394
442
|
if (dirty) {
|
|
395
443
|
slotsSignature = signature;
|
|
396
|
-
ribbons.set(slots.filter((slot) => !slot.empty).map((slot) => ({ positions: slot.positions, style: slot.style })));
|
|
444
|
+
ribbons.set(slots.filter((slot) => !slot.empty).map((slot) => ({ positions: slot.positions, style: slot.style, fade: slot.fade })));
|
|
397
445
|
}
|
|
398
446
|
const own = wanted.filter((w) => w.name === "selected" && pathState.selectedOn);
|
|
399
447
|
pathState.info = slots.filter((slot) => !slot.empty).map((slot) => ({ ...slot.info }));
|
|
@@ -470,7 +518,7 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
470
518
|
streak.visible = false;
|
|
471
519
|
scene.add(streak);
|
|
472
520
|
}
|
|
473
|
-
entry = { source: group.satellites, points, geometry, material, positions, attribute, dim, dimVersion: -1, lines: [], linesAt: Number.NaN, linesWall: 0, style: "", streak, streakPositions, streakColours, streakAttribute, pinWall: 0, pinTime: 0, pinNext: 0 };
|
|
521
|
+
entry = { source: group.satellites, points, geometry, material, positions, attribute, dim, dimVersion: -1, lines: [], hid: [], linesAt: Number.NaN, linesWall: 0, style: "", streak, streakPositions, streakColours, streakAttribute, pinWall: 0, pinTime: 0, pinNext: 0 };
|
|
474
522
|
drawn.set(name, entry);
|
|
475
523
|
}
|
|
476
524
|
const style = `${group.color}|${group.size}|${ratio()}|${dotScale}|${state.orbitTint ? 1 : 0}`;
|
|
@@ -563,12 +611,18 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
563
611
|
}
|
|
564
612
|
placed += group.satellites.placed;
|
|
565
613
|
group.placed = group.satellites.placed;
|
|
566
|
-
orbitsOf(entry, group, time, started);
|
|
614
|
+
orbitsOf(entry, group, name, time, started);
|
|
567
615
|
const opacity = dimmed ? 0.15 : 0.45;
|
|
568
616
|
for (const line of entry.lines)
|
|
569
617
|
line.loop.material.opacity = opacity;
|
|
570
618
|
}
|
|
571
619
|
}
|
|
620
|
+
let lines = 0;
|
|
621
|
+
for (const entry of drawn.values())
|
|
622
|
+
for (const line of entry.lines)
|
|
623
|
+
if (line.loop.visible)
|
|
624
|
+
lines += 1;
|
|
625
|
+
state.drawn.orbitLines = lines;
|
|
572
626
|
if (size)
|
|
573
627
|
ribbons.frame(size.width, size.height, radius);
|
|
574
628
|
const chosen = state.selected;
|
package/dist/space/scene.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { type Frame, type PlanetName, type Vec3 } from "./ephemeris.ts";
|
|
|
8
8
|
import { type ScaleMode } from "./scale.ts";
|
|
9
9
|
import type { SatelliteRef } from "../satellites/types.ts";
|
|
10
10
|
import { type RideFace, type RideLook, type RideModelSize, type RideViewpoint } from "./ride.ts";
|
|
11
|
+
import { type LightFade } from "../realistic/light-fade.ts";
|
|
11
12
|
import type { SkyFrame } from "../sky/frame.ts";
|
|
12
13
|
import type { PlaceView } from "../markers/places.ts";
|
|
13
14
|
import { type PlaceSpriteData } from "../markers/place-sprites.ts";
|
|
@@ -170,6 +171,8 @@ export interface SpaceModel {
|
|
|
170
171
|
focus: BodyName;
|
|
171
172
|
/** How the Earth is lit (see `LightMode`); the Sun, the Moon and the planets keep their true places either way. */
|
|
172
173
|
light: LightMode;
|
|
174
|
+
/** The cross-fade of the Earth's night lights between the true light and `lit`, stepped at each draw (src/realistic/light-fade.ts). */
|
|
175
|
+
lightFade: LightFade;
|
|
173
176
|
/** How the painter draws the Sun, the planets and their moons (one of its `looks`, or `plain` for the sphere in the right colour); empty for its first. */
|
|
174
177
|
bodies: string;
|
|
175
178
|
/** Filled at each draw. */
|
package/dist/space/scene.js
CHANGED
|
@@ -6,6 +6,9 @@ import { createTileSet } from "../realistic/tile-set.js";
|
|
|
6
6
|
import { createTrack, orbitPath, PLANETS } from "./ephemeris.js";
|
|
7
7
|
import { placeAround, placeMoon, placeSun, RADIUS } from "./scale.js";
|
|
8
8
|
import { faceOffset, outsidePose, ridePose } from "./ride.js";
|
|
9
|
+
import { stripLights } from "./model-lights.js";
|
|
10
|
+
import { newLightFade, stepLightFade } from "../realistic/light-fade.js";
|
|
11
|
+
import { prefersLessMotion } from "../meteors/note.js";
|
|
9
12
|
import { genericSatellite, satelliteKind } from "./generic-satellite.js";
|
|
10
13
|
import { followSpin } from "./follow.js";
|
|
11
14
|
import { coverBody, covers } from "../sky/cover.js";
|
|
@@ -116,6 +119,7 @@ export const newSpaceModel = () => ({
|
|
|
116
119
|
focus: "Earth",
|
|
117
120
|
bodies: "",
|
|
118
121
|
light: "sun",
|
|
122
|
+
lightFade: newLightFade(),
|
|
119
123
|
drawn: null,
|
|
120
124
|
painted: { bodies: 0, moons: 0, held: 0, moon: false, tiles: 0, mapped: 0, pending: 0 },
|
|
121
125
|
lookups: 0,
|
|
@@ -401,8 +405,17 @@ export function createSpaceItem(model, deps) {
|
|
|
401
405
|
let routeLayer = null;
|
|
402
406
|
let marksTold = false;
|
|
403
407
|
// the followed satellite's model: which satellite it is for, the drawing once it is made, and a count so that a model made for a satellite no longer followed is let go
|
|
404
|
-
const modelSlot = { key: "", drawing: null, turn: 0, parts: 0, axes: null };
|
|
408
|
+
const modelSlot = { key: "", drawing: null, turn: 0, parts: 0, axes: null, sun: null };
|
|
409
|
+
// The Sun's light for a generic satellite drawing, in the scene for good and dark (intensity 0) while no drawing is shown. Three counts the lights in the scene into the key of every program, so a light that came and went with a ride
|
|
410
|
+
// made a second program of the same code for each shader that was drawn while it was there (the Moon's, MODULES-1293): with the light always in the scene there is one.
|
|
411
|
+
const SunLight = three.DirectionalLight;
|
|
412
|
+
const sceneSun = SunLight ? new SunLight(0xfff4e0, 0) : undefined;
|
|
413
|
+
if (sceneSun)
|
|
414
|
+
scene.add(sceneSun);
|
|
405
415
|
const dropModel = () => {
|
|
416
|
+
if (sceneSun)
|
|
417
|
+
sceneSun.intensity = 0;
|
|
418
|
+
modelSlot.sun = null;
|
|
406
419
|
if (!modelSlot.drawing)
|
|
407
420
|
return;
|
|
408
421
|
scene.remove(modelSlot.drawing.object);
|
|
@@ -463,7 +476,11 @@ export function createSpaceItem(model, deps) {
|
|
|
463
476
|
cloudShift.value = -(((model.time / 3_600_000) * model.cloudDrift) % 360) / 360;
|
|
464
477
|
atmosphereMaterial.uniforms["thick"].value = model.airThickness;
|
|
465
478
|
glow.scale.setScalar(airTop(model.airThickness));
|
|
466
|
-
|
|
479
|
+
const fade = stepLightFade(model.lightFade, model.light === "lit", performance.now(), prefersLessMotion());
|
|
480
|
+
// one more frame while it moves, and none once it has arrived
|
|
481
|
+
if (fade.fading)
|
|
482
|
+
deps.invalidate();
|
|
483
|
+
earthMaterial.uniforms["lights"].value = 1 - fade.mix;
|
|
467
484
|
earthMaterial.uniforms["boost"].value = model.light === "boost" ? 1 : 0;
|
|
468
485
|
if (deps.paint) {
|
|
469
486
|
const changed = deps.paint.step(model.time);
|
|
@@ -862,6 +879,8 @@ export function createSpaceItem(model, deps) {
|
|
|
862
879
|
const adopt = (made) => {
|
|
863
880
|
made.object.matrixAutoUpdate = false;
|
|
864
881
|
made.object.visible = false;
|
|
882
|
+
// the scene owns the Sun's light: a light the painter put in its model is switched off and its look taken for the scene's Sun to wear while the model is shown (a generic drawing has none of its own: it was given the scene's)
|
|
883
|
+
modelSlot.sun = stripLights(made.object);
|
|
865
884
|
scene.add(made.object);
|
|
866
885
|
modelSlot.drawing = made;
|
|
867
886
|
// how many meshes the model is made of: a draw call each, which a test of the draw budget adds to the scene's own
|
|
@@ -873,7 +892,7 @@ export function createSpaceItem(model, deps) {
|
|
|
873
892
|
deps.invalidate();
|
|
874
893
|
};
|
|
875
894
|
if (modelKey.startsWith("generic:"))
|
|
876
|
-
adopt(genericSatellite(three, modelKey.slice(8)));
|
|
895
|
+
adopt(genericSatellite(three, modelKey.slice(8), sceneSun ? { sun: sceneSun } : undefined));
|
|
877
896
|
else if (modelKey && satellitePainter && norad !== undefined) {
|
|
878
897
|
void Promise.resolve(satellitePainter.make(three, norad, { look: "", invalidate: () => deps.invalidate(), ratio: model.ratio(), maxTexture: deps.cap() }))
|
|
879
898
|
.then((made) => {
|
|
@@ -910,6 +929,11 @@ export function createSpaceItem(model, deps) {
|
|
|
910
929
|
object.visible = true;
|
|
911
930
|
const toSunNow = unit(frame.sun);
|
|
912
931
|
modelSlot.drawing.light?.(toSunNow);
|
|
932
|
+
if (sceneSun && modelSlot.sun) {
|
|
933
|
+
sceneSun.color.setHex(modelSlot.sun.color);
|
|
934
|
+
sceneSun.intensity = modelSlot.sun.intensity;
|
|
935
|
+
sceneSun.position.set(toSunNow[0], toSunNow[1], toSunNow[2]);
|
|
936
|
+
}
|
|
913
937
|
modelSlot.drawing.update?.({ toSun: toSunNow, ms: model.time, radiusPx: size.height * share });
|
|
914
938
|
projected.set(shownSat.place[0], shownSat.place[1], shownSat.place[2]).project(camera);
|
|
915
939
|
const sx = ((projected.x + 1) / 2) * size.width;
|
|
@@ -920,6 +944,8 @@ export function createSpaceItem(model, deps) {
|
|
|
920
944
|
else {
|
|
921
945
|
if (modelSlot.drawing)
|
|
922
946
|
modelSlot.drawing.object.visible = false;
|
|
947
|
+
if (sceneSun)
|
|
948
|
+
sceneSun.intensity = 0;
|
|
923
949
|
model.followModel = null;
|
|
924
950
|
}
|
|
925
951
|
const sunToSun = unit([-frame.sun[0], -frame.sun[1], -frame.sun[2]]);
|
|
@@ -1249,6 +1275,10 @@ export function createSpaceItem(model, deps) {
|
|
|
1249
1275
|
routeLayer?.dispose();
|
|
1250
1276
|
modelSlot.turn += 1;
|
|
1251
1277
|
dropModel();
|
|
1278
|
+
if (sceneSun) {
|
|
1279
|
+
scene.remove(sceneSun);
|
|
1280
|
+
sceneSun.dispose?.();
|
|
1281
|
+
}
|
|
1252
1282
|
layer?.dispose();
|
|
1253
1283
|
model.pick = null;
|
|
1254
1284
|
model.pathAt = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/chikyu-earth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "Chikyu Earth 地球 — A line-drawn globe for the web: country outlines that turn at the Earth's own rate, centred on the place you give it, with an optional realistic Earth from space (three.js), the Sun, Moon and planets, satellites on their orbits, and markers for any place. A web component and an SVG string.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"earth",
|