载入中...
搜索中...
未找到
TerrainMask.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Result.h"
4
5namespace eve::procgen {
6class Heightmap;
7struct TerrainStampSettings;
8enum class TerrainMaskBlend;
9
12 float featureSize = 10, concavity = 1;
13};
14
31 const Heightmap& heights,
32 const Heightmap& curve,
34 TerrainMaskBlend mode);
35
38 float radius = 0.001F, worldUnits = -400, intensity = 0.7F;
39 int steps = 32, directions = 16;
40};
41
59 const Heightmap& heights,
60 const Heightmap& curve,
62 TerrainMaskBlend mode);
63
79 const Heightmap& curve, float distance);
80
83
96[[nodiscard]] EVENGINE_API_DOMAINS Result<int> applyTerrainStrength(Heightmap& target, const Heightmap& source,
97 const Heightmap& curve, TerrainStrengthMode mode,
98 float strength, bool invert);
99
112[[nodiscard]] EVENGINE_API_DOMAINS Result<int> smoothTerrainMask(Heightmap& target, const Heightmap& input,
113 float verticality, float blurRadius);
114
117 float heightXX = 1, heightXZ = 0, heightZX = 0, heightZZ = 1;
119 float brushXX = 1, brushXZ = 0, brushZX = 0, brushZZ = 1;
121 float strength = 1;
122};
123
126 double originX = 0, originZ = 0, spacingX = 1, spacingZ = 1;
127 int width = 1, height = 1;
128};
129
146 int contextWidth, int contextHeight,
147 const TerrainSampleGrid& heights);
148
164 const Heightmap& newHeights, const Heightmap& brush,
166
184 Heightmap& target, const Heightmap& oldHeights, const Heightmap& erosion, const Heightmap& brush,
185 const TerrainBrushBlendSettings& spatial, const Heightmap& curve, TerrainStrengthMode mode, float strength,
186 bool userInvert);
187
190
199
211 const Heightmap& curve);
212
226 float minimum, float maximum,
227 const Heightmap& filterCurve,
228 const Heightmap& strengthCurve);
229
245 float spacingX, float spacingZ,
246 float heightScale = 1);
247
262 const Heightmap& filterCurve,
263 const Heightmap& strengthCurve);
264} // namespace eve::procgen
LogicalId target
EvpackChunkInput input
Definition Evpack.cpp:170
#define EVENGINE_API_DOMAINS
Definition Export.h:110
float maximum[3]
float minimum[3]
float distance
World3D * world
Move-only, checked operation results for the common layer.
Heightmap curve
TerrainThermalSettings settings
double spacingZ
double spacingX
const UnitySourceAsset & source
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
TerrainStrengthMode
StrengthTransform pass order; source pass 0 named Multiply actually replaces with the curve value.
Definition TerrainMask.h:82
Result< int > generateTerrainDistanceMask(Heightmap &target, const TerrainDistanceMaskSettings &s, const Heightmap &filterCurve, const Heightmap &strengthCurve)
Generate a transformed distance mask using circle, X, Z or rounded-square coordinates.
Result< int > transformTerrainMask(Heightmap &target, const Heightmap &source, const Heightmap &curve)
Transform scalar input through a clamped bilinear one-row curve texture.
Result< int > generateTerrainRangeMask(Heightmap &target, const Heightmap &source, float minimum, float maximum, const Heightmap &filterCurve, const Heightmap &strengthCurve)
Generate height/range fitness with smoothstep followed by filter and strength curves.
Result< int > generateTerrainCurvatureMask(Heightmap &target, const Heightmap &input, const Heightmap &heights, const Heightmap &curve, const TerrainCurvatureSettings &s, TerrainMaskBlend mode)
Radially blur heights, derive source curvature, transform its curve and combine with an input mask.
Result< int > configureTerrainBrushWorld(TerrainBrushBlendSettings &target, const TerrainStampSettings &w, int contextWidth, int contextHeight, const TerrainSampleGrid &h)
Configure paint-context UV matrices from world sample centers and a rotated stamp footprint.
Result< int > blendTerrainBrush(Heightmap &target, const Heightmap &oldHeights, const Heightmap &newHeights, const Heightmap &brush, const TerrainBrushBlendSettings &s)
Blend an erosion scalar output with old heights through transformed brush UVs.
TerrainMaskBlend
Ordered scalar-mask arithmetic; intermediate values are not clamped.
Definition TerrainStamp.h:9
Result< int > smoothTerrainMask(Heightmap &target, const Heightmap &input, float verticality, float blurRadius)
Apply Pcg's two-pass Smooth ImageMask operation to a scalar mask.
Result< int > applyTerrainStrength(Heightmap &target, const Heightmap &source, const Heightmap &curve, TerrainStrengthMode mode, float strength, bool invert)
Apply the reference strength curve, inversion, mode and final interpolation.
Result< int > deriveTerrainSlope(Heightmap &target, const Heightmap &heights, float spacingX, float spacingZ, float heightScale)
Derive the shader's slope metric 1-normal.y from world-scaled height gradients.
Result< int > generateTerrainErosionMask(Heightmap &target, const Heightmap &oldHeights, const Heightmap &erosion, const Heightmap &brush, const TerrainBrushBlendSettings &spatial, const Heightmap &curve, TerrainStrengthMode mode, float strength, bool userInvert)
Compose spatial erosion-output blending and the source's inverted strength filter atomically.
Result< int > generateTerrainConcavityMask(Heightmap &target, const Heightmap &input, const Heightmap &heights, const Heightmap &curve, const TerrainConcavitySettings &s, TerrainMaskBlend mode)
Generate source normalized-gradient concavity with border attenuation and indexed curve lookup.
TerrainDistanceAxis
Distance coordinates used by the Pcg distance-mask shader.
Result< int > growShrinkTerrainMask(Heightmap &target, const Heightmap &source, const Heightmap &curve, float distance)
Ordered radial Grow/Shrink followed by the reference strength curve.
Paint-context affine UV mappings, evaluated at destination pixel centers.
Concavity source controls; featureSize is in height texels, concavity is signed.
Definition TerrainMask.h:11
Radial curvature controls; radius is UV distance, worldUnits scales signed height-minus-blur.
Definition TerrainMask.h:37
Value-only UV transform; distances are relative to the target raster, rotation in radians.
World X/Z positions of height sample centers, with positive spacing and dimensions.
Value configuration for a rectangular stamp in world X/Z coordinates.