载入中...
搜索中...
未找到

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()

static HexVec3 eve::hexmap::HexMetrics::bridge ( HexDirection  d)
inlinestaticnoexcept

Bridge vector from the solid edge of direction to the neighbour.

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

引用了 corner(), d, kBlendFactor , 以及 eve::hexmap::next().

◆ corner()

static HexVec3 eve::hexmap::HexMetrics::corner ( HexDirection  direction,
float  scale = 1.f 
)
inlinestaticnoexcept

◆ elevationY()

static float eve::hexmap::HexMetrics::elevationY ( int  elevation)
inlinestaticnoexcept

Y coordinate of a cell's elevation surface.

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

引用了 elevation , 以及 kElevationStep.

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

◆ firstCorner()

static HexVec3 eve::hexmap::HexMetrics::firstCorner ( HexDirection  d)
inlinestaticnoexcept

First (counter-clockwise) outer corner of direction.

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

引用了 corner() , 以及 d.

◆ firstSolidCorner()

static HexVec3 eve::hexmap::HexMetrics::firstSolidCorner ( HexDirection  d)
inlinestaticnoexcept

First solid corner of direction.

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

引用了 corner(), d , 以及 kSolidFactor.

◆ firstWaterCorner()

static HexVec3 eve::hexmap::HexMetrics::firstWaterCorner ( HexDirection  d)
inlinestaticnoexcept

First water corner of direction.

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

引用了 corner(), d , 以及 kWaterFactor.

◆ innerDiameter()

static constexpr float eve::hexmap::HexMetrics::innerDiameter ( )
inlinestaticconstexprnoexcept

Width of one hex column.

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

引用了 kInnerDiameter.

被这些函数引用 eve::hexmap::HexCoordinates::fromWorldPosition().

◆ innerRadius()

static constexpr float eve::hexmap::HexMetrics::innerRadius ( )
inlinestaticconstexprnoexcept

Inner radius of a hex cell.

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

引用了 kInnerRadius.

被这些函数引用 eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh() , 以及 solidRadius().

◆ outerRadius()

static constexpr float eve::hexmap::HexMetrics::outerRadius ( )
inlinestaticconstexprnoexcept

Radius of a hex cell in world units.

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

引用了 kOuterRadius.

被这些函数引用 eve::hexmap::HexCoordinates::fromWorldPosition().

◆ rowSpacing()

static constexpr float eve::hexmap::HexMetrics::rowSpacing ( )
inlinestaticconstexprnoexcept

Row spacing between hex rows.

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

引用了 kRowSpacing.

◆ secondCorner()

static HexVec3 eve::hexmap::HexMetrics::secondCorner ( HexDirection  d)
inlinestaticnoexcept

Second (clockwise) outer corner of direction.

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

引用了 corner(), d , 以及 eve::hexmap::next().

◆ secondSolidCorner()

static HexVec3 eve::hexmap::HexMetrics::secondSolidCorner ( HexDirection  d)
inlinestaticnoexcept

Second solid corner of direction.

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

引用了 corner(), d, kSolidFactor , 以及 eve::hexmap::next().

◆ secondWaterCorner()

static HexVec3 eve::hexmap::HexMetrics::secondWaterCorner ( HexDirection  d)
inlinestaticnoexcept

Second water corner of direction.

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

引用了 corner(), d, kWaterFactor , 以及 eve::hexmap::next().

◆ solidEdgeMiddle()

static HexVec3 eve::hexmap::HexMetrics::solidEdgeMiddle ( HexDirection  d)
inlinestaticnoexcept

Midpoint of the solid edge of direction.

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

引用了 corner(), d, kSolidFactor , 以及 eve::hexmap::next().

被这些函数引用 eve::hexmap::buildRiverMesh() , 以及 eve::hexmap::buildRoadMesh().

◆ solidRadius()

static float eve::hexmap::HexMetrics::solidRadius ( )
inlinestaticnoexcept

Distance from a cell centre to its nearest edge midpoint.

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

引用了 innerRadius() , 以及 kSolidFactor.

◆ streamBedY()

static float eve::hexmap::HexMetrics::streamBedY ( int  elevation)
inlinestaticnoexcept

Y coordinate of a river bed inside a cell.

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

引用了 elevation, kElevationStep , 以及 kStreamBedElevationOffset.

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

◆ terraceLerp()

