An editable hex map wrapped onto a sphere. 更多...
#include <HexSphereMap.h>
Public 成员函数 | |
| HexSphereMap ()=default | |
| Hex sphere map. | |
| Result< void > | reset (std::int32_t subdivision, float radius, std::uint32_t seed) |
Replaces the map with a new sphere of 10 * 4^subdivision + 2 cells. | |
| bool | empty () const noexcept |
| Whether the map holds any cell. | |
| std::int32_t | subdivision () const noexcept |
| The subdivision level this map was built at. | |
| std::int32_t | frequency () const noexcept |
Subdivision frequency f = 2^subdivision. | |
| std::int32_t | cellCount () const noexcept |
Number of cells (10 * f^2 + 2). | |
| std::int32_t | pentagonCount () const noexcept |
| Number of pentagonal cells (12 for a non-empty map). | |
| float | sphereRadius () const noexcept |
| Sphere radius in world units. | |
| float | cellSpacing () const noexcept |
| Mean centre-to-centre distance between neighbouring cells, in world units. | |
| float | elevationStep () const noexcept |
| World distance one elevation level lifts the surface. | |
| void | setElevationStep (float step) noexcept |
| Sets the radial world distance of one elevation level. | |
| std::uint32_t | seed () const noexcept |
| The seed this map was built with. | |
| std::uint64_t | revision () const noexcept |
| Monotonic counter bumped by every mutation; used to detect stale meshes. | |
| const HexNoise & | noise () const noexcept |
| Deterministic noise field shared by this map's mesh builders. | |
| const HexSphereTopology & | topology () const noexcept |
The topology backing this map. @ownership Borrowed; valid until this map is destroyed or reset is called. | |
| bool | contains (HexSphereCell cell) const noexcept |
Whether cell is a valid id of this map. | |
| bool | isPentagon (HexSphereCell cell) const noexcept |
Whether cell has five edges instead of six. | |
| std::int32_t | neighborCount (HexSphereCell cell) const noexcept |
Number of edges of cell (5 or 6), or 0 when out of range. | |
| HexSphereCell | neighbor (HexSphereCell cell, std::int32_t direction) const noexcept |
Neighbour of cell across edge direction, or kNoHexSphereCell. | |
| std::int32_t | directionOf (HexSphereCell cell, HexSphereCell other) const noexcept |
Edge index shared with other, or kNoHexSphereCell when not adjacent. | |
| std::int32_t | oppositeDirection (HexSphereCell cell, std::int32_t direction) const noexcept |
Edge index of cell's edge towards its neighbour across direction. | |
| std::int32_t | cornerCountOf (HexSphereCell cell) const noexcept |
Number of corners of cell (5 or 6), or 0 when out of range. | |
| HexEdgeType | edgeTypeTo (HexSphereCell a, HexSphereCell b) const noexcept |
| Relationship between two adjacent cells; Flat when not adjacent. | |
| HexVec3 | direction (HexSphereCell cell) const noexcept |
Unit direction from the sphere centre to the centre of cell. | |
| HexVec3 | cornerDirection (HexSphereCell cell, std::int32_t corner) const noexcept |
Unit direction of corner corner of cell. | |
| float | surfaceRadius (HexSphereCell cell) const noexcept |
Radius of the cell's surface: sphereRadius + elevation * elevationStep. | |
| HexVec3 | cellPosition (HexSphereCell cell) const noexcept |
| World-space centre of the cell's surface. | |
| HexVec3 | cellGroundPosition (HexSphereCell cell) const noexcept |
| World-space centre of the cell at radius, ignoring elevation. | |
| const HexCellData * | cellAt (HexSphereCell cell) const noexcept |
Cell record by id, or null when out of range. @ownership Borrowed; the map owns the record. @lifetime Valid until this map is destroyed or reset is called; any mutation of the map's cell storage invalidates the pointer. | |
| std::int32_t | elevation (HexSphereCell c) const noexcept |
| std::int32_t | waterLevel (HexSphereCell c) const noexcept |
| std::int32_t | terrainType (HexSphereCell c) const noexcept |
| std::int32_t | urbanLevel (HexSphereCell c) const noexcept |
| std::int32_t | farmLevel (HexSphereCell c) const noexcept |
| std::int32_t | plantLevel (HexSphereCell c) const noexcept |
| std::int32_t | specialIndex (HexSphereCell c) const noexcept |
| bool | isUnderwater (HexSphereCell c) const noexcept |
| bool | hasRiver (HexSphereCell c) const noexcept |
| bool | hasRoad (HexSphereCell c) const noexcept |
| bool | hasRiverThrough (HexSphereCell c, std::int32_t direction) const noexcept |
| bool | isWalled (HexSphereCell c) const noexcept |
| bool | isExplored (HexSphereCell c) const noexcept |
| Whether a cell has ever been seen by a viewer (the fog-of-war latch). | |
| bool | isExplorable (HexSphereCell c) const noexcept |
| Whether a cell may ever be revealed by a viewer. | |
| HexValues | values (HexSphereCell c) const noexcept |
| Full packed value record of a cell (zero when out of range). | |
| HexFlags | flags (HexSphereCell c) const noexcept |
| Full packed flag record of a cell (zero when out of range). | |
| Result< HexSphereCell > | pickCell (HexVec3 rayOrigin, HexVec3 rayDirection) const |
| Finds the cell under a world-space ray. | |
| std::int32_t | distance (HexSphereCell a, HexSphereCell b) const |
Number of edges between two cells, or kNoHexSphereCell when either is invalid. | |
| void | collectBrush (HexSphereCell center, std::int32_t radius, std::vector< HexSphereCell > &out) const |
Enumerates the cells within radius steps of center into out. | |
| Result< void > | editElevation (HexSphereCell center, std::int32_t radius, std::int32_t delta) |
Raises or lowers every cell within radius steps of center. | |
| Result< void > | editWaterLevel (HexSphereCell center, std::int32_t radius, std::int32_t delta) |
Applies additive water-level change over a hex brush. | |
| Result< void > | editTerrainType (HexSphereCell center, std::int32_t radius, std::int32_t terrainType) |
| Paints a terrain palette index over a hex brush. | |
| Result< void > | editFeatureLevel (HexSphereCell center, std::int32_t radius, std::int32_t feature, std::int32_t delta) |
Applies additive change to one feature level (0 urban, 1 farm, 2 plant). | |
| Result< void > | setElevation (HexSphereCell c, std::int32_t elevation) |
| Sets a cell's elevation, clamped to the editable range, and refreshes dependents. | |
| Result< void > | setWaterLevel (HexSphereCell c, std::int32_t waterLevel) |
Sets a cell's water level, clamped to [0, kMaxElevation]. | |
| Result< void > | setTerrainType (HexSphereCell c, std::int32_t terrainType) |
| Sets a cell's terrain palette index, clamped to the palette range. | |
| Result< void > | setUrbanLevel (HexSphereCell c, std::int32_t level) |
Sets a cell's urban level, clamped to [0, 3]. | |
| Result< void > | setFarmLevel (HexSphereCell c, std::int32_t level) |
Sets a cell's farm level, clamped to [0, 3]. | |
| Result< void > | setPlantLevel (HexSphereCell c, std::int32_t level) |
Sets a cell's plant level, clamped to [0, 3]. | |
| Result< void > | setSpecialIndex (HexSphereCell c, std::int32_t index) |
| Sets a cell's special-feature index; ignored while the cell carries a river. | |
| Result< void > | setWalled (HexSphereCell c, bool walled) |
| Sets whether a cell is walled. | |
| Result< void > | setExplored (HexSphereCell c, bool explored) |
| Sets the explored (fog-of-war) latch of a cell. | |
| Result< void > | setExplorable (HexSphereCell c, bool explorable) |
| Sets whether a cell may ever be explored. | |
| Result< void > | setCellState (HexSphereCell c, HexValues values, HexFlags flags) |
| Writes a complete cell record verbatim. | |
| Result< void > | setOutgoingRiver (HexSphereCell c, std::int32_t direction) |
Forces a river to leave the cell through direction, mirroring the neighbour. | |
| Result< void > | removeRiver (HexSphereCell c) |
| Removes every river connection of the cell and its neighbours. | |
| Result< void > | addRoad (HexSphereCell c, std::int32_t direction) |
Adds a road through direction when both cells can carry one. | |
| Result< void > | removeRoads (HexSphereCell c) |
| Removes every road of the cell and its neighbours. | |
| void | markAllDirty () noexcept |
| Marks every cell dirty. | |
| void | markCellDirtyAndNeighbors (HexSphereCell cell) noexcept |
| Marks one cell and its direct neighbours dirty. | |
| std::int32_t | takeDirtyCell () noexcept |
| Pops the next dirty cell. | |
| std::int32_t | dirtyCellCount () const noexcept |
| Number of cells currently pending a rebuild. | |
静态 Public 属性 | |
| static constexpr float | kDefaultElevationRatio = 0.006f |
| Ratio of the default radial elevation step to the sphere radius. | |
详细描述
An editable hex map wrapped onto a sphere.
This is the spherical counterpart of HexMap. It reuses the whole per-cell data model unchanged — HexCellData, HexValues and HexFlags — and the geometry constants of HexMetrics, and replaces only the two things that cannot survive the change of surface: cell identity and the neighbour relation.
Cell identity is a dense HexSphereCell id from HexSphereTopology instead of axial/offset HexCoordinates, and neighbours are reached through the topology's half-edge tables instead of integer direction offsets. There is no chunk grid: the topology already gives every cell a stable id over the whole sphere, so dirty tracking is per cell.
Elevation is radial. A cell's surface sits at sphereRadius + elevation * elevationStep, so elevationStep is the world distance one elevation level lifts the surface, and it defaults to a fraction of the radius rather than to the planar HexMetrics::kElevationStep (three world units), which would be an absurd relief on a planet-sized sphere. The editable range, the packed layout and every clamping rule stay exactly those of HexValues.
Direction indices are the topology's edge indices in [0, neighborCount(cell)), i.e. six for a hexagon and five for a pentagon. HexFlags stores roads and rivers in six one-bit slots indexed by HexDirection, so a direction index is cast into that enumeration directly; slot 5 is simply never set on a pentagon.
Ownership and lifetime: a value type owning its topology, its cell storage and its noise field. It performs no I/O, opens no GPU resources and invokes no callbacks.
Thread affinity: affine to one thread, like HexMap. The type is not synchronized.
Determinism: the topology, the noise field and every derived position depend only on the subdivision level, the radius and the seed. Two maps built with the same triple produce identical topology, cell storage and positions.
在文件 HexSphereMap.h 第 58 行定义.
构造及析构函数说明
◆ HexSphereMap()
|
default |
Hex sphere map.
成员函数说明
◆ addRoad()
| Result< void > eve::hexmap::HexSphereMap::addRoad | ( | HexSphereCell | c, |
| std::int32_t | direction | ||
| ) |
Adds a road through direction when both cells can carry one.
在文件 HexSphereMap.cpp 第 590 行定义.
引用了 c, direction, elevation, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCellData::flags, eve::hexmap::HexFlags::hasRiverThrough(), eve::InvalidArgument, eve::hexmap::kNoHexSphereCell, eve::hexmap::HexSphereTopology::neighbor(), neighborCount(), eve::hexmap::HexSphereTopology::oppositeDirection(), eve::hexmap::HexValues::specialIndex(), eve::Result< T >::success(), eve::hexmap::HexCellData::values , 以及 eve::hexmap::HexFlags::withRoad().
◆ cellAt()
|
noexcept |
Cell record by id, or null when out of range. @ownership Borrowed; the map owns the record. @lifetime Valid until this map is destroyed or reset is called; any mutation of the map's cell storage invalidates the pointer.
在文件 HexSphereMap.cpp 第 111 行定义.
引用了 cell.
被这些函数引用 editFeatureLevel() , 以及 eve::hexmap::snapshotHexSphereTerrain().
◆ cellCount()
|
inlinenoexcept |
Number of cells (10 * f^2 + 2).
在文件 HexSphereMap.h 第 91 行定义.
被这些函数引用 eve::hexmap::applyHexSphereTerrain(), cellSpacing(), eve::hexmap::generateSphereMap() , 以及 eve::hexmap::snapshotHexSphereTerrain().
◆ cellGroundPosition()
|
noexcept |
World-space centre of the cell at radius, ignoring elevation.
在文件 HexSphereMap.cpp 第 99 行定义.
引用了 cell.
◆ cellPosition()
|
noexcept |
◆ cellSpacing()
|
noexcept |
Mean centre-to-centre distance between neighbouring cells, in world units.
The spherical replacement for HexMetrics::kOuterRadius as a scale: geometry that the planar builders express as a fixed number of world units has to be expressed as a fraction of the cell size on a sphere, because the cell size is set by the subdivision level and the radius together.
在文件 HexSphereMap.cpp 第 87 行定义.
引用了 cellCount() , 以及 count.
◆ collectBrush()
| void eve::hexmap::HexSphereMap::collectBrush | ( | HexSphereCell | center, |
| std::int32_t | radius, | ||
| std::vector< HexSphereCell > & | out | ||
| ) | const |
Enumerates the cells within radius steps of center into out.
out is cleared first and then filled in breadth-first order, which is deterministic for a given topology. The centre is always the first entry.
- 参数
-
center Brush centre. radius Number of steps the brush reaches; 0 collects only the centre. out Receives the cell ids; cleared first. @cost O(cellCount) memory for the visited set, plus the brush size in time.
在文件 HexSphereMap.cpp 第 284 行定义.
引用了 cell, center, contains(), count, d, eve::hexmap::kNoHexSphereCell, eve::hexmap::HexSphereTopology::neighbor(), eve::hexmap::HexSphereTopology::neighborCount(), radius, step , 以及 u.
被这些函数引用 editElevation(), editFeatureLevel(), editTerrainType() , 以及 editWaterLevel().
◆ contains()
|
inlinenoexcept |
Whether cell is a valid id of this map.
在文件 HexSphereMap.h 第 129 行定义.
引用了 cell.
被这些函数引用 collectBrush(), distance(), editElevation(), editFeatureLevel(), editTerrainType(), editWaterLevel() , 以及 takeDirtyCell().
◆ cornerCountOf()
|
inlinenoexcept |
◆ cornerDirection()
|
inlinenoexcept |
Unit direction of corner corner of cell.
A corner is not a fixed angular offset of its cell on a sphere, so the mesh builder must read it here instead of deriving it from edge directions.
在文件 HexSphereMap.h 第 170 行定义.
引用了 cell.
◆ direction()
|
inlinenoexcept |
Unit direction from the sphere centre to the centre of cell.
在文件 HexSphereMap.h 第 163 行定义.
引用了 cell.
被这些函数引用 eve::hexmap::generateSphereMap().
◆ directionOf()
|
inlinenoexcept |
Edge index shared with other, or kNoHexSphereCell when not adjacent.
在文件 HexSphereMap.h 第 146 行定义.
引用了 cell.
◆ dirtyCellCount()
|
inlinenoexcept |
Number of cells currently pending a rebuild.
在文件 HexSphereMap.h 第 323 行定义.
◆ distance()
| std::int32_t eve::hexmap::HexSphereMap::distance | ( | HexSphereCell | a, |
| HexSphereCell | b | ||
| ) | const |
Number of edges between two cells, or kNoHexSphereCell when either is invalid.
This is a breadth-first walk over the neighbour graph: a sphere has no cheap closed form for hex distance, unlike the planar offset arithmetic.
@cost O(cellCount) time and memory; intended for authoring and tests, not for per-frame queries over many pairs.
在文件 HexSphereMap.cpp 第 253 行定义.
引用了 a, b, cell, contains(), count, d, depth, eve::hexmap::kNoHexSphereCell, eve::hexmap::HexSphereTopology::neighbor(), eve::hexmap::HexSphereTopology::neighborCount(), eve::hexmap::next() , 以及 u.
◆ edgeTypeTo()
|
noexcept |
Relationship between two adjacent cells; Flat when not adjacent.
在文件 HexSphereMap.cpp 第 103 行定义.
引用了 a, b, eve::hexmap::edgeType(), elevation , 以及 eve::hexmap::Flat.
◆ editElevation()
| Result< void > eve::hexmap::HexSphereMap::editElevation | ( | HexSphereCell | center, |
| std::int32_t | radius, | ||
| std::int32_t | delta | ||
| ) |
Raises or lowers every cell within radius steps of center.
在文件 HexSphereMap.cpp 第 646 行定义.
引用了 cell, cells, center, collectBrush(), contains(), elevation, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), eve::InvalidArgument, eve::hexmap::next(), radius, setElevation() , 以及 eve::Result< T >::success().
◆ editFeatureLevel()
| Result< void > eve::hexmap::HexSphereMap::editFeatureLevel | ( | HexSphereCell | center, |
| std::int32_t | radius, | ||
| std::int32_t | feature, | ||
| std::int32_t | delta | ||
| ) |
Applies additive change to one feature level (0 urban, 1 farm, 2 plant).
在文件 HexSphereMap.cpp 第 684 行定义.
引用了 cell, cellAt(), cells, center, collectBrush(), contains(), current, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), eve::InvalidArgument, layer, eve::hexmap::next(), radius, setFarmLevel(), setPlantLevel(), setUrbanLevel() , 以及 eve::Result< T >::success().
◆ editTerrainType()
| Result< void > eve::hexmap::HexSphereMap::editTerrainType | ( | HexSphereCell | center, |
| std::int32_t | radius, | ||
| std::int32_t | terrainType | ||
| ) |
Paints a terrain palette index over a hex brush.
在文件 HexSphereMap.cpp 第 672 行定义.
引用了 cell, cells, center, collectBrush(), contains(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), eve::InvalidArgument, radius, setTerrainType(), eve::Result< T >::success() , 以及 terrainType().
◆ editWaterLevel()
| Result< void > eve::hexmap::HexSphereMap::editWaterLevel | ( | HexSphereCell | center, |
| std::int32_t | radius, | ||
| std::int32_t | delta | ||
| ) |
Applies additive water-level change over a hex brush.
在文件 HexSphereMap.cpp 第 660 行定义.
引用了 cell, cells, center, collectBrush(), contains(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, radius, setWaterLevel(), eve::Result< T >::success() , 以及 waterLevel.
◆ elevation()
|
noexcept |
在文件 HexSphereMap.cpp 第 121 行定义.
引用了 c.
◆ elevationStep()
|
inlinenoexcept |
World distance one elevation level lifts the surface.
在文件 HexSphereMap.h 第 106 行定义.
◆ empty()
|
inlinenoexcept |
Whether the map holds any cell.
在文件 HexSphereMap.h 第 85 行定义.
被这些函数引用 eve::hexmap::applyHexSphereTerrain(), eve::hexmap::HexMapModule::applySphereTerrain(), eve::hexmap::buildSphereTerrainMesh(), eve::hexmap::buildSphereWaterMesh(), eve::hexmap::generateSphereMap(), pickCell() , 以及 eve::hexmap::HexMapModule::rebuildSphere().
◆ farmLevel()
|
noexcept |
在文件 HexSphereMap.cpp 第 137 行定义.
引用了 c.
◆ flags()
|
noexcept |
Full packed flag record of a cell (zero when out of range).
在文件 HexSphereMap.cpp 第 182 行定义.
引用了 c.
被这些函数引用 setCellState().
◆ frequency()
|
inlinenoexcept |
Subdivision frequency f = 2^subdivision.
在文件 HexSphereMap.h 第 89 行定义.
◆ hasRiver()
|
noexcept |
在文件 HexSphereMap.cpp 第 153 行定义.
引用了 c.
◆ hasRiverThrough()
|
noexcept |
在文件 HexSphereMap.cpp 第 161 行定义.
引用了 c, direction , 以及 eve::hexmap::kHexDirectionCount.
◆ hasRoad()
|
noexcept |
在文件 HexSphereMap.cpp 第 157 行定义.
引用了 c.
◆ isExplorable()
|
noexcept |
◆ isExplored()
|
noexcept |
Whether a cell has ever been seen by a viewer (the fog-of-war latch).
在文件 HexSphereMap.cpp 第 170 行定义.
引用了 c.
◆ isPentagon()
|
inlinenoexcept |
◆ isUnderwater()
|
noexcept |
在文件 HexSphereMap.cpp 第 149 行定义.
引用了 c.
◆ isWalled()
|
noexcept |
在文件 HexSphereMap.cpp 第 166 行定义.
引用了 c.
◆ markAllDirty()
|
noexcept |
Marks every cell dirty.
在文件 HexSphereMap.cpp 第 326 行定义.
引用了 u.
被这些函数引用 eve::hexmap::applyHexSphereTerrain(), eve::hexmap::generateSphereMap() , 以及 reset().
◆ markCellDirtyAndNeighbors()
|
noexcept |
Marks one cell and its direct neighbours dirty.
在文件 HexSphereMap.cpp 第 319 行定义.
◆ neighbor()
|
inlinenoexcept |
Neighbour of cell across edge direction, or kNoHexSphereCell.
在文件 HexSphereMap.h 第 142 行定义.
◆ neighborCount()
|
inlinenoexcept |
Number of edges of cell (5 or 6), or 0 when out of range.
On the sphere this is not a constant, so a caller enumerating the edges of a cell must bound its loop by this and never by kHexDirectionCount.
在文件 HexSphereMap.h 第 138 行定义.
引用了 cell.
被这些函数引用 addRoad(), removeRiver(), removeRoads(), setElevation() , 以及 setOutgoingRiver().
◆ noise()
|
inlinenoexcept |
Deterministic noise field shared by this map's mesh builders.
在文件 HexSphereMap.h 第 119 行定义.
◆ oppositeDirection()
|
inlinenoexcept |
Edge index of cell's edge towards its neighbour across direction.
在文件 HexSphereMap.h 第 150 行定义.
◆ pentagonCount()
|
inlinenoexcept |
Number of pentagonal cells (12 for a non-empty map).
在文件 HexSphereMap.h 第 93 行定义.
◆ pickCell()
| Result< HexSphereCell > eve::hexmap::HexSphereMap::pickCell | ( | HexVec3 | rayOrigin, |
| HexVec3 | rayDirection | ||
| ) | const |
Finds the cell under a world-space ray.
The map has no collision geometry, so the ray is intersected with the sphere at the cell's own surface radius and the result is refined a few times: the first hit is taken against the bounding sphere, then the radius of the cell found there is used for the next intersection. A camera outside the sphere converges in a handful of iterations.
- 参数
-
rayOrigin Ray origin in world space. rayDirection Non-zero ray direction in world space; normalized internally.
- 返回
- The hit cell, or NotFound when the ray misses the sphere, or InvalidArgument when the direction is zero. @cost A fixed small number of
HexSphereTopology::cellAtwalks.
在文件 HexSphereMap.cpp 第 189 行定义.
引用了 cell, eve::hexmap::HexSphereTopology::cellAt(), direction, empty(), eve::Diagnostic::error(), eve::Result< T >::failure(), hit, eve::InvalidArgument, eve::hexmap::HexMetrics::kMaxElevation, eve::hexmap::kNoHexSphereCell, eve::NotFound, point, eve::Result< T >::success(), surfaceRadius() , 以及 t.
◆ plantLevel()
|
noexcept |
在文件 HexSphereMap.cpp 第 141 行定义.
引用了 c.
◆ removeRiver()
| Result< void > eve::hexmap::HexSphereMap::removeRiver | ( | HexSphereCell | c | ) |
Removes every river connection of the cell and its neighbours.
在文件 HexSphereMap.cpp 第 567 行定义.
引用了 c, count, d, direction, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCellData::flags, eve::InvalidArgument, eve::hexmap::kHexDirectionCount, eve::hexmap::kNoHexSphereCell, eve::hexmap::HexSphereTopology::neighbor(), neighborCount(), eve::hexmap::HexSphereTopology::oppositeDirection(), eve::Result< T >::success(), eve::hexmap::HexFlags::withoutRiverIn() , 以及 eve::hexmap::HexFlags::withoutRiverOut().
◆ removeRoads()
| Result< void > eve::hexmap::HexSphereMap::removeRoads | ( | HexSphereCell | c | ) |
Removes every road of the cell and its neighbours.
在文件 HexSphereMap.cpp 第 625 行定义.
引用了 c, count, d, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCellData::flags, eve::InvalidArgument, eve::hexmap::kNoHexSphereCell, eve::hexmap::HexSphereTopology::neighbor(), neighborCount(), eve::hexmap::HexSphereTopology::oppositeDirection(), eve::hexmap::HexFlags::roadMask(), eve::Result< T >::success() , 以及 eve::hexmap::HexFlags::withoutRoad().
被这些函数引用 setElevation() , 以及 setSpecialIndex().
◆ reset()
| Result< void > eve::hexmap::HexSphereMap::reset | ( | std::int32_t | subdivision, |
| float | radius, | ||
| std::uint32_t | seed | ||
| ) |
Replaces the map with a new sphere of 10 * 4^subdivision + 2 cells.
Every cell starts as a default record at elevation 0 and the whole sphere is marked dirty. The subdivision level fixes the cell count permanently for the lifetime of this map.
- 参数
-
subdivision Subdivision level in [0, kMaxHexSphereSubdivision].radius Sphere radius in world units; must be finite and positive. seed Deterministic seed for the noise field.
- 返回
- Success, or InvalidArgument when an argument is out of range, or the topology construction's own failure status. @cost Builds the topology's five tables; proportional to the cell count.
在文件 HexSphereMap.cpp 第 52 行定义.
引用了 eve::hexmap::HexSphereTopology::build(), eve::hexmap::HexSphereTopology::cellCount(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, kDefaultElevationRatio, eve::hexmap::kMaxHexSphereSubdivision, markAllDirty(), radius, eve::hexmap::HexNoise::reset(), seed(), subdivision(), eve::Result< T >::success() , 以及 u.
被这些函数引用 eve::procgen::generateHexSphere() , 以及 eve::hexmap::HexMapModule::newSphere().
◆ revision()
|
inlinenoexcept |
Monotonic counter bumped by every mutation; used to detect stale meshes.
在文件 HexSphereMap.h 第 117 行定义.
◆ seed()
|
inlinenoexcept |
The seed this map was built with.
在文件 HexSphereMap.h 第 115 行定义.
被这些函数引用 reset() , 以及 eve::hexmap::snapshotHexSphereTerrain().
◆ setCellState()
| Result< void > eve::hexmap::HexSphereMap::setCellState | ( | HexSphereCell | c, |
| HexValues | values, | ||
| HexFlags | flags | ||
| ) |
Writes a complete cell record verbatim.
This is the restore path used by a save format. It deliberately skips the neighbour fix-ups of the individual authoring setters, because a payload carries both sides of every connection; the caller is responsible for a consistent payload and must finish with markAllDirty().
- 返回
- Success, or InvalidArgument when
cis out of range.
在文件 HexSphereMap.cpp 第 498 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), flags(), eve::InvalidArgument, eve::Result< T >::success() , 以及 values.
被这些函数引用 eve::hexmap::applyHexSphereTerrain().
◆ setElevation()
| Result< void > eve::hexmap::HexSphereMap::setElevation | ( | HexSphereCell | c, |
| std::int32_t | elevation | ||
| ) |
Sets a cell's elevation, clamped to the editable range, and refreshes dependents.
在文件 HexSphereMap.cpp 第 382 行定义.
引用了 c, count, d, elevation, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), eve::InvalidArgument, eve::hexmap::HexMetrics::kMaxElevation, eve::hexmap::HexMetrics::kMinElevation, eve::hexmap::kNoHexSphereCell, eve::hexmap::HexSphereTopology::neighbor(), neighborCount(), removeRoads(), eve::Result< T >::success() , 以及 value.
被这些函数引用 editElevation() , 以及 eve::hexmap::generateSphereMap().
◆ setElevationStep()
|
noexcept |
Sets the radial world distance of one elevation level.
Only geometry changes, so the cells stay clean; the revision is bumped so a renderer can tell that the built meshes are stale.
在文件 HexSphereMap.cpp 第 75 行定义.
引用了 step.
◆ setExplorable()
| Result< void > eve::hexmap::HexSphereMap::setExplorable | ( | HexSphereCell | c, |
| bool | explorable | ||
| ) |
Sets whether a cell may ever be explored.
在文件 HexSphereMap.cpp 第 489 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ setExplored()
| Result< void > eve::hexmap::HexSphereMap::setExplored | ( | HexSphereCell | c, |
| bool | explored | ||
| ) |
Sets the explored (fog-of-war) latch of a cell.
在文件 HexSphereMap.cpp 第 478 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ setFarmLevel()
| Result< void > eve::hexmap::HexSphereMap::setFarmLevel | ( | HexSphereCell | c, |
| std::int32_t | level | ||
| ) |
Sets a cell's farm level, clamped to [0, 3].
在文件 HexSphereMap.cpp 第 440 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Result< T >::success() , 以及 value.
被这些函数引用 editFeatureLevel().
◆ setOutgoingRiver()
| Result< void > eve::hexmap::HexSphereMap::setOutgoingRiver | ( | HexSphereCell | c, |
| std::int32_t | direction | ||
| ) |
Forces a river to leave the cell through direction, mirroring the neighbour.
在文件 HexSphereMap.cpp 第 508 行定义.
引用了 c, count, d, direction, elevation, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::hexmap::HexCellData::flags, eve::InvalidArgument, eve::hexmap::kNoHexSphereCell, eve::hexmap::HexSphereTopology::neighbor(), neighborCount(), eve::hexmap::HexSphereTopology::oppositeDirection(), previous, eve::Result< T >::success(), eve::hexmap::HexCellData::values, waterLevel, eve::hexmap::HexFlags::withoutRiverIn(), eve::hexmap::HexFlags::withoutRiverOut(), eve::hexmap::HexFlags::withoutRoad(), eve::hexmap::HexFlags::withRiverIn() , 以及 eve::hexmap::HexValues::withSpecialIndex().
◆ setPlantLevel()
| Result< void > eve::hexmap::HexSphereMap::setPlantLevel | ( | HexSphereCell | c, |
| std::int32_t | level | ||
| ) |
Sets a cell's plant level, clamped to [0, 3].
在文件 HexSphereMap.cpp 第 449 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Result< T >::success() , 以及 value.
被这些函数引用 editFeatureLevel().
◆ setSpecialIndex()
| Result< void > eve::hexmap::HexSphereMap::setSpecialIndex | ( | HexSphereCell | c, |
| std::int32_t | index | ||
| ) |
Sets a cell's special-feature index; ignored while the cell carries a river.
在文件 HexSphereMap.cpp 第 458 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Result< void >::ignore(), index, eve::InvalidArgument, removeRoads() , 以及 eve::Result< T >::success().
◆ setTerrainType()
| Result< void > eve::hexmap::HexSphereMap::setTerrainType | ( | HexSphereCell | c, |
| std::int32_t | terrainType | ||
| ) |
Sets a cell's terrain palette index, clamped to the palette range.
在文件 HexSphereMap.cpp 第 422 行定义.
引用了 c, eve::hexmap::clampTerrainType(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Result< T >::success() , 以及 value.
被这些函数引用 editTerrainType() , 以及 eve::hexmap::generateSphereMap().
◆ setUrbanLevel()
| Result< void > eve::hexmap::HexSphereMap::setUrbanLevel | ( | HexSphereCell | c, |
| std::int32_t | level | ||
| ) |
Sets a cell's urban level, clamped to [0, 3].
在文件 HexSphereMap.cpp 第 431 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Result< T >::success() , 以及 value.
被这些函数引用 editFeatureLevel().
◆ setWalled()
| Result< void > eve::hexmap::HexSphereMap::setWalled | ( | HexSphereCell | c, |
| bool | walled | ||
| ) |
Sets whether a cell is walled.
在文件 HexSphereMap.cpp 第 469 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ setWaterLevel()
| Result< void > eve::hexmap::HexSphereMap::setWaterLevel | ( | HexSphereCell | c, |
| std::int32_t | waterLevel | ||
| ) |
Sets a cell's water level, clamped to [0, kMaxElevation].
在文件 HexSphereMap.cpp 第 410 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::hexmap::HexMetrics::kMaxElevation, eve::Result< T >::success() , 以及 value.
被这些函数引用 editWaterLevel() , 以及 eve::hexmap::generateSphereMap().
◆ specialIndex()
|
noexcept |
在文件 HexSphereMap.cpp 第 145 行定义.
引用了 c.
◆ sphereRadius()
|
inlinenoexcept |
Sphere radius in world units.
在文件 HexSphereMap.h 第 95 行定义.
◆ subdivision()
|
inlinenoexcept |
The subdivision level this map was built at.
在文件 HexSphereMap.h 第 87 行定义.
被这些函数引用 eve::hexmap::applyHexSphereTerrain(), reset() , 以及 eve::hexmap::snapshotHexSphereTerrain().
◆ surfaceRadius()
|
noexcept |
Radius of the cell's surface: sphereRadius + elevation * elevationStep.
在文件 HexSphereMap.cpp 第 82 行定义.
被这些函数引用 pickCell().
◆ takeDirtyCell()
|
noexcept |
Pops the next dirty cell.
- 返回
- The dirty cell id, or
kNoHexSphereCellwhen nothing is pending.
- 注解
- Callers loop until
kNoHexSphereCellis returned; the returned cell is no longer reported dirty until it is mutated again.
在文件 HexSphereMap.cpp 第 337 行定义.
引用了 cell, contains(), eve::hexmap::kNoHexSphereCell , 以及 u.
◆ terrainType()
|
noexcept |
◆ topology()
|
inlinenoexcept |
The topology backing this map. @ownership Borrowed; valid until this map is destroyed or reset is called.
在文件 HexSphereMap.h 第 124 行定义.
◆ urbanLevel()
|
noexcept |
在文件 HexSphereMap.cpp 第 133 行定义.
引用了 c.
◆ values()
|
noexcept |
◆ waterLevel()
|
noexcept |
在文件 HexSphereMap.cpp 第 125 行定义.
引用了 c.
类成员变量说明
◆ kDefaultElevationRatio
|
staticconstexpr |
Ratio of the default radial elevation step to the sphere radius.
在文件 HexSphereMap.h 第 61 行定义.
被这些函数引用 reset().
该类的文档由以下文件生成:
- src/modules/hexmap/HexSphereMap.h
- src/modules/hexmap/HexSphereMap.cpp