@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
|
@@ -1,582 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./library-mesh-BRk4Ycnn.js";
|
|
2
|
-
import { DAY_PRESETS as n } from "@margoengine/sky/day-presets";
|
|
3
|
-
import { PresetScene as r, SCENE_PRESETS as i } from "@margoengine/sky/scenes";
|
|
4
|
-
import { degrees as a, sunPath as o } from "@margoengine/sky/sun";
|
|
5
|
-
import { Shadows as s } from "@margoengine/shadows";
|
|
6
|
-
import { GTAO as c } from "@margoengine/post/gtao";
|
|
7
|
-
import { BiomeWorld as l, defineBiome as u } from "@margoengine/biomes";
|
|
8
|
-
import { BiomeEditor as ee } from "@margoengine/biomes/editor";
|
|
9
|
-
import "@margoengine/biomes/splines";
|
|
10
|
-
import { FARMLAND_MATERIALS as d, FARMLAND_PAINT as te, farmlandEdits as ne, layoutFarmland as re, lowlandFarmWorld as ie } from "@margoengine/biomes/farmland";
|
|
11
|
-
import { BiomeView as ae } from "@margoengine/biomes/view";
|
|
12
|
-
import { VolumetricClouds as oe } from "@margoengine/sky/volumetric-clouds";
|
|
13
|
-
import { WEATHER_PRESETS as f, WeatherMachine as se } from "@margoengine/weather";
|
|
14
|
-
import { WeatherDrive as ce } from "@margoengine/weather/drive";
|
|
15
|
-
import { loadGLTF as le } from "@margoengine/gltf";
|
|
16
|
-
import { textured as ue } from "@margoengine/gltf/textured";
|
|
17
|
-
import { DOF as de } from "@margoengine/dof";
|
|
18
|
-
//#region src/fauld-world.ts
|
|
19
|
-
var p = 6400, m = Object.freeze({
|
|
20
|
-
easting: 418225,
|
|
21
|
-
northing: 327725
|
|
22
|
-
}), h = Object.freeze({
|
|
23
|
-
crater: [0, 0],
|
|
24
|
-
farm: [0, 10],
|
|
25
|
-
hanbury: [-1225, -175],
|
|
26
|
-
church: [-1190, -190],
|
|
27
|
-
inn: [-1120, -120],
|
|
28
|
-
works: [120, -780],
|
|
29
|
-
reservoir: [210, -430],
|
|
30
|
-
dove: [-300, -2600],
|
|
31
|
-
tutbury: [3100, -1300]
|
|
32
|
-
}), g = Object.freeze({
|
|
33
|
-
church: {
|
|
34
|
-
at: h.church,
|
|
35
|
-
turn: 0,
|
|
36
|
-
model: "church_st_werburgh",
|
|
37
|
-
eras: [
|
|
38
|
-
"before",
|
|
39
|
-
"1944",
|
|
40
|
-
"today"
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
inn: {
|
|
44
|
-
at: h.inn,
|
|
45
|
-
turn: .3,
|
|
46
|
-
model: "cock_inn",
|
|
47
|
-
eras: [
|
|
48
|
-
"before",
|
|
49
|
-
"1944",
|
|
50
|
-
"today"
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
cottages: {
|
|
54
|
-
at: [-1260, -90],
|
|
55
|
-
turn: .1,
|
|
56
|
-
model: "cottage_row",
|
|
57
|
-
eras: [
|
|
58
|
-
"before",
|
|
59
|
-
"1944",
|
|
60
|
-
"today"
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
farmhouse: {
|
|
64
|
-
at: h.farm,
|
|
65
|
-
turn: .2,
|
|
66
|
-
model: void 0,
|
|
67
|
-
eras: ["before"]
|
|
68
|
-
},
|
|
69
|
-
kilnWorks: {
|
|
70
|
-
at: h.works,
|
|
71
|
-
turn: -.4,
|
|
72
|
-
model: "kiln_works",
|
|
73
|
-
eras: ["before", "1944"]
|
|
74
|
-
},
|
|
75
|
-
guardHut: {
|
|
76
|
-
at: [150, 120],
|
|
77
|
-
turn: 0,
|
|
78
|
-
model: "guard_hut",
|
|
79
|
-
eras: ["before", "1944"]
|
|
80
|
-
},
|
|
81
|
-
nfsTender: {
|
|
82
|
-
at: [205, 150],
|
|
83
|
-
turn: .15,
|
|
84
|
-
model: "nfs_tender",
|
|
85
|
-
eras: ["1944"]
|
|
86
|
-
},
|
|
87
|
-
wvsVan: {
|
|
88
|
-
at: [222, 162],
|
|
89
|
-
turn: .4,
|
|
90
|
-
model: "wvs_van",
|
|
91
|
-
eras: ["1944"]
|
|
92
|
-
},
|
|
93
|
-
cattle: {
|
|
94
|
-
at: [-160, 220],
|
|
95
|
-
turn: 0,
|
|
96
|
-
model: "cattle",
|
|
97
|
-
eras: ["before", "today"]
|
|
98
|
-
}
|
|
99
|
-
}), _ = {
|
|
100
|
-
dawn: {
|
|
101
|
-
hour: 8.7,
|
|
102
|
-
weather: {
|
|
103
|
-
cloud: .85,
|
|
104
|
-
fog: .25,
|
|
105
|
-
humidity: .92,
|
|
106
|
-
temperature: -1,
|
|
107
|
-
wind: 1.5
|
|
108
|
-
},
|
|
109
|
-
preset: "overcast",
|
|
110
|
-
clouds: "stratus"
|
|
111
|
-
},
|
|
112
|
-
lowSun: {
|
|
113
|
-
hour: 11.5,
|
|
114
|
-
weather: {
|
|
115
|
-
cloud: .6,
|
|
116
|
-
fog: .12,
|
|
117
|
-
humidity: .75,
|
|
118
|
-
temperature: 4,
|
|
119
|
-
wind: 3
|
|
120
|
-
},
|
|
121
|
-
preset: "noon",
|
|
122
|
-
clouds: "cumulus"
|
|
123
|
-
},
|
|
124
|
-
overcast: {
|
|
125
|
-
hour: 11.2,
|
|
126
|
-
weather: {
|
|
127
|
-
...f.overcast,
|
|
128
|
-
cloud: .9,
|
|
129
|
-
fog: .14,
|
|
130
|
-
temperature: 5
|
|
131
|
-
},
|
|
132
|
-
preset: "overcast",
|
|
133
|
-
clouds: "stratus"
|
|
134
|
-
},
|
|
135
|
-
grey: {
|
|
136
|
-
hour: 12.5,
|
|
137
|
-
weather: {
|
|
138
|
-
...f.overcast,
|
|
139
|
-
cloud: .95,
|
|
140
|
-
fog: .22,
|
|
141
|
-
temperature: 4
|
|
142
|
-
},
|
|
143
|
-
preset: "overcast",
|
|
144
|
-
clouds: "stratus"
|
|
145
|
-
},
|
|
146
|
-
dusk: {
|
|
147
|
-
hour: 15.9,
|
|
148
|
-
weather: {
|
|
149
|
-
cloud: .7,
|
|
150
|
-
fog: .18,
|
|
151
|
-
humidity: .85,
|
|
152
|
-
temperature: 1,
|
|
153
|
-
wind: 2
|
|
154
|
-
},
|
|
155
|
-
preset: "goldenHour",
|
|
156
|
-
clouds: "stratus"
|
|
157
|
-
},
|
|
158
|
-
night: {
|
|
159
|
-
hour: 19,
|
|
160
|
-
weather: {
|
|
161
|
-
cloud: .8,
|
|
162
|
-
fog: .2,
|
|
163
|
-
humidity: .9,
|
|
164
|
-
temperature: 0,
|
|
165
|
-
wind: 1
|
|
166
|
-
},
|
|
167
|
-
preset: "overcast",
|
|
168
|
-
clouds: "stratus"
|
|
169
|
-
},
|
|
170
|
-
snow: {
|
|
171
|
-
hour: 12,
|
|
172
|
-
weather: { ...f.snow },
|
|
173
|
-
preset: "overcast",
|
|
174
|
-
clouds: "stratus"
|
|
175
|
-
},
|
|
176
|
-
rain: {
|
|
177
|
-
hour: 12,
|
|
178
|
-
weather: {
|
|
179
|
-
...f.rain,
|
|
180
|
-
wind: 5
|
|
181
|
-
},
|
|
182
|
-
preset: "overcast",
|
|
183
|
-
clouds: "stratus"
|
|
184
|
-
},
|
|
185
|
-
mist: {
|
|
186
|
-
hour: 8.6,
|
|
187
|
-
weather: {
|
|
188
|
-
...f.fog,
|
|
189
|
-
fog: .4
|
|
190
|
-
},
|
|
191
|
-
preset: "overcast",
|
|
192
|
-
clouds: "stratus"
|
|
193
|
-
}
|
|
194
|
-
}, v = Object.freeze({
|
|
195
|
-
bottom: 1e3,
|
|
196
|
-
top: 1600
|
|
197
|
-
}), fe = {
|
|
198
|
-
oak: "trees/oak",
|
|
199
|
-
ash: "trees/ash",
|
|
200
|
-
birch: "trees/birch",
|
|
201
|
-
holly: "trees/holly",
|
|
202
|
-
hazel: "hedges/hawthorn_b",
|
|
203
|
-
hawthorn: "hedges/hawthorn_a",
|
|
204
|
-
blackthorn: "hedges/blackthorn_a"
|
|
205
|
-
}, pe = {
|
|
206
|
-
"winter-pasture": {
|
|
207
|
-
file: "grass_ground",
|
|
208
|
-
repeat: 3,
|
|
209
|
-
color: [
|
|
210
|
-
.3,
|
|
211
|
-
.38,
|
|
212
|
-
.19
|
|
213
|
-
]
|
|
214
|
-
},
|
|
215
|
-
"rough-meadow": {
|
|
216
|
-
file: "sparse_grass",
|
|
217
|
-
repeat: 3,
|
|
218
|
-
color: [
|
|
219
|
-
.36,
|
|
220
|
-
.36,
|
|
221
|
-
.22
|
|
222
|
-
]
|
|
223
|
-
},
|
|
224
|
-
plough: {
|
|
225
|
-
file: "brown_mud_dry",
|
|
226
|
-
repeat: 2.5,
|
|
227
|
-
color: [
|
|
228
|
-
.36,
|
|
229
|
-
.25,
|
|
230
|
-
.18
|
|
231
|
-
]
|
|
232
|
-
},
|
|
233
|
-
stubble: {
|
|
234
|
-
file: "withered_grass",
|
|
235
|
-
repeat: 2.5,
|
|
236
|
-
color: [
|
|
237
|
-
.55,
|
|
238
|
-
.48,
|
|
239
|
-
.33
|
|
240
|
-
]
|
|
241
|
-
},
|
|
242
|
-
"lane-gravel": {
|
|
243
|
-
file: "gravel_road",
|
|
244
|
-
repeat: 3,
|
|
245
|
-
color: [
|
|
246
|
-
.42,
|
|
247
|
-
.37,
|
|
248
|
-
.31
|
|
249
|
-
]
|
|
250
|
-
},
|
|
251
|
-
mud: {
|
|
252
|
-
file: "mud_forest",
|
|
253
|
-
repeat: 2.5,
|
|
254
|
-
color: [
|
|
255
|
-
.27,
|
|
256
|
-
.21,
|
|
257
|
-
.15
|
|
258
|
-
]
|
|
259
|
-
},
|
|
260
|
-
"leaf-litter": {
|
|
261
|
-
file: "leaves_forest_ground",
|
|
262
|
-
repeat: 2.5,
|
|
263
|
-
color: [
|
|
264
|
-
.34,
|
|
265
|
-
.26,
|
|
266
|
-
.18
|
|
267
|
-
]
|
|
268
|
-
},
|
|
269
|
-
moss: {
|
|
270
|
-
file: "forest_leaves_02",
|
|
271
|
-
repeat: 2.5,
|
|
272
|
-
color: [
|
|
273
|
-
.27,
|
|
274
|
-
.29,
|
|
275
|
-
.16
|
|
276
|
-
]
|
|
277
|
-
},
|
|
278
|
-
"crater-marl": {
|
|
279
|
-
file: "brown_mud_dry",
|
|
280
|
-
repeat: 3,
|
|
281
|
-
color: [
|
|
282
|
-
.55,
|
|
283
|
-
.5,
|
|
284
|
-
.44
|
|
285
|
-
]
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
async function me(e, t) {
|
|
289
|
-
let n = await (await fetch(e, t ? { signal: t } : {})).blob(), r = 1024, i = await createImageBitmap(n, {
|
|
290
|
-
resizeWidth: r,
|
|
291
|
-
resizeHeight: r,
|
|
292
|
-
resizeQuality: "high"
|
|
293
|
-
}), a = new OffscreenCanvas(r, r).getContext("2d");
|
|
294
|
-
if (!a) throw TypeError("fauld: no 2D canvas to decode the ground scans; run the scene in a browser with OffscreenCanvas 2D.");
|
|
295
|
-
return a.drawImage(i, 0, 0), i.close(), {
|
|
296
|
-
width: r,
|
|
297
|
-
height: r,
|
|
298
|
-
data: a.getImageData(0, 0, r, r).data
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
var y = (e, t) => (e.endsWith("/") ? e : e + "/") + t;
|
|
302
|
-
async function he(e, t) {
|
|
303
|
-
let n = await (await fetch(e.replace(/\.f32$/, ".json"), t ? { signal: t } : {})).json(), r = await (await fetch(e, t ? { signal: t } : {})).arrayBuffer(), i = new Float32Array(r);
|
|
304
|
-
if (i.length !== n.width * n.depth) throw RangeError(`fauld: ${e} holds ${i.length} heights, not ${n.width} x ${n.depth}; regenerate the grid and its .json together.`);
|
|
305
|
-
return (e, t) => {
|
|
306
|
-
let r = (e - n.xll_easting - n.cellsize_m / 2) / n.cellsize_m, a = (n.ytop_northing - n.cellsize_m / 2 - t) / n.cellsize_m, o = Math.max(0, Math.min(n.width - 2, Math.floor(r))), s = Math.max(0, Math.min(n.depth - 2, Math.floor(a))), c = Math.max(0, Math.min(1, r - o)), l = Math.max(0, Math.min(1, a - s)), u = (e, t) => i[t * n.width + e];
|
|
307
|
-
return (u(o, s) * (1 - c) + u(o + 1, s) * c) * (1 - l) + (u(o, s + 1) * (1 - c) + u(o + 1, s + 1) * c) * l;
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
function ge(e) {
|
|
311
|
-
let t = e.geometry.positions, n = (/* @__PURE__ */ new Float32Array(68121)).fill(NaN);
|
|
312
|
-
for (let e = 0; e < t.length; e += 3) {
|
|
313
|
-
let r = Math.round((t[e] + 260) / 2), i = Math.round((t[e + 2] + 260) / 2);
|
|
314
|
-
if (r < 0 || i < 0 || r >= 261 || i >= 261) continue;
|
|
315
|
-
let a = i * 261 + r;
|
|
316
|
-
n[a] >= t[e + 1] || (n[a] = t[e + 1]);
|
|
317
|
-
}
|
|
318
|
-
return {
|
|
319
|
-
half: 260,
|
|
320
|
-
at(e, t) {
|
|
321
|
-
let r = Math.round((e + 260) / 2), i = Math.round((t + 260) / 2);
|
|
322
|
-
if (r < 0 || i < 0 || r >= 261 || i >= 261) return;
|
|
323
|
-
let a = n[i * 261 + r];
|
|
324
|
-
return Number.isNaN(a) ? void 0 : a;
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
var _e = (e, t, n) => {
|
|
329
|
-
let r = Math.max(0, Math.min(1, (n - e) / (t - e)));
|
|
330
|
-
return r * r * (3 - 2 * r);
|
|
331
|
-
}, b = u({
|
|
332
|
-
id: "crater-spoil",
|
|
333
|
-
climate: { height: [1e5, null] },
|
|
334
|
-
ground: [{ material: "crater-marl" }, {
|
|
335
|
-
material: "mud",
|
|
336
|
-
moisture: [.85, null]
|
|
337
|
-
}]
|
|
338
|
-
});
|
|
339
|
-
async function x(u, x = {}) {
|
|
340
|
-
let S = x.era ?? "before", C = x.sky ?? "lowSun", w = _[C], T = x.seed ?? 1944, E = x.library ?? "/asset-library/", D = x.radius ?? 2500, O = x.signal, k = [], A = [];
|
|
341
|
-
if (!_[C]) throw RangeError(`fauld: unknown sky ${C}; pass one of ${Object.keys(_).join(", ")}.`);
|
|
342
|
-
if (![
|
|
343
|
-
"before",
|
|
344
|
-
"1944",
|
|
345
|
-
"today"
|
|
346
|
-
].includes(S)) throw RangeError(`fauld: unknown era ${S}; pass 'before', '1944' or 'today'.`);
|
|
347
|
-
if (!(D >= 200 && D <= 3e3)) throw RangeError(`fauld: radius ${D} is outside 200 to 3,000 metres; pass a radius in that range.`);
|
|
348
|
-
try {
|
|
349
|
-
let _ = await he(x.dem ?? y(E, "dem/os-terrain-50/fauld_sk12_sk23.f32"), O), j = S === "before" ? void 0 : await t(y(E, `margo-library/fauld/crater/crater_inner_${S === "1944" ? "1944" : "today"}.gltf`), {
|
|
350
|
-
kind: "stone",
|
|
351
|
-
color: [
|
|
352
|
-
.5,
|
|
353
|
-
.5,
|
|
354
|
-
.5
|
|
355
|
-
],
|
|
356
|
-
maxTriangles: 6e5,
|
|
357
|
-
...O ? { signal: O } : {}
|
|
358
|
-
}), M = j ? ge(j) : void 0, N = 0;
|
|
359
|
-
for (let e = 0; e < 32; e++) {
|
|
360
|
-
let t = e / 32 * 2 * Math.PI;
|
|
361
|
-
N += _(m.easting + 250 * Math.cos(t), m.northing - 250 * Math.sin(t)) / 32;
|
|
362
|
-
}
|
|
363
|
-
let P = M ? N - 44.9 : 0, F = 1281, I = new Float32Array(F * F);
|
|
364
|
-
for (let e = 0; e < F; e++) for (let t = 0; t < F; t++) {
|
|
365
|
-
let n = -3200 + t * 5, r = -3200 + e * 5, i = _(m.easting + n, m.northing - r);
|
|
366
|
-
if (M) {
|
|
367
|
-
let e = M.at(n, r), t = 1 - _e(150, 200, Math.hypot(n, r));
|
|
368
|
-
e !== void 0 && (i = i * (1 - t) + (e + P) * t);
|
|
369
|
-
}
|
|
370
|
-
I[e * F + t] = i;
|
|
371
|
-
}
|
|
372
|
-
let L = await l.create({
|
|
373
|
-
seed: T,
|
|
374
|
-
origin: [-3200, -3200],
|
|
375
|
-
size: [p, p],
|
|
376
|
-
climate: ie.climate,
|
|
377
|
-
height: {
|
|
378
|
-
samples: I,
|
|
379
|
-
width: F,
|
|
380
|
-
depth: F,
|
|
381
|
-
unit: "m"
|
|
382
|
-
},
|
|
383
|
-
biomes: [...ie.biomes, b],
|
|
384
|
-
paint: [...te, { biome: b.id }],
|
|
385
|
-
...O ? { signal: O } : {}
|
|
386
|
-
});
|
|
387
|
-
k.push(() => L.dispose());
|
|
388
|
-
let R = (e, t, n = 24) => Array.from({ length: n }, (r, i) => [e[0] + t * Math.cos(i / n * 2 * Math.PI), e[1] + t * Math.sin(i / n * 2 * Math.PI)]), ve = [
|
|
389
|
-
R(h.hanbury, 260),
|
|
390
|
-
R(h.works, 110),
|
|
391
|
-
R(h.reservoir, 70),
|
|
392
|
-
S === "before" ? R(h.farm, 45) : R(h.crater, 230)
|
|
393
|
-
], ye = p / 2, z = re(L, {
|
|
394
|
-
seed: T,
|
|
395
|
-
fieldSize: 42e3,
|
|
396
|
-
keep: ve,
|
|
397
|
-
connect: [
|
|
398
|
-
[-3200, 260],
|
|
399
|
-
h.hanbury,
|
|
400
|
-
S === "before" ? h.farm : [0, 260],
|
|
401
|
-
h.works,
|
|
402
|
-
[ye, -900],
|
|
403
|
-
[-420, -3200],
|
|
404
|
-
[-900, ye]
|
|
405
|
-
]
|
|
406
|
-
}), B = ee.attach(L);
|
|
407
|
-
for (let e of ne(z, {}, [R([380, -620], 230), ...S === "today" ? [R(h.crater, 200)] : []])) B.apply(e);
|
|
408
|
-
S === "1944" && B.polygon(b.id, R(h.crater, 175, 48));
|
|
409
|
-
let V = o({
|
|
410
|
-
latitude: a(52.84),
|
|
411
|
-
dayOfYear: 332,
|
|
412
|
-
hour: x.hour ?? w.hour
|
|
413
|
-
}), H = r.attach(u, {
|
|
414
|
-
...i[w.preset],
|
|
415
|
-
day: {
|
|
416
|
-
...n[w.preset === "dawn" ? "overcast" : w.preset],
|
|
417
|
-
azimuth: V.azimuth.degrees,
|
|
418
|
-
elevation: Math.max(C === "night" ? -12 : 1, V.elevation.degrees)
|
|
419
|
-
},
|
|
420
|
-
fog: 3.912 / (C === "mist" ? 2500 : C === "grey" || C === "rain" || C === "snow" ? 6e3 : 16e3)
|
|
421
|
-
});
|
|
422
|
-
k.push(() => H.dispose()), H.post.addEffect(new c({
|
|
423
|
-
radius: 2,
|
|
424
|
-
slices: 3,
|
|
425
|
-
steps: 8
|
|
426
|
-
}), 0);
|
|
427
|
-
let U = x.lens?.stop ?? 8, W = x.lens?.focusDistance ?? 1e3;
|
|
428
|
-
if (!(U > 0) || !(W > 0)) throw RangeError(`Fauld lens needs a stop and focus distance over 0 (got f/${U} at ${W} m)`);
|
|
429
|
-
let G = new de({
|
|
430
|
-
aperture: U,
|
|
431
|
-
focalDistance: W,
|
|
432
|
-
filmGauge: 24.89,
|
|
433
|
-
sensorFit: "horizontal"
|
|
434
|
-
});
|
|
435
|
-
H.post.addEffect(G, 1);
|
|
436
|
-
let K = s.attach(u, {
|
|
437
|
-
resolution: 4096,
|
|
438
|
-
distance: 1200,
|
|
439
|
-
lambda: .8,
|
|
440
|
-
lightSize: .02,
|
|
441
|
-
normalBias: .2,
|
|
442
|
-
casterMargin: 300
|
|
443
|
-
});
|
|
444
|
-
k.push(() => K.dispose());
|
|
445
|
-
let q = {};
|
|
446
|
-
for (let [t, n] of Object.entries(fe)) q[`library:${t}`] = await e(y(E, `margo-library/fauld/${n}.gltf`), {
|
|
447
|
-
maxTriangles: 25e4,
|
|
448
|
-
kind: "bark",
|
|
449
|
-
...O ? { signal: O } : {}
|
|
450
|
-
});
|
|
451
|
-
q["library:fern"] = [{
|
|
452
|
-
geometry: (await t(y(E, "big-burn-1910/plants/fern_02/fern_02_2k.gltf"), {
|
|
453
|
-
kind: "foliage",
|
|
454
|
-
color: [
|
|
455
|
-
.2,
|
|
456
|
-
.12,
|
|
457
|
-
.06
|
|
458
|
-
],
|
|
459
|
-
maxTriangles: 6e4,
|
|
460
|
-
...O ? { signal: O } : {}
|
|
461
|
-
})).geometry,
|
|
462
|
-
color: [
|
|
463
|
-
.2,
|
|
464
|
-
.12,
|
|
465
|
-
.06
|
|
466
|
-
],
|
|
467
|
-
kind: "foliage"
|
|
468
|
-
}];
|
|
469
|
-
let J = { ...d };
|
|
470
|
-
for (let [e, t] of Object.entries(pe)) J[e] = {
|
|
471
|
-
...d[e] ?? {
|
|
472
|
-
detail: .4,
|
|
473
|
-
bump: .4,
|
|
474
|
-
macro: .35
|
|
475
|
-
},
|
|
476
|
-
color: t.color,
|
|
477
|
-
image: await me(y(E, `margo-library/fauld/ground/${t.file}_diff_2k.jpg`), O),
|
|
478
|
-
repeat: t.repeat
|
|
479
|
-
};
|
|
480
|
-
let Y = await ae.attach(u, L, {
|
|
481
|
-
sky: H.sky,
|
|
482
|
-
shadows: K,
|
|
483
|
-
materials: J,
|
|
484
|
-
exclusions: [...z.exclusions, ...S === "1944" ? [{
|
|
485
|
-
kind: "polygon",
|
|
486
|
-
points: R(h.crater, 205)
|
|
487
|
-
}] : []],
|
|
488
|
-
radius: D,
|
|
489
|
-
meshes: q,
|
|
490
|
-
...O ? { signal: O } : {}
|
|
491
|
-
});
|
|
492
|
-
k.push(() => Y.dispose());
|
|
493
|
-
let be = (e, t) => {
|
|
494
|
-
let n = L.heightAt(e, t), r = M && Math.hypot(e, t) < 150 ? M.at(e, t) : void 0;
|
|
495
|
-
return r === void 0 ? n : Math.max(n, r + P);
|
|
496
|
-
}, X = oe.attach(u, {
|
|
497
|
-
sky: H.sky,
|
|
498
|
-
type: w.clouds,
|
|
499
|
-
coverage: Math.min(.95, (w.weather.cloud ?? .4) + .05),
|
|
500
|
-
...w.clouds === "stratus" ? v : {}
|
|
501
|
-
});
|
|
502
|
-
k.push(() => X.dispose());
|
|
503
|
-
let Z = new se({
|
|
504
|
-
...f.clear,
|
|
505
|
-
...w.weather,
|
|
506
|
-
windDirection: .6
|
|
507
|
-
}, { seed: T });
|
|
508
|
-
k.push(() => Z.dispose());
|
|
509
|
-
let Q = ce.attach(u, {
|
|
510
|
-
weather: Z,
|
|
511
|
-
listener: u.camera,
|
|
512
|
-
clouds: X
|
|
513
|
-
});
|
|
514
|
-
k.push(() => Q.dispose?.());
|
|
515
|
-
let $ = {};
|
|
516
|
-
if (x.buildings ?? !0) for (let [e, t] of Object.entries(g)) {
|
|
517
|
-
if (!t.model || !t.eras.includes(S)) continue;
|
|
518
|
-
let n = t.model === "cattle" ? Array.from({ length: 14 }, (e, n) => {
|
|
519
|
-
let r = n * 2.399963, i = 9 * Math.sqrt(n + .5);
|
|
520
|
-
return {
|
|
521
|
-
file: n % 3 == 2 ? "cow_friesian" : "cow_shorthorn",
|
|
522
|
-
at: [t.at[0] + i * Math.cos(r), t.at[1] + i * Math.sin(r)],
|
|
523
|
-
turn: n * .618034 % 1
|
|
524
|
-
};
|
|
525
|
-
}) : [{
|
|
526
|
-
file: t.model,
|
|
527
|
-
at: t.at,
|
|
528
|
-
turn: t.turn
|
|
529
|
-
}];
|
|
530
|
-
$[e] = [];
|
|
531
|
-
for (let t of n) {
|
|
532
|
-
let n = await le(u, y(E, `margo-library/fauld/buildings/${t.file}/${t.file}.gltf`), {
|
|
533
|
-
extensions: [ue],
|
|
534
|
-
...O ? { signal: O } : {}
|
|
535
|
-
});
|
|
536
|
-
k.push(() => n.dispose()), n.root.setPosition([
|
|
537
|
-
t.at[0],
|
|
538
|
-
be(t.at[0], t.at[1]) - .15,
|
|
539
|
-
t.at[1]
|
|
540
|
-
]), n.root.setRotation([
|
|
541
|
-
0,
|
|
542
|
-
t.turn * 2 * Math.PI,
|
|
543
|
-
0
|
|
544
|
-
]), $[e].push(n);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
return {
|
|
548
|
-
era: S,
|
|
549
|
-
world: L,
|
|
550
|
-
farm: z,
|
|
551
|
-
view: Y,
|
|
552
|
-
preset: H,
|
|
553
|
-
clouds: X,
|
|
554
|
-
weather: Z,
|
|
555
|
-
shadows: K,
|
|
556
|
-
dof: G,
|
|
557
|
-
meshes: A,
|
|
558
|
-
buildings: $,
|
|
559
|
-
height: be,
|
|
560
|
-
look(e, t, n = 45) {
|
|
561
|
-
u.camera.position = [...e], u.camera.target = [...t], u.camera.fov = n;
|
|
562
|
-
},
|
|
563
|
-
advanceTime(e) {
|
|
564
|
-
Q.advanceTime(e), H.sky.advanceTime?.(e);
|
|
565
|
-
},
|
|
566
|
-
settle: () => Y.whenIdle(),
|
|
567
|
-
dispose() {
|
|
568
|
-
for (let e of k.reverse()) e();
|
|
569
|
-
k.length = 0;
|
|
570
|
-
for (let e of A) e.dispose?.();
|
|
571
|
-
},
|
|
572
|
-
[Symbol.dispose]() {
|
|
573
|
-
this.dispose();
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
} catch (e) {
|
|
577
|
-
for (let e of k.reverse()) e();
|
|
578
|
-
throw e;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
//#endregion
|
|
582
|
-
export { g as a, p as i, v as n, x as o, h as r, m as t };
|