vibeglobe 0.2.0 → 0.3.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/dist/globe/motion-detail.d.ts +6 -7
- package/core/dist/globe/motion-detail.d.ts.map +1 -1
- package/core/dist/globe/motion-detail.js +7 -6
- package/core/dist/globe/motion-detail.js.map +1 -1
- package/core/dist/globe/surface-frame.js +5 -6
- package/core/dist/globe/surface-frame.js.map +1 -1
- package/core/dist/imagery/imagery-draws.d.ts.map +1 -1
- package/core/dist/imagery/imagery-draws.js +30 -6
- package/core/dist/imagery/imagery-draws.js.map +1 -1
- package/core/dist/imagery/imagery-loader.hot.d.ts +5 -0
- package/core/dist/imagery/imagery-loader.hot.d.ts.map +1 -1
- package/core/dist/imagery/imagery-loader.hot.js +5 -0
- package/core/dist/imagery/imagery-loader.hot.js.map +1 -1
- package/core/src/globe/motion-detail.ts +7 -6
- package/core/src/globe/surface-frame.ts +5 -5
- package/core/src/imagery/imagery-draws.ts +29 -6
- package/core/src/imagery/imagery-loader.hot.ts +5 -0
- package/dist/create-vibe-globe.d.ts +4 -1
- package/dist/create-vibe-globe.d.ts.map +1 -1
- package/dist/create-vibe-globe.js +4 -4
- package/dist/create-vibe-globe.js.map +1 -1
- package/docs/data-licenses.md +9 -0
- package/docs/guides/integration.md +6 -4
- package/docs/guides/services.md +8 -7
- package/docs/guides/sources.md +25 -2
- package/package.json +1 -1
- package/quality/README.md +2 -1
- package/quality/dist/quality.d.ts +3 -2
- package/quality/dist/quality.d.ts.map +1 -1
- package/quality/dist/quality.js +31 -4
- package/quality/dist/quality.js.map +1 -1
- package/quality/src/quality.ts +29 -4
- package/sources/dist/earth-images.d.ts +25 -0
- package/sources/dist/earth-images.d.ts.map +1 -0
- package/sources/dist/earth-images.js +46 -0
- package/sources/dist/earth-images.js.map +1 -0
- package/sources/dist/index.d.ts +1 -0
- package/sources/dist/index.d.ts.map +1 -1
- package/sources/dist/index.js +1 -0
- package/sources/dist/index.js.map +1 -1
- package/sources/src/earth/day.webp +0 -0
- package/sources/src/earth/night.webp +0 -0
- package/sources/src/earth-images.ts +55 -0
- package/sources/src/index.ts +8 -0
- package/src/create-vibe-globe.ts +8 -7
- package/vue/README.md +2 -0
- package/vue/dist/globe-config.d.ts +2 -1
- package/vue/dist/globe-config.d.ts.map +1 -1
- package/vue/dist/globe-config.js +3 -1
- package/vue/dist/globe-config.js.map +1 -1
- package/vue/dist/vibe-globe.d.ts +11 -4
- package/vue/dist/vibe-globe.d.ts.map +1 -1
- package/vue/dist/vibe-globe.js +5 -2
- package/vue/dist/vibe-globe.js.map +1 -1
- package/vue/src/globe-config.ts +5 -2
- package/vue/src/vibe-globe.ts +5 -2
- package/web-component/dist/browser/vibe-globe.js +809 -799
|
@@ -22,14 +22,15 @@ const MOTION_FACTOR = 2;
|
|
|
22
22
|
/** Index of the last frame's factor in {@link MotionDetail.state}, which per-frame code reads directly. */
|
|
23
23
|
export const FACTOR = 3;
|
|
24
24
|
/** Index of the largest texel at rest in {@link MotionDetail.state}. */
|
|
25
|
-
|
|
25
|
+
const BASE_TEXEL = 4;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Motion-aware detail (F287, F288, F301): while the camera moves fast the imagery may be coarser (texels up
|
|
29
|
-
* times the still size, two levels), so a fast pan or a flight loads fewer, coarser tiles it can actually show;
|
|
30
|
-
* slow link one level coarser again.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* Motion-aware detail (F287, F288, F301): while the camera moves fast the imagery it requests may be coarser (texels up
|
|
29
|
+
* to four times the still size, two levels), so a fast pan or a flight loads fewer, coarser tiles it can actually show;
|
|
30
|
+
* on a slow link one level coarser again. What is already resident still draws at the still detail (F713). Once the
|
|
31
|
+
* camera slows the factor returns to 1 and the finer tiles load and fade in. The speed is the eye's motion in view
|
|
32
|
+
* ranges (its distance to the target) per second, remembered with a fast decay so a frame without motion does not
|
|
33
|
+
* refine at once. A zoom out is not motion here (KB-309).
|
|
33
34
|
*/
|
|
34
35
|
export class MotionDetail {
|
|
35
36
|
private readonly lastEye = new Float64Array(3).fill(Number.NaN);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
3
3
|
import type { LayerGround } from '../layers/layer-target.js';
|
|
4
4
|
import { refuseDisplayOnly } from './display-only.js';
|
|
5
|
-
import {
|
|
5
|
+
import { FACTOR, motionOf } from './motion-detail.js';
|
|
6
6
|
import { DrawList, drawOnBaseImage, drawWithoutTerrain } from '../imagery/draw-list.js';
|
|
7
7
|
import { DEFAULT_FADE_MS } from '../imagery/fades.js';
|
|
8
8
|
import {
|
|
@@ -288,16 +288,16 @@ export class SurfaceFrame {
|
|
|
288
288
|
const imagery = this.imagery;
|
|
289
289
|
const timed = imagery?.heights !== undefined;
|
|
290
290
|
const selectionStart = timed ? imagery.now() : 0;
|
|
291
|
-
// Motion-aware detail (F288): a fast camera
|
|
291
|
+
// Motion-aware detail (F288): a fast camera requests coarser imagery and loads ahead nothing, nor does a flight
|
|
292
|
+
// (F287); it selects and draws the still view's tiles, finer imagery already resident included (F713).
|
|
292
293
|
motionOf(this).flying = imagery?.plan.flying === true;
|
|
293
294
|
motionOf(this).update(camera, this.nowMs, imagery?.network.bandwidth);
|
|
294
295
|
const motion = motionOf(this).state[FACTOR] ?? 1;
|
|
295
|
-
// Written only when it changes: a new double in the options' field would allocate every frame (F064).
|
|
296
|
-
const texelErrorPx = (motionOf(this).state[BASE_TEXEL] ?? 1.5) * motion;
|
|
297
|
-
if (this.selection.maxTexelErrorPx !== texelErrorPx) this.selection.maxTexelErrorPx = texelErrorPx;
|
|
298
296
|
if (imagery)
|
|
299
297
|
for (const layer of imagery.layers) {
|
|
300
298
|
layer.loader.prefetchPaused = motion > 1 || imagery.plan.flying;
|
|
299
|
+
// The factor's levels: 1, 2, 4 and 8 are 0 to 3.
|
|
300
|
+
layer.loader.motionLevels = 31 - Math.clz32(motion);
|
|
301
301
|
// A flight requests no visible tile: its plan loads the path and the destination instead (F287, F671).
|
|
302
302
|
layer.loader.settleMs = imagery.plan.flying ? Number.POSITIVE_INFINITY : 0;
|
|
303
303
|
}
|
|
@@ -253,14 +253,18 @@ function writeOverlays(list: DrawList, index: number, overlays: number): void {
|
|
|
253
253
|
/**
|
|
254
254
|
* Wants a tile of a layer from its source chain (F247, F248): the first source that has the tile at the surface's
|
|
255
255
|
* level (within its levels and coverage, not missing or failing), the deepest resident tile of which is drawn; while
|
|
256
|
-
* that source's tiles load, a resident tile of another source stands in. When no source has it, the
|
|
257
|
-
*
|
|
258
|
-
* `mapping`, or -1 when nothing is resident.
|
|
256
|
+
* that source's tiles load, a resident tile of another source stands in. When no source has it, the covering source
|
|
257
|
+
* whose last level is finest shows it magnified (KB-344), and while it loads the first source that covers the area
|
|
258
|
+
* does. Returns the chosen source's index with the handle and mapping in `mapping`, or -1 when nothing is resident.
|
|
259
259
|
*/
|
|
260
260
|
function wantChain(chain: readonly ImageryLayer[], tile: QuadtreeTile, distance: number): number {
|
|
261
261
|
let fallback = -1;
|
|
262
262
|
// The first source with no tile here: its own ancestors may still be finer than another source's (KB-331).
|
|
263
263
|
let missing = -1;
|
|
264
|
+
// Of the covering sources whose last level the tile is past, the one whose last level is finest, and its floor.
|
|
265
|
+
let finest = -1;
|
|
266
|
+
let finestTop = -1;
|
|
267
|
+
let finestFloor = 0;
|
|
264
268
|
// Levels an earlier source serves are its own: a later source is asked only for finer ones (F247).
|
|
265
269
|
let floor = 0;
|
|
266
270
|
for (let k = 0; k < chain.length; k++) {
|
|
@@ -269,11 +273,17 @@ function wantChain(chain: readonly ImageryLayer[], tile: QuadtreeTile, distance:
|
|
|
269
273
|
if (!hasTile(layer, tile)) {
|
|
270
274
|
// A source that answered "no tile" here shows its ancestors only where no other source serves finer ones (KB-142,
|
|
271
275
|
// KB-149, KB-331).
|
|
272
|
-
|
|
276
|
+
const covers = mapInto(layer, tile);
|
|
277
|
+
if (covers && fallback < 0) {
|
|
273
278
|
if (!unavailableAtMapping(layer)) fallback = k;
|
|
274
279
|
else if (missing < 0) missing = k;
|
|
275
280
|
}
|
|
276
281
|
const top = topLevel(layer);
|
|
282
|
+
if (covers && tile.level > top && top > finestTop) {
|
|
283
|
+
finest = k;
|
|
284
|
+
finestTop = top;
|
|
285
|
+
finestFloor = floor;
|
|
286
|
+
}
|
|
277
287
|
if (tile.level > top && top + 1 > floor) floor = top + 1;
|
|
278
288
|
continue;
|
|
279
289
|
}
|
|
@@ -287,6 +297,9 @@ function wantChain(chain: readonly ImageryLayer[], tile: QuadtreeTile, distance:
|
|
|
287
297
|
const own = chain[missing];
|
|
288
298
|
// Its own ancestors when finer than anything another source serves there (Esri's filler, F691).
|
|
289
299
|
if (own && wantLayer(own, tile, distance, floor) >= 0) return missing;
|
|
300
|
+
// Zoomed past every source's last level, the finest of them shows magnified, not the first (KB-344).
|
|
301
|
+
const best = chain[finest];
|
|
302
|
+
if (best && finest !== fallback && wantLayer(best, tile, distance, finestFloor) >= 0) return finest;
|
|
290
303
|
const covering = chain[fallback];
|
|
291
304
|
return covering && wantLayer(covering, tile, distance, 0) >= 0 ? fallback : -1;
|
|
292
305
|
}
|
|
@@ -379,13 +392,23 @@ const COVER_SPAN = 32;
|
|
|
379
392
|
* source of the chain) are neither requested nor looked up. While nothing finer is resident, the ancestor
|
|
380
393
|
* {@link COVER_LEVELS} up (or the coarsest level), and the coarser ones requested, are requested before every visible
|
|
381
394
|
* tile, coarse first (KB-305). In both classes a request ranks by its levels below the tile's wanted one, not by its
|
|
382
|
-
* own level: where half a view wants deeper levels than the other half, both halves sharpen together (KB-330).
|
|
395
|
+
* own level: where half a view wants deeper levels than the other half, both halves sharpen together (KB-330). A fast
|
|
396
|
+
* camera's requests start `loader.motionLevels` below the tile's level, the finer ones drawn only when resident (F713).
|
|
383
397
|
*/
|
|
384
398
|
function wantLayer(layer: ImageryLayer, tile: QuadtreeTile, distance: number, floor: number): number {
|
|
385
399
|
const source = layer.source;
|
|
386
400
|
if (!mapInto(layer, tile)) return -1;
|
|
387
|
-
const wanted = mapped(MAPPING_LEVEL);
|
|
388
401
|
const lowest = source.minLevel > floor ? source.minLevel : floor;
|
|
402
|
+
// A fast camera requests coarser levels only: the finer ones it draws when already resident (F713).
|
|
403
|
+
for (let skip = layer.loader.motionLevels; skip > 0 && mapped(MAPPING_LEVEL) > lowest; skip--) {
|
|
404
|
+
const handle = layer.loader.readyHandle(mapped(MAPPING_LEVEL), mapped(MAPPING_X), mapped(MAPPING_Y));
|
|
405
|
+
if (handle >= 0) {
|
|
406
|
+
mapping[MAPPING_HANDLE] = handle;
|
|
407
|
+
return handle;
|
|
408
|
+
}
|
|
409
|
+
mapAncestor(mapping, 0, 1);
|
|
410
|
+
}
|
|
411
|
+
const wanted = mapped(MAPPING_LEVEL);
|
|
389
412
|
const cover = wanted - COVER_LEVELS > lowest ? wanted - COVER_LEVELS : lowest;
|
|
390
413
|
// Once a finer tile's bytes are in hand (ARRIVING), coarser ones are only looked up, never requested (F097).
|
|
391
414
|
let arriving = false;
|
|
@@ -248,6 +248,11 @@ export class ImageryLoader implements NetworkPoolClient {
|
|
|
248
248
|
* long, milliseconds: tiles a moving view shows for a moment never load (F287). Its ancestors stand in meanwhile.
|
|
249
249
|
*/
|
|
250
250
|
settleMs = 0;
|
|
251
|
+
/**
|
|
252
|
+
* Levels below a visible tile's own that a fast camera requests it from, 0 at rest (F288, F713): the finer levels are
|
|
253
|
+
* only looked up, so tiles already on the GPU keep drawing while nothing finer loads.
|
|
254
|
+
*/
|
|
255
|
+
motionLevels = 0;
|
|
251
256
|
/** Surface levels finer than the source's tiles: 1 for tiles of 512 texels, which serve the next level (F240). */
|
|
252
257
|
levelShift = 0;
|
|
253
258
|
|
|
@@ -7,7 +7,10 @@ export interface VibeGlobeOptions extends Omit<GlobeOptions, 'container' | 'rend
|
|
|
7
7
|
readonly tiles: TileService;
|
|
8
8
|
/** Place search; without it the search box accepts coordinates only. */
|
|
9
9
|
readonly geocoder?: GeocoderService;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* An equirectangular image of the whole world, shown where no tile is loaded yet (default: the NASA Blue Marble
|
|
12
|
+
* shipped with the package, `dayImageUrl()` of `vibeglobe/sources`, with its polar caps).
|
|
13
|
+
*/
|
|
11
14
|
readonly baseImageryUrl?: string;
|
|
12
15
|
/** Mouse, touch and keyboard navigation options, or false for none. */
|
|
13
16
|
readonly controls?: ControlsOptions | false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-vibe-globe.d.ts","sourceRoot":"","sources":["../src/create-vibe-globe.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-vibe-globe.d.ts","sourceRoot":"","sources":["../src/create-vibe-globe.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAgC,KAAK,EAAE,EAAE,MAAM,eAAe,CAAC;AAGtE,kHAAkH;AAClH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,YAAY,EACZ,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,gBAAgB,GAAG,SAAS,GAAG,SAAS,CACjF;IACC,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,KAAK,CAAC;IAC5C,gGAAgG;IAChG,QAAQ,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC;IACtB,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC;IAC5B,2DAA2D;IAC3D,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CA2C3G"}
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
import { createControls } from 'vibeglobe/controls';
|
|
4
4
|
import { createGlobe, GlobeError, } from 'vibeglobe/core';
|
|
5
5
|
import { createRenderer } from 'vibeglobe/renderer';
|
|
6
|
+
import { DAY_IMAGE_POLAR_CAPS, dayImageUrl } from 'vibeglobe/sources';
|
|
6
7
|
import { addDefaultControls, createUi } from 'vibeglobe/ui';
|
|
7
8
|
import { createWorkers } from 'vibeglobe/worker';
|
|
8
|
-
/** A 1×1 ocean-blue image: the world under the tiles while none is loaded, without an asset to host. */
|
|
9
|
-
const OCEAN = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGOQsY8BAAEyALi+BX15AAAAAElFTkSuQmCC';
|
|
10
9
|
/**
|
|
11
10
|
* Starts VibeGlobe in `container` with the application's services (ADR 0186): the tiles, required, and optionally a
|
|
12
11
|
* terrain and a geocoder. Resolves once the first frame is drawn and the tile service's style, if any, is attached;
|
|
@@ -14,15 +13,16 @@ const OCEAN = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1P
|
|
|
14
13
|
* style does not load.
|
|
15
14
|
*/
|
|
16
15
|
export async function createVibeGlobe(container, options) {
|
|
17
|
-
const { tiles, geocoder, controls, ui: withUi = true, language, baseImageryUrl
|
|
16
|
+
const { tiles, geocoder, controls, ui: withUi = true, language, baseImageryUrl, ...engine } = options;
|
|
18
17
|
if (!tiles)
|
|
19
18
|
throw new GlobeError('invalid-option', 'createVibeGlobe needs a tile service: { tiles }');
|
|
20
19
|
const globe = createGlobe({
|
|
20
|
+
...(baseImageryUrl ? {} : { polarCapColors: DAY_IMAGE_POLAR_CAPS }),
|
|
21
21
|
...engine,
|
|
22
22
|
container,
|
|
23
23
|
renderer: createRenderer(),
|
|
24
24
|
...(controls === false ? {} : { controls: createControls(controls) }),
|
|
25
|
-
baseImageryUrl,
|
|
25
|
+
baseImageryUrl: baseImageryUrl ?? dayImageUrl(),
|
|
26
26
|
imagery: tiles.imagery,
|
|
27
27
|
workers: createWorkers(),
|
|
28
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-vibe-globe.js","sourceRoot":"","sources":["../src/create-vibe-globe.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,kFAAkF;AAClF,OAAO,EAAE,cAAc,EAAwB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACL,WAAW,EACX,UAAU,GAKX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"create-vibe-globe.js","sourceRoot":"","sources":["../src/create-vibe-globe.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,kFAAkF;AAClF,OAAO,EAAE,cAAc,EAAwB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACL,WAAW,EACX,UAAU,GAKX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,qBA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AC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7D,IAAI,KAAqC,CAAC;IAC1C,MAAM,OAAO,GAAG,GAAS,EAAE;QACzB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,EAAE,EAAE,OAAO,EAAE,CAAC;QACd,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC,CAAC;IACF,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,KAAK,CAAC;QAClB,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,sBAAsB,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBACzE,MAAM,CAAC,gCAAgC,CAAC;gBACxC,MAAM,CAAC,kCAAkC,CAAC;aAC3C,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,EAAE;gBACzC,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,MAAM,EAAE,sBAAsB;gBAC9B,OAAO,EAAE,SAAS;aACnB,CAAC,CAAC;YACH,IAAI,QAAQ;gBAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC3C,KAAK,GAAG,MAAM,CAAC;QACjB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;QACV,MAAM,KAAK,YAAY,UAAU;YAC/B,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,IAAI,UAAU,CAAC,iBAAiB,EAAE,4BAA4B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC"}
|
package/docs/data-licenses.md
CHANGED
|
@@ -24,6 +24,15 @@ The application hosts these outputs itself and shows each attribution wherever t
|
|
|
24
24
|
| ------------------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- | ---------- |
|
|
25
25
|
| Fresher imagery: a mosaic built from raw Copernicus Sentinel-2 data | Copernicus Sentinel data licence (free, full and open) | Contains modified Copernicus Sentinel data {year} (the year of the data) | [https://registry.opendata.aws/sentinel-2-l2a-cogs/](https://registry.opendata.aws/sentinel-2-l2a-cogs/) | 2026-10-21 |
|
|
26
26
|
|
|
27
|
+
## Images shipped in the package
|
|
28
|
+
|
|
29
|
+
Two images ship in `vibeglobe/sources` (ADR 0194); an application that shows them shows their attribution.
|
|
30
|
+
|
|
31
|
+
| Image | Used by | License | Attribution (exact) | Source |
|
|
32
|
+
| ------------------------------------------------------------ | --------------------------------------- | ------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
33
|
+
| NASA Blue Marble, shaded relief and bathymetry (4096 × 2048) | `dayImageUrl()`, the default base image | Public domain | Imagery: NASA Blue Marble, from NASA's Global Imagery Browse Services (GIBS), part of NASA's ESDIS | [https://www.earthdata.nasa.gov/gibs](https://www.earthdata.nasa.gov/gibs) |
|
|
34
|
+
| NASA Black Marble 2016, VIIRS night lights (2048 × 2048) | `nightImageUrl()`, `nightLights()` | Public domain | Night lights: NASA Black Marble | [https://earthobservatory.nasa.gov/features/NightLights](https://earthobservatory.nasa.gov/features/NightLights) |
|
|
35
|
+
|
|
27
36
|
## Refused sources
|
|
28
37
|
|
|
29
38
|
The pipeline and the offline package builder (`vibeglobe-data pack`) refuse these before downloading anything:
|
|
@@ -51,9 +51,11 @@ assemble the same engine piece by piece, for an application that needs to choose
|
|
|
51
51
|
|
|
52
52
|
## The base image
|
|
53
53
|
|
|
54
|
-
`baseImageryUrl` is
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
`baseImageryUrl` is an equirectangular image of the whole world (for example a JPEG of 4096 × 2048 pixels). The engine
|
|
55
|
+
drapes it over the globe before any tile arrives and wherever no imagery layer has a tile. `createGlobe` and the Web
|
|
56
|
+
Component require it; `createVibeGlobe` and the Vue component default to the NASA Blue Marble shipped in the package
|
|
57
|
+
(`dayImageUrl()` of `vibeglobe/sources`, with its polar caps `DAY_IMAGE_POLAR_CAPS`), which bundlers copy to the
|
|
58
|
+
application's assets. `globe.ready` waits for it, and rejects with a `GlobeError` (`resource-failed`)
|
|
57
59
|
when it fails to load. The [hosting guide](hosting.md) shows how to build one from public-domain data.
|
|
58
60
|
|
|
59
61
|
## Plain TypeScript
|
|
@@ -151,7 +153,7 @@ the controls and, when `imagery` is set, the workers (`createWorkers()` of `vibe
|
|
|
151
153
|
|
|
152
154
|
| Prop | Applied | Effect |
|
|
153
155
|
| -------------------------------------------------------------- | --------------- | -------------------------------------------------------------------------- |
|
|
154
|
-
| `baseImageryUrl` | at start |
|
|
156
|
+
| `baseImageryUrl` | at start | The base image (default: the shipped NASA Blue Marble) |
|
|
155
157
|
| `imagery` | at start | Imagery sources, bottom first |
|
|
156
158
|
| `backend` | at start | `'auto'` (default), `'webgpu'` or `'webgl2'` |
|
|
157
159
|
| `controls` | at start | `true` (default), `false`, or the options of `createControls` |
|
package/docs/guides/services.md
CHANGED
|
@@ -70,12 +70,12 @@ key or token only when a request is made; a source's `attribution` and `profile`
|
|
|
70
70
|
`createVibeGlobe(container, options)` takes the services and every `GlobeOptions` field the engine does not build
|
|
71
71
|
itself (`view`, `quality`, `constraints`, `atmosphere`, `home`, `memory`, …).
|
|
72
72
|
|
|
73
|
-
| Option | Type | Default
|
|
74
|
-
| ---------------- | -------------------------- |
|
|
75
|
-
| `ui` | `boolean` | `true`
|
|
76
|
-
| `controls` | `ControlsOptions \| false` | the defaults
|
|
77
|
-
| `language` | `string` | `'en'`
|
|
78
|
-
| `baseImageryUrl` | `string` |
|
|
73
|
+
| Option | Type | Default | Effect |
|
|
74
|
+
| ---------------- | -------------------------- | ------------------------- | ------------------------------------------------- |
|
|
75
|
+
| `ui` | `boolean` | `true` | search, zoom, compass, fullscreen and coordinates |
|
|
76
|
+
| `controls` | `ControlsOptions \| false` | the defaults | mouse, touch and keyboard navigation |
|
|
77
|
+
| `language` | `string` | `'en'` | the controls' language and the map's names |
|
|
78
|
+
| `baseImageryUrl` | `string` | NASA Blue Marble, shipped | the world image shown where no tile is loaded yet |
|
|
79
79
|
|
|
80
80
|
The promise resolves with `globe` (the `Globe`), `ui` (the controls, `undefined` with `ui: false`; add more with
|
|
81
81
|
`ui.add`) and `destroy()`, which stops the globe and removes its canvas and controls.
|
|
@@ -86,7 +86,8 @@ The promise resolves with `globe` (the `Globe`), `ui` (the controls, `undefined`
|
|
|
86
86
|
offline use and credits included.
|
|
87
87
|
- The style loads before the promise resolves; a style that fails to load rejects it and stops the globe.
|
|
88
88
|
- Keys in tile URLs are visible to anyone who opens the page: restrict them to your domains in the provider's console.
|
|
89
|
-
-
|
|
89
|
+
- Without `baseImageryUrl` the globe starts on the NASA Blue Marble shipped in the package (`dayImageUrl()` of
|
|
90
|
+
`vibeglobe/sources`, 0.85 MB), which your bundler copies to your assets; pass your own image to replace it.
|
|
90
91
|
|
|
91
92
|
## Errors
|
|
92
93
|
|
package/docs/guides/sources.md
CHANGED
|
@@ -214,6 +214,27 @@ const lights = mercatorImage({
|
|
|
214
214
|
// A layer of its own: globe.imageryLayers.add({ id: 'night-lights', blend: 'night', sources: [lights] }).
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
+
## Images of the Earth shipped with the package
|
|
218
|
+
|
|
219
|
+
Two public-domain images ship in `vibeglobe/sources`; bundlers copy them to the application's assets, and nothing
|
|
220
|
+
downloads them unless the application uses them.
|
|
221
|
+
|
|
222
|
+
- `dayImageUrl()`: NASA Blue Marble with bathymetry by day, equirectangular, 4096 × 2048 pixels (0.85 MB), the default
|
|
223
|
+
base image of `createVibeGlobe` and the Vue component. Pass it with `DAY_IMAGE_POLAR_CAPS` to `createGlobe`, and
|
|
224
|
+
show `DAY_IMAGE_CREDIT` with the other credits.
|
|
225
|
+
- `nightLights(image?)`: the night side's city lights, a `blend: 'night'` layer (`NIGHT_LIGHTS_ID`) cut from NASA's
|
|
226
|
+
Black Marble 2016 (`nightImageUrl()`, Web Mercator, 2048 pixels), or from the application's own image of the world.
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
import { createGlobe } from 'vibeglobe/core';
|
|
230
|
+
import { DAY_IMAGE_POLAR_CAPS, dayImageUrl, NIGHT_LIGHTS_ID, nightLights } from 'vibeglobe/sources';
|
|
231
|
+
|
|
232
|
+
const globe = createGlobe({ container, renderer, baseImageryUrl: dayImageUrl(), polarCapColors: DAY_IMAGE_POLAR_CAPS });
|
|
233
|
+
globe.imageryLayers.add({ ...nightLights(), visible: false }); // or nightLights('/my/night-lights.webp')
|
|
234
|
+
// Shown with the night side: globe.setAtmosphere({ dayNight: 1, timeMs: Date.now() }).
|
|
235
|
+
globe.imageryLayers.set(NIGHT_LIGHTS_ID, { visible: true });
|
|
236
|
+
```
|
|
237
|
+
|
|
217
238
|
## Reprojection
|
|
218
239
|
|
|
219
240
|
The engine draws Web Mercator and geographic pyramids. A service in another reference system, such as UTM zones 32N
|
|
@@ -265,7 +286,8 @@ transparent outside the data, so the layers below show there.
|
|
|
265
286
|
|
|
266
287
|
Web Mercator sources end at ±85.0511°. Beyond, the globe draws two polar caps: a geographic (`EPSG:4326`) imagery
|
|
267
288
|
source that covers them fills them; otherwise each cap shows one color, `#78a9cd` in the north and `#f2f3f7` in the
|
|
268
|
-
south (the sea and the ice of the
|
|
289
|
+
south (the sea and the ice of the Natural Earth base image the pipeline builds); the day image shipped in the package
|
|
290
|
+
comes with its own, `DAY_IMAGE_POLAR_CAPS`.
|
|
269
291
|
|
|
270
292
|
```ts
|
|
271
293
|
import { createGlobe } from 'vibeglobe/core';
|
|
@@ -283,7 +305,8 @@ globe at every zoom, so the cap is always a whole disc.
|
|
|
283
305
|
|
|
284
306
|
`createGlobe({ imagery })` takes layers bottom first. A layer is a source, or `{ id, sources, opacity, visible, blend }`
|
|
285
307
|
with sources in priority order: each tile comes from the first source that has it, and a source that fails (errors,
|
|
286
|
-
timeouts, offline) leaves its tiles to the next one.
|
|
308
|
+
timeouts, offline) leaves its tiles to the next one. Zoomed in past every source's last level, the source whose last
|
|
309
|
+
level is finest shows, magnified.
|
|
287
310
|
|
|
288
311
|
```ts
|
|
289
312
|
import { createGlobe, type WorkerEndpointFactory } from 'vibeglobe/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibeglobe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-rc.2",
|
|
4
4
|
"description": "VibeGlobe: a 3D globe and 2D map engine for the web, started in one call with the application's tile, terrain and geocoder services.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"repository": {
|
package/quality/README.md
CHANGED
|
@@ -48,7 +48,8 @@ lowers one step after 500 ms above 1.15 × the target, and raises one after 3 s
|
|
|
48
48
|
2 s between changes. Steps alternate resolution × 0.85 and screen error × 1.4, down to 0.4 and 8 px; effects stay.
|
|
49
49
|
An object for `adaptive` overrides `GOVERNOR_DEFAULTS`. The lowered step applies while the camera moves: once it rests
|
|
50
50
|
(the engine idles, or the camera has been still for 150 ms while an animation draws) the preset shows in full
|
|
51
|
-
(`reason` `'rest'`)
|
|
51
|
+
(`reason` `'rest'`); the camera's next move draws its first 6 frames back to back at the preset, then brings the step
|
|
52
|
+
back if they were slow (`'motion'`), or forgets it if they were fast (`'raise'`, `level` 0).
|
|
52
53
|
|
|
53
54
|
## Pitfalls
|
|
54
55
|
|
|
@@ -59,8 +59,9 @@ export interface QualityController {
|
|
|
59
59
|
* measures the interval between drawn frames, lowers one ladder step ({@link adaptiveLadder}) when frames stay slow
|
|
60
60
|
* and raises one step back once they are fast for the governor's stable interval. The lowered level applies while the
|
|
61
61
|
* camera moves: once it rests (the engine idles, or no movement event came for 150 ms while frames go on, as an
|
|
62
|
-
* animation draws them, three frames at least) the preset shows in full
|
|
63
|
-
*
|
|
62
|
+
* animation draws them, three frames at least) the preset shows in full (F688); the next movement draws its first
|
|
63
|
+
* frames back to back at the preset, and brings the level back only if they are slow, else forgets it (F714). Create
|
|
64
|
+
* it after `globe.ready`, so the 'auto' preset reads the device's capabilities; an explicit preset overrides detection.
|
|
64
65
|
*/
|
|
65
66
|
export declare function createQuality(target: QualityTarget, options?: QualityOptions): QualityController;
|
|
66
67
|
//# sourceMappingURL=quality.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quality.d.ts","sourceRoot":"","sources":["../src/quality.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"quality.d.ts","sourceRoot":"","sources":["../src/quality.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA8B,KAAK,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvH,sFAAsF;AACtF,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACrD,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAChH,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,aAAa,IAAI,IAAI,CAAC;IACtB,kBAAkB,CAAC,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAC7D;AAED,wCAAwC;AACxC,MAAM,WAAW,cAAc;IAC7B,qFAAq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B;AA0LD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,GAAE,cAAmB,GAAG,iBAAiB,CAEpG"}
|
package/quality/dist/quality.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
|
|
2
2
|
// distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
3
|
-
import { FrameTimeGovernor } from './governor.js';
|
|
3
|
+
import { FrameTimeGovernor, GOVERNOR_DEFAULTS } from './governor.js';
|
|
4
4
|
import { adaptiveLadder, isPresetName, QUALITY_PRESETS, } from './presets.js';
|
|
5
5
|
import { browserHints, choosePreset } from './startup.js';
|
|
6
6
|
function resolve(settings, capabilities, pixelRatio) {
|
|
@@ -29,6 +29,11 @@ function startPreset(target, options) {
|
|
|
29
29
|
* shows in full. The frames keep a slow device's drag, whose frames can come without the input's next move, moving.
|
|
30
30
|
*/
|
|
31
31
|
const REST = { ms: 150, frames: 3 };
|
|
32
|
+
/**
|
|
33
|
+
* Frames a movement from rest draws back to back at the preset before a lowered level returns: the level comes back
|
|
34
|
+
* only when they are slow, and is forgotten when they are fast (F714).
|
|
35
|
+
*/
|
|
36
|
+
const TRIAL_FRAMES = 6;
|
|
32
37
|
class Quality {
|
|
33
38
|
target;
|
|
34
39
|
preset;
|
|
@@ -50,6 +55,9 @@ class Quality {
|
|
|
50
55
|
restTimer;
|
|
51
56
|
/** The camera rests: the preset shows in full and frames are not judged. */
|
|
52
57
|
resting = false;
|
|
58
|
+
/** Frames of a movement's trial drawn so far (-1: none under way), and the time of its first. */
|
|
59
|
+
trialFrames = -1;
|
|
60
|
+
trialStartMs = 0;
|
|
53
61
|
constructor(target, options) {
|
|
54
62
|
this.target = target;
|
|
55
63
|
this.now = options.now ?? (() => globalThis.performance.now());
|
|
@@ -81,15 +89,33 @@ class Quality {
|
|
|
81
89
|
const still = ++this.stillFrames >= REST.frames && this.now() - this.movedAtMs >= REST.ms;
|
|
82
90
|
if (still && this.movedAtMs > Number.NEGATIVE_INFINITY)
|
|
83
91
|
return this.rest();
|
|
92
|
+
if (this.trialFrames >= 0)
|
|
93
|
+
return this.trial();
|
|
84
94
|
const decision = this.governor.frame(this.now());
|
|
85
95
|
if (decision)
|
|
86
96
|
this.apply(decision.level, decision.direction);
|
|
87
97
|
}
|
|
98
|
+
// A level lowered once came back with every movement, though frames were fast again (KB-345): it returns only when
|
|
99
|
+
// the movement's first frames, drawn back to back so they measure the drawing and not the input, are slow.
|
|
100
|
+
trial() {
|
|
101
|
+
const nowMs = this.now();
|
|
102
|
+
if (this.trialFrames++ === 0)
|
|
103
|
+
this.trialStartMs = nowMs;
|
|
104
|
+
if (this.trialFrames <= TRIAL_FRAMES)
|
|
105
|
+
return this.target.requestRender();
|
|
106
|
+
this.trialFrames = -1;
|
|
107
|
+
const { targetFrameMs, lowerAbove } = { ...GOVERNOR_DEFAULTS, ...this.governorOptions };
|
|
108
|
+
const slow = (nowMs - this.trialStartMs) / TRIAL_FRAMES > targetFrameMs * lowerAbove;
|
|
109
|
+
const level = slow ? this.governor.level : 0;
|
|
110
|
+
this.governor.reset(level, nowMs);
|
|
111
|
+
this.apply(level, slow ? 'motion' : 'raise');
|
|
112
|
+
}
|
|
88
113
|
// A still view is drawn once, so its cost does not matter: it turns sharp the moment the camera stops.
|
|
89
114
|
rest() {
|
|
90
115
|
if (this.resting || !this.adaptive)
|
|
91
116
|
return;
|
|
92
117
|
this.resting = true;
|
|
118
|
+
this.trialFrames = -1;
|
|
93
119
|
if (this.governor.level > 0)
|
|
94
120
|
this.apply(0, 'rest');
|
|
95
121
|
}
|
|
@@ -110,7 +136,7 @@ class Quality {
|
|
|
110
136
|
return;
|
|
111
137
|
this.resting = false;
|
|
112
138
|
if (this.adaptive && this.governor.level > 0)
|
|
113
|
-
this.
|
|
139
|
+
this.trialFrames = 0;
|
|
114
140
|
}
|
|
115
141
|
apply(level, reason) {
|
|
116
142
|
this.settings = resolve(this.ladder[level] ?? QUALITY_PRESETS[this.preset], this.target.capabilities, this.pixelRatio);
|
|
@@ -156,8 +182,9 @@ class Quality {
|
|
|
156
182
|
* measures the interval between drawn frames, lowers one ladder step ({@link adaptiveLadder}) when frames stay slow
|
|
157
183
|
* and raises one step back once they are fast for the governor's stable interval. The lowered level applies while the
|
|
158
184
|
* camera moves: once it rests (the engine idles, or no movement event came for 150 ms while frames go on, as an
|
|
159
|
-
* animation draws them, three frames at least) the preset shows in full
|
|
160
|
-
*
|
|
185
|
+
* animation draws them, three frames at least) the preset shows in full (F688); the next movement draws its first
|
|
186
|
+
* frames back to back at the preset, and brings the level back only if they are slow, else forgets it (F714). Create
|
|
187
|
+
* it after `globe.ready`, so the 'auto' preset reads the device's capabilities; an explicit preset overrides detection.
|
|
161
188
|
*/
|
|
162
189
|
export function createQuality(target, options = {}) {
|
|
163
190
|
return new Quality(target, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quality.js","sourceRoot":"","sources":["../src/quality.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,kFAAkF;AAClF,OAAO,EAAE,iBAAiB,EAAwB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"quality.js","sourceRoot":"","sources":["../src/quality.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,kFAAkF;AAClF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAwB,MAAM,eAAe,CAAC;AAC3F,OAAO,EACL,cAAc,EACd,YAAY,EACZ,eAAe,GAGhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,YAAY,EAA+D,MAAM,cAAc,CAAC;AA6DvH,SAAS,OAAO,CACd,QAAyB,EACzB,YAA2C,EAC3C,UAA8B;IAE9B,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAC;IAC9C,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,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to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
|
|
2
2
|
// distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
3
|
-
import { FrameTimeGovernor, type GovernorOptions } from './governor.js';
|
|
3
|
+
import { FrameTimeGovernor, GOVERNOR_DEFAULTS, type GovernorOptions } from './governor.js';
|
|
4
4
|
import {
|
|
5
5
|
adaptiveLadder,
|
|
6
6
|
isPresetName,
|
|
@@ -103,6 +103,11 @@ function startPreset(
|
|
|
103
103
|
* shows in full. The frames keep a slow device's drag, whose frames can come without the input's next move, moving.
|
|
104
104
|
*/
|
|
105
105
|
const REST = { ms: 150, frames: 3 };
|
|
106
|
+
/**
|
|
107
|
+
* Frames a movement from rest draws back to back at the preset before a lowered level returns: the level comes back
|
|
108
|
+
* only when they are slow, and is forgotten when they are fast (F714).
|
|
109
|
+
*/
|
|
110
|
+
const TRIAL_FRAMES = 6;
|
|
106
111
|
|
|
107
112
|
class Quality implements QualityController {
|
|
108
113
|
preset: QualityPresetName;
|
|
@@ -124,6 +129,9 @@ class Quality implements QualityController {
|
|
|
124
129
|
private restTimer: ReturnType<typeof setTimeout> | undefined;
|
|
125
130
|
/** The camera rests: the preset shows in full and frames are not judged. */
|
|
126
131
|
private resting = false;
|
|
132
|
+
/** Frames of a movement's trial drawn so far (-1: none under way), and the time of its first. */
|
|
133
|
+
private trialFrames = -1;
|
|
134
|
+
private trialStartMs = 0;
|
|
127
135
|
|
|
128
136
|
constructor(
|
|
129
137
|
private readonly target: QualityTarget,
|
|
@@ -158,14 +166,30 @@ class Quality implements QualityController {
|
|
|
158
166
|
if (!this.adaptive || this.resting) return;
|
|
159
167
|
const still = ++this.stillFrames >= REST.frames && this.now() - this.movedAtMs >= REST.ms;
|
|
160
168
|
if (still && this.movedAtMs > Number.NEGATIVE_INFINITY) return this.rest();
|
|
169
|
+
if (this.trialFrames >= 0) return this.trial();
|
|
161
170
|
const decision = this.governor.frame(this.now());
|
|
162
171
|
if (decision) this.apply(decision.level, decision.direction);
|
|
163
172
|
}
|
|
164
173
|
|
|
174
|
+
// A level lowered once came back with every movement, though frames were fast again (KB-345): it returns only when
|
|
175
|
+
// the movement's first frames, drawn back to back so they measure the drawing and not the input, are slow.
|
|
176
|
+
private trial(): void {
|
|
177
|
+
const nowMs = this.now();
|
|
178
|
+
if (this.trialFrames++ === 0) this.trialStartMs = nowMs;
|
|
179
|
+
if (this.trialFrames <= TRIAL_FRAMES) return this.target.requestRender();
|
|
180
|
+
this.trialFrames = -1;
|
|
181
|
+
const { targetFrameMs, lowerAbove } = { ...GOVERNOR_DEFAULTS, ...this.governorOptions };
|
|
182
|
+
const slow = (nowMs - this.trialStartMs) / TRIAL_FRAMES > targetFrameMs * lowerAbove;
|
|
183
|
+
const level = slow ? this.governor.level : 0;
|
|
184
|
+
this.governor.reset(level, nowMs);
|
|
185
|
+
this.apply(level, slow ? 'motion' : 'raise');
|
|
186
|
+
}
|
|
187
|
+
|
|
165
188
|
// A still view is drawn once, so its cost does not matter: it turns sharp the moment the camera stops.
|
|
166
189
|
private rest(): void {
|
|
167
190
|
if (this.resting || !this.adaptive) return;
|
|
168
191
|
this.resting = true;
|
|
192
|
+
this.trialFrames = -1;
|
|
169
193
|
if (this.governor.level > 0) this.apply(0, 'rest');
|
|
170
194
|
}
|
|
171
195
|
|
|
@@ -183,7 +207,7 @@ class Quality implements QualityController {
|
|
|
183
207
|
clearTimeout(this.restTimer);
|
|
184
208
|
if (!this.resting) return;
|
|
185
209
|
this.resting = false;
|
|
186
|
-
if (this.adaptive && this.governor.level > 0) this.
|
|
210
|
+
if (this.adaptive && this.governor.level > 0) this.trialFrames = 0;
|
|
187
211
|
}
|
|
188
212
|
|
|
189
213
|
private apply(level: number, reason: QualityChangeReason): void {
|
|
@@ -234,8 +258,9 @@ class Quality implements QualityController {
|
|
|
234
258
|
* measures the interval between drawn frames, lowers one ladder step ({@link adaptiveLadder}) when frames stay slow
|
|
235
259
|
* and raises one step back once they are fast for the governor's stable interval. The lowered level applies while the
|
|
236
260
|
* camera moves: once it rests (the engine idles, or no movement event came for 150 ms while frames go on, as an
|
|
237
|
-
* animation draws them, three frames at least) the preset shows in full
|
|
238
|
-
*
|
|
261
|
+
* animation draws them, three frames at least) the preset shows in full (F688); the next movement draws its first
|
|
262
|
+
* frames back to back at the preset, and brings the level back only if they are slow, else forgets it (F714). Create
|
|
263
|
+
* it after `globe.ready`, so the 'auto' preset reads the device's capabilities; an explicit preset overrides detection.
|
|
239
264
|
*/
|
|
240
265
|
export function createQuality(target: QualityTarget, options: QualityOptions = {}): QualityController {
|
|
241
266
|
return new Quality(target, options);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Attribution, ImageryLayerOptions, PolarCapColors } from 'vibeglobe/core';
|
|
2
|
+
/**
|
|
3
|
+
* The world by day, shipped with the package (ADR 0194): NASA Blue Marble with shaded relief and bathymetry (public
|
|
4
|
+
* domain, from NASA GIBS), equirectangular, 4096 × 2048 pixels in WebP (0.85 MB), sharp to about level 4. It is the
|
|
5
|
+
* base image of `createVibeGlobe` and of the Vue component when they are given none; bundlers copy it to the
|
|
6
|
+
* application's assets from `src/earth/day.webp`, next to this module in the package.
|
|
7
|
+
*/
|
|
8
|
+
export declare const dayImageUrl: () => string;
|
|
9
|
+
/** The credit of {@link dayImageUrl}'s image. */
|
|
10
|
+
export declare const DAY_IMAGE_CREDIT: Attribution;
|
|
11
|
+
/** The polar caps that continue {@link dayImageUrl}'s image beyond ±85.05°: its deep sea north, its ice south. */
|
|
12
|
+
export declare const DAY_IMAGE_POLAR_CAPS: PolarCapColors;
|
|
13
|
+
/**
|
|
14
|
+
* City lights by night, shipped with the package: NASA Black Marble 2016 (VIIRS, public domain) in Web Mercator,
|
|
15
|
+
* 2048 × 2048 pixels in WebP (0.1 MB), from `src/earth/night.webp`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const nightImageUrl: () => string;
|
|
18
|
+
/** The id of the {@link nightLights} layer, to show or hide it with `globe.imageryLayers.set`. */
|
|
19
|
+
export declare const NIGHT_LIGHTS_ID = "night-lights";
|
|
20
|
+
/**
|
|
21
|
+
* The night side's city lights as an imagery layer (`blend: 'night'`, shown with `AtmosphereSettings.dayNight`): the
|
|
22
|
+
* shipped Black Marble, or `image`, the application's own Web Mercator image of the whole world.
|
|
23
|
+
*/
|
|
24
|
+
export declare function nightLights(image?: string): ImageryLayerOptions;
|
|
25
|
+
//# sourceMappingURL=earth-images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earth-images.d.ts","sourceRoot":"","sources":["../src/earth-images.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGxF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAAO,MAAgE,CAAC;AAEhG,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,EAAE,WAG9B,CAAC;AAEF,kHAAkH;AAClH,eAAO,MAAM,oBAAoB,EAAE,cAAuD,CAAC;AAE3F;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,MAAkE,CAAC;AAEpG,kGAAkG;AAClG,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAK9C;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,GAAE,MAAwB,GAAG,mBAAmB,CAgBhF"}
|