static HexVec3 eve::hexmap::HexMetrics::terraceLerp ( HexVec3  a,
HexVec3  b,
int  step 
)
inlinestaticnoexcept

Interpolates a position along a terraced slope.

参数
aStart position (low side).
bEnd position (high side).
stepTerrace step in [0, kTerraceSteps].

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

引用了 a, b, h, kHorizontalTerraceStepSize, kVerticalTerraceStepSize, step, v , 以及 eve::hexmap::HexVec3::x.

被这些函数引用 eve::hexmap::EdgeVertices::terraceLerp().

◆ terraceLerpWeights()

static HexVec3 eve::hexmap::HexMetrics::terraceLerpWeights ( HexVec3  a,
HexVec3  b,
int  step 
)
inlinestaticnoexcept

Interpolates terrain weights along a terraced slope.

Lerp.

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

引用了 a, b, h, kHorizontalTerraceStepSize, eve::hexmap::lerp() , 以及 step.

◆ wallLerp()

static HexVec3 eve::hexmap::HexMetrics::wallLerp ( HexVec3  near,
HexVec3  far 
)
inlinestaticnoexcept

Position of the midpoint of a wall between two elevations.

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

引用了 kWallElevationOffset, kWallYOffset, v , 以及 eve::hexmap::HexVec3::x.

◆ wallThicknessOffset()

static HexVec3 eve::hexmap::HexMetrics::wallThicknessOffset ( HexVec3  near,
HexVec3  far 
)
inlinestaticnoexcept

Half-thickness offset applied to a wall segment.

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

引用了 dx, dz, kWallThickness, s , 以及 eve::hexmap::HexVec3::x.

◆ waterBridge()

static HexVec3 eve::hexmap::HexMetrics::waterBridge ( HexDirection  d)
inlinestaticnoexcept

Bridge vector from the water edge of direction to the neighbour.

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

引用了 corner(), d, kWaterBlendFactor , 以及 eve::hexmap::next().

◆ waterSurfaceY()

static float eve::hexmap::HexMetrics::waterSurfaceY ( int  waterLevel)
inlinestaticnoexcept

Y coordinate of a water surface at waterLevel.

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

引用了 kElevationStep, kWaterElevationOffset , 以及 waterLevel.

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

类成员变量说明

◆ kBlendFactor

constexpr float eve::hexmap::HexMetrics::kBlendFactor = 1.f - kSolidFactor
staticconstexpr

Factor of the blend region between two neighbouring cells.

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

被这些函数引用 bridge().

◆ kCellPerturbStrength

constexpr float eve::hexmap::HexMetrics::kCellPerturbStrength = 4.f
staticconstexpr

Strength of the XZ position perturbation.

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

被这些函数引用 eve::hexmap::HexNoise::perturb().

◆ kChunkSizeX

◆ kChunkSizeZ

◆ kDefaultOuterRadius

constexpr float eve::hexmap::HexMetrics::kDefaultOuterRadius = 10.f
staticconstexpr

Default outer (corner) radius of one hex cell.

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

◆ kElevationPerturbStrength

constexpr float eve::hexmap::HexMetrics::kElevationPerturbStrength = 1.5f
staticconstexpr

Strength of the vertical elevation perturbation.

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

被这些函数引用 eve::hexmap::HexNoise::elevationPerturb().

◆ kElevationStep

constexpr float eve::hexmap::HexMetrics::kElevationStep = 3.f
staticconstexpr

Vertical distance between two elevation levels.

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

被这些函数引用 elevationY(), eve::hexmap::HexMap::pickCell(), streamBedY() , 以及 waterSurfaceY().

◆ kHorizontalTerraceStepSize

constexpr float eve::hexmap::HexMetrics::kHorizontalTerraceStepSize = 1.f / static_cast<float>(kTerraceSteps)
staticconstexpr

Horizontal fraction of one terrace interpolation step.

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

被这些函数引用 terraceLerp() , 以及 terraceLerpWeights().

◆ kInnerDiameter

constexpr float eve::hexmap::HexMetrics::kInnerDiameter = kInnerRadius * 2.f
staticconstexpr

Width of one hex column.

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

被这些函数引用 innerDiameter().

◆ kInnerRadius

constexpr float eve::hexmap::HexMetrics::kInnerRadius = kDefaultOuterRadius * kOuterToInner
staticconstexpr

Inner (edge) radius of one hex cell in world units.

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

