载入中...
搜索中...
未找到
TerrainWorldWorkspaceInternal.h
浏览该文件的文档.
1#pragma once
2#include "procgen/PointSet.h"
9namespace eve::procgen {
19 struct Snapshot {
20 std::vector<Heightmap> heights, holes;
21 std::vector<TerrainSplatmap> splats;
22 std::vector<TerrainDetailLayer> details;
23 std::vector<PointSet> trees, objects, probes;
25 };
27 std::vector<Tile> tiles;
29 std::vector<Snapshot> history;
30 int cursor = 0;
32 std::unique_ptr<Impl> runCandidate;
34 std::size_t runNext = 0;
36
37 Impl() = default;
38 Impl(const Impl& other) : settings(other.settings), last(other.last), history(other.history), cursor(other.cursor) {
39 tiles.reserve(other.tiles.size());
40 for (const auto& source : other.tiles) {
41 Tile tile;
42 tile.name = source.name;
43 tile.heights = source.heights;
44 tile.holes = source.holes;
45 tile.splat = source.splat;
46 tile.detail = source.detail;
47 tile.trees = source.trees;
48 tile.objects = source.objects;
49 tile.probes = source.probes;
50 tile.originX = source.originX;
51 tile.originZ = source.originZ;
52 tiles.push_back(std::move(tile));
53 }
54 }
57 for (const auto& tile : tiles) {
58 result.heights.push_back(tile.heights);
59 result.holes.push_back(tile.holes);
60 result.splats.push_back(tile.splat);
61 result.details.push_back(tile.detail);
62 result.trees.push_back(tile.trees);
63 result.objects.push_back(tile.objects);
64 result.probes.push_back(tile.probes);
65 }
66 result.report = last;
67 return result;
68 }
69 void restore(const Snapshot& value) {
70 for (std::size_t i = 0; i < tiles.size(); ++i) {
71 tiles[i].heights = value.heights[i];
72 tiles[i].holes = value.holes[i];
73 tiles[i].splat = value.splats[i];
74 tiles[i].detail = value.details[i];
75 tiles[i].trees = value.trees[i];
76 tiles[i].objects = value.objects[i];
77 tiles[i].probes = value.probes[i];
78 }
79 last = value.report;
80 }
81 void record() {
82 history.resize(static_cast<std::size_t>(cursor + 1));
83 history.push_back(snapshot());
84 ++cursor;
85 }
86};
87
88} // namespace eve::procgen
Poco::JSON::Object::Ptr result
Object::Ptr value
std::string_view source
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
Owned integer terrain-detail layer, independent of graphics and resource registries....
Own an ordered mixed-domain Pcg-style spawn recipe. Rule IDs are stable and unique....
Owning normalized terrain texture-layer weights with atomic mutation. Layers share one finite width/h...
TerrainWorldRunStatus
Observable lifecycle of a caller-driven staged world spawn.
Completed multi-tile stamp statistics and Pcg-compatible affected-pixel mappings.
Validated Pcg-style centered terrain-grid topology.