@bendyline/molen-tooling 0.0.6 → 0.0.8
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 +213 -213
- package/dist/capture/worldgen-preview.js +60 -60
- package/dist/cli.mjs +2 -2
- package/dist/docs-src/guide/3d-model-assets.md +9 -0
- package/dist/docs-src/guide/determinism.md +1 -1
- package/dist/docs-src/guide/earth-view.md +68 -7
- package/dist/docs-src/guide/surface-rendering.md +51 -5
- package/dist/docs-src/guide/terrain.md +3 -0
- package/dist/docs-src/llms.txt +1 -1
- package/dist/docs-src/schemas/asset.md +100 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +1 -1
- package/dist/{mcp-ClDdiqq4.mjs → mcp-BbHk4ibu.mjs} +1 -1
- package/dist/{ops-2qoHKV54.mjs → ops-CErtZh2t.mjs} +48 -5
- package/dist/templates/index.json +16 -16
- package/package.json +13 -13
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as formatPacked, A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as previewFigure, H as describeOps, I as listFigurePresets, J as checkSoundbank, K as planAudio, L as exportFrames, M as bakeNetwork, N as generateTypes, O as extractContentPack, Q as formatBytes, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, V as OPS_CATALOG, W as checkScripts, X as stageAssets, Z as screenshotAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as listAssets, p as getComponentOp, q as importSound, r as previewWorldgen, s as simWatch, t as formatWorldgenStats, tt as inspectAsset, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates } from "./ops-
|
|
2
|
+
import { $ as formatPacked, A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as previewFigure, H as describeOps, I as listFigurePresets, J as checkSoundbank, K as planAudio, L as exportFrames, M as bakeNetwork, N as generateTypes, O as extractContentPack, Q as formatBytes, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, V as OPS_CATALOG, W as checkScripts, X as stageAssets, Z as screenshotAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as listAssets, p as getComponentOp, q as importSound, r as previewWorldgen, s as simWatch, t as formatWorldgenStats, tt as inspectAsset, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates } from "./ops-CErtZh2t.mjs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { formatIssues } from "@bendyline/molen-schema";
|
|
@@ -1254,7 +1254,7 @@ async function cmdWorldgen(args) {
|
|
|
1254
1254
|
return 2;
|
|
1255
1255
|
}
|
|
1256
1256
|
async function cmdMcp() {
|
|
1257
|
-
const { startMcpServer } = await import("./mcp-
|
|
1257
|
+
const { startMcpServer } = await import("./mcp-BbHk4ibu.mjs");
|
|
1258
1258
|
await startMcpServer();
|
|
1259
1259
|
return 0;
|
|
1260
1260
|
}
|
|
@@ -31,6 +31,15 @@ For programmatic captures of reflective metal or glass, pass `reflections: true`
|
|
|
31
31
|
viewer's shared procedural sky/ground environment; the default remains the legacy light rig.
|
|
32
32
|
The repository landmark capture script accepts `--reflections` and records that mode in its
|
|
33
33
|
hash-bound report. See [sky reflections](sky.md#reflections) for the runtime lighting model.
|
|
34
|
+
For fine glazing joints, rails or louvres, programmatic `screenshotScene` and `screenshotAsset`
|
|
35
|
+
calls also accept `antialias: true`. The landmark capture script exposes this as `--antialias`
|
|
36
|
+
and records it in the report, so changing the setting invalidates cached captures. The default
|
|
37
|
+
remains false for existing golden captures. Antialiasing reduces subpixel edge artifacts;
|
|
38
|
+
it does not replace reviewing distant detail or authoring appropriate levels of detail.
|
|
39
|
+
For large structures, `screenshotScene({ fitShadows: true, ... })` fits enabled sun shadows
|
|
40
|
+
to the loaded scene bounds using the viewer's shadow-focus system. The landmark capture
|
|
41
|
+
script records `--fit-shadows` separately. The default fixed shadow box is preserved;
|
|
42
|
+
the option does not turn shadows on in scenes where they are disabled.
|
|
34
43
|
|
|
35
44
|
## 1. Convert the prompt into an asset brief
|
|
36
45
|
|
|
@@ -135,7 +135,7 @@ Two constants live in `packages/kernel/src/version.ts` and they do different job
|
|
|
135
135
|
|
|
136
136
|
| Constant | Today | Role |
|
|
137
137
|
|---|---|---|
|
|
138
|
-
| `ENGINE_VERSION` | `0.0.
|
|
138
|
+
| `ENGINE_VERSION` | `0.0.5` | metadata. Written into a keyframe's `engine` field so a save says which build wrote it. **Never compared on load, never hashed.** |
|
|
139
139
|
| `STATE_FORMAT` | `1` | the gate. Written into a keyframe under the reserved `plugins.$format` key, compared by `applyKeyframeTo`, and folded into `stateHash` as `stateFormat`. |
|
|
140
140
|
|
|
141
141
|
So a release — even one that moves every package — keeps your keyframes
|
|
@@ -462,15 +462,71 @@ placement evidence. Older historical sources without a complete supported date i
|
|
|
462
462
|
drafts. Shared placement QA uses `capture-landmark-library.mjs --viewing-date=1930-01-01` and
|
|
463
463
|
records the explicit date in its hash-bound report.
|
|
464
464
|
|
|
465
|
-
Geographic and category models use `
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
465
|
+
Geographic and category models use `StructureLodStreamer`. Each asset has separately fetched
|
|
466
|
+
`skyline`, `district`, `street`, and `closeup` files in its sidecar's `runtimeLods`. The default
|
|
467
|
+
viewer loads skyline first and chooses detail by projected geometric error and remaining
|
|
468
|
+
budgets. The source master stays available for authoring and review. Generated close-ups are
|
|
469
|
+
reduced runtime models; they are not a promise of every detail in the master.
|
|
470
|
+
|
|
471
|
+
The streamer prioritizes nearby placements, limits concurrent requests, reserves memory before
|
|
472
|
+
loading, verifies payload hashes, and cancels unused requests. Instances keep the old level while
|
|
473
|
+
the replacement is prepared, then swap atomically. Placement, heading, elevation, ground cutouts
|
|
474
|
+
and bridge clipping are reapplied before publication. A five-second warm cache avoids immediately
|
|
475
|
+
reloading recently released models; memory pressure can evict unused models sooner. Shared
|
|
476
|
+
geometry and materials are counted once. Procedural scatter uses its separate instanced path.
|
|
477
|
+
|
|
478
|
+
| Default landmark allowance | Phone/tablet | Laptop/desktop |
|
|
479
|
+
| --- | ---: | ---: |
|
|
480
|
+
| Resident skyline payloads, uncompressed | 3 MB | 6 MB |
|
|
481
|
+
| Geometry CPU backing buffers | 64 MB | 192 MB |
|
|
482
|
+
| Estimated geometry GPU uploads | 64 MB | 192 MB |
|
|
483
|
+
| Shared worldgen textures, including mipmaps | 16 MB | 48 MB |
|
|
484
|
+
| Triangle / draw-call allowance | 350,000 / 100 | 1,000,000 / 200 |
|
|
485
|
+
| Concurrent model loads | 2 | 4 |
|
|
486
|
+
| Cooperative preparation time per frame | 2 ms | 4 ms |
|
|
487
|
+
|
|
488
|
+
These are decimal MB, separate from terrain, render targets, transport caches and parser/driver
|
|
489
|
+
overhead. Initial payload limits cover the active skyline set, not lifetime travel downloads or
|
|
490
|
+
pack metadata. Upgrades can download larger files after a one-second skyline grace period.
|
|
491
|
+
Draw/triangle admission reserves twice the nominal geometry cost for extra passes; shadows and
|
|
492
|
+
other renderer passes have their own costs. Preparation yields between instances; an individual
|
|
493
|
+
GLB parse or GPU upload can exceed the cooperative time allowance.
|
|
494
|
+
|
|
495
|
+
Touch devices or browsers reporting at most 4 GB use the phone preset. Hosts can choose explicitly:
|
|
496
|
+
|
|
497
|
+
```ts
|
|
498
|
+
const view = await mountEarthView({
|
|
499
|
+
canvas,
|
|
500
|
+
// ... terrain source, content and other required options
|
|
501
|
+
landmarkStreaming: {
|
|
502
|
+
mobile: true,
|
|
503
|
+
budget: { maxInitialBytes: 3_000_000, maxGpuBytes: 64_000_000 },
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
// view.stats().structures: resident levels, payloads, geometry, texture bytes,
|
|
507
|
+
// queued/in-flight loads, upgrades, failures and evictions.
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
Runtime variants use separate vertex attribute streams so Float32 positions and Uint8 colors
|
|
511
|
+
do not cause overlapping GPU uploads. The reducer preserves source material references on detailed
|
|
512
|
+
levels; skyline uses a single color material and local convex pieces derived from the source.
|
|
513
|
+
Small openings and fine trim can disappear in that distant silhouette. Detailed levels use
|
|
514
|
+
conservative reduction and can exceed their advisory triangle targets. Expensive models stay
|
|
515
|
+
coarse when an upgrade does not fit; source-authored LODs may be needed for more detail on phones.
|
|
516
|
+
Geometric error is an estimate for selection, not a certified maximum deviation.
|
|
517
|
+
|
|
518
|
+
Assets without current LOD metadata keep their procedural fallback in the default viewer. A host
|
|
519
|
+
can deliberately select `landmarkStreaming: false` to use the original `StructureModelLibrary`
|
|
520
|
+
and full imports for inspection or legacy content. Static geometry is required; animation and
|
|
521
|
+
skinning need a host-specific implementation.
|
|
471
522
|
|
|
472
523
|
### Shared architectural surfaces
|
|
473
524
|
|
|
525
|
+
The Earth viewer bakes shared surfaces when they are first used, with two concurrent jobs and the
|
|
526
|
+
texture allowance above. Each graph is cached once for that worldgen instance. If adding a texture
|
|
527
|
+
would exceed the allowance, its flat material remains usable. The library is released with the
|
|
528
|
+
worldgen instance. Rejected textures do not trigger a repeated bake every frame.
|
|
529
|
+
|
|
474
530
|
Authored GLB materials can opt into the same texture library as procedural buildings. Set
|
|
475
531
|
the material's glTF `extras.molenSurface` (available as Three.js material `userData.molenSurface`):
|
|
476
532
|
|
|
@@ -525,13 +581,18 @@ of images that may come from an external cache.
|
|
|
525
581
|
|
|
526
582
|
Mapped roads with `bridge: true` receive solid decks, edge barriers and regularly spaced
|
|
527
583
|
supports in the shared terrain surface renderer, including its worker path. Road, rail and
|
|
528
|
-
pedestrian spans follow mapped centerlines and widths
|
|
584
|
+
pedestrian spans follow mapped centerlines and widths. Complete spans
|
|
529
585
|
interpolate between bank heights and connect to adjoining ground roads. Clipped spans use
|
|
530
586
|
estimated terrain clearance (6 m for roads/rail, 3 m for paths); a semantic provider can set
|
|
531
587
|
`deckElevation` to an absolute surveyed height. These are visual approximations: tile data
|
|
532
588
|
does not establish bridge engineering type, navigation clearance, foundations or collision.
|
|
533
589
|
The SR-520 preview replaces the floating section; its approaches use this same fallback.
|
|
534
590
|
|
|
591
|
+
Mapped tunnels receive separate inferred underground bores and portal cuts that retain the
|
|
592
|
+
terrain above them. Aircraft support queries use the bore floor while underground. Centerlines
|
|
593
|
+
alone do not establish surveyed grades, widths or clearances; see [Tunnels](surface-rendering.md#tunnels)
|
|
594
|
+
for the metadata overrides, inference and bounded route stitching.
|
|
595
|
+
|
|
535
596
|
Regional procedural styles are separate from exact structures. The atlas's ordered rules use
|
|
536
597
|
mapped building class, footprint size, context, and known height to choose a style. A rule can
|
|
537
598
|
give weighted variants, sampled from a stable building identity, so a neighborhood has a
|
|
@@ -28,6 +28,8 @@ const renderer = createDefaultTerrainSemanticRenderer({ surfaceRenderer: surface
|
|
|
28
28
|
// in createTerrainPackageSemanticLayers.
|
|
29
29
|
|
|
30
30
|
await surfaces.setOptions({ style: '1910' });
|
|
31
|
+
// Call once per frame with absolute simulation time (seconds).
|
|
32
|
+
surfaces.updateSignals(tick / tickRate);
|
|
31
33
|
console.log(surfaces.stats());
|
|
32
34
|
// Dispose the stream/layers, then the shared controller when the experience closes.
|
|
33
35
|
surfaces.dispose();
|
|
@@ -106,7 +108,9 @@ await surfaces.setOptions({
|
|
|
106
108
|
Nearby nodes on divided roads form one junction; crossings follow
|
|
107
109
|
the external approaches, and short turning links receive no independent crossings. Same-grade
|
|
108
110
|
junctions leave their centers clear of lane paint.
|
|
109
|
-
Four-way major junctions can receive
|
|
111
|
+
Four-way major junctions can receive curbside masts with bars over the incoming lanes,
|
|
112
|
+
yellow backplates, shaded round lenses, and one signal head per lane (up to three).
|
|
113
|
+
Red, amber and green lenses are self-lit, remaining visible at night. Instanced streetlights
|
|
110
114
|
occupy eligible corners outside road corridors, buildings, and water.
|
|
111
115
|
- Parking, plazas, and pedestrian polygons are filled, with holes retained. Pedestrian polygons
|
|
112
116
|
and mapped paths use distinct heights above parking pavement, including inferred lots, so
|
|
@@ -142,12 +146,21 @@ await surfaces.setOptions({
|
|
|
142
146
|
- Simple surfaces retain road and parking fills with decoration disabled.
|
|
143
147
|
|
|
144
148
|
The decoder preserves road `subclass`, `service`, `link` (including Protomaps `is_link`), `surface`, `lanes`, `oneway`, `layer`, `bridge`, `tunnel`
|
|
145
|
-
and explicit `width`. Properties absent from the source use class-based defaults.
|
|
146
|
-
|
|
149
|
+
and explicit `width`. Properties absent from the source use class-based defaults. Tunnel roads are
|
|
150
|
+
excluded from the ground painter; Earth views add separate underground bores as described below.
|
|
151
|
+
Bridges and differing layers do not form surface junctions. Bridge ribbons retain the
|
|
147
152
|
existing approximate terrain-relative elevation; this renderer does not build engineered bridge
|
|
148
153
|
decks. Crossing paint, inferred sidewalks, signal placement and parking occupancy are decorative,
|
|
149
|
-
not traffic-control or navigation data. [Ambient life](ambient-life.md) builds its own lane graph
|
|
150
|
-
from the same features for NPC traffic.
|
|
154
|
+
not surveyed traffic-control or navigation data. [Ambient life](ambient-life.md) builds its own lane graph
|
|
155
|
+
from the same features for NPC traffic. Earth view and world explorer match signal heads to
|
|
156
|
+
that graph, displaying the same phase that controls approaching cars. Without a matching
|
|
157
|
+
simulation junction, signals use a deterministic cycle: 24 seconds green, 3 seconds amber,
|
|
158
|
+
and 2 seconds all-red clearance, with opposing approaches sharing a phase. Custom hosts
|
|
159
|
+
call `surfaces.updateSignals(elapsedSeconds, resolver?)`; a resolver receives a world-space
|
|
160
|
+
`junction`, outward approach `direction`, and junction `radius`, and returns `'red'`, `'amber'`,
|
|
161
|
+
`'green'`, or `undefined` for the default cycle. Direct/static consumers can call
|
|
162
|
+
`updateTerrainSurfaceSignals(object, elapsedSeconds, resolver?)` on the surface object instead.
|
|
163
|
+
Here `object` is the group returned by `createTerrainSurfaceObject`.
|
|
151
164
|
|
|
152
165
|
Ground surfaces render at all available semantic levels. Fine markings and fixtures default to
|
|
153
166
|
the finest pyramid level; `detailLevelsBelowMax` extends them to coarser levels. Fixture/car and
|
|
@@ -169,6 +182,39 @@ Protomaps deliberately includes a subset of OSM features. Its documented `landus
|
|
|
169
182
|
kinds do not currently include parking, while roads may carry `parking_aisle` detail.
|
|
170
183
|
See the [Protomaps layer reference](https://docs.protomaps.com/basemaps/layers).
|
|
171
184
|
|
|
185
|
+
## Tunnels
|
|
186
|
+
|
|
187
|
+
World explorer and `mountEarthView` render mapped `tunnel: true` corridors in Human mode.
|
|
188
|
+
Roads, paths and railways receive an open-ended floor, walls and ceiling. Portal cuts remove
|
|
189
|
+
terrain and draped paving only below the bore ceiling, leaving the hill above it intact.
|
|
190
|
+
Visible mesh collision includes the lining. World explorer's free flight slows near the ground,
|
|
191
|
+
can descend to 2 m above a road, and uses the bore floor and ceiling while underground.
|
|
192
|
+
Aircraft ground support also uses the bore floor at the aircraft's altitude; its existing body
|
|
193
|
+
collision still determines whether an aircraft fits.
|
|
194
|
+
|
|
195
|
+
The Seattle PMTiles fixture contains `is_tunnel` centerlines for the Mount Baker Ridge road and
|
|
196
|
+
bicycle/pedestrian tunnels. It supplies neither surveyed floor elevations nor clearances.
|
|
197
|
+
The default infers a straight grade between terrain heights at the complete route's endpoints,
|
|
198
|
+
with 6.5 m road, 6 m rail and 3.5 m path clearance and the existing transport width defaults.
|
|
199
|
+
These are approximate interiors, not surveyed tunnel geometry. Semantic providers can supply
|
|
200
|
+
`tunnelFloorElevation` (absolute world Y) and `tunnelClearance`; the MVT decoder accepts
|
|
201
|
+
`tunnel_floor_elevation` and `tunnel_clearance`/`tunnel_height`, or configurable property names.
|
|
202
|
+
|
|
203
|
+
Fragments are clipped out of their tile buffers and joined across neighboring tiles before
|
|
204
|
+
grading, so tile boundaries do not create portals or conflicting floor heights. Searches are
|
|
205
|
+
bounded to 16 tiles. Unresolved long routes and branches are omitted rather than assigning a
|
|
206
|
+
terrain height to an underground tile boundary. Tunnel inference runs at the finest source
|
|
207
|
+
feature level and above. Hiding the Human layer also removes its portal cuts and navigation
|
|
208
|
+
support; the original elevation heightfield always remains available for surface anchoring.
|
|
209
|
+
|
|
210
|
+
Custom package hosts opt in with `createTerrainPackageSemanticLayers` (or its profiled variant),
|
|
211
|
+
passing `tunnels: { heights: elevationSource }` alongside their feature renderer. Share the
|
|
212
|
+
elevation source returned by `openTerrainPackagePyramid` with the terrain stream.
|
|
213
|
+
`withTerrainTunnels` wraps a custom semantic renderer, and `sampleTerrainTunnel(root, x, y, z)`
|
|
214
|
+
returns a visible bore's floor and ceiling in the root's coordinate frame. Observers above the
|
|
215
|
+
ceiling continue using the surface height. Static hosts can use `createTerrainTunnelObject`
|
|
216
|
+
with complete route lines and a ground sampler that covers both portals.
|
|
217
|
+
|
|
172
218
|
## Lines beyond roads
|
|
173
219
|
|
|
174
220
|
`createTerrainLinearObject(lines, context, profile)` is independent of road semantics. Lines use
|
|
@@ -291,6 +291,9 @@ stream the tile payloads to disk in tile-id order (`pmtilesTileId(z, x, y)`) and
|
|
|
291
291
|
`createPmtilesPrefix(records, dataLength, options)` in front of them. Official readers fetch only the
|
|
292
292
|
first 16 KiB to find the root directory, so the writer moves entries into gzip-compressed leaf
|
|
293
293
|
directories once one root would overflow that window; archives of any size stay readable.
|
|
294
|
+
Internal gzip timestamps are fixed at zero, so identical inputs produce byte-identical archives
|
|
295
|
+
and stable content hashes across rebuilds. Tile payloads are stored verbatim: callers that
|
|
296
|
+
precompress them must also use fixed timestamps to keep the resulting archive reproducible.
|
|
294
297
|
|
|
295
298
|
The optional `surface` block declares `seaLevel` and portable height/slope material bands. If it is
|
|
296
299
|
omitted, the projected-Earth adapter supplies a conservative dirt/sand/grass/rock/snow palette.
|
package/dist/docs-src/llms.txt
CHANGED
|
@@ -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.
|
|
7
|
+
Engine version: 0.0.5. 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
|
|
|
@@ -171,6 +171,106 @@ Per-asset metadata written by `molen asset import`: bounds + collision geometry
|
|
|
171
171
|
"pattern": "^sha256:[0-9a-f]{64}$",
|
|
172
172
|
"description": "'sha256:<hex>' of the pre-import source file."
|
|
173
173
|
},
|
|
174
|
+
"runtimeLods": {
|
|
175
|
+
"type": "object",
|
|
176
|
+
"properties": {
|
|
177
|
+
"recipe": {
|
|
178
|
+
"type": "integer",
|
|
179
|
+
"exclusiveMinimum": 0,
|
|
180
|
+
"maximum": 9007199254740991
|
|
181
|
+
},
|
|
182
|
+
"recipeHash": {
|
|
183
|
+
"type": "string",
|
|
184
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
185
|
+
},
|
|
186
|
+
"masterHash": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
189
|
+
},
|
|
190
|
+
"levels": {
|
|
191
|
+
"minItems": 4,
|
|
192
|
+
"maxItems": 4,
|
|
193
|
+
"type": "array",
|
|
194
|
+
"items": {
|
|
195
|
+
"type": "object",
|
|
196
|
+
"properties": {
|
|
197
|
+
"name": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"enum": [
|
|
200
|
+
"skyline",
|
|
201
|
+
"district",
|
|
202
|
+
"street",
|
|
203
|
+
"closeup"
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
"file": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"minLength": 1,
|
|
209
|
+
"pattern": "^(?![A-Za-z]:|[/\\\\])(?!.*\\\\)(?!.*(?:^|\\/)\\.\\.(?:\\/|$)).+$"
|
|
210
|
+
},
|
|
211
|
+
"hash": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
214
|
+
},
|
|
215
|
+
"bytes": {
|
|
216
|
+
"type": "integer",
|
|
217
|
+
"exclusiveMinimum": 0,
|
|
218
|
+
"maximum": 9007199254740991
|
|
219
|
+
},
|
|
220
|
+
"gzipBytes": {
|
|
221
|
+
"type": "integer",
|
|
222
|
+
"exclusiveMinimum": 0,
|
|
223
|
+
"maximum": 9007199254740991
|
|
224
|
+
},
|
|
225
|
+
"triangles": {
|
|
226
|
+
"type": "integer",
|
|
227
|
+
"exclusiveMinimum": 0,
|
|
228
|
+
"maximum": 9007199254740991
|
|
229
|
+
},
|
|
230
|
+
"cpuBytes": {
|
|
231
|
+
"type": "integer",
|
|
232
|
+
"exclusiveMinimum": 0,
|
|
233
|
+
"maximum": 9007199254740991
|
|
234
|
+
},
|
|
235
|
+
"gpuBytes": {
|
|
236
|
+
"type": "integer",
|
|
237
|
+
"exclusiveMinimum": 0,
|
|
238
|
+
"maximum": 9007199254740991
|
|
239
|
+
},
|
|
240
|
+
"errorMeters": {
|
|
241
|
+
"type": "number",
|
|
242
|
+
"minimum": 0
|
|
243
|
+
},
|
|
244
|
+
"drawCalls": {
|
|
245
|
+
"type": "integer",
|
|
246
|
+
"exclusiveMinimum": 0,
|
|
247
|
+
"maximum": 9007199254740991
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"required": [
|
|
251
|
+
"name",
|
|
252
|
+
"file",
|
|
253
|
+
"hash",
|
|
254
|
+
"bytes",
|
|
255
|
+
"gzipBytes",
|
|
256
|
+
"triangles",
|
|
257
|
+
"cpuBytes",
|
|
258
|
+
"gpuBytes",
|
|
259
|
+
"errorMeters",
|
|
260
|
+
"drawCalls"
|
|
261
|
+
],
|
|
262
|
+
"additionalProperties": false
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"required": [
|
|
267
|
+
"recipe",
|
|
268
|
+
"masterHash",
|
|
269
|
+
"levels"
|
|
270
|
+
],
|
|
271
|
+
"additionalProperties": false,
|
|
272
|
+
"description": "Separately fetchable source-derived runtime LODs, bound to the master hash."
|
|
273
|
+
},
|
|
174
274
|
"bounds": {
|
|
175
275
|
"type": "object",
|
|
176
276
|
"properties": {
|
package/dist/index.d.mts
CHANGED
|
@@ -260,6 +260,10 @@ interface ScreenshotInput {
|
|
|
260
260
|
clearColor?: string;
|
|
261
261
|
/** Enable the viewer's shared procedural sky/ground reflections for PBR metals and glass. */
|
|
262
262
|
reflections?: boolean;
|
|
263
|
+
/** Enable multisample antialiasing for fine model detail; default false for golden captures. */
|
|
264
|
+
antialias?: boolean;
|
|
265
|
+
/** Fit enabled sun shadows to loaded scene bounds; default false for existing captures. */
|
|
266
|
+
fitShadows?: boolean;
|
|
263
267
|
}
|
|
264
268
|
interface RenderStats {
|
|
265
269
|
entitiesRendered: number;
|
|
@@ -298,6 +302,8 @@ interface AssetShotInput {
|
|
|
298
302
|
clearColor?: string;
|
|
299
303
|
/** Enable the viewer's shared procedural sky/ground reflection environment. */
|
|
300
304
|
reflections?: boolean;
|
|
305
|
+
/** Enable multisample antialiasing for fine model detail; default false for golden captures. */
|
|
306
|
+
antialias?: boolean;
|
|
301
307
|
outDir: string;
|
|
302
308
|
}
|
|
303
309
|
interface AssetShotOutput {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, G as schemaToTsType, H as describeOps, L as exportFrames, N as generateTypes, O as extractContentPack, P as renderTypesModule, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, V as OPS_CATALOG, W as checkScripts, X as stageAssets, Y as ASSET_INDEX_FILE, Z as screenshotAsset, a as lineupBatchDoc, at as findProjectFile, b as diffSnapshots, c as validateAsset, ct as loadSetupLike, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, ft as registerExperiencePlaySchema, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, lt as updateProjectFile, m as getSchemaOp, n as worldgenStats, nt as listAssets, o as loadStylePackFromDisk, ot as loadProject, p as getComponentOp, r as previewWorldgen, rt as assetFileIndex, s as simWatch, st as loadSceneDocument, tt as inspectAsset, u as testTypes, ut as parseExperiencePlayScenario, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates, z as locateDocsRoot } from "./ops-
|
|
1
|
+
import { A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, G as schemaToTsType, H as describeOps, L as exportFrames, N as generateTypes, O as extractContentPack, P as renderTypesModule, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, V as OPS_CATALOG, W as checkScripts, X as stageAssets, Y as ASSET_INDEX_FILE, Z as screenshotAsset, a as lineupBatchDoc, at as findProjectFile, b as diffSnapshots, c as validateAsset, ct as loadSetupLike, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, ft as registerExperiencePlaySchema, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, lt as updateProjectFile, m as getSchemaOp, n as worldgenStats, nt as listAssets, o as loadStylePackFromDisk, ot as loadProject, p as getComponentOp, r as previewWorldgen, rt as assetFileIndex, s as simWatch, st as loadSceneDocument, tt as inspectAsset, u as testTypes, ut as parseExperiencePlayScenario, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates, z as locateDocsRoot } from "./ops-CErtZh2t.mjs";
|
|
2
2
|
import { access, copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { PNG } from "pngjs";
|
|
4
4
|
import { dirname } from "node:path";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as formatPacked, A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as previewFigure, H as describeOps, I as listFigurePresets, J as checkSoundbank, K as planAudio, L as exportFrames, M as bakeNetwork, N as generateTypes, O as extractContentPack, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, W as checkScripts, X as stageAssets, Z as screenshotAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as listAssets, p as getComponentOp, q as importSound, r as previewWorldgen, tt as inspectAsset, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates } from "./ops-
|
|
1
|
+
import { $ as formatPacked, A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as previewFigure, H as describeOps, I as listFigurePresets, J as checkSoundbank, K as planAudio, L as exportFrames, M as bakeNetwork, N as generateTypes, O as extractContentPack, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, W as checkScripts, X as stageAssets, Z as screenshotAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as listAssets, p as getComponentOp, q as importSound, r as previewWorldgen, tt as inspectAsset, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates } from "./ops-CErtZh2t.mjs";
|
|
2
2
|
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -6,7 +6,7 @@ import { applyUvPaint, bakeMatGraph, bakePalette, bakePixelGrid, bakeSvg } from
|
|
|
6
6
|
import { TransportNetwork, ambientCapability, ambientOf, networkToDocument } from "@bendyline/molen-ambient/kernel";
|
|
7
7
|
import { FIGURE_PRESET_IDS, deriveRig, descriptorKey, figuresScriptApi, generateFigureBody, installFigures, resolveFigureDescriptor, strideRateFor } from "@bendyline/molen-figures/kernel";
|
|
8
8
|
import { heightfieldFromPng, terrainPyramidTileOrigin, terrainPyramidTileSize, wgs84ToWebMercatorTile, worldToWgs84 } from "@bendyline/molen-terrain/kernel";
|
|
9
|
-
import { createLandmarkLibrary, encodeGlb, generateLandmarkModel, generateWorldgenBatch, groundSamplerForBatch, resolveStylePackDocuments, stylePackAssetIndex,
|
|
9
|
+
import { createLandmarkLibrary, encodeGlb, generateLandmarkModel, generateWorldgenBatch, groundSamplerForBatch, resolveStylePackDocuments, stylePackAssetIndex, validateStylePackBundle } from "@bendyline/molen-worldgen/kernel";
|
|
10
10
|
import { createPlacesContent, createRegionResolver, semanticTileToBatch, tileGroundSampler, worldgenTileBudgetForQuality } from "@bendyline/molen-worldgen-earth/kernel";
|
|
11
11
|
import { evaluateCameraTrack, registerCameraTrackSchema } from "@bendyline/molen-client/camera-track";
|
|
12
12
|
import { createReadStream, watch } from "node:fs";
|
|
@@ -1043,12 +1043,17 @@ function buildStats(doc, sizeBytes) {
|
|
|
1043
1043
|
const root = doc.getRoot();
|
|
1044
1044
|
let triangles = 0;
|
|
1045
1045
|
let vertices = 0;
|
|
1046
|
+
const positions = /* @__PURE__ */ new Set();
|
|
1046
1047
|
let primitives = 0;
|
|
1047
1048
|
for (const mesh of root.listMeshes()) {
|
|
1048
1049
|
triangles += primTriangleCount(mesh);
|
|
1049
1050
|
for (const prim of mesh.listPrimitives()) {
|
|
1050
1051
|
primitives++;
|
|
1051
|
-
|
|
1052
|
+
const position = prim.getAttribute("POSITION");
|
|
1053
|
+
if (position && !positions.has(position)) {
|
|
1054
|
+
positions.add(position);
|
|
1055
|
+
vertices += position.getCount();
|
|
1056
|
+
}
|
|
1052
1057
|
}
|
|
1053
1058
|
}
|
|
1054
1059
|
return {
|
|
@@ -1605,8 +1610,12 @@ async function inspectAsset(input) {
|
|
|
1605
1610
|
} catch (e) {
|
|
1606
1611
|
verifyErrors.push(`${trimesh.bin}: ${e.message}`);
|
|
1607
1612
|
}
|
|
1613
|
+
if (sidecar.runtimeLods && sidecar.runtimeLods.masterHash !== sidecar.hash) verifyErrors.push("runtimeLods: stale master hash");
|
|
1614
|
+
for (const level of sidecar.runtimeLods?.levels ?? []) if (sidecar.files.variants[level.name] !== level.file) verifyErrors.push(`runtimeLods: missing or mismatched variant "${level.name}"`);
|
|
1608
1615
|
for (const [name, file] of Object.entries(sidecar.files.variants)) try {
|
|
1609
|
-
await readFile(join(dir, file));
|
|
1616
|
+
const bytes = await readFile(join(dir, file));
|
|
1617
|
+
const level = sidecar.runtimeLods?.levels.find((level) => level.name === name);
|
|
1618
|
+
if (level && (level.file !== file || level.bytes !== bytes.byteLength || level.hash !== sha256$2(bytes))) verifyErrors.push(`variant "${name}" (${file}): runtime LOD hash/size mismatch`);
|
|
1610
1619
|
} catch (e) {
|
|
1611
1620
|
verifyErrors.push(`variant "${name}" (${file}): ${e.message}`);
|
|
1612
1621
|
}
|
|
@@ -2080,6 +2089,7 @@ async function screenshotAssetImpl(input) {
|
|
|
2080
2089
|
terrain: null,
|
|
2081
2090
|
clearColor: input.clearColor ?? "#181d24",
|
|
2082
2091
|
reflections: input.reflections ?? false,
|
|
2092
|
+
antialias: input.antialias ?? false,
|
|
2083
2093
|
assetsBaseUrl: `${server.url}/files/`,
|
|
2084
2094
|
assetsIndex: { [sidecar.id]: modelUrlRel }
|
|
2085
2095
|
};
|
|
@@ -7060,6 +7070,8 @@ async function screenshotSceneImpl(input) {
|
|
|
7060
7070
|
terrain: terrainPayload ?? null,
|
|
7061
7071
|
clearColor,
|
|
7062
7072
|
reflections: input.reflections ?? false,
|
|
7073
|
+
antialias: input.antialias ?? false,
|
|
7074
|
+
fitShadows: input.fitShadows ?? false,
|
|
7063
7075
|
assetsBaseUrl: filesRoot !== void 0 ? `${server.url}/files/` : null,
|
|
7064
7076
|
assetsIndex: assetsIndex ?? null
|
|
7065
7077
|
};
|
|
@@ -7639,10 +7651,39 @@ async function contentPacksFor(options = {}) {
|
|
|
7639
7651
|
return openProjectPacks(project, { cwd });
|
|
7640
7652
|
}
|
|
7641
7653
|
/**
|
|
7654
|
+
* A pack source directory read in place: its id and roles from the settings file, and documents
|
|
7655
|
+
* straight from disk. Opening it as a `Pack` would read and hash every file it includes (for the
|
|
7656
|
+
* default worldgen pack, gigabytes of structure GLBs) only to find the few documents read here.
|
|
7657
|
+
*/
|
|
7658
|
+
var SourceDirectory = class {
|
|
7659
|
+
label;
|
|
7660
|
+
manifest;
|
|
7661
|
+
constructor(label, manifest) {
|
|
7662
|
+
this.label = label;
|
|
7663
|
+
this.manifest = manifest;
|
|
7664
|
+
}
|
|
7665
|
+
async readJson(path) {
|
|
7666
|
+
const target = resolve(this.label, ...path.split("/"));
|
|
7667
|
+
if (!target.startsWith(this.label + sep)) throw new Error(`pack "${this.manifest.id}" has no file "${path}"`);
|
|
7668
|
+
return parseJson(await readFile(target, "utf8"));
|
|
7669
|
+
}
|
|
7670
|
+
};
|
|
7671
|
+
async function openSourceDirectory(dir) {
|
|
7672
|
+
const path = join(dir, PACK_SOURCE_FILE);
|
|
7673
|
+
const parsed = validate("pack-source", parseJson(await readFile(path, "utf8")));
|
|
7674
|
+
if (!parsed.ok) throw new Error(`${path}:\n${parsed.formatted}`);
|
|
7675
|
+
const provides = Object.fromEntries(Object.entries(parsed.value.provides).map(([role, paths]) => [role, typeof paths === "string" ? [paths] : [...paths]]));
|
|
7676
|
+
return new SourceDirectory(dir, {
|
|
7677
|
+
id: parsed.value.id,
|
|
7678
|
+
provides
|
|
7679
|
+
});
|
|
7680
|
+
}
|
|
7681
|
+
/**
|
|
7642
7682
|
* A directory holding a pack's files: a pack source directory is used as it is; a built or
|
|
7643
7683
|
* downloaded pack is extracted once into the cache, keyed by its content hash.
|
|
7644
7684
|
*/
|
|
7645
7685
|
async function packDirectory(pack) {
|
|
7686
|
+
if (pack instanceof SourceDirectory) return pack.label;
|
|
7646
7687
|
try {
|
|
7647
7688
|
if ((await stat(pack.label)).isDirectory()) return pack.label;
|
|
7648
7689
|
} catch {}
|
|
@@ -7659,9 +7700,11 @@ const isUrl = (path) => /^https?:\/\//.test(path);
|
|
|
7659
7700
|
/** A path that names a content pack (built file, URL, or source directory) rather than a document. */
|
|
7660
7701
|
async function asContentPack(path) {
|
|
7661
7702
|
if (isUrl(path) || path.endsWith(".zip")) return openContentPack(path, process.cwd());
|
|
7703
|
+
let source = false;
|
|
7662
7704
|
try {
|
|
7663
|
-
|
|
7705
|
+
source = (await stat(join(path, PACK_SOURCE_FILE))).isFile();
|
|
7664
7706
|
} catch {}
|
|
7707
|
+
return source ? openSourceDirectory(resolve(path)) : void 0;
|
|
7665
7708
|
}
|
|
7666
7709
|
/** Where `role` comes from: the named pack when it provides it, else the project's packs. */
|
|
7667
7710
|
async function providedBy(role, own, options) {
|
|
@@ -8265,7 +8308,7 @@ async function previewWorldgenImpl(input) {
|
|
|
8265
8308
|
filesBaseUrl,
|
|
8266
8309
|
assetIndex: stylePackAssetIndex(pack, filesBaseUrl),
|
|
8267
8310
|
landmarks,
|
|
8268
|
-
materialRefs:
|
|
8311
|
+
materialRefs: [...new Set(output.buildings?.groups.map((group) => group.materialRef) ?? [])],
|
|
8269
8312
|
ground: {
|
|
8270
8313
|
y: groundY,
|
|
8271
8314
|
minX: bounds.min[0] - extent,
|
|
@@ -189,21 +189,21 @@
|
|
|
189
189
|
}
|
|
190
190
|
],
|
|
191
191
|
"versions": {
|
|
192
|
-
"@bendyline/molen-ambient": "0.0.
|
|
193
|
-
"@bendyline/molen-client": "0.0.
|
|
194
|
-
"@bendyline/molen-earth": "0.0.
|
|
195
|
-
"@bendyline/molen-entities": "0.0.
|
|
196
|
-
"@bendyline/molen-figures": "0.0.
|
|
197
|
-
"@bendyline/molen-input-react": "0.0.
|
|
198
|
-
"@bendyline/molen-kernel": "0.0.
|
|
199
|
-
"@bendyline/molen-materials": "0.0.
|
|
200
|
-
"@bendyline/molen-pack": "0.0.
|
|
201
|
-
"@bendyline/molen-pathfinding": "0.0.
|
|
202
|
-
"@bendyline/molen-physics-rapier": "0.0.
|
|
203
|
-
"@bendyline/molen-schema": "0.0.
|
|
204
|
-
"@bendyline/molen-terrain": "0.0.
|
|
205
|
-
"@bendyline/molen-tooling": "0.0.
|
|
206
|
-
"@bendyline/molen-worldgen": "0.0.
|
|
207
|
-
"@bendyline/molen-worldgen-earth": "0.0.
|
|
192
|
+
"@bendyline/molen-ambient": "0.0.8",
|
|
193
|
+
"@bendyline/molen-client": "0.0.7",
|
|
194
|
+
"@bendyline/molen-earth": "0.0.8",
|
|
195
|
+
"@bendyline/molen-entities": "0.0.7",
|
|
196
|
+
"@bendyline/molen-figures": "0.0.7",
|
|
197
|
+
"@bendyline/molen-input-react": "0.0.7",
|
|
198
|
+
"@bendyline/molen-kernel": "0.0.5",
|
|
199
|
+
"@bendyline/molen-materials": "0.0.6",
|
|
200
|
+
"@bendyline/molen-pack": "0.0.6",
|
|
201
|
+
"@bendyline/molen-pathfinding": "0.0.5",
|
|
202
|
+
"@bendyline/molen-physics-rapier": "0.0.5",
|
|
203
|
+
"@bendyline/molen-schema": "0.0.5",
|
|
204
|
+
"@bendyline/molen-terrain": "0.0.8",
|
|
205
|
+
"@bendyline/molen-tooling": "0.0.8",
|
|
206
|
+
"@bendyline/molen-worldgen": "0.0.7",
|
|
207
|
+
"@bendyline/molen-worldgen-earth": "0.0.8"
|
|
208
208
|
}
|
|
209
209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/molen-tooling",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
"pmtiles": "4.3.2",
|
|
62
62
|
"pngjs": "^7.0.0",
|
|
63
63
|
"quickhull3d": "3.1.1",
|
|
64
|
-
"sharp": "0.35.
|
|
64
|
+
"sharp": "0.35.5",
|
|
65
65
|
"zod": "^4.6.5",
|
|
66
|
-
"@bendyline/molen-ambient": "0.0.
|
|
67
|
-
"@bendyline/molen-
|
|
68
|
-
"@bendyline/molen-
|
|
69
|
-
"@bendyline/molen-
|
|
70
|
-
"@bendyline/molen-pack": "0.0.
|
|
71
|
-
"@bendyline/molen-
|
|
72
|
-
"@bendyline/molen-
|
|
73
|
-
"@bendyline/molen-
|
|
74
|
-
"@bendyline/molen-worldgen-earth": "0.0.
|
|
75
|
-
"@bendyline/molen-
|
|
76
|
-
"@bendyline/molen-
|
|
66
|
+
"@bendyline/molen-ambient": "0.0.8",
|
|
67
|
+
"@bendyline/molen-kernel": "0.0.5",
|
|
68
|
+
"@bendyline/molen-client": "0.0.7",
|
|
69
|
+
"@bendyline/molen-materials": "0.0.6",
|
|
70
|
+
"@bendyline/molen-pack": "0.0.6",
|
|
71
|
+
"@bendyline/molen-figures": "0.0.7",
|
|
72
|
+
"@bendyline/molen-terrain": "0.0.8",
|
|
73
|
+
"@bendyline/molen-worldgen": "0.0.7",
|
|
74
|
+
"@bendyline/molen-worldgen-earth": "0.0.8",
|
|
75
|
+
"@bendyline/molen-schema": "0.0.5",
|
|
76
|
+
"@bendyline/molen-physics-rapier": "0.0.5"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@biomejs/biome": "^2.5.0",
|