RenderGraph - ++ boolean areConnected(node,node), store renderGraph into nodes upon addition. remove upon removal
@@ -58,6 +58,8 @@ public void addNode(NewNode node) {
node.setDependencies(context);
}
+ node.setRenderGraph(this);
+
nodeMap.put(nodeUri, node);
graph.addNode(node);
}
@@ -74,6 +76,8 @@ public NewNode removeNode(SimpleUri nodeUri) {
throw new RuntimeException("NewNode removal failure: node '" + nodeUri + "' is still connected to other nodes in the render graph!");
}
+ node.setRenderGraph(null);
+
nodeMap.remove(nodeUri);
return nodeMap.remove(nodeUri);
}
@@ -108,6 +112,13 @@ public void connect(NewNode... nodeList) {
}
}
+ public boolean areConnected(NewNode fromNode, NewNode toNode){
+ Preconditions.checkNotNull(fromNode, "fromNode cannot be null!");
+ Preconditions.checkNotNull(toNode, "toNode cannot be null!");
+
+ return graph.hasEdgeConnecting(fromNode, toNode);
+ }
+
public void disconnect(NewNode fromNode, NewNode toNode) {
Preconditions.checkNotNull(fromNode, "fromNode cannot be null!");
Preconditions.checkNotNull(toNode, "toNode cannot be null!");
