@bendyline/molen-client 0.0.10 → 0.0.12
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/README.md +1 -0
- package/dist/aircraft.d.mts +89 -4
- package/dist/aircraft.mjs +737 -8
- package/dist/audio.d.mts +10 -1
- package/dist/audio.mjs +131 -6
- package/dist/camera-track.d.mts +1 -1
- package/dist/clouds-DmASLVoe.mjs +862 -0
- package/dist/glass.d.mts +19 -0
- package/dist/glass.mjs +249 -0
- package/dist/index.d.mts +34 -6
- package/dist/index.mjs +917 -171
- package/dist/{input-BVZjf4T-.mjs → input-BliZYUY1.mjs} +42 -12
- package/dist/{input-CD-dHuv0.d.mts → input-Ckev_Kvj.d.mts} +9 -0
- package/dist/livery-qcDLzbU9.mjs +307 -0
- package/dist/navigation.d.mts +54 -10
- package/dist/navigation.mjs +646 -220
- package/dist/{renderer-CtEtmwJG.d.mts → renderer-DAk7C8jH.d.mts} +318 -24
- package/dist/vehicle-interior-B8TpzTAx.d.mts +56 -0
- package/dist/vehicle-interior-CeyzF5El.mjs +455 -0
- package/dist/vehicles.d.mts +26 -20
- package/dist/vehicles.mjs +317 -71
- package/dist/webgpu-clouds-H03g7ID1.mjs +186 -0
- package/package.json +7 -3
- package/dist/vehicle-interior-BgcC750p.d.mts +0 -31
- package/dist/vehicle-interior-DfpZwWEh.mjs +0 -15
|
@@ -8,8 +8,14 @@ interface AdmissionOptions {
|
|
|
8
8
|
bytes?: number;
|
|
9
9
|
signal?: AbortSignal;
|
|
10
10
|
label?: string;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Background jobs run only in frame budget that no normal job is waiting for. Urgent jobs run
|
|
13
|
+
* before normal ones, in their own order: small work the view is visibly waiting on, such as
|
|
14
|
+
* terrain ground. Sustained urgent traffic shares service with waiting normal work.
|
|
15
|
+
*/
|
|
16
|
+
priority?: "urgent" | "normal" | "background";
|
|
17
|
+
/** Live order within normal work, lower first. Unordered work still receives regular service. */
|
|
18
|
+
order?: () => number;
|
|
13
19
|
}
|
|
14
20
|
interface AdmissionSample {
|
|
15
21
|
label: string;
|
|
@@ -38,12 +44,22 @@ declare class FrameAdmissionQueue implements SceneAdmission {
|
|
|
38
44
|
private readonly queuedBackground;
|
|
39
45
|
private scheduled;
|
|
40
46
|
private disposed;
|
|
47
|
+
private paused;
|
|
41
48
|
private readonly clock;
|
|
42
49
|
private readonly schedule;
|
|
43
|
-
private
|
|
44
|
-
private
|
|
45
|
-
private
|
|
50
|
+
private maxMs;
|
|
51
|
+
private maxBytes;
|
|
52
|
+
private maxJobs;
|
|
53
|
+
private urgentStreak;
|
|
54
|
+
private orderedStreak;
|
|
55
|
+
/** Recent work time per label (ms, smoothed): what the next job of that kind will likely take. */
|
|
56
|
+
private readonly expected;
|
|
46
57
|
constructor(options?: FrameAdmissionOptions);
|
|
58
|
+
/**
|
|
59
|
+
* Change the per-frame budget from the next frame on; omitted limits keep their values. A host
|
|
60
|
+
* can admit more when frames have time to spare (an adaptive quality tier, say).
|
|
61
|
+
*/
|
|
62
|
+
setLimits(limits: Pick<FrameAdmissionOptions, "maxMilliseconds" | "maxBytes" | "maxJobs">): void;
|
|
47
63
|
run<T>(task: () => T, options?: AdmissionOptions): Promise<T>;
|
|
48
64
|
/**
|
|
49
65
|
* Callers keep the promise (preparation caches do, keyed by long-lived resources); the job holds
|
|
@@ -59,6 +75,8 @@ declare class FrameAdmissionQueue implements SceneAdmission {
|
|
|
59
75
|
front?: boolean;
|
|
60
76
|
}): void;
|
|
61
77
|
get pending(): number;
|
|
78
|
+
/** Hold queued uploads/preparation while the view is inactive; keep resources for resume. */
|
|
79
|
+
setPaused(paused: boolean): void;
|
|
62
80
|
private request;
|
|
63
81
|
/** One frame's budget. Exposed for hosts with a manual frame loop and deterministic tests. */
|
|
64
82
|
flush(): void;
|
|
@@ -188,7 +206,15 @@ declare class SkyVisual {
|
|
|
188
206
|
private catalog;
|
|
189
207
|
private readonly palette;
|
|
190
208
|
private lastTime;
|
|
209
|
+
/**
|
|
210
|
+
* What the dome's colors and the stars were last written for. The sun and the sky turn a
|
|
211
|
+
* quarter of a degree a minute: rewriting the dome and every star each second cost a frame
|
|
212
|
+
* 3-5 ms for changes far below a pixel, so they are rewritten once those changes could show.
|
|
213
|
+
*/
|
|
214
|
+
private drawnDome;
|
|
215
|
+
private drawnStars;
|
|
191
216
|
private cloudAttenuation;
|
|
217
|
+
private directCloudAttenuation;
|
|
192
218
|
private currentFrame;
|
|
193
219
|
private currentReflections;
|
|
194
220
|
private disposed;
|
|
@@ -196,8 +222,12 @@ declare class SkyVisual {
|
|
|
196
222
|
get frame(): SkyFrame;
|
|
197
223
|
/** Sky radiance for the viewer's shared PBR environment, sampled with the celestial frame. */
|
|
198
224
|
get reflectionState(): SkyReflectionState;
|
|
199
|
-
/**
|
|
200
|
-
|
|
225
|
+
/**
|
|
226
|
+
* Diffuse cloud lighting; actual celestial occlusion comes from the cloud layer geometry.
|
|
227
|
+
* `direct` dims the sun and moon (default `value`); with spatial cloud shadows it is 0, since
|
|
228
|
+
* the shadows themselves take light away where clouds cover the sun.
|
|
229
|
+
*/
|
|
230
|
+
setCloudAttenuation(value: number, direct?: number): void;
|
|
201
231
|
/** Move an Earth observer without rebuilding the dome, bodies or star catalog. */
|
|
202
232
|
setObserver(observer: EarthObserver): void;
|
|
203
233
|
/** Seek in simulation seconds. Earth render samples use a stable one-second UTC grid. */
|
|
@@ -216,21 +246,177 @@ declare class SkyVisual {
|
|
|
216
246
|
dispose(): void;
|
|
217
247
|
}
|
|
218
248
|
//#endregion
|
|
249
|
+
//#region src/weather/cloud-shadows.d.ts
|
|
250
|
+
interface CloudShadowUniforms {
|
|
251
|
+
/** The deck's weather map, blurred for soft shadow edges (CloudTextures.shadow). */
|
|
252
|
+
molenCloudMap: {
|
|
253
|
+
value: THREE.Texture;
|
|
254
|
+
};
|
|
255
|
+
/** Strength (0 off), and the base and top of the layer (rendered Y). */
|
|
256
|
+
molenCloudShadow: {
|
|
257
|
+
value: THREE.Vector4;
|
|
258
|
+
};
|
|
259
|
+
/** The deck's field: texels per meter, wrapped UV offset, coverage. */
|
|
260
|
+
molenCloudField: {
|
|
261
|
+
value: THREE.Vector4;
|
|
262
|
+
};
|
|
263
|
+
molenCloudMix: {
|
|
264
|
+
value: THREE.Vector4;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Coverage softness, opacity of a fully cloudy column, height fraction it is cast from, and
|
|
268
|
+
* how much thinner (so lighter) a column is where the field is weak.
|
|
269
|
+
*/
|
|
270
|
+
molenCloudFit: {
|
|
271
|
+
value: THREE.Vector4;
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region src/weather/noise.d.ts
|
|
276
|
+
type NoiseName = "weather" | "shape" | "detail" | "cirrus";
|
|
277
|
+
/** The page's cloud noise, filled in as `build` is given time. */
|
|
278
|
+
declare class CloudNoise {
|
|
279
|
+
readonly weather: Uint8Array;
|
|
280
|
+
readonly shape: Uint8Array;
|
|
281
|
+
readonly detail: Uint8Array;
|
|
282
|
+
readonly cirrus: Uint8Array;
|
|
283
|
+
private readonly ready;
|
|
284
|
+
private readonly jobs;
|
|
285
|
+
has(name: NoiseName): boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Work on `wanted`, in order, for about `budgetMs` (Infinity finishes them). Returns whether all
|
|
288
|
+
* of them are ready.
|
|
289
|
+
*/
|
|
290
|
+
build(wanted: readonly NoiseName[], budgetMs: number): boolean;
|
|
291
|
+
}
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/weather/clouds.d.ts
|
|
294
|
+
/**
|
|
295
|
+
* How much work the cloud renderer does per pixel: ray-march steps, light samples, erosion
|
|
296
|
+
* detail and, from 'high', cloud shadows on lit surfaces. Changing it never rebuilds a shader.
|
|
297
|
+
*/
|
|
298
|
+
type CloudQuality = "low" | "medium" | "high" | "ultra";
|
|
299
|
+
/**
|
|
300
|
+
* GPU textures over the page's shared noise arrays (see noise.ts). One set per renderer: the
|
|
301
|
+
* cloud-shadow uniforms of every lit shader keep the weather map for the renderer's lifetime.
|
|
302
|
+
*/
|
|
303
|
+
declare class CloudTextures {
|
|
304
|
+
readonly noise: CloudNoise;
|
|
305
|
+
readonly weather: THREE.DataTexture;
|
|
306
|
+
/**
|
|
307
|
+
* The weather map at a sixteenth of its texels (about 250 m each at the default scale), for
|
|
308
|
+
* cloud shadows: plain bilinear filtering of it gives their soft edges with one lookup.
|
|
309
|
+
*/
|
|
310
|
+
readonly shadow: THREE.DataTexture;
|
|
311
|
+
readonly shape: THREE.Data3DTexture;
|
|
312
|
+
readonly detail: THREE.Data3DTexture;
|
|
313
|
+
/** Cirrus RGBA; its alpha is rewritten for each coverage (see WeatherVisual). */
|
|
314
|
+
readonly cirrus: THREE.DataTexture;
|
|
315
|
+
private uploaded;
|
|
316
|
+
constructor(noise: CloudNoise);
|
|
317
|
+
/** Upload each field once its noise is complete. Returns whether the deck can draw. */
|
|
318
|
+
sync(): boolean;
|
|
319
|
+
dispose(): void;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* The deck's uniform values, shared by reference with both backends' materials. Every
|
|
323
|
+
* position is in rendered (floating-origin) coordinates; offsets into the tiling textures are
|
|
324
|
+
* wrapped on the CPU in double precision, so the GPU never sees a large world coordinate.
|
|
325
|
+
*/
|
|
326
|
+
declare class CloudUniforms {
|
|
327
|
+
/** Base, top and 1 / thickness (rendered Y), and the draw distance. */
|
|
328
|
+
readonly slab: THREE.Vector4;
|
|
329
|
+
/** Weather-map texels per meter, its wrapped UV offset, and coverage. */
|
|
330
|
+
readonly field: THREE.Vector4;
|
|
331
|
+
readonly mix: THREE.Vector4;
|
|
332
|
+
/** Shortest column, base rise, top softness, anvil. */
|
|
333
|
+
readonly form: THREE.Vector4;
|
|
334
|
+
/** Shape erosion, detail erosion (0 skips the detail lookup), coverage softness. */
|
|
335
|
+
readonly erode: THREE.Vector4;
|
|
336
|
+
/** Field relief, taper, and the blurred weather level and lift that spread an anvil. */
|
|
337
|
+
readonly relief: THREE.Vector4;
|
|
338
|
+
/** Billow noise repeats per meter and wrapped offset, in texture units. */
|
|
339
|
+
readonly shape: THREE.Vector4;
|
|
340
|
+
readonly detail: THREE.Vector4;
|
|
341
|
+
/** Steps, light steps, longest marched path (m), extinction per meter at full density. */
|
|
342
|
+
readonly march: THREE.Vector4;
|
|
343
|
+
/** Direction toward the light, and the farthest a light ray is marched, meters. */
|
|
344
|
+
readonly sun: THREE.Vector4;
|
|
345
|
+
readonly sunColor: THREE.Vector3;
|
|
346
|
+
readonly ambientTop: THREE.Vector3;
|
|
347
|
+
readonly ambientBottom: THREE.Vector3;
|
|
348
|
+
/** Forward and back scattering asymmetry, back-lobe weight, edge fade start (of distance). */
|
|
349
|
+
readonly phase: THREE.Vector4;
|
|
350
|
+
/** The scene's fog for clouds: near, far, density and kind (0 none, 1 linear, 2 exp2). */
|
|
351
|
+
readonly fog: THREE.Vector4;
|
|
352
|
+
/** Fog color, and how far haze also fades a cloud out (see setFog). */
|
|
353
|
+
readonly fogColor: THREE.Vector4;
|
|
354
|
+
/** Shadow opacity of a fully cloudy column: -ln of the sunlight it lets through. */
|
|
355
|
+
shadowDepth: number;
|
|
356
|
+
private readonly sunWarm;
|
|
357
|
+
private readonly sunLow;
|
|
358
|
+
private readonly moon;
|
|
359
|
+
private readonly skyDay;
|
|
360
|
+
private readonly skyDusk;
|
|
361
|
+
private readonly skyNight;
|
|
362
|
+
private readonly groundDay;
|
|
363
|
+
private readonly groundNight;
|
|
364
|
+
private readonly scratch;
|
|
365
|
+
/**
|
|
366
|
+
* Fog the clouds as the scene's `fog` fogs everything else (thinner looking up). Haze also
|
|
367
|
+
* fades a cloud out by `fade` (0–1), so that a fully hazed cloud shows the sky's own horizon
|
|
368
|
+
* behind it, whichever color space the backend fogs in; a closed deck (`fade` 0) has no sky
|
|
369
|
+
* behind it to show and turns the fog's grey instead.
|
|
370
|
+
*/
|
|
371
|
+
setFog(fog: THREE.Fog | THREE.FogExp2 | null, fade: number): void;
|
|
372
|
+
/** Recompute for one frame. `far` bounds the draw distance. */
|
|
373
|
+
update(weather: ResolvedWeather, seconds: number, origin: Vec3, far: number, quality: CloudQuality, sky: SkyFrame | undefined): void;
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
219
376
|
//#region src/weather/visual.d.ts
|
|
377
|
+
interface WeatherVisualOptions {
|
|
378
|
+
/** Cloud textures to draw with. A renderer passes its own; by default the visual makes some. */
|
|
379
|
+
textures?: CloudTextures;
|
|
380
|
+
/** The cloud deck's material for the renderer's backend; the WebGL material by default. */
|
|
381
|
+
createCloudMaterial?: (uniforms: CloudUniforms, textures: CloudTextures) => THREE.Material;
|
|
382
|
+
/** Per-pixel cloud work; default 'medium'. See `setCloudQuality`. */
|
|
383
|
+
quality?: CloudQuality;
|
|
384
|
+
/**
|
|
385
|
+
* Milliseconds of cloud noise generation per `update` until it is complete (default 3); the
|
|
386
|
+
* clouds appear once it is. Infinity builds it all in the first update. Built once per page.
|
|
387
|
+
*/
|
|
388
|
+
noiseBudgetMs?: number;
|
|
389
|
+
/**
|
|
390
|
+
* The renderer's backend, which decides how the sky veil matches its fog (three fogs WebGL
|
|
391
|
+
* materials after tone mapping, WebGPU's before). Default 'webgl'.
|
|
392
|
+
*/
|
|
393
|
+
backend?: "webgl" | "webgpu";
|
|
394
|
+
}
|
|
220
395
|
/**
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
396
|
+
* Volumetric clouds, a high cirrus layer and local precipitation on both graphics backends.
|
|
397
|
+
* Patterns are seeded and sampled at absolute simulation time, not integrated frames. Cloud
|
|
398
|
+
* layers use absolute world altitudes; particles are visual and do not accumulate or collide.
|
|
224
399
|
*/
|
|
225
400
|
declare class WeatherVisual {
|
|
226
401
|
readonly object: THREE.Group;
|
|
227
402
|
readonly fog: THREE.Fog;
|
|
228
403
|
private state;
|
|
229
|
-
private
|
|
230
|
-
private
|
|
231
|
-
private readonly
|
|
232
|
-
private
|
|
233
|
-
private
|
|
404
|
+
private readonly textures;
|
|
405
|
+
private readonly ownsTextures;
|
|
406
|
+
private readonly createCloudMaterial;
|
|
407
|
+
private readonly noiseBudgetMs;
|
|
408
|
+
private readonly uniforms;
|
|
409
|
+
private quality;
|
|
410
|
+
private cloudMaterial;
|
|
411
|
+
private deck;
|
|
412
|
+
private shells;
|
|
413
|
+
private deckReady;
|
|
414
|
+
private cirrus;
|
|
415
|
+
private cirrusCoverage;
|
|
416
|
+
private readonly backend;
|
|
417
|
+
/** Murk over the sky in poor visibility; see updateVeil. */
|
|
418
|
+
private veil;
|
|
419
|
+
private veilVisibility;
|
|
234
420
|
private particles;
|
|
235
421
|
private particleTexture;
|
|
236
422
|
private readonly cameraPosition;
|
|
@@ -238,22 +424,50 @@ declare class WeatherVisual {
|
|
|
238
424
|
private readonly up;
|
|
239
425
|
private readonly color;
|
|
240
426
|
private disposed;
|
|
241
|
-
constructor(data: WeatherData);
|
|
427
|
+
constructor(data: WeatherData, options?: WeatherVisualOptions);
|
|
242
428
|
/** Resolved copy; editing it does not change the visual. */
|
|
243
429
|
get data(): ResolvedWeather;
|
|
244
430
|
/** Replace weather while retaining geometry, particles and cached noise. */
|
|
245
431
|
setData(data: WeatherData): void;
|
|
246
432
|
get cloudAttenuation(): number;
|
|
433
|
+
/** Per-pixel cloud work. Uniform-driven: changing it rebuilds nothing. */
|
|
434
|
+
setCloudQuality(quality: CloudQuality): void;
|
|
435
|
+
get cloudQuality(): CloudQuality;
|
|
436
|
+
/**
|
|
437
|
+
* Whether lit surfaces get spatial cloud shadows this frame: from 'high' quality, once the
|
|
438
|
+
* clouds have appeared. While they do, direct light needs no uniform cloud dimming.
|
|
439
|
+
*/
|
|
440
|
+
get shadowsActive(): boolean;
|
|
441
|
+
/** Write this frame's cloud shadow into a renderer's lit-shader uniforms. */
|
|
442
|
+
writeShadows(uniforms: CloudShadowUniforms, active?: boolean): void;
|
|
443
|
+
/** Cloud layers drawn (the volumetric layer and cirrus) and precipitation particles. */
|
|
247
444
|
get stats(): {
|
|
248
445
|
cloudLayers: number;
|
|
249
446
|
particles: number;
|
|
250
447
|
};
|
|
251
448
|
/** Update camera-relative geometry using the renderer's absolute floating origin. */
|
|
252
449
|
update(seconds: number, camera: THREE.Camera, origin: Vec3, sky?: SkyFrame): void;
|
|
253
|
-
/**
|
|
450
|
+
/**
|
|
451
|
+
* Combine weather visibility with an authored/streaming fog limit without mutating it. The
|
|
452
|
+
* clouds are fogged with the result (see CloudUniforms.setFog).
|
|
453
|
+
*/
|
|
254
454
|
fogFor(base: THREE.Fog | THREE.FogExp2 | null, sky?: SkyFrame): THREE.Fog | THREE.FogExp2;
|
|
255
|
-
private
|
|
455
|
+
private limitFog;
|
|
456
|
+
private deckVisible;
|
|
457
|
+
private buildDeck;
|
|
256
458
|
private updateClouds;
|
|
459
|
+
/**
|
|
460
|
+
* In fog, rain or snow the murk hides the sky too, not only the ground: a camera-centred
|
|
461
|
+
* dome in the fog color, behind everything nearer, opaque toward the horizon and thinner
|
|
462
|
+
* overhead, where a view crosses less hazy air. Clouds draw over it, and a fully hazed cloud
|
|
463
|
+
* shows it. Absent in clear air (visibility from 20 km).
|
|
464
|
+
*/
|
|
465
|
+
private updateVeil;
|
|
466
|
+
/**
|
|
467
|
+
* Cirrus are thin ice streaks combed out by the jet stream, so this layer is a flat sheet: a
|
|
468
|
+
* stretched texture turned to lie along the wind, at the cirrus altitude.
|
|
469
|
+
*/
|
|
470
|
+
private updateCirrus;
|
|
257
471
|
private buildParticles;
|
|
258
472
|
private updateParticles;
|
|
259
473
|
dispose(): void;
|
|
@@ -287,7 +501,7 @@ type ShadowQuality = "off" | "low" | "medium" | "high";
|
|
|
287
501
|
interface ShadowFocus {
|
|
288
502
|
/** Focus point in absolute world coordinates (before any floating-origin rebase). */
|
|
289
503
|
center: readonly [number, number, number];
|
|
290
|
-
/**
|
|
504
|
+
/** Minimum half-width of the shadowed square, meters. Rounded up for a stable texel grid. */
|
|
291
505
|
radius: number;
|
|
292
506
|
}
|
|
293
507
|
//#endregion
|
|
@@ -347,11 +561,17 @@ declare class WebGpuSceneOptimizer {
|
|
|
347
561
|
type RendererBackend = "webgl" | "webgpu";
|
|
348
562
|
type RendererBackendPreference = "auto" | RendererBackend;
|
|
349
563
|
type ThreeRenderer = THREE.WebGLRenderer | WebGPURenderer;
|
|
564
|
+
/** The backend's cloud deck material and lit-shader cloud shadows (WebGPU: webgpu-clouds.ts). */
|
|
565
|
+
interface CloudBackend {
|
|
566
|
+
material(uniforms: CloudUniforms, textures: CloudTextures): THREE.Material;
|
|
567
|
+
installShadows(uniforms: CloudShadowUniforms): void;
|
|
568
|
+
}
|
|
350
569
|
interface InitializedRenderer {
|
|
351
570
|
three: ThreeRenderer;
|
|
352
571
|
backend: RendererBackend;
|
|
353
572
|
optimizer?: WebGpuSceneOptimizer;
|
|
354
573
|
reflectionFilter?: SkyReflectionFilter;
|
|
574
|
+
clouds?: CloudBackend;
|
|
355
575
|
}
|
|
356
576
|
interface RendererOptions {
|
|
357
577
|
/** Shared procedural sky/ground reflections for PBR materials. Default false; Earth viewers enable it. */
|
|
@@ -448,6 +668,10 @@ declare class Renderer {
|
|
|
448
668
|
private warmupMaterial;
|
|
449
669
|
private readonly warmedPrograms;
|
|
450
670
|
private readonly warmedMeshes;
|
|
671
|
+
/** Per material, one prepared mesh of each kind it draws; see `prepareMaterialChange`. */
|
|
672
|
+
private readonly materialMeshes;
|
|
673
|
+
/** The scene's visible lights for warm-up builds, gathered once between rendered frames. */
|
|
674
|
+
private preparationLights;
|
|
451
675
|
/**
|
|
452
676
|
* Per mesh, builds of the materials it swaps to itself (`null`: prepared with the mesh); see
|
|
453
677
|
* `prepareVariants`.
|
|
@@ -492,12 +716,23 @@ declare class Renderer {
|
|
|
492
716
|
private occlusion;
|
|
493
717
|
private occlusionLoad;
|
|
494
718
|
private occlusionSuspended;
|
|
495
|
-
/** Sun lights
|
|
496
|
-
private readonly
|
|
719
|
+
/** Sun lights that have cast shadows: 'off' parks their maps; see setShadowQuality. */
|
|
720
|
+
private readonly shadowLights;
|
|
721
|
+
/** Kinds of shadow caster prepared so far (WebGL); see noteShadowCaster. */
|
|
722
|
+
private readonly casterVariants;
|
|
723
|
+
/** Whether the shadow pass has drawn shadowCasterWarmup's casters (WebGL). */
|
|
724
|
+
private shadowCastersWarmed;
|
|
497
725
|
private readonly reflectionClearColor;
|
|
498
726
|
private starCatalog;
|
|
499
727
|
private activeWeather;
|
|
500
728
|
private weatherTimeOverride;
|
|
729
|
+
/** Cloud textures and the cloud-shadow uniforms every lit shader reads, for the renderer's life. */
|
|
730
|
+
private readonly cloudTextures;
|
|
731
|
+
private readonly cloudShadows;
|
|
732
|
+
private readonly cloudBackend;
|
|
733
|
+
private releaseCloudShadows;
|
|
734
|
+
private cloudQualityLevel;
|
|
735
|
+
private cloudShadowMapVersion;
|
|
501
736
|
private readonly weatherLightIntensities;
|
|
502
737
|
/** The hemisphere the sky reflection map stands in for, and its authored visibility. */
|
|
503
738
|
private hiddenAmbient;
|
|
@@ -510,12 +745,17 @@ declare class Renderer {
|
|
|
510
745
|
/** Active clear-sky visual and sampled ephemeris, when environment.sky is configured. */
|
|
511
746
|
get sky(): SkyVisual | undefined;
|
|
512
747
|
/**
|
|
513
|
-
* Aim the sun's shadow at a focus (absolute world coordinates) covering ±`radius` meters, or
|
|
748
|
+
* Aim the sun's shadow at a focus (absolute world coordinates) covering at least ±`radius` meters, or
|
|
514
749
|
* `undefined` for the environment's own fixed box. Call whenever what the camera frames
|
|
515
750
|
* moves: an orbit target, a walker, a car. Shadows must be on (`setShadowQuality`).
|
|
516
751
|
*/
|
|
517
752
|
setShadowFocus(focus: ShadowFocus | undefined): void;
|
|
518
|
-
/**
|
|
753
|
+
/**
|
|
754
|
+
* Turn sun shadows on at a map resolution, or off, without rebuilding the environment. Once a
|
|
755
|
+
* light has cast shadows, 'off' stops redrawing its map and fades it out, so every lit shader
|
|
756
|
+
* keeps the shadow inputs it was built with: a host that turns shadows on once before its first
|
|
757
|
+
* frame can then switch them freely (adaptive quality tiers do) without rebuilding a shader.
|
|
758
|
+
*/
|
|
519
759
|
setShadowQuality(quality: ShadowQuality): void;
|
|
520
760
|
/** WebGL PCF shadow lookups against a reversed depth buffer; see focusDirectionalShadow. */
|
|
521
761
|
private webglReversedPcfShadows;
|
|
@@ -524,6 +764,13 @@ declare class Renderer {
|
|
|
524
764
|
private applyShadowFocus;
|
|
525
765
|
/** Active weather effects; physical weather data is also available in the simulation component. */
|
|
526
766
|
get weather(): WeatherVisual | undefined;
|
|
767
|
+
/**
|
|
768
|
+
* Per-pixel cloud work, default 'medium': ray-march steps and light samples, erosion detail
|
|
769
|
+
* from 'high', and from 'high' also cloud shadows on every lit surface. Takes effect on the
|
|
770
|
+
* next frame without rebuilding any shader, so adaptive quality tiers may change it freely.
|
|
771
|
+
*/
|
|
772
|
+
setCloudQuality(quality: CloudQuality): void;
|
|
773
|
+
get cloudQuality(): CloudQuality;
|
|
527
774
|
/** Apply the singleton weather component without rebuilding the sky or moving the camera. */
|
|
528
775
|
setWeather(data: WeatherData | undefined): void;
|
|
529
776
|
/** Standalone weather preview clock. Undefined follows simulation time, independently of sky seeks. */
|
|
@@ -575,8 +822,21 @@ declare class Renderer {
|
|
|
575
822
|
* other levels afterwards in the background, so publication waits only for what can be seen.
|
|
576
823
|
* Queued work is cancelled once every caller waiting for it has aborted, and background work
|
|
577
824
|
* once its mesh or geometry is disposed.
|
|
825
|
+
*
|
|
826
|
+
* `root.userData.admissionPriority` admits the root's own work as `'urgent'` (ahead of normal
|
|
827
|
+
* work) or `'background'` (only in budget normal work leaves: content nobody waits on yet).
|
|
828
|
+
* `root.userData.admissionOrder` supplies live normal-lane order (lower first).
|
|
578
829
|
*/
|
|
579
830
|
prepareObject(root: THREE.Object3D, signal?: AbortSignal, parent?: THREE.Object3D): Promise<void>;
|
|
831
|
+
/**
|
|
832
|
+
* Build `next`'s shaders for every kind of prepared mesh that draws `current`, before the caller
|
|
833
|
+
* copies `next` into `current`: a progressive material upgrading its placeholder in place once a
|
|
834
|
+
* texture bake lands. Three shares a program between materials built alike, so the upgraded
|
|
835
|
+
* placeholder draws with it at once. Otherwise every mesh showing the placeholder built its new
|
|
836
|
+
* shaders in the next frame, together: seconds of frozen flight shortly after loading. The work
|
|
837
|
+
* runs in the background lane. Keep `next` alive while `current` uses the shared program.
|
|
838
|
+
*/
|
|
839
|
+
prepareMaterialChange(current: THREE.Material, next: THREE.Material): Promise<void>;
|
|
580
840
|
private prepareMesh;
|
|
581
841
|
private flushWebGlBatches;
|
|
582
842
|
/**
|
|
@@ -607,8 +867,34 @@ declare class Renderer {
|
|
|
607
867
|
/** Nobody waits any longer: drop the job from every cache first, then from the queue. */
|
|
608
868
|
private cancelWarmup;
|
|
609
869
|
private rememberPreparation;
|
|
870
|
+
/**
|
|
871
|
+
* While WebGL shadows are parked the shadow pass never runs, so no depth program is built for
|
|
872
|
+
* the casters arriving meanwhile, and the first frame with shadows back built every one of them
|
|
873
|
+
* at once (an adaptive tier change, mid-flight). A caster of a kind the map has not drawn yet
|
|
874
|
+
* asks the parked map for one render, which builds its depth program as it streams in. The
|
|
875
|
+
* kinds follow three's shadow pass: one depth material, cloned for alpha-tested maps,
|
|
876
|
+
* displacement or clipping, built per mesh kind and side.
|
|
877
|
+
*/
|
|
878
|
+
private noteShadowCaster;
|
|
610
879
|
/** Build `mesh` for the frame's draw target, drawn with `material` when given. */
|
|
611
880
|
private compileMesh;
|
|
881
|
+
/**
|
|
882
|
+
* Three's compileAsync, but waiting for the programs built for this mesh. Three polls each
|
|
883
|
+
* material's current program, which the next frame resets for whatever it drew last: a
|
|
884
|
+
* material shared with drawn meshes (every building's wall) reported its ready program while
|
|
885
|
+
* the instanced variant was still linking, and that variant's first draw waited for the link
|
|
886
|
+
* mid-frame (130 ms in flight).
|
|
887
|
+
*/
|
|
888
|
+
private compileWebGl;
|
|
889
|
+
/** The scene's visible lights, gathered once between rendered frames for warm-up builds. */
|
|
890
|
+
private sceneLights;
|
|
891
|
+
/**
|
|
892
|
+
* What a lit program is built for besides its material and mesh: the scene's lights and which
|
|
893
|
+
* cast shadows, the shadow map, fog, environment and output. Warm-ups are remembered under it.
|
|
894
|
+
* Without it a material built before the sky's sun, its shadows or its reflections existed
|
|
895
|
+
* counted as prepared, and the next tile drawing it built the real program mid-frame.
|
|
896
|
+
*/
|
|
897
|
+
private programState;
|
|
612
898
|
private prepareWebGlGeometries;
|
|
613
899
|
render(): void;
|
|
614
900
|
/**
|
|
@@ -623,6 +909,14 @@ declare class Renderer {
|
|
|
623
909
|
*/
|
|
624
910
|
private hideReflectedAmbient;
|
|
625
911
|
private renderScene;
|
|
912
|
+
/**
|
|
913
|
+
* Once WebGL sun shadows draw, a frame of degenerate casters (one plain and one instanced mesh
|
|
914
|
+
* per side): the shadow pass builds a depth program for each kind of caster the first time it
|
|
915
|
+
* draws one, and the first double-sided caster in view held a mid-flight frame 10 ms. The
|
|
916
|
+
* shadow pass keeps its depth materials, so the programs stay built; three keys them by the
|
|
917
|
+
* scene's light counts too, so a light the renderer shows or hides warms them again.
|
|
918
|
+
*/
|
|
919
|
+
private shadowCasterWarmup;
|
|
626
920
|
private optimized;
|
|
627
921
|
/**
|
|
628
922
|
* Screen-space ambient occlusion on the WebGPU backend (a no-op on WebGL): creases, corners and
|
|
@@ -651,4 +945,4 @@ declare class Renderer {
|
|
|
651
945
|
dispose(): void;
|
|
652
946
|
}
|
|
653
947
|
//#endregion
|
|
654
|
-
export {
|
|
948
|
+
export { SkyReflectionState as A, defaultSkyPalette as C, skyTimeMs as D, evaluateEarthSky as E, AdmissionSample as F, FrameAdmissionOptions as I, FrameAdmissionQueue as L, createWebGlSkyReflectionFilter as M, reflectionStateFromLights as N, starDirection as O, AdmissionOptions as P, SceneAdmission as R, SkyVisualOptions as S, EarthSkyState as T, WeatherVisualOptions as _, RendererBackendPreference as a, SkyStar as b, TopDownOrtho as c, ShadowFocus as d, ShadowQuality as f, WeatherVisual as g, createGpuFrameTimer as h, RendererBackend as i, SkyReflections as j, SkyReflectionFilter as k, nextWorldOrigin as l, GpuFrameTimerOptions as m, CameraPose as n, RendererOptions as o, GpuFrameTimer as p, Renderer as r, ThreeRenderer as s, AutoWorldOriginOptions as t, orthoFrustum as u, CloudQuality as v, CelestialPosition as w, SkyVisual as x, SkyFrame as y };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { n as ModelSignals, t as ModelSignalVisual } from "./model-signals-BpeXhsim.mjs";
|
|
2
|
+
import { AircraftCollisionProbe, AircraftContact, VehicleInteriorSpec, VehicleSpec } from "@bendyline/molen-schema";
|
|
3
|
+
import * as THREE from "three";
|
|
4
|
+
import { Object3D } from "three";
|
|
5
|
+
|
|
6
|
+
//#region src/aircraft-collision.d.ts
|
|
7
|
+
interface AircraftObstacleScene {
|
|
8
|
+
/** Collision tree origin and query, e.g. WalkCollision. */
|
|
9
|
+
origin: THREE.Vector3;
|
|
10
|
+
octree: {
|
|
11
|
+
sphereIntersect(sphere: THREE.Sphere): false | {
|
|
12
|
+
normal: THREE.Vector3;
|
|
13
|
+
depth: number;
|
|
14
|
+
};
|
|
15
|
+
getSphereTriangles?(sphere: THREE.Sphere, triangles: THREE.Triangle[]): unknown;
|
|
16
|
+
};
|
|
17
|
+
cars: ReadonlyArray<{
|
|
18
|
+
transform: {
|
|
19
|
+
pos: [number, number, number];
|
|
20
|
+
rot: [number, number, number, number];
|
|
21
|
+
};
|
|
22
|
+
spec: Pick<VehicleSpec, "width" | "height" | "length">;
|
|
23
|
+
}>;
|
|
24
|
+
/** Other aircraft body centers. The host excludes the queried aircraft. */
|
|
25
|
+
aircraft: ReadonlyArray<[number, number, number]>;
|
|
26
|
+
}
|
|
27
|
+
/** Contact normals from streamed geometry and nearby parked vehicles, in absolute coordinates. */
|
|
28
|
+
declare function aircraftObstacleContacts(probes: readonly AircraftCollisionProbe[], scene: AircraftObstacleScene): AircraftContact[];
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/vehicle-camera.d.ts
|
|
31
|
+
interface VehicleCameraOptions {
|
|
32
|
+
view: "cockpit" | "chase";
|
|
33
|
+
lookYaw?: number;
|
|
34
|
+
lookPitch?: number;
|
|
35
|
+
/** Distance to the first static obstruction between two absolute world points. */
|
|
36
|
+
obstructionDistance?: (from: [number, number, number], to: [number, number, number]) => number | undefined;
|
|
37
|
+
}
|
|
38
|
+
interface VehicleCameraPose {
|
|
39
|
+
position: [number, number, number];
|
|
40
|
+
lookAt: [number, number, number];
|
|
41
|
+
yaw: number;
|
|
42
|
+
pitch: number;
|
|
43
|
+
}
|
|
44
|
+
/** Seat-space cockpit and collision-shortened chase views for any vehicle host. */
|
|
45
|
+
declare function vehicleCameraPose(transform: {
|
|
46
|
+
pos: [number, number, number];
|
|
47
|
+
rot: [number, number, number, number];
|
|
48
|
+
}, spec: Pick<VehicleSpec, "driverEye" | "length">, options: VehicleCameraOptions): VehicleCameraPose;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/vehicle-interior.d.ts
|
|
51
|
+
type VehicleInteriorSignals = ModelSignals;
|
|
52
|
+
type VehicleInteriorVisual = ModelSignalVisual;
|
|
53
|
+
/** Vehicle convenience wrapper around the platform's model-signal binding system. */
|
|
54
|
+
declare function createVehicleInteriorVisual(model: Object3D, spec: VehicleInteriorSpec): VehicleInteriorVisual;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { VehicleCameraPose as a, aircraftObstacleContacts as c, VehicleCameraOptions as i, VehicleInteriorVisual as n, vehicleCameraPose as o, createVehicleInteriorVisual as r, AircraftObstacleScene as s, VehicleInteriorSignals as t };
|