载入中...
搜索中...
未找到
TerrainObjectPlacement.h
浏览该文件的文档.
1#pragma once
2
3#include <cstdint>
4#include <memory>
5#include <string>
6#include <vector>
7
8#include "common/Result.h"
9
10namespace eve::procgen {
11class Heightmap;
12class PointSet;
13struct TerrainStampSettings;
14struct TerrainMultiTileReport;
15
19enum class TerrainObjectYOffsetMode : std::uint8_t { TerrainHeight, SeaLevel, Custom };
21enum class TerrainObjectOperationMode : std::uint8_t { Add, Replace, Remove };
22
48
51 float originX = 0, originZ = 0, width = 1, depth = 1, heightScale = 1;
52 float spacing = 10, spawnDensity = 1, jitterPercent = 0.5F;
53 float startOffsetX = 0, startOffsetZ = 0;
54 float failureRate = 0, minimumFitness = 0.5F, minimumInstanceFitness = 0.5F;
55 float minimumDirection = 0, maximumDirection = 360;
56 float boundsRadius = 1, boundsCheckQuality = 100, prototypeScale = 1;
57 bool boundsCollisionCheck = false;
58 float seaLevel = 0;
59 std::int32_t seed = 1;
60 std::uint64_t namespaceId = 1;
61 int maxPoints = 1000000;
62 std::string prototype;
63 std::vector<TerrainObjectInstanceSettings> instances;
65 [[nodiscard]] Result<int> addInstance(const TerrainObjectInstanceSettings& instance);
66};
67
82 PointSet& output, const Heightmap& fitness, const Heightmap& heights,
84
90 const Heightmap& fitness,
92 float removalStrength);
93
96 std::string name;
97 PointSet* objects = nullptr;
98 const Heightmap* heights = nullptr;
99 double originX = 0, originZ = 0, width = 1, depth = 1;
101 bool worldMap = false;
102 double originY = 0;
103};
104
115 const std::vector<TerrainObjectTile>& tiles, const Heightmap& operationFitness,
116 const TerrainObjectPlacementSettings& settings, const TerrainStampSettings& operationSettings,
117 TerrainObjectOperationMode mode, bool worldMapOperation, const std::vector<std::string>& validTerrainNames = {});
118
121public:
133 [[nodiscard]] Result<int> addTile(const std::string& name, const PointSet& objects, const Heightmap& heights,
134 double originX, double originZ, double width, double depth,
135 int resolutionX, int resolutionY, bool worldMap = false);
137 [[nodiscard]] Result<int> apply(const Heightmap& fitness, const TerrainObjectPlacementSettings& settings,
138 const TerrainStampSettings& operationSettings, TerrainObjectOperationMode mode,
139 bool worldMapOperation = false);
141 [[nodiscard]] Result<int> copyTile(const std::string& name, PointSet& output) const;
143 [[nodiscard]] Result<int> undo();
145 [[nodiscard]] Result<int> redo();
147 [[nodiscard]] int getTileCount() const noexcept;
149 [[nodiscard]] int getLastChangedSamples() const noexcept;
151 [[nodiscard]] int getLastAffectedTiles() const noexcept;
153 [[nodiscard]] int getOperationCount() const noexcept;
155 [[nodiscard]] int getAppliedCount() const noexcept;
156private:
157 struct Impl;
158 std::unique_ptr<Impl> impl_;
159};
160} // namespace eve::procgen
std::string output
std::string name
Definition ECS.cpp:154
EvpackChunkInput input
Definition Evpack.cpp:170
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::uint32_t width
OceanWakeSettings settings
Move-only, checked operation results for the common layer.
std::vector< WfcTile > tiles
int spacing
uint32_t seed
Definition TreeMesh.cpp:276
std::uint32_t depth
float heightScale
Move-only operation result carrying either a value or Status.
Definition Result.h:176
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from ...
Definition Heightmap.h:21
Script-friendly collection of attributed 3D samples.
Definition PointSet.h:59
Owning transactional multi-terrain object workspace with undo and redo snapshots.
~TerrainMultiObjectWorkspace()
Terrain multi object workspace.
TerrainMultiObjectWorkspace(TerrainMultiObjectWorkspace &&) noexcept
Terrain multi object workspace.
StateValue objects
Definition Snapshot.cpp:110
Result< int > removeTerrainObjectPoints(PointSet &output, const PointSet &input, const Heightmap &fitness, const TerrainObjectPlacementSettings &s, float removalStrength)
Remove matching prototype points wherever fitness is strictly above removalStrength.
TerrainObjectScaleMode
Pcg-compatible scale policy for one terrain object instance resource.
Result< TerrainMultiTileReport > applyTerrainObjectsMultiTile(const std::vector< TerrainObjectTile > &tiles, const Heightmap &fitness, const TerrainObjectPlacementSettings &s, const TerrainStampSettings &operationSettings, TerrainObjectOperationMode mode, bool worldMapOperation, const std::vector< std::string > &validTerrainNames)
Apply one Pcg-style game-object rule over mapped terrain tiles atomically.
Result< int > exportTerrainObjectPoints(PointSet &output, const Heightmap &fitness, const Heightmap &heights, const TerrainObjectPlacementSettings &s)
Export Pcg-style terrain game-object resources into an attributed PointSet atomically.
TerrainObjectYOffsetMode
Height reference used by one terrain object instance resource.
TerrainObjectOperationMode
Mutation performed by a multi-terrain game-object operation.
One resource entry emitted around each accepted Pcg game-object prototype location.
Deterministic Pcg SetTerrainGameObjects scan, collision and resource configuration.
std::vector< TerrainObjectInstanceSettings > instances
One exclusively borrowed terrain object owner and its immutable height source.
double originY
Added to sampled terrain height; explicit sea/custom height modes remain world absolute.
Value configuration for a rectangular stamp in world X/Z coordinates.