@johnmorrisdotca/wakusei-planets 0.1.0 → 0.3.1
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 +29 -1
- package/NOTICE.md +29 -4
- package/README.md +7 -5
- package/dist/bodies/all.d.ts +2 -0
- package/dist/bodies/all.js +2 -0
- package/dist/bodies/earth-look.d.ts +1 -0
- package/dist/bodies/earth-look.js +18 -0
- package/dist/bodies/earth.d.ts +1 -1
- package/dist/bodies/earth.js +3 -11
- package/dist/bodies/jupiter.js +3 -2
- package/dist/bodies/mars.js +1 -0
- package/dist/bodies/mercury.js +1 -0
- package/dist/bodies/moons-earth.js +1 -0
- package/dist/bodies/moons-jupiter.js +5 -3
- package/dist/bodies/moons-saturn.js +4 -2
- package/dist/bodies/neptune.js +2 -1
- package/dist/bodies/pluto.js +1 -0
- package/dist/bodies/saturn.js +1 -0
- package/dist/bodies/sun.js +1 -0
- package/dist/bodies/uranus.js +1 -0
- package/dist/bodies/venus.js +1 -0
- package/dist/element.d.ts +15 -3
- package/dist/element.js +50 -27
- package/dist/facts.js +2 -2
- package/dist/scene/body.d.ts +3 -1
- package/dist/scene/body.js +47 -17
- package/dist/scene/look.d.ts +11 -0
- package/dist/scene/store.d.ts +1 -7
- package/dist/textures/callisto-1024.webp +0 -0
- package/dist/textures/callisto-512.webp +0 -0
- package/dist/textures/earth-1024.webp +0 -0
- package/dist/textures/earth-512.webp +0 -0
- package/dist/textures/enceladus-1024.webp +0 -0
- package/dist/textures/enceladus-512.webp +0 -0
- package/dist/textures/europa-1024.webp +0 -0
- package/dist/textures/europa-512.webp +0 -0
- package/dist/textures/ganymede-1024.webp +0 -0
- package/dist/textures/ganymede-512.webp +0 -0
- package/dist/textures/io-1024.webp +0 -0
- package/dist/textures/io-512.webp +0 -0
- package/dist/textures/jupiter-1024.webp +0 -0
- package/dist/textures/jupiter-512.webp +0 -0
- package/dist/textures/mars-1024.webp +0 -0
- package/dist/textures/mars-512.webp +0 -0
- package/dist/textures/mercury-1024.webp +0 -0
- package/dist/textures/mercury-512.webp +0 -0
- package/dist/textures/mimas-1024.webp +0 -0
- package/dist/textures/mimas-512.webp +0 -0
- package/dist/textures/moon-1024.webp +0 -0
- package/dist/textures/moon-512.webp +0 -0
- package/dist/textures/neptune-1024.webp +0 -0
- package/dist/textures/neptune-512.webp +0 -0
- package/dist/textures/pluto-1024.webp +0 -0
- package/dist/textures/pluto-512.webp +0 -0
- package/dist/textures/rhea-1024.webp +0 -0
- package/dist/textures/rhea-512.webp +0 -0
- package/dist/textures/saturn-1024.webp +0 -0
- package/dist/textures/saturn-512.webp +0 -0
- package/dist/textures/saturn-ring-2048.webp +0 -0
- package/dist/textures/sun-1024.webp +0 -0
- package/dist/textures/sun-512.webp +0 -0
- package/dist/textures/titan-1024.webp +0 -0
- package/dist/textures/titan-512.webp +0 -0
- package/dist/textures/uranus-1024.webp +0 -0
- package/dist/textures/uranus-512.webp +0 -0
- package/dist/textures/venus-1024.webp +0 -0
- package/dist/textures/venus-512.webp +0 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
The Earth is a body like the others, and "To scale" is a comparison.
|
|
6
|
+
|
|
7
|
+
- **The Earth draws in every look.** In the realistic and painted looks the big view was empty and the row showed chikyu-earth's line globe, because the Earth was handed to chikyu-earth's own live element (0.7.0 here, a second WebGL context, no still). It is now drawn by this package like every other body, from NASA's Blue Marble picture (`earth-512`, `-1024` and `-2048`; the package grows by 0.08 MB), through the page's one WebGL context, with a still in the row. Both looks use the picture (an honest shaded Earth cannot be worked out from numbers), with a rim of air. Only the line look is chikyu-earth's globe. The Earth is in `/all`. chikyu-earth is now `^0.10.0` (it was `^0.7.0`).
|
|
8
|
+
- **"To scale" is a lineup** (section "To scale" in the demo): every body at the same scale in the same size of picture, a magnified picture joined by a line for each body too small to see, Saturn's rings whole, the Sun as the curved edge it is, the Earth at its true size. The tiles in the row are never scaled any more (the Sun was a flat square, Mercury a dot). New attribute `span-km`: the half-width of a picture in kilometres, the same in every picture of a lineup.
|
|
9
|
+
- **Every moon has a tile and a name** for `body` (`?body=io`), in the demo under its planet, with chips on each planet's and moon's view for its moons, its planet and its sister moons.
|
|
10
|
+
- **The body cannot be dragged out of the view** (a quarter of it stays in), and Fit centres it and returns it to its first angle.
|
|
11
|
+
- The README's pictures are absolute addresses pinned to the release's tag (npm's page showed a different picture from GitHub's), and a test holds it (`pnpm readme:images` pins them after a version bump).
|
|
12
|
+
|
|
13
|
+
## 0.3.0
|
|
14
|
+
|
|
15
|
+
Painted moons, Saturn's rings from Cassini, and a drag that goes the right way up.
|
|
16
|
+
|
|
17
|
+
- **Painted maps of nine moons**, from public-domain imagery on Wikimedia Commons, each file's licence read from Commons and credited in `NOTICE.md`: the Moon (LRO WAC, NASA's SVS Moon Kit), Io (Galileo and Voyager), Europa (USGS), Ganymede and Callisto (USGS), Titan (Cassini's 938 nm map, coloured and low in contrast, said plainly in `NOTICE.md`), Rhea, Enceladus (Cassini colour maps, the false colour turned most of the way to grey) and Mimas (Cassini). 512 and 1024 pixel widths in the package, 2048 from the repository as for the planets (Europa's source is 1024 wide, so it has no 2048). Where a source does not state its longitudes, `NOTICE.md` says what the map was turned by and why. Tethys, Dione, Iapetus, Triton and Charon keep their drawn look: Cassini maps of the first three are not made yet, Triton's source gives no longitudes, and the only clean public-domain map of Charon is under a grid of labels.
|
|
18
|
+
- **Saturn's rings in the painted look are a Cassini picture** (PIA07874, natural colour): one strip of 2048 colours and opacities from 74,794 to 137,035 km, 2.4 KB, with the real ringlets, the Cassini Division and the Encke gap. The realistic look keeps the strip made from the ring table. `PaintedMap.rings` names the strip; a strip that cannot load leaves the table's.
|
|
19
|
+
- **The package's pictures grow from 0.53 MB to 1.31 MB** (the 512 and 1024 widths of 18 maps and the ring strip); the budget in `pnpm test:package` is 1.5 MB.
|
|
20
|
+
- **The Moon is in `/all`.** `@johnmorrisdotca/wakusei-planets/all` left out `moons-earth`, so the demo's Moon was drawn as a plain ball.
|
|
21
|
+
- **Io's Pele is at 105 degrees east** in the shaded look (it was at 90 degrees west; Pele is at 255 degrees west).
|
|
22
|
+
- **A drag up moves the surface up** (it moved it down), in every look: the controls' tilt tipped the pole toward you as it grew, and now tips the top of the body away, so the near surface goes up, as in chikyu-earth 0.9.1. Drag right, the right arrow and the up arrow agree. Test (`e2e/drag.demo.ts`): a real pointer and real key presses on Mars (line, shaded, painted), Venus and the Moon (painted); the vertical checks fail on 0.2.0.
|
|
23
|
+
- `scripts/make-textures.py` makes the moons and the ring strip too (`python3 scripts/make-textures.py io saturn-ring`) and writes each source's file page, licence and credit into `textures/SOURCES.json`.
|
|
24
|
+
|
|
25
|
+
## 0.2.0
|
|
26
|
+
|
|
27
|
+
The painted looks.
|
|
28
|
+
|
|
29
|
+
- `look="painted"`: real surface maps of Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto and the Sun, from public-domain NASA, USGS and JPL imagery, each file's licence checked and credited in `NOTICE.md`. Saturn, Uranus, Neptune and the Sun have no global map, so theirs are made from one photograph each (said plainly in `NOTICE.md`).
|
|
30
|
+
- Small pictures by default: the 512 and 1024 pixel widths are in the package (0.53 MB in all); a view that is zoomed in fetches the 2048 pixel width from the repository by jsDelivr's GitHub address (`texture-far-base` to serve it yourself). A picture that fails to load leaves the shaded look drawn, and no picture is asked for twice.
|
|
31
|
+
- A texture is freed when a sharper one replaces it and when the element leaves.
|
|
4
32
|
|
|
5
33
|
## 0.1.0
|
|
6
34
|
|
package/NOTICE.md
CHANGED
|
@@ -15,10 +15,35 @@ The tests compare the Galilean moons and four planets with astronomy-engine (MIT
|
|
|
15
15
|
|
|
16
16
|
## The Earth
|
|
17
17
|
|
|
18
|
-
The Earth
|
|
18
|
+
The Earth's line drawing is chikyu-earth's own globe (MIT, by John Morris; https://github.com/johnmorrisdotca/chikyu-earth), an optional peer dependency: its own NOTICE.md has the terms of its outlines. The Earth's realistic and painted looks are drawn here, like every other body, from NASA's Blue Marble picture (below).
|
|
19
19
|
|
|
20
20
|
## Surface pictures
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
NASA says its content "generally are not subject to copyright in the United States" and asks for acknowledgement (https://www.nasa.gov/nasa-brand-center/images-and-media/). This package is not endorsed by NASA and uses none of
|
|
22
|
+
The painted looks' pictures in `textures/` (the 512 and 1024 pixel widths are also in the package's `dist/textures/`) are made by `scripts/make-textures.py` from public-domain imagery on Wikimedia Commons. The script reads each file's licence from Commons' own metadata and stops unless it is public domain or CC0; the originals are downloaded to `.cache/` and never kept in the repository. `textures/SOURCES.json` records the file pages, licences and credits as read on 2026-11-02.
|
|
23
|
+
|
|
24
|
+
NASA says its content "generally are not subject to copyright in the United States" and asks for acknowledgement (https://www.nasa.gov/nasa-brand-center/images-and-media/); USGS and JPL maps are works of the United States government. This package is not endorsed by NASA, the USGS or any mission, and uses none of their insignia or logotypes.
|
|
25
|
+
|
|
26
|
+
| Pictures | Body | Source file | Licence | Credit | What was done |
|
|
27
|
+
|---|---|---|---|---|---|
|
|
28
|
+
| `mercury-*.webp` | Mercury | [Mercury MESSENGER MDIS Basemap EnhancedColor Mosaic Global 32ppd.jpg](https://commons.wikimedia.org/wiki/File:Mercury_MESSENGER_MDIS_Basemap_EnhancedColor_Mosaic_Global_32ppd.jpg) | Public domain | Johns Hopkins Applied Physics Laboratory, Applied Coherent Technology Corporation | MESSENGER MDIS enhanced-colour global mosaic (USGS Astrogeology map), colour turned most of the way to grey and brightened; the polar rows with no data repeat the nearest real ones |
|
|
29
|
+
| `venus-*.webp` | Venus | [Cylindrical Map of Venus.jpg](https://commons.wikimedia.org/wiki/File:Cylindrical_Map_of_Venus.jpg) | Public domain | NASA / Jet Propulsion Laboratory | Magellan radar global map in the orange tone of the Venera pictures (a colour for the radar's brightness, not a photograph of the surface under the clouds), turned so Maxwell Montes is at 3 degrees east |
|
|
30
|
+
| `mars-*.webp` | Mars | [Mars Viking MDIM21 ClrMosaic 1km.jpg](https://commons.wikimedia.org/wiki/File:Mars_Viking_MDIM21_ClrMosaic_1km.jpg) | Public domain | NASA / Jet Propulsion Lab / USGS | Viking Orbiter MDIM 2.1 colour mosaic (USGS Astrogeology), as it is |
|
|
31
|
+
| `jupiter-*.webp` | Jupiter | [Jupiter Cylindrical Map - Dec 2000 PIA07782.jpg](https://commons.wikimedia.org/wiki/File:Jupiter_Cylindrical_Map_-_Dec_2000_PIA07782.jpg) | Public domain | NASA/JPL/Space Science Institute | Cassini cylindrical map of December 2000 (PIA07782), as it is; the poles are the map's own |
|
|
32
|
+
| `saturn-*.webp` | Saturn | [Saturn during Equinox.jpg](https://commons.wikimedia.org/wiki/File:Saturn_during_Equinox.jpg) | Public domain | NASA / JPL / Space Science Institute | made from Cassini's natural-colour portrait of 2009 (PIA11141): the visible hemisphere turned back onto the sphere, the limb darkening taken off, and each latitude's colour kept all the way round (a photograph has no longitudes to map), the ring shadow and the ring crossing the disc taken out |
|
|
33
|
+
| `uranus-*.webp` | Uranus | [Uranus as seen by NASA's Voyager 2.tif](https://commons.wikimedia.org/wiki/File:Uranus_as_seen_by_NASA%27s_Voyager_2.tif) | Public domain | NASA | made from Voyager 2's portrait (PIA18182): one colour for the whole planet, a little brighter toward the south pole, because that photograph has no features to map |
|
|
34
|
+
| `neptune-*.webp` | Neptune | [Neptune Full (original).jpg](https://commons.wikimedia.org/wiki/File:Neptune_Full_(original).jpg) | Public domain | NASA/JPL | made from Voyager 2's full-disk view (PIA01492): the bands of each latitude all the way round, and the Great Dark Spot with its bright companion clouds put back where the photograph shows them |
|
|
35
|
+
| `pluto-*.webp` | Pluto | [Pluto color mapmosaic.jpg](https://commons.wikimedia.org/wiki/File:Pluto_color_mapmosaic.jpg) | Public domain | NASA / Johns Hopkins University Applied Physics Laboratory / Southwest Research Institute | New Horizons global colour map, turned so Sputnik Planitia is at 178 degrees east; the south, in the polar night New Horizons never saw, fades into a dark brown |
|
|
36
|
+
| `sun-*.webp` | Sun | [SDO 20240810 000000 4096 HMIIC (HMI).jpg](https://commons.wikimedia.org/wiki/File:SDO_20240810_000000_4096_HMIIC_(HMI).jpg) | Public domain | Courtesy of NASA/SDO and the AIA, EVE, and HMI science teams. | SDO's HMI continuum picture of 10 August 2024: the visible hemisphere turned back onto the sphere, limb darkening taken off, and its sunspots and granulation kept on a flat orange, repeated on the far side |
|
|
37
|
+
| `moon-*.webp` | The Moon | [CGI Moon Kit - Lroc color poles.tif](https://commons.wikimedia.org/wiki/File:CGI_Moon_Kit_-_Lroc_color_poles.tif) | Public domain | NASA's Scientific Visualization Studio (Ernie Wright, Noah Petro); Lunar Reconnaissance Orbiter Camera | LRO WAC colour map from the SVS Moon Kit (4720), as it is, longitude 0 in the middle |
|
|
38
|
+
| `io-*.webp` | Io | [Io from Galileo and Voyager missions.jpg](https://commons.wikimedia.org/wiki/File:Io_from_Galileo_and_Voyager_missions.jpg) | Public domain | NASA / JPL (Galileo SSI and Voyager images); the file page names no author | Galileo and Voyager colour map between 57 degrees north and south, turned so Pele is at 105 degrees east; the poles it does not reach fade from the map's edge into its mean colour |
|
|
39
|
+
| `europa-*.webp` | Europa | [Europa Voyager GalileoSSI global mosaic.jpg](https://commons.wikimedia.org/wiki/File:Europa_Voyager_GalileoSSI_global_mosaic.jpg) | Public domain | U.S. Geological Survey / Planetary Data System / Tammy Becker | USGS Voyager and Galileo grey-scale mosaic, longitude 0 in the middle (the source does not say; the Pwyll crater and the dark trailing side fall at 90 degrees east, the bright leading side at 90 degrees west); the unmapped rim of the south fades to its mean grey. The source is 1024 pixels wide, so there is no 2048 picture |
|
|
40
|
+
| `ganymede-*.webp` | Ganymede | [Ganymede equatorial.jpg](https://commons.wikimedia.org/wiki/File:Ganymede_equatorial.jpg) | Public domain | USGS | USGS Voyager and Galileo colour mosaic (I-2762), the Mercator sheet for 57 degrees north and south, redrawn as an equirectangular map with longitude 0 in the middle (the source does not say; Galileo Regio falls at 140 degrees west); the poles are not on that sheet and fade from its edge into its mean colour |
|
|
41
|
+
| `callisto-*.webp` | Callisto | [Callisto equatorial.jpg](https://commons.wikimedia.org/wiki/File:Callisto_equatorial.jpg) | Public domain | USGS | USGS Voyager and Galileo mosaic (I-2770), the Mercator sheet for 57 degrees north and south, redrawn as an equirectangular map with longitude 0 in the middle (the source does not say; Valhalla falls at 56 degrees west); the poles fade from its edge into its mean grey |
|
|
42
|
+
| `titan-*.webp` | Titan | [Titan map April 2011 full.png](https://commons.wikimedia.org/wiki/File:Titan_map_April_2011_full.png) | Public domain | NASA / JPL / Space Science Institute | Cassini ISS 938 nm map (PIA14908), turned so longitude 0 is in the middle (the original is centred on 180). Titan's surface cannot be seen in visible light under its haze, so the picture is a colour for the infrared brightness, with its contrast turned down: it is not a photograph, as with Venus |
|
|
43
|
+
| `earth-*.webp` | Earth | [Blue Marble: Next Generation with topography and bathymetry, September 2004](https://visibleearth.nasa.gov/images/73801) (Visible Earth 73801) | Public domain (NASA) | NASA Earth Observatory (Reto Stockli) | Resized from the 2048 pixel picture chikyu-earth already makes from the 5400 x 2700 original; the realistic and the painted looks both draw it, because an honest shaded Earth cannot be worked out from numbers |
|
|
44
|
+
| `rhea-*.webp` | Rhea | [Rhea Color Map.jpg](https://commons.wikimedia.org/wiki/File:Rhea_Color_Map.jpg) | Public domain | NASA/JPL-Caltech/Space Science Institute/Lunar and Planetary Institute | Cassini global colour map (PIA18438), turned half way round so longitude 0 is in the middle (the source does not say where it is centred; the dark trailing side is put at 90 degrees east); the colours are false-colour (infrared, green, ultraviolet) and are turned about half way to grey |
|
|
45
|
+
| `enceladus-*.webp` | Enceladus | [Enceladus Color Map.jpg](https://commons.wikimedia.org/wiki/File:Enceladus_Color_Map.jpg) | Public domain | NASA/JPL-Caltech/Space Science Institute/Lunar and Planetary Institute | Cassini global colour map (PIA18435), turned half way round the same way as Rhea's (the source does not say where it is centred; the fractured trailing terrain is put at 90 degrees east); the colours are false-colour (the blue of the tiger stripes is ultraviolet) and are turned most of the way to grey |
|
|
46
|
+
| `mimas-*.webp` | Mimas | [Map of Mimas 2010-02 PIA12780.jpg](https://commons.wikimedia.org/wiki/File:Map_of_Mimas_2010-02_PIA12780.jpg) | Public domain | NASA/JPL/Space Science Institute | Cassini ISS map of February 2010 (PIA12780), cropped inside its frame and labels; Herschel is at 110 degrees west as its own scale says |
|
|
47
|
+
| `saturn-ring-2048.webp` | Saturn's rings | [Saturn's rings in visible light and radio.jpg](https://commons.wikimedia.org/wiki/File:Saturn's_rings_in_visible_light_and_radio.jpg) | Public domain | NASA / JPL / Space Science Institute | Cassini's natural-colour mosaic of the lit rings (PIA07874, from PIA06175), read along one radius into a strip of 2048 colours and opacities from 74,794 to 137,035 km. The radii are fitted to five edges the picture shows (the B ring's inner edge, the two edges of the Cassini Division, the Encke gap and the A ring's outer edge), each within 300 km. The opacity is taken from the brightness, and the colour balance is moved to match the Saturn portrait above; the F ring and the D ring are not in the picture |
|
|
48
|
+
|
|
49
|
+
The package does not ship the 2048 pixel widths: `TEXTURE_FAR_BASE` fetches them from this repository by jsDelivr's GitHub address when a view is zoomed in. The 512 and 1024 pixel widths of every picture, and the ring strip, are 1.31 MB in the package (the nine of 0.2.0 were 0.53 MB). Tethys, Dione, Iapetus, Triton and Charon have no picture: Cassini's maps of the first three are not made yet, the source of Triton's map does not give its longitudes, and the only clean public-domain map of Charon is under a grid of labels, so those five keep their drawn look.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<h1 align="center">Wakusei Planets <sub>惑星</sub></h1>
|
|
2
2
|
|
|
3
3
|
<p align="center"><strong>The Sun, the planets and their moons, for the web.</strong><br>
|
|
4
|
-
A clean line drawing, a shaded realistic drawing, or
|
|
4
|
+
A clean line drawing, a shaded realistic drawing, or a painted surface map, with each body's real size, axial tilt and rotation as data, and a planet's moons where they are at any date and time.</p>
|
|
5
5
|
|
|
6
6
|
<p align="center">
|
|
7
7
|
<a href="https://github.com/johnmorrisdotca/wakusei-planets/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/johnmorrisdotca/wakusei-planets/actions/workflows/ci.yml/badge.svg"></a>
|
|
@@ -11,7 +11,9 @@ A clean line drawing, a shaded realistic drawing, or (soon) a painted surface ma
|
|
|
11
11
|
|
|
12
12
|
<p align="center"><a href="https://johnmorrisdotca.github.io/wakusei-planets/"><strong>Open the demo →</strong></a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/embed.html">Embed page</a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/docs/">Docs</a></p>
|
|
13
13
|
|
|
14
|
-
<p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="docs/images/hero-desk.png" width="640"></p>
|
|
14
|
+
<p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.3.1/docs/images/hero-desk.png" width="640"></p>
|
|
15
|
+
|
|
16
|
+
<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.3.1/docs/images/lineup-desk.png" width="640"></p>
|
|
15
17
|
|
|
16
18
|
## One minute
|
|
17
19
|
|
|
@@ -72,9 +74,9 @@ A bundled app imports it: `import "@johnmorrisdotca/wakusei-planets/element"` (a
|
|
|
72
74
|
|---|---|---|
|
|
73
75
|
| `line` | A clean outline drawing with the body's key features: bands, craters, rings and their gaps, caps, the dark side dashed off. An SVG. | nothing |
|
|
74
76
|
| `realistic` | A shaded sphere drawn from the body's real colours and features, lit from the Sun's side, with the rings casting shadows. No pictures: the surface is worked out in a shader. | `three`, the body's entry point |
|
|
75
|
-
| `painted` | A real surface map from public-domain imagery. Small pictures first, sharper when you zoom in. |
|
|
77
|
+
| `painted` | A real surface map from public-domain NASA, USGS and JPL imagery. Small pictures first (1.31 MB for all of them in the package), a sharper one fetched when you zoom in. | `three`, the body's entry point |
|
|
76
78
|
|
|
77
|
-
Every body has its real size relative to the others (`scale-to="jupiter"`), its axial tilt and its rotation. The Sun, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune and Pluto are drawn, and so are 25 moons (the Moon, Phobos and Deimos, the four Galilean moons, Saturn's seven larger moons, Uranus's five, Proteus, Triton and Nereid, Charon, Nix and Hydra). The Earth is [chikyu-earth](https://github.com/johnmorrisdotca/chikyu-earth)'s own globe
|
|
79
|
+
Every body has its real size relative to the others (`scale-to="jupiter"`), its axial tilt and its rotation. The Sun, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune and Pluto are drawn, and so are 25 moons (the Moon, Phobos and Deimos, the four Galilean moons, Saturn's seven larger moons, Uranus's five, Proteus, Triton and Nereid, Charon, Nix and Hydra). The Earth is drawn like the rest in the realistic and painted looks (NASA's Blue Marble), and its line look is [chikyu-earth](https://github.com/johnmorrisdotca/chikyu-earth)'s own globe: `import "@johnmorrisdotca/wakusei-planets/earth"` (it needs `@johnmorrisdotca/chikyu-earth` 0.10.0 or later installed). The painted looks cover the Sun, the planets from Mercury to Earth and Pluto, the Moon, the four Galilean moons, Titan, Rhea, Enceladus and Mimas, and Saturn's rings are Cassini's own picture of them.
|
|
78
80
|
|
|
79
81
|
## As the Earth sees it
|
|
80
82
|
|
|
@@ -140,7 +142,7 @@ The pure side has no DOM: `BODIES`, `apparent(id, time)`, `system(planet, time)`
|
|
|
140
142
|
|
|
141
143
|
## The data
|
|
142
144
|
|
|
143
|
-
Sizes, flattening, poles and rotation are the IAU's and NASA's; planet positions are JPL's approximate elements; the Moon's are Meeus's largest terms; the other moons are JPL's mean elements. Nothing is fetched at run time
|
|
145
|
+
Sizes, flattening, poles and rotation are the IAU's and NASA's; planet positions are JPL's approximate elements; the Moon's are Meeus's largest terms; the other moons are JPL's mean elements. Nothing is fetched at run time by the line and shaded looks, which use no pictures. See [NOTICE.md](NOTICE.md).
|
|
144
146
|
|
|
145
147
|
## The name
|
|
146
148
|
|
package/dist/bodies/all.d.ts
CHANGED
package/dist/bodies/all.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { registerLook } from "../scene/look.js";
|
|
2
|
+
// The Earth's realistic and painted looks, drawn like every other body's from the Blue Marble picture, so they share the page's one WebGL context and have stills like the rest.
|
|
3
|
+
registerLook({
|
|
4
|
+
id: "earth",
|
|
5
|
+
surface: `
|
|
6
|
+
vec4 surface(vec3 p) {
|
|
7
|
+
float land = smoothstep(0.52, 0.58, fbm(p * 2.6 + 3.0));
|
|
8
|
+
vec3 sea = vec3(0.05, 0.17, 0.38);
|
|
9
|
+
vec3 ground = mix(vec3(0.22, 0.38, 0.16), vec3(0.62, 0.55, 0.40), smoothstep(0.55, 0.8, fbm(p * 5.0)));
|
|
10
|
+
float ice = smoothstep(radians(66.0), radians(76.0), abs(lat(p)));
|
|
11
|
+
return vec4(mix(mix(sea, ground, land), vec3(0.93, 0.96, 0.98), ice), 0.0);
|
|
12
|
+
}`,
|
|
13
|
+
atmosphere: { colour: [0.32, 0.52, 0.95], strength: 0.5, power: 3 },
|
|
14
|
+
wrap: 0.12,
|
|
15
|
+
limb: 0.12,
|
|
16
|
+
mapped: true,
|
|
17
|
+
painted: { map: "earth", widths: [512, 1024, 2048], far: 2048, relief: 0 },
|
|
18
|
+
});
|
package/dist/bodies/earth.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import "./earth-look.ts";
|
package/dist/bodies/earth.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import "./earth-look.js";
|
|
1
2
|
import { delegates } from "../scene/store.js";
|
|
2
|
-
// The Earth
|
|
3
|
-
//
|
|
3
|
+
// The Earth's line look is chikyu-earth's own globe with the countries, not a second copy (chikyu-earth is an optional peer, loaded only when that line globe is drawn). The realistic and
|
|
4
|
+
// painted looks are drawn here like every other body's (earth-look.ts, which `/all` also loads).
|
|
4
5
|
const CENTRE = "10,20";
|
|
5
6
|
delegates.set("earth", {
|
|
6
7
|
async line({ center, size }) {
|
|
@@ -11,13 +12,4 @@ delegates.set("earth", {
|
|
|
11
12
|
globe.setAttribute("size", String(size));
|
|
12
13
|
return globe;
|
|
13
14
|
},
|
|
14
|
-
async live({ center, time, textureBase }) {
|
|
15
|
-
await import("@johnmorrisdotca/chikyu-earth/realistic/element");
|
|
16
|
-
const earth = document.createElement("chikyu-earth-realistic");
|
|
17
|
-
earth.setAttribute("center", center || CENTRE);
|
|
18
|
-
earth.setAttribute("time", time);
|
|
19
|
-
if (textureBase !== null)
|
|
20
|
-
earth.setAttribute("texture-base", textureBase);
|
|
21
|
-
return earth;
|
|
22
|
-
},
|
|
23
15
|
});
|
package/dist/bodies/jupiter.js
CHANGED
|
@@ -8,8 +8,8 @@ registerLook({
|
|
|
8
8
|
streaks: 0.22,
|
|
9
9
|
plateau: 0.22,
|
|
10
10
|
extra: `
|
|
11
|
-
float spot = oval(p, -
|
|
12
|
-
float halo = oval(p, -
|
|
11
|
+
float spot = oval(p, -48.0, -22.0, 9.5, 6.0, 0.55);
|
|
12
|
+
float halo = oval(p, -48.0, -22.0, 14.0, 9.0, 0.5) - spot;
|
|
13
13
|
vec3 spotCol = mix(vec3(0.70, 0.31, 0.20), vec3(0.86, 0.52, 0.36), fbm(p * 16.0 + 2.0));
|
|
14
14
|
col = mix(col, col * 0.78, clamp(halo, 0.0, 1.0) * 0.5);
|
|
15
15
|
col = mix(col, spotCol, spot);
|
|
@@ -18,4 +18,5 @@ registerLook({
|
|
|
18
18
|
}),
|
|
19
19
|
atmosphere: { colour: [0.75, 0.7, 0.62], strength: 0.12, power: 3.5 },
|
|
20
20
|
limb: 0.45,
|
|
21
|
+
painted: { map: "jupiter", widths: [512, 1024, 2048], far: 2048, relief: 0 },
|
|
21
22
|
});
|
package/dist/bodies/mars.js
CHANGED
package/dist/bodies/mercury.js
CHANGED
|
@@ -5,4 +5,5 @@ registerLook({
|
|
|
5
5
|
surface: rock({ dark: "#4f4a46", light: "#a6a09a", craters: 0.9, contrast: 0.8, seed: 2, patches: 1.8, extra: "col *= 1.0 + 0.5 * smoothstep(0.05, 0.25, h);" }),
|
|
6
6
|
relief: 0.9,
|
|
7
7
|
ambient: 0.03,
|
|
8
|
+
painted: { map: "mercury", widths: [512, 1024, 2048], far: 2048 },
|
|
8
9
|
});
|
|
@@ -11,17 +11,19 @@ vec4 surface(vec3 p) {
|
|
|
11
11
|
col = mix(col, vec3(0.96, 0.96, 0.92), smoothstep(0.68, 0.85, fbm(p * 5.0 + 8.0)) * 0.65);
|
|
12
12
|
float c = -craters(p, 6.5, 1.0, 21.0);
|
|
13
13
|
col = mix(col, vec3(0.20, 0.12, 0.07), smoothstep(0.06, 0.26, c) * 0.8);
|
|
14
|
-
float pele = oval(p,
|
|
14
|
+
float pele = oval(p, 105.0, -19.0, 13.0, 13.0, 0.5) - oval(p, 105.0, -19.0, 6.0, 6.0, 0.5);
|
|
15
15
|
col = mix(col, vec3(0.78, 0.2, 0.1), clamp(pele, 0.0, 1.0) * 0.55);
|
|
16
16
|
return vec4(col, 0.0);
|
|
17
17
|
}`,
|
|
18
18
|
ambient: 0.02,
|
|
19
|
+
painted: { map: "io", widths: [512, 1024, 2048], far: 2048 },
|
|
19
20
|
});
|
|
20
|
-
registerLook({ id: "europa", surface: ice({ base: "#e9e0cd", stain: "#a2623e", cracks: 0.85, craters: 0.2 }), ambient: 0.02,
|
|
21
|
+
registerLook({ id: "europa", surface: ice({ base: "#e9e0cd", stain: "#a2623e", cracks: 0.85, craters: 0.2 }), ambient: 0.02, painted: { map: "europa", widths: [512, 1024] } });
|
|
21
22
|
registerLook({
|
|
22
23
|
id: "ganymede",
|
|
23
24
|
surface: rock({ dark: "#5f5448", light: "#b6aa99", craters: 0.9, contrast: 0.9, seed: 12, patches: 3.4, extra: "col = mix(col, vec3(0.30, 0.25, 0.21), oval(p, -140.0, 20.0, 38.0, 50.0, 0.4) * 0.7); col += vec3(0.28) * smoothstep(0.05, 0.2, -h) * 0.6;" }),
|
|
24
25
|
relief: 0.6,
|
|
25
26
|
ambient: 0.02,
|
|
27
|
+
painted: { map: "ganymede", widths: [512, 1024, 2048], far: 2048 },
|
|
26
28
|
});
|
|
27
|
-
registerLook({ id: "callisto", surface: rock({ dark: "#3f3832", light: "#7d7265", craters: 1.8, contrast: 0.9, seed: 21, patches: 3.2, extra: "col += vec3(0.4, 0.4, 0.42) * smoothstep(0.05, 0.22, -h);" }), relief: 0.9, ambient: 0.02 });
|
|
29
|
+
registerLook({ id: "callisto", surface: rock({ dark: "#3f3832", light: "#7d7265", craters: 1.8, contrast: 0.9, seed: 21, patches: 3.2, extra: "col += vec3(0.4, 0.4, 0.42) * smoothstep(0.05, 0.22, -h);" }), relief: 0.9, ambient: 0.02, painted: { map: "callisto", widths: [512, 1024, 2048], far: 2048 } });
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { registerLook } from "../scene/look.js";
|
|
2
2
|
import { cloud, ice, rock } from "../scene/recipes.js";
|
|
3
|
-
registerLook({ id: "mimas", surface: rock({ dark: "#7f7d79", light: "#bebcb7", craters: 1.7, contrast: 1, seed: 6, extra: "float hs = bowl(p, -110.0, 0.0, 33.0, 0.7); h += hs; col *= 1.0 + 0.9 * hs;" }), relief: 1, ambient: 0.02 });
|
|
3
|
+
registerLook({ id: "mimas", surface: rock({ dark: "#7f7d79", light: "#bebcb7", craters: 1.7, contrast: 1, seed: 6, extra: "float hs = bowl(p, -110.0, 0.0, 33.0, 0.7); h += hs; col *= 1.0 + 0.9 * hs;" }), relief: 1, ambient: 0.02, painted: { map: "mimas", widths: [512, 1024, 2048], far: 2048 } });
|
|
4
4
|
registerLook({
|
|
5
5
|
id: "enceladus",
|
|
6
6
|
surface: ice({ base: "#f4f7fa", stain: "#c3cfd9", craters: 0.35, extra: "float tiger = oval(p, 0.0, -80.0, 170.0, 14.0, 0.5) * (1.0 - smoothstep(0.0, 0.04, abs(fbm(p * vec3(4.0, 4.0, 14.0)) - 0.5))); col = mix(col, vec3(0.45, 0.72, 0.85), tiger * 0.85);" }),
|
|
7
7
|
ambient: 0.03,
|
|
8
8
|
relief: 0.3,
|
|
9
|
+
painted: { map: "enceladus", widths: [512, 1024, 2048], far: 2048 },
|
|
9
10
|
});
|
|
10
11
|
registerLook({ id: "tethys", surface: rock({ dark: "#8f8d88", light: "#d0cec9", craters: 1.2, contrast: 0.9, seed: 14, patches: 2.2, extra: "float od = bowl(p, 232.0, 5.0, 24.0, 0.6); h += od; col *= 1.0 + 0.7 * od;" }), relief: 0.8, ambient: 0.02 });
|
|
11
12
|
registerLook({ id: "dione", surface: rock({ dark: "#8c8a85", light: "#cdcbc5", craters: 1, contrast: 0.9, seed: 18, patches: 2.6 }), relief: 0.8, ambient: 0.02 });
|
|
12
|
-
registerLook({ id: "rhea", surface: rock({ dark: "#8a8883", light: "#cac8c2", craters: 1.5, contrast: 0.9, seed: 24, patches: 2 }), relief: 0.85, ambient: 0.02 });
|
|
13
|
+
registerLook({ id: "rhea", surface: rock({ dark: "#8a8883", light: "#cac8c2", craters: 1.5, contrast: 0.9, seed: 24, patches: 2 }), relief: 0.85, ambient: 0.02, painted: { map: "rhea", widths: [512, 1024, 2048], far: 2048 } });
|
|
13
14
|
registerLook({
|
|
14
15
|
id: "titan",
|
|
15
16
|
surface: cloud({ light: "#ecbe6c", dark: "#b8802f", swirl: 0.7 }),
|
|
16
17
|
atmosphere: { colour: [0.92, 0.66, 0.3], strength: 0.65, power: 2.3 },
|
|
17
18
|
limb: 0.3,
|
|
18
19
|
ambient: 0.06,
|
|
20
|
+
painted: { map: "titan", widths: [512, 1024, 2048], far: 2048 },
|
|
19
21
|
});
|
|
20
22
|
registerLook({
|
|
21
23
|
id: "iapetus",
|
package/dist/bodies/neptune.js
CHANGED
|
@@ -7,7 +7,7 @@ registerLook({
|
|
|
7
7
|
turbulence: 0.022,
|
|
8
8
|
streaks: 0.1,
|
|
9
9
|
extra: `
|
|
10
|
-
float spot = oval(p, -30.0, -
|
|
10
|
+
float spot = oval(p, -30.0, -24.0, 11.0, 6.5, 0.5);
|
|
11
11
|
col = mix(col, vec3(0.10, 0.17, 0.46), spot * 0.9);
|
|
12
12
|
float cirrus = smoothstep(0.6, 0.8, fbm(vec3(p.xy * 3.0, p.z * 30.0) + 8.0)) * smoothstep(0.5, 0.0, abs(degrees(la) + 38.0) / 10.0);
|
|
13
13
|
col = mix(col, vec3(0.86, 0.9, 1.0), clamp(cirrus + oval(p, -8.0, -28.0, 7.0, 2.0, 0.6) * 0.8, 0.0, 1.0) * 0.55);`,
|
|
@@ -15,4 +15,5 @@ registerLook({
|
|
|
15
15
|
atmosphere: { colour: [0.35, 0.5, 0.95], strength: 0.42, power: 2.8 },
|
|
16
16
|
limb: 0.3,
|
|
17
17
|
ambient: 0.05,
|
|
18
|
+
painted: { map: "neptune", widths: [512, 1024, 2048], far: 2048, relief: 0 },
|
|
18
19
|
});
|
package/dist/bodies/pluto.js
CHANGED
package/dist/bodies/saturn.js
CHANGED
package/dist/bodies/sun.js
CHANGED
package/dist/bodies/uranus.js
CHANGED
package/dist/bodies/venus.js
CHANGED
package/dist/element.d.ts
CHANGED
|
@@ -25,13 +25,25 @@ export type WakuseiState = "line" | "loading" | "still" | "live" | "lost" | "una
|
|
|
25
25
|
* console.log(TEXTURE_BASE);
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.1
|
|
28
|
+
export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.3.1/dist/textures/";
|
|
29
|
+
/**
|
|
30
|
+
* 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
|
|
31
|
+
* never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts no-run
|
|
35
|
+
* import { TEXTURE_FAR_BASE } from "@johnmorrisdotca/wakusei-planets/element";
|
|
36
|
+
*
|
|
37
|
+
* console.log(TEXTURE_FAR_BASE);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.3.1/textures/";
|
|
29
41
|
/**
|
|
30
42
|
* The `<wakusei-body>` custom element: a body of the solar system, drawn in a look.
|
|
31
43
|
*
|
|
32
44
|
* Attributes: `body` (a name, such as `jupiter`), `look` (`line`, `realistic` or `painted`), `size` (pixels across), `time` (`now` or an ISO date: the body as the Earth sees it then; leave it out for a portrait),
|
|
33
45
|
* `tilt`, `pitch`, `phase` and `meridian` (a portrait's pose, degrees), `turn` (a portrait turns this many degrees a second), `rate` (simulated seconds for each real second), `moons` (draw the planet's moons on their orbits),
|
|
34
|
-
* `range` (planet radii the moons picture reaches), `scale-to` (draw to scale with another body), `live` (`always`, `hover` or `off`: when it takes the page's one WebGL context), `texture-base` (where the surface pictures are) and `lang` (`en` or `ja`).
|
|
46
|
+
* `range` (planet radii the moons picture reaches), `scale-to` (draw to scale with another body), `span-km` (draw to scale: the half-width of the picture in kilometres, the same in every picture of a lineup), `live` (`always`, `hover` or `off`: when it takes the page's one WebGL context), `texture-base` (where the surface pictures are) and `lang` (`en` or `ja`).
|
|
35
47
|
*
|
|
36
48
|
* @example
|
|
37
49
|
* ```ts no-run
|
|
@@ -65,7 +77,7 @@ export declare class WakuseiBody extends HTMLElement {
|
|
|
65
77
|
goLive(): Promise<boolean>;
|
|
66
78
|
/** Give the WebGL context back: the picture stays as a still. */
|
|
67
79
|
rest(): void;
|
|
68
|
-
/** The shared controllers' camera: `yaw` turns the body about its pole, `tilt` tips its
|
|
80
|
+
/** The shared controllers' camera: `yaw` turns the body about its pole, `tilt` tips its top away from you as it grows (a drag up moves the surface up), `zoom` and the pan move the picture. */
|
|
69
81
|
setView(view: {
|
|
70
82
|
yaw?: number;
|
|
71
83
|
tilt?: number;
|
package/dist/element.js
CHANGED
|
@@ -20,6 +20,18 @@ export { setThreeLoader };
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
export const TEXTURE_BASE = `https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@${VERSION}/dist/textures/`;
|
|
23
|
+
/**
|
|
24
|
+
* 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
|
|
25
|
+
* never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts no-run
|
|
29
|
+
* import { TEXTURE_FAR_BASE } from "@johnmorrisdotca/wakusei-planets/element";
|
|
30
|
+
*
|
|
31
|
+
* console.log(TEXTURE_FAR_BASE);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export const TEXTURE_FAR_BASE = `https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v${VERSION}/textures/`;
|
|
23
35
|
const num = (value, fallback) => {
|
|
24
36
|
if (value === null || value.trim() === "")
|
|
25
37
|
return fallback;
|
|
@@ -43,10 +55,18 @@ function extentOf(id, options) {
|
|
|
43
55
|
const far = Math.max(1.8, ringReach(f) * 1.15, ...near.map((m) => m.reach * 1.1));
|
|
44
56
|
return options.range ?? far;
|
|
45
57
|
}
|
|
58
|
+
if (options.spanKm !== undefined)
|
|
59
|
+
return options.spanKm / f.radiusKm;
|
|
46
60
|
if (options.scaleTo !== undefined)
|
|
47
61
|
return (BODIES[options.scaleTo].radiusKm * 1.06) / f.radiusKm;
|
|
48
62
|
return Math.max(id === "sun" ? 1.55 : 1.06, ringReach(f) * 1.04);
|
|
49
63
|
}
|
|
64
|
+
/** Keep the body in the picture: at least a quarter of its width stays inside the edge, however far the view is moved. `pan` is in half-widths of the picture. */
|
|
65
|
+
function clampPan(pan, extent, zoom) {
|
|
66
|
+
const half = extent / Math.max(0.05, zoom);
|
|
67
|
+
const limit = 1 + 0.5 / half;
|
|
68
|
+
return Math.max(-limit, Math.min(limit, pan));
|
|
69
|
+
}
|
|
50
70
|
const TEMPLATE = `<style>
|
|
51
71
|
:host { display: block; width: var(--wakusei-size, 320px); max-width: 100%; aspect-ratio: 1 / 1; position: relative; contain: layout style; }
|
|
52
72
|
#stage { position: absolute; inset: 0; }
|
|
@@ -57,7 +77,7 @@ const TEMPLATE = `<style>
|
|
|
57
77
|
*
|
|
58
78
|
* Attributes: `body` (a name, such as `jupiter`), `look` (`line`, `realistic` or `painted`), `size` (pixels across), `time` (`now` or an ISO date: the body as the Earth sees it then; leave it out for a portrait),
|
|
59
79
|
* `tilt`, `pitch`, `phase` and `meridian` (a portrait's pose, degrees), `turn` (a portrait turns this many degrees a second), `rate` (simulated seconds for each real second), `moons` (draw the planet's moons on their orbits),
|
|
60
|
-
* `range` (planet radii the moons picture reaches), `scale-to` (draw to scale with another body), `live` (`always`, `hover` or `off`: when it takes the page's one WebGL context), `texture-base` (where the surface pictures are) and `lang` (`en` or `ja`).
|
|
80
|
+
* `range` (planet radii the moons picture reaches), `scale-to` (draw to scale with another body), `span-km` (draw to scale: the half-width of the picture in kilometres, the same in every picture of a lineup), `live` (`always`, `hover` or `off`: when it takes the page's one WebGL context), `texture-base` (where the surface pictures are) and `lang` (`en` or `ja`).
|
|
61
81
|
*
|
|
62
82
|
* @example
|
|
63
83
|
* ```ts no-run
|
|
@@ -71,7 +91,7 @@ const TEMPLATE = `<style>
|
|
|
71
91
|
* ```
|
|
72
92
|
*/
|
|
73
93
|
export class WakuseiBody extends HTMLElement {
|
|
74
|
-
static observedAttributes = ["body", "look", "size", "time", "tilt", "pitch", "phase", "meridian", "turn", "rate", "moons", "range", "scale-to", "live", "texture-base", "lang", "labels"];
|
|
94
|
+
static observedAttributes = ["body", "look", "size", "time", "tilt", "pitch", "phase", "meridian", "turn", "rate", "moons", "range", "scale-to", "span-km", "live", "texture-base", "texture-far-base", "lang", "labels"];
|
|
75
95
|
#stage;
|
|
76
96
|
#state = "line";
|
|
77
97
|
#renderer;
|
|
@@ -197,10 +217,6 @@ export class WakuseiBody extends HTMLElement {
|
|
|
197
217
|
if (this.look === "line")
|
|
198
218
|
return false;
|
|
199
219
|
this.#wantLive = true;
|
|
200
|
-
if (delegates.has(this.body)) {
|
|
201
|
-
await this.#delegated(delegates.get(this.body));
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
220
|
await this.#ensureView();
|
|
205
221
|
const ok = (await this.#view?.focus()) === true;
|
|
206
222
|
if (ok) {
|
|
@@ -215,10 +231,6 @@ export class WakuseiBody extends HTMLElement {
|
|
|
215
231
|
/** Give the WebGL context back: the picture stays as a still. */
|
|
216
232
|
rest() {
|
|
217
233
|
this.#wantLive = false;
|
|
218
|
-
if (delegates.has(this.body)) {
|
|
219
|
-
this.#queue(true);
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
234
|
this.#stopTick();
|
|
223
235
|
if (this.#view !== undefined) {
|
|
224
236
|
this.#view.blur();
|
|
@@ -228,7 +240,7 @@ export class WakuseiBody extends HTMLElement {
|
|
|
228
240
|
}
|
|
229
241
|
}
|
|
230
242
|
}
|
|
231
|
-
/** The shared controllers' camera: `yaw` turns the body about its pole, `tilt` tips its
|
|
243
|
+
/** The shared controllers' camera: `yaw` turns the body about its pole, `tilt` tips its top away from you as it grows (a drag up moves the surface up), `zoom` and the pan move the picture. */
|
|
232
244
|
setView(view) {
|
|
233
245
|
this.#yaw = view.yaw ?? 0;
|
|
234
246
|
this.#tilt = view.tilt ?? 0;
|
|
@@ -268,7 +280,7 @@ export class WakuseiBody extends HTMLElement {
|
|
|
268
280
|
// --- the state of the scene --------------------------------------------------------------------------------------------------------------------
|
|
269
281
|
#sceneOf(frame) {
|
|
270
282
|
let { pole, meridian, light } = frame.pose;
|
|
271
|
-
const tiltBy = this.#
|
|
283
|
+
const tiltBy = this.#pitchDelta - this.#tilt;
|
|
272
284
|
if (this.#yaw !== 0)
|
|
273
285
|
meridian = turnVec(meridian, pole, this.#yaw);
|
|
274
286
|
if (tiltBy !== 0) {
|
|
@@ -280,7 +292,8 @@ export class WakuseiBody extends HTMLElement {
|
|
|
280
292
|
const r = this.#request();
|
|
281
293
|
const scaleTo = this.getAttribute("scale-to");
|
|
282
294
|
const range = this.hasAttribute("range") ? num(this.getAttribute("range"), 0) : undefined;
|
|
283
|
-
const
|
|
295
|
+
const span = num(this.getAttribute("span-km"), 0);
|
|
296
|
+
const extent = extentOf(this.body, { ...(span > 0 ? { spanKm: span } : {}), ...(scaleTo !== null && scaleTo in BODIES ? { scaleTo } : {}), moons: r.moons, ...(range !== undefined && range > 0 ? { range } : {}) });
|
|
284
297
|
const moons = r.moons
|
|
285
298
|
? frame.moons
|
|
286
299
|
.filter((m) => m.distance <= extent * 1.05)
|
|
@@ -290,7 +303,7 @@ export class WakuseiBody extends HTMLElement {
|
|
|
290
303
|
return { id: m.id, x: rotated[0], y: rotated[1], z: rotated[2], ...(orbit !== undefined ? { orbit: tiltBy === 0 ? orbit : this.#tiltedOrbit(m.id, orbit, tiltBy) } : {}) };
|
|
291
304
|
})
|
|
292
305
|
: undefined;
|
|
293
|
-
return { pose: { pole, meridian, light }, extent, zoom: this.#zoom, panX: this.#panX, panY: this.#panY, ...(moons !== undefined ? { moons } : {}) };
|
|
306
|
+
return { pose: { pole, meridian, light }, extent, zoom: this.#zoom, panX: clampPan(this.#panX, extent, this.#zoom), panY: clampPan(this.#panY, extent, this.#zoom), ...(moons !== undefined ? { moons } : {}) };
|
|
294
307
|
}
|
|
295
308
|
#tilted = new Map();
|
|
296
309
|
#tiltedOrbit(id, orbit, tilt) {
|
|
@@ -347,7 +360,7 @@ export class WakuseiBody extends HTMLElement {
|
|
|
347
360
|
this.setAttribute("aria-label", this.#label());
|
|
348
361
|
if (this.hasAttribute("size"))
|
|
349
362
|
this.style.setProperty("--wakusei-size", `${num(this.getAttribute("size"), 320)}px`);
|
|
350
|
-
const delegate = delegates.get(this.body);
|
|
363
|
+
const delegate = this.look === "line" ? delegates.get(this.body) : undefined;
|
|
351
364
|
if (delegate !== undefined) {
|
|
352
365
|
await this.#delegated(delegate);
|
|
353
366
|
return;
|
|
@@ -429,12 +442,12 @@ export class WakuseiBody extends HTMLElement {
|
|
|
429
442
|
size,
|
|
430
443
|
pose: scene.pose,
|
|
431
444
|
...(r.moons ? { moons: true, ...(frame.time !== undefined ? { time: frame.time } : {}), range: scene.extent, moonsAt: (scene.moons ?? []).map((m) => ({ id: m.id, x: m.x, y: m.y, z: m.z, distance: Math.hypot(m.x, m.y, m.z) })), orbits: new Map((scene.moons ?? []).filter((m) => m.orbit !== undefined).map((m) => [m.id, m.orbit])) } : {}),
|
|
432
|
-
...(scaleTo !== null
|
|
445
|
+
...(scaleTo !== null || this.hasAttribute("span-km") ? { fill: this.#fill() } : {}),
|
|
433
446
|
...(this.getAttribute("lang") === "ja" ? { lang: "ja" } : {}),
|
|
434
447
|
...(this.getAttribute("labels") === "off" ? { labels: false } : {}),
|
|
435
448
|
...(stroke !== "" ? { stroke } : {}),
|
|
436
449
|
...(paper !== "" ? { paper } : {}),
|
|
437
|
-
...(this.#zoom !== 1 ? { zoom: this.#zoom, panX:
|
|
450
|
+
...(this.#zoom !== 1 ? { zoom: this.#zoom, panX: scene.panX, panY: scene.panY } : {}),
|
|
438
451
|
});
|
|
439
452
|
this.#stage.innerHTML = html;
|
|
440
453
|
}
|
|
@@ -471,6 +484,12 @@ export class WakuseiBody extends HTMLElement {
|
|
|
471
484
|
key: this.#viewKey,
|
|
472
485
|
state: () => this.#sceneState ?? state,
|
|
473
486
|
textureBase: base,
|
|
487
|
+
farBase: () => {
|
|
488
|
+
const own = this.getAttribute("texture-far-base");
|
|
489
|
+
if (own !== null && own !== "")
|
|
490
|
+
return own.endsWith("/") ? own : `${own}/`;
|
|
491
|
+
return this.hasAttribute("texture-base") ? base() : TEXTURE_FAR_BASE;
|
|
492
|
+
},
|
|
474
493
|
wantedWidth: (discPx) => discPx * Math.min(2, window.devicePixelRatio || 1) * 1.6,
|
|
475
494
|
redraw: () => this.#view?.invalidate(),
|
|
476
495
|
report: (note) => {
|
|
@@ -486,30 +505,34 @@ export class WakuseiBody extends HTMLElement {
|
|
|
486
505
|
if (this.#visible)
|
|
487
506
|
this.#still();
|
|
488
507
|
}
|
|
489
|
-
/** A body another package draws (the Earth
|
|
508
|
+
/** A body whose line look another package draws (the Earth's globe with its countries). It is drawn at the body's size in a scale picture, never larger than the picture. */
|
|
490
509
|
async #delegated(delegate) {
|
|
491
510
|
if (this.#view !== undefined) {
|
|
492
511
|
this.#view.dispose();
|
|
493
512
|
this.#view = undefined;
|
|
494
513
|
this.#viewKey = "";
|
|
495
514
|
}
|
|
496
|
-
const shaded = this.look !== "line" && (this.#wantLive || (this.#hasPriority() && (this.getAttribute("live") ?? "always") === "always"));
|
|
497
|
-
const kind = shaded ? "live" : "line";
|
|
498
|
-
const time = this.#start === undefined ? "now" : new Date(this.#start).toISOString();
|
|
499
|
-
const base = this.getAttribute("texture-base");
|
|
500
515
|
const center = this.hasAttribute("meridian") ? `${num(this.getAttribute("meridian"), 10)},20` : "10,20";
|
|
501
|
-
const
|
|
516
|
+
const size = Math.round(this.clientWidth || 320);
|
|
517
|
+
const fill = this.#fill();
|
|
518
|
+
const key = `line|${center}|${fill}`;
|
|
502
519
|
if (this.#delegateEl !== undefined && this.#delegateKind === key)
|
|
503
520
|
return;
|
|
504
|
-
const
|
|
505
|
-
const el = kind === "live" ? await delegate.live({ center, time, textureBase: base }) : await delegate.line({ center, size });
|
|
521
|
+
const el = await delegate.line({ center, size });
|
|
506
522
|
this.#delegateEl?.remove();
|
|
507
523
|
this.#stage.innerHTML = "";
|
|
508
|
-
el.style.cssText =
|
|
524
|
+
el.style.cssText = `display:block;width:${fill * 100}%;height:${fill * 100}%;aspect-ratio:1;position:absolute;left:${(1 - fill) * 50}%;top:${(1 - fill) * 50}%`;
|
|
509
525
|
this.#stage.append(el);
|
|
510
526
|
this.#delegateEl = el;
|
|
511
527
|
this.#delegateKind = key;
|
|
512
|
-
this.#set(
|
|
528
|
+
this.#set("line");
|
|
529
|
+
}
|
|
530
|
+
/** How much of the picture's width the body's disc takes: 1 alone, less in a scale picture (`scale-to`, `span-km`). */
|
|
531
|
+
#fill() {
|
|
532
|
+
const scaleTo = this.getAttribute("scale-to");
|
|
533
|
+
const span = num(this.getAttribute("span-km"), 0);
|
|
534
|
+
const half = span > 0 ? span : scaleTo !== null && scaleTo in BODIES ? BODIES[scaleTo].radiusKm * 1.06 : 0;
|
|
535
|
+
return half > 0 ? Math.max(0.01, Math.min(1, BODIES[this.body].radiusKm / half)) : 1;
|
|
513
536
|
}
|
|
514
537
|
/** Make the view's still, once, when it is in sight. */
|
|
515
538
|
#still() {
|
package/dist/facts.js
CHANGED
|
@@ -110,7 +110,7 @@ export const BODIES = {
|
|
|
110
110
|
],
|
|
111
111
|
}),
|
|
112
112
|
jupiter: f("jupiter", "planet", "Jupiter", "木星", 71492, 0.06487, 3.13, 268.056595, 64.495303, 284.95, 870.536, 9.925, "#d9b48a", {
|
|
113
|
-
showLon: -
|
|
113
|
+
showLon: -48,
|
|
114
114
|
features: [...bandsAt([62, 48, 35, 22, 8, -8, -22, -34, -48, -62]), { kind: "oval", lon: 20, lat: -22, rx: 12, ry: 6 }, { kind: "oval", lon: -70, lat: -33, rx: 3, ry: 2 }],
|
|
115
115
|
}),
|
|
116
116
|
saturn: f("saturn", "planet", "Saturn", "土星", 60268, 0.09796, 26.73, 40.589, 83.537, 38.9, 810.7939024, 10.656, "#e4d09c", {
|
|
@@ -119,7 +119,7 @@ export const BODIES = {
|
|
|
119
119
|
}),
|
|
120
120
|
uranus: f("uranus", "planet", "Uranus", "天王星", 25559, 0.02293, 97.77, 257.311, -15.175, 203.81, -501.1600928, -17.24, "#a9e0e5", { rings: URANUS_RINGS, features: bandsAt([62, 38, 14, -14, -38]) }),
|
|
121
121
|
neptune: f("neptune", "planet", "Neptune", "海王星", 24764, 0.01708, 28.32, 299.36, 43.46, 249.978, 541.1397757, 16.11, "#4a6ee0", {
|
|
122
|
-
showLon: -
|
|
122
|
+
showLon: -30,
|
|
123
123
|
features: [...bandsAt([58, 34, 10, -14, -38, -60]), { kind: "oval", lon: -20, lat: -22, rx: 12, ry: 6 }, { kind: "oval", lon: 45, lat: -42, rx: 5, ry: 2.5 }],
|
|
124
124
|
}),
|
|
125
125
|
pluto: f("pluto", "dwarf-planet", "Pluto", "冥王星", 1188.3, 0, 122.53, 132.993, -6.163, 302.695, 56.3625225, -153.2935, "#c9a98a", {
|
package/dist/scene/body.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Pose } from "../ephemeris.ts";
|
|
|
4
4
|
import { type BodyFacts, type BodyId } from "../facts.ts";
|
|
5
5
|
import { type BodyLook } from "./look.ts";
|
|
6
6
|
/** The parts of three.js the bodies use: a page may hand over a module with only these (see `setThreeLoader`). */
|
|
7
|
-
export type ThreeParts = Pick<typeof THREE, "AdditiveBlending" | "BufferAttribute" | "BufferGeometry" | "ClampToEdgeWrapping" | "DataTexture" | "DoubleSide" | "Line" | "LineBasicMaterial" | "LinearFilter" | "Mesh" | "NoColorSpace" | "OrthographicCamera" | "PlaneGeometry" | "RGBAFormat" | "RingGeometry" | "Scene" | "ShaderMaterial" | "SphereGeometry" | "TextureLoader" | "Vector2" | "Vector3" | "WebGLRenderer">;
|
|
7
|
+
export type ThreeParts = Pick<typeof THREE, "AdditiveBlending" | "BufferAttribute" | "BufferGeometry" | "ClampToEdgeWrapping" | "DataTexture" | "DoubleSide" | "Line" | "LineBasicMaterial" | "LinearFilter" | "Mesh" | "NoColorSpace" | "OrthographicCamera" | "PlaneGeometry" | "RepeatWrapping" | "RGBAFormat" | "RingGeometry" | "Scene" | "ShaderMaterial" | "SphereGeometry" | "TextureLoader" | "Vector2" | "Vector3" | "WebGLRenderer">;
|
|
8
8
|
/** One moon in a system view: its place in planet radii (viewer's frame) and the points of its orbit, if they changed. */
|
|
9
9
|
export interface MoonDraw {
|
|
10
10
|
id: BodyId;
|
|
@@ -43,6 +43,8 @@ export interface BodyItemOptions {
|
|
|
43
43
|
state(): SceneState;
|
|
44
44
|
/** Where the pictures are: a folder address that ends in a slash. */
|
|
45
45
|
textureBase(): string;
|
|
46
|
+
/** Where the widths from `painted.far` up are: a folder address that ends in a slash. */
|
|
47
|
+
farBase(): string;
|
|
46
48
|
/** The widest texture worth fetching for a disc this many CSS pixels across (the element's call). */
|
|
47
49
|
wantedWidth(discPx: number): number;
|
|
48
50
|
/** The scene asks for a redraw when a sharper picture arrives. */
|
package/dist/scene/body.js
CHANGED
|
@@ -52,7 +52,7 @@ export function createBodyItem(options) {
|
|
|
52
52
|
key: options.key,
|
|
53
53
|
async build({ three: T, assets, width, height }) {
|
|
54
54
|
const look = lookOf(options.id) ?? fallbackLook(facts);
|
|
55
|
-
const wantPainted = options.look === "painted" && look.painted !== undefined;
|
|
55
|
+
const wantPainted = (options.look === "painted" || look.mapped === true) && look.painted !== undefined;
|
|
56
56
|
const geometry = assets.acquire("wk:sphere", () => new T.SphereGeometry(1, 128, 64), (g) => g.dispose());
|
|
57
57
|
const shader = assets.acquire(`wk:body:${options.id}:r`, () => makeBodyMaterial(T, look, false), (m) => m.dispose());
|
|
58
58
|
const paintedMaterial = wantPainted ? assets.acquire(`wk:body:${options.id}:p`, () => makeBodyMaterial(T, look, true), (m) => m.dispose()) : undefined;
|
|
@@ -62,28 +62,56 @@ export function createBodyItem(options) {
|
|
|
62
62
|
const mesh = new T.Mesh(geometry, shader);
|
|
63
63
|
mesh.frustumCulled = false;
|
|
64
64
|
scene.add(mesh);
|
|
65
|
-
// rings
|
|
66
|
-
const
|
|
65
|
+
// rings: a picture of them when the look has one (painted), else the table's strip
|
|
66
|
+
const loadImage = (url) => new Promise((resolve, reject) => {
|
|
67
|
+
const loader = new T.TextureLoader();
|
|
68
|
+
loader.setCrossOrigin("anonymous");
|
|
69
|
+
loader.load(url, (t) => resolve(t), undefined, (e) => reject(e instanceof Error ? e : new Error("texture failed")));
|
|
70
|
+
});
|
|
71
|
+
const table = ringStrip(facts, 1024);
|
|
72
|
+
const photo = wantPainted && table !== null ? look.painted?.rings : undefined;
|
|
73
|
+
let photoTexture;
|
|
74
|
+
if (photo !== undefined) {
|
|
75
|
+
try {
|
|
76
|
+
photoTexture = await loadImage(`${options.textureBase()}${photo.map}-${photo.width}.webp`);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
photoTexture = undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const ringInner = photo !== undefined && photoTexture !== undefined ? photo.from / facts.radiusKm : (table?.inner ?? 1);
|
|
83
|
+
const ringOuter = photo !== undefined && photoTexture !== undefined ? photo.to / facts.radiusKm : (table?.outer ?? 2);
|
|
84
|
+
const ringKey = photoTexture !== undefined ? `${options.id}:p` : options.id;
|
|
67
85
|
let ringMesh;
|
|
68
86
|
let ringTexture;
|
|
69
87
|
let ringMaterial;
|
|
70
|
-
if (
|
|
71
|
-
ringTexture = assets.acquire(`wk:ringtex:${
|
|
72
|
-
|
|
88
|
+
if (table !== null && look.emissive !== true) {
|
|
89
|
+
ringTexture = assets.acquire(`wk:ringtex:${ringKey}`, () => {
|
|
90
|
+
if (photoTexture !== undefined) {
|
|
91
|
+
photoTexture.magFilter = T.LinearFilter;
|
|
92
|
+
photoTexture.minFilter = T.LinearFilter;
|
|
93
|
+
photoTexture.generateMipmaps = false;
|
|
94
|
+
photoTexture.wrapS = T.ClampToEdgeWrapping;
|
|
95
|
+
photoTexture.colorSpace = T.NoColorSpace;
|
|
96
|
+
return photoTexture;
|
|
97
|
+
}
|
|
98
|
+
const tex = new T.DataTexture(table.data, table.width, 1, T.RGBAFormat);
|
|
73
99
|
tex.magFilter = T.LinearFilter;
|
|
74
100
|
tex.minFilter = T.LinearFilter;
|
|
75
101
|
tex.wrapS = T.ClampToEdgeWrapping;
|
|
76
102
|
tex.needsUpdate = true;
|
|
77
103
|
return tex;
|
|
78
104
|
}, (t) => t.dispose());
|
|
79
|
-
|
|
80
|
-
|
|
105
|
+
if (photoTexture !== undefined && ringTexture !== photoTexture)
|
|
106
|
+
photoTexture.dispose();
|
|
107
|
+
const ringGeometry = assets.acquire(`wk:ring:${ringKey}`, () => new T.RingGeometry(ringInner, ringOuter, 256, 1), (g) => g.dispose());
|
|
108
|
+
ringMaterial = assets.acquire(`wk:ringmat:${ringKey}`, () => new T.ShaderMaterial({
|
|
81
109
|
vertexShader: RING_VERTEX,
|
|
82
110
|
fragmentShader: RING_FRAGMENT,
|
|
83
111
|
side: T.DoubleSide,
|
|
84
112
|
transparent: true,
|
|
85
113
|
depthWrite: false,
|
|
86
|
-
uniforms: { uRingTex: { value: ringTexture }, uRingR: { value: new T.Vector2(
|
|
114
|
+
uniforms: { uRingTex: { value: ringTexture }, uRingR: { value: new T.Vector2(ringInner, ringOuter) }, uLight: { value: new T.Vector3(0, 0, 1) }, uRingN: { value: new T.Vector3(0, 1, 0) } },
|
|
87
115
|
}), (m) => m.dispose());
|
|
88
116
|
ringMesh = new T.Mesh(ringGeometry, ringMaterial);
|
|
89
117
|
ringMesh.frustumCulled = false;
|
|
@@ -111,14 +139,15 @@ export function createBodyItem(options) {
|
|
|
111
139
|
let texture;
|
|
112
140
|
let loading = false;
|
|
113
141
|
let failed = false;
|
|
142
|
+
const tried = new Set();
|
|
114
143
|
let latest = options.state();
|
|
115
|
-
const loadTexture = (w) =>
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
144
|
+
const loadTexture = (w) => {
|
|
145
|
+
const far = look.painted.far !== undefined && w >= look.painted.far;
|
|
146
|
+
return loadImage(`${far ? options.farBase() : options.textureBase()}${look.painted.map}-${w}.webp`);
|
|
147
|
+
};
|
|
120
148
|
const use = (t, w) => {
|
|
121
149
|
t.anisotropy = 4;
|
|
150
|
+
t.wrapS = T.RepeatWrapping;
|
|
122
151
|
t.colorSpace = T.NoColorSpace;
|
|
123
152
|
const previous = texture;
|
|
124
153
|
texture = t;
|
|
@@ -236,7 +265,7 @@ export function createBodyItem(options) {
|
|
|
236
265
|
orient(state);
|
|
237
266
|
frame(state);
|
|
238
267
|
place(state);
|
|
239
|
-
if (ringMaterial !== undefined
|
|
268
|
+
if (ringMaterial !== undefined) {
|
|
240
269
|
const light = v3(T, state.pose.light);
|
|
241
270
|
const pole = v3(T, state.pose.pole);
|
|
242
271
|
ringMaterial.uniforms.uLight.value.copy(light);
|
|
@@ -246,7 +275,7 @@ export function createBodyItem(options) {
|
|
|
246
275
|
continue;
|
|
247
276
|
mat.uniforms.uRingOn.value = 1;
|
|
248
277
|
mat.uniforms.uRingN.value.copy(pole);
|
|
249
|
-
mat.uniforms.uRingR.value.set(
|
|
278
|
+
mat.uniforms.uRingR.value.set(ringInner, ringOuter);
|
|
250
279
|
mat.uniforms.uRingTex.value = ringTexture;
|
|
251
280
|
}
|
|
252
281
|
}
|
|
@@ -260,7 +289,8 @@ export function createBodyItem(options) {
|
|
|
260
289
|
const discPx = (aspect >= 1 ? viewHeight : viewWidth) * (state.zoom / state.extent);
|
|
261
290
|
const wanted = options.wantedWidth(discPx);
|
|
262
291
|
const next = look.painted.widths.find((w) => w >= wanted) ?? look.painted.widths[look.painted.widths.length - 1];
|
|
263
|
-
if (next > textureWidth) {
|
|
292
|
+
if (next > textureWidth && !tried.has(next)) {
|
|
293
|
+
tried.add(next);
|
|
264
294
|
loading = true;
|
|
265
295
|
void loadTexture(next).then((t) => {
|
|
266
296
|
loading = false;
|
package/dist/scene/look.d.ts
CHANGED
|
@@ -33,8 +33,17 @@ export interface PaintedMap {
|
|
|
33
33
|
map: string;
|
|
34
34
|
/** The widths made, smallest first: the smallest is drawn first and sharper ones are fetched when the view is zoomed in. */
|
|
35
35
|
widths: readonly number[];
|
|
36
|
+
/** The smallest width that is not in the npm package: it is fetched from the repository's own files (see `texture-far-base`). */
|
|
37
|
+
far?: number;
|
|
36
38
|
/** How much of the map's brightness is also relief. Default 0. */
|
|
37
39
|
relief?: number;
|
|
40
|
+
/** A picture of the body's rings for this look, one pixel high: colour and opacity from the inner edge to the outer, `width` samples. Used instead of the table's strip when it loads. */
|
|
41
|
+
rings?: {
|
|
42
|
+
map: string;
|
|
43
|
+
width: number;
|
|
44
|
+
from: number;
|
|
45
|
+
to: number;
|
|
46
|
+
};
|
|
38
47
|
/** The painted pictures' credit line, for the page. */
|
|
39
48
|
credit?: string;
|
|
40
49
|
}
|
|
@@ -65,6 +74,8 @@ export interface BodyLook {
|
|
|
65
74
|
/** How much of the night side shows (0 to 1). Default 0.04. */
|
|
66
75
|
ambient?: number;
|
|
67
76
|
painted?: PaintedMap;
|
|
77
|
+
/** Draw the painted map in the realistic look too: for a body with no honest drawing from numbers (the Earth's continents). */
|
|
78
|
+
mapped?: boolean;
|
|
68
79
|
}
|
|
69
80
|
/**
|
|
70
81
|
* Teach the package how to draw a body in three.js. Each body's entry point (`@johnmorrisdotca/wakusei-planets/jupiter`) calls this once as it loads; call it yourself to add or replace a look.
|
package/dist/scene/store.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { BodyId } from "../facts.ts";
|
|
2
2
|
import type { BodyLook } from "./look.ts";
|
|
3
|
-
/** A body
|
|
3
|
+
/** A body whose line look another package's element draws (the Earth, by chikyu-earth) instead of this one: the element asks it for what to show. The shaded and painted looks are always this package's. */
|
|
4
4
|
export interface Delegate {
|
|
5
5
|
/** The line look: an element for the body, centred on a longitude and latitude (`"lon,lat"`). */
|
|
6
6
|
line(options: {
|
|
7
7
|
center: string;
|
|
8
8
|
size: number;
|
|
9
9
|
}): Promise<HTMLElement>;
|
|
10
|
-
/** The shaded and painted looks, drawn live: an element lit by the Sun at `time` (`"now"` or an ISO date). */
|
|
11
|
-
live(options: {
|
|
12
|
-
center: string;
|
|
13
|
-
time: string;
|
|
14
|
-
textureBase: string | null;
|
|
15
|
-
}): Promise<HTMLElement>;
|
|
16
10
|
}
|
|
17
11
|
export declare const looks: Map<BodyId, BodyLook>, waiting: Set<() => void>, delegates: Map<BodyId, Delegate>;
|
|
18
12
|
/** Call `wake` whenever a look is registered; returns a function that stops it. */
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1
|
|
1
|
+
export declare const VERSION = "0.3.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1
|
|
1
|
+
export const VERSION = "0.3.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/wakusei-planets",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.3.1",
|
|
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",
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"node": ">=24"
|
|
161
161
|
},
|
|
162
162
|
"scripts": {
|
|
163
|
-
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
163
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json && node scripts/copy-textures.mjs",
|
|
164
164
|
"lint": "eslint .",
|
|
165
165
|
"typecheck": "tsc -p tsconfig.check.json && tsc -p tsconfig.tools.json && tsc -p tsconfig.demo.json",
|
|
166
166
|
"test": "node --test test/*.test.ts",
|
|
@@ -168,6 +168,7 @@
|
|
|
168
168
|
"check": "pnpm lint && pnpm typecheck && pnpm test && pnpm build && node scripts/check-package.ts",
|
|
169
169
|
"prepublishOnly": "pnpm check",
|
|
170
170
|
"family:readme": "node scripts/family-readme.mjs",
|
|
171
|
+
"readme:images": "node scripts/readme-images.mjs",
|
|
171
172
|
"site": "pnpm build && node scripts/site.ts",
|
|
172
173
|
"dev": "pnpm site && node scripts/dev.ts",
|
|
173
174
|
"test:demo": "pnpm site && node scripts/docs-site.mjs build && playwright test --project=chromium-desk --project=chromium-phone --project=webkit-desk --project=webkit-phone",
|
|
@@ -186,7 +187,7 @@
|
|
|
186
187
|
"@angular/core": "^22.2.4",
|
|
187
188
|
"@angular/platform-browser": "^22.2.4",
|
|
188
189
|
"@eslint/js": "^9.0.0",
|
|
189
|
-
"@johnmorrisdotca/chikyu-earth": "^0.
|
|
190
|
+
"@johnmorrisdotca/chikyu-earth": "^0.10.0",
|
|
190
191
|
"@playwright/test": "1.64.0",
|
|
191
192
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
192
193
|
"@types/node": "^24.0.0",
|
|
@@ -220,7 +221,7 @@
|
|
|
220
221
|
},
|
|
221
222
|
"peerDependencies": {
|
|
222
223
|
"three": ">=0.160.0",
|
|
223
|
-
"@johnmorrisdotca/chikyu-earth": ">=0.
|
|
224
|
+
"@johnmorrisdotca/chikyu-earth": ">=0.10.0"
|
|
224
225
|
},
|
|
225
226
|
"peerDependenciesMeta": {
|
|
226
227
|
"three": {
|