Refactor fountain assembly module

This commit is contained in:
2026-08-03 12:35:51 +08:00
parent 168f57a8e8
commit 627105555f
11 changed files with 268 additions and 51 deletions

View File

@@ -50,7 +50,8 @@
| `mesh.py` | bpy | `MeshBatch``make_prism``add_roof``add_wall_panel``add_polyline`、集合管理 |
| `materials.py` | bpy | 把 `catalog` 的规格变成真实材质:`from_spec()`、贴图、程序化噪声、tint、alpha-clip |
| `tree.py` | bpy | 两个 vendored 模型 → 一套可实例化的运行时形状 |
| `water.py` / `grass.py` / `scrub.py` | bpy | 单一 OSM 要素的装配 |
| `water.py` / `grass.py` / `scrub.py` | bpy | 单一 OSM 要素的装配 |
| `fountain.py` | bpy | 单一 OSM 点要素 `amenity=fountain` 的装配 |
### `geom.py` 的两条隐含约定
@@ -62,7 +63,7 @@
## 要素模块的统一形状
`water.py` / `grass.py` / `scrub.py` 三个要素模块签名一致:
`water.py` / `grass.py` / `scrub.py` 三个要素模块签名一致:
```python
def assemble(ring, [way_id,] scene_xmin, scene_xmax, scene_ymin, scene_ymax,
@@ -83,6 +84,17 @@ def assemble(ring, [way_id,] scene_xmin, scene_xmax, scene_ymin, scene_ymax,
`focus`
4. **不自己找数据**。ring 由 `generate_scene.py` 传入,模块只负责装配
`fountain.py` 是点要素模块,不收 ring 或裁剪边界:
```python
def assemble(name, x, y, collection, materials):
...
```
`generate_scene.py` 仍负责过滤 `amenity=fountain`、检查点是否在范围内、投影坐标、
创建三张 fountain 材质,并维护 `counts["fountain_count"]`。模块只负责在已投影
坐标上创建 basin / water / pedestal / spray objects保持对象名和自定义属性不变。
### 加一种新 OSM 要素
目标形态:**新增一个模块 + 注册一行,不改 `build()`**。

View File

@@ -163,7 +163,7 @@ capturedAt / durationMs / label
|---|---|---|
| P0 | 抽纯函数到 `osmassets/{osm,geom}.py` | ✅ 已完成 |
| P1 | `catalog.py` 单一定义源 + `check_layers` | ✅ 已完成 |
| P2 | 要素注册表 | ⚠️ **部分**——`water/grass/scrub/tree.py` 已拆出,但**没有 `features/` 注册表**`building` / `fountain` / `roads` 仍在 `generate_scene.py` 里 |
| P2 | 要素注册表 | ⚠️ **部分**——`water/grass/scrub/tree/fountain.py` 已拆出,但**没有 `features/` 注册表**`building` / `roads` 仍在 `generate_scene.py` 里 |
| P3 | 材质契约化(自定义属性传递 spec | ✅ 已完成——`catalog.MATERIALS[*]["cesium"]``materials.from_spec()` 写入 `material["cesium_export"]``export_cesium.py` 优先读该属性;四张材质名表仅作旧 `.blend` 回退 |
### 已知缺陷(记录在案,本轮不修)