类 | |
| struct | GridConfig |
| Grid shape, cell metrics, origin, and placement plane. Pure data; use GridProjection helpers for world/cell conversion. 更多... | |
枚举 | |
| enum class | GridLayout { Rectangle , Hexagon , Isometric , Staggered , IsometricZAsY } |
| Cell topology: rectangle, hex, isometric, or staggered variants. 更多... | |
| enum class | StaggerAxis { X , Y } |
| Axis used for odd/even row or column offset in staggered layouts. 更多... | |
| enum class | StaggerIndex { Odd , Even } |
| Whether odd or even indices along the stagger axis are offset. 更多... | |
| enum class | GridPlane { XY , XZ } |
| Placement plane for the second grid axis. XY maps the second axis to world Y (2D tilemaps / top-down). XZ maps the second axis to world Z with world Y as height (3D ground grids). 更多... | |
函数 | |
| float | cellPitchX (const GridConfig &cfg) |
| Effective cell pitch on X including gap. | |
| float | cellPitchY (const GridConfig &cfg) |
| Effective cell pitch on Y including gap. | |
| void | cellToWorld (const GridConfig &cfg, int cx, int cy, float &px, float &py) |
| Maps a cell to planar coordinates (px, py). On XY plane these are world (x, y); on XZ plane they are world (x, z). | |
| float | cellToDepthY (const GridConfig &cfg, int cx, int cy) |
| 2D sort key (cell foot Y), matching map::tileToDepthY semantics. Unused on the XZ plane. | |
| void | worldToCell (const GridConfig &cfg, float px, float py, int &cx, int &cy, int mapW=1, int mapH=1) |
| Maps planar coordinates to the nearest cell. Staggered/hex layouts use a bounded nearest-neighbor search; mapW/mapH bound the search range (Tiled-compatible pick semantics). | |
| 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) |
| Enumerates local cells of a rotated footprint. | |
| void | rotatedFootprintSize (int w, int h, const std::vector< uint8_t > &mask, int steps, bool hexMode, int &outW, int &outH) |
| Axis-aligned size of a footprint after rotation. | |
枚举类型说明
◆ GridLayout
|
strong |
Cell topology: rectangle, hex, isometric, or staggered variants.
| 枚举值 | |
|---|---|
| Rectangle | |
| Hexagon | |
| Isometric | |
| Staggered | |
| IsometricZAsY | |
在文件 GridConfig.h 第 17 行定义.
◆ GridPlane
|
strong |
Placement plane for the second grid axis. XY maps the second axis to world Y (2D tilemaps / top-down). XZ maps the second axis to world Z with world Y as height (3D ground grids).
| 枚举值 | |
|---|---|
| XY | |
| XZ | |
在文件 GridConfig.h 第 28 行定义.
◆ StaggerAxis
|
strong |
◆ StaggerIndex
|
strong |
Whether odd or even indices along the stagger axis are offset.
| 枚举值 | |
|---|---|
| Odd | |
| Even | |
在文件 GridConfig.h 第 21 行定义.
函数说明
◆ cellPitchX()
|
inline |
Effective cell pitch on X including gap.
在文件 GridConfig.h 第 58 行定义.
引用了 eve::grid::GridConfig::cellGapX , 以及 eve::grid::GridConfig::cellW.
被这些函数引用 cellToWorld() , 以及 worldToCell().
◆ cellPitchY()
|
inline |
Effective cell pitch on Y including gap.
在文件 GridConfig.h 第 60 行定义.
引用了 eve::grid::GridConfig::cellGapY , 以及 eve::grid::GridConfig::cellH.
被这些函数引用 cellToWorld() , 以及 worldToCell().
◆ cellToDepthY()
| EVENGINE_API_FOUNDATION float eve::grid::cellToDepthY | ( | const GridConfig & | cfg, |
| int | cx, | ||
| int | cy | ||
| ) |
2D sort key (cell foot Y), matching map::tileToDepthY semantics. Unused on the XZ plane.
在文件 GridProjection.cpp 第 63 行定义.
引用了 eve::grid::GridConfig::cellH, cellToWorld(), cx, cy, px , 以及 py.
被这些函数引用 eve::map::tileToDepthY().
◆ cellToWorld()
| EVENGINE_API_FOUNDATION void eve::grid::cellToWorld | ( | const GridConfig & | cfg, |
| int | cx, | ||
| int | cy, | ||
| float & | px, | ||
| float & | py | ||
| ) |
Maps a cell to planar coordinates (px, py). On XY plane these are world (x, y); on XZ plane they are world (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, py, 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()
| EVENGINE_API_FOUNDATION 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 | ||
| ) |
Enumerates local cells of a rotated footprint.
- 参数
-
mask Row-major w*h occupancy (empty = solid rectangle). steps Cardinal: 90° steps (0..3); hexMode: 60° steps (0..5). Callback receives normalized local coords (bbox min corner at origin, anchor at origin cell).
在文件 GridProjection.cpp 第 121 行定义.
引用了 c, fn, h, idx, mask, nx, ny, nz, q, s, steps, w, x, y , 以及 z.
被这些函数引用 eve::building::PlacementSystem::foreachFootprintCell() , 以及 rotatedFootprintSize().
◆ rotatedFootprintSize()
| EVENGINE_API_FOUNDATION void eve::grid::rotatedFootprintSize | ( | int | w, |
| int | h, | ||
| const std::vector< uint8_t > & | mask, | ||
| int | steps, | ||
| bool | hexMode, | ||
| int & | outW, | ||
| int & | outH | ||
| ) |
Axis-aligned size of a footprint after rotation.
在文件 GridProjection.cpp 第 187 行定义.
引用了 foreachRotatedFootprint(), h, mask, steps , 以及 w.
被这些函数引用 eve::building::PlacementSystem::effectiveFootprint().
◆ worldToCell()
| EVENGINE_API_FOUNDATION void eve::grid::worldToCell | ( | const GridConfig & | cfg, |
| float | px, | ||
| float | py, | ||
| int & | cx, | ||
| int & | cy, | ||
| int | mapW, | ||
| int | mapH | ||
| ) |
Maps planar coordinates to the nearest cell. Staggered/hex layouts use a bounded nearest-neighbor search; mapW/mapH bound the search range (Tiled-compatible pick semantics).
在文件 GridProjection.cpp 第 69 行定义.
引用了 a, b, best, eve::grid::GridConfig::cellH, cellPitchX(), cellPitchY(), cellToWorld(), eve::grid::GridConfig::cellW, cx, cy, d, dx, dy, h, Isometric, IsometricZAsY, eve::grid::GridConfig::layout, eve::grid::GridConfig::originX, eve::grid::GridConfig::originY, px, py, Rectangle, w, wx, wy, x , 以及 y.
被这些函数引用 eve::building::PlacementSystem::canPlaceFree(), eve::building::PlacementSystem::ensureBuiltins(), eve::building::PlacementSystem::moveFreeResult(), eve::building::PlacementSystem::moveFreeSurfaceResult(), eve::building::PlacementSystem::placeFreeResult(), eve::building::PlacementSystem::placeFreeSurfaceResult(), eve::building::PlacementSystem::restoreExact(), eve::building::PlacementSystem::sampleSurfacePatch(), eve::building::Ghost::setFree(), eve::building::PlacementWorld::worldToCell3D(), eve::building::PlacementWorld::worldToCellX(), eve::building::PlacementWorld::worldToCellY() , 以及 eve::map::worldToTile().