载入中...
搜索中...
未找到
eve::hexmap 命名空间参考

类

struct  EdgeVertices
 Five sample points along one hex edge, from v1 to v5. 更多...
 
struct  HexCellData
 One cell of the hex map: packed values plus packed flags. 更多...
 
struct  HexCoordinates
 Axial coordinates of one hex cell. 更多...
 
class  HexFlags
 Packed boolean cell state (roads, rivers, walls, exploration). 更多...
 
struct  HexHash
 Five-component pseudo-random value used to pick and orient one feature. 更多...
 
class  HexHashGrid
 Deterministic replacement for the reference project's hash grid. 更多...
 
class  HexMap
 An editable, chunked, pointy-top hex map. 更多...
 
struct  HexMapGeneratorSettings
 Tunables of the reference project's map generator. 更多...
 
class  HexMapModule
 Owns the active hex map and the GPU meshes generated from it. 更多...
 
class  HexMeshData
 CPU-side triangle soup for one hex chunk surface. 更多...
 
class  HexMetrics
 Hexagon metrics shared by the map model and every mesh builder. 更多...
 
struct  HexMoveRules
 Movement tuning of one actor; cells per turn and vision radius in cells. 更多...
 
class  HexNoise
 Deterministic four-channel value noise over the XZ plane. 更多...
 
struct  HexPath
 One found path: the cells from origin to goal, with the turn each one is reached on. 更多...
 
class  HexSearchContext
 Reusable search scratch: one record per cell plus a priority bucket queue. 更多...
 
struct  HexSearchData
 Per-cell scratch record of one search. 更多...
 
struct  HexSphereGeneratorSettings
 Tunables of the spherical generator. 更多...
 
class  HexSphereMap
 An editable hex map wrapped onto a sphere. 更多...
 
class  HexSphereTopology
 Icosahedral (Goldberg) hex topology for a spherical hex map. 更多...
 
struct  HexSurfaceId
 Stable identifier of one chunk surface stream. 更多...
 
struct  HexTerrainBake
 Packed terrain produced by a generator and applied onto a hex map. 更多...
 
struct  HexTerrainVertexCode
 Encodes the three contributing cells of a terrain vertex. 更多...
 
struct  HexTerrainWeights
 Terrain-layer weights of a vertex; the three entries sum to 1. 更多...
 
class  HexUnitRegistry
 Owns the units of one map and their fog-of-war contribution. 更多...
 
struct  HexUnitSample
 Snapshot of one unit used to drive rendering. 更多...
 
struct  HexUnitState
 Serializable state of one unit. 更多...
 
struct  HexUnitTuning
 Per-unit tuning shared by every unit of a registry. 更多...
 
class  HexValues
 Packed numeric cell state. 更多...
 
struct  HexVec3
 Minimal 3-component float vector used by the hex mesh builders. 更多...
 
struct  HexVec4
 Four-component float vector, matching the reference four-channel noise sample. 更多...
 
class  HexVisibility
 Fog-of-war bookkeeping: how many viewers currently see each cell. 更多...
 

类型定义

using HexOccupancyQuery = std::function< bool(HexCoordinates)>
 Predicate answering whether a cell is already occupied by another actor.
 
using HexSphereCell = std::int32_t
 Dense identifier of one cell of a spherical hex topology.
 

枚举

enum class  HexTerrainType : std::int32_t {
  Sand = 0 , Grass = 1 , Mud = 2 , Stone = 3 ,
  Snow = 4
}
 Terrain palette index of a hex cell. 更多...
 
enum class  HexSurface : std::int32_t {
  Terrain = 0 , Water = 1 , River = 2 , Road = 3 ,
  Fog = 4 , Wall = 5 , Feature = 6
}
 Surface streams a chunk mesh is generated for. 更多...
 
enum class  HexDirection : std::int32_t {
  NE = 0 , E = 1 , SE = 2 , SW = 3 ,
  W = 4 , NW = 5
}
 Hex facing directions, counter-clockwise from north-east. 更多...
 
enum class  HexEdgeType : std::int32_t { Flat = 0 , Slope = 1 , Cliff = 2 }
 Relationship between two neighbouring cells of different elevation. 更多...
 
enum class  HexSearchPop : std::int32_t { Cell = 0 , Empty = 1 }
 Outcome of one frontier pop. 更多...
 

函数

constexpr std::int32_t clampTerrainType (std::int32_t index) noexcept
 Terrain type index clamped into the supported palette range.
 
constexpr bool canHoldUnit (const HexCellData &cell) noexcept
 Whether a cell record is in a state that can hold a unit.
 
float featureThreshold (std::int32_t level, std::int32_t index) noexcept
 Feature-placement thresholds of the reference project.
 
