@margoengine/scenes 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.
@@ -0,0 +1,591 @@
1
+ // @margo/core-built 0.1.0
2
+ import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
3
+
4
+ import { t as e } from "./dune-coast-info-e8eDZXBu.js";
5
+ import { PbrMaterial as t } from "@margoengine/core";
6
+ import { applyMatrix4 as n, toGeometry as r } from "@margoengine/geometry";
7
+ import { Noise as i } from "@margoengine/procedural/noise";
8
+ import { generateLaunchRail as a, generatePlankShed as o } from "@margoengine/procedural/sheds";
9
+ import { weatheredWood as s } from "@margoengine/materials/presets";
10
+ import { TerrainColors as c, TerrainHeightmap as l, heightfieldGeometry as u } from "@margoengine/terrain";
11
+ import { duneField as d, duneHill as f } from "@margoengine/terrain/dunes";
12
+ import { DAY_PRESETS as p } from "@margoengine/sky/day-presets";
13
+ import { PresetScene as m, SCENE_PRESETS as h } from "@margoengine/sky/scenes";
14
+ import { degrees as g, sunPath as _ } from "@margoengine/sky/sun";
15
+ import { Water as v } from "@margoengine/water";
16
+ import { GrassScatter as y } from "@margoengine/scatter/grass";
17
+ import { Shadows as b } from "@margoengine/shadows";
18
+ import { GTAO as x } from "@margoengine/post/gtao";
19
+ //#region src/dune-coast.ts
20
+ var S = e, C = 0, w = 900, T = {
21
+ origin: [-900, -800],
22
+ size: [2200, 2e3]
23
+ };
24
+ function E(e) {
25
+ if (typeof e != "object" || !e) throw TypeError("dune-coast: pass settings as an object.");
26
+ let t = {
27
+ ...Object.fromEntries(Object.entries(S.settings).map(([e, t]) => [e, t.default])),
28
+ ...e
29
+ };
30
+ for (let [e, n] of Object.entries(S.settings)) {
31
+ let r = t[e];
32
+ if (n.range && !(typeof r == "number" && r >= n.range[0] && r <= n.range[1])) throw RangeError(`dune-coast: ${e} is out of range; pass ${n.range[0]} to ${n.range[1]}.`);
33
+ if (n.options && !n.options.includes(r)) throw RangeError(`dune-coast: unknown ${e}; pass ${n.options.join(" or ")}.`);
34
+ }
35
+ for (let e of [
36
+ "sand",
37
+ "boards",
38
+ "roof",
39
+ "grassColor"
40
+ ]) {
41
+ let n = t[e];
42
+ if (!n || n.length !== 3 || !Array.from(n).every((e) => typeof e == "number" && e >= 0 && e <= 1)) throw RangeError(`dune-coast: ${e} is not a colour; pass three linear RGB values from 0 to 1.`);
43
+ }
44
+ if (!Number.isInteger(t.grassBlades)) throw RangeError("dune-coast: grassBlades is not a whole number; pass 4 to 64.");
45
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(t.date) || Number.isNaN(Date.parse(t.date))) throw RangeError("dune-coast: date is not a date; pass YYYY-MM-DD.");
46
+ return t;
47
+ }
48
+ function D(e) {
49
+ let t = Date.parse(e + "T12:00:00Z"), n = Date.UTC(Number(e.slice(0, 4)), 0, 1, 12);
50
+ return Math.round((t - n) / 864e5) + 1;
51
+ }
52
+ var O = (e, t, n) => {
53
+ let r = Math.min(1, Math.max(0, (n - e) / (t - e)));
54
+ return r * r * (3 - 2 * r);
55
+ };
56
+ function k(e) {
57
+ if (e.heights) {
58
+ let { samples: t, width: n, depth: r } = e.heights, i = e.heights.cellSize ?? 1, [a, o] = e.heights.origin ?? [-n * i / 2, -r * i / 2], s = e.heights.sea ?? .05;
59
+ if (t.length !== n * r) throw RangeError("dune-coast: heights.samples must hold width * depth values.");
60
+ let c = (e, i) => {
61
+ let a = t[Math.min(r - 1, Math.max(0, i)) * n + Math.min(n - 1, Math.max(0, e))];
62
+ return a <= s ? -1.5 : a;
63
+ };
64
+ return (e, t) => {
65
+ let n = (e - a) / i, r = (t - o) / i, s = Math.floor(n), l = Math.floor(r), u = n - s, d = r - l;
66
+ return (c(s, l) * (1 - u) + c(s + 1, l) * u) * (1 - d) + (c(s, l + 1) * (1 - u) + c(s + 1, l + 1) * u) * d;
67
+ };
68
+ }
69
+ let t = T.size[0] / 2 + 1, n = T.size[1] / 2 + 1, r = ((e.windFrom + 180) % 360 - 90 + 360) % 360, i = d({
70
+ width: t,
71
+ depth: n,
72
+ cellSize: 2,
73
+ origin: T.origin,
74
+ type: "transverse",
75
+ height: .8,
76
+ spacing: 16,
77
+ stoss: 10,
78
+ lee: 28,
79
+ irregularity: .9,
80
+ round: 4,
81
+ wind: r,
82
+ seed: e.seed,
83
+ amount: (e, t) => O(90, 220, Math.hypot(e + 10, t - 10)) * (1 - O(640, 720, e))
84
+ }), a = [
85
+ {
86
+ crest: [-40, 430],
87
+ height: e.hill,
88
+ wind: r,
89
+ stoss: 12,
90
+ lee: 30,
91
+ round: e.hill / 3 * (1 - .85 * e.crest)
92
+ },
93
+ {
94
+ crest: [-560, 260],
95
+ height: 11,
96
+ wind: r,
97
+ stoss: 11,
98
+ lee: 30,
99
+ halfWidth: 70
100
+ },
101
+ {
102
+ crest: [260, 520],
103
+ height: 7,
104
+ wind: r,
105
+ stoss: 10,
106
+ lee: 28,
107
+ halfWidth: 45
108
+ }
109
+ ].filter((e) => e.height > 0);
110
+ return (e, r) => {
111
+ let o = (e - T.origin[0]) / 2, s = (r - T.origin[1]) / 2, c = Math.min(t - 2, Math.max(0, Math.floor(o))), l = Math.min(n - 2, Math.max(0, Math.floor(s))), u = Math.min(1, Math.max(0, o - c)), d = Math.min(1, Math.max(0, s - l)), p = (i[l * t + c] * (1 - u) + i[l * t + c + 1] * u) * (1 - d) + (i[(l + 1) * t + c] * (1 - u) + i[(l + 1) * t + c + 1] * u) * d, m = 0;
112
+ for (let t of a) m += f(e, r, t);
113
+ let h = 2.5 + p * (1 - O(.5, 4, m)) + m, g = e < w ? (w - e) / 28 : (w - e) / 50, _ = O(730, 830, e), v = 3.2 * Math.exp(-(((e - 785) / 28) ** 2)) * (.8 + .2 * Math.sin(r / 37 + Math.sin(r / 91)));
114
+ return (1 - _) * h + _ * g + v;
115
+ };
116
+ }
117
+ function A(e = {}) {
118
+ return k(E(e));
119
+ }
120
+ function j(e, t) {
121
+ let n = t + 1, r = T.size[0] / t, i = T.size[1] / t, a = new Float32Array(n * n);
122
+ for (let t = 0; t < n; t++) for (let o = 0; o < n; o++) a[t * n + o] = e(T.origin[0] + o * r, T.origin[1] + t * i);
123
+ return (e, o) => {
124
+ let s = Math.min(t, Math.max(0, (e - T.origin[0]) / r)), c = Math.min(t, Math.max(0, (o - T.origin[1]) / i)), l = Math.min(t - 1, Math.floor(s)), u = Math.min(t - 1, Math.floor(c)), d = s - l, f = c - u, p = a[u * n + l], m = a[u * n + l + 1], h = a[(u + 1) * n + l], g = a[(u + 1) * n + l + 1];
125
+ return (p + (m - p) * d) * (1 - f) + (h + (g - h) * d) * f;
126
+ };
127
+ }
128
+ function M(e, t) {
129
+ let n = new i(e.seed + 7), r = .9 - 1.2 * e.grass;
130
+ return (i, a) => {
131
+ let o = t(i, a), s = O(1.2, 2, o) * (1 - O(7, 11, o));
132
+ if (!(s > 0) || e.grass <= 0) return 0;
133
+ let c = (t(i + 6, a) + t(i - 6, a) + t(i, a + 6) + t(i, a - 6)) / 4, l = r - .5 * O(-.05, .35, o - c), u = .65 * n.simplex2(i / 8, a / 8) + .3 * n.simplex2(i / 2.5 - 9, a / 2.5 + 4) + .5 * n.simplex2(i / 30 + 31, a / 30 - 17);
134
+ return s * Math.max(.03, .95 * O(l, l + .15, u));
135
+ };
136
+ }
137
+ function N(e = {}) {
138
+ let t = E(e);
139
+ return M(t, k(t));
140
+ }
141
+ function P(e, t, r, i, a = 0) {
142
+ let o = Math.cos(a), s = Math.sin(a);
143
+ return n(e, [
144
+ o,
145
+ 0,
146
+ -s,
147
+ 0,
148
+ 0,
149
+ 1,
150
+ 0,
151
+ 0,
152
+ s,
153
+ 0,
154
+ o,
155
+ 0,
156
+ t,
157
+ r,
158
+ i,
159
+ 1
160
+ ]);
161
+ }
162
+ function F(e, n = {}) {
163
+ let i = E(n), d = i.quality === "film", f = k(i), w = [], A = [], N = _({
164
+ latitude: g(i.latitude),
165
+ dayOfYear: D(i.date),
166
+ hour: i.hour
167
+ }), F = i.weather === "overcast" ? h.overcast : h.noon, I = m.attach(e, {
168
+ ...F,
169
+ day: {
170
+ ...i.weather === "overcast" ? p.overcast : p.noon,
171
+ azimuth: N.azimuth.degrees,
172
+ elevation: Math.max(1, N.elevation.degrees),
173
+ clouds: i.weather === "overcast" ? 1 : .35
174
+ },
175
+ fog: 3.912 / i.visibility
176
+ });
177
+ A.push(() => I.dispose());
178
+ let L = i.occlusion > 0 ? new x({
179
+ radius: i.occlusion,
180
+ slices: d ? 3 : 2,
181
+ steps: d ? 8 : 6
182
+ }) : void 0;
183
+ L && I.post.addEffect(L, 0);
184
+ let R = b.attach(e, {
185
+ resolution: d ? 4096 : 2048,
186
+ distance: 220,
187
+ lambda: .75,
188
+ lightSize: i.weather === "overcast" ? .08 : .02,
189
+ normalBias: .06,
190
+ casterMargin: 80
191
+ });
192
+ A.push(() => R.dispose());
193
+ let z = d ? 1023 : 511, B = j(f, z), V = e.createMesh().setGeometry(r(u(B, {
194
+ size: T.size,
195
+ origin: T.origin,
196
+ resolution: z
197
+ }))).setMaterial(new t({
198
+ color: [
199
+ i.sand[0],
200
+ i.sand[1],
201
+ i.sand[2]
202
+ ],
203
+ roughness: .92
204
+ }));
205
+ V.name = "dune-coast ground", w.push(V), R.add(V, { static: !0 });
206
+ let H = l.attach(e, f, {
207
+ origin: [660, T.origin[1]],
208
+ size: [400, T.size[1]],
209
+ resolution: 512
210
+ });
211
+ A.push(() => H.dispose());
212
+ let U;
213
+ if (c.attach(e, V, {
214
+ sand: i.sand,
215
+ shore: [80, 90],
216
+ stoneNormal: [.2, .25],
217
+ wetHeight: [-.1, .9],
218
+ wetDarkening: .58,
219
+ variation: .08,
220
+ detail: 1,
221
+ sandSurface: {
222
+ wind: [Math.sin((i.windFrom + 180) * Math.PI / 180), -Math.cos((i.windFrom + 180) * Math.PI / 180)],
223
+ broad: i.sandBands
224
+ },
225
+ wetness: {
226
+ texture: () => U?.coastalDepthTexture,
227
+ origin: [660, T.origin[1]],
228
+ size: [400, T.size[1]]
229
+ }
230
+ }), i.surf > 0) {
231
+ let t = i.surf / 2, n = (i.windFrom + 180) * Math.PI / 180, r = [Math.sin(n), -Math.cos(n)], a = [
232
+ {
233
+ direction: [-.97, .24],
234
+ amplitude: t * .75,
235
+ wavelength: 72,
236
+ steepness: .45,
237
+ phase: .4
238
+ },
239
+ {
240
+ direction: [-.88, -.47],
241
+ amplitude: t * .4,
242
+ wavelength: 41,
243
+ steepness: .45,
244
+ phase: 2.2
245
+ },
246
+ {
247
+ direction: r,
248
+ amplitude: Math.min(.35, .025 * i.wind),
249
+ wavelength: 11,
250
+ steepness: .3,
251
+ phase: 4.1
252
+ },
253
+ {
254
+ direction: [r[0] * .8 - .2, r[1]],
255
+ amplitude: Math.min(.12, .01 * i.wind),
256
+ wavelength: 5,
257
+ steepness: .35,
258
+ phase: 1.3
259
+ }
260
+ ];
261
+ U = v.attach(e, {
262
+ size: [1200, 1200],
263
+ segments: d ? 512 : 256,
264
+ horizon: !0,
265
+ height: 0,
266
+ color: [
267
+ .018,
268
+ .04,
269
+ .036
270
+ ],
271
+ foamDistance: 3,
272
+ spray: !0,
273
+ whitecaps: Math.min(1, i.wind / 18),
274
+ chop: Math.min(1, i.wind / 16),
275
+ depth: () => I.post.depthTexture,
276
+ sceneColor: () => I.post.sceneTexture,
277
+ reflection: () => I.sky.reflectionTexture,
278
+ lights: I.sky.lights,
279
+ shadows: R,
280
+ terrain: {
281
+ heightmap: () => H.texture,
282
+ origin: [660, T.origin[1]],
283
+ size: [400, T.size[1]]
284
+ },
285
+ waves: a
286
+ }), A.push(() => U?.dispose());
287
+ }
288
+ let W;
289
+ if (i.grass > 0) {
290
+ let n = z + 1, r = T.size[0] / z, a = T.size[1] / z, o = [T.origin[0] - r / 2, T.origin[1] - a / 2], s = [T.size[0] + r, T.size[1] + a], c = {
291
+ origin: o,
292
+ size: s,
293
+ resolution: n
294
+ }, u = l.attach(e, B, c), f = l.attach(e, M(i, B), c), p = (i.windFrom + 180) * Math.PI / 180;
295
+ A.push(() => u.dispose(), () => f.dispose()), W = y.attach(e, {
296
+ count: d ? 24e4 : 8e4,
297
+ area: [480, 480],
298
+ follow: !0,
299
+ bounds: [
300
+ o[0],
301
+ o[1],
302
+ o[0] + s[0],
303
+ o[1] + s[1]
304
+ ],
305
+ heightmap: () => u.texture,
306
+ densityMap: () => f.texture,
307
+ maxSlope: 32,
308
+ scale: [.7, 1.25],
309
+ lod: [
310
+ 30,
311
+ 90,
312
+ 230
313
+ ],
314
+ edgeShrink: 40,
315
+ grass: {
316
+ height: i.grassHeight,
317
+ heightVariance: .5,
318
+ width: i.grassWidth,
319
+ blades: i.grassBlades,
320
+ radius: .25,
321
+ lean: .65,
322
+ round: .4
323
+ },
324
+ blades: {
325
+ rootShade: .5,
326
+ widen: 1,
327
+ translucency: i.grassTranslucency
328
+ },
329
+ variation: {
330
+ hue: i.grassVariety,
331
+ value: .25
332
+ },
333
+ material: new t({
334
+ color: [
335
+ i.grassColor[0],
336
+ i.grassColor[1],
337
+ i.grassColor[2]
338
+ ],
339
+ roughness: .85,
340
+ doubleSided: !0
341
+ }),
342
+ wind: [
343
+ Math.sin(p),
344
+ -Math.cos(p),
345
+ Math.min(1, i.wind / 15)
346
+ ],
347
+ sink: .04,
348
+ seed: i.seed
349
+ }), A.push(() => W?.dispose());
350
+ }
351
+ let G, K = !1, q = Promise.resolve(), J = [], Y = `dune-coast-clock:${C++}`;
352
+ if (i.blownSand > 0) {
353
+ let t = i.grass > 0 ? M(i, B) : () => 0, n = (i.windFrom + 180) * Math.PI / 180, r = {
354
+ ground: B,
355
+ wind: {
356
+ speed: i.wind,
357
+ direction: Math.atan2(Math.sin(n), -Math.cos(n)),
358
+ gust: .35
359
+ },
360
+ mask: (e, n) => O(1.2, 2.2, B(e, n)) * (1 - t(e, n)),
361
+ amount: i.blownSand,
362
+ color: i.sand,
363
+ fog: 3.912 / i.visibility,
364
+ depth: () => I.post.depthTexture,
365
+ softness: .2,
366
+ sky: I.sky,
367
+ seed: i.seed
368
+ }, a = {coreRequirement:/*@__PURE__*/__margoCoreRequirement("0.1.0",import.meta.url),
369
+ name: Y,
370
+ setup() {},
371
+ onPreUpdate: (e) => J.push(e)
372
+ }, o = () => e.sceneOf(a)?.removePlugin(Y);
373
+ e.use(a), q = import("@margoengine/vfx/blown-sand").then(({ BlownSand: t }) => {
374
+ let n = e.sceneOf(a);
375
+ if (K || !n) return;
376
+ n.removePlugin(Y);
377
+ let i = new t(r);
378
+ n.use(i);
379
+ for (let e of J) i.advanceTime(e);
380
+ J.length = 0, G = i;
381
+ }, (e) => {
382
+ throw K || o(), e;
383
+ }), A.push(() => {
384
+ K = !0, G ? G.dispose() : o();
385
+ });
386
+ }
387
+ if (i.camp) {
388
+ let n = new t({
389
+ color: [
390
+ i.boards[0],
391
+ i.boards[1],
392
+ i.boards[2]
393
+ ],
394
+ roughness: s.roughness,
395
+ metalness: s.metalness
396
+ }), c = new t({
397
+ color: [
398
+ i.roof[0],
399
+ i.roof[1],
400
+ i.roof[2]
401
+ ],
402
+ roughness: s.roughness,
403
+ metalness: s.metalness
404
+ }), l = (e) => e === "trim" ? u : e === "roof" ? c : n, u = new t({
405
+ color: [
406
+ .2,
407
+ .17,
408
+ .13
409
+ ],
410
+ roughness: .9
411
+ }), d = new t({
412
+ color: [
413
+ .35,
414
+ .34,
415
+ .33
416
+ ],
417
+ roughness: .6,
418
+ metalness: .8
419
+ }), p = (t, n, i) => {
420
+ let a = e.createMesh().setGeometry(r(t)).setMaterial(n);
421
+ a.name = i, w.push(a), R.add(a, { static: !0 });
422
+ }, m = (e, t) => i.shedWindows ? t.map((t) => ({
423
+ wall: e,
424
+ at: t,
425
+ width: .8,
426
+ height: .7,
427
+ bottom: 1,
428
+ leaf: "none"
429
+ })) : [], h = o({
430
+ overhang: i.shedOverhang,
431
+ weathering: i.shedWeathering,
432
+ openings: [
433
+ {
434
+ wall: "front",
435
+ width: 3.6,
436
+ height: 2.1,
437
+ leaf: "awning"
438
+ },
439
+ ...m("back", [-3.5, 3.5]),
440
+ ...m("left", [0])
441
+ ],
442
+ seed: 3
443
+ }), g = o({
444
+ overhang: i.shedOverhang,
445
+ weathering: i.shedWeathering,
446
+ length: 7.6,
447
+ width: 4.9,
448
+ eaves: 2.3,
449
+ pitch: 30,
450
+ siding: "vertical",
451
+ board: .2,
452
+ openings: [
453
+ {
454
+ wall: "front",
455
+ at: -1.6,
456
+ width: .9,
457
+ height: 1.95,
458
+ leaf: "closed"
459
+ },
460
+ {
461
+ wall: "front",
462
+ at: 1.5,
463
+ width: .8,
464
+ height: .7,
465
+ bottom: 1,
466
+ leaf: "none"
467
+ },
468
+ ...m("left", [0])
469
+ ],
470
+ seed: 4
471
+ }), _ = -88.5, v = (e, t) => f(e, t) - .05;
472
+ for (let [e, t] of Object.entries(h.parts)) p(P(t, -70, v(-70, 30), 30, Math.PI), l(e), `hangar ${e}`);
473
+ for (let [e, t] of Object.entries(g.parts)) p(P(t, _, v(_, 30), 30, Math.PI), l(e), `shed ${e}`);
474
+ let y = a({ ground: (e) => f(0, -e) });
475
+ p(P(y.parts.wood, 0, 0, 0, Math.PI / 2), n, "rail"), y.parts.metal && p(P(y.parts.metal, 0, 0, 0, Math.PI / 2), d, "rail strip");
476
+ }
477
+ let X = (e, t, n) => [
478
+ e,
479
+ f(e, t) + n,
480
+ t
481
+ ], Z = {
482
+ rail: {
483
+ position: X(6, 4, 1.6),
484
+ target: X(0, -18, .3),
485
+ about: "the launch rail, its south end at the origin"
486
+ },
487
+ camp: {
488
+ position: X(-60, -25, 1.7),
489
+ target: X(-78, 30, 2),
490
+ about: "the hangar and the shed, seen from the north"
491
+ },
492
+ flightLine: {
493
+ position: X(0, -18.3, 1.5),
494
+ target: X(0, -60, 1.5),
495
+ about: "north along the first flight, 120 ft"
496
+ },
497
+ bigHill: {
498
+ position: X(-40, 430, 1.7),
499
+ target: X(-40, -50, 2),
500
+ about: "the big dune crest, looking back at the camp"
501
+ },
502
+ beach: {
503
+ position: X(780, 0, 1.7),
504
+ target: [
505
+ 1100,
506
+ 1,
507
+ 40
508
+ ],
509
+ about: "the foredune crest over the surf"
510
+ },
511
+ "first-flight": {
512
+ position: X(14, -14, 1.3),
513
+ target: X(-60, -40, .4),
514
+ about: "LC-W861-35, the first flight launch, looking west"
515
+ },
516
+ "camp-buildings": {
517
+ position: X(-40, -12, 1.6),
518
+ target: X(-80, 30, 1.6),
519
+ about: "LC-W86-15, the camp from the north-east"
520
+ },
521
+ "killdevil-from-flat": {
522
+ position: X(10, -60, 1.6),
523
+ target: X(-40, 430, 14),
524
+ about: "LC-W86-120, the big dune across the flat"
525
+ },
526
+ "flyer-on-rail": {
527
+ position: X(-75, 300, 1.6),
528
+ target: X(-25, 330, 1),
529
+ about: "LC-W86-21, on the windward slope, the slope rising right"
530
+ },
531
+ "killdevil-back": {
532
+ position: X(-40, 640, 1.6),
533
+ target: X(-40, 430, 10),
534
+ about: "LC-W85-110, the lee side of the big dune"
535
+ },
536
+ "landing-rail-view": {
537
+ position: X(-4, -48, 1.2),
538
+ target: X(0, 0, .2),
539
+ about: "LC-W86-38, back south along the flight line"
540
+ },
541
+ surf: {
542
+ position: X(860, -30, 1.7),
543
+ target: [
544
+ 960,
545
+ .5,
546
+ 10
547
+ ],
548
+ about: "the beach and the surf, looking east"
549
+ },
550
+ crest: {
551
+ position: X(-75, 424, 1.6),
552
+ target: X(-30, 432, .5),
553
+ about: "the big dune crest seen side on, the wind blowing across the view from left to right"
554
+ }
555
+ };
556
+ return {
557
+ settings: i,
558
+ height: f,
559
+ anchors: Z,
560
+ views: S.views,
561
+ view(t, n = 50) {
562
+ let r = Z[t];
563
+ if (!r) throw RangeError(`dune-coast: no anchor ${t}; pass one of ${Object.keys(Z).join(", ")}.`);
564
+ e.camera.position = [...r.position], e.camera.target = [...r.target], e.camera.fov = n;
565
+ },
566
+ advanceTime(e) {
567
+ I.sky.advanceTime?.(e), U?.advanceTime(e), W?.advanceTime(e), G ? G.advanceTime(e) : i.blownSand > 0 && J.push(e);
568
+ },
569
+ ready: q,
570
+ parts: {
571
+ preset: I,
572
+ water: U,
573
+ shadows: R,
574
+ grass: W,
575
+ occlusion: L,
576
+ get blownSand() {
577
+ return G;
578
+ }
579
+ },
580
+ dispose() {
581
+ for (let e of w) e.dispose?.();
582
+ for (let e of A.reverse()) e();
583
+ w.length = 0, A.length = 0;
584
+ },
585
+ [Symbol.dispose]() {
586
+ this.dispose();
587
+ }
588
+ };
589
+ }
590
+ //#endregion
591
+ export { F as attach, N as grassCover, A as ground, S as info };
@@ -0,0 +1,67 @@
1
+ /// <reference lib="esnext.disposable" preserve="true" />
2
+ import type { EngineKernel } from '@margoengine/core';
3
+ import { BlastCloud } from '@margoengine/weather/eruption';
4
+ import { Clouds } from '@margoengine/vfx/clouds';
5
+ import { Debris } from '@margoengine/vfx/debris';
6
+ import { Flood } from '@margoengine/water/flood';
7
+ import { type FauldWorld, type FauldWorldSettings } from './fauld-world.js';
8
+ export { FAULD_CENTRE, FAULD_CLOUD_DECK, FAULD_PLACES, FAULD_SIZE, FAULD_SLOTS, type FauldEra, type FauldSky, } from './fauld-world.js';
9
+ /** Settings of {@link attach}: the shared Fauld settings plus the film time and the mud. */
10
+ export interface FauldBlastSettings extends FauldWorldSettings {
11
+ /** Film seconds since the first explosion at attach, 0 to 3,600. Default 0. */
12
+ readonly time?: number;
13
+ /** Whether the burst reservoir's mud flows (`Flood` in mud mode). Default false (it costs a GPU solver). */
14
+ readonly mud?: boolean;
15
+ /**
16
+ * Whether each engine frame moves the film on by its delta. Default true; false leaves the film where `seek` puts it
17
+ * (a shot tool that seeks every frame from its own clock).
18
+ */
19
+ readonly clock?: boolean;
20
+ /** Puffs of each cap and each stem (`BlastCloud.draw`). Default 2,040 and 1,020. */
21
+ readonly puffs?: {
22
+ readonly cap?: number;
23
+ readonly stem?: number;
24
+ };
25
+ }
26
+ /** The scene handle: the world plus the blast's parts and its film clock. */
27
+ export interface FauldBlast extends FauldWorld {
28
+ readonly blast: BlastCloud;
29
+ readonly smoke: Clouds;
30
+ readonly fire: Clouds;
31
+ readonly debris: readonly Debris[];
32
+ readonly flood: Flood | undefined;
33
+ /** Film seconds since the first explosion. */
34
+ readonly time: number;
35
+ /** Sets the film time; every part shows that moment. */
36
+ seek(t: number): void;
37
+ }
38
+ /**
39
+ * The two releases: 3,700 tonnes of bombs, a share of it high explosive, given as 4,000 t of TNT equivalent split
40
+ * 55 / 45 between two explosions 1.6 s apart (a model choice from the two shocks the witnesses heard), the second
41
+ * 95 m east of the first along the crater's long axis.
42
+ */
43
+ export declare const FAULD_BLASTS: readonly ({
44
+ at: number;
45
+ at_: readonly [-40, 10];
46
+ tnt: number;
47
+ speed: number;
48
+ } | {
49
+ at: number;
50
+ at_: readonly [55, -15];
51
+ tnt: number;
52
+ speed: number;
53
+ })[];
54
+ /** Film second the reservoir's bank goes and the mud starts down the slope. */
55
+ export declare const FAULD_MUD_AT = 20;
56
+ /** Film second the incendiary dump on the surface catches. */
57
+ export declare const FAULD_FIRE_AT = 3;
58
+ /** The incendiary dump on the surface, [x, z] metres from the crater. */
59
+ export declare const FAULD_DUMP: readonly [-150, 95];
60
+ /**
61
+ * Builds the countryside with the explosion into `engine`, at film time `settings.time`.
62
+ * @example
63
+ * const scene = await attach(engine, { sky: 'overcast', time: 30 });
64
+ * scene.look([-1800, 150, 900], [0, 900, 0], 30);
65
+ * scene.seek(60); // the column a minute after the first explosion
66
+ */
67
+ export declare function attach(engine: EngineKernel, settings?: FauldBlastSettings): Promise<FauldBlast>;