载入中...
搜索中...
未找到
TerrainDerivedMap.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Result.h"
4
5namespace eve::procgen {
6class Heightmap;
7
13[[nodiscard]] EVENGINE_API_DOMAINS Result<float> sampleTerrainHeightmapSafe(const Heightmap& source, int x, int z);
14
23[[nodiscard]] EVENGINE_API_DOMAINS Result<float> sampleTerrainHeightmapNormalized(const Heightmap& source, float x,
24 float z);
25
27[[nodiscard]] EVENGINE_API_DOMAINS Result<bool> terrainHeightmapHasData(const Heightmap& source);
29[[nodiscard]] EVENGINE_API_DOMAINS Result<bool> terrainHeightmapIsPowerOfTwo(const Heightmap& source);
30
38enum class TerrainHeightmapArithmetic { Add = 0, Subtract = 1, Multiply = 2, Divide = 3 };
40enum class TerrainHeightmapTransform { Invert = 0, Normalise = 1, Power = 2, Contrast = 3 };
42enum class TerrainHeightmapCopy { Always = 0, IfLess = 1, IfGreater = 2 };
44enum class TerrainHeightmapMeasure { Minimum = 0, Maximum = 1, Sum = 2, Average = 3, BaseLevel = 4 };
47
58 const Heightmap& source,
60
71 const Heightmap& source,
73
86 const Heightmap& source, int radius,
88
97[[nodiscard]] EVENGINE_API_DOMAINS Result<int> smoothTerrainHeightmap(Heightmap& target, const Heightmap& source,
98 int iterations);
99
108[[nodiscard]] EVENGINE_API_DOMAINS Result<int> smoothTerrainHeightmapRadius(Heightmap& target, const Heightmap& source,
109 int radius);
110
119[[nodiscard]] EVENGINE_API_DOMAINS Result<int> convolveTerrainHeightmap(Heightmap& target, const Heightmap& source,
120 const Heightmap& kernel);
121
130 const Heightmap& source);
131
140[[nodiscard]] EVENGINE_API_DOMAINS Result<int> quantizeTerrainHeightmap(Heightmap& target, const Heightmap& source,
141 float divisor);
142
155 Heightmap& target, const Heightmap& source, float operand, TerrainHeightmapArithmetic operation, bool clampResult,
156 float minValue, float maxValue);
157
170 Heightmap& target, const Heightmap& source, const Heightmap& operand, TerrainHeightmapArithmetic operation,
171 bool clampResult, float minValue, float maxValue);
172
181[[nodiscard]] EVENGINE_API_DOMAINS Result<int> lerpTerrainHeightmap(Heightmap& target, const Heightmap& source,
182 const Heightmap& values, const Heightmap& mask);
183
192[[nodiscard]] EVENGINE_API_DOMAINS Result<int> transformTerrainHeightmap(Heightmap& target, const Heightmap& source,
194 float parameter);
195
203[[nodiscard]] EVENGINE_API_DOMAINS Result<int> copyTerrainHeightmap(Heightmap& target, const Heightmap& source,
205
214[[nodiscard]] EVENGINE_API_DOMAINS Result<int> copyTerrainHeightmapClamped(Heightmap& target, const Heightmap& source,
215 float minValue, float maxValue);
216
223[[nodiscard]] EVENGINE_API_DOMAINS Result<int> flipTerrainHeightmap(Heightmap& target, const Heightmap& source);
224
233
243 const Heightmap& source,
244 const Heightmap& startHeights,
245 const Heightmap& curves);
246
255[[nodiscard]] EVENGINE_API_DOMAINS Result<double> measureTerrainHeightmapSlope(const Heightmap& source, float x,
256 float y,
258
260[[nodiscard]] EVENGINE_API_DOMAINS Result<int> fillTerrainHeightmap(Heightmap& target, float value);
262[[nodiscard]] EVENGINE_API_DOMAINS Result<int> setTerrainHeightmapSafe(Heightmap& target, int x, int y, float value);
264[[nodiscard]] EVENGINE_API_DOMAINS Result<int> setTerrainHeightmapRow(Heightmap& target, int rowX,
265 const Heightmap& values);
267[[nodiscard]] EVENGINE_API_DOMAINS Result<int> setTerrainHeightmapColumn(Heightmap& target, int columnZ,
268 const Heightmap& values);
270[[nodiscard]] Result<int> resetTerrainHeightmap(Heightmap& target);
271}
LogicalId target
ActionParameterOperation operation
double value
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float z
Definition AnimClip.cpp:738
int mask
std::map< std::string, Var > values
#define EVENGINE_API_DOMAINS
Definition Export.h:110
float radius
Move-only, checked operation results for the common layer.
int iterations
Definition TreeMesh.cpp:311
const UnitySourceAsset & source
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Result< int > resetTerrainHeightmap(Heightmap &target)
Reset a heightmap to Pcg's empty zero-by-zero state.
TerrainHeightmapNeighborhood
Pcg HeightMap neighborhood mutation modes.
Result< int > quantizeTerrainHeightmapTerraces(Heightmap &target, const Heightmap &source, const Heightmap &startHeights, const Heightmap &curves)
Apply Pcg's curve-driven Quantize overload using one sampled curve per raster row.
Result< int > generateTerrainHeightmapSlope(Heightmap &target, const Heightmap &source)
Generate Pcg HeightMap.SlopeMap's normalized gradient magnitude.
Result< int > setTerrainHeightmapRow(Heightmap &target, int rowX, const Heightmap &values)
Set Pcg's fixed-X row from a one-dimensional strip.
Result< int > copyTerrainHeightmapClamped(Heightmap &target, const Heightmap &source, float minValue, float maxValue)
Copy a Pcg heightmap with inclusive output clamping and normalized resampling.
Result< int > applyTerrainHeightmapRasterArithmetic(Heightmap &target, const Heightmap &source, const Heightmap &operand, TerrainHeightmapArithmetic operation, bool clampResult, float minValue, float maxValue)
Apply a raster Pcg HeightMap arithmetic operation, resampling a differently sized operand.
TerrainHeightmapCurvature
Pcg HeightMap.CurvatureMap modes in source enum order.
Result< int > flipTerrainHeightmap(Heightmap &target, const Heightmap &source)
Transpose a Pcg HeightMap exactly as HeightMap.Flip does.
Result< int > smoothTerrainHeightmap(Heightmap &target, const Heightmap &source, int iterations)
Apply Pcg HeightMap.Smooth's in-place four-neighbor passes.
TerrainHeightmapSlopeQuery
Pcg HeightMap point slope query variants.
Result< int > fillTerrainHeightmap(Heightmap &target, float value)
Fill a finite Pcg heightmap with one value clamped to [0,1].
Result< int > smoothTerrainHeightmapRadius(Heightmap &target, const Heightmap &source, int radius)
Apply Pcg HeightMap.SmoothRadius's scaled sliding-window filter, including its first-row omission.
Result< int > convolveTerrainHeightmap(Heightmap &target, const Heightmap &source, const Heightmap &kernel)
Apply Pcg HeightMap.Convolve with an odd square kernel and source-order in-place feedback.
Result< int > copyTerrainHeightmap(Heightmap &target, const Heightmap &source, TerrainHeightmapCopy mode)
Copy or conditionally merge a Pcg heightmap, resampling when dimensions differ.
Result< int > transformTerrainHeightmap(Heightmap &target, const Heightmap &source, TerrainHeightmapTransform transform, float parameter)
Apply Pcg Invert, Normalise, Power, or Contrast to a finite heightmap.
Result< int > setTerrainHeightmapColumn(Heightmap &target, int columnZ, const Heightmap &values)
Set Pcg's fixed-Z column from a one-dimensional strip.
Result< bool > terrainHeightmapHasData(const Heightmap &source)
Return whether a heightmap contains a valid positive-size sample array.
Result< float > sampleTerrainHeightmapSafe(const Heightmap &source, int x, int z)
Read a finite heightmap at an integer coordinate clamped to its nearest border.
TerrainHeightmapTransform
Pcg HeightMap whole-raster value transforms.
Result< int > quantizeTerrainHeightmap(Heightmap &target, const Heightmap &source, float divisor)
Quantize every sample using Pcg HeightMap.Quantize's Mathf.Round rule.
Result< bool > terrainHeightmapIsPowerOfTwo(const Heightmap &source)
Return whether both positive heightmap dimensions are powers of two; malformed storage fails.
TerrainHeightmapMeasure
Pcg HeightMap read-only scalar measurements.
Result< double > measureTerrainHeightmap(const Heightmap &source, TerrainHeightmapMeasure measure)
Measure Pcg height range, sum, average, or scanner base level from current samples.
Result< int > filterTerrainHeightmapNeighborhood(Heightmap &target, const Heightmap &source, int radius, TerrainHeightmapNeighborhood mode)
Apply Pcg HeightMap.DeNoise, GrowEdges, or ShrinkEdges in source traversal order.
TerrainHeightmapCopy
Pcg HeightMap.Copy conditional modes in source enum order.
Result< float > sampleTerrainHeightmapNormalized(const Heightmap &source, float x, float z)
Read Pcg HeightMap's normalized bilinear sample using x*width and z*depth coordinates.
Result< int > lerpTerrainHeightmap(Heightmap &target, const Heightmap &source, const Heightmap &values, const Heightmap &mask)
Lerp source toward values under a mask using Pcg's clamped Mathf.Lerp semantics.
TerrainHeightmapAspect
Pcg HeightMap.Aspect modes in source enum order.
Result< int > generateTerrainHeightmapAspect(Heightmap &target, const Heightmap &source, TerrainHeightmapAspect mode)
Derive Pcg HeightMap.Aspect's aspect, northerness, or easterness raster.
Result< int > setTerrainHeightmapSafe(Heightmap &target, int x, int y, float value)
Set one sample after clamping its coordinates to the nearest border.
Result< int > applyTerrainHeightmapScalarArithmetic(Heightmap &target, const Heightmap &source, float operand, TerrainHeightmapArithmetic operation, bool clampResult, float minValue, float maxValue)
Apply a scalar Pcg HeightMap arithmetic operation with optional clamping.
TerrainHeightmapArithmetic
Pcg HeightMap pointwise arithmetic operations.
Result< double > measureTerrainHeightmapSlope(const Heightmap &source, float x, float y, TerrainHeightmapSlopeQuery mode)
Evaluate one of Pcg HeightMap's three point-slope formulas.
Result< int > generateTerrainHeightmapCurvature(Heightmap &target, const Heightmap &source, TerrainHeightmapCurvature mode)
Derive Pcg HeightMap.CurvatureMap's normalized differential curvature.