@bendyline/molen-tooling 0.0.1
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/NOTICE.md +15 -0
- package/README.md +91 -0
- package/dist/capture/THIRD-PARTY-NOTICES.md +223 -0
- package/dist/capture/basis/LICENSE.txt +55 -0
- package/dist/capture/basis/basis_transcoder.js +19 -0
- package/dist/capture/basis/basis_transcoder.wasm +0 -0
- package/dist/capture/capture.html +15 -0
- package/dist/capture/harness.js +4671 -0
- package/dist/capture/worldgen-preview.html +15 -0
- package/dist/capture/worldgen-preview.js +4617 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +1276 -0
- package/dist/docs-src/guide/3d-art-guidelines.md +157 -0
- package/dist/docs-src/guide/3d-model-assets.md +286 -0
- package/dist/docs-src/guide/adaptive-performance.md +89 -0
- package/dist/docs-src/guide/agent-loop.md +156 -0
- package/dist/docs-src/guide/aircraft.md +225 -0
- package/dist/docs-src/guide/browser-mount.md +185 -0
- package/dist/docs-src/guide/building-interiors.md +175 -0
- package/dist/docs-src/guide/capability-authoring.md +69 -0
- package/dist/docs-src/guide/determinism.md +285 -0
- package/dist/docs-src/guide/entities.md +47 -0
- package/dist/docs-src/guide/examples.md +58 -0
- package/dist/docs-src/guide/experience-playback.md +57 -0
- package/dist/docs-src/guide/figures.md +164 -0
- package/dist/docs-src/guide/game-samples.md +100 -0
- package/dist/docs-src/guide/graphics-performance.md +167 -0
- package/dist/docs-src/guide/input.md +205 -0
- package/dist/docs-src/guide/materials.md +125 -0
- package/dist/docs-src/guide/project.md +157 -0
- package/dist/docs-src/guide/quickstart.md +63 -0
- package/dist/docs-src/guide/recognizable-places.md +158 -0
- package/dist/docs-src/guide/rendering-backends.md +231 -0
- package/dist/docs-src/guide/scripting.md +330 -0
- package/dist/docs-src/guide/sky.md +192 -0
- package/dist/docs-src/guide/source-bundles.md +42 -0
- package/dist/docs-src/guide/structure-library.md +114 -0
- package/dist/docs-src/guide/surface-rendering.md +203 -0
- package/dist/docs-src/guide/terrain.md +389 -0
- package/dist/docs-src/guide/three-surface.md +70 -0
- package/dist/docs-src/guide/vehicle-interiors.md +126 -0
- package/dist/docs-src/guide/vehicles.md +110 -0
- package/dist/docs-src/guide/weather.md +123 -0
- package/dist/docs-src/guide/worldgen.md +434 -0
- package/dist/docs-src/llms.txt +129 -0
- package/dist/docs-src/schemas/README.md +36 -0
- package/dist/docs-src/schemas/archstyle.md +2340 -0
- package/dist/docs-src/schemas/assert.md +169 -0
- package/dist/docs-src/schemas/asset.md +543 -0
- package/dist/docs-src/schemas/business-catalog.md +162 -0
- package/dist/docs-src/schemas/cameratrack.md +132 -0
- package/dist/docs-src/schemas/command.md +112 -0
- package/dist/docs-src/schemas/components.md +5826 -0
- package/dist/docs-src/schemas/delta.md +204 -0
- package/dist/docs-src/schemas/experience-play.md +452 -0
- package/dist/docs-src/schemas/figure.md +290 -0
- package/dist/docs-src/schemas/interior-catalog.md +230 -0
- package/dist/docs-src/schemas/keyframe.md +314 -0
- package/dist/docs-src/schemas/landmark-catalog.md +56 -0
- package/dist/docs-src/schemas/landmark.md +293 -0
- package/dist/docs-src/schemas/matgraph.md +1163 -0
- package/dist/docs-src/schemas/pack-index.md +82 -0
- package/dist/docs-src/schemas/pack-source.md +139 -0
- package/dist/docs-src/schemas/pack.md +225 -0
- package/dist/docs-src/schemas/pixelgrid.md +108 -0
- package/dist/docs-src/schemas/prefab.md +106 -0
- package/dist/docs-src/schemas/project.md +271 -0
- package/dist/docs-src/schemas/region-atlas.md +612 -0
- package/dist/docs-src/schemas/replay.md +807 -0
- package/dist/docs-src/schemas/scatter.md +541 -0
- package/dist/docs-src/schemas/scene.md +1152 -0
- package/dist/docs-src/schemas/source-bundle.md +266 -0
- package/dist/docs-src/schemas/stylepack.md +420 -0
- package/dist/docs-src/schemas/terrain-package.md +731 -0
- package/dist/docs-src/schemas/terrain.md +313 -0
- package/dist/docs-src/schemas/types.md +218 -0
- package/dist/docs-src/schemas/uvpaint.md +149 -0
- package/dist/docs-src/schemas/worldgen-batch.md +743 -0
- package/dist/index.d.mts +1271 -0
- package/dist/index.mjs +78 -0
- package/dist/mcp-BFnCWrg0.mjs +796 -0
- package/dist/ops-BGxhSP6w.mjs +7246 -0
- package/package.json +96 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Default structure library
|
|
2
|
+
|
|
3
|
+
Molen ships **120 procedural structures**: the original 16 styles and 104 additional interpretations
|
|
4
|
+
of real-world buildings. They share 45 material graphs and the existing footprint-driven worldgen
|
|
5
|
+
pipeline. Each entry has a stable style ID, taxonomy, country references, use, characteristic
|
|
6
|
+
details, and a representative footprint and floor count. These are original stylized studies,
|
|
7
|
+
not surveyed replicas or static meshes stretched to fit a parcel.
|
|
8
|
+
|
|
9
|
+
The generated runtime index is
|
|
10
|
+
[`structures/catalog.json`](../../content/worldgen/structures/catalog.json), shipped in the
|
|
11
|
+
`molen.worldgen.default` content pack (role `structures`). All 120 styles are
|
|
12
|
+
registered in the default style pack. The editable source for each logical building lives in its
|
|
13
|
+
own copyable directory under
|
|
14
|
+
[`source/structures/`](../../content/worldgen/source/structures/); its `source.json` inventories
|
|
15
|
+
the local recipe or archstyle and definition metadata. Supporting architectural references are
|
|
16
|
+
maintained in the collection-wide
|
|
17
|
+
[`catalog.json`](../../content/worldgen/source/shared/structure-library/catalog.json).
|
|
18
|
+
|
|
19
|
+
## See and reshape every structure
|
|
20
|
+
|
|
21
|
+
Run the world explorer and open **`/structures.html`**, or use its **Explore 120 structures** link.
|
|
22
|
+
The collection renders the actual shipped generators and shared material graphs. Search by name,
|
|
23
|
+
country, construction material or description; filter by taxonomy; select any card to change
|
|
24
|
+
width, depth and storeys, orbit, compare front and rear, or inspect the silhouette without textures.
|
|
25
|
+
The detail menu uses the production geometry tiers. The sheet shows complete exteriors; optional
|
|
26
|
+
enterable interiors are generated separately by the world renderer.
|
|
27
|
+
|
|
28
|
+
**Download model sheet** exports all 120 rendered entries as a labeled PNG. For reproducible
|
|
29
|
+
captures, build once and run:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
pnpm -r build
|
|
33
|
+
node examples/world-explorer/scripts/capture-structure-sheet.mjs
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This creates `artifacts/building-diversity/model-sheet.png`, 13 taxonomy sheets, front/rear/detail
|
|
37
|
+
and resized inspection frames for six representative structures, and `render-report.json`
|
|
38
|
+
with material failures, mesh counts and hashes. The report must contain 120 entries, 120 unique
|
|
39
|
+
IDs, and no failed materials or browser errors. The full sheet is normalized to fit each card;
|
|
40
|
+
dimensions beneath each study supply its real scale.
|
|
41
|
+
|
|
42
|
+
## Taxonomies
|
|
43
|
+
|
|
44
|
+
| Family | Examples |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| North American homes | Cape Cod, Craftsman, brownstone, ranch, timber barn |
|
|
47
|
+
| Latin American and Caribbean streets | Patio house, hacienda wing, sobrado, Chiloé shingles |
|
|
48
|
+
| Northern European vernacular | Nordic timber, croft, thatched farmhouse, boathouse |
|
|
49
|
+
| Western European town and country | Canal house, mansard apartments, half-timbered house |
|
|
50
|
+
| Mediterranean buildings | Palazzo, azulejo townhouse, Cycladic house, farmhouse |
|
|
51
|
+
| Eastern European and alpine buildings | Konak, timber cottage, gallery house, alpine inn |
|
|
52
|
+
| North African and West Asian buildings | Riad, courtyard house, earthen tower, stone house |
|
|
53
|
+
| African domestic and community buildings | Swahili house, Sahel townhouse, courtyard compound |
|
|
54
|
+
| South Asian buildings | Haveli, nalukettu, Newari townhouse, bungalow |
|
|
55
|
+
| East Asian buildings | Machiya, gassho farmhouse, hanok, siheyuan, square tulou |
|
|
56
|
+
| Southeast Asian buildings | Shophouse, tube house, timber house, limasan |
|
|
57
|
+
| Australian, New Zealand and Pacific buildings | Queenslander, villa, bach, community hall |
|
|
58
|
+
| Civic, commercial and working structures | Library, fire station, market, factory, clinic, retail |
|
|
59
|
+
|
|
60
|
+
## Place and resize a building
|
|
61
|
+
|
|
62
|
+
Supply a catalog entry's `style` to any normal `BuildingRequest`, `worldgenBuilding` component,
|
|
63
|
+
worldgen batch, preview or bake operation. Regenerate with a new footprint to change width/depth;
|
|
64
|
+
the wall bays, windows, roofs and ornament are rebuilt in meters. Changing `levels` changes the
|
|
65
|
+
storeys; supplied `height` remains the total envelope. Transformed and nonrectangular footprints
|
|
66
|
+
use the same analysis and safe roof fallback as existing styles.
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
const request = {
|
|
70
|
+
identity: 'neighborhood:home-42',
|
|
71
|
+
style: 'molen.worldgen.catalog.craftsman',
|
|
72
|
+
labels: ['bungalow'],
|
|
73
|
+
outline: [[0, 0], [16, 0], [16, 11], [0, 11]],
|
|
74
|
+
levels: 2,
|
|
75
|
+
};
|
|
76
|
+
// generateWorldgenBatch({ buildings: [request], pack })
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The default Earth atlas now has 45 geographic regions. Weighted variants sample a named stream
|
|
80
|
+
of stable building identity, so reordering features or regenerating a tile preserves its style.
|
|
81
|
+
Rules retain a fallback `style`; optional `variants: [{ style, weight }]` supplies the weighted
|
|
82
|
+
pool. Explicit building styles win. Measured heights and floor counts are retained, and known
|
|
83
|
+
tall buildings bypass low-rise residential variant pools. Geographic envelopes are broad visual
|
|
84
|
+
priors and do not identify the architecture of an individual mapped building.
|
|
85
|
+
|
|
86
|
+
## Architecture and material authoring
|
|
87
|
+
|
|
88
|
+
`facade.details` adds shutters, balconies, timber framing or pilasters, awnings and verandas.
|
|
89
|
+
Details use the actual facade rhythm, a bounded perimeter allocation, and the existing
|
|
90
|
+
`facade-bands` tier flag. Structural openings, clipped edges and courtyard constraints take
|
|
91
|
+
precedence. Dormers use `roof.features.dormers` on eligible pitched wings. Simplified budget
|
|
92
|
+
representations omit ornament while retaining their footprint, primary roof and measured envelope.
|
|
93
|
+
|
|
94
|
+
The [standard material catalog](../../content/worldgen/materials/README.md)
|
|
95
|
+
groups all 45 shared graphs by construction. It includes several brick bonds, cut/rubble stone,
|
|
96
|
+
clapboard and board-and-batten, shingles, clay tiles, slate, thatch, rammed earth and metal roofs.
|
|
97
|
+
Physical repeat sizes live in `scripts/standard-materials.mjs`. Common textures are 256² and
|
|
98
|
+
prepared once per shared material set. Window graphs use cell UVs; solid surfaces use meter UVs.
|
|
99
|
+
|
|
100
|
+
Edit the applicable `content/worldgen/source/structures/<style>/` bundle. Generated styles use
|
|
101
|
+
`recipe.json`; the original styles carry their complete `archstyle.json`. After editing:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
node packages/worldgen/scripts/generate-structures.mjs
|
|
105
|
+
node packages/worldgen-earth/scripts/generate-structure-atlas.mjs
|
|
106
|
+
pnpm -r build
|
|
107
|
+
pnpm docs:gen
|
|
108
|
+
node examples/world-explorer/scripts/capture-structure-sheet.mjs
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The worldgen build rejects stale generated catalog resources. Keep the model-sheet review in
|
|
112
|
+
the loop: inspect roof silhouettes, window proportions, trim contrast, shadows and resized
|
|
113
|
+
placements before accepting a recipe change. Kernel tests generate every entry repeatedly at
|
|
114
|
+
independent footprint scales and a supplied height, and verify valid deterministic geometry.
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Surface styles and parameterized line features
|
|
2
|
+
|
|
3
|
+
The terrain client renders roads, parking areas, pedestrian surfaces, and street fixtures from
|
|
4
|
+
normalized semantic tiles. World explorer exposes **Surfaces → Modern traffic / Circa 1910 /
|
|
5
|
+
Simple surfaces** in Human mode. Styles change in place, preserving the camera, streamed data,
|
|
6
|
+
and generated buildings. Expand **Surface details** to control markings, sidewalks, crossings,
|
|
7
|
+
streetlights, signals, parked cars, and inferred parking. The URL preserves these choices:
|
|
8
|
+
`?surfaces=1910`, `?surfaces=modern&parkedCars=0`, or `?inferParking=0`.
|
|
9
|
+
|
|
10
|
+
## Shared rendering API
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import {
|
|
14
|
+
createTerrainSurfaceRenderer,
|
|
15
|
+
createDefaultTerrainSemanticRenderer,
|
|
16
|
+
} from '@bendyline/molen-terrain/client';
|
|
17
|
+
|
|
18
|
+
const surfaces = createTerrainSurfaceRenderer({
|
|
19
|
+
style: 'modern',
|
|
20
|
+
details: {
|
|
21
|
+
maxFixturesPerTile: 160,
|
|
22
|
+
maxDetailElements: 16_000,
|
|
23
|
+
parkingOccupancy: 0.7,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const renderer = createDefaultTerrainSemanticRenderer({ surfaceRenderer: surfaces });
|
|
27
|
+
// Supply renderer to createTerrainSemanticPyramidLayer, or featuresLayer.renderer
|
|
28
|
+
// in createTerrainPackageSemanticLayers.
|
|
29
|
+
|
|
30
|
+
await surfaces.setOptions({ style: '1910' });
|
|
31
|
+
console.log(surfaces.stats());
|
|
32
|
+
// Dispose the stream/layers, then the shared controller when the experience closes.
|
|
33
|
+
surfaces.dispose();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Worldgen's `createWorldgenSemanticRenderers(pack, { roads: { surfaceRenderer: surfaces } })`
|
|
37
|
+
uses the same controller. Static consumers can pass
|
|
38
|
+
`{ surfaces: { style: '1910', details: { streetlights: false } } }` to
|
|
39
|
+
`createTerrainSemanticObject` or the default semantic renderer. `createTerrainSurfaceObject`
|
|
40
|
+
also works directly with a tile and `TerrainPyramidTileLayerContext`.
|
|
41
|
+
|
|
42
|
+
`setOptions` replaces the options, validates them, and cooperatively rebuilds resident surface
|
|
43
|
+
groups. New tiles use the latest options immediately. A newer update supersedes an older update.
|
|
44
|
+
The default semantic disposer unregisters controller-owned tiles and frees their geometry and
|
|
45
|
+
instance buffers. Caller-supplied materials remain caller-owned; `materials.road` applies to the
|
|
46
|
+
static renderer, while the shared controller uses its style palette.
|
|
47
|
+
|
|
48
|
+
For streamed worlds, run surface generation in a module worker. World explorer enables this by
|
|
49
|
+
default (diagnostic opt-out: `?surfaceWorker=0`, or `?worker=0` for all generation workers).
|
|
50
|
+
The worker handles road topology, intersections, parking inference, draping, fixture transforms,
|
|
51
|
+
and culling bounds. It transfers typed geometry and instance buffers; the main thread creates
|
|
52
|
+
render objects and uploads them to the GPU. The geometry and style match synchronous generation.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// surface-worker.ts
|
|
56
|
+
import { installTerrainSurfaceWorker } from '@bendyline/molen-terrain/client';
|
|
57
|
+
installTerrainSurfaceWorker(self);
|
|
58
|
+
|
|
59
|
+
// viewer.ts
|
|
60
|
+
import {
|
|
61
|
+
createTerrainSurfaceWorkerBridge,
|
|
62
|
+
createTerrainSurfaceRenderer,
|
|
63
|
+
} from '@bendyline/molen-terrain/client';
|
|
64
|
+
const generator = createTerrainSurfaceWorkerBridge(
|
|
65
|
+
new Worker(new URL('./surface-worker.ts', import.meta.url), { type: 'module' }),
|
|
66
|
+
);
|
|
67
|
+
const surfaces = createTerrainSurfaceRenderer({ style: 'modern' }, generator);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The default semantic renderer awaits `surfaces.createTileAsync(tile, context)` before publishing
|
|
71
|
+
a tile, so pending-layer counts and `whenIdle()` include surface work. Custom streamed renderers
|
|
72
|
+
should await that method too. `createTile` and `createTerrainSurfaceObject` remain synchronous for
|
|
73
|
+
static callers. The worker runs one job at a time; aborted queued jobs are removed before height
|
|
74
|
+
samples are copied. Cancellation settles the caller immediately; a job already executing in the
|
|
75
|
+
worker finishes before the next job starts. `setOptions` cancels older queued revisions, keeps
|
|
76
|
+
existing surfaces visible until their replacement arrives, and makes initial tile readiness follow
|
|
77
|
+
the newest style. `stats().loading` counts pending resident replacements, and
|
|
78
|
+
`stats().geometryRevision` advances when rendered geometry changes. A host using terrain memory
|
|
79
|
+
budgets can call the stream's `refreshMemoryUsage()` after a new revision finishes loading.
|
|
80
|
+
Disposing the controller
|
|
81
|
+
also disposes its generator; do not share that generator between separately owned controllers.
|
|
82
|
+
|
|
83
|
+
`TERRAIN_SURFACE_STYLES` provides immutable presets. Pass a custom `TerrainSurfaceStyle` to
|
|
84
|
+
change colors, inferred road widths, sidewalk width, and defaults for each detail class:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { TERRAIN_SURFACE_STYLES } from '@bendyline/molen-terrain/client';
|
|
88
|
+
await surfaces.setOptions({
|
|
89
|
+
style: {
|
|
90
|
+
...TERRAIN_SURFACE_STYLES['1910'],
|
|
91
|
+
id: 'quiet-country',
|
|
92
|
+
label: 'Country lanes',
|
|
93
|
+
dirt: '#a99069',
|
|
94
|
+
roadWidthScale: 0.7,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## What is drawn
|
|
100
|
+
|
|
101
|
+
- Modern streets use asphalt, exposed shoulder strips, curb/sidewalk bands, lane dividers, edge paint, stop
|
|
102
|
+
bars and zebra crossings. Mapped paths are cut at same-grade carriageway edges, so footway
|
|
103
|
+
fills cannot compete with asphalt at walking height; paths beneath bridges remain continuous.
|
|
104
|
+
Nearby nodes on divided roads form one junction; crossings follow
|
|
105
|
+
the external approaches, and short turning links receive no independent crossings. Same-grade
|
|
106
|
+
junctions leave their centers clear of lane paint.
|
|
107
|
+
Four-way major junctions can receive illustrative traffic signals. Instanced streetlights
|
|
108
|
+
occupy eligible corners outside road corridors, buildings, and water.
|
|
109
|
+
- Parking, plazas, and pedestrian polygons are filled, with holes retained. Pedestrian polygons
|
|
110
|
+
and mapped paths use distinct heights above parking pavement, including inferred lots, so
|
|
111
|
+
overlapping sidewalk and asphalt fills remain stable at walking height. Land cover, paved
|
|
112
|
+
polygons, roads, and markings are clipped to the same rendered terrain grid and cell diagonals,
|
|
113
|
+
so large footprints follow dips and hills without covering streets or intersecting each other. Parking receives rows of bays aligned to mapped aisles (or a regular fallback grid) and deterministic parked cars;
|
|
114
|
+
layout checks keep bays out of mapped aisles, holes, buildings and water. Cars are drawn from
|
|
115
|
+
`details.parkedVehicles`, a list of `{ id, spec }` a host builds from loaded vehicle types (the
|
|
116
|
+
world explorer uses the `molen.entities` pack's, in type order); without it no cars are parked.
|
|
117
|
+
- Some basemaps omit parking polygons. Service-aisle pairs can infer pavement inside mapped
|
|
118
|
+
commercial/retail sites, near large buildings outside mapped residential areas, or with explicit
|
|
119
|
+
`parking_aisle` metadata. These pairs can be angled and 9–60 world units apart, with at least
|
|
120
|
+
12 units of overlap and half the shorter run. This also fills wedges where access roads meet.
|
|
121
|
+
Without this evidence, the fallback requires three parallel runs at least 28 units long,
|
|
122
|
+
9–26 units apart, with at least 20 units of overlap and half the shorter run. Nearly straight
|
|
123
|
+
fragments are joined before measuring; aisle pairs across ordinary streets are rejected.
|
|
124
|
+
- Bounded service-road loops also infer pavement when their connected courts have parking tags,
|
|
125
|
+
a commercial site, or a nearby building of at least 240 square world units outside residential
|
|
126
|
+
land use. This covers office loops and small entrance courts without paving an entire property.
|
|
127
|
+
Faces must be 80–12,000 square units and no more than 240 units across. Junctions tolerate up to
|
|
128
|
+
0.6 units of source simplification error; larger gaps and clipped tile boundaries remain open.
|
|
129
|
+
Tagged driveways, alleys, unpaved roads, bridges,
|
|
130
|
+
tunnels and other road layers do not supply inference geometry.
|
|
131
|
+
- Inferred areas are clipped to the site or tile and cut around buildings, water, existing parking,
|
|
132
|
+
and mapped vegetation, playgrounds and sports fields. New loop fills also exclude residential
|
|
133
|
+
land use. This is a visual inference, not surveyed parking geometry; disable `inferParking` to
|
|
134
|
+
use only mapped lots. Large unclassified buildings can still be mistaken for commercial premises,
|
|
135
|
+
and repeated aisle patterns can occur in residential developments too.
|
|
136
|
+
- Circa 1910 uses earth-colored roads, narrower inferred widths, and wheel tracks. Its defaults
|
|
137
|
+
omit road paint, sidewalks, signals, streetlights, parking stripes, and modern parked cars.
|
|
138
|
+
It retains the **present-day map layout and buildings**; this is an art treatment rather than
|
|
139
|
+
a historical reconstruction. Individual details can be overridden.
|
|
140
|
+
- Simple surfaces retain road and parking fills with decoration disabled.
|
|
141
|
+
|
|
142
|
+
The decoder preserves road `subclass`, `service`, `link` (including Protomaps `is_link`), `surface`, `lanes`, `oneway`, `layer`, `bridge`, `tunnel`
|
|
143
|
+
and explicit `width`. Properties absent from the source use class-based defaults. Tunnels are
|
|
144
|
+
omitted; bridges and differing layers do not form surface junctions. Bridge ribbons retain the
|
|
145
|
+
existing approximate terrain-relative elevation; this renderer does not build engineered bridge
|
|
146
|
+
decks. Crossing paint, inferred sidewalks, signal placement and parking occupancy are decorative,
|
|
147
|
+
not traffic-control or navigation data.
|
|
148
|
+
|
|
149
|
+
Ground surfaces render at all available semantic levels. Fine markings and fixtures default to
|
|
150
|
+
the finest pyramid level; `detailLevelsBelowMax` extends them to coarser levels. Fixture/car and
|
|
151
|
+
detail-work budgets bound each tile. A portion of the detail budget is reserved for parking.
|
|
152
|
+
Geometry is batched by surface role, broad land-cover meshes share indexed vertices, and fixture/car parts are instanced. Stats cover resident
|
|
153
|
+
surface tiles, including temporarily hidden tiles.
|
|
154
|
+
|
|
155
|
+
## Parking data in PMTiles
|
|
156
|
+
|
|
157
|
+
PMTiles is an archive format; the encoded tile schema determines which features it contains.
|
|
158
|
+
The local Sammamish archive retains service aisles but has no parking polygons in the nine
|
|
159
|
+
zoom-15 tiles around the shopping center. The reported shopping and office courts also lack
|
|
160
|
+
`parking_aisle` road subtypes: their roads carry `kind=minor_road`, `kind_detail=service`, so
|
|
161
|
+
geometry and nearby buildings supply the missing evidence. The renderer consumes polygon features
|
|
162
|
+
classified as `parking` or `car_park` when supplied, including holes; those footprints take
|
|
163
|
+
priority over inferred fills. A parking POI alone does not supply a boundary.
|
|
164
|
+
|
|
165
|
+
Protomaps deliberately includes a subset of OSM features. Its documented `landuse` polygon
|
|
166
|
+
kinds do not currently include parking, while roads may carry `parking_aisle` detail.
|
|
167
|
+
See the [Protomaps layer reference](https://docs.protomaps.com/basemaps/layers).
|
|
168
|
+
|
|
169
|
+
## Lines beyond roads
|
|
170
|
+
|
|
171
|
+
`createTerrainLinearObject(lines, context, profile)` is independent of road semantics. Lines use
|
|
172
|
+
normalized tile-local `[u,v]` points; profile dimensions use world units (meters in metric Earth
|
|
173
|
+
packages). A profile combines offset bands with optional dash patterns and repeated fixtures.
|
|
174
|
+
Compatible degree-two fragments join before rendering. The path sampler handles duplicate
|
|
175
|
+
points, arc-length spacing, continuous offset edges, bounded joins at bends, closed-loop seams,
|
|
176
|
+
and tile clipping. Bands can follow terrain or use absolute elevations. Streamed layer contexts
|
|
177
|
+
provide `surfaceResolution`, the actual ground-grid resolution after quality capping; custom
|
|
178
|
+
contexts may supply it when their rendered grid is coarser than the source heightfield. Ground
|
|
179
|
+
overlays use this grid without changing the logical heightfield used by simulation and collision.
|
|
180
|
+
|
|
181
|
+
For example, a rail profile combines ballast, two raised rails, and repeated sleepers:
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
import { createTerrainLinearObject } from '@bendyline/molen-terrain/client';
|
|
185
|
+
const track = createTerrainLinearObject(lines, context, {
|
|
186
|
+
bands: [
|
|
187
|
+
{ width: 3.2, color: '#837f70', elevation: 0.25 },
|
|
188
|
+
{ width: 0.08, offset: -0.72, color: '#b8b8b2', elevation: 0.46 },
|
|
189
|
+
{ width: 0.08, offset: 0.72, color: '#b8b8b2', elevation: 0.46 },
|
|
190
|
+
],
|
|
191
|
+
repeaters: [
|
|
192
|
+
{ spacing: 0.65, size: [2.4, 0.16, 0.22], color: '#76604b', elevation: 0.28 },
|
|
193
|
+
],
|
|
194
|
+
maxElements: 20_000,
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
For a utility corridor, use narrow elevated bands and widely spaced pole repeaters. `size` is
|
|
199
|
+
width across the route, height, and length along it. Band `dash: [length, gap]` and `phase` use
|
|
200
|
+
world units along the path; callers can carry phase across tile fragments when their source
|
|
201
|
+
provides route chainage. `terrainLinePath` and `sampleTerrainLine` are exported for custom
|
|
202
|
+
attachment/model placement. Railway switches, wire sag, traffic simulation, and route-level
|
|
203
|
+
cross-tile topology are separate consumers of this foundation.
|