@johnmorrisdotca/wakusei-planets 0.20.0 → 0.22.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 +17 -0
- package/NOTICE.md +27 -1
- package/README.md +36 -6
- package/dist/bodies/earth.js +13 -5
- package/dist/calendar.js +7 -6
- package/dist/clock.js +5 -6
- package/dist/coordinates.d.ts +7 -12
- package/dist/coordinates.js +19 -18
- package/dist/craft/cassini.d.ts +1 -0
- package/dist/craft/cassini.js +1131 -0
- package/dist/craft/galileo.d.ts +1 -0
- package/dist/craft/galileo.js +224 -0
- package/dist/craft/juno.d.ts +1 -0
- package/dist/craft/juno.js +640 -0
- package/dist/craft/newhorizons.d.ts +1 -0
- package/dist/craft/newhorizons.js +18 -0
- package/dist/craft/parker.d.ts +1 -0
- package/dist/craft/parker.js +221 -0
- package/dist/craft/pioneer10.d.ts +1 -0
- package/dist/craft/pioneer10.js +24 -0
- package/dist/craft/pioneer11.d.ts +1 -0
- package/dist/craft/pioneer11.js +34 -0
- package/dist/craft/voyager1.d.ts +1 -0
- package/dist/craft/voyager1.js +28 -0
- package/dist/craft/voyager2.d.ts +1 -0
- package/dist/craft/voyager2.js +43 -0
- package/dist/craft/webb.d.ts +1 -0
- package/dist/craft/webb.js +28 -0
- package/dist/data/craft.d.ts +23 -0
- package/dist/data/craft.js +53 -0
- package/dist/data/galilean.d.ts +15 -0
- package/dist/data/galilean.js +7 -0
- package/dist/data/orbits.js +25 -25
- package/dist/data/stars.d.ts +4 -0
- package/dist/data/stars.js +5088 -0
- package/dist/data/tass17.d.ts +17 -0
- package/dist/data/tass17.js +10 -0
- package/dist/data/theories.d.ts +64 -0
- package/dist/data/theories.js +70 -0
- package/dist/data/vsop.js +2 -2
- package/dist/element.d.ts +3 -24
- package/dist/element.js +92 -112
- package/dist/ephemeris.d.ts +20 -0
- package/dist/ephemeris.js +57 -22
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/portrait/element.d.ts +1 -0
- package/dist/portrait/element.js +27 -39
- package/dist/scene/basis.d.ts +3 -0
- package/dist/scene/basis.js +4 -0
- package/dist/scene/body.d.ts +2 -4
- package/dist/scene/body.js +55 -67
- package/dist/scene/fallback.d.ts +4 -0
- package/dist/scene/fallback.js +5 -0
- package/dist/scene/painter.js +10 -23
- package/dist/scene/store.d.ts +2 -2
- package/dist/scene/textures.d.ts +30 -0
- package/dist/scene/textures.js +47 -0
- package/dist/sidereal.d.ts +4 -0
- package/dist/sidereal.js +15 -9
- package/dist/sky/engine.d.ts +6 -15
- package/dist/sky/engine.js +9 -38
- package/dist/sky/frames.d.ts +3 -0
- package/dist/sky/frames.js +26 -0
- package/dist/sky/types.d.ts +20 -0
- package/dist/sky/types.js +1 -0
- package/dist/space/aim.d.ts +18 -0
- package/dist/space/aim.js +28 -0
- package/dist/space/element.d.ts +212 -0
- package/dist/space/element.js +524 -0
- package/dist/space/frame.d.ts +152 -0
- package/dist/space/frame.js +169 -0
- package/dist/space/index.d.ts +4 -0
- package/dist/space/index.js +5 -0
- package/dist/space/ride.d.ts +89 -0
- package/dist/space/ride.js +58 -0
- package/dist/space/scale.d.ts +126 -0
- package/dist/space/scale.js +139 -0
- package/dist/space/scene.d.ts +189 -0
- package/dist/space/scene.js +422 -0
- package/dist/spacecraft-facts.d.ts +114 -0
- package/dist/spacecraft-facts.js +215 -0
- package/dist/spacecraft.d.ts +134 -0
- package/dist/spacecraft.js +198 -0
- package/dist/stars.d.ts +160 -0
- package/dist/stars.js +193 -0
- package/dist/suncalc.js +4 -10
- package/dist/tables/all.d.ts +2 -0
- package/dist/tables/all.js +2 -0
- package/dist/tables/galilean.d.ts +1 -0
- package/dist/tables/galilean.js +4 -0
- package/dist/tables/lazy.d.ts +2 -0
- package/dist/tables/lazy.js +15 -0
- package/dist/tables/saturn-moons.d.ts +1 -0
- package/dist/tables/saturn-moons.js +4 -0
- package/dist/tables/vsop.d.ts +1 -0
- package/dist/tables/vsop.js +11 -0
- package/dist/theories/galilean.d.ts +7 -0
- package/dist/theories/galilean.js +78 -0
- package/dist/theories/tass17.d.ts +7 -0
- package/dist/theories/tass17.js +90 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/when.js +6 -11
- package/package.json +68 -4
package/dist/portrait/element.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { BODIES } from "../facts.js";
|
|
2
2
|
import { createGate, frameCap } from "../gate.js";
|
|
3
3
|
import { setThreeLoader, takeRenderer } from "../scene/shared.js";
|
|
4
|
-
|
|
4
|
+
// /portrait has always registered the body element as well.
|
|
5
|
+
import "../element.js";
|
|
6
|
+
import { texturePaths } from "../scene/textures.js";
|
|
5
7
|
import { backgroundCss, drawShapes, lineScene, paintBackground, shapesOf, shapesSvg, starfield } from "./overlay.js";
|
|
6
8
|
import { decodeScene, defaultPortrait, encodeScene, fromScreen, hitTest, resolve, toScreen } from "./model.js";
|
|
7
9
|
import { REDUCED_TURN } from "../live.js";
|
|
@@ -151,15 +153,8 @@ export class WakuseiPortrait extends HTMLElement {
|
|
|
151
153
|
this.#stopTick();
|
|
152
154
|
this.#io?.disconnect();
|
|
153
155
|
document.removeEventListener("visibilitychange", this.#onHidden);
|
|
154
|
-
this
|
|
155
|
-
this
|
|
156
|
-
this.removeEventListener("pointerdown", this.#hover);
|
|
157
|
-
this.#view?.dispose();
|
|
158
|
-
this.#view = undefined;
|
|
159
|
-
this.#viewKey = "";
|
|
160
|
-
this.#release?.();
|
|
161
|
-
this.#release = undefined;
|
|
162
|
-
this.#renderer = undefined;
|
|
156
|
+
this.#applyHover(false);
|
|
157
|
+
this.#disposeView(true);
|
|
163
158
|
}
|
|
164
159
|
attributeChangedCallback(name) {
|
|
165
160
|
if (!this.isConnected)
|
|
@@ -313,14 +308,8 @@ export class WakuseiPortrait extends HTMLElement {
|
|
|
313
308
|
this.setAttribute("aria-label", this.#label());
|
|
314
309
|
const wants3d = p.look !== "line" && this.#state !== "unavailable" && p.items.length > 0;
|
|
315
310
|
if (!wants3d) {
|
|
316
|
-
if (this.#view !== undefined)
|
|
317
|
-
this.#
|
|
318
|
-
this.#view = undefined;
|
|
319
|
-
this.#viewKey = "";
|
|
320
|
-
this.#release?.();
|
|
321
|
-
this.#release = undefined;
|
|
322
|
-
this.#renderer = undefined;
|
|
323
|
-
}
|
|
311
|
+
if (this.#view !== undefined)
|
|
312
|
+
this.#disposeView(true);
|
|
324
313
|
this.#drawLine();
|
|
325
314
|
if (p.look === "line" || p.items.length === 0)
|
|
326
315
|
this.#set("line");
|
|
@@ -352,14 +341,13 @@ export class WakuseiPortrait extends HTMLElement {
|
|
|
352
341
|
#priority() {
|
|
353
342
|
return (this.getAttribute("live") ?? "always") === "always" && this.#visible;
|
|
354
343
|
}
|
|
355
|
-
#applyHover() {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
if ((this.getAttribute("live") ?? "always") === "hover") {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
this.addEventListener("pointerdown", this.#hover);
|
|
344
|
+
#applyHover(allow = true) {
|
|
345
|
+
const events = ["pointerenter", "focusin", "pointerdown"];
|
|
346
|
+
for (const name of events)
|
|
347
|
+
this.removeEventListener(name, this.#hover);
|
|
348
|
+
if (allow && (this.getAttribute("live") ?? "always") === "hover") {
|
|
349
|
+
for (const name of events)
|
|
350
|
+
this.addEventListener(name, this.#hover);
|
|
363
351
|
}
|
|
364
352
|
}
|
|
365
353
|
#poses() {
|
|
@@ -388,6 +376,17 @@ export class WakuseiPortrait extends HTMLElement {
|
|
|
388
376
|
const { width } = this.#size();
|
|
389
377
|
return `${encodeScene(this.#portrait)}|${width}`;
|
|
390
378
|
}
|
|
379
|
+
// Replacing a view keeps the renderer lease; leaving 3D gives it back.
|
|
380
|
+
#disposeView(releaseRenderer = false) {
|
|
381
|
+
this.#view?.dispose();
|
|
382
|
+
this.#view = undefined;
|
|
383
|
+
this.#viewKey = "";
|
|
384
|
+
if (releaseRenderer) {
|
|
385
|
+
this.#release?.();
|
|
386
|
+
this.#release = undefined;
|
|
387
|
+
this.#renderer = undefined;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
391
390
|
async #ensureView() {
|
|
392
391
|
if (this.#renderer === undefined) {
|
|
393
392
|
const taken = takeRenderer(this.#onContext);
|
|
@@ -401,20 +400,10 @@ export class WakuseiPortrait extends HTMLElement {
|
|
|
401
400
|
this.#viewKey = this.#key();
|
|
402
401
|
this.#stilled = false;
|
|
403
402
|
this.#stage.innerHTML = "";
|
|
404
|
-
const base = () => {
|
|
405
|
-
const own = this.getAttribute("texture-base");
|
|
406
|
-
return own === null || own === "" ? TEXTURE_BASE : own.endsWith("/") ? own : `${own}/`;
|
|
407
|
-
};
|
|
408
403
|
const item = createPortraitItem({
|
|
409
404
|
key: this.#viewKey,
|
|
410
405
|
state: () => this.#draw(),
|
|
411
|
-
|
|
412
|
-
farBase: () => {
|
|
413
|
-
const own = this.getAttribute("texture-far-base");
|
|
414
|
-
if (own !== null && own !== "")
|
|
415
|
-
return own.endsWith("/") ? own : `${own}/`;
|
|
416
|
-
return this.hasAttribute("texture-base") ? base() : TEXTURE_FAR_BASE;
|
|
417
|
-
},
|
|
406
|
+
...texturePaths(this),
|
|
418
407
|
redraw: () => this.#view?.invalidate(),
|
|
419
408
|
});
|
|
420
409
|
this.#view = this.#renderer.view(this.#stage, item);
|
|
@@ -436,8 +425,7 @@ export class WakuseiPortrait extends HTMLElement {
|
|
|
436
425
|
return;
|
|
437
426
|
if (this.#key() === this.#viewKey)
|
|
438
427
|
return;
|
|
439
|
-
this.#
|
|
440
|
-
this.#view = undefined;
|
|
428
|
+
this.#disposeView();
|
|
441
429
|
this.#makeView();
|
|
442
430
|
}
|
|
443
431
|
#sync() {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// The axes are already numeric triples; do not allocate Vector3 objects every frame.
|
|
2
|
+
export function writeBasis(matrix, x, y, z, sx = 1, sy = 1, sz = 1) {
|
|
3
|
+
return matrix.set(x[0] * sx, y[0] * sy, z[0] * sz, 0, x[1] * sx, y[1] * sy, z[1] * sz, 0, x[2] * sx, y[2] * sy, z[2] * sz, 0, 0, 0, 0, 1);
|
|
4
|
+
}
|
package/dist/scene/body.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Item3D, Scene3D } from "@johnmorrisdotca/kazoku-ui/renderer";
|
|
2
2
|
import type * as THREE from "three";
|
|
3
3
|
import type { Pose } from "../ephemeris.ts";
|
|
4
|
-
import { type
|
|
5
|
-
|
|
4
|
+
import { type BodyId } from "../facts.ts";
|
|
5
|
+
export { fallbackLook } from "./fallback.ts";
|
|
6
6
|
/** The parts of three.js the bodies use: a page may hand over a module with only these (see `setThreeLoader`). */
|
|
7
7
|
export type ThreeParts = Pick<typeof THREE, "AdditiveBlending" | "BufferAttribute" | "BufferGeometry" | "ClampToEdgeWrapping" | "DataTexture" | "DoubleSide" | "Group" | "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. */
|
|
@@ -58,8 +58,6 @@ export interface BodyItemOptions {
|
|
|
58
58
|
failed?: boolean;
|
|
59
59
|
}): void;
|
|
60
60
|
}
|
|
61
|
-
/** A body that has no registered look is still drawn: a lit ball in its mean colour. */
|
|
62
|
-
export declare function fallbackLook(facts: BodyFacts): BodyLook;
|
|
63
61
|
/**
|
|
64
62
|
* The shared-renderer item for a body: what `renderer.view(host, item)` shows. `state()` is read when the scene is built and `apply` moves it afterwards.
|
|
65
63
|
*
|
package/dist/scene/body.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { BODIES
|
|
1
|
+
import { BODIES } from "../facts.js";
|
|
2
2
|
import { cross } from "../vec.js";
|
|
3
3
|
import { BALL_FRAGMENT, bodyFragment, GLOW_FRAGMENT, GLOW_VERTEX, PAINTED_SURFACE, RING_FRAGMENT, RING_VERTEX, VERTEX } from "./glsl.js";
|
|
4
4
|
import { lookOf } from "./look.js";
|
|
5
|
+
import { fallbackLook } from "./fallback.js";
|
|
6
|
+
import { writeBasis } from "./basis.js";
|
|
7
|
+
import { loadImage } from "./textures.js";
|
|
5
8
|
import { ringStrip } from "./rings.js";
|
|
6
|
-
|
|
7
|
-
export function fallbackLook(facts) {
|
|
8
|
-
const c = [1, 3, 5].map((i) => (parseInt(facts.colour.slice(i, i + 2), 16) / 255).toFixed(3)).join(", ");
|
|
9
|
-
return { id: facts.id, surface: `vec4 surface(vec3 p) { float n = fbm(p * 5.0); return vec4(vec3(${c}) * (0.85 + 0.3 * n), 0.0); }` };
|
|
10
|
-
}
|
|
11
|
-
const col3 = (T, rgb) => new T.Vector3(rgb[0], rgb[1], rgb[2]);
|
|
12
|
-
const v3 = (T, v) => new T.Vector3(v[0], v[1], v[2]);
|
|
9
|
+
export { fallbackLook } from "./fallback.js";
|
|
13
10
|
function makeBodyMaterial(T, look, painted) {
|
|
14
11
|
const a = look.atmosphere;
|
|
15
12
|
return new T.ShaderMaterial({
|
|
@@ -21,7 +18,7 @@ function makeBodyMaterial(T, look, painted) {
|
|
|
21
18
|
uAmbient: { value: look.ambient ?? 0.04 },
|
|
22
19
|
uLimb: { value: look.limb ?? 0 },
|
|
23
20
|
uWrap: { value: look.wrap ?? (a === undefined ? 0.04 : 0.3) },
|
|
24
|
-
uAtmos: { value:
|
|
21
|
+
uAtmos: { value: new T.Vector3(...(a?.colour ?? [0, 0, 0])) },
|
|
25
22
|
uAtmosPow: { value: a?.power ?? 3 },
|
|
26
23
|
uRimBase: { value: 0.12 },
|
|
27
24
|
uEmissive: { value: look.emissive === true ? 1 : 0 },
|
|
@@ -35,11 +32,10 @@ function makeBodyMaterial(T, look, painted) {
|
|
|
35
32
|
});
|
|
36
33
|
}
|
|
37
34
|
/** Set an object's matrix from three axes (columns), without letting three.js overwrite it. */
|
|
38
|
-
function setBasis(
|
|
35
|
+
function setBasis(object, x, y, z, sx = 1, sy = 1, sz = 1) {
|
|
39
36
|
object.matrixAutoUpdate = false;
|
|
40
37
|
object.matrixWorldAutoUpdate = false;
|
|
41
|
-
object.
|
|
42
|
-
object.matrixWorld.copy(object.matrix);
|
|
38
|
+
object.matrixWorld.copy(writeBasis(object.matrix, x, y, z, sx, sy, sz));
|
|
43
39
|
}
|
|
44
40
|
/**
|
|
45
41
|
* The shared-renderer item for a body: what `renderer.view(host, item)` shows. `state()` is read when the scene is built and `apply` moves it afterwards.
|
|
@@ -58,6 +54,7 @@ export function createBodyItem(options) {
|
|
|
58
54
|
const geometry = assets.acquire("wk:sphere", () => new T.SphereGeometry(1, 128, 64), (g) => g.dispose());
|
|
59
55
|
const shader = assets.acquire(`wk:body:${options.id}:r`, () => makeBodyMaterial(T, look, false), (m) => m.dispose());
|
|
60
56
|
const paintedMaterial = wantPainted ? assets.acquire(`wk:body:${options.id}:p`, () => makeBodyMaterial(T, look, true), (m) => m.dispose()) : undefined;
|
|
57
|
+
const materials = paintedMaterial === undefined ? [shader] : [shader, paintedMaterial];
|
|
61
58
|
const baseWrap = look.wrap ?? (look.atmosphere === undefined ? 0.04 : 0.3);
|
|
62
59
|
const baseAmbient = look.ambient ?? 0.04;
|
|
63
60
|
const scene = new T.Scene();
|
|
@@ -67,17 +64,12 @@ export function createBodyItem(options) {
|
|
|
67
64
|
mesh.frustumCulled = false;
|
|
68
65
|
scene.add(mesh);
|
|
69
66
|
// rings: a picture of them when the look has one (painted), else the table's strip
|
|
70
|
-
const loadImage = (url) => new Promise((resolve, reject) => {
|
|
71
|
-
const loader = new T.TextureLoader();
|
|
72
|
-
loader.setCrossOrigin("anonymous");
|
|
73
|
-
loader.load(url, (t) => resolve(t), undefined, (e) => reject(e instanceof Error ? e : new Error("texture failed")));
|
|
74
|
-
});
|
|
75
67
|
const table = ringStrip(facts, 1024);
|
|
76
68
|
const photo = wantPainted && table !== null ? look.painted?.rings : undefined;
|
|
77
69
|
let photoTexture;
|
|
78
70
|
if (photo !== undefined) {
|
|
79
71
|
try {
|
|
80
|
-
photoTexture = await loadImage(`${options.textureBase()}${photo.map}-${photo.width}.webp`);
|
|
72
|
+
photoTexture = await loadImage(T, `${options.textureBase()}${photo.map}-${photo.width}.webp`);
|
|
81
73
|
}
|
|
82
74
|
catch {
|
|
83
75
|
photoTexture = undefined;
|
|
@@ -119,15 +111,16 @@ export function createBodyItem(options) {
|
|
|
119
111
|
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) } },
|
|
120
112
|
}), (m) => m.dispose());
|
|
121
113
|
// 0..pi is the +Y half. The basis maps local +Y onto +east.
|
|
122
|
-
const half = (key,
|
|
123
|
-
const geometry = assets.acquire(`wk:ring:${ringKey}:${key}`, () => new T.RingGeometry(ringInner, ringOuter, 128, 1,
|
|
114
|
+
const half = (key, depthTest) => {
|
|
115
|
+
const geometry = assets.acquire(`wk:ring:${ringKey}:${key}`, () => new T.RingGeometry(ringInner, ringOuter, 128, 1, 0, Math.PI), (g) => g.dispose());
|
|
124
116
|
const material = ringMaterial(key, depthTest);
|
|
125
117
|
const piece = new T.Mesh(geometry, material);
|
|
126
118
|
piece.frustumCulled = false;
|
|
119
|
+
piece.renderOrder = depthTest ? 1 : 2;
|
|
127
120
|
scene.add(piece);
|
|
128
121
|
return { mesh: piece, material };
|
|
129
122
|
};
|
|
130
|
-
ringHalves = [half("e",
|
|
123
|
+
ringHalves = [half("e", false), half("w", true)];
|
|
131
124
|
}
|
|
132
125
|
// the glow of a star
|
|
133
126
|
let glow;
|
|
@@ -146,6 +139,7 @@ export function createBodyItem(options) {
|
|
|
146
139
|
const orbitMaterial = new T.LineBasicMaterial({ color: 0x8fa1b8, transparent: true, opacity: 0.4 });
|
|
147
140
|
let viewWidth = width;
|
|
148
141
|
let viewHeight = height;
|
|
142
|
+
let aspect = viewWidth / Math.max(1, viewHeight);
|
|
149
143
|
// the picture
|
|
150
144
|
let textureWidth = 0;
|
|
151
145
|
let loading = false;
|
|
@@ -155,7 +149,7 @@ export function createBodyItem(options) {
|
|
|
155
149
|
let latest = options.state();
|
|
156
150
|
const loadTexture = (w) => {
|
|
157
151
|
const far = look.painted.far !== undefined && w >= look.painted.far;
|
|
158
|
-
return loadImage(`${far ? options.farBase() : options.textureBase()}${look.painted.map}-${w}.webp`);
|
|
152
|
+
return loadImage(T, `${far ? options.farBase() : options.textureBase()}${look.painted.map}-${w}.webp`);
|
|
159
153
|
};
|
|
160
154
|
const drop = (t) => {
|
|
161
155
|
t.dispose();
|
|
@@ -203,7 +197,7 @@ export function createBodyItem(options) {
|
|
|
203
197
|
const scaleX = ax ? ax[1] / mean : 1;
|
|
204
198
|
const scaleY = ax ? ax[2] / mean : 1 - facts.flattening;
|
|
205
199
|
const scaleZ = ax ? ax[0] / mean : 1;
|
|
206
|
-
setBasis(
|
|
200
|
+
setBasis(mesh, east, pole, meridian, scaleX, scaleY, scaleZ);
|
|
207
201
|
if (ringHalves !== undefined) {
|
|
208
202
|
const [near, far] = ringHalves;
|
|
209
203
|
// 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.
|
|
@@ -212,16 +206,11 @@ export function createBodyItem(options) {
|
|
|
212
206
|
const span = Math.hypot(zx, zy) || 1;
|
|
213
207
|
const toward = [(meridian[0] * zx + east[0] * zy) / span, (meridian[1] * zx + east[1] * zy) / span, (meridian[2] * zx + east[2] * zy) / span];
|
|
214
208
|
const across = cross(toward, pole);
|
|
215
|
-
setBasis(
|
|
216
|
-
setBasis(
|
|
217
|
-
near.mesh.renderOrder = 2;
|
|
218
|
-
far.mesh.renderOrder = 1;
|
|
219
|
-
near.material.depthTest = false;
|
|
220
|
-
far.material.depthTest = true;
|
|
209
|
+
setBasis(near.mesh, across, toward, pole);
|
|
210
|
+
setBasis(far.mesh, [-across[0], -across[1], -across[2]], [-toward[0], -toward[1], -toward[2]], pole);
|
|
221
211
|
}
|
|
222
212
|
};
|
|
223
213
|
const frame = (state) => {
|
|
224
|
-
const aspect = viewWidth / Math.max(1, viewHeight);
|
|
225
214
|
const half = state.extent / Math.max(0.05, state.zoom);
|
|
226
215
|
const halfW = aspect >= 1 ? half * aspect : half;
|
|
227
216
|
const halfH = aspect >= 1 ? half : half / aspect;
|
|
@@ -239,7 +228,7 @@ export function createBodyItem(options) {
|
|
|
239
228
|
return m;
|
|
240
229
|
const f = BODIES[id];
|
|
241
230
|
const c = [1, 3, 5].map((i) => parseInt(f.colour.slice(i, i + 2), 16) / 255);
|
|
242
|
-
const material = assets.acquire(`wk:ball:${id}`, () => new T.ShaderMaterial({ vertexShader: VERTEX, fragmentShader: BALL_FRAGMENT, uniforms: { uLight: { value: new T.Vector3(0, 0, 1) }, uColour: { value:
|
|
231
|
+
const material = assets.acquire(`wk:ball:${id}`, () => new T.ShaderMaterial({ vertexShader: VERTEX, fragmentShader: BALL_FRAGMENT, uniforms: { uLight: { value: new T.Vector3(0, 0, 1) }, uColour: { value: new T.Vector3(c[0], c[1], c[2]) } } }), (x) => x.dispose());
|
|
243
232
|
m = new T.Mesh(geometry, material);
|
|
244
233
|
m.frustumCulled = false;
|
|
245
234
|
moonMeshes.set(id, m);
|
|
@@ -248,7 +237,6 @@ export function createBodyItem(options) {
|
|
|
248
237
|
};
|
|
249
238
|
const place = (state) => {
|
|
250
239
|
const moons = state.moons ?? [];
|
|
251
|
-
const aspect = viewWidth / Math.max(1, viewHeight);
|
|
252
240
|
const half = state.extent / Math.max(0.05, state.zoom);
|
|
253
241
|
const unitsPerPx = (2 * half) / Math.max(1, aspect >= 1 ? viewHeight : viewWidth);
|
|
254
242
|
const minR = (state.minMoonPx ?? 2.5) * unitsPerPx;
|
|
@@ -273,7 +261,7 @@ export function createBodyItem(options) {
|
|
|
273
261
|
mesh2.updateMatrix();
|
|
274
262
|
mesh2.updateMatrixWorld(true);
|
|
275
263
|
const mat = mesh2.material;
|
|
276
|
-
mat.uniforms.uLight.value.
|
|
264
|
+
mat.uniforms.uLight.value.set(...state.pose.light);
|
|
277
265
|
if (moon.orbit !== undefined) {
|
|
278
266
|
const held = orbitLines.get(moon.id);
|
|
279
267
|
if (held === undefined || held.source !== moon.orbit) {
|
|
@@ -293,41 +281,9 @@ export function createBodyItem(options) {
|
|
|
293
281
|
if (state.orbitColour !== undefined)
|
|
294
282
|
orbitMaterial.color.set(state.orbitColour);
|
|
295
283
|
};
|
|
296
|
-
const
|
|
297
|
-
latest = state;
|
|
298
|
-
orient(state);
|
|
299
|
-
frame(state);
|
|
300
|
-
place(state);
|
|
301
|
-
if (ringHalves !== undefined) {
|
|
302
|
-
const light = v3(T, state.pose.light);
|
|
303
|
-
const pole = v3(T, state.pose.pole);
|
|
304
|
-
for (const piece of ringHalves) {
|
|
305
|
-
piece.material.uniforms.uLight.value.copy(light);
|
|
306
|
-
piece.material.uniforms.uRingN.value.copy(pole);
|
|
307
|
-
}
|
|
308
|
-
for (const mat of [shader, paintedMaterial]) {
|
|
309
|
-
if (mat === undefined)
|
|
310
|
-
continue;
|
|
311
|
-
mat.uniforms.uRingOn.value = 1;
|
|
312
|
-
mat.uniforms.uRingN.value.copy(pole);
|
|
313
|
-
mat.uniforms.uRingR.value.set(ringInner, ringOuter);
|
|
314
|
-
mat.uniforms.uRingTex.value = ringTexture;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
for (const mat of [shader, paintedMaterial]) {
|
|
318
|
-
if (mat === undefined)
|
|
319
|
-
continue;
|
|
320
|
-
mat.uniforms.uLight.value.copy(v3(T, state.pose.light));
|
|
321
|
-
const sky = state.sky === true;
|
|
322
|
-
mat.uniforms.uWrap.value = sky ? 0.02 : (mat === paintedMaterial ? baseWrap : baseWrap);
|
|
323
|
-
mat.uniforms.uAmbient.value = sky ? 0.012 : baseAmbient;
|
|
324
|
-
mat.uniforms.uRimBase.value = sky ? 0.02 : 0.12;
|
|
325
|
-
}
|
|
326
|
-
if (glow !== undefined)
|
|
327
|
-
glow.scale.setScalar(1);
|
|
284
|
+
const requestSharperTexture = (state) => {
|
|
328
285
|
// a sharper picture, when the disc is big enough to show it
|
|
329
286
|
if (wantPainted && !failed && !loading && look.painted !== undefined) {
|
|
330
|
-
const aspect = viewWidth / Math.max(1, viewHeight);
|
|
331
287
|
const discPx = (aspect >= 1 ? viewHeight : viewWidth) * (state.zoom / state.extent);
|
|
332
288
|
const wanted = options.wantedWidth(discPx);
|
|
333
289
|
const next = look.painted.widths.find((w) => w >= wanted) ?? look.painted.widths[look.painted.widths.length - 1];
|
|
@@ -348,8 +304,39 @@ export function createBodyItem(options) {
|
|
|
348
304
|
}
|
|
349
305
|
}
|
|
350
306
|
};
|
|
307
|
+
const light = new T.Vector3();
|
|
308
|
+
const pole = new T.Vector3();
|
|
309
|
+
const apply = (state) => {
|
|
310
|
+
latest = state;
|
|
311
|
+
orient(state);
|
|
312
|
+
frame(state);
|
|
313
|
+
place(state);
|
|
314
|
+
light.set(...state.pose.light);
|
|
315
|
+
if (ringHalves !== undefined) {
|
|
316
|
+
pole.set(...state.pose.pole);
|
|
317
|
+
for (const piece of ringHalves) {
|
|
318
|
+
piece.material.uniforms.uLight.value.copy(light);
|
|
319
|
+
piece.material.uniforms.uRingN.value.copy(pole);
|
|
320
|
+
}
|
|
321
|
+
for (const mat of materials) {
|
|
322
|
+
mat.uniforms.uRingOn.value = 1;
|
|
323
|
+
mat.uniforms.uRingN.value.copy(pole);
|
|
324
|
+
mat.uniforms.uRingR.value.set(ringInner, ringOuter);
|
|
325
|
+
mat.uniforms.uRingTex.value = ringTexture;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
const sky = state.sky === true;
|
|
329
|
+
for (const mat of materials) {
|
|
330
|
+
mat.uniforms.uLight.value.copy(light);
|
|
331
|
+
mat.uniforms.uWrap.value = sky ? 0.02 : baseWrap;
|
|
332
|
+
mat.uniforms.uAmbient.value = sky ? 0.012 : baseAmbient;
|
|
333
|
+
mat.uniforms.uRimBase.value = sky ? 0.02 : 0.12;
|
|
334
|
+
}
|
|
335
|
+
if (glow !== undefined)
|
|
336
|
+
glow.scale.setScalar(1);
|
|
337
|
+
requestSharperTexture(state);
|
|
338
|
+
};
|
|
351
339
|
apply(latest);
|
|
352
|
-
void ringReach;
|
|
353
340
|
return {
|
|
354
341
|
scene,
|
|
355
342
|
camera,
|
|
@@ -363,6 +350,7 @@ export function createBodyItem(options) {
|
|
|
363
350
|
resize(w, h) {
|
|
364
351
|
viewWidth = w;
|
|
365
352
|
viewHeight = h;
|
|
353
|
+
aspect = viewWidth / Math.max(1, viewHeight);
|
|
366
354
|
frame(latest);
|
|
367
355
|
place(latest);
|
|
368
356
|
},
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** A body that has no registered look is still drawn: a lit ball in its mean colour. */
|
|
2
|
+
export function fallbackLook(facts) {
|
|
3
|
+
const c = [1, 3, 5].map((i) => (parseInt(facts.colour.slice(i, i + 2), 16) / 255).toFixed(3)).join(", ");
|
|
4
|
+
return { id: facts.id, surface: `vec4 surface(vec3 p) { float n = fbm(p * 5.0); return vec4(vec3(${c}) * (0.85 + 0.3 * n), 0.0); }` };
|
|
5
|
+
}
|
package/dist/scene/painter.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import "../bodies/all.js";
|
|
2
2
|
import { BODIES, MOONS_OF } from "../facts.js";
|
|
3
|
-
import {
|
|
3
|
+
import { writeBasis } from "./basis.js";
|
|
4
|
+
import { TEXTURE_BASE, TEXTURE_FAR_BASE, slash, loadImage } from "./textures.js";
|
|
4
5
|
import { cross } from "../vec.js";
|
|
5
6
|
import { bodyFragment, GLOW_FRAGMENT, GLOW_VERTEX, PAINTED_SURFACE, RING_FRAGMENT_WORLD, RING_VERTEX_WORLD, VERTEX_WORLD } from "./glsl.js";
|
|
7
|
+
import { fallbackLook } from "./fallback.js";
|
|
6
8
|
import { lookOf } from "./look.js";
|
|
7
9
|
import { moonOffset, orientation } from "./orient.js";
|
|
8
10
|
import { ringStrip } from "./rings.js";
|
|
@@ -19,9 +21,6 @@ export { moonOffset, orientation };
|
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
21
23
|
export const LOOKS = ["realistic", "painted"];
|
|
22
|
-
const TEXTURE_BASE = `https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@${VERSION}/dist/textures/`;
|
|
23
|
-
const TEXTURE_FAR_BASE = `https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v${VERSION}/textures/`;
|
|
24
|
-
const slash = (base) => (base.endsWith("/") ? base : `${base}/`);
|
|
25
24
|
const titled = (id) => id.charAt(0).toUpperCase() + id.slice(1);
|
|
26
25
|
const pools = new WeakMap();
|
|
27
26
|
function acquire(three, key, make) {
|
|
@@ -49,10 +48,6 @@ function acquire(three, key, make) {
|
|
|
49
48
|
},
|
|
50
49
|
};
|
|
51
50
|
}
|
|
52
|
-
const fallbackLook = (id) => {
|
|
53
|
-
const c = [1, 3, 5].map((i) => (parseInt(BODIES[id].colour.slice(i, i + 2), 16) / 255).toFixed(3)).join(", ");
|
|
54
|
-
return { id, surface: `vec4 surface(vec3 p) { float n = fbm(p * 5.0); return vec4(vec3(${c}) * (0.85 + 0.3 * n), 0.0); }` };
|
|
55
|
-
};
|
|
56
51
|
/** The name of a body as the painter takes it: any case, `Sun`, a planet or Pluto, or a moon such as `Io`. */
|
|
57
52
|
function idOf(name) {
|
|
58
53
|
const id = name.toLowerCase();
|
|
@@ -66,7 +61,7 @@ const moonsOf = (planet) => {
|
|
|
66
61
|
};
|
|
67
62
|
function paint(T, id, context, bases) {
|
|
68
63
|
const facts = BODIES[id];
|
|
69
|
-
const look = lookOf(id) ?? fallbackLook(
|
|
64
|
+
const look = lookOf(id) ?? fallbackLook(facts);
|
|
70
65
|
const wantPainted = (context.look === "painted" || look.mapped === true) && look.painted !== undefined;
|
|
71
66
|
const ratio = context.ratio ?? 1;
|
|
72
67
|
const maxWidth = context.maxTexture ?? 2048;
|
|
@@ -106,7 +101,7 @@ function paint(T, id, context, bases) {
|
|
|
106
101
|
};
|
|
107
102
|
const shader = material(false);
|
|
108
103
|
const paintedMaterial = wantPainted ? material(true) : undefined;
|
|
109
|
-
const materials =
|
|
104
|
+
const materials = paintedMaterial ? [shader, paintedMaterial] : [shader];
|
|
110
105
|
const mesh = new T.Mesh(sphere.value, shader);
|
|
111
106
|
mesh.matrixAutoUpdate = false;
|
|
112
107
|
group.add(mesh);
|
|
@@ -117,11 +112,6 @@ function paint(T, id, context, bases) {
|
|
|
117
112
|
let ringInner = 1;
|
|
118
113
|
let ringOuter = 2;
|
|
119
114
|
const table = look.emissive === true ? null : ringStrip(facts, 1024);
|
|
120
|
-
const loadImage = (url) => new Promise((resolve, reject) => {
|
|
121
|
-
const loader = new T.TextureLoader();
|
|
122
|
-
loader.setCrossOrigin("anonymous");
|
|
123
|
-
loader.load(url, resolve, undefined, (e) => reject(e instanceof Error ? e : new Error("texture failed")));
|
|
124
|
-
});
|
|
125
115
|
let gone = false;
|
|
126
116
|
if (table !== null) {
|
|
127
117
|
ringInner = table.inner;
|
|
@@ -150,7 +140,7 @@ function paint(T, id, context, bases) {
|
|
|
150
140
|
group.add(ringMesh);
|
|
151
141
|
const photo = wantPainted ? look.painted?.rings : undefined;
|
|
152
142
|
if (photo !== undefined) {
|
|
153
|
-
void loadImage(`${bases.near}${photo.map}-${photo.width}.webp`).then((t) => {
|
|
143
|
+
void loadImage(T, `${bases.near}${photo.map}-${photo.width}.webp`).then((t) => {
|
|
154
144
|
if (gone) {
|
|
155
145
|
t.dispose();
|
|
156
146
|
return;
|
|
@@ -217,7 +207,7 @@ function paint(T, id, context, bases) {
|
|
|
217
207
|
redraw();
|
|
218
208
|
};
|
|
219
209
|
if (wantPainted && paintedMaterial !== undefined && widths[0] !== undefined) {
|
|
220
|
-
void loadImage(urlOf(widths[0])).then((t) => {
|
|
210
|
+
void loadImage(T, urlOf(widths[0])).then((t) => {
|
|
221
211
|
if (gone) {
|
|
222
212
|
t.dispose();
|
|
223
213
|
return;
|
|
@@ -237,7 +227,7 @@ function paint(T, id, context, bases) {
|
|
|
237
227
|
if (next > sharpWidth && next > widths[0] && !tried.has(next)) {
|
|
238
228
|
tried.add(next);
|
|
239
229
|
loading = true;
|
|
240
|
-
void loadImage(urlOf(next)).then((t) => {
|
|
230
|
+
void loadImage(T, urlOf(next)).then((t) => {
|
|
241
231
|
loading = false;
|
|
242
232
|
if (gone) {
|
|
243
233
|
t.dispose();
|
|
@@ -273,9 +263,6 @@ function paint(T, id, context, bases) {
|
|
|
273
263
|
const scaleX = axes ? axes[1] / facts.radiusKm : 1;
|
|
274
264
|
const scaleY = axes ? axes[2] / facts.radiusKm : 1 - facts.flattening;
|
|
275
265
|
const scaleZ = axes ? axes[0] / facts.radiusKm : 1;
|
|
276
|
-
const basis = (object, x, y, z, sx = 1, sy = 1, sz = 1) => {
|
|
277
|
-
object.matrix.makeBasis(new T.Vector3(x[0] * sx, x[1] * sx, x[2] * sx), new T.Vector3(y[0] * sy, y[1] * sy, y[2] * sy), new T.Vector3(z[0] * sz, z[1] * sz, z[2] * sz));
|
|
278
|
-
};
|
|
279
266
|
const light = new T.Vector3();
|
|
280
267
|
const poleVec = new T.Vector3();
|
|
281
268
|
return {
|
|
@@ -287,9 +274,9 @@ function paint(T, id, context, bases) {
|
|
|
287
274
|
if (look.emissive !== true) {
|
|
288
275
|
const { pole, meridian } = info.pose ?? orientation(id, info.ms);
|
|
289
276
|
const east = cross(pole, meridian);
|
|
290
|
-
|
|
277
|
+
writeBasis(mesh.matrix, east, pole, meridian, scaleX, scaleY, scaleZ);
|
|
291
278
|
if (ringMesh !== undefined)
|
|
292
|
-
|
|
279
|
+
writeBasis(ringMesh.matrix, meridian, east, pole);
|
|
293
280
|
poleVec.set(pole[0], pole[1], pole[2]);
|
|
294
281
|
}
|
|
295
282
|
const occluders = info.occluders ?? [];
|
package/dist/scene/store.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import type { BodyId } from "../facts.ts";
|
|
|
2
2
|
import type { BodyLook } from "./look.ts";
|
|
3
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
|
-
/** The line look: an element for the body, centred on a longitude and latitude (`"lon,lat"`). */
|
|
5
|
+
/** The line look: an element for the body, centred on a longitude and latitude (`"lon,lat"`), or null when the other package is not on the page and this one draws its own. */
|
|
6
6
|
line(options: {
|
|
7
7
|
center: string;
|
|
8
8
|
size: number;
|
|
9
|
-
}): Promise<HTMLElement>;
|
|
9
|
+
}): Promise<HTMLElement | null>;
|
|
10
10
|
}
|
|
11
11
|
export declare const looks: Map<BodyId, BodyLook>, waiting: Set<() => void>, delegates: Map<BodyId, Delegate>;
|
|
12
12
|
/** Call `wake` whenever a look is registered; returns a function that stops it. */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* The default home of the surface pictures: the files of this exact version on jsDelivr. Set `texture-base` on an element to serve them yourself.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts no-run
|
|
7
|
+
* import { TEXTURE_BASE } from "@johnmorrisdotca/wakusei-planets/element";
|
|
8
|
+
*
|
|
9
|
+
* console.log(TEXTURE_BASE);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.22.0/dist/textures/";
|
|
13
|
+
/**
|
|
14
|
+
* 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
|
|
15
|
+
* never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts no-run
|
|
19
|
+
* import { TEXTURE_FAR_BASE } from "@johnmorrisdotca/wakusei-planets/element";
|
|
20
|
+
*
|
|
21
|
+
* console.log(TEXTURE_FAR_BASE);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.22.0/textures/";
|
|
25
|
+
export declare const slash: (base: string) => string;
|
|
26
|
+
export declare function texturePaths(element: Element): {
|
|
27
|
+
textureBase(): string;
|
|
28
|
+
farBase(): string;
|
|
29
|
+
};
|
|
30
|
+
export declare function loadImage(three: Pick<typeof THREE, "TextureLoader">, url: string): Promise<THREE.Texture>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { VERSION } from "../version.js";
|
|
2
|
+
/**
|
|
3
|
+
* The default home of the surface pictures: the files of this exact version on jsDelivr. Set `texture-base` on an element to serve them yourself.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts no-run
|
|
7
|
+
* import { TEXTURE_BASE } from "@johnmorrisdotca/wakusei-planets/element";
|
|
8
|
+
*
|
|
9
|
+
* console.log(TEXTURE_BASE);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export const TEXTURE_BASE = `https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@${VERSION}/dist/textures/`;
|
|
13
|
+
/**
|
|
14
|
+
* 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
|
|
15
|
+
* never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts no-run
|
|
19
|
+
* import { TEXTURE_FAR_BASE } from "@johnmorrisdotca/wakusei-planets/element";
|
|
20
|
+
*
|
|
21
|
+
* console.log(TEXTURE_FAR_BASE);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export const TEXTURE_FAR_BASE = `https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v${VERSION}/textures/`;
|
|
25
|
+
export const slash = (base) => (base.endsWith("/") ? base : `${base}/`);
|
|
26
|
+
export function texturePaths(element) {
|
|
27
|
+
const textureBase = () => {
|
|
28
|
+
const own = element.getAttribute("texture-base");
|
|
29
|
+
return own === null || own === "" ? TEXTURE_BASE : slash(own);
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
textureBase,
|
|
33
|
+
farBase: () => {
|
|
34
|
+
const own = element.getAttribute("texture-far-base");
|
|
35
|
+
if (own !== null && own !== "")
|
|
36
|
+
return slash(own);
|
|
37
|
+
return element.hasAttribute("texture-base") ? textureBase() : TEXTURE_FAR_BASE;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function loadImage(three, url) {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
const loader = new three.TextureLoader();
|
|
44
|
+
loader.setCrossOrigin("anonymous");
|
|
45
|
+
loader.load(url, resolve, undefined, (error) => reject(error instanceof Error ? error : new Error("texture failed")));
|
|
46
|
+
});
|
|
47
|
+
}
|
package/dist/sidereal.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type When } from "./when.ts";
|
|
2
|
+
/** IAU 1980 mean obliquity, in arcseconds, at TT Julian centuries from J2000. */
|
|
3
|
+
export declare const meanObliquityArcseconds: (T: number) => number;
|
|
4
|
+
/** Unwrapped IAU 1982 Greenwich mean sidereal angle, in degrees, at UT1 days from J2000. */
|
|
5
|
+
export declare function meanSiderealDegrees(days: number): number;
|
|
2
6
|
/** Nutation in longitude and in obliquity, and the mean obliquity of date, in radians, at `T` Julian centuries of terrestrial time from J2000 (Meeus ch. 22, accurate to 0.5 arc-seconds). */
|
|
3
7
|
export declare function nutation(T: number): {
|
|
4
8
|
longitude: number;
|