@margoengine/scenes 0.1.0 → 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 -201
- package/NOTICE +4 -4
- package/README.md +620 -387
- package/dist/{dune-coast-info-e8eDZXBu.js → dune-coast-info-D9yQIv8G.js} +13 -3
- package/dist/dune-coast.d.ts +20 -1
- package/dist/dune-coast.js +374 -187
- package/dist/errors-fc4i1pSL.js +7 -0
- package/dist/fauld-blast.d.ts +119 -21
- package/dist/fauld-blast.js +957 -206
- package/dist/fauld-countryside.d.ts +1 -1
- package/dist/fauld-countryside.js +4 -4
- package/dist/fauld-crater.d.ts +1 -1
- package/dist/fauld-crater.js +4 -4
- package/dist/fauld-dig.d.ts +89 -0
- package/dist/fauld-dustfall-fines-grid-MA6XPrq6.js +14 -0
- package/dist/fauld-dustfall-fines-grid.d.ts +11 -0
- package/dist/fauld-dustfall-grid-Bb4X8b-u.js +14 -0
- package/dist/fauld-dustfall-grid.d.ts +11 -0
- package/dist/fauld-explosion.d.ts +135 -0
- package/dist/fauld-grains.d.ts +27 -0
- package/dist/fauld-mud.d.ts +104 -0
- package/dist/fauld-surge.d.ts +71 -0
- package/dist/fauld-tunnels.d.ts +76 -3
- package/dist/fauld-tunnels.js +518 -193
- package/dist/fauld-world-CNNSonJF.js +863 -0
- package/dist/fauld-world.d.ts +86 -3
- package/dist/index.js +2 -2
- package/dist/{library-mesh-BRk4Ycnn.js → library-mesh-CjTG-mVZ.js} +97 -74
- package/dist/library-parts.d.ts +11 -1
- package/dist/library.js +1 -1
- package/dist/look-family.d.ts +16 -1
- package/dist/look-family.js +35 -12
- package/dist/shared/settings.d.ts +89 -89
- package/dist/{timber-valley-info-BB6GvcsL.js → timber-valley-info-vVI2nwDs.js} +11 -0
- package/dist/timber-valley.d.ts +69 -3
- package/dist/timber-valley.js +198 -136
- package/package.json +106 -104
- package/dist/fauld-world-85dg03jo.js +0 -582
package/dist/dune-coast.js
CHANGED
|
@@ -1,33 +1,91 @@
|
|
|
1
|
-
// @margo/core-built
|
|
1
|
+
// @margo/core-built 1.0.0
|
|
2
2
|
import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
|
|
3
3
|
|
|
4
|
-
import { t as e } from "./dune-coast-info-
|
|
4
|
+
import { t as e } from "./dune-coast-info-D9yQIv8G.js";
|
|
5
5
|
import { PbrMaterial as t } from "@margoengine/core";
|
|
6
6
|
import { applyMatrix4 as n, toGeometry as r } from "@margoengine/geometry";
|
|
7
7
|
import { Noise as i } from "@margoengine/procedural/noise";
|
|
8
|
-
import { generateLaunchRail as a, generatePlankShed as o } from "@margoengine/procedural/sheds";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
8
|
+
import { generateLaunchRail as a, generatePlankShed as o, shedBoardMap as s } from "@margoengine/procedural/sheds";
|
|
9
|
+
import { Material as c, Texture as l, createMesh as u } from "@margoengine/materials";
|
|
10
|
+
import { weatheredWood as d } from "@margoengine/materials/presets";
|
|
11
|
+
import { TerrainColors as f, TerrainHeightmap as p, heightfieldGeometry as m } from "@margoengine/terrain";
|
|
12
|
+
import { TerrainDeformation as h } from "@margoengine/terrain/deform";
|
|
13
|
+
import { duneField as g, duneHill as _ } from "@margoengine/terrain/dunes";
|
|
14
|
+
import { refinedHeightfieldGeometry as v, windScour as y } from "@margoengine/terrain/scour";
|
|
15
|
+
import { DAY_PRESETS as b } from "@margoengine/sky/day-presets";
|
|
16
|
+
import { PresetScene as ee, SCENE_PRESETS as x } from "@margoengine/sky/scenes";
|
|
17
|
+
import { degrees as S, sunPath as te } from "@margoengine/sky/sun";
|
|
18
|
+
import { Water as ne } from "@margoengine/water";
|
|
19
|
+
import { SpectralSea as re } from "@margoengine/physics/sea";
|
|
20
|
+
import { jonswap as C, sumSpectra as ie } from "@margoengine/physics/waves";
|
|
21
|
+
import { GrassScatter as ae } from "@margoengine/scatter/grass";
|
|
22
|
+
import { Shadows as oe } from "@margoengine/shadows";
|
|
23
|
+
import { GTAO as se } from "@margoengine/post/gtao";
|
|
19
24
|
//#region src/dune-coast.ts
|
|
20
|
-
var
|
|
25
|
+
var w = e, ce = 0, T = 900, E = {
|
|
21
26
|
origin: [-900, -800],
|
|
22
27
|
size: [2200, 2e3]
|
|
23
|
-
}
|
|
24
|
-
|
|
28
|
+
}, le = [
|
|
29
|
+
[
|
|
30
|
+
[-86.9, 27],
|
|
31
|
+
[-79, 24.5],
|
|
32
|
+
[-71, 27.2]
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
[-69.5, 27],
|
|
36
|
+
[-52, 17],
|
|
37
|
+
[-31, 8.5],
|
|
38
|
+
[-11, 2.5],
|
|
39
|
+
[-1.6, .8]
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
[-1.4, -2.4],
|
|
43
|
+
[-13, 3.6],
|
|
44
|
+
[-33, 12],
|
|
45
|
+
[-56, 20.5],
|
|
46
|
+
[-71, 26.4]
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
[-68, 25.5],
|
|
50
|
+
[-45, 6],
|
|
51
|
+
[-22, -6],
|
|
52
|
+
[-2.2, -9]
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
[1.2, 2.5],
|
|
56
|
+
[1.5, -7],
|
|
57
|
+
[1.1, -19.5],
|
|
58
|
+
[-1.1, -20.5],
|
|
59
|
+
[-1.3, -9],
|
|
60
|
+
[-1.6, 1.5]
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
[-2.5, -46],
|
|
64
|
+
[-1.4, -31],
|
|
65
|
+
[-1.2, -21]
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
[-.4, -20],
|
|
69
|
+
[-3.5, -12],
|
|
70
|
+
[-2.8, -4],
|
|
71
|
+
[3.5, 3],
|
|
72
|
+
[6.5, 5.5]
|
|
73
|
+
],
|
|
74
|
+
[
|
|
75
|
+
[-70, 26],
|
|
76
|
+
[-55, 9],
|
|
77
|
+
[-43.5, -7],
|
|
78
|
+
[-30, -14],
|
|
79
|
+
[-6, -15.5]
|
|
80
|
+
]
|
|
81
|
+
];
|
|
82
|
+
function D(e) {
|
|
25
83
|
if (typeof e != "object" || !e) throw TypeError("dune-coast: pass settings as an object.");
|
|
26
84
|
let t = {
|
|
27
|
-
...Object.fromEntries(Object.entries(
|
|
85
|
+
...Object.fromEntries(Object.entries(w.settings).map(([e, t]) => [e, t.default])),
|
|
28
86
|
...e
|
|
29
87
|
};
|
|
30
|
-
for (let [e, n] of Object.entries(
|
|
88
|
+
for (let [e, n] of Object.entries(w.settings)) {
|
|
31
89
|
let r = t[e];
|
|
32
90
|
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
91
|
if (n.options && !n.options.includes(r)) throw RangeError(`dune-coast: unknown ${e}; pass ${n.options.join(" or ")}.`);
|
|
@@ -45,7 +103,7 @@ function E(e) {
|
|
|
45
103
|
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
104
|
return t;
|
|
47
105
|
}
|
|
48
|
-
function
|
|
106
|
+
function ue(e) {
|
|
49
107
|
let t = Date.parse(e + "T12:00:00Z"), n = Date.UTC(Number(e.slice(0, 4)), 0, 1, 12);
|
|
50
108
|
return Math.round((t - n) / 864e5) + 1;
|
|
51
109
|
}
|
|
@@ -66,11 +124,11 @@ function k(e) {
|
|
|
66
124
|
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
125
|
};
|
|
68
126
|
}
|
|
69
|
-
let t =
|
|
127
|
+
let t = E.size[0] / 2 + 1, n = E.size[1] / 2 + 1, r = ((e.windFrom + 180) % 360 - 90 + 360) % 360, i = g({
|
|
70
128
|
width: t,
|
|
71
129
|
depth: n,
|
|
72
130
|
cellSize: 2,
|
|
73
|
-
origin:
|
|
131
|
+
origin: E.origin,
|
|
74
132
|
type: "transverse",
|
|
75
133
|
height: .8,
|
|
76
134
|
spacing: 16,
|
|
@@ -108,37 +166,72 @@ function k(e) {
|
|
|
108
166
|
}
|
|
109
167
|
].filter((e) => e.height > 0);
|
|
110
168
|
return (e, r) => {
|
|
111
|
-
let o = (e -
|
|
112
|
-
for (let t of a)
|
|
113
|
-
let
|
|
114
|
-
return (1 -
|
|
169
|
+
let o = (e - E.origin[0]) / 2, s = (r - E.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)), f = (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, p = 0;
|
|
170
|
+
for (let t of a) p += _(e, r, t);
|
|
171
|
+
let m = 2.5 + f * (1 - O(.5, 4, p)) + p, h = e < T ? (T - e) / 28 : (T - e) / 50, g = O(730, 830, e), v = 3.2 * Math.exp(-(((e - 785) / 28) ** 2)) * (.8 + .2 * Math.sin(r / 37 + Math.sin(r / 91)));
|
|
172
|
+
return (1 - g) * m + g * h + v;
|
|
115
173
|
};
|
|
116
174
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
175
|
+
var A = [{
|
|
176
|
+
center: [-70, 30],
|
|
177
|
+
size: [13.4, 4.9],
|
|
178
|
+
height: 3.2
|
|
179
|
+
}, {
|
|
180
|
+
center: [-88.5, 30],
|
|
181
|
+
size: [7.6, 4.9],
|
|
182
|
+
height: 3.71
|
|
183
|
+
}];
|
|
120
184
|
function j(e, t) {
|
|
121
|
-
|
|
122
|
-
|
|
185
|
+
if (!(e.scour > 0)) return;
|
|
186
|
+
let n = ((e.windFrom + 180) % 360 - 90 + 360) % 360, r = Math.cos(n * Math.PI / 180), a = Math.sin(n * Math.PI / 180), o = P(e, t), s = new i(e.seed + 11), c = [];
|
|
187
|
+
for (let e = 0; e < 56; e++) for (let t = 0; t < 54; t++) {
|
|
188
|
+
let n = -110 + 2.5 * t + 1.1 * s.simplex2(t * 7.3, e * 5.1), i = -65 + 2.5 * e + 1.1 * s.simplex2(t * 3.7 + 40, e * 8.9);
|
|
189
|
+
Math.abs(n) < 4 && i > -23 && i < 4 || o(n, i) > .45 && o(n + 1.6 * r, i + 1.6 * a) < .2 && c.push({
|
|
190
|
+
center: [n, i],
|
|
191
|
+
width: 1 + .5 * s.simplex2(t * 11.9 - 3, e * 13.3)
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return y({
|
|
195
|
+
buildings: e.camp ? A : [],
|
|
196
|
+
plants: c,
|
|
197
|
+
wind: n,
|
|
198
|
+
speed: e.wind
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function M(e) {
|
|
202
|
+
let t = k(e), n = j(e, t), r = n ? (t, r) => e.scour * n.change(t, r) : void 0;
|
|
203
|
+
return {
|
|
204
|
+
base: t,
|
|
205
|
+
wind: n,
|
|
206
|
+
change: r,
|
|
207
|
+
height: r ? (e, n) => t(e, n) + r(e, n) : t
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function N(e = {}) {
|
|
211
|
+
return M(D(e)).height;
|
|
212
|
+
}
|
|
213
|
+
function de(e, t) {
|
|
214
|
+
let n = t + 1, r = E.size[0] / t, i = E.size[1] / t, a = new Float32Array(n * n);
|
|
215
|
+
for (let t = 0; t < n; t++) for (let o = 0; o < n; o++) a[t * n + o] = e(E.origin[0] + o * r, E.origin[1] + t * i);
|
|
123
216
|
return (e, o) => {
|
|
124
|
-
let s = Math.min(t, Math.max(0, (e -
|
|
217
|
+
let s = Math.min(t, Math.max(0, (e - E.origin[0]) / r)), c = Math.min(t, Math.max(0, (o - E.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
218
|
return (p + (m - p) * d) * (1 - f) + (h + (g - h) * d) * f;
|
|
126
219
|
};
|
|
127
220
|
}
|
|
128
|
-
function
|
|
221
|
+
function P(e, t) {
|
|
129
222
|
let n = new i(e.seed + 7), r = .9 - 1.2 * e.grass;
|
|
130
223
|
return (i, a) => {
|
|
131
224
|
let o = t(i, a), s = O(1.2, 2, o) * (1 - O(7, 11, o));
|
|
132
225
|
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));
|
|
226
|
+
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), d = O(-98, -96.5, i) * (1 - O(-62, -60.5, i)) * O(26, 27.5, a) * (1 - O(32.5, 34, a));
|
|
227
|
+
return s * Math.max(.03, .95 * O(l, l + .15, u)) * (1 - d);
|
|
135
228
|
};
|
|
136
229
|
}
|
|
137
|
-
function
|
|
138
|
-
let t =
|
|
139
|
-
return
|
|
230
|
+
function F(e = {}) {
|
|
231
|
+
let t = D(e);
|
|
232
|
+
return P(t, k(t));
|
|
140
233
|
}
|
|
141
|
-
function
|
|
234
|
+
function I(e, t, r, i, a = 0) {
|
|
142
235
|
let o = Math.cos(a), s = Math.sin(a);
|
|
143
236
|
return n(e, [
|
|
144
237
|
o,
|
|
@@ -159,42 +252,47 @@ function P(e, t, r, i, a = 0) {
|
|
|
159
252
|
1
|
|
160
253
|
]);
|
|
161
254
|
}
|
|
162
|
-
function
|
|
163
|
-
let i =
|
|
164
|
-
latitude:
|
|
165
|
-
dayOfYear:
|
|
255
|
+
function L(e, n = {}) {
|
|
256
|
+
let i = D(n), g = i.quality === "film", { base: _, wind: y, change: T, height: k } = M(i), A = [], j = [], N = te({
|
|
257
|
+
latitude: S(i.latitude),
|
|
258
|
+
dayOfYear: ue(i.date),
|
|
166
259
|
hour: i.hour
|
|
167
|
-
}), F = i.weather === "overcast" ?
|
|
260
|
+
}), F = i.weather === "overcast" ? x.overcast : x.noon, L = ee.attach(e, {
|
|
168
261
|
...F,
|
|
169
262
|
day: {
|
|
170
|
-
...i.weather === "overcast" ?
|
|
263
|
+
...i.weather === "overcast" ? b.overcast : b.noon,
|
|
171
264
|
azimuth: N.azimuth.degrees,
|
|
172
265
|
elevation: Math.max(1, N.elevation.degrees),
|
|
173
266
|
clouds: i.weather === "overcast" ? 1 : .35
|
|
174
267
|
},
|
|
175
268
|
fog: 3.912 / i.visibility
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
let
|
|
269
|
+
}, { meter: !0 });
|
|
270
|
+
j.push(() => L.dispose());
|
|
271
|
+
let R = i.occlusion > 0 ? new se({
|
|
179
272
|
radius: i.occlusion,
|
|
180
|
-
slices:
|
|
181
|
-
steps:
|
|
273
|
+
slices: g ? 3 : 2,
|
|
274
|
+
steps: g ? 8 : 6
|
|
182
275
|
}) : void 0;
|
|
183
|
-
|
|
184
|
-
let
|
|
185
|
-
resolution:
|
|
276
|
+
R && L.post.addEffect(R, 0);
|
|
277
|
+
let z = oe.attach(e, {
|
|
278
|
+
resolution: g ? 4096 : 2048,
|
|
186
279
|
distance: 220,
|
|
187
280
|
lambda: .75,
|
|
188
281
|
lightSize: i.weather === "overcast" ? .08 : .02,
|
|
189
282
|
normalBias: .06,
|
|
190
283
|
casterMargin: 80
|
|
191
284
|
});
|
|
192
|
-
|
|
193
|
-
let
|
|
194
|
-
size:
|
|
195
|
-
origin:
|
|
196
|
-
resolution:
|
|
197
|
-
})
|
|
285
|
+
j.push(() => z.dispose());
|
|
286
|
+
let B = g ? 1023 : 511, V = de(_, B), H = {
|
|
287
|
+
size: E.size,
|
|
288
|
+
origin: E.origin,
|
|
289
|
+
resolution: B
|
|
290
|
+
}, U = e.createMesh().setGeometry(r(y ? v(V, {
|
|
291
|
+
...H,
|
|
292
|
+
regions: y.bounds,
|
|
293
|
+
subdivide: g ? 5 : 3,
|
|
294
|
+
add: T
|
|
295
|
+
}) : m(V, H))).setMaterial(new t({
|
|
198
296
|
color: [
|
|
199
297
|
i.sand[0],
|
|
200
298
|
i.sand[1],
|
|
@@ -202,15 +300,15 @@ function F(e, n = {}) {
|
|
|
202
300
|
],
|
|
203
301
|
roughness: .92
|
|
204
302
|
}));
|
|
205
|
-
|
|
206
|
-
let
|
|
207
|
-
origin: [660,
|
|
208
|
-
size: [400,
|
|
303
|
+
U.name = "dune-coast ground", A.push(U), z.add(U, { static: !0 });
|
|
304
|
+
let W = p.attach(e, k, {
|
|
305
|
+
origin: [660, E.origin[1]],
|
|
306
|
+
size: [400, E.size[1]],
|
|
209
307
|
resolution: 512
|
|
210
308
|
});
|
|
211
|
-
|
|
212
|
-
let
|
|
213
|
-
if (
|
|
309
|
+
j.push(() => W.dispose());
|
|
310
|
+
let G;
|
|
311
|
+
if (f.attach(e, U, {
|
|
214
312
|
sand: i.sand,
|
|
215
313
|
shore: [80, 90],
|
|
216
314
|
stoneNormal: [.2, .25],
|
|
@@ -223,9 +321,9 @@ function F(e, n = {}) {
|
|
|
223
321
|
broad: i.sandBands
|
|
224
322
|
},
|
|
225
323
|
wetness: {
|
|
226
|
-
texture: () =>
|
|
227
|
-
origin: [660,
|
|
228
|
-
size: [400,
|
|
324
|
+
texture: () => G?.coastalDepthTexture,
|
|
325
|
+
origin: [660, E.origin[1]],
|
|
326
|
+
size: [400, E.size[1]]
|
|
229
327
|
}
|
|
230
328
|
}), i.surf > 0) {
|
|
231
329
|
let t = i.surf / 2, n = (i.windFrom + 180) * Math.PI / 180, r = [Math.sin(n), -Math.cos(n)], a = [
|
|
@@ -257,10 +355,25 @@ function F(e, n = {}) {
|
|
|
257
355
|
steepness: .35,
|
|
258
356
|
phase: 1.3
|
|
259
357
|
}
|
|
260
|
-
]
|
|
261
|
-
|
|
358
|
+
], o = () => ({
|
|
359
|
+
frequencies: Float64Array.from({ length: 34 }, (e, t) => .04 * 25 ** (t / 33)),
|
|
360
|
+
directions: Float64Array.from({ length: 24 }, (e, t) => 2 * Math.PI * t / 24),
|
|
361
|
+
energy: /* @__PURE__ */ new Float64Array(816),
|
|
362
|
+
depth: 20,
|
|
363
|
+
density: 1025
|
|
364
|
+
}), s = (e) => 4 * Math.sqrt(e.reduce((e, t) => e + t.amplitude * t.amplitude / 2, 0)), c = (e) => Math.sqrt(2 * Math.PI * e / 9.81), l = ie(o(), C({
|
|
365
|
+
height: s(a.slice(0, 2)),
|
|
366
|
+
period: c(72),
|
|
367
|
+
direction: Math.atan2(.24, -.97),
|
|
368
|
+
spread: { s: 25 }
|
|
369
|
+
}, o()), C({
|
|
370
|
+
height: s(a.slice(2)),
|
|
371
|
+
period: c(11),
|
|
372
|
+
direction: Math.atan2(r[1], r[0])
|
|
373
|
+
}, o()));
|
|
374
|
+
G = ne.attach(e, {
|
|
262
375
|
size: [1200, 1200],
|
|
263
|
-
segments:
|
|
376
|
+
segments: g ? 512 : 256,
|
|
264
377
|
horizon: !0,
|
|
265
378
|
height: 0,
|
|
266
379
|
color: [
|
|
@@ -272,28 +385,37 @@ function F(e, n = {}) {
|
|
|
272
385
|
spray: !0,
|
|
273
386
|
whitecaps: Math.min(1, i.wind / 18),
|
|
274
387
|
chop: Math.min(1, i.wind / 16),
|
|
275
|
-
depth: () =>
|
|
276
|
-
sceneColor: () =>
|
|
277
|
-
reflection: () =>
|
|
278
|
-
lights:
|
|
279
|
-
shadows:
|
|
388
|
+
depth: () => L.post.depthTexture,
|
|
389
|
+
sceneColor: () => L.post.sceneTexture,
|
|
390
|
+
reflection: () => L.sky.reflectionTexture,
|
|
391
|
+
lights: L.sky.lights,
|
|
392
|
+
shadows: z,
|
|
280
393
|
terrain: {
|
|
281
|
-
heightmap: () =>
|
|
282
|
-
origin: [660,
|
|
283
|
-
size: [400,
|
|
394
|
+
heightmap: () => W.texture,
|
|
395
|
+
origin: [660, E.origin[1]],
|
|
396
|
+
size: [400, E.size[1]]
|
|
284
397
|
},
|
|
285
|
-
waves: a
|
|
286
|
-
|
|
398
|
+
waves: a,
|
|
399
|
+
sea: new re({
|
|
400
|
+
waves: l,
|
|
401
|
+
seed: 1
|
|
402
|
+
})
|
|
403
|
+
}), j.push(() => G?.dispose());
|
|
404
|
+
let u = L.sky.options.fog;
|
|
405
|
+
u && (L.sky.options.fog = {
|
|
406
|
+
...u,
|
|
407
|
+
depth: () => G?.depthTexture ?? L.post.depthTexture
|
|
408
|
+
});
|
|
287
409
|
}
|
|
288
|
-
let
|
|
410
|
+
let K;
|
|
289
411
|
if (i.grass > 0) {
|
|
290
|
-
let n =
|
|
412
|
+
let n = B + 1, r = E.size[0] / B, a = E.size[1] / B, o = [E.origin[0] - r / 2, E.origin[1] - a / 2], s = [E.size[0] + r, E.size[1] + a], c = {
|
|
291
413
|
origin: o,
|
|
292
414
|
size: s,
|
|
293
415
|
resolution: n
|
|
294
|
-
},
|
|
295
|
-
|
|
296
|
-
count:
|
|
416
|
+
}, l = p.attach(e, V, c), u = p.attach(e, P(i, V), c), d = (i.windFrom + 180) * Math.PI / 180;
|
|
417
|
+
j.push(() => l.dispose(), () => u.dispose()), K = ae.attach(e, {
|
|
418
|
+
count: g ? 24e4 : 8e4,
|
|
297
419
|
area: [480, 480],
|
|
298
420
|
follow: !0,
|
|
299
421
|
bounds: [
|
|
@@ -302,8 +424,8 @@ function F(e, n = {}) {
|
|
|
302
424
|
o[0] + s[0],
|
|
303
425
|
o[1] + s[1]
|
|
304
426
|
],
|
|
305
|
-
heightmap: () =>
|
|
306
|
-
densityMap: () =>
|
|
427
|
+
heightmap: () => l.texture,
|
|
428
|
+
densityMap: () => u.texture,
|
|
307
429
|
maxSlope: 32,
|
|
308
430
|
scale: [.7, 1.25],
|
|
309
431
|
lod: [
|
|
@@ -340,75 +462,99 @@ function F(e, n = {}) {
|
|
|
340
462
|
doubleSided: !0
|
|
341
463
|
}),
|
|
342
464
|
wind: [
|
|
343
|
-
Math.sin(
|
|
344
|
-
-Math.cos(
|
|
465
|
+
Math.sin(d),
|
|
466
|
+
-Math.cos(d),
|
|
345
467
|
Math.min(1, i.wind / 15)
|
|
346
468
|
],
|
|
347
469
|
sink: .04,
|
|
348
470
|
seed: i.seed
|
|
349
|
-
}),
|
|
471
|
+
}), j.push(() => K?.dispose());
|
|
350
472
|
}
|
|
351
|
-
let
|
|
473
|
+
let q, J = !1, fe = Promise.resolve(), Y = [], X = `dune-coast-clock:${ce++}`;
|
|
352
474
|
if (i.blownSand > 0) {
|
|
353
|
-
let t = i.grass > 0 ?
|
|
354
|
-
ground:
|
|
475
|
+
let t = i.grass > 0 ? P(i, V) : () => 0, n = (i.windFrom + 180) * Math.PI / 180, r = {
|
|
476
|
+
ground: T ? (e, t) => V(e, t) + T(e, t) : V,
|
|
355
477
|
wind: {
|
|
356
478
|
speed: i.wind,
|
|
357
479
|
direction: Math.atan2(Math.sin(n), -Math.cos(n)),
|
|
358
480
|
gust: .35
|
|
359
481
|
},
|
|
360
|
-
mask: (e, n) => O(1.2, 2.2,
|
|
482
|
+
mask: (e, n) => O(1.2, 2.2, V(e, n)) * (1 - t(e, n)),
|
|
361
483
|
amount: i.blownSand,
|
|
362
484
|
color: i.sand,
|
|
363
485
|
fog: 3.912 / i.visibility,
|
|
364
|
-
depth: () =>
|
|
486
|
+
depth: () => L.post.depthTexture,
|
|
365
487
|
softness: .2,
|
|
366
|
-
sky:
|
|
488
|
+
sky: L.sky,
|
|
367
489
|
seed: i.seed
|
|
368
|
-
}, a = {coreRequirement:/*@__PURE__*/__margoCoreRequirement("
|
|
369
|
-
name:
|
|
490
|
+
}, a = {coreRequirement:/*@__PURE__*/__margoCoreRequirement("1.0.0",import.meta.url),
|
|
491
|
+
name: X,
|
|
370
492
|
setup() {},
|
|
371
|
-
onPreUpdate: (e) =>
|
|
372
|
-
}, o = () => e.sceneOf(a)?.removePlugin(
|
|
373
|
-
e.use(a),
|
|
493
|
+
onPreUpdate: (e) => Y.push(e)
|
|
494
|
+
}, o = () => e.sceneOf(a)?.removePlugin(X);
|
|
495
|
+
e.use(a), fe = import("@margoengine/vfx/blown-sand").then(({ BlownSand: t }) => {
|
|
374
496
|
let n = e.sceneOf(a);
|
|
375
|
-
if (
|
|
376
|
-
n.removePlugin(
|
|
497
|
+
if (J || !n) return;
|
|
498
|
+
n.removePlugin(X);
|
|
377
499
|
let i = new t(r);
|
|
378
500
|
n.use(i);
|
|
379
|
-
for (let e of
|
|
380
|
-
|
|
501
|
+
for (let e of Y) i.advanceTime(e);
|
|
502
|
+
Y.length = 0, q = i;
|
|
381
503
|
}, (e) => {
|
|
382
|
-
throw
|
|
383
|
-
}),
|
|
384
|
-
|
|
504
|
+
throw J || o(), e;
|
|
505
|
+
}), j.push(() => {
|
|
506
|
+
J = !0, q ? q.dispose() : o();
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
let Z;
|
|
510
|
+
if (i.camp && i.footprints > 0) {
|
|
511
|
+
Z = h.attach(e, U, {
|
|
512
|
+
size: g ? 2048 : 1024,
|
|
513
|
+
depth: .045 * i.footprints,
|
|
514
|
+
rim: .3,
|
|
515
|
+
darken: .22,
|
|
516
|
+
distance: 45,
|
|
517
|
+
persist: !0,
|
|
518
|
+
follow: () => {
|
|
519
|
+
let [t, , n] = e.camera.position, [r, , i] = e.camera.target, a = Math.hypot(r - t, i - n), o = a > 0 ? Math.min(1, (g ? 20 : 10) / a) : 0;
|
|
520
|
+
return [t + (r - t) * o, n + (i - n) * o];
|
|
521
|
+
}
|
|
385
522
|
});
|
|
523
|
+
let t = Z;
|
|
524
|
+
j.push(() => t.dispose()), le.forEach((e, n) => t.walk(e, { seed: i.seed + n }));
|
|
386
525
|
}
|
|
387
526
|
if (i.camp) {
|
|
388
|
-
let
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
i.boards[2]
|
|
393
|
-
],
|
|
394
|
-
roughness: s.roughness,
|
|
395
|
-
metalness: s.metalness
|
|
396
|
-
}), c = new t({
|
|
527
|
+
let t = (e, t) => {
|
|
528
|
+
let n = new l(e, t);
|
|
529
|
+
return j.push(() => n.dispose()), n;
|
|
530
|
+
}, n = (e, n) => t(s({
|
|
397
531
|
color: [
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
532
|
+
e[0],
|
|
533
|
+
e[1],
|
|
534
|
+
e[2]
|
|
401
535
|
],
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
}),
|
|
536
|
+
variation: i.shedWeathering,
|
|
537
|
+
seed: n
|
|
538
|
+
}), {
|
|
539
|
+
colorSpace: "srgb",
|
|
540
|
+
wrapS: "repeat",
|
|
541
|
+
wrapT: "repeat",
|
|
542
|
+
anisotropy: 8
|
|
543
|
+
}), r = (e, t) => new c({
|
|
405
544
|
color: [
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
545
|
+
1,
|
|
546
|
+
1,
|
|
547
|
+
1
|
|
409
548
|
],
|
|
410
|
-
|
|
411
|
-
|
|
549
|
+
map: e,
|
|
550
|
+
roughness: d.roughness,
|
|
551
|
+
metalness: d.metalness,
|
|
552
|
+
...t ? { aoMap: t } : {}
|
|
553
|
+
}), f = n(i.boards, 1), p = r(f), m = r(n(i.roof, 2)), h = r(n([
|
|
554
|
+
.2,
|
|
555
|
+
.17,
|
|
556
|
+
.13
|
|
557
|
+
], 3)), g = new c({
|
|
412
558
|
color: [
|
|
413
559
|
.35,
|
|
414
560
|
.34,
|
|
@@ -416,17 +562,43 @@ function F(e, n = {}) {
|
|
|
416
562
|
],
|
|
417
563
|
roughness: .6,
|
|
418
564
|
metalness: .8
|
|
419
|
-
}),
|
|
420
|
-
let
|
|
421
|
-
|
|
422
|
-
|
|
565
|
+
}), _ = (e) => {
|
|
566
|
+
let n = Math.max(1, Math.round(255 * e)), a = t({
|
|
567
|
+
data: new Uint8Array([
|
|
568
|
+
n,
|
|
569
|
+
n,
|
|
570
|
+
n,
|
|
571
|
+
255
|
|
572
|
+
]),
|
|
573
|
+
width: 1,
|
|
574
|
+
height: 1
|
|
575
|
+
}, {});
|
|
576
|
+
return {
|
|
577
|
+
siding: p,
|
|
578
|
+
roof: m,
|
|
579
|
+
trim: h,
|
|
580
|
+
faces: r(f, a),
|
|
581
|
+
floor: new c({
|
|
582
|
+
color: [
|
|
583
|
+
i.sand[0],
|
|
584
|
+
i.sand[1],
|
|
585
|
+
i.sand[2]
|
|
586
|
+
],
|
|
587
|
+
roughness: .92,
|
|
588
|
+
aoMap: a
|
|
589
|
+
})
|
|
590
|
+
};
|
|
591
|
+
}, v = (t, n, r) => {
|
|
592
|
+
let i = u(e, t, n);
|
|
593
|
+
i.root.name = r, j.push(() => i.dispose()), z.add(i, { static: !0 });
|
|
594
|
+
}, y = (e, t) => i.shedWindows ? t.map((t) => ({
|
|
423
595
|
wall: e,
|
|
424
596
|
at: t,
|
|
425
597
|
width: .8,
|
|
426
598
|
height: .7,
|
|
427
599
|
bottom: 1,
|
|
428
600
|
leaf: "none"
|
|
429
|
-
})) : [],
|
|
601
|
+
})) : [], b = o({
|
|
430
602
|
overhang: i.shedOverhang,
|
|
431
603
|
weathering: i.shedWeathering,
|
|
432
604
|
openings: [
|
|
@@ -436,11 +608,11 @@ function F(e, n = {}) {
|
|
|
436
608
|
height: 2.1,
|
|
437
609
|
leaf: "awning"
|
|
438
610
|
},
|
|
439
|
-
...
|
|
440
|
-
...
|
|
611
|
+
...y("back", [-3.5, 3.5]),
|
|
612
|
+
...y("left", [0])
|
|
441
613
|
],
|
|
442
614
|
seed: 3
|
|
443
|
-
}),
|
|
615
|
+
}), ee = o({
|
|
444
616
|
overhang: i.shedOverhang,
|
|
445
617
|
weathering: i.shedWeathering,
|
|
446
618
|
length: 7.6,
|
|
@@ -465,42 +637,56 @@ function F(e, n = {}) {
|
|
|
465
637
|
bottom: 1,
|
|
466
638
|
leaf: "none"
|
|
467
639
|
},
|
|
468
|
-
...
|
|
640
|
+
...y("left", [0])
|
|
469
641
|
],
|
|
470
642
|
seed: 4
|
|
471
|
-
}),
|
|
472
|
-
for (let [e, t] of
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
643
|
+
}), x = (e, t) => k(e, t) - .05;
|
|
644
|
+
for (let [e, t, n] of [[
|
|
645
|
+
"hangar",
|
|
646
|
+
b,
|
|
647
|
+
-70
|
|
648
|
+
], [
|
|
649
|
+
"shed",
|
|
650
|
+
ee,
|
|
651
|
+
-88.5
|
|
652
|
+
]]) {
|
|
653
|
+
let r = _(t.inside.daylight), { faces: i, floor: a } = t.inside;
|
|
654
|
+
for (let [o, s] of Object.entries({
|
|
655
|
+
...t.parts,
|
|
656
|
+
faces: i,
|
|
657
|
+
floor: a
|
|
658
|
+
})) v(I(s, n, x(n, 30), 30, Math.PI), r[o], `${e} ${o}`);
|
|
659
|
+
}
|
|
660
|
+
let S = a({ ground: (e) => k(0, -e) });
|
|
661
|
+
v(I(S.parts.wood, 0, 0, 0, Math.PI / 2), p, "rail"), S.parts.metal && v(I(S.parts.metal, 0, 0, 0, Math.PI / 2), g, "rail strip");
|
|
476
662
|
}
|
|
477
|
-
let
|
|
663
|
+
let Q = (e, t, n) => [
|
|
478
664
|
e,
|
|
479
|
-
|
|
665
|
+
k(e, t) + n,
|
|
480
666
|
t
|
|
481
|
-
],
|
|
667
|
+
], $ = {
|
|
482
668
|
rail: {
|
|
483
|
-
position:
|
|
484
|
-
target:
|
|
669
|
+
position: Q(6, 4, 1.6),
|
|
670
|
+
target: Q(0, -18, .3),
|
|
485
671
|
about: "the launch rail, its south end at the origin"
|
|
486
672
|
},
|
|
487
673
|
camp: {
|
|
488
|
-
position:
|
|
489
|
-
target:
|
|
674
|
+
position: Q(-60, -25, 1.7),
|
|
675
|
+
target: Q(-78, 30, 2),
|
|
490
676
|
about: "the hangar and the shed, seen from the north"
|
|
491
677
|
},
|
|
492
678
|
flightLine: {
|
|
493
|
-
position:
|
|
494
|
-
target:
|
|
679
|
+
position: Q(0, -18.3, 1.5),
|
|
680
|
+
target: Q(0, -60, 1.5),
|
|
495
681
|
about: "north along the first flight, 120 ft"
|
|
496
682
|
},
|
|
497
683
|
bigHill: {
|
|
498
|
-
position:
|
|
499
|
-
target:
|
|
684
|
+
position: Q(-40, 430, 1.7),
|
|
685
|
+
target: Q(-40, -50, 2),
|
|
500
686
|
about: "the big dune crest, looking back at the camp"
|
|
501
687
|
},
|
|
502
688
|
beach: {
|
|
503
|
-
position:
|
|
689
|
+
position: Q(780, 0, 1.7),
|
|
504
690
|
target: [
|
|
505
691
|
1100,
|
|
506
692
|
1,
|
|
@@ -509,37 +695,37 @@ function F(e, n = {}) {
|
|
|
509
695
|
about: "the foredune crest over the surf"
|
|
510
696
|
},
|
|
511
697
|
"first-flight": {
|
|
512
|
-
position:
|
|
513
|
-
target:
|
|
698
|
+
position: Q(14, -14, 1.3),
|
|
699
|
+
target: Q(-60, -40, .4),
|
|
514
700
|
about: "LC-W861-35, the first flight launch, looking west"
|
|
515
701
|
},
|
|
516
702
|
"camp-buildings": {
|
|
517
|
-
position:
|
|
518
|
-
target:
|
|
703
|
+
position: Q(-40, -12, 1.6),
|
|
704
|
+
target: Q(-80, 30, 1.6),
|
|
519
705
|
about: "LC-W86-15, the camp from the north-east"
|
|
520
706
|
},
|
|
521
707
|
"killdevil-from-flat": {
|
|
522
|
-
position:
|
|
523
|
-
target:
|
|
708
|
+
position: Q(10, -60, 1.6),
|
|
709
|
+
target: Q(-40, 430, 14),
|
|
524
710
|
about: "LC-W86-120, the big dune across the flat"
|
|
525
711
|
},
|
|
526
712
|
"flyer-on-rail": {
|
|
527
|
-
position:
|
|
528
|
-
target:
|
|
713
|
+
position: Q(-75, 300, 1.6),
|
|
714
|
+
target: Q(-25, 330, 1),
|
|
529
715
|
about: "LC-W86-21, on the windward slope, the slope rising right"
|
|
530
716
|
},
|
|
531
717
|
"killdevil-back": {
|
|
532
|
-
position:
|
|
533
|
-
target:
|
|
718
|
+
position: Q(-40, 640, 1.6),
|
|
719
|
+
target: Q(-40, 430, 10),
|
|
534
720
|
about: "LC-W85-110, the lee side of the big dune"
|
|
535
721
|
},
|
|
536
722
|
"landing-rail-view": {
|
|
537
|
-
position:
|
|
538
|
-
target:
|
|
723
|
+
position: Q(-4, -48, 1.2),
|
|
724
|
+
target: Q(0, 0, .2),
|
|
539
725
|
about: "LC-W86-38, back south along the flight line"
|
|
540
726
|
},
|
|
541
727
|
surf: {
|
|
542
|
-
position:
|
|
728
|
+
position: Q(860, -30, 1.7),
|
|
543
729
|
target: [
|
|
544
730
|
960,
|
|
545
731
|
.5,
|
|
@@ -548,39 +734,40 @@ function F(e, n = {}) {
|
|
|
548
734
|
about: "the beach and the surf, looking east"
|
|
549
735
|
},
|
|
550
736
|
crest: {
|
|
551
|
-
position:
|
|
552
|
-
target:
|
|
737
|
+
position: Q(-75, 424, 1.6),
|
|
738
|
+
target: Q(-30, 432, .5),
|
|
553
739
|
about: "the big dune crest seen side on, the wind blowing across the view from left to right"
|
|
554
740
|
}
|
|
555
741
|
};
|
|
556
742
|
return {
|
|
557
743
|
settings: i,
|
|
558
|
-
height:
|
|
559
|
-
anchors:
|
|
560
|
-
views:
|
|
744
|
+
height: k,
|
|
745
|
+
anchors: $,
|
|
746
|
+
views: w.views,
|
|
561
747
|
view(t, n = 50) {
|
|
562
|
-
let r =
|
|
563
|
-
if (!r) throw RangeError(`dune-coast: no anchor ${t}; pass one of ${Object.keys(
|
|
748
|
+
let r = $[t];
|
|
749
|
+
if (!r) throw RangeError(`dune-coast: no anchor ${t}; pass one of ${Object.keys($).join(", ")}.`);
|
|
564
750
|
e.camera.position = [...r.position], e.camera.target = [...r.target], e.camera.fov = n;
|
|
565
751
|
},
|
|
566
752
|
advanceTime(e) {
|
|
567
|
-
|
|
753
|
+
L.sky.advanceTime?.(e), G?.advanceTime(e), K?.advanceTime(e), q ? q.advanceTime(e) : i.blownSand > 0 && Y.push(e);
|
|
568
754
|
},
|
|
569
|
-
ready:
|
|
755
|
+
ready: fe,
|
|
570
756
|
parts: {
|
|
571
|
-
preset:
|
|
572
|
-
water:
|
|
573
|
-
shadows:
|
|
574
|
-
grass:
|
|
575
|
-
occlusion:
|
|
757
|
+
preset: L,
|
|
758
|
+
water: G,
|
|
759
|
+
shadows: z,
|
|
760
|
+
grass: K,
|
|
761
|
+
occlusion: R,
|
|
762
|
+
footprints: Z,
|
|
576
763
|
get blownSand() {
|
|
577
|
-
return
|
|
764
|
+
return q;
|
|
578
765
|
}
|
|
579
766
|
},
|
|
580
767
|
dispose() {
|
|
581
|
-
for (let e of
|
|
582
|
-
for (let e of
|
|
583
|
-
|
|
768
|
+
for (let e of A) e.dispose?.();
|
|
769
|
+
for (let e of j.reverse()) e();
|
|
770
|
+
A.length = 0, j.length = 0;
|
|
584
771
|
},
|
|
585
772
|
[Symbol.dispose]() {
|
|
586
773
|
this.dispose();
|
|
@@ -588,4 +775,4 @@ function F(e, n = {}) {
|
|
|
588
775
|
};
|
|
589
776
|
}
|
|
590
777
|
//#endregion
|
|
591
|
-
export {
|
|
778
|
+
export { L as attach, F as grassCover, N as ground, w as info };
|