@bendyline/molen-tooling 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE.md +15 -0
- package/README.md +91 -0
- package/dist/capture/THIRD-PARTY-NOTICES.md +223 -0
- package/dist/capture/basis/LICENSE.txt +55 -0
- package/dist/capture/basis/basis_transcoder.js +19 -0
- package/dist/capture/basis/basis_transcoder.wasm +0 -0
- package/dist/capture/capture.html +15 -0
- package/dist/capture/harness.js +4671 -0
- package/dist/capture/worldgen-preview.html +15 -0
- package/dist/capture/worldgen-preview.js +4617 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +1276 -0
- package/dist/docs-src/guide/3d-art-guidelines.md +157 -0
- package/dist/docs-src/guide/3d-model-assets.md +286 -0
- package/dist/docs-src/guide/adaptive-performance.md +89 -0
- package/dist/docs-src/guide/agent-loop.md +156 -0
- package/dist/docs-src/guide/aircraft.md +225 -0
- package/dist/docs-src/guide/browser-mount.md +185 -0
- package/dist/docs-src/guide/building-interiors.md +175 -0
- package/dist/docs-src/guide/capability-authoring.md +69 -0
- package/dist/docs-src/guide/determinism.md +285 -0
- package/dist/docs-src/guide/entities.md +47 -0
- package/dist/docs-src/guide/examples.md +58 -0
- package/dist/docs-src/guide/experience-playback.md +57 -0
- package/dist/docs-src/guide/figures.md +164 -0
- package/dist/docs-src/guide/game-samples.md +100 -0
- package/dist/docs-src/guide/graphics-performance.md +167 -0
- package/dist/docs-src/guide/input.md +205 -0
- package/dist/docs-src/guide/materials.md +125 -0
- package/dist/docs-src/guide/project.md +157 -0
- package/dist/docs-src/guide/quickstart.md +63 -0
- package/dist/docs-src/guide/recognizable-places.md +158 -0
- package/dist/docs-src/guide/rendering-backends.md +231 -0
- package/dist/docs-src/guide/scripting.md +330 -0
- package/dist/docs-src/guide/sky.md +192 -0
- package/dist/docs-src/guide/source-bundles.md +42 -0
- package/dist/docs-src/guide/structure-library.md +114 -0
- package/dist/docs-src/guide/surface-rendering.md +203 -0
- package/dist/docs-src/guide/terrain.md +389 -0
- package/dist/docs-src/guide/three-surface.md +70 -0
- package/dist/docs-src/guide/vehicle-interiors.md +126 -0
- package/dist/docs-src/guide/vehicles.md +110 -0
- package/dist/docs-src/guide/weather.md +123 -0
- package/dist/docs-src/guide/worldgen.md +434 -0
- package/dist/docs-src/llms.txt +129 -0
- package/dist/docs-src/schemas/README.md +36 -0
- package/dist/docs-src/schemas/archstyle.md +2340 -0
- package/dist/docs-src/schemas/assert.md +169 -0
- package/dist/docs-src/schemas/asset.md +543 -0
- package/dist/docs-src/schemas/business-catalog.md +162 -0
- package/dist/docs-src/schemas/cameratrack.md +132 -0
- package/dist/docs-src/schemas/command.md +112 -0
- package/dist/docs-src/schemas/components.md +5826 -0
- package/dist/docs-src/schemas/delta.md +204 -0
- package/dist/docs-src/schemas/experience-play.md +452 -0
- package/dist/docs-src/schemas/figure.md +290 -0
- package/dist/docs-src/schemas/interior-catalog.md +230 -0
- package/dist/docs-src/schemas/keyframe.md +314 -0
- package/dist/docs-src/schemas/landmark-catalog.md +56 -0
- package/dist/docs-src/schemas/landmark.md +293 -0
- package/dist/docs-src/schemas/matgraph.md +1163 -0
- package/dist/docs-src/schemas/pack-index.md +82 -0
- package/dist/docs-src/schemas/pack-source.md +139 -0
- package/dist/docs-src/schemas/pack.md +225 -0
- package/dist/docs-src/schemas/pixelgrid.md +108 -0
- package/dist/docs-src/schemas/prefab.md +106 -0
- package/dist/docs-src/schemas/project.md +271 -0
- package/dist/docs-src/schemas/region-atlas.md +612 -0
- package/dist/docs-src/schemas/replay.md +807 -0
- package/dist/docs-src/schemas/scatter.md +541 -0
- package/dist/docs-src/schemas/scene.md +1152 -0
- package/dist/docs-src/schemas/source-bundle.md +266 -0
- package/dist/docs-src/schemas/stylepack.md +420 -0
- package/dist/docs-src/schemas/terrain-package.md +731 -0
- package/dist/docs-src/schemas/terrain.md +313 -0
- package/dist/docs-src/schemas/types.md +218 -0
- package/dist/docs-src/schemas/uvpaint.md +149 -0
- package/dist/docs-src/schemas/worldgen-batch.md +743 -0
- package/dist/index.d.mts +1271 -0
- package/dist/index.mjs +78 -0
- package/dist/mcp-BFnCWrg0.mjs +796 -0
- package/dist/ops-BGxhSP6w.mjs +7246 -0
- package/package.json +96 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
# Terrain flyover
|
|
2
|
+
|
|
3
|
+
Streamed, LOD'd, procedurally-shaded terrain from a JSON descriptor + PNG16 height tiles. No image
|
|
4
|
+
assets ship with the engine — examples generate their own heightmaps from a seed. A single whole-map
|
|
5
|
+
heightmap remains available for small scenes and deterministic captures.
|
|
6
|
+
|
|
7
|
+
## 1. Describe the terrain (`molen/terrain@2`)
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"format": "molen/terrain@2",
|
|
12
|
+
"name": "island",
|
|
13
|
+
"chunkSize": 128,
|
|
14
|
+
"tileResolution": 129,
|
|
15
|
+
"gridSize": [4, 4],
|
|
16
|
+
"height": { "min": 0, "max": 120 },
|
|
17
|
+
"tiles": { "heightUrl": "tiles/h_{x}_{z}.png" },
|
|
18
|
+
"layers": [
|
|
19
|
+
{ "name": "grass" },
|
|
20
|
+
{ "name": "rock", "auto": { "slopeMin": 0.45 } },
|
|
21
|
+
{ "name": "snow", "auto": { "heightMin": 85 } }
|
|
22
|
+
],
|
|
23
|
+
"lod": { "levels": 4, "distanceBands": [200, 400, 800, 1600], "skirts": true },
|
|
24
|
+
"streaming": {
|
|
25
|
+
"loadRadius": 3,
|
|
26
|
+
"unloadRadius": 4,
|
|
27
|
+
"maxConcurrentLoads": 4,
|
|
28
|
+
"maxResidentTiles": 96
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Validate it: `molen validate island.terrain.json`.
|
|
34
|
+
|
|
35
|
+
Version 1 descriptors still validate and auto-upgrade with a deprecation notice; rewrite the
|
|
36
|
+
file as `molen/terrain@2` to silence it.
|
|
37
|
+
|
|
38
|
+
- **Layers** paint the terrain by height/slope auto-banding: a layer with no `auto` is the base;
|
|
39
|
+
layers with `auto` blend in where their height/slope window matches. Each layer has a
|
|
40
|
+
representative `color` (or a sensible default by name: grass, rock, snow, dirt, sand, water).
|
|
41
|
+
- **LOD** picks a coarser mesh for far chunks (`distanceBands`), and **skirts** hide the seams
|
|
42
|
+
between LODs.
|
|
43
|
+
- **Streaming** prioritizes nearby chunks, bounds concurrent requests and resident meshes, and uses
|
|
44
|
+
separate load/unload radii so a camera near a boundary does not churn tiles.
|
|
45
|
+
|
|
46
|
+
## 2. Terrain as a game service (kernel side)
|
|
47
|
+
|
|
48
|
+
`@bendyline/molen-terrain/kernel` decodes 16-bit-grayscale heightmaps and exposes bilinear
|
|
49
|
+
`sampleHeight(x, z)`, `normalAt(x, z)`, and `slopeAt(x, z)`. The same PNG decodes identically in
|
|
50
|
+
Node, a Worker, and the browser. Use `heightfieldFromPng` for one whole-map PNG or
|
|
51
|
+
`heightfieldTileFromPng` for a descriptor tile.
|
|
52
|
+
|
|
53
|
+
A scene makes its terrain part of the simulation by referencing it:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"terrain": { "descriptor": "island.terrain.json", "heightmap": "height.png" },
|
|
58
|
+
"physics": { "engine": "kinematics", "ground": "terrain", "character": true }
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`molen sim run` / `shot` / `drive` decode the heightmap in Node and register it as the world's
|
|
63
|
+
ground field (`installTerrain` on `@bendyline/molen-kernel/terrain`), so:
|
|
64
|
+
|
|
65
|
+
- the **character controller** (`physics.character: true`; `character` + `moveIntent`
|
|
66
|
+
components) lands on and walks over the surface;
|
|
67
|
+
- **kinematic bodies** (`physics.ground: "terrain"`) integrate `vel[1]` and rest on it;
|
|
68
|
+
- a **rapier** scene can collide with it: `collider3d: { shape: { type: "heightfield", ref: "scene" } }`;
|
|
69
|
+
- **scripts** query it: `molen.terrain.heightAt(x, z)`, `normalAt`, `slopeAt`, and
|
|
70
|
+
`raycast(origin, dir, maxDist)` (a ray-march against the surface);
|
|
71
|
+
- captures render the same heightmap under the entities.
|
|
72
|
+
|
|
73
|
+
`raycast` is sampled: it marches in fixed steps (`installTerrain`'s `rayStep`, default half the
|
|
74
|
+
field's cell size), then bisects the first above-to-below crossing, including a final partial step
|
|
75
|
+
and rays shorter than one step. The hit lies on the ray at the reported distance, and an origin
|
|
76
|
+
already below the surface hits at distance 0. Invalid input, or a ray that needs more than
|
|
77
|
+
`maxRaySteps` (default 4096) steps, throws instead of reporting a false miss. Choose a step
|
|
78
|
+
suited to the terrain's feature size.
|
|
79
|
+
|
|
80
|
+
In your own host, `buildWorld(manifest, setup, { terrain: (world) => ({ terrain:
|
|
81
|
+
terrainScriptApi(installTerrain(world, heightfield)) }) })` does the same. The kernel's
|
|
82
|
+
`GroundField` contract is structural (`sampleHeight` + `normalAt`), so any height source can be
|
|
83
|
+
the ground. Scenes whose heightmap is generated at runtime (no `heightmap` file) get no ground
|
|
84
|
+
service — write the PNG once and reference it.
|
|
85
|
+
|
|
86
|
+
### Projected Earth is metric
|
|
87
|
+
|
|
88
|
+
Earth packages use Web Mercator, which inflates horizontal distance by 1/cos(latitude)
|
|
89
|
+
(≈1.48× at 47.6°N) while heights stay in meters. The package adapters pre-multiply the whole
|
|
90
|
+
projected frame by `metersPerUnit = cos(center latitude)` (recorded on the descriptor), so tiles,
|
|
91
|
+
meshes, semantic densities, character speeds, and entity XZ are all in ground meters. Convert
|
|
92
|
+
between world and projected space with `projectedToWorld` / `worldToProjected`; `webMercatorToWgs84`
|
|
93
|
+
takes projected coordinates (divide world XZ by `metersPerUnit` first).
|
|
94
|
+
|
|
95
|
+
## 3. Render it (client side)
|
|
96
|
+
|
|
97
|
+
For a small, already-decoded map, `createTerrainObject(heightfield, descriptor, { cameraPos })`
|
|
98
|
+
builds one three.js group of vertex-colored chunk meshes.
|
|
99
|
+
|
|
100
|
+
For runtime streaming, pass a provider to `createTerrainStream`:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { createViewer } from '@bendyline/molen-client';
|
|
104
|
+
import {
|
|
105
|
+
createTerrainStream,
|
|
106
|
+
createUrlTerrainTileSource,
|
|
107
|
+
} from '@bendyline/molen-terrain/client';
|
|
108
|
+
|
|
109
|
+
const viewer = await createViewer({
|
|
110
|
+
canvas,
|
|
111
|
+
cameraFar: 100_000,
|
|
112
|
+
reverseDepthBuffer: true,
|
|
113
|
+
autoWorldOrigin: { threshold: 2_000, gridSize: 500 },
|
|
114
|
+
});
|
|
115
|
+
const source = createUrlTerrainTileSource(descriptor, { baseUrl: document.baseURI });
|
|
116
|
+
const terrain = createTerrainStream(descriptor, source, { cameraPos: [0, 100, 0] });
|
|
117
|
+
viewer.renderer.worldRoot.add(terrain.object);
|
|
118
|
+
|
|
119
|
+
function frame(cameraPosition: [number, number, number]) {
|
|
120
|
+
terrain.update(cameraPosition);
|
|
121
|
+
viewer.setCamera({ position: cameraPosition, lookAt: [0, 0, 0] });
|
|
122
|
+
viewer.renderFrame();
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The source interface returns decoded height tiles, so archive readers, procedural worlds, and tests
|
|
127
|
+
do not change residency behavior. HTTP 404 is a stable missing tile; call `retryFailed()` only after
|
|
128
|
+
the backing data has changed. A *thrown* error is not: a dropped range request, a 503, or a CORS
|
|
129
|
+
failure is retried with bounded exponential backoff (`maxRetries`, `retryDelayMs`,
|
|
130
|
+
`maxRetryDelayMs`) before the tile is abandoned, and every request carries a `requestTimeoutMs`
|
|
131
|
+
deadline so a stalled connection cannot hold a concurrent load slot. `stats()` counts `missing` and
|
|
132
|
+
`retrying` separately from `failed`, and `tileFailures()` reports each tile's state, attempts, and
|
|
133
|
+
next attempt time, so a host can tell a user "still retrying" rather than "gave up".
|
|
134
|
+
|
|
135
|
+
The pyramid streamer applies the same retry policy to semantic layer generation and GPU
|
|
136
|
+
preparation, with a separate `layerTimeoutMs` deadline (120000 ms by default; 0 or Infinity disables
|
|
137
|
+
it). This allows CPU-heavy generation and software shader compilation more time than height
|
|
138
|
+
requests. A stalled layer releases its load slot, and late cancelled results are disposed.
|
|
139
|
+
`stats().retryingLayers` and `stats().failedLayers` report those failures independently from height
|
|
140
|
+
tiles; `retryFailed()` retries both. Disabling a layer or evicting its tile clears its failure state.
|
|
141
|
+
|
|
142
|
+
Adjacent tiles share their border heights, and the streamer keeps their border *normals* continuous
|
|
143
|
+
too: each side recomputes its edge from the neighbouring tile's heights once that neighbour is
|
|
144
|
+
resident, so there is no lighting seam along tile edges.
|
|
145
|
+
|
|
146
|
+
### Classification, hydrology, and human-feature layers
|
|
147
|
+
|
|
148
|
+
`TerrainTileLayer` creates an optional tile-local three.js object after a height tile becomes
|
|
149
|
+
resident. Categories are `classification`, `hydrology`, and `human-feature`; use
|
|
150
|
+
`setLayerVisible(id, visible)` to compose application modes while keeping always-on natural water
|
|
151
|
+
independent from optional roads and buildings. Layer objects are evicted with their height
|
|
152
|
+
tile, and a layer can provide `disposeTile` for owned GPU resources. Vector schema parsing and model
|
|
153
|
+
selection belong in layer adapters, not the streamer. The shipped styled-building adapter is
|
|
154
|
+
`@bendyline/molen-worldgen-earth` (see [worldgen.md](worldgen.md)).
|
|
155
|
+
|
|
156
|
+
### Large-world coordinates
|
|
157
|
+
|
|
158
|
+
Streamed mesh vertices are local to their tile. Engine-owned objects live under
|
|
159
|
+
`viewer.renderer.worldRoot`; `renderer.setWorldOrigin([x,y,z])` rebases that root and camera poses
|
|
160
|
+
without changing authored world coordinates. This is the generic precision mechanism used by large
|
|
161
|
+
invented worlds and projected Earth patches. Set `autoWorldOrigin` on the viewer to make camera
|
|
162
|
+
movement trigger coherent grid-snapped rebases for every engine-owned object automatically.
|
|
163
|
+
|
|
164
|
+
`terrainStreamBudgetForQuality('economy' | 'balanced' | 'high')` returns portable residency and
|
|
165
|
+
concurrency budgets. `stream.stats()` reports decoded samples, geometry bytes, triangles, draw
|
|
166
|
+
calls, instances, loading/failure counts, and evictions for live quality diagnostics.
|
|
167
|
+
|
|
168
|
+
## 4. Screenshot it headlessly
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
molen shot scene.json --out island.png --camera 256,160,580 --look 256,20,256 --size 1280x720
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
(The `screenshotScene` op / `screenshot_scene` MCP tool also accept a `terrain` payload so the
|
|
175
|
+
flyover renders without any live entities.) See `examples/terrain-flyover` for the full slice.
|
|
176
|
+
|
|
177
|
+
### Walk through the world explorer
|
|
178
|
+
|
|
179
|
+
The explorer blends distant terrain and objects into pale daylight haze on both rendering
|
|
180
|
+
backends. At low altitude, the fade spans 2 to 20 kilometres, preserving nearby neighborhoods
|
|
181
|
+
while softening the horizon. Both distances extend at flight altitude and stay inside the streamed
|
|
182
|
+
range; it does not otherwise change with the terrain quality preset.
|
|
183
|
+
|
|
184
|
+
In `examples/world-explorer`, select **Walk mode** to move from the aerial viewer to open ground
|
|
185
|
+
near your current position. The camera sits 1.7 meters above your feet, with a 5 cm near clipping
|
|
186
|
+
plane, so nearby buildings retain their real, human-scale dimensions. Human features turn on
|
|
187
|
+
when available; the terrain layer buttons remain independent of navigation.
|
|
188
|
+
|
|
189
|
+
Use **WASD** to walk (1.5 m/s), **Shift** to run (4 m/s), **Space** to jump, and click the world
|
|
190
|
+
to capture the mouse for looking around. **Esc** releases it; drag-look works in hosts without
|
|
191
|
+
pointer lock. Select **Fly** to rise back into aerial navigation. `?navigation=walk` starts on foot.
|
|
192
|
+
|
|
193
|
+
Walk mode uses gravity and a 1.8-meter capsule against a bounded neighborhood of visible terrain,
|
|
194
|
+
roads, buildings, and props, including instanced geometry. Collision follows tile residency and
|
|
195
|
+
layer visibility and remains stable across floating-origin changes. Missing terrain pauses movement
|
|
196
|
+
until coverage arrives. Ground placement waits for streaming and searches up to 16 meters for an
|
|
197
|
+
open spot; if none is available, use Fly to choose another location. Water is not a solid floor;
|
|
198
|
+
swimming and building interiors are not modeled.
|
|
199
|
+
|
|
200
|
+
## 5. Installable tiled-world packages
|
|
201
|
+
|
|
202
|
+
`molen/terrain-package@1` describes an extracted runtime directory containing an elevation
|
|
203
|
+
PMTiles archive, optional landcover/features sidecars, provenance, attribution, and checksums. A ZIP
|
|
204
|
+
may transport the directory, but browser deployments extract it so PMTiles remains range-readable.
|
|
205
|
+
Each PMTiles source is either package-relative (`{ "kind": "pmtiles", "path": "world.pmtiles" }`)
|
|
206
|
+
or an absolute HTTP(S) URL (`{ "kind": "pmtiles", "url": "https://tiles.example.com/world.pmtiles" }`).
|
|
207
|
+
This lets a small installed DEM package reuse one shared, Range-readable world feature archive.
|
|
208
|
+
Only bundled `path` sources appear in `files` and are checksum-verified; remote archives remain the
|
|
209
|
+
deployment's responsibility. `baseUrl` resolves package paths and never rewrites an absolute source
|
|
210
|
+
URL. An absolute source works immediately when it is same-origin; cross-origin hosts must allow the
|
|
211
|
+
consumer origin with CORS and expose the range/cache headers needed by the PMTiles reader.
|
|
212
|
+
Validate the manifest with `molen validate terrain-package.json`. A compiler/release job should
|
|
213
|
+
also run `molen validate terrain-package.json --verify-files`; that streams every declared file
|
|
214
|
+
and checks directory containment, byte size, and SHA-256 without loading an archive into memory.
|
|
215
|
+
|
|
216
|
+
The optional `surface` block declares `seaLevel` and portable height/slope material bands. If it is
|
|
217
|
+
omitted, the projected-Earth adapter supplies a conservative dirt/sand/grass/rock/snow palette.
|
|
218
|
+
|
|
219
|
+
The first executable package path is PNG16 elevation in a PMTiles v3 archive. For normal
|
|
220
|
+
perspective exploration, open its complete available pyramid and update it with camera projection
|
|
221
|
+
state:
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
import { createViewer } from '@bendyline/molen-client';
|
|
225
|
+
import {
|
|
226
|
+
createTerrainPackagePyramidStream,
|
|
227
|
+
terrainPyramidBudgetForQuality,
|
|
228
|
+
} from '@bendyline/molen-terrain/client';
|
|
229
|
+
import { wgs84ToWebMercator } from '@bendyline/molen-terrain/kernel';
|
|
230
|
+
import packageDoc from './terrain-package.json';
|
|
231
|
+
|
|
232
|
+
const [x, z] = wgs84ToWebMercator(-122.3321, 47.6062);
|
|
233
|
+
const earth = await createTerrainPackagePyramidStream(packageDoc, {
|
|
234
|
+
baseUrl: import.meta.url,
|
|
235
|
+
...terrainPyramidBudgetForQuality('balanced'),
|
|
236
|
+
initialView: {
|
|
237
|
+
position: [x, 2_000, z],
|
|
238
|
+
verticalFov: Math.PI / 3,
|
|
239
|
+
viewportHeight: canvas.height,
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
const viewer = await createViewer({
|
|
244
|
+
canvas,
|
|
245
|
+
cameraFar: 1_000_000,
|
|
246
|
+
reverseDepthBuffer: true,
|
|
247
|
+
autoWorldOrigin: { threshold: 2_000, gridSize: 500 },
|
|
248
|
+
});
|
|
249
|
+
viewer.renderer.worldRoot.add(earth.stream.object);
|
|
250
|
+
|
|
251
|
+
function frame(position: [number, number, number]) {
|
|
252
|
+
earth.stream.update({
|
|
253
|
+
position,
|
|
254
|
+
verticalFov: Math.PI / 3,
|
|
255
|
+
viewportHeight: canvas.height,
|
|
256
|
+
});
|
|
257
|
+
viewer.renderFrame();
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The selector measures projected source-sample spacing, adapts its error/range to the selected-tile
|
|
262
|
+
budget, requests ancestors before descendants, and retains a displayed parent until all selected
|
|
263
|
+
descendant coverage is resident. `stream.stats()` adds selected/displayed counts, effective
|
|
264
|
+
screen-space error, displayed-level range, and leaf fallback count. Quality presets set explicit
|
|
265
|
+
error, view-distance, concurrency, selection, and residency budgets. Include `direction` and
|
|
266
|
+
`aspect` in each view update to reject tiles safely outside a guarded horizontal camera cone while
|
|
267
|
+
retaining direction-independent coarse coverage to the configured distance. In-flight surface
|
|
268
|
+
requests finish into a bounded warm cache instead of being restarted on every small camera turn;
|
|
269
|
+
hidden cached tiles are evicted only when capacity is needed. Sparse descendants also share a
|
|
270
|
+
bounded decoded-ancestor cache, avoiding repeated PNG decode/resample work while panning.
|
|
271
|
+
|
|
272
|
+
`TerrainPyramidTileLayer` provides the same classification/hydrology/human-feature lifecycle over
|
|
273
|
+
adaptive tiles. Its optional inclusive `minLevel`/`maxLevel` bounds keep expensive decoration off
|
|
274
|
+
coarse fallback and horizon tiles. Layer objects become visible only with their selected surface,
|
|
275
|
+
remain cached briefly across LOD transitions, and are disposed with their resident height tile.
|
|
276
|
+
|
|
277
|
+
Optional package sidecars cross a normalized boundary before reaching those layers. Call
|
|
278
|
+
`openTerrainPackageSemantics(packageDoc, { decoder, baseUrl })` to open and header-check declared
|
|
279
|
+
landcover/features PMTiles. The injected decoder receives only the requested source-layer names and
|
|
280
|
+
returns `molen/terrain-semantics@1`: tile-local `[u,v]` polygons/lines plus normalized landcover,
|
|
281
|
+
water, transportation, and building records. XYZ/TMS conversion and sidecar level clipping happen
|
|
282
|
+
in the package adapter. This keeps MVT tags and Earth projection out of generic render code, and
|
|
283
|
+
lets an invented format implement the same `TerrainSemanticTileSource` contract.
|
|
284
|
+
|
|
285
|
+
MVT packages can explicitly declare `"profile": "protomaps-basemap@1"` on each semantic section.
|
|
286
|
+
`createProtomapsTerrainMvtDecoder` maps the observed Protomaps `landcover`, `landuse`, `water`,
|
|
287
|
+
`roads`, and `buildings` layers into that normalized contract, including buffered coordinates,
|
|
288
|
+
polygon holes, waterways, bridge/tunnel flags, and building height/level fallbacks. Unknown profiles
|
|
289
|
+
are never guessed. `createTerrainMvtSemanticDecoder` exposes source-layer/property mappings and
|
|
290
|
+
per-tile feature/point limits for other MVT producers.
|
|
291
|
+
|
|
292
|
+
`createTerrainSemanticPyramidLayer` joins any normalized source and renderer to adaptive residency.
|
|
293
|
+
`createDefaultTerrainSemanticRenderer` is the initial scalable mesh policy: deterministic instanced
|
|
294
|
+
trees inside forest polygons, combined terrain-draped road ribbons, combined footprint extrusions,
|
|
295
|
+
flat polygonal water, and draped linear waterways. `createTerrainWaterMaterial` provides an opaque
|
|
296
|
+
physical material with optional world-space animation; call `setTerrainWaterTime` each frame to
|
|
297
|
+
advance its highlights without discontinuities across floating-origin shifts. Opaque coverage
|
|
298
|
+
avoids dark overlap seams while adjacent or parent/child water tiles refine. Expensive semantics
|
|
299
|
+
can be level-bounded, toggled without re-decoding resident objects, and disposed with the elevation
|
|
300
|
+
tile. Applications may replace the decoder, renderer, materials, or model geometry independently.
|
|
301
|
+
|
|
302
|
+
For the standard path, `createTerrainPackageSemanticLayers` opens every optional sidecar and returns
|
|
303
|
+
classification, hydrology, and human-feature layers ready for
|
|
304
|
+
`createTerrainPackagePyramidStream`. Classification and built features are detail-bounded by
|
|
305
|
+
default; hydrology spans every available sidecar level so distant lakes retain mapped shorelines.
|
|
306
|
+
Successfully empty layer tiles remain cached with their resident terrain tile, allowing farther
|
|
307
|
+
water requests to finish instead of repeatedly querying empty nearby tiles.
|
|
308
|
+
Water is separated from transportation/buildings even when
|
|
309
|
+
they share one `features` PMTiles sidecar. When both sections reference one MVT archive, the
|
|
310
|
+
renderer layers share one in-flight range read and full decode; decoded semantic documents are not
|
|
311
|
+
retained as a second long-lived cache.
|
|
312
|
+
|
|
313
|
+
The package elevation pyramid may be sparse. `createTerrainPackagePyramidHeightSource` walks to the
|
|
314
|
+
nearest declared ancestor when an exact tile is absent, then crops and resamples that ancestor into
|
|
315
|
+
the requested tile bounds. This supports broad coarse coverage plus a small regional detail window
|
|
316
|
+
without a hard distance cutoff. Set `parentFallback: false` when exact-level coverage is required.
|
|
317
|
+
|
|
318
|
+
Adaptive quality budgets include `maxSurfaceTileResolution` (33 economy, 65 balanced, 129 high).
|
|
319
|
+
This limits render geometry without reducing the decoded heightfield used for sampling, feature
|
|
320
|
+
draping, or collision.
|
|
321
|
+
|
|
322
|
+
`openTerrainPackagePyramid` exposes the descriptor/source separately for custom lifecycles;
|
|
323
|
+
`terrainPyramidDescriptorFromPackage` is the pure coordinate adapter. `TerrainTileArchive` remains
|
|
324
|
+
the seam for native or test range readers. The official `pmtiles` browser reader is used by default,
|
|
325
|
+
and its header clips the usable level range and verifies PNG content before streaming.
|
|
326
|
+
|
|
327
|
+
`createTerrainPackageStream({ level })` remains the fixed-level path for orthographic views,
|
|
328
|
+
semantic tile-layer development, and diagnostics. Missing fixed-level tiles use the nearest
|
|
329
|
+
available parent by default; the adapter crops and resamples the ancestor while keeping neighbor
|
|
330
|
+
borders identical. Set `parentFallback: false` for strict package diagnostics.
|
|
331
|
+
|
|
332
|
+
Current projected-Earth runtime constraints are explicit: EPSG:3857, a square `[1,1]` root tile
|
|
333
|
+
matrix, guarded horizontal-cone selection ahead of exact six-plane/horizon culling, and an injected
|
|
334
|
+
decoder for unknown MVT/PNG8 profiles alongside the explicit built-in Protomaps MVT profile. TMS Y
|
|
335
|
+
addresses,
|
|
336
|
+
sidecar-header validation, normalized semantic meshes, and parent-safe adaptive refinement are
|
|
337
|
+
handled automatically. See the binding roadmap in `docs/10-earth-terrain.md` in the source
|
|
338
|
+
repository.
|
|
339
|
+
|
|
340
|
+
With parent fallback enabled, a package pyramid may extend above the elevation archive's
|
|
341
|
+
maximum zoom. For example, a zoom-15 vector archive can use cropped/resampled zoom-14 elevation
|
|
342
|
+
without downloading another DEM level. Set `parentFallback: false` to clamp the pyramid to exact
|
|
343
|
+
elevation archive levels. The World Explorer data builder defaults to this 15/14 split and exposes
|
|
344
|
+
`--elevation-max-level` separately from `--max-level`.
|
|
345
|
+
|
|
346
|
+
## Surface rendering styles
|
|
347
|
+
|
|
348
|
+
Human mode includes a Surfaces selector for Modern traffic, Circa 1910, and Simple surfaces.
|
|
349
|
+
The Surface details controls customize markings, sidewalks, crossings, streetlights, signals,
|
|
350
|
+
parked cars, and inferred parking. Changes preserve the camera and buildings and update the URL.
|
|
351
|
+
Circa 1910 changes the surface treatment of the present-day map; it does not reconstruct history.
|
|
352
|
+
|
|
353
|
+
See [Surface styles and parameterized line features](surface-rendering.md) for the shared rendering API, parking inference rules, budgets, and rail/utility profile examples.
|
|
354
|
+
|
|
355
|
+
The explorer plans adaptive streaming at 10 Hz, independently of rendering and movement. Covered
|
|
356
|
+
ancestors that were evicted under memory pressure are not reloaded while finer resident tiles
|
|
357
|
+
supply their coverage; coarse coverage remains warm for camera turns. The HUD reports actual
|
|
358
|
+
renderer draws/triangles and frame mean/max alongside resident allocation estimates.
|
|
359
|
+
|
|
360
|
+
Land-cover draping can run off-thread with `createTerrainLandcoverWorkerBridge(worker)` and
|
|
361
|
+
`installTerrainLandcoverWorker(scope)` from the terrain client. The worldgen renderer accepts the
|
|
362
|
+
bridge through `landcoverGenerator`; the caller disposes it after its tiles are disposed. It
|
|
363
|
+
preserves source height samples, terrain triangle alignment, colors, holes, and material settings.
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
Runtime quality controllers can call `stream.setBudget(partialBudget)` with measured screen-space
|
|
367
|
+
error, view distance, selected/resident tile ceilings, concurrency, and optional `maxResidentBytes`.
|
|
368
|
+
Use `maxResidentBytes: undefined` to remove an automatic byte cap. The patch is validated
|
|
369
|
+
atomically, retains the existing stream and cache, and replans its latest
|
|
370
|
+
view. `stream.getBudget()` returns a detached snapshot. Reducing concurrency allows current work
|
|
371
|
+
to finish; new work waits for the lower limit. Reducing residency evicts hidden cache first and
|
|
372
|
+
retains displayed descendants until a replacement parent is ready. Already displayed coverage may
|
|
373
|
+
temporarily exceed a reduced tile limit; at most one replacement parent is admitted at a time
|
|
374
|
+
while the stream converges, rather than exposing a hole.
|
|
375
|
+
|
|
376
|
+
`stream.pressure()` provides constant-time retained height/geometry byte estimates, tile and byte
|
|
377
|
+
ratios, and `overBudget` for the controller without traversing the scene. `displayedBytes` and
|
|
378
|
+
`displayedByteRatio` isolate the currently displayed tile allocations from the reclaimable hidden
|
|
379
|
+
cache. Use that working-set ratio for quality recovery decisions: normal LRU residency fills its
|
|
380
|
+
cache near the cap, which alone should not prevent recovery. The byte ceiling is soft:
|
|
381
|
+
visible coverage and its coarse fallback are protected, so sustained pressure should make the host
|
|
382
|
+
increase screen-space error or reduce its selected-tile budget. These estimates exclude textures,
|
|
383
|
+
source caches, and driver allocations; geometry shared across tiles is counted conservatively.
|
|
384
|
+
Adapters that replace a resident layer's geometry in place should call
|
|
385
|
+
`stream.refreshMemoryUsage()` once after that asynchronous update settles. It refreshes allocation
|
|
386
|
+
estimates and evicts hidden cache under pressure; ordinary `pressure()` calls remain constant-time.
|
|
387
|
+
A runtime `maxSurfaceTileResolution` change affects new tile admissions only. Resident surface
|
|
388
|
+
meshes and the matching resolution passed to draped layers stay intact, avoiding mass geometry
|
|
389
|
+
rebuilds and terrain/overlay disagreement during adaptive changes.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# The three.js surface
|
|
2
|
+
|
|
3
|
+
Molen takes **three.js** as a peer dependency in the range `>=0.184.0 <0.187.0` and is developed
|
|
4
|
+
against **0.184.0** (see the header of [llms.txt](../llms.txt)). Install `three` beside
|
|
5
|
+
`@bendyline/molen-client` so your app and the engine share one copy. If your training data
|
|
6
|
+
describes older three idioms (r1xx), trust this page and the 0.184 types over your priors — the
|
|
7
|
+
client wraps three so you rarely touch it directly.
|
|
8
|
+
|
|
9
|
+
## What the client wraps (`@bendyline/molen-client`)
|
|
10
|
+
|
|
11
|
+
You almost never construct three.js objects yourself. The client owns the scene graph and syncs it
|
|
12
|
+
from kernel snapshots:
|
|
13
|
+
|
|
14
|
+
| Symbol | Role |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `await mountExperience({ link, scene, canvas })` | the one-call browser mount: client + the scene's camera and input blocks + resize ([browser-mount.md](browser-mount.md)) |
|
|
17
|
+
| `await createClient(link, opts)` | live client: connects to a kernel (Worker/in-proc), interpolates, renders |
|
|
18
|
+
| `client.command(type, payload?)` | send a command; the client fills the envelope (auto `seq`, `source: 'local'`) |
|
|
19
|
+
| `client.onEvent(type or '*', cb)` / `client.onDiag(cb)` | kernel events (with their tick) and diagnostics reach the page |
|
|
20
|
+
| `client.onError(cb)` | client-side failures: a dead or throwing kernel link, and frame-loop exceptions |
|
|
21
|
+
| `client.backend` / `client.getObject(id)` | the live `ThreeSceneBackend` and the raw three.js object for an entity (escape hatch) |
|
|
22
|
+
| `client.get(id, component)` / `client.entities()` / `client.tick` | mirrored simulation state (detached copies) — a HUD's data source |
|
|
23
|
+
| `createClientCore({ link, backend })` | the renderer-free core (mirror + interpolation + events) for tests and custom backends — the one synchronous factory |
|
|
24
|
+
| `applySceneCamera(camera, renderer)` / `applyInputRules(input, inputMap, emit)` | the scene `camera` / `input` blocks as functions |
|
|
25
|
+
| `await createSnapshotViewer(keyframe, opts)` | renders a single keyframe (what `molen shot` uses) |
|
|
26
|
+
| `await createViewer(opts)` | kernel-less empty viewer: a renderer + scene for client-side capabilities (e.g. terrain) |
|
|
27
|
+
| `Renderer` | three.js renderer wrapper (WebGL or WebGPU): camera (`setCamera`, `setTopDownOrtho`, `setFov`), tone mapping, resize (ortho refits) |
|
|
28
|
+
| `ThreeSceneBackend` | implements `SceneBackend`: creates/updates/destroys meshes from `Renderable` components |
|
|
29
|
+
| `SceneMirror` | the kernel→scene-graph reconciler (pure; backend-agnostic) |
|
|
30
|
+
| `InputMap` (`onPress`/`onRelease`/`isActive`) / `resolveAction` | device codes → named actions |
|
|
31
|
+
| `InterpolationBuffer`, `lerp3`, `nlerp4` | the interpolation primitives |
|
|
32
|
+
|
|
33
|
+
Renderables are **data**, not three objects: primitives
|
|
34
|
+
(`{ kind: 'primitive', ref: 'box'|'sphere'|'plane'|'cylinder', primitive: { size } }`) or glTF
|
|
35
|
+
assets (`{ kind: 'gltf', ref: '<asset-id>', node?, animation? { clip, loop, speed } }` — import
|
|
36
|
+
with `molen asset import`; enable with `ClientOptions.assets`). Materials resolve `palette:#rrggbb`
|
|
37
|
+
plus doc-backed `matgraph:`/`pixelgrid:` refs (CPU-baked at load — see
|
|
38
|
+
[materials.md](materials.md) "From bake to render"); unknown refs render neutral grey. Per-entity
|
|
39
|
+
`light` components and a singleton `environment` component (ambient/sun, background, fog, tone
|
|
40
|
+
mapping, `shadows: off|low|medium|high`) replace the built-in default rig.
|
|
41
|
+
|
|
42
|
+
## Escape hatch (unstable)
|
|
43
|
+
|
|
44
|
+
When you need an effect the wrapper doesn't cover, drop to raw three.js — using the **same `three`
|
|
45
|
+
instance** the client renders with: the peer your app installed, also re-exported from the client
|
|
46
|
+
as `THREE` (so you never fight a second, mismatched copy).
|
|
47
|
+
Reach it through the client that owns the scene: `client.backend` is the live `ThreeSceneBackend`
|
|
48
|
+
(`mountExperience`/`createClient` built it — both return a promise, so `await` the factory before
|
|
49
|
+
you reach for it), and `client.getObject(id)` delegates to it.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { THREE } from '@bendyline/molen-client';
|
|
53
|
+
|
|
54
|
+
const { client } = await mountExperience({ link: worker, scene: scene(), canvas });
|
|
55
|
+
// ... after the entity exists (a keyframe has arrived) ...
|
|
56
|
+
const mesh = client.getObject('player'); // the raw THREE.Mesh, or undefined
|
|
57
|
+
client.backend.threeScene.add(new THREE.PointLight(0xffffff, 1)); // custom objects/lights
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Take the object through `getObject`, not `client.renderer.worldRoot.getObjectByName(id)`:
|
|
61
|
+
`getObject` pulls the entity out of any static batch and marks it escaped, so what you mutate is
|
|
62
|
+
what renders. The batched original is `visible = false`, so edits made to it are invisible.
|
|
63
|
+
|
|
64
|
+
Constructing your own `new ThreeSceneBackend(scene)` builds an unrelated, empty backend — it
|
|
65
|
+
mirrors nothing and its `getObject` always returns `undefined`. Do that only when you are driving
|
|
66
|
+
`SceneMirror` yourself (a custom host, or `createClientCore({ link, backend })`).
|
|
67
|
+
|
|
68
|
+
This is explicitly unstable: you own whatever you mutate, and the backend may recreate a mesh when
|
|
69
|
+
its renderable changes. Prefer components + materialRefs for anything that should be deterministic
|
|
70
|
+
or survive snapshot/replay.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Vehicle interiors and instruments
|
|
2
|
+
|
|
3
|
+
Each vehicle owns its cabin in its main GLB. Windows, seats, panels, instruments and controls
|
|
4
|
+
are model geometry, visible from outside and from the seated camera. Boarding moves the camera
|
|
5
|
+
to the model's authored `pilotEye` or `driverEye`; it does not substitute a cockpit mesh.
|
|
6
|
+
Authors can build a warbird, helicopter or airliner flight deck without changing the renderer.
|
|
7
|
+
|
|
8
|
+
## Platform: simulation data to model geometry
|
|
9
|
+
|
|
10
|
+
The shared primitive is **model signals**, not a built-in cockpit. Add `model.signals` beside
|
|
11
|
+
`renderable` on any entity: a vehicle, a machine with a pressure gauge, or a building with a lift.
|
|
12
|
+
The normal client automatically reads the entity's components after snapshots/deltas and poses
|
|
13
|
+
the named GLB nodes. No vehicle-specific renderer or per-frame browser script is required.
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"renderable": { "kind": "gltf", "ref": "my.airliner" },
|
|
18
|
+
"model.signals": {
|
|
19
|
+
"sources": {
|
|
20
|
+
"engine2rpm": { "component": "avionics", "path": ["engines", 1, "rpm"] },
|
|
21
|
+
"airspeed": { "component": "aircraftState", "path": ["airspeed"] }
|
|
22
|
+
},
|
|
23
|
+
"bindings": [
|
|
24
|
+
{ "node": "engine-two-pointer", "source": "engine2rpm", "property": "rotation", "axis": "z", "scale": 0.0015, "offset": -2.3 },
|
|
25
|
+
{ "node": "speed-tape", "source": "airspeed", "property": "position", "axis": "y", "scale": 0.001, "max": 0.4 }
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Sources use explicit path segments, not JavaScript expressions or dot-split strings. Reads stay
|
|
32
|
+
on the same entity; numbers are passed through, booleans become 0/1, and missing/nonfinite values
|
|
33
|
+
are ignored. Declare custom components such as `avionics` in the scene or type registry;
|
|
34
|
+
deterministic entity scripts can publish calculated RPM, sensor values, or switch positions to
|
|
35
|
+
them. Unit conversions and instrument calibration belong in the asset's bindings, or in a
|
|
36
|
+
simulation script for nonlinear/computed readings. Render bindings never write back to physics.
|
|
37
|
+
|
|
38
|
+
Bindings receive the latest values even if the GLB finishes loading later. Replacing/removing
|
|
39
|
+
bindings restores their authored transforms. Signal-driven models stay out of static mesh
|
|
40
|
+
batching. Signals take precedence over animation clips on the channels they own; avoid assigning
|
|
41
|
+
the same channel to multiple systems. Other clip channels keep animating normally.
|
|
42
|
+
|
|
43
|
+
Custom hosts can use `createModelSignalVisual(model, spec)` and `readModelSignals(sources,
|
|
44
|
+
readComponent)` from `@bendyline/molen-client`. `update(signals)` accepts arbitrary named numeric
|
|
45
|
+
telemetry, `reset()` restores the authored pose, and `missingNodes` diagnoses unresolved names.
|
|
46
|
+
This is a transform-binding foundation for analog gauges, tapes, levers and moving parts;
|
|
47
|
+
text readouts, emissive annunciators and render-to-texture avionics screens are not implemented.
|
|
48
|
+
|
|
49
|
+
## Source ownership
|
|
50
|
+
|
|
51
|
+
Vehicle bundles contain `models/source.glb`, `entity.types.json` and `scripts/interactions.ts`.
|
|
52
|
+
Aircraft also have `models/interior.json` (gauge positions, labels, sizes, panel, seats, switches
|
|
53
|
+
and horizon placement) and `models/interior.mjs` (their local cockpit builder).
|
|
54
|
+
`models/generate.mjs` includes that cockpit in the main GLB. Each aircraft can change its
|
|
55
|
+
layout and builder independently. All of these files are inventoried by `source.json`.
|
|
56
|
+
|
|
57
|
+
The five road vehicles have editable GLB interiors. Their current basic dashboard/chassis
|
|
58
|
+
geometry is merged into `body`, with a separate steering wheel. Edit these meshes in a DCC
|
|
59
|
+
to add cabin detail. There is no universal dashboard fabricated by the runtime.
|
|
60
|
+
|
|
61
|
+
Aircraft generators accept `--out /path/to/candidate.glb` for reviewing changes without
|
|
62
|
+
overwriting the master or baseline. Import an approved master with `molen asset import`, update
|
|
63
|
+
the source manifest hash, and run the entity package's `generate` command for aggregate types.
|
|
64
|
+
|
|
65
|
+
## Model-specific bindings
|
|
66
|
+
|
|
67
|
+
`aircraft.spec.visual.interior` and `vehicle.visual.interior` share this shape:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"nodes": ["flight-deck"],
|
|
72
|
+
"bindings": [
|
|
73
|
+
{
|
|
74
|
+
"node": "left-speed-pointer",
|
|
75
|
+
"source": "airspeed",
|
|
76
|
+
"property": "rotation",
|
|
77
|
+
"axis": "z",
|
|
78
|
+
"scale": 0.023,
|
|
79
|
+
"offset": -2.3,
|
|
80
|
+
"min": -2.3,
|
|
81
|
+
"max": 2.3
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Bindings add `clamp(signal * scale + offset, min, max)` to a node's authored local transform.
|
|
88
|
+
`rotation` uses radians; `position` uses meters (useful for tapes and levers). Limits are optional.
|
|
89
|
+
Repeated updates do not accumulate movement. Missing/nonfinite signals leave channels unchanged.
|
|
90
|
+
Duplicate names animate together, but GLTFLoader can suffix duplicate GLB names with `_1`;
|
|
91
|
+
bind the loaded names explicitly. Two bindings cannot write the same node/property/axis.
|
|
92
|
+
`nodes` identifies cabin geometry and never changes its visibility.
|
|
93
|
+
|
|
94
|
+
Aircraft signals are `airspeed` (m/s), `altitude`/`altitudeAGL` (m), `verticalSpeed` (m/s),
|
|
95
|
+
`heading`/`pitch`/`roll` (radians), `rpm`/`power` (0–1), `pitchInput`/`rollInput`/`yawInput`
|
|
96
|
+
(-1–1), and `gear`/`flaps`/`engine` (0 or 1). Calibration belongs to each model.
|
|
97
|
+
Cars supply `steering` and `wheelAngle` (radians); their optional third `update` argument accepts
|
|
98
|
+
additional signals. World explorer passes `speed` (signed m/s), `heading`/`pitch`/`roll` (radians),
|
|
99
|
+
`throttle` (-1–1) and `brake` (0 or 1).
|
|
100
|
+
|
|
101
|
+
An interior can also include `sources`, using the same component/path mappings as `model.signals`.
|
|
102
|
+
World explorer resolves these for each vehicle and merges them over the convenience signals,
|
|
103
|
+
so an asset can bind a gauge to script-owned state or to an individual engine. Other custom
|
|
104
|
+
hosts pass resolved readings as the aircraft visual's optional fourth `update` argument or the
|
|
105
|
+
car visual's third argument. Choose the interior adapter or the automatic `model.signals`
|
|
106
|
+
component for a given model; do not let two adapters own the same transform channel.
|
|
107
|
+
|
|
108
|
+
The `createVehicleInteriorVisual(model, spec)` wrapper around model signals is exported from
|
|
109
|
+
`@bendyline/molen-client/vehicles`. Its `update(signals)` also accepts custom telemetry names,
|
|
110
|
+
such as individual engine readings. Its `missingNodes` reports unresolved bindings; aircraft
|
|
111
|
+
and vehicle visuals expose it as `visual.interior`. There is no prescribed instrument count,
|
|
112
|
+
node naming scheme or panel layout. This animates model transforms; full avionics/display
|
|
113
|
+
rendering is a separate system. Entity scripts can manage simulation state and interactions.
|
|
114
|
+
|
|
115
|
+
Legacy explicit `controlStick`, `collective` and `steeringWheelNode` bindings work without
|
|
116
|
+
`interior`. New models should use `interior.bindings`. The implicit `needle-*`/`attitude-ball`
|
|
117
|
+
convention is removed: assets must list instruments explicitly. `airspeedGaugeMax` remains
|
|
118
|
+
legacy metadata and no longer drives a gauge.
|
|
119
|
+
|
|
120
|
+
## Exterior views and detail levels
|
|
121
|
+
|
|
122
|
+
Cockpit and chase views share the GLB. An interior can be a high-detail portion of that model,
|
|
123
|
+
but is not inherently a separate LOD: an exterior camera looking through a window needs it too.
|
|
124
|
+
World explorer promotes up to eight nearby dormant cars to their GLBs within 14 meters,
|
|
125
|
+
retaining detail to 20 meters to avoid repeated swaps. Distant parking proxies remain instanced.
|
|
126
|
+
Boarding retains that same GLB for the session. Aircraft already keep their full GLBs resident.
|