@bendyline/molen-tooling 0.0.18 → 0.0.19

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.
@@ -20,8 +20,10 @@ of being mistaken for normal rendering. A second pause within a minute of render
20
20
 
21
21
  Frame times cannot show a level that streams more than it can hold: that work runs outside the
22
22
  frame. A host reports it as `strained` in each sample (the explorer does when half of the
23
- tiles built over ten seconds had been evicted and rebuilt, or when the view fills most of a full
24
- terrain cache). Strain blocks upgrades at once and, sustained for `strainDelayMs` (10 s), lowers
23
+ tiles built over ten seconds had been evicted within the minute before, the terrain stream's
24
+ `thrashedTiles`, or when the view fills most of a full terrain cache). Ground built again
25
+ minutes after it was evicted (`rebuiltTiles` counts it too) is a flight coming back, not strain:
26
+ over a session in one region it becomes nearly every tile built. Strain blocks upgrades at once and, sustained for `strainDelayMs` (10 s), lowers
25
27
  detail with the reason `'streaming'`. `upgradeWorkFraction` (default 0.9) is the share of the
26
28
  target that measured frame work must stay under before a step up.
27
29
  While content streams, slow frames lower detail only when the measured CPU/GPU frame work is itself
@@ -41,13 +43,21 @@ controller's thresholds both ways, Balanced to Medium to Balanced to High in fou
41
43
  step a change of resolution, shadows and terrain detail across the whole view, and a slow takeoff
42
44
  roll left a fast laptop at the lowest tiers for the rest of the flight.
43
45
 
44
- Three things still lower the tier, one step at a time and for good: displayed content over the
45
- memory budget, streaming strain, and frames under 30 a second for ten seconds running, which is a
46
- device the guess was wrong about rather than a busy moment. Slow frames while content loads count
47
- only when frame work itself is heavy, and long stalls never do. Nothing raises the tier: High is a
48
- manual preset (Ultra, whose view alone holds most of the terrain cache, is reached only with
49
- `?tier=5`). Choosing Auto again in the quality menu makes the guess afresh. Manual presets remain
50
- fixed.
46
+ Three things still lower the tier, one step at a time: displayed content over the memory budget,
47
+ streaming strain, and frames under 30 a second for ten seconds running. Slow frames while content
48
+ loads count only when frame work itself is heavy, and long stalls never do. A lowered tier comes
49
+ back one step at a time, never past the guess, once the view has been calm for most of a minute:
50
+ frames at 45 a second or better, frame work within 20 ms, no streaming strain, and displayed
51
+ content within three quarters of the memory budget. A hitch (a frame over 100 ms) costs a couple of
52
+ seconds of that minute rather than restarting it. A tier lost again within three
53
+ minutes of coming back waits twice as long the next time (up to ten minutes), so a device or a
54
+ place that cannot hold it does not flip back and forth. Each lowering used to be for good, and the
55
+ busy moments behind them pass: a ten-minute circle over Seattle lost a tier over downtown and kept
56
+ the lower one at 50 frames a second for the rest of the flight, and a longer session went the same
57
+ way down to Minimum, where a street view shows bare ground with no buildings near and has nothing
58
+ left to load. Nothing raises the tier past the guess: High is a manual preset (Ultra, whose view
59
+ alone holds most of the terrain cache, is reached only with `?tier=5`, which also holds that tier).
60
+ Choosing Auto again in the quality menu makes the guess afresh. Manual presets remain fixed.
51
61
 
52
62
  The explorer applies a tier's resolution, terrain, building, surface and shadow changes over
53
63
  separate frames. The embeddable Earth view keeps its own policy: a default ceiling of Balanced
@@ -237,6 +237,11 @@ frame the engine starts. Every other rotor (helicopter main and tail rotors, and
237
237
  binds as rotors) blurs between 35 and 78 rad/s instead: its blades fade into a faint disc with a
238
238
  slightly darker tip ring, sized from the model, and its hub stays solid.
239
239
 
