载入中...
搜索中...
未找到
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;
48
49private:
51 struct Impl;
52 std::unique_ptr<Impl> impl_;
53 friend EVENGINE_API_DOMAINS Result<int> paintTerrainSplatLayer(TerrainSplatmap&, const Heightmap&, int);
54 friend EVENGINE_API_DOMAINS Result<int> applyGtsHeightBlend(TerrainSplatmap&, const TerrainSplatmap&,
55 const GtsHeightBlendSet&, float);
56 friend EVENGINE_API_DOMAINS Result<int> alignTerrainSplatTextures(TerrainSplatmap&, TerrainSplatmap&,
58 friend EVENGINE_API_DOMAINS Result<TerrainMultiTileReport> paintTerrainSplatLayerMultiTile(
59 const std::vector<struct TerrainSplatTile>&, const Heightmap&, int, const TerrainStampSettings&, bool,
60 const std::vector<std::string>&);
61};
62
65 float terrainAOriginX = 0;
66 float terrainAOriginZ = 0;
67 float terrainAWidth = 1;
68 float terrainADepth = 1;
69 float terrainBOriginX = 1;
70 float terrainBOriginZ = 0;
71 float terrainBWidth = 1;
72 float terrainBDepth = 1;
73 float blendStrength = 1;
74 int blendWidth = 8;
75 float adjacencyTolerance = 1.5F;
76};
77
86 TerrainSplatmap& terrainB,
88
91public:
99 GtsHeightBlendSet& operator=(GtsHeightBlendSet&&) noexcept;
101 GtsHeightBlendSet& operator=(const GtsHeightBlendSet&) = delete;
103 [[nodiscard]] Result<int> addLayer(const Heightmap& height, float contrast = 1,
104 float brightness = 1, float increase = 0);
106 int getLayerCount() const noexcept;
107private:
108 struct Impl;
109 std::unique_ptr<Impl> impl_;
110 friend EVENGINE_API_DOMAINS Result<int> applyGtsHeightBlend(TerrainSplatmap&, const TerrainSplatmap&,
111 const GtsHeightBlendSet&, float);
112};
113
118[[nodiscard]] EVENGINE_API_DOMAINS Result<int> applyGtsHeightBlend(TerrainSplatmap& output,
119 const TerrainSplatmap& input,
120 const GtsHeightBlendSet& heights, float blendFactor);
121
124 std::string name;
125 TerrainSplatmap* splatmap = nullptr;
126 double originX = 0, originZ = 0, width = 1, depth = 1;
127 bool worldMap = false;
128};
129
138 int targetLayer);
139
145 const std::vector<TerrainSplatTile>& tiles, const Heightmap& operationPaint, int targetLayer,
146 const TerrainStampSettings& operationSettings, bool worldMapOperation = false,
147 const std::vector<std::string>& validTerrainNames = {});
148
155public:
167 [[nodiscard]] Result<int> addTile(const std::string& name, const TerrainSplatmap& splatmap, double originX,
168 double originZ, double width, double depth, bool worldMap = false);
170 [[nodiscard]] Result<int> paint(const Heightmap& operationPaint, int targetLayer,
171 const TerrainStampSettings& operationSettings,
172 bool worldMapOperation = false);
174 [[nodiscard]] Result<int> copyTile(const std::string& name, TerrainSplatmap& output) const;
176 [[nodiscard]] Result<int> undo();
178 [[nodiscard]] Result<int> redo();
180 int getTileCount() const noexcept;
182 int getLastChangedSamples() const noexcept;
184 int getLastAffectedTiles() const noexcept;
186 int getOperationCount() const noexcept;
188 int getAppliedCount() const noexcept;
189private:
190 struct Impl;
191 std::unique_ptr<Impl> impl_;
192};
193} // namespace eve::procgen
double y
double x
LogicalId target
std::string output
float contrast
std::string name
Definition ECS.cpp:154
EvpackChunkInput input
Definition Evpack.cpp:170
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::uint32_t height
std::uint32_t width
OceanWakeSettings settings
TileLayer * layer
Move-only, checked operation results for the common layer.
std::vector< WfcTile > tiles
std::uint32_t depth
Move-only operation result carrying either a value or Status.
Definition Result.h:176
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.
Own a complete Pcg-style terrain grid and its height, splat, detail, tree, object and probe state....
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.