载入中...
搜索中...
未找到
GeneratedArtifactRecipes.cpp
浏览该文件的文档.
52 const std::uint32_t value = seed ^ (std::uint32_t(x) * 0x9e3779b9u) ^ (std::uint32_t(y) * 0x85ebca6bu);
72 anchors.add(float(width - 1) * xStep, 0.f, (float(height - 1) + float((width - 1) & 1) * .5f) * zStep);
95 const float keepWidth = std::clamp(params.getFloat("keepWidth", width * .25f), 6.f, width * .55f);
96 const float keepDepth = std::clamp(params.getFloat("keepDepth", depth * .24f), 6.f, depth * .55f);
111eve::Result<ArtifactPart> partFromMesh(std::string role, ArtifactId parent, const BuildKey &parentKey, MeshBuild mesh,
115 return rejectedPart(eve::DiagnosticCode::InvalidArgument, "cannot derive child build key for " + role);
118 return makeArtifactPart(std::move(role), childId, ArtifactType::MeshData, eve::SchemaVersion(1),
122eve::Result<ArtifactPart> partFromCollider(std::string role, ArtifactId parent, const BuildKey &parentKey,
126 return rejectedPart(eve::DiagnosticCode::InvalidArgument, "cannot derive child build key for " + role);
129 return makeArtifactPart(std::move(role), childId, ArtifactType::Collider, eve::SchemaVersion(1),
134eve::Result<ArtifactPart> partFromGrid(std::string role, ArtifactId parent, const BuildKey &parentKey, Grid2D grid,
138 return rejectedPart(eve::DiagnosticCode::InvalidArgument, "cannot derive child build key for " + role);
141 return makeArtifactPart(std::move(role), childId, ArtifactType::Grid, eve::SchemaVersion(1), std::move(*childKey),
145eve::Result<ArtifactPart> partFromPoints(std::string role, ArtifactId parent, const BuildKey &parentKey,
149 return rejectedPart(eve::DiagnosticCode::InvalidArgument, "cannot derive child build key for " + role);
152 return makeArtifactPart(std::move(role), childId, ArtifactType::PointSet, eve::SchemaVersion(1),
157bool appendPart(eve::Result<ArtifactPart> &&result, std::vector<ArtifactPart> &parts, eve::Status &failure) {
166eve::Result<GeneratedArtifact> generateComposite(const Params ¶ms, ArtifactId id, std::string_view recipe,
170 return rejectedArtifact(eve::DiagnosticCode::InvalidArgument, "top-level artifact identity must not be nil");
173 return rejectedArtifact(eve::DiagnosticCode::InvalidArgument, "recipe or parameters cannot form a build key");
201 auto topologyPart = partFromGrid("topology", id, *key, std::move(topology), std::move(topologyMeta));
208 auto anchorsPart = partFromPoints("anchors", id, *key, std::move(anchors), std::move(anchorsMeta));
220 return makeArtifact(id, ArtifactType::Composite, eve::SchemaVersion(1), *key, bounds, {}, std::move(metadata),
227 return generateComposite(params, id, "mesh.hexterrain", generateHexTerrainMesh, makeHexTopology(params),
232 return generateComposite(params, id, "mesh.castle", generateCastleMesh, makeCastleTopology(params),
236eve::Result<GeneratedArtifact> generateMeshArtifact(std::string_view recipeId, const Params ¶ms, ArtifactId id) {
241 return rejectedArtifact(eve::DiagnosticCode::InvalidArgument, "top-level artifact identity must not be nil");
244 return rejectedArtifact(eve::DiagnosticCode::InvalidArgument, "recipe or parameters cannot form a build key");
255 return makeArtifact(id, ArtifactType::MeshData, eve::SchemaVersion(1), *key, bounds, {}, std::move(metadata),
Owning, backend-neutral products published by procedural generation.
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Id128 child(std::string_view role) const noexcept
Derives a deterministic child UUID for a hierarchical identity.
Definition Identity.h:191
static std::optional< BuildKey > fromCanonical(std::string_view canonical)
Construct a build key from canonical text.
Definition BuildKey.cpp:27
static std::optional< BuildKey > forRecipe(std::string_view recipeId, const Params ¶ms)
Derive a compact deterministic key for a recipe and parameters.
Definition BuildKey.cpp:32
CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packe...
Definition MeshBuild.h:20
static MeshRecipeRegistry & instance()
Access the process-wide mesh recipe registry.
Definition MarchingCubes.cpp:456
@ Collider
@ PointSet
Definition EvpackPointGraphLoader.h:12
EVENGINE_API_DOMAINS eve::Result< GeneratedArtifact > generateRoadNetworkArtifact(const Params ¶ms, ArtifactId id)
Generate a road composite containing mesh, collider, terrain footprint, navigation and placement poin...
Definition RoadArtifact.cpp:363
bool generateHexTerrainMesh(const Params ¶ms, MeshBuild &out, std::string &error)
Build a deterministic, flat-top hexagonal continent mesh.
Definition HexTerrain.cpp:373
bool generateCastleMesh(const Params &p, MeshBuild &out, std::string &error)
Build a complete, walkable, multi-ring medieval castle.
Definition CastleMesh.cpp:104
EVENGINE_API_DOMAINS eve::Result< GeneratedArtifact > generateCastleArtifact(const Params ¶ms, ArtifactId id)
Generate a castle composite containing mesh, collider, ring topology and gate/keep anchors.
Definition GeneratedArtifactRecipes.cpp:231
eve::Result< ArtifactPart > makeArtifactPart(std::string role, ArtifactId id, ArtifactType type, eve::SchemaVersion schemaVersion, BuildKey buildKey, Bounds bounds, std::vector< ArtifactId > dependencies, eve::Value::Object metadata, ArtifactLeafPayload payload)
Validate and construct a leaf part for a composite artifact.
Definition GeneratedArtifact.cpp:1002
@ Composite
@ MeshData
@ Collider
@ PointSet
eve::ArtifactId ArtifactId
Common strong UUID identity for one published procedural artifact.
Definition GeneratedArtifact.h:43
EVENGINE_API_DOMAINS eve::Result< GeneratedArtifact > generateHexTerrainArtifact(const Params ¶ms, ArtifactId id)
Generate a hex-terrain composite containing mesh, collider, topology and world anchors.
Definition GeneratedArtifactRecipes.cpp:226
EVENGINE_API_DOMAINS eve::Result< GeneratedArtifact > generateMeshArtifact(std::string_view recipeId, const Params ¶ms, ArtifactId id)
Generate any registered mesh recipe as a CPU artifact.
Definition GeneratedArtifactRecipes.cpp:236
eve::Result< GeneratedArtifact > makeArtifact(ArtifactId id, ArtifactType type, eve::SchemaVersion schemaVersion, BuildKey buildKey, Bounds bounds, std::vector< ArtifactId > dependencies, eve::Value::Object metadata, GeneratedArtifact::Payload payload)
Validate and construct one artifact record.
Definition GeneratedArtifact.cpp:985
WidgetDesc grid(int columns, std::vector< WidgetDesc > children, std::string id)
Fixed-column grid; children are placed in source order.
Definition Widget.cpp:878
@ InvalidArgument
@ Failed
Axis-aligned bounds in the artifact's declared world coordinate space.
Definition GeneratedArtifact.h:95
std::variant< Grid2D, PointSet, MeshData, ImageData, Collider, CompositeArtifact > Payload
Definition GeneratedArtifact.h:191