240
+ Neither casts a sun shadow while it turns fast. A fading propeller's blades leave the shadow
241
+ pass, and so does a rotor above 20 rad/s, hub and all: its blades, grips and pitch links turned
242
+ up to half their spacing between frames, and their hard shadows flashed about the cabin (an
243
+ OH-6's four blades at 50 rad/s, 48 degrees a frame). A slow rotor's shadow turns with it.
244
+
240
245
  For powered lift, declare `spec.poweredLift` with positive `transitTime`, `controlFadeSpeed`,
241
246
  `pitchAuthority`, `rollAuthority`, `yawAuthority` and `damping`, and mark the participating
242
247
  forward-facing engine installations `vectored: true`. `aircraftInput.thrustVector` is 0–1;
@@ -758,14 +763,25 @@ Glass casts no sun shadow: a mesh whose materials all blend at less than full op
758
763
  name contains `canopy` or `bubble`. Three's shadow pass draws a pane as solid, so a windscreen
759
764
  shaded its whole cockpit.
760
765
 
761
- For the aircraft a view follows (flown or watched), hosts also pass `renderer.shadowTexelSize`
762
- to `visual.updateShadows(texel)` each frame, and `undefined` for every other aircraft. Over a
763
- wide view the sun's shadow map coarsens (on High, 0.2 m texels 100 m above the ground, 1.6 m in
764
- cruise at 2,500 ft). It then cannot resolve the aircraft's own canopy frame and seat, and their
765
- shadows on the cockpit jumped from frame to frame as the aircraft crossed the map's texel grid.
766
- Coarser than 0.15 m, the aircraft casts no sun shadow; at 0.12 m or finer it casts again. It
767
- still receives shadows from terrain, buildings and clouds. The Earth view and the world explorer
768
- do this for the mounted aircraft.
766
+ The flown aircraft casts its sun shadow from a map of its own, which travels with it: hosts pass
767
+ `EarthAircraft.shadowSubject` (its model and measured sphere, `undefined` while none is flown) to
768
+ `renderer.setShadowSubject` each frame, as for the driven car. The sun's main map is fixed to the
769
+ ground, and an aircraft crossing it lands on different texels every frame: an OH-6 30 m up is in
770
+ 7 cm texels, and the canopy frame's shade crawled over its panel. Its own map holds it at about
771
+ 13 mm a texel (up to 2048 texels across for a larger aircraft, where the main map has as many),
772
+ and its ground shadow reaches ten times its radius down the light before it fades. See
773
+ [the sky guide](sky.md) for the map itself. WebGL only: `setShadowSubject` returns false on
774
+ WebGPU, and the rule below applies there instead.
775
+
776
+ Without that map, for the aircraft a view follows (flown or watched), hosts pass
777
+ `renderer.shadowTexelSize` to `visual.updateShadows(texel)` each frame, and `undefined` for every
778
+ other aircraft. Over a wide view the sun's shadow map coarsens (on High, 0.2 m texels 100 m above
779
+ the ground, 1.6 m in cruise at 2,500 ft). It then cannot resolve the aircraft's own canopy frame
780
+ and seat, and their shadows on the cockpit jumped from frame to frame as the aircraft crossed the
781
+ map's texel grid. Coarser than 0.15 m, the aircraft casts no sun shadow; at 0.12 m or finer it
782
+ casts again. It still receives shadows from terrain, buildings and clouds. The Earth view and
783
+ the world explorer do this for the mounted aircraft, and pass `undefined` while it has its own
784
+ map.
769
785
 
770
786
  `createAircraftVisual` exposes `cockpit`, a mesh picker and control inventory derived from the
771
787
  interior's authored primary-input bindings and glTF node `extras.aircraftControl` metadata.
@@ -782,6 +798,12 @@ through `flyAircraft`, and mix `AircraftPointerAxes` with their keyboard/gamepad
782
798
  release must clear transient axes. The binder cancels drags on exit, view change, blur and pointer
783
799
  cancellation; it does not write simulation components directly.
784
800
 
801
+ The same inventory drives the [vehicle console](vehicle-console.md)'s touch controls, which copy
802
+ the modeled stick, pedals and levers out of the cockpit and pose them from `AircraftVisual.signals`
803
+ (the readings the cockpit was last posed with). The console works the controls in any view, so the
804
+ Earth view's `EarthAircraft.controlSession()` is the cockpit session without its cockpit-view
805
+ check.
806
+
785
807
  In the engine repository, build the client and kernel, then run a local live review of all 54 bundled aircraft:
786
808
 
