@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.
Files changed (38) hide show
  1. package/LICENSE +201 -201
  2. package/NOTICE +4 -4
  3. package/README.md +620 -387
  4. package/dist/{dune-coast-info-e8eDZXBu.js → dune-coast-info-D9yQIv8G.js} +13 -3
  5. package/dist/dune-coast.d.ts +20 -1
  6. package/dist/dune-coast.js +374 -187
  7. package/dist/errors-fc4i1pSL.js +7 -0
  8. package/dist/fauld-blast.d.ts +119 -21
  9. package/dist/fauld-blast.js +957 -206
  10. package/dist/fauld-countryside.d.ts +1 -1
  11. package/dist/fauld-countryside.js +4 -4
  12. package/dist/fauld-crater.d.ts +1 -1
  13. package/dist/fauld-crater.js +4 -4
  14. package/dist/fauld-dig.d.ts +89 -0
  15. package/dist/fauld-dustfall-fines-grid-MA6XPrq6.js +14 -0
  16. package/dist/fauld-dustfall-fines-grid.d.ts +11 -0
  17. package/dist/fauld-dustfall-grid-Bb4X8b-u.js +14 -0
  18. package/dist/fauld-dustfall-grid.d.ts +11 -0
  19. package/dist/fauld-explosion.d.ts +135 -0
  20. package/dist/fauld-grains.d.ts +27 -0
  21. package/dist/fauld-mud.d.ts +104 -0
  22. package/dist/fauld-surge.d.ts +71 -0
  23. package/dist/fauld-tunnels.d.ts +76 -3
  24. package/dist/fauld-tunnels.js +518 -193
  25. package/dist/fauld-world-CNNSonJF.js +863 -0
  26. package/dist/fauld-world.d.ts +86 -3
  27. package/dist/index.js +2 -2
  28. package/dist/{library-mesh-BRk4Ycnn.js → library-mesh-CjTG-mVZ.js} +97 -74
  29. package/dist/library-parts.d.ts +11 -1
  30. package/dist/library.js +1 -1
  31. package/dist/look-family.d.ts +16 -1
  32. package/dist/look-family.js +35 -12
  33. package/dist/shared/settings.d.ts +89 -89
  34. package/dist/{timber-valley-info-BB6GvcsL.js → timber-valley-info-vVI2nwDs.js} +11 -0
  35. package/dist/timber-valley.d.ts +69 -3
  36. package/dist/timber-valley.js +198 -136
  37. package/package.json +106 -104
  38. package/dist/fauld-world-85dg03jo.js +0 -582
