![]() |
XII Release 0.1.0
|
Serializable particle graph descriptor. It is intentionally data-only so tools can round-trip it losslessly. More...
#include <ParticleGraph.h>
Public Member Functions | |
| xiiUuid | AddNode (const xiiParticleGraphNodeDesc &node) |
| Adds a new node to the graph with the specified description and returns its unique identifier. The node description should have a unique m_NodeId, but if it is not set, a new one will be generated. The caller is responsible for ensuring that the node description is valid and that the m_NodeId is unique within this graph. | |
| bool | RemoveNode (const xiiUuid &nodeId) |
| Removes the node with the specified unique identifier from the graph, along with any links connected to it. Returns true if the node was found and removed, or false if no node with the specified ID exists in the graph. The caller is responsible for ensuring that any references to this node (e.g., in links or groups) are also updated or removed as necessary. | |
| void | AddLink (const xiiParticleGraphLinkDesc &link) |
| Adds a new directed link between the specified source and target pins of the source and target nodes. The link description should reference valid node IDs and pin names that exist in this graph. The caller is responsible for ensuring that the link description is valid and that the source and target nodes and pins exist in this graph. | |
| void | Clear () |
| Removes the directed link between the specified source and target pins of the source and target nodes. Returns true if the link was found and removed, or false if no such link exists in the graph. The caller is responsible for ensuring that any references to this link (e.g., in node implementations) are also updated or removed as necessary. | |
| const xiiParticleGraphNodeDesc * | FindNode (const xiiUuid &nodeId) const |
| Finds a node in the graph by its unique identifier. Returns a pointer to the node description if found, or nullptr if no node with the specified ID exists in the graph. The caller should not modify the returned node description directly, as it is owned by the graph. Instead, use the non-const version of this function to modify nodes. | |
| xiiParticleGraphNodeDesc * | FindNode (const xiiUuid &nodeId) |
| Finds a node in the graph by its unique identifier. Returns a pointer to the node description if found, or nullptr if no node with the specified ID exists in the graph. The caller can modify the returned node description directly, as it is owned by the graph. | |
| xiiResult | Validate (xiiStringBuilder *out_pError=nullptr) const |
| Validates the integrity of the graph, checking for issues such as missing nodes, invalid links, duplicate IDs, and other potential problems. If the graph is valid, returns success. If the graph is invalid, returns failure and optionally fills out_pError with a description of the first encountered issue. The caller can use this function to ensure that the graph is well-formed before attempting to compile or execute it. | |
| xiiUInt64 | ComputePipelineHash () const |
| Computes a hash value for the compute pipeline that would be generated from this graph. This can be used for caching and quick comparisons of graph configurations. The hash should take into account the structure of the graph, the types and connections of nodes, and any relevant parameters that would affect the generated compute shader. The exact hashing algorithm is up to the implementation, but it should produce the same hash for graphs that are functionally equivalent in terms of their compute behavior. | |
| void | Save (xiiStreamWriter &ref_stream) const |
| void | Load (xiiStreamReader &ref_stream) |
Public Attributes | |
| xiiString | m_sGraphName |
| Name of the particle graph, used for identification and debugging purposes. This is purely a hint for visualization and has no effect on the graph's behavior. | |
| xiiString | m_sDescription |
| Optional description of the particle graph, used for providing additional context and information in the editor. This is purely a hint for visualization and has no effect on the graph's behavior. | |
| xiiString | m_sAuthoringTool |
| Optional name of the tool or DCC application that authored this graph, used for tracking and debugging purposes. This is purely a hint for visualization and has no effect on the graph's behavior. | |
| xiiDynamicArray< xiiParticleGraphNodeDesc > | m_Nodes |
| List of nodes in this particle graph. Each node should have a unique m_NodeId, and links will reference nodes by their IDs. The order of nodes in this array does not determine execution order, which is determined by the links and scheduling hints. | |
| xiiDynamicArray< xiiParticleGraphLinkDesc > | m_Links |
| List of directed links between node pins in this particle graph. Each link should reference valid source and target nodes and pins. The order of links in this array does not determine execution order, which is determined by the scheduling hints on the nodes and the data dependencies implied by the links. | |
| xiiDynamicArray< xiiParticleGraphGroupDesc > | m_Groups |
| List of editor groups for organizing nodes in the graph. This is purely for editor purposes and has no effect on runtime behavior, but can be used by the editor to visually group nodes together and allow for easier manipulation of related nodes. | |
| xiiDynamicArray< xiiParticleGraphParameterDesc > | m_ExposedParameters |
| List of parameters exposed by the graph as a whole, which can be edited by artists and designers. Each parameter should have a unique name within this graph and should specify the expected data format and semantics for connections. These parameters can be used to control global aspects of the graph's behavior or to provide inputs that are not tied to a specific node. | |
Serializable particle graph descriptor. It is intentionally data-only so tools can round-trip it losslessly.