@margoengine/scenes 0.0.0-stage → 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 (48) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +4 -0
  3. package/README.md +619 -2
  4. package/dist/dune-coast-info-D9yQIv8G.js +218 -0
  5. package/dist/dune-coast-info.d.ts +3 -0
  6. package/dist/dune-coast.d.ts +179 -0
  7. package/dist/dune-coast.js +778 -0
  8. package/dist/errors-fc4i1pSL.js +7 -0
  9. package/dist/fauld-blast.d.ts +165 -0
  10. package/dist/fauld-blast.js +1034 -0
  11. package/dist/fauld-countryside.d.ts +13 -0
  12. package/dist/fauld-countryside.js +10 -0
  13. package/dist/fauld-crater.d.ts +13 -0
  14. package/dist/fauld-crater.js +10 -0
  15. package/dist/fauld-dig.d.ts +89 -0
  16. package/dist/fauld-dustfall-fines-grid-MA6XPrq6.js +14 -0
  17. package/dist/fauld-dustfall-fines-grid.d.ts +11 -0
  18. package/dist/fauld-dustfall-grid-Bb4X8b-u.js +14 -0
  19. package/dist/fauld-dustfall-grid.d.ts +11 -0
  20. package/dist/fauld-explosion.d.ts +135 -0
  21. package/dist/fauld-grains.d.ts +27 -0
  22. package/dist/fauld-mud.d.ts +104 -0
  23. package/dist/fauld-surge.d.ts +71 -0
  24. package/dist/fauld-tunnels-info-8qv9X4OJ.js +70 -0
  25. package/dist/fauld-tunnels-info.d.ts +5 -0
  26. package/dist/fauld-tunnels-plan.d.ts +1069 -0
  27. package/dist/fauld-tunnels.d.ts +281 -0
  28. package/dist/fauld-tunnels.js +6801 -0
  29. package/dist/fauld-world-CNNSonJF.js +863 -0
  30. package/dist/fauld-world-info.d.ts +7 -0
  31. package/dist/fauld-world.d.ts +243 -0
  32. package/dist/index.d.ts +53 -0
  33. package/dist/index.js +160 -0
  34. package/dist/library-mesh-CjTG-mVZ.js +329 -0
  35. package/dist/library-mesh.d.ts +108 -0
  36. package/dist/library-parts.d.ts +55 -0
  37. package/dist/library.d.ts +52 -0
  38. package/dist/library.js +48 -0
  39. package/dist/look-family.d.ts +63 -0
  40. package/dist/look-family.js +57 -0
  41. package/dist/shared/settings.d.ts +89 -0
  42. package/dist/shot-settings.d.ts +40 -0
  43. package/dist/shot-settings.js +94 -0
  44. package/dist/timber-valley-info-vVI2nwDs.js +253 -0
  45. package/dist/timber-valley-info.d.ts +3 -0
  46. package/dist/timber-valley.d.ts +229 -0
  47. package/dist/timber-valley.js +424 -0
  48. package/package.json +104 -4
