feat(renderer/roofs): 还原原版暗黑2建筑/城门屋顶与过道拱梁遮挡消失机制(修复哈洛加斯等城门盲区) #72
Labels
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: troytt/diablo2-web#72
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
1. 现象描述与现场定位
在第五幕哈洛加斯(Harrogath)城门西出口(连接血腥丘陵 Bloody Foothills,
townWest.ds1)处:cellX = 7..8, cellY = 30)。alpha = 1.0),未发生任何衰减或消失,严重阻挡门洞及后方视野。alpha = 0.0),让玩家能够清晰看到门洞内部、穿行动线以及后方地形。2. 根因技术剖析(Root Cause Analysis)
审计当前
src/render/roofs.ts与src/game/d2map.ts,存在以下 4 处深层缺陷:缺陷一:等轴测投影高度位移导致 2D Bounding Box 碰撞脱节
roofHeight(哈洛加斯城门屋顶roofHeight = 160像素)。d2map.ts中,屋顶贴图坐标被向上平移:y = orthoY - tile.roofHeight。isPlayerOverlappingRoofBounds采用屏幕像素级 2D AABB 判定。当玩家站在地面(y ~ 1480)时,高空的屋顶贴图 AABB(y ~ 1200)在 Y 轴上与地面角色框完全错开,导致 AABB 判定恒为false。缺陷二:城门过道间隙导致聚类断裂(Clustering Disconnection)
clusterRoofs算法基于clusterCellDistance = 2进行图连通分支聚类。cellX = 7..10):cellX = 5..7, cellY = 27..29(Cluster 2)。cellX = 10..12, cellY = 21..27(Cluster 1)。cellX = 8, cellY = 30时,既不属于 Cluster 1 也不属于 Cluster 2 的cells集合,被判定为“室外”,完全漏检。缺陷三:过门拱廊瓦片未纳入屋顶遮挡层(Type 12/14 遗漏)
townWest.ds1中,跨越通道上方的拱门与连接结构采用了type 12(Pillar/Archway 柱石拱顶)与type 14(Overhead Wall 跨空上层墙)。wall.type === 15(TileRoof)分离到rawRoofs,而将type 12和type 14留在了普通墙面rawWalls中,普通墙面不支持动态 Fade,始终 100% 不透明渲染。缺陷四:遮挡透明度目标不匹配(0.25 vs 0.0)
DEFAULT_MIN_ROOF_ALPHA = 0.25,即便触发遮挡,也仍残留 25% 的不透明度。alpha = 0.0),视线零阻碍。3. 改造任务与实施计划
roofHeight与等轴测角度沿视线向地面投射有效遮挡足迹(Footprint)。type 12与type 14中高空跨梁),纳入动态可淡化图���。0.0(完全隐去),还原原版遮挡消失体验。4. 验收标准
alpha = 0.0)。alpha = 1.0)。tests/roofs.test.ts补充哈洛加斯城门与跨道廊桥遮挡测试用例,全量回归 100% 通过。