@margoengine/scenes 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +387 -3
- package/dist/dune-coast-info-e8eDZXBu.js +208 -0
- package/dist/dune-coast-info.d.ts +3 -0
- package/dist/dune-coast.d.ts +160 -0
- package/dist/dune-coast.js +591 -0
- package/dist/fauld-blast.d.ts +67 -0
- package/dist/fauld-blast.js +283 -0
- package/dist/fauld-countryside.d.ts +13 -0
- package/dist/fauld-countryside.js +10 -0
- package/dist/fauld-crater.d.ts +13 -0
- package/dist/fauld-crater.js +10 -0
- package/dist/fauld-tunnels-info-8qv9X4OJ.js +70 -0
- package/dist/fauld-tunnels-info.d.ts +5 -0
- package/dist/fauld-tunnels-plan.d.ts +1069 -0
- package/dist/fauld-tunnels.d.ts +208 -0
- package/dist/fauld-tunnels.js +6476 -0
- package/dist/fauld-world-85dg03jo.js +582 -0
- package/dist/fauld-world-info.d.ts +7 -0
- package/dist/fauld-world.d.ts +160 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +160 -0
- package/dist/library-mesh-BRk4Ycnn.js +306 -0
- package/dist/library-mesh.d.ts +108 -0
- package/dist/library-parts.d.ts +45 -0
- package/dist/library.d.ts +52 -0
- package/dist/library.js +48 -0
- package/dist/look-family.d.ts +48 -0
- package/dist/look-family.js +34 -0
- package/dist/shared/settings.d.ts +89 -0
- package/dist/shot-settings.d.ts +40 -0
- package/dist/shot-settings.js +94 -0
- package/dist/timber-valley-info-BB6GvcsL.js +242 -0
- package/dist/timber-valley-info.d.ts +3 -0
- package/dist/timber-valley.d.ts +163 -0
- package/dist/timber-valley.js +362 -0
- package/package.json +104 -6
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" preserve="true" />
|
|
2
|
+
import type { EngineKernel, Vec3 } from '@margoengine/core';
|
|
3
|
+
import { Clustered, type PointLight, type SpotLight } from '@margoengine/clustered';
|
|
4
|
+
import { LocalShadows } from '@margoengine/clustered/shadows';
|
|
5
|
+
import { LightGroups } from '@margoengine/clustered/groups';
|
|
6
|
+
import { VolumetricFog } from '@margoengine/environment/volumetric';
|
|
7
|
+
import { PostStack } from '@margoengine/post/stack';
|
|
8
|
+
import { GTAO } from '@margoengine/post/gtao';
|
|
9
|
+
import { Bloom } from '@margoengine/post/bloom';
|
|
10
|
+
import { DOF } from '@margoengine/dof';
|
|
11
|
+
import { Tonemap } from '@margoengine/tonemap';
|
|
12
|
+
import { Fire } from '@margoengine/vfx/fire';
|
|
13
|
+
import { Smoke } from '@margoengine/vfx/smoke';
|
|
14
|
+
import { FAULD_TUNNEL_STATES, fauldTunnelsInfo } from './fauld-tunnels-info.js';
|
|
15
|
+
export { fauldTunnelsInfo as info, FAULD_TUNNEL_STATES };
|
|
16
|
+
/** A lighting state of the store. */
|
|
17
|
+
export type FauldTunnelState = (typeof FAULD_TUNNEL_STATES)[number];
|
|
18
|
+
/** Settings of {@link attach}. Every one has a default: the store at work on the morning of 27 November 1944. */
|
|
19
|
+
export interface FauldTunnelsSettings {
|
|
20
|
+
/** Lighting state. Default `working`. */
|
|
21
|
+
readonly state?: FauldTunnelState;
|
|
22
|
+
/** Seconds of the state when the scene opens (fire, smoke). Default 0. */
|
|
23
|
+
readonly time?: number;
|
|
24
|
+
/** `film` (1,024 texel lamp shadows, fine fog grid) or `preview`. Default `film`. */
|
|
25
|
+
readonly quality?: 'film' | 'preview';
|
|
26
|
+
/** URL root of the asset library holding the `fauld-1944` and `big-burn-1910` subjects. Default `/asset-library/`. */
|
|
27
|
+
readonly library?: string;
|
|
28
|
+
/** Aborts loading. */
|
|
29
|
+
readonly signal?: AbortSignal;
|
|
30
|
+
}
|
|
31
|
+
/** A named place of the plan: where it is (metres, Margo axes) and how big. */
|
|
32
|
+
export interface FauldMark {
|
|
33
|
+
readonly position: Vec3;
|
|
34
|
+
readonly size: number;
|
|
35
|
+
}
|
|
36
|
+
/** The scene handle from {@link attach}. */
|
|
37
|
+
export interface FauldTunnelsScene extends Disposable {
|
|
38
|
+
readonly settings: Readonly<Required<Omit<FauldTunnelsSettings, 'signal'>>>;
|
|
39
|
+
/** Every mark of the plan, in Margo axes. */
|
|
40
|
+
readonly marks: Readonly<Record<string, FauldMark>>;
|
|
41
|
+
/** Plan metres (+X in, +Y north, Z up) to Margo axes. */
|
|
42
|
+
toWorld(x: number, y: number, z: number): Vec3;
|
|
43
|
+
/** Puts the camera at `from` looking at `to` with a lens of `focal` mm on a 36 mm wide 16:9 frame, focus on `to`. */
|
|
44
|
+
frame(from: Vec3, to: Vec3, focal: number, fStop?: number): void;
|
|
45
|
+
/** Moves the scene's own time on (fire, smoke): film frames use this, never the wall clock. */
|
|
46
|
+
advanceTime(seconds: number): void;
|
|
47
|
+
/** The state's exposure, EV100 (one per state, metered on a white card at its key mark). */
|
|
48
|
+
readonly ev100: number;
|
|
49
|
+
/** Models loaded, instances drawn and lamps lit (for checks). */
|
|
50
|
+
readonly counts: {
|
|
51
|
+
readonly models: number;
|
|
52
|
+
readonly instances: number;
|
|
53
|
+
readonly lamps: number;
|
|
54
|
+
readonly shadowed: number;
|
|
55
|
+
};
|
|
56
|
+
readonly parts: {
|
|
57
|
+
readonly lights: Clustered;
|
|
58
|
+
readonly groups: LightGroups;
|
|
59
|
+
readonly shadows: LocalShadows;
|
|
60
|
+
readonly fog: VolumetricFog;
|
|
61
|
+
readonly occlusion: GTAO;
|
|
62
|
+
readonly dof: DOF;
|
|
63
|
+
readonly bloom: Bloom;
|
|
64
|
+
readonly tonemap: Tonemap;
|
|
65
|
+
readonly stack: PostStack;
|
|
66
|
+
readonly fires: readonly Fire[];
|
|
67
|
+
readonly smokes: readonly Smoke[];
|
|
68
|
+
};
|
|
69
|
+
dispose(): void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Lamp catalogue (lighting plan): Osram-GEC coiled coil, 2700 K. Lumens per lamp.
|
|
73
|
+
*/
|
|
74
|
+
export declare const FAULD_LAMPS: {
|
|
75
|
+
readonly w40: 400;
|
|
76
|
+
readonly w60: 690;
|
|
77
|
+
readonly w100: 1250;
|
|
78
|
+
readonly handlamp: 40;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* The mains fitting, `tn_wellglass` (channel-films tunnels_kit_blender.py `well_glass`, a 1940s well-glass bulkhead):
|
|
82
|
+
* a 60 or 100 W GLS lamp inside a 140 mm opal well glass. The glowing part a camera sees is the globe, not the 30 mm
|
|
83
|
+
* filament bulb (an opal or frosted globe diffuses the filament over its whole surface), so the globe is the lamp's
|
|
84
|
+
* emitter: the light's `radius` is the globe's, measured on the model (its TN_Paper glass spans x and z -0.07 to
|
|
85
|
+
* 0.07 about the pivot), and its radiance is the lamp's candela over the globe's projected area, the lumens
|
|
86
|
+
* unchanged (KB-FAULD-GLOBE1). A 30 mm bulb at 2700 K reads about 26,000 to 28,500 in the pre-exposed frame, inside
|
|
87
|
+
* half-float range but without the headroom bloom and the white balance need; the globe, 0.07 m, about 4,700 to 6,700.
|
|
88
|
+
*/
|
|
89
|
+
export declare const WELL_GLASS_RADIUS = 0.07;
|
|
90
|
+
/**
|
|
91
|
+
* The cradle's work lamp hangs in a 12.5 in deep bowl (concentrating) reflector (tunnels_kit_blender.py DEEP_DISH, rim
|
|
92
|
+
* radius 0.16 m): seen from under the beam the whole mouth of the bowl is bright with the lamp's image, so the
|
|
93
|
+
* mouth is the emitter (it was 0.02, a hand lamp's).
|
|
94
|
+
*/
|
|
95
|
+
export declare const DEEP_BOWL_RADIUS = 0.16;
|
|
96
|
+
/** Lamps at or over this plan height (m) hang in a well-glass fitting; lower ones are lanterns and work lamps. */
|
|
97
|
+
export declare const HUNG_Z = 2;
|
|
98
|
+
/** The model of the mains fitting, its pivot at the globe's centre (the light's place), the conduit up to the arch. */
|
|
99
|
+
export declare const WELL_GLASS_ASSET = "fauld-1944/tunnels/tn_wellglass";
|
|
100
|
+
/**
|
|
101
|
+
* A rescuer's hand lamp emits through its lens: 104 mm across on the period battery hand lamp of the kit
|
|
102
|
+
* (tunnels_kit_blender.py `handlamp`, the lens TN_Water spans -0.052 to 0.052), so its light's radius is the lens's
|
|
103
|
+
* (it was 0.02, a 40 mm source that put the lens 6.8 times over its real radiance; KB-FAULD-GLOBE1).
|
|
104
|
+
*/
|
|
105
|
+
export declare const HANDLAMP_LENS_RADIUS = 0.052;
|
|
106
|
+
/** Light output ratio of a caged bulkhead fitting (lower hemisphere): judgement, lighting plan. */
|
|
107
|
+
export declare const BULKHEAD_OUTPUT = 0.65;
|
|
108
|
+
/**
|
|
109
|
+
* EV100 per state: a white card at the state's key mark reads 1.0 (lighting plan, step 2; channel-films
|
|
110
|
+
* tunnels_light.key_cards). Working: the card 2.5 m along vault S from its second lamp, 1.2 m up. After, flooded and
|
|
111
|
+
* sealed: a card 2 m along the first rescuer's hand lamp's beam, facing it, as the plan's key_after; they were set to 1
|
|
112
|
+
* by hand when the hand lamps were lifted to chest height, which left that card reading 7.4 (2.9 stops over) and put
|
|
113
|
+
* every lamp's glass over the half-float headroom (KB-FAULD-GLOBE1). The night yard: 1.75 m along the yard lamp's beam
|
|
114
|
+
* (it read 1.33 at 1.5). Fire is metered on its flames and the blast clips on purpose; daylight overcast November
|
|
115
|
+
* about 12.
|
|
116
|
+
*/
|
|
117
|
+
export declare const FAULD_STATE_EV: Readonly<Record<FauldTunnelState, number>>;
|
|
118
|
+
/**
|
|
119
|
+
* 2700 K tungsten in linear sRGB, scaled to luminance 1 so a lamp's candela are its photometric value: the blackbody's
|
|
120
|
+
* sRGB (255, 169, 87) (Charity, "What color is a blackbody?", 2001, D65 white) decoded to linear (1, 0.397, 0.095),
|
|
121
|
+
* over its luminance 0.2126 + 0.7152 x 0.397 + 0.0722 x 0.095 = 0.505.
|
|
122
|
+
*/
|
|
123
|
+
export declare const TUNGSTEN_2700: Vec3;
|
|
124
|
+
/** The detonation flash of the blast state, candela (see the blast lamps in `attach`). */
|
|
125
|
+
export declare const BLAST_FLASH_CD = 1900000;
|
|
126
|
+
/**
|
|
127
|
+
* The colour of the detonation flash: a 3,000 K blackbody in linear sRGB, scaled to luminance 1 (blackbodyColor of
|
|
128
|
+
* @margoengine/math). Post-detonation fireballs of high explosive radiate at about 3,000 to 3,500 K (Lewis and
|
|
129
|
+
* Rumchik, "Measurement of apparent temperature in post-detonation fireballs using atomic emission spectroscopy",
|
|
130
|
+
* J. Appl. Phys. 105, 2009), so the flash reads hot white-orange through the store's 3,200 K balance. It was
|
|
131
|
+
* [1, 0.93, 0.82], about 5,000 K, which that balance turned steel blue (KB-FAULD-BLASTBLUE1).
|
|
132
|
+
*/
|
|
133
|
+
export declare const BLAST_FLASH_COLOR: Vec3;
|
|
134
|
+
type Extra = {
|
|
135
|
+
scale?: number;
|
|
136
|
+
pitch?: number;
|
|
137
|
+
roll?: number;
|
|
138
|
+
ground?: boolean;
|
|
139
|
+
dz?: number;
|
|
140
|
+
avoid?: readonly (readonly number[])[];
|
|
141
|
+
aim?: readonly number[];
|
|
142
|
+
cone?: number;
|
|
143
|
+
rgb?: readonly number[];
|
|
144
|
+
fire?: boolean;
|
|
145
|
+
};
|
|
146
|
+
type LineRow = readonly [string, string, number, number, number, number, number, Extra?];
|
|
147
|
+
type BulbRow = readonly [string, readonly number[], readonly number[], number, Extra?];
|
|
148
|
+
type FxRow = readonly [string, string, number, number, number, number];
|
|
149
|
+
/** Plan metres to Margo axes: (x, z, -y). */
|
|
150
|
+
export declare const toWorld: (x: number, y: number, z: number) => Vec3;
|
|
151
|
+
/** Column-major matrix of a plan placement: yaw about up, then pitch, then roll (Unreal's rotator order), scale. */
|
|
152
|
+
export declare function placement(x: number, y: number, z: number, yaw?: number, pitch?: number, roll?: number, s?: number): number[];
|
|
153
|
+
/** Points of a line row: from `from` toward `to` every `every` metres (both ends), minus `avoid` circles. */
|
|
154
|
+
export declare function linePoints(row: LineRow): {
|
|
155
|
+
x: number;
|
|
156
|
+
y: number;
|
|
157
|
+
yaw: number;
|
|
158
|
+
}[];
|
|
159
|
+
/** Every lamp position of a bulb row (from, to, every). */
|
|
160
|
+
export declare function bulbPoints(row: BulbRow): number[][];
|
|
161
|
+
/** What a state draws: its pieces by asset (plan rows), its lamps and its fire and smoke. */
|
|
162
|
+
export declare function dressState(state: FauldTunnelState): {
|
|
163
|
+
pieces: Map<string, number[][]>;
|
|
164
|
+
lamps: {
|
|
165
|
+
run: string;
|
|
166
|
+
at: number[];
|
|
167
|
+
extra?: Extra;
|
|
168
|
+
}[];
|
|
169
|
+
fx: readonly FxRow[];
|
|
170
|
+
};
|
|
171
|
+
/** A lamp of a state, ready for `Clustered`: pre-exposed (see {@link stateLights}). */
|
|
172
|
+
export type FauldLamp = PointLight | SpotLight;
|
|
173
|
+
/**
|
|
174
|
+
* The lights of a state, pre-exposed: every intensity is its photometric candela times the state's exposure
|
|
175
|
+
* (`exposureFromEV100` of {@link FAULD_STATE_EV}), so the frame holds display values and the tonemap adds no exposure.
|
|
176
|
+
* Absolute luminance does not fit the half-float colour target: a 100 W bulb's glass is about 50,000 cd/m2 and its
|
|
177
|
+
* red channel at 2700 K about 100,000, past half-float's 65,504, which clipped red alone and turned the bulbs and their
|
|
178
|
+
* glow white-green under the 3200 K white balance (KB-FAULD-BULBHUE1; Lagarde and de Rousiers, "Moving Frostbite to
|
|
179
|
+
* Physically Based Rendering", SIGGRAPH 2014, section 5.1: pre-exposed lighting for half-float targets). The vfx
|
|
180
|
+
* flames are in display units already (their radiance is shown through an exposure, `@margoengine/vfx/flame`), so
|
|
181
|
+
* they now light at their own scale beside the lamps instead of 1.3 to 4.3 stops under them (KB-FAULD-FIREDARK1).
|
|
182
|
+
* Hand lamps, lanterns and sparks are 2700 K filaments (the plan carried Unreal's [1, 0.82, 0.6], about 3,800 K,
|
|
183
|
+
* 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).
|
|
185
|
+
*/
|
|
186
|
+
export declare function stateLights(state: FauldTunnelState): {
|
|
187
|
+
lamps: FauldLamp[];
|
|
188
|
+
glass: Vec3[];
|
|
189
|
+
fires: {
|
|
190
|
+
at: readonly number[];
|
|
191
|
+
scale: number;
|
|
192
|
+
}[];
|
|
193
|
+
exposure: number;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* The paint of one casing stack at plan place (x, z): a tone 0.86 to 1.08 and a warm or cool shift up to 3%, from a hash
|
|
197
|
+
* of the place, so neighbours differ and the same stack keeps its paint in every state and frame. Batches of casings
|
|
198
|
+
* came from several filling stations and years, faded and dusty to different degrees (the depot photographs).
|
|
199
|
+
*/
|
|
200
|
+
export declare function paintTone(x: number, z: number): [number, number, number];
|
|
201
|
+
/**
|
|
202
|
+
* Builds the store (or its yard) in `engine`'s active scene.
|
|
203
|
+
* @throws RangeError for an unknown state or a time outside 0..600; Error for an asset that does not load.
|
|
204
|
+
* @example
|
|
205
|
+
* const scene = await attach(engine, { state: 'working', library: '/asset-library/' });
|
|
206
|
+
* scene.frame(scene.marks.c_fd004_a.position, scene.marks.racks.position, 24);
|
|
207
|
+
*/
|
|
208
|
+
export declare function attach(engine: EngineKernel, settings?: FauldTunnelsSettings): Promise<FauldTunnelsScene>;
|