载入中...
搜索中...
未找到
TerrainSplatmap.h
浏览该文件的文档.
1#pragma once
2
3#include <memory>
4#include <string>
5#include <vector>
6
7#include "common/Result.h"
8
9namespace eve::procgen {
10class Heightmap;
11struct TerrainMultiTileReport;
12struct TerrainStampSettings;
13class GtsHeightBlendSet;
14struct TerrainTextureAlignSettings;
15
21public:
29 TerrainSplatmap& operator=(TerrainSplatmap&&) noexcept;
33 TerrainSplatmap& operator=(const TerrainSplatmap&);
35 [[nodiscard]] Result<int> initialize(int width, int height, int layerCount, int defaultLayer = 0);
37 [[nodiscard]] Result<float> sample(int layer, int x, int y) const;
39 [[nodiscard]] Result<int> copyLayer(int layer, Heightmap& output) const;
41 int getLastChangedSamples() const noexcept;
43 int getWidth() const noexcept;
45 int getHeight() const noexcept;
47 int getLayerCount() const noexcept;
48private:
49 struct Impl;
50 std::unique_ptr<Impl> impl_;
51 friend EVENGINE_API_DOMAINS Result<int> paintTerrainSplatLayer(TerrainSplatmap&, const Heightmap&, int);
52 friend EVENGINE_API_DOMAINS Result<int> applyGtsHeightBlend(TerrainSplatmap&, const TerrainSplatmap&,
53 const GtsHeightBlendSet&, float);
54 friend EVENGINE_API_DOMAINS Result<int> alignTerrainSplatTextures(TerrainSplatmap&, TerrainSplatmap&,
56 friend EVENGINE_API_DOMAINS Result<TerrainMultiTileReport> paintTerrainSplatLayerMultiTile(
57 const std::vector<struct TerrainSplatTile>&, const Heightmap&, int, const TerrainStampSettings&, bool,
58 const std::vector<std::string>&);
59};
60
63 float terrainAOriginX = 0;
64 float terrainAOriginZ = 0;
65 float terrainAWidth = 1;
66 float terrainADepth = 1;
67 float terrainBOriginX = 1;
68 float terrainBOriginZ = 0;
69 float terrainBWidth = 1;
70 float terrainBDepth = 1;
71 float blendStrength = 1;
72 int blendWidth = 8;
73 float adjacencyTolerance = 1.5F;
74};
75
84 TerrainSplatmap& terrainB,
86
89public:
97 GtsHeightBlendSet& operator=(GtsHeightBlendSet&&) noexcept;
99 GtsHeightBlendSet& operator=(const GtsHeightBlendSet&) = delete;
101 [[nodiscard]] Result<int> addLayer(const Heightmap& height, float contrast = 1,
102 float brightness = 1, float increase = 0);
104 int getLayerCount() const noexcept;
105private:
106 struct Impl;
107 std::unique_ptr<Impl> impl_;
108 friend EVENGINE_API_DOMAINS Result<int> applyGtsHeightBlend(TerrainSplatmap&, const TerrainSplatmap&,
109 const GtsHeightBlendSet&, float);
110};
111
116[[nodiscard]] EVENGINE_API_DOMAINS Result<int> applyGtsHeightBlend(TerrainSplatmap& output,
117 const TerrainSplatmap& input,
118 const GtsHeightBlendSet& heights, float blendFactor);
119
122 std::string name;
123 TerrainSplatmap* splatmap = nullptr;
124 double originX = 0, originZ = 0, width = 1, depth = 1;
125 bool worldMap = false;
126};
127
136 int targetLayer);
137
143 const std::vector<TerrainSplatTile>& tiles, const Heightmap& operationPaint, int targetLayer,
144 const TerrainStampSettings& operationSettings, bool worldMapOperation = false,
145 const std::vector<std::string>& validTerrainNames = {});
146
153public:
165 [[nodiscard]] Result<int> addTile(const std::string& name, const TerrainSplatmap& splatmap, double originX,
166 double originZ, double width, double depth, bool worldMap = false);
168 [[nodiscard]] Result<int> paint(const Heightmap& operationPaint, int targetLayer,
169 const TerrainStampSettings& operationSettings,
170 bool worldMapOperation = false);
172 [[nodiscard]] Result<int> copyTile(const std::string& name, TerrainSplatmap& output) const;
174 [[nodiscard]] Result<int> undo();
176 [[nodiscard]] Result<int> redo();
178 int getTileCount() const noexcept;
180 int getLastChangedSamples() const noexcept;
182 int getLastAffectedTiles() const noexcept;
184 int getOperationCount() const noexcept;
186 int getAppliedCount() const noexcept;
187private:
188 struct Impl;
189 std::unique_ptr<Impl> impl_;
190};
191} // namespace eve::procgen
LogicalId target
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
std::string output
float contrast
EvpackChunkInput input
Definition Evpack.cpp:170
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::uint32_t height
std::uint32_t width
std::string name
TileLayer * layer
Move-only, checked operation results for the common layer.
TerrainThermalSettings settings
std::uint32_t depth
std::vector< WfcTile > tiles
Definition WfcSimple.cpp:22
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Owning ordered GTS layer-height rasters and their alpha-channel transforms.
GtsHeightBlendSet(GtsHeightBlendSet &&) noexcept
Gts height blend set.
~GtsHeightBlendSet()
Gts height blend set.
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from ...
Definition Heightmap.h:21
Owning script-safe multi-terrain splat transaction and all-tile undo history. Input maps are copied....
~TerrainMultiSplatWorkspace()
Terrain multi splat workspace.
TerrainMultiSplatWorkspace(TerrainMultiSplatWorkspace &&) noexcept
Terrain multi splat workspace.
Owning normalized terrain texture-layer weights with atomic mutation. Layers share one finite width/h...
TerrainSplatmap(TerrainSplatmap &&) noexcept
Terrain splatmap.
~TerrainSplatmap()
Terrain splatmap.
Result< TerrainMultiTileReport > paintTerrainSplatLayerMultiTile(const std::vector< TerrainSplatTile > &tiles, const Heightmap &operationPaint, int targetLayer, const TerrainStampSettings &operationSettings, bool worldMapOperation, const std::vector< std::string > &validTerrainNames)
Paint one shared Pcg Texture-domain operation raster across selected tiles atomically.
Result< int > paintTerrainSplatLayer(TerrainSplatmap &target, const Heightmap &paint, int targetLayer)
Replace one terrain layer with a normalized paint raster and proportionally renormalize all other lay...
Result< int > alignTerrainSplatTextures(TerrainSplatmap &terrainA, TerrainSplatmap &terrainB, const TerrainTextureAlignSettings &settings)
Blend texture weights on adjacent terrain edges using Pcg's synchronized-noise equation.
Completed multi-tile stamp statistics and Pcg-compatible affected-pixel mappings.
Borrowed terrain splat owner and world geometry for one synchronous texture transaction.
Value configuration for a rectangular stamp in world X/Z coordinates.
World-space placement and Pcg-compatible seam blending controls for two splatmaps.