787
809
  ```sh
@@ -136,7 +136,7 @@ Two constants live in `packages/kernel/src/version.ts` and they do different job
136
136
 
137
137
  | Constant | Today | Role |
138
138
  |---|---|---|
139
- | `ENGINE_VERSION` | `0.0.12` | metadata. Written into a keyframe's `engine` field so a save says which build wrote it. **Never compared on load, never hashed.** |
139
+ | `ENGINE_VERSION` | `0.0.13` | metadata. Written into a keyframe's `engine` field so a save says which build wrote it. **Never compared on load, never hashed.** |
140
140
  | `STATE_FORMAT` | `1` | the gate. Written into a keyframe under the reserved `plugins.$format` key, compared by `applyKeyframeTo`, and folded into `stateHash` as `stateFormat`. |
141
141
 
142
142
  So a release — even one that moves every package — keeps your keyframes
@@ -126,6 +126,11 @@ so from the air the ground carries tree shadows only around the aircraft: the LO
126
126
  host gets the far map from `earthShadowFocus` (its `far` square) and
127
127
  `renderer.setFarShadowCasters(stream.object)`.
128
128
 
129
+ Also on WebGL, the car being driven and the aircraft being flown cast from a third, small map
130
+ that travels with them (`renderer.setShadowSubject(vehicles.shadowSubject)`, and
131
+ `aircraft.shadowSubject` in flight), so a shadow on the ground and in its own cabin holds still
132
+ at any speed; see the [sky guide](sky.md).
133
+
129
134
  Earth viewers reserve a 4096-pixel sun map before preparing materials. WebGPU retains that
130
135
  allocation across quality changes, so High really uses 4096 pixels even after starting at a
131
136
  lower tier; WebGL can resize it with the tier. A chase camera 10 m above ground covers an
@@ -136,6 +141,12 @@ large airliners and their shadows inside the tighter runway footprint.
136
141
  `touchJoystickContainer` adds an on-screen movement stick while walking, driving or flying. By default it
137
142
  appears only on touch devices; pass `touchJoystick: 'always'` to show it everywhere.
138
143
 
144
+ `console: { container }` adds the [vehicle console](vehicle-console.md) instead: touch controls
145
+ drawn as the vehicle's own, the flown aircraft's stick, rudder pedals, throttle, gear and flap
146
+ handles and dials, or a car's wheel and pedals, in a see-through strip along the bottom. It shows
147
+ on touch devices (`touch: 'always'` everywhere), follows the mode, and is `view.console`. A page
148
+ lays out around it with the `--molen-console-height` CSS property it sets on the container.
149
+
139
150
  ## Modes
140
151
 
141
152
  - **orbit** (default): the map camera from [camera navigation](navigation.md). `flyTo(target)`
@@ -176,11 +187,31 @@ heading for a car, with its gear, engine rev/min, traction or stability control
176
187
  (`assist`) and the grip of the surface under it (`surfaceGrip`); airspeed, altitude and height
177
188
  above ground, vertical speed, attitude, load factor (g), sideslip, power, engine, gear, flaps,
178
189
  fuel remaining, stall buffet, the pilot's `greyout` and `redout` under g, and stall/impact flags
179
- for an aircraft (SI units, compass radians). Both carry the type's `label` and, where the type declares them, its name-free
190
+ for an aircraft (SI units, compass radians). Both carry the type's `label` and entity `type`, and, where the type declares them, its name-free
180
191
  `genericLabel` (`Full-size pickup`) and `bodyStyle`, so a HUD that must not show a real
181
192
  manufacturer or model name has something to show instead. An airplane started in flight is trimmed for level flight at its launch speed.
182
193
  `view.setThrottle(power)` sets an aircraft's throttle or collective from an on-screen lever.
183
194
 
195
+ `view.setInstrumentCanvas(canvas)` draws the flown aircraft's own airspeed and altitude
196
+ instruments into a host canvas, side by side: close-ups of the dials (or a glass cockpit's
197
+ readouts) in its cockpit, with the faces, units, needles and calibration the model has, for a HUD
198
+ beside a chase view. `vehicleStatus().instruments` lists them (`{ kind: 'speed' | 'altitude',
199
+ unit? }`, empty until the model loads or for a cockpit without them); give each a square cell of
200
+ the canvas's width. They draw about 20 times a second while flying, not while the canvas is
201
+ hidden, through a small WebGL context of the canvas's own. `undefined` stops and releases it; the
202
+ canvas cannot draw again, so show them later on a new one. The pieces are in
203
+ `@bendyline/molen-client/aircraft` for hosts with their own aircraft:
204
+ `createAircraftInstrumentViews({ model, spec })` crops the instruments out of a loaded cockpit
205
+ and `createAircraftInstrumentDisplay(canvas)` draws them.
206
+
207
+ ```ts
208
+ const status = view.vehicleStatus();
209
+ if (status?.kind === 'aircraft' && status.view === 'chase' && status.instruments.length > 0) {
210
+ gauges.style.aspectRatio = `${status.instruments.length} / 1`;
211
+ view.setInstrumentCanvas(gauges);
212
+ }
213
+ ```
214
+
184
215
  Listen for `modechange`. The input profile, clip planes and touch stick follow the mode
185
216
  automatically.
186
217
 
@@ -1217,7 +1248,8 @@ does not establish bridge engineering type, navigation clearance, foundations or
1217
1248
  The SR-520 preview replaces the floating section; its approaches use this same fallback.
1218
1249
 
1219
1250
  Mapped tunnels receive separate inferred underground bores and portal cuts that retain the
1220
- terrain above them. Aircraft support queries use the bore floor while underground. Centerlines
1251
+ terrain above them; a way tagged as a tunnel only beneath bridges is drawn as the street under
1252
+ them instead. Aircraft support queries use the bore floor while underground. Centerlines
1221
1253
  alone do not establish surveyed grades, widths or clearances; see [Tunnels](surface-rendering.md#tunnels)
1222
1254
  for the metadata overrides, inference and bounded route stitching.
1223
1255
 
@@ -1353,8 +1385,9 @@ The runway snapshot covers 10,746 airports with complete endpoint and width reco
1353
1385
  aprons, taxiways and hangars are currently bundled for Boeing Field; elsewhere these depend on
1354
1386
  the map's coverage. Building heights and untagged taxiway widths are interpreted. Runways with
1355
1387
  missing endpoints, closed runways and water runways are omitted. Supplemental airports also
1356
- render when the basemap has no tile (Itami lies outside the bundled Kyoto street-detail
1357
- coverage). Seattle's street-detail coverage includes Boeing Field and its surroundings.
1388
+ render when the basemap has no tile, such as an airport outside a package's street-detail
1389
+ coverage. The bundled Seattle and Kyoto street detail include Boeing Field and Osaka Itami and
1390
+ their surroundings; Kyoto's reaches south to central Osaka.
1358
1391
  No airport data is fetched without a supplied pack. Hosts composing their own
1359
1392
  terrain renderer can use `withEarthAirports`
1360
1393
  around semantic renderers and observers, passing `content.airports` from `loadEarthContent`.
@@ -54,5 +54,14 @@ const id = markers.pick(tap.x, tap.y);
54
54
  - **Budget:** `maxVisible` keeps the highest `priority`, then nearest, markers.
55
55
  - `screenPosition(id)` places DOM callouts next to a marker. `projectWorldToScreen(renderer,
56
56
  position)` projects any world point the same way.
57
+ - **Occlusion:** markers hide behind terrain, buildings and vehicles through the GPU's depth test
58
+ (`occlude`, on by default), which a DOM callout cannot see. So as each marker draws for the
59
+ renderer's camera, the layer asks the GPU whether any of it passed (an occlusion query: three's
60
+ own `occlusionTest` on WebGPU, one `ANY_SAMPLES_PASSED` query per marker on WebGL2). Only
61
+ what can be seen counts: an occluding layer discards near-transparent texels, so a pin's blank
62
+ margin or shadow halo peeking over a roof does not keep it "in sight".
63
+ `screenPosition(id).occluded` reports the latest finished answer, a frame or two behind drawing
64
+ and absent until the first one; hide a callout while it is `true`. `pick` passes over an
65
+ occluded marker, leaving the tap to whatever hides it.
57
66
 
58
67
  The layer never fetches anything you did not pass it, and it adds no draw calls when it is empty.
@@ -159,12 +159,21 @@ For movement on phones, add the on-screen stick:
159
159
  import { createTouchJoystick } from '@bendyline/molen-client/navigation';
160
160
 
161
161
  const stick = createTouchJoystick(container, input.map); // bottom-left, style with className
162
- stick.setVisible(matchMedia('(pointer: coarse)').matches);
162
+ // Any coarse pointer: phones, tablets and touchscreen laptops.
163
+ stick.setVisible(matchMedia('(any-pointer: coarse)').matches);
163
164
  ```
