Hexagon metrics shared by the map model and every mesh builder. 更多...
#include <HexMetrics.h>
静态 Public 成员函数 | |
| static constexpr float | outerRadius () noexcept |
| Radius of a hex cell in world units. | |
| static constexpr float | innerRadius () noexcept |
| Inner radius of a hex cell. | |
| static constexpr float | innerDiameter () noexcept |
| Width of one hex column. | |
| static constexpr float | rowSpacing () noexcept |
| Row spacing between hex rows. | |
| static HexVec3 | corner (HexDirection direction, float scale=1.f) noexcept |
Outer corner direction of a unit hex, scaled by scale. | |
| static HexVec3 | firstCorner (HexDirection d) noexcept |
First (counter-clockwise) outer corner of direction. | |
| static HexVec3 | secondCorner (HexDirection d) noexcept |
Second (clockwise) outer corner of direction. | |
| static HexVec3 | firstSolidCorner (HexDirection d) noexcept |
First solid corner of direction. | |
| static HexVec3 | secondSolidCorner (HexDirection d) noexcept |
Second solid corner of direction. | |
| static HexVec3 | solidEdgeMiddle (HexDirection d) noexcept |
Midpoint of the solid edge of direction. | |
| static HexVec3 | firstWaterCorner (HexDirection d) noexcept |
First water corner of direction. | |
| static HexVec3 | secondWaterCorner (HexDirection d) noexcept |
Second water corner of direction. | |
| static HexVec3 | bridge (HexDirection d) noexcept |
Bridge vector from the solid edge of direction to the neighbour. | |
| static HexVec3 | waterBridge (HexDirection d) noexcept |
Bridge vector from the water edge of direction to the neighbour. | |
| static HexVec3 | terraceLerp (HexVec3 a, HexVec3 b, int step) noexcept |
| Interpolates a position along a terraced slope. | |
| static HexVec3 | terraceLerpWeights (HexVec3 a, HexVec3 b, int step) noexcept |
| Interpolates terrain weights along a terraced slope. | |
| static HexVec3 | wallLerp (HexVec3 near, HexVec3 far) noexcept |
| Position of the midpoint of a wall between two elevations. | |
| static HexVec3 | wallThicknessOffset (HexVec3 near, HexVec3 far) noexcept |
| Half-thickness offset applied to a wall segment. | |
| static float | elevationY (int elevation) noexcept |
| Y coordinate of a cell's elevation surface. | |
| static float | streamBedY (int elevation) noexcept |
| Y coordinate of a river bed inside a cell. | |
| static float | waterSurfaceY (int waterLevel) noexcept |
Y coordinate of a water surface at waterLevel. | |
| static float | solidRadius () noexcept |
| Distance from a cell centre to its nearest edge midpoint. | |
静态 Public 属性 | |
| static constexpr float | kOuterToInner = 0.866025404f |
| Ratio of the outer radius to the inner radius. | |
| static constexpr float | kInnerToOuter = 1.f / kOuterToInner |
| Ratio of the inner radius to the outer radius. | |
| static constexpr float | kDefaultOuterRadius = 10.f |
| Default outer (corner) radius of one hex cell. | |
| static constexpr float | kElevationStep = 3.f |
| Vertical distance between two elevation levels. | |
| static constexpr int | kTerracesPerSlope = 2 |
| Terraces generated per slope. | |
| static constexpr int | kTerraceSteps = kTerracesPerSlope * 2 + 1 |
Terrace interpolation steps per slope (terracesPerSlope * 2 + 1). | |
| static constexpr float | kHorizontalTerraceStepSize = 1.f / static_cast<float>(kTerraceSteps) |
| Horizontal fraction of one terrace interpolation step. | |
| static constexpr float | kVerticalTerraceStepSize = 1.f / static_cast<float>(kTerracesPerSlope + 1) |
| Vertical fraction of one terrace interpolation step. | |
| static constexpr float | kSolidFactor = 0.8f |
| Factor of the solid, uniform-colour hex inscribed in a cell. | |
| static constexpr float | kBlendFactor = 1.f - kSolidFactor |
| Factor of the blend region between two neighbouring cells. | |
| static constexpr float | kWaterFactor = 0.6f |
| Factor of the solid water surface inscribed in a cell. | |
| static constexpr float | kWaterBlendFactor = 1.f - kWaterFactor |
| Factor of the water blend region between two cells. | |
| static constexpr float | kCellPerturbStrength = 4.f |
| Strength of the XZ position perturbation. | |
| static constexpr float | kElevationPerturbStrength = 1.5f |
| Strength of the vertical elevation perturbation. | |
| static constexpr float | kStreamBedElevationOffset = -1.75f |
| Elevation offset of a carved river bed relative to the cell. | |
| static constexpr float | kWaterElevationOffset = -0.5f |
| Elevation offset of a water surface relative to the water level. | |
| static constexpr float | kRiverSurfaceScale = 0.6f |
| Width of the river channel. | |
| static constexpr float | kWallHeight = 4.f |
| Height of a city/farm wall. | |
| static constexpr float | kWallYOffset = -1.f |
| Vertical wall offset; negative so walls do not float above the surface. | |
| static constexpr float | kWallThickness = 0.75f |
| Wall thickness. | |
| static constexpr float | kWallElevationOffset = kVerticalTerraceStepSize |
| Wall elevation offset, matching the vertical terrace step size. | |
| static constexpr int | kChunkSizeX = 5 |
| Chunk size in the X dimension. | |
| static constexpr int | kChunkSizeZ = 5 |
| Chunk size in the Z dimension. | |
| static constexpr int | kMinElevation = -4 |
| Minimum editable elevation. | |
| static constexpr int | kMaxElevation = 8 |
| Maximum editable elevation. | |
| static constexpr float | kOuterRadius = kDefaultOuterRadius |
| Outer (corner) radius of one hex cell in world units. | |
| static constexpr float | kInnerRadius = kDefaultOuterRadius * kOuterToInner |
| Inner (edge) radius of one hex cell in world units. | |
| static constexpr float | kInnerDiameter = kInnerRadius * 2.f |
| Width of one hex column. | |
| static constexpr float | kRowSpacing = kDefaultOuterRadius * 1.5f |
| Row spacing between hex rows. | |
详细描述
Hexagon metrics shared by the map model and every mesh builder.
The layout matches the Catlike Coding "Hex Map" reference project: pointy-top hexes on the XZ plane, +X east, +Z north, odd rows shifted half a cell to the right, Y up. All radii are expressed in world units and are compile-time constants, so a different scale needs a different build rather than a setter.
在文件 HexMetrics.h 第 111 行定义.
成员函数说明
◆ bridge()
|
inlinestaticnoexcept |
Bridge vector from the solid edge of direction to the neighbour.
在文件 HexMetrics.h 第 214 行定义.
引用了 corner(), d, kBlendFactor , 以及 eve::hexmap::next().
◆ corner()
|
inlinestaticnoexcept |
Outer corner direction of a unit hex, scaled by scale.
在文件 HexMetrics.h 第 183 行定义.
引用了 direction, eve::hexmap::E, kInnerRadius, kOuterRadius, eve::hexmap::NE, eve::hexmap::NW, r, scale, eve::hexmap::SE, eve::hexmap::SW , 以及 eve::hexmap::W.
被这些函数引用 bridge(), firstCorner(), firstSolidCorner(), firstWaterCorner(), secondCorner(), secondSolidCorner(), secondWaterCorner(), solidEdgeMiddle() , 以及 waterBridge().
◆ elevationY()
|
inlinestaticnoexcept |
Y coordinate of a cell's elevation surface.
在文件 HexMetrics.h 第 265 行定义.
引用了 elevation , 以及 kElevationStep.
被这些函数引用 eve::hexmap::HexMap::cellPosition() , 以及 eve::hexmap::HexMap::pickCell().
◆ firstCorner()
|
inlinestaticnoexcept |
First (counter-clockwise) outer corner of direction.
在文件 HexMetrics.h 第 198 行定义.
◆ firstSolidCorner()
|
inlinestaticnoexcept |
◆ firstWaterCorner()
|
inlinestaticnoexcept |
◆ innerDiameter()
|
inlinestaticconstexprnoexcept |
◆ innerRadius()
|
inlinestaticconstexprnoexcept |
Inner radius of a hex cell.
在文件 HexMetrics.h 第 176 行定义.
引用了 kInnerRadius.
被这些函数引用 eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh() , 以及 solidRadius().
◆ outerRadius()
|
inlinestaticconstexprnoexcept |
◆ rowSpacing()
|
inlinestaticconstexprnoexcept |
◆ secondCorner()
|
inlinestaticnoexcept |
Second (clockwise) outer corner of direction.
在文件 HexMetrics.h 第 200 行定义.
引用了 corner(), d , 以及 eve::hexmap::next().
◆ secondSolidCorner()
|
inlinestaticnoexcept |
Second solid corner of direction.
在文件 HexMetrics.h 第 204 行定义.
引用了 corner(), d, kSolidFactor , 以及 eve::hexmap::next().
◆ secondWaterCorner()
|
inlinestaticnoexcept |
Second water corner of direction.
在文件 HexMetrics.h 第 212 行定义.
引用了 corner(), d, kWaterFactor , 以及 eve::hexmap::next().
◆ solidEdgeMiddle()
|
inlinestaticnoexcept |
Midpoint of the solid edge of direction.
在文件 HexMetrics.h 第 206 行定义.
引用了 corner(), d, kSolidFactor , 以及 eve::hexmap::next().
被这些函数引用 eve::hexmap::buildRiverMesh() , 以及 eve::hexmap::buildRoadMesh().
◆ solidRadius()
|
inlinestaticnoexcept |
Distance from a cell centre to its nearest edge midpoint.
在文件 HexMetrics.h 第 278 行定义.
引用了 innerRadius() , 以及 kSolidFactor.
◆ streamBedY()
|
inlinestaticnoexcept |
Y coordinate of a river bed inside a cell.
在文件 HexMetrics.h 第 269 行定义.
引用了 elevation, kElevationStep , 以及 kStreamBedElevationOffset.
被这些函数引用 eve::hexmap::buildRiverMesh().
◆ terraceLerp()
|
inlinestaticnoexcept |
Interpolates a position along a terraced slope.
- 参数
-
a Start position (low side). b End position (high side). step Terrace step in [0, kTerraceSteps].
在文件 HexMetrics.h 第 229 行定义.
引用了 a, b, h, kHorizontalTerraceStepSize, kVerticalTerraceStepSize, step, v , 以及 eve::hexmap::HexVec3::x.
◆ terraceLerpWeights()
|
inlinestaticnoexcept |
Interpolates terrain weights along a terraced slope.
Lerp.
在文件 HexMetrics.h 第 239 行定义.
引用了 a, b, h, kHorizontalTerraceStepSize, eve::hexmap::lerp() , 以及 step.
◆ wallLerp()
Position of the midpoint of a wall between two elevations.
在文件 HexMetrics.h 第 246 行定义.
引用了 kWallElevationOffset, kWallYOffset, v , 以及 eve::hexmap::HexVec3::x.
◆ wallThicknessOffset()
|
inlinestaticnoexcept |
Half-thickness offset applied to a wall segment.
在文件 HexMetrics.h 第 255 行定义.
引用了 dx, dz, kWallThickness, s , 以及 eve::hexmap::HexVec3::x.
◆ waterBridge()
|
inlinestaticnoexcept |
Bridge vector from the water edge of direction to the neighbour.
在文件 HexMetrics.h 第 218 行定义.
引用了 corner(), d, kWaterBlendFactor , 以及 eve::hexmap::next().
◆ waterSurfaceY()
|
inlinestaticnoexcept |
Y coordinate of a water surface at waterLevel.
在文件 HexMetrics.h 第 273 行定义.
引用了 kElevationStep, kWaterElevationOffset , 以及 waterLevel.
被这些函数引用 eve::hexmap::buildWaterMesh().
类成员变量说明
◆ kBlendFactor
|
staticconstexpr |
Factor of the blend region between two neighbouring cells.
在文件 HexMetrics.h 第 132 行定义.
被这些函数引用 bridge().
◆ kCellPerturbStrength
|
staticconstexpr |
Strength of the XZ position perturbation.
在文件 HexMetrics.h 第 138 行定义.
被这些函数引用 eve::hexmap::HexNoise::perturb().
◆ kChunkSizeX
|
staticconstexpr |
Chunk size in the X dimension.
在文件 HexMetrics.h 第 156 行定义.
被这些函数引用 eve::hexmap::buildFogMesh(), eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh(), eve::hexmap::buildWaterMesh(), eve::hexmap::HexMap::chunkCell(), eve::hexmap::HexMap::chunkCenter(), eve::hexmap::loadHexMap(), eve::procgen::registerHexTerrainAlgorithms() , 以及 eve::hexmap::HexMap::reset().
◆ kChunkSizeZ
|
staticconstexpr |
Chunk size in the Z dimension.
在文件 HexMetrics.h 第 158 行定义.
被这些函数引用 eve::hexmap::buildFogMesh(), eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh(), eve::hexmap::buildWaterMesh(), eve::hexmap::HexMap::chunkCell(), eve::hexmap::HexMap::chunkCenter(), eve::hexmap::loadHexMap(), eve::procgen::registerHexTerrainAlgorithms() , 以及 eve::hexmap::HexMap::reset().
◆ kDefaultOuterRadius
|
staticconstexpr |
Default outer (corner) radius of one hex cell.
在文件 HexMetrics.h 第 118 行定义.
◆ kElevationPerturbStrength
|
staticconstexpr |
Strength of the vertical elevation perturbation.
在文件 HexMetrics.h 第 140 行定义.
◆ kElevationStep
|
staticconstexpr |
Vertical distance between two elevation levels.
在文件 HexMetrics.h 第 120 行定义.
被这些函数引用 elevationY(), eve::hexmap::HexMap::pickCell(), streamBedY() , 以及 waterSurfaceY().
◆ kHorizontalTerraceStepSize
|
staticconstexpr |
Horizontal fraction of one terrace interpolation step.
在文件 HexMetrics.h 第 126 行定义.
被这些函数引用 terraceLerp() , 以及 terraceLerpWeights().
◆ kInnerDiameter
|
staticconstexpr |
◆ kInnerRadius
|
staticconstexpr |
Inner (edge) radius of one hex cell in world units.
在文件 HexMetrics.h 第 167 行定义.
被这些函数引用 corner() , 以及 innerRadius().
◆ kInnerToOuter
|
staticconstexpr |
Ratio of the inner radius to the outer radius.
在文件 HexMetrics.h 第 116 行定义.
◆ kMaxElevation
|
staticconstexpr |
Maximum editable elevation.
在文件 HexMetrics.h 第 162 行定义.
被这些函数引用 eve::hexmap::generateSphereMap(), eve::hexmap::HexSphereMap::pickCell(), eve::hexmap::HexMap::pickCell(), eve::hexmap::HexMap::setElevation(), eve::hexmap::HexSphereMap::setElevation(), eve::hexmap::HexMap::setWaterLevel() , 以及 eve::hexmap::HexSphereMap::setWaterLevel().
◆ kMinElevation
|
staticconstexpr |
Minimum editable elevation.
在文件 HexMetrics.h 第 160 行定义.
被这些函数引用 eve::hexmap::generateSphereMap(), eve::hexmap::HexMap::pickCell(), eve::hexmap::HexMap::setElevation() , 以及 eve::hexmap::HexSphereMap::setElevation().
◆ kOuterRadius
|
staticconstexpr |
Outer (corner) radius of one hex cell in world units.
在文件 HexMetrics.h 第 165 行定义.
被这些函数引用 corner(), outerRadius() , 以及 eve::hexmap::HexMap::pickCell().
◆ kOuterToInner
|
staticconstexpr |
Ratio of the outer radius to the inner radius.
在文件 HexMetrics.h 第 114 行定义.
◆ kRiverSurfaceScale
|
staticconstexpr |
◆ kRowSpacing
|
staticconstexpr |
◆ kSolidFactor
|
staticconstexpr |
Factor of the solid, uniform-colour hex inscribed in a cell.
在文件 HexMetrics.h 第 130 行定义.
被这些函数引用 eve::hexmap::buildRoadMesh(), firstSolidCorner(), secondSolidCorner(), solidEdgeMiddle() , 以及 solidRadius().
◆ kStreamBedElevationOffset
|
staticconstexpr |
Elevation offset of a carved river bed relative to the cell.
在文件 HexMetrics.h 第 142 行定义.
被这些函数引用 streamBedY().
◆ kTerracesPerSlope
|
staticconstexpr |
Terraces generated per slope.
在文件 HexMetrics.h 第 122 行定义.
◆ kTerraceSteps
|
staticconstexpr |
Terrace interpolation steps per slope (terracesPerSlope * 2 + 1).
在文件 HexMetrics.h 第 124 行定义.
◆ kVerticalTerraceStepSize
|
staticconstexpr |
Vertical fraction of one terrace interpolation step.
在文件 HexMetrics.h 第 128 行定义.
被这些函数引用 terraceLerp().
◆ kWallElevationOffset
|
staticconstexpr |
Wall elevation offset, matching the vertical terrace step size.
在文件 HexMetrics.h 第 154 行定义.
被这些函数引用 wallLerp().
◆ kWallHeight
|
staticconstexpr |
Height of a city/farm wall.
在文件 HexMetrics.h 第 148 行定义.
◆ kWallThickness
|
staticconstexpr |
◆ kWallYOffset
|
staticconstexpr |
Vertical wall offset; negative so walls do not float above the surface.
在文件 HexMetrics.h 第 150 行定义.
被这些函数引用 wallLerp().
◆ kWaterBlendFactor
|
staticconstexpr |
Factor of the water blend region between two cells.
在文件 HexMetrics.h 第 136 行定义.
被这些函数引用 waterBridge().
◆ kWaterElevationOffset
|
staticconstexpr |
Elevation offset of a water surface relative to the water level.
在文件 HexMetrics.h 第 144 行定义.
被这些函数引用 waterSurfaceY().
◆ kWaterFactor
|
staticconstexpr |
Factor of the solid water surface inscribed in a cell.
在文件 HexMetrics.h 第 134 行定义.
被这些函数引用 firstWaterCorner() , 以及 secondWaterCorner().
该类的文档由以下文件生成:
- src/modules/hexmap/HexMetrics.h