@margoengine/terrain 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +2366 -2
- package/dist/bed-mesh.d.ts +40 -0
- package/dist/bed-mesh.js +95 -0
- package/dist/blend.d.ts +70 -0
- package/dist/blend.js +159 -0
- package/dist/colors.d.ts +170 -0
- package/dist/deform.d.ts +134 -0
- package/dist/deform.js +404 -0
- package/dist/displace.d.ts +60 -0
- package/dist/displace.js +254 -0
- package/dist/dunes.d.ts +86 -0
- package/dist/dunes.js +88 -0
- package/dist/elevation.d.ts +182 -0
- package/dist/elevation.js +155 -0
- package/dist/errors-fc4i1pSL.js +7 -0
- package/dist/far.d.ts +66 -0
- package/dist/far.js +191 -0
- package/dist/furrows.d.ts +74 -0
- package/dist/furrows.js +157 -0
- package/dist/grid.d.ts +14 -0
- package/dist/ground-change-settings.d.ts +29 -0
- package/dist/ground-change-settings.js +69 -0
- package/dist/ground-change.d.ts +227 -0
- package/dist/ground-change.js +1412 -0
- package/dist/ground-contact-settings.d.ts +27 -0
- package/dist/ground-contact-settings.js +22 -0
- package/dist/ground-contact.d.ts +91 -0
- package/dist/ground-contact.js +241 -0
- package/dist/ground-model.d.ts +372 -0
- package/dist/hdr-format-DRhzGS7G.js +30 -0
- package/dist/height-grid.d.ts +65 -0
- package/dist/height-grid.js +74 -0
- package/dist/heightfield.d.ts +38 -0
- package/dist/holes.d.ts +37 -0
- package/dist/holes.js +97 -0
- package/dist/imagery.d.ts +109 -0
- package/dist/imagery.js +472 -0
- package/dist/index.d.ts +408 -0
- package/dist/index.js +1 -0
- package/dist/layers-pbr.d.ts +78 -0
- package/dist/layers-pbr.js +128 -0
- package/dist/lighting-layout-CaDtDa5G.js +34 -0
- package/dist/lighting-layout.d.ts +5 -0
- package/dist/mesh-patch-BThCHCeS.js +21 -0
- package/dist/mesh-patch.d.ts +14 -0
- package/dist/noise3-sQdnbz4B.js +11 -0
- package/dist/noise3.d.ts +3 -0
- package/dist/overlays.d.ts +74 -0
- package/dist/overlays.js +297 -0
- package/dist/planet-complex.d.ts +31 -0
- package/dist/planet-craters.d.ts +80 -0
- package/dist/planet-rays.d.ts +37 -0
- package/dist/planet-recipes.d.ts +84 -0
- package/dist/planet-recipes.js +442 -0
- package/dist/planet.d.ts +144 -0
- package/dist/planet.js +610 -0
- package/dist/query.d.ts +150 -0
- package/dist/query.js +243 -0
- package/dist/relief-lighting.d.ts +53 -0
- package/dist/relief-lighting.js +221 -0
- package/dist/require-webgpu--tUXPsmA.js +7 -0
- package/dist/rock-settings.d.ts +39 -0
- package/dist/rock-settings.js +84 -0
- package/dist/rock-surface.d.ts +114 -0
- package/dist/rock-surface.js +380 -0
- package/dist/rocks.d.ts +258 -0
- package/dist/rocks.js +488 -0
- package/dist/rvt.d.ts +136 -0
- package/dist/rvt.js +518 -0
- package/dist/scour.d.ts +90 -0
- package/dist/scour.js +153 -0
- package/dist/sculpt.d.ts +103 -0
- package/dist/sculpt.js +361 -0
- package/dist/settings-B9BSdnhD.js +72 -0
- package/dist/settings.d.ts +81 -0
- package/dist/settings.js +152 -0
- package/dist/shader.d.ts +176 -0
- package/dist/shared/settings.d.ts +89 -0
- package/dist/src-Cr7Gm4n0.js +1366 -0
- package/dist/stream-window.d.ts +123 -0
- package/dist/stream.d.ts +169 -0
- package/dist/stream.js +531 -0
- package/dist/surface-height.d.ts +16 -0
- package/dist/wet-ground.d.ts +82 -0
- package/dist/wet-ground.js +147 -0
- package/package.json +173 -4
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/** One loaded tile: `tileTexels` x `tileTexels` samples, row by row along +X from the tile's minimum corner, rows along +Z. */
|
|
2
|
+
export interface TerrainStreamTile {
|
|
3
|
+
/** Heights in heightmap units (world Y is `height * heightScale + heightOffset`), finite. */
|
|
4
|
+
readonly heights: Float32Array;
|
|
5
|
+
/**
|
|
6
|
+
* With `TerrainStreamOptions.weights` above 0: that many arrays of RGBA bytes (4 per texel), the painted layer
|
|
7
|
+
* weights of `TerrainTextures.weights` for this tile (layer i is channel i % 4 of array i / 4).
|
|
8
|
+
*/
|
|
9
|
+
readonly weights?: readonly Uint8Array[];
|
|
10
|
+
/**
|
|
11
|
+
* With `TerrainStreamOptions.normals`: the tile's normals as RGBA bytes (4 per texel), XYZ encoded 0..1 (`n * 0.5 +
|
|
12
|
+
* 0.5`), the `TerrainTextures.normalmap` texels for this tile. Required on every tile with data then.
|
|
13
|
+
*/
|
|
14
|
+
readonly normals?: Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* With `TerrainStreamOptions.tint`: the tile's tint as RGBA bytes (4 per texel, sRGB colour and A how far tinted
|
|
17
|
+
* layers move toward it), the `TerrainTextures.tint` texels for this tile. Optional: a tile without it is untinted.
|
|
18
|
+
*/
|
|
19
|
+
readonly tint?: Uint8Array;
|
|
20
|
+
}
|
|
21
|
+
/** What changed in the heightmap: a band of rows uploaded, or the whole window moved (`shifted`). Texel rectangle. */
|
|
22
|
+
export interface TerrainStreamChange {
|
|
23
|
+
readonly shifted: boolean;
|
|
24
|
+
readonly u: number;
|
|
25
|
+
readonly v: number;
|
|
26
|
+
readonly width: number;
|
|
27
|
+
readonly depth: number;
|
|
28
|
+
}
|
|
29
|
+
/** Loads tile (x, z); see `TerrainStreamOptions.load`. */
|
|
30
|
+
export type TerrainStreamLoad = (x: number, z: number, signal: AbortSignal) => Promise<TerrainStreamTile | null | undefined>;
|
|
31
|
+
/** The streamed tiles of one window: what `TerrainStream` and its far ring show of their data. */
|
|
32
|
+
export interface TerrainTiles {
|
|
33
|
+
/** Texels per window side (`window * tileTexels`). */
|
|
34
|
+
readonly columns: number;
|
|
35
|
+
/** CPU copy of the heightmap, `columns` x `columns`, row by row from `origin` (kept in place: the same array always). */
|
|
36
|
+
readonly heights: Float32Array;
|
|
37
|
+
/** CPU copies of the weight textures, RGBA bytes, as `heights`. */
|
|
38
|
+
readonly weights: readonly Uint8Array[];
|
|
39
|
+
/** CPU copy of the normal map with `normals`, RGBA bytes as `heights`; else undefined. */
|
|
40
|
+
readonly normals?: Uint8Array;
|
|
41
|
+
/** CPU copy of the tint with `tint`, RGBA bytes as `heights`; else undefined. */
|
|
42
|
+
readonly tint?: Uint8Array;
|
|
43
|
+
/** World XZ of the window's first texel; moves by whole tiles. */
|
|
44
|
+
readonly origin: readonly [number, number];
|
|
45
|
+
/** Tile index of the window's minimum corner. */
|
|
46
|
+
readonly tile: readonly [number, number];
|
|
47
|
+
/** Rises on every change to the heightmap: an upload or a window move. */
|
|
48
|
+
readonly version: number;
|
|
49
|
+
/** Whether tile (x, z) is in the window and fully uploaded (loaded data, or no data at `fill`). */
|
|
50
|
+
resident(x: number, z: number): boolean;
|
|
51
|
+
/** Calls `callback` for every change to the heightmap. Returns the remover. */
|
|
52
|
+
onChange(callback: (change: TerrainStreamChange) => void): () => void;
|
|
53
|
+
}
|
|
54
|
+
/** What a window needs: `TerrainStreamOptions` with every default filled in. */
|
|
55
|
+
export interface TileWindowConfig {
|
|
56
|
+
readonly tileSize: number;
|
|
57
|
+
readonly tileTexels: number;
|
|
58
|
+
readonly window: number;
|
|
59
|
+
/** World XZ of tile (0, 0)'s minimum corner. */
|
|
60
|
+
readonly lattice: readonly [number, number];
|
|
61
|
+
readonly load: TerrainStreamLoad;
|
|
62
|
+
readonly weights: number;
|
|
63
|
+
readonly normals: boolean;
|
|
64
|
+
readonly tint: boolean;
|
|
65
|
+
/** The weight textures as the layers of one array texture. */
|
|
66
|
+
readonly weightArray: boolean;
|
|
67
|
+
readonly fill: number;
|
|
68
|
+
readonly retries: number;
|
|
69
|
+
readonly retryDelay: number;
|
|
70
|
+
readonly signal?: AbortSignal;
|
|
71
|
+
}
|
|
72
|
+
export declare class TileWindow implements TerrainTiles {
|
|
73
|
+
#private;
|
|
74
|
+
readonly columns: number;
|
|
75
|
+
readonly heights: Float32Array;
|
|
76
|
+
readonly weights: readonly Uint8Array[];
|
|
77
|
+
readonly normals?: Uint8Array;
|
|
78
|
+
readonly tint?: Uint8Array;
|
|
79
|
+
/** The arrays `tile` and `origin` return, moved in place with the window (the terrain reads `origin` every frame). */
|
|
80
|
+
readonly tile: [number, number];
|
|
81
|
+
readonly origin: [number, number];
|
|
82
|
+
/** Loads in flight. */
|
|
83
|
+
loading: number;
|
|
84
|
+
version: number;
|
|
85
|
+
/** `x`, `z`: the world position the window is first placed around. `changed` and `settle` tell the owner. */
|
|
86
|
+
constructor(config: TileWindowConfig, x: number, z: number, changed: () => void, settle: () => void);
|
|
87
|
+
/** The textures made by `create`: the heights, the weights (one entry per texture), the normal map and the tint. */
|
|
88
|
+
get textures(): {
|
|
89
|
+
height: GPUTexture;
|
|
90
|
+
weights: GPUTexture[];
|
|
91
|
+
normals?: GPUTexture;
|
|
92
|
+
tint?: GPUTexture;
|
|
93
|
+
};
|
|
94
|
+
resident(x: number, z: number): boolean;
|
|
95
|
+
/** Whether tile (x, z) is resident with loaded data, not just `fill`. */
|
|
96
|
+
holds(x: number, z: number): boolean;
|
|
97
|
+
onChange(callback: (change: TerrainStreamChange) => void): () => void;
|
|
98
|
+
/** Starts every failed tile, and every tile waiting for a retry, over; returns how many. */
|
|
99
|
+
retry(): number;
|
|
100
|
+
/** Whether some tile of the window is not resident yet, and the first failed tile's error as `failed`. */
|
|
101
|
+
state(): {
|
|
102
|
+
missing: boolean;
|
|
103
|
+
failed?: {
|
|
104
|
+
error: unknown;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Moves the window a whole tile or more when world (x, z) is more than 0.75 of a tile from its centre. Returns
|
|
109
|
+
* (x, z) in tiles from the lattice, the window's centre for a position that is not finite.
|
|
110
|
+
*/
|
|
111
|
+
follow(x: number, z: number): [number, number];
|
|
112
|
+
/** Starts up to `free` loads for window tiles without one, nearest to (fx, fz) in tiles first. */
|
|
113
|
+
schedule(fx: number, fz: number, free: number): void;
|
|
114
|
+
/** Uploads bands of loaded tiles within `budget` texels, nearest to (fx, fz) first; returns the texels uploaded. */
|
|
115
|
+
upload(fx: number, fz: number, budget: number): number;
|
|
116
|
+
/** Makes the textures on `device` from the CPU copies, at attachment and after device restoration. */
|
|
117
|
+
create(device: GPUDevice): void;
|
|
118
|
+
/** Destroys the window's own scratch and fill textures (a terrain given the others owns and destroys them). */
|
|
119
|
+
release(): void;
|
|
120
|
+
/** Destroys the heightmap and planes too: for a window whose textures no terrain owns (the far ring). */
|
|
121
|
+
destroyTextures(): void;
|
|
122
|
+
dispose(): void;
|
|
123
|
+
}
|
package/dist/stream.d.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" preserve="true" />
|
|
2
|
+
import type { EngineKernel } from '@margoengine/core';
|
|
3
|
+
import { type Engine, type EnginePlugin } from '@margoengine/core/extension';
|
|
4
|
+
import { Terrain, type TerrainOptions, type TerrainSource } from './index.js';
|
|
5
|
+
import { type TerrainStreamChange, type TerrainStreamLoad, type TerrainStreamTile, type TerrainTiles } from './stream-window.js';
|
|
6
|
+
export type { TerrainStreamChange, TerrainStreamLoad, TerrainStreamTile, TerrainTiles, } from './stream-window.js';
|
|
7
|
+
/** {@link TerrainStream} options: the terrain's own options without `textures`, `origin` and `size`, plus these.
|
|
8
|
+
* The clipmap window defaults to `'camera'`, on the same world lattice as its tiles. */
|
|
9
|
+
export interface TerrainStreamOptions extends Omit<TerrainOptions, 'textures' | 'origin' | 'size'> {
|
|
10
|
+
/** World size of a tile side, above 0. */
|
|
11
|
+
readonly tileSize: number;
|
|
12
|
+
/** Height samples per tile side, an integer from 2 to 1,024. Adjacent tiles share no samples. */
|
|
13
|
+
readonly tileTexels: number;
|
|
14
|
+
/** Tiles per window side, an even integer from 2 to 16. Default 4. The window must fit the device's 2D texture limit. */
|
|
15
|
+
readonly window?: number;
|
|
16
|
+
/** World XZ of tile (0, 0)'s minimum corner (its first sample). Default [0, 0]. */
|
|
17
|
+
readonly origin?: readonly [number, number];
|
|
18
|
+
/**
|
|
19
|
+
* Loads tile (x, z) (any integers; tile (x, z) starts at `origin + [x, z] * tileSize`). Resolve undefined or null
|
|
20
|
+
* for no data there (the tile keeps `fill`; with `far` the far ring's ground shows there). `signal` aborts when the
|
|
21
|
+
* tile leaves the window or the stream is disposed.
|
|
22
|
+
*/
|
|
23
|
+
readonly load: (x: number, z: number, signal: AbortSignal) => Promise<TerrainStreamTile | null | undefined>;
|
|
24
|
+
/** Makes the layer colour array (`TerrainTextures.layers`), at attachment and again after device restoration. */
|
|
25
|
+
readonly colors: (device: GPUDevice) => GPUTexture;
|
|
26
|
+
/** Painted weight textures per tile, 0 to 4 (enough for the layers, 4 each). Default 0: the height and slope rules. */
|
|
27
|
+
readonly weights?: number;
|
|
28
|
+
/** Texels uploaded per frame (one tile row at least). Default 65,536 (one 256 x 256 tile). */
|
|
29
|
+
readonly budget?: number;
|
|
30
|
+
/** Tile loads in flight at once, 1 to 64, the far ring's included. Default 4. */
|
|
31
|
+
readonly concurrency?: number;
|
|
32
|
+
/** Height of texels whose tile is not loaded yet, finite. Default 0. */
|
|
33
|
+
readonly fill?: number;
|
|
34
|
+
/** Aborts every load; no new ones start, and `ready` rejects with its reason. */
|
|
35
|
+
readonly signal?: AbortSignal;
|
|
36
|
+
/**
|
|
37
|
+
* Times a tile whose `load` rejects is loaded again before it counts as failed, 0 to 16. Default 2. A tile of the
|
|
38
|
+
* wrong shape and an aborted load are not retried. `retry()` starts every failed tile over.
|
|
39
|
+
*/
|
|
40
|
+
readonly retries?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Base wait before a retry in milliseconds, 0 or more. Default 250. Retry k (from 0) waits a random time up to
|
|
43
|
+
* `retryDelay * 2^k`, capped at 30 s (exponential backoff with full jitter), so tiles that failed together do not
|
|
44
|
+
* all ask again at once.
|
|
45
|
+
*/
|
|
46
|
+
readonly retryDelay?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Stream a normal map with the heights: each tile with data gives `normals`, and the terrain shades with them in place
|
|
49
|
+
* of normals from neighbouring heights (`TerrainTextures.normalmap`), so lighting keeps detail finer than the height
|
|
50
|
+
* samples. Texels not loaded yet face straight up. Default false.
|
|
51
|
+
*/
|
|
52
|
+
readonly normals?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Stream a tint texture with the heights (`TerrainTextures.tint`, as `rgba8unorm-srgb`; needs `weights`): layers with
|
|
55
|
+
* `tint: true` move toward each tile's `tint` colour by its A, a draped photograph or a season map. Texels not loaded
|
|
56
|
+
* yet, and tiles without `tint`, are untinted. Default false.
|
|
57
|
+
*/
|
|
58
|
+
readonly tint?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Draw coarser ground past the window: `terrainFar({ scale, load })` from `@margoengine/terrain/far`, a second window
|
|
61
|
+
* of bigger tiles the heights blend into with distance. With it, `levels` defaults to enough rings to reach the far
|
|
62
|
+
* ring's edge. Default: none (nothing past the window is drawn).
|
|
63
|
+
*/
|
|
64
|
+
readonly far?: TerrainStreamFar;
|
|
65
|
+
}
|
|
66
|
+
/** A tile window the far ring reads: its tiles, which hold data, and its textures. */
|
|
67
|
+
export interface TerrainStreamWindow extends TerrainTiles {
|
|
68
|
+
/** Whether tile (x, z) is resident with loaded data, not just `fill`. */
|
|
69
|
+
holds(x: number, z: number): boolean;
|
|
70
|
+
/** The window's textures, made for the current device. */
|
|
71
|
+
readonly textures: {
|
|
72
|
+
readonly height: GPUTexture;
|
|
73
|
+
readonly weights: readonly GPUTexture[];
|
|
74
|
+
readonly normals?: GPUTexture;
|
|
75
|
+
readonly tint?: GPUTexture;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** What a {@link TerrainStream} needs of its far ring; `terrainFar` (`@margoengine/terrain/far`) makes one. */
|
|
79
|
+
export interface TerrainStreamFar {
|
|
80
|
+
/** Loads far tile (x, z), which starts at the stream's `origin + [x, z] * tileSize` of the far ring. */
|
|
81
|
+
readonly load: TerrainStreamLoad;
|
|
82
|
+
/**
|
|
83
|
+
* The far window for a stream with these tiles: its tile side in world units, texels and tiles per side, and how far
|
|
84
|
+
* from the camera on each axis it draws (`reach`).
|
|
85
|
+
* @throws RangeError when the two windows do not fit together.
|
|
86
|
+
*/
|
|
87
|
+
plan(near: {
|
|
88
|
+
tileSize: number;
|
|
89
|
+
tileTexels: number;
|
|
90
|
+
window: number;
|
|
91
|
+
}): {
|
|
92
|
+
tileSize: number;
|
|
93
|
+
tileTexels: number;
|
|
94
|
+
window: number;
|
|
95
|
+
reach: number;
|
|
96
|
+
};
|
|
97
|
+
/** Joins the two windows: returns what draws and updates the blend between them. */
|
|
98
|
+
bind(near: TerrainStreamWindow, far: TerrainStreamWindow, terrain: Pick<TerrainOptions, 'heightScale' | 'heightOffset'>): {
|
|
99
|
+
/** The shader additions on `device`, at attachment and after device restoration (after both windows' textures). */
|
|
100
|
+
source(device: GPUDevice): TerrainSource;
|
|
101
|
+
/** One frame: the camera's world XZ and the seconds since the last. Returns whether the drawn ground changed. */
|
|
102
|
+
update(delta: number, x: number, z: number): boolean;
|
|
103
|
+
dispose(): void;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A {@link Terrain} whose heightmap (and painted weights) stream in tiles around the camera, so the world can be far
|
|
108
|
+
* bigger than one heightmap. Attach with {@link TerrainStream.attach}; it makes and owns the terrain (`terrain`).
|
|
109
|
+
* The window follows the engine camera: it moves a whole tile when the camera is more than 0.75 of a tile from its
|
|
110
|
+
* centre, so ground at least `(window / 2 - 0.75) * tileSize` from the camera on each axis is always in it (the
|
|
111
|
+
* terrain draws nothing past the window, as past any heightmap, unless `far` adds a coarser ring there).
|
|
112
|
+
*/
|
|
113
|
+
export declare class TerrainStream implements EnginePlugin {
|
|
114
|
+
#private;
|
|
115
|
+
readonly name: string;
|
|
116
|
+
/** The terrain drawing the window. The stream owns it: `dispose()` disposes it. */
|
|
117
|
+
readonly terrain: Terrain;
|
|
118
|
+
/** Texels per window side (`window * tileTexels`). */
|
|
119
|
+
readonly columns: number;
|
|
120
|
+
/** CPU copy of the heightmap, `columns` x `columns`, row by row from `origin` (kept in place: the same array always). */
|
|
121
|
+
readonly heights: Float32Array;
|
|
122
|
+
/** CPU copies of the weight textures, RGBA bytes, as `heights`. */
|
|
123
|
+
readonly weights: readonly Uint8Array[];
|
|
124
|
+
/** CPU copy of the normal map with `normals`, RGBA bytes as `heights`; else undefined. */
|
|
125
|
+
readonly normals?: Uint8Array;
|
|
126
|
+
/** CPU copy of the tint with `tint`, RGBA bytes as `heights`; else undefined. */
|
|
127
|
+
readonly tint?: Uint8Array;
|
|
128
|
+
/** With `far`: the far ring's own window of tiles. */
|
|
129
|
+
readonly far?: TerrainTiles;
|
|
130
|
+
disposed: boolean;
|
|
131
|
+
private constructor();
|
|
132
|
+
/**
|
|
133
|
+
* Makes a streamed terrain on `engine` (WebGPU) around its camera and starts loading. Returns it; `dispose()`
|
|
134
|
+
* removes it and its terrain.
|
|
135
|
+
* @throws RangeError or TypeError for bad options (the terrain's own included); MargoError `'unsupported'` on WebGL.
|
|
136
|
+
*/
|
|
137
|
+
static attach(engine: EngineKernel, options: TerrainStreamOptions): TerrainStream;
|
|
138
|
+
/** World XZ of the window's first texel (the terrain's `origin`); moves by whole tiles. */
|
|
139
|
+
get origin(): readonly [number, number];
|
|
140
|
+
/** Tile index of the window's minimum corner. */
|
|
141
|
+
get tile(): readonly [number, number];
|
|
142
|
+
/** Rises on every change to the heightmap: an upload or a window move. */
|
|
143
|
+
get version(): number;
|
|
144
|
+
/** Whether tile (x, z) is in the window and fully uploaded (loaded data, or no data at `fill`). */
|
|
145
|
+
resident(x: number, z: number): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Starts every failed tile of the window (and of the far ring) over, and every tile waiting for a retry at once, each
|
|
148
|
+
* with its full `retries` again (after the network comes back, say: `addEventListener('online', () =>
|
|
149
|
+
* stream.retry())`). Returns how many tiles it started over; they load as frames are drawn.
|
|
150
|
+
*/
|
|
151
|
+
retry(): number;
|
|
152
|
+
/**
|
|
153
|
+
* Calls `callback` for every change to the heightmap, for a `TerrainQuery` over `heights`: refresh it over a band's
|
|
154
|
+
* rectangle, or build a new one (`origin` moved) when `shifted`. Returns the remover. The far ring's changes come
|
|
155
|
+
* from `far.onChange`.
|
|
156
|
+
*/
|
|
157
|
+
onChange(callback: (change: TerrainStreamChange) => void): () => void;
|
|
158
|
+
/**
|
|
159
|
+
* Resolves once every tile of the current window, and of the far ring, is loaded and uploaded (uploads go in as frames
|
|
160
|
+
* are drawn). Rejects with a tile's load error once its `retries` are spent, `signal`'s or the stream's abort reason,
|
|
161
|
+
* or MargoError `'disposed'`.
|
|
162
|
+
*/
|
|
163
|
+
ready(signal?: AbortSignal): Promise<void>;
|
|
164
|
+
setup(engine: Engine): void;
|
|
165
|
+
/** Follows the camera, loads and uploads; `delta`, the frame's seconds, drives the far ring's fades. */
|
|
166
|
+
onPreUpdate(delta?: number): void;
|
|
167
|
+
dispose(): void;
|
|
168
|
+
[Symbol.dispose]: () => void;
|
|
169
|
+
}
|