@johnmorrisdotca/wakusei-planets 0.69.0 → 0.70.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/NOTICE.md +29 -1
  3. package/README.md +7 -7
  4. package/dist/bodies/moons-jupiter.js +2 -0
  5. package/dist/bodies/moons-mars.js +2 -2
  6. package/dist/bodies/moons-neptune.js +2 -1
  7. package/dist/bodies/moons-pluto.js +2 -2
  8. package/dist/bodies/moons-saturn.js +14 -2
  9. package/dist/data/discovery.js +225 -0
  10. package/dist/data/moon-catalogue.js +15 -15
  11. package/dist/data/orbits.js +15 -0
  12. package/dist/data/shapes/amalthea.d.ts +2 -0
  13. package/dist/data/shapes/amalthea.js +1 -0
  14. package/dist/data/shapes/atlas.d.ts +2 -0
  15. package/dist/data/shapes/atlas.js +1 -0
  16. package/dist/data/shapes/calypso.d.ts +2 -0
  17. package/dist/data/shapes/calypso.js +1 -0
  18. package/dist/data/shapes/daphnis.d.ts +2 -0
  19. package/dist/data/shapes/daphnis.js +1 -0
  20. package/dist/data/shapes/deimos.d.ts +2 -0
  21. package/dist/data/shapes/deimos.js +1 -0
  22. package/dist/data/shapes/epimetheus.d.ts +2 -0
  23. package/dist/data/shapes/epimetheus.js +1 -0
  24. package/dist/data/shapes/helene.d.ts +2 -0
  25. package/dist/data/shapes/helene.js +1 -0
  26. package/dist/data/shapes/hydra.d.ts +2 -0
  27. package/dist/data/shapes/hydra.js +1 -0
  28. package/dist/data/shapes/hyperion.d.ts +2 -0
  29. package/dist/data/shapes/hyperion.js +1 -0
  30. package/dist/data/shapes/janus.d.ts +2 -0
  31. package/dist/data/shapes/janus.js +1 -0
  32. package/dist/data/shapes/larissa.d.ts +2 -0
  33. package/dist/data/shapes/larissa.js +1 -0
  34. package/dist/data/shapes/nix.d.ts +2 -0
  35. package/dist/data/shapes/nix.js +1 -0
  36. package/dist/data/shapes/pan.d.ts +2 -0
  37. package/dist/data/shapes/pan.js +1 -0
  38. package/dist/data/shapes/pandora.d.ts +2 -0
  39. package/dist/data/shapes/pandora.js +1 -0
  40. package/dist/data/shapes/phobos.d.ts +2 -0
  41. package/dist/data/shapes/phobos.js +1 -0
  42. package/dist/data/shapes/phoebe.d.ts +2 -0
  43. package/dist/data/shapes/phoebe.js +1 -0
  44. package/dist/data/shapes/prometheus.d.ts +2 -0
  45. package/dist/data/shapes/prometheus.js +1 -0
  46. package/dist/data/shapes/proteus.d.ts +2 -0
  47. package/dist/data/shapes/proteus.js +1 -0
  48. package/dist/data/shapes/telesto.d.ts +2 -0
  49. package/dist/data/shapes/telesto.js +1 -0
  50. package/dist/data/shapes/thebe.d.ts +2 -0
  51. package/dist/data/shapes/thebe.js +1 -0
  52. package/dist/discovery.d.ts +1 -1
  53. package/dist/earth-places.d.ts +7 -6
  54. package/dist/earth-places.js +11 -8
  55. package/dist/facts.d.ts +21 -4
  56. package/dist/facts.js +71 -38
  57. package/dist/index.d.ts +2 -1
  58. package/dist/index.js +2 -1
  59. package/dist/moon-catalogue.d.ts +1 -1
  60. package/dist/nearest.js +2 -0
  61. package/dist/picture-credits.js +3 -0
  62. package/dist/scene/body-places.js +4 -5
  63. package/dist/scene/body.js +10 -5
  64. package/dist/scene/earth-places.d.ts +110 -2
  65. package/dist/scene/earth-places.js +149 -9
  66. package/dist/scene/glsl.d.ts +2 -2
  67. package/dist/scene/glsl.js +11 -0
  68. package/dist/scene/look.d.ts +7 -0
  69. package/dist/scene/look.js +1 -0
  70. package/dist/scene/painter.js +18 -3
  71. package/dist/scene/recipes.js +6 -2
  72. package/dist/scene/rings.js +11 -2
  73. package/dist/scene/shape.d.ts +50 -0
  74. package/dist/scene/shape.js +110 -0
  75. package/dist/shape-basis.d.ts +43 -0
  76. package/dist/shape-basis.js +45 -0
  77. package/dist/space/all-moons.d.ts +6 -1
  78. package/dist/space/all-moons.js +5 -1
  79. package/dist/space/element.d.ts +28 -3
  80. package/dist/space/element.js +169 -40
  81. package/dist/space/orbit-lines.d.ts +66 -0
  82. package/dist/space/orbit-lines.js +118 -0
  83. package/dist/space/scale.d.ts +1 -1
  84. package/dist/space/scale.js +20 -5
  85. package/dist/space/scene.d.ts +8 -0
  86. package/dist/space/scene.js +116 -9
  87. package/dist/stops.js +12 -0
  88. package/dist/surface/element.js +3 -3
  89. package/dist/surface/glsl.d.ts +2 -2
  90. package/dist/surface/glsl.js +15 -3
  91. package/dist/surface/height.d.ts +7 -0
  92. package/dist/surface/height.js +10 -0
  93. package/dist/textures/deimos-1024.webp +0 -0
  94. package/dist/textures/deimos-512.webp +0 -0
  95. package/dist/textures/phobos-1024.webp +0 -0
  96. package/dist/textures/phobos-512.webp +0 -0
  97. package/dist/textures/phoebe-1024.webp +0 -0
  98. package/dist/textures/phoebe-512.webp +0 -0
  99. package/package.json +1 -1
@@ -161,21 +161,24 @@ function room(host) {
161
161
  return 0.35 * Math.min(...gaps);
162
162
  }
163
163
  const reaches = new Map();
