@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
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { DamBreach } from '@margoengine/physics/breach';
|
|
2
|
+
import type { CraterSolver } from '@margoengine/physics/crater';
|
|
3
|
+
import type { GranularFlowSolver } from '@margoengine/physics/granular-flow';
|
|
4
|
+
import type { PhysicsWorld } from '@margoengine/physics/world';
|
|
5
|
+
/** The reservoir: what it held and how its bank stands. */
|
|
6
|
+
export declare const FAULD_RESERVOIR: Readonly<{
|
|
7
|
+
/** The water in it, m^3: six million imperial gallons. */
|
|
8
|
+
volume: 27300;
|
|
9
|
+
/** Its stage-storage power: 1, a pond with steep sides (27,300 m^3 at 8 m is 3,410 m^2, the mapped 58 by 58 m). */
|
|
10
|
+
exponent: 1;
|
|
11
|
+
/** The bank's length across the pond, m. */
|
|
12
|
+
length: 58;
|
|
13
|
+
/** The bank's height over its toe, m. */
|
|
14
|
+
bank: 8;
|
|
15
|
+
/** The blast's cut through the bank at the mud's start: its bottom over the toe and its width, m. */
|
|
16
|
+
cut: {
|
|
17
|
+
bottom: number;
|
|
18
|
+
width: number;
|
|
19
|
+
};
|
|
20
|
+
/** The breach it widens to, m, and over how long, s (a prescribed breach: the blast, not erosion, opened it). */
|
|
21
|
+
breach: {
|
|
22
|
+
width: number;
|
|
23
|
+
sideSlope: number;
|
|
24
|
+
time: number;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
/** The mud as it runs: its density, its friction, the water in its pores and what it picks up from the slope. */
|
|
28
|
+
export declare const FAULD_MUD: Readonly<{
|
|
29
|
+
density: 1800;
|
|
30
|
+
friction: 0.1;
|
|
31
|
+
poreSupport: 0.7;
|
|
32
|
+
turbulence: 500;
|
|
33
|
+
/** McDougall and Hungr's growth rate per metre and the depth of loose soil it can take, m. */
|
|
34
|
+
entrainment: {
|
|
35
|
+
growth: number;
|
|
36
|
+
depth: number;
|
|
37
|
+
};
|
|
38
|
+
/** The mud's sediment for Water's tint, kg/m^3 (42 percent solids by volume at 2,650 kg/m^3). */
|
|
39
|
+
concentration: number;
|
|
40
|
+
}>;
|
|
41
|
+
/** A grid of the mud on the ground: its cells across, the corner it starts at and its size, m. */
|
|
42
|
+
export interface FauldMudGrid {
|
|
43
|
+
readonly cells: number;
|
|
44
|
+
readonly origin: readonly [number, number];
|
|
45
|
+
readonly size: readonly [number, number];
|
|
46
|
+
}
|
|
47
|
+
/** What Water's renderer reads: the grid and a sample of the mud's depth, surface and velocity at a point. */
|
|
48
|
+
export interface FauldMudSurface {
|
|
49
|
+
readonly shape: {
|
|
50
|
+
readonly columns: number;
|
|
51
|
+
readonly rows: number;
|
|
52
|
+
readonly width: number;
|
|
53
|
+
readonly depth: number;
|
|
54
|
+
readonly centre: readonly [number, number];
|
|
55
|
+
};
|
|
56
|
+
sample(x: number, z: number, out: {
|
|
57
|
+
depth: number;
|
|
58
|
+
surface: number;
|
|
59
|
+
velocity: [number, number];
|
|
60
|
+
}): {
|
|
61
|
+
depth: number;
|
|
62
|
+
surface: number;
|
|
63
|
+
velocity: [number, number];
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** The mud in the scene: its world, breach and flow, its film time and the renderer's views of it. */
|
|
67
|
+
export interface FauldMudFlow {
|
|
68
|
+
readonly world: PhysicsWorld;
|
|
69
|
+
readonly breach: DamBreach;
|
|
70
|
+
readonly flow: GranularFlowSolver;
|
|
71
|
+
/** With `blasts`: the crater EARTH-06 digs, whose zones break the bank. */
|
|
72
|
+
readonly crater: CraterSolver | undefined;
|
|
73
|
+
/** Film seconds the mud stands at. */
|
|
74
|
+
readonly time: number;
|
|
75
|
+
/** Moves the mud to film second `t`, back to the snapshot before it and on, or on from where it is. */
|
|
76
|
+
seek(t: number): void;
|
|
77
|
+
readonly surface: FauldMudSurface;
|
|
78
|
+
readonly sediment: {
|
|
79
|
+
readonly concentrationSize: readonly [number, number];
|
|
80
|
+
copyConcentrations(out: Float32Array): void;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** A release of the store: its film second, its place [x, z] m from the crater and its TNT equivalent, kg. */
|
|
84
|
+
export interface FauldMudBlast {
|
|
85
|
+
readonly at: number;
|
|
86
|
+
readonly at_: readonly [number, number];
|
|
87
|
+
readonly tnt: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Builds the reservoir and its mud on `grid` over the ground `height(x, z)`: its outlet `outlet` [x, z] on the slope below
|
|
91
|
+
* and the way `toward` [x, z] the mud is sent off. With `blasts` and the pond's centre `pond` [x, z], the store's releases go
|
|
92
|
+
* off as one buried charge (FIRE-05) whose crater EARTH-06 digs, and the side of the pond's ring bank nearest it fails by
|
|
93
|
+
* the crater's zones (HYDRO-05): cracked inside 2.5 crater radii, it pipes, and the breach grows by Froehlich's law.
|
|
94
|
+
* Without, the bank is cut at film second `at`.
|
|
95
|
+
*/
|
|
96
|
+
export declare function fauldMud({ height, grid, outlet, toward, at, blasts, pond, }: {
|
|
97
|
+
readonly height: (x: number, z: number) => number;
|
|
98
|
+
readonly grid: FauldMudGrid;
|
|
99
|
+
readonly outlet: readonly [number, number];
|
|
100
|
+
readonly toward: readonly [number, number];
|
|
101
|
+
readonly at?: number;
|
|
102
|
+
readonly blasts?: readonly FauldMudBlast[];
|
|
103
|
+
readonly pond?: readonly [number, number];
|
|
104
|
+
}): Promise<FauldMudFlow>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { TerrainBed } from '@margoengine/physics/earth';
|
|
2
|
+
import type { ExplosionSolver } from '@margoengine/physics/explosive';
|
|
3
|
+
import type { GravityCurrentSolver } from '@margoengine/physics/gravity-current';
|
|
4
|
+
import type { PhysicsWorld } from '@margoengine/physics/world';
|
|
5
|
+
import { DustCurrent } from '@margoengine/vfx/dust-current';
|
|
6
|
+
/** The surge's dust and its ground: silt from the mudstone (50 micrometres, 2,650 kg/m^3, as the solver was calibrated). */
|
|
7
|
+
export declare const FAULD_SURGE: Readonly<{
|
|
8
|
+
grain: Readonly<{
|
|
9
|
+
diameter: 0.00005;
|
|
10
|
+
density: 2650;
|
|
11
|
+
}>;
|
|
12
|
+
/** The patch of ground it runs on: cells across and its size, m, centred on the crater. */
|
|
13
|
+
cells: 96;
|
|
14
|
+
size: 3200;
|
|
15
|
+
}>;
|
|
16
|
+
/** A release of the store: its film second, its place [x, z] m from the crater and its TNT equivalent, kg. */
|
|
17
|
+
export interface FauldSurgeBlast {
|
|
18
|
+
readonly at: number;
|
|
19
|
+
readonly at_: readonly [number, number];
|
|
20
|
+
readonly tnt: number;
|
|
21
|
+
}
|
|
22
|
+
/** The surge at a point: its depth, m, its dust's volume fraction, its velocity [x, z], m/s, and its dust's optical depth. */
|
|
23
|
+
export interface FauldSurgeSample {
|
|
24
|
+
depth: number;
|
|
25
|
+
dust: number;
|
|
26
|
+
velocity: [number, number];
|
|
27
|
+
opacity: number;
|
|
28
|
+
}
|
|
29
|
+
/** The base surge in the scene: its world and solvers, its film time and views of it. */
|
|
30
|
+
export interface FauldSurgeFlow {
|
|
31
|
+
readonly world: PhysicsWorld;
|
|
32
|
+
readonly charge: ExplosionSolver;
|
|
33
|
+
readonly bed: TerrainBed;
|
|
34
|
+
readonly current: GravityCurrentSolver;
|
|
35
|
+
/** The ground's grid: cells across, its size, m, and its centre [x, z]. */
|
|
36
|
+
readonly shape: {
|
|
37
|
+
readonly columns: number;
|
|
38
|
+
readonly rows: number;
|
|
39
|
+
readonly width: number;
|
|
40
|
+
readonly depth: number;
|
|
41
|
+
readonly centre: readonly [number, number];
|
|
42
|
+
};
|
|
43
|
+
/** Film seconds the surge stands at. */
|
|
44
|
+
readonly time: number;
|
|
45
|
+
/** Moves the surge to film second `t`, back to the snapshot before it and on, or on from where it is. */
|
|
46
|
+
seek(t: number): void;
|
|
47
|
+
/** The surge at (x, z), m, into `out`. */
|
|
48
|
+
sample(x: number, z: number, out: FauldSurgeSample): FauldSurgeSample;
|
|
49
|
+
/** The dust laid on the ground at (x, z) so far, m (the bed's rise over the ground). */
|
|
50
|
+
deposit(x: number, z: number): number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Builds the base surge over the ground `height(x, z)` from the store's releases `blasts`.
|
|
54
|
+
* @example
|
|
55
|
+
* const surge = await fauldSurge({ height: world.height, blasts: FAULD_BLASTS });
|
|
56
|
+
* surge.seek(40);
|
|
57
|
+
* surge.sample(600, 0, { depth: 0, dust: 0, velocity: [0, 0], opacity: 0 }).opacity;
|
|
58
|
+
*/
|
|
59
|
+
export declare function fauldSurge({ height, blasts, }: {
|
|
60
|
+
readonly height: (x: number, z: number) => number;
|
|
61
|
+
readonly blasts: readonly FauldSurgeBlast[];
|
|
62
|
+
}): Promise<FauldSurgeFlow>;
|
|
63
|
+
/**
|
|
64
|
+
* The surge drawn as dust: a `DustCurrent` of @margoengine/vfx/dust-current over its grid, a puff for each visible patch
|
|
65
|
+
* standing on `height(x, z)`. Draw it into the scene's smoke `Clouds` after each `surge.seek`.
|
|
66
|
+
* @example
|
|
67
|
+
* const dust = fauldSurgeDust(surge, world.height);
|
|
68
|
+
* surge.seek(40);
|
|
69
|
+
* dust.draw(smoke);
|
|
70
|
+
*/
|
|
71
|
+
export declare function fauldSurgeDust(surge: FauldSurgeFlow, height: (x: number, z: number) => number): DustCurrent;
|
package/dist/fauld-tunnels.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { EngineKernel, Vec3 } from '@margoengine/core';
|
|
|
3
3
|
import { Clustered, type PointLight, type SpotLight } from '@margoengine/clustered';
|
|
4
4
|
import { LocalShadows } from '@margoengine/clustered/shadows';
|
|
5
5
|
import { LightGroups } from '@margoengine/clustered/groups';
|
|
6
|
+
import { type ShadowBudgetOptions } from '@margoengine/clustered/budget';
|
|
6
7
|
import { VolumetricFog } from '@margoengine/environment/volumetric';
|
|
7
8
|
import { PostStack } from '@margoengine/post/stack';
|
|
8
9
|
import { GTAO } from '@margoengine/post/gtao';
|
|
@@ -95,6 +96,13 @@ export declare const WELL_GLASS_RADIUS = 0.07;
|
|
|
95
96
|
export declare const DEEP_BOWL_RADIUS = 0.16;
|
|
96
97
|
/** Lamps at or over this plan height (m) hang in a well-glass fitting; lower ones are lanterns and work lamps. */
|
|
97
98
|
export declare const HUNG_Z = 2;
|
|
99
|
+
/** The kit's battery hand lamp (tunnels_kit_blender.py `handlamp`): its beam along +X, its origin at the handle's top. */
|
|
100
|
+
export declare const HANDLAMP_ASSET = "fauld-1944/tunnels/tn_handlamp";
|
|
101
|
+
/**
|
|
102
|
+
* A hand lamp standing on the floor, measured on the model: its origin 0.27 m over its base, the lens 0.046 m forward
|
|
103
|
+
* of the origin and 0.05 m under it (TN_Water spans x 0.044 to 0.048, y -0.102 to 0.002).
|
|
104
|
+
*/
|
|
105
|
+
export declare const HANDLAMP_STAND: readonly [0.27, 0.046, 0.05];
|
|
98
106
|
/** The model of the mains fitting, its pivot at the globe's centre (the light's place), the conduit up to the arch. */
|
|
99
107
|
export declare const WELL_GLASS_ASSET = "fauld-1944/tunnels/tn_wellglass";
|
|
100
108
|
/**
|
|
@@ -121,6 +129,40 @@ export declare const FAULD_STATE_EV: Readonly<Record<FauldTunnelState, number>>;
|
|
|
121
129
|
* over its luminance 0.2126 + 0.7152 x 0.397 + 0.0722 x 0.095 = 0.505.
|
|
122
130
|
*/
|
|
123
131
|
export declare const TUNGSTEN_2700: Vec3;
|
|
132
|
+
/**
|
|
133
|
+
* The roof over a place of the store, metres (the floor at y = 0), measured on the models: the old roadway's rock
|
|
134
|
+
* (tn_shell, x past 118: 3.16 to 3.48 m, 3.2 over its fire) and the crown of the vaults' sheeted arch (tn_sheet,
|
|
135
|
+
* 3.39 m).
|
|
136
|
+
* @example fauldRoofHeight(125); // 3.2
|
|
137
|
+
*/
|
|
138
|
+
export declare function fauldRoofHeight(x: number): number;
|
|
139
|
+
/**
|
|
140
|
+
* The gallery round a place of the store (world metres): the old roadway (x past 118, running along z) or the vault
|
|
141
|
+
* bay or aisle along x whose centre line is nearest.
|
|
142
|
+
* @example fauldGallery(60, 5.6).walls; // [2.8, 8.4]
|
|
143
|
+
*/
|
|
144
|
+
export declare function fauldGallery(x: number, z: number): {
|
|
145
|
+
axis: 'x' | 'z';
|
|
146
|
+
walls: [number, number];
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* The smoke column of a fire underground at `(x, z)` world metres: it stops at the roof and runs along the gallery
|
|
150
|
+
* under it (`Smoke`'s `ceiling` and `gallery`, {@link fauldGallery}), dark, as bitumen and munitions packing burn
|
|
151
|
+
* sooty.
|
|
152
|
+
* @example fauldFireSmoke(125, 23).ceiling; // 3.2
|
|
153
|
+
*/
|
|
154
|
+
export declare function fauldFireSmoke(x: number, z: number): {
|
|
155
|
+
ceiling: number;
|
|
156
|
+
gallery: ReturnType<typeof fauldGallery>;
|
|
157
|
+
color: [number, number, number];
|
|
158
|
+
opacity: number;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* The firelight's key card underground, metres: a white card this far from a fire, facing it, reads 1.0, as the other
|
|
162
|
+
* states meter their key lamp. The flames' silhouette light left the fire frames 4 to 5 stops under it, nearly black
|
|
163
|
+
* beside the flames (KB-FAULD-FIREDIM1).
|
|
164
|
+
*/
|
|
165
|
+
export declare const FIRE_KEY_DISTANCE = 2;
|
|
124
166
|
/** The detonation flash of the blast state, candela (see the blast lamps in `attach`). */
|
|
125
167
|
export declare const BLAST_FLASH_CD = 1900000;
|
|
126
168
|
/**
|
|
@@ -158,7 +200,31 @@ export declare function linePoints(row: LineRow): {
|
|
|
158
200
|
}[];
|
|
159
201
|
/** Every lamp position of a bulb row (from, to, every). */
|
|
160
202
|
export declare function bulbPoints(row: BulbRow): number[][];
|
|
161
|
-
/**
|
|
203
|
+
/**
|
|
204
|
+
* The solid pieces a fire may not stand in, by asset: their model-space bounds [x0, y0, z0, x1, y1, z1] in metres (glTF
|
|
205
|
+
* axes, y up), read from the asset library's glTF files (each POSITION accessor's min and max through its node
|
|
206
|
+
* matrices, the `_2k` files of `blender-library/<asset>/`, 2026-11-29). The casing stacks, SAA bomb rows, trolleys, the
|
|
207
|
+
* 1,000 lb bomb and its cradles, the bench, desk, hut, fire buckets, piers, rail buffers, boulders, the walls and seals,
|
|
208
|
+
* the bent door and the ladder; not the arch ribs, beams and lining sheets overhead, the rails and baulks, the small
|
|
209
|
+
* stones and tools, or the shell, hill, yard floor and water the store is built in (KB-FAULD-FIREINSTACK1).
|
|
210
|
+
*/
|
|
211
|
+
export declare const FAULD_SOLIDS: Readonly<Record<string, readonly [number, number, number, number, number, number]>>;
|
|
212
|
+
/** A solid piece of a state in plan metres: its row name and box [x0, y0, z0, x1, y1, z1] (+X in, +Y north, Z up). */
|
|
213
|
+
export type FauldSolid = {
|
|
214
|
+
readonly name: string;
|
|
215
|
+
readonly box: readonly [number, number, number, number, number, number];
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Where a fire of `scale` burns: at plan (x, y) when that is clear of every solid, else at the nearest place that is,
|
|
219
|
+
* moved straight out of the solids it stands in (a burning heap lies on open floor beside a stack, never inside one;
|
|
220
|
+
* KB-FAULD-FIREINSTACK1). Ties go to the first solid's first side, so a place is the same in every run.
|
|
221
|
+
* @throws RangeError when no clear place is found within four moves.
|
|
222
|
+
*/
|
|
223
|
+
export declare function clearFire(x: number, y: number, z: number, scale: number, solids: readonly FauldSolid[]): [number, number];
|
|
224
|
+
/**
|
|
225
|
+
* What a state draws: its pieces by asset (plan rows), its solid pieces' boxes, its lamps and its fire and smoke. Each
|
|
226
|
+
* fire stands clear of the solids ({@link clearFire}).
|
|
227
|
+
*/
|
|
162
228
|
export declare function dressState(state: FauldTunnelState): {
|
|
163
229
|
pieces: Map<string, number[][]>;
|
|
164
230
|
lamps: {
|
|
@@ -166,7 +232,8 @@ export declare function dressState(state: FauldTunnelState): {
|
|
|
166
232
|
at: number[];
|
|
167
233
|
extra?: Extra;
|
|
168
234
|
}[];
|
|
169
|
-
fx:
|
|
235
|
+
fx: FxRow[];
|
|
236
|
+
solids: FauldSolid[];
|
|
170
237
|
};
|
|
171
238
|
/** A lamp of a state, ready for `Clustered`: pre-exposed (see {@link stateLights}). */
|
|
172
239
|
export type FauldLamp = PointLight | SpotLight;
|
|
@@ -181,7 +248,7 @@ export type FauldLamp = PointLight | SpotLight;
|
|
|
181
248
|
* they now light at their own scale beside the lamps instead of 1.3 to 4.3 stops under them (KB-FAULD-FIREDARK1).
|
|
182
249
|
* Hand lamps, lanterns and sparks are 2700 K filaments (the plan carried Unreal's [1, 0.82, 0.6], about 3,800 K,
|
|
183
250
|
* which a 3,200 K balance turns blue); a lamp marked `fire` is a burning heap, a {@link Fire} of `scale` at its
|
|
184
|
-
* place, unless one of the state's fires is within 1.5 m (KB-FAULD-FIRELAMPS1).
|
|
251
|
+
* place on clear floor ({@link clearFire}), unless one of the state's fires is within 1.5 m (KB-FAULD-FIRELAMPS1).
|
|
185
252
|
*/
|
|
186
253
|
export declare function stateLights(state: FauldTunnelState): {
|
|
187
254
|
lamps: FauldLamp[];
|
|
@@ -198,6 +265,12 @@ export declare function stateLights(state: FauldTunnelState): {
|
|
|
198
265
|
* came from several filling stations and years, faded and dusty to different degrees (the depot photographs).
|
|
199
266
|
*/
|
|
200
267
|
export declare function paintTone(x: number, z: number): [number, number, number];
|
|
268
|
+
/**
|
|
269
|
+
* The lamps' share of the shadow maps beside `fires` large fires: each fire's light casts through one slot of six faces
|
|
270
|
+
* (`FlameOptions.castShadow`), taken after the lamps in the light list, so the lamps leave that many slots and their
|
|
271
|
+
* texels free (KB-VFX-FIRESHADOW1). At least one lamp keeps casting.
|
|
272
|
+
*/
|
|
273
|
+
export declare function lampShadowBudget(fires: number, film: boolean, viewer: ArrayLike<number>): ShadowBudgetOptions;
|
|
201
274
|
/**
|
|
202
275
|
* Builds the store (or its yard) in `engine`'s active scene.
|
|
203
276
|
* @throws RangeError for an unknown state or a time outside 0..600; Error for an asset that does not load.
|