类 | |
| struct | GridConfig |
枚举 | |
| enum class | GridLayout { Rectangle , Hexagon , Isometric , Staggered , IsometricZAsY } |
| enum class | StaggerAxis { X , Y } |
| enum class | StaggerIndex { Odd , Even } |
| enum class | GridPlane { XY , XZ } |
函数 | |
| float | cellPitchX (const GridConfig &cfg) |
| float | cellPitchY (const GridConfig &cfg) |
| void | cellToWorld (const GridConfig &cfg, int cx, int cy, float &px, float &py) |
| float | cellToDepthY (const GridConfig &cfg, int cx, int cy) |
| void | worldToCell (const GridConfig &cfg, float px, float py, int &cx, int &cy, int mapW, int mapH) |
| void | foreachRotatedFootprint (int w, int h, const std::vector< uint8_t > &mask, int steps, bool hexMode, const std::function< void(int lx, int ly)> &fn) |
| void | rotatedFootprintSize (int w, int h, const std::vector< uint8_t > &mask, int steps, bool hexMode, int &outW, int &outH) |
枚举类型说明
◆ GridLayout
|
strong |
| 枚举值 | |
|---|---|
| Rectangle | |
| Hexagon | |
| Isometric | |
| Staggered | |
| IsometricZAsY | |
在文件 GridConfig.h 第 11 行定义.
◆ GridPlane
|
strong |
放置平面轴: XY —— 网格第二轴映射到世界 Y(2D tilemap / 俯视 2D 场景,默认)。 XZ —— 网格第二轴映射到世界 Z,世界 Y 为垂直高度(3D 场景地面网格)。
| 枚举值 | |
|---|---|
| XY | |
| XZ | |
在文件 GridConfig.h 第 20 行定义.
◆ StaggerAxis
|
strong |
| 枚举值 | |
|---|---|
| X | |
| Y | |
在文件 GridConfig.h 第 12 行定义.
◆ StaggerIndex
|
strong |
| 枚举值 | |
|---|---|
| Odd | |
| Even | |
在文件 GridConfig.h 第 13 行定义.
函数说明
◆ cellPitchX()
|
inline |
单元有效间距(含 gap)。
在文件 GridConfig.h 第 43 行定义.
引用了 eve::grid::GridConfig::cellGapX , 以及 eve::grid::GridConfig::cellW.
被这些函数引用 cellToWorld() , 以及 worldToCell().
◆ cellPitchY()
|
inline |
在文件 GridConfig.h 第 44 行定义.
引用了 eve::grid::GridConfig::cellGapY , 以及 eve::grid::GridConfig::cellH.
被这些函数引用 cellToWorld() , 以及 worldToCell().
◆ cellToDepthY()
| float eve::grid::cellToDepthY | ( | const GridConfig & | cfg, |
| int | cx, | ||
| int | cy | ||
| ) |
2D 排序键(格脚点 Y,与 map::tileToDepthY 语义一致);XZ 平面不使用。
在文件 GridProjection.cpp 第 63 行定义.
引用了 eve::grid::GridConfig::cellH, cellToWorld(), cx, cy , 以及 px.
被这些函数引用 eve::map::tileToDepthY().
◆ cellToWorld()
| void eve::grid::cellToWorld | ( | const GridConfig & | cfg, |
| int | cx, | ||
| int | cy, | ||
| float & | px, | ||
| float & | py | ||
| ) |
cell -> 平面坐标 (px, py)。XY 平面:世界 (x, y);XZ 平面:世界 (x, z)。
在文件 GridProjection.cpp 第 30 行定义.
引用了 cellPitchX(), cellPitchY(), cx, cy, Hexagon, eve::grid::GridConfig::hexSideLength, Isometric, IsometricZAsY, eve::grid::GridConfig::layout, eve::grid::GridConfig::originX, eve::grid::GridConfig::originY, px, Rectangle, eve::grid::GridConfig::staggerAxis, Staggered , 以及 Y.
被这些函数引用 cellToDepthY(), eve::building::PlacementWorld::cellToWorld3D(), eve::building::PlacementWorld::cellToWorldPlane(), eve::building::PlacementWorld::cellToWorldX(), eve::building::PlacementWorld::cellToWorldY(), eve::map::tileToWorld() , 以及 worldToCell().
◆ foreachRotatedFootprint()
| void eve::grid::foreachRotatedFootprint | ( | int | w, |
| int | h, | ||
| const std::vector< uint8_t > & | mask, | ||
| int | steps, | ||
| bool | hexMode, | ||
| const std::function< void(int lx, int ly)> & | fn | ||
| ) |
旋转后的占地局部格枚举。mask 为行主序 w*h(空 = 实心矩形)。 steps:cardinal 为 90° 步数(0..3);hexMode 为 60° 步数(0..5)。 回调收到归一化局部坐标(旋转后包围盒最小角归零,原点格为锚点)。
在文件 GridProjection.cpp 第 121 行定义.
引用了 c, fn, h, idx, s, w, x, y , 以及 z.
被这些函数引用 eve::building::PlacementSystem::foreachFootprintCell() , 以及 rotatedFootprintSize().
◆ rotatedFootprintSize()
| void eve::grid::rotatedFootprintSize | ( | int | w, |
| int | h, | ||
| const std::vector< uint8_t > & | mask, | ||
| int | steps, | ||
| bool | hexMode, | ||
| int & | outW, | ||
| int & | outH | ||
| ) |
旋转后的占地包围盒尺寸。
在文件 GridProjection.cpp 第 187 行定义.
引用了 foreachRotatedFootprint(), h , 以及 w.
被这些函数引用 eve::building::PlacementSystem::effectiveFootprint().
◆ worldToCell()
| void eve::grid::worldToCell | ( | const GridConfig & | cfg, |
| float | px, | ||
| float | py, | ||
| int & | cx, | ||
| int & | cy, | ||
| int | mapW = 1, |
||
| int | mapH = 1 |
||
| ) |
平面坐标 -> 最近格子。staggered / hex 采用有界最近邻搜索 (mapW / mapH 提供搜索范围,与 Tiled 拾取语义一致)。
在文件 GridProjection.cpp 第 69 行定义.
引用了 a, b, eve::grid::GridConfig::cellH, cellPitchX(), cellPitchY(), cellToWorld(), eve::grid::GridConfig::cellW, cx, cy, d, h, Isometric, IsometricZAsY, eve::grid::GridConfig::layout, eve::grid::GridConfig::originX, eve::grid::GridConfig::originY, px, Rectangle, w, x , 以及 y.
被这些函数引用 eve::building::PlacementSystem::ensureBuiltins(), eve::building::PlacementWorld::worldToCell3D(), eve::building::PlacementWorld::worldToCellX(), eve::building::PlacementWorld::worldToCellY() , 以及 eve::map::worldToTile().