@margoengine/terrain 0.0.0-stage → 0.1.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 (71) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +4 -0
  3. package/README.md +1808 -3
  4. package/dist/blend.d.ts +70 -0
  5. package/dist/blend.js +159 -0
  6. package/dist/colors.d.ts +164 -0
  7. package/dist/deform.d.ts +103 -0
  8. package/dist/deform.js +322 -0
  9. package/dist/displace.d.ts +60 -0
  10. package/dist/displace.js +254 -0
  11. package/dist/dunes.d.ts +86 -0
  12. package/dist/dunes.js +88 -0
  13. package/dist/errors-fc4i1pSL.js +7 -0
  14. package/dist/grid.d.ts +11 -0
  15. package/dist/ground-change-settings.d.ts +29 -0
  16. package/dist/ground-change-settings.js +69 -0
  17. package/dist/ground-change.d.ts +227 -0
  18. package/dist/ground-change.js +1291 -0
  19. package/dist/ground-model.d.ts +290 -0
  20. package/dist/hdr-format-DRhzGS7G.js +30 -0
  21. package/dist/height-grid.d.ts +65 -0
  22. package/dist/height-grid.js +74 -0
  23. package/dist/heightfield.d.ts +38 -0
  24. package/dist/holes.d.ts +37 -0
  25. package/dist/holes.js +97 -0
  26. package/dist/imagery.d.ts +109 -0
  27. package/dist/imagery.js +472 -0
  28. package/dist/index.d.ts +297 -0
  29. package/dist/index.js +1 -0
  30. package/dist/layers-pbr.d.ts +78 -0
  31. package/dist/layers-pbr.js +128 -0
  32. package/dist/lighting-layout-CaDtDa5G.js +34 -0
  33. package/dist/lighting-layout.d.ts +5 -0
  34. package/dist/mesh-patch-BThCHCeS.js +21 -0
  35. package/dist/mesh-patch.d.ts +14 -0
  36. package/dist/noise3-sQdnbz4B.js +11 -0
  37. package/dist/noise3.d.ts +3 -0
  38. package/dist/overlays.d.ts +74 -0
  39. package/dist/overlays.js +297 -0
  40. package/dist/planet-craters.d.ts +55 -0
  41. package/dist/planet-recipes.d.ts +75 -0
  42. package/dist/planet-recipes.js +216 -0
  43. package/dist/planet.d.ts +139 -0
  44. package/dist/planet.js +602 -0
  45. package/dist/query.d.ts +150 -0
  46. package/dist/query.js +243 -0
  47. package/dist/relief-lighting.d.ts +46 -0
  48. package/dist/relief-lighting.js +208 -0
  49. package/dist/require-webgpu--tUXPsmA.js +7 -0
  50. package/dist/rock-settings.d.ts +39 -0
  51. package/dist/rock-settings.js +84 -0
  52. package/dist/rock-surface.d.ts +111 -0
  53. package/dist/rock-surface.js +368 -0
  54. package/dist/rocks.d.ts +258 -0
  55. package/dist/rocks.js +488 -0
  56. package/dist/rvt.d.ts +136 -0
  57. package/dist/rvt.js +518 -0
  58. package/dist/sculpt.d.ts +103 -0
  59. package/dist/sculpt.js +361 -0
  60. package/dist/settings-B9BSdnhD.js +72 -0
  61. package/dist/settings.d.ts +81 -0
  62. package/dist/settings.js +152 -0
  63. package/dist/shader.d.ts +61 -0
  64. package/dist/shared/settings.d.ts +89 -0
  65. package/dist/src-C6dtSaAb.js +1155 -0
  66. package/dist/stream.d.ts +100 -0
  67. package/dist/stream.js +339 -0
  68. package/dist/surface-height.d.ts +16 -0
  69. package/dist/wet-ground.d.ts +82 -0
  70. package/dist/wet-ground.js +147 -0
  71. package/package.json +148 -6
