@margoengine/terrain 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.
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +2366 -2
- package/dist/bed-mesh.d.ts +40 -0
- package/dist/bed-mesh.js +95 -0
- package/dist/blend.d.ts +70 -0
- package/dist/blend.js +159 -0
- package/dist/colors.d.ts +170 -0
- package/dist/deform.d.ts +134 -0
- package/dist/deform.js +404 -0
- package/dist/displace.d.ts +60 -0
- package/dist/displace.js +254 -0
- package/dist/dunes.d.ts +86 -0
- package/dist/dunes.js +88 -0
- package/dist/elevation.d.ts +182 -0
- package/dist/elevation.js +155 -0
- package/dist/errors-fc4i1pSL.js +7 -0
- package/dist/far.d.ts +66 -0
- package/dist/far.js +191 -0
- package/dist/furrows.d.ts +74 -0
- package/dist/furrows.js +157 -0
- package/dist/grid.d.ts +14 -0
- package/dist/ground-change-settings.d.ts +29 -0
- package/dist/ground-change-settings.js +69 -0
- package/dist/ground-change.d.ts +227 -0
- package/dist/ground-change.js +1412 -0
- package/dist/ground-contact-settings.d.ts +27 -0
- package/dist/ground-contact-settings.js +22 -0
- package/dist/ground-contact.d.ts +91 -0
- package/dist/ground-contact.js +241 -0
- package/dist/ground-model.d.ts +372 -0
- package/dist/hdr-format-DRhzGS7G.js +30 -0
- package/dist/height-grid.d.ts +65 -0
- package/dist/height-grid.js +74 -0
- package/dist/heightfield.d.ts +38 -0
- package/dist/holes.d.ts +37 -0
- package/dist/holes.js +97 -0
- package/dist/imagery.d.ts +109 -0
- package/dist/imagery.js +472 -0
- package/dist/index.d.ts +408 -0
- package/dist/index.js +1 -0
- package/dist/layers-pbr.d.ts +78 -0
- package/dist/layers-pbr.js +128 -0
- package/dist/lighting-layout-CaDtDa5G.js +34 -0
- package/dist/lighting-layout.d.ts +5 -0
- package/dist/mesh-patch-BThCHCeS.js +21 -0
- package/dist/mesh-patch.d.ts +14 -0
- package/dist/noise3-sQdnbz4B.js +11 -0
- package/dist/noise3.d.ts +3 -0
- package/dist/overlays.d.ts +74 -0
- package/dist/overlays.js +297 -0
- package/dist/planet-complex.d.ts +31 -0
- package/dist/planet-craters.d.ts +80 -0
- package/dist/planet-rays.d.ts +37 -0
- package/dist/planet-recipes.d.ts +84 -0
- package/dist/planet-recipes.js +442 -0
- package/dist/planet.d.ts +144 -0
- package/dist/planet.js +610 -0
- package/dist/query.d.ts +150 -0
- package/dist/query.js +243 -0
- package/dist/relief-lighting.d.ts +53 -0
- package/dist/relief-lighting.js +221 -0
- package/dist/require-webgpu--tUXPsmA.js +7 -0
- package/dist/rock-settings.d.ts +39 -0
- package/dist/rock-settings.js +84 -0
- package/dist/rock-surface.d.ts +114 -0
- package/dist/rock-surface.js +380 -0
- package/dist/rocks.d.ts +258 -0
- package/dist/rocks.js +488 -0
- package/dist/rvt.d.ts +136 -0
- package/dist/rvt.js +518 -0
- package/dist/scour.d.ts +90 -0
- package/dist/scour.js +153 -0
- package/dist/sculpt.d.ts +103 -0
- package/dist/sculpt.js +361 -0
- package/dist/settings-B9BSdnhD.js +72 -0
- package/dist/settings.d.ts +81 -0
- package/dist/settings.js +152 -0
- package/dist/shader.d.ts +176 -0
- package/dist/shared/settings.d.ts +89 -0
- package/dist/src-Cr7Gm4n0.js +1366 -0
- package/dist/stream-window.d.ts +123 -0
- package/dist/stream.d.ts +169 -0
- package/dist/stream.js +531 -0
- package/dist/surface-height.d.ts +16 -0
- package/dist/wet-ground.d.ts +82 -0
- package/dist/wet-ground.js +147 -0
- package/package.json +173 -4
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/** A world XZ point. */
|
|
2
|
+
export type GroundPoint = readonly [number, number];
|
|
3
|
+
/** How a gully's section is shaped: 'v' a young incision, 'u' a flat bed between steep walls. */
|
|
4
|
+
export type GullyShape = 'v' | 'u';
|
|
5
|
+
/** The side of a line's travel direction (from its first point to its last). */
|
|
6
|
+
export type GroundSide = 'left' | 'right';
|
|
7
|
+
interface Timed {
|
|
8
|
+
/** Film seconds the event starts, 0 or more. Default 0. */
|
|
9
|
+
start?: number;
|
|
10
|
+
/** Film seconds the event takes, above 0. Default per kind. */
|
|
11
|
+
duration?: number;
|
|
12
|
+
/** Edge roughness, 0 (geometric) to 1. Default 0.3. */
|
|
13
|
+
roughness?: number;
|
|
14
|
+
/** Noise seed, an integer. Default 1. */
|
|
15
|
+
seed?: number;
|
|
16
|
+
}
|
|
17
|
+
/** A gully cutting back from its mouth (`path[0]`) to its head (the last point). */
|
|
18
|
+
export interface GullyEvent extends Timed {
|
|
19
|
+
kind: 'gully';
|
|
20
|
+
/** 2 or more points, mouth first. */
|
|
21
|
+
path: readonly GroundPoint[];
|
|
22
|
+
/** Full top width, metres above 0. Default 4. */
|
|
23
|
+
width?: number;
|
|
24
|
+
/** Full depth, metres above 0. Default 1.5. */
|
|
25
|
+
depth?: number;
|
|
26
|
+
/** Section shape. Default 'v'. */
|
|
27
|
+
shape?: GullyShape;
|
|
28
|
+
/** Share of the eroded volume left as a fan at the mouth, 0 to 1. Default 0.6. */
|
|
29
|
+
deposit?: number;
|
|
30
|
+
/** Fan radius, metres above 0. Default 3 times the width. */
|
|
31
|
+
fan?: number;
|
|
32
|
+
}
|
|
33
|
+
/** A cut bank: the ground beside a river line retreats from it. */
|
|
34
|
+
export interface BankEvent extends Timed {
|
|
35
|
+
kind: 'bank';
|
|
36
|
+
/** 2 or more points along the bank's first edge. */
|
|
37
|
+
path: readonly GroundPoint[];
|
|
38
|
+
/** The side of the path the river is on; the ground on the other side retreats. Default 'left'. */
|
|
39
|
+
river?: GroundSide;
|
|
40
|
+
/** Metres the bank retreats, above 0. Default 6. */
|
|
41
|
+
retreat?: number;
|
|
42
|
+
/** World Y of the channel bed the cut reaches. Required. */
|
|
43
|
+
bed: number;
|
|
44
|
+
/** Angle of the cut face from horizontal, degrees 10 to 89. Default 60. */
|
|
45
|
+
face?: number;
|
|
46
|
+
}
|
|
47
|
+
/** A scour hole, with a mound downstream when the flow is given. */
|
|
48
|
+
export interface ScourEvent extends Timed {
|
|
49
|
+
kind: 'scour';
|
|
50
|
+
center: GroundPoint;
|
|
51
|
+
/** Final radius, metres above 0. Default 5. */
|
|
52
|
+
radius?: number;
|
|
53
|
+
/** Equilibrium depth, metres above 0. Default 2. */
|
|
54
|
+
depth?: number;
|
|
55
|
+
/** Flow direction [x, z]; the mound forms downstream. Default none (the sand is carried away). */
|
|
56
|
+
flow?: GroundPoint;
|
|
57
|
+
/** Share of the scoured volume in the mound, 0 to 1. Default 0.5. */
|
|
58
|
+
deposit?: number;
|
|
59
|
+
}
|
|
60
|
+
/** A slide: a scar below its crown and a lobe that runs out to its toe. */
|
|
61
|
+
export interface SlideEvent extends Timed {
|
|
62
|
+
kind: 'slide';
|
|
63
|
+
/** The crown, the top of the head scarp. */
|
|
64
|
+
from: GroundPoint;
|
|
65
|
+
/** Where the lobe's front stops. */
|
|
66
|
+
to: GroundPoint;
|
|
67
|
+
/** Scar width, metres above 0. Default 20. */
|
|
68
|
+
width?: number;
|
|
69
|
+
/** Scar depth, metres above 0. Default 3. */
|
|
70
|
+
depth?: number;
|
|
71
|
+
/** Scar length along the slide, metres above 0. Default 40 percent of the distance from `from` to `to`. */
|
|
72
|
+
length?: number;
|
|
73
|
+
/** Volume of the lobe over the scar's, 1 to 2 (loosened debris). Default 1.15. */
|
|
74
|
+
bulking?: number;
|
|
75
|
+
}
|
|
76
|
+
/** A flood's mud: a front moving inland from a shore line, leaving a deposit that thins and dries. */
|
|
77
|
+
export interface MudEvent extends Timed {
|
|
78
|
+
kind: 'mud';
|
|
79
|
+
/** 2 or more points along the shore. */
|
|
80
|
+
shore: readonly GroundPoint[];
|
|
81
|
+
/** The side of the shore line the land is on. Default 'left'. */
|
|
82
|
+
land?: GroundSide;
|
|
83
|
+
/** Metres the water reaches inland, above 0. Default 400. */
|
|
84
|
+
reach?: number;
|
|
85
|
+
/** Deposit at the shore, metres 0 or more. Default 0.25. */
|
|
86
|
+
thickness?: number;
|
|
87
|
+
/** Metres inland over which the deposit thins by e, above 0. Default a third of `reach`. */
|
|
88
|
+
decay?: number;
|
|
89
|
+
/** Film seconds for the wet mud to dry by e after the water passes, above 0. Default 1,800. */
|
|
90
|
+
drying?: number;
|
|
91
|
+
}
|
|
92
|
+
/** Ash falling from a vent, thickest near it, stretched downwind. */
|
|
93
|
+
export interface AshEvent extends Timed {
|
|
94
|
+
kind: 'ash';
|
|
95
|
+
vent: GroundPoint;
|
|
96
|
+
/** Thickness at the vent when the fall ends, metres above 0. Default 0.1. */
|
|
97
|
+
thickness?: number;
|
|
98
|
+
/** Crosswind metres over which the deposit halves, above 0. Default 400. */
|
|
99
|
+
half?: number;
|
|
100
|
+
/** Wind [x, z] m/s carrying the plume; it stretches the isopachs downwind. Default [0, 0]. */
|
|
101
|
+
wind?: GroundPoint;
|
|
102
|
+
/** Downwind over crosswind length of each isopach, 1 to 12. Default from the wind: 1 + 0.25 |wind| (at most 12). */
|
|
103
|
+
elongation?: number;
|
|
104
|
+
}
|
|
105
|
+
/** A lava flow advancing down a path from its vent. */
|
|
106
|
+
export interface LavaEvent extends Timed {
|
|
107
|
+
kind: 'lava';
|
|
108
|
+
/** 2 or more points, vent first. */
|
|
109
|
+
path: readonly GroundPoint[];
|
|
110
|
+
/** Flow width, metres above 0. Default 12. */
|
|
111
|
+
width?: number;
|
|
112
|
+
/** Sheet thickness, metres above 0. Default 2. */
|
|
113
|
+
thickness?: number;
|
|
114
|
+
/** Levee height over the sheet, as a share of the thickness, 0 to 1. Default 0.35. */
|
|
115
|
+
levee?: number;
|
|
116
|
+
/** Real seconds of cooling per film second (a film that shows hours in a minute), above 0. Default 1. */
|
|
117
|
+
cooling?: number;
|
|
118
|
+
/** Crust thickness at which the glow has faded by e, metres above 0. Default 0.03. */
|
|
119
|
+
glowCrust?: number;
|
|
120
|
+
/**
|
|
121
|
+
* Film seconds the front reaches each point of `path` (one per point, never decreasing), as a flow model that follows
|
|
122
|
+
* the slope gives them (`LavaFlow.lavaEvent()` of `@margoengine/weather/lava`): the front then stops where the times
|
|
123
|
+
* do, and `start` and `duration` are taken from the first and last. Unset: the front law of `duration`.
|
|
124
|
+
*/
|
|
125
|
+
arrival?: readonly number[];
|
|
126
|
+
/** Flow width at each point of `path`, metres above 0, in place of `width`. */
|
|
127
|
+
widths?: readonly number[];
|
|
128
|
+
/** Sheet thickness at each point of `path`, metres above 0, in place of `thickness`. */
|
|
129
|
+
thicknesses?: readonly number[];
|
|
130
|
+
/** Glow of the core at each point of `path`, 0 to 1 (1 at the vent's temperature), multiplying the heat. Default 1. */
|
|
131
|
+
glows?: readonly number[];
|
|
132
|
+
/**
|
|
133
|
+
* Levee height over the sheet at each point of `path`, as a share of the thickness, 0 to 1, in place of `levee`
|
|
134
|
+
* (`LavaFlow.lavaEvent()` gives the levees as they stand at its film time: set the event again to grow them).
|
|
135
|
+
*/
|
|
136
|
+
levees?: readonly number[];
|
|
137
|
+
/**
|
|
138
|
+
* Film second the channel from each point of `path` to the next roofs over into a lava tube, 0 to 1e9 (1e9: never;
|
|
139
|
+
* `LavaFlow.lavaEvent()` gives its `roofTime`s). From the front's arrival to then a crust grows in from the levees
|
|
140
|
+
* over the channel (Peterson et al. 1994) until it closes level with their crests: under it the lava shows no glow.
|
|
141
|
+
*/
|
|
142
|
+
roofs?: readonly number[];
|
|
143
|
+
/**
|
|
144
|
+
* Mean spacing of skylights along a roofed tube, metres, 0 (none) to 1e5. Default 200. A skylight is a hole where the
|
|
145
|
+
* roof fell in or never closed (Kauahikaua et al. 1998; Greeley 1987): one in most stretches of this length, at a
|
|
146
|
+
* seeded place, 0.8 widths long and half a width across, showing the stream below the roof, which glows fresh until
|
|
147
|
+
* the tube drains (`drains`) and then crusts over like open lava.
|
|
148
|
+
*/
|
|
149
|
+
skylights?: number;
|
|
150
|
+
/**
|
|
151
|
+
* Film second the tube from each point of `path` stops carrying lava, 0 to 1e9 (1e9: never; `LavaFlow.lavaEvent()`
|
|
152
|
+
* gives them as the vent's supply runs out past each point). Its skylights glow fresh until then.
|
|
153
|
+
*/
|
|
154
|
+
drains?: readonly number[];
|
|
155
|
+
/**
|
|
156
|
+
* A pond the flow fills where it can run no further (`LavaFlow.lavaEvent()` gives it when the flow ponds): an
|
|
157
|
+
* axisymmetric viscous gravity current (Huppert 1982) of radius R = 0.715 (g Q^3 / (3 nu))^(1/8) t^(1/2), nu the
|
|
158
|
+
* kinematic viscosity, fed at `flux` from `start` to `end` and held after, whose thickness is
|
|
159
|
+
* H (1 - (r / R)^2)^(1/3) with H = V / (0.75 pi R^2), so its volume is the V = Q t fed into it. Its surface glows by
|
|
160
|
+
* the age since the edge passed (the crust of `glowCrust` and `cooling`), times the last point's `glows`.
|
|
161
|
+
*/
|
|
162
|
+
pond?: LavaPond;
|
|
163
|
+
}
|
|
164
|
+
/** A lava pond: see {@link LavaEvent.pond}. */
|
|
165
|
+
export interface LavaPond {
|
|
166
|
+
/** Centre [x, z], metres. */
|
|
167
|
+
center: GroundPoint;
|
|
168
|
+
/** Film second the pond starts to fill. */
|
|
169
|
+
start: number;
|
|
170
|
+
/** Film second its feed stops (it holds its size after), above `start`. */
|
|
171
|
+
end: number;
|
|
172
|
+
/** Lava fed into it, m^3/s, above 0. */
|
|
173
|
+
flux: number;
|
|
174
|
+
/** Dynamic viscosity, Pa s, above 0. */
|
|
175
|
+
viscosity: number;
|
|
176
|
+
/** Lava density, kg/m^3, above 0. Default 2,600. */
|
|
177
|
+
density?: number;
|
|
178
|
+
}
|
|
179
|
+
/** A burn scar spreading from an ignition point as a wind-driven ellipse. */
|
|
180
|
+
export interface BurnEvent extends Timed {
|
|
181
|
+
kind: 'burn';
|
|
182
|
+
ignition: GroundPoint;
|
|
183
|
+
/** Wind [x, z] m/s at 10 m; it sets the ellipse's heading and length to breadth. Default [0, 0]. */
|
|
184
|
+
wind?: GroundPoint;
|
|
185
|
+
/** Head fire rate of spread, m/s above 0. Default 0.3. */
|
|
186
|
+
rate?: number;
|
|
187
|
+
/** Burn severity, 0 to 1: how black the char and how much litter burns off. Default 1. */
|
|
188
|
+
severity?: number;
|
|
189
|
+
/** Film seconds for the char to whiten to ash by e, above 0. Default 900. */
|
|
190
|
+
ashing?: number;
|
|
191
|
+
/** Litter and duff burned off at full severity, metres 0 to 1. Default 0.03. */
|
|
192
|
+
consume?: number;
|
|
193
|
+
}
|
|
194
|
+
/** A buried explosion: the ground heaves into a dome, then the crater opens with a raised lip and an ejecta blanket. */
|
|
195
|
+
export interface CraterEvent extends Timed {
|
|
196
|
+
kind: 'crater';
|
|
197
|
+
center: GroundPoint;
|
|
198
|
+
/** Apparent crater radius at the rim, metres above 0. Default 30. */
|
|
199
|
+
radius?: number;
|
|
200
|
+
/** Apparent crater depth below the old ground, metres above 0. Default 10. */
|
|
201
|
+
depth?: number;
|
|
202
|
+
/** Height of the heave dome before it vents, metres 0 or more (0: no dome). Default 0.4 of `depth`. */
|
|
203
|
+
heave?: number;
|
|
204
|
+
/** Seconds the dome rises, above 0. Default sqrt(2 heave / g), the spalled surface's ballistic rise (1.43 s for 10 m). */
|
|
205
|
+
heaveTime?: number;
|
|
206
|
+
/** Radius of the heave dome over the crater's, 1 to 3. Default 1.3. */
|
|
207
|
+
domeSpread?: number;
|
|
208
|
+
/** Volume of the ejecta blanket over the bowl's, 0 to 1.5. Default 0.7. */
|
|
209
|
+
ejecta?: number;
|
|
210
|
+
/**
|
|
211
|
+
* The blanket's share by direction: 3 to 360 weights 0 or more (not all 0) for equal sectors from +X toward +Z, the
|
|
212
|
+
* first centred on +X, such as the mass a crater's ejecta landed with in each (EARTH-06's `ejectaBlocks`). Scaled to a
|
|
213
|
+
* mean of 1 and read linearly between sector centres, in place of the noise rays. Default: noise rays.
|
|
214
|
+
*/
|
|
215
|
+
rays?: readonly number[];
|
|
216
|
+
/**
|
|
217
|
+
* Whether to scatter noise secondary pits over the blanket (true), or leave them to crater events of their own (false,
|
|
218
|
+
* as when the secondaries come from the blocks' strikes). Default true.
|
|
219
|
+
*/
|
|
220
|
+
pits?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Whether to raise noise blocks of thrown-back cap rock on the floor, walls and rim (true), or leave the blocks to be
|
|
223
|
+
* drawn as rocks of their own (false, as when they come from the crater's thrown blocks). Default true.
|
|
224
|
+
*/
|
|
225
|
+
blocks?: boolean;
|
|
226
|
+
}
|
|
227
|
+
/** One crater of a {@link CratersEvent}. */
|
|
228
|
+
export interface SmallCrater {
|
|
229
|
+
center: GroundPoint;
|
|
230
|
+
/** Film seconds it starts, 0 or more. */
|
|
231
|
+
start: number;
|
|
232
|
+
/** Bowl radius and depth below the old ground, metres above 0. */
|
|
233
|
+
radius: number;
|
|
234
|
+
depth: number;
|
|
235
|
+
/** Seconds it takes to open, above 0. Default 0.5. */
|
|
236
|
+
duration?: number;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* A field of small craters each opening at its own time, such as the secondary craters a crater's blocks dig where they
|
|
240
|
+
* land (EARTH-06's `impactCrater` of each `blockLanding`): each a paraboloid bowl with its lip and an ejecta blanket thinning
|
|
241
|
+
* as (r / R)^-3 to 5 R, as the crater event's, without its dome. Thousands are cheap: each point reads only the craters
|
|
242
|
+
* near it.
|
|
243
|
+
*/
|
|
244
|
+
export interface CratersEvent extends Timed {
|
|
245
|
+
kind: 'craters';
|
|
246
|
+
/** 1 to 200,000 craters. */
|
|
247
|
+
craters: readonly SmallCrater[];
|
|
248
|
+
/** Volume of each blanket over its bowl's, 0 to 1.5. Default 0.8 (Holsapple's ejecta of a strike's crater). */
|
|
249
|
+
ejecta?: number;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* A deposit laid from a grid of mass per area, such as the dust a plume drops (ATMO-06's `depositField`): its thickness
|
|
253
|
+
* the mass over the layer's bulk density, falling at a steady rate over `duration`, coloured by `cover` where it is
|
|
254
|
+
* thick (full at 4 mm): grey like fallen ash, or the fresh soil of the earth it was thrown from.
|
|
255
|
+
*/
|
|
256
|
+
export interface FallEvent extends Timed {
|
|
257
|
+
kind: 'fall';
|
|
258
|
+
/** The grid: `columns` by `rows` cells over `width` by `depth` m centred on `centre`, vertex (r, c) at r + (rows + 1) c. */
|
|
259
|
+
grid: {
|
|
260
|
+
columns: number;
|
|
261
|
+
rows: number;
|
|
262
|
+
width: number;
|
|
263
|
+
depth: number;
|
|
264
|
+
centre: GroundPoint;
|
|
265
|
+
};
|
|
266
|
+
/** kg/m^2 at each of the (columns + 1) (rows + 1) vertices, 0 or more. */
|
|
267
|
+
mass: ArrayLike<number>;
|
|
268
|
+
/** The laid layer's bulk density, kg/m^3, above 0. Default 1,680 (Mercia Mudstone's median dry density, BGS RR/01/02). */
|
|
269
|
+
density?: number;
|
|
270
|
+
/**
|
|
271
|
+
* What the layer looks like: `'ash'` (the ash cover, a volcano's or a fire's) or `'soil'` (the fresh soil cover, for the
|
|
272
|
+
* earth a crater threw up). Default `'ash'`.
|
|
273
|
+
*/
|
|
274
|
+
cover?: 'ash' | 'soil';
|
|
275
|
+
}
|
|
276
|
+
/** Every event the ground can take. */
|
|
277
|
+
export type GroundEvent = FallEvent | CratersEvent | GullyEvent | BankEvent | ScourEvent | SlideEvent | MudEvent | AshEvent | LavaEvent | BurnEvent | CraterEvent;
|
|
278
|
+
/** The kinds of {@link GroundEvent}. */
|
|
279
|
+
export type GroundEventKind = GroundEvent['kind'];
|
|
280
|
+
/** Default seconds per kind. */
|
|
281
|
+
export declare const GROUND_DURATIONS: Readonly<Record<GroundEventKind, number>>;
|
|
282
|
+
/** The surface a point shows: shares 0 to 1. */
|
|
283
|
+
export interface GroundCover {
|
|
284
|
+
/** Fresh mud. */
|
|
285
|
+
mud: number;
|
|
286
|
+
/** Fallen ash. */
|
|
287
|
+
ash: number;
|
|
288
|
+
/** Burned ground. */
|
|
289
|
+
char: number;
|
|
290
|
+
/** Lava rock. */
|
|
291
|
+
lava: number;
|
|
292
|
+
/** Lava glow, 1 at the front, falling as the crust closes. */
|
|
293
|
+
heat: number;
|
|
294
|
+
/** Wetness of the mud. */
|
|
295
|
+
wet: number;
|
|
296
|
+
/** Freshly cut soil (gully, bank, scour, slide). */
|
|
297
|
+
soil: number;
|
|
298
|
+
/** How far the char has whitened to ash. */
|
|
299
|
+
ashen: number;
|
|
300
|
+
}
|
|
301
|
+
/** Channels of {@link GroundCover}, in the order the cover textures hold them. */
|
|
302
|
+
export declare const COVER_CHANNELS: readonly ['mud', 'ash', 'char', 'lava', 'heat', 'wet', 'soil', 'ashen'];
|
|
303
|
+
/** Lengths along a polyline and its points, for distances along and across it. */
|
|
304
|
+
interface Line {
|
|
305
|
+
points: Float64Array;
|
|
306
|
+
/** Cumulative length at each point. */
|
|
307
|
+
at: Float64Array;
|
|
308
|
+
length: number;
|
|
309
|
+
}
|
|
310
|
+
/** A resolved event: every option filled in, plus what evaluation needs. */
|
|
311
|
+
export interface ResolvedEvent {
|
|
312
|
+
readonly kind: GroundEventKind;
|
|
313
|
+
readonly start: number;
|
|
314
|
+
readonly duration: number;
|
|
315
|
+
/** Film time after which the event no longer changes (Infinity never). */
|
|
316
|
+
readonly settle: number;
|
|
317
|
+
/** World bounds [x0, z0, x1, z1] it can touch. */
|
|
318
|
+
readonly bounds: readonly [number, number, number, number];
|
|
319
|
+
readonly order: number;
|
|
320
|
+
readonly source: GroundEvent;
|
|
321
|
+
readonly o: Record<string, number>;
|
|
322
|
+
readonly line?: Line;
|
|
323
|
+
readonly dir?: readonly [number, number];
|
|
324
|
+
/** A lava event's per-point arrival, width, thickness and glow (each one value per path point). */
|
|
325
|
+
readonly profile?: LavaProfile;
|
|
326
|
+
/** A crater's blanket share by sector, scaled to a mean of 1. */
|
|
327
|
+
readonly rays?: Float64Array;
|
|
328
|
+
/** A craters event's craters (x, z, start, radius, depth, duration, six numbers each) and the buckets that find them. */
|
|
329
|
+
readonly field?: CraterField;
|
|
330
|
+
/** A fall event's laid thickness at each grid vertex, m. */
|
|
331
|
+
readonly thickness?: Float64Array;
|
|
332
|
+
}
|
|
333
|
+
/** A craters event's index: craters by bucket of a square grid, each bucket holding the craters whose blankets reach it. */
|
|
334
|
+
export interface CraterField {
|
|
335
|
+
readonly craters: Float64Array;
|
|
336
|
+
readonly origin: readonly [number, number];
|
|
337
|
+
readonly cell: number;
|
|
338
|
+
readonly columns: number;
|
|
339
|
+
readonly rows: number;
|
|
340
|
+
/** Start of each bucket's list in `members` (rows x columns + 1 offsets). */
|
|
341
|
+
readonly offsets: Uint32Array;
|
|
342
|
+
readonly members: Uint32Array;
|
|
343
|
+
}
|
|
344
|
+
/** Per-point values of a lava event along its path. */
|
|
345
|
+
export interface LavaProfile {
|
|
346
|
+
readonly arrival?: Float64Array;
|
|
347
|
+
readonly width?: Float64Array;
|
|
348
|
+
readonly thickness?: Float64Array;
|
|
349
|
+
readonly glow?: Float64Array;
|
|
350
|
+
readonly levee?: Float64Array;
|
|
351
|
+
readonly roof?: Float64Array;
|
|
352
|
+
readonly drain?: Float64Array;
|
|
353
|
+
}
|
|
354
|
+
/** Value noise 0 to 1 at (x, z) in lattice units, seeded. */
|
|
355
|
+
export declare function groundNoise(x: number, z: number, seed: number): number;
|
|
356
|
+
/** The Sumer et al. scour law normalised to reach 1 at the end: (1 - e^(-5 p)) / (1 - e^(-5)). */
|
|
357
|
+
export declare const scourProgress: (p: number) => number;
|
|
358
|
+
/** Front of a block sliding under constant friction: 1 - (1 - p)^2. */
|
|
359
|
+
export declare const runoutProgress: (p: number) => number;
|
|
360
|
+
/** Alexander's (1985) length to breadth of a wind-driven fire ellipse, wind in m/s at 10 m. */
|
|
361
|
+
export declare function lengthToBreadth(wind: number): number;
|
|
362
|
+
/** Hon et al.'s (1994) crust thickness in metres after `seconds` of cooling: 0.0779 sqrt(hours). */
|
|
363
|
+
export declare const crustThickness: (seconds: number) => number;
|
|
364
|
+
/** Checks and fills in one event; `order` keeps ties stable. `top` is the highest base height (for a bank's face). */
|
|
365
|
+
export declare function resolveEvent(event: GroundEvent, order: number, top: number): ResolvedEvent;
|
|
366
|
+
/** Volume a gully has eroded at progress p: the integral of its section along the opened length. */
|
|
367
|
+
export declare function gullyVolume(e: ResolvedEvent, p: number): number;
|
|
368
|
+
/** Volume a slide's scar has lost at progress p: an ellipsoid cap, 2/3 pi a b D. */
|
|
369
|
+
export declare function slideVolume(e: ResolvedEvent, p: number): number;
|
|
370
|
+
/** Adds one event's change at world (x, z) and film time t into `out` (height delta at 0, cover shares after). */
|
|
371
|
+
export declare function sampleEvent(e: ResolvedEvent, x: number, z: number, t: number, base: number, out: Float64Array): void;
|
|
372
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region ../shared/display.js
|
|
2
|
+
var e = "fn pbrNeutral(input:vec3f)->vec3f {let x=min(input.r,min(input.g,input.b));let offset=select(0.04,x-6.25*x*x,x<0.08);var v=input-offset;let peak=max(v.r,max(v.g,v.b));if(peak<0.76){return v;}let newPeak=1.0-0.24*0.24/(peak+0.24-0.76);v*=newPeak/peak;return mix(v,vec3f(newPeak),1.0-1.0/(0.15*(peak-newPeak)+1.0));}\n", t = `${e}fn toDisplay(c:vec3f)->vec3f {let x=pbrNeutral(max(c,vec3f(0)));return select(x*12.92,1.055*pow(x,vec3f(1.0/2.4))-0.055,x>=vec3f(0.0031308));}
|
|
3
|
+
`;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region ../shared/view-rect.js
|
|
6
|
+
function n(e) {
|
|
7
|
+
return e?.view?.viewport;
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
let t = n(e);
|
|
11
|
+
return t ? [t[2], t[3]] : [e.width, e.height];
|
|
12
|
+
}
|
|
13
|
+
function i(e, t) {
|
|
14
|
+
let r = n(t);
|
|
15
|
+
if (!r) return;
|
|
16
|
+
e.setViewport(r[0], r[1], r[2], r[3], 0, 1);
|
|
17
|
+
let i = t.view.scissor ?? r;
|
|
18
|
+
e.setScissorRect(i[0], i[1], i[2], i[3]);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ../shared/unit-light.js
|
|
22
|
+
function a(e, t, n) {
|
|
23
|
+
let r = Math.hypot(n[0], n[1], n[2]);
|
|
24
|
+
e[t] = n[0] / r, e[t + 1] = n[1] / r, e[t + 2] = n[2] / r, e[t + 3] = n[3];
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../shared/hdr-format.js
|
|
28
|
+
var o = (e) => typeof e == "string" && e.endsWith("float");
|
|
29
|
+
//#endregion
|
|
30
|
+
export { t as a, r as i, a as n, e as o, i as r, o as t };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { HeightField } from '@margoengine/math';
|
|
2
|
+
/** How a missing sample (NaN, or equal to `noData`) is filled before the grid is read. */
|
|
3
|
+
export type GridFill = number | 'nearest' | 'min' | 'mean';
|
|
4
|
+
/** Options of {@link gridHeightField}. */
|
|
5
|
+
export interface GridHeightOptions {
|
|
6
|
+
/** Texels across (x), an integer 2 to 65,536. */
|
|
7
|
+
width: number;
|
|
8
|
+
/** Texels down (z), an integer 2 to 65,536. */
|
|
9
|
+
height: number;
|
|
10
|
+
/**
|
|
11
|
+
* Row-major heights, `width * height` numbers (a Float32Array from a float GeoTIFF, an Int16Array from SRTM or any
|
|
12
|
+
* array of numbers). Row 0 is at the grid's minimum z (the north edge of a north-up raster when north is -z), column 0
|
|
13
|
+
* at its minimum x. Read once and not kept: later changes to it do not reach the result.
|
|
14
|
+
*/
|
|
15
|
+
heights: ArrayLike<number>;
|
|
16
|
+
/** Real ground extent in world units along x and z, each above 0 to 100,000. */
|
|
17
|
+
size: readonly [number, number];
|
|
18
|
+
/** World x and z of the grid's minimum corner. Default centred on the origin (`-size / 2`). */
|
|
19
|
+
origin?: readonly [number, number];
|
|
20
|
+
/** Added to every height after `exaggeration`, in world units. Default 0. */
|
|
21
|
+
base?: number;
|
|
22
|
+
/** Vertical scale: world height = (sample * exaggeration) + base. Default 1. */
|
|
23
|
+
exaggeration?: number;
|
|
24
|
+
/** A sample value that means no data (GDAL_NODATA, for example -32768 or -999999). NaN always does. Default none. */
|
|
25
|
+
noData?: number;
|
|
26
|
+
/**
|
|
27
|
+
* What stands in for a missing sample: a number (a world height, `exaggeration` and `base` do not touch it),
|
|
28
|
+
* `'nearest'` (the valid texel fewest steps away over the eight neighbours, ties to the one met first in row-major
|
|
29
|
+
* order), `'min'` or `'mean'` of the valid heights (world units). A grid with no valid sample needs a number. Default
|
|
30
|
+
* `'nearest'`.
|
|
31
|
+
*/
|
|
32
|
+
fill?: GridFill;
|
|
33
|
+
/**
|
|
34
|
+
* Where the samples sit. `'point'` (default, as `Terrain` and `TerrainQuery` read heights): texel (0, 0) is at the
|
|
35
|
+
* minimum corner and the last texel at `origin + size`. `'area'` (a GeoTIFF with PixelIsArea): each texel covers a cell
|
|
36
|
+
* of `size / (width, height)` and its sample sits at the cell's centre, so the grid reaches half a cell short of the box
|
|
37
|
+
* and the edge heights hold beyond it.
|
|
38
|
+
*/
|
|
39
|
+
registration?: 'point' | 'area';
|
|
40
|
+
/** Reads row 0 at the maximum z instead of the minimum (a south-up grid). Default false. */
|
|
41
|
+
flipRows?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** A height function with the grid's own limits; call it as `(x, z) => height` for `heightfield` or `TerrainHeightmap`. */
|
|
44
|
+
export interface GridHeightField extends HeightField {
|
|
45
|
+
/** Lowest world height the grid gives (after `exaggeration`, `base` and the fill). */
|
|
46
|
+
readonly min: number;
|
|
47
|
+
/** Highest world height the grid gives. */
|
|
48
|
+
readonly max: number;
|
|
49
|
+
/** Minimum world x and z of the grid box. */
|
|
50
|
+
readonly origin: readonly [number, number];
|
|
51
|
+
/** World x and z extent of the grid box. */
|
|
52
|
+
readonly size: readonly [number, number];
|
|
53
|
+
/** How many samples were missing and filled. */
|
|
54
|
+
readonly filled: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Turns a stored height grid into a height function: bilinear between texels, clamped to the edge texels outside the
|
|
58
|
+
* box, with the grid's real ground size, an optional vertical exaggeration and base, and a fill for missing samples.
|
|
59
|
+
* @example
|
|
60
|
+
* const ground = gridHeightField({ width: 3, height: 3, heights: [0, 1, 0, 1, 2, 1, 0, 1, 0], size: [200, 200] });
|
|
61
|
+
* ground(0, 0); // 2, the middle texel
|
|
62
|
+
* @throws RangeError for a grid size, a heights array of another length, a size, an origin, a base, an exaggeration or a
|
|
63
|
+
* fill that is not valid, a non-finite height that is not missing, or a grid with no valid sample and no numeric fill.
|
|
64
|
+
*/
|
|
65
|
+
export declare function gridHeightField(options: GridHeightOptions): GridHeightField;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/height-grid.ts
|
|
2
|
+
var e = 65536;
|
|
3
|
+
function t(e, t) {
|
|
4
|
+
if (typeof e != "number" || !Number.isFinite(Math.fround(e))) throw RangeError(`Invalid grid height field; ${t} must be a finite number.`);
|
|
5
|
+
return e;
|
|
6
|
+
}
|
|
7
|
+
function n(n) {
|
|
8
|
+
let { width: i, height: a, heights: o, size: s, base: c = 0, exaggeration: l = 1, noData: u, fill: d = "nearest", registration: f = "point", flipRows: p = !1 } = n, m = n.origin ?? [-s[0] / 2, -s[1] / 2];
|
|
9
|
+
if (!Number.isInteger(i) || !Number.isInteger(a) || i < 2 || a < 2 || i > e || a > e) throw RangeError("Invalid grid height field; width and height are integers from 2 to 65536.");
|
|
10
|
+
if (!o || typeof o.length != "number" || o.length !== i * a) throw RangeError(`Invalid grid height field; heights needs ${i * a} numbers, got ${o?.length}.`);
|
|
11
|
+
if (!Array.isArray(s) && !ArrayBuffer.isView(s)) throw RangeError("Invalid grid height field; size is [x, z].");
|
|
12
|
+
if (s.length !== 2 || !(s[0] > 0) || !(s[1] > 0) || s[0] > 1e5 || s[1] > 1e5) throw RangeError("Invalid grid height field; size is [x, z], each above 0 to 100000.");
|
|
13
|
+
if (m.length !== 2) throw RangeError("Invalid grid height field; origin is [x, z].");
|
|
14
|
+
if (t(m[0], "origin x"), t(m[1], "origin z"), t(c, "base"), t(l, "exaggeration"), u !== void 0 && typeof u != "number") throw RangeError("Invalid grid height field; noData is a number.");
|
|
15
|
+
if (f !== "point" && f !== "area") throw RangeError("Invalid grid height field; registration is 'point' or 'area'.");
|
|
16
|
+
if (typeof d == "number") t(d, "fill");
|
|
17
|
+
else if (d !== "nearest" && d !== "min" && d !== "mean") throw RangeError("Invalid grid height field; fill is a number, 'nearest', 'min' or 'mean'.");
|
|
18
|
+
let h = i * a, g = new Float32Array(h), _ = new Uint8Array(h), v = u === void 0 || Number.isNaN(u) ? NaN : Math.fround(u), y = 0, b = 0, x = Infinity;
|
|
19
|
+
for (let e = 0; e < a; e++) {
|
|
20
|
+
let t = (p ? a - 1 - e : e) * i;
|
|
21
|
+
for (let n = 0; n < i; n++) {
|
|
22
|
+
let r = Number(o[e * i + n]);
|
|
23
|
+
if (Number.isNaN(r) || Math.fround(r) === v) {
|
|
24
|
+
g[t + n] = NaN, _[t + n] = 1;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (!Number.isFinite(r)) throw RangeError("Invalid grid height field; a height is infinite; mark missing samples with NaN or noData.");
|
|
28
|
+
let a = r * l + c;
|
|
29
|
+
if (!Number.isFinite(Math.fround(a))) throw RangeError("Invalid grid height field; a height times exaggeration plus base is not finite.");
|
|
30
|
+
g[t + n] = a, y++, b += a, a < x && (x = a);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let S = h - y;
|
|
34
|
+
if (S) {
|
|
35
|
+
let e;
|
|
36
|
+
if (typeof d == "number") e = d;
|
|
37
|
+
else if (y) e = d === "min" ? x : d === "mean" ? b / y : NaN;
|
|
38
|
+
else throw RangeError("Invalid grid height field; no sample is valid, so fill must be a number.");
|
|
39
|
+
if (d === "nearest") r(g, _, i, a);
|
|
40
|
+
else for (let t = 0; t < h; t++) _[t] && (g[t] = e);
|
|
41
|
+
}
|
|
42
|
+
let C = Infinity, w = -Infinity;
|
|
43
|
+
for (let e = 0; e < h; e++) {
|
|
44
|
+
let t = g[e];
|
|
45
|
+
t < C && (C = t), t > w && (w = t);
|
|
46
|
+
}
|
|
47
|
+
let T = f === "area", E = m[0], D = m[1], O = (T ? i : i - 1) / s[0], k = (T ? a : a - 1) / s[1], A = T ? .5 : 0, j = [i - 1, a - 1];
|
|
48
|
+
return Object.assign((e, t) => {
|
|
49
|
+
let n = Math.min(Math.max((e - E) * O - A, 0), j[0]), r = Math.min(Math.max((t - D) * k - A, 0), j[1]), o = Math.min(Math.floor(n), i - 2), s = Math.min(Math.floor(r), a - 2), c = n - o, l = r - s, u = g[s * i + o], d = g[s * i + o + 1], f = g[(s + 1) * i + o], p = g[(s + 1) * i + o + 1];
|
|
50
|
+
return (u + (d - u) * c) * (1 - l) + (f + (p - f) * c) * l;
|
|
51
|
+
}, {
|
|
52
|
+
min: C,
|
|
53
|
+
max: w,
|
|
54
|
+
origin: [E, D],
|
|
55
|
+
size: [s[0], s[1]],
|
|
56
|
+
filled: S
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function r(e, t, n, r) {
|
|
60
|
+
let i = new Uint32Array(n * r), a = 0, o = 0;
|
|
61
|
+
for (let e = 0; e < t.length; e++) t[e] || (i[o++] = e);
|
|
62
|
+
let s = t.slice();
|
|
63
|
+
for (; a < o;) {
|
|
64
|
+
let t = i[a++], c = t % n, l = (t - c) / n;
|
|
65
|
+
for (let a = -1; a <= 1; a++) for (let u = -1; u <= 1; u++) {
|
|
66
|
+
let d = c + u, f = l + a;
|
|
67
|
+
if (d < 0 || f < 0 || d >= n || f >= r) continue;
|
|
68
|
+
let p = f * n + d;
|
|
69
|
+
s[p] && (s[p] = 0, e[p] = e[t], i[o++] = p);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { n as gridHeightField };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" preserve="true" />
|
|
2
|
+
import type { EngineKernel } from '@margoengine/core';
|
|
3
|
+
import { type Engine, type EnginePlugin } from '@margoengine/core/extension';
|
|
4
|
+
import { type GeometryData } from '@margoengine/geometry/utils';
|
|
5
|
+
import type { Geometry } from '@margoengine/core';
|
|
6
|
+
import type { HeightField } from '@margoengine/math';
|
|
7
|
+
export type { HeightField };
|
|
8
|
+
/** Area and sampling of `heightfieldGeometry` and `TerrainHeightmap`. Invalid values throw RangeError. */
|
|
9
|
+
export interface HeightfieldOptions {
|
|
10
|
+
/** World XZ extent, each 0-100,000 (exclusive of 0). */
|
|
11
|
+
size: readonly [number, number];
|
|
12
|
+
/** Minimum world XZ corner. Default: centred on the origin (`-size / 2`). */
|
|
13
|
+
origin?: readonly [number, number];
|
|
14
|
+
/** Segments (mesh) or texels (heightmap) per side, an integer 1-1024. Default 192 (mesh) / 256 (heightmap). */
|
|
15
|
+
resolution?: number;
|
|
16
|
+
}
|
|
17
|
+
/** Y-up mesh with recomputed slope normals; origin is the minimum world XZ corner. */
|
|
18
|
+
export declare function heightfieldGeometry(height: HeightField, options: HeightfieldOptions): GeometryData;
|
|
19
|
+
/**
|
|
20
|
+
* {@link heightfieldGeometry} as a core `Geometry`, ready for `mesh.setGeometry` (positions and normals; core keeps no
|
|
21
|
+
* UVs). Use `heightfieldGeometry` when you need the UVs or want to edit the arrays first.
|
|
22
|
+
*/
|
|
23
|
+
export declare function heightfield(height: HeightField, options: HeightfieldOptions): Geometry;
|
|
24
|
+
/** Owns a sampled height texture and regenerates it on device restoration. */
|
|
25
|
+
export declare class TerrainHeightmap implements EnginePlugin {
|
|
26
|
+
private readonly height;
|
|
27
|
+
private readonly options;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
texture?: GPUTexture;
|
|
30
|
+
private engine?;
|
|
31
|
+
private disposed;
|
|
32
|
+
constructor(height: HeightField, options: HeightfieldOptions);
|
|
33
|
+
static attach(engine: EngineKernel, height: HeightField, options: HeightfieldOptions): TerrainHeightmap;
|
|
34
|
+
setup(engine: Engine): void;
|
|
35
|
+
onDeviceRestored(engine: Engine): void;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
[Symbol.dispose]: () => void;
|
|
38
|
+
}
|
package/dist/holes.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Terrain, TerrainOptions } from './index.js';
|
|
2
|
+
import type { TerrainHoleMask } from './query.js';
|
|
3
|
+
export type { TerrainHoleMask } from './query.js';
|
|
4
|
+
/**
|
|
5
|
+
* A hole mask for a terrain: one byte a cell over the terrain's `origin` and `size` (255 ground, 0 hole). Cut shapes,
|
|
6
|
+
* make the texture for `TerrainTextures.holes` with `texture(device)`, and send later edits with `upload(terrain)`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TerrainHoles implements TerrainHoleMask {
|
|
9
|
+
#private;
|
|
10
|
+
readonly columns: number;
|
|
11
|
+
readonly rows: number;
|
|
12
|
+
readonly mask: Uint8Array;
|
|
13
|
+
/**
|
|
14
|
+
* @param options the terrain's `origin` and `size` (`terrain.options` fits).
|
|
15
|
+
* @param columns mask cells along X, 1 to 8,192: one per heightmap cell (heightmap columns - 1) cuts holes cell by
|
|
16
|
+
* cell, as `TerrainQuery` hits them exactly.
|
|
17
|
+
* @param rows mask cells along Z. Default `columns`.
|
|
18
|
+
* @throws RangeError for a bad size or cell count.
|
|
19
|
+
*/
|
|
20
|
+
constructor(options: Pick<TerrainOptions, 'origin' | 'size'>, columns: number, rows?: number);
|
|
21
|
+
/** Whether world (x, z) lies in a hole (false outside the mask). */
|
|
22
|
+
hole(x: number, z: number): boolean;
|
|
23
|
+
/** Cuts (or with `hole` false, fills) the cells whose centres lie within `radius` of world (x, z). */
|
|
24
|
+
circle(x: number, z: number, radius: number, hole?: boolean): this;
|
|
25
|
+
/** Cuts (or fills) the cells whose centres lie in the world rectangle from (x0, z0) to (x1, z1). */
|
|
26
|
+
rect(x0: number, z0: number, x1: number, z1: number, hole?: boolean): this;
|
|
27
|
+
/** Cuts (or fills) the cells whose centres lie inside a world XZ polygon (3 or more points, even-odd rule). */
|
|
28
|
+
polygon(points: readonly (readonly [number, number])[], hole?: boolean): this;
|
|
29
|
+
/** Makes an `r8unorm` texture of the mask for `TerrainTextures.holes` (call it in the terrain's `textures` factory). */
|
|
30
|
+
texture(device: GPUDevice): GPUTexture;
|
|
31
|
+
/**
|
|
32
|
+
* Sends the cells changed since the last `texture` or `upload` to the terrain's holes texture (its `holes`, made by
|
|
33
|
+
* `texture`), and invalidates its shadow. Returns whether anything was sent.
|
|
34
|
+
* @throws TypeError when the terrain has no holes texture of this mask's size.
|
|
35
|
+
*/
|
|
36
|
+
upload(terrain: Terrain): boolean;
|
|
37
|
+
}
|