Home Reference Source
import RenderGraph from 'videocontext/src/rendergraph.js'
public class | source

RenderGraph

Static Method Summary

Static Public Methods
public static

getInputlessNodes(connections: *): *

public static

inputEdgesFor(node: *, connections: *): *

public static

outputEdgesFor(node: *, connections: *): *

Constructor Summary

Public Constructor
public

Manages the rendering graph.

Member Summary

Public Members
public

Method Summary

Public Methods
public

Get a list of nodes which are connected as inputs to the given node.

public

Get a list of nodes which are connected, by input name, to the given node.

public

Get a list of nodes which are connected to the output of the passed node.

public

Get a list of nodes which are connected, by z-index name, to the given node.

public

Check if a named input on a node is available to connect too.

public

registerConnection(sourceNode: GraphNode, destinationNode: GraphNode, target: String | number): boolean

Register a connection between two nodes.

public

unregisterConnection(sourceNode: GraphNode, destinationNode: GraphNode): boolean

Remove a connection between two nodes.

Static Public Methods

public static getInputlessNodes(connections: *): * source

Params:

NameTypeAttributeDescription
connections *

Return:

*

public static inputEdgesFor(node: *, connections: *): * source

Params:

NameTypeAttributeDescription
node *
connections *

Return:

*

public static outputEdgesFor(node: *, connections: *): * source

Params:

NameTypeAttributeDescription
node *
connections *

Return:

*

Public Constructors

public constructor() source

Manages the rendering graph.

Public Members

public connections: *[] source

Public Methods

public getInputsForNode(node: GraphNode): GraphNode[] source

Get a list of nodes which are connected as inputs to the given node. The length of the return array is always equal to the number of inputs for the node, with undefined taking the place of any inputs not connected.

Params:

NameTypeAttributeDescription
node GraphNode

the node to get the inputs for.

Return:

GraphNode[]

An array of GraphNodes which are connected to the node.

public getNamedInputsForNode(node: GraphNode): Object[] source

Get a list of nodes which are connected, by input name, to the given node. Array contains objects of the form: {"source":sourceNode, "type":"name", "name":inputName, "destination":destinationNode}.

Params:

NameTypeAttributeDescription
node GraphNode

the node to get the named inputs for.

Return:

Object[]

An array of objects representing the nodes and connection type, which are connected to the named inputs for the node.

public getOutputsForNode(node: GraphNode): GraphNode[] source

Get a list of nodes which are connected to the output of the passed node.

Params:

NameTypeAttributeDescription
node GraphNode

the node to get the outputs for.

Return:

GraphNode[]

An array of the nodes which are connected to the output.

public getZIndexInputsForNode(node: GraphNode): Object[] source

Get a list of nodes which are connected, by z-index name, to the given node. Array contains objects of the form: {"source":sourceNode, "type":"zIndex", "zIndex":0, "destination":destinationNode}.

Params:

NameTypeAttributeDescription
node GraphNode

the node to get the z-index refernced inputs for.

Return:

Object[]

An array of objects representing the nodes and connection type, which are connected by z-Index for the node.

public isInputAvailable(node: GraphNode, inputName: String): boolean source

Check if a named input on a node is available to connect too.

Params:

NameTypeAttributeDescription
node GraphNode

the node to check.

inputName String

the named input to check.

Return:

boolean

public registerConnection(sourceNode: GraphNode, destinationNode: GraphNode, target: String | number): boolean source

Register a connection between two nodes.

Params:

NameTypeAttributeDescription
sourceNode GraphNode

the node to connect from.

destinationNode GraphNode

the node to connect to.

target String | number
  • optional

the target port of the conenction, this could be a string to specfiy a specific named port, a number to specify a port by index, or undefined, in which case the next available port will be connected to.

Return:

boolean

Will return true if connection succeeds otherwise will throw a ConnectException.

public unregisterConnection(sourceNode: GraphNode, destinationNode: GraphNode): boolean source

Remove a connection between two nodes.

Params:

NameTypeAttributeDescription
sourceNode GraphNode

the node to unregsiter connection from.

destinationNode GraphNode

the node to register connection to.

Return:

boolean

Will return true if removing connection succeeds, or false if there was no connectionsction to remove.