Add optional GLB compression stage

This commit is contained in:
2026-08-03 17:50:21 +08:00
parent 5ef128c6f9
commit 7ba85946dc
13 changed files with 738 additions and 15 deletions

View File

@@ -12,7 +12,7 @@
```
config/areas/<id>.json ← 你写的
│ build-area.js: normalizeAreaConfig() 补默认值 + 推导 14 个输出路径
│ build-area.js: normalizeAreaConfig() 补默认值 + 推导输出路径
<areaDir>/_pipeline/osm2streets-qgis.config.json ← 生成的,不要手改
@@ -52,6 +52,7 @@ cp config/examples/template.json config/areas/my-area.json
| `qgis` | | 见下 | QGIS/osm2streets 旋钮 |
| `osm2streets` | | 见下 | 透传给 osm2streets 的选项 |
| `blender` | | 见下 | Blender 侧选项 |
| `compress` | | 见下 | 显式 `compress` 阶段的 GLB 压缩选项 |
| `outputs` | | 从 `id` 推导 | 输出路径覆盖,逃生舱 |
**路径一律绝对**`normalizeAreaConfig` 对每一项都做 `path.resolve`,相对路径会
@@ -65,10 +66,11 @@ cp config/examples/template.json config/areas/my-area.json
| `blender` | `true` | |
| `cesium` | `true` | |
`reimport``preview` **在这里配也没用**——`normalizeAreaConfig:117-118` 把它们
`reimport``preview``compress` **在这里配也没用**——`normalizeAreaConfig` 把它们
硬编码为 `false`,只能靠 `--stages` 显式请求。
> 恢复动作reimport补丁动作preview不该被一份配置文件变成默认行为。
> 恢复动作reimport补丁动作preview和替代产物动作compress不该被一份
> 配置文件变成默认行为。
`--stages` 会整体覆盖这里的默认值。
@@ -117,6 +119,18 @@ cp config/examples/template.json config/areas/my-area.json
| `treeStyle` | `"natural"` | 合法值见 `generate_scene.py``TREE_STYLES``natural``procedural``shapespark` |
| `officeOverrides` | `""` | 旧名 `office_overrides` 仍被接受 |
### `compress`
只影响显式 `--stages compress`。默认压缩链是 texture resize + WebP transcode
不覆盖默认 `<area-id>.glb`
| 字段 | 默认 | 说明 |
|---|---|---|
| `textureSize` | `768` | 最大纹理宽高,范围 `64..4096` |
| `quality` | `82` | WebP 质量,范围 `1..100` |
| `effort` | `80` | WebP 编码 effort范围 `0..100` |
| `meshopt` | `false` | 是否追加 `EXT_meshopt_compression`。开启前要单独验证 Cesium 兼容性 |
### `outputs`(逃生舱)
默认全部从 `id` 推导为 `<outputRoot>/<id>/<fileStem>.<ext>`。需要定制时逐项覆盖:
@@ -134,6 +148,7 @@ cp config/examples/template.json config/areas/my-area.json
可覆盖的键(`build-area.js:87-102``areaDir``fileStem``geojsonDir``gpkg`
`qgisProject``qgisPreview``blend``render``glb``metadata``cesiumPreview`
`compressedFileStem``compressedGlb``compressedMetadata``compressedCesiumPreview`
`vehicleRoute``vehicleModel``pipelineDir`
**优先改 `fileStem` 或 `areaDir`**——它们能一次性影响全部派生路径。逐个覆盖容易漏。
@@ -175,7 +190,7 @@ cp config/examples/template.json config/areas/my-area.json
| 布尔字段用 `\|\|` 兜底 | `false` 被翻转 |
| 给新字段造顶层平铺别名 | 扩大历史包袱 |
| 逐个覆盖 `outputs` 而不用 `fileStem` | 漏掉某个产物路径 |
| 在 `stages` 里配 `reimport` / `preview` | 无效,被硬编码为 false |
| 在 `stages` 里配 `reimport` / `preview` / `compress` | 无效,被硬编码为 false |
| 加数值字段不做范围校验 | 错配置在中途才崩,输出已被破坏 |
---