@@ -1,89 +1,89 @@
1
- /** A colour value: linear RGB. */
2
- export type SettingColor = readonly [number, number, number];
3
- /** One gradient stop: a colour at a position (`elevation` unless the row's `stopKey` says otherwise). */
4
- export type SettingStop = { readonly color: SettingColor };
5
- /** One value of a setting: a number, a colour, a choice, gradient stops, or null where `nullable`. */
6
- export type SettingValue = number | SettingColor | string | readonly SettingStop[] | null;
7
- /** Values by setting name; a name left out takes its default. */
8
- export type SettingValues = Readonly<Record<string, SettingValue>>;
9
- /** One slider row, the shape every package's `/settings` entry shares. */
10
- export interface SettingRow {
11
- readonly name: string;
12
- readonly group: string;
13
- /** `number` is a slider, `color` three sliders or a picker, `choice` a list, `gradient` a stop editor. */
14
- readonly kind: 'number' | 'color' | 'choice' | 'gradient';
15
- /** The value with which the target draws exactly as it does without the option (null: follow the weather). */
16
- readonly default: SettingValue;
17
- readonly min?: number;
18
- readonly max?: number;
19
- readonly step?: number;
20
- readonly choices?: readonly string[];
21
- /** May be null: the target uses its own value, or follows the weather when `weather` is set. */
22
- readonly nullable?: boolean;
23
- /** The weather master slider that drives this row while it is null. */
24
- readonly weather?: string;
25
- /** The key a gradient stop is placed by (default `elevation`). */
26
- readonly stopKey?: string;
27
- readonly unit: string;
28
- readonly about: string;
29
- /** True: cheap to write every frame (no pipeline, buffer or texture is created), so it can be keyed over a shot. False: writing it rebuilds something. */
30
- readonly live: boolean;
31
- }
32
- export declare const numberSetting: (
33
- name: string,
34
- group: string,
35
- value: number,
36
- min: number,
37
- max: number,
38
- step: number,
39
- unit: string,
40
- about: string,
41
- live?: boolean,
42
- ) => SettingRow;
43
- export declare const colorSetting: (
44
- name: string,
45
- group: string,
46
- value: SettingColor,
47
- min: number,
48
- max: number,
49
- about: string,
50
- live?: boolean,
51
- ) => SettingRow;
52
- export declare const choiceSetting: (
53
- name: string,
54
- group: string,
55
- choices: readonly string[],
56
- about: string,
57
- live?: boolean,
58
- ) => SettingRow;
59
- /** The row with a null default that follows the weather master slider `weather` until a value is given. */
60
- export declare const followsWeather: (row: SettingRow, weather: string) => SettingRow;
61
- /** Marks `key` of `target` as set by hand (`held` true) or hands it back to the weather (false). */
62
- export declare function holdFromWeather(target: object, key: string, held?: boolean): void;
63
- /** True while `key` of `target` holds a value set by hand, which the weather drive leaves alone. */
64
- export declare const heldFromWeather: (target: object, key: string) => boolean;
65
- export declare const sameSettingValue: (a: unknown, b: unknown) => boolean;
66
- export declare function copySettingValue(v: SettingValue): SettingValue;
67
- /** A fresh object holding every row at its default (a slider panel's state). */
68
- export declare function settingDefaults(rows: readonly SettingRow[]): Record<string, SettingValue>;
69
- /** The rows that may change every frame without a rebuild. */
70
- export declare const liveSettings: (rows: readonly SettingRow[]) => SettingRow[];
71
- /** A name to row map. */
72
- export declare const settingIndex: (rows: readonly SettingRow[]) => Map<string, SettingRow>;
73
- /** @throws RangeError when `v` is not a value of `row`. */
74
- export declare function checkSettingValue(row: SettingRow, v: unknown, label: string): void;
75
- /** @throws TypeError for an unknown name; RangeError for a bad value or a null on a row that is not nullable. */
76
- export declare function checkSettings(
77
- rows: readonly SettingRow[] | ReadonlyMap<string, SettingRow>,
78
- values: SettingValues,
79
- label: string,
80
- entry?: string,
81
- ): void;
82
- /** Checks `values`, then calls `write` once per row (or per row `only` accepts) with the given value or the default. */
83
- export declare function applySettings(
84
- rows: readonly SettingRow[],
85
- values: SettingValues,
86
- label: string,
87
- write: (row: SettingRow, value: SettingValue) => void,
88
- only?: (row: SettingRow) => boolean,
89
- ): void;
1
+ /** A colour value: linear RGB. */
2
+ export type SettingColor = readonly [number, number, number];
3
+ /** One gradient stop: a colour at a position (`elevation` unless the row's `stopKey` says otherwise). */
4
+ export type SettingStop = { readonly color: SettingColor };
5
+ /** One value of a setting: a number, a colour, a choice, gradient stops, or null where `nullable`. */
6
+ export type SettingValue = number | SettingColor | string | readonly SettingStop[] | null;
7
+ /** Values by setting name; a name left out takes its default. */
8
+ export type SettingValues = Readonly<Record<string, SettingValue>>;
9
+ /** One slider row, the shape every package's `/settings` entry shares. */
10
+ export interface SettingRow {
11
+ readonly name: string;
12
+ readonly group: string;
13
+ /** `number` is a slider, `color` three sliders or a picker, `choice` a list, `gradient` a stop editor. */
14
+ readonly kind: 'number' | 'color' | 'choice' | 'gradient';
15
+ /** The value with which the target draws exactly as it does without the option (null: follow the weather). */
16
+ readonly default: SettingValue;
17
+ readonly min?: number;
18
+ readonly max?: number;
19
+ readonly step?: number;
20
+ readonly choices?: readonly string[];
21
+ /** May be null: the target uses its own value, or follows the weather when `weather` is set. */
22
+ readonly nullable?: boolean;
23
+ /** The weather master slider that drives this row while it is null. */
24
+ readonly weather?: string;
25
+ /** The key a gradient stop is placed by (default `elevation`). */
26
+ readonly stopKey?: string;
27
+ readonly unit: string;
28
+ readonly about: string;
29
+ /** True: cheap to write every frame (no pipeline, buffer or texture is created), so it can be keyed over a shot. False: writing it rebuilds something. */
30
+ readonly live: boolean;
31
+ }
32
+ export declare const numberSetting: (
33
+ name: string,
34
+ group: string,
35
+ value: number,
36
+ min: number,
37
+ max: number,
38
+ step: number,
39
+ unit: string,
40
+ about: string,
41
+ live?: boolean,
42
+ ) => SettingRow;
43
+ export declare const colorSetting: (
44
+ name: string,
45
+ group: string,
46
+ value: SettingColor,
47
+ min: number,
48
+ max: number,
49
+ about: string,
50
+ live?: boolean,
51
+ ) => SettingRow;
52
+ export declare const choiceSetting: (
53
+ name: string,
54
+ group: string,
55
+ choices: readonly string[],
56
+ about: string,
57
+ live?: boolean,
58
+ ) => SettingRow;
59
+ /** The row with a null default that follows the weather master slider `weather` until a value is given. */
60
+ export declare const followsWeather: (row: SettingRow, weather: string) => SettingRow;
61
+ /** Marks `key` of `target` as set by hand (`held` true) or hands it back to the weather (false). */
62
+ export declare function holdFromWeather(target: object, key: string, held?: boolean): void;
63
+ /** True while `key` of `target` holds a value set by hand, which the weather drive leaves alone. */
64
+ export declare const heldFromWeather: (target: object, key: string) => boolean;
65
+ export declare const sameSettingValue: (a: unknown, b: unknown) => boolean;
66
+ export declare function copySettingValue(v: SettingValue): SettingValue;
67
+ /** A fresh object holding every row at its default (a slider panel's state). */
68
+ export declare function settingDefaults(rows: readonly SettingRow[]): Record<string, SettingValue>;
69
+ /** The rows that may change every frame without a rebuild. */
70
+ export declare const liveSettings: (rows: readonly SettingRow[]) => SettingRow[];
71
+ /** A name to row map. */
72
+ export declare const settingIndex: (rows: readonly SettingRow[]) => Map<string, SettingRow>;
73
+ /** @throws RangeError when `v` is not a value of `row`. */
74
+ export declare function checkSettingValue(row: SettingRow, v: unknown, label: string): void;
75
+ /** @throws TypeError for an unknown name; RangeError for a bad value or a null on a row that is not nullable. */
76
+ export declare function checkSettings(
77
+ rows: readonly SettingRow[] | ReadonlyMap<string, SettingRow>,
78
+ values: SettingValues,
79
+ label: string,
80
+ entry?: string,
81
+ ): void;
82
+ /** Checks `values`, then calls `write` once per row (or per row `only` accepts) with the given value or the default. */
83
+ export declare function applySettings(
84
+ rows: readonly SettingRow[],
85
+ values: SettingValues,
86
+ label: string,
87
+ write: (row: SettingRow, value: SettingValue) => void,
88
+ only?: (row: SettingRow) => boolean,
89
+ ): void;
@@ -63,6 +63,12 @@ var e = {
63
63
  unit: "s",
64
64
  about: "seconds the fire has burned when the scene opens"
65
65
  },
