载入中...
搜索中...
未找到
TerrainWaterField.h
浏览该文件的文档.
1#pragma once
2#include <memory>
3#include "common/Result.h"
4
5namespace eve::procgen {
6class Heightmap;
7struct TerrainSedimentSettings;
8struct TerrainThermalSettings;
9
12
15 float spacingX = 1, spacingZ = 1, heightScale = 1, waterScale = 1;
16 float dt = 0.05F, precipitation = 0.000004F, evaporation = 0.000004F;
17 float flowAcceleration = -0.00049F;
18};
19
22 float depth = 0, velocityX = 0, velocityZ = 0;
23 float fluxRight = 0, fluxLeft = 0, fluxBottom = 0, fluxTop = 0;
24};
25
28 float dropletVolume = 0.3F;
29 float absorptionRate = 0.05F;
31};
32
47
58 const Heightmap& source, int iterations);
59
72public:
80 TerrainWaterField& operator=(TerrainWaterField&&) noexcept;
84 TerrainWaterField& operator=(const TerrainWaterField&) = delete;
85
94 [[nodiscard]] Result<int> reset(int width, int height, float depth = 0);
104 [[nodiscard]] Result<int> advance(const Heightmap& terrain, const TerrainWaterSettings& settings);
121 [[nodiscard]] Result<int> advanceHydraulic(Heightmap& heights, Heightmap& sediment,
123 const TerrainSedimentSettings& reaction,
126 [[nodiscard]] Result<TerrainWaterSample> sample(int x, int z) const;
135 [[nodiscard]] Result<int> exportChannel(Heightmap& target, TerrainWaterChannel channel) const;
137 int getWidth() const noexcept;
139 int getHeight() const noexcept;
140
141private:
142 struct Impl;
143 std::unique_ptr<Impl> impl_;
144};
145} // namespace eve::procgen
LogicalId target
float x
Definition AnimClip.cpp:738
float z
Definition AnimClip.cpp:738
std::string terrain
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::uint32_t height
std::uint32_t width
Move-only, checked operation results for the common layer.
TerrainWaterField water
TerrainThermalSettings settings
TerrainThermalSettings thermal
Heightmap sediment
int iterations
Definition TreeMesh.cpp:311
const UnitySourceAsset & source
std::uint32_t depth
Move-only operation result carrying either a value or Status.
Definition Result.h:155
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from ...
Definition Heightmap.h:21
Owned water/flux/velocity state for deterministic execution of the Pcg water stage....
~TerrainWaterField()
Destroy all owned simulation buffers; no external registrations are retained.
TerrainWaterField()
Construct an empty field; reset must succeed before advance or sample.
TerrainWaterField(TerrainWaterField &&) noexcept
Transfer owned buffers; a moved-from field is empty and can be reset.
Result< int > generateTerrainVelocityFlowMap(Heightmap &target, const Heightmap &source, int iterations)
Generate Pcg HeightMap.FlowMap's normalized four-direction velocity magnitude.
TerrainWaterChannel
Stored scalar channels; Pcg erosion masks read FluxRight or VelocityX, not vector magnitude.
Result< int > generateTerrainWaterFlowMap(Heightmap &target, const Heightmap &source, const TerrainWaterFlowMapSettings &settings)
Generate Pcg's legacy transposed water-flow accumulation map.
Effective sediment coefficients from Hydraulic.compute, after UI conversion. The source hardcodes har...
Explicit simulation controls for the Pcg eight-neighbor thermal kernel. Height differences are multip...
Controls Pcg's legacy offline WaterFlowMap droplet tracer.
Value snapshot of one water cell; direction order follows Hydraulic.compute (Z+ is bottom).
Explicit constants for the source hydraulic water-flow equations, after UI unit conversion.
float flowAcceleration
Signed flowRate*gravity; source default is negative.