@johnmorrisdotca/wakusei-planets 0.44.1 → 0.45.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 +12 -0
- package/NOTICE.md +15 -0
- package/README.md +3 -3
- package/dist/door/map.d.ts +1 -1
- package/dist/door/map.js +1 -1
- package/dist/element.d.ts +1 -0
- package/dist/element.js +65 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/interior.d.ts +74 -0
- package/dist/interior.js +92 -0
- package/dist/place-marks.d.ts +1 -1
- package/dist/place-marks.js +11 -1
- package/dist/scene/body.d.ts +4 -0
- package/dist/scene/body.js +35 -0
- package/dist/scene/painter.d.ts +13 -0
- package/dist/scene/painter.js +24 -2
- package/dist/scene/textures.d.ts +2 -2
- package/dist/scene/tiles.d.ts +23 -0
- package/dist/scene/tiles.js +29 -0
- package/dist/space/element.d.ts +4 -0
- package/dist/space/element.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.45.0] - 2026-11-13
|
|
6
|
+
|
|
7
|
+
- **Sharper Moon and Mars maps, switched off until asked** (MODULES-1264). `pnpm tiles:moon` and `pnpm tiles:mars` cut level 4 (32768 pixels across) from the LROC WAC 100 m mosaic and the Viking MDIM 2.1 mosaic at 232 m. The Pages build runs them only when the repository variable `WAKUSEI_SHARP_TILES` is `1`, and does not download those files otherwise. `tilePoint` names the tile pixel of a longitude and latitude.
|
|
8
|
+
|
|
9
|
+
- **A cutaway of the interior** (MODULES-1246). `cutaway` on a body (off unless set) opens a quarter of the globe toward the camera, turning with the body, and draws the layers as flat-coloured shells. The legend names each layer, its depth from the surface and what it is made of. `interiorOf` returns the layers. Only the Earth and Mars have figures, read from NASA pages on 2026-11-13; a body without them stays whole.
|
|
10
|
+
|
|
11
|
+
- **A view at rest waits until its pictures have arrived** (MODULES-1209). `stats.pictures.pending` is how many surface pictures are still being fetched. A sharper picture draws one frame when it arrives, so a test of a still view waits for this to be 0 and then for the draw count to stay still, instead of a longer quiet timer.
|
|
12
|
+
|
|
13
|
+
## [0.44.2] - 2026-11-13
|
|
14
|
+
|
|
15
|
+
- **The best-known names come first** (MODULES-1231). Six names on a phone's Moon were six seas. Each body now has a hand-ranked head ahead of the rule of fame and size (`placeRank`): on the Moon the four great seas, Tycho and Copernicus; on Mars Olympus Mons, Valles Marineris, Hellas, the Tharsis volcanoes (Arsia, Ascraeus, Pavonis) and Gale. The cap and the placement are as in 0.44.1.
|
|
16
|
+
|
|
5
17
|
## [0.44.1] - 2026-11-13
|
|
6
18
|
|
|
7
19
|
- **Few names on a small body** (MODULES-1231). On a phone the Moon at 49 px of radius had five names laid across it, wider than the disc. A name is now written only from 70 px of radius (`MARK_RULES.nameFromPx`), comes in over the next 20 px, at most one to every 20 px of radius, and never wider than the disc.
|
package/NOTICE.md
CHANGED
|
@@ -157,6 +157,13 @@ A tile is the package's own 2048 picture of the body, enlarged, with the source'
|
|
|
157
157
|
| Triton | levels 1 to 2, up to 8192 x 4096 (160 tiles, 1.0 MB) | [Triton map no grid.jpg](https://commons.wikimedia.org/wiki/File:Triton_map_no_grid.jpg), 14138 x 7069, https://upload.wikimedia.org/wikipedia/commons/6/61/Triton_map_no_grid.jpg, SHA-256 `ff533af3163f53cc5560cd983cfe0f06b1c2cd0f3db36518d4c5cc5f5ddfeabb` | Public domain (the file page's licence as Commons' own metadata gave it, read 2026-11-09) | Paul Schenk, Lunar and Planetary Institute (Voyager 2 mosaic), NASA | Colour kept at 45 percent; the north in the polar night is the 2048 picture's |
|
|
158
158
|
| Mimas | levels 1 to 1, up to 4096 x 2048 (32 tiles, 0.4 MB) | [Map of Mimas 2010-02 PIA12780.jpg](https://commons.wikimedia.org/wiki/File:Map_of_Mimas_2010-02_PIA12780.jpg), 5828 x 2947, https://upload.wikimedia.org/wikipedia/commons/5/5a/Map_of_Mimas_2010-02_PIA12780.jpg, SHA-256 `8dd786afff003466f196bdd5c9f4c63a6bffddbd0d384c04fac0706068602943` | Public domain (the file page's licence as Commons' own metadata gave it, read 2026-11-09) | NASA / JPL / Space Science Institute (Cassini, PIA12780) | Cropped to the map as the 2048 picture was |
|
|
159
159
|
|
|
160
|
+
Level 4 (32768 x 16384, 2048 tiles) is a separate cut, not made unless `WAKUSEI_SHARP_TILES=1` (`pnpm tiles:moon`, `pnpm tiles:mars`). The Pages build does not download these two files while that repository variable is off. Each file's SHA-256 is checked by the script before a tile is cut. An empty hash would hash the download and then refuse, so an unchecked file is never cut. Both hashes below were checked against the files on 2026-11-13.
|
|
161
|
+
|
|
162
|
+
| Body | Source, read 2026-11-13 | Terms | What it is |
|
|
163
|
+
|---|---|---|---|
|
|
164
|
+
| The Moon | [Lunar LRO LROC-WAC Mosaic global 100m June 2013](https://astrogeology.usgs.gov/search/map/moon_lro_lroc_wac_global_morphology_mosaic_100m), 109164 x 54582, 5.5 GB, https://planetarymaps.usgs.gov/mosaic/Lunar_LRO_LROC-WAC_Mosaic_global_100m_June2013.tif, SHA-256 `87159ead1888ae31bb647e957ec60943022b707ec804cb5353a304575936fd55` | Public domain. The USGS product page's access constraint is "public domain" (read 2026-11-13). NASA imagery, not subject to copyright. Credit NASA / GSFC / Arizona State University | LROC Wide Angle Camera morphology mosaic, 100 m a pixel, simple cylindrical, planetocentric, longitude -180 to 180 with 0 at the mean-Earth meridian, east to the right, row 0 at latitude 90. A named place (Tycho, Copernicus, Mare Crisium) falls on the pixel `tilePoint` names |
|
|
165
|
+
| Mars | [Mars Viking MDIM21 color mosaic global 232m](https://astrogeology.usgs.gov/search/map/mars_viking_colorized_global_mosaic_232m), 92160 x 46080, 12 GB, https://planetarymaps.usgs.gov/mosaic/Mars_Viking_MDIM21_ClrMosaic_global_232m.tif, SHA-256 `554f1170998b4cd00359defa48600307e52c49f921c282d842361ad45082aa31` | Public domain. The USGS product page's access constraint is "Public domain" and its use constraint is "None" (read 2026-11-13). Credit NASA / JPL / USGS | Viking MDIM 2.1 colour, 232 m a pixel, IAU 2000, planetocentric, east of Airy-0, longitude -180 to 180, row 0 at latitude 90. The file's centre is longitude 0, latitude 0. Olympus Mons, Valles Marineris, Hellas and Gale use the same pixel rule |
|
|
166
|
+
|
|
160
167
|
Not tiled, because no finer public-domain map was found that this package can use: Venus (the 2048 picture is Solar System Scope's, CC BY 4.0), Jupiter, Saturn, Uranus, Neptune and the Sun (the same, or Nestaeric's, CC BY 4.0, or one photograph), Titan and Ceres (the maps in `textures/` are the finest the sources have: 4046 and 4000 pixels), Ganymede (3126 pixels) and Europa (1024). Where a finer USGS mosaic of Ganymede, Europa or Titan exists, it is a separate piece of work (its licence read first).
|
|
161
168
|
|
|
162
169
|
The generic detail of a close zoom (docs/guides/close-zoom.md) is noise made in the shader. It is no data and takes nothing from any source.
|
|
@@ -253,3 +260,11 @@ The rows of `/moon-catalogue` (`src/data/moon-catalogue.ts`, made by `scripts/ma
|
|
|
253
260
|
- **Sizes worked out from the brightness**: D = 10^(3.1236 − 0.5 log10(albedo) − 0.2 V), the formula of NASA/JPL CNEOS's asteroid size estimator (https://cneos.jpl.nasa.gov/tools/ast_size_est.html and its script, read 2026-11-11), with the sheet's albedo where it gives one and 0.04 (the sheet's albedo for Himalia, the largest irregular moon) where it does not. These radii are flagged `derived` and are this package's own estimate, not a measurement.
|
|
254
261
|
- **Groups** are this package's own sorting of the mean orbits by a stated rule (the guide "Every known moon"); the group names are the usual ones, each named after its largest member.
|
|
255
262
|
- **Japanese names** are given only for the 29 moons the package draws in full, whose katakana was checked; the other moons keep their English names and designations.
|
|
263
|
+
|
|
264
|
+
## Interior cutaway
|
|
265
|
+
|
|
266
|
+
The cutaway's figures were read on 2026-11-13. NASA content is not subject to copyright in the United States. Nothing was copied from the pages; the numbers and the materials they name are the pages' facts, and a figure the page gives as "about" stays marked about.
|
|
267
|
+
|
|
268
|
+
- **Earth.** Volumetric mean radius 6371.000 km and core radius 3485 km: NASA Space Science Data Coordinated Archive, Earth Fact Sheet (https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html). Inner core about 1,221 km in radius, of iron and nickel, solid; outer core of iron and nickel, fluid; mantle of rock; crust of rock, about 30 km deep on land (about 5 km under the ocean, which this cutaway does not draw as its own layer): NASA Science, Earth Facts (https://science.nasa.gov/earth/facts/). The mantle's outside in the table is the mean radius minus that 30 km, so it is about, not a figure the page prints.
|
|
269
|
+
- **Mars.** Volumetric mean radius 3389.5 km and core radius 1830 km: NASA Space Science Data Coordinated Archive, Mars Fact Sheet (https://nssdc.gsfc.nasa.gov/planetary/factsheet/marsfact.html). The page does not say what the core or the rest is made of, and it does not split the rest into a crust and a mantle, so the cutaway does not either.
|
|
270
|
+
- **Left out,** because those pages do not state a layer boundary: the Moon, Mercury, Venus, Jupiter, Saturn, Uranus, Neptune, Io, Europa, Ganymede and Titan. The same fact sheets were read for them on 2026-11-13.
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Wakusei Planets runs in the browser of a phone, a tablet or a computer: nothing
|
|
|
19
19
|
|
|
20
20
|
<p align="center"><img alt="The demo on a desk: Saturn in the painted look, turning in the big view, with the page's links to the portrait builder, the colouring sheets, the space view, the star page and the size line-up above it, and the choice of body and its moons below" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/main/docs/images/home-desk.webp" width="620"> <img alt="The same page on a phone: the same links in rows, and Saturn in the painted look below them" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/main/docs/images/home-phone.webp" width="200"></p>
|
|
21
21
|
|
|
22
|
-
<p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
22
|
+
<p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.45.0/docs/images/lineup-desk.png" width="640"></p>
|
|
23
23
|
|
|
24
24
|
## Who it is for
|
|
25
25
|
|
|
@@ -388,7 +388,7 @@ The tiles of every body share one 48 MB budget, six loads at a time for a source
|
|
|
388
388
|
|
|
389
389
|
## The portrait builder
|
|
390
390
|
|
|
391
|
-
<p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
391
|
+
<p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.45.0/docs/images/portrait-family.png" width="640"></p>
|
|
392
392
|
|
|
393
393
|
[The portrait builder](https://johnmorrisdotca.github.io/wakusei-planets/portrait.html) puts any bodies in one picture: drag them, size them, turn them, order them front to back, arrange them in a row, an arc, a grid or at true orbit distance (true or readable sizes, a planet's moons round it in orbit order), light them from one direction, and take the code, a PNG or an SVG. The scene is kept in the address, and every body is drawn in one WebGL scene, so the page holds one WebGL context. [The portrait builder](docs/guides/portrait-builder.md) is its guide.
|
|
394
394
|
|
|
@@ -534,7 +534,7 @@ BODIES.pluto.kind; // "dwarf-planet"
|
|
|
534
534
|
|
|
535
535
|
If this package helps a paper, a talk or a class, please cite it as software. GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA; in plain text:
|
|
536
536
|
|
|
537
|
-
> Morris, J. (2026). *Wakusei Planets* (version 0.
|
|
537
|
+
> Morris, J. (2026). *Wakusei Planets* (version 0.45.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
|
|
538
538
|
|
|
539
539
|
Cite the version you used (`npm ls @johnmorrisdotca/wakusei-planets`), and cite the sources of the numbers you use as well: [NOTICE.md](NOTICE.md) names each one, with the paper or the page it was read from (the IAU working group's report for sizes and poles, VSOP87B, ELP2000-82B, L1.2 and TASS1.7 for positions, and NASA's JPL Horizons for the fits and the spacecraft).
|
|
540
540
|
|
package/dist/door/map.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export type BodyMapSource = TileSource<BodyMapPlace, number, ImageTile> & {
|
|
|
46
46
|
levels?(body: string, signal: AbortSignal): readonly TileLevel[] | undefined | Promise<readonly TileLevel[] | undefined>;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
* The levels a source has when it does not say:
|
|
49
|
+
* The levels a source has when it does not say: levels 1 to 3, which the ordinary cut makes. A manifest can name a finer level, and the view then uses that.
|
|
50
50
|
*
|
|
51
51
|
* @example
|
|
52
52
|
* ```ts
|
package/dist/door/map.js
CHANGED
|
@@ -5,7 +5,7 @@ const TAU = Math.PI * 2;
|
|
|
5
5
|
/** A tile's own edge is not the next tile: places are measured to a billionth of a tile. */
|
|
6
6
|
const EDGE = 1e-9;
|
|
7
7
|
/**
|
|
8
|
-
* The levels a source has when it does not say:
|
|
8
|
+
* The levels a source has when it does not say: levels 1 to 3, which the ordinary cut makes. A manifest can name a finer level, and the view then uses that.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
package/dist/element.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export type WakuseiState = "line" | "loading" | "still" | "live" | "lost" | "una
|
|
|
37
37
|
* `controls="none"` turns them off, and `live="off"` (a still, a thumbnail) starts without them (`controls` with no value brings them back). `zoom-min` and `zoom-max` set the range (0.1 to 50 for the line drawing; for the shaded looks 0.1 up to where the body's detail runs out, 8 at least and 1000 at most: see the close zoom guide); a `<kazoku-view-controls for="...">` takes over and reads it.
|
|
38
38
|
* Close up, `tiles` is where the finer map tiles are (a folder address; `off` for none; by default the demo site's, unless `texture-base` names your own pictures): a window of them is laid over the painted map for the part in view and let go when it is not, and the zoom range of a body with tiles grows with them.
|
|
39
39
|
* Whatever moves the view, `setView` sends a `wakusei-view` event with its `yaw`, `tilt`, `roll`, `zoom`, `panX` and `panY`.
|
|
40
|
+
* `cutaway` (off when absent or `off`) opens a quarter of the globe toward the camera, turning with the body, and lists the interior layers. Only a body with sourced figures is cut; the others stay whole and the legend says so. See the guide "A cutaway of the interior".
|
|
40
41
|
* `places` marks the places on the body in the shaded looks, by layer (`landing`, `crash`, `planned`, `feature`; the lists come from `setPlacesLoader`), with `wakusei-place` on a click and `goToPlace` to turn one to the middle: see the guide "Places on the Moon, Mars and 31 more bodies".
|
|
41
42
|
* `body-label` writes the body's name on its globe in the shaded looks (`painted`, `etched`, `outline` or `burned`; absent for none), with `body-label-strength`, `-repeat`, `-latitude`, `-facing`, `-font`, `-fallback-font` and `-tone` (`auto`, `light` or `dark` letters: auto takes dark ones for a `painted` look on a light body) beside it, and the `bodyLabel` property takes the same as an object: see the guide "A name on the body".
|
|
42
43
|
* A dated picture (a `time`, or `moons`) has a clock: `rate` is the simulated seconds for each real second, and `rate="0"` holds it, drawing nothing. While it runs (`rate` not 0), `wakusei-timechange` carries
|
package/dist/element.js
CHANGED
|
@@ -7,6 +7,7 @@ import { BODIES, MINOR_IDS } from "./facts.js";
|
|
|
7
7
|
import { extentOf, ROOM } from "./scene/extent.js";
|
|
8
8
|
import { createGate, frameCap } from "./gate.js";
|
|
9
9
|
import { lineSvg } from "./line.js";
|
|
10
|
+
import { interiorLegend } from "./interior.js";
|
|
10
11
|
import { starLook } from "./star.js";
|
|
11
12
|
import { starLineSvg } from "./star-line.js";
|
|
12
13
|
import { detailOf, lookOf, starLookOf } from "./scene/look.js";
|
|
@@ -70,8 +71,12 @@ const LINE_LIMITS = { zoomMin: 0.1, zoomMax: 50, tiltMax: 90 };
|
|
|
70
71
|
const TEMPLATE = `<style>
|
|
71
72
|
:host { display: block; width: var(--wakusei-size, 320px); max-width: 100%; aspect-ratio: 1 / 1; position: relative; contain: layout style; }
|
|
72
73
|
#stage { position: absolute; inset: 0; }
|
|
74
|
+
#cutaway { position: absolute; z-index: 2; left: 8px; right: 8px; bottom: 8px; margin: 0; padding: 6px 8px; list-style: none; background: color-mix(in srgb, Canvas 88%, transparent); color: CanvasText; font: 12px/1.35 system-ui, sans-serif; }
|
|
75
|
+
#cutaway[hidden] { display: none; }
|
|
76
|
+
#cutaway li { display: grid; grid-template-columns: 12px 1fr; gap: 2px 8px; align-items: baseline; }
|
|
77
|
+
#cutaway [data-swatch] { width: 12px; height: 12px; }
|
|
73
78
|
#stage svg { display: block; width: 100%; height: 100%; }
|
|
74
|
-
</style><div id="stage"></div>`;
|
|
79
|
+
</style><div id="stage"></div><ol id="cutaway" hidden></ol>`;
|
|
75
80
|
/**
|
|
76
81
|
* The `<wakusei-body>` custom element: a body of the solar system, drawn in a look.
|
|
77
82
|
*
|
|
@@ -83,6 +88,7 @@ const TEMPLATE = `<style>
|
|
|
83
88
|
* `controls="none"` turns them off, and `live="off"` (a still, a thumbnail) starts without them (`controls` with no value brings them back). `zoom-min` and `zoom-max` set the range (0.1 to 50 for the line drawing; for the shaded looks 0.1 up to where the body's detail runs out, 8 at least and 1000 at most: see the close zoom guide); a `<kazoku-view-controls for="...">` takes over and reads it.
|
|
84
89
|
* Close up, `tiles` is where the finer map tiles are (a folder address; `off` for none; by default the demo site's, unless `texture-base` names your own pictures): a window of them is laid over the painted map for the part in view and let go when it is not, and the zoom range of a body with tiles grows with them.
|
|
85
90
|
* Whatever moves the view, `setView` sends a `wakusei-view` event with its `yaw`, `tilt`, `roll`, `zoom`, `panX` and `panY`.
|
|
91
|
+
* `cutaway` (off when absent or `off`) opens a quarter of the globe toward the camera, turning with the body, and lists the interior layers. Only a body with sourced figures is cut; the others stay whole and the legend says so. See the guide "A cutaway of the interior".
|
|
86
92
|
* `places` marks the places on the body in the shaded looks, by layer (`landing`, `crash`, `planned`, `feature`; the lists come from `setPlacesLoader`), with `wakusei-place` on a click and `goToPlace` to turn one to the middle: see the guide "Places on the Moon, Mars and 31 more bodies".
|
|
87
93
|
* `body-label` writes the body's name on its globe in the shaded looks (`painted`, `etched`, `outline` or `burned`; absent for none), with `body-label-strength`, `-repeat`, `-latitude`, `-facing`, `-font`, `-fallback-font` and `-tone` (`auto`, `light` or `dark` letters: auto takes dark ones for a `painted` look on a light body) beside it, and the `bodyLabel` property takes the same as an object: see the guide "A name on the body".
|
|
88
94
|
* A dated picture (a `time`, or `moons`) has a clock: `rate` is the simulated seconds for each real second, and `rate="0"` holds it, drawing nothing. While it runs (`rate` not 0), `wakusei-timechange` carries
|
|
@@ -101,7 +107,7 @@ const TEMPLATE = `<style>
|
|
|
101
107
|
* ```
|
|
102
108
|
*/
|
|
103
109
|
export class WakuseiBody extends HTMLElement {
|
|
104
|
-
static observedAttributes = ["body", "star", "quality", ...STAR_ATTRS, "look", "size", "time", "tilt", "pitch", "phase", "meridian", "turn", "rate", "moons", "range", "scale-to", "span-km", "fit", "live", "texture-base", "texture-far-base", "tiles", "data", "lang", "labels", "places", "surface-names", ...NAME_LABEL_ATTRIBUTES];
|
|
110
|
+
static observedAttributes = ["body", "star", "quality", ...STAR_ATTRS, "look", "size", "time", "tilt", "pitch", "phase", "meridian", "turn", "rate", "moons", "range", "scale-to", "span-km", "fit", "live", "texture-base", "texture-far-base", "tiles", "data", "lang", "labels", "places", "surface-names", "cutaway", ...NAME_LABEL_ATTRIBUTES];
|
|
105
111
|
#stage;
|
|
106
112
|
#state = "line";
|
|
107
113
|
#renderer;
|
|
@@ -840,9 +846,60 @@ export class WakuseiBody extends HTMLElement {
|
|
|
840
846
|
void this.#refresh();
|
|
841
847
|
});
|
|
842
848
|
}
|
|
849
|
+
/** The picture's identity: a new one disposes the view and builds it again, so a cutaway gives its shells back when it is turned off. */
|
|
850
|
+
#signature() {
|
|
851
|
+
return `${this.#star()?.key ?? this.body}|${this.look}|${this.#cutawayOn() ? "cut" : "whole"}`;
|
|
852
|
+
}
|
|
853
|
+
#cutawayOn() {
|
|
854
|
+
const value = this.getAttribute("cutaway");
|
|
855
|
+
return value !== null && value !== "off" && value !== "0";
|
|
856
|
+
}
|
|
857
|
+
/** The legend. It is HTML, so it costs no graphics object, and it lists only the layers `interiorLegend` has. */
|
|
858
|
+
#syncLegend() {
|
|
859
|
+
const list = this.shadowRoot?.querySelector("#cutaway");
|
|
860
|
+
if (!(list instanceof HTMLOListElement))
|
|
861
|
+
return;
|
|
862
|
+
if (!this.#cutawayOn()) {
|
|
863
|
+
list.hidden = true;
|
|
864
|
+
list.replaceChildren();
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
list.hidden = false;
|
|
868
|
+
list.replaceChildren();
|
|
869
|
+
const lang = this.getAttribute("lang") === "ja" ? "ja" : "en";
|
|
870
|
+
const rows = interiorLegend(this.body, lang);
|
|
871
|
+
if (rows === undefined) {
|
|
872
|
+
const item = document.createElement("li");
|
|
873
|
+
item.dataset.empty = "";
|
|
874
|
+
item.textContent = lang === "ja" ? "この天体の内部は、このパッケージには出典つきの数値がありません。" : "This body has no sourced interior in this package.";
|
|
875
|
+
list.append(item);
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
for (const row of rows) {
|
|
879
|
+
const item = document.createElement("li");
|
|
880
|
+
item.dataset.layer = row.id;
|
|
881
|
+
const swatch = document.createElement("span");
|
|
882
|
+
swatch.dataset.swatch = "";
|
|
883
|
+
swatch.style.background = row.colour;
|
|
884
|
+
const text = document.createElement("span");
|
|
885
|
+
const name = document.createElement("b");
|
|
886
|
+
name.dataset.name = "";
|
|
887
|
+
name.textContent = row.name;
|
|
888
|
+
const depth = document.createElement("span");
|
|
889
|
+
depth.dataset.depth = "";
|
|
890
|
+
depth.textContent = row.depth;
|
|
891
|
+
const made = document.createElement("span");
|
|
892
|
+
made.dataset.made = "";
|
|
893
|
+
made.textContent = row.madeOf;
|
|
894
|
+
text.append(name, " ", depth, " ", made);
|
|
895
|
+
item.append(swatch, text);
|
|
896
|
+
list.append(item);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
843
899
|
async #refresh() {
|
|
844
900
|
if (!this.isConnected)
|
|
845
901
|
return;
|
|
902
|
+
this.#syncLegend();
|
|
846
903
|
this.setAttribute("aria-label", this.#label());
|
|
847
904
|
if (this.hasAttribute("size"))
|
|
848
905
|
this.style.setProperty("--wakusei-size", `${num(this.getAttribute("size"), 320)}px`);
|
|
@@ -873,7 +930,7 @@ export class WakuseiBody extends HTMLElement {
|
|
|
873
930
|
this.#resume();
|
|
874
931
|
return;
|
|
875
932
|
}
|
|
876
|
-
const sig =
|
|
933
|
+
const sig = this.#signature();
|
|
877
934
|
if (this.#view !== undefined && this.#viewSig !== sig) {
|
|
878
935
|
if (this.#view.live)
|
|
879
936
|
this.#wantLive = true;
|
|
@@ -970,7 +1027,7 @@ export class WakuseiBody extends HTMLElement {
|
|
|
970
1027
|
const state = this.#sceneOf(frame);
|
|
971
1028
|
this.#sceneState = state;
|
|
972
1029
|
this.#viewKey = this.#key(state);
|
|
973
|
-
this.#viewSig =
|
|
1030
|
+
this.#viewSig = this.#signature();
|
|
974
1031
|
this.#stilled = false;
|
|
975
1032
|
this.#stage.innerHTML = "";
|
|
976
1033
|
const star = this.#star();
|
|
@@ -978,6 +1035,10 @@ export class WakuseiBody extends HTMLElement {
|
|
|
978
1035
|
id: this.body,
|
|
979
1036
|
...(star === undefined ? {} : { shaded: star.look, facts: star.facts, assetKey: `star:${star.key}` }),
|
|
980
1037
|
look: this.look === "illustrated" ? "realistic" : "painted",
|
|
1038
|
+
cutaway: this.#cutawayOn(),
|
|
1039
|
+
onShells: (count) => {
|
|
1040
|
+
this.dataset.shells = String(count);
|
|
1041
|
+
},
|
|
981
1042
|
key: this.#viewKey,
|
|
982
1043
|
state: () => this.#sceneState ?? state,
|
|
983
1044
|
...texturePaths(this),
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { apparent, heliocentric, heliocentricModel, meanSunAu, moonGeocentric, o
|
|
|
3
3
|
export { JOURNEY_STOPS, journeyStop, stopPlaceAu, type JourneyStop } from "./stops.ts";
|
|
4
4
|
export { drawnTilt, portrait, type PortraitOptions } from "./pose.ts";
|
|
5
5
|
export { lineSvg, mix, type LineOptions } from "./line.ts";
|
|
6
|
+
export { interiorLegend, interiorOf } from "./interior.ts";
|
|
6
7
|
export { ringStrip, type RingStrip } from "./scene/rings.ts";
|
|
7
8
|
export { embedCode, embedCredit, EMBED_KINDS, lineupCode, lineupCredit, portraitCode, type EmbedKind, type EmbedOptions, type EmbedSettings, type LineupEmbed, type PortraitEmbed } from "./embed.ts";
|
|
8
9
|
export { mercuryTilesCredit, PICTURE_CREDITS, picturesCredit, type PictureCredit } from "./picture-credits.ts";
|
|
@@ -12,3 +13,4 @@ export { starLineSvg } from "./star-line.ts";
|
|
|
12
13
|
export { LINEUP_SETS, LINEUP_STARS, lineupBodies, type LineupBody, type LineupSet, type RadiusBasis, type RadiusRow } from "./lineup/data.ts";
|
|
13
14
|
export { LINEUP_LAYOUTS, lineupFocus, lineupProject, lineupView, lineupZoomFor, lineupZoomOf, placeLineup, type LineupDot, type LineupLayout, type LineupPlace, type LineupView } from "./lineup/layout.ts";
|
|
14
15
|
export { lineupKm, lineupLabels, lineupLabelsSvg, lineupText, type LineupLabel, type LineupLang, type LineupText } from "./lineup/labels.ts";
|
|
16
|
+
export { tilePoint } from "./scene/tiles.ts";
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { apparent, heliocentric, heliocentricModel, meanSunAu, moonGeocentric, o
|
|
|
3
3
|
export { JOURNEY_STOPS, journeyStop, stopPlaceAu } from "./stops.js";
|
|
4
4
|
export { drawnTilt, portrait } from "./pose.js";
|
|
5
5
|
export { lineSvg, mix } from "./line.js";
|
|
6
|
+
export { interiorLegend, interiorOf } from "./interior.js";
|
|
6
7
|
export { ringStrip } from "./scene/rings.js";
|
|
7
8
|
export { embedCode, embedCredit, EMBED_KINDS, lineupCode, lineupCredit, portraitCode } from "./embed.js";
|
|
8
9
|
export { mercuryTilesCredit, PICTURE_CREDITS, picturesCredit } from "./picture-credits.js";
|
|
@@ -12,3 +13,4 @@ export { starLineSvg } from "./star-line.js";
|
|
|
12
13
|
export { LINEUP_SETS, LINEUP_STARS, lineupBodies } from "./lineup/data.js";
|
|
13
14
|
export { LINEUP_LAYOUTS, lineupFocus, lineupProject, lineupView, lineupZoomFor, lineupZoomOf, placeLineup } from "./lineup/layout.js";
|
|
14
15
|
export { lineupKm, lineupLabels, lineupLabelsSvg, lineupText } from "./lineup/labels.js";
|
|
16
|
+
export { tilePoint } from "./scene/tiles.js";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { BodyId } from "./facts.ts";
|
|
2
|
+
/** One layer, from the centre outward. `outerKm` is the radius of its outside. */
|
|
3
|
+
export interface InteriorLayer {
|
|
4
|
+
id: string;
|
|
5
|
+
name: {
|
|
6
|
+
en: string;
|
|
7
|
+
ja: string;
|
|
8
|
+
};
|
|
9
|
+
/** What the source says the layer is made of. */
|
|
10
|
+
madeOf: {
|
|
11
|
+
en: string;
|
|
12
|
+
ja: string;
|
|
13
|
+
};
|
|
14
|
+
/** Radius of the outside of the layer, in kilometres. */
|
|
15
|
+
outerKm: number;
|
|
16
|
+
/** The outside radius is the source's "about", not a figure it states exactly. */
|
|
17
|
+
about: boolean;
|
|
18
|
+
/** A flat colour from the cutaway's palette, `#rrggbb`. */
|
|
19
|
+
colour: string;
|
|
20
|
+
}
|
|
21
|
+
/** The layers of one body, innermost first. `radiusKm` is the volumetric mean radius the depths are measured from. */
|
|
22
|
+
export interface Interior {
|
|
23
|
+
body: BodyId;
|
|
24
|
+
radiusKm: number;
|
|
25
|
+
/** True when `radiusKm` is the source's "about". */
|
|
26
|
+
radiusAbout: boolean;
|
|
27
|
+
layers: readonly InteriorLayer[];
|
|
28
|
+
/** Where the figures were read, and on which date. */
|
|
29
|
+
source: {
|
|
30
|
+
page: string;
|
|
31
|
+
read: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** One row of the legend: the layer's name, its depth from the surface, and what it is made of. */
|
|
35
|
+
export interface InteriorRow {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
depth: string;
|
|
39
|
+
madeOf: string;
|
|
40
|
+
colour: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The interior of a body, or `undefined` when this package has no sourced figures for it. The layers run from the centre outward.
|
|
44
|
+
* The Earth and Mars are the bodies with figures; the Moon, Mercury, Venus, the giant planets, and Io, Europa, Ganymede and Titan are left out.
|
|
45
|
+
*
|
|
46
|
+
* @param bodyId - A body's id, such as `"earth"`.
|
|
47
|
+
* @returns The layers, or `undefined`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { interiorOf } from "@johnmorrisdotca/wakusei-planets";
|
|
52
|
+
*
|
|
53
|
+
* const earth = interiorOf("earth");
|
|
54
|
+
* console.log(earth?.layers.map((layer) => layer.outerKm).join(","));
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function interiorOf(bodyId: string): Interior | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* The legend's rows for a body, outermost layer first, or `undefined` when `interiorOf` has nothing for it.
|
|
60
|
+
* A depth is kilometres from the surface down to the layer's outside and then to its inside.
|
|
61
|
+
*
|
|
62
|
+
* @param bodyId - A body's id.
|
|
63
|
+
* @param lang - `en` or `ja`.
|
|
64
|
+
* @returns The rows, or `undefined`.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import { interiorLegend } from "@johnmorrisdotca/wakusei-planets";
|
|
69
|
+
*
|
|
70
|
+
* const rows = interiorLegend("earth", "en");
|
|
71
|
+
* console.log(rows?.[0]?.name);
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare function interiorLegend(bodyId: string, lang: "en" | "ja"): InteriorRow[] | undefined;
|
package/dist/interior.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const EARTH = {
|
|
2
|
+
body: "earth",
|
|
3
|
+
// NASA Earth fact sheet, volumetric mean radius. The inner-core radius and the land crust's thickness are the science.nasa.gov Earth's "about".
|
|
4
|
+
radiusKm: 6371,
|
|
5
|
+
radiusAbout: false,
|
|
6
|
+
source: { page: "https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html", read: "2026-11-13" },
|
|
7
|
+
layers: [
|
|
8
|
+
{ id: "inner-core", name: { en: "Inner core", ja: "内核" }, madeOf: { en: "iron and nickel, solid", ja: "鉄とニッケル、固体" }, outerKm: 1221, about: true, colour: "#e6c36a" },
|
|
9
|
+
{ id: "outer-core", name: { en: "Outer core", ja: "外核" }, madeOf: { en: "iron and nickel, fluid", ja: "鉄とニッケル、流体" }, outerKm: 3485, about: false, colour: "#d4652f" },
|
|
10
|
+
{ id: "mantle", name: { en: "Mantle", ja: "マントル" }, madeOf: { en: "rock", ja: "岩石" }, outerKm: 6341, about: true, colour: "#8a3e2a" },
|
|
11
|
+
{ id: "crust", name: { en: "Crust", ja: "地殻" }, madeOf: { en: "rock", ja: "岩石" }, outerKm: 6371, about: false, colour: "#c9a36b" },
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
const MARS = {
|
|
15
|
+
body: "mars",
|
|
16
|
+
// NASA Mars fact sheet: volumetric mean radius and core radius. The page does not say what either layer is made of, and it does not split the outside of the core.
|
|
17
|
+
radiusKm: 3389.5,
|
|
18
|
+
radiusAbout: false,
|
|
19
|
+
source: { page: "https://nssdc.gsfc.nasa.gov/planetary/factsheet/marsfact.html", read: "2026-11-13" },
|
|
20
|
+
layers: [
|
|
21
|
+
{ id: "core", name: { en: "Core", ja: "核" }, madeOf: { en: "not stated", ja: "述べられていない" }, outerKm: 1830, about: false, colour: "#d4652f" },
|
|
22
|
+
{ id: "outside-core", name: { en: "Outside the core", ja: "核の外側" }, madeOf: { en: "not stated", ja: "述べられていない" }, outerKm: 3389.5, about: false, colour: "#a85a3c" },
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
const INTERIORS = { earth: EARTH, mars: MARS };
|
|
26
|
+
/**
|
|
27
|
+
* The interior of a body, or `undefined` when this package has no sourced figures for it. The layers run from the centre outward.
|
|
28
|
+
* The Earth and Mars are the bodies with figures; the Moon, Mercury, Venus, the giant planets, and Io, Europa, Ganymede and Titan are left out.
|
|
29
|
+
*
|
|
30
|
+
* @param bodyId - A body's id, such as `"earth"`.
|
|
31
|
+
* @returns The layers, or `undefined`.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { interiorOf } from "@johnmorrisdotca/wakusei-planets";
|
|
36
|
+
*
|
|
37
|
+
* const earth = interiorOf("earth");
|
|
38
|
+
* console.log(earth?.layers.map((layer) => layer.outerKm).join(","));
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function interiorOf(bodyId) {
|
|
42
|
+
return INTERIORS[bodyId];
|
|
43
|
+
}
|
|
44
|
+
const km = (n) => (Number.isInteger(n) ? String(n) : String(Math.round(n * 10) / 10));
|
|
45
|
+
/** A depth, with "about" when the figure it comes from is the source's "about". */
|
|
46
|
+
function depthEnd(n, about, lang) {
|
|
47
|
+
const text = `${km(n)} km`;
|
|
48
|
+
if (!about)
|
|
49
|
+
return text;
|
|
50
|
+
return lang === "ja" ? `約 ${text}` : `about ${text}`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The legend's rows for a body, outermost layer first, or `undefined` when `interiorOf` has nothing for it.
|
|
54
|
+
* A depth is kilometres from the surface down to the layer's outside and then to its inside.
|
|
55
|
+
*
|
|
56
|
+
* @param bodyId - A body's id.
|
|
57
|
+
* @param lang - `en` or `ja`.
|
|
58
|
+
* @returns The rows, or `undefined`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { interiorLegend } from "@johnmorrisdotca/wakusei-planets";
|
|
63
|
+
*
|
|
64
|
+
* const rows = interiorLegend("earth", "en");
|
|
65
|
+
* console.log(rows?.[0]?.name);
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export function interiorLegend(bodyId, lang) {
|
|
69
|
+
const interior = interiorOf(bodyId);
|
|
70
|
+
if (interior === undefined)
|
|
71
|
+
return undefined;
|
|
72
|
+
const { radiusKm, layers } = interior;
|
|
73
|
+
const rows = [];
|
|
74
|
+
for (let i = layers.length - 1; i >= 0; i -= 1) {
|
|
75
|
+
const layer = layers[i];
|
|
76
|
+
const innerKm = i === 0 ? 0 : layers[i - 1].outerKm;
|
|
77
|
+
const shallow = radiusKm - layer.outerKm;
|
|
78
|
+
const deep = radiusKm - innerKm;
|
|
79
|
+
const shallowAbout = layer.about;
|
|
80
|
+
const deepAbout = i === 0 ? false : layers[i - 1].about;
|
|
81
|
+
const from = depthEnd(shallow, shallowAbout, lang);
|
|
82
|
+
const to = depthEnd(deep, deepAbout, lang);
|
|
83
|
+
rows.push({
|
|
84
|
+
id: layer.id,
|
|
85
|
+
name: layer.name[lang],
|
|
86
|
+
depth: lang === "ja" ? `${from} から ${to}` : `${from} to ${to}`,
|
|
87
|
+
madeOf: layer.madeOf[lang],
|
|
88
|
+
colour: layer.colour,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return rows;
|
|
92
|
+
}
|
package/dist/place-marks.d.ts
CHANGED
|
@@ -196,7 +196,7 @@ export interface Obstacle {
|
|
|
196
196
|
id?: string;
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
|
-
* How important a place is for a name on the surface. Lower is more important.
|
|
199
|
+
* How important a place is for a name on the surface. Lower is more important. A body's hand-ranked head comes first (on the Moon the four great seas, Tycho and Copernicus; on Mars Olympus Mons, Valles Marineris, Hellas, the Tharsis volcanoes and Gale). Then fame: a famous place ranks ahead of every place that is not. Within each group a larger feature ranks ahead of a smaller one (its diameter in kilometres is taken off the rank). A place with no size ranks last in its group.
|
|
200
200
|
*
|
|
201
201
|
* @param place - One place.
|
|
202
202
|
* @returns The rank.
|
package/dist/place-marks.js
CHANGED
|
@@ -197,7 +197,7 @@ export function placeMarks(places, layers, view, radiusKm, options) {
|
|
|
197
197
|
const nameBox = (text) => ({ halfWidth: Math.ceil(text.length * 3.7) + 5, halfHeight: 9 });
|
|
198
198
|
const touches = (a, b) => Math.abs(a.x - b.x) < a.halfWidth + b.halfWidth && Math.abs(a.y - b.y) < a.halfHeight + b.halfHeight;
|
|
199
199
|
/**
|
|
200
|
-
* How important a place is for a name on the surface. Lower is more important.
|
|
200
|
+
* How important a place is for a name on the surface. Lower is more important. A body's hand-ranked head comes first (on the Moon the four great seas, Tycho and Copernicus; on Mars Olympus Mons, Valles Marineris, Hellas, the Tharsis volcanoes and Gale). Then fame: a famous place ranks ahead of every place that is not. Within each group a larger feature ranks ahead of a smaller one (its diameter in kilometres is taken off the rank). A place with no size ranks last in its group.
|
|
201
201
|
*
|
|
202
202
|
* @param place - One place.
|
|
203
203
|
* @returns The rank.
|
|
@@ -213,9 +213,19 @@ const touches = (a, b) => Math.abs(a.x - b.x) < a.halfWidth + b.halfWidth && Mat
|
|
|
213
213
|
* ```
|
|
214
214
|
*/
|
|
215
215
|
export function placeRank(place) {
|
|
216
|
+
// a hand-ranked head for a body: the places every reader knows come first, in this order (the largest seas with the two best-known craters on the Moon; the great volcanoes and canyon on Mars)
|
|
217
|
+
const head = NAME_HEAD[place.id.slice(0, place.id.indexOf("/"))];
|
|
218
|
+
const at = head === undefined ? -1 : head.indexOf(place.id);
|
|
219
|
+
if (at >= 0)
|
|
220
|
+
return -2_000_000 + at;
|
|
216
221
|
const size = Math.min(1_000_000, place.feature?.diameterKm ?? 0);
|
|
217
222
|
return (place.famous === true ? 0 : 1_000_000) - size;
|
|
218
223
|
}
|
|
224
|
+
/** The first names of a body, in order, ahead of the rule of fame and size: what a reader would name first. */
|
|
225
|
+
const NAME_HEAD = {
|
|
226
|
+
moon: ["moon/mare-imbrium", "moon/mare-tranquillitatis", "moon/oceanus-procellarum", "moon/mare-serenitatis", "moon/tycho", "moon/copernicus"],
|
|
227
|
+
mars: ["mars/olympus-mons", "mars/valles-marineris", "mars/hellas-planitia", "mars/arsia-mons", "mars/ascraeus-mons", "mars/pavonis-mons", "mars/gale"],
|
|
228
|
+
};
|
|
219
229
|
/**
|
|
220
230
|
* Read the `surface-names` attribute. Omitted, empty or `on` is on, with the view's own cap. `off` or `0` is off. A positive whole number is on and is the most names to show.
|
|
221
231
|
*
|
package/dist/scene/body.d.ts
CHANGED
|
@@ -90,6 +90,10 @@ export interface BodyItemOptions {
|
|
|
90
90
|
allowed(): boolean;
|
|
91
91
|
onLevels?(levels: readonly TileLevel[] | undefined): void;
|
|
92
92
|
};
|
|
93
|
+
/** Draw the interior cutaway instead of the whole globe. Off when left out. A body with no sourced interior is drawn whole. */
|
|
94
|
+
cutaway?: boolean;
|
|
95
|
+
/** How many interior shells this scene built. `0` when the cutaway is off or the body has no sourced interior. */
|
|
96
|
+
onShells?(count: number): void;
|
|
93
97
|
}
|
|
94
98
|
/** The shader material of a body: its surface code with the look's lighting and glow uniforms. A star made from numbers is drawn with it too (the size line-up). */
|
|
95
99
|
export declare function makeBodyMaterial(T: ThreeParts, look: BodyLook, painted: boolean): THREE.ShaderMaterial;
|
package/dist/scene/body.js
CHANGED
|
@@ -6,6 +6,7 @@ import { detailOf, lookOf } from "./look.js";
|
|
|
6
6
|
import { createDetail } from "./detail.js";
|
|
7
7
|
import { fallbackLook } from "./fallback.js";
|
|
8
8
|
import { writeBasis } from "./basis.js";
|
|
9
|
+
import { interiorOf } from "../interior.js";
|
|
9
10
|
import { loadImage } from "./textures.js";
|
|
10
11
|
import { ringStrip } from "./rings.js";
|
|
11
12
|
import { createNameLabel } from "./name-label.js";
|
|
@@ -80,6 +81,34 @@ export function createBodyItem(options) {
|
|
|
80
81
|
const mesh = new T.Mesh(geometry, shader);
|
|
81
82
|
mesh.frustumCulled = false;
|
|
82
83
|
scene.add(mesh);
|
|
84
|
+
// the cutaway: a quarter of the globe left open toward the camera. Its own group, not a child of the hidden globe, so the shells are drawn. The same basis as the globe, so the opening turns with the body.
|
|
85
|
+
const shells = [];
|
|
86
|
+
let cut;
|
|
87
|
+
if (options.cutaway === true) {
|
|
88
|
+
const interior = interiorOf(options.id);
|
|
89
|
+
if (interior !== undefined) {
|
|
90
|
+
mesh.visible = false;
|
|
91
|
+
cut = new T.Group();
|
|
92
|
+
scene.add(cut);
|
|
93
|
+
for (const layer of interior.layers) {
|
|
94
|
+
const radius = layer.outerKm / interior.radiusKm;
|
|
95
|
+
const shellGeometry = new T.SphereGeometry(radius, 48, 24, Math.PI / 4, Math.PI * 1.5);
|
|
96
|
+
const channel = (start) => Number.parseInt(layer.colour.slice(start, start + 2), 16) / 255;
|
|
97
|
+
const material = new T.ShaderMaterial({
|
|
98
|
+
side: T.DoubleSide,
|
|
99
|
+
depthWrite: true,
|
|
100
|
+
uniforms: { uColour: { value: new T.Vector3(channel(1), channel(3), channel(5)) } },
|
|
101
|
+
vertexShader: "void main(){ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }",
|
|
102
|
+
fragmentShader: "uniform vec3 uColour; void main(){ gl_FragColor = vec4(uColour, 1.0); }",
|
|
103
|
+
});
|
|
104
|
+
const shell = new T.Mesh(shellGeometry, material);
|
|
105
|
+
shell.frustumCulled = false;
|
|
106
|
+
cut.add(shell);
|
|
107
|
+
shells.push({ geometry: shellGeometry, material });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
options.onShells?.(shells.length);
|
|
83
112
|
// rings: a picture of them when the look has one (painted), else the table's strip
|
|
84
113
|
const table = ringStrip(facts, 1024);
|
|
85
114
|
const photo = wantPainted && table !== null ? look.painted?.rings : undefined;
|
|
@@ -247,6 +276,8 @@ export function createBodyItem(options) {
|
|
|
247
276
|
const scaleY = ax ? ax[2] / mean : 1 - facts.flattening;
|
|
248
277
|
const scaleZ = ax ? ax[0] / mean : 1;
|
|
249
278
|
setBasis(mesh, east, pole, meridian, scaleX, scaleY, scaleZ);
|
|
279
|
+
if (cut !== undefined)
|
|
280
|
+
setBasis(cut, east, pole, meridian, scaleX, scaleY, scaleZ);
|
|
250
281
|
if (ringHalves !== undefined) {
|
|
251
282
|
const [near, far] = ringHalves;
|
|
252
283
|
// The camera sits on +Z. The ring's near direction is +Z laid onto the ring plane, and that half is drawn over the disc.
|
|
@@ -477,6 +508,10 @@ export function createBodyItem(options) {
|
|
|
477
508
|
for (const o of orbitLines.values())
|
|
478
509
|
o.line.geometry.dispose();
|
|
479
510
|
orbitMaterial.dispose();
|
|
511
|
+
for (const shell of shells) {
|
|
512
|
+
shell.geometry.dispose();
|
|
513
|
+
shell.material.dispose();
|
|
514
|
+
}
|
|
480
515
|
scene.clear();
|
|
481
516
|
},
|
|
482
517
|
};
|
package/dist/scene/painter.d.ts
CHANGED
|
@@ -6,6 +6,19 @@ import { type DetailStats } from "./detail.ts";
|
|
|
6
6
|
import { type TileLevel } from "./tiles.ts";
|
|
7
7
|
import { moonOffset, orientation } from "./orient.ts";
|
|
8
8
|
import { type NameLabelOptions } from "./name-label.ts";
|
|
9
|
+
/**
|
|
10
|
+
* How many surface pictures are still being fetched. A view draws once more when one arrives, so a rest test waits for this to be 0.
|
|
11
|
+
*
|
|
12
|
+
* @returns The number of picture fetches that have not finished.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { picturesPending } from "@johnmorrisdotca/wakusei-planets/painter";
|
|
17
|
+
*
|
|
18
|
+
* console.log(picturesPending());
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function picturesPending(): number;
|
|
9
22
|
export { moonOffset, orientation };
|
|
10
23
|
export { nameLabelLook, nameLabelText, nameTone, readNameLabel, setBodyLabelFontUrl, type NameLabelOptions, type NameLabelTone } from "./name-label.ts";
|
|
11
24
|
export { mercuryTilesCredit, PICTURE_CREDITS, picturesCredit, type PictureCredit } from "../picture-credits.ts";
|
package/dist/scene/painter.js
CHANGED
|
@@ -14,6 +14,28 @@ import { seenRegion } from "./tiles.js";
|
|
|
14
14
|
import { moonOffset, orientation } from "./orient.js";
|
|
15
15
|
import { ringStrip } from "./rings.js";
|
|
16
16
|
import { createNameLabel, nameLabelText } from "./name-label.js";
|
|
17
|
+
let pictureLoads = 0;
|
|
18
|
+
/**
|
|
19
|
+
* How many surface pictures are still being fetched. A view draws once more when one arrives, so a rest test waits for this to be 0.
|
|
20
|
+
*
|
|
21
|
+
* @returns The number of picture fetches that have not finished.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { picturesPending } from "@johnmorrisdotca/wakusei-planets/painter";
|
|
26
|
+
*
|
|
27
|
+
* console.log(picturesPending());
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function picturesPending() {
|
|
31
|
+
return pictureLoads;
|
|
32
|
+
}
|
|
33
|
+
function trackPicture(load) {
|
|
34
|
+
pictureLoads += 1;
|
|
35
|
+
return load.finally(() => {
|
|
36
|
+
pictureLoads -= 1;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
17
39
|
export { moonOffset, orientation };
|
|
18
40
|
export { nameLabelLook, nameLabelText, nameTone, readNameLabel, setBodyLabelFontUrl } from "./name-label.js";
|
|
19
41
|
export { mercuryTilesCredit, PICTURE_CREDITS, picturesCredit } from "../picture-credits.js";
|
|
@@ -262,7 +284,7 @@ function paint(T, id, context, bases, hold) {
|
|
|
262
284
|
redraw();
|
|
263
285
|
};
|
|
264
286
|
if (wantPainted && paintedMaterial !== undefined && widths[0] !== undefined) {
|
|
265
|
-
void loadImage(T, urlOf(widths[0])).then((t) => {
|
|
287
|
+
void trackPicture(loadImage(T, urlOf(widths[0]))).then((t) => {
|
|
266
288
|
if (gone) {
|
|
267
289
|
t.dispose();
|
|
268
290
|
return;
|
|
@@ -282,7 +304,7 @@ function paint(T, id, context, bases, hold) {
|
|
|
282
304
|
if (next > sharpWidth && next > widths[0] && !tried.has(next)) {
|
|
283
305
|
tried.add(next);
|
|
284
306
|
loading = true;
|
|
285
|
-
void loadImage(T, urlOf(next)).then((t) => {
|
|
307
|
+
void trackPicture(loadImage(T, urlOf(next))).then((t) => {
|
|
286
308
|
loading = false;
|
|
287
309
|
if (gone) {
|
|
288
310
|
t.dispose();
|
package/dist/scene/textures.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { type BodyMapSource } from "../door/map.ts";
|
|
|
11
11
|
* console.log(TEXTURE_BASE);
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.
|
|
14
|
+
export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.45.0/dist/textures/";
|
|
15
15
|
/**
|
|
16
16
|
* Where the sharpest surface pictures are: the files of this exact version in the repository, on jsDelivr's GitHub address. The npm package holds only the two smaller widths, so a page that
|
|
17
17
|
* never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
|
|
@@ -23,7 +23,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
|
|
|
23
23
|
* console.log(TEXTURE_FAR_BASE);
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.
|
|
26
|
+
export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.45.0/textures/";
|
|
27
27
|
/**
|
|
28
28
|
* Where the finer map tiles are by default: the demo site's `tiles/` folder (GitHub Pages sends `access-control-allow-origin: *`). The tiles are made by `scripts/make-body-tiles.py` and are in no package and no repository:
|
|
29
29
|
* a page that serves its own gives the folder in the `tiles` attribute, and `tiles="off"` turns them off. A page that sets `texture-base` (it serves its own pictures) has none unless it says where they are.
|
package/dist/scene/tiles.d.ts
CHANGED
|
@@ -102,6 +102,29 @@ export declare const tilePath: (body: string, tile: {
|
|
|
102
102
|
col: number;
|
|
103
103
|
row: number;
|
|
104
104
|
}) => string;
|
|
105
|
+
/**
|
|
106
|
+
* Where a place on the surface falls in the tile pyramid. Longitude is degrees east of the prime meridian, from -180 to 180, and latitude is planetocentric, north positive.
|
|
107
|
+
* Column 0 is longitude -180 and row 0 is latitude 90, the same layout as the maps. For the Moon the prime meridian is the mean-Earth point. For Mars it is Airy-0.
|
|
108
|
+
*
|
|
109
|
+
* @param lon - East longitude in degrees.
|
|
110
|
+
* @param lat - Planetocentric latitude in degrees.
|
|
111
|
+
* @param level - The pyramid level. Level L is `2048 * 2^L` pixels across.
|
|
112
|
+
* @returns The tile's column and row, and the pixel inside that tile.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* import { tilePoint } from "@johnmorrisdotca/wakusei-planets";
|
|
117
|
+
*
|
|
118
|
+
* const tycho = tilePoint(-11.2153, -43.2958, 3);
|
|
119
|
+
* console.log(tycho.column, tycho.row);
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare function tilePoint(lon: number, lat: number, level: number): {
|
|
123
|
+
column: number;
|
|
124
|
+
row: number;
|
|
125
|
+
x: number;
|
|
126
|
+
y: number;
|
|
127
|
+
};
|
|
105
128
|
/** True when the region lies inside the window (the window is then still the right one for the view, whatever else changed). */
|
|
106
129
|
export declare function covers(window: TileWindow, region: Region): boolean;
|
|
107
130
|
/** The angle one texel of a level covers, in radians along the equator (`2 pi / width`). */
|
package/dist/scene/tiles.js
CHANGED
|
@@ -223,6 +223,35 @@ export function windowTiles(window) {
|
|
|
223
223
|
}
|
|
224
224
|
/** `layer/level/column/row` as the tile's path under the tile set (without the `.webp`). */
|
|
225
225
|
export const tilePath = (body, tile) => `${body}/${tile.level}/${tile.col}/${tile.row}`;
|
|
226
|
+
/**
|
|
227
|
+
* Where a place on the surface falls in the tile pyramid. Longitude is degrees east of the prime meridian, from -180 to 180, and latitude is planetocentric, north positive.
|
|
228
|
+
* Column 0 is longitude -180 and row 0 is latitude 90, the same layout as the maps. For the Moon the prime meridian is the mean-Earth point. For Mars it is Airy-0.
|
|
229
|
+
*
|
|
230
|
+
* @param lon - East longitude in degrees.
|
|
231
|
+
* @param lat - Planetocentric latitude in degrees.
|
|
232
|
+
* @param level - The pyramid level. Level L is `2048 * 2^L` pixels across.
|
|
233
|
+
* @returns The tile's column and row, and the pixel inside that tile.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* import { tilePoint } from "@johnmorrisdotca/wakusei-planets";
|
|
238
|
+
*
|
|
239
|
+
* const tycho = tilePoint(-11.2153, -43.2958, 3);
|
|
240
|
+
* console.log(tycho.column, tycho.row);
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
export function tilePoint(lon, lat, level) {
|
|
244
|
+
const width = BASE_WIDTH * 2 ** level;
|
|
245
|
+
const height = width / 2;
|
|
246
|
+
const columns = width / TILE_SIZE;
|
|
247
|
+
const rows = height / TILE_SIZE;
|
|
248
|
+
const u = ((lon + 180) / 360) * width;
|
|
249
|
+
const v = ((90 - lat) / 180) * height;
|
|
250
|
+
const column = Math.floor(u / TILE_SIZE);
|
|
251
|
+
const row = Math.min(rows - 1, Math.max(0, Math.floor(v / TILE_SIZE)));
|
|
252
|
+
const wrapped = ((column % columns) + columns) % columns;
|
|
253
|
+
return { column: wrapped, row, x: u - column * TILE_SIZE, y: v - row * TILE_SIZE };
|
|
254
|
+
}
|
|
226
255
|
/** True when the region lies inside the window (the window is then still the right one for the view, whatever else changed). */
|
|
227
256
|
export function covers(window, region) {
|
|
228
257
|
const need = region.lonMax - region.lonMin;
|
package/dist/space/element.d.ts
CHANGED
|
@@ -666,6 +666,10 @@ export declare class WakuseiSpace extends HTMLElement {
|
|
|
666
666
|
lines: number;
|
|
667
667
|
track: number;
|
|
668
668
|
};
|
|
669
|
+
/** Surface pictures still being fetched. A rest test waits for 0, then for the draw count to stay still: a sharper picture draws one more frame when it arrives. */
|
|
670
|
+
pictures: {
|
|
671
|
+
pending: number;
|
|
672
|
+
};
|
|
669
673
|
/** The body the last arrival kept in the picture beside the one gone to, or null. */
|
|
670
674
|
companion: string | null;
|
|
671
675
|
};
|
package/dist/space/element.js
CHANGED
|
@@ -8,7 +8,7 @@ import { bodyKindOf, findBody, hopFrom, hostOf, HOP_ORDER, systemOf } from "./bo
|
|
|
8
8
|
import { sightChanged, sightOf } from "./sight.js";
|
|
9
9
|
import { chooseLabels, nameSpot } from "./labels.js";
|
|
10
10
|
import { coverArrows } from "./covered.js";
|
|
11
|
-
import { createPainter } from "../scene/painter.js";
|
|
11
|
+
import { createPainter, picturesPending } from "../scene/painter.js";
|
|
12
12
|
import { NAME_LABEL_ATTRIBUTES, readNameLabel } from "../scene/name-label.js";
|
|
13
13
|
import { createDoorHost } from "../door/host.js";
|
|
14
14
|
import { ownCredit } from "../door/own.js";
|
|
@@ -1777,6 +1777,7 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
1777
1777
|
spacecraft: { count: this.#model.craftDrawn.count, status: { ...this.#model.craftDrawn.status }, drawn: [...this.#model.craftDrawn.drawn] },
|
|
1778
1778
|
companion: this.#model.companion,
|
|
1779
1779
|
moonSize: { asked: this.#model.moonSize, factor: this.#model.moonDrawn.factor, clamped: this.#model.moonDrawn.clamped },
|
|
1780
|
+
pictures: { pending: picturesPending() },
|
|
1780
1781
|
};
|
|
1781
1782
|
}
|
|
1782
1783
|
// --- the game clock ----------------------------------------------------------------------------------------------------------------------------
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.45.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.45.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/wakusei-planets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"planets",
|
|
@@ -583,6 +583,8 @@
|
|
|
583
583
|
"check": "pnpm lint && pnpm typecheck && pnpm test && pnpm build && node scripts/check-package.ts",
|
|
584
584
|
"prepublishOnly": "pnpm check",
|
|
585
585
|
"tiles": ".cache/venv/bin/python -I scripts/make-body-tiles.py build",
|
|
586
|
+
"tiles:moon": ".cache/venv/bin/python -I scripts/make-body-tiles.py sharp --bodies moon",
|
|
587
|
+
"tiles:mars": ".cache/venv/bin/python -I scripts/make-body-tiles.py sharp --bodies mars",
|
|
586
588
|
"test:tiles": ".cache/venv/bin/python -I scripts/make-body-tiles.py selftest",
|
|
587
589
|
"orbiters:refresh": "python3 -I scripts/make-orbiter-data.py --brief --cache \"$HOME/.cache/wakusei-planets/horizons-orbiters\"",
|
|
588
590
|
"family:readme": "node scripts/family-readme.mjs",
|