@@ -0,0 +1,216 @@
1
+ import { n as e } from "./noise3-sQdnbz4B.js";
2
+ //#region src/planet-craters.ts
3
+ var t = 256, n = 3, r = (e) => (e ^= e >>> 16, e = Math.imul(e, 2146121005), e ^= e >>> 15, e = Math.imul(e, 2221713035), (e ^ e >>> 16) >>> 0);
4
+ function i(e = {}) {
5
+ let i = e, a = i.radius ?? 6371e3, o = i.exponent ?? 2, s = i.dMin ?? a / 2e4, c = i.dMax ?? a / 4, l = i.seed ?? 1, u = i.depthRatio ?? .196, d = i.rimRatio ?? .036, f = i.maxDepth ?? 3400, p = i.floor ?? 0, m = i.ejecta ?? !0, h = i.blend ?? .15, g = 4 * Math.PI * a * a;
6
+ if (i.density !== void 0 && i.count !== void 0) throw RangeError("Invalid craterField options; pass density or count, not both");
7
+ let _ = i.count === void 0 ? (i.density ?? 1e3) / 0xe8d4a51000 : i.count / g, v = (e, t, n) => Number.isFinite(e) && e >= t && e <= n;
8
+ if (!(Number.isFinite(a) && a > 0) || !(Number.isFinite(s) && s > 0) || !(Number.isFinite(c) && c > s && c <= a) || !v(o, 1, 3) || !Number.isInteger(l) || !v(_, 0, Infinity) || !v(u, 0, Infinity) || !v(d, 0, Infinity) || !(Number.isFinite(f) && f > 0) || !(Number.isFinite(p) && p >= 0 && p < 1) || !v(h, 0, 1) || typeof m != "boolean") throw RangeError("Invalid craterField options; pass radius above 0, 0 < dMin < dMax <= radius, exponent 1 to 3, an integer seed, density or count 0 or more, floor 0 up to 1, blend 0 to 1");
9
+ let y = [], b = _ * s ** o;
10
+ for (let e = s, n = 0; e < c; e *= 2, n++) {
11
+ let i = Math.min(e * 2, c), s = b * (e ** -o - i ** -o), u = 3 * i, d = u / 4, f = 4 * Math.PI / 3 * ((a + d) ** 3 - Math.max(0, a - d) ** 3), p = s * g / f * u ** 3;
12
+ if (p > t) throw RangeError(`craterField puts ${p.toFixed(0)} craters in a lattice cell at diameters ${e.toFixed(1)} to ${i.toFixed(1)} m (limit ${t}); raise dMin or lower the density`);
13
+ y.push({
14
+ lo: e,
15
+ hi: i,
16
+ cell: u,
17
+ eps: d,
18
+ mean: p,
19
+ limit: Math.exp(-p),
20
+ salt: r(Math.imul(n + 1, 2654435761) ^ l)
21
+ });
22
+ }
23
+ let x = 64, S = new Float64Array(x), C = new Float64Array(x), w = new Float64Array(x), T = new Float64Array(x), E = new Float64Array(x), D = new Float64Array(x), O = () => {
24
+ x *= 2;
25
+ let e = (e) => {
26
+ let t = new Float64Array(x);
27
+ return t.set(e), t;
28
+ };
29
+ S = e(S), C = e(C), w = e(w), T = e(T), E = e(E), D = e(D);
30
+ };
31
+ function k(e, t, i, s) {
32
+ let c = 0, l = 0, u = () => {
33
+ l = l + 1831565813 | 0;
34
+ let e = Math.imul(l ^ l >>> 15, 1 | l);
35
+ return e = e + Math.imul(e ^ e >>> 7, 61 | e) ^ e, ((e ^ e >>> 14) >>> 0) / 4294967296;
36
+ }, d = e * a, f = t * a, p = i * a;
37
+ for (let m of y) {
38
+ if (m.hi < 2 * s) continue;
39
+ let h = m.cell, g = Math.floor(d / h), _ = Math.floor(f / h), v = Math.floor(p / h), y = a - m.eps, b = a + m.eps, k = m.lo ** -o - m.hi ** -o;
40
+ for (let d = g - 1; d <= g + 1; d++) for (let f = _ - 1; f <= _ + 1; f++) for (let p = v - 1; p <= v + 1; p++) {
41
+ let g = Math.max(d * h, -(d + 1) * h, 0), _ = Math.max(f * h, -(f + 1) * h, 0), v = Math.max(p * h, -(p + 1) * h, 0), A = Math.max(Math.abs(d * h), Math.abs((d + 1) * h)), j = Math.max(Math.abs(f * h), Math.abs((f + 1) * h)), M = Math.max(Math.abs(p * h), Math.abs((p + 1) * h));
42
+ if (g * g + _ * _ + v * v > b * b || A * A + j * j + M * M < y * y) continue;
43
+ l = r(Math.imul(d, 2376512323) ^ Math.imul(f, 3625334849) ^ Math.imul(p, 3407524639) ^ m.salt);
44
+ let N = 0;
45
+ for (let e = 1; e *= u(), !(e <= m.limit); N++);
46
+ for (let r = 0; r < N; r++) {
47
+ let r = (d + u()) * h, l = (f + u()) * h, g = (p + u()) * h, _ = u(), v = u(), A = Math.hypot(r, l, g);
48
+ if (A < y || A > b) continue;
49
+ let j = (m.lo ** -o - _ * k) ** (-1 / o);
50
+ if (j < 2 * s) continue;
51
+ let M = r / A, N = l / A, P = g / A, F = Math.hypot(M - e, N - t, P - i), I = a * 2 * Math.asin(Math.min(1, F / 2)) / (j / 2);
52
+ I >= n || (c === x && O(), S[c] = j, C[c] = I, w[c] = v, T[c] = M, E[c] = N, D[c] = P, c++);
53
+ }
54
+ }
55
+ }
56
+ for (let e = 1; e < c; e++) {
57
+ let t = S[e], n = C[e], r = w[e], i = T[e], a = E[e], o = D[e], s = e - 1;
58
+ for (; s >= 0 && w[s] > r; s--) S[s + 1] = S[s], C[s + 1] = C[s], w[s + 1] = w[s], T[s + 1] = T[s], E[s + 1] = E[s], D[s + 1] = D[s];
59
+ S[s + 1] = t, C[s + 1] = n, w[s + 1] = r, T[s + 1] = i, E[s + 1] = a, D[s + 1] = o;
60
+ }
61
+ return c;
62
+ }
63
+ let A = ((e, t, n, r) => {
64
+ let i = k(e, t, n, r || 0), a = 0;
65
+ for (let e = 0; e < i; e++) a = j(a, C[e], S[e]);
66
+ return a;
67
+ });
68
+ function j(e, t, n) {
69
+ let r = n / 1e3, i = u * r ** 1.01 * 1e3, a = i > f ? f / i : 1, o = i * a, s = d * r ** 1.01 * 1e3 * a, c = n / 2, l = m ? .14 * c ** .74 : 0, g = Math.max(0, s - .14 * c ** .74), _ = g + l;
70
+ if (t < 1) {
71
+ if (t <= p) return -o;
72
+ let e = (t - p) / (1 - p);
73
+ return -o + (o + _) * e * e;
74
+ }
75
+ let v = Math.min(1, Math.max(0, (t - 2.5) / .5)), y = (g * t ** -4 + l * t ** -3) * (1 - v * v * (3 - 2 * v)), b = h > 0 ? Math.min(1, Math.max(0, (t - 1) / h)) : 1;
76
+ return e * (b * b * (3 - 2 * b)) + y;
77
+ }
78
+ return A.craters = (e, t, n, r = 0) => {
79
+ let i = k(e, t, n, r), a = [];
80
+ for (let e = 0; e < i; e++) a.push({
81
+ x: T[e],
82
+ y: E[e],
83
+ z: D[e],
84
+ diameter: S[e],
85
+ age: w[e]
86
+ });
87
+ return a;
88
+ }, A;
89
+ }
90
+ //#endregion
91
+ //#region src/planet-recipes.ts
92
+ var a = (e, t) => Number.isFinite(e) && e >= t;
93
+ function o(t = {}) {
94
+ let { radius: n = 6371e3, relief: r = 8e3, octaves: i = 6, gain: o = 2, frequency: s = 2, seed: c = 1 } = t;
95
+ if (!(Number.isFinite(n) && n > 0) || !a(r, 0) || !Number.isInteger(i) || i < 1 || i > 24 || !a(o, 0) || !(Number.isFinite(s) && s > 0) || !Number.isInteger(c)) throw RangeError("Invalid ridgeNoise options; pass radius above 0, relief 0 or more, octaves 1 to 24, gain 0 or more, frequency above 0 and an integer seed");
96
+ let l = 0;
97
+ for (let e = 0; e < i; e++) l += .5 ** e;
98
+ return (t, a, u, d) => {
99
+ let f = 0, p = 1;
100
+ for (let r = 0; r < i && 2 * Math.PI * n / (s * 2 ** r) >= 2 * d; r++) {
101
+ let n = s * 2 ** r / (2 * Math.PI), i = 1 - Math.abs(e(t * n + r * 7.31, a * n - r * 3.17, u * n + r * 5.79, c + r)), l = i * i * p;
102
+ f += l * .5 ** r, p = Math.min(1, Math.max(0, l * o));
103
+ }
104
+ return f / l * r;
105
+ };
106
+ }
107
+ function s(t, n = {}) {
108
+ let { radius: r = 6371e3, amplitude: i = 1e5, frequency: o = 8, levels: s = 1, seed: c = 1 } = n;
109
+ if (typeof t != "function" || !(Number.isFinite(r) && r > 0) || !a(i, 0) || !(Number.isFinite(o) && o > 0) || s !== 1 && s !== 2 || !Number.isInteger(c)) throw TypeError("Invalid domainWarp options; pass a height function, radius above 0, amplitude 0 or more, frequency above 0, levels 1 or 2 and an integer seed");
110
+ let l = o / (2 * Math.PI), u = i / r;
111
+ return (n, r, i, a) => {
112
+ let o = n, d = r, f = i;
113
+ for (let t = 0; t < s; t++) {
114
+ let a = c + t * 101, s = o * l, p = d * l, m = f * l;
115
+ o = n + u * e(s + 1.7, p + 9.2, m + 3.1, a), d = r + u * e(s + 8.3, p + 2.8, m + 5.5, a + 1), f = i + u * e(s + 4.1, p + 6.4, m + 7.7, a + 2);
116
+ }
117
+ let p = Math.hypot(o, d, f);
118
+ return t(o / p, d / p, f / p, a);
119
+ };
120
+ }
121
+ function c(e, t = {}) {
122
+ let { mode: n = "add", smooth: r = 100 } = t;
123
+ if (!Array.isArray(e) || e.length === 0 || e.some((e) => typeof e != "function")) throw TypeError("Invalid combine heights; pass a non-empty array of height functions");
124
+ if (n !== "add" && n !== "max" && n !== "smoothMax") throw RangeError("Invalid combine mode; pass 'add', 'max' or 'smoothMax'");
125
+ if (!a(r, 0)) throw RangeError("Invalid combine smooth; pass a width in metres, 0 or more");
126
+ let i = e.slice();
127
+ return (e, t, a, o) => {
128
+ let s = i[0](e, t, a, o);
129
+ for (let c = 1; c < i.length; c++) {
130
+ let l = i[c](e, t, a, o);
131
+ if (n === "add") s += l;
132
+ else if (n === "max" || r === 0) s = Math.max(s, l);
133
+ else {
134
+ let e = Math.max(r - Math.abs(s - l), 0) / r;
135
+ s = Math.max(s, l) + e * e * r / 4;
136
+ }
137
+ }
138
+ return s;
139
+ };
140
+ }
141
+ var l = {
142
+ moon: {
143
+ radius: 1737400,
144
+ relief: 4e3
145
+ },
146
+ mars: {
147
+ radius: 3389500,
148
+ relief: 8e3
149
+ },
150
+ asteroid: {
151
+ radius: 1e4,
152
+ relief: 600
153
+ },
154
+ ice: {
155
+ radius: 1560800,
156
+ relief: 600
157
+ }
158
+ };
159
+ function u(e) {
160
+ let t = l[e];
161
+ if (!Object.hasOwn(l, e) || !t) throw RangeError("Invalid planet preset; pass 'moon', 'mars', 'asteroid' or 'ice'");
162
+ return t.radius;
163
+ }
164
+ function d(e, t = {}) {
165
+ let n = u(e), r = t.radius ?? n, a = t.seed ?? 1, d = l[e];
166
+ if (!(Number.isFinite(r) && r > 0) || !Number.isInteger(a)) throw RangeError("Invalid planetPreset options; pass radius above 0 and an integer seed");
167
+ let f = r / d.radius, p = (e, t) => o({
168
+ radius: r,
169
+ relief: e * f,
170
+ octaves: t,
171
+ seed: a + 5
172
+ });
173
+ switch (e) {
174
+ case "moon": return c([p(1500, 5), i({
175
+ radius: r,
176
+ density: 3e3,
177
+ dMin: r / 4e4,
178
+ dMax: r / 6,
179
+ seed: a
180
+ })]);
181
+ case "mars": return c([p(3e3, 6), i({
182
+ radius: r,
183
+ density: 400,
184
+ dMin: r / 2e4,
185
+ dMax: r / 8,
186
+ depthRatio: .15,
187
+ seed: a
188
+ })]);
189
+ case "asteroid": return c([p(150, 4), i({
190
+ radius: r,
191
+ density: 3e6,
192
+ dMin: r / 200,
193
+ dMax: r / 2,
194
+ blend: .3,
195
+ seed: a
196
+ })]);
197
+ case "ice": return c([s(p(250, 4), {
198
+ radius: r,
199
+ amplitude: r / 15,
200
+ frequency: 6,
201
+ levels: 2,
202
+ seed: a
203
+ }), i({
204
+ radius: r,
205
+ density: 60,
206
+ dMin: r / 1e4,
207
+ dMax: r / 10,
208
+ depthRatio: .08,
209
+ rimRatio: .02,
210
+ seed: a
211
+ })]);
212
+ default: throw RangeError("Invalid planet preset; pass 'moon', 'mars', 'asteroid' or 'ice'");
213
+ }
214
+ }
215
+ //#endregion
216
+ export { c as combine, i as craterField, s as domainWarp, d as planetPreset, u as planetPresetRadius, o as ridgeNoise };
@@ -0,0 +1,139 @@
1
+ /// <reference lib="esnext.disposable" preserve="true" />
2
+ import type { EngineKernel } from '@margoengine/core';
3
+ import { type Camera, type Engine, type EnginePlugin, type FrameGraph } from '@margoengine/core/extension';
4
+ import type { TerrainLighting } from './index.js';
5
+ /**
6
+ * Ground height in metres above `radius` at a unit direction from the planet's centre (float64). `detail` is the
7
+ * spacing in metres of the vertices being built there (0 for a query): a procedural height may skip detail finer than it.
8
+ */
9
+ export type PlanetHeight = (x: number, y: number, z: number, detail: number) => number;
10
+ /** A `FloatingOrigin` (`@margoengine/cameras/origin`), or anything with its `origin` and `onRebase`. */
11
+ export interface PlanetOrigin {
12
+ readonly origin: ArrayLike<number>;
13
+ onRebase(listener: (shift: ArrayLike<number>, origin: ArrayLike<number>) => void): () => void;
14
+ }
15
+ /** `PlanetTerrain.attach` options. Every one is optional. */
16
+ export interface PlanetTerrainOptions {
17
+ /** Radius in metres at height 0, above 0. Default 6,371,000 (the Earth's mean radius). */
18
+ radius?: number;
19
+ /** World position of the centre (float64). Default [0, 0, 0]. With `origin`, a world position: the planet draws at `center - origin.origin`. */
20
+ center?: ArrayLike<number>;
21
+ /** Ground height. Default `planetNoise({radius, relief, seed})`. */
22
+ height?: PlanetHeight;
23
+ /** Height range of the default ground and of the colours, in metres above 0. Default 8,000. */
24
+ relief?: number;
25
+ /** Seed of the default ground, an integer. Default 1. */
26
+ seed?: number;
27
+ /** Ground below this height draws as flat sea; `false` for none. Default 0. */
28
+ seaLevel?: number | false;
29
+ /** Quads along a patch's side, an even integer 4 to 64. Default 32. */
30
+ resolution?: number;
31
+ /** Deepest quadtree level, an integer 0 to 24. Default 20 (vertices 0.3 m apart on the Earth at resolution 32). */
32
+ maxLevel?: number;
33
+ /** A patch splits while its vertex spacing on screen is wider than this, in pixels, above 0. Default 4. */
34
+ screenError?: number;
35
+ /** Milliseconds a frame may spend building patches, at least one patch a frame; 0 or more, Infinity for no limit. Default 4. */
36
+ budget?: number;
37
+ /**
38
+ * Patches a frame may build, a work count: the same patches are built on any machine, so a film frame is the same on
39
+ * every run. When set it replaces the millisecond `budget`; 1 or more, Infinity to build until nothing more is wanted.
40
+ * Default unset (the live `budget` in milliseconds decides).
41
+ */
42
+ maxBuilds?: number;
43
+ /** Clock in milliseconds for the `budget`. Default `performance.now`; pass a simulation clock for replay. */
44
+ clock?: () => number;
45
+ /**
46
+ * Patches kept on the GPU at once, an integer 6 to 16,384 (about 24 KB each at resolution 32). Default 2,048. They
47
+ * share one vertex buffer, which must fit the device's `maxBufferSize` (256 MiB unless the device asked for more):
48
+ * 10,992 patches at resolution 32, 2,992 at 64. `attach` throws RangeError past it.
49
+ */
50
+ maxPatches?: number;
51
+ /** A floating origin to follow: the planet's centre moves with each rebase. */
52
+ origin?: PlanetOrigin;
53
+ }
54
+ /** What the last planned frame did. */
55
+ export interface PlanetStats {
56
+ /** Patches drawn. */
57
+ drawn: number;
58
+ /** Patches built (heights sampled, uploaded). */
59
+ built: number;
60
+ /** Patches on the GPU. */
61
+ resident: number;
62
+ /** Deepest level drawn. */
63
+ level: number;
64
+ }
65
+ /** A drawn patch: cube face 0 to 5 (+X, -X, +Y, -Y, +Z, -Z), quadtree level and cell. */
66
+ export interface PlanetPatch {
67
+ readonly face: number;
68
+ readonly level: number;
69
+ readonly x: number;
70
+ readonly y: number;
71
+ }
72
+ /**
73
+ * The unit direction of point (s, t) of cube face `face` (0 to 5: +X, -X, +Y, -Y, +Z, -Z; s and t from -1 to 1), through
74
+ * the equal-angle warp. Writes `out` (float64) and returns it. Points just past a face's edge continue onto its
75
+ * neighbour's ground.
76
+ */
77
+ export declare function cubeSphere(face: number, s: number, t: number, out?: number[] | Float64Array): number[] | Float64Array;
78
+ /**
79
+ * The default ground: fractal value noise over the sphere, about -`relief` to `relief` metres. Octave k has a
80
+ * wavelength of `radius / 2^(k+1)` and an amplitude of `relief / 2^(k+1)`; octaves shorter than twice the `detail` asked
81
+ * for are left out (at most 24).
82
+ */
83
+ export declare function planetNoise({ radius, relief, seed, }?: {
84
+ radius?: number;
85
+ relief?: number;
86
+ seed?: number;
87
+ }): PlanetHeight;
88
+ /**
89
+ * A planet's terrain: a cube sphere quadtree of height patches with skirts, drawn relative to the eye so it holds still
90
+ * from orbit to the ground. `PlanetTerrain.attach(engine, options)`; every option has a default.
91
+ * @throws RangeError or TypeError on an invalid option.
92
+ */
93
+ export declare class PlanetTerrain implements EnginePlugin, Disposable {
94
+ #private;
95
+ private static nextId;
96
+ readonly name: string;
97
+ readonly radius: number;
98
+ readonly resolution: number;
99
+ readonly maxLevel: number;
100
+ readonly maxPatches: number;
101
+ readonly seaLevel: number | false;
102
+ readonly relief: number;
103
+ screenError: number;
104
+ budget: number;
105
+ /** Patches a frame may build (a work count that replaces `budget`), or undefined for the millisecond `budget`. */
106
+ maxBuilds: number | undefined;
107
+ /** What the last planned frame did. */
108
+ readonly stats: PlanetStats;
109
+ /** Engine owning this planet, while attached. */
110
+ get owner(): Engine | undefined;
111
+ /** Centre after the floating origin, in the engine's coordinates. */
112
+ get localCenter(): [number, number, number];
113
+ /** Adds a surface shader effect at group 1; the returned function removes it. */
114
+ addLighting(effect: TerrainLighting): () => void;
115
+ /** Same as `engine.use(new PlanetTerrain(options))`; returns the planet. */
116
+ static attach(engine: EngineKernel, options?: PlanetTerrainOptions): PlanetTerrain;
117
+ constructor(options?: PlanetTerrainOptions);
118
+ /** World position of the planet's centre (float64; with `origin`, the world position before the origin is taken off). */
119
+ get center(): [number, number, number];
120
+ set center(value: ArrayLike<number>);
121
+ /** The patches the last planned frame drew. */
122
+ get patches(): PlanetPatch[];
123
+ /** Ground height in metres at a direction from the centre (normalised here), at full detail. */
124
+ heightAt(direction: ArrayLike<number>): number;
125
+ /** Height in metres of a point (the engine's coordinates, float64) above the ground (sea surface included) under it. */
126
+ altitude(position: ArrayLike<number>): number;
127
+ /**
128
+ * Plans a frame for `camera` drawn `size` pixels wide and high: picks the patches, builds those it needs within the
129
+ * budget and fills the per-patch offsets. The frame calls it; call it yourself to warm the patches up before a cut.
130
+ * Returns `stats`.
131
+ */
132
+ update(camera: Camera, size: readonly [number, number]): PlanetStats;
133
+ setup(engine: Engine): void;
134
+ registerPasses(graph: FrameGraph): void;
135
+ onDeviceRestored(engine: Engine): void;
136
+ /** Detaches from the engine and frees the GPU buffers; also `using`. */
137
+ dispose(): void;
138
+ [Symbol.dispose](): void;
139
+ }