载入中...
搜索中...
未找到
TerrainPipeline.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
6
7#include <cstdint>
8#include <cstddef>
9#include <string>
10#include <vector>
11
12namespace eve::procgen {
13
15struct ThermalErosionSettings { int iterations = 20; float talus = 0.02f; float strength = 0.35f; };
18 int iterations = 60; float rainfall = 0.012f; float evaporation = 0.08f;
19 float capacity = 2.f; float erosion = 0.18f; float deposition = 0.12f;
20};
23 int iterations = 8;
24 float riverThreshold = 0.015f;
25 float incision = 0.012f;
26 float maxDepth = 0.28f;
27 float bankWidth = 3.f;
29 float maxBreachDepth = 0.04f;
31 float coordinateScale = 1.f;
32};
33
35enum class Biome : uint8_t {
38};
39
42 int width = 0, height = 0;
43 std::vector<int8_t> flowDirection;
44 std::vector<float> flowVectorX, flowVectorY;
45 std::vector<float> flowAccumulation;
46 std::vector<float> lakeDepth;
47 std::vector<uint8_t> rivers;
48 std::vector<uint8_t> streamOrder;
49};
50
52struct ClimateMap {
53 int width = 0, height = 0;
54 std::vector<float> temperature, moisture;
55 std::vector<Biome> biomes;
56};
57
60 int width = 0, height = 0;
61 std::vector<float> wear;
62 std::vector<float> deposition;
63 std::vector<float> heightDelta;
65 int getWidth() const { return width; }
67 int getHeight() const { return height; }
69 float getWear(int x, int y) const;
71 float getDeposition(int x, int y) const;
73 float getHeightDelta(int x, int y) const;
74};
75
78public:
80 TerrainLayers() = default;
83
85 int getWidth() const;
87 int getHeight() const;
89 float getFlowAccumulation(int x, int y) const;
91 int getFlowDirection(int x, int y) const;
93 float getFlowVectorX(int x, int y) const;
95 float getFlowVectorY(int x, int y) const;
97 bool isRiver(int x, int y) const;
99 int getStreamOrder(int x, int y) const;
101 float getLakeDepth(int x, int y) const;
103 bool isLake(int x, int y, float minimumDepth = 0.001f) const;
105 float getTemperature(int x, int y) const;
107 float getMoisture(int x, int y) const;
109 int getBiome(int x, int y) const;
111 std::string getBiomeName(int x, int y) const;
112
114 const HydrologyMap &hydrology() const { return hydrology_; }
116 const ClimateMap &climate() const { return climate_; }
117
118private:
119 size_t index(int x, int y) const;
120 HydrologyMap hydrology_;
121 ClimateMap climate_;
122};
123
126public:
128 static void erodeThermal(Heightmap &heightmap, const ThermalErosionSettings &settings = {});
130 static void erodeHydraulic(Heightmap &heightmap, const HydraulicErosionSettings &settings = {});
132 static void erodeFluvial(Heightmap &heightmap, const FluvialErosionSettings &settings = {});
134 static TerrainErosionMap erodeFluvialDetailed(
135 Heightmap &heightmap, const FluvialErosionSettings &settings = {});
137 static HydrologyMap buildHydrology(const Heightmap &heightmap, float riverThreshold = 0.025f,
138 float seaLevel = 0.25f, float coordinateScale = 1.f,
139 bool classifyLakes = true);
141 static ClimateMap buildClimate(const Heightmap &heightmap, const HydrologyMap &hydrology,
142 float seaLevel = 0.25f, float latitude = 0.35f,
143 float coordinateScale = 1.f);
144};
145
146} // namespace eve::procgen
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::vector< ClimateData > climate
Current moisture and cloud state per cell.
std::uint32_t height
std::uint32_t width
TerrainThermalSettings settings
uint32_t index
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from ...
Definition Heightmap.h:21
Script-friendly ownership wrapper for baked hydrology and climate layers.
TerrainLayers()=default
Terrain layers.
const HydrologyMap & hydrology() const
Hydrology.
const ClimateMap & climate() const
Climate.
Deterministic CPU terrain baking stages shared by editors and runtime tools.
Biome
Biome public API.
ClimateMap public API.
std::vector< float > temperature
std::vector< Biome > biomes
std::vector< float > moisture
FluvialErosionSettings public API.
HydraulicErosionSettings public API.
HydrologyMap public API.
std::vector< float > flowVectorX
std::vector< uint8_t > rivers
std::vector< float > flowAccumulation
std::vector< float > flowVectorY
Normalized continuous downslope direction.
std::vector< int8_t > flowDirection
D8 neighbour index, or -1 for a sink.
std::vector< float > lakeDepth
Priority-Flood water depth; zero on drained terrain.
std::vector< uint8_t > streamOrder
Strahler order; zero outside the resolved river network.
Per-cell diagnostic outputs produced by an erosion stage.
int getHeight() const
Return the map height.
std::vector< float > deposition
Material deposited after transport, in heightmap units.
int getWidth() const
Return the map width.
std::vector< float > heightDelta
Final minus initial elevation; negative means net erosion.
std::vector< float > wear
Gross material removed, in heightmap units.
ThermalErosionSettings public API.