载入中...
搜索中...
未找到
BuildLayerStack.cpp
浏览该文件的文档.
63 DiagnosticCode::InvalidArgument, "artifact index is out of range", {}, {}, "procgen.buildLayers"));
67 Diagnostic::error(DiagnosticCode::TypeMismatch, "artifact is not a mesh", {}, {}, "procgen.buildLayers"));
74 DiagnosticCode::InvalidArgument, "artifact index is out of range", {}, {}, "procgen.buildLayers"));
77 return Result<PointSet>::failure(Diagnostic::error(DiagnosticCode::TypeMismatch, "artifact is not a point set",
88Result<void> BuildLayerStack::addTileLayer(std::string id, bool enabled, float cellSize, float height,
92 Diagnostic::error(DiagnosticCode::InvalidArgument, "layer id is empty", {}, {}, "procgen.buildLayers"));
95 Diagnostic::error(DiagnosticCode::Conflict, "duplicate layer id", id, {}, "procgen.buildLayers"));
97 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "tile dimensions are invalid",
103Result<void> BuildLayerStack::addObjectLayer(std::string id, bool enabled, const ObjectBuildLayer& layer) {
106 Diagnostic::error(DiagnosticCode::InvalidArgument, "layer id is empty", {}, {}, "procgen.buildLayers"));
109 Diagnostic::error(DiagnosticCode::Conflict, "duplicate layer id", id, {}, "procgen.buildLayers"));
121 Diagnostic::error(DiagnosticCode::NotFound, "unknown layer", std::string(id), {}, "procgen.buildLayers"));
133 return std::holds_alternative<TileLayer>(layers_[std::size_t(index)].definition) ? "tiles" : "objects";
149Result<BuildLayerExecution> BuildLayerStack::executeRegion(const Grid2D& grid, const PointSet& points,
221 Diagnostic::error(DiagnosticCode::ParseError, "invalid build-layer header", {}, {}, "procgen.buildLayers"));
241 return Result<void>::failure(Diagnostic::error(DiagnosticCode::ParseError, "invalid TILE record", {},
243 auto applied = replacement.addTileLayer(std::move(id), enabled != 0, cellSize, height, std::move(group));
248 return Result<void>::failure(Diagnostic::error(DiagnosticCode::ParseError, "invalid OBJECT record", {},
259 DiagnosticCode::ParseError, "unknown build-layer record: " + kind, {}, {}, "procgen.buildLayers"));
264 DiagnosticCode::ParseError, "trailing build-layer record data", {}, {}, "procgen.buildLayers"));
267 return Result<void>::failure(Diagnostic::error(DiagnosticCode::ParseError, "build-layer END record is missing",
Stable, structured diagnostics shared by engine modules.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Immutable-by-convention result of one complete build-stack execution.
Definition BuildLayerStack.h:35
Result< PointSet > getPoints(int index) const
Copy a point artifact, or return a typed failure for a bad index/type.
Definition BuildLayerStack.cpp:71
Result< MeshBuild > getMesh(int index) const
Copy a mesh artifact, or return a typed failure for a bad index/type.
Definition BuildLayerStack.cpp:60
Ordered, versioned executor for procedural tile and object build layers.
Definition BuildLayerStack.h:60
Result< BuildLayerExecution > execute(const Grid2D &grid, const PointSet &points, const PointSet *orientation=nullptr) const
Execute every enabled layer in stable insertion order.
Definition BuildLayerStack.cpp:140
Result< void > setEnabled(std::string_view id, bool enabled)
Definition BuildLayerStack.cpp:114
std::string serializeDefinition() const
Serialize ordered definitions using EVPCG_BUILD_LAYERS schema version 1.
Definition BuildLayerStack.cpp:197
bool isLayerEnabled(int index) const noexcept
True when layer enabled.
Definition BuildLayerStack.cpp:136
Result< void > addObjectLayer(std::string id, bool enabled, const ObjectBuildLayer &layer)
Append an object layer by value. Layer ids are unique.
Definition BuildLayerStack.cpp:103
Result< void > addTileLayer(std::string id, bool enabled, float cellSize, float height, std::string group)
Append a grid-to-mesh tile layer. Layer ids are unique.
Definition BuildLayerStack.cpp:88
Result< void > deserializeDefinition(std::string_view definition)
Atomically restore version 1; unknown fields and malformed embedded layers are rejected.
Definition BuildLayerStack.cpp:214
Result< BuildLayerExecution > executeRegion(const Grid2D &grid, const PointSet &points, const BuildLayerRegion ®ion, const PointSet *orientation=nullptr) const
Execute enabled layers for one half-open cluster region.
Definition BuildLayerStack.cpp:149
Intermediate 2D generation result. cells store semantic ids (see Semantic.h), not tile GIDs — convert...
Definition Grid2D.h:36
Typed procedural mesh graph composing grid, point and topology domains.
Definition MeshGraph.h:21
Deterministic TileWorldCreator-style object build layer.
Definition ObjectBuildLayer.h:37
Result< void > deserializeDefinition(std::string_view definition)
Atomically replace settings from schema version 1; unknown records are rejected.
Definition ObjectBuildLayer.cpp:348
Result< int > appendPointFrom(const PointSet &source, std::size_t sourceIndex)
Append a point and its attributes from another set.
Definition PointSet.cpp:69
void reserve(std::size_t count)
Reserve point storage without changing point or attribute row counts.
Definition PointSet.cpp:60
Definition EvpackPointGraphLoader.h:12
@ InvalidArgument
@ TypeMismatch
A stable reference resolved to a different canonical domain type.
@ NotFound
@ ParseError
@ Conflict
Half-open grid and world-space bounds used for one incremental cluster build.
Definition BuildLayerStack.h:23