@johnmorrisdotca/chikyu-earth 0.46.5 → 0.46.6
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 +4 -0
- package/README.md +2 -1
- package/dist/beam/geometry.d.ts +131 -0
- package/dist/beam/geometry.js +141 -0
- package/dist/beam/layer.d.ts +47 -0
- package/dist/beam/layer.js +308 -0
- package/dist/space/element-base.d.ts +39 -0
- package/dist/space/element-base.js +77 -1
- package/dist/space/index.d.ts +2 -0
- package/dist/space/index.js +1 -0
- package/dist/space/scene.d.ts +3 -0
- package/dist/space/scene.js +19 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.46.6 - 2026-11-13
|
|
4
|
+
|
|
5
|
+
- **A beam from the chosen satellite to the ground below it** (MODULES-1309). `beam` on `<chikyu-space>` (off unless set; the property `beam`) draws a soft, additive cone of light from the satellite marked with `selectSatellite`, or the one ridden, down to its footprint on the ground: a lit ring and a faint fill, the circle from which the satellite is above `beam-elevation` degrees (25), worked from its height (`footprintAngle`, `footprintKm`), cut off by the limb, in Ride along and Ride above as well. `beam-cells` (up to 91) adds spot cells in a hexagonal pack, each with a thin shaft of light (an illustration, not any operator's plan), `beam-cell-size`, `beam-color` and `beam-strength` set the look; `stats.beam` says the footprint's radius in kilometres. It is part of the draw that moves the satellite: nothing at rest, nothing rebuilt on a clock step, no shimmer. Guide: `docs/guides/beam.md` (and its Japanese twin), and a "Satellite beam" button in the demo.
|
|
6
|
+
|
|
3
7
|
## 0.46.5 - 2026-11-13
|
|
4
8
|
|
|
5
9
|
- **The ridden satellite's model shrinks as a ride above it rises, and the package's drawings are better** (MODULES-1306). In a ride above (`view: "above"`) the model was a fixed 17 per cent of the picture at any height, so from 6,000 km it was a huge block. The new option `modelSize: "distance" | "fixed"` (attribute `ride-model-size`, property `rideModelSize`; `distance` is the default) keeps the model at that size up to 150 km, shrinks it as one over the height, lets it down smoothly from 1,000 km to nothing at 2,000 km, where the ordinary mark (ring and name) takes over (`aboveModelShare`, `MODEL_HANDOVER_PX`); `fixed` is the old size at every height. A page's painter is told the size through `update({ radiusPx })` and `stats.followModel` reports it. The chosen satellite's ring and name stay off its model in both modes while it is drawn and return at the hand-over or when the ride ends (`modelOver`, `stats.satellites.selectedRing`). The generic drawings are redrawn with framed thin panels, a bus with a radiator and a camera, a dish, a long panel for a constellation, and a new `cubesat` kind (FLOCK, DOVE, LEMUR, SPIRE and similar names); every part of every kind is inside the model's disc (the flat kind's panel was not, which was the stray slab), tested in `test/generic-satellite.test.ts` and, pixel by pixel outside the reported box, in `e2e/ride-size.gl.ts`. Names under the model: while the model is drawn the package's own names (places, cities, seas, countries, stars) keep clear of its box, and `chikyu-ride-model` (`detail: { box, radiusPx, x, y }`, `box` null when none) tells the page when the box has moved by more than a pixel or has come or gone, for its own labels. **Behaviour change:** `distance` is the default; set `ride-model-size="fixed"` for the old size (upgrading guide).
|
package/README.md
CHANGED
|
@@ -578,6 +578,7 @@ Each guide has a Japanese twin in [docs/guides/ja](docs/guides/ja/getting-starte
|
|
|
578
578
|
| [City names on the Earth](docs/guides/city-names.md) | Cities named from kuni's list, more as the Earth grows on the screen, in the page's language |
|
|
579
579
|
| [Borders on the Earth](docs/guides/borders.md) | The borders between countries, and a page's own regions once the Earth is large enough |
|
|
580
580
|
| [The grid and country names on the Earth](docs/guides/grid-and-country-names.md) | Meridians and parallels with the special lines picked out, and the countries in sight named in the page's language |
|
|
581
|
+
| [A beam from a satellite to the ground](docs/guides/beam.md) | A soft cone of light from the chosen satellite to a lit footprint, true to its height, with optional spot cells, in a ride too |
|
|
581
582
|
| [A name on the Earth](docs/guides/body-label.md) | The Earth's name written on the globe, in the family's plain attribute names |
|
|
582
583
|
| [You are here, and places on the Earth](docs/guides/places.md) | The reader's place and favourite places as markers standing out of the Earth, asked for only on a press, kept on the device |
|
|
583
584
|
| [Meteors seen from space](docs/guides/meteors.md) | Streaks over the night side, the shower table, what is real and what is illustration |
|
|
@@ -611,7 +612,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
611
612
|
|
|
612
613
|
## How to cite
|
|
613
614
|
|
|
614
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.46.
|
|
615
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.46.6) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
615
616
|
|
|
616
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.
|
|
617
618
|
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The elevation, in degrees, above which a satellite counts as seen from the ground: the footprint is the circle from which it stands at least this high.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { BEAM_ELEVATION } from "@johnmorrisdotca/chikyu-earth/space";
|
|
7
|
+
*
|
|
8
|
+
* console.log(BEAM_ELEVATION);
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const BEAM_ELEVATION = 25;
|
|
12
|
+
/**
|
|
13
|
+
* The angle at the Earth's centre between the point below a satellite and the edge of its footprint, in radians: the ground circle from which the satellite is above `elevation`.
|
|
14
|
+
* It is `acos(R cos(e) / (R + h)) - e` for the Earth's radius R, the height h and the elevation e. A satellite on or under the ground, or an elevation of 90 degrees or more, has none.
|
|
15
|
+
*
|
|
16
|
+
* @param heightKm - The satellite's height above the ground, in kilometres.
|
|
17
|
+
* @param elevation - The least elevation, in degrees. 25 when left out.
|
|
18
|
+
* @returns The angle, in radians, from 0 up to a quarter of a turn.
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { footprintAngle } from "@johnmorrisdotca/chikyu-earth/space";
|
|
22
|
+
*
|
|
23
|
+
* console.log((footprintAngle(420) * 180) / Math.PI);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function footprintAngle(heightKm: number, elevation?: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* The radius of a satellite's footprint along the ground, in kilometres: the Earth's radius times {@link footprintAngle}.
|
|
29
|
+
*
|
|
30
|
+
* @param heightKm - The satellite's height above the ground, in kilometres.
|
|
31
|
+
* @param elevation - The least elevation, in degrees. 25 when left out.
|
|
32
|
+
* @returns The radius in kilometres.
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { footprintKm } from "@johnmorrisdotca/chikyu-earth/space";
|
|
36
|
+
*
|
|
37
|
+
* console.log(Math.round(footprintKm(550)));
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const footprintKm: (heightKm: number, elevation?: number) => number;
|
|
41
|
+
/**
|
|
42
|
+
* The spot cells inside a footprint: where each one's middle is, and how large they are, in the footprint's own units (the footprint's radius is 1).
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts no-run
|
|
46
|
+
* import type { BeamCells } from "@johnmorrisdotca/chikyu-earth/space";
|
|
47
|
+
*
|
|
48
|
+
* const none: BeamCells = { lattice: [], pitch: 0, radius: 0 };
|
|
49
|
+
* console.log(none.lattice.length);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export interface BeamCells {
|
|
53
|
+
/** Each cell's middle on the lattice, in units of the distance between neighbours (the hexagonal pack: one at the middle, then rings of six, twelve, eighteen). */
|
|
54
|
+
lattice: number[][];
|
|
55
|
+
/** The distance between neighbouring cells as a share of the footprint's radius. */
|
|
56
|
+
pitch: number;
|
|
57
|
+
/** A cell's radius as a share of the footprint's radius. */
|
|
58
|
+
radius: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The spot cells of a footprint: `count` circles in a hexagonal pack (the middle one, then the nearest to it), drawn to fit inside the footprint, or at most `cellKm` in radius when that is smaller.
|
|
62
|
+
* It is an illustration of a satellite that serves the ground in cells; it is not the pattern of any operator's beam plan.
|
|
63
|
+
*
|
|
64
|
+
* @param count - How many cells (0 for none; the most is 91, six rings).
|
|
65
|
+
* @param radiusKm - The footprint's radius along the ground, in kilometres.
|
|
66
|
+
* @param cellKm - A cell's radius in kilometres, when the page wants it smaller than the fit; 0 for the fit.
|
|
67
|
+
* @returns The cells.
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import { beamCells } from "@johnmorrisdotca/chikyu-earth/space";
|
|
71
|
+
*
|
|
72
|
+
* console.log(beamCells(19, 2200, 0).lattice.length);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function beamCells(count: number, radiusKm: number, cellKm?: number): BeamCells;
|
|
76
|
+
/**
|
|
77
|
+
* The attributes the beam reads: `beam`, `beam-elevation`, `beam-cells`, `beam-cell-size`, `beam-color` and `beam-strength`.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* import { BEAM_ATTRIBUTES } from "@johnmorrisdotca/chikyu-earth/space";
|
|
82
|
+
*
|
|
83
|
+
* console.log(BEAM_ATTRIBUTES.join(" "));
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare const BEAM_ATTRIBUTES: readonly ["beam", "beam-elevation", "beam-cells", "beam-cell-size", "beam-color", "beam-strength"];
|
|
87
|
+
/**
|
|
88
|
+
* What the attributes say: whether the beam is on, and its options.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts no-run
|
|
92
|
+
* import type { BeamOptions } from "@johnmorrisdotca/chikyu-earth/space";
|
|
93
|
+
*
|
|
94
|
+
* const options: BeamOptions = { on: true, elevation: 25, cells: 19, cellSize: 0, colour: "#8fd1ff", strength: 0.6 };
|
|
95
|
+
* console.log(options.cells);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export interface BeamOptions {
|
|
99
|
+
on: boolean;
|
|
100
|
+
elevation: number;
|
|
101
|
+
cells: number;
|
|
102
|
+
cellSize: number;
|
|
103
|
+
colour: string;
|
|
104
|
+
strength: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The beam's colour when the page names none: a pale blue that reads on the day side and the night side.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* import { BEAM_COLOUR } from "@johnmorrisdotca/chikyu-earth/space";
|
|
112
|
+
*
|
|
113
|
+
* console.log(BEAM_COLOUR);
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare const BEAM_COLOUR = "#8fd1ff";
|
|
117
|
+
/**
|
|
118
|
+
* What the beam's attributes say. `beam` is off when it is missing, `off` or `false`; a bare attribute, `selected` or `on` switches it on for the chosen satellite. The strength is from 0 to 1 (0.6 when left out),
|
|
119
|
+
* the elevation from 0 to 80 degrees (25), the cells from 0 to 91 (none) and the cell size in kilometres (0 for the fit).
|
|
120
|
+
*
|
|
121
|
+
* @param get - Reads an attribute by name, `null` when it is missing.
|
|
122
|
+
* @returns The options.
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* import { readBeam } from "@johnmorrisdotca/chikyu-earth/space";
|
|
126
|
+
*
|
|
127
|
+
* const read = readBeam((name) => ({ beam: "selected", "beam-cells": "19" })[name] ?? null);
|
|
128
|
+
* console.log(read.on, read.cells);
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare function readBeam(get: (name: string) => string | null): BeamOptions;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// The beam from a satellite to the ground below it: the true size of the footprint, and the pattern of spot cells drawn inside it. Pure: numbers in, numbers out.
|
|
2
|
+
// The footprint is the circle on the ground from which the satellite stands above a stated elevation; the cells are an illustration, never an operator's beam plan.
|
|
3
|
+
const RAD = Math.PI / 180;
|
|
4
|
+
/** The Earth's mean radius in kilometres, as the space view measures: the same 6,371. */
|
|
5
|
+
const EARTH_KM = 6371;
|
|
6
|
+
/**
|
|
7
|
+
* The elevation, in degrees, above which a satellite counts as seen from the ground: the footprint is the circle from which it stands at least this high.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { BEAM_ELEVATION } from "@johnmorrisdotca/chikyu-earth/space";
|
|
12
|
+
*
|
|
13
|
+
* console.log(BEAM_ELEVATION);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export const BEAM_ELEVATION = 25;
|
|
17
|
+
/**
|
|
18
|
+
* The angle at the Earth's centre between the point below a satellite and the edge of its footprint, in radians: the ground circle from which the satellite is above `elevation`.
|
|
19
|
+
* It is `acos(R cos(e) / (R + h)) - e` for the Earth's radius R, the height h and the elevation e. A satellite on or under the ground, or an elevation of 90 degrees or more, has none.
|
|
20
|
+
*
|
|
21
|
+
* @param heightKm - The satellite's height above the ground, in kilometres.
|
|
22
|
+
* @param elevation - The least elevation, in degrees. 25 when left out.
|
|
23
|
+
* @returns The angle, in radians, from 0 up to a quarter of a turn.
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { footprintAngle } from "@johnmorrisdotca/chikyu-earth/space";
|
|
27
|
+
*
|
|
28
|
+
* console.log((footprintAngle(420) * 180) / Math.PI);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function footprintAngle(heightKm, elevation = BEAM_ELEVATION) {
|
|
32
|
+
if (!(heightKm > 0) || !(elevation < 90))
|
|
33
|
+
return 0;
|
|
34
|
+
const e = Math.max(0, elevation) * RAD;
|
|
35
|
+
const cosine = (EARTH_KM * Math.cos(e)) / (EARTH_KM + heightKm);
|
|
36
|
+
return Math.max(0, Math.acos(Math.min(1, cosine)) - e);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The radius of a satellite's footprint along the ground, in kilometres: the Earth's radius times {@link footprintAngle}.
|
|
40
|
+
*
|
|
41
|
+
* @param heightKm - The satellite's height above the ground, in kilometres.
|
|
42
|
+
* @param elevation - The least elevation, in degrees. 25 when left out.
|
|
43
|
+
* @returns The radius in kilometres.
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { footprintKm } from "@johnmorrisdotca/chikyu-earth/space";
|
|
47
|
+
*
|
|
48
|
+
* console.log(Math.round(footprintKm(550)));
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export const footprintKm = (heightKm, elevation = BEAM_ELEVATION) => EARTH_KM * footprintAngle(heightKm, elevation);
|
|
52
|
+
/** A cell's radius as a share of the distance between neighbours: a little under a half, so the rings of neighbours do not touch. */
|
|
53
|
+
const CELL_SHARE = 0.46;
|
|
54
|
+
/** How far out the outer edge of the outermost cell may reach, as a share of the footprint's radius. */
|
|
55
|
+
const FIT = 0.97;
|
|
56
|
+
/**
|
|
57
|
+
* The spot cells of a footprint: `count` circles in a hexagonal pack (the middle one, then the nearest to it), drawn to fit inside the footprint, or at most `cellKm` in radius when that is smaller.
|
|
58
|
+
* It is an illustration of a satellite that serves the ground in cells; it is not the pattern of any operator's beam plan.
|
|
59
|
+
*
|
|
60
|
+
* @param count - How many cells (0 for none; the most is 91, six rings).
|
|
61
|
+
* @param radiusKm - The footprint's radius along the ground, in kilometres.
|
|
62
|
+
* @param cellKm - A cell's radius in kilometres, when the page wants it smaller than the fit; 0 for the fit.
|
|
63
|
+
* @returns The cells.
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { beamCells } from "@johnmorrisdotca/chikyu-earth/space";
|
|
67
|
+
*
|
|
68
|
+
* console.log(beamCells(19, 2200, 0).lattice.length);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export function beamCells(count, radiusKm, cellKm = 0) {
|
|
72
|
+
const wanted = Math.max(0, Math.min(91, Math.floor(Number.isFinite(count) ? count : 0)));
|
|
73
|
+
const lattice = [];
|
|
74
|
+
const reach = 6;
|
|
75
|
+
for (let j = -reach; j <= reach; j += 1)
|
|
76
|
+
for (let i = -reach; i <= reach; i += 1)
|
|
77
|
+
lattice.push([i + j / 2, (j * Math.sqrt(3)) / 2]);
|
|
78
|
+
lattice.sort((a, b) => Math.hypot(a[0], a[1]) - Math.hypot(b[0], b[1]) || Math.atan2(a[1], a[0]) - Math.atan2(b[1], b[0]));
|
|
79
|
+
const taken = lattice.slice(0, wanted);
|
|
80
|
+
const far = taken.reduce((most, point) => Math.max(most, Math.hypot(point[0], point[1])), 0);
|
|
81
|
+
let pitch = FIT / (far + CELL_SHARE);
|
|
82
|
+
let radius = CELL_SHARE * pitch;
|
|
83
|
+
if (cellKm > 0 && radiusKm > 0 && cellKm / radiusKm < radius) {
|
|
84
|
+
radius = cellKm / radiusKm;
|
|
85
|
+
pitch = radius / CELL_SHARE;
|
|
86
|
+
}
|
|
87
|
+
return { lattice: taken, pitch, radius };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The attributes the beam reads: `beam`, `beam-elevation`, `beam-cells`, `beam-cell-size`, `beam-color` and `beam-strength`.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* import { BEAM_ATTRIBUTES } from "@johnmorrisdotca/chikyu-earth/space";
|
|
95
|
+
*
|
|
96
|
+
* console.log(BEAM_ATTRIBUTES.join(" "));
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export const BEAM_ATTRIBUTES = ["beam", "beam-elevation", "beam-cells", "beam-cell-size", "beam-color", "beam-strength"];
|
|
100
|
+
/**
|
|
101
|
+
* The beam's colour when the page names none: a pale blue that reads on the day side and the night side.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* import { BEAM_COLOUR } from "@johnmorrisdotca/chikyu-earth/space";
|
|
106
|
+
*
|
|
107
|
+
* console.log(BEAM_COLOUR);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export const BEAM_COLOUR = "#8fd1ff";
|
|
111
|
+
const number = (value, fallback, least, most) => {
|
|
112
|
+
const read = value === null || value.trim() === "" ? Number.NaN : Number(value);
|
|
113
|
+
return Number.isFinite(read) ? Math.min(most, Math.max(least, read)) : fallback;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* What the beam's attributes say. `beam` is off when it is missing, `off` or `false`; a bare attribute, `selected` or `on` switches it on for the chosen satellite. The strength is from 0 to 1 (0.6 when left out),
|
|
117
|
+
* the elevation from 0 to 80 degrees (25), the cells from 0 to 91 (none) and the cell size in kilometres (0 for the fit).
|
|
118
|
+
*
|
|
119
|
+
* @param get - Reads an attribute by name, `null` when it is missing.
|
|
120
|
+
* @returns The options.
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { readBeam } from "@johnmorrisdotca/chikyu-earth/space";
|
|
124
|
+
*
|
|
125
|
+
* const read = readBeam((name) => ({ beam: "selected", "beam-cells": "19" })[name] ?? null);
|
|
126
|
+
* console.log(read.on, read.cells);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export function readBeam(get) {
|
|
130
|
+
const word = get("beam");
|
|
131
|
+
const on = word !== null && !["off", "false", "none"].includes(word.trim().toLowerCase());
|
|
132
|
+
const colour = (get("beam-color") ?? "").trim();
|
|
133
|
+
return {
|
|
134
|
+
on,
|
|
135
|
+
elevation: number(get("beam-elevation"), BEAM_ELEVATION, 0, 80),
|
|
136
|
+
cells: Math.floor(number(get("beam-cells"), 0, 0, 91)),
|
|
137
|
+
cellSize: number(get("beam-cell-size"), 0, 0, 5000),
|
|
138
|
+
colour: /^#[0-9a-f]{3,8}$|^[a-z]+$|^(rgb|hsl)a?\(/i.test(colour) ? colour : BEAM_COLOUR,
|
|
139
|
+
strength: number(get("beam-strength"), 0.6, 0, 1),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type * as THREE from "three";
|
|
2
|
+
import type { ThreeParts } from "../realistic/textures.ts";
|
|
3
|
+
import { type BeamOptions } from "./geometry.ts";
|
|
4
|
+
/**
|
|
5
|
+
* What the beam has done: whether it is drawn, the chosen satellite's height, the footprint's radius along the ground in kilometres and its angle at the Earth's centre, the elevation it was worked for,
|
|
6
|
+
* the cells drawn and a cell's radius in kilometres, and how many times its geometry was made.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts no-run
|
|
10
|
+
* import type { BeamStats } from "@johnmorrisdotca/chikyu-earth/space/element";
|
|
11
|
+
*
|
|
12
|
+
* const none: BeamStats = { shown: false, heightKm: 0, radiusKm: 0, angleDegrees: 0, elevation: 25, cells: 0, cellRadiusKm: 0, builds: 0, failed: false };
|
|
13
|
+
* console.log(none);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export interface BeamStats {
|
|
17
|
+
shown: boolean;
|
|
18
|
+
heightKm: number;
|
|
19
|
+
radiusKm: number;
|
|
20
|
+
angleDegrees: number;
|
|
21
|
+
elevation: number;
|
|
22
|
+
cells: number;
|
|
23
|
+
cellRadiusKm: number;
|
|
24
|
+
builds: number;
|
|
25
|
+
failed: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** What the element and the scene share: the options the attributes give, and what the beam did. */
|
|
28
|
+
export interface BeamState extends BeamOptions {
|
|
29
|
+
onError?: (error: unknown) => void;
|
|
30
|
+
stats: BeamStats;
|
|
31
|
+
}
|
|
32
|
+
export declare const newBeamState: () => BeamState;
|
|
33
|
+
export interface BeamLayer {
|
|
34
|
+
/** Places the beam for this draw: the chosen satellite's place in Earth radii (the scene's axes), or `null` for none. */
|
|
35
|
+
sync(position: readonly [number, number, number] | null): void;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Makes the beam in `scene` (the world the satellites are in, not the Earth's turning group: the footprint is worked out for the satellite's place now).
|
|
40
|
+
*
|
|
41
|
+
* @param three - The page's three.js; it must have `AdditiveBlending`.
|
|
42
|
+
* @param scene - The scene the satellites are in.
|
|
43
|
+
* @param state - The model's beam.
|
|
44
|
+
* @param order - The render order: after the satellites' dots.
|
|
45
|
+
* @returns The layer.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createBeamLayer(three: ThreeParts, scene: THREE.Object3D, state: BeamState, order: number): BeamLayer;
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { BEAM_COLOUR, beamCells, footprintAngle, footprintKm } from "./geometry.js";
|
|
2
|
+
/** Earth radii: the Earth's radius in kilometres, the unit the scene measures in. */
|
|
3
|
+
const EARTH_KM = 6371;
|
|
4
|
+
/** The footprint sits this far above the ground (in Earth radii): over the map tiles and the sphere's flat facets, as the grid does. */
|
|
5
|
+
const GROUND = 1.0015;
|
|
6
|
+
const CONE_SEGMENTS = 72;
|
|
7
|
+
const DISC_SEGMENTS = 64;
|
|
8
|
+
const DISC_RINGS = 6;
|
|
9
|
+
export const newBeamState = () => ({ on: false, elevation: 25, cells: 0, cellSize: 0, colour: BEAM_COLOUR, strength: 0.6, stats: { shown: false, heightKm: 0, radiusKm: 0, angleDegrees: 0, elevation: 25, cells: 0, cellRadiusKm: 0, builds: 0, failed: false } });
|
|
10
|
+
// The footprint's flat units (its radius is 1) mapped onto the sphere about the point below the satellite, the angle growing with the distance from the middle: the same map the rings use.
|
|
11
|
+
const MAP = /* glsl */ `
|
|
12
|
+
vec3 ground(vec2 p) {
|
|
13
|
+
float r = length(p);
|
|
14
|
+
vec2 d = r > 1e-6 ? p / r : vec2(1.0, 0.0);
|
|
15
|
+
float a = r * lambda;
|
|
16
|
+
return (nadir * cos(a) + (e1 * d.x + e2 * d.y) * sin(a)) * ${GROUND.toFixed(4)};
|
|
17
|
+
}`;
|
|
18
|
+
const CONE_VERT = /* glsl */ `
|
|
19
|
+
attribute vec4 cone;
|
|
20
|
+
attribute float shaft;
|
|
21
|
+
uniform vec3 sat;
|
|
22
|
+
uniform vec3 nadir;
|
|
23
|
+
uniform vec3 e1;
|
|
24
|
+
uniform vec3 e2;
|
|
25
|
+
uniform float lambda;
|
|
26
|
+
uniform float pitch;
|
|
27
|
+
uniform float circle;
|
|
28
|
+
uniform float weights;
|
|
29
|
+
uniform float cone0;
|
|
30
|
+
uniform float thin;
|
|
31
|
+
varying float vT;
|
|
32
|
+
varying float vFace;
|
|
33
|
+
varying float vRay;
|
|
34
|
+
varying float vDist;
|
|
35
|
+
varying float vWeight;
|
|
36
|
+
${MAP}
|
|
37
|
+
// the footprint's own cone (shaft 0) or the thin one to a cell (shaft 1)
|
|
38
|
+
vec3 rim(float phi) { return shaft > 0.5 ? ground(cone.zw * pitch + circle * thin * vec2(cos(phi), sin(phi))) : ground(vec2(cos(phi), sin(phi))); }
|
|
39
|
+
vec3 at(float t, float phi) { return mix(sat, rim(phi), t); }
|
|
40
|
+
void main() {
|
|
41
|
+
float t = cone.x;
|
|
42
|
+
float s = clamp(t, 0.05, 1.0);
|
|
43
|
+
vec3 p = at(t, cone.y);
|
|
44
|
+
vec3 dp = at(s, cone.y + 0.01) - at(s, cone.y - 0.01);
|
|
45
|
+
vec3 n = normalize(cross(dp, rim(cone.y) - sat));
|
|
46
|
+
vec3 v = cameraPosition - p;
|
|
47
|
+
vDist = length(v);
|
|
48
|
+
vFace = abs(dot(n, normalize(v)));
|
|
49
|
+
vT = t;
|
|
50
|
+
vRay = cone.y;
|
|
51
|
+
vWeight = shaft > 0.5 ? weights : cone0;
|
|
52
|
+
gl_Position = projectionMatrix * viewMatrix * vec4(p, 1.0);
|
|
53
|
+
}`;
|
|
54
|
+
const CONE_FRAG = /* glsl */ `
|
|
55
|
+
uniform vec3 colour;
|
|
56
|
+
uniform float strength;
|
|
57
|
+
varying float vT;
|
|
58
|
+
varying float vFace;
|
|
59
|
+
varying float vRay;
|
|
60
|
+
varying float vDist;
|
|
61
|
+
varying float vWeight;
|
|
62
|
+
void main() {
|
|
63
|
+
// brightest at the satellite, fading towards the ground; soft at the edges (a shaft is thickest through its middle), and a little streaked round
|
|
64
|
+
float along = 0.04 + 0.96 * pow(1.0 - vT, 1.7);
|
|
65
|
+
float body = 0.1 + 0.9 * pow(vFace, 1.4);
|
|
66
|
+
float streaks = 0.88 + 0.12 * sin(vRay * 36.0);
|
|
67
|
+
float near = smoothstep(0.004, 0.06, vDist);
|
|
68
|
+
float a = strength * vWeight * along * body * streaks * near;
|
|
69
|
+
gl_FragColor = vec4(colour, a);
|
|
70
|
+
}`;
|
|
71
|
+
// The footprint itself (kinds 2 and 3) and the cells (kinds 0 and 1), each a faint fill with a soft inner glow and a thin bright line, mapped from the footprint's flat units onto the sphere.
|
|
72
|
+
// The line is drawn in a band either side of the edge and shaped in pixels (from how fast the radius changes across the screen), so it is as thin on a small cell as on the whole footprint.
|
|
73
|
+
const DISC_VERT = /* glsl */ `
|
|
74
|
+
attribute vec4 disc;
|
|
75
|
+
attribute vec2 pol;
|
|
76
|
+
uniform vec3 nadir;
|
|
77
|
+
uniform vec3 e1;
|
|
78
|
+
uniform vec3 e2;
|
|
79
|
+
uniform float lambda;
|
|
80
|
+
uniform float pitch;
|
|
81
|
+
uniform float circle;
|
|
82
|
+
varying float vRho;
|
|
83
|
+
varying float vRing;
|
|
84
|
+
varying float vFill;
|
|
85
|
+
varying float vShare;
|
|
86
|
+
${MAP}
|
|
87
|
+
void main() {
|
|
88
|
+
bool foot = disc.w > 1.5;
|
|
89
|
+
vec2 q = vec2(cos(pol.y), sin(pol.y)) * pol.x;
|
|
90
|
+
vec2 p = foot ? q : disc.xy * pitch + circle * q;
|
|
91
|
+
vRho = pol.x;
|
|
92
|
+
vRing = mod(disc.w, 2.0);
|
|
93
|
+
vFill = foot ? 0.05 : 0.04;
|
|
94
|
+
vShare = foot ? 1.0 : 0.8;
|
|
95
|
+
gl_Position = projectionMatrix * viewMatrix * vec4(ground(p), 1.0);
|
|
96
|
+
}`;
|
|
97
|
+
const DISC_FRAG = /* glsl */ `
|
|
98
|
+
uniform vec3 colour;
|
|
99
|
+
uniform float strength;
|
|
100
|
+
varying float vRho;
|
|
101
|
+
varying float vRing;
|
|
102
|
+
varying float vFill;
|
|
103
|
+
varying float vShare;
|
|
104
|
+
void main() {
|
|
105
|
+
float a;
|
|
106
|
+
if (vRing > 0.5) {
|
|
107
|
+
float d = (vRho - 1.0) / max(fwidth(vRho), 1e-5);
|
|
108
|
+
float line = 1.0 - smoothstep(0.35, 1.1, abs(d));
|
|
109
|
+
float glow = d < 0.0 ? 0.34 * exp(d / 7.0) : 0.2 * exp(-d / 4.0);
|
|
110
|
+
a = vShare * min(1.0, line + glow);
|
|
111
|
+
} else {
|
|
112
|
+
a = vFill * (0.25 + 0.75 * pow(clamp(vRho, 0.0, 1.0), 5.0));
|
|
113
|
+
}
|
|
114
|
+
gl_FragColor = vec4(colour, strength * a);
|
|
115
|
+
}`;
|
|
116
|
+
/** The cones: the footprint's own, then one thin one for each lattice point. Each is a strip from the apex (t = 0) to the rim (t = 1), every phi round. */
|
|
117
|
+
function coneGeometry(three, lattice) {
|
|
118
|
+
const verts = [];
|
|
119
|
+
const shaft = [];
|
|
120
|
+
const index = [];
|
|
121
|
+
const add = (x, y, thin, rows, segments) => {
|
|
122
|
+
const base = verts.length / 4;
|
|
123
|
+
for (let r = 0; r <= rows; r += 1) {
|
|
124
|
+
for (let s = 0; s <= segments; s += 1) {
|
|
125
|
+
verts.push(r / rows, (s / segments) * Math.PI * 2, x, y);
|
|
126
|
+
shaft.push(thin);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
for (let r = 0; r < rows; r += 1) {
|
|
130
|
+
for (let s = 0; s < segments; s += 1) {
|
|
131
|
+
const a = base + r * (segments + 1) + s;
|
|
132
|
+
const b = a + segments + 1;
|
|
133
|
+
index.push(a, b, a + 1, a + 1, b, b + 1);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
add(0, 0, 0, 10, CONE_SEGMENTS);
|
|
138
|
+
for (const point of lattice)
|
|
139
|
+
add(point[0], point[1], 1, 6, 24);
|
|
140
|
+
const geometry = new three.BufferGeometry();
|
|
141
|
+
geometry.setAttribute("cone", new three.BufferAttribute(new Float32Array(verts), 4));
|
|
142
|
+
geometry.setAttribute("shaft", new three.BufferAttribute(new Float32Array(shaft), 1));
|
|
143
|
+
geometry.setAttribute("position", new three.BufferAttribute(new Float32Array((verts.length / 4) * 3), 3));
|
|
144
|
+
geometry.setIndex(index);
|
|
145
|
+
return geometry;
|
|
146
|
+
}
|
|
147
|
+
/** The ground: the footprint's disc and ring (kinds 2 and 3), then each cell's (kinds 0 and 1). */
|
|
148
|
+
function groundGeometry(three, lattice) {
|
|
149
|
+
const disc = [];
|
|
150
|
+
const pol = [];
|
|
151
|
+
const index = [];
|
|
152
|
+
const push = (x, y, kind, rho, phi, band = 0) => {
|
|
153
|
+
disc.push(x, y, band, kind);
|
|
154
|
+
pol.push(rho, phi);
|
|
155
|
+
return pol.length / 2 - 1;
|
|
156
|
+
};
|
|
157
|
+
const circleAt = (x, y, fillKind) => {
|
|
158
|
+
const fill = push(x, y, fillKind, 0, 0);
|
|
159
|
+
const first = pol.length / 2;
|
|
160
|
+
for (let r = 1; r <= DISC_RINGS; r += 1)
|
|
161
|
+
for (let s = 0; s < DISC_SEGMENTS; s += 1)
|
|
162
|
+
push(x, y, fillKind, (r / DISC_RINGS) * 0.985, (s / DISC_SEGMENTS) * Math.PI * 2);
|
|
163
|
+
for (let s = 0; s < DISC_SEGMENTS; s += 1)
|
|
164
|
+
index.push(fill, first + s, first + ((s + 1) % DISC_SEGMENTS));
|
|
165
|
+
for (let r = 1; r < DISC_RINGS; r += 1) {
|
|
166
|
+
for (let s = 0; s < DISC_SEGMENTS; s += 1) {
|
|
167
|
+
const a = first + (r - 1) * DISC_SEGMENTS + s;
|
|
168
|
+
const b = first + (r - 1) * DISC_SEGMENTS + ((s + 1) % DISC_SEGMENTS);
|
|
169
|
+
index.push(a, a + DISC_SEGMENTS, b, b, a + DISC_SEGMENTS, b + DISC_SEGMENTS);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// the ring: a band just inside the edge, brightest in the middle of it
|
|
173
|
+
const band = pol.length / 2;
|
|
174
|
+
for (const w of [0, 1])
|
|
175
|
+
for (let s = 0; s < DISC_SEGMENTS; s += 1)
|
|
176
|
+
push(x, y, fillKind + 1, 0.82 + 0.36 * w, (s / DISC_SEGMENTS) * Math.PI * 2, w);
|
|
177
|
+
for (let s = 0; s < DISC_SEGMENTS; s += 1) {
|
|
178
|
+
const a = band + s;
|
|
179
|
+
const b = band + ((s + 1) % DISC_SEGMENTS);
|
|
180
|
+
index.push(a, a + DISC_SEGMENTS, b, b, a + DISC_SEGMENTS, b + DISC_SEGMENTS);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
circleAt(0, 0, 2);
|
|
184
|
+
for (const point of lattice)
|
|
185
|
+
circleAt(point[0], point[1], 0);
|
|
186
|
+
const geometry = new three.BufferGeometry();
|
|
187
|
+
geometry.setAttribute("disc", new three.BufferAttribute(new Float32Array(disc), 4));
|
|
188
|
+
geometry.setAttribute("pol", new three.BufferAttribute(new Float32Array(pol), 2));
|
|
189
|
+
geometry.setAttribute("position", new three.BufferAttribute(new Float32Array((pol.length / 2) * 3), 3));
|
|
190
|
+
geometry.setIndex(index);
|
|
191
|
+
return geometry;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Makes the beam in `scene` (the world the satellites are in, not the Earth's turning group: the footprint is worked out for the satellite's place now).
|
|
195
|
+
*
|
|
196
|
+
* @param three - The page's three.js; it must have `AdditiveBlending`.
|
|
197
|
+
* @param scene - The scene the satellites are in.
|
|
198
|
+
* @param state - The model's beam.
|
|
199
|
+
* @param order - The render order: after the satellites' dots.
|
|
200
|
+
* @returns The layer.
|
|
201
|
+
*/
|
|
202
|
+
export function createBeamLayer(three, scene, state, order) {
|
|
203
|
+
if (three.AdditiveBlending === undefined)
|
|
204
|
+
throw new Error("the three.js handed over has no AdditiveBlending, which the beam needs");
|
|
205
|
+
const blending = three.AdditiveBlending;
|
|
206
|
+
const uniforms = {
|
|
207
|
+
sat: { value: new three.Vector3() },
|
|
208
|
+
nadir: { value: new three.Vector3(0, 1, 0) },
|
|
209
|
+
e1: { value: new three.Vector3(1, 0, 0) },
|
|
210
|
+
e2: { value: new three.Vector3(0, 0, 1) },
|
|
211
|
+
lambda: { value: 0 },
|
|
212
|
+
colour: { value: new three.Color(state.colour) },
|
|
213
|
+
strength: { value: state.strength },
|
|
214
|
+
pitch: { value: 0.2 },
|
|
215
|
+
circle: { value: 0.1 },
|
|
216
|
+
weights: { value: 0.3 },
|
|
217
|
+
cone0: { value: 0.42 },
|
|
218
|
+
thin: { value: 0.5 },
|
|
219
|
+
};
|
|
220
|
+
// forceSinglePass: a double-sided transparent material is drawn twice (back faces, then front); added light does not care about the order, so once is enough and the beam costs half the draw calls.
|
|
221
|
+
// Two draw calls in all: the cones (the footprint's own and the thin one to each cell), and the ground (the footprint's disc and ring and the cells').
|
|
222
|
+
const common = { transparent: true, depthWrite: false, blending, forceSinglePass: true, side: three.DoubleSide, uniforms };
|
|
223
|
+
const coneMaterial = new three.ShaderMaterial({ vertexShader: CONE_VERT, fragmentShader: CONE_FRAG, ...common });
|
|
224
|
+
const groundMaterial = new three.ShaderMaterial({ vertexShader: DISC_VERT, fragmentShader: DISC_FRAG, ...common });
|
|
225
|
+
let cones = null;
|
|
226
|
+
let ground = null;
|
|
227
|
+
let cellKey = "";
|
|
228
|
+
const make = (lattice) => {
|
|
229
|
+
for (const old of [cones, ground]) {
|
|
230
|
+
if (!old)
|
|
231
|
+
continue;
|
|
232
|
+
scene.remove(old);
|
|
233
|
+
old.geometry.dispose();
|
|
234
|
+
}
|
|
235
|
+
cones = new three.Mesh(coneGeometry(three, lattice), coneMaterial);
|
|
236
|
+
ground = new three.Mesh(groundGeometry(three, lattice), groundMaterial);
|
|
237
|
+
for (const part of [cones, ground]) {
|
|
238
|
+
part.frustumCulled = false;
|
|
239
|
+
part.renderOrder = order;
|
|
240
|
+
part.visible = false;
|
|
241
|
+
scene.add(part);
|
|
242
|
+
}
|
|
243
|
+
state.stats.builds += 1;
|
|
244
|
+
};
|
|
245
|
+
const stats = state.stats;
|
|
246
|
+
const up = new three.Vector3(0, 1, 0);
|
|
247
|
+
const side = new three.Vector3();
|
|
248
|
+
return {
|
|
249
|
+
sync(position) {
|
|
250
|
+
const height = position ? Math.hypot(position[0], position[1], position[2]) : 0;
|
|
251
|
+
const on = state.on && position !== null && height > 1;
|
|
252
|
+
stats.shown = on;
|
|
253
|
+
if (cones)
|
|
254
|
+
cones.visible = on;
|
|
255
|
+
if (ground)
|
|
256
|
+
ground.visible = on;
|
|
257
|
+
if (!on || !position) {
|
|
258
|
+
stats.heightKm = 0;
|
|
259
|
+
stats.radiusKm = 0;
|
|
260
|
+
stats.angleDegrees = 0;
|
|
261
|
+
stats.cells = 0;
|
|
262
|
+
stats.cellRadiusKm = 0;
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const heightKm = (height - 1) * EARTH_KM;
|
|
266
|
+
const lambda = footprintAngle(heightKm, state.elevation);
|
|
267
|
+
stats.heightKm = heightKm;
|
|
268
|
+
stats.radiusKm = footprintKm(heightKm, state.elevation);
|
|
269
|
+
stats.angleDegrees = (lambda * 180) / Math.PI;
|
|
270
|
+
stats.elevation = state.elevation;
|
|
271
|
+
// the cells: the geometry is made again only when their number changes (and the first time); their size follows the footprint
|
|
272
|
+
const wanted = beamCells(state.cells, stats.radiusKm, state.cellSize);
|
|
273
|
+
const key = `${wanted.lattice.length}`;
|
|
274
|
+
if (!cones || key !== cellKey) {
|
|
275
|
+
cellKey = key;
|
|
276
|
+
make(wanted.lattice);
|
|
277
|
+
}
|
|
278
|
+
cones.visible = true;
|
|
279
|
+
ground.visible = true;
|
|
280
|
+
uniforms.sat.value.set(position[0], position[1], position[2]);
|
|
281
|
+
uniforms.nadir.value.set(position[0] / height, position[1] / height, position[2] / height);
|
|
282
|
+
side.copy(Math.abs(uniforms.nadir.value.y) > 0.99 ? side.set(1, 0, 0) : up).cross(uniforms.nadir.value).normalize();
|
|
283
|
+
uniforms.e1.value.copy(side);
|
|
284
|
+
uniforms.e2.value.copy(uniforms.nadir.value).cross(side);
|
|
285
|
+
uniforms.lambda.value = lambda;
|
|
286
|
+
uniforms.colour.value.set(state.colour);
|
|
287
|
+
uniforms.strength.value = state.strength;
|
|
288
|
+
uniforms.pitch.value = wanted.pitch;
|
|
289
|
+
uniforms.circle.value = wanted.radius;
|
|
290
|
+
// the shafts are the beam's body when there are cells (the footprint's own cone is then a faint haze); each is dimmer the more there are, since they add up at the satellite
|
|
291
|
+
uniforms.weights.value = 0.7 / Math.sqrt(Math.max(1, wanted.lattice.length / 7));
|
|
292
|
+
uniforms.cone0.value = wanted.lattice.length > 0 ? 0.12 : 0.42;
|
|
293
|
+
stats.cells = wanted.lattice.length;
|
|
294
|
+
stats.cellRadiusKm = wanted.lattice.length > 0 ? wanted.radius * stats.radiusKm : 0;
|
|
295
|
+
},
|
|
296
|
+
dispose() {
|
|
297
|
+
for (const part of [cones, ground]) {
|
|
298
|
+
if (!part)
|
|
299
|
+
continue;
|
|
300
|
+
scene.remove(part);
|
|
301
|
+
part.geometry.dispose();
|
|
302
|
+
}
|
|
303
|
+
coneMaterial.dispose();
|
|
304
|
+
groundMaterial.dispose();
|
|
305
|
+
stats.shown = false;
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
}
|
|
@@ -9,6 +9,7 @@ import { type BorderSets } from "../borders/lines.ts";
|
|
|
9
9
|
import type { BorderData, BorderStats } from "../borders/layer.ts";
|
|
10
10
|
import { type RouteLeg } from "../route.ts";
|
|
11
11
|
import type { GridStats } from "../grid/layer.ts";
|
|
12
|
+
import type { BeamStats } from "../beam/layer.ts";
|
|
12
13
|
import { type CountryNamesStats, type CountryNamesStyle } from "../country-names/host.ts";
|
|
13
14
|
import { type SeaNamesStats } from "../sea-names/host.ts";
|
|
14
15
|
import type { TileStats } from "../realistic/tile-set.ts";
|
|
@@ -179,6 +180,9 @@ type SatelliteStats = {
|
|
|
179
180
|
* `borders` draws the borders on the Earth's land as thin lines that turn with it, as on `<chikyu-earth-realistic>`: `countries`, `regions` (from the page's `borderData.regions`, once the Earth is
|
|
180
181
|
* large enough), or both with a bare attribute; `chikyu-borders-unavailable` is sent when the shapes cannot be loaded.
|
|
181
182
|
*
|
|
183
|
+
* `beam` draws a beam of light from the chosen satellite (the one marked, or the one ridden) down to the ground below it: a soft cone ending in a lit footprint, the circle from which the satellite is above
|
|
184
|
+
* `beam-elevation` degrees (25), with `beam-cells` spot cells inside it (an illustration, never an operator's plan), `beam-cell-size`, `beam-color` and `beam-strength` (the property `beam` and its siblings, and `stats.beam`).
|
|
185
|
+
*
|
|
182
186
|
* `grid` draws the meridians and parallels on the Earth, and `country-names` names its countries, as on `<chikyu-earth-realistic>`: the names keep clear of the bodies', the places' and the
|
|
183
187
|
* cities' names and stay on the Earth's disc; `chikyu-country-names-unavailable` is sent when the outlines cannot be loaded.
|
|
184
188
|
*
|
|
@@ -350,6 +354,39 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
350
354
|
*/
|
|
351
355
|
get cityNamesStyle(): CityNamesStyle;
|
|
352
356
|
set cityNamesStyle(value: CityNamesStyle);
|
|
357
|
+
/**
|
|
358
|
+
* Whether a beam of light is drawn from the chosen satellite down to the ground below it (the attribute `beam`, off unless set). The chosen satellite is the one marked with `selectSatellite` or a press,
|
|
359
|
+
* or the one ridden (Ride along and Ride above, where the camera looks down the beam). The beam is a soft cone, brighter at the satellite and fading towards the ground, ending in a lit ring on the
|
|
360
|
+
* surface: the footprint, the circle from which the satellite stands above `beamElevation` degrees (25), true to its height. Behind the Earth it is cut off by the limb. It is drawn with the draw that
|
|
361
|
+
* moves the satellite, and nothing is drawn at rest. Setting it writes the attribute, or takes it away; `stats.beam` says the footprint's radius in kilometres.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* ```ts no-run
|
|
365
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space/element";
|
|
366
|
+
*
|
|
367
|
+
* const space = document.querySelector<ChikyuSpace>("chikyu-space")!;
|
|
368
|
+
* space.beam = true;
|
|
369
|
+
* space.beamElevation = 30;
|
|
370
|
+
* console.log(space.stats.beam.radiusKm);
|
|
371
|
+
* ```
|
|
372
|
+
*/
|
|
373
|
+
get beam(): boolean;
|
|
374
|
+
set beam(value: boolean);
|
|
375
|
+
/** The least elevation, in degrees, from which the footprint counts the satellite as seen (the attribute `beam-elevation`, 25). Setting it writes the attribute. */
|
|
376
|
+
get beamElevation(): number;
|
|
377
|
+
set beamElevation(value: number);
|
|
378
|
+
/** How many spot cells are drawn inside the footprint, 0 for none (the attribute `beam-cells`, up to 91). They are an illustration of a satellite that serves the ground in cells, not any operator's plan. */
|
|
379
|
+
get beamCells(): number;
|
|
380
|
+
set beamCells(value: number);
|
|
381
|
+
/** A spot cell's radius on the ground in kilometres, at most what fits (the attribute `beam-cell-size`, 0 for the fit). */
|
|
382
|
+
get beamCellSize(): number;
|
|
383
|
+
set beamCellSize(value: number);
|
|
384
|
+
/** The beam's colour, any CSS colour (the attribute `beam-color`, a pale blue). */
|
|
385
|
+
get beamColor(): string;
|
|
386
|
+
set beamColor(value: string);
|
|
387
|
+
/** How strong the beam is, from 0 to 1 (the attribute `beam-strength`, 0.6). */
|
|
388
|
+
get beamStrength(): number;
|
|
389
|
+
set beamStrength(value: number);
|
|
353
390
|
/** Whether the meridians and parallels are drawn on the Earth (the attribute `grid`). Setting it writes the attribute, or takes it away. */
|
|
354
391
|
get grid(): boolean;
|
|
355
392
|
set grid(value: boolean);
|
|
@@ -762,6 +799,8 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
762
799
|
borders: BorderStats;
|
|
763
800
|
/** The grid: whether it was drawn at the last draw, whether every 15 degrees (else 30), its segments then, how many times its lines were made, and whether it could not be made. */
|
|
764
801
|
grid: GridStats;
|
|
802
|
+
/** The beam: whether it was drawn at the last draw, the chosen satellite's height, the footprint's radius in kilometres and its angle at the Earth's centre, the elevation, the cells drawn and a cell's radius, and how many times its geometry was made. */
|
|
803
|
+
beam: BeamStats;
|
|
765
804
|
/** The route between two places: whether one is set, and its geodesic distance, great-circle distance and flight time at 900 km/h. */
|
|
766
805
|
route: {
|
|
767
806
|
on: boolean;
|
|
@@ -15,6 +15,7 @@ import { BORDER_ATTRIBUTES, readBorders } from "../borders/lines.js";
|
|
|
15
15
|
import { GRID_ATTRIBUTES, readGrid } from "../grid/lines.js";
|
|
16
16
|
import { readRoute, routeLeg, routeText } from "../route.js";
|
|
17
17
|
import { applyRoute } from "../route/layer.js";
|
|
18
|
+
import { BEAM_ATTRIBUTES, readBeam } from "../beam/geometry.js";
|
|
18
19
|
import { COUNTRY_NAMES_ATTRIBUTES } from "../country-names/geometry.js";
|
|
19
20
|
import { COUNTRY_NAMES_STYLE, createCountryHost } from "../country-names/host.js";
|
|
20
21
|
import { SEA_NAMES_ATTRIBUTES, readSeaNames } from "../sea-names/geometry.js";
|
|
@@ -131,6 +132,9 @@ const STYLE = `:host{display:block;aspect-ratio:1/1;position:relative;overflow:h
|
|
|
131
132
|
* `borders` draws the borders on the Earth's land as thin lines that turn with it, as on `<chikyu-earth-realistic>`: `countries`, `regions` (from the page's `borderData.regions`, once the Earth is
|
|
132
133
|
* large enough), or both with a bare attribute; `chikyu-borders-unavailable` is sent when the shapes cannot be loaded.
|
|
133
134
|
*
|
|
135
|
+
* `beam` draws a beam of light from the chosen satellite (the one marked, or the one ridden) down to the ground below it: a soft cone ending in a lit footprint, the circle from which the satellite is above
|
|
136
|
+
* `beam-elevation` degrees (25), with `beam-cells` spot cells inside it (an illustration, never an operator's plan), `beam-cell-size`, `beam-color` and `beam-strength` (the property `beam` and its siblings, and `stats.beam`).
|
|
137
|
+
*
|
|
134
138
|
* `grid` draws the meridians and parallels on the Earth, and `country-names` names its countries, as on `<chikyu-earth-realistic>`: the names keep clear of the bodies', the places' and the
|
|
135
139
|
* cities' names and stay on the Earth's disc; `chikyu-country-names-unavailable` is sent when the outlines cannot be loaded.
|
|
136
140
|
*
|
|
@@ -157,7 +161,7 @@ const STYLE = `:host{display:block;aspect-ratio:1/1;position:relative;overflow:h
|
|
|
157
161
|
* ```
|
|
158
162
|
*/
|
|
159
163
|
export class ChikyuSpace extends HTMLElement {
|
|
160
|
-
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, ...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"];
|
|
164
|
+
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"];
|
|
161
165
|
#model = newSpaceModel();
|
|
162
166
|
/** The finer imagery (NASA's tile service), one source while the attributes stay the same. Off unless `tiles-finer="gibs"`. */
|
|
163
167
|
#finerHold = createFinerHolder(() => new Date(this.#model.time), () => this.#gate?.request());
|
|
@@ -283,6 +287,8 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
283
287
|
Object.assign(this.#model.borders, readBorders(this.getAttribute("borders")));
|
|
284
288
|
this.#model.borders.onError = (error) => this.dispatchEvent(new CustomEvent("chikyu-borders-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } }));
|
|
285
289
|
this.#model.grid.on = readGrid(this.getAttribute("grid"));
|
|
290
|
+
this.#applyBeam();
|
|
291
|
+
this.#model.beam.onError = (error) => this.dispatchEvent(new CustomEvent("chikyu-beam-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } }));
|
|
286
292
|
this.#model.grid.onError = (error) => this.dispatchEvent(new CustomEvent("chikyu-grid-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } }));
|
|
287
293
|
this.#countries = createCountryHost({
|
|
288
294
|
root,
|
|
@@ -501,6 +507,10 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
501
507
|
this.#model.grid.on = readGrid(value);
|
|
502
508
|
this.#gate?.request();
|
|
503
509
|
}
|
|
510
|
+
else if (BEAM_ATTRIBUTES.includes(name)) {
|
|
511
|
+
this.#applyBeam();
|
|
512
|
+
this.#gate?.request();
|
|
513
|
+
}
|
|
504
514
|
else if (COUNTRY_NAMES_ATTRIBUTES.includes(name))
|
|
505
515
|
this.#countries?.refresh();
|
|
506
516
|
else if (name === "satellite-tint") {
|
|
@@ -976,6 +986,71 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
976
986
|
this.#citiesStyle = { ...value };
|
|
977
987
|
this.#cities?.setStyle(this.#citiesStyle);
|
|
978
988
|
}
|
|
989
|
+
/** Read the beam's attributes into the model. */
|
|
990
|
+
#applyBeam() {
|
|
991
|
+
const { on, elevation, cells, cellSize, colour, strength } = readBeam((name) => this.getAttribute(name));
|
|
992
|
+
Object.assign(this.#model.beam, { on, elevation, cells, cellSize, colour, strength });
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Whether a beam of light is drawn from the chosen satellite down to the ground below it (the attribute `beam`, off unless set). The chosen satellite is the one marked with `selectSatellite` or a press,
|
|
996
|
+
* or the one ridden (Ride along and Ride above, where the camera looks down the beam). The beam is a soft cone, brighter at the satellite and fading towards the ground, ending in a lit ring on the
|
|
997
|
+
* surface: the footprint, the circle from which the satellite stands above `beamElevation` degrees (25), true to its height. Behind the Earth it is cut off by the limb. It is drawn with the draw that
|
|
998
|
+
* moves the satellite, and nothing is drawn at rest. Setting it writes the attribute, or takes it away; `stats.beam` says the footprint's radius in kilometres.
|
|
999
|
+
*
|
|
1000
|
+
* @example
|
|
1001
|
+
* ```ts no-run
|
|
1002
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space/element";
|
|
1003
|
+
*
|
|
1004
|
+
* const space = document.querySelector<ChikyuSpace>("chikyu-space")!;
|
|
1005
|
+
* space.beam = true;
|
|
1006
|
+
* space.beamElevation = 30;
|
|
1007
|
+
* console.log(space.stats.beam.radiusKm);
|
|
1008
|
+
* ```
|
|
1009
|
+
*/
|
|
1010
|
+
get beam() {
|
|
1011
|
+
return readBeam((name) => this.getAttribute(name)).on;
|
|
1012
|
+
}
|
|
1013
|
+
set beam(value) {
|
|
1014
|
+
if (value)
|
|
1015
|
+
this.setAttribute("beam", "selected");
|
|
1016
|
+
else
|
|
1017
|
+
this.removeAttribute("beam");
|
|
1018
|
+
}
|
|
1019
|
+
/** The least elevation, in degrees, from which the footprint counts the satellite as seen (the attribute `beam-elevation`, 25). Setting it writes the attribute. */
|
|
1020
|
+
get beamElevation() {
|
|
1021
|
+
return readBeam((name) => this.getAttribute(name)).elevation;
|
|
1022
|
+
}
|
|
1023
|
+
set beamElevation(value) {
|
|
1024
|
+
this.setAttribute("beam-elevation", String(value));
|
|
1025
|
+
}
|
|
1026
|
+
/** How many spot cells are drawn inside the footprint, 0 for none (the attribute `beam-cells`, up to 91). They are an illustration of a satellite that serves the ground in cells, not any operator's plan. */
|
|
1027
|
+
get beamCells() {
|
|
1028
|
+
return readBeam((name) => this.getAttribute(name)).cells;
|
|
1029
|
+
}
|
|
1030
|
+
set beamCells(value) {
|
|
1031
|
+
this.setAttribute("beam-cells", String(value));
|
|
1032
|
+
}
|
|
1033
|
+
/** A spot cell's radius on the ground in kilometres, at most what fits (the attribute `beam-cell-size`, 0 for the fit). */
|
|
1034
|
+
get beamCellSize() {
|
|
1035
|
+
return readBeam((name) => this.getAttribute(name)).cellSize;
|
|
1036
|
+
}
|
|
1037
|
+
set beamCellSize(value) {
|
|
1038
|
+
this.setAttribute("beam-cell-size", String(value));
|
|
1039
|
+
}
|
|
1040
|
+
/** The beam's colour, any CSS colour (the attribute `beam-color`, a pale blue). */
|
|
1041
|
+
get beamColor() {
|
|
1042
|
+
return readBeam((name) => this.getAttribute(name)).colour;
|
|
1043
|
+
}
|
|
1044
|
+
set beamColor(value) {
|
|
1045
|
+
this.setAttribute("beam-color", value);
|
|
1046
|
+
}
|
|
1047
|
+
/** How strong the beam is, from 0 to 1 (the attribute `beam-strength`, 0.6). */
|
|
1048
|
+
get beamStrength() {
|
|
1049
|
+
return readBeam((name) => this.getAttribute(name)).strength;
|
|
1050
|
+
}
|
|
1051
|
+
set beamStrength(value) {
|
|
1052
|
+
this.setAttribute("beam-strength", String(value));
|
|
1053
|
+
}
|
|
979
1054
|
/** Whether the meridians and parallels are drawn on the Earth (the attribute `grid`). Setting it writes the attribute, or takes it away. */
|
|
980
1055
|
get grid() {
|
|
981
1056
|
return readGrid(this.getAttribute("grid"));
|
|
@@ -1820,6 +1895,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
1820
1895
|
cityNames: this.#cities?.stats ?? { on: false, max: 0, radius: 0, tiers: [], cities: 0, names: 0, renders: 0 },
|
|
1821
1896
|
borders: { ...this.#model.borders.stats, shown: { ...this.#model.borders.stats.shown }, loaded: [...this.#model.borders.stats.loaded] },
|
|
1822
1897
|
grid: { ...this.#model.grid.stats },
|
|
1898
|
+
beam: { ...this.#model.beam.stats },
|
|
1823
1899
|
route: { ...this.#model.route.stats },
|
|
1824
1900
|
countryNames: this.#countries?.stats ?? { on: false, max: 0, countries: 0, names: 0, renders: 0, failed: false },
|
|
1825
1901
|
seaNames: this.#seas?.stats ?? { on: false, radius: 0, names: 0, renders: 0 },
|
package/dist/space/index.d.ts
CHANGED
|
@@ -5,3 +5,5 @@ export { faceOffset, OUTSIDE_KM, outsidePose, RIDE_FACES, RIDE_FOV, rideFov, rid
|
|
|
5
5
|
export type { SatelliteScreen } from "./satellite-layer.ts";
|
|
6
6
|
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.ts";
|
|
7
7
|
export { genericSatellite, satelliteKind, type SatelliteKind } from "./generic-satellite.ts";
|
|
8
|
+
export { BEAM_ATTRIBUTES, BEAM_COLOUR, BEAM_ELEVATION, beamCells, footprintAngle, footprintKm, readBeam, type BeamCells, type BeamOptions } from "../beam/geometry.ts";
|
|
9
|
+
export type { BeamStats } from "../beam/layer.ts";
|
package/dist/space/index.js
CHANGED
|
@@ -6,3 +6,4 @@ export { fitDistance, plainPainter } from "./scene.js";
|
|
|
6
6
|
export { faceOffset, OUTSIDE_KM, outsidePose, RIDE_FACES, RIDE_FOV, rideFov, ridePose, rideTiltLimits, rideTurnDegrees } from "./ride.js";
|
|
7
7
|
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";
|
|
8
8
|
export { genericSatellite, satelliteKind } from "./generic-satellite.js";
|
|
9
|
+
export { BEAM_ATTRIBUTES, BEAM_COLOUR, BEAM_ELEVATION, beamCells, footprintAngle, footprintKm, readBeam } from "../beam/geometry.js";
|
package/dist/space/scene.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { type BodyLabelState } from "../realistic/body-label.ts";
|
|
|
18
18
|
import { type MeteorState } from "../meteors/layer.ts";
|
|
19
19
|
import { type BorderState } from "../borders/layer.ts";
|
|
20
20
|
import { type GridState } from "../grid/layer.ts";
|
|
21
|
+
import { type BeamState } from "../beam/layer.ts";
|
|
21
22
|
import { type RouteState } from "../route/layer.ts";
|
|
22
23
|
type Three = ThreeParts;
|
|
23
24
|
/** How much of the view's shorter side the Earth's disc fills at zoom 1 when the page does not say: 0.9, so the atmosphere's glow (8% beyond the disc) is inside the view and never cut. */
|
|
@@ -190,6 +191,8 @@ export interface SpaceModel {
|
|
|
190
191
|
borders: BorderState;
|
|
191
192
|
/** The meridians and parallels on the Earth (src/grid/layer.ts): off unless the element switches them on. */
|
|
192
193
|
grid: GridState;
|
|
194
|
+
/** The beam of light from the chosen satellite to the ground below it (src/beam/layer.ts): off unless the element switches it on. */
|
|
195
|
+
beam: BeamState;
|
|
193
196
|
/** A route between two places, on the Earth (src/route/layer.ts): off unless the element sets it. */
|
|
194
197
|
route: RouteState;
|
|
195
198
|
/** The body or satellite the camera rides along with, or null. */
|
package/dist/space/scene.js
CHANGED
|
@@ -17,6 +17,7 @@ import { createBodyLabelLayer, newBodyLabelState } from "../realistic/body-label
|
|
|
17
17
|
import { createMeteorLayer, newMeteorState } from "../meteors/layer.js";
|
|
18
18
|
import { createBorderLayer, newBorderState } from "../borders/layer.js";
|
|
19
19
|
import { createGridLayer, newGridState } from "../grid/layer.js";
|
|
20
|
+
import { createBeamLayer, newBeamState } from "../beam/layer.js";
|
|
20
21
|
import { createRouteLayer, newRouteState } from "../route/layer.js";
|
|
21
22
|
import { subsolarPoint, unitVector } from "../realistic/sun.js";
|
|
22
23
|
/** The most satellites ringed and named at once, over all the labelled groups. */
|
|
@@ -113,6 +114,7 @@ export const newSpaceModel = () => ({
|
|
|
113
114
|
bodyLabel: newBodyLabelState(),
|
|
114
115
|
borders: newBorderState(),
|
|
115
116
|
grid: newGridState(),
|
|
117
|
+
beam: newBeamState(),
|
|
116
118
|
route: newRouteState(),
|
|
117
119
|
pick: null,
|
|
118
120
|
placeSatellite: null,
|
|
@@ -371,6 +373,8 @@ export function createSpaceItem(model, deps) {
|
|
|
371
373
|
let borders = null;
|
|
372
374
|
const placeRings = { sprites: null, tried: false };
|
|
373
375
|
let gridLayer = null;
|
|
376
|
+
let beamLayer = null;
|
|
377
|
+
const beamAt = new Float64Array(6);
|
|
374
378
|
let routeLayer = null;
|
|
375
379
|
let marksTold = false;
|
|
376
380
|
// 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
|
|
@@ -1126,6 +1130,20 @@ export function createSpaceItem(model, deps) {
|
|
|
1126
1130
|
}
|
|
1127
1131
|
}
|
|
1128
1132
|
gridLayer?.sync(Math.min(px.Earth, 1e5));
|
|
1133
|
+
// the beam, from the chosen satellite (the one ridden, else the one marked) to the ground below it: made the first time it is switched on
|
|
1134
|
+
if (model.beam.on && !beamLayer && !model.beam.stats.failed) {
|
|
1135
|
+
try {
|
|
1136
|
+
beamLayer = createBeamLayer(three, scene, model.beam, 7);
|
|
1137
|
+
}
|
|
1138
|
+
catch (error) {
|
|
1139
|
+
model.beam.stats.failed = true;
|
|
1140
|
+
model.beam.onError?.(error);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
if (beamLayer) {
|
|
1144
|
+
const chosen = model.ride && typeof model.ride.target === "object" ? model.ride.target : model.satellites.selected;
|
|
1145
|
+
beamLayer.sync(model.beam.on && chosen && layer?.exact(chosen, model.time, beamAt) ? [beamAt[0], beamAt[1], beamAt[2]] : null);
|
|
1146
|
+
}
|
|
1129
1147
|
if ((model.route.ends || routeLayer) && !routeLayer && !model.route.failed) {
|
|
1130
1148
|
try {
|
|
1131
1149
|
routeLayer = createRouteLayer(three, earth, model.route);
|
|
@@ -1159,6 +1177,7 @@ export function createSpaceItem(model, deps) {
|
|
|
1159
1177
|
borders?.dispose();
|
|
1160
1178
|
placeRings.sprites?.dispose();
|
|
1161
1179
|
gridLayer?.dispose();
|
|
1180
|
+
beamLayer?.dispose();
|
|
1162
1181
|
routeLayer?.dispose();
|
|
1163
1182
|
modelSlot.turn += 1;
|
|
1164
1183
|
dropModel();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/chikyu-earth",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.6",
|
|
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",
|