@@ -0,0 +1,218 @@
1
+ //#region src/dune-coast-info.ts
2
+ var e = {
3
+ name: "dune-coast",
4
+ title: "Dune coast (Kill Devil Hills, 17 December 1903)",
5
+ about: "A winter barrier-island coast: bare sand flat, hummocks with sparse grass, a big dune, board sheds, a launch rail, the foredune and Atlantic surf, under a grey sky.",
6
+ entry: "@margoengine/scenes/dune-coast",
7
+ settings: {
8
+ date: {
9
+ default: "1903-12-17",
10
+ about: "calendar date, YYYY-MM-DD"
11
+ },
12
+ hour: {
13
+ default: 10.6,
14
+ range: [0, 24],
15
+ unit: "h",
16
+ about: "local solar time"
17
+ },
18
+ latitude: {
19
+ default: 36.02,
20
+ range: [-90, 90],
21
+ unit: "deg",
22
+ about: "latitude north"
23
+ },
24
+ weather: {
25
+ default: "overcast",
26
+ options: ["overcast", "clear"],
27
+ about: "grey diffuse sky or sun and cloud"
28
+ },
29
+ visibility: {
30
+ default: 6e3,
31
+ range: [500, 5e4],
32
+ unit: "m",
33
+ about: "haze distance"
34
+ },
35
+ wind: {
36
+ default: 11,
37
+ range: [0, 25],
38
+ unit: "m/s",
39
+ about: "wind speed"
40
+ },
41
+ windFrom: {
42
+ default: 0,
43
+ range: [0, 360],
44
+ unit: "deg",
45
+ about: "compass direction the wind blows from"
46
+ },
47
+ sand: {
48
+ default: [
49
+ .5,
50
+ .42,
51
+ .29
52
+ ],
53
+ about: "dry sand albedo, linear RGB"
54
+ },
55
+ grass: {
56
+ default: .5,
57
+ range: [0, 1],
58
+ about: "share of ground in grass patches"
59
+ },
60
+ grassColor: {
61
+ default: [
62
+ .36,
63
+ .31,
64
+ .16
65
+ ],
66
+ about: "dune grass albedo, linear RGB"
67
+ },
68
+ grassHeight: {
69
+ default: .8,
70
+ range: [.2, 2],
71
+ unit: "m",
72
+ about: "tallest dune grass leaf"
73
+ },
74
+ grassBlades: {
75
+ default: 30,
76
+ range: [4, 64],
77
+ about: "leaves to a grass clump"
78
+ },
79
+ grassVariety: {
80
+ default: .035,
81
+ range: [0, .2],
82
+ about: "hue spread between grass clumps"
83
+ },
84
+ grassTranslucency: {
85
+ default: 0,
86
+ range: [0, 1],
87
+ about: "sunlight seen through the grass leaves"
88
+ },
89
+ grassWidth: {
90
+ default: .016,
91
+ range: [.004, .05],
92
+ unit: "m",
93
+ about: "grass leaf width at the root"
94
+ },
95
+ hill: {
96
+ default: 30,
97
+ range: [0, 40],
98
+ unit: "m",
99
+ about: "big dune crest height"
100
+ },
101
+ crest: {
102
+ default: 0,
103
+ range: [0, 1],
104
+ about: "sharpness of the big dune brink"
105
+ },
106
+ sandBands: {
107
+ default: 0,
108
+ range: [0, 1],
109
+ about: "broad scour bands along the wind on the sand"
110
+ },
111
+ surf: {
112
+ default: 1.2,
113
+ range: [0, 3],
114
+ unit: "m",
115
+ about: "swell height at the beach"
116
+ },
117
+ camp: {
118
+ default: !0,
119
+ about: "camp sheds and launch rail"
120
+ },
121
+ boards: {
122
+ default: [
123
+ .258,
124
+ .205,
125
+ .147
126
+ ],
127
+ about: "shed wall boards and rail timber albedo, linear RGB"
128
+ },
129
+ roof: {
130
+ default: [
131
+ .258,
132
+ .205,
133
+ .147
134
+ ],
135
+ about: "shed roof boards albedo, linear RGB"
136
+ },
137
+ shedOverhang: {
138
+ default: .2,
139
+ range: [0, 1],
140
+ unit: "m",
141
+ about: "shed roof overhang"
142
+ },
143
+ shedWeathering: {
144
+ default: .5,
145
+ range: [0, 1],
146
+ about: "how weathered the shed boards are"
147
+ },
148
+ shedWindows: {
149
+ default: !1,
150
+ about: "windows in the hangar back wall and the shed ends"
151
+ },
152
+ occlusion: {
153
+ default: 1.5,
154
+ range: [0, 10],
155
+ unit: "m",
156
+ about: "ambient occlusion reach (GTAO), 0 for none"
157
+ },
158
+ footprints: {
159
+ default: 1,
160
+ range: [0, 1],
161
+ about: "depth of the footprints trodden round the camp, 0 for none"
162
+ },
163
+ scour: {
164
+ default: 1,
165
+ range: [0, 1],
166
+ about: "sand the wind has shaped round the sheds and grass, 0 for none"
167
+ },
168
+ blownSand: {
169
+ default: 0,
170
+ range: [0, 1],
171
+ about: "sand blowing off the crests and over the dry sand, 0 (none) to 1"
172
+ },
173
+ quality: {
174
+ default: "film",
175
+ options: ["film", "preview"],
176
+ about: "ground and grass detail"
177
+ },
178
+ seed: {
179
+ default: 1903,
180
+ about: "seed of hummocks and small dunes"
181
+ }
182
+ },
183
+ presets: {
184
+ "first-flight": {},
185
+ "clear-morning": {
186
+ weather: "clear",
187
+ visibility: 2e4
188
+ },
189
+ "calm-summer": {
190
+ date: "1903-07-15",
191
+ hour: 15,
192
+ weather: "clear",
193
+ wind: 3,
194
+ windFrom: 225,
195
+ surf: .5,
196
+ visibility: 25e3
197
+ }
198
+ },
199
+ anchors: [
200
+ "rail",
201
+ "camp",
202
+ "flightLine",
203
+ "bigHill",
204
+ "beach"
205
+ ],
206
+ views: [
207
+ "first-flight",
208
+ "camp-buildings",
209
+ "killdevil-from-flat",
210
+ "flyer-on-rail",
211
+ "killdevil-back",
212
+ "landing-rail-view",
213
+ "surf",
214
+ "crest"
215
+ ]
216
+ };
217
+ //#endregion
218
+ export { e as t };
@@ -0,0 +1,3 @@
1
+ import type { SceneInfo } from './index.js';
2
+ /** The catalogue entry of this scene. */
3
+ export declare const duneCoastInfo: SceneInfo;
@@ -0,0 +1,179 @@
1
+ import { type EngineKernel, type Vec3 } from '@margoengine/core';
2
+ import { TerrainDeformation } from '@margoengine/terrain/deform';
3
+ import { PresetScene } from '@margoengine/sky/scenes';
4
+ import { Water } from '@margoengine/water';
5
+ import { GrassScatter } from '@margoengine/scatter/grass';
6
+ import { Shadows } from '@margoengine/shadows';
7
+ import { GTAO } from '@margoengine/post/gtao';
8
+ import type { BlownSand } from '@margoengine/vfx/blown-sand';
9
+ /** Heights to build the ground from, such as a USGS 3DEP bare-earth grid: metres, row by row along x (east). */
10
+ export interface DuneCoastHeights {
11
+ readonly samples: Float32Array;
12
+ readonly width: number;
13
+ readonly depth: number;
14
+ /** Metres between samples. Default 1. */
15
+ readonly cellSize?: number;
16
+ /** World x and z of the first sample (its north-west corner). Default: the grid centred on the rail. */
17
+ readonly origin?: readonly [number, number];
18
+ /** Heights at or below this are sea and are lowered under the water (3DEP reads the sea as 0). Default 0.05. */
19
+ readonly sea?: number;
20
+ }
21
+ /** Settings of {@link attach}. Every one has a default; the defaults are 17 December 1903 at Kill Devil Hills. */
22
+ export interface DuneCoastSettings {
23
+ /** Calendar date, `YYYY-MM-DD`. Default `1903-12-17`. */
24
+ readonly date?: string;
25
+ /** Local solar time, hours. Default 10.6 (10:35 eastern time at 75.67 W). */
26
+ readonly hour?: number;
27
+ /** Latitude, degrees north. Default 36.02. */
28
+ readonly latitude?: number;
29
+ /** `overcast` (the photographs' grey sky, diffuse light) or `clear` (sun and broken cloud). Default `overcast`. */
30
+ readonly weather?: 'overcast' | 'clear';
31
+ /** Distance at which the air hides 98 percent of the far view, metres, 500 to 50,000. Default 6,000 (sea haze). */
32
+ readonly visibility?: number;
33
+ /** Wind speed, m/s, 0 to 25. Default 11 (the 1903 morning: 20 to 27 mph from the north). */
34
+ readonly wind?: number;
35
+ /** Compass direction the wind blows FROM, degrees (0 north, 90 east). Default 0. */
36
+ readonly windFrom?: number;
37
+ /**
38
+ * Dry sand albedo, linear RGB. Default [0.5, 0.42, 0.29], @margoengine/terrain's `DRY_SAND` (luminance 0.43, inside dry
39
+ * sand's measured 0.35 to 0.45, Oke 1987 table 1.1).
40
+ */
41
+ readonly sand?: Vec3;
42
+ /** Share of the ground in dune grass patches, most on the hummocks, 0 (none) to 1. Default 0.5 (see `grassCover`). */
43
+ readonly grass?: number;
44
+ /** Albedo of the dune grass, linear RGB 0 to 1. Default [0.36, 0.31, 0.16]: winter straw with olive bases. */
45
+ readonly grassColor?: Vec3;
46
+ /** Tallest dune grass leaf, metres, 0.2 to 2. Default 0.8 (winter Ammophila, 0.4 to 0.9 m). */
47
+ readonly grassHeight?: number;
48
+ /** Leaves to a grass clump, an integer 4 to 64. Default 30. */
49
+ readonly grassBlades?: number;
50
+ /** Hue spread between grass clumps, 0 (all one colour) to 0.2: straw and olive clumps side by side. Default 0.035. */
51
+ readonly grassVariety?: number;
52
+ /** Sunlight seen through the grass leaves, 0 to 1 (GrassScatter `blades.translucency`). Default 0. */
53
+ readonly grassTranslucency?: number;
54
+ /** Grass leaf width at the root, metres, 0.004 to 0.05. Default 0.016 (inrolled Ammophila leaves). */
55
+ readonly grassWidth?: number;
56
+ /** Height of the big dune's crest above the flat, metres, 0 (none) to 40. Default 30 (about 100 ft in 1903). */
57
+ readonly hill?: number;
58
+ /**
59
+ * How sharp the wind makes the big dune's brink, 0 to 1. Default 0: rounded over a third of its height (an old,
60
+ * settled crest); 1 rounds it over a twentieth, the sharp brink of a crest the wind is still building.
61
+ */
62
+ readonly crest?: number;
63
+ /** Broad scour bands along the wind on the sand, 0 to 1 (the terrain's `sandSurface.broad`). Default 0. */
64
+ readonly sandBands?: number;
65
+ /** Significant height of the swell at the beach, metres, 0 to 3. Default 1.2 (4 ft winter surf). */
66
+ readonly surf?: number;
67
+ /** Builds the camp sheds and the launch rail. Default true. */
68
+ readonly camp?: boolean;
69
+ /**
70
+ * Albedo of the sheds' wall boards and the rail's timber, linear RGB 0 to 1. Default [0.258, 0.205, 0.147], the
71
+ * `weatheredWood` preset of @margoengine/materials. A film sets its own (silver-grey sun-bleached boards are lighter
72
+ * and cooler).
73
+ */
74
+ readonly boards?: Vec3;
75
+ /** Albedo of the sheds' roof boards, linear RGB 0 to 1. Default [0.258, 0.205, 0.147], as `boards`. */
76
+ readonly roof?: Vec3;
77
+ /** Roof overhang past the sheds' walls, metres, 0 to 1. Default 0.2. */
78
+ readonly shedOverhang?: number;
79
+ /** How weathered the shed boards are, 0 to 1: tilts, uneven ends and gaps that catch the light. Default 0.5. */
80
+ readonly shedWeathering?: number;
81
+ /** Windows: two in the hangar's back wall and one in each shed's end wall. Default false (the photographs' fronts only). */
82
+ readonly shedWindows?: boolean;
83
+ /**
84
+ * Reach of the ambient occlusion, metres, 0 (none) to 10. Default 1.5: the grey sky's light is shut out inside the
85
+ * sheds, under the eaves and the rail, and where a model or the grass meets the sand. Ground-truth ambient occlusion
86
+ * (`GTAO` of @margoengine/post, Jimenez et al. 2016), first in the post stack. A gltf/pbr model is seen and darkened
87
+ * once registered: `scene.parts.occlusion?.add(model)`.
88
+ */
89
+ readonly occlusion?: number;
90
+ /**
91
+ * Footprints trodden into the sand with the camp: between the sheds, to and fro between the camp and the launch rail
92
+ * and along the rail (`TerrainDeformation` of @margoengine/terrain/deform), 0 (none) to 1 their depth, 4.5 cm at 1.
93
+ * Needs `camp`. They show within 45 m of the camera. Default 1.
94
+ */
95
+ readonly footprints?: number;
96
+ /**
97
+ * Sand the wind has shaped round the camp, 0 (none) to 1 (`windScour` of @margoengine/terrain/scour): with `camp`, a
98
+ * scour moat along the sheds' windward walls and flanks, a deposit horseshoe in front and two tails past them; with
99
+ * `grass`, shadow dunes in the lee of grass clumps round the camp and the rail. None at wind speeds of 6.6 m/s or
100
+ * less. The ground mesh is split finer where they lie. Default 1.
101
+ */
102
+ readonly scour?: number;
103
+ /** Real ground heights in place of the built landform. */
104
+ readonly heights?: DuneCoastHeights;
105
+ /**
106
+ * Wind-blown sand (`BlownSand` from @margoengine/vfx/blown-sand), 0 (none) to 1: streaks of sand drifting low over
107
+ * the dry sand, spindrift off the dune crests and the haze sheet near the ground, wherever `wind` with its gusts is
108
+ * over the threshold of 0.25 mm sand (6.6 m/s at 10 m); none on the wet beach or in the grass. Default 0.
109
+ */
110
+ readonly blownSand?: number;
111
+ /** `film` (finest ground and grass) or `preview` (a quarter of the ground cells, a third of the grass). Default `film`. */
112
+ readonly quality?: 'film' | 'preview';
113
+ /** Seed of the hummocks and small dunes. Default 1903. */
114
+ readonly seed?: number;
115
+ }
116
+ /** A named place in the scene: where to stand and where to look, metres. */
117
+ export interface Anchor {
118
+ readonly position: Vec3;
119
+ readonly target: Vec3;
120
+ readonly about: string;
121
+ }
122
+ /** The scene handle from {@link attach}. */
123
+ export interface DuneCoastScene extends Disposable {
124
+ /** The settings in use, every default filled in. */
125
+ readonly settings: Readonly<Required<Omit<DuneCoastSettings, 'heights'>>> & {
126
+ readonly heights?: DuneCoastHeights;
127
+ };
128
+ /** Ground height at world (x, z), metres (sea level 0). */
129
+ height(x: number, z: number): number;
130
+ /** Named places: `rail`, `camp`, `flightLine`, `bigHill`, `beach`, and the photographs' views (see `views`). */
131
+ readonly anchors: Readonly<Record<string, Anchor>>;
132
+ /** The six reference photographs' camera views, by name, the coast view and the big dune's crest seen side on. */
133
+ readonly views: readonly string[];
134
+ /** Puts the engine camera at an anchor (and a field of view, degrees; default 50). */
135
+ view(name: string, fov?: number): void;
136
+ /** Moves the scene's own time on (water, sky, grass sway): use for film frames instead of wall-clock time. */
137
+ advanceTime(seconds: number): void;
138
+ /**
139
+ * Settles when every part is in the scene. The wind-blown sand (`blownSand` above 0) loads its package on demand, so
140
+ * a scene without it never downloads it; await this before the first frame you keep. Its clock counts every frame
141
+ * delta and `advanceTime` call from `attach` on, so the sand is the same whenever it arrives. Resolves at once when
142
+ * nothing loads; rejects if a part fails to load.
143
+ */
144
+ readonly ready: Promise<void>;
145
+ /** The parts, for settings past these: the sky and post stack, the water, the shadows, the grass. */
146
+ readonly parts: {
147
+ readonly preset: PresetScene;
148
+ readonly water?: Water;
149
+ readonly shadows: Shadows;
150
+ readonly grass?: GrassScatter;
151
+ /** The ambient occlusion pass, first in `preset.post`; absent when `occlusion` is 0. */
152
+ readonly occlusion?: GTAO;
153
+ /** The trodden footprints, absent without `camp` or with `footprints` 0; `walk` lays more. */
154
+ readonly footprints?: TerrainDeformation;
155
+ /** The wind-blown sand, when `blownSand` is above 0, once `ready` has settled. */
156
+ readonly blownSand?: BlownSand;
157
+ };
158
+ dispose(): void;
159
+ }
160
+ /** The catalogue entry of this scene. */
161
+ export declare const info: import("./index.js").SceneInfo;
162
+ /**
163
+ * The ground height function of the scene for `settings`, with no engine: metres above sea level at world (x, z),
164
+ * the same heights `attach` builds. For placing subjects and cameras before or without a GPU.
165
+ * @throws TypeError or RangeError for a bad setting.
166
+ */
167
+ export declare function ground(settings?: DuneCoastSettings): (x: number, z: number) => number;
168
+ /**
169
+ * Where the scene's dune grass grows: ground cover 0 (bare sand) to 1 (full clump) at world (x, z) for `settings`,
170
+ * with no engine. `attach` places its grass clumps by this map, so subjects can be kept out of the grass or put in it.
171
+ * @throws TypeError or RangeError for a bad setting.
172
+ */
173
+ export declare function grassCover(settings?: DuneCoastSettings): (x: number, z: number) => number;
174
+ /**
175
+ * Builds the dune coast in `engine`: ground, sky and post, sea and surf, grass, camp and rail. One call; every look
176
+ * value is a setting (see {@link DuneCoastSettings}) or a part's own option (`scene.parts`).
177
+ * @throws TypeError or RangeError for a bad setting.
178
+ */
179
+ export declare function attach(engine: EngineKernel, settings?: DuneCoastSettings): DuneCoastScene;