@threenative/procedural-environment 0.1.8 → 0.1.9
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/README.md +62 -1
- package/dist/asset-library-client.js +12956 -0
- package/dist/asset-library.d.ts +36 -0
- package/dist/asset-library.js +13039 -0
- package/dist/index-CYazo00w.d.ts +335 -0
- package/dist/index.d.ts +1 -316
- package/dist/stylized.d.ts +13 -3
- package/dist/stylized.js +4813 -334
- package/package.json +5 -3
- package/scans/credits.json +44 -0
- package/scans/toybox_backdrop-frost.webp +0 -0
- package/scans/toybox_backdrop-garden.webp +0 -0
- package/scans/toybox_backdrop-sand.webp +0 -0
- package/scans/toybox_flagstone-detail.webp +0 -0
- package/scans/toybox_flagstone-normal.webp +0 -0
- package/scans/toybox_metal-detail.webp +0 -0
- package/scans/toybox_metal-normal.webp +0 -0
- package/scans/toybox_planks-detail.webp +0 -0
- package/scans/toybox_planks-normal.webp +0 -0
- package/scans/toybox_rock-detail.webp +0 -0
- package/scans/toybox_rock-normal.webp +0 -0
- package/scans/toybox_slab-detail.webp +0 -0
- package/scans/toybox_slab-normal.webp +0 -0
- package/scans/toybox_soil-detail.webp +0 -0
- package/scans/toybox_soil-normal.webp +0 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where each element belongs. A biome lists the trees, cover, debris and rock forms that read as
|
|
3
|
+
* that place, and names the Outcrop rock surface its rocks wear. Ids match the Strata terrain kits
|
|
4
|
+
* (forest, coastal, alpine, desert, tundra) where they overlap. A spec fails when an element has no
|
|
5
|
+
* biome, so a new preset gets one here.
|
|
6
|
+
*/
|
|
7
|
+
interface IEnvironmentBiome {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
/** Other words a request uses for this place ("jungle", "swamp"); `environmentElements` searches them. */
|
|
11
|
+
readonly words: readonly string[];
|
|
12
|
+
/** The Outcrop biome whose colours, weathering and cover (moss, snow, sand, algae) the rocks take. */
|
|
13
|
+
readonly rock: string;
|
|
14
|
+
/** Element ids: Arbor and forest-kit presets, and Outcrop rock forms. */
|
|
15
|
+
readonly elements: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface IBakeCityOptions {
|
|
19
|
+
/** Directory the GLB is written to; created when missing. */
|
|
20
|
+
readonly out: string;
|
|
21
|
+
/** A module id: `environmentElements({ kind: "city" })` lists all 75 (cross, office, sedan, civic-bridge ...). */
|
|
22
|
+
readonly module: string;
|
|
23
|
+
/** An integer 0 to 4294967295. The same options always write the same bytes. Default 31082, the page's. */
|
|
24
|
+
readonly seed?: number;
|
|
25
|
+
/** Geometry detail: 0 low, 1 standard, 2 high. Default 2. */
|
|
26
|
+
readonly detail?: number;
|
|
27
|
+
/** Surface wetness, 0 to 100. Default 30. */
|
|
28
|
+
readonly wet?: number;
|
|
29
|
+
/** Building floors, an integer 2 to 12. Default 4. */
|
|
30
|
+
readonly floors?: number;
|
|
31
|
+
/** Sign text, at most 24 characters; empty uses the generated name. Default "". */
|
|
32
|
+
readonly text?: string;
|
|
33
|
+
/** Include street fixtures. Default true. */
|
|
34
|
+
readonly dressing?: boolean;
|
|
35
|
+
/** Straight and curve carriageway width in metres (6–16). Default 10. */
|
|
36
|
+
readonly roadWidth?: number;
|
|
37
|
+
/** Straight length in metres (8–200). Default 24. */
|
|
38
|
+
readonly roadLength?: number;
|
|
39
|
+
/** Curve sweep in degrees (5–180). Default 90. */
|
|
40
|
+
readonly bendAngle?: number;
|
|
41
|
+
/** Curve centreline radius in metres (12–120). Default 12. */
|
|
42
|
+
readonly bendRadius?: number;
|
|
43
|
+
/** Curve direction from its north inlet. Default "right". */
|
|
44
|
+
readonly bendSide?: "left" | "right";
|
|
45
|
+
/** Roadway material for modules with road sockets. Default "asphalt". */
|
|
46
|
+
readonly roadSurface?: "asphalt" | "concrete" | "paving";
|
|
47
|
+
/** Include pedestrian paving on supported road modules. Default true. */
|
|
48
|
+
readonly sidewalk?: boolean;
|
|
49
|
+
/** Include curbs on supported road modules. Default true. */
|
|
50
|
+
readonly curb?: boolean;
|
|
51
|
+
/** Include lane paint on straight and curve modules. Default true. */
|
|
52
|
+
readonly markings?: boolean;
|
|
53
|
+
/** Light canvas-drawn sign materials (`extras.sign`) with an emissive map for night scenes. Default false. */
|
|
54
|
+
readonly emissiveSigns?: boolean;
|
|
55
|
+
/** Convert transmissive glass (`transmission > 0`) to opaque reflective PBR glass. Default true: the default native engine refuses a transmissive mesh by name (`TN_MATERIAL_UNSUPPORTED transmission`) and three pays a full-scene transmission pass; `false` keeps the kit's transmissive glass. */
|
|
56
|
+
readonly opaqueGlass?: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface IVegetationPreset {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly latin?: string;
|
|
63
|
+
/** `tree`, `cover` (grass, fern, flower, shrub) or `debris` (log, twig, litter, stone). */
|
|
64
|
+
readonly kind: string;
|
|
65
|
+
}
|
|
66
|
+
interface IBakeVegetationOptions {
|
|
67
|
+
/** Directory the GLBs are written to; created when missing. */
|
|
68
|
+
readonly out: string;
|
|
69
|
+
/** A preset id from `vegetationPresets()`. */
|
|
70
|
+
readonly preset: string;
|
|
71
|
+
/** An integer. The same preset and seed always write the same bytes. Default 1. */
|
|
72
|
+
readonly seed?: number;
|
|
73
|
+
/** Levels of detail to write, each 0 (full) to 2 (far). Default `[0]`. */
|
|
74
|
+
readonly lods?: readonly number[];
|
|
75
|
+
/**
|
|
76
|
+
* A patch over the preset, so a game changes a species' form and leaf card with no package edit:
|
|
77
|
+
* `levels`, `leaves` and `tex.cells` merge row by row into the preset's own rows, and any other key
|
|
78
|
+
* replaces the preset's value. Each key must name a field the preset has. The file names carry a
|
|
79
|
+
* hash of the patch, so a formed bake never overwrites the stock one.
|
|
80
|
+
*/
|
|
81
|
+
readonly form?: Readonly<Record<string, unknown>>;
|
|
82
|
+
/**
|
|
83
|
+
* A PNG the leaves draw instead of Arbor's drawn card, as an atlas laid out on the preset's
|
|
84
|
+
* `tex.grid` (cell 0 top-left, row by row); `form` picks the grid and each leaf row's `cells`.
|
|
85
|
+
* The file names carry a hash of its bytes.
|
|
86
|
+
*/
|
|
87
|
+
readonly leafImage?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The longest side of Arbor's drawn leaf card, in pixels; Arbor draws 1024. A far level is drawn
|
|
90
|
+
* at a few pixels on screen, so a 1024 px card is bytes the frame never shows. A game's own
|
|
91
|
+
* `leafImage` is always used as given, and the two together throw.
|
|
92
|
+
*/
|
|
93
|
+
readonly leafSize?: number;
|
|
94
|
+
/**
|
|
95
|
+
* A PNG painted on the bark instead of Arbor's drawn one, for a species whose trunk is the whole
|
|
96
|
+
* silhouette (`saguaro`): the drawn bark is a flat pinstripe, and no photograph of a ribbed
|
|
97
|
+
* column is in the preset. The file names carry a hash of its bytes.
|
|
98
|
+
*/
|
|
99
|
+
readonly barkImage?: string;
|
|
100
|
+
/**
|
|
101
|
+
* The bark's relief as a glTF tangent-space normal PNG, drawn against `barkImage`.
|
|
102
|
+
*
|
|
103
|
+
* Arbor's own bark normal belongs to its drawn bark and is dropped when `barkImage` replaces it,
|
|
104
|
+
* so without this the trunk keeps a smooth surface and a ribbed column loses its ribs. Throws
|
|
105
|
+
* without `barkImage`, because a relief with no albedo to show is a caller's mistake.
|
|
106
|
+
*/
|
|
107
|
+
readonly barkNormalImage?: string;
|
|
108
|
+
/**
|
|
109
|
+
* `"scans"` (the default) wraps bark and forest-kit wood and stone in a Poly Haven CC0 scan, and
|
|
110
|
+
* draws leaves, blades, fronds and needles from CC0 leaf scans, where one fits (the bake's `scan`
|
|
111
|
+
* and `leafScan` name them); `"generated"` keeps the generator's own texture, byte for byte, as the
|
|
112
|
+
* raw Arbor and forest-kit pages draw it.
|
|
113
|
+
*/
|
|
114
|
+
readonly textures?: "scans" | "generated";
|
|
115
|
+
}
|
|
116
|
+
interface IEnvironmentBake {
|
|
117
|
+
readonly bounds: {
|
|
118
|
+
readonly max: readonly [number, number, number];
|
|
119
|
+
readonly min: readonly [number, number, number];
|
|
120
|
+
};
|
|
121
|
+
readonly lod: number;
|
|
122
|
+
readonly path: string;
|
|
123
|
+
readonly triangles: number;
|
|
124
|
+
/** The Poly Haven scan the bark or wood wears, absent when the texture is generated. */
|
|
125
|
+
readonly scan?: string;
|
|
126
|
+
/**
|
|
127
|
+
* The scanned foliage sprites the leaves, blades or fronds wear (`+` between several), absent when
|
|
128
|
+
* the leaf card is Arbor's drawing or a game's leafImage.
|
|
129
|
+
*/
|
|
130
|
+
readonly leafScan?: string;
|
|
131
|
+
/**
|
|
132
|
+
* A rock's material inputs: Outcrop's ROCK_TEXTURES profile, metres per repeat, and the two lossless WebPs
|
|
133
|
+
* its triplanar material samples (detail: rgb albedo multiplier, a roughness; normal: rgb
|
|
134
|
+
* tangent normal, a height). The GLB's `_ROCK`, `_COVER` and `_WET` attributes are the rest.
|
|
135
|
+
*/
|
|
136
|
+
readonly rock?: {
|
|
137
|
+
readonly texture: string;
|
|
138
|
+
readonly tile: number;
|
|
139
|
+
readonly detail: string;
|
|
140
|
+
readonly normal: string;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* List every preset a bake can grow: id, name, latin name and kind.
|
|
145
|
+
* Trees and cover come from Arbor; the `debris` rows (log, stump, twig, branch, leaflitter, rock)
|
|
146
|
+
* and the extra cover rows (reeds, tussock, seedgrass, clover, dock, plume) come from forest-kit.
|
|
147
|
+
* @situation list the oak, pine, spruce, palm and other tree species a bake can grow
|
|
148
|
+
* @situation choose a tree species id for bakeVegetation or a terrain arbor: species
|
|
149
|
+
* @situation what deadwood, leaf litter, boulders, reeds and tussocks can I bake for a forest floor
|
|
150
|
+
* @constraint ids come from the vendored Arbor and forest-kit presets; trees are kind "tree", grass, ferns and flowers are kind "cover", deadwood, litter and stone are kind "debris"
|
|
151
|
+
* @requires npm i -D @threenative/procedural-environment
|
|
152
|
+
* @example vegetationPresets().filter((p) => p.kind === "debris").map((p) => p.id);
|
|
153
|
+
*/
|
|
154
|
+
declare function vegetationPresets(): IVegetationPreset[];
|
|
155
|
+
/**
|
|
156
|
+
* Bake a procedural tree (Arbor) to GLBs, one per level of detail, ready for ctx.assets.model.
|
|
157
|
+
* Each GLB carries the _WIND vertex attribute, COLOR_0 and TEXCOORD_0 and embeds WebP textures:
|
|
158
|
+
* Arbor trees and cover wear a CC0 bark scan and alpha-masked leaves, blades, fronds and needles
|
|
159
|
+
* painted from CC0 leaf scans; forest-kit wood and stone wear a grey CC0 detail scan, and forest-kit
|
|
160
|
+
* cover and leaf litter a grey CC0 blade or leaf scan, each over the kit's COLOR_0 palette.
|
|
161
|
+
* @situation generate a procedural tree, an oak, pine, spruce, palm or any forest species as a GLB
|
|
162
|
+
* @situation procedural oak tree GLB with level of detail for a game forest
|
|
163
|
+
* @situation tree GLB for Unity, Unreal or Godot, with wind weights in a _WIND attribute
|
|
164
|
+
* @situation a fallen mossy log and leaf litter on the forest floor, with a stump, twigs and boulders
|
|
165
|
+
* @situation reeds and cattails at a pond edge, or sedge tussocks, clover and seeding grass as cover
|
|
166
|
+
* @alias trees
|
|
167
|
+
* @alias palm trees
|
|
168
|
+
* @alias street trees along a road
|
|
169
|
+
* @alias bushes and shrubs
|
|
170
|
+
* @alias grass, flowers and ferns as ground cover
|
|
171
|
+
* @alias dead trees, fallen logs and stumps
|
|
172
|
+
* @alias low poly tree with level of detail
|
|
173
|
+
* @alias realistic textured tree model
|
|
174
|
+
* @alias foliage and vegetation models
|
|
175
|
+
* @alias pine, oak or spruce forest trees
|
|
176
|
+
* @alias grass tufts and clumps
|
|
177
|
+
* @constraint fails closed: an unknown preset throws naming the nearest ids, the seed must be an integer and each lod 0 to 2
|
|
178
|
+
* @constraint the same preset, seed and lods write identical bytes; files are written atomically (temporary file, then rename)
|
|
179
|
+
* @constraint bake-time only, so keep it a dev dependency; the game owns the look and the sway (a TSL render/wind.ts reading _WIND), because Arbor.three is not shipped
|
|
180
|
+
* @constraint _WIND is vec4 (trunk sway, branch sway, flutter, phase): forest-kit sway is flutter in z, and debris writes all four zero
|
|
181
|
+
* @constraint textures default to "scans" (the bake's `scan` and `leafScan` name them); nine presets with no fitting CC0 leaf scan (ginkgo, palms, banana, joshua, flowers, elephantear) keep Arbor's drawn leaf card; textures: "generated" keeps every generator texture byte for byte
|
|
182
|
+
* @constraint form, leafImage, barkImage and barkNormalImage patch an Arbor preset only; a forest-kit debris or cover preset throws when given any
|
|
183
|
+
* @requires npm i -D @threenative/procedural-environment
|
|
184
|
+
* @example await bakeVegetation({ preset: "oak", seed: 7, lods: [0, 1], out: "assets/trees" });
|
|
185
|
+
* @example await bakeVegetation({ preset: "log", seed: 3, out: "assets/debris" });
|
|
186
|
+
*/
|
|
187
|
+
declare function bakeVegetation(options: IBakeVegetationOptions): Promise<IEnvironmentBake[]>;
|
|
188
|
+
/** What an element is: a tree, ground cover, floor debris, a rock form or an Apex city module. */
|
|
189
|
+
type EnvironmentKind = "tree" | "cover" | "debris" | "rock" | "city";
|
|
190
|
+
interface IEnvironmentElement {
|
|
191
|
+
readonly id: string;
|
|
192
|
+
readonly name: string;
|
|
193
|
+
readonly latin?: string;
|
|
194
|
+
readonly kind: EnvironmentKind;
|
|
195
|
+
/** Biome ids from `environmentBiomes()` this element belongs in. */
|
|
196
|
+
readonly biomes: readonly string[];
|
|
197
|
+
/** A city module's Apex category: Roads, Buildings, Street Props, Vehicles, Race Kit ... */
|
|
198
|
+
readonly category?: string;
|
|
199
|
+
/** The call that bakes it, ready to paste; a rock's names the filter's biome, else its first. */
|
|
200
|
+
readonly bake: string;
|
|
201
|
+
}
|
|
202
|
+
interface IEnvironmentFilter {
|
|
203
|
+
/** A biome id or one of its words ("jungle" finds tropical). */
|
|
204
|
+
readonly biome?: string;
|
|
205
|
+
readonly kind?: EnvironmentKind;
|
|
206
|
+
/** Words that must all appear in the id, name, latin name, kind or biomes ("pine", "red rock"). */
|
|
207
|
+
readonly search?: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Every biome: its id, name, the request words that mean it, the rock surface its rocks wear and
|
|
211
|
+
* the element ids that belong there.
|
|
212
|
+
* @situation which biomes can I bake nature for: forest, desert, jungle, tundra, coast, volcano
|
|
213
|
+
* @situation what trees, plants, debris and rocks belong in a desert or an alpine biome
|
|
214
|
+
* @constraint ids match the Strata terrain kits where they overlap (forest, coastal, alpine, desert, tundra)
|
|
215
|
+
* @requires npm i -D @threenative/procedural-environment
|
|
216
|
+
* @example environmentBiomes().map((biome) => biome.id);
|
|
217
|
+
*/
|
|
218
|
+
declare function environmentBiomes(): IEnvironmentBiome[];
|
|
219
|
+
/**
|
|
220
|
+
* Find the nature elements to bake, by biome, kind or words: trees, ground cover, forest-floor
|
|
221
|
+
* debris and rock forms (boulders, cliffs, sea stacks, mesas, arches, mountains), each with the
|
|
222
|
+
* exact bake call.
|
|
223
|
+
* @situation what can I bake for a desert, a jungle, a coast, a tundra or a volcanic island
|
|
224
|
+
* @situation list the rocks, cliffs and mountains for a biome, or every plant that grows there
|
|
225
|
+
* @situation find a tree or plant by name or latin name, such as pine, palm, cactus or fern
|
|
226
|
+
* @alias nature props for a level
|
|
227
|
+
* @alias jungle and tropical plants
|
|
228
|
+
* @alias desert cactus
|
|
229
|
+
* @alias vegetation for a biome
|
|
230
|
+
* @constraint fails closed: an unknown biome or kind throws naming the nearest ids
|
|
231
|
+
* @constraint biome takes an id or one of its words, so "jungle" finds tropical and "swamp" finds wetland
|
|
232
|
+
* @requires npm i -D @threenative/procedural-environment
|
|
233
|
+
* @example environmentElements({ biome: "desert", kind: "rock" }).map((element) => element.bake);
|
|
234
|
+
* @example environmentElements({ search: "palm" });
|
|
235
|
+
*/
|
|
236
|
+
declare function environmentElements(filter?: IEnvironmentFilter): IEnvironmentElement[];
|
|
237
|
+
interface IBakeRockOptions {
|
|
238
|
+
/** Directory the GLBs are written to; created when missing. */
|
|
239
|
+
readonly out: string;
|
|
240
|
+
/** A rock form: `environmentElements({ kind: "rock" })` lists boulder, slab, cliff, arch, mountain and the rest. */
|
|
241
|
+
readonly form: string;
|
|
242
|
+
/** A biome id or word from `environmentBiomes()`; sets the rock's weathering and colour. Default "hills". */
|
|
243
|
+
readonly biome?: string;
|
|
244
|
+
/** An integer. The same options always write the same bytes. Default 1. */
|
|
245
|
+
readonly seed?: number;
|
|
246
|
+
/** Levels of detail, each 0 (full) to 2 (far); level n keeps `detail` x 1, 0.5, 0.2. Default `[0]`. */
|
|
247
|
+
readonly lods?: readonly number[];
|
|
248
|
+
/** Mesh density of level 0, 0 to 1: about 1 500 triangles at 0, 70 000 at 1. Default 0.3. */
|
|
249
|
+
readonly detail?: number;
|
|
250
|
+
/** Width, height, depth in metres; default the form's own (a boulder is 2.4 x 1.8 x 2.1 m). */
|
|
251
|
+
readonly size?: readonly [number, number, number];
|
|
252
|
+
/** Shape overrides 0 to 1 over the biome's: roughness, chipping, strata, layers, tilt, fracture, columnar, weathering. */
|
|
253
|
+
readonly traits?: Readonly<Record<string, number>>;
|
|
254
|
+
/** Colour and cover overrides over the biome's: rockA, rockB, accent, moss, snow, sand, lichen, tide and their colours. */
|
|
255
|
+
readonly surface?: Readonly<Record<string, string | number>>;
|
|
256
|
+
/**
|
|
257
|
+
* A tileable form's (cliff) module along +X: module n sits n widths over and meets n - 1 and
|
|
258
|
+
* n + 1 without a seam, as Outcrop's `tile()` lays them. Place it at x = n x width. Default 0.
|
|
259
|
+
*/
|
|
260
|
+
readonly module?: number;
|
|
261
|
+
/**
|
|
262
|
+
* Where the module stands in its run, in metres. A tileable form (`cliff`) joins its neighbour
|
|
263
|
+
* only when both share the seed and stand one width apart: module n takes `[n * width, 0, 0]`.
|
|
264
|
+
*/
|
|
265
|
+
readonly offset?: readonly [number, number, number];
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Bake a procedural rock (Outcrop) to GLBs, one per level of detail: a boulder, slab, spire,
|
|
269
|
+
* hoodoo, sea stack, mesa, arch, tileable cliff module or a mountain, weathered and coloured for
|
|
270
|
+
* its biome (moss in a forest, snow in the tundra, sand in the desert, algae below the tide line).
|
|
271
|
+
* @situation generate a procedural rock, boulder or cliff as a GLB for a game level
|
|
272
|
+
* @situation desert mesa, hoodoo or sandstone arch; coastal sea stack; alpine spire; volcanic basalt columns
|
|
273
|
+
* @situation a procedural mountain mesh for the horizon, with snow at altitude
|
|
274
|
+
* @alias rocks and boulders
|
|
275
|
+
* @alias cliffs and mountains
|
|
276
|
+
* @constraint fails closed: an unknown form or biome throws naming the nearest ids, as do unknown traits or surface keys, a non-integer seed, a lod outside 0 to 2 and a detail outside 0 to 1
|
|
277
|
+
* @constraint the same options write identical bytes; files are written atomically (temporary file, then rename)
|
|
278
|
+
* @constraint each GLB carries POSITION, NORMAL and COLOR_0 (linear RGB, rock and cover already blended) on one `rock` material; units are metres, +Y up, the rock rests on y = 0
|
|
279
|
+
* @constraint a `cliff` module shows a cut face at each end: bake a run with one seed and `offset: [n * width, 0, 0]`, stand the modules one width apart and bury the two ends of the run
|
|
280
|
+
* @constraint bake-time only, so keep it a dev dependency; the game owns the material and can re-material by the glTF material name `rock`
|
|
281
|
+
* @requires npm i -D @threenative/procedural-environment
|
|
282
|
+
* @example await bakeRock({ form: "cliff", biome: "coastal", seed: 7, lods: [0, 1], out: "assets/rocks" });
|
|
283
|
+
* @example await bakeRock({ form: "boulder", biome: "forest", traits: { weathering: 0.8 }, out: "assets/rocks" });
|
|
284
|
+
* @example for (const n of [0, 1, 2]) await bakeRock({ form: "cliff", biome: "desert", seed: 7, offset: [n * 10, 0, 0], out: "assets/rocks" }); // three modules of one wall
|
|
285
|
+
*/
|
|
286
|
+
declare function bakeRock(options: IBakeRockOptions): Promise<IEnvironmentBake[]>;
|
|
287
|
+
/**
|
|
288
|
+
* Bake an Apex City Kit module to one GLB: a road tile, a building, a street prop, a vehicle, a race
|
|
289
|
+
* kit piece, a block or lot, a sidewalk, transit, a public space, a utility or a decal. The page's
|
|
290
|
+
* own generator and GLTFExporter run headless, so the GLB carries its merged meshes, its materials
|
|
291
|
+
* and textures (Poly Haven CC0 PBR maps and the canvas-drawn signs, liveries and markings) and its
|
|
292
|
+
* road sockets in the root node's extras.
|
|
293
|
+
* @situation generate a modular city street, intersection, roundabout or highway tile as a GLB
|
|
294
|
+
* @situation a procedural building, storefront, office tower, apartment block, house or warehouse for a city level
|
|
295
|
+
* @situation street props for a city: traffic signal, streetlight, bus shelter, hydrant, bench, mailbox, dumpster
|
|
296
|
+
* @situation a race track kit: starting grid, timing gantry, barriers, tire wall, kerbs, pit lane; or a car, van, kart or formula car
|
|
297
|
+
* @alias city kit
|
|
298
|
+
* @alias modular road tiles
|
|
299
|
+
* @alias low poly city buildings
|
|
300
|
+
* @alias cars and vehicles
|
|
301
|
+
* @constraint fails closed: an unknown module throws naming the nearest ids; seed is an integer 0 to 4294967295, detail 0 to 2, wet 0 to 100, floors an integer 2 to 12, text at most 24 characters, dressing a boolean
|
|
302
|
+
* @constraint the same options write identical bytes on one Node major and machine (fonts draw the sign text); files are written atomically (temporary file, then rename)
|
|
303
|
+
* @constraint units are metres, +Y up; stock roads fit a 24 m grid, and custom straights and bends export updated socket positions, directions, widths and lane centres in the root node's extras
|
|
304
|
+
* @constraint roadWidth and markings apply to straight and curve; roadLength applies to straight; bendAngle, bendRadius and bendSide apply to curve; roadSurface applies to socketed road modules
|
|
305
|
+
* @constraint bake-time only, so keep it a dev dependency; textures are capped at 1024 px like the page's export
|
|
306
|
+
* @constraint only bake road tiles (`straight`, `curve`, `cross`, `tee`, `alley`, `grid`, `pit`, `cul-de-sac`) when assembling the drivable carriageway from kit tiles; when a level builds its own spline or terrain road, bake scenery modules instead (`detail: 1, dressing: false` keeps draw counts low)
|
|
307
|
+
* @constraint `emissiveSigns: true` lights canvas-drawn signs (`extras.sign`) for night scenes; glass ships opaque reflective PBR by default (`opaqueGlass: true`), because the default native engine refuses a transmissive mesh by name (`TN_MATERIAL_UNSUPPORTED transmission`) and three pays a full-scene transmission pass; `opaqueGlass: false` keeps the kit's transmissive glass under its own file name
|
|
308
|
+
* @requires npm i -D @threenative/procedural-environment
|
|
309
|
+
* @example await bakeCity({ module: "office", detail: 1, dressing: false, out: "assets/city" });
|
|
310
|
+
* @example await bakeCity({ module: "civic-ad", detail: 1, text: "GRAND PRIX", emissiveSigns: true, out: "assets/city" });
|
|
311
|
+
* @example // Modular-road layout built from kit tiles:
|
|
312
|
+
* await bakeCity({ module: "cross", out: "assets/city" });
|
|
313
|
+
*/
|
|
314
|
+
declare function bakeCity(options: IBakeCityOptions): Promise<IEnvironmentBake[]>;
|
|
315
|
+
|
|
316
|
+
type __index_js_EnvironmentKind = EnvironmentKind;
|
|
317
|
+
type __index_js_IBakeCityOptions = IBakeCityOptions;
|
|
318
|
+
type __index_js_IBakeRockOptions = IBakeRockOptions;
|
|
319
|
+
type __index_js_IBakeVegetationOptions = IBakeVegetationOptions;
|
|
320
|
+
type __index_js_IEnvironmentBake = IEnvironmentBake;
|
|
321
|
+
type __index_js_IEnvironmentBiome = IEnvironmentBiome;
|
|
322
|
+
type __index_js_IEnvironmentElement = IEnvironmentElement;
|
|
323
|
+
type __index_js_IEnvironmentFilter = IEnvironmentFilter;
|
|
324
|
+
type __index_js_IVegetationPreset = IVegetationPreset;
|
|
325
|
+
declare const __index_js_bakeCity: typeof bakeCity;
|
|
326
|
+
declare const __index_js_bakeRock: typeof bakeRock;
|
|
327
|
+
declare const __index_js_bakeVegetation: typeof bakeVegetation;
|
|
328
|
+
declare const __index_js_environmentBiomes: typeof environmentBiomes;
|
|
329
|
+
declare const __index_js_environmentElements: typeof environmentElements;
|
|
330
|
+
declare const __index_js_vegetationPresets: typeof vegetationPresets;
|
|
331
|
+
declare namespace __index_js {
|
|
332
|
+
export { type __index_js_EnvironmentKind as EnvironmentKind, type __index_js_IBakeCityOptions as IBakeCityOptions, type __index_js_IBakeRockOptions as IBakeRockOptions, type __index_js_IBakeVegetationOptions as IBakeVegetationOptions, type __index_js_IEnvironmentBake as IEnvironmentBake, type __index_js_IEnvironmentBiome as IEnvironmentBiome, type __index_js_IEnvironmentElement as IEnvironmentElement, type __index_js_IEnvironmentFilter as IEnvironmentFilter, type __index_js_IVegetationPreset as IVegetationPreset, __index_js_bakeCity as bakeCity, __index_js_bakeRock as bakeRock, __index_js_bakeVegetation as bakeVegetation, __index_js_environmentBiomes as environmentBiomes, __index_js_environmentElements as environmentElements, __index_js_vegetationPresets as vegetationPresets };
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export { type EnvironmentKind as E, type IBakeCityOptions as I, __index_js as _, type IBakeRockOptions as a, type IBakeVegetationOptions as b, type IEnvironmentBake as c, type IEnvironmentBiome as d, type IEnvironmentElement as e, type IEnvironmentFilter as f, type IVegetationPreset as g, bakeCity as h, bakeRock as i, bakeVegetation as j, environmentBiomes as k, environmentElements as l, vegetationPresets as v };
|