@johnmorrisdotca/wakusei-planets 0.63.0 → 0.65.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.
@@ -159,9 +159,11 @@ export class WakuseiSurface extends HTMLElement {
159
159
  this.#look = clampLook(value);
160
160
  this.#changed();
161
161
  }
162
- /** Where the eyes are: metres east and north of the site, and metres over the ground under them. */
162
+ /** Where the eyes are: metres east and north of the site, and metres over the ground under them. Standing, that is a person's height; while the rover is driven or the landing watched, it is the height of the view being drawn (the seat, the chase camera). */
163
163
  get position() {
164
- return { ...this.#at, up: EYE_HEIGHT };
164
+ if (this.#terrain === undefined || (this.#vehicle === undefined && this.#landing === undefined))
165
+ return { ...this.#at, up: EYE_HEIGHT };
166
+ return { ...this.#at, up: this.#eyeUp() - this.#groundAt(this.#at.east, this.#at.north) };
165
167
  }
166
168
  /** The sky now: the Sun and the Earth in it. */
167
169
  get sky() {
@@ -182,7 +184,7 @@ export class WakuseiSurface extends HTMLElement {
182
184
  /** Numbers for a test or a status line: the draws, the tiles, the renderer's own counts, the mesh, the quality of the last draw and the milliseconds of the last measured one. */
183
185
  get stats() {
184
186
  const scene = this.#view?.scene;
185
- return { state: this.#state, draws: this.#draws, tiles: this.#progress, renderer: this.#renderer?.stats, mesh: scene?.mesh, quality: this.#quality(), scale: this.#drawScale, scaled: this.#scaled, landing: this.landing, vehicle: this.#vehicle === undefined ? undefined : { ...this.#vehicle, spin: [...this.#vehicle.spin] }, drawMs: scene?.drawMs ?? this.#drawMs, rocks: scene?.rocks ?? 0 };
187
+ return { state: this.#state, draws: this.#draws, tiles: this.#progress, renderer: this.#renderer?.stats, mesh: scene?.mesh, quality: this.#quality(), scale: this.#drawScale, scaled: this.#scaled, landing: this.landing, vehicle: this.#vehicle === undefined ? undefined : { ...this.#vehicle, spin: [...this.#vehicle.spin] }, drawMs: scene?.drawMs ?? this.#drawMs, rocks: scene?.rocks ?? 0, vehicleDrawn: scene?.vehicleDrawn ?? false };
186
188
  }
187
189
  /** The quality of the next draw: the `quality` attribute, or in `auto` the quality of motion while the view moves and the machine's own quality of rest otherwise. */
188
190
  #quality() {
@@ -69,6 +69,8 @@ export interface SurfaceScene extends Scene3D {
69
69
  rays: number;
70
70
  triangles: number;
71
71
  };
72
+ /** Whether the driven vehicle is in the picture as of the last `apply`: its shapes, or its model. It is, whenever a drive is on, at a site with things on the ground or without. */
73
+ readonly vehicleDrawn: boolean;
72
74
  }
73
75
  export interface SurfaceItemOptions {
74
76
  /** The pyramid's levels, finest first, filled with their heights. */
@@ -365,9 +365,12 @@ export function createSurfaceItem(options) {
365
365
  let vehicleShadow;
366
366
  let vehicleCount = 0;
367
367
  let modelDrawn;
368
+ // The driven vehicle is drawn whenever a drive is on. `objects` is for the things at the site and the rover's tracks: a site with none (the flat-ground ones) still has its vehicle.
369
+ let vehicleDrawn = false;
368
370
  const makeVehicle = (state) => {
369
371
  const v = state.vehicle;
370
- if (v === undefined || state.objects === false) {
372
+ vehicleDrawn = v !== undefined;
373
+ if (v === undefined) {
371
374
  modelDrawn = undefined;
372
375
  if (vehicleMesh !== undefined)
373
376
  vehicleMesh.visible = false;
@@ -748,6 +751,9 @@ export function createSurfaceItem(options) {
748
751
  scene,
749
752
  camera,
750
753
  mesh: { rings: RINGS, rays: RAYS, triangles },
754
+ get vehicleDrawn() {
755
+ return vehicleDrawn;
756
+ },
751
757
  get rocks() {
752
758
  return rockCount;
753
759
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.63.0",
3
+ "version": "0.65.0",
4
4
  "description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
5
5
  "keywords": [
6
6
  "planets",
@@ -441,6 +441,11 @@
441
441
  "import": "./dist/sky-bodies.js",
442
442
  "default": "./dist/sky-bodies.js"
443
443
  },
444
+ "./sky": {
445
+ "types": "./dist/sky.d.ts",
446
+ "import": "./dist/sky.js",
447
+ "default": "./dist/sky.js"
448
+ },
444
449
  "./suncalc": {
445
450
  "types": "./dist/suncalc.d.ts",
446
451
  "import": "./dist/suncalc.js",
@@ -720,9 +725,13 @@
720
725
  },
721
726
  "peerDependencies": {
722
727
  "@johnmorrisdotca/chikyu-earth": ">=0.10.0",
728
+ "astronomy-engine": ">=2.1.19 <3",
723
729
  "three": ">=0.160.0"
724
730
  },
725
731
  "peerDependenciesMeta": {
732
+ "astronomy-engine": {
733
+ "optional": true
734
+ },
726
735
  "three": {
727
736
  "optional": true
728
737
  },