66
+ grassMoisture: {
67
+ default: .3,
68
+ range: [.3, 2.5],
69
+ unit: "fraction",
70
+ about: "live moisture of the grass (dry weight): 0.3 cured straw (the 1910 drought) up to 2.5 at green-up"
71
+ },
66
72
  houses: {
67
73
  default: 48,
68
74
  range: [0, 256],
@@ -76,6 +82,11 @@ var e = {
76
82
  seed: {
77
83
  default: 1910,
78
84
  about: "seed of the valley, forest, town and embers"
85
+ },
86
+ standSeed: {
87
+ default: 0,
88
+ range: [0, 4294967295],
89
+ about: "restocks the forest on the same valley: 1 or more reseeds where trees stand and their meshes; 0 the valley own"
79
90
  }
80
91
  },
81
92
  presets: {
@@ -12,7 +12,10 @@ import { WeatherDrive } from '@margoengine/weather/drive';
12
12
  import { FireFront } from '@margoengine/vfx/fire-front';
13
13
  import { Shadows } from '@margoengine/shadows';
14
14
  import { GTAO } from '@margoengine/post/gtao';
15
- import { type LookFamilyName } from './look-family.js';
15
+ import { Grade } from '@margoengine/tonemap/grade';
16
+ import type { TAA } from '@margoengine/taa';
17
+ import type { MotionBlur } from '@margoengine/post/motion-blur';
18
+ import { type LookFamilyName, type LookFamilyTargets } from './look-family.js';
16
19
  import type { SceneShot } from './index.js';
17
20
  /** Settings of {@link attach}. Every one has a default; the defaults are the blowup afternoon of 20 August 1910. */
18
21
  export interface TimberValleySettings {
@@ -36,10 +39,20 @@ export interface TimberValleySettings {
36
39
  readonly weather?: 'calm' | 'redFlag' | 'blowup' | 'smoke';
37
40
  /** Compass direction the wind blows FROM, degrees (0 north, 90 east). Default 225 (the south-west gale). */
38
41
  readonly windFrom?: number;
39
- /** `none`, `running` (burning for `fireTime` seconds) or `burnt` (run until nothing burns). Default `running`. */
42
+ /** `none`, `running` (burning for `fireTime` seconds) or `burnt` (run until nothing burns, `burnOut`; days of fire time). Default `running`. */
40
43
  readonly fire?: 'none' | 'running' | 'burnt';
41
44
  /** Seconds the fire has burned when the scene opens, 0 to 21,600. Default 1,800. */
42
45
  readonly fireTime?: number;
46
+ /**
47
+ * Live herbaceous fuel moisture of the grass, a fraction of dry weight, 0.3 to 2.5: it sets the share of cured,
48
+ * straw-coloured blades (`herbaceousCuring` of `@margoengine/biomes/fuel`, the load transfer of Scott and Burgan 2005:
49
+ * all living at 1.2 and above, all cured at 0.3). Default 0.3: the summer of 1910 was the driest the northern Rockies
50
+ * had known (Pyne 2001; Koch 1942), and pinegrass is dormant by midsummer (D. G. Stout, A. McLean, B. Brooke and J. W. Hall, Journal of Range
51
+ * Management 33(4), 1980, 286-291, https://doi.org/10.2307/3898075), at the 30 percent of cured herbaceous fuel
52
+ * (NWCG PMS 437, "Live fuel moisture content").
53
+ * A spring valley is near 2.5.
54
+ */
55
+ readonly grassMoisture?: number;
43
56
  /** Town lots along the rail line, 0 to 256. They are fuel and fire obstacles; no building is drawn. Default 48. */
44
57
  readonly houses?: number;
45
58
  /**
@@ -51,6 +64,12 @@ export interface TimberValleySettings {
51
64
  readonly quality?: 'film' | 'preview';
52
65
  /** Seed of the valley, the forest, the town and the embers. Default 1910. */
53
66
  readonly seed?: number;
67
+ /**
68
+ * Restocks the forest on the same valley (KB-BIOMES-STANDSEED1): 1 or more reseeds where the trees stand and their
69
+ * meshes' own randomness (`BiomeViewOptions.standSeed`), keeping the ground, town, cameras and fire. Default 0, the
70
+ * valley's own stand.
71
+ */
72
+ readonly standSeed?: number;
54
73
  /** Aborts loading. */
55
74
  readonly signal?: AbortSignal;
56
75
  }
@@ -111,7 +130,11 @@ export interface TimberValleyScene extends Disposable {
111
130
  readonly layout: TimberValleyLayout;
112
131
  /** Applies a look family to every part. */
113
132
  applyLook(name: LookFamilyName): void;
114
- /** Writes per-shot rows: `{weather: {...}, sky: {...}, fire: {...}}`, each through its package's apply function. */
133
+ /**
134
+ * Writes per-shot rows: `{weather: {...}, sky: {...}, fire: {...}}`, each through its package's apply function. The sky
135
+ * rows go over the look family in use (`applyFamilySky`): a row left out keeps the family's value, and the sun, the
136
+ * cloud layer and the exposure stay the scene's unless a row names them.
137
+ */
115
138
  applySettings(values: Readonly<Record<string, Readonly<Record<string, unknown>>>>): void;
116
139
  /** Moves the scene's own time on (fire, sky): use for film frames instead of wall-clock time. */
117
140
  advanceTime(seconds: number): void;
@@ -121,6 +144,8 @@ export interface TimberValleyScene extends Disposable {
121
144
  readonly world: BiomeWorld;
122
145
  readonly view: BiomeView;
123
146
  readonly preset: PresetScene;
147
+ /** The colour grade in the preset's Tonemap (its first extension): the look family's and the sky rows' `grade.*`. */
148
+ readonly grade: Grade;
124
149
  readonly clouds: VolumetricClouds;
125
150
  readonly weather: WeatherMachine;
126
151
  readonly drive: WeatherDrive;
@@ -128,6 +153,22 @@ export interface TimberValleyScene extends Disposable {
128
153
  readonly occlusion: GTAO;
129
154
  readonly fuel: FuelMap;
130
155
  readonly fireFront?: FireFront;
156
+ /**
157
+ * Temporal anti-aliasing of the `film` quality (`@margoengine/taa`, its defaults: history weight 0.9, the
158
+ * silhouette history of KB-TAA-EDGE1), reading the post stack's depth, with every swaying scatter of the view in its
159
+ * velocity pass (`BiomeObjects.swaying`, `@margoengine/scatter/velocity`) so swaying leaves keep their history; the
160
+ * flames, smoke, weather and water mark their pixels reactive themselves, and the clouds' march moves its start
161
+ * each frame for it (`temporal: 'auto'`). Undefined at `preview`.
162
+ */
163
+ readonly taa?: TAA;
164
+ /**
165
+ * Motion blur of the `film` quality (`@margoengine/post/motion-blur`, the reconstruction filter of McGuire et al.
166
+ * 2012) on TAA's resolved frame with TAA's velocity, a 180 degree shutter (`shutter` 0.5) by default. A shot drawn
167
+ * in sub-frames sets `shutter` per sub-frame to its share of the motion since the frame before (the shot tool's
168
+ * `page.shutter` hook, `shutterShare`), so each sub-frame blurs over its own slice of the shutter and the copies
169
+ * join with no steps (KB-LOOK-TV-SUBSTEP1). Undefined at `preview`.
170
+ */
171
+ readonly motionBlur?: MotionBlur;
131
172
  };
132
173
  dispose(): void;
133
174
  }
@@ -141,6 +182,19 @@ export declare function weatherState(weather: Filled['weather'], windFrom: numbe
141
182
  export declare function layout(world: BiomeWorld, settings?: TimberValleySettings): TimberValleyLayout;
142
183
  /** The scene's world on the CPU (heights, climate, biomes), for placing subjects and cameras. */
143
184
  export declare function world(settings?: TimberValleySettings): Promise<BiomeWorld>;
185
+ /**
186
+ * What a look family writes in the valley: the sky with its clouds, the preset's Tonemap and its `grade` (the sky rows and
187
+ * the family's tonemap look, so the family's curve, vignette, dither and saturation reach the frame), and the water and
188
+ * fire where the valley has them. Until 2026-11-29 the Tonemap went only to the sky rows, which carry no curve, so every
189
+ * family left the valley on Tonemap's default Neutral curve with no vignette or dither (KB-SCENES-TVTONE1).
190
+ */
191
+ export declare function lookTargets(parts: {
192
+ readonly preset: Pick<PresetScene, 'sky' | 'tonemap'>;
193
+ readonly grade: Grade;
194
+ readonly clouds: VolumetricClouds;
195
+ readonly water?: LookFamilyTargets['water'];
196
+ readonly fireFront?: FireFront;
197
+ }): LookFamilyTargets;
144
198
  /**
145
199
  * Builds the scene into `engine`: sky, clouds, weather, the valley and its forest, the town lots, and the fire.
146
200
  * @throws TypeError or RangeError for bad settings, before anything is built.
@@ -149,6 +203,18 @@ export declare function world(settings?: TimberValleySettings): Promise<BiomeWor
149
203
  * scene.view('ridge');
150
204
  */
151
205
  export declare function attach(engine: EngineKernel, settings?: TimberValleySettings): Promise<TimberValleyScene>;
206
+ /** The most fire time `fire: 'burnt'` runs while waiting for the fire to go out, seconds: 30 days. */
207
+ export declare const BURN_OUT_LIMIT: number;
208
+ /**
209
+ * Runs a fire until nothing burns and no ember waits (`settle`), for `fire: 'burnt'`, and resolves with its fire time.
210
+ * A surface fire in this valley's timber litter runs on for days (about 2 days of fire time on the 8 m grid): until
211
+ * 2026-11-27 the scene stopped it after one, so the burned valley still burned (KB-VFX-DARKTRAILS1). Throws a coded
212
+ * error, never a picture of a fire still burning, if it has not gone out by {@link BURN_OUT_LIMIT}; `signal` aborts it.
213
+ */
214
+ export declare function burnOut(fire: {
215
+ settle(maxSeconds: number, signal?: AbortSignal): Promise<number>;
216
+ readonly active: boolean;
217
+ }, signal?: AbortSignal): Promise<number>;
152
218
  /**
153
219
  * Runs a fire's past `seconds` with its weather: the drive and the front step together in 10 s steps, so the front has
154
220
  * the weather's wind and the fuel dried by its humidity and temperature from its first second (stepped alone, a front