载入中...
搜索中...
未找到
GridMeshGraphScript.cpp
浏览该文件的文档.
22 grid.addFunc("addNode", [gridVm](GridGraph* self, const std::string& id, const std::string& operation) {
25 grid.addFunc("connect", [gridVm](GridGraph* self, const std::string& from, const std::string& to, int slot) {
31 gridVm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "grid is null")));
34 grid.addFunc("setNodeInt", [gridVm](GridGraph* self, const std::string& id, const std::string& key, int value) {
37 grid.addFunc("setNodeFloat", [gridVm](GridGraph* self, const std::string& id, const std::string& key, float value) {
41 [gridVm](GridGraph* self, const std::string& id, const std::string& key, const std::string& value) {
44 grid.addFunc("setNodePointSubgraph", [gridVm](GridGraph* self, const std::string& id, PointGraph* nested,
49 return eve::script::projectResult(gridVm, self->setNodePointSubgraph(id, *nested, input, output));
82 mesh.addFunc("addNode", [meshVm](MeshGraph* self, const std::string& id, const std::string& operation) {
85 mesh.addFunc("connect", [meshVm](MeshGraph* self, const std::string& from, const std::string& to, int slot) {
91 meshVm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "grid is null")));
94 mesh.addFunc("setNodePoints", [meshVm](MeshGraph* self, const std::string& id, PointSet* value) {
97 meshVm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "points are null")));
100 mesh.addFunc("setNodeMesh", [meshVm](MeshGraph* self, const std::string& id, MeshBuild* value) {
103 meshVm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "mesh is null")));
106 mesh.addFunc("setNodeFloat", [meshVm](MeshGraph* self, const std::string& id, const std::string& key, float value) {
110 [meshVm](MeshGraph* self, const std::string& id, const std::string& key, const std::string& value) {
119 return eve::script::projectStatusResult(meshVm, Status::success(), std::move(instance).takeValue());
127 mesh.addFunc("deserializeDefinition", [meshVm](MeshGraph* self, const std::string& definition) {
131 auto objects = table.addClass<ObjectBuildLayer>("ProcgenObjectBuildLayer", ssq::Class::Ctor<ObjectBuildLayer()>());
133 objects.addFunc("addAsset", [objectsVm](ObjectBuildLayer* self, const std::string& asset, float weight) {
137 objects.addFunc("setSeed", [](ObjectBuildLayer* self, std::uint32_t seed) { self->setSeed(seed); });
140 objects.addFunc("setLayerScale", [objectsVm](ObjectBuildLayer* self, float x, float y, float z) {
146 objects.addFunc("setRandomRotation", [objectsVm](ObjectBuildLayer* self, float minPitch, float maxPitch,
151 objects.addFunc("setRandomScale", [objectsVm](ObjectBuildLayer* self, float minX, float maxX, float minY,
153 return eve::script::projectResult(objectsVm, self->setRandomScale(minX, maxX, minY, maxY, minZ, maxZ, uniform));
157 return eve::script::projectResult(objectsVm, self->setOrientation(cellSize, yawOffset, invert));
159 objects.addFunc("disableOrientation", [](ObjectBuildLayer* self) { self->disableOrientation(); });
160 objects.addFunc("setPlaceOnTop", [](ObjectBuildLayer* self, bool enabled, bool useLowest, float topOffset) {
163 objects.addFunc("addChild", [objectsVm](ObjectBuildLayer* self, const std::string& asset, int count, float radius,
170 objects.addFunc("deserializeDefinition", [objectsVm](ObjectBuildLayer* self, const std::string& definition) {
177 Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "source points are null"))
184 return eve::script::projectStatusResult(objectsVm, Status::success(), std::move(instance).takeValue());
209 execution.addFunc("getMesh", [executionVm](BuildLayerExecution* self, int index) -> ssq::Table {
215 return eve::script::projectStatusResult(executionVm, Status::success(), std::move(instance).takeValue());
217 execution.addFunc("getPoints", [executionVm](BuildLayerExecution* self, int index) -> ssq::Table {
223 return eve::script::projectStatusResult(executionVm, Status::success(), std::move(instance).takeValue());
226 auto stack = table.addClass<BuildLayerStack>("ProcgenBuildLayerStack", ssq::Class::Ctor<BuildLayerStack()>());
228 stack.addFunc("addTileLayer", [stackVm](BuildLayerStack* self, const std::string& id, bool enabled, float cellSize,
230 return eve::script::projectResult(stackVm, self->addTileLayer(id, enabled, cellSize, height, group));
232 stack.addFunc("addObjectLayer", [stackVm](BuildLayerStack* self, const std::string& id, bool enabled,
239 stack.addFunc("setEnabled", [stackVm](BuildLayerStack* self, const std::string& id, bool enabled) {
246 stack.addFunc("isLayerEnabled", [](BuildLayerStack* self, int index) { return self->isLayerEnabled(index); });
248 stack.addFunc("deserializeDefinition", [stackVm](BuildLayerStack* self, const std::string& definition) {
251 stack.addFunc("execute", [stackVm](BuildLayerStack* self, Grid2D* grid, PointSet* points) -> ssq::Table {
262 return eve::script::projectStatusResult(stackVm, Status::success(), std::move(instance).takeValue());
266 [stackVm](BuildLayerStack* self, Grid2D* grid, PointSet* points, PointSet* orientation) -> ssq::Table {
277 return eve::script::projectStatusResult(stackVm, Status::success(), std::move(instance).takeValue());
282 std::function<IncrementalBuildDelta*()>([]() -> IncrementalBuildDelta* { return nullptr; }), true);
285 delta.addFunc("getClusterX", [](IncrementalBuildDelta* self, int index) { return self->getClusterX(index); });
286 delta.addFunc("getClusterZ", [](IncrementalBuildDelta* self, int index) { return self->getClusterZ(index); });
287 delta.addFunc("isRemoved", [](IncrementalBuildDelta* self, int index) { return self->isRemoved(index); });
294 return eve::script::projectStatusResult(deltaVm, Status::success(), std::move(instance).takeValue());
317 [incrementalVm](IncrementalBuildExecutor* self, BuildLayerStack* buildStack, Grid2D* grid, PointSet* points,
329 return eve::script::projectStatusResult(incrementalVm, Status::success(), std::move(instance).takeValue());
333 [incrementalVm](IncrementalBuildExecutor* self, BuildLayerStack* buildStack, Grid2D* grid, PointSet* points,
346 return eve::script::projectStatusResult(incrementalVm, Status::success(), std::move(instance).takeValue());
The single Squirrel projection for common Result, Status and Value.
Explicit Value/Owned/Borrowed semantics at the Squirrel boundary.
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 Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
Immutable-by-convention result of one complete build-stack execution.
Definition BuildLayerStack.h:35
Ordered, versioned executor for procedural tile and object build layers.
Definition BuildLayerStack.h:60
std::string serializeDefinition() const
Serialize ordered definitions using EVPCG_BUILD_LAYERS schema version 1.
Definition BuildLayerStack.cpp:197
Intermediate 2D generation result. cells store semantic ids (see Semantic.h), not tile GIDs — convert...
Definition Grid2D.h:36
Deterministic data-flow graph for grid generation and explicit grid-to-point composition.
Definition GridGraph.h:35
Result< void > setNodeFloat(std::string_view id, std::string key, float value)
Set one floating-point parameter declared by the node operation.
Definition GridGraph.cpp:226
std::uint64_t revision() const noexcept
Monotonic authoring revision; successful mutations increment it.
Definition GridGraph.h:68
Result< GridGraphValue > execute(std::string_view outputId)
Validate and evaluate one output into an independent owning value.
Definition GridGraph.cpp:478
std::string serializeDefinition() const
Serialize topology and scalar parameters using the versioned EVPCG grid schema.
Definition GridGraph.cpp:547
Result< void > deserializeDefinition(std::string_view definition)
Atomically replace this graph from a versioned definition.
Definition GridGraph.cpp:580
Result< void > connect(std::string_view fromId, std::string_view toId, int inputIndex=0)
Connect one node output to a typed input slot.
Definition GridGraph.cpp:176
void clearCache()
Remove all cached node values while retaining topology and parameters.
Definition GridGraph.cpp:513
Result< void > setNodeGrid(std::string_view id, const Grid2D &grid)
Assign an owning copy to a grid.input node.
Definition GridGraph.cpp:196
Result< void > addNode(std::string id, std::string operation)
Add a reflected operation under a stable, non-empty node id.
Definition GridGraph.cpp:163
Result< void > setNodePointSubgraph(std::string_view id, const PointGraph &graph, std::string inputNode, std::string outputNode)
Bind an owning PointGraph copy to a point.subgraph bridge.
Definition GridGraph.cpp:252
Result< void > setNodeString(std::string_view id, std::string key, std::string value)
Set one string parameter declared by the node operation.
Definition GridGraph.cpp:239
Result< void > validate(std::string_view outputId) const
Validate topology, required inputs and cross-graph bindings without evaluating values.
Definition GridGraph.cpp:485
Result< void > setNodeInt(std::string_view id, std::string key, int value)
Set one integer parameter declared by the node operation.
Definition GridGraph.cpp:208
Ordered changes required to synchronize a scene-side cluster cache.
Definition IncrementalBuild.h:21
Derived cluster cache that incrementally executes a BuildLayerStack.
Definition IncrementalBuild.h:47
CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packe...
Definition MeshBuild.h:19
Typed procedural mesh graph composing grid, point and topology domains.
Definition MeshGraph.h:21
std::string serializeDefinition() const
Serialize topology and scalar parameters using the versioned EVPCG mesh schema.
Definition MeshGraph.cpp:307
Deterministic TileWorldCreator-style object build layer.
Definition ObjectBuildLayer.h:37
std::string serializeDefinition() const
Serialize all layer settings using the versioned EVPCG object-layer schema.
Definition ObjectBuildLayer.cpp:322
Definition EvpackPointGraphLoader.h:12
void exposeGridMeshGraphs(ssq::Table &table)
Expose grid mesh graphs.
Definition GridMeshGraphScript.cpp:18
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:454
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:470
@ InvalidArgument