被这些函数引用 corner() , 以及 innerRadius().

◆ kInnerToOuter

constexpr float eve::hexmap::HexMetrics::kInnerToOuter = 1.f / kOuterToInner
staticconstexpr

Ratio of the inner radius to the outer radius.

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

◆ kMaxElevation

◆ kMinElevation

constexpr int eve::hexmap::HexMetrics::kMinElevation = -4
staticconstexpr

◆ kOuterRadius

constexpr float eve::hexmap::HexMetrics::kOuterRadius = kDefaultOuterRadius
staticconstexpr

Outer (corner) radius of one hex cell in world units.

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

被这些函数引用 corner(), outerRadius() , 以及 eve::hexmap::HexMap::pickCell().

◆ kOuterToInner

constexpr float eve::hexmap::HexMetrics::kOuterToInner = 0.866025404f
staticconstexpr

Ratio of the outer radius to the inner radius.

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

◆ kRiverSurfaceScale

constexpr float eve::hexmap::HexMetrics::kRiverSurfaceScale = 0.6f
staticconstexpr

Width of the river channel.

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

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

◆ kRowSpacing

constexpr float eve::hexmap::HexMetrics::kRowSpacing = kDefaultOuterRadius * 1.5f
staticconstexpr

Row spacing between hex rows.

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

被这些函数引用 rowSpacing().

◆ kSolidFactor

constexpr float eve::hexmap::HexMetrics::kSolidFactor = 0.8f
staticconstexpr

Factor of the solid, uniform-colour hex inscribed in a cell.

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

被这些函数引用 eve::hexmap::buildRoadMesh(), firstSolidCorner(), secondSolidCorner(), solidEdgeMiddle() , 以及 solidRadius().

◆ kStreamBedElevationOffset

constexpr float eve::hexmap::HexMetrics::kStreamBedElevationOffset = -1.75f
staticconstexpr

Elevation offset of a carved river bed relative to the cell.

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

被这些函数引用 streamBedY().

◆ kTerracesPerSlope

constexpr int eve::hexmap::HexMetrics::kTerracesPerSlope = 2
staticconstexpr

Terraces generated per slope.

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

◆ kTerraceSteps

constexpr int eve::hexmap::HexMetrics::kTerraceSteps = kTerracesPerSlope * 2 + 1
staticconstexpr

Terrace interpolation steps per slope (terracesPerSlope * 2 + 1).

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

◆ kVerticalTerraceStepSize

constexpr float eve::hexmap::HexMetrics::kVerticalTerraceStepSize = 1.f / static_cast<float>(kTerracesPerSlope + 1)
staticconstexpr

Vertical fraction of one terrace interpolation step.

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

被这些函数引用 terraceLerp().

◆ kWallElevationOffset

constexpr float eve::hexmap::HexMetrics::kWallElevationOffset = kVerticalTerraceStepSize
staticconstexpr

Wall elevation offset, matching the vertical terrace step size.

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

被这些函数引用 wallLerp().

◆ kWallHeight

constexpr float eve::hexmap::HexMetrics::kWallHeight = 4.f
staticconstexpr

Height of a city/farm wall.

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

◆ kWallThickness

constexpr float eve::hexmap::HexMetrics::kWallThickness = 0.75f
staticconstexpr

Wall thickness.

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

被这些函数引用 wallThicknessOffset().

◆ kWallYOffset

constexpr float eve::hexmap::HexMetrics::kWallYOffset = -1.f
staticconstexpr

Vertical wall offset; negative so walls do not float above the surface.

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

被这些函数引用 wallLerp().

◆ kWaterBlendFactor

constexpr float eve::hexmap::HexMetrics::kWaterBlendFactor = 1.f - kWaterFactor
staticconstexpr

Factor of the water blend region between two cells.

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

被这些函数引用 waterBridge().

◆ kWaterElevationOffset

constexpr float eve::hexmap::HexMetrics::kWaterElevationOffset = -0.5f
staticconstexpr

Elevation offset of a water surface relative to the water level.

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

被这些函数引用 waterSurfaceY().

◆ kWaterFactor

constexpr float eve::hexmap::HexMetrics::kWaterFactor = 0.6f
staticconstexpr

Factor of the solid water surface inscribed in a cell.

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

被这些函数引用 firstWaterCorner() , 以及 secondWaterCorner().


该类的文档由以下文件生成: