Search in sources :

Example 1 with Node

use of org.terasology.engine.rendering.dag.Node in project Terasology by MovingBlocks.

the class WorldRendererImpl method dagRedirect.

/**
 * Redirect output FBO from one node to another's input
 * <p>
 * Usage: {@code dagRedirect <connectionTypeString> <fromNodeUri> <outputFboId> <toNodeUri> <inputFboId>}
 * <p>
 * Example: dagRedirect fbo blurredAmbientOcclusion 1 BasicRendering:outputToScreenNode 1 dagRedirect bufferpair
 * backdrop 1 AdvancedRendering:intermediateHazeNode 1
 */
@Command(shortDescription = "Debugging command for DAG.", requiredPermission = PermissionManager.NO_PERMISSION)
public void dagRedirect(@CommandParam("fromNodeUri") final String connectionTypeString, @CommandParam("fromNodeUri") final String fromNodeUri, @CommandParam("outputFboId") final int outputFboId, @CommandParam("toNodeUri") final String toNodeUri, @CommandParam(value = "inputFboId") final int inputFboId) {
    RenderGraph.ConnectionType connectionType;
    if (connectionTypeString.equalsIgnoreCase("fbo")) {
        connectionType = RenderGraph.ConnectionType.FBO;
    } else if (connectionTypeString.equalsIgnoreCase("bufferpair")) {
        connectionType = RenderGraph.ConnectionType.BUFFER_PAIR;
    } else {
        throw new RuntimeException(("Unsupported connection type: '" + connectionTypeString + "'. Expected 'fbo' " + "or 'bufferpair'.\n"));
    }
    Node toNode = renderGraph.findNode(toNodeUri);
    if (toNode == null) {
        toNode = renderGraph.findAka(toNodeUri);
        if (toNode == null) {
            throw new RuntimeException(("No node is associated with URI '" + toNodeUri + "'"));
        }
    }
    Node fromNode = renderGraph.findNode(fromNodeUri);
    if (fromNode == null) {
        fromNode = renderGraph.findAka(fromNodeUri);
        if (fromNode == null) {
            throw new RuntimeException(("No node is associated with URI '" + fromNodeUri + "'"));
        }
    }
    renderGraph.reconnectInputToOutput(fromNode, outputFboId, toNode, inputFboId, connectionType, true);
    toNode.clearDesiredStateChanges();
    requestTaskListRefresh();
}
Also used : Node(org.terasology.engine.rendering.dag.Node) RenderGraph(org.terasology.engine.rendering.dag.RenderGraph) MethodCommand(org.terasology.engine.logic.console.commandSystem.MethodCommand) Command(org.terasology.engine.logic.console.commandSystem.annotations.Command)

Example 2 with Node

use of org.terasology.engine.rendering.dag.Node in project Terasology by MovingBlocks.

the class WorldRendererImpl method dagNodeCommand.

/**
 * Acts as an interface between the console and the Nodes. All parameters passed to command are redirected to the
 * concerned Nodes, which in turn take care of executing them.
 * <p>
 * Usage: {@code dagNodeCommand <nodeUri> <command> <parameters>}
 * <p>
 * Example: dagNodeCommand engine:outputToScreenNode setFbo engine:fbo.ssao
 */
@Command(shortDescription = "Debugging command for DAG.", requiredPermission = PermissionManager.NO_PERMISSION)
public void dagNodeCommand(@CommandParam("nodeUri") final String nodeUri, @CommandParam("command") final String command, @CommandParam(value = "arguments") final String... arguments) {
    Node node = renderGraph.findNode(nodeUri);
    if (node == null) {
        node = renderGraph.findAka(nodeUri);
        if (node == null) {
            throw new RuntimeException(("No node is associated with URI '" + nodeUri + "'"));
        }
    }
    node.handleCommand(command, arguments);
}
Also used : Node(org.terasology.engine.rendering.dag.Node) MethodCommand(org.terasology.engine.logic.console.commandSystem.MethodCommand) Command(org.terasology.engine.logic.console.commandSystem.annotations.Command)

Aggregations

MethodCommand (org.terasology.engine.logic.console.commandSystem.MethodCommand)2 Command (org.terasology.engine.logic.console.commandSystem.annotations.Command)2 Node (org.terasology.engine.rendering.dag.Node)2 RenderGraph (org.terasology.engine.rendering.dag.RenderGraph)1