164
165
 
165
166
  The stick drives the same `nav-forward`/`nav-back`/`nav-left`/`nav-right` actions through
166
167
  `InputMap.setVirtual`, so a phone moves exactly like a keyboard or gamepad. `TouchStick` is its
167
- DOM-free geometry, if you want to draw your own.
168
+ DOM-free geometry, if you want to draw your own; `appearance: 'none'` leaves the zone invisible
169
+ under a stick you draw.
170
+
171
+ For levers, handles and switches, `createTouchLeverZone` and `createTouchButtonZone` put an
172
+ invisible zone over a rectangle you draw: a lever follows the thumb's travel from where it landed
173
+ (so a touch never makes it jump), optionally springing back or settling on notches, and each zone
174
+ captures its own pointer so two thumbs work two controls at once. `TouchLever` is the lever's
175
+ geometry. The [vehicle console](vehicle-console.md) builds a whole set of them, drawn as the
176
+ vehicle's own controls.
168
177
 
169
178
  ## Streaming alongside the camera
170
179
 
@@ -179,6 +179,7 @@ differences with a known cause:
179
179
  | | WebGL | WebGPU |
180
180
  | --- | --- | --- |
181
181
  | Far sun shadows (`setFarShadowCasters`) | A second, wider shadow map | None: scenery past the focused map stays sunlit |
182
+ | The driven car's or flown aircraft's sun shadow (`setShadowSubject`) | A map of its own that travels with it: the shadow holds its shape | The focused map: the shadow's outline changes as it moves; from a car's driver's seat the car casts none, and an aircraft casts none once the map's texels pass 0.15 m |
182
183
  | Sun shadow filter | PCF | Soft PCF, except at the low shadow quality |
183
184
  | Ambient occlusion | None | `setAmbientOcclusion`, off by default |
184
185
  | Cloud deck haze | Mixed in after tone mapping | Mixed in before it, so distant clouds are brighter |
@@ -106,6 +106,21 @@ that has arrived, so a moving caster would leave its shadow behind. It is at mos
106
106
  across (meters a texel: a house's shadow, not a chimney's) and costs under a millisecond of
107
107
  main thread each time it is drawn. `renderer.farShadowInfo` reports its radius, how often it has
108
108
  been drawn and how long the last drawing took.
109
+ A focused map is fixed to the ground, so a moving object is drawn into different texels every
110
+ frame. Texels of a driving view are 0.14 to 0.56 m, and a car's shadow on the road changed
111
+ outline each frame. On WebGL `renderer.setShadowSubject({ object, center, radius })` gives one
112
+ moving subject (the driven car, the flown aircraft) a third map that travels with it and holds
113
+ nothing else: its shadow keeps its shape on the ground and on itself. The map is 1024 texels
114
+ across the subject's sphere, about 5 mm each around a car and 13 mm around a helicopter; a
115
+ larger subject's grows toward 1.5 cm texels, up to the focused map's size and at most 2048.
116
+ `measureShadowSubject(object)` measures the sphere from the object's meshes; measure once and
117
+ pass the same subject each frame, `undefined` for none. Everything under `object` that casts
118
+ shadows casts into this map instead of the focused one. Its see-through glass lets sunlight
119
+ 1.8 m past a pane (onto a dashboard and seats) and shades beyond that, so the shadow on the
120
+ ground stays whole. The shadow fades out down the light past the subject, from 30 m or ten times
121
+ its radius (whichever is farther) over as far again. The call returns false on WebGPU, where the
122
+ subject goes on casting into the focused map; `renderer.subjectShadowInfo` reports the map's
123
+ radius, texel size and how often it was drawn.
109
124
  `renderer.shadowTexelSize` reports the meters one texel covers as of the last frame (`undefined`
110
125
  while sun shadows are off), for hosts that keep a subject the map cannot resolve out of the
