|
Infinity Engine v0.6.20
C++ API Documentation
|
Main interface for a directed acyclic graph of procedural components. More...
#include <ProceduralSystem.hpp>
Public Member Functions | |
| ProceduralSystem (const std::filesystem::path &file) | |
| Loads a ProceduralSystem from a file. | |
| ProceduralSystem (const std::vector< unsigned char > &buffer, const std::filesystem::path &loadPath={}) | |
| Creates a ProceduralSystem from a binary buffer. | |
| ProceduralSystem (ProceduralSystem &&other) | |
| Move constructor. | |
| ~ProceduralSystem () | |
| Destructor. | |
| ProceduralSystem & | operator= (ProceduralSystem &&other) |
| Move assignment operator. | |
| std::string | id () const |
| Gets the unique identifier for this system. | |
| void | execute () |
| Executes the procedural system. | |
| void | setSeed (uint64_t seed) |
| Sets the random seed for the entire system. | |
| bool | setLoop (int start, int stop, int step) |
| Configures the system to loop over a range of integer values. | |
| bool | setLoop (std::string portName) |
| Configures the system to loop over values from an input port. | |
| void | clearLoop () |
| Clears any configured loop behavior. | |
| template<typename T > | |
| const T & | getIn (const std::string &name) const |
| Retrieves typed data from an input port. | |
| template<typename T > | |
| const T & | getOut (const std::string &name) const |
| Retrieves typed data from an output port. | |
| template<typename T > | |
| void | setIn (const std::string &name, T &&val) |
| Sets typed data on an input port (rvalue reference overload). | |
| template<typename T > | |
| void | setIn (const std::string &name, const T &val) |
| Sets typed data on an input port (const reference overload). | |
| template<typename T > | |
| void | setIn (const std::string &name, const T *val) |
| Sets typed data on an input port from a pointer (copied). | |
Friends | |
| class | ProceduralSystemImpl |
Main interface for a directed acyclic graph of procedural components.
ProceduralSystem represents a complete procedural generation pipeline composed of interconnected ProceduralComponents arranged in a directed acyclic graph (DAG). Systems can be loaded from files, executed to generate outputs, and configured with input parameters and random seeds.
A ProceduralSystem manages:
Systems are the primary execution unit in the Infinity Engine and can contain nested sub-systems, allowing for hierarchical procedural generation workflows. Systems are typically accessed through an InfinityCore rather than loaded directly.
Example usage:
See Working with Procedural Systems for an in-depth guide on using Procedural Systems.
|
explicit |
Loads a ProceduralSystem from a file.
Deserializes a complete procedural system, including all component descriptions, connections, and configuration. Automatically detects file format and instantiates all required components from registered plugins.
| file | Path to the system file (.prcb/.yaml). |
| std::runtime_error | if the file cannot be read, parsed, or if required component types are not registered. |
| Infinity::Procedural::ProceduralSystem::ProceduralSystem | ( | const std::vector< unsigned char > & | buffer, |
| const std::filesystem::path & | loadPath = {} |
||
| ) |
Creates a ProceduralSystem from a binary buffer.
Deserializes a procedural system from in-memory binary data.
| buffer | Vector containing the serialized system data. |
| loadPath | Optional path indicating where this system conceptually resides (used as the base path for loading component files). |
| std::runtime_error | if the buffer is invalid or if required component types are not registered. |
| Infinity::Procedural::ProceduralSystem::ProceduralSystem | ( | ProceduralSystem && | other | ) |
Move constructor.
| other | The ProceduralSystem to move from. |
| Infinity::Procedural::ProceduralSystem::~ProceduralSystem | ( | ) |
Destructor.
Cleans up all component instances and releases resources.
| void Infinity::Procedural::ProceduralSystem::clearLoop | ( | ) |
Clears any configured loop behavior.
Removes loop configuration, causing the system to execute only once per execute() call.
| void Infinity::Procedural::ProceduralSystem::execute | ( | ) |
Executes the procedural system.
Runs all components in the system in dependency order, propagating data through the graph. If a loop is configured, executes the system multiple times with the loop variable. After execution, output data is available via getOut().
| std::runtime_error | if execution fails due to missing inputs, component errors, or cyclic dependencies. |
|
inline |
Retrieves typed data from an input port.
If T is derived from Infinity::Types::Core::Data, returns the data directly. Otherwise, unwraps the value from Infinity::Types::Core::Value<T>.
| T | The expected type of the input data. |
| name | The name of the input port. |
| std::bad_cast | if the input data is not of type T. |
| std::runtime_error | if the input port doesn't exist or has no data. |
|
inline |
Retrieves typed data from an output port.
If T is derived from Infinity::Types::Core::Data, returns the data directly. Otherwise, unwraps the value from Infinity::Types::Core::Value<T>.
Output data is only available after execute() has been called.
| T | The expected type of the output data. |
| name | The name of the output port. |
| std::bad_cast | if the output data is not of type T. |
| std::runtime_error | if the output port doesn't exist, has no data, or execute() has not been called. |
| std::string Infinity::Procedural::ProceduralSystem::id | ( | ) | const |
Gets the unique identifier for this system.
| ProceduralSystem & Infinity::Procedural::ProceduralSystem::operator= | ( | ProceduralSystem && | other | ) |
Move assignment operator.
| other | The ProceduralSystem to move from. |
|
inline |
Sets typed data on an input port (const reference overload).
If T is derived from Infinity::Types::Core::Data, stores it directly. Otherwise, wraps it in Infinity::Types::Core::Value<T>.
| T | The type of the input data. |
| name | The name of the input port. |
| val | Const reference to the data to set (copied). |
|
inline |
Sets typed data on an input port from a pointer (copied).
| T | The type of the input data. |
| name | The name of the input port. |
| val | Pointer to the data to set (dereferenced and copied). |
|
inline |
Sets typed data on an input port (rvalue reference overload).
If T is derived from Infinity::Types::Core::Data, stores it directly. Otherwise, wraps it in Infinity::Types::Core::Value<T>.
| T | The type of the input data. |
| name | The name of the input port. |
| val | Rvalue reference to the data to set (moved). |
| bool Infinity::Procedural::ProceduralSystem::setLoop | ( | int | start, |
| int | stop, | ||
| int | step | ||
| ) |
Configures the system to loop over a range of integer values.
Sets up an integer loop that will execute the system multiple times, incrementing a loop variable from start to stop (exclusive) by step. The loop variable can be accessed by components within the system.
| start | The starting value of the loop (inclusive). |
| stop | The ending value of the loop (exclusive). |
| step | The increment value for each iteration. |
| bool Infinity::Procedural::ProceduralSystem::setLoop | ( | std::string | portName | ) |
Configures the system to loop over values from an input port.
Sets up a loop that iterates over a collection provided via the specified input port. The system will execute once for each element in the collection.
| portName | The name of the input port containing the collection to iterate over. |
| void Infinity::Procedural::ProceduralSystem::setSeed | ( | uint64_t | seed | ) |
Sets the random seed for the entire system.
Propagates the seed to all components in the system, ensuring reproducible generation. Each component derives its own seed deterministically from this base seed and its position in the graph.
| seed | The random seed value. |
|
friend |