载入中...
搜索中...
未找到
HexSphereGenerator.cpp
浏览该文件的文档.
112 if (absLatitude > 0.72f && elevation >= 2) return static_cast<std::int32_t>(HexTerrainType::Snow);
117 if (moisture < 0.36f && absLatitude < 0.45f) return static_cast<std::int32_t>(HexTerrainType::Sand);
139 const HexVec3 coarse{direction.x * frequency, direction.y * frequency, direction.z * frequency};
140 const HexVec3 damp{direction.x * frequency * 2.7f + 41.3f, direction.y * frequency * 2.7f - 17.9f,
151 const float landFraction = std::clamp(static_cast<float>(settings.landPercentage) / 100.f, 0.f, 1.f);
163 const std::int32_t waterLevel = std::clamp(settings.waterLevel, HexMetrics::kMinElevation, HexMetrics::kMaxElevation);
181 map.setTerrainType(cell, terrainFor(elevation, moisture[static_cast<std::size_t>(cell)], latitude, waterLevel))
Stable, structured diagnostics shared by engine modules.
Packed per-cell state records of the hex map.
Pointy-top hex metrics, directions and vertex helpers.
Procedural terrain generator for a spherical hex map.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
void ignore(std::string_view reason={}) const noexcept
Explicitly discard this result after documenting the reason.
Definition Result.h:537
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Result< void > setWaterLevel(HexSphereCell c, std::int32_t waterLevel)
Sets a cell's water level, clamped to [0, kMaxElevation].
Definition HexSphereMap.cpp:410
Result< void > setElevation(HexSphereCell c, std::int32_t elevation)
Sets a cell's elevation, clamped to the editable range, and refreshes dependents.
Definition HexSphereMap.cpp:382
Result< void > setTerrainType(HexSphereCell c, std::int32_t terrainType)
Sets a cell's terrain palette index, clamped to the palette range.
Definition HexSphereMap.cpp:422
HexVec3 direction(HexSphereCell cell) const noexcept
Unit direction from the sphere centre to the centre of cell.
Definition HexSphereMap.h:163
Definition HexCell.h:9
Result< void > generateSphereMap(HexSphereMap &map, const HexSphereGeneratorSettings &settings)
Regenerates every cell of map procedurally.
Definition HexSphereGenerator.cpp:124
std::int32_t HexSphereCell
Dense identifier of one cell of a spherical hex topology.
Definition HexSphereTopology.h:16
@ InvalidArgument
Tunables of the spherical generator.
Definition HexSphereGenerator.h:23
Minimal 3-component float vector used by the hex mesh builders.
Definition HexMetrics.h:18