载入中...
搜索中...
未找到
RoadTerrainWorkspace.h
浏览该文件的文档.
1#pragma once
2#include "common/Value.h"
5
6#include <functional>
7#include <memory>
8#include <span>
9#include <string>
10#include <vector>
11
12namespace eve::procgen::road {
15 std::string resourceId;
16 int width = 0, height = 0;
17 std::vector<int> density;
18};
21 std::string id, resourceId;
22 float x = 0.f, y = 0.f, z = 0.f, yaw = 0.f, width = 1.f, height = 1.f;
23};
29 std::string id;
30 float originX = 0.f, originZ = 0.f, sizeX = 1.f, sizeZ = 1.f, heightScale = 1.f;
32 std::vector<Heightmap> splatLayers;
33 std::vector<RoadTerrainDetail> details;
34 std::vector<RoadTerrainTree> trees;
35 float originY = 0.f;
36};
39 float blendDistance = 2.f, maxVerticalDelta = 2.f;
40 int splatLayer = -1;
41 bool clearDetails = true, clearTrees = true, cutTunnelHoles = false;
43 std::size_t maximumWork = 16u * 1024u * 1024u;
44 float splatOpacity = 1.f;
45};
48 std::reference_wrapper<const MeshBuild> mesh;
50};
60public:
70 RoadTerrainWorkspace& operator=(const RoadTerrainWorkspace&) = delete;
75 [[nodiscard]] Result<int> initialize(std::vector<RoadTerrainTile> tiles);
84 [[nodiscard]] Result<int> apply(const MeshBuild& mesh, const RoadTerrainWriteOptions& options);
93 [[nodiscard]] Result<int> applyBatch(std::span<const RoadTerrainWrite> writes, std::size_t maximumWork);
97 [[nodiscard]] Result<int> undo();
101 [[nodiscard]] Result<int> redo();
105 [[nodiscard]] Result<RoadTerrainTile> copyTile(const std::string& id) const;
109 [[nodiscard]] Result<Value> capture() const;
113 [[nodiscard]] Result<int> restore(const Value& snapshot);
114
115private:
116 struct Impl;
117 std::unique_ptr<Impl> impl_;
118};
119} // namespace eve::procgen::road
#define EVENGINE_API_DOMAINS
Definition Export.h:110
OceanMeshSettings mesh
std::vector< WfcTile > tiles
const SquirrelValueOptions & options
Owning, renderer-independent dynamic values.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from ...
Definition Heightmap.h:21
CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packe...
Definition MeshBuild.h:20
Single mutable owner of imported terrain tiles and their complete-channel history....
RoadTerrainWorkspace(RoadTerrainWorkspace &&) noexcept
Transfer ownership; moved-from objects can be initialized again.
~RoadTerrainWorkspace()
Destroy owned tiles and history.
Owned detail raster keyed by the external terrain's stable resource identity.
Renderer-neutral complete tile value, handed into one RoadTerrainWorkspace owner. Splat layers are no...
std::vector< RoadTerrainDetail > details
std::vector< RoadTerrainTree > trees
float originY
World height baseline; absent schema-v1 fields migrate to zero.
Owned terrain tree instance; its stable identity survives removal, undo and save.
Explicit channel selection for one all-tile atomic write; no implicit optional providers.
bool tunnelHolesAtPortalsOnly
Cut authored portal surfaces; false selects the legacy full footprint.
float splatOpacity
Finite [0,1] target weight ceiling; multiplies coverage for splats only.
int splatLayer
Negative one preserves texture weights; otherwise paints the selected layer.
One synchronous terrain operation; mesh is borrowed until the batch returns, options are copied value...
std::reference_wrapper< const MeshBuild > mesh