@bendyline/molen-tooling 0.0.15 → 0.0.17
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/dist/capture/harness.js +755 -406
- package/dist/capture/worldgen-preview.js +409 -298
- package/dist/docs-src/guide/3d-art-guidelines.md +15 -9
- package/dist/docs-src/guide/adaptive-performance.md +50 -23
- package/dist/docs-src/guide/aircraft.md +263 -29
- package/dist/docs-src/guide/ambient-life.md +36 -9
- package/dist/docs-src/guide/building-interiors.md +92 -8
- package/dist/docs-src/guide/determinism.md +1 -1
- package/dist/docs-src/guide/earth-view.md +215 -16
- package/dist/docs-src/guide/entities.md +42 -8
- package/dist/docs-src/guide/figures.md +32 -4
- package/dist/docs-src/guide/graphics-performance.md +122 -18
- package/dist/docs-src/guide/livery-catalog.md +137 -1
- package/dist/docs-src/guide/livery-gallery.md +136 -1
- package/dist/docs-src/guide/medium-fi.md +197 -12
- package/dist/docs-src/guide/night-lighting.md +13 -0
- package/dist/docs-src/guide/recognizable-places.md +47 -4
- package/dist/docs-src/guide/regional-fleets.md +27 -5
- package/dist/docs-src/guide/regional-world.md +19 -1
- package/dist/docs-src/guide/rendering-backends.md +28 -4
- package/dist/docs-src/guide/sky.md +28 -2
- package/dist/docs-src/guide/snow.md +231 -0
- package/dist/docs-src/guide/surface-rendering.md +333 -11
- package/dist/docs-src/guide/terrain.md +74 -5
- package/dist/docs-src/guide/typography.md +36 -0
- package/dist/docs-src/guide/vehicle-interiors.md +6 -0
- package/dist/docs-src/guide/vehicles.md +374 -46
- package/dist/docs-src/guide/weather.md +7 -1
- package/dist/docs-src/guide/worldgen.md +82 -3
- package/dist/docs-src/llms.txt +3 -2
- package/dist/docs-src/schemas/README.md +2 -0
- package/dist/docs-src/schemas/components.md +835 -57
- package/dist/docs-src/schemas/figure.md +30 -4
- package/dist/docs-src/schemas/interior-catalog.md +56 -3
- package/dist/docs-src/schemas/map-overrides.md +658 -0
- package/dist/docs-src/schemas/sign-looks.md +174 -0
- package/dist/docs-src/schemas/structure-placement-data.md +195 -0
- package/dist/docs-src/schemas/structure-placements.md +195 -0
- package/dist/docs-src/schemas/worldgen-batch.md +95 -0
- package/dist/templates/city-courier/gen/molen-types.ts +121 -4
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +120 -3
- package/dist/templates/figures-gallery/test/headless.test.ts +3 -2
- package/dist/templates/index.json +17 -17
- package/dist/templates/skybound/gen/molen-types.ts +121 -4
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +120 -3
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +120 -3
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +121 -4
- package/package.json +12 -12
|
@@ -107,13 +107,23 @@ setTerrainGroundOrigin(pavement, [worldOrigin[0], worldOrigin[2]]);
|
|
|
107
107
|
|
|
108
108
|
The material reads a `surfaceDetail` attribute the surface builder writes on every road, sidewalk,
|
|
109
109
|
curb, marking and lot: meters along the band, meters across it from its edge, the surface kind
|
|
110
|
-
and band width, and a road's lane width
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
and band width, and a road's lane width and wear grade or the surface a marking is painted on.
|
|
111
|
+
Roads and lots get asphalt aggregate
|
|
112
|
+
(within a few meters, crisp pale chips and dark pits a few centimeters across), blotchy wear,
|
|
113
|
+
polished wheel tracks and an oil line in each lane, grit in the gutters, storm-drain grates,
|
|
114
|
+
manhole covers and the odd darker repaired section; asphalt and concrete both get hairline cracks.
|
|
115
|
+
Worn roads also get potholes in the wheel tracks, each with a ragged lip and a halo of alligator
|
|
116
|
+
cracking, plus more patches and cracks: none on freeways, trunk and primary roads (grade 0), a few
|
|
117
|
+
on secondary and tertiary roads (1), more on residential streets (2) and most on service roads and
|
|
118
|
+
alleys (3). A band sets its grade with `wear` beside `lanes`; lots get oil
|
|
114
119
|
stains; sidewalks and footways get 1.5 m saw-cut slabs and curbs 3 m ones, each slab its own
|
|
115
120
|
tone, weathered with water stains and, close up, the odd spot of gum; plazas and pedestrian areas get a half-meter paver grid; markings wear through to the
|
|
116
|
-
asphalt.
|
|
121
|
+
asphalt. A marking narrower than a pixel fades into the color and shading of the
|
|
122
|
+
surface it lies on (`beneath` on a paint `TerrainLineBand`, a road's by default; a parking lot's
|
|
123
|
+
lines take on its oil stains), so from the air lines and rows of bays melt into the asphalt
|
|
124
|
+
instead of breaking into dashes that beat into moiré. A mark drawn with `surfaceSince` passes its
|
|
125
|
+
narrowest dimension as the width, which sets that fade.
|
|
126
|
+
Detail fades to the plain swatch with distance, so it never shimmers, and each layer's
|
|
117
127
|
noise is evaluated only where it still shows: distant pavement skips the fine layers, and only
|
|
118
128
|
fragments within 2 m of a frayed edge evaluate the fray. `setMaterial(undefined)` restores the plain material. Your own geometry can opt in with
|
|
119
129
|
`TerrainSurfaceMeshBuilder.surfaceSince(start, TERRAIN_SURFACE_KIND.road, …)`, or a
|
|
@@ -159,6 +169,45 @@ Curbs are a step, not a stripe: a 15 cm vertical face drops from the curb's road
|
|
|
159
169
|
asphalt, split finer than the ground grid so it follows the draped ground, and jointed like the curb top.
|
|
160
170
|
Any draped band can have one with `riser` (meters) on its `TerrainLineBand`.
|
|
161
171
|
|
|
172
|
+
Markings follow US practice (MUTCD), with center lines yellow where the sign profile's countries
|
|
173
|
+
use yellow (the Americas and Korea) and white elsewhere. Lines are about 11 cm wide (edge lines
|
|
174
|
+
15 cm), and broken lines are 3 m of paint in every 12 m.
|
|
175
|
+
|
|
176
|
+
- **Center lines:** residential streets have none unless mapped with `lanes`. Multilane roads and
|
|
177
|
+
city arterials get a double solid line. A two-lane country road gets a broken line where passing
|
|
178
|
+
is allowed, and a double line round curves (more than about 11° of turn over 90 m), within 60 m
|
|
179
|
+
of a junction, on bridges, and in passing zones too short to use (under about 120 m). Roads with
|
|
180
|
+
an odd lane count get a two-way left-turn lane down the middle: each edge is solid on the
|
|
181
|
+
outside and broken toward the turn lane.
|
|
182
|
+
- **Lane and edge lines:** white broken lines separate lanes going the same way, turning solid over
|
|
183
|
+
the last 30 m into a signal. Lane counts match the traffic simulation's. Edge lines run along
|
|
184
|
+
freeways and ramps (yellow on a one-way carriageway's left), country roads, and city arterials at
|
|
185
|
+
least 8 m wide.
|
|
186
|
+
- **Junctions:** marked crosswalks (high-visibility bars, laddered with transverse lines at
|
|
187
|
+
signals) cross every arm of a signal. At stop or yield signs they appear only where an arterial
|
|
188
|
+
meets the junction or at a mapped all-way stop. Where two quiet streets meet, the corner stays
|
|
189
|
+
unmarked. Stop lines stand about 1.2 m short of a crosswalk, yield lines are rows of triangles,
|
|
190
|
+
and signal approaches with two or more lanes get lane arrows. Lines run up to the stop line or
|
|
191
|
+
crosswalk, or to the crossing road's edge. A road with the right of way past side streets that
|
|
192
|
+
join from one side only (a tee) keeps its center line across their mouths, and its edge line
|
|
193
|
+
breaks only where each side street meets it. Where a track crosses a road, a crossing panel
|
|
194
|
+
carries the rails across it (see [Railways](#railways)).
|
|
195
|
+
|
|
196
|
+
Sidewalks follow built-up frontage, not every street. Stations every 10 m along a street look for
|
|
197
|
+
buildings within about 70 m (five for an arterial, eight otherwise) or mapped commercial or retail
|
|
198
|
+
land. A sidewalk then runs about 40 m past the last house, bridges gaps under about 120 m, and
|
|
199
|
+
skips stretches shorter than about 80 m. A tile without building footprints reads mapped
|
|
200
|
+
residential land as built up, and a tile with no land data at all keeps sidewalks on every street.
|
|
201
|
+
Where a sidewalk mapped as its own footway runs alongside a street, the inferred one on that side
|
|
202
|
+
is left out (the curb stays). Streetlights, poles, hydrants and mailboxes stand only where there is
|
|
203
|
+
a sidewalk. Living streets have none.
|
|
204
|
+
|
|
205
|
+
Where a road continues into another feature (for example where its tags change at a bridge's
|
|
206
|
+
end), the two lines' ends share a miter (`TerrainLinePath.startJoin` and `endJoin`), so their
|
|
207
|
+
bands meet on one seam instead of leaving a wedge on the outside of the bend. Paint is drawn a few
|
|
208
|
+
centimeters above the asphalt and is marked `walkIgnore`, so walkers and cars do not collide with
|
|
209
|
+
it.
|
|
210
|
+
|
|
162
211
|
Styles with streetlights also furnish their blocks: utility poles every 38 m on one side of each
|
|
163
212
|
street with sidewalks, set back behind the sidewalk with a crossarm and a pair of sagging lines
|
|
164
213
|
between neighbors, and a hydrant at the other curb about every 100 m. Residential streets that
|
|
@@ -199,7 +248,8 @@ await surfaces.setOptions({
|
|
|
199
248
|
Mapped signal junctions and inferred crossings of two substantial arterials can receive curbside masts with bars over the incoming lanes,
|
|
200
249
|
yellow backplates, shaded round lenses, and one signal head per lane (up to three).
|
|
201
250
|
Red, amber and green lenses are self-lit, remaining visible at night. Instanced streetlights
|
|
202
|
-
occupy eligible corners outside road corridors, buildings, and water
|
|
251
|
+
occupy eligible corners outside road corridors, buildings, and water: mast arms where an
|
|
252
|
+
arterial meets the junction, post-top lanterns otherwise (see [night lighting](night-lighting.md)).
|
|
203
253
|
- Freeways receive wider paved shoulders, longer lane dashes, a yellow left edge on one-way
|
|
204
254
|
carriageways, and white ramp edges. Green overhead boards use mapped route references or
|
|
205
255
|
destinations. At a connected outgoing ramp, an advance gantry and roadside exit board use
|
|
@@ -253,9 +303,10 @@ The decoder preserves road `subclass`, `service`, `link` (including Protomaps `i
|
|
|
253
303
|
and explicit `width`. Properties absent from the source use class-based defaults. Tunnel roads are
|
|
254
304
|
excluded from the ground painter; Earth views add separate underground bores as described below.
|
|
255
305
|
Bridges and differing layers do not form surface junctions. Tagged bridges receive inferred
|
|
256
|
-
decks, slabs, barriers and supports
|
|
257
|
-
|
|
258
|
-
|
|
306
|
+
decks, slabs, barriers and supports, at heights that clear whatever they cross (see
|
|
307
|
+
[Road grading](#road-grading)). A deck that reaches its end still raised hands the rest of the
|
|
308
|
+
descent to the roads joined to it there, which climb on retaining walls with a parapet along
|
|
309
|
+
any drop of a meter or more. Curved profiles follow distance along the mapped road. Barriers
|
|
259
310
|
sit outside paved shoulders and open at merges where the adjoining carriageway is at the same
|
|
260
311
|
height; edge paint also clears these openings. Traffic uses the same grading samples.
|
|
261
312
|
Surveyed deck heights and authored bridge connections take precedence. Inferred grades depend
|
|
@@ -310,6 +361,9 @@ this change does not add a full-stop/dwell simulation for the decorative signs.
|
|
|
310
361
|
Ground surfaces render at all available semantic levels. Fine markings and fixtures default to
|
|
311
362
|
the finest pyramid level; `detailLevelsBelowMax` extends them to coarser levels. Fixture/car and
|
|
312
363
|
detail-work budgets bound each tile. A portion of the detail budget is reserved for parking.
|
|
364
|
+
`maxDetailElements` counts the quads drawn for sidewalks, curbs and paint (dash gaps cost
|
|
365
|
+
nothing), and roads are furnished in order of importance: freeways and arterials first, so on a
|
|
366
|
+
tile that runs out the side streets go without, not the main roads.
|
|
313
367
|
Geometry is batched by surface role, broad land-cover meshes share indexed vertices, and fixture/car parts are instanced. Stats cover resident
|
|
314
368
|
surface tiles, including temporarily hidden tiles.
|
|
315
369
|
|
|
@@ -327,6 +381,151 @@ Protomaps deliberately includes a subset of OSM features. Its documented `landus
|
|
|
327
381
|
kinds do not currently include parking, while roads may carry `parking_aisle` detail.
|
|
328
382
|
See the [Protomaps layer reference](https://docs.protomaps.com/basemaps/layers).
|
|
329
383
|
|
|
384
|
+
### Parking garages
|
|
385
|
+
|
|
386
|
+
The same archive identifies multi-storey car parks, though it drops `building=parking` and
|
|
387
|
+
`parking=multi-storey`. A `parking` POI keeps the source id of its OSM element, so a footprint that
|
|
388
|
+
shares its id is one element tagged both `building=*` and `amenity=parking`. Failing that, a POI
|
|
389
|
+
inside exactly one footprint counts if its name claims a structure ("garage", "car park",
|
|
390
|
+
"Parkhaus", "立体駐車場"), since an unnamed one is as likely a tower's basement. Footprints under
|
|
391
|
+
450 m² or over 48 m tall are left alone: small roofed lots, and towers with parking in them.
|
|
392
|
+
|
|
393
|
+
Height gives the number of decks: Protomaps derives a missing height as `3 × levels + 2`, so
|
|
394
|
+
`(height - 2) / 3` recovers `building:levels`. An unmapped height is assumed to be three decks.
|
|
395
|
+
`parking_entrance` POIs within 6 m of the walls place the doors. `applyParkingStructure` then
|
|
396
|
+
requests the `molen.worldgen.use.parking_garage` style and modeled decks, ramps and cars; see
|
|
397
|
+
[Inferred building interiors](building-interiors.md#car-parks). A style pack without that style
|
|
398
|
+
keeps its usual architecture.
|
|
399
|
+
|
|
400
|
+
## Building use
|
|
401
|
+
|
|
402
|
+
Stock Protomaps footprints say only `building`. `kind_detail` is empty on all of them, and in the
|
|
403
|
+
regional archives between 3% and 22% carry a height. So the use of a building is argued from what
|
|
404
|
+
surrounds it, strongest evidence first:
|
|
405
|
+
|
|
406
|
+
1. A POI with the footprint's source id is the same OSM element, so the building is that thing: a
|
|
407
|
+
`hotel`, `school`, `place_of_worship`, `fire_station` and so on.
|
|
408
|
+
2. A POI inside exactly one footprint names it when it is an institution (`hotel`, `hospital`,
|
|
409
|
+
`school`, `mall`, `library`, `museum`). A cinema or a chapel inside a tower does not.
|
|
410
|
+
3. Eight or more shops and restaurants in a footprint of 5,000 m² or more make a mall.
|
|
411
|
+
4. The land use under it: `school`, `university`, `college` and `hospital` land.
|
|
412
|
+
5. Its shape on that land: at 15 m or more on `commercial` land it is offices, at 12 m or more on
|
|
413
|
+
`residential` land it is flats, at 45 m or more a tower, and at 60 m or more on anything but
|
|
414
|
+
residential land a skyscraper.
|
|
415
|
+
|
|
416
|
+
`associateBuildingUses` returns the use and which of these decided it, and `applyBuildingUse` puts
|
|
417
|
+
the use ahead of any tenant in the interior's labels, so a cafe in the lobby does not make the tower
|
|
418
|
+
a cafe. It also requests a matching style from the `molen.worldgen.use.*` family, and a style pack
|
|
419
|
+
without one keeps its usual architecture. Styles in that family are chosen by a building's use, so
|
|
420
|
+
they are not part of the [structure library](structure-library.md).
|
|
421
|
+
|
|
422
|
+
Everything else, most buildings by far, stays with the style rules. Use
|
|
423
|
+
`?synthetic=1&uses=1` in world explorer for a street with one of each.
|
|
424
|
+
|
|
425
|
+
## Road grading
|
|
426
|
+
|
|
427
|
+
A digital elevation model is sampled every ten meters or so and knows nothing of roads, and
|
|
428
|
+
many basemaps keep neither a bridge's height nor the OpenStreetMap `layer` tag that says which
|
|
429
|
+
of two crossing bridges is on top. Draped as mapped, a street tilts with every hillside it runs
|
|
430
|
+
along and ripples with the samples, and every bridge of an interchange stands at one height,
|
|
431
|
+
through the others. Two passes put that right. World explorer and `mountEarthView` run both by
|
|
432
|
+
default; compare with `?roadGrading=0` (neither) or `?earthworks=0` (bridges only).
|
|
433
|
+
|
|
434
|
+
### Leveled ground
|
|
435
|
+
|
|
436
|
+
The ground is graded for roads the way it is for an airfield, before the terrain is meshed, so
|
|
437
|
+
the terrain, everything draped on it and everything that drives on it agree:
|
|
438
|
+
|
|
439
|
+
- **Profile.** A road's height at a point is the elevation averaged 30 m either way along the
|
|
440
|
+
road's own direction, weighted toward the point: bumps shorter than a block go, the hill
|
|
441
|
+
stays. It is read from one elevation level, two below the finest (about the resolution
|
|
442
|
+
elevation is surveyed at), so every tile and every level of detail gets the same answer.
|
|
443
|
+
- **Cross-section.** The road is level from edge to edge at that height: the carriageway with
|
|
444
|
+
its curbs and sidewalks, a freeway with its shoulders, a track with its ballast.
|
|
445
|
+
- **Bench.** A road draped on the ground grid is only as level as the grid vertices around
|
|
446
|
+
it, so the level ground reaches 1.25 grid cells past the road's edge. Beyond that it blends
|
|
447
|
+
back to the surveyed ground over 1.6 cells (at least 8 m). At High detail that is about 16 m
|
|
448
|
+
and 21 m; at Ultra, half as much.
|
|
449
|
+
- **Between roads** the nearest one decides. Two streets on one slope each keep their own
|
|
450
|
+
bench and the block between them takes up the difference, as a graded city block does.
|
|
451
|
+
- Bridges and tunnels are not graded for (the ground under a deck is the river's or the lower
|
|
452
|
+
road's), nor are footpaths, which take the ground as they find it. Mapped water keeps its
|
|
453
|
+
bed beside a road. No point moves more than 12 m.
|
|
454
|
+
|
|
455
|
+
Grading runs for the two finest feature levels, where the rendered grid is no coarser than
|
|
456
|
+
28 m between vertices; coarser tiles are seen from too far to tell. Adjacent tiles agree on
|
|
457
|
+
their shared edge exactly: each reads the roads of the eight tiles around it as well as its
|
|
458
|
+
own.
|
|
459
|
+
|
|
460
|
+
### Clearance
|
|
461
|
+
|
|
462
|
+
Every inferred bridge gets a height profile, and so does every road that has to climb to one:
|
|
463
|
+
|
|
464
|
+
- A deck meets the roads at its ends where they stand and spans straight between them. Over
|
|
465
|
+
ground with nothing mapped beneath it (water, mostly) it rises toward 6 m, 3 m for a
|
|
466
|
+
footbridge, no faster than its class of road climbs.
|
|
467
|
+
- Where it crosses another way without sharing a vertex, it clears that way's surface by a
|
|
468
|
+
clear height plus 1.4 m of girder and slab: **6.5 m over a road** (5.1 m clear, the 16 ft
|
|
469
|
+
9 in of US practice and well over the 14 ft legal minimum), **8.4 m over a railway** (7 m
|
|
470
|
+
clear, for double-stack trains and wires) and **4.4 m over a footpath**. The height holds
|
|
471
|
+
across the lower way's whole width.
|
|
472
|
+
- Two bridges that cross are stacked. The mapped `layer` decides which is on top when the
|
|
473
|
+
source keeps it. Otherwise: the deck whose span already stands 3 m or more above the
|
|
474
|
+
other's (a bridge between two hilltops is over a ramp in the valley); else by what they
|
|
475
|
+
carry (ramps over streets, streets over freeway carriageways and railways); else the one
|
|
476
|
+
farther along its structure from where it lands; else the one running more nearly north
|
|
477
|
+
and south. Only the two structures near the crossing enter into it, so every tile that
|
|
478
|
+
sees the crossing decides alike.
|
|
479
|
+
- A deck falls away from a crossing no faster than its class allows: 5% for a freeway, 7% for
|
|
480
|
+
its ramps, 6 to 8% for streets, 10% for service roads and footpaths, 3% for heavy rail and
|
|
481
|
+
as stairs do for steps. Breaks in grade are rounded over about 20 m.
|
|
482
|
+
- A road climbing to a structure lies on the ground wherever that same structure passes over
|
|
483
|
+
it: an approach never lifts what its own bridge has to clear. Lift passes down the ranks
|
|
484
|
+
only, so a footbridge's steps come down to the street and the street does not rise to the
|
|
485
|
+
footbridge; a footpath beside a climbing road rides on its embankment.
|
|
486
|
+
- Decks side by side (twin carriageways, a sidewalk mapped along a road bridge) stand level
|
|
487
|
+
with each other.
|
|
488
|
+
|
|
489
|
+
A vertex shared by a bridge and a road beneath it is taken for a junction or a mapper's tie,
|
|
490
|
+
never a flyover, and a way's end lying on another way is joined to it even where the tile
|
|
491
|
+
dropped the shared vertex. Surveyed deck heights and authored bridge connections are left
|
|
492
|
+
alone. The stacking order where nothing is mapped is an inference that produces a buildable
|
|
493
|
+
interchange, not a survey of the real one.
|
|
494
|
+
|
|
495
|
+
### Using it
|
|
496
|
+
|
|
497
|
+
`createTerrainPackageSemanticLayers` wires both passes with one option and hands back the
|
|
498
|
+
ground transform for the stream:
|
|
499
|
+
|
|
500
|
+
```ts
|
|
501
|
+
const semantic = await createProfiledTerrainPackageSemanticLayers(pkg, {
|
|
502
|
+
roadGrading: { heights: elevationSource }, // the stream's elevation source
|
|
503
|
+
featuresLayer: { renderer },
|
|
504
|
+
});
|
|
505
|
+
const stream = await createTerrainPackagePyramidStream(pkg, {
|
|
506
|
+
layers: semantic.layers,
|
|
507
|
+
...(semantic.roadGrading
|
|
508
|
+
? { transformHeightfield: semantic.roadGrading.transformHeightfield }
|
|
509
|
+
: {}),
|
|
510
|
+
});
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
Pass `earthworks: false` to keep the ground as surveyed, and `maxSpacing` to change the
|
|
514
|
+
coarsest grid that is leveled. A host with its own transform (an airport's leveling) applies
|
|
515
|
+
the road grading first; `composeEarthGroundGrading(roads, airports)` from
|
|
516
|
+
`@bendyline/molen-earth/client` does that. The pieces are public for custom hosts:
|
|
517
|
+
`createTerrainRoadGrading` and `withTerrainRoadGrading` (client), and the pure
|
|
518
|
+
`gradeRoadEarthworks`, `roadProfileHeight` and `gradeTransportSeparations` (kernel), which need
|
|
519
|
+
neither three.js nor a tile stream.
|
|
520
|
+
|
|
521
|
+
Without the option, each tile's bridges are still graded from that tile alone, with the same
|
|
522
|
+
clearances. A bridge cut by a tile edge then cannot see what it crosses in the next tile and
|
|
523
|
+
assumes a free clearance at the cut.
|
|
524
|
+
|
|
525
|
+
Both passes run on the main thread in slices of about 2 ms, so a tile arriving under a fast
|
|
526
|
+
camera does not hold a frame. A town tile's earthworks take 3 to 10 ms in all; an
|
|
527
|
+
interchange and its surroundings, 15 to 35 ms.
|
|
528
|
+
|
|
330
529
|
## Tunnels
|
|
331
530
|
|
|
332
531
|
World explorer and `mountEarthView` render mapped `tunnel: true` corridors in Human mode.
|
|
@@ -363,6 +562,129 @@ returns a visible bore's floor and ceiling in the root's coordinate frame. Obser
|
|
|
363
562
|
ceiling continue using the surface height. Static hosts can use `createTerrainTunnelObject`
|
|
364
563
|
with complete route lines and a ground sampler that covers both portals.
|
|
365
564
|
|
|
565
|
+
## Railways
|
|
566
|
+
|
|
567
|
+
Railway lines in the transportation layer (a `class`, `subclass` or `service` that names rail,
|
|
568
|
+
tram or train) are drawn as track rather than as roads, by the same surface renderer and worker.
|
|
569
|
+
Everything below is inferred from the map's classes and points and placed by fixed rules, so a
|
|
570
|
+
tile draws the same railway on every load and neighboring tiles agree.
|
|
571
|
+
|
|
572
|
+
- **Track beds.** Each track is a ballast band as wide as its sleepers plus a shoulder each side:
|
|
573
|
+
about 3.6 m on a main line, 3.3 m on a siding and 3 m on yard, spur and crossover tracks. Main
|
|
574
|
+
lines and sidings in the open stand on a prism whose shoulders slope about a meter down to the
|
|
575
|
+
ground wherever no other track runs alongside. Yard ballast is darker and browner, and mapped
|
|
576
|
+
railway land (the `railway` land use of yards and corridors) is ballast grey rather than lawn.
|
|
577
|
+
- **Sleepers and rails in the pavement material.** A track band is `TERRAIN_SURFACE_KIND.track`.
|
|
578
|
+
With the pavement material (see [Pavement material](#pavement-material)) it draws sleepers and a
|
|
579
|
+
pair of rails across the band's middle: concrete sleepers every 0.6 m on main lines and light
|
|
580
|
+
rail, timber every 0.52 m on sidings, yards, spurs, heritage and disused track, and rails at the
|
|
581
|
+
track's gauge with a polished head over a rusty web and foot. Both are box-filtered, so they stay
|
|
582
|
+
antialiased at every distance and settle, as they shrink below a pixel, to the averaged dark
|
|
583
|
+
stripe a track makes in an aerial photograph: a yard reads from the air as many parallel tracks
|
|
584
|
+
on grey ballast. Track is standard gauge unless the style's `railGauge` gives the region's
|
|
585
|
+
main-line gauge (1.067 m for Japan's conventional lines, 1.676 m for India's); light rail,
|
|
586
|
+
trams, subways and lines named as Shinkansen stay standard gauge, and lines mapped as
|
|
587
|
+
`narrow_gauge` are 1 m.
|
|
588
|
+
- **Rails in 3D.** On the finest tiles each rail is also modeled: a 72 mm polished steel head on a
|
|
589
|
+
rusty web 0.17 m deep, its head `TERRAIN_RAIL_HEIGHT` (0.21 m) above the ballast top. Rails run
|
|
590
|
+
on unbroken through level crossings and over bridges and stay out of walking and driving
|
|
591
|
+
collision. They are `TERRAIN_SURFACE_KIND.rail`: the pavement material polishes the heads and
|
|
592
|
+
drops a rail wherever it would be under about a pixel and a half wide, where the track's drawn
|
|
593
|
+
rails beneath it take over, so a yard seen from a plane never sparkles with broken rails. Rails
|
|
594
|
+
and wires also stop drawing for tiles more than 260 m (rails) or 200 m (wires) away, counting
|
|
595
|
+
the camera's height above the ground as well as its distance.
|
|
596
|
+
- **Level crossings.** Where a road crosses tracks on the same layer, neither on a bridge nor in a
|
|
597
|
+
tunnel, a concrete panel level with the rail heads covers the crossing, with short ramps down to
|
|
598
|
+
the road; tracks within 30 m of each other along one road share one crossing. A main line or
|
|
599
|
+
siding crossing a public road gets active warning: a crossbuck (R15-1) with a plate counting the
|
|
600
|
+
tracks (R15-2P) when there is more than one, a pair of flashing lights (dark until a train
|
|
601
|
+
comes), a raised gate arm on roads at least 5 m wide, and an equipment house beside the track.
|
|
602
|
+
Yard, spur and service-road crossings get crossbucks only, and disused track nothing. Each
|
|
603
|
+
approach also gets an advance warning sign 45 to 75 m up the road: the round yellow W10-1 in the
|
|
604
|
+
United States, Canada and Mexico, a red-bordered triangle elsewhere. Signs stand on the side the region's sign profile
|
|
605
|
+
drives on, and a one-way carriageway has a single approach.
|
|
606
|
+
- **Turnouts.** Where a track's end meets another track's side at a shallow angle, where three or
|
|
607
|
+
more track ends meet, and at mapped `switch` points, a turnout gets a powered switch machine on a
|
|
608
|
+
main line or a hand-thrown stand with its target and lamp elsewhere, beside the points and
|
|
609
|
+
opposite the diverging track. Mapped `buffer_stop` and `derail` points get a buffer stop across
|
|
610
|
+
the track's end and a yellow derail on its rail.
|
|
611
|
+
- **Signals.** Mapped `signal` points become color-light signals: a mast with three lenses on main
|
|
612
|
+
lines, a dwarf signal beside yard, siding and tram tracks, and a signal bridge where three or
|
|
613
|
+
more stand abreast over parallel tracks. Map data keeps no direction, so a signal faces the
|
|
614
|
+
trains heading toward the nearest turnout it stands short of, or governs the trains it is mapped
|
|
615
|
+
to the driving side of. Aspects are mostly green, yellow approaching a junction, and the odd red.
|
|
616
|
+
Each lit lens is a self-lit lamp in one instanced draw per tile; `object.userData.railLamps`
|
|
617
|
+
lists them.
|
|
618
|
+
- **Lineside signs.** Whistle posts ("W") stand 400 m ahead of crossings with active warning on
|
|
619
|
+
main lines, unless another crossing comes first. Mileposts stand at mapped `milestone` points
|
|
620
|
+
and, where none is mapped nearby, wherever a main line crosses a north-south line of a world grid
|
|
621
|
+
a mile apart. "YARD LIMIT" boards stand on a main line about 150 m outside each stretch it runs
|
|
622
|
+
beside yard tracks. Like road signs, they need fonts for their lettering.
|
|
623
|
+
- **Overhead catenary.** `railElectrification` on the surface style (or in `details`, which
|
|
624
|
+
overrides it) decides which tracks are wired: `'light'`, the default, wires light rail, trams
|
|
625
|
+
and subways in the open; `'all'` also wires heavy rail, for regions whose main lines are
|
|
626
|
+
electrified (Japan, India, much of Europe, Sydney's suburban network); `'none'` draws no wires.
|
|
627
|
+
Masts stand about every 60 m on heavy rail, 50 m on light rail and 35 m beside trams, at
|
|
628
|
+
stations fixed in the world so wires run on across tile edges, and on the outside of a pair of
|
|
629
|
+
tracks. Each mast's arms carry a messenger wire sagging between masts, droppers every 5.5 m and
|
|
630
|
+
a level contact wire 5.2 to 5.6 m up, staggered from side to side; street trams carry a single
|
|
631
|
+
contact wire. With WebGL, each wire segment also stops drawing beyond 140 m, where it would be
|
|
632
|
+
far thinner than a pixel.
|
|
633
|
+
- **Platforms.** Mapped `platform` land is a raised slab with walls down to the ground: 0.36 m
|
|
634
|
+
beside light rail and trams, 1 m beside subways, 0.4 m beside heavy rail in North America and
|
|
635
|
+
0.9 m elsewhere, and curb height with no track within 40 m. Edges that face a track get a yellow
|
|
636
|
+
tactile strip. Platforms on viaducts are left to the viaduct.
|
|
637
|
+
- **Disused lines** keep their track, with rusted rails, weeds through the ballast and the odd
|
|
638
|
+
missing sleeper, but get no signals, crossing equipment or wires.
|
|
639
|
+
- **Rolling stock in yards.** With `details.railCars` (rail vehicle types: specs with a `rail`
|
|
640
|
+
block), yard, siding and spur tracks hold cuts of coupled cars. Freight cars and the odd idle
|
|
641
|
+
locomotive stand on heavy rail, and light-rail cars stand in light-rail yards. A cut is a unit
|
|
642
|
+
train's cars of one kind and paint, or a mixed manifest in blocks. Cuts keep 32 m clear of each
|
|
643
|
+
turnout's points and 14 m clear of road crossings. Tracks are split into blocks at stations fixed
|
|
644
|
+
in the world, about 75 m apart. That way neighbouring tiles, and the coarser tile one level up
|
|
645
|
+
(yards are filled that far out, for the view from the air), agree on which blocks hold cars and
|
|
646
|
+
what they hold. `railCarOccupancy` scales how full they are (default 1: about three yard blocks
|
|
647
|
+
in four, half of the sidings). The cars are ordinary parked-vehicle placements (`kind`, `spec`,
|
|
648
|
+
`color`, standing on the rail heads), drawn with the parked cars when `parkedCars` is on. Far off
|
|
649
|
+
each stands in as a silhouette of its `spec.rail.profile` (`railVehicleProxyGeometry` in
|
|
650
|
+
`@bendyline/molen-client/vehicles`), and a host makes the near ones entities as it does a
|
|
651
|
+
street's.
|
|
652
|
+
|
|
653
|
+
`railEquipment: false` (on the style or in `details`) keeps the beds and rails and drops the
|
|
654
|
+
equipment: signals, switch stands, crossing signs, lights and gates, lineside signs and catenary.
|
|
655
|
+
The Simple surfaces style turns it off.
|
|
656
|
+
|
|
657
|
+
```ts
|
|
658
|
+
import {
|
|
659
|
+
createTerrainSurfaceRenderer,
|
|
660
|
+
TERRAIN_SURFACE_STYLES,
|
|
661
|
+
} from '@bendyline/molen-terrain/client';
|
|
662
|
+
|
|
663
|
+
// A region whose main lines are electrified and on 1,067 mm gauge.
|
|
664
|
+
const surfaces = createTerrainSurfaceRenderer({
|
|
665
|
+
style: { ...TERRAIN_SURFACE_STYLES.modern, railElectrification: 'all', railGauge: 1.067 },
|
|
666
|
+
});
|
|
667
|
+
// Later: tracks only, no equipment.
|
|
668
|
+
await surfaces.setOptions({ details: { railEquipment: false } });
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
Equipment has budgets of its own, scaled by `maxFixturesPerTile`: 25 boxes per fixture for
|
|
672
|
+
signals, stands, crossing gear and masts, as many again for wire segments, and up to 48 lineside
|
|
673
|
+
signs a tile. Rails in 3D take up to three quarters of `maxDetailElements`, in segments a few
|
|
674
|
+
meters long. Tracks are furnished most important first: main lines, then light rail, sidings,
|
|
675
|
+
trams, yards and spurs, then disused track. `stats()` counts `railTracks`, `railCrossings`,
|
|
676
|
+
`railSwitches` and `railSignals`. `placeTerrainYardCars` is the yard placement on its own.
|
|
677
|
+
`terrainRailTrack(feature, countries)` (a line's mode, service,
|
|
678
|
+
gauge and sleepers) and `TERRAIN_RAIL_HEIGHT` are exported from `@bendyline/molen-terrain/kernel`
|
|
679
|
+
as well, for anything that must run on the rails the renderer draws.
|
|
680
|
+
|
|
681
|
+
The [Protomaps layer reference](https://docs.protomaps.com/basemaps/layers) keeps a railway's
|
|
682
|
+
`kind_detail` (`rail`, `light_rail`, `tram`, `subway`, `disused` and others) and `service`
|
|
683
|
+
(`yard`, `siding`, `spur`, `crossover`), and its points layer keeps railway nodes: `switch`,
|
|
684
|
+
`signal`, `level_crossing`, `railway_crossing`, `buffer_stop`, `derail` and `milestone`. It keeps
|
|
685
|
+
no electrification, voltage, gauge, signal direction or aspect; those are inferred as described
|
|
686
|
+
above, not surveyed.
|
|
687
|
+
|
|
366
688
|
## Lines beyond roads
|
|
367
689
|
|
|
368
690
|
`createTerrainLinearObject(lines, context, profile)` is independent of road semantics. Lines use
|
|
@@ -396,8 +718,8 @@ For a utility corridor, use narrow elevated bands and widely spaced pole repeate
|
|
|
396
718
|
width across the route, height, and length along it. Band `dash: [length, gap]` and `phase` use
|
|
397
719
|
world units along the path; callers can carry phase across tile fragments when their source
|
|
398
720
|
provides route chainage. `terrainLinePath` and `sampleTerrainLine` are exported for custom
|
|
399
|
-
attachment/model placement.
|
|
400
|
-
|
|
721
|
+
attachment/model placement. The surface renderer's [railways](#railways) are built on it, and
|
|
722
|
+
traffic simulation is [ambient life](ambient-life.md).
|
|
401
723
|
|
|
402
724
|
## Road sign fonts
|
|
403
725
|
|
|
@@ -183,8 +183,13 @@ movement trigger coherent grid-snapped rebases for every engine-owned object aut
|
|
|
183
183
|
`terrainStreamBudgetForQuality('economy' | 'balanced' | 'high')` returns portable residency and
|
|
184
184
|
concurrency budgets. `stream.stats()` reports decoded samples, geometry bytes, triangles, draw
|
|
185
185
|
calls, instances, loading/failure counts, and evictions for live quality diagnostics. It walks
|
|
186
|
-
|
|
187
|
-
`stream.loading()` (tiles and layers loading now) and `stream.pressure()` are constant-time.
|
|
186
|
+
the displayed tiles' objects to count them, so call it for diagnostics, not every frame:
|
|
187
|
+
`stream.loading()` (tiles and layers loading now) and `stream.pressure()` are constant-time. On the
|
|
188
|
+
pyramid stream, `stats()` also counts `builtTiles`/`builtLayers` and how many of those repeated an
|
|
189
|
+
earlier build (`rebuiltTiles`/`rebuiltLayers`), which is the cache missing. `stream.viewCoverage`
|
|
190
|
+
reports how finished the view is by distance, a tile count per band of tiles `complete`, drawn from
|
|
191
|
+
another level (`stale`), drawn with layers missing (`bare`) and undrawn (`empty`), and the
|
|
192
|
+
`onLayerTiming` option reports where each layer's build time went.
|
|
188
193
|
|
|
189
194
|
## 4. Screenshot it headlessly
|
|
190
195
|
|
|
@@ -387,8 +392,41 @@ detail (`peripheralDetail`, default 0.4, weighs their error), with hydrology pre
|
|
|
387
392
|
turning the camera reveals ground and mapped water that are already there. Buildings and vegetation
|
|
388
393
|
build once the tile is in view. In-flight surface
|
|
389
394
|
requests finish into a bounded warm cache instead of being restarted on every small camera turn;
|
|
390
|
-
hidden cached tiles are evicted only when capacity is needed
|
|
391
|
-
|
|
395
|
+
hidden cached tiles are evicted only when capacity is needed, farthest first in tile widths from
|
|
396
|
+
the camera rather than least recently used, because a circling camera returns to the ground it saw
|
|
397
|
+
longest ago. A hidden tile leaves the scene graph as well as the draw list, so a large cache costs
|
|
398
|
+
memory and no frame time. Sparse descendants also share a bounded decoded-ancestor cache, avoiding
|
|
399
|
+
repeated PNG decode/resample work while panning.
|
|
400
|
+
|
|
401
|
+
Refinement measures a tile's distance from the ground it holds. Until a tile or an ancestor has
|
|
402
|
+
loaded it can reach anywhere in the package's height range, and a camera inside that range has no
|
|
403
|
+
height above it; `tileHeight` on `selectTerrainPyramidTiles` supplies the same knowledge to your
|
|
404
|
+
own selection.
|
|
405
|
+
|
|
406
|
+
A camera that travels gets its tiles before it arrives. The stream follows the track of the
|
|
407
|
+
positions passed to `update`, as a speed and a turn rate, so an aircraft in a steady turn is
|
|
408
|
+
predicted along its arc. No host wiring is needed, and it works for whatever moves the camera.
|
|
409
|
+
|
|
410
|
+
- Work is ordered for where the camera will be when it finishes, so a fast camera does not spend
|
|
411
|
+
its capacity on the ground beneath it. Ground with no layers on it comes before more detail for
|
|
412
|
+
ground that has some.
|
|
413
|
+
- Tiles the track reaches within `lookAhead.seconds` (default 3, 6, 12 and 20) are built hidden
|
|
414
|
+
from spare capacity, with one layer slot kept free and only while the frame queue has no backlog.
|
|
415
|
+
They appear finished when selected, and are the first thing given up under memory pressure.
|
|
416
|
+
- Levels whose tiles the camera crosses in under `lookAhead.minTileSeconds` (default 5) refine
|
|
417
|
+
only near the camera. Each takes `lookAhead.fastDetail` (default 0.25) of the work of a level
|
|
418
|
+
built across the whole view, so the faster the camera, the nearer its finest detail stops.
|
|
419
|
+
Refining the whole view at speed starts far more tiles than the stream can finish, and it then
|
|
420
|
+
finishes little of any. This limits only what is built: finer ground already built stays as
|
|
421
|
+
long as the view would show it at rest, so speeding up or turning does not take detail off the
|
|
422
|
+
screen. `fastDetail: 0` builds none of those levels. Detail spreads out again when the camera
|
|
423
|
+
slows.
|
|
424
|
+
|
|
425
|
+
`lookAhead: false` turns all of this off. A camera has to hold a track for most of a second before
|
|
426
|
+
any of it applies. A teleport starts the track over, and so does a second without an `update`, so a
|
|
427
|
+
host that updates only while the camera moves still gets full detail when it stops. `stats()` reports `aheadTiles`, `aheadReady`,
|
|
428
|
+
`cameraSpeed` and `speedLevel`, and counts ground in view that changed level: `refinedInView` as
|
|
429
|
+
detail arrives, `coarsenedInView` as it is given up, which reads as popping.
|
|
392
430
|
|
|
393
431
|
With `shadows: true` every tile surface and layer mesh receives sun shadows, and layer meshes
|
|
394
432
|
taller than `shadowCasterHeight` (default 1.5 m: buildings, trees, landmarks) cast them. A layer
|
|
@@ -428,7 +466,9 @@ per-tile feature/point limits for other MVT producers.
|
|
|
428
466
|
trees inside forest polygons, combined terrain-draped road ribbons, combined footprint extrusions,
|
|
429
467
|
flat polygonal water, and draped linear waterways. `createTerrainWaterMaterial` provides an opaque
|
|
430
468
|
physical material with optional world-space animation; call `setTerrainWaterTime` each frame to
|
|
431
|
-
advance its highlights without discontinuities across floating-origin shifts.
|
|
469
|
+
advance its highlights without discontinuities across floating-origin shifts. It folds the origin
|
|
470
|
+
into the ripples in double precision, so water stays sharp at planet-scale coordinates. Ripples a
|
|
471
|
+
pixel cannot resolve fade into a broader highlight instead of shimmering. Opaque coverage
|
|
432
472
|
avoids dark overlap seams while adjacent or parent/child water tiles refine. Expensive semantics
|
|
433
473
|
can be level-bounded, toggled without re-decoding resident objects, and disposed with the elevation
|
|
434
474
|
tile. Applications may replace the decoder, renderer, materials, or model geometry independently.
|
|
@@ -573,6 +613,16 @@ Circa 1910 changes the surface treatment of the present-day map; it does not rec
|
|
|
573
613
|
|
|
574
614
|
See [Surface styles and parameterized line features](surface-rendering.md) for the shared rendering API, parking inference rules, budgets, and rail/utility profile examples.
|
|
575
615
|
|
|
616
|
+
Railways are surfaces too: ballasted track beds whose sleepers and rails the pavement material
|
|
617
|
+
draws (so a yard reads as parallel tracks from the air), rails in 3D close up, level crossings
|
|
618
|
+
with their panels, crossbucks, lights and gates, switch stands, color-light signals at mapped
|
|
619
|
+
signal points, lineside signs, platforms and overhead catenary. Which tracks are wired is the
|
|
620
|
+
surface style's `railElectrification`: `'light'` by default (light rail, trams and open-air
|
|
621
|
+
subways), `'all'` where main lines are electrified too, or `'none'`; `railGauge` sets the main
|
|
622
|
+
lines' gauge where it is not standard. World explorer wires Kyoto, Sydney and New Delhi
|
|
623
|
+
throughout, with Kyoto's lines at 1.067 m and New Delhi's at 1.676 m. See
|
|
624
|
+
[Railways](surface-rendering.md#railways).
|
|
625
|
+
|
|
576
626
|
The explorer plans adaptive streaming at 10 Hz, independently of rendering and movement. Covered
|
|
577
627
|
ancestors that were evicted under memory pressure are not reloaded while finer resident tiles
|
|
578
628
|
supply their coverage; coarse coverage remains warm for camera turns. The HUD reports actual
|
|
@@ -583,6 +633,25 @@ Land-cover draping can run off-thread with `createTerrainLandcoverWorkerBridge(w
|
|
|
583
633
|
bridge through `landcoverGenerator`; the caller disposes it after its tiles are disposed. It
|
|
584
634
|
preserves source height samples, terrain triangle alignment, colors, holes, and material settings.
|
|
585
635
|
|
|
636
|
+
Distant tiles can draw land cover as one texture each instead: pass `landcoverRaster` in the
|
|
637
|
+
semantic mesh options (`TerrainLandcoverRasterOptions`) and a shared
|
|
638
|
+
`createTerrainGroundTextureMaterialAsync({}, renderer.backend)` as `materials.landcoverRaster`
|
|
639
|
+
(`createTerrainGroundTextureMaterial()` is its synchronous WebGL form; keep the material's origin
|
|
640
|
+
current with `setTerrainGroundOrigin`, as for the ground). Tiles at least `minDepth`
|
|
641
|
+
levels coarser than the pyramid's finest (default 2) then paint their classes into a `size`
|
|
642
|
+
texture (default 256 texels across) and draw it on a copy of the tile's own terrain grid, cut by
|
|
643
|
+
shorelines and model openings like the draped mesh. Each class takes the color the draped mesh
|
|
644
|
+
settles to with distance: crop rows and shrub crowns at their mean. The tile's mapped roads and
|
|
645
|
+
building footprints are painted over the classes (`features`, default on), each texel by the
|
|
646
|
+
share of it they cover, so a town past the range of road and building geometry still reads as
|
|
647
|
+
one; `canopy` tints wooded classes on tiles past the range a host places trees in. The draped
|
|
648
|
+
mesh clips every polygon to the terrain grid and carries 88 bytes a vertex for crop rows, class
|
|
649
|
+
blends and ground detail, none of which shows from kilometers away: over Bellevue at Balanced
|
|
650
|
+
detail it was 1.9 of a view's 4.8 million triangles and 208 of its 671 MiB of visible geometry,
|
|
651
|
+
and its slowest layer to build. With the texture on tiles from two levels down, the same view
|
|
652
|
+
draws 2.5 million triangles and holds 276 MiB, and a flight that had filled its 2 GiB cache and
|
|
653
|
+
evicted 79 tiles stayed at 1.2 GiB and evicted none. The worker bridge builds either form.
|
|
654
|
+
|
|
586
655
|
|
|
587
656
|
Runtime quality controllers can call `stream.setBudget(partialBudget)` with measured screen-space
|
|
588
657
|
error, view distance, selected/resident tile ceilings, concurrency, and optional `maxResidentBytes`.
|
|
@@ -89,6 +89,42 @@ mesh; this is the same API used in the browser. Existing baked GLBs must be rege
|
|
|
89
89
|
change their lettering. Seven-segment electronic displays can retain their physical segments;
|
|
90
90
|
fixed captions around those displays should use font geometry.
|
|
91
91
|
|
|
92
|
+
## Glyph atlases
|
|
93
|
+
|
|
94
|
+
Storefront names use a second form of the same faces: a `molen/glyph-atlas@1` document of glyph
|
|
95
|
+
metrics and atlas rectangles, beside raw 8-bit pages of signed distances. A name is then two
|
|
96
|
+
triangles a letter, every sign in the world shares one texture, and a face can be an atlas only:
|
|
97
|
+
the Kyoto pack's Japanese face holds the 1,544 letters Kyoto's place names use, where a vector font
|
|
98
|
+
of them would run to tens of megabytes.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { assembleGlyphAtlasPixels, createGlyphAtlasSet } from '@bendyline/molen-materials/text';
|
|
102
|
+
|
|
103
|
+
const set = createGlyphAtlasSet([latinDoc, kyotoDoc]); // metrics only; a worker can hold this
|
|
104
|
+
set.faceFor('大垣書店'); // 'sign.gothic.jp': the first face that holds every letter
|
|
105
|
+
const layout = set.layout('Samir’s Mediterranean Grill', {
|
|
106
|
+
font: 'serif',
|
|
107
|
+
maxWidth: 6,
|
|
108
|
+
maxHeight: 0.8,
|
|
109
|
+
maxLines: 2,
|
|
110
|
+
});
|
|
111
|
+
// layout.quads: x0, y0, x1, y1, u0, v0, u1, v1 per letter; layout.lines: the line break chosen
|
|
112
|
+
const pixels = await assembleGlyphAtlasPixels(set, (doc, path) => readPage(doc, path));
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`createGlyphAtlasSet` stacks the documents' pages into one texture, so every document in a set
|
|
116
|
+
shares one distance range. A name is set in the first candidate face that holds all of it: the
|
|
117
|
+
requested face or role in each document, then each document's default face. Layout is left to
|
|
118
|
+
right, with kerning, uniform fitting, and a second line where it sets the letters a tenth larger,
|
|
119
|
+
broken at a space or, in Japanese and Chinese, between letters (never before a closing mark or a
|
|
120
|
+
small kana). There is no per-letter fallback across faces and no shaping, so Arabic and Indic
|
|
121
|
+
names keep their category sign until a shaping stage exists.
|
|
122
|
+
|
|
123
|
+
In the engine repository, `node scripts/build-fonts.mjs` rasterizes the Earth atlas from the same
|
|
124
|
+
pinned TTFs as the vector fonts, and each region pack (`content/glyphs-*`) from its own pinned
|
|
125
|
+
font and the character set `scripts/build-glyph-charset.mjs` reads from the region's map extract.
|
|
126
|
+
The distance field is plain arithmetic, byte-identical on every machine; `--check` verifies it.
|
|
127
|
+
|
|
92
128
|
## Compiling another face
|
|
93
129
|
|
|
94
130
|
`compileVectorFont(typefaceJson, { id, characters, weight, style, curveSegments, kerning })`
|
|
@@ -89,6 +89,12 @@ before adding labels and small switches. Record calibration and differences, inc
|
|
|
89
89
|
depths or variant mismatches. If suitable interior references cannot be found, document the
|
|
90
90
|
search and mark the affected geometry as approximate; do not infer approval from exterior QA.
|
|
91
91
|
|
|
92
|
+
Measure each aircraft from the seat as well. `node packages/entities/scripts/cockpit-sweep.mjs
|
|
93
|
+
--ids=<slug>` casts rays from `pilotEye` and reports head clearance, where the seat sits under the
|
|
94
|
+
eye, the view over the nose, and whether the attitude display is in frame. Then look at a seat
|
|
95
|
+
render: world-explorer enters the cockpit 10.3 degrees below level, and Earth view enters level, so
|
|
96
|
+
check the frame the pilot gets. `content/entities/PROPORTION-REVIEW.md` lists each column and limit.
|
|
97
|
+
|
|
92
98
|
Aircraft generators accept `--out /path/to/candidate.glb` for reviewing changes without
|
|
93
99
|
overwriting the master or baseline. Import an approved master with `molen asset import`, update
|
|
94
100
|
the source manifest hash, and run the entity package's `generate` command for aggregate types.
|