void buildWallMesh (const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
 Builds the wall and bridge geometry of one chunk.
 
void buildFeatureMesh (const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
 Builds the urban, farm, plant and special decorations of one chunk.
 
void buildFogMesh (const HexMap &map, const HexVisibility &visibility, std::int32_t chunkIndex, HexMeshData &out)
 Builds the fog-of-war overlay of one chunk.
 
Result< void > generateHexMap (HexMap &map, const HexMapGeneratorSettings &settings)
 Replaces the grid's contents with a procedurally generated map.
 
void buildChunkSurfaceMesh (const HexMap &map, std::int32_t chunkIndex, HexSurface surface, HexMeshData &out)
 Builds one chunk surface by dispatching on surface.
 
EVENGINE_API_WORLD void buildTerrainMesh (const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
 Builds the ground, terrace and cliff surface of one chunk.
 
EVENGINE_API_WORLD void buildWaterMesh (const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
 Builds the water surface and shore band of one chunk.
 
void buildRiverMesh (const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
 Builds the river channel surface of one chunk.
 
void buildRoadMesh (const HexMap &map, std::int32_t chunkIndex, HexMeshData &out)
 Builds the road surface of one chunk.
 
 Module_IMPL (HexMapModule, new HexMapModule())
 
constexpr HexVec3 operator+ (HexVec3 a, HexVec3 b) noexcept
 Operator +.
 
constexpr HexVec3 operator- (HexVec3 a, HexVec3 b) noexcept
 Operator -.
 
constexpr HexVec3 operator* (HexVec3 a, float s) noexcept
 Operator *.
 
constexpr HexVec3 operator* (float s, HexVec3 a) noexcept
 Operator *.
 
constexpr HexVec3 & operator+= (HexVec3 &a, HexVec3 b) noexcept
 Operator +=.
 
constexpr HexVec3 lerp (HexVec3 a, HexVec3 b, float t) noexcept
 Linear interpolation between two positions.
 
constexpr HexVec3 weightsLerp (HexVec3 a, HexVec3 b, float t) noexcept
 Blends the three terrain-layer weights of a hex vertex.
 
constexpr HexDirection opposite (HexDirection d) noexcept
 The direction opposite to d.
 
constexpr HexDirection previous (HexDirection d) noexcept
 The next direction counter-clockwise (NE wraps to NW).
 
constexpr HexDirection next (HexDirection d) noexcept
 The next direction clockwise (NW wraps to NE).
 
constexpr HexDirection previous2 (HexDirection d) noexcept
 Two steps counter-clockwise.
 
constexpr HexDirection next2 (HexDirection d) noexcept
 Two steps clockwise.
 
constexpr HexEdgeType edgeType (int elevation1, int elevation2) noexcept
 The relationship between two elevations (single-step changes are slopes).
 
bool isValidDestination (const HexMap &map, HexCoordinates coordinates, const HexOccupancyQuery &occupied={})
 Whether an actor may occupy a cell.
 
std::int32_t moveCost (const HexMap &map, HexCoordinates from, HexCoordinates to, HexDirection direction, const HexOccupancyQuery &occupied={})
 Cost of moving between two adjacent cells.
 
Result< HexPath > findPath (const HexMap &map, HexSearchContext &scratch, HexCoordinates from, HexCoordinates to, const HexMoveRules &rules, const HexOccupancyQuery &occupied={})
 Finds the cheapest path between two cells.
 
Result< void > collectVisibleCells (const HexMap &map, HexSearchContext &scratch, HexCoordinates from, std::int32_t range, std::vector< std::int32_t > &out)
 Collects every cell visible from from within range.
 
Result< void > saveHexMap (const HexMap &map, const std::vector< HexUnitState > &units, std::vector< std::uint8_t > &out)
 Serializes a map and its units into a self-describing byte payload.
 
Result< void > loadHexMap (const std::vector< std::uint8_t > &bytes, HexMap &map, std::vector< HexUnitState > &units)
 Restores a map and its units from a payload produced by saveHexMap.
 
Result< void > generateSphereMap (HexSphereMap &map, const HexSphereGeneratorSettings &settings)
 Regenerates every cell of map procedurally.
 
void buildSphereTerrainMesh (const HexSphereMap &map, HexMeshData &out)
 Builds the ground, terrace and cliff surface of a spherical hex map.
 
void buildSphereWaterMesh (const HexSphereMap &map, HexMeshData &out)
 Builds the ocean surface of a spherical hex map.
 
HexTerrainBake snapshotHexTerrain (const HexMap &map)
 Snapshot every cell of a planar map into a bake.
 
HexTerrainBake snapshotHexSphereTerrain (const HexSphereMap &map)
 Snapshot every cell of a spherical map into a bake.
 
Value hexTerrainBakeToValue (const HexTerrainBake &bake)
 Project a bake into the script Result payload.
 
Result< HexTerrainBake > hexTerrainBakeFromValue (const Value &value)
 Parse a script bake payload produced by hexTerrainBakeToValue.
 
Result< void > applyHexTerrain (HexMap &map, const HexTerrainBake &bake)
 Replace a planar map's cells with a bake.
 
Result< void > applyHexSphereTerrain (HexSphereMap &map, const HexTerrainBake &bake)
 Replace a spherical map's cells with a bake.
 

变量

constexpr std::int32_t kHexTerrainTypeCount = 5
 Number of entries in the terrain palette.
 
constexpr std::int32_t kFeatureThresholdCount = 3
 Number of threshold entries per feature level.
 
constexpr float kWallTowerThreshold = 0.5f
 Height of a city/farm wall, matching HexMetrics::kWallHeight.
 
constexpr float kBridgeDesignLength = 7.f
 Edge length the reference bridge model is designed for.
 
constexpr std::int32_t kHexSurfaceCount = 7
 Number of chunk surface streams.
 
constexpr std::int32_t kMaxHexGridDimension = 512
 Largest grid edge, in cells, any entry point may request.
 
constexpr std::int32_t kHexDirectionCount = 6
 Number of hex edges / facing directions.
 
constexpr std::uint8_t kHexSaveMagic [8] = {'E', 'V', 'E', 'H', 'E', 'X', 0, 0}
 Magic prefix of a hex map payload; ASCII EVEHEX\0\0.
 
constexpr std::uint32_t kHexSaveVersion = 1
 Format version written by saveHexMap.
 
constexpr HexSphereCell kNoHexSphereCell = -1
 Returned by a spherical cell query that has no answer.
 
constexpr std::int32_t kMaxHexSphereSubdivision = 7
 Largest supported subdivision level; 10 * 4^7 + 2 = 163842 cells.
 

类型定义说明

◆ HexOccupancyQuery

using eve::hexmap::HexOccupancyQuery = typedef std::function<bool(HexCoordinates)>

Predicate answering whether a cell is already occupied by another actor.

An empty query means "the grid is empty": the search then only rejects cells that the terrain itself forbids.

在文件 HexSearch.h 第 143 行定义.

◆ HexSphereCell

using eve::hexmap::HexSphereCell = typedef std::int32_t

Dense identifier of one cell of a spherical hex topology.

在文件 HexSphereTopology.h 第 16 行定义.

枚举类型说明

◆ HexDirection

enum class eve::hexmap::HexDirection : std::int32_t
strong

Hex facing directions, counter-clockwise from north-east.

枚举值
NE 
E 
SE 
SW 
W 
NW 

在文件 HexMetrics.h 第 59 行定义.

◆ HexEdgeType

enum class eve::hexmap::HexEdgeType : std::int32_t
strong

Relationship between two neighbouring cells of different elevation.

枚举值
Flat 
Slope 
Cliff 

在文件 HexMetrics.h 第 93 行定义.

◆ HexSearchPop

enum class eve::hexmap::HexSearchPop : std::int32_t
strong

Outcome of one frontier pop.

A named status rather than a bare bool, so a caller cannot read a meaningless cell index out of an empty queue by accident.

枚举值
Cell 

A cell was removed; the out-parameter holds it.

Empty 

The frontier is empty; the out-parameter is untouched.

在文件 HexSearch.h 第 45 行定义.

◆ HexSurface

enum class eve::hexmap::HexSurface : std::int32_t
strong

Surface streams a chunk mesh is generated for.

枚举值
Terrain 
Water 
River 
Road 
Fog 

Fog-of-war overlay of a chunk.

Unlike the other streams this one depends on HexVisibility as well as on the grid, so it is built by buildFogMesh and not by buildChunkSurfaceMesh.

Wall 

City/farm walls, wall towers and bridges; built by buildWallMesh.

Feature 

Urban, farm, plant and special decorations; built by buildFeatureMesh.

在文件 HexMap.h 第 19 行定义.

◆ HexTerrainType

enum class eve::hexmap::HexTerrainType : std::int32_t
strong

Terrain palette index of a hex cell.

枚举值
Sand 
Grass 
Mud 
Stone 
Snow 

在文件 HexCell.h 第 12 行定义.

函数说明

◆ applyHexSphereTerrain()

EVENGINE_API_WORLD Result< void > eve::hexmap::applyHexSphereTerrain ( HexSphereMap &  map,
const HexTerrainBake &  bake 
)

Replace a spherical map's cells with a bake.

The live topology must already match the bake (cellCount and subdivision). This does not rebuild GPU meshes.

参数
mapTarget sphere.
bakeSphere bake.
返回
Success, or InvalidArgument when the bake is not a sphere or the live topology does not match. @cost One write per cell, then markAllDirty.

在文件 HexTerrainBake.cpp 第 192 行定义.

引用了 cell, eve::hexmap::HexSphereMap::cellCount(), eve::hexmap::HexTerrainBake::cellCount, eve::hexmap::HexTerrainBake::cells, eve::hexmap::HexSphereMap::empty(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCellData::flags, eve::InvalidArgument, eve::hexmap::HexTerrainBake::kind, eve::hexmap::HexSphereMap::markAllDirty(), eve::hexmap::HexSphereMap::setCellState(), eve::hexmap::HexTerrainBake::Sphere, eve::hexmap::HexSphereMap::subdivision(), eve::hexmap::HexTerrainBake::subdivision, eve::Result< T >::success() , 以及 eve::hexmap::HexCellData::values.

被这些函数引用 eve::hexmap::HexMapModule::applySphereTerrain().

◆ applyHexTerrain()

EVENGINE_API_WORLD Result< void > eve::hexmap::applyHexTerrain ( HexMap &  map,
const HexTerrainBake &  bake 
)

Replace a planar map's cells with a bake.

Resets the grid to the bake's size and seed first, so terrain perturbation matches the generator seed. The caller owns units, fog and GPU meshes.

参数
mapTarget grid.
bakePlanar bake whose cell count matches cellCountX * cellCountZ.
返回
Success, or InvalidArgument when the bake is not planar or the size is not a legal hex grid. @cost One reset plus one write per cell.

在文件 HexTerrainBake.cpp 第 175 行定义.

引用了 cell, eve::hexmap::HexMap::cellCount(), eve::hexmap::HexTerrainBake::cellCountX, eve::hexmap::HexTerrainBake::cellCountZ, eve::hexmap::HexTerrainBake::cells, eve::hexmap::HexMap::coordinatesAt(), eve::Diagnostic::error(), eve::Result< T >::failure(), index, eve::InvalidArgument, eve::hexmap::HexTerrainBake::kind, eve::hexmap::HexMap::markAllChunksDirty(), eve::hexmap::HexTerrainBake::Planar, eve::hexmap::HexMap::reset(), eve::hexmap::HexTerrainBake::seed, eve::hexmap::HexMap::setCellState() , 以及 eve::Result< T >::success().

被这些函数引用 eve::hexmap::HexMapModule::applyTerrain().

◆ buildChunkSurfaceMesh()

EVENGINE_API_WORLD void eve::hexmap::buildChunkSurfaceMesh ( const HexMap &  map,
std::int32_t  chunkIndex,
HexSurface  surface,
HexMeshData &  out 
)

Builds one chunk surface by dispatching on surface.

参数
mapSource map; must contain chunkIndex.
chunkIndexChunk to build.
surfaceWhich stream to generate; HexSurface::Fog is not supported here because it also needs the visibility state, use buildFogMesh.
outDestination mesh; cleared and finalized by this call.

在文件 HexMapMesh.cpp 第 5 行定义.

引用了 buildRiverMesh(), buildRoadMesh(), buildTerrainMesh(), buildWaterMesh(), eve::hexmap::HexMeshData::clear(), Feature, eve::hexmap::HexMeshData::finalize(), Fog, River, Road, Terrain, Wall , 以及 Water.

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ buildFeatureMesh()

EVENGINE_API_WORLD void eve::hexmap::buildFeatureMesh ( const HexMap &  map,
std::int32_t  chunkIndex,
HexMeshData &  out 
)

Builds the urban, farm, plant and special decorations of one chunk.

Every cell emits at most one decoration, chosen exactly like the reference project: the urban, farm and plant collections are each tested against the cell's hash and the one with the lowest passing hash wins. Special features suppress ordinary decorations entirely.

The single texture coordinate encodes the collection (3 urban, 4 farm, 5 plant, 6 special); the second carries the hash's orientation selector so a shader could rotate the decoration.

参数
mapSource map; must contain chunkIndex.
chunkIndexChunk to build.
outDestination mesh; cleared and finalized by this call.

在文件 HexFeatures.cpp 第 644 行定义.

引用了 eve::hexmap::HexMap::chunkCount(), eve::hexmap::HexMeshData::clear(), eve::hexmap::HexMap::empty() , 以及 eve::hexmap::HexMeshData::finalize().

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ buildFogMesh()

EVENGINE_API_WORLD void eve::hexmap::buildFogMesh ( const HexMap &  map,
const HexVisibility &  visibility,
std::int32_t  chunkIndex,
HexMeshData &  out 
)

Builds the fog-of-war overlay of one chunk.

Only cells that are not fully visible contribute: an unexplored cell is covered by an opaque dark column, an explored cell that no viewer currently sees is covered by a dimmer one. The column is a hexagonal prism rather than a flat cap so it also covers the cliff faces along a fog boundary.

The single texture coordinate carries the fog shade (0 explored-but-unseen, 1 unexplored); the second coordinate is reserved.

参数
mapSource map; must contain chunkIndex.
visibilityVisibility counters of the same map.
chunkIndexChunk to build.
outDestination mesh; cleared and finalized by this call.

在文件 HexFogMesh.cpp 第 116 行定义.

引用了 eve::hexmap::HexMap::cellCount(), eve::hexmap::HexVisibility::cellCount(), eve::hexmap::HexMap::chunkCell(), eve::hexmap::HexMap::chunkCount(), eve::hexmap::HexMeshData::clear(), column, eve::hexmap::HexMap::contains(), eve::hexmap::HexMap::empty(), eve::hexmap::HexMeshData::finalize(), index, eve::hexmap::HexMap::indexOf(), eve::hexmap::HexMap::isExplored(), eve::hexmap::HexVisibility::isVisible(), eve::hexmap::HexMetrics::kChunkSizeX , 以及 eve::hexmap::HexMetrics::kChunkSizeZ.

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ buildRiverMesh()

◆ buildRoadMesh()

◆ buildSphereTerrainMesh()

EVENGINE_API_WORLD void eve::hexmap::buildSphereTerrainMesh ( const HexSphereMap &  map,
HexMeshData &  out 
)

Builds the ground, terrace and cliff surface of a spherical hex map.

This is the spherical counterpart of buildTerrainMesh. The whole sphere is one mesh, because the topology gives every cell a global id and the surface has no chunk borders to hide a seam in.

The construction is the same corner-matrix scheme the planar builder uses, with the three planar assumptions replaced:

  • Edge count. A cell has five edges if it is pentagonal and six otherwise, so nothing iterates a fixed six directions.
  • Edge ownership. The planar builder leans on the chunk grid (direction <= SE) to emit every shared boundary exactly once. A sphere has no chunk grid, so the lower cell id owns the edge instead: the strip across cell -> neighbour is built only while cell < neighbour. The rule is a total order on the same set of edges, so it still emits each shared boundary exactly once.
  • **"Vertical" is radial.** Positions are built as a unit direction times a radius, and the terrace interpolation of a slope moves along the surface by the horizontal step and outward by the vertical step, instead of moving in XZ and Y.

All three terrain layers are encoded exactly as the planar builder encodes them (see HexTerrainVertexCode), so mesh3d's terrain shader consumes this mesh unchanged.

参数
mapSource map. An empty map produces an empty mesh.
outDestination mesh; cleared and finalized by this call.

在文件 HexSphereMesh.cpp 第 959 行定义.

引用了 eve::hexmap::HexMeshData::clear(), eve::hexmap::HexSphereMap::empty() , 以及 eve::hexmap::HexMeshData::finalize().

被这些函数引用 eve::hexmap::HexMapModule::rebuildSphere().

◆ buildSphereWaterMesh()

EVENGINE_API_WORLD void eve::hexmap::buildSphereWaterMesh ( const HexSphereMap &  map,
HexMeshData &  out 
)

Builds the ocean surface of a spherical hex map.

Only flooded cells contribute. Unlike the planar water stream there is no shore band: a flooded cell draws its whole hexagonal cap at its water radius, so two neighbouring flooded cells share their corners exactly and the ocean is one closed sheet with a clean edge where it meets land.

The texture coordinates follow the same contract as the planar water mesh: u is the shore parameter (0 in open ocean, 1 where the water ends against land) and v is reserved.

参数
mapSource map. An empty map, or one with no flooded cell, produces an empty mesh.
outDestination mesh; cleared and finalized by this call.

在文件 HexSphereMesh.cpp 第 971 行定义.

引用了 eve::hexmap::HexMeshData::clear(), eve::hexmap::HexSphereMap::empty() , 以及 eve::hexmap::HexMeshData::finalize().

被这些函数引用 eve::hexmap::HexMapModule::rebuildSphere().

◆ buildTerrainMesh()

void eve::hexmap::buildTerrainMesh ( const HexMap &  map,
std::int32_t  chunkIndex,
HexMeshData &  out 
)

Builds the ground, terrace and cliff surface of one chunk.

The result covers the chunk's own cells plus the blend strips it owns towards its NE, E and SE neighbours, matching the reference project's chunk-border ownership rule.

参数
mapSource map; must contain chunkIndex.
chunkIndexChunk to build.
outDestination mesh; cleared and finalized by this call.

在文件 HexTerrainMesh.cpp 第 729 行定义.

引用了 eve::hexmap::HexMap::chunkCount(), eve::hexmap::HexMeshData::clear() , 以及 eve::hexmap::HexMeshData::finalize().

被这些函数引用 buildChunkSurfaceMesh().

◆ buildWallMesh()

EVENGINE_API_WORLD void eve::hexmap::buildWallMesh ( const HexMap &  map,
std::int32_t  chunkIndex,
HexMeshData &  out 
)

Builds the wall and bridge geometry of one chunk.

Walls appear along the boundary between a walled and an unwalled cell when neither side is underwater and the two do not differ by a cliff. A bridge is emitted where a road crosses a river on the chunk's own edges.

The single texture coordinate encodes the part so one shader can shade them differently; the complete code table, shared with buildFeatureMesh, is 0 wall, 1 tower, 2 bridge, 3 urban, 4 farm, 5 plant, 6 special. The second coordinate is reserved.

参数
mapSource map; must contain chunkIndex.
chunkIndexChunk to build.
outDestination mesh; cleared and finalized by this call.

在文件 HexFeatures.cpp 第 632 行定义.

引用了 eve::hexmap::HexMap::chunkCount(), eve::hexmap::HexMeshData::clear(), eve::hexmap::HexMap::empty() , 以及 eve::hexmap::HexMeshData::finalize().

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ buildWaterMesh()

◆ canHoldUnit()

constexpr bool eve::hexmap::canHoldUnit ( const HexCellData &  cell)
constexprnoexcept

Whether a cell record is in a state that can hold a unit.

This is the single rule shared by pathfinding's destination test, the unit registry's restore path and the save-payload validator: a unit may stand on a cell that has been explored, may still be explored, and is not flooded. Occupancy by another unit is deliberately not part of this predicate, because a travelling unit reserves its own destination.

参数
cellCell record to test.
返回
True when the cell can hold a unit.

在文件 HexCell.h 第 261 行定义.

引用了 cell , 以及 eve::hexmap::HexFlags::isExplored().

被这些函数引用 isValidDestination() , 以及 loadHexMap().

◆ clampTerrainType()

constexpr std::int32_t eve::hexmap::clampTerrainType ( std::int32_t  index)
constexprnoexcept

Terrain type index clamped into the supported palette range.

在文件 HexCell.h 第 24 行定义.

引用了 index , 以及 kHexTerrainTypeCount.

被这些函数引用 eve::hexmap::HexMap::setTerrainType() , 以及 eve::hexmap::HexSphereMap::setTerrainType().

◆ collectVisibleCells()

Result< void > eve::hexmap::collectVisibleCells ( const HexMap &  map,
HexSearchContext &  scratch,
HexCoordinates  from,
std::int32_t  range,
std::vector< std::int32_t > &  out 
)

Collects every cell visible from from within range.

Visibility is line of sight on the hex grid: a cell is visible when the shortest path distance to it, plus its own view elevation, stays within range + from.viewElevation, and that distance is not longer than the direct hex distance (which rejects cells hidden behind a ridge).

参数
mapSource map.
scratchSearch scratch, resized to map.cellCount().
fromViewing cell; must be inside the grid.
rangeVision radius in cells, excluding the viewer's own elevation bonus.
outReceives the visible cells, nearest first; cleared first.
返回
Success, or InvalidArgument when from is outside the grid. @cost Proportional to the visible region, not to the map.

在文件 HexSearch.cpp 第 250 行定义.

引用了 eve::hexmap::HexSearchContext::beginPhase(), Cell, eve::hexmap::HexMap::cellCount(), eve::hexmap::HexSearchContext::cellCount(), eve::hexmap::HexSearchContext::change(), eve::hexmap::HexMap::contains(), eve::hexmap::HexMap::coordinatesAt(), current, eve::hexmap::HexSearchContext::data(), eve::hexmap::HexSearchContext::dequeue(), direction, eve::hexmap::HexSearchData::distance, distance, eve::hexmap::HexMap::empty(), eve::hexmap::HexSearchContext::enqueue(), eve::Diagnostic::error(), eve::Result< T >::failure(), from, eve::hexmap::HexMap::getNeighbor(), eve::hexmap::HexSearchData::heuristic, eve::hexmap::HexMap::indexOf(), eve::InvalidArgument, eve::hexmap::HexMap::isExplorable(), kHexDirectionCount, eve::hexmap::HexSearchData::pathFrom, phase, eve::hexmap::HexSearchData::priority(), range, eve::hexmap::HexSearchData::searchPhase, start, eve::Result< T >::success(), eve::hexmap::HexMap::values() , 以及 eve::hexmap::HexValues::viewElevation().

被这些函数引用 eve::hexmap::HexVisibility::decrease() , 以及 eve::hexmap::HexVisibility::increase().

◆ edgeType()

constexpr HexEdgeType eve::hexmap::edgeType ( int  elevation1,
int  elevation2 
)
constexprnoexcept

The relationship between two elevations (single-step changes are slopes).

在文件 HexMetrics.h 第 96 行定义.

引用了 Cliff, Flat , 以及 Slope.

被这些函数引用 eve::hexmap::HexMap::edgeTypeTo(), eve::hexmap::HexSphereMap::edgeTypeTo() , 以及 moveCost().

◆ featureThreshold()

EVENGINE_API_WORLD float eve::hexmap::featureThreshold ( std::int32_t  level,
std::int32_t  index 
)
noexcept

Feature-placement thresholds of the reference project.

A feature level (1-3) picks a collection by comparing the cell's hash against these thresholds; the last entry of each row is the catch-all.

在文件 HexFeatures.cpp 第 616 行定义.

引用了 index, kFeatureThresholdCount , 以及 level.

◆ findPath()

EVENGINE_API_WORLD Result< HexPath > eve::hexmap::findPath ( const HexMap &  map,
HexSearchContext &  scratch,
HexCoordinates  from,
HexCoordinates  to,
const HexMoveRules &  rules,
const HexOccupancyQuery &  occupied = {} 
)

Finds the cheapest path between two cells.

The result is a plan, not a commitment: it is computed against the current cell state and is invalidated by any later map mutation, so callers re-run it rather than caching it across edits.

参数
mapSource map.
scratchSearch scratch, resized by the caller to map.cellCount().
fromOrigin cell; must be inside the grid.
toGoal cell; must be inside the grid and a valid destination.
rulesMovement rules of the travelling actor.
occupiedOccupancy predicate of other actors; may be empty.
返回
The path, or NotFound when the goal is unreachable / InvalidArgument when an endpoint is outside the grid. @cost Proportional to the number of cells expanded; bounded by map.cellCount().

在文件 HexSearch.cpp 第 147 行定义.

引用了 eve::hexmap::HexSearchContext::beginPhase(), Cell, eve::hexmap::HexMap::cellCount(), eve::hexmap::HexSearchContext::cellCount(), eve::hexmap::HexSearchContext::change(), eve::hexmap::HexMap::contains(), eve::hexmap::HexMap::coordinatesAt(), current, eve::hexmap::HexSearchContext::data(), eve::hexmap::HexSearchContext::dequeue(), direction, eve::hexmap::HexSearchData::distance, distance, eve::hexmap::HexMap::empty(), eve::hexmap::HexSearchContext::enqueue(), found, from, eve::hexmap::HexMap::getNeighbor(), eve::hexmap::HexSearchData::heuristic, index, eve::hexmap::HexMap::indexOf(), isValidDestination(), kHexDirectionCount, moveCost(), occupied, path, eve::hexmap::HexSearchData::pathFrom, phase, eve::hexmap::HexSearchData::priority(), eve::hexmap::HexSearchData::searchPhase, eve::hexmap::HexMoveRules::speed, start, step, eve::Result< T >::success(), to , 以及 turn.

◆ generateHexMap()

EVENGINE_API_WORLD Result< void > eve::hexmap::generateHexMap ( HexMap &  map,
const HexMapGeneratorSettings &  settings 
)

Replaces the grid's contents with a procedurally generated map.

The generator mirrors the reference project's pipeline: land regions grow from seeded cells with jitter and occasional rises/sinks, the coastline is eroded back towards the water level until the target land share is met, rivers are carved downhill, moisture is transported downwind to pick the terrain type, and plant levels follow the moisture.

参数
mapGrid to fill. Its size and seed must already be set by HexMap::reset; the settings' own seed only drives the generator's internal choices, so two calls with the same settings and the same grid produce the same map. Scripts do not call this: they bake through procgen.generateHexTerrain and apply with hexmap.applyTerrain.
settingsGenerator tunables.
返回
Success, or InvalidArgument when the grid is empty. @cost Proportional to the cell count; allocates one scratch value per cell.
注解
Every cell is left explorable but unexplored and the whole map is marked dirty, so the caller rebuilds every chunk afterwards.

在文件 HexMapGenerator.cpp 第 1221 行定义.

引用了 eve::hexmap::HexMap::cellCount(), eve::hexmap::HexMap::cellCountX(), eve::hexmap::HexMap::cellCountZ(), eve::hexmap::HexMap::coordinatesAt(), eve::hexmap::HexMap::empty(), eve::Diagnostic::error(), eve::Result< T >::failure(), index, eve::InvalidArgument, random, settings, eve::Result< T >::success() , 以及 u.

被这些函数引用 eve::procgen::generateHexTerrain().

◆ generateSphereMap()

EVENGINE_API_WORLD Result< void > eve::hexmap::generateSphereMap ( HexSphereMap &  map,
const HexSphereGeneratorSettings &  settings 
)

Regenerates every cell of map procedurally.

Overwrites the whole cell storage: elevation, water level, terrain type and special index. Rivers, roads, walls and the fog latches are left as they are, so a caller that wants a clean planet must reset the map first (which is what the module's generate path does).

The result is a pure function of the map's topology, its radius and the settings, so two runs of the same settings produce identical cells.

参数
mapMap to fill; must not be empty. Scripts do not call this: they bake through procgen.generateHexSphere and apply with hexmap.applySphereTerrain.
settingsGenerator tunables.
返回
Success, or InvalidArgument when the map has no cells. @cost One 3D fBm evaluation per cell for the continents and one more for the moisture, so proportional to the cell count and dominated by the noise.

在文件 HexSphereGenerator.cpp 第 124 行定义.

引用了 cell, eve::hexmap::HexSphereMap::cellCount(), eve::hexmap::HexSphereMap::direction(), direction, elevation, eve::hexmap::HexSphereMap::empty(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), eve::InvalidArgument, eve::hexmap::HexMetrics::kMaxElevation, eve::hexmap::HexMetrics::kMinElevation, eve::hexmap::HexSphereMap::markAllDirty(), moisture, eve::hexmap::HexSphereMap::setElevation(), eve::hexmap::HexSphereMap::setTerrainType(), settings, eve::hexmap::HexSphereMap::setWaterLevel(), eve::Result< T >::success(), unit, value, waterLevel, eve::hexmap::HexVec3::x , 以及 eve::hexmap::HexVec3::y.

被这些函数引用 eve::procgen::generateHexSphere().

◆ hexTerrainBakeFromValue()

◆ hexTerrainBakeToValue()

◆ isValidDestination()

EVENGINE_API_WORLD bool eve::hexmap::isValidDestination ( const HexMap &  map,
HexCoordinates  coordinates,
const HexOccupancyQuery &  occupied = {} 
)

Whether an actor may occupy a cell.

A destination must be explored, explorable, not underwater and not occupied. This mirrors HexUnit.IsValidDestination in the reference project; the occupied query supplies the "no other unit" clause.

参数
mapSource map.
coordinatesCell to test.
occupiedOccupancy predicate; may be empty.
返回
True when the cell can hold an actor.

在文件 HexSearch.cpp 第 121 行定义.

引用了 canHoldUnit(), eve::hexmap::HexMap::cell(), cell, eve::hexmap::HexMap::contains() , 以及 occupied.

被这些函数引用 eve::hexmap::HexUnitRegistry::beginTravel(), findPath(), moveCost() , 以及 eve::hexmap::HexUnitRegistry::restore().

◆ lerp()

constexpr HexVec3 eve::hexmap::lerp ( HexVec3  a,
HexVec3  b,
float  t 
)
constexprnoexcept

Linear interpolation between two positions.

在文件 HexMetrics.h 第 51 行定义.

引用了 a, b, t , 以及 eve::hexmap::HexVec3::x.

被这些函数引用 eve::hexmap::EdgeVertices::EdgeVertices(), eve::hexmap::EdgeVertices::EdgeVertices(), eve::hexmap::HexMetrics::terraceLerpWeights() , 以及 weightsLerp().

◆ loadHexMap()

EVENGINE_API_WORLD Result< void > eve::hexmap::loadHexMap ( const std::vector< std::uint8_t > &  bytes,
HexMap &  map,
std::vector< HexUnitState > &  units 
)

Restores a map and its units from a payload produced by saveHexMap.

The whole payload is validated before map is touched, so a rejected payload leaves both map and units unchanged. On success map is rebuilt from scratch through HexMap::reset — no partially applied cell writes are observable.

参数
bytesPayload to decode.
mapReceives the restored grid; replaced only on success.
unitsReceives the restored unit states; replaced only on success.
返回
Success, or InvalidArgument for a truncated, mis-magic'd, wrong-version or out-of-range payload. @cost Proportional to the cell count.

在文件 HexSerializer.cpp 第 197 行定义.

引用了 bytes, canHoldUnit(), cell, cells, eve::hexmap::HexMap::coordinatesAt(), eve::Result< T >::failure(), eve::Result< void >::ignore(), index, eve::hexmap::HexMetrics::kChunkSizeX, eve::hexmap::HexMetrics::kChunkSizeZ, kHexSaveMagic, kHexSaveVersion, eve::hexmap::HexMap::markAllChunksDirty(), eve::hexmap::HexMap::reset(), seed, eve::hexmap::HexMap::setCellState(), eve::Result< T >::success(), u , 以及 units.

◆ Module_IMPL()

eve::hexmap::Module_IMPL ( HexMapModule  ,
new   HexMapModule() 
)

◆ moveCost()

EVENGINE_API_WORLD std::int32_t eve::hexmap::moveCost ( const HexMap &  map,
HexCoordinates  from,
HexCoordinates  to,
HexDirection  direction,
const HexOccupancyQuery &  occupied = {} 
)

Cost of moving between two adjacent cells.

Cliffs and wall boundaries are impassable. A road on the source cell costs a single point; otherwise flat ground costs 5, a slope 10, plus the target cell's urban, farm and plant levels.

参数
mapSource map.
fromSource cell.
toDestination cell.
directionDirection of travel from from to to.
occupiedOccupancy predicate; may be empty.
返回
A positive cost, or a negative value when the move is blocked.

在文件 HexSearch.cpp 第 131 行定义.

引用了 Cliff, direction, edgeType(), eve::hexmap::HexMap::elevation(), eve::hexmap::HexMap::farmLevel(), eve::hexmap::HexMap::flags(), Flat, from, eve::hexmap::HexFlags::hasRoad(), isValidDestination(), eve::hexmap::HexMap::isWalled(), occupied, eve::hexmap::HexMap::plantLevel(), to, type , 以及 eve::hexmap::HexMap::urbanLevel().

被这些函数引用 findPath().

◆ next()

◆ next2()

constexpr HexDirection eve::hexmap::next2 ( HexDirection  d)
constexprnoexcept

Two steps clockwise.

在文件 HexMetrics.h 第 87 行定义.

引用了 d , 以及 v.

◆ operator*() [1/2]

constexpr HexVec3 eve::hexmap::operator* ( float  s,
HexVec3  a 
)
constexprnoexcept

Operator *.

在文件 HexMetrics.h 第 35 行定义.

引用了 a , 以及 s.

◆ operator*() [2/2]

constexpr HexVec3 eve::hexmap::operator* ( HexVec3  a,
float  s 
)
constexprnoexcept

Operator *.

在文件 HexMetrics.h 第 33 行定义.

引用了 a, s , 以及 eve::hexmap::HexVec3::x.

◆ operator+()

constexpr HexVec3 eve::hexmap::operator+ ( HexVec3  a,
HexVec3  b 
)
constexprnoexcept

Operator +.

在文件 HexMetrics.h 第 25 行定义.

引用了 a, b , 以及 eve::hexmap::HexVec3::x.

◆ operator+=()

constexpr HexVec3 & eve::hexmap::operator+= ( HexVec3 &  a,
HexVec3  b 
)
constexprnoexcept

Operator +=.

在文件 HexMetrics.h 第 37 行定义.

引用了 a , 以及 b.

◆ operator-()

constexpr HexVec3 eve::hexmap::operator- ( HexVec3  a,
HexVec3  b 
)
constexprnoexcept

Operator -.

在文件 HexMetrics.h 第 29 行定义.

引用了 a, b , 以及 eve::hexmap::HexVec3::x.

◆ opposite()

constexpr HexDirection eve::hexmap::opposite ( HexDirection  d)
constexprnoexcept

The direction opposite to d.

在文件 HexMetrics.h 第 65 行定义.

引用了 d , 以及 v.

被这些函数引用 eve::hexmap::HexMap::addRoad(), eve::hexmap::HexMap::removeRiver(), eve::hexmap::HexMap::removeRoads() , 以及 eve::hexmap::HexMap::setOutgoingRiver().

◆ previous()

constexpr HexDirection eve::hexmap::previous ( HexDirection  d)
constexprnoexcept

The next direction counter-clockwise (NE wraps to NW).

在文件 HexMetrics.h 第 71 行定义.

引用了 d, NE , 以及 NW.

◆ previous2()

constexpr HexDirection eve::hexmap::previous2 ( HexDirection  d)
constexprnoexcept

Two steps counter-clockwise.

在文件 HexMetrics.h 第 81 行定义.

引用了 d , 以及 v.

◆ saveHexMap()

EVENGINE_API_WORLD Result< void > eve::hexmap::saveHexMap ( const HexMap &  map,
const std::vector< HexUnitState > &  units,
std::vector< std::uint8_t > &  out 
)

Serializes a map and its units into a self-describing byte payload.

Every field is little-endian and written byte by byte:

offset type field
0 uint8[8] kHexSaveMagic
8 uint32 format version
12 uint32 cell count X
16 uint32 cell count Z
20 uint32 generation seed
24 uint64 map revision at save time (diagnostic)
32 uint32[2*N] per cell: packed HexValues, HexFlags
... uint32 unit count
... (int32,float) per unit: cell index, orientation

The payload is a snapshot format, not a save-game format for arbitrary game state: it carries the grid and the units that the map itself owns. Unknown fields are not preserved because the version is rejected outright when it is not kHexSaveVersion; a newer writer must therefore bump the version and add its migration in loadHexMap.

参数
mapMap to serialize.
unitsUnit states, in registry order.
outReceives the payload; cleared first.
返回
Success, or InvalidArgument when the map holds no cells. @cost Proportional to the cell count.

在文件 HexSerializer.cpp 第 163 行定义.

引用了 cell, eve::hexmap::HexMap::cellAt(), eve::hexmap::HexMap::cellCount(), eve::hexmap::HexMap::cellCountX(), eve::hexmap::HexMap::cellCountZ(), eve::hexmap::HexMap::empty(), eve::Result< T >::failure(), index, kHexSaveMagic, kHexSaveVersion, payload, eve::hexmap::HexMap::revision(), eve::hexmap::HexMap::seed(), eve::Result< T >::success(), unit , 以及 units.

◆ snapshotHexSphereTerrain()

◆ snapshotHexTerrain()

◆ weightsLerp()

constexpr HexVec3 eve::hexmap::weightsLerp ( HexVec3  a,
HexVec3  b,
float  t 
)
constexprnoexcept

Blends the three terrain-layer weights of a hex vertex.

在文件 HexMetrics.h 第 56 行定义.

引用了 a, b, lerp() , 以及 t.

变量说明

◆ kBridgeDesignLength

constexpr float eve::hexmap::kBridgeDesignLength = 7.f
inlineconstexpr

Edge length the reference bridge model is designed for.

在文件 HexFeatures.h 第 69 行定义.

◆ kFeatureThresholdCount

constexpr std::int32_t eve::hexmap::kFeatureThresholdCount = 3
inlineconstexpr

Number of threshold entries per feature level.

在文件 HexFeatures.h 第 64 行定义.

被这些函数引用 featureThreshold().

◆ kHexDirectionCount

◆ kHexSaveMagic

constexpr std::uint8_t eve::hexmap::kHexSaveMagic[8] = {'E', 'V', 'E', 'H', 'E', 'X', 0, 0}
inlineconstexpr

Magic prefix of a hex map payload; ASCII EVEHEX\0\0.

在文件 HexSerializer.h 第 17 行定义.

被这些函数引用 loadHexMap() , 以及 saveHexMap().

◆ kHexSaveVersion

constexpr std::uint32_t eve::hexmap::kHexSaveVersion = 1
inlineconstexpr

Format version written by saveHexMap.

在文件 HexSerializer.h 第 20 行定义.

被这些函数引用 loadHexMap() , 以及 saveHexMap().

◆ kHexSurfaceCount

constexpr std::int32_t eve::hexmap::kHexSurfaceCount = 7
inlineconstexpr

Number of chunk surface streams.

在文件 HexMap.h 第 38 行定义.

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ kHexTerrainTypeCount

constexpr std::int32_t eve::hexmap::kHexTerrainTypeCount = 5
inlineconstexpr

Number of entries in the terrain palette.

在文件 HexCell.h 第 21 行定义.

被这些函数引用 clampTerrainType().

◆ kMaxHexGridDimension

constexpr std::int32_t eve::hexmap::kMaxHexGridDimension = 512
inlineconstexpr

Largest grid edge, in cells, any entry point may request.

Both the script bindings and the save format check against this before allocating, so the limit has exactly one definition. 512 x 512 cells is the largest map the chunked mesh path is validated for.

在文件 HexMap.h 第 47 行定义.

被这些函数引用 eve::hexmap::HexMapModule::newGrid() , 以及 eve::procgen::registerHexTerrainAlgorithms().

◆ kMaxHexSphereSubdivision

constexpr std::int32_t eve::hexmap::kMaxHexSphereSubdivision = 7
inlineconstexpr

Largest supported subdivision level; 10 * 4^7 + 2 = 163842 cells.

在文件 HexSphereTopology.h 第 22 行定义.

被这些函数引用 eve::hexmap::HexSphereTopology::build(), eve::procgen::registerHexTerrainAlgorithms() , 以及 eve::hexmap::HexSphereMap::reset().

◆ kNoHexSphereCell

◆ kWallTowerThreshold

constexpr float eve::hexmap::kWallTowerThreshold = 0.5f
inlineconstexpr

Height of a city/farm wall, matching HexMetrics::kWallHeight.

在文件 HexFeatures.h 第 67 行定义.