3 Commits
Author SHA1 Message Date
西风逍遥游 62eb50b6c8 docs(hexmap): 修正注释折行触发的 api-lifetime 误报
`HexSphereTopology::corner` 的 `@return` 说明在 "…is out of / range (…)" 处折行,
使注释续行在架构门禁 check_architecture_contracts 的 POINTER_API 正则下形如
`* range (`,被判定为"公开裸指针 API 缺少所有权与生命周期契约"。

`corner()` 返回的是值类型 `HexVec3`,本身没有所有权可写,因此是把折行位置移开,
而不是补一个不成立的 `@lifetime`。
2026-09-18 18:01:52 +08:00
西风逍遥游 fb3f0d8579 feat(hexmap): 新增二十面体球面后端与 examples/hex-planet 星球示例
在已合入的平面 hexmap 之上增加球面世界,复用其单元记录(HexCellData / HexValues /
HexFlags)、几何常量(HexMetrics)、网格容器(HexMeshData)与地形顶点编码
(HexTerrainVertexCode):

- HexSphereTopology:二十面体(Goldberg)拓扑。单元是细分后二十面体的顶点,
  cellCount = 10f^2 + 2,12 个五边形恒为 [0,12)。方向不是算术:五边形只有 5 条边,
  跨边查询一律走 directionOf(cell, other),因为不存在处处成立的 opposite。
- HexSphereMap:球面对应物。逐格脏标记(球面无分块网格),高程为径向,
  含拾取、距离与笔刷。
- HexSphereMesh:整球地形与海洋网格。平面版用弦 v1->v5 跨越梯田带,这在平面上安全
  只因其 5 个采样点共线;球面采样点在弧上,故按扇形同样拆成 4 段以免 T 型接缝。
- HexSphereGenerator:三维值噪声 fBm、按噪声自身分位数定海平面、生物群系。
- HexMapModule:28 个 hexmap.sphere* 脚本绑定。
- examples/hex-planet:轨道相机 + 两个片元着色器。平面着色器把 vWorldPos.y 当海拔、
  N.y 当“上”、细节噪声投影到 XZ、远处加距离雾,这四点在球面上均不成立。
- test/hexmap_sphere.cpp:31 个用例;docs/usr/modules/hexmap.md 补充球面章节。

验证:hexmap 套件 66/66 通过(含 31 个球面用例);示例实机跑通并自捕获
hex-planet.png。网格闭合性由焊接后的欧拉特征 V - E + F = 2 断言,朝向由
“无内向三角形”断言。
2026-09-18 17:58:01 +08:00
西风逍遥游 af76e3194f feat(hexmap): port the Catlike Coding hex map as a module and interactive example Adds src/modules/hexmap, an editable pointy-top hex grid with 5x5 chunk dirty tracking, per-chunk mesh generation (terrain fans, blend strips, terraces, cliffs, water, river channels, roads, city walls, decorations and a fog overlay), A* pathfinding, reference-counted fog of war, a unit registry with destination-reserving travel, a versioned save payload and a procedural map generator ported from the reference MapGenerator. Ships the interactive example as a new examples/hex-terrain-3d directory; the unrelated mesh.hexterrain procgen example in examples/hex-terrain is left byte-identical to dev. 2026-09-18 10:09:33 +08:00