164
- /** How far out a body's moons go, in its radii: the farthest any of them is found in a year of looks. */
164
+ /** A moon so far out beyond the others that, if it set the scale, every other moon of its planet would be crowded into a few radii: Phoebe is 183 Saturn radii away and Iapetus, the next, 58. It is drawn just past the farthest of the others. */
165
+ const OUTLIERS = new Set(["phoebe"]);
166
+ /** How far out a body's moons go, in its radii: the farthest any of them is found in a year of looks (an outlier does not count). */
165
167
  function reachOf(host) {
166
168
  let reach = reaches.get(host);
167
169
  if (reach === undefined) {
168
170
  reach = 0;
169
171
  const start = Date.UTC(2026, 0, 1);
170
172
  for (const moon of MOONS_OF[host] ?? [])
171
- for (let i = 0; i < 24; i += 1)
172
- reach = Math.max(reach, length(moonOffset(moon, start + i * 15 * 86_400_000)));
173
+ if (!OUTLIERS.has(moon))
174
+ for (let i = 0; i < 24; i += 1)
175
+ reach = Math.max(reach, length(moonOffset(moon, start + i * 15 * 86_400_000)));
173
176
  reaches.set(host, reach);
174
177
  }
175
178
  return reach;
176
179
  }
177
180
  /**
178
- * How far from its planet a moon is drawn, in the planet's radii, when it is really `distance` radii away. True: as it is. Compressed: the same, until the farthest of the planet's moons would
181
+ * How far from its planet a moon is drawn, in the planet's radii, when it is really `distance` radii away. True: as it is. Compressed: the same (but never inside the planet's rings: a moon that really goes through them is drawn just outside), until the farthest of the planet's moons would
179
182
  * reach across the gap to the next planet's orbit; then every moon is drawn nearer, the farthest at about a third of the gap and the nearer ones in the order they are, so no moon's orbit crosses another planet's,
180
183
  * and none is drawn nearer than 1.5 radii or inside the planet's rings (Mimas stays outside Saturn's, Proteus outside Neptune's), so a camera at a moon is never in the ring plane.
181
184
  *
@@ -197,12 +200,18 @@ export function moonDistance(mode, host, distance) {
197
200
  const reach = reachOf(host);
198
201
  const radius = radiusIn(host, "compressed");
199
202
  const space = room(host);
203
+ // a moon that really goes inside the planet's rings (Amalthea in Jupiter's gossamer ring, Saturn's small moons round the A ring and the F ring) is drawn just outside them, in the order the moons are, in the little room between the ring and the next moon
204
+ const inner = nearestOf(host);
205
+ if (distance < inner)
206
+ return inner + 0.25 * (distance / inner) ** 8;
200
207
  if (reach === 0 || reach * radius <= space)
201
208
  return distance;
202
209
  // from the nearest a moon may be drawn (clear of the globe and its rings) out to the room's edge, in the order the moons are: a moon drawn in the ring plane, or inside the globe, put the camera riding beside it in the rings
203
210
  const near = nearestOf(host);
204
211
  const far = Math.max(space / radius, near * 1.6);
205
- return Math.min(distance, near + (far - near) * Math.sqrt(distance / reach));
212
+ // beyond the reach (an outlier) the curve flattens: a little past the farthest of the others, in the order the moons are
213
+ const t = Math.sqrt(distance / reach);
214
+ return Math.min(distance, near + (far - near) * (t <= 1 ? t : 1 + 0.15 * (1 - 1 / t)));
206
215
  }
207
216
  /** The squeezed view draws moons this many times their real size, unless a moon would pass a limit. 1 is today's size. True distances ignore it. */
208
217
  export const MOON_SIZE_DEFAULT = 2;