111
126
  shadow pass (see `AircraftVisual.updateShadows` in the aircraft guide and
@@ -250,6 +250,8 @@ await surfaces.setOptions({
250
250
  Red, amber and green lenses are self-lit, remaining visible at night. Instanced streetlights
251
251
  occupy eligible corners outside road corridors, buildings, and water: mast arms where an
252
252
  arterial meets the junction, post-top lanterns otherwise (see [night lighting](night-lighting.md)).
253
+ A junction whose roads are raised on an approach to a bridge gets none of this, nor crossing
254
+ paint: all of it stands on the ground, under the road.
253
255
  - Freeways receive wider paved shoulders, longer lane dashes, a yellow left edge on one-way
254
256
  carriageways, and white ramp edges. Green overhead boards use mapped route references or
255
257
  destinations. At a connected outgoing ramp, an advance gantry and roadside exit board use
@@ -322,7 +324,10 @@ await surfaces.setOptions({
322
324
  - Simple surfaces retain road and parking fills with decoration disabled.
323
325
 
324
326
  The decoder preserves road `subclass`, `service`, `link` (including Protomaps `is_link`), `surface`, `lanes`, `oneway`, `layer`, `bridge`, `tunnel`
325
- and explicit `width`. Properties absent from the source use class-based defaults. Tunnel roads are
327
+ and explicit `width`. Properties absent from the source use class-based defaults. A class's
328
+ default width is that of the whole road, both directions; a ramp (`link`) is drawn 6.6 m wide off
329
+ a freeway and 4.5 m off a street, and a one-way freeway carriageway 11 m, with the shoulders
330
+ outside that. Tunnel roads are
326
331
  excluded from the ground painter; Earth views add separate underground bores as described below.
327
332
  Bridges and differing layers do not form surface junctions. Tagged bridges receive inferred
328
333
  decks, slabs, barriers and supports, at heights that clear whatever they cross (see
@@ -499,17 +504,35 @@ Every inferred bridge gets a height profile, and so does every road that has to
499
504
  other's (a bridge between two hilltops is over a ramp in the valley); else by what they
500
505
  carry (ramps over streets, streets over freeway carriageways and railways); else the one
501
506
  farther along its structure from where it lands; else the one running more nearly north
502
- and south. Only the two structures near the crossing enter into it, so every tile that
503
- sees the crossing decides alike.
507
+ and south. Only the structures near the crossing enter into it, so every tile that
508
+ sees the crossing decides alike. Carriageways side by side are one road to whatever crosses
509
+ them: a ramp's crossings of the two are decided together, so it passes over both or under
510
+ both.
504
511
  - A deck falls away from a crossing no faster than its class allows: 5% for a freeway, 7% for
505
512
  its ramps, 6 to 8% for streets, 10% for service roads and footpaths, 3% for heavy rail and
506
513
  as stairs do for steps. Breaks in grade are rounded over about 20 m.
507
- - A road climbing to a structure lies on the ground wherever that same structure passes over
508
- it: an approach never lifts what its own bridge has to clear. Lift passes down the ranks
509
- only, so a footbridge's steps come down to the street and the street does not rise to the
510
- footbridge; a footpath beside a climbing road rides on its embankment.
511
- - Decks side by side (twin carriageways, a sidewalk mapped along a road bridge) stand level
512
- with each other.
514
+ - A road climbing to a structure fits beneath every deck that passes over it, its own
515
+ bridge's or another's: it stands no higher there than leaves the deck its clearance, and
516
+ comes down to that as steeply as 25% if it must. A deck is never raised to clear a road that
517
+ is itself climbing; where that was done, a viaduct's surface streets rose with the ramps
518
+ that joined them and lifted every deck above. Near where a deck lands on it, though, the
519
+ road can only come down so fast: a deck crossing it there clears the road as high as a 25%
520
+ ramp from the landing leaves it, not the ground. Lift passes down the ranks only, so a
521
+ footbridge's steps come down to the street and the street does not rise to the footbridge;
522
+ a footpath beside a climbing road rides on its embankment.
523
+ - Decks whose paving overlaps are one surface, level throughout: the carriageways of one road
524
+ mapped closer than they are drawn wide, and a ramp for as long as it runs into the road it
525
+ joins. That holds for decks of one kind (two freeway decks, two tracks) or that join within
526
+ 150 m; a railway bridge under a viaduct on the same river crossing is another structure.
527
+ Decks a little apart (a sidewalk mapped along a road bridge) are level as far as 2.5 m goes.
528
+ - Decks joined so near a crossing that neither could stand a story over the other (a
529
+ crossover between two tracks, a ramp across the road it has just left) cross on the level.
530
+ - Some arrangements no heights satisfy: one deck must clear another that is tied to it, by a
531
+ join or by lying abreast, before either has the length to fall a story. Raised in turn,
532
+ such decks only stop at the 30 m limit. They are found as they start, and given another
533
+ arrangement, cheapest first: a crossing decided on little (bearing, or how far each deck
534
+ had come) is turned over; two decks are no longer held level; a crossing decided on what
535
+ the decks carry is turned over; at the last, two decks cross on the level.
513
536
 
514
537
  A vertex shared by a bridge and a road beneath it is taken for a junction or a mapper's tie,
515
538
  never a flyover, and a way's end lying on another way is joined to it even where the tile
@@ -547,9 +570,27 @@ Without the option, each tile's bridges are still graded from that tile alone, w
547
570
  clearances. A bridge cut by a tile edge then cannot see what it crosses in the next tile and
548
571
  assumes a free clearance at the cut.
549
572
 
573
+ ### Tile edges
574
+
575
+ Each tile grades its bridges with what lies within 400 m of it, and an interchange reaches
576
+ farther: one tile reads the ramp that lifts a deck, or the far bank a long bridge lands on, and
577
+ the tile beside it does not. Each alone would draw its half of the deck at its own height. So
578
+ within 300 m of an edge a road takes its height from both tiles' gradings, half and half on
579
+ the edge and wholly its own tile's from 300 m inward (four tiles' at a corner). Both tiles read
580
+ the same two gradings of the same point, so a road is one height where they meet whatever each
581
+ grading made of it, and a mix of profiles that each clear what they cross clears it too. A
582
+ tile's grading is kept for the tiles around it, so this costs about one grading a tile, as
583
+ before, once the first tile of an interchange has asked for its eight neighbors'.
584
+
585
+ A long bridge is still graded by tiles that cannot read both its banks (a tile reads 400 m
586
+ past its own edges), and such a tile takes the end it cannot see to stand a free clearance
587
+ over the ground there. The mix makes the deck continuous, not right: a high bridge between two
588
+ hills sags toward its middle.
589
+
550
590
  Both passes run on the main thread in slices of about 2 ms, so a tile arriving under a fast
551
591
  camera does not hold a frame. A town tile's earthworks take 3 to 10 ms in all; an
552
- interchange and its surroundings, 15 to 35 ms.
592
+ interchange and its surroundings, 10 to 60 ms a tile, and the densest in Seattle 300 ms. A
593
+ grading that no tile still waits for stops.
553
594
 
554
595
  ## Tunnels
555
596
 
@@ -579,6 +620,16 @@ street there and open the ground along its whole length. Tunnel inference runs a
579
620
  feature level and above. Hiding the Human layer also removes its portal cuts and navigation
580
621
  support; the original elevation heightfield always remains available for surface anchoring.
581
622
 
623
+ A way tagged as a tunnel only where it passes beneath bridges is an underpass, not a bore.
624
+ Mappers often tag a street that runs under a railway's bridges this way, and an elevation model
625
+ has no dip for it. Built as a bore, it stood on the ground as a 6.5 m box with the bridges
626
+ through it. `createTerrainPackageSemanticLayers` hands every reader of its road tiles such a way
627
+ as an ordinary one. The road painter draws it, grade separation lifts the bridges over it, and
628
+ traffic shows on it. The rule is `withTerrainUnderpasses` in `@bendyline/molen-terrain/kernel`.
629
+ A way qualifies when bridges cross over it at least every 30 m and within 15 m of each end
630
+ (`TERRAIN_UNDERPASS_REACH`). Lines with a surveyed `tunnelFloorElevation` stay tunnels. So do
631
+ lines the tile does not see whole and lines that continue as a tunnel.
632
+
582
633
  Custom package hosts opt in with `createTerrainPackageSemanticLayers` (or its profiled variant),
583
634
  passing `tunnels: { heights: elevationSource }` alongside their feature renderer. Share the
584
635
  elevation source returned by `openTerrainPackagePyramid` with the terrain stream.
@@ -0,0 +1,158 @@
1
+ # Vehicle console
2
+
3
+ The vehicle console gives phones and tablets on-screen controls drawn as the vehicle's own. Flying
4
+ a P-51, the stick under your left thumb is the P-51's stick, copied out of its cockpit model and
5
+ tilting as you push; its rudder pedals sit beside it, its throttle at the right edge with a gear
6
+ handle and a flap lever beside that, and its own airspeed and altitude dials between. A car shows
7
+ its steering wheel and pedals, a motorcycle its handlebars, a boat its helm. On foot the console is
8
+ the plain two-circle stick with jump and use buttons.
9
+
10
+ Every part is drawn see-through at rest so the view stays clear, and goes solid under a thumb. The
11
+ controls work through the same navigation actions as keys and gamepads, and through the aircraft's
12
+ control session for levers, so a touch flies exactly as a keyboard does.
13
+
14
+ ## Add it to an Earth view
15
+
16
+ Pass `console` to `mountEarthView` with the element around the canvas. It shows on touch devices
17
+ (any pointer that is coarse, which includes touchscreen laptops) and switches with the mode: the
18
+ flown aircraft, the driven vehicle, on foot, and nothing in orbit.
19
+
20
+ ```ts
21
+ import { mountEarthView } from '@bendyline/molen-earth/client';
22
+
23
+ const view = await mountEarthView({
24
+ canvas,
25
+ // ...content, workers
26
+ console: { container: stage }, // `touch: 'always'` shows it on every device
27
+ });
28
+ view.console?.layout; // where everything went
29
+ ```
30
+
31
+ Where the console shows, it takes the place of `touchJoystickContainer`'s plain stick. The flown
32
+ aircraft's dials appear in the chase view only, since the cockpit view has its own; pass
33
+ `gauges: false` to leave them out. `handed: 'left'` mirrors the console, stick on the right.
34
+
35
+ ## Use it with your own renderer
36
+
37
+ `@bendyline/molen-client/console` works with any host that has a `NavigationInputSource` and the
38
+ vehicle's visual. Tell it what the viewer is in with `setSubject`, and call `update` once per frame
39
+ after the frame renders (the dials copy the cockpit's posed meshes):
40
+
41
+ ```ts
42
+ import { createVehicleConsole } from '@bendyline/molen-client/console';
43
+
44
+ const vehicleConsole = createVehicleConsole(stage, { input: input.map, focusTarget: canvas });
45
+ vehicleConsole.setSubject({
46
+ kind: 'aircraft',
47
+ visual, // from createAircraftVisual, posed by you each frame
48
+ spec,
49
+ session: () => cockpitSession(), // the pilot's controls: change({ control, value })
50
+ gauges: view === 'chase',
51
+ });
52
+
53
+ function frame(now: number) {
54
+ // ...simulate, pose the visual, render
55
+ vehicleConsole.update(now);
56
+ }
57
+ ```
58
+
59
+ The subject is an aircraft (`visual`, `spec`, a `session` that applies `applyAircraftControl`), a
60
+ vehicle (`visual` from `createVehicleVisual` and the vehicle's or boat's data), `{ kind: 'walk' }`
61
+ or `{ kind: 'free' }` (a free camera with up and down buttons), or `undefined` to hide it. Calling
62
+ `setSubject` every frame is cheap: the same vehicle keeps its parts.
63
+
64
+ ## What each vehicle shows
65
+
66
+ Each control is drawn from the best source the vehicle has:
67
+
68
+ 1. **Its own part.** The console copies the control out of the model (`AircraftVisual.cockpit`
69
+ lists an aircraft's modeled controls), shares its geometry and materials, and moves the copy
70
+ with the same bindings and readings as the cockpit (`AircraftVisual.signals`,
71
+ `VehicleVisual.signals`). Where a cockpit has two seats, the controls nearest the pilot's eye
72
+ are used.
73
+ 2. **A kit part.** Where the model has no part of its own, or only a placeholder from the bolted-on
74
+ control module, the console draws a generic one: a gear handle with a wheel for a knob and
75
+ gear lamps, a flap lever with a wing-shaped knob and notches, a throttle lever, an engine
76
+ switch, a parking brake, car pedals and a handbrake.
77
+ 3. **The plain stick and buttons.** On foot, on boards and skis, and for anything without a lever.
78
+
79
+ | Vehicle | Left | Right | Middle |
80
+ | --- | --- | --- | --- |
81
+ | Airplane | stick or yoke, rudder pedals | throttle, gear, flaps, engine, brakes, parking brake; mixture, propeller, speed brake and nozzle behind the drawer on a phone | airspeed and altitude dials in a chase view |
82
+ | Helicopter | cyclic, pedals | collective, engine | dials in a chase view |
83
+ | Car | steering wheel, pedals | handbrake | |
84
+ | Motorcycle, bicycle, snowmobile | handlebars | brake | |
85
+ | Boat | helm | anchor | |
86
+ | On foot | plain stick | jump, use | |
87
+
88
+ Mounted, two buttons at the top corner change the view and leave the vehicle.
89
+
90
+ ## Controls
91
+
92
+ - **Stick, wheel and handlebars** are the touch stick (`createTouchJoystick`, drawn invisible
93
+ under the vehicle's part): `nav-forward`, `nav-back`, `nav-left`, `nav-right`.
94
+ - **Levers** follow the thumb's travel from where it landed, so touching one never makes it jump.
95
+ The throttle stays where it is left, and moves every engine's lever together.
96
+ - **The gear handle** is a throw: drag it past halfway. On the ground the aircraft refuses it, and
97
+ the handle shakes.
98
+ - **Flaps** settle on up, half and full.
99
+ - **Rudder pedals** slide sideways and center when the thumb lifts (`nav-yaw-left`,
100
+ `nav-yaw-right`).
101
+ - **Switches** (engine, parking brake) toggle on a tap. **Brakes**, the car's pedals, the
102
+ handbrake and the anchor work while held (`nav-jump`, `nav-sprint`).
103
+
104
+ Each control captures its own pointer, so the stick and the throttle work at the same time. The
105
+ zones refocus the canvas when touched, so keys keep working on a device with both.
106
+
107
+ ## Layout
108
+
109
+ The console fills its container and passes touches through between controls. It places controls
110
+ by importance:
111
+
112
+ - **The bottom row.** The stick goes in the bottom-left corner (its touch box keeps the plain
113
+ stick's size and place, 144 pixels at 24 pixels in), and the throttle goes at the right edge,
114
+ with the handles in from it.
115
+ - **The dials** go between, when they fit.
116
+ - **A landscape phone** keeps one row. What does not fit waits behind a "more controls" button at
117
+ the top.
118
+ - **A portrait phone or a tablet** (shorter side 600 pixels or more, parts a quarter larger) takes
119
+ a second row.
120
+
121
+ It publishes the room it takes as CSS custom properties on the container, so a page can lay out
122
+ around it:
123
+
124
+ | Property | Meaning |
125
+ | --- | --- |
126
+ | `--molen-console-height` | height of the strip from the bottom edge |
127
+ | `--molen-console-left`, `--molen-console-right` | width it takes along the bottom from each side |
128
+ | `--molen-console-buttons` | width of the button cluster in the top corner |
129
+
130
+ ```css
131
+ #help { bottom: calc(26px + var(--molen-console-height, 0px)); }
132
+ ```
133
+
134
+ To keep clear of a phone's notch and home indicator, set `--molen-console-inset-left`, `-right`,
135
+ `-top` and `-bottom` on the container, for example to `env(safe-area-inset-left)`.
136
+
137
+ ## Drawing and cost
138
+
139
+ All parts draw into one transparent canvas along the bottom edge through one small WebGL context of
140
+ its own, not the main renderer. It draws only when something moved, faded or changed size, and
141
+ the dials at most 20 times a second; a console nobody touches costs no draws. Each part is a small
142
+ scene with its own camera: the throttle, handles and switches face you head-on from the
143
+ operator's seat, a little from above so a lever's travel shows (the kit's panels slope back to
144
+ face you square, the gear knob a wheel and the flap knob a wing toward you); the stick from the
145
+ seat behind it; pedals from the seat, low enough that their pads face you. A thin dark outline keeps parts readable over bright sky and
146
+ snow. `prefers-reduced-motion` turns off the fades.
147
+
148
+ Without WebGL the controls still work, drawn as labelled outlines, with the two-circle stick.
149
+
150
+ ## Gotchas
151
+
152
+ - Call `update` after the frame renders: the dials copy world matrices the render poses.
153
+ - A copied part starts from the pose its bindings move it from, recorded when the visual was
154
+ created, so it is right even if the live part has moved since.
155
+ - A stick, yoke or pair of pedals always moves the way the thumb does: forward for nose down,
156
+ the right pedal forward for right rudder. The console measures each copy against the
157
+ convention in the [vehicle interiors guide](vehicle-interiors.md) and reverses a channel a model
158
+ binds the other way, so the console can move where a model's own cockpit does not.
@@ -605,7 +605,15 @@ and `dispose()`. `signals` feeds the interior and `vehicle.visual.animation` bin
605
605
  them keep the wheels planted. The camera helper accepts a transform, `vehicle.spec`, view, look offsets, and an
606
606
  optional obstruction-distance callback.
607
607
 
608
- While the view is from a vehicle's own seat (the cockpit view), hosts pass
608
+ The driven vehicle casts its sun shadow from a map of its own, which travels with it: hosts pass
609
+ `EarthVehicles.shadowSubject` (the mounted vehicle's model and its measured sphere, `undefined`
610
+ on foot) to `renderer.setShadowSubject` each frame. The sun's main map is fixed to the ground, and
611
+ a car at speed lands on different texels of it every frame, so its shadow on the road changed
612
+ shape as it drove; from its own map the shadow holds still, in the chase view and in the cabin.
613
+ See [the sky guide](sky.md) for the map itself. WebGL only: `setShadowSubject` returns false on
614
+ WebGPU, and the rule below applies there instead.
615
+
616
+ Without that map, while the view is from a vehicle's own seat (the cockpit view), hosts pass
609
617
  `renderer.shadowTexelSize` to that vehicle's `visual.updateShadows(texel)` each frame, and
610
618
  `undefined` for every other vehicle and view. From the seat the dashboard is under a meter away,
611
619
  and the vehicle's roof, pillars and doors shaded it in blocks that jumped as it drove across the
@@ -613,7 +621,7 @@ sun shadow map's texel grid (a driving view's map spans hundreds of meters, 0.14
613
621
  High). Coarser than 0.027 m, the vehicle casts no sun shadow; at 0.025 m or finer it casts
614
622
  again. It still receives shadows from terrain, buildings, trees, other vehicles and clouds.
615
623
  `EarthVehicles` does this for the mounted vehicle from its `shadowTexel` field, which the Earth
616
- view and the world explorer set each frame.
624
+ view and the world explorer set each frame (to `undefined` while the vehicle has its own map).
617
625
 
618
626
  Surface objects expose `userData.vehicles: VehiclePlacement[]`; each record has an `id`, external
619
627
  type `kind`, `color`, resolved `spec`, absolute metric `position`, and `yaw`, with optional
@@ -4,7 +4,7 @@
4
4
  > three.js rendering client, authored through JSON schemas, a small typed API, and a headless
5
5
  > dev loop. This bundle is version-locked to the engine release.
6
6
 
7
- Engine version: 0.0.12. three.js peer range: >=0.184.0 <0.187.0 (developed against 0.184.0). Node ≥ 22.13, ESM only.
7
+ Engine version: 0.0.13. three.js peer range: >=0.184.0 <0.187.0 (developed against 0.184.0). Node ≥ 22.13, ESM only.
8
8
 
9
9
  ## Start here
10
10
 
@@ -33,6 +33,7 @@ downloads them into a project and pins them in project.json.
33
33
  - [Browser mount](guide/browser-mount.md): `buildWorld` in a Worker + `await mountExperience` on the page; events and state for HUDs.
34
34
  - [Input profiles and joysticks](guide/input.md): keyboard/controller remapping, raw axes, walking/driving/flying profiles, analog commands, and optional React controls.
35
35
  - [Camera navigation](guide/navigation.md): orbit, fly, walk (capsule collision against streamed geometry) and follow cameras for `createViewer` hosts; one input model across keys, gamepad, pointer gestures and an on-screen touch stick.
36
+ - [Vehicle console](guide/vehicle-console.md): touch controls drawn as the vehicle's own (the P-51's stick, rudder pedals and throttle, kit gear and flap handles, the aircraft's dials; a car's wheel and pedals) in one see-through strip; `createVehicleConsole` and the Earth view's `console` option, subjects, layout and the CSS properties to lay out around it.
36
37
  - [World markers](guide/markers.md): screen-sized photo pins and labels pinned to world positions, ground-snapped, occluded, faded, budgeted and pickable.
37
38
  - [Earth view](guide/earth-view.md): `mountEarthView` from `@bendyline/molen-earth` — real-world terrain, buildings, landmarks, orbit/walk/drive/fly (cars on the nearest road, airborne P-51 or OH-6), a `vehicleStatus()` HUD feed, decluttered lat/lon markers, credits and adaptive quality in one call; `overrides` replace a rectangle of the mapped world (a landmark, a block) with the host's own buildings, models, props, people, vehicles and scene, at mount or while the view runs.
38
39
  - [WebGPU and WebGL](guide/rendering-backends.md): the `backend` option ('auto' | 'webgl' | 'webgpu') on the asynchronous client factories, legacy WebGL fallback, compatible materials, and world-explorer comparisons.