载入中...
搜索中...
未找到
TerrainWaterField.cpp
浏览该文件的文档.
16 return invalid("terrain.waterFlow: transposed finite rasters and valid droplet controls required");
29 if (!isRepresentable(deposited)) return invalid("terrain.waterFlow: accumulation exceeds float range");
50 if (!isRepresentable(pooled)) return invalid("terrain.waterFlow: pooled height exceeds float range");
77Result<int> generateTerrainVelocityFlowMap(Heightmap& target, const Heightmap& source, int iterations) {
81 return invalid("terrain.velocityFlow: matching finite rasters and nonnegative iterations required");
102 if (!isRepresentable(value)) return invalid("terrain.velocityFlow: outflow exceeds float range");
107 for (int direction = 0; direction < 4; ++direction) flow[i][direction] = next[direction] * scale;
116 const double outgoing = double(flow[i][left]) + flow[i][right] + flow[i][bottom] + flow[i][top];
123 if (!isRepresentable(value)) return invalid("terrain.velocityFlow: water value exceeds float range");
140 if (!isRepresentable(magnitude)) return invalid("terrain.velocityFlow: velocity exceeds float range");
162 if (width <= 0 || height <= 0 || width > std::numeric_limits<int>::max() / height || !std::isfinite(depth) ||
178 DiagnosticCode::InvalidArgument, "terrain.water.sample: coordinate outside initialized field"));
182Result<int> TerrainWaterField::exportChannel(Heightmap& target, TerrainWaterChannel channel) const {
184 if (!impl_ || !validRaster(target) || target.getWidth() != impl_->width || target.getHeight() != impl_->height)
185 return invalid("terrain.water.exportChannel: matching finite target and initialized field required");
202Result<int> TerrainWaterField::advance(const Heightmap& terrain, const TerrainWaterSettings& s) {
206 if (!impl_ || !validRaster(terrain) || terrain.getWidth() != impl_->width || terrain.getHeight() != impl_->height ||
207 !positive(s.spacingX) || !positive(s.spacingZ) || !positive(s.heightScale) || !positive(s.waterScale) ||
210 return invalid("terrain.water.advance: matching finite terrain and finite simulation controls required");
235 if (!isRepresentable(value)) return invalid("terrain.water.advance: flux exceeds finite float range");
254 const double inFlow = double(left.fluxRight) + right.fluxLeft + bottom.fluxTop + top.fluxBottom;
290 sediment.getWidth() != impl_->width || sediment.getHeight() != impl_->height || iterations < 0 ||
293 "terrain.hydraulic: initialized field, distinct matching rasters, nonnegative heights/iterations required");
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
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
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....
Definition TerrainWaterField.h:71
Result< int > advanceHydraulic(Heightmap &heights, Heightmap &sediment, const TerrainWaterSettings &water, const TerrainSedimentSettings &reaction, const TerrainThermalSettings &thermal, int iterations)
Advance water, source sediment and thermal stages as one transaction.
Definition TerrainWaterField.cpp:283
~TerrainWaterField()
Destroy all owned simulation buffers; no external registrations are retained.
int getHeight() const noexcept
Return Z sample count, or zero for an empty/moved-from field.
Definition TerrainWaterField.cpp:158
Result< TerrainWaterSample > sample(int x, int z) const
Read an owned value snapshot; invalid coordinates or empty state return InvalidArgument.
Definition TerrainWaterField.cpp:175
Result< int > exportChannel(Heightmap &target, TerrainWaterChannel channel) const
Copy one stored channel into an existing matching raster for mask processing.
Definition TerrainWaterField.cpp:182
TerrainWaterField()
Construct an empty field; reset must succeed before advance or sample.
Result< int > reset(int width, int height, float depth=0)
Reset dimensions, uniform depth and zero flux/velocity atomically.
Definition TerrainWaterField.cpp:160
Result< int > advance(const Heightmap &terrain, const TerrainWaterSettings &settings)
Advance one injected time step, with clamped neighbor indices.
Definition TerrainWaterField.cpp:202
Result< int > publish(Heightmap &target, std::vector< float > candidate)
Publish.
Definition TerrainRasterInternal.h:62
Definition EvpackPointGraphLoader.h:12
Result< int > generateTerrainVelocityFlowMap(Heightmap &target, const Heightmap &source, int iterations)
Generate Pcg HeightMap.FlowMap's normalized four-direction velocity magnitude.
Definition TerrainWaterField.cpp:77
TerrainWaterChannel
Stored scalar channels; Pcg erosion masks read FluxRight or VelocityX, not vector magnitude.
Definition TerrainWaterField.h:11
@ FluxBottom
@ VelocityX
@ VelocityZ
@ FluxRight
EVENGINE_API_DOMAINS Result< int > applyTerrainSediment(Heightmap &heights, Heightmap &sediment, const Heightmap &velocityX, const Heightmap &velocityZ, const TerrainWaterSettings &water, const TerrainSedimentSettings &settings)
Apply the source sediment reaction and backtrace equations with atomic dual output.
Definition TerrainSediment.cpp:7
Result< int > generateTerrainWaterFlowMap(Heightmap &target, const Heightmap &source, const TerrainWaterFlowMapSettings &settings)
Generate Pcg's legacy transposed water-flow accumulation map.
Definition TerrainWaterField.cpp:8
Result< int > applyTerrainThermal(Heightmap &heights, Heightmap &sediment, const TerrainThermalSettings &settings)
Apply the source thermal equation, publishing height and sediment together.
Definition TerrainErosion.cpp:7
@ InvalidArgument
Effective sediment coefficients from Hydraulic.compute, after UI conversion. The source hardcodes har...
Definition TerrainErosion.h:14
Explicit simulation controls for the Pcg eight-neighbor thermal kernel. Height differences are multip...
Definition TerrainErosion.h:114
std::vector< TerrainWaterSample > cells
Definition TerrainWaterField.cpp:151
Controls Pcg's legacy offline WaterFlowMap droplet tracer.
Definition TerrainWaterField.h:27
Value snapshot of one water cell; direction order follows Hydraulic.compute (Z+ is bottom).
Definition TerrainWaterField.h:21
Explicit constants for the source hydraulic water-flow equations, after UI unit conversion.
Definition TerrainWaterField.h:14