@@ -239,6 +248,12 @@ export function moonSizeFactor(mode, host, size, moons) {
239
248
  for (const other of moons) {
240
249
  if (other === moon)
241
250
  continue;
251
+ // a moon more than ten times the size of the other, or less than a tenth of it, is not held by it: at the same distance from the planet they may be on opposite sides (Telesto and Calypso, a sixtieth of a turn ahead of and behind Tethys, Helene beside Dione) and a speck hidden by a big moon is no loss
252
+ if (other.radius > 0 && (other.radius > moon.radius * 10 || moon.radius > other.radius * 10))
253
+ continue;
254
+ // two at the same distance (within a fiftieth of a radius: Telesto and Calypso) are side by side on the circle, not one behind the other
255
+ if (Math.abs(moon.orbit - other.orbit) < 0.02)
256
+ continue;
242
257
  cap = Math.min(cap, Math.max(moon.radius, Math.abs(moon.orbit - other.orbit) * 0.9));
243
258
  }
244
259
  factor = Math.min(factor, cap / moon.radius);
@@ -16,6 +16,7 @@ import type { SightInput } from "./sight.ts";
16
16
  import { type SpaceDwarf, type SpaceFrame, type SpacePlanet, type SpaceVec3 } from "./frame.ts";
17
17
  import { type PaintSpec, type PaintTrail } from "../paint/trail.ts";
18
18
  import { type RideLook } from "./ride.ts";
19
+ import { type ScreenLine } from "./orbit-lines.ts";
19
20
  import { type ScaleMode } from "./scale.ts";
20
21
  import { type SunRegion } from "./regions.ts";
21
22
  import { type TravelInput, type TravelKind, type TravelPlan } from "./travel.ts";
@@ -258,7 +259,14 @@ export interface SpaceModel {
258
259
  miss: Record<string, number>;
259
260
  hidden: string[];
260
261
  faded: string[];
262
+ fade: {
263
+ crowd: number;
264
+ outness: number;
265
+ opacity: number;
266
+ };
261
267
  };
268
+ /** The orbit lines on the screen as the last draw left them (every kind, the catalogue moons' too), for a hover and a press; with `only`, the one line of that key. */
269
+ orbitPaths: (only?: string) => ScreenLine[];
262
270
  /** The arrowheads on the orbit lines at the last draw, by line: where each is and the way it points. */
263
271
  arrows: Record<string, OrbitArrow[]>;
264
272
  /** Help mode: draw, on the body looked at, the axis it turns about and a curved arrow showing which way it turns. */
@@ -1,7 +1,7 @@
1
1
  import { BODIES, MOONS_OF } from "../facts.js";
2
2
  import { createSmallBodyPoints, smallBodyPlace } from "../door/points.js";
3
3
  import { asteroidKey } from "./asteroid-ids.js";
4
- import { createMoonLayer } from "./all-moons.js";
4
+ import { createMoonLayer, MOON_ORBIT_OPACITY } from "./all-moons.js";
5
5
  import { BELT_IDS, BELTS, OORT } from "../belts/index.js";
6
6
  import { toTerrestrialTime } from "../clock.js";
7
7
  import { moonOffset, orientation } from "../scene/orient.js";
@@ -20,7 +20,9 @@ import { createPaintOverlay } from "./paint-overlay.js";
20
20
  import { createPaintTrail, groundUnder, paintMinute } from "../paint/trail.js";
21
21
  import { BALL_FRAGMENT, VERTEX } from "../scene/glsl.js";
22
22
  import { ridePose } from "./ride.js";
23
+ import { lineAlpha, linesInView, outnessOf } from "./orbit-lines.js";
23
24
  import { fadesNearBody, isOwnLine, nearBodyKeep } from "./orbit-rules.js";
25
+ import { catalogueMoonKey } from "./moon-settings.js";
24
26
  import { moonDistance, moonSizeFactor, orbitLine, placeAround, placeBodies, placeMoon, radiusIn } from "./scale.js";
25
27
  import { regionOrbits, regionView } from "./regions.js";
26
28
  import { TRAVEL_BUDGET_MS, travelPlan, travelPose } from "./travel.js";
@@ -30,9 +32,15 @@ const RAD = Math.PI / 180;
30
32
  export const FIT_DISTANCE = 4.1;
31
33
  const FOV = 35;
32
34
  const ORBIT_POINTS = 96;
35
+ /** The opacity of a planet's, a dwarf planet's, a minor body's or the Moon's orbit line, and of the Roadster's, when few lines are drawn and the view is near. */
36
+ const LINE_OPACITY = 0.55;
33
37
  const ORBIT_BODIES = ["earth", ...SPACE_PLANETS, ...SPACE_DWARFS, ...SPACE_MINORS, "moon"];
34
38
  /** A dwarf planet or a minor body is drawn once it is this many CSS pixels across its radius, or when it is the body looked at: Sedna at true scale is never anything but a speck, and its picture is not made for it. */
35
39
  const DWARF_MIN_PX = 0.4;
40
+ /** The most moons made for the first time (or made again after a change of look) in one draw. A moon's shader is compiled at the first draw it is in, and a rock moon's takes a good part of a second on a software renderer: Saturn's nineteen moons in one draw were a pause of five seconds on the Linux software renderers the tests run on (the page answered nothing meanwhile), so the moons come a few at a time, the moons the package drew first (the bigger ones) first, and the view asks for one more draw until they are all there. */
41
+ const MOON_MAKES_PER_DRAW = 3;
42
+ /** The colour of a body's orbit line, `#rrggbb`. */
43
+ const orbitColour = (id) => (id === "earth" ? "#6aa8ff" : id === "moon" ? "#c5cdd9" : BODIES[id].colour);
36
44
  /** A colour as three numbers from 0 to 1, from `#rrggbb`. */
37
45
  const rgb = (hex) => [parseInt(hex.slice(1, 3), 16) / 255, parseInt(hex.slice(3, 5), 16) / 255, parseInt(hex.slice(5, 7), 16) / 255];
38
46
  /** How long each arrowhead on an orbit line is, in CSS pixels: small, so it reads at every zoom and never hides a body. */
@@ -153,7 +161,8 @@ export const newSpaceModel = () => ({
153
161
  drawn: null,
154
162
  painted: { bodies: 0, moons: 0, held: 0 },
155
163
  tiles: { requested: 0, loading: 0, failed: 0, shown: null },
156
- rings: { drawn: [], miss: {}, hidden: [], faded: [] },
164
+ rings: { drawn: [], miss: {}, hidden: [], faded: [], fade: { crowd: 0, outness: 0, opacity: LINE_OPACITY } },
165
+ orbitPaths: () => [],
157
166
  arrows: {},
158
167
  help: false,
159
168
  helpThrough: false,
@@ -329,13 +338,13 @@ export function createSpaceItem(model, deps) {
329
338
  for (const id of ORBIT_BODIES) {
330
339
  const positions = new Float32Array((ORBIT_POINTS + 1) * 3);
331
340
  const colours = new Float32Array((ORBIT_POINTS + 1) * 4);
332
- const base = rgb(id === "earth" ? "#6aa8ff" : id === "moon" ? "#c5cdd9" : BODIES[id].colour);
341
+ const base = rgb(orbitColour(id));
333
342
  for (let i = 0; i <= ORBIT_POINTS; i += 1)
334
343
  colours.set([base[0], base[1], base[2], 1], i * 4);
335
344
  const geometry = new three.BufferGeometry();
336
345
  geometry.setAttribute("position", new three.BufferAttribute(positions, 3));
337
346
  geometry.setAttribute("color", new three.BufferAttribute(colours, 4));
338
- const line = new three.Line(geometry, new three.LineBasicMaterial({ vertexColors: true, transparent: true, opacity: 0.55 }));
347
+ const line = new three.Line(geometry, new three.LineBasicMaterial({ vertexColors: true, transparent: true, opacity: LINE_OPACITY }));
339
348
  line.frustumCulled = false;
340
349
  scene.add(line);
341
350
  orbits.set(id, { line, positions, colours, faded: false, samples: [], epoch: Number.NaN });
@@ -351,7 +360,7 @@ export function createSpaceItem(model, deps) {
351
360
  arrowLines.frustumCulled = false;
352
361
  scene.add(arrowLines);
353
362
  ORBIT_BODIES.forEach((id, k) => {
354
- const c = rgb(id === "earth" ? "#6aa8ff" : id === "moon" ? "#c5cdd9" : BODIES[id].colour);
363
+ const c = rgb(orbitColour(id));
355
364
  for (let v = 0; v < MAX_ARROWS_PER_ORBIT * 4; v += 1)
356
365
  arrowColours.set(c, (k * MAX_ARROWS_PER_ORBIT * 4 + v) * 3);
357
366
  });
@@ -385,7 +394,7 @@ export function createSpaceItem(model, deps) {
385
394
  const roadsterPositions = new Float32Array((ORBIT_POINTS + 1) * 3);
386
395
  const roadsterLineGeometry = new three.BufferGeometry();
387
396
  roadsterLineGeometry.setAttribute("position", new three.BufferAttribute(roadsterPositions, 3));
388
- const roadsterLine = new three.Line(roadsterLineGeometry, new three.LineBasicMaterial({ color: 0xe8705a, transparent: true, opacity: 0.55 }));
397
+ const roadsterLine = new three.Line(roadsterLineGeometry, new three.LineBasicMaterial({ color: 0xe8705a, transparent: true, opacity: LINE_OPACITY }));
389
398
  roadsterLine.visible = false;
390
399
  roadsterLine.frustumCulled = false;
391
400
  scene.add(roadsterLine);
@@ -421,7 +430,7 @@ export function createSpaceItem(model, deps) {
421
430
  const line = new three.Line(geometry, lineMaterial);
422
431
  line.frustumCulled = false;
423
432
  scene.add(line);
424
- drawing = { mesh, material, line, lineMaterial, positions, epoch: Number.NaN };
433
+ drawing = { mesh, material, line, lineMaterial, positions, epoch: Number.NaN, base: 0.4, chosen: false };
425
434
  orbiterDrawings.set(id, drawing);
426
435
  return drawing;
427
436
  };
@@ -441,6 +450,69 @@ export function createSpaceItem(model, deps) {
441
450
  return null;
442
451
  return { x: ((projected.x + 1) / 2) * size.width, y: ((1 - projected.y) / 2) * size.height };
443
452
  };
453
+ // The orbit lines of every kind as the screen shows them, for a hover and a press: worked out when asked (a pointer move, a press), from the places the last draw left. A draw works out the planets' and craft's own (a
454
+ // few thousand points) to count the lines in the picture, never the catalogue moons'. A line is broken
455
+ // where it is behind the camera or outside its depth range; the catalogue moons' lines are cut from their planet's one object, a moon a line.
456
+ const pathsOf = (which, only) => {
457
+ const a = camera.projectionMatrix.elements;
458
+ const b = camera.matrixWorldInverse.elements;
459
+ const m = new Float64Array(16);
460
+ for (let c = 0; c < 4; c += 1)
461
+ for (let r = 0; r < 4; r += 1)
462
+ m[c * 4 + r] = a[r] * b[c * 4] + a[4 + r] * b[c * 4 + 1] + a[8 + r] * b[c * 4 + 2] + a[12 + r] * b[c * 4 + 3];
463
+ const out = [];
464
+ const trace = (id, colour, positions, count, vertexAt, at, scale, fades) => {
465
+ if (only !== undefined && only !== id)
466
+ return;
467
+ const xy = new Float32Array(count * 2);
468
+ for (let k = 0; k < count; k += 1) {
469
+ const v = vertexAt(k) * 3;
470
+ const x = at[0] + positions[v] * scale;
471
+ const y = at[1] + positions[v + 1] * scale;
472
+ const z = at[2] + positions[v + 2] * scale;
473
+ const w = m[3] * x + m[7] * y + m[11] * z + m[15];
474
+ const depth = m[2] * x + m[6] * y + m[10] * z + m[14];
475
+ // a point of a line that has been let go near the close body is not there to be pointed at
476
+ if (!(w > 1e-12) || depth > w || depth < -w || (fades !== undefined && fades[k * 4 + 3] < 0.1)) {
477
+ xy[k * 2] = Number.NaN;
478
+ xy[k * 2 + 1] = Number.NaN;
479
+ continue;
480
+ }
481
+ xy[k * 2] = (((m[0] * x + m[4] * y + m[8] * z + m[12]) / w + 1) / 2) * size.width;
482
+ xy[k * 2 + 1] = ((1 - (m[1] * x + m[5] * y + m[9] * z + m[13]) / w) / 2) * size.height;
483
+ }
484
+ out.push({ id, colour, xy });
485
+ };
486
+ const origin0 = [0, 0, 0];
487
+ for (const id of ORBIT_BODIES) {
488
+ const o = orbits.get(id);
489
+ if (o.line.visible)
490
+ trace(id, orbitColour(id), o.positions, ORBIT_POINTS + 1, (k) => k, origin0, 1, o.colours);
491
+ }
492
+ if (roadsterLine.visible)
493
+ trace("roadster", "#e8705a", roadsterPositions, ORBIT_POINTS + 1, (k) => k, origin0, 1);
494
+ for (const [id, drawing] of orbiterDrawings)
495
+ if (drawing.line.visible)
496
+ trace(id, "#9fd0ff", drawing.positions, ORBIT_POINTS + 1, (k) => k, [drawing.line.position.x, drawing.line.position.y, drawing.line.position.z], drawing.line.scale.x);
497
+ if (which === "all" && moonLayer !== undefined) {
498
+ for (const host of model.moonHosts) {
499
+ const object = moonLayer.orbitObject(host);
500
+ if (object === undefined || !object.visible)
501
+ continue;
502
+ const positions = object.geometry.getAttribute("position").array;
503
+ const at = [object.position.x, object.position.y, object.position.z];
504
+ let first = 0;
505
+ for (const moon of moonLayer.orbitMoons(host)) {
506
+ const start = first;
507
+ first += moon.segments;
508
+ // a segment is two vertices: the first of each, then the last of the last
509
+ trace(catalogueMoonKey(moon.id), moon.colour, positions, moon.segments + 1, (k) => (k < moon.segments ? 2 * (start + k) : 2 * (start + moon.segments - 1) + 1), at, object.scale.x);
510
+ }
511
+ }
512
+ }
513
+ return out;
514
+ };
515
+ model.orbitPaths = (only) => pathsOf("all", only);
444
516
  return {
445
517
  scene,
446
518
  camera,
@@ -930,7 +1002,7 @@ export function createSpaceItem(model, deps) {
930
1002
  drawnRings.push(id);
931
1003
  miss[id] = distanceToLine(pos[id], line) / radius;
932
1004
  }
933
- model.rings = { drawn: drawnRings, miss, hidden: hiddenRings, faded: fadedRings };
1005
+ model.rings = { drawn: drawnRings, miss, hidden: hiddenRings, faded: fadedRings, fade: model.rings.fade };
934
1006
  // Starman and the Roadster: where the table puts the car, in the same mapping as the planets, as a dot a few pixels across, on its orbit line (about one trip round the Sun, from the table, worked out again every month)
935
1007
  const path = model.roadster ? model.roadsterPath : null;
936
1008
  let roadsterAt = null;
@@ -1050,7 +1122,8 @@ export function createSpaceItem(model, deps) {
1050
1122
  // the line is in the body's radii round the origin: placed and scaled with the body
1051
1123
  drawing.line.position.set(pos[centre][0], pos[centre][1], pos[centre][2]);
1052
1124
  drawing.line.scale.setScalar(hostRadius);
1053
- drawing.lineMaterial.opacity = chosen ? (dim ? 0.5 : 0.85) : dim ? 0.2 : 0.4;
1125
+ drawing.base = chosen ? (dim ? 0.5 : 0.85) : dim ? 0.2 : 0.4;
1126
+ drawing.chosen = chosen;
1054
1127
  drawing.line.visible = model.orbiterLines === "all" || (model.orbiterLines === "chosen" && chosen);
1055
1128
  if (drawing.line.visible)
1056
1129
  linesDrawn += 1;
@@ -1093,6 +1166,24 @@ export function createSpaceItem(model, deps) {
1093
1166
  }
1094
1167
  if (trackDrawn === 0)
1095
1168
  trackLine.visible = false;
1169
+ // every orbit line is fainter the more are drawn and the farther out the view is (the orbiter chosen keeps its own)
1170
+ // (the lines with some of their length in the picture, and a planet's moon lines once the planet is big enough for its moons to be told from it)
1171
+ let crowd = linesInView(pathsOf("base"), size.width, size.height);
1172
+ if (moonLayer !== undefined && model.orbits) {
1173
+ for (const host of model.moonHosts)
1174
+ if (moonLayer.orbitObject(host)?.visible && px[host] >= MOON_MIN_PLANET_PX)
1175
+ crowd += moonLayer.orbitMoons(host).length;
1176
+ }
1177
+ const crowding = { crowd, outness: outnessOf(distance / Math.max(1e-9, focusRadius)) };
1178
+ const faint = (base) => lineAlpha({ base, ...crowding });
1179
+ for (const o of orbits.values())
1180
+ o.line.material.opacity = faint(LINE_OPACITY);
1181
+ roadsterLine.material.opacity = faint(LINE_OPACITY);
1182
+ for (const drawing of orbiterDrawings.values())
1183
+ drawing.lineMaterial.opacity = drawing.chosen ? drawing.base : faint(drawing.base);
1184
+ moonLayer?.setOrbitOpacity(faint(MOON_ORBIT_OPACITY));
1185
+ arrowLines.material.opacity = faint(0.95);
1186
+ model.rings.fade = { crowd, outness: crowding.outness, opacity: faint(LINE_OPACITY) };
1096
1187
  model.orbitersDrawn = { count: Object.keys(orbiterPlaces).length, status: orbiterStatus, dim: orbitersDim, lines: linesDrawn, track: trackDrawn };
1097
1188
  // the painted trail: stepped and uploaded only while the painted craft's body is drawn, and only when the shown moment moved
1098
1189
  const paintedCraft = model.paint;
@@ -1189,6 +1280,8 @@ export function createSpaceItem(model, deps) {
1189
1280
  const now = performance.now();
1190
1281
  const seen = new Set();
1191
1282
  const moonPlaces = {};
1283
+ let moonsMade = 0;
1284
+ let moonsLeft = false;
1192
1285
  const moonDistances = {};
1193
1286
  for (const id of [...SPACE_PLANETS, ...SPACE_DWARFS]) {
1194
1287
  const planet = slotOf(id).drawing;
@@ -1216,6 +1309,17 @@ export function createSpaceItem(model, deps) {
1216
1309
  if (key === hiddenMoon)
1217
1310
  continue;
1218
1311
  let held = moonSlots.get(key);
1312
+ // a moon not yet made, or made with another look, is made in this draw only if there is room for it in the draw (the moon looked at always is)
1313
+ if ((held === undefined || (held.slot.look !== model.look && !held.slot.failed)) && moonsMade >= MOON_MAKES_PER_DRAW && key !== model.focus) {
1314
+ moonsLeft = true;
1315
+ if (held !== undefined) {
1316
+ held.seen = now;
1317
+ seen.add(key);
1318
+ }
1319
+ continue;
1320
+ }
1321
+ if (held === undefined || (held.slot.look !== model.look && !held.slot.failed))
1322
+ moonsMade += 1;
1219
1323
  if (!held)
1220
1324
  moonSlots.set(key, (held = { slot: { drawing: undefined, look: null, failed: false, labelled: -1 }, seen: now }));
1221
1325
  held.seen = now;
@@ -1244,6 +1348,9 @@ export function createSpaceItem(model, deps) {
1244
1348
  }
1245
1349
  }
1246
1350
  }
1351
+ // moons left for the next draw: ask for it (the view at rest draws nothing)
1352
+ if (moonsLeft)
1353
+ deps.invalidate();
1247
1354
  let soonest = Number.POSITIVE_INFINITY;
1248
1355
  for (const [key, held] of moonSlots) {
1249
1356
  if (seen.has(key))
package/dist/stops.js CHANGED
@@ -57,6 +57,18 @@ const GM = {
57
57
  charon: 106.1,
58
58
  nix: 0.0015,
59
59
  hydra: 0.002,
60
+ // JPL "Planetary Satellite Physical Parameters", read 2026-11-18, for the moons added with their shape models. Telesto, Calypso and Daphnis print no GM, and Larissa's (0.25484) has an uncertainty of 3.1, larger than itself, so it is left empty.
61
+ amalthea: 0.16456,
62
+ thebe: 0.03015,
63
+ hyperion: 0.37049,
64
+ phoebe: 0.55479,
65
+ janus: 0.12662,
66
+ epimetheus: 0.03514,
67
+ helene: 0.00048,
68
+ atlas: 0.00037,
69
+ prometheus: 0.01071,
70
+ pandora: 0.00926,
71
+ pan: 0.00028,
60
72
  };
61
73
  /** Escape speed in km/s, where a page prints one. Anything else is worked out from GM and the radius. */
62
74
  const ESCAPE = {
@@ -5,7 +5,7 @@ import { madeGround, rocksAround, setKeepOut, standingPlace } from "./detail.js"
5
5
  import { driveStep, driveView, ROVER, startDrive, toWorld } from "./drive.js";
6
6
  import { DustField } from "./dust.js";
7
7
  import { calloutsBy, clockText, LANDING, landingAt, turnedBy, watchedLook } from "./landing.js";
8
- import { drop, groundAt } from "./height.js";
8
+ import { drop, groundAt, joinCredits } from "./height.js";
9
9
  import { loadTerrain } from "./load.js";
10
10
  import { createSurfaceItem } from "./scene.js";
11
11
  import { objectsOf, traverseOf } from "./objects.js";
@@ -472,8 +472,8 @@ export class WakuseiSurface extends HTMLElement {
472
472
  return this.#lang() === "ja" ? "地面: 高さのデータが追加されるまでの平らな代用です。ここには、実測した起伏も作った起伏もありません。太陽、空、重力は、この場所と時刻の実際のとおりです。" : "Ground: flat stand-in until a DTM is added. There is no relief here, measured or made. The Sun, sky and gravity are the real ones for this place and time.";
473
473
  const made = this.#noDetail() ? "" : this.#lang() === "ja" ? "5 m より細かい地形(小さなクレーター、砂塵、岩)は計算で作ったもので、実測ではありません。" : "Detail finer than the 5 m grid (small craters, dust, rocks) is made, not measured.";
474
474
  const things = this.#objects.length === 0 ? "" : this.#lang() === "ja" ? " 地面の物は、公表された座標の位置にこのパッケージが置いたもので、形は簡単な絵です。" : " The things on the ground are placed by this package at published positions, as plain drawings.";
475
- const picture = m.picture === null || m.picture === undefined ? "" : ` ${m.picture.credit}.`;
476
- return this.#lang() === "ja" ? `高さの実測: ${m.accuracy}。${m.credit}。${made}${things}` : `Heights measured: ${m.accuracy}. ${m.credit}.${picture} ${made}${things}`;
475
+ const credit = joinCredits(m.credit, m.picture?.credit);
476
+ return this.#lang() === "ja" ? `高さの実測: ${m.accuracy}。${credit}。${made}${things}` : `Heights measured: ${m.accuracy}. ${credit}. ${made}${things}`;
477
477
  }
478
478
  /** The ground's height at a point over the site's: the measured heights, the made craters on them (if the page has them on) and the Moon's curve taken off. */
479
479
  #groundAt(east, north) {
@@ -7,7 +7,7 @@ export declare const GROUND_VERTEX = "\nprecision highp float;\nprecision highp
7
7
  /** What the ground, the rocks and their shadows all need to be lit: the Sun, the eyes, the heights and the made detail, the ground's height with the craters on it, and a point's light (a hard shadow by a march toward the Sun). */
8
8
  export declare const LIGHT = "\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n // the made craters are in the ground at the point only where they are in the march too (uNear.z is 0 in the quality of motion, which leaves them out of the march): a point set down in a made crater's floor and a ray over the ground without the crater put the whole floor under the ground's height, black\n P.y = groundY(P.xz, dist0, true, uNear.z > 0.0 ? 2.5 * dist0 * uPixel : 99.0);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n";
9
9
  /** The ground's light. */
10
- export declare const GROUND_FRAGMENT = "\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n // the made craters are in the ground at the point only where they are in the march too (uNear.z is 0 in the quality of motion, which leaves them out of the march): a point set down in a made crater's floor and a ray over the ground without the crater put the whole floor under the ground's height, black\n P.y = groundY(P.xz, dist0, true, uNear.z > 0.0 ? 2.5 * dist0 * uPixel : 99.0);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n\nvarying vec3 vP;\n\nvoid main() {\n float dist = distance(vP.xz, uEyeEN);\n float fromD = 2.5 * dist * uPixel;\n float e = max(spacing(vP.xz, dist), dist * 0.001);\n float hE = terrainY(vP.xz + vec2(e, 0.0), dist, true);\n float hW = terrainY(vP.xz - vec2(e, 0.0), dist, true);\n float hN = terrainY(vP.xz + vec2(0.0, e), dist, true);\n float hS = terrainY(vP.xz - vec2(0.0, e), dist, true);\n vec2 slope = vec2((hE - hW) / (2.0 * e), (hN - hS) / (2.0 * e));\n if (uDetail > 0.5) {\n if (fromD < 24.0) slope += madeGround(vP.xz, fromD).yz;\n slope += roughness(vP.xz, dist * uPixel);\n }\n vec3 n = normalize(vec3(-slope.x, 1.0, -slope.y));\n float mu0 = dot(n, uSun);\n float mu = max(dot(n, normalize(uEye - vP)), 0.03);\n float shine = 0.0;\n if (mu0 > 0.0 && uSun.y > -0.01) shine = (uShadows > 0.5 ? lit(vP, dist) : 1.0) * 2.0 * mu0 / (mu0 + mu);\n float light = uAlbedo * albedoAt(vP.xz, dist) * (shine + uEarthshine * max(n.y, 0.0)) * uExposure;\n gl_FragColor = vec4(pow(clamp(vec3(light) * uTint, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}\n";
10
+ export declare const GROUND_FRAGMENT = "\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n // the made craters are in the ground at the point only where they are in the march too (uNear.z is 0 in the quality of motion, which leaves them out of the march): a point set down in a made crater's floor and a ray over the ground without the crater put the whole floor under the ground's height, black\n P.y = groundY(P.xz, dist0, true, uNear.z > 0.0 ? 2.5 * dist0 * uPixel : 99.0);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n\nvarying vec3 vP;\n\nvoid main() {\n float dist = distance(vP.xz, uEyeEN);\n float fromD = 2.5 * dist * uPixel;\n float e = max(spacing(vP.xz, dist), dist * 0.001);\n float hE = terrainY(vP.xz + vec2(e, 0.0), dist, true);\n float hW = terrainY(vP.xz - vec2(e, 0.0), dist, true);\n float hN = terrainY(vP.xz + vec2(0.0, e), dist, true);\n float hS = terrainY(vP.xz - vec2(0.0, e), dist, true);\n vec2 slope = vec2((hE - hW) / (2.0 * e), (hN - hS) / (2.0 * e));\n if (uDetail > 0.5) {\n if (fromD < 24.0) slope += madeGround(vP.xz, fromD).yz;\n // the dust's grain only where the Sun is well on the ground: where it grazes, a grain a degree off lights or darkens each cell and the grain reads as blocks\n slope += roughness(vP.xz, dist * uPixel) * smoothstep(0.0, 0.12, dot(normalize(vec3(-slope.x, 1.0, -slope.y)), uSun));\n }\n vec3 n = normalize(vec3(-slope.x, 1.0, -slope.y));\n float mu0 = dot(n, uSun);\n float mu = max(dot(n, normalize(uEye - vP)), 0.03);\n float shine = 0.0;\n if (mu0 > 0.0 && uSun.y > -0.01) shine = (uShadows > 0.5 ? lit(vP, dist) : 1.0) * 2.0 * mu0 / (mu0 + mu);\n float light = uAlbedo * albedoAt(vP.xz, dist) * (shine + uEarthshine * max(n.y, 0.0)) * uExposure;\n gl_FragColor = vec4(pow(clamp(vec3(light) * uTint, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}\n";
11
11
  /** The rocks: pieces of ground standing on it. Their corners come from the page already in the site's plane (east, up, north). */
12
12
  export declare const ROCK_VERTEX = "\nprecision highp float;\n// position, normal and uv are declared by three.js\nattribute float tone;\nuniform mat4 uVP;\nvarying vec3 vP;\nvarying vec3 vN;\nvarying float vTone;\nvoid main() {\n vP = position;\n vN = normal;\n vTone = tone;\n gl_Position = uVP * vec4(position.x, position.y, -position.z, 1.0);\n}\n";
13
13
  export declare const ROCK_FRAGMENT = "\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n // the made craters are in the ground at the point only where they are in the march too (uNear.z is 0 in the quality of motion, which leaves them out of the march): a point set down in a made crater's floor and a ray over the ground without the crater put the whole floor under the ground's height, black\n P.y = groundY(P.xz, dist0, true, uNear.z > 0.0 ? 2.5 * dist0 * uPixel : 99.0);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n\nvarying vec3 vP;\nvarying vec3 vN;\nvarying float vTone;\nvoid main() {\n vec3 n = normalize(vN);\n float mu0 = dot(n, uSun);\n float mu = max(dot(n, normalize(uEye - vP)), 0.03);\n float dist = distance(vP.xz, uEyeEN);\n float shine = 0.0;\n if (mu0 > 0.0 && uSun.y > -0.01) shine = (uShadows > 0.5 ? lit(vP + n * 0.02, dist) : 1.0) * 2.0 * mu0 / (mu0 + mu);\n float light = uAlbedo * 1.1 * vTone * (shine + 0.12 * (n.y * 0.5 + 0.5)) * uExposure; // the shade of a stone is lit by the ground round it\n gl_FragColor = vec4(vec3(pow(clamp(light, 0.0, 1.0), 1.0 / 2.2)), 1.0);\n}\n";
@@ -17,7 +17,7 @@ export declare const SHADOW_FRAGMENT = "\nprecision highp float;\nvarying vec2 v
17
17
  /** A flat disc that always faces the viewer, set at a direction and a size: the Sun, and the Earth with its lit side toward the Sun. */
18
18
  export declare const DISC_VERTEX = "\nprecision highp float;\n// position (declared by three.js) holds the corners of a square, -1 to 1\nuniform mat4 uVP;\nuniform vec3 uEyeWorld;\nuniform vec3 uDirWorld; // unit, scene frame\nuniform vec3 uRightWorld;\nuniform vec3 uUpWorld;\nuniform float uHalf; // half the square's side as a share of the distance\nvarying vec2 vUv;\nvoid main() {\n vUv = position.xy;\n float d = 400000.0;\n vec3 w = uEyeWorld + uDirWorld * d + (uRightWorld * position.x + uUpWorld * position.y) * uHalf * d;\n gl_Position = uVP * vec4(w, 1.0);\n}\n";
19
19
  /** The Sun as a disc, or the Earth as a lit sphere: the same shader, `uKind` 0 for the Sun and 1 for the Earth. */
20
- export declare const DISC_FRAGMENT = "\nprecision highp float;\nuniform float uKind;\nuniform vec3 uSunEnu; // the Sun's direction in the sky's own frame (east, north, up)\nuniform vec3 uDirEnu; // the disc's direction in the same frame\nuniform vec3 uRightEnu;\nuniform vec3 uUpEnu;\nuniform float uExposure;\nvarying vec2 vUv;\nvoid main() {\n float r2 = dot(vUv, vUv);\n if (r2 > 1.0) discard;\n if (uKind < 0.5) { gl_FragColor = vec4(vec3(1.0), 1.0); return; }\n // the sphere's normal toward the viewer, in the sky's frame: the viewer looks along uDirEnu, so the face toward it points the other way\n vec3 nrm = normalize(-uDirEnu * sqrt(1.0 - r2) + uRightEnu * vUv.x + uUpEnu * vUv.y);\n float d = dot(nrm, uSunEnu);\n float day = smoothstep(-0.02, 0.06, d);\n vec3 ocean = vec3(0.10, 0.27, 0.62);\n vec3 cloud = vec3(0.85, 0.88, 0.92);\n float band = 0.5 + 0.5 * sin(nrm.z * 9.0 + nrm.x * 5.0);\n vec3 c = mix(ocean, cloud, smoothstep(0.55, 0.95, band) * 0.6);\n float limb = 1.0 - 0.35 * r2;\n vec3 colour = c * (0.04 + 0.96 * max(d, 0.0)) * day * limb;\n colour += c * 0.012; // the night side's own faint light\n gl_FragColor = vec4(pow(clamp(colour, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}\n";
20
+ export declare const DISC_FRAGMENT = "\nprecision highp float;\nuniform float uKind;\nuniform vec3 uSunEnu; // the Sun's direction in the sky's own frame (east, north, up)\nuniform vec3 uDirEnu; // the disc's direction in the same frame\nuniform vec3 uRightEnu;\nuniform vec3 uUpEnu;\nuniform float uExposure;\nvarying vec2 vUv;\nfloat hash3(vec3 p) { return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453); }\nfloat vnoise3(vec3 p) {\n vec3 i = floor(p);\n vec3 f = fract(p);\n f = f * f * (3.0 - 2.0 * f);\n return mix(\n mix(mix(hash3(i), hash3(i + vec3(1.0, 0.0, 0.0)), f.x), mix(hash3(i + vec3(0.0, 1.0, 0.0)), hash3(i + vec3(1.0, 1.0, 0.0)), f.x), f.y),\n mix(mix(hash3(i + vec3(0.0, 0.0, 1.0)), hash3(i + vec3(1.0, 0.0, 1.0)), f.x), mix(hash3(i + vec3(0.0, 1.0, 1.0)), hash3(i + vec3(1.0, 1.0, 1.0)), f.x), f.y),\n f.z);\n}\nvoid main() {\n float r2 = dot(vUv, vUv);\n if (r2 > 1.0) discard;\n if (uKind < 0.5) { gl_FragColor = vec4(vec3(1.0), 1.0); return; }\n // the sphere's normal toward the viewer, in the sky's frame: the viewer looks along uDirEnu, so the face toward it points the other way\n vec3 nrm = normalize(-uDirEnu * sqrt(1.0 - r2) + uRightEnu * vUv.x + uUpEnu * vUv.y);\n float d = dot(nrm, uSunEnu);\n float day = smoothstep(-0.02, 0.06, d);\n vec3 ocean = vec3(0.10, 0.27, 0.62);\n vec3 cloud = vec3(0.85, 0.88, 0.92);\n // clouds as noise in all three directions: a sine along one axis is a band, and with the sky's vertical as that axis it reads as a gas giant's\n float blotch = 0.65 * vnoise3(nrm * 4.0) + 0.35 * vnoise3(nrm * 9.0);\n vec3 c = mix(ocean, cloud, smoothstep(0.5, 0.8, blotch) * 0.6);\n float limb = 1.0 - 0.35 * r2;\n vec3 colour = c * (0.04 + 0.96 * max(d, 0.0)) * day * limb;\n colour += c * 0.012; // the night side's own faint light\n gl_FragColor = vec4(pow(clamp(colour, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}\n";
21
21
  /** The rover's traverse as a faint pair of tracks on the ground: a strip along the published line, its heights read from the same pyramid and made craters as the ground, drawn a hair over it. */
22
22
  export declare const TRACK_VERTEX = "\nprecision highp float;\nprecision highp sampler2D;\nuniform mat4 uVP;\nuniform vec2 uEyeEN;\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\nvarying vec2 vUv;\nvarying float vDist;\nvoid main() {\n vec2 p = position.xy;\n float dist = distance(p, uEyeEN);\n vUv = uv;\n vDist = dist;\n if (dist > 600.0) {\n gl_Position = vec4(2.0, 2.0, 2.0, 1.0);\n return;\n }\n float y = terrainY(p, dist, true);\n if (uDetail > 0.5) y += madeGround(p, max(2.5 * dist * uPixel, 0.06 * dist)).x;\n y += 0.03 + 0.0007 * dist;\n gl_Position = uVP * vec4(p.x, y, -p.y, 1.0);\n}\n";
23
23
  export declare const TRACK_FRAGMENT = "\nprecision highp float;\nvarying vec2 vUv;\nvarying float vDist;\nvoid main() {\n // two bands, a wheel's width each, a gauge apart, broken a little along the way, fading out with the distance: faint on purpose\n float band = smoothstep(0.11, 0.0, abs(abs(vUv.y) - 0.64));\n float broken = 0.65 + 0.35 * fract(sin(floor(vUv.x * 3.0) * 12.9898) * 43758.5453);\n float a = band * broken * 0.14 * (1.0 - smoothstep(250.0, 600.0, vDist));\n if (a < 0.004) discard;\n gl_FragColor = vec4(0.0, 0.0, 0.0, a);\n}\n";
@@ -303,7 +303,8 @@ void main() {
303
303
  vec2 slope = vec2((hE - hW) / (2.0 * e), (hN - hS) / (2.0 * e));
304
304
  if (uDetail > 0.5) {
305
305
  if (fromD < 24.0) slope += madeGround(vP.xz, fromD).yz;
306
- slope += roughness(vP.xz, dist * uPixel);
306
+ // the dust's grain only where the Sun is well on the ground: where it grazes, a grain a degree off lights or darkens each cell and the grain reads as blocks
307
+ slope += roughness(vP.xz, dist * uPixel) * smoothstep(0.0, 0.12, dot(normalize(vec3(-slope.x, 1.0, -slope.y)), uSun));
307
308
  }
308
309
  vec3 n = normalize(vec3(-slope.x, 1.0, -slope.y));
309
310
  float mu0 = dot(n, uSun);
@@ -398,6 +399,16 @@ uniform vec3 uRightEnu;
398
399
  uniform vec3 uUpEnu;
399
400
  uniform float uExposure;
400
401
  varying vec2 vUv;
402
+ float hash3(vec3 p) { return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453); }
403
+ float vnoise3(vec3 p) {
404
+ vec3 i = floor(p);
405
+ vec3 f = fract(p);
406
+ f = f * f * (3.0 - 2.0 * f);
407
+ return mix(
408
+ mix(mix(hash3(i), hash3(i + vec3(1.0, 0.0, 0.0)), f.x), mix(hash3(i + vec3(0.0, 1.0, 0.0)), hash3(i + vec3(1.0, 1.0, 0.0)), f.x), f.y),
409
+ mix(mix(hash3(i + vec3(0.0, 0.0, 1.0)), hash3(i + vec3(1.0, 0.0, 1.0)), f.x), mix(hash3(i + vec3(0.0, 1.0, 1.0)), hash3(i + vec3(1.0, 1.0, 1.0)), f.x), f.y),
410
+ f.z);
411
+ }
401
412
  void main() {
402
413
  float r2 = dot(vUv, vUv);
403
414
  if (r2 > 1.0) discard;
@@ -408,8 +419,9 @@ void main() {
408
419
  float day = smoothstep(-0.02, 0.06, d);
409
420
  vec3 ocean = vec3(0.10, 0.27, 0.62);
410
421
  vec3 cloud = vec3(0.85, 0.88, 0.92);
411
- float band = 0.5 + 0.5 * sin(nrm.z * 9.0 + nrm.x * 5.0);
412
- vec3 c = mix(ocean, cloud, smoothstep(0.55, 0.95, band) * 0.6);
422
+ // clouds as noise in all three directions: a sine along one axis is a band, and with the sky's vertical as that axis it reads as a gas giant's
423
+ float blotch = 0.65 * vnoise3(nrm * 4.0) + 0.35 * vnoise3(nrm * 9.0);
424
+ vec3 c = mix(ocean, cloud, smoothstep(0.5, 0.8, blotch) * 0.6);
413
425
  float limb = 1.0 - 0.35 * r2;
414
426
  vec3 colour = c * (0.04 + 0.96 * max(d, 0.0)) * day * limb;
415
427
  colour += c * 0.012; // the night side's own faint light
@@ -124,6 +124,13 @@ export interface HeightLevel extends HeightLevelInfo {
124
124
  * ```
125
125
  */
126
126
  export declare function tileAddress(base: string, manifest: Pick<TerrainManifest, "body" | "site" | "format">, level: string, column: number, row: number): string;
127
+ /**
128
+ * Credits joined into one line, each name once: a credit is a list of names, and the heights and the ground picture of a site often name the same one.
129
+ *
130
+ * @param credits - The credits, each a list of names split by commas (a comma inside brackets stays in its name); `undefined` is skipped.
131
+ * @returns The names in the order first met, split by commas.
132
+ */
133
+ export declare function joinCredits(...credits: readonly (string | undefined)[]): string;
127
134
  /**
128
135
  * An empty level, ready to be filled tile by tile: every height the lowest the encoding holds until a tile says otherwise.
129
136
  *
@@ -21,6 +21,16 @@
21
21
  export function tileAddress(base, manifest, level, column, row) {
22
22
  return `${base.endsWith("/") ? base : `${base}/`}${manifest.body}/${manifest.site}/terrain/${level}/${column}/${row}.${manifest.format ?? "png"}`;
23
23
  }
24
+ /**
25
+ * Credits joined into one line, each name once: a credit is a list of names, and the heights and the ground picture of a site often name the same one.
26
+ *
27
+ * @param credits - The credits, each a list of names split by commas (a comma inside brackets stays in its name); `undefined` is skipped.
28
+ * @returns The names in the order first met, split by commas.
29
+ */
30
+ export function joinCredits(...credits) {
31
+ const names = credits.flatMap((credit) => (credit ?? "").split(/,\s*(?![^(]*\))/).map((name) => name.trim()));
32
+ return [...new Set(names.filter((name) => name !== ""))].join(", ");
33
+ }
24
34
  /**
25
35
  * An empty level, ready to be filled tile by tile: every height the lowest the encoding holds until a tile says otherwise.
26
36
  *
Binary file
Binary file