@adatechnology/game-urban 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +170 -2
- package/dist/index.d.ts +1769 -0
- package/dist/index.global.js +31835 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +1614 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1769 @@
|
|
|
1
|
+
import * as _adatechnology_game_floorplan from '@adatechnology/game-floorplan';
|
|
2
|
+
import { SilhouettePart, SilhouetteWindow, RandomSource, Silhouette } from '@adatechnology/game-floorplan';
|
|
3
|
+
export { RandomSource, Silhouette, SilhouettePart, SilhouetteWindow } from '@adatechnology/game-floorplan';
|
|
4
|
+
import { DeepPartial } from '@adatechnology/game-contracts';
|
|
5
|
+
import { Region } from '@adatechnology/game-vegetation-species';
|
|
6
|
+
|
|
7
|
+
type Trig = 'sin' | 'cos';
|
|
8
|
+
type Point = readonly [number, number];
|
|
9
|
+
type Rect = readonly [number, number, number, number];
|
|
10
|
+
/** One term of a rolling surface. `product`: `fx(kx·px) · fy(ky·py) · amplitude`. `diagonal`: `sin(kx·px + ky·py) · amplitude`. */
|
|
11
|
+
type Wave = {
|
|
12
|
+
kind: 'product';
|
|
13
|
+
x: readonly [Trig, number];
|
|
14
|
+
y: readonly [Trig, number];
|
|
15
|
+
amplitude: number;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'diagonal';
|
|
18
|
+
kx: number;
|
|
19
|
+
ky: number;
|
|
20
|
+
amplitude: number;
|
|
21
|
+
};
|
|
22
|
+
/** A factor of a mask: a smoothstep along one axis. With `fullUntil`, everything before that value counts as 1. */
|
|
23
|
+
type Ramp = {
|
|
24
|
+
axis: 'x' | 'y';
|
|
25
|
+
from: number;
|
|
26
|
+
to: number;
|
|
27
|
+
fullUntil?: number;
|
|
28
|
+
};
|
|
29
|
+
/** A region that adds relief: `mask · (level + waves)`. The mask is the product of its ramps. */
|
|
30
|
+
type TerrainLayer = {
|
|
31
|
+
id: string;
|
|
32
|
+
mask: readonly Ramp[];
|
|
33
|
+
level: number;
|
|
34
|
+
waves: readonly Wave[];
|
|
35
|
+
};
|
|
36
|
+
/** Levels a rectangle (a city) towards `level`, from `margin` outside it to the inside, by a smoothstep of the distance to its nearest edge. */
|
|
37
|
+
type Flatten = {
|
|
38
|
+
id: string;
|
|
39
|
+
rect: Rect;
|
|
40
|
+
margin: number;
|
|
41
|
+
edge: readonly [number, number];
|
|
42
|
+
level: number;
|
|
43
|
+
};
|
|
44
|
+
/** The bed of a river: a fixed height, or `below` the surrounding ground but never lower than `floor`. */
|
|
45
|
+
type RiverBed = {
|
|
46
|
+
fixed: number;
|
|
47
|
+
} | {
|
|
48
|
+
below: number;
|
|
49
|
+
floor: number;
|
|
50
|
+
};
|
|
51
|
+
/** A river as a polyline; the ground eases from the bed to the land between the two distances of `width`. */
|
|
52
|
+
type River = {
|
|
53
|
+
id: string;
|
|
54
|
+
points: readonly Point[];
|
|
55
|
+
width: readonly [number, number];
|
|
56
|
+
bed: RiverBed;
|
|
57
|
+
};
|
|
58
|
+
/** A lake as an ellipse; the ground eases from `level` to the land between the two fractions of `edge` and is untouched past `reach`. */
|
|
59
|
+
type Lake = {
|
|
60
|
+
id: string;
|
|
61
|
+
center: Point;
|
|
62
|
+
radius: Point;
|
|
63
|
+
level: number;
|
|
64
|
+
edge: readonly [number, number];
|
|
65
|
+
reach: number;
|
|
66
|
+
};
|
|
67
|
+
/** Where trees grow: the strongest of the masked zones and a patchy noise. */
|
|
68
|
+
type ForestOptions = {
|
|
69
|
+
zones: readonly {
|
|
70
|
+
mask: readonly Ramp[];
|
|
71
|
+
}[];
|
|
72
|
+
patch?: {
|
|
73
|
+
waves: readonly Wave[];
|
|
74
|
+
edge: readonly [number, number];
|
|
75
|
+
weight: number;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/** What colours a vertex, tried in this order; the first rule that matches wins. */
|
|
79
|
+
type ColorRule = {
|
|
80
|
+
kind: 'below';
|
|
81
|
+
height: number;
|
|
82
|
+
color: number;
|
|
83
|
+
} | {
|
|
84
|
+
kind: 'above';
|
|
85
|
+
height: number;
|
|
86
|
+
color: number;
|
|
87
|
+
} | {
|
|
88
|
+
kind: 'ellipse';
|
|
89
|
+
center: Point;
|
|
90
|
+
radius: Point;
|
|
91
|
+
color: number;
|
|
92
|
+
} | {
|
|
93
|
+
kind: 'rects';
|
|
94
|
+
rects: readonly Rect[];
|
|
95
|
+
margin: number;
|
|
96
|
+
color: number;
|
|
97
|
+
} | {
|
|
98
|
+
kind: 'forest';
|
|
99
|
+
above: number;
|
|
100
|
+
color: number;
|
|
101
|
+
};
|
|
102
|
+
/** Map coordinates (the ground plan) to world metres: `world = map · scale + origin`. The mesh is a square of `size` metres with `segments` cells a side. */
|
|
103
|
+
type WorldFrame = {
|
|
104
|
+
size: number;
|
|
105
|
+
scale: number;
|
|
106
|
+
origin: number;
|
|
107
|
+
segments: number;
|
|
108
|
+
};
|
|
109
|
+
/** Everything that makes a terrain; the numbers of a place live in the game, not here. */
|
|
110
|
+
type TerrainOptions = {
|
|
111
|
+
world: WorldFrame;
|
|
112
|
+
base: {
|
|
113
|
+
level: number;
|
|
114
|
+
waves: readonly Wave[];
|
|
115
|
+
};
|
|
116
|
+
layers: readonly TerrainLayer[];
|
|
117
|
+
flatten: readonly Flatten[];
|
|
118
|
+
rivers: readonly River[];
|
|
119
|
+
lakes: readonly Lake[];
|
|
120
|
+
forest: ForestOptions;
|
|
121
|
+
colors: readonly ColorRule[];
|
|
122
|
+
/** Colours of the open ground, picked by a hash of the map cell. */
|
|
123
|
+
fields: {
|
|
124
|
+
colors: readonly number[];
|
|
125
|
+
cell: Point;
|
|
126
|
+
};
|
|
127
|
+
/** The water plane under the whole terrain. */
|
|
128
|
+
water: {
|
|
129
|
+
level: number;
|
|
130
|
+
color: number;
|
|
131
|
+
roughness: number;
|
|
132
|
+
metalness: number;
|
|
133
|
+
};
|
|
134
|
+
/** Shape of the last touch: changes the height after every layer, river and lake. */
|
|
135
|
+
custom?: (px: number, py: number, height: number) => number;
|
|
136
|
+
};
|
|
137
|
+
/** The ground as numbers a drawer turns into a mesh: a grid of `segments + 1` vertices a side, rows along z. */
|
|
138
|
+
type TerrainGrid = {
|
|
139
|
+
segments: number;
|
|
140
|
+
size: number;
|
|
141
|
+
/** x and z of each vertex in world metres. */
|
|
142
|
+
x: Float32Array;
|
|
143
|
+
z: Float32Array;
|
|
144
|
+
heights: Float32Array;
|
|
145
|
+
/** Colour of each vertex as 0xRRGGBB. */
|
|
146
|
+
colors: Uint32Array;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/** How a drawer treats a part when the default (standard material, rough 0.9, shadows on) is not what the team's page does. */
|
|
150
|
+
type PartStyle = {
|
|
151
|
+
/** Metal and paint of the standard material. */
|
|
152
|
+
roughness?: number;
|
|
153
|
+
metalness?: number;
|
|
154
|
+
/** Shadows: boxes, cylinders, cones and prisms cast and receive by default, planes only receive, crowns only cast, signs and lines neither. */
|
|
155
|
+
castShadow?: boolean;
|
|
156
|
+
receiveShadow?: boolean;
|
|
157
|
+
};
|
|
158
|
+
type Styled<TPart> = TPart & {
|
|
159
|
+
style?: PartStyle;
|
|
160
|
+
};
|
|
161
|
+
/** A cone (pointed cap of an iron pole, pine foliage); `y` is the centre. Flat shaded. */
|
|
162
|
+
type ConePart = {
|
|
163
|
+
shape: 'cone';
|
|
164
|
+
parent: number;
|
|
165
|
+
x: number;
|
|
166
|
+
y: number;
|
|
167
|
+
z: number;
|
|
168
|
+
radius: number;
|
|
169
|
+
height: number;
|
|
170
|
+
color: number;
|
|
171
|
+
segments: number;
|
|
172
|
+
style?: PartStyle;
|
|
173
|
+
};
|
|
174
|
+
/** A rough ball of leaves (a dodecahedron of the given radius). Casts shadows only. */
|
|
175
|
+
type CrownPart = {
|
|
176
|
+
shape: 'crown';
|
|
177
|
+
parent: number;
|
|
178
|
+
x: number;
|
|
179
|
+
y: number;
|
|
180
|
+
z: number;
|
|
181
|
+
radius: number;
|
|
182
|
+
color: number;
|
|
183
|
+
style?: PartStyle;
|
|
184
|
+
};
|
|
185
|
+
/** Half (or any arc) of a cylinder lying down, for a barrel-vault roof. Casts shadows only. `rotation` and `scale` are the mesh's own. */
|
|
186
|
+
type VaultPart = {
|
|
187
|
+
shape: 'vault';
|
|
188
|
+
parent: number;
|
|
189
|
+
x: number;
|
|
190
|
+
y: number;
|
|
191
|
+
z: number;
|
|
192
|
+
radius: number;
|
|
193
|
+
length: number;
|
|
194
|
+
arc: number;
|
|
195
|
+
segments: number;
|
|
196
|
+
color: number;
|
|
197
|
+
rotation: {
|
|
198
|
+
x: number;
|
|
199
|
+
y: number;
|
|
200
|
+
z: number;
|
|
201
|
+
};
|
|
202
|
+
scale: {
|
|
203
|
+
x: number;
|
|
204
|
+
y: number;
|
|
205
|
+
z: number;
|
|
206
|
+
};
|
|
207
|
+
style?: PartStyle;
|
|
208
|
+
};
|
|
209
|
+
/** The ground: a square mesh of the grid's vertices with a colour each, flat shaded, that casts and receives shadows. */
|
|
210
|
+
type TerrainPart = {
|
|
211
|
+
shape: 'terrain';
|
|
212
|
+
parent: number;
|
|
213
|
+
grid: TerrainGrid;
|
|
214
|
+
style?: PartStyle;
|
|
215
|
+
};
|
|
216
|
+
/** A flat rectangle lying on the ground (`y` is its height). */
|
|
217
|
+
type PlanePart = {
|
|
218
|
+
shape: 'plane';
|
|
219
|
+
parent: number;
|
|
220
|
+
x: number;
|
|
221
|
+
y: number;
|
|
222
|
+
z: number;
|
|
223
|
+
width: number;
|
|
224
|
+
depth: number;
|
|
225
|
+
color: number;
|
|
226
|
+
style?: PartStyle;
|
|
227
|
+
};
|
|
228
|
+
/** Text over one or more lines on a canvas texture (street names, strip labels). */
|
|
229
|
+
type LabelPart = {
|
|
230
|
+
shape: 'label';
|
|
231
|
+
parent: number;
|
|
232
|
+
x: number;
|
|
233
|
+
y: number;
|
|
234
|
+
z: number;
|
|
235
|
+
width: number;
|
|
236
|
+
height: number;
|
|
237
|
+
ry: number;
|
|
238
|
+
lines: string[];
|
|
239
|
+
background: string;
|
|
240
|
+
foreground: string;
|
|
241
|
+
font: string;
|
|
242
|
+
canvas: {
|
|
243
|
+
width: number;
|
|
244
|
+
height: number;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
/** A real light. A lamp that did not get one from the budget keeps its glowing lens and has no part like this. */
|
|
248
|
+
type LightPart = {
|
|
249
|
+
shape: 'light';
|
|
250
|
+
kind: 'point';
|
|
251
|
+
parent: number;
|
|
252
|
+
x: number;
|
|
253
|
+
y: number;
|
|
254
|
+
z: number;
|
|
255
|
+
color: number;
|
|
256
|
+
intensity: number;
|
|
257
|
+
distance: number;
|
|
258
|
+
decay: number;
|
|
259
|
+
flicker: boolean;
|
|
260
|
+
} | {
|
|
261
|
+
shape: 'light';
|
|
262
|
+
kind: 'spot';
|
|
263
|
+
parent: number;
|
|
264
|
+
x: number;
|
|
265
|
+
y: number;
|
|
266
|
+
z: number;
|
|
267
|
+
color: number;
|
|
268
|
+
intensity: number;
|
|
269
|
+
distance: number;
|
|
270
|
+
decay: number;
|
|
271
|
+
angle: number;
|
|
272
|
+
penumbra: number;
|
|
273
|
+
/** Where the beam points at rest. */
|
|
274
|
+
target: {
|
|
275
|
+
x: number;
|
|
276
|
+
y: number;
|
|
277
|
+
z: number;
|
|
278
|
+
};
|
|
279
|
+
/** When set the target circles the light: `target = (x + sin(t·speed + x)·radius, 0, z + cos(t·speed + x)·radius)`. */
|
|
280
|
+
sweep?: {
|
|
281
|
+
speed: number;
|
|
282
|
+
radius: number;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* A thing another package draws where the scene says: a vehicle of the fleet or a plant of the species pack. The scene keeps only
|
|
287
|
+
* what to put and where; the drawer asks the resolver of that kind for an object (nothing is drawn when it has none).
|
|
288
|
+
* `y` is the base on the ground, `color` the body paint of a vehicle (omitted: the palette of its group by `seed`).
|
|
289
|
+
*/
|
|
290
|
+
type PlacementPart = {
|
|
291
|
+
shape: 'placement';
|
|
292
|
+
parent: number;
|
|
293
|
+
kind: 'vehicle' | 'plant';
|
|
294
|
+
/** Id of the vehicle in the fleet or of the species in the pack. */
|
|
295
|
+
id: string;
|
|
296
|
+
x: number;
|
|
297
|
+
y: number;
|
|
298
|
+
z: number;
|
|
299
|
+
ry: number;
|
|
300
|
+
scale: number;
|
|
301
|
+
color?: number;
|
|
302
|
+
seed: number | string;
|
|
303
|
+
};
|
|
304
|
+
/** The parts of an urban scene: the silhouette vocabulary of game-floorplan plus what streets and poles need. */
|
|
305
|
+
type UrbanPart = Styled<SilhouettePart> | ConePart | CrownPart | PlanePart | VaultPart | TerrainPart | LabelPart | LightPart | PlacementPart;
|
|
306
|
+
/** One small box drawn as an instance of a single mesh (dashes of a road, sandbags). `y` is the base. */
|
|
307
|
+
type ItemBox = {
|
|
308
|
+
x: number;
|
|
309
|
+
y: number;
|
|
310
|
+
z: number;
|
|
311
|
+
width: number;
|
|
312
|
+
height: number;
|
|
313
|
+
depth: number;
|
|
314
|
+
color: number;
|
|
315
|
+
rx: number;
|
|
316
|
+
ry: number;
|
|
317
|
+
rz: number;
|
|
318
|
+
};
|
|
319
|
+
/** Everything a pole, a street, a block or a prop adds to a scene, in the order the team's page adds it. */
|
|
320
|
+
type UrbanScene = {
|
|
321
|
+
parts: UrbanPart[];
|
|
322
|
+
items: ItemBox[];
|
|
323
|
+
windows: {
|
|
324
|
+
lit: SilhouetteWindow[];
|
|
325
|
+
dark: SilhouetteWindow[];
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
/** The lights a scene may spend. Every lamp that is on takes one, and the first ones win; the rest keep only their glowing lens. */
|
|
329
|
+
type LightBudget = {
|
|
330
|
+
/** Lights left. It goes below zero when more lamps ask than the budget had, as the team's counter does. */
|
|
331
|
+
left: number;
|
|
332
|
+
/** True while the budget lasts (spends one either way). */
|
|
333
|
+
take(): boolean;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
/** The team's counter: `take()` is `left-- > 0`, so the count keeps falling after the budget is spent. */
|
|
337
|
+
declare function createLightBudget(count: number): LightBudget;
|
|
338
|
+
|
|
339
|
+
type BoxOptions = {
|
|
340
|
+
parent?: number;
|
|
341
|
+
ry?: number;
|
|
342
|
+
rz?: number;
|
|
343
|
+
emissive?: boolean;
|
|
344
|
+
style?: PartStyle;
|
|
345
|
+
};
|
|
346
|
+
type UrbanBuilderOptions = {
|
|
347
|
+
/** Lights the scene may spend; omitted means no limit. */
|
|
348
|
+
budget?: LightBudget;
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* Collects the parts of an urban scene the way the team's page adds them to its root: every helper appends in call order, so a
|
|
352
|
+
* scene drawn with the same seeded random has the same parts, the same instances and the same windows.
|
|
353
|
+
* Heights follow the page: `y` is the base of a box, a cylinder, a cone and a prism, and the centre of a crown.
|
|
354
|
+
*/
|
|
355
|
+
declare function createUrbanBuilder(random: RandomSource, options?: UrbanBuilderOptions): {
|
|
356
|
+
random: RandomSource;
|
|
357
|
+
pick: <TEntry>(list: readonly TEntry[]) => TEntry;
|
|
358
|
+
lights: LightBudget;
|
|
359
|
+
parts: UrbanPart[];
|
|
360
|
+
items: ItemBox[];
|
|
361
|
+
windows: {
|
|
362
|
+
lit: _adatechnology_game_floorplan.SilhouetteWindow[];
|
|
363
|
+
dark: _adatechnology_game_floorplan.SilhouetteWindow[];
|
|
364
|
+
};
|
|
365
|
+
group: (x: number, y: number, z: number, ry?: number, parent?: number) => number;
|
|
366
|
+
box: (x: number, y: number, z: number, width: number, height: number, depth: number, color: number, o?: BoxOptions) => void;
|
|
367
|
+
cylinder: (x: number, y: number, z: number, radiusTop: number, radiusBottom: number, height: number, color: number, parent?: number, segments?: number, style?: PartStyle) => void;
|
|
368
|
+
cone: (x: number, y: number, z: number, radius: number, height: number, color: number, parent?: number, segments?: number) => void;
|
|
369
|
+
prism: (x: number, y: number, z: number, width: number, height: number, depth: number, color: number, parent?: number, ry?: number) => void;
|
|
370
|
+
plane: (x: number, y: number, z: number, width: number, depth: number, color: number, style?: PartStyle, parent?: number) => void;
|
|
371
|
+
vault: (part: Omit<Extract<UrbanPart, {
|
|
372
|
+
shape: "vault";
|
|
373
|
+
}>, "shape" | "parent"> & {
|
|
374
|
+
parent?: number;
|
|
375
|
+
}) => void;
|
|
376
|
+
terrain: (grid: TerrainGrid, parent?: number) => void;
|
|
377
|
+
crown: (x: number, y: number, z: number, radius: number, color: number, parent?: number) => void;
|
|
378
|
+
line: (points: [number, number, number][], color: number, parent?: number) => void;
|
|
379
|
+
label: (lines: string[], x: number, y: number, z: number, width: number, height: number, ry: number, o: {
|
|
380
|
+
background: string;
|
|
381
|
+
foreground: string;
|
|
382
|
+
font?: string;
|
|
383
|
+
canvas?: {
|
|
384
|
+
width: number;
|
|
385
|
+
height: number;
|
|
386
|
+
};
|
|
387
|
+
}, parent?: number) => void;
|
|
388
|
+
light: (part: Omit<Extract<LightPart, {
|
|
389
|
+
kind: "point";
|
|
390
|
+
}>, "shape" | "kind" | "parent" | "decay" | "flicker"> & {
|
|
391
|
+
flicker?: boolean;
|
|
392
|
+
decay?: number;
|
|
393
|
+
}) => void;
|
|
394
|
+
spot: (part: Omit<Extract<LightPart, {
|
|
395
|
+
kind: "spot";
|
|
396
|
+
}>, "shape" | "kind" | "parent">) => void;
|
|
397
|
+
place: (kind: PlacementPart["kind"], id: string, x: number, z: number, o?: {
|
|
398
|
+
y?: number;
|
|
399
|
+
ry?: number;
|
|
400
|
+
scale?: number;
|
|
401
|
+
color?: number;
|
|
402
|
+
seed?: number | string;
|
|
403
|
+
parent?: number;
|
|
404
|
+
}) => void;
|
|
405
|
+
item: (x: number, y: number, z: number, width: number, height: number, depth: number, color: number, ry?: number, rx?: number, rz?: number) => void;
|
|
406
|
+
fence: (x0: number, z0: number, x1: number, z1: number, height: number, color?: number) => void;
|
|
407
|
+
add: (silhouette: Silhouette) => void;
|
|
408
|
+
scene: () => UrbanScene;
|
|
409
|
+
};
|
|
410
|
+
type UrbanBuilder = ReturnType<typeof createUrbanBuilder>;
|
|
411
|
+
|
|
412
|
+
/** The pole that carries the lamp: a tapered cylinder. */
|
|
413
|
+
type MastSpec = {
|
|
414
|
+
radiusTop: number;
|
|
415
|
+
radiusBottom: number;
|
|
416
|
+
height: number;
|
|
417
|
+
color: number;
|
|
418
|
+
segments?: number;
|
|
419
|
+
style?: PartStyle;
|
|
420
|
+
};
|
|
421
|
+
/** A bar or a box of the pole, placed by its base `y`. `reach` is how far from the mast its centre sits. */
|
|
422
|
+
type BarSpec = {
|
|
423
|
+
reach: number;
|
|
424
|
+
y: number;
|
|
425
|
+
width: number;
|
|
426
|
+
height: number;
|
|
427
|
+
depth: number;
|
|
428
|
+
color: number;
|
|
429
|
+
};
|
|
430
|
+
/** The box of a lamp head: its colour is the lens, lit or unlit. */
|
|
431
|
+
type LampSpec = {
|
|
432
|
+
reach: number;
|
|
433
|
+
y: number;
|
|
434
|
+
width: number;
|
|
435
|
+
height: number;
|
|
436
|
+
depth: number;
|
|
437
|
+
};
|
|
438
|
+
/** Colour of the lamp lens when the lamp is on (it glows) and when it is off. */
|
|
439
|
+
type LensSpec = {
|
|
440
|
+
lit: number;
|
|
441
|
+
unlit: number;
|
|
442
|
+
};
|
|
443
|
+
/** The real light a lamp that is on may get from the budget. `reach` moves it along the arm. */
|
|
444
|
+
type LampLightSpec = {
|
|
445
|
+
color: number;
|
|
446
|
+
intensity: number;
|
|
447
|
+
distance: number;
|
|
448
|
+
y: number;
|
|
449
|
+
reach?: number;
|
|
450
|
+
z?: number;
|
|
451
|
+
};
|
|
452
|
+
/** Double arm with two LED heads (the avenue pole of the downtown pattern). */
|
|
453
|
+
type DoubleArmSpec = {
|
|
454
|
+
mast: MastSpec;
|
|
455
|
+
arm: BarSpec;
|
|
456
|
+
lamp: LampSpec;
|
|
457
|
+
lens: LensSpec;
|
|
458
|
+
light: LampLightSpec;
|
|
459
|
+
};
|
|
460
|
+
/** Concrete pole with one arm and a sodium lamp, with an optional transformer drum. */
|
|
461
|
+
type SingleArmSpec = {
|
|
462
|
+
mast: MastSpec;
|
|
463
|
+
arm: BarSpec;
|
|
464
|
+
lamp: LampSpec;
|
|
465
|
+
lens: LensSpec;
|
|
466
|
+
light: LampLightSpec;
|
|
467
|
+
transformer: {
|
|
468
|
+
offset: number;
|
|
469
|
+
y: number;
|
|
470
|
+
radius: number;
|
|
471
|
+
height: number;
|
|
472
|
+
color: number;
|
|
473
|
+
segments: number;
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
/** Short iron post with a lantern box and a pointed cap. */
|
|
477
|
+
type LanternSpec = {
|
|
478
|
+
mast: MastSpec;
|
|
479
|
+
lamp: LampSpec;
|
|
480
|
+
cap: {
|
|
481
|
+
y: number;
|
|
482
|
+
radius: number;
|
|
483
|
+
height: number;
|
|
484
|
+
color: number;
|
|
485
|
+
segments: number;
|
|
486
|
+
};
|
|
487
|
+
lens: LensSpec;
|
|
488
|
+
light: LampLightSpec;
|
|
489
|
+
};
|
|
490
|
+
/** Wooden pole with a crossarm and a hanging lamp. */
|
|
491
|
+
type CrossarmSpec = {
|
|
492
|
+
mast: MastSpec;
|
|
493
|
+
arm: BarSpec;
|
|
494
|
+
lamp: LampSpec;
|
|
495
|
+
lens: LensSpec;
|
|
496
|
+
light: LampLightSpec;
|
|
497
|
+
};
|
|
498
|
+
/** Four-legged tower with a deck and a row of floodlights. */
|
|
499
|
+
type FloodTowerSpec = {
|
|
500
|
+
legs: {
|
|
501
|
+
offset: number;
|
|
502
|
+
height: number;
|
|
503
|
+
size: number;
|
|
504
|
+
color: number;
|
|
505
|
+
};
|
|
506
|
+
deck: BarSpec;
|
|
507
|
+
heads: {
|
|
508
|
+
count: number;
|
|
509
|
+
start: number;
|
|
510
|
+
spacing: number;
|
|
511
|
+
y: number;
|
|
512
|
+
z: number;
|
|
513
|
+
width: number;
|
|
514
|
+
height: number;
|
|
515
|
+
depth: number;
|
|
516
|
+
};
|
|
517
|
+
lens: LensSpec;
|
|
518
|
+
light: LampLightSpec;
|
|
519
|
+
};
|
|
520
|
+
/** What a game says when it places a pole. */
|
|
521
|
+
type PoleOptions = {
|
|
522
|
+
x: number;
|
|
523
|
+
z: number;
|
|
524
|
+
/** Lit lamp (glowing lens and, while the budget lasts, a real light). Default true. */
|
|
525
|
+
on?: boolean;
|
|
526
|
+
/** Turns the whole pole (the double arm only; the others are placed by their arm direction). */
|
|
527
|
+
ry?: number;
|
|
528
|
+
/** The real light flickers (a failing lamp). */
|
|
529
|
+
flicker?: boolean;
|
|
530
|
+
/** Which way the arm points, 1 or -1 (single arm). Default 1. */
|
|
531
|
+
dir?: number;
|
|
532
|
+
/** Adds the transformer drum (single arm). */
|
|
533
|
+
transformer?: boolean;
|
|
534
|
+
};
|
|
535
|
+
type PoleShapeBuilder = (b: UrbanBuilder, spec: any, o: PoleOptions) => void;
|
|
536
|
+
type PoleDef = {
|
|
537
|
+
id: string;
|
|
538
|
+
/** Key of the shape builder that reads `spec`. */
|
|
539
|
+
shape: string;
|
|
540
|
+
spec: object;
|
|
541
|
+
};
|
|
542
|
+
/** The shape builders the five default poles use; a game adds its own through `createUrban({ shapes })`. */
|
|
543
|
+
declare const POLE_SHAPES: Readonly<Record<string, PoleShapeBuilder>>;
|
|
544
|
+
/**
|
|
545
|
+
* The five poles of the neighbourhood patterns, with the numbers of the Galeria (heights, arms, lens colours, the colour,
|
|
546
|
+
* strength and reach of the real light). A game patches a number by id or adds a pole with its own shape.
|
|
547
|
+
*/
|
|
548
|
+
declare const DEFAULT_POLES: readonly PoleDef[];
|
|
549
|
+
|
|
550
|
+
/** Look of the road surface and its centre line; the defaults are the Galeria's. */
|
|
551
|
+
type RoadStyle = {
|
|
552
|
+
color: number;
|
|
553
|
+
/** Painted dashes along the centre line. */
|
|
554
|
+
dash: {
|
|
555
|
+
color: number;
|
|
556
|
+
every: number;
|
|
557
|
+
first: number;
|
|
558
|
+
length: number;
|
|
559
|
+
width: number;
|
|
560
|
+
height: number;
|
|
561
|
+
y: number;
|
|
562
|
+
};
|
|
563
|
+
};
|
|
564
|
+
type WalkStyle = {
|
|
565
|
+
color: number;
|
|
566
|
+
height: number;
|
|
567
|
+
castShadow: boolean;
|
|
568
|
+
};
|
|
569
|
+
declare const DEFAULT_ROAD_STYLE: RoadStyle;
|
|
570
|
+
declare const DEFAULT_WALK_STYLE: WalkStyle;
|
|
571
|
+
type StreetOptions = {
|
|
572
|
+
road?: Partial<RoadStyle> & {
|
|
573
|
+
dash?: Partial<RoadStyle['dash']>;
|
|
574
|
+
};
|
|
575
|
+
walk?: Partial<WalkStyle>;
|
|
576
|
+
};
|
|
577
|
+
/** Road centred on (x, z), `w` wide and `l` long along `x` or `z`, with a dash every 5 m starting 2 m from its start. */
|
|
578
|
+
declare function drawRoad(b: UrbanBuilder, x: number, z: number, w: number, l: number, along: 'x' | 'z', options?: StreetOptions): void;
|
|
579
|
+
/** Sidewalk slab centred on (x, z). */
|
|
580
|
+
declare function drawWalk(b: UrbanBuilder, x: number, z: number, w: number, d: number, options?: StreetOptions): void;
|
|
581
|
+
/** The big plane under the scene. */
|
|
582
|
+
declare function drawGround(b: UrbanBuilder, color?: number, size?: number): void;
|
|
583
|
+
/**
|
|
584
|
+
* A grid of `2n + 1` roads each way, `block` apart and `width` wide, with a sidewalk slab on every one of the `2n x 2n` blocks.
|
|
585
|
+
* Roads first (z then x for each line), then the walks, as the page.
|
|
586
|
+
*/
|
|
587
|
+
declare function drawStreetGrid(b: UrbanBuilder, block: number, count: number, width: number, options?: StreetOptions): void;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* One kind of tower the city can put on a tall lot: the numbers of a typology of `game-floorplan-commercial` (office) or `game-floorplan-residential`
|
|
591
|
+
* (residential), which the tests keep equal to theirs. The city only draws the outside; the plan of the inside is the typology's.
|
|
592
|
+
*/
|
|
593
|
+
type TowerPreset = {
|
|
594
|
+
id: string;
|
|
595
|
+
/** Chance weight among the presets (the one the random picks). */
|
|
596
|
+
weight: number;
|
|
597
|
+
/** Floor to floor in metres: the clear height of the typology plus its slab. */
|
|
598
|
+
storeyHeight: number;
|
|
599
|
+
/** A plant floor (darker band, no windows) every this many storeys; `false` none. */
|
|
600
|
+
mechanicalEvery: number | false;
|
|
601
|
+
/** A glass curtain wall (a ribbon of tall windows on a tinted skin) or a punched facade (a window in each bay of the masonry). */
|
|
602
|
+
glass: boolean;
|
|
603
|
+
/** Fewest and most storeys this preset's towers have (the lot height is raised or cut to it); omitted: no minimum, and `TowerOptions.maxStoreys` for the top. */
|
|
604
|
+
minStoreys?: number;
|
|
605
|
+
maxStoreys?: number;
|
|
606
|
+
/** Colour of the skin; omitted: the facade colour the block drew for the lot (glass: a blue tint of it). */
|
|
607
|
+
color?: number;
|
|
608
|
+
};
|
|
609
|
+
/** The two typologies: the office tower (4.0 m storeys: 3.6 clear and 0.4 slab, a plant floor every 20, glass) and the residential tower (3.1 m, every 25, masonry). */
|
|
610
|
+
declare const DEFAULT_TOWER_PRESETS: readonly TowerPreset[];
|
|
611
|
+
/**
|
|
612
|
+
* A preset from the layout of a typology (`officeTowerLayout(opts)`, `residentialTowerLayout(opts)`), so the city draws the tower the game configured:
|
|
613
|
+
* the storey pitch and the facade come from the layout, the storey range from its `range` when given.
|
|
614
|
+
*/
|
|
615
|
+
declare const towerPresetOf: (id: string, weight: number, layout: {
|
|
616
|
+
pitch: number;
|
|
617
|
+
facade: "curtain" | "punched";
|
|
618
|
+
}, extra?: Partial<Omit<TowerPreset, "id" | "weight" | "storeyHeight" | "glass">>) => TowerPreset;
|
|
619
|
+
/** What a game asks a tower provider to put on the ground: the lot, the height, the preset the random chose and the facade colour. */
|
|
620
|
+
type TowerRequest = {
|
|
621
|
+
x: number;
|
|
622
|
+
z: number;
|
|
623
|
+
width: number;
|
|
624
|
+
depth: number;
|
|
625
|
+
height: number;
|
|
626
|
+
color: number;
|
|
627
|
+
preset: TowerPreset;
|
|
628
|
+
lit: number;
|
|
629
|
+
use?: string;
|
|
630
|
+
storeys?: number;
|
|
631
|
+
};
|
|
632
|
+
/** Draws a tower in place of the default one (the game's own model, or the plan of the typology rendered by `game-floorplan-three`). */
|
|
633
|
+
type TowerProvider = (request: TowerRequest, b: UrbanBuilder) => void;
|
|
634
|
+
type TowerOptions = {
|
|
635
|
+
/** A building at least this tall (metres) is drawn as a tower. Default 60. */
|
|
636
|
+
minHeight?: number;
|
|
637
|
+
/** Kinds of tower and their weights. Default `DEFAULT_TOWER_PRESETS`. */
|
|
638
|
+
presets?: readonly TowerPreset[];
|
|
639
|
+
/** Replaces the default drawing. */
|
|
640
|
+
provider?: TowerProvider;
|
|
641
|
+
/** The crown: height of the mast over the roof as a share of the tower (default 0.06, at most 25 m), 0 for none. */
|
|
642
|
+
mast?: number;
|
|
643
|
+
/** Most storeys a tower may have (default 60, the structural limit of the kit): a taller lot is drawn at this many storeys of its preset. */
|
|
644
|
+
maxStoreys?: number;
|
|
645
|
+
/** Chance that a window is lit when the block did not say (default 0.12). */
|
|
646
|
+
lit?: number;
|
|
647
|
+
};
|
|
648
|
+
declare const TOWER_DEFAULTS: {
|
|
649
|
+
readonly minHeight: 60;
|
|
650
|
+
readonly maxStoreys: 60;
|
|
651
|
+
readonly mast: 0.06;
|
|
652
|
+
readonly lit: 0.12;
|
|
653
|
+
};
|
|
654
|
+
/** The preset the random picks by weight; draws once. */
|
|
655
|
+
declare function pickTowerPreset(b: UrbanBuilder, presets: readonly TowerPreset[]): TowerPreset;
|
|
656
|
+
/** Storeys of a tower of this height, the podium (a taller ground storey) included. */
|
|
657
|
+
declare const towerStoreys: (height: number, preset: TowerPreset) => number;
|
|
658
|
+
/**
|
|
659
|
+
* A tower: a podium with a taller ground storey, the shaft with a row of windows on every storey of its four faces, darker bands where the plant
|
|
660
|
+
* floors are (no windows), the top plant floor set back, the parapet and the mast. Draws one random per window (lit or not), after the preset's.
|
|
661
|
+
*/
|
|
662
|
+
declare function drawTower(b: UrbanBuilder, request: TowerRequest, options?: Pick<TowerOptions, 'mast'>): BlockBuilding;
|
|
663
|
+
/** The drawer a kit uses for a building of the block or the avenue: a tower from the minimum height up, the plain city building under it. */
|
|
664
|
+
declare function createTowerDrawer(towers: TowerOptions, plain: (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o?: BuildingOptions) => BlockBuilding): (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o?: BuildingOptions) => BlockBuilding;
|
|
665
|
+
|
|
666
|
+
/** Facade colours of the city buildings (the Galeria's `FAC`). */
|
|
667
|
+
declare const DEFAULT_FACADES: readonly number[];
|
|
668
|
+
type FillBlockOptions = {
|
|
669
|
+
/** The block is split into `k x k` lots. Default 2. */
|
|
670
|
+
k?: number;
|
|
671
|
+
/** Chance that a lot stays empty. Default 0.08. */
|
|
672
|
+
gap?: number;
|
|
673
|
+
/** Chance that a window is lit. */
|
|
674
|
+
lit?: number;
|
|
675
|
+
/** Chance of a ground-floor shop on a building. */
|
|
676
|
+
shop?: number;
|
|
677
|
+
/** Facade colours. Default `DEFAULT_FACADES`. */
|
|
678
|
+
palette?: readonly number[];
|
|
679
|
+
/**
|
|
680
|
+
* Storeys of each building, a number or `[min, max]` (the same name and shape as a city block's `building.floors`). Given, the height is storeys times the
|
|
681
|
+
* storey height of the use's preset instead of `minHeight..maxHeight`; the random draws are the same.
|
|
682
|
+
*/
|
|
683
|
+
floors?: number | readonly [number, number];
|
|
684
|
+
/** Share of the buildings by use (`commercial`, `residential`, ...); each building picks one (one more random draw). Needs no `floors`. */
|
|
685
|
+
uses?: Readonly<Record<string, number>>;
|
|
686
|
+
/** Which tower preset gives the storey height of a use. Default `{ commercial: 'office', residential: 'residential' }`. */
|
|
687
|
+
storeyPresets?: Readonly<Record<string, string>>;
|
|
688
|
+
/** The presets whose storey heights are used (default `DEFAULT_TOWER_PRESETS`; the kit passes its `towers.presets`). */
|
|
689
|
+
presets?: readonly TowerPreset[];
|
|
690
|
+
/** Storey height when no preset applies, metres. Default the residential preset's. */
|
|
691
|
+
storeyHeight?: number;
|
|
692
|
+
/** Draws each building (default `drawBuilding`): the kit passes its own to put towers on the tall lots. */
|
|
693
|
+
draw?: (b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, options: BuildingOptions) => BlockBuilding;
|
|
694
|
+
};
|
|
695
|
+
/** A building a block ended up with, for the game's own bookkeeping (collisions, minimap). */
|
|
696
|
+
type BlockBuilding = {
|
|
697
|
+
x: number;
|
|
698
|
+
z: number;
|
|
699
|
+
width: number;
|
|
700
|
+
depth: number;
|
|
701
|
+
height: number;
|
|
702
|
+
color: number;
|
|
703
|
+
};
|
|
704
|
+
type BuildingOptions = {
|
|
705
|
+
lit?: number;
|
|
706
|
+
shop?: number;
|
|
707
|
+
/** Use of the building (`commercial`, `residential`...), when the block gave `uses`. */
|
|
708
|
+
use?: string;
|
|
709
|
+
/** Storeys of the building, when the block gave `floors`; the height is already storeys times the storey height. */
|
|
710
|
+
storeys?: number;
|
|
711
|
+
/** Id of the tower preset the use maps to; a tower drawer with that preset uses it instead of picking at random. */
|
|
712
|
+
preset?: string;
|
|
713
|
+
};
|
|
714
|
+
declare const DEFAULT_STOREY_PRESETS: Readonly<Record<string, string>>;
|
|
715
|
+
/** One city building: block, roof slab, maybe a vent on the roof, maybe a shop front on both long faces, windows on the four faces. Draws from the builder's random. */
|
|
716
|
+
declare function drawBuilding(b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, options?: BuildingOptions): BlockBuilding;
|
|
717
|
+
/**
|
|
718
|
+
* Fills a square block with city buildings: a `k x k` split of the block less 2 m of street, each lot maybe empty, each building a
|
|
719
|
+
* little smaller than its lot and as tall as `lerp(min, max, random^1.6)` (more low buildings than tall ones). Draws from the
|
|
720
|
+
* builder's random in the page's order: gap, width, depth, height, facade, then the building's own.
|
|
721
|
+
*/
|
|
722
|
+
declare function fillBlock(b: UrbanBuilder, cx: number, cz: number, size: number, minHeight: number, maxHeight: number, options?: FillBlockOptions): BlockBuilding[];
|
|
723
|
+
|
|
724
|
+
/** Colours of the props; a game replaces the ones it wants. */
|
|
725
|
+
type PropColors = {
|
|
726
|
+
tent: number;
|
|
727
|
+
trunk: number;
|
|
728
|
+
pines: readonly number[];
|
|
729
|
+
crowns: readonly number[];
|
|
730
|
+
sandbags: number;
|
|
731
|
+
fence: number;
|
|
732
|
+
wire: number;
|
|
733
|
+
label: {
|
|
734
|
+
background: string;
|
|
735
|
+
foreground: string;
|
|
736
|
+
};
|
|
737
|
+
watchtower: {
|
|
738
|
+
leg: number;
|
|
739
|
+
cabin: number;
|
|
740
|
+
deck: number;
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
declare const DEFAULT_PROP_COLORS: PropColors;
|
|
744
|
+
/** Fence along a line: posts every 3 m and three wires. */
|
|
745
|
+
declare function drawFence(b: UrbanBuilder, x0: number, z0: number, x1: number, z1: number, height: number, color?: number): void;
|
|
746
|
+
/** Tent: a triangular prism `w` wide, 0.7 w high and `d` long, turned by `ry`. */
|
|
747
|
+
declare function drawTent(b: UrbanBuilder, x: number, z: number, ry: number, w: number, d: number, color?: number, c?: Partial<PropColors>): void;
|
|
748
|
+
/** Pine: a trunk and two cones of one of the greens (one draw from the random). */
|
|
749
|
+
declare function drawPine(b: UrbanBuilder, x: number, z: number, scale?: number, y?: number, c?: Partial<PropColors>): void;
|
|
750
|
+
/** Tree: a trunk and a rough ball of leaves of one of the greens (one draw from the random). */
|
|
751
|
+
declare function drawTree(b: UrbanBuilder, x: number, z: number, scale?: number, c?: Partial<PropColors>): void;
|
|
752
|
+
/** Shipping container (2.44 x 2.6 x 6.06 m) with five ribs on one end. */
|
|
753
|
+
declare function drawContainer(b: UrbanBuilder, x: number, y: number, z: number, ry: number, color: number): void;
|
|
754
|
+
/** Watch tower: four legs, a cabin, a roof deck and two posts; with a searchlight whose beam circles the ground. */
|
|
755
|
+
declare function drawWatchtower(b: UrbanBuilder, x: number, z: number, searchlight?: boolean, c?: Partial<PropColors>): void;
|
|
756
|
+
/** Rows of sandbags along `x` or `z`, each row shifted half a bag. Instances, no parts. */
|
|
757
|
+
declare function drawSandbags(b: UrbanBuilder, x: number, z: number, length: number, along: 'x' | 'z', rows?: number, c?: Partial<PropColors>): void;
|
|
758
|
+
/** A big strip of text on the ground level (name of a street, caption of a cell): two lines on a 22 x 4.4 m board at 2.4 m. */
|
|
759
|
+
declare function drawStripLabel(b: UrbanBuilder, x: number, z: number, title: string, subtitle: string, c?: Partial<PropColors>): void;
|
|
760
|
+
/** Wires between poles: a polyline at one height. */
|
|
761
|
+
declare function drawWires(b: UrbanBuilder, points: readonly (readonly [number, number])[], y: number, color?: number, c?: Partial<PropColors>): void;
|
|
762
|
+
|
|
763
|
+
/** What a game asks a house provider to put on the ground. Fields a typology does not use are ignored. */
|
|
764
|
+
type HouseRequest = {
|
|
765
|
+
x: number;
|
|
766
|
+
z: number;
|
|
767
|
+
/** Turn of the whole house; the default provider turns the group. */
|
|
768
|
+
ry?: number;
|
|
769
|
+
width?: number;
|
|
770
|
+
depth?: number;
|
|
771
|
+
floors?: number;
|
|
772
|
+
color?: number;
|
|
773
|
+
roofColor?: number;
|
|
774
|
+
hasDoor?: boolean;
|
|
775
|
+
isBoarded?: boolean;
|
|
776
|
+
};
|
|
777
|
+
/** Draws a house of the given typology into the builder (and may add vehicles, plants or anything else around it). */
|
|
778
|
+
type HouseProvider = (typology: string, request: HouseRequest, b: UrbanBuilder) => void;
|
|
779
|
+
/** Draws a vehicle where the pattern parks one. A pattern parks none unless a provider is given. */
|
|
780
|
+
type VehicleRequest = {
|
|
781
|
+
x: number;
|
|
782
|
+
z: number;
|
|
783
|
+
ry: number;
|
|
784
|
+
color: number;
|
|
785
|
+
};
|
|
786
|
+
type VehicleProvider = (request: VehicleRequest, b: UrbanBuilder) => void;
|
|
787
|
+
/** Draws a tree where the pattern plants one. The default is the cone pine and the ball tree of the street props. */
|
|
788
|
+
type PlantRequest = {
|
|
789
|
+
kind: 'pine' | 'tree';
|
|
790
|
+
x: number;
|
|
791
|
+
z: number;
|
|
792
|
+
scale: number;
|
|
793
|
+
};
|
|
794
|
+
type PlantProvider = (request: PlantRequest, b: UrbanBuilder) => void;
|
|
795
|
+
type Providers = {
|
|
796
|
+
house?: HouseProvider;
|
|
797
|
+
vehicle?: VehicleProvider;
|
|
798
|
+
plant?: PlantProvider;
|
|
799
|
+
};
|
|
800
|
+
/** The cell of the sample sheet and what was put there, as data. */
|
|
801
|
+
type UrbanPlan = {
|
|
802
|
+
id: string;
|
|
803
|
+
origin: {
|
|
804
|
+
x: number;
|
|
805
|
+
z: number;
|
|
806
|
+
};
|
|
807
|
+
houses: {
|
|
808
|
+
typology: string;
|
|
809
|
+
x: number;
|
|
810
|
+
z: number;
|
|
811
|
+
ry: number;
|
|
812
|
+
}[];
|
|
813
|
+
buildings: BlockBuilding[];
|
|
814
|
+
poles: {
|
|
815
|
+
pole: string;
|
|
816
|
+
x: number;
|
|
817
|
+
z: number;
|
|
818
|
+
on: boolean;
|
|
819
|
+
}[];
|
|
820
|
+
vehicles: VehicleRequest[];
|
|
821
|
+
plants: PlantRequest[];
|
|
822
|
+
};
|
|
823
|
+
type Locale = 'pt-BR' | 'en';
|
|
824
|
+
type PatternText = {
|
|
825
|
+
label: string;
|
|
826
|
+
title: string;
|
|
827
|
+
caption: string;
|
|
828
|
+
detail: string;
|
|
829
|
+
};
|
|
830
|
+
/**
|
|
831
|
+
* A neighbourhood pattern: numbers a game can change and a key into the registry of composers, which draw the street.
|
|
832
|
+
* `params` are the numbers of that composer (counts, pitch, palettes, positions of the poles).
|
|
833
|
+
*/
|
|
834
|
+
type NeighbourhoodPattern<TParams = Record<string, unknown>> = {
|
|
835
|
+
id: string;
|
|
836
|
+
/** Width of the main paved strip (a road, a cobbled street, a yard or a boardwalk). */
|
|
837
|
+
streetWidth: number;
|
|
838
|
+
/** Width of the sidewalks; 0 when the pattern has none. */
|
|
839
|
+
walkWidth: number;
|
|
840
|
+
/** House and building typologies the pattern places (ids of the house provider). */
|
|
841
|
+
typologies: readonly string[];
|
|
842
|
+
/** Id of the kind of pole the pattern uses; empty when it has no public lighting. */
|
|
843
|
+
pole: string;
|
|
844
|
+
/** Colour of the light the lamps give. */
|
|
845
|
+
lightColor: number;
|
|
846
|
+
/** Metres between poles (0 when it has none). */
|
|
847
|
+
spacing: number;
|
|
848
|
+
/** Share of the lamps that are on; the rest are burnt out. 1 means all, without drawing from the random. */
|
|
849
|
+
lit: number;
|
|
850
|
+
/** Key into the composers. */
|
|
851
|
+
compose: string;
|
|
852
|
+
/** Where a map marker stands over the sample: its height and its shift in z from the origin. */
|
|
853
|
+
marker: {
|
|
854
|
+
height: number;
|
|
855
|
+
dz?: number;
|
|
856
|
+
};
|
|
857
|
+
/** Title, caption under the sample and marker text, by locale. */
|
|
858
|
+
text: Record<Locale, PatternText>;
|
|
859
|
+
params: TParams;
|
|
860
|
+
};
|
|
861
|
+
/** The parts of the kit a composer draws with: poles, streets, blocks and props. */
|
|
862
|
+
interface UrbanKitCore {
|
|
863
|
+
poles: {
|
|
864
|
+
get(id: string): {
|
|
865
|
+
build(b: UrbanBuilder, options: PoleOptions): void;
|
|
866
|
+
};
|
|
867
|
+
};
|
|
868
|
+
streets: {
|
|
869
|
+
road(b: UrbanBuilder, x: number, z: number, w: number, l: number, along: 'x' | 'z'): void;
|
|
870
|
+
walk(b: UrbanBuilder, x: number, z: number, w: number, d: number): void;
|
|
871
|
+
ground(b: UrbanBuilder, color?: number, size?: number): void;
|
|
872
|
+
grid(b: UrbanBuilder, g: {
|
|
873
|
+
block: number;
|
|
874
|
+
count: number;
|
|
875
|
+
width: number;
|
|
876
|
+
}): void;
|
|
877
|
+
};
|
|
878
|
+
block: {
|
|
879
|
+
facades: readonly number[];
|
|
880
|
+
building(b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o?: BuildingOptions): BlockBuilding;
|
|
881
|
+
fill(b: UrbanBuilder, g: {
|
|
882
|
+
cx: number;
|
|
883
|
+
cz: number;
|
|
884
|
+
size: number;
|
|
885
|
+
minHeight: number;
|
|
886
|
+
maxHeight: number;
|
|
887
|
+
} & FillBlockOptions): BlockBuilding[];
|
|
888
|
+
};
|
|
889
|
+
props: {
|
|
890
|
+
fence(b: UrbanBuilder, x0: number, z0: number, x1: number, z1: number, height: number, color?: number): void;
|
|
891
|
+
tent(b: UrbanBuilder, x: number, z: number, ry: number, w: number, d: number, color?: number): void;
|
|
892
|
+
pine(b: UrbanBuilder, x: number, z: number, scale?: number, y?: number): void;
|
|
893
|
+
tree(b: UrbanBuilder, x: number, z: number, scale?: number): void;
|
|
894
|
+
container(b: UrbanBuilder, x: number, y: number, z: number, ry: number, color: number): void;
|
|
895
|
+
watchtower(b: UrbanBuilder, x: number, z: number, searchlight?: boolean): void;
|
|
896
|
+
sandbags(b: UrbanBuilder, x: number, z: number, length: number, along: 'x' | 'z', rows?: number): void;
|
|
897
|
+
label(b: UrbanBuilder, x: number, z: number, title: string, subtitle: string): void;
|
|
898
|
+
wires(b: UrbanBuilder, points: readonly (readonly [number, number])[], y: number, color?: number): void;
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
type ComposeContext<TParams = Record<string, unknown>> = {
|
|
902
|
+
kit: UrbanKitCore;
|
|
903
|
+
b: UrbanBuilder;
|
|
904
|
+
pattern: NeighbourhoodPattern<TParams>;
|
|
905
|
+
params: TParams;
|
|
906
|
+
x0: number;
|
|
907
|
+
z0: number;
|
|
908
|
+
plan: UrbanPlan;
|
|
909
|
+
/** True with the probability `share`; draws from the random unless the share is 1. */
|
|
910
|
+
isLit(share: number): boolean;
|
|
911
|
+
pole(options: PoleOptions & {
|
|
912
|
+
id?: string;
|
|
913
|
+
}): void;
|
|
914
|
+
house(typology: string, request: HouseRequest): void;
|
|
915
|
+
vehicle(request: VehicleRequest): void;
|
|
916
|
+
plant(request: PlantRequest): void;
|
|
917
|
+
building(x: number, z: number, width: number, depth: number, height: number, color: number, options?: {
|
|
918
|
+
lit?: number;
|
|
919
|
+
shop?: number;
|
|
920
|
+
}): void;
|
|
921
|
+
};
|
|
922
|
+
type Composer<TParams = any> = (context: ComposeContext<TParams>) => void;
|
|
923
|
+
type ComposeOptions = {
|
|
924
|
+
locale?: Locale;
|
|
925
|
+
providers?: Providers;
|
|
926
|
+
};
|
|
927
|
+
type SilhouetteFactory = (request: HouseRequest, random: () => number) => Silhouette;
|
|
928
|
+
|
|
929
|
+
type DistrictKindText = {
|
|
930
|
+
name: string;
|
|
931
|
+
description: string;
|
|
932
|
+
};
|
|
933
|
+
/**
|
|
934
|
+
* A kind of district: what a patch of the city is. Numbers a game can change; the ids of `zone` and `pattern` point into other catalogues.
|
|
935
|
+
*/
|
|
936
|
+
type DistrictKindDef = {
|
|
937
|
+
id: string;
|
|
938
|
+
/** Colour on the map (css hex). */
|
|
939
|
+
color: string;
|
|
940
|
+
/** Id of a zone of `game-floorplan-residential` / `game-floorplan-commercial` (`zt`, `zc`, `zr1`, ...); null for ground that is not built. */
|
|
941
|
+
zone: string | null;
|
|
942
|
+
/** Id of a neighbourhood pattern of `urban.neighbourhoods` (or `financial_district` of `TOWER_PATTERNS`); null for ground that is not built. */
|
|
943
|
+
pattern: string | null;
|
|
944
|
+
/** Storeys of the buildings, `[min, max]`. */
|
|
945
|
+
floors: readonly [number, number];
|
|
946
|
+
/** Share of the buildings by use (`commercial`, `residential`, `industrial`, `institutional`, `agricultural`, ...). */
|
|
947
|
+
uses: Readonly<Record<string, number>>;
|
|
948
|
+
/** Size of a block in metres; 0 means the kind has no blocks. */
|
|
949
|
+
block: number;
|
|
950
|
+
text: Record<Locale, DistrictKindText>;
|
|
951
|
+
};
|
|
952
|
+
type PlanRect = readonly [x0: number, z0: number, x1: number, z1: number];
|
|
953
|
+
type PlanPoint = readonly [x: number, z: number];
|
|
954
|
+
type PlanDistrict = {
|
|
955
|
+
id: string;
|
|
956
|
+
/** Id of a `DistrictKindDef`. */
|
|
957
|
+
kind: string;
|
|
958
|
+
rect: PlanRect;
|
|
959
|
+
/** Replaces the name of the kind; a string or one string by locale. */
|
|
960
|
+
name?: string | Partial<Record<Locale, string>>;
|
|
961
|
+
/** Replaces the storeys of the kind. */
|
|
962
|
+
floors?: readonly [number, number];
|
|
963
|
+
/** Replaces the shares of use of the kind. */
|
|
964
|
+
uses?: Readonly<Record<string, number>>;
|
|
965
|
+
};
|
|
966
|
+
type PlanLine = {
|
|
967
|
+
id: string;
|
|
968
|
+
/** `avenue`, `street`, `highway`, `rail`, `river` or any string a drawer knows. */
|
|
969
|
+
kind: string;
|
|
970
|
+
width: number;
|
|
971
|
+
points: readonly PlanPoint[];
|
|
972
|
+
};
|
|
973
|
+
type PlanLandmark = {
|
|
974
|
+
kind: string;
|
|
975
|
+
at: PlanPoint;
|
|
976
|
+
name?: string | Partial<Record<Locale, string>>;
|
|
977
|
+
};
|
|
978
|
+
type CityScale = 'metropolis' | 'city' | 'town' | 'village' | (string & {});
|
|
979
|
+
/**
|
|
980
|
+
* A city plan: districts painted on a map of metres (centre 0,0; x east, z south), roads, rails and rivers, and landmarks.
|
|
981
|
+
* Districts are listed from the outer to the inner one: the LAST district that contains a point wins.
|
|
982
|
+
*/
|
|
983
|
+
type CityPlanDef = {
|
|
984
|
+
id: string;
|
|
985
|
+
scale: CityScale;
|
|
986
|
+
/** Width and depth of the map in metres. */
|
|
987
|
+
size: readonly [w: number, d: number];
|
|
988
|
+
text: Record<Locale, {
|
|
989
|
+
name: string;
|
|
990
|
+
description: string;
|
|
991
|
+
}>;
|
|
992
|
+
/** Id of another plan to start from: its districts, lines and landmarks come first; a district or line of the same id replaces, a new one appends. */
|
|
993
|
+
extends?: string;
|
|
994
|
+
districts: readonly PlanDistrict[];
|
|
995
|
+
lines: readonly PlanLine[];
|
|
996
|
+
landmarks: readonly PlanLandmark[];
|
|
997
|
+
};
|
|
998
|
+
/** A plan as a game writes it: with `extends`, everything but the id is optional and comes from the parent. */
|
|
999
|
+
type CityPlanInput = {
|
|
1000
|
+
id: string;
|
|
1001
|
+
extends?: string;
|
|
1002
|
+
} & Partial<Omit<CityPlanDef, 'id' | 'extends'>>;
|
|
1003
|
+
type BlockUse = {
|
|
1004
|
+
floors: readonly [number, number];
|
|
1005
|
+
uses: Readonly<Record<string, number>>;
|
|
1006
|
+
zone: string | null;
|
|
1007
|
+
pattern: string | null;
|
|
1008
|
+
};
|
|
1009
|
+
type ResolvedDistrict = {
|
|
1010
|
+
id: string;
|
|
1011
|
+
kind: string;
|
|
1012
|
+
rect: PlanRect;
|
|
1013
|
+
name: string;
|
|
1014
|
+
description: string;
|
|
1015
|
+
color: string;
|
|
1016
|
+
zone: string | null;
|
|
1017
|
+
pattern: string | null;
|
|
1018
|
+
/** Storeys after the district's override, clamped to `[0, maxFloors]`. */
|
|
1019
|
+
floors: readonly [number, number];
|
|
1020
|
+
uses: Readonly<Record<string, number>>;
|
|
1021
|
+
block: number;
|
|
1022
|
+
};
|
|
1023
|
+
/** A block of a district: its centre, its dimensions less the street, and the config a building generator takes. */
|
|
1024
|
+
type Block = {
|
|
1025
|
+
x: number;
|
|
1026
|
+
z: number;
|
|
1027
|
+
size: readonly [w: number, d: number];
|
|
1028
|
+
district: string;
|
|
1029
|
+
building: BlockUse;
|
|
1030
|
+
};
|
|
1031
|
+
type CityLayout = {
|
|
1032
|
+
id: string;
|
|
1033
|
+
scale: string;
|
|
1034
|
+
size: readonly [number, number];
|
|
1035
|
+
name: string;
|
|
1036
|
+
description: string;
|
|
1037
|
+
districts: ResolvedDistrict[];
|
|
1038
|
+
lines: PlanLine[];
|
|
1039
|
+
landmarks: (Omit<PlanLandmark, 'name'> & {
|
|
1040
|
+
name?: string;
|
|
1041
|
+
})[];
|
|
1042
|
+
/** The district at a point; the last one in the list that contains it. */
|
|
1043
|
+
districtAt(x: number, z: number): ResolvedDistrict | undefined;
|
|
1044
|
+
/** The grid of blocks of a district (by the kind's block size), less the cells another district was painted over. */
|
|
1045
|
+
blocks(districtId: string, options?: {
|
|
1046
|
+
street?: number;
|
|
1047
|
+
}): Block[];
|
|
1048
|
+
};
|
|
1049
|
+
type LayoutOptions = {
|
|
1050
|
+
maxFloors?: number;
|
|
1051
|
+
locale?: Locale;
|
|
1052
|
+
};
|
|
1053
|
+
type KindStats = {
|
|
1054
|
+
kind: string;
|
|
1055
|
+
area: number;
|
|
1056
|
+
share: number;
|
|
1057
|
+
districts: number;
|
|
1058
|
+
};
|
|
1059
|
+
type FillBlockCityOptions = Omit<FillBlockOptions, 'shop'> & {
|
|
1060
|
+
/** Chance of a ground-floor shop; default the commercial share of the block. */
|
|
1061
|
+
shop?: number;
|
|
1062
|
+
/** Which tower preset gives the storey height of a use: default `{ commercial: 'office', residential: 'residential' }`. */
|
|
1063
|
+
storeyPresets?: Readonly<Record<string, string>>;
|
|
1064
|
+
/** Storey height when no preset applies, metres. Default the residential preset's. */
|
|
1065
|
+
storeyHeight?: number;
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
/** Highest storey count a district may have unless the game raises it. */
|
|
1069
|
+
declare const DEFAULT_MAX_FLOORS = 60;
|
|
1070
|
+
declare const DEFAULT_STREET = 10;
|
|
1071
|
+
type CitiesOptions = {
|
|
1072
|
+
/** Most storeys any district may have, applied on top of the kinds and the districts' own numbers. Default 60. */
|
|
1073
|
+
maxFloors?: number;
|
|
1074
|
+
packs?: {
|
|
1075
|
+
kinds?: readonly DistrictKindDef[];
|
|
1076
|
+
plans?: readonly CityPlanInput[];
|
|
1077
|
+
};
|
|
1078
|
+
patch?: {
|
|
1079
|
+
kinds?: Record<string, DeepPartial<DistrictKindDef>>;
|
|
1080
|
+
plans?: Record<string, DeepPartial<CityPlanInput>>;
|
|
1081
|
+
};
|
|
1082
|
+
remove?: {
|
|
1083
|
+
kinds?: readonly string[];
|
|
1084
|
+
plans?: readonly string[];
|
|
1085
|
+
};
|
|
1086
|
+
/** Tower presets of the kit (storey heights by use). */
|
|
1087
|
+
presets: readonly TowerPreset[];
|
|
1088
|
+
fill(b: UrbanBuilder, g: {
|
|
1089
|
+
cx: number;
|
|
1090
|
+
cz: number;
|
|
1091
|
+
size: number;
|
|
1092
|
+
minHeight: number;
|
|
1093
|
+
maxHeight: number;
|
|
1094
|
+
} & FillBlockOptions): BlockBuilding[];
|
|
1095
|
+
};
|
|
1096
|
+
/** City plans as data: district kinds and plans are registries; a plan resolves to a layout with the district at a point and the grid of blocks of a district. */
|
|
1097
|
+
declare function createCities(o: CitiesOptions): {
|
|
1098
|
+
maxFloors: number;
|
|
1099
|
+
kinds: {
|
|
1100
|
+
ids: () => string[];
|
|
1101
|
+
list: () => DistrictKindDef[];
|
|
1102
|
+
has: (id: string) => boolean;
|
|
1103
|
+
get(id: string): DistrictKindDef;
|
|
1104
|
+
};
|
|
1105
|
+
plans: {
|
|
1106
|
+
/** The plan with everything inherited from the plans it extends. */
|
|
1107
|
+
resolve: (id: string) => CityPlanDef;
|
|
1108
|
+
ids: () => string[];
|
|
1109
|
+
list: () => CityPlanInput[];
|
|
1110
|
+
has: (id: string) => boolean;
|
|
1111
|
+
get(id: string): CityPlanInput;
|
|
1112
|
+
};
|
|
1113
|
+
layout: (planOrId: string | CityPlanInput, options?: LayoutOptions) => CityLayout;
|
|
1114
|
+
stats: (l: CityLayout) => KindStats[];
|
|
1115
|
+
fillBlock: (b: UrbanBuilder, block: Block, options?: FillBlockCityOptions) => BlockBuilding[];
|
|
1116
|
+
};
|
|
1117
|
+
type Cities = ReturnType<typeof createCities>;
|
|
1118
|
+
|
|
1119
|
+
/** The district kinds of the city plans: colour on the map, zone of the floorplan packages, neighbourhood pattern, storeys, share of buildings by use and block size. */
|
|
1120
|
+
declare const DEFAULT_DISTRICT_KINDS: readonly DistrictKindDef[];
|
|
1121
|
+
|
|
1122
|
+
/** The six city plans (metropolis, regional city, port city, rail town, country town, mountain village). Districts are listed from the outer to the inner one. */
|
|
1123
|
+
declare const DEFAULT_CITY_PLANS: readonly CityPlanDef[];
|
|
1124
|
+
|
|
1125
|
+
type Origin = {
|
|
1126
|
+
x: number;
|
|
1127
|
+
z: number;
|
|
1128
|
+
};
|
|
1129
|
+
/** Draws one pattern at `origin`: its composer, then the board with the title and the caption. */
|
|
1130
|
+
declare function composePattern(kit: UrbanKitCore, pattern: NeighbourhoodPattern<any>, composer: Composer, b: UrbanBuilder, origin: Origin, options?: ComposeOptions): UrbanPlan;
|
|
1131
|
+
/** The marker (map pin) of a pattern at an origin: where it stands, how high, and what it says. */
|
|
1132
|
+
declare function patternMarker(pattern: NeighbourhoodPattern<any>, origin: Origin, locale?: Locale): {
|
|
1133
|
+
x: number;
|
|
1134
|
+
y: number;
|
|
1135
|
+
z: number;
|
|
1136
|
+
label: string;
|
|
1137
|
+
detail: string;
|
|
1138
|
+
};
|
|
1139
|
+
type SampleSheetOptions = ComposeOptions & {
|
|
1140
|
+
/** Ids to draw, in this order. Default all of the kit's patterns in the page's order. */
|
|
1141
|
+
ids?: readonly string[];
|
|
1142
|
+
/** Where each pattern stands. Default the Galeria's grid. */
|
|
1143
|
+
cells?: Readonly<Record<string, Origin>>;
|
|
1144
|
+
/** Colour and size of the ground under the sheet; false for none. */
|
|
1145
|
+
ground?: {
|
|
1146
|
+
color: number;
|
|
1147
|
+
size: number;
|
|
1148
|
+
} | false;
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
declare const clamp: (v: number, a: number, b: number) => number;
|
|
1152
|
+
declare const lerp: (a: number, b: number, t: number) => number;
|
|
1153
|
+
/** Smoothstep between `a` and `b`; with `a > b` it falls instead of rising. */
|
|
1154
|
+
declare const smoothstep: (a: number, b: number, x: number) => number;
|
|
1155
|
+
/** The team's cheap hash of two numbers into [0, 1). */
|
|
1156
|
+
declare const hash2: (a: number, b: number) => number;
|
|
1157
|
+
/** Distance from a point to the nearest segment of a polyline. */
|
|
1158
|
+
declare function distanceToPolyline(px: number, py: number, points: readonly Point[]): number;
|
|
1159
|
+
/** Inside the rectangle grown by `margin` on every side. */
|
|
1160
|
+
declare const insideRect: (px: number, py: number, r: Rect, margin: number) => boolean;
|
|
1161
|
+
/** Inside an ellipse given by its centre and radii. */
|
|
1162
|
+
declare const insideEllipse: (px: number, py: number, center: Point, radius: Point) => boolean;
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* A ground made of layers, as the team's Vale: a rolling base, masked relief (mountains, hills), cities levelled flat, rivers and lakes carved in,
|
|
1166
|
+
* a forest density, and a colour for every point. It answers questions about a point of the map and hands a drawer the grid of a square mesh.
|
|
1167
|
+
*/
|
|
1168
|
+
declare function createTerrain(options: TerrainOptions): {
|
|
1169
|
+
options: TerrainOptions;
|
|
1170
|
+
toWorld: (px: number, py: number) => [number, number];
|
|
1171
|
+
fromWorld: (x: number, z: number) => [number, number];
|
|
1172
|
+
heightAt: (px: number, py: number) => number;
|
|
1173
|
+
forestAt: (px: number, py: number) => number;
|
|
1174
|
+
nearRiver: (px: number, py: number, margin: number) => boolean;
|
|
1175
|
+
colorAt: (px: number, py: number, h?: number) => number;
|
|
1176
|
+
grid: (segments?: number) => TerrainGrid;
|
|
1177
|
+
};
|
|
1178
|
+
type Terrain = ReturnType<typeof createTerrain>;
|
|
1179
|
+
/** Puts the ground and its water under it into a builder: the terrain mesh first, then the water plane, as the page's `buildWorld`. */
|
|
1180
|
+
declare function drawTerrain(b: UrbanBuilder, terrain: Terrain, segments?: number): void;
|
|
1181
|
+
|
|
1182
|
+
/** Lights a scene may spend: the Galeria spends 16 real point lights. */
|
|
1183
|
+
declare const DEFAULT_LIGHT_BUDGET = 16;
|
|
1184
|
+
/** Seed of the Galeria's generator. */
|
|
1185
|
+
declare const DEFAULT_URBAN_SEED = 7;
|
|
1186
|
+
type UrbanOptions = {
|
|
1187
|
+
/** Entries added to the catalogues (an entry with an existing id replaces it). */
|
|
1188
|
+
packs?: {
|
|
1189
|
+
poles?: readonly PoleDef[];
|
|
1190
|
+
neighbourhoods?: readonly NeighbourhoodPattern<any>[];
|
|
1191
|
+
districtKinds?: readonly DistrictKindDef[];
|
|
1192
|
+
cityPlans?: readonly CityPlanInput[];
|
|
1193
|
+
};
|
|
1194
|
+
/** Numbers changed on shipped entries, by id (objects merge, arrays replace). */
|
|
1195
|
+
patch?: {
|
|
1196
|
+
poles?: Record<string, DeepPartial<PoleDef>>;
|
|
1197
|
+
neighbourhoods?: Record<string, DeepPartial<NeighbourhoodPattern<any>>>;
|
|
1198
|
+
districtKinds?: Record<string, DeepPartial<DistrictKindDef>>;
|
|
1199
|
+
cityPlans?: Record<string, DeepPartial<CityPlanInput>>;
|
|
1200
|
+
};
|
|
1201
|
+
/** Ids taken out of the catalogues. */
|
|
1202
|
+
remove?: {
|
|
1203
|
+
poles?: readonly string[];
|
|
1204
|
+
neighbourhoods?: readonly string[];
|
|
1205
|
+
districtKinds?: readonly string[];
|
|
1206
|
+
cityPlans?: readonly string[];
|
|
1207
|
+
};
|
|
1208
|
+
/** Shape builders for the poles a pack adds; the five of the Galeria are always there. */
|
|
1209
|
+
shapes?: Readonly<Record<string, PoleShapeBuilder>>;
|
|
1210
|
+
/** Composers for the patterns a pack adds; the ten of the Galeria are always there. */
|
|
1211
|
+
composers?: Readonly<Record<string, Composer>>;
|
|
1212
|
+
/** City plans (zoning): district kinds and plans are catalogues (`packs`, `patch` and `remove` above, under `districtKinds` and `cityPlans`). */
|
|
1213
|
+
cities?: {
|
|
1214
|
+
maxFloors?: number;
|
|
1215
|
+
};
|
|
1216
|
+
lights?: {
|
|
1217
|
+
budget?: number;
|
|
1218
|
+
};
|
|
1219
|
+
streets?: StreetOptions;
|
|
1220
|
+
/** Facade colours of the city buildings. */
|
|
1221
|
+
facades?: readonly number[];
|
|
1222
|
+
props?: Partial<PropColors>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Towers on the tall lots, off by default. `true` or an object turns them on: a building of the block or of an avenue at least `minHeight` (60 m) tall is drawn as
|
|
1225
|
+
* a tower of one of the `presets` (the office and residential typologies), not as a box; a `provider` replaces the drawing. See `TowerOptions`.
|
|
1226
|
+
*/
|
|
1227
|
+
towers?: boolean | TowerOptions;
|
|
1228
|
+
};
|
|
1229
|
+
type Pole = {
|
|
1230
|
+
readonly def: PoleDef;
|
|
1231
|
+
build(b: UrbanBuilder, options: PoleOptions): void;
|
|
1232
|
+
};
|
|
1233
|
+
type BuilderOptions = {
|
|
1234
|
+
/** Seed of the generator when no `random` is given. Default 7. */
|
|
1235
|
+
seed?: number;
|
|
1236
|
+
random?: RandomSource;
|
|
1237
|
+
/** Lights this scene may spend; default the kit's budget. */
|
|
1238
|
+
budget?: number;
|
|
1239
|
+
};
|
|
1240
|
+
type UrbanKit = ReturnType<typeof createUrban>;
|
|
1241
|
+
/** The urban pattern as data: poles, streets, blocks and props that add parts to a builder. Knows nothing about three.js, a game or a place. */
|
|
1242
|
+
declare function createUrban(options?: UrbanOptions): {
|
|
1243
|
+
poles: {
|
|
1244
|
+
ids: () => string[];
|
|
1245
|
+
list: () => PoleDef[];
|
|
1246
|
+
get(id: string): Pole;
|
|
1247
|
+
};
|
|
1248
|
+
cities: {
|
|
1249
|
+
maxFloors: number;
|
|
1250
|
+
kinds: {
|
|
1251
|
+
ids: () => string[];
|
|
1252
|
+
list: () => DistrictKindDef[];
|
|
1253
|
+
has: (id: string) => boolean;
|
|
1254
|
+
get(id: string): DistrictKindDef;
|
|
1255
|
+
};
|
|
1256
|
+
plans: {
|
|
1257
|
+
resolve: (id: string) => CityPlanDef;
|
|
1258
|
+
ids: () => string[];
|
|
1259
|
+
list: () => CityPlanInput[];
|
|
1260
|
+
has: (id: string) => boolean;
|
|
1261
|
+
get(id: string): CityPlanInput;
|
|
1262
|
+
};
|
|
1263
|
+
layout: (planOrId: string | CityPlanInput, options?: LayoutOptions) => CityLayout;
|
|
1264
|
+
stats: (l: CityLayout) => KindStats[];
|
|
1265
|
+
fillBlock: (b: UrbanBuilder, block: Block, options?: FillBlockCityOptions) => BlockBuilding[];
|
|
1266
|
+
};
|
|
1267
|
+
builder: (o?: BuilderOptions) => UrbanBuilder;
|
|
1268
|
+
neighbourhoods: {
|
|
1269
|
+
ids: () => string[];
|
|
1270
|
+
get(id: string): {
|
|
1271
|
+
pattern: NeighbourhoodPattern<any>;
|
|
1272
|
+
/** Draws the pattern at `origin` and gives back what it put there. */
|
|
1273
|
+
compose: (b: UrbanBuilder, origin: Origin, o?: ComposeOptions) => UrbanPlan;
|
|
1274
|
+
marker: (origin: Origin, locale?: Locale) => {
|
|
1275
|
+
x: number;
|
|
1276
|
+
y: number;
|
|
1277
|
+
z: number;
|
|
1278
|
+
label: string;
|
|
1279
|
+
detail: string;
|
|
1280
|
+
};
|
|
1281
|
+
};
|
|
1282
|
+
/** The Galeria's sample sheet: the ground, then each pattern in its cell, in the order the page builds them. */
|
|
1283
|
+
composeSampleSheet(b: UrbanBuilder, o?: SampleSheetOptions): {
|
|
1284
|
+
plans: UrbanPlan[];
|
|
1285
|
+
markers: {
|
|
1286
|
+
x: number;
|
|
1287
|
+
y: number;
|
|
1288
|
+
z: number;
|
|
1289
|
+
label: string;
|
|
1290
|
+
detail: string;
|
|
1291
|
+
}[];
|
|
1292
|
+
};
|
|
1293
|
+
};
|
|
1294
|
+
terrain: (o: TerrainOptions) => Terrain;
|
|
1295
|
+
drawTerrain: typeof drawTerrain;
|
|
1296
|
+
towers: {
|
|
1297
|
+
enabled: boolean;
|
|
1298
|
+
options: TowerOptions | null;
|
|
1299
|
+
};
|
|
1300
|
+
streets: {
|
|
1301
|
+
road(b: UrbanBuilder, x: number, z: number, w: number, l: number, along: "x" | "z"): void;
|
|
1302
|
+
walk(b: UrbanBuilder, x: number, z: number, w: number, d: number): void;
|
|
1303
|
+
ground(b: UrbanBuilder, color?: number, size?: number): void;
|
|
1304
|
+
grid(b: UrbanBuilder, g: {
|
|
1305
|
+
block: number;
|
|
1306
|
+
count: number;
|
|
1307
|
+
width: number;
|
|
1308
|
+
}): void;
|
|
1309
|
+
};
|
|
1310
|
+
block: {
|
|
1311
|
+
facades: readonly number[];
|
|
1312
|
+
building(b: UrbanBuilder, x: number, z: number, width: number, depth: number, height: number, color: number, o?: BuildingOptions): BlockBuilding;
|
|
1313
|
+
fill(b: UrbanBuilder, g: {
|
|
1314
|
+
cx: number;
|
|
1315
|
+
cz: number;
|
|
1316
|
+
size: number;
|
|
1317
|
+
minHeight: number;
|
|
1318
|
+
maxHeight: number;
|
|
1319
|
+
} & FillBlockOptions): BlockBuilding[];
|
|
1320
|
+
};
|
|
1321
|
+
props: {
|
|
1322
|
+
fence(b: UrbanBuilder, x0: number, z0: number, x1: number, z1: number, height: number, color?: number): void;
|
|
1323
|
+
tent(b: UrbanBuilder, x: number, z: number, ry: number, w: number, d: number, color?: number): void;
|
|
1324
|
+
pine(b: UrbanBuilder, x: number, z: number, scale?: number, y?: number): void;
|
|
1325
|
+
tree(b: UrbanBuilder, x: number, z: number, scale?: number): void;
|
|
1326
|
+
container(b: UrbanBuilder, x: number, y: number, z: number, ry: number, color: number): void;
|
|
1327
|
+
watchtower(b: UrbanBuilder, x: number, z: number, searchlight?: boolean): void;
|
|
1328
|
+
sandbags(b: UrbanBuilder, x: number, z: number, length: number, along: "x" | "z", rows?: number): void;
|
|
1329
|
+
label(b: UrbanBuilder, x: number, z: number, title: string, subtitle: string): void;
|
|
1330
|
+
wires(b: UrbanBuilder, points: readonly (readonly [number, number])[], y: number, color?: number): void;
|
|
1331
|
+
};
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
/** Every composer reads its numbers from `pattern.params`; the defaults are in `patterns.ts`. */
|
|
1335
|
+
type DowntownParams = {
|
|
1336
|
+
roadLength: number;
|
|
1337
|
+
roadColor: number;
|
|
1338
|
+
median: {
|
|
1339
|
+
width: number;
|
|
1340
|
+
height: number;
|
|
1341
|
+
color: number;
|
|
1342
|
+
};
|
|
1343
|
+
poles: {
|
|
1344
|
+
from: number;
|
|
1345
|
+
to: number;
|
|
1346
|
+
};
|
|
1347
|
+
buildings: {
|
|
1348
|
+
perRow: number;
|
|
1349
|
+
first: number;
|
|
1350
|
+
pitch: number;
|
|
1351
|
+
rowOffset: number;
|
|
1352
|
+
size: number;
|
|
1353
|
+
north: {
|
|
1354
|
+
minHeight: number;
|
|
1355
|
+
range: number;
|
|
1356
|
+
lit: number;
|
|
1357
|
+
};
|
|
1358
|
+
south: {
|
|
1359
|
+
minHeight: number;
|
|
1360
|
+
range: number;
|
|
1361
|
+
lit: number;
|
|
1362
|
+
};
|
|
1363
|
+
};
|
|
1364
|
+
walks: {
|
|
1365
|
+
offset: number;
|
|
1366
|
+
length: number;
|
|
1367
|
+
};
|
|
1368
|
+
car: {
|
|
1369
|
+
dx: number;
|
|
1370
|
+
dz: number;
|
|
1371
|
+
ry: number;
|
|
1372
|
+
color: number;
|
|
1373
|
+
};
|
|
1374
|
+
};
|
|
1375
|
+
type SuburbParams = {
|
|
1376
|
+
roadLength: number;
|
|
1377
|
+
walkOffset: number;
|
|
1378
|
+
houses: {
|
|
1379
|
+
count: number;
|
|
1380
|
+
first: number;
|
|
1381
|
+
pitch: number;
|
|
1382
|
+
north: {
|
|
1383
|
+
z: number;
|
|
1384
|
+
typologies: readonly [string, string];
|
|
1385
|
+
colors: readonly number[];
|
|
1386
|
+
};
|
|
1387
|
+
south: {
|
|
1388
|
+
z: number;
|
|
1389
|
+
colors: readonly number[];
|
|
1390
|
+
};
|
|
1391
|
+
roofColor: number;
|
|
1392
|
+
width: number;
|
|
1393
|
+
depth: number;
|
|
1394
|
+
};
|
|
1395
|
+
walls: {
|
|
1396
|
+
color: number;
|
|
1397
|
+
height: number;
|
|
1398
|
+
thickness: number;
|
|
1399
|
+
offset: number;
|
|
1400
|
+
gateColor: number;
|
|
1401
|
+
gateWidth: number;
|
|
1402
|
+
gateHeight: number;
|
|
1403
|
+
gateOffset: number;
|
|
1404
|
+
gateInset: number;
|
|
1405
|
+
length: number;
|
|
1406
|
+
};
|
|
1407
|
+
poles: {
|
|
1408
|
+
at: readonly number[];
|
|
1409
|
+
z: number;
|
|
1410
|
+
transformerFrom: number;
|
|
1411
|
+
};
|
|
1412
|
+
wires: {
|
|
1413
|
+
half: number;
|
|
1414
|
+
height: number;
|
|
1415
|
+
};
|
|
1416
|
+
};
|
|
1417
|
+
type WorkingClassParams = {
|
|
1418
|
+
houses: {
|
|
1419
|
+
count: number;
|
|
1420
|
+
first: number;
|
|
1421
|
+
pitch: number;
|
|
1422
|
+
width: number;
|
|
1423
|
+
depth: number;
|
|
1424
|
+
north: {
|
|
1425
|
+
z: number;
|
|
1426
|
+
colors: readonly number[];
|
|
1427
|
+
};
|
|
1428
|
+
south: {
|
|
1429
|
+
z: number;
|
|
1430
|
+
colors: readonly number[];
|
|
1431
|
+
};
|
|
1432
|
+
maxFloors: number;
|
|
1433
|
+
};
|
|
1434
|
+
poles: {
|
|
1435
|
+
from: number;
|
|
1436
|
+
to: number;
|
|
1437
|
+
z: number;
|
|
1438
|
+
jitter: number;
|
|
1439
|
+
};
|
|
1440
|
+
wires: {
|
|
1441
|
+
count: number;
|
|
1442
|
+
from: number;
|
|
1443
|
+
to: number;
|
|
1444
|
+
z: number;
|
|
1445
|
+
step: number;
|
|
1446
|
+
height: number;
|
|
1447
|
+
heightStep: number;
|
|
1448
|
+
sag: number;
|
|
1449
|
+
color: number;
|
|
1450
|
+
};
|
|
1451
|
+
};
|
|
1452
|
+
type HistoricParams = {
|
|
1453
|
+
cobbles: {
|
|
1454
|
+
y: number;
|
|
1455
|
+
length: number;
|
|
1456
|
+
color: number;
|
|
1457
|
+
from: number;
|
|
1458
|
+
to: number;
|
|
1459
|
+
step: number;
|
|
1460
|
+
spread: number;
|
|
1461
|
+
sizes: readonly [number, number, number];
|
|
1462
|
+
colors: readonly number[];
|
|
1463
|
+
};
|
|
1464
|
+
rows: {
|
|
1465
|
+
from: number;
|
|
1466
|
+
to: number;
|
|
1467
|
+
minWidth: number;
|
|
1468
|
+
widthSteps: number;
|
|
1469
|
+
north: {
|
|
1470
|
+
z: number;
|
|
1471
|
+
colors: readonly number[];
|
|
1472
|
+
};
|
|
1473
|
+
south: {
|
|
1474
|
+
z: number;
|
|
1475
|
+
colors: readonly number[];
|
|
1476
|
+
};
|
|
1477
|
+
};
|
|
1478
|
+
poles: {
|
|
1479
|
+
from: number;
|
|
1480
|
+
to: number;
|
|
1481
|
+
step: number;
|
|
1482
|
+
z: number;
|
|
1483
|
+
sideOffset: number;
|
|
1484
|
+
};
|
|
1485
|
+
};
|
|
1486
|
+
type IndustrialParams = {
|
|
1487
|
+
yard: {
|
|
1488
|
+
length: number;
|
|
1489
|
+
color: number;
|
|
1490
|
+
};
|
|
1491
|
+
hangar: {
|
|
1492
|
+
x: number;
|
|
1493
|
+
z: number;
|
|
1494
|
+
width: number;
|
|
1495
|
+
height: number;
|
|
1496
|
+
depth: number;
|
|
1497
|
+
color: number;
|
|
1498
|
+
roofColor: number;
|
|
1499
|
+
roofRadius: number;
|
|
1500
|
+
roofY: number;
|
|
1501
|
+
doorColor: number;
|
|
1502
|
+
doorWidth: number;
|
|
1503
|
+
doorHeight: number;
|
|
1504
|
+
stripeColor: number;
|
|
1505
|
+
};
|
|
1506
|
+
towers: readonly {
|
|
1507
|
+
dx: number;
|
|
1508
|
+
dz: number;
|
|
1509
|
+
on: boolean;
|
|
1510
|
+
}[];
|
|
1511
|
+
container: {
|
|
1512
|
+
dx: number;
|
|
1513
|
+
dz: number;
|
|
1514
|
+
ry: number;
|
|
1515
|
+
color: number;
|
|
1516
|
+
};
|
|
1517
|
+
};
|
|
1518
|
+
type RailwayParams = {
|
|
1519
|
+
houses: {
|
|
1520
|
+
count: number;
|
|
1521
|
+
first: number;
|
|
1522
|
+
pitch: number;
|
|
1523
|
+
north: {
|
|
1524
|
+
z: number;
|
|
1525
|
+
colors: readonly number[];
|
|
1526
|
+
};
|
|
1527
|
+
south: {
|
|
1528
|
+
z: number;
|
|
1529
|
+
color: number;
|
|
1530
|
+
};
|
|
1531
|
+
};
|
|
1532
|
+
poles: {
|
|
1533
|
+
at: readonly number[];
|
|
1534
|
+
z: number;
|
|
1535
|
+
transformerFrom: number;
|
|
1536
|
+
};
|
|
1537
|
+
wires: {
|
|
1538
|
+
half: number;
|
|
1539
|
+
height: number;
|
|
1540
|
+
};
|
|
1541
|
+
};
|
|
1542
|
+
type MountainParams = {
|
|
1543
|
+
road: {
|
|
1544
|
+
y: number;
|
|
1545
|
+
length: number;
|
|
1546
|
+
color: number;
|
|
1547
|
+
};
|
|
1548
|
+
chalets: {
|
|
1549
|
+
count: number;
|
|
1550
|
+
first: number;
|
|
1551
|
+
pitch: number;
|
|
1552
|
+
northZ: number;
|
|
1553
|
+
southZ: number;
|
|
1554
|
+
southShift: number;
|
|
1555
|
+
northColors: readonly number[];
|
|
1556
|
+
southColors: readonly number[];
|
|
1557
|
+
};
|
|
1558
|
+
poles: {
|
|
1559
|
+
from: number;
|
|
1560
|
+
to: number;
|
|
1561
|
+
step: number;
|
|
1562
|
+
z: number;
|
|
1563
|
+
sideOffset: number;
|
|
1564
|
+
};
|
|
1565
|
+
pines: {
|
|
1566
|
+
count: number;
|
|
1567
|
+
first: number;
|
|
1568
|
+
span: number;
|
|
1569
|
+
rowZ: number;
|
|
1570
|
+
minScale: number;
|
|
1571
|
+
scaleRange: number;
|
|
1572
|
+
};
|
|
1573
|
+
};
|
|
1574
|
+
type StiltParams = {
|
|
1575
|
+
water: {
|
|
1576
|
+
y: number;
|
|
1577
|
+
z: number;
|
|
1578
|
+
length: number;
|
|
1579
|
+
depth: number;
|
|
1580
|
+
color: number;
|
|
1581
|
+
roughness: number;
|
|
1582
|
+
metalness: number;
|
|
1583
|
+
};
|
|
1584
|
+
bank: {
|
|
1585
|
+
z: number;
|
|
1586
|
+
length: number;
|
|
1587
|
+
depth: number;
|
|
1588
|
+
color: number;
|
|
1589
|
+
};
|
|
1590
|
+
boardwalk: {
|
|
1591
|
+
y: number;
|
|
1592
|
+
length: number;
|
|
1593
|
+
width: number;
|
|
1594
|
+
color: number;
|
|
1595
|
+
pilesFrom: number;
|
|
1596
|
+
pilesTo: number;
|
|
1597
|
+
pilesStep: number;
|
|
1598
|
+
};
|
|
1599
|
+
houses: {
|
|
1600
|
+
count: number;
|
|
1601
|
+
first: number;
|
|
1602
|
+
pitch: number;
|
|
1603
|
+
z: number;
|
|
1604
|
+
colors: readonly number[];
|
|
1605
|
+
lantern: {
|
|
1606
|
+
dx: number;
|
|
1607
|
+
y: number;
|
|
1608
|
+
dz: number;
|
|
1609
|
+
lit: number;
|
|
1610
|
+
unlit: number;
|
|
1611
|
+
};
|
|
1612
|
+
};
|
|
1613
|
+
lamp: {
|
|
1614
|
+
dx: number;
|
|
1615
|
+
y: number;
|
|
1616
|
+
dz: number;
|
|
1617
|
+
color: number;
|
|
1618
|
+
intensity: number;
|
|
1619
|
+
distance: number;
|
|
1620
|
+
};
|
|
1621
|
+
boat: {
|
|
1622
|
+
dx: number;
|
|
1623
|
+
dz: number;
|
|
1624
|
+
color: number;
|
|
1625
|
+
};
|
|
1626
|
+
};
|
|
1627
|
+
type MilitaryParams = {
|
|
1628
|
+
yard: {
|
|
1629
|
+
length: number;
|
|
1630
|
+
color: number;
|
|
1631
|
+
};
|
|
1632
|
+
fence: {
|
|
1633
|
+
from: number;
|
|
1634
|
+
to: number;
|
|
1635
|
+
step: number;
|
|
1636
|
+
z: number;
|
|
1637
|
+
height: number;
|
|
1638
|
+
color: number;
|
|
1639
|
+
wireColor: number;
|
|
1640
|
+
};
|
|
1641
|
+
towers: {
|
|
1642
|
+
dx: readonly number[];
|
|
1643
|
+
dz: number;
|
|
1644
|
+
};
|
|
1645
|
+
alarm: {
|
|
1646
|
+
dz: number;
|
|
1647
|
+
color: number;
|
|
1648
|
+
intensity: number;
|
|
1649
|
+
distance: number;
|
|
1650
|
+
y: number;
|
|
1651
|
+
lampDz: number;
|
|
1652
|
+
lampY: number;
|
|
1653
|
+
};
|
|
1654
|
+
sandbags: {
|
|
1655
|
+
dz: number;
|
|
1656
|
+
length: number;
|
|
1657
|
+
rows: number;
|
|
1658
|
+
};
|
|
1659
|
+
tents: {
|
|
1660
|
+
count: number;
|
|
1661
|
+
first: number;
|
|
1662
|
+
pitch: number;
|
|
1663
|
+
dz: number;
|
|
1664
|
+
width: number;
|
|
1665
|
+
depth: number;
|
|
1666
|
+
};
|
|
1667
|
+
};
|
|
1668
|
+
type RuralParams = {
|
|
1669
|
+
road: {
|
|
1670
|
+
length: number;
|
|
1671
|
+
color: number;
|
|
1672
|
+
};
|
|
1673
|
+
field: {
|
|
1674
|
+
y: number;
|
|
1675
|
+
dz: number;
|
|
1676
|
+
length: number;
|
|
1677
|
+
depth: number;
|
|
1678
|
+
color: number;
|
|
1679
|
+
};
|
|
1680
|
+
farmhouse: {
|
|
1681
|
+
dx: number;
|
|
1682
|
+
dz: number;
|
|
1683
|
+
};
|
|
1684
|
+
pole: {
|
|
1685
|
+
dx: number;
|
|
1686
|
+
dz: number;
|
|
1687
|
+
};
|
|
1688
|
+
fence: {
|
|
1689
|
+
dz: number;
|
|
1690
|
+
half: number;
|
|
1691
|
+
height: number;
|
|
1692
|
+
color: number;
|
|
1693
|
+
};
|
|
1694
|
+
trees: {
|
|
1695
|
+
count: number;
|
|
1696
|
+
first: number;
|
|
1697
|
+
span: number;
|
|
1698
|
+
dz: number;
|
|
1699
|
+
spread: number;
|
|
1700
|
+
minScale: number;
|
|
1701
|
+
scaleRange: number;
|
|
1702
|
+
};
|
|
1703
|
+
crops: {
|
|
1704
|
+
rows: number;
|
|
1705
|
+
perRow: number;
|
|
1706
|
+
first: number;
|
|
1707
|
+
pitch: number;
|
|
1708
|
+
dz: number;
|
|
1709
|
+
rowPitch: number;
|
|
1710
|
+
width: number;
|
|
1711
|
+
minHeight: number;
|
|
1712
|
+
heightRange: number;
|
|
1713
|
+
color: number;
|
|
1714
|
+
};
|
|
1715
|
+
};
|
|
1716
|
+
/** The composers the ten default patterns use; a game adds its own through `createUrban({ composers })`. */
|
|
1717
|
+
declare const COMPOSERS: Readonly<Record<string, Composer>>;
|
|
1718
|
+
|
|
1719
|
+
/** The far-away silhouettes of game-floorplan as the typologies of the default house provider. */
|
|
1720
|
+
declare const SILHOUETTE_TYPOLOGIES: Readonly<Record<string, SilhouetteFactory>>;
|
|
1721
|
+
/** The default provider: the silhouette of game-floorplan for the typology, added to the builder with its shared random. */
|
|
1722
|
+
declare function createSilhouetteHouses(typologies?: Readonly<Record<string, SilhouetteFactory>>): HouseProvider;
|
|
1723
|
+
|
|
1724
|
+
/** The vehicles of the fleet that park on a street: cars, SUVs, pickups and vans. */
|
|
1725
|
+
declare const PARKED_VEHICLE_IDS: readonly string[];
|
|
1726
|
+
type VehicleProviderOptions = {
|
|
1727
|
+
/** Ids of the fleet to choose from. Default `PARKED_VEHICLE_IDS`. */
|
|
1728
|
+
ids?: readonly string[];
|
|
1729
|
+
/** Replaces the choice: the id for a request. The default picks by the spot, so the same pattern parks the same cars every time. */
|
|
1730
|
+
pick?: (request: VehicleRequest, ids: readonly string[]) => string;
|
|
1731
|
+
/** Paint of the car. Default the colour the pattern asks for. */
|
|
1732
|
+
paint?: (request: VehicleRequest) => number | undefined;
|
|
1733
|
+
};
|
|
1734
|
+
/**
|
|
1735
|
+
* A vehicle provider that asks the drawer for a vehicle of the fleet where the pattern parks one. It chooses by the spot and not
|
|
1736
|
+
* by the scene's random, so the scene's draw order (and the golden of the Galeria, which parks nothing) does not move.
|
|
1737
|
+
*/
|
|
1738
|
+
declare function createVehicleProvider(options?: VehicleProviderOptions): VehicleProvider;
|
|
1739
|
+
type PlantProviderOptions = {
|
|
1740
|
+
/** Planting table of a region. Default Brazil's. */
|
|
1741
|
+
region?: Region;
|
|
1742
|
+
/** Context of the table for each kind the patterns plant. */
|
|
1743
|
+
contexts?: Partial<Record<PlantRequest['kind'], string>>;
|
|
1744
|
+
/** Seed of the choice; the spot is added so each place gets its own species. */
|
|
1745
|
+
seed?: number | string;
|
|
1746
|
+
/** Replaces the choice: the species id for a request. */
|
|
1747
|
+
pick?: (request: PlantRequest, context: string, seed: string) => string;
|
|
1748
|
+
};
|
|
1749
|
+
declare const DEFAULT_PLANT_CONTEXTS: Readonly<Record<PlantRequest['kind'], string>>;
|
|
1750
|
+
/** A plant provider that asks the drawer for a species of the pack, drawn from the region's table for the kind (a tree on the sidewalk, a pine in the square). */
|
|
1751
|
+
declare function createPlantProvider(options?: PlantProviderOptions): PlantProvider;
|
|
1752
|
+
|
|
1753
|
+
/** The ten patterns of the Galeria's sample sheet, in the order the page builds them. */
|
|
1754
|
+
declare const DEFAULT_PATTERNS: readonly NeighbourhoodPattern<any>[];
|
|
1755
|
+
/** Where the sample sheet puts each pattern: a 3 x 3 grid 80 by 56 m apart, and the military cell off to the east. */
|
|
1756
|
+
declare const SAMPLE_CELLS: Readonly<Record<string, {
|
|
1757
|
+
x: number;
|
|
1758
|
+
z: number;
|
|
1759
|
+
}>>;
|
|
1760
|
+
|
|
1761
|
+
/** The patterns of the tower pack. */
|
|
1762
|
+
declare const TOWER_PATTERNS: readonly NeighbourhoodPattern<any>[];
|
|
1763
|
+
/** Where the sample sheet puts them (pass it as `cells`). */
|
|
1764
|
+
declare const TOWER_SAMPLE_CELLS: Readonly<Record<string, {
|
|
1765
|
+
x: number;
|
|
1766
|
+
z: number;
|
|
1767
|
+
}>>;
|
|
1768
|
+
|
|
1769
|
+
export { type BarSpec, type Block, type BlockBuilding, type BlockUse, type BuilderOptions, type BuildingOptions, COMPOSERS, type Cities, type CitiesOptions, type CityLayout, type CityPlanDef, type CityPlanInput, type CityScale, type ColorRule, type ComposeContext, type ComposeOptions, type Composer, type ConePart, type CrossarmSpec, type CrownPart, DEFAULT_CITY_PLANS, DEFAULT_DISTRICT_KINDS, DEFAULT_FACADES, DEFAULT_LIGHT_BUDGET, DEFAULT_MAX_FLOORS, DEFAULT_PATTERNS, DEFAULT_PLANT_CONTEXTS, DEFAULT_POLES, DEFAULT_PROP_COLORS, DEFAULT_ROAD_STYLE, DEFAULT_STOREY_PRESETS, DEFAULT_STREET, DEFAULT_TOWER_PRESETS, DEFAULT_URBAN_SEED, DEFAULT_WALK_STYLE, type DistrictKindDef, type DistrictKindText, type DoubleArmSpec, type DowntownParams, type FillBlockCityOptions, type FillBlockOptions, type Flatten, type FloodTowerSpec, type ForestOptions, type HistoricParams, type HouseProvider, type HouseRequest, type IndustrialParams, type ItemBox, type KindStats, type LabelPart, type Lake, type LampLightSpec, type LampSpec, type LanternSpec, type LayoutOptions, type LensSpec, type LightBudget, type LightPart, type Locale, type MastSpec, type MilitaryParams, type MountainParams, type NeighbourhoodPattern, type Origin, PARKED_VEHICLE_IDS, POLE_SHAPES, type PartStyle, type PatternText, type PlacementPart, type PlanDistrict, type PlanLandmark, type PlanLine, type PlanPoint, type PlanRect, type PlanePart, type PlantProvider, type PlantProviderOptions, type PlantRequest, type Point, type Pole, type PoleDef, type PoleOptions, type PoleShapeBuilder, type PropColors, type Providers, type RailwayParams, type Ramp, type Rect, type ResolvedDistrict, type River, type RiverBed, type RoadStyle, type RuralParams, SAMPLE_CELLS, SILHOUETTE_TYPOLOGIES, type SampleSheetOptions, type SilhouetteFactory, type SingleArmSpec, type StiltParams, type StreetOptions, type SuburbParams, TOWER_DEFAULTS, TOWER_PATTERNS, TOWER_SAMPLE_CELLS, type Terrain, type TerrainGrid, type TerrainLayer, type TerrainOptions, type TerrainPart, type TowerOptions, type TowerPreset, type TowerProvider, type TowerRequest, type Trig, type UrbanBuilder, type UrbanBuilderOptions, type UrbanKit, type UrbanKitCore, type UrbanOptions, type UrbanPart, type UrbanPlan, type UrbanScene, type VaultPart, type VehicleProvider, type VehicleProviderOptions, type VehicleRequest, type WalkStyle, type Wave, type WorkingClassParams, type WorldFrame, clamp, composePattern, createCities, createLightBudget, createPlantProvider, createSilhouetteHouses, createTerrain, createTowerDrawer, createUrban, createUrbanBuilder, createVehicleProvider, distanceToPolyline, drawBuilding, drawContainer, drawFence, drawGround, drawPine, drawRoad, drawSandbags, drawStreetGrid, drawStripLabel, drawTent, drawTerrain, drawTower, drawTree, drawWalk, drawWatchtower, drawWires, fillBlock, hash2, insideEllipse, insideRect, lerp, patternMarker, pickTowerPreset, smoothstep, towerPresetOf, towerStoreys };
|