Add configurable area asset budgets
This commit is contained in:
39
.trellis/tasks/08-04-add-area-asset-budgets/design.md
Normal file
39
.trellis/tasks/08-04-add-area-asset-budgets/design.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Area asset budgets design
|
||||
|
||||
## Boundaries
|
||||
|
||||
`scripts/lib/area-config.js` 归一化配置的 `budget`。`scripts/glb-digest.js` 承担 GLB
|
||||
结构统计和 source/image 摘要;`scripts/lib/stage-manifest.js` 承担默认预算、覆盖合并、
|
||||
判定和 warning 文本。`scripts/lib/area-diagnostics.js` 只消费这两个共享事实源,并向
|
||||
diagnose/check 报告结果。
|
||||
|
||||
## Data Flow
|
||||
|
||||
```text
|
||||
config budget + global defaults
|
||||
-> normalizeAreaConfig()
|
||||
GLB JSON -> digest() -> usage + source/image summaries
|
||||
-> evaluateGlbBudget(digest, area.budget)
|
||||
-> stage manifest summary/warnings
|
||||
-> diagnose report / check failures
|
||||
```
|
||||
|
||||
预算字段面向用户使用 `glbSizeMb`,内部归一化为 bytes;其余计数为整数。有效预算对象应始终
|
||||
完整,避免 consumers 自己回退默认值。
|
||||
|
||||
## Attribution
|
||||
|
||||
`digest()` 将每个 node 的 mesh primitives 转为 triangles,并按有限、稳定的名称规则分组
|
||||
(building、foliage、roads、water、fountain、other)。同一 mesh 被多个 node 引用时,source
|
||||
summary 统计实例化后的渲染 triangles;它用于帧渲染复杂度而非 GLB 静态字节。图片条目从
|
||||
`bufferViews[image.bufferView].byteLength` 读取 embedded bytes,并按 bytes 排序。
|
||||
|
||||
## Compatibility
|
||||
|
||||
没有 `budget` 的区域仍使用当前全局 25 MB / 1000 nodes / 24 images,并增加 triangles 和
|
||||
embedded image bytes 的默认阈值。旧 stage manifest 可被读取;新字段只在后续 Cesium / compress
|
||||
阶段写入。现有 `check:area` 保持超预算失败。
|
||||
|
||||
## Rollback
|
||||
|
||||
移除配置归一化、预算评估和扩展摘要即可回退到固定三项预算;旧 manifest 中的附加字段可忽略。
|
||||
Reference in New Issue
Block a user