use of com.gempukku.libgdx.graph.plugin.callback.RenderCallbackPrivateData in project gdx-graph by MarcinSc.
the class RenderCallbackPipelineNodeProducer method createNodeForSingleInputs.
@Override
public PipelineNode createNodeForSingleInputs(JsonValue data, ObjectMap<String, String> inputTypes, ObjectMap<String, String> outputTypes) {
final String callbackId = data.getString("callbackId", null);
final ObjectMap<String, PipelineNode.FieldOutput<?>> result = new ObjectMap<>();
final DefaultFieldOutput<RenderPipeline> output = new DefaultFieldOutput<>(PipelineFieldType.RenderPipeline);
result.put("output", output);
return new SingleInputsPipelineNode(result) {
private PipelineDataProvider pipelineDataProvider;
private RenderCallbackPrivateData renderCallbackData;
@Override
public void initializePipeline(PipelineDataProvider pipelineDataProvider) {
renderCallbackData = pipelineDataProvider.getPrivatePluginData(RenderCallbackPrivateData.class);
this.pipelineDataProvider = pipelineDataProvider;
}
@Override
public void executeNode(PipelineRenderingContext pipelineRenderingContext, PipelineRequirementsCallback pipelineRequirementsCallback) {
final PipelineNode.FieldOutput<Boolean> processorEnabled = (PipelineNode.FieldOutput<Boolean>) inputs.get("enabled");
final PipelineNode.FieldOutput<RenderPipeline> renderPipelineInput = (PipelineNode.FieldOutput<RenderPipeline>) inputs.get("input");
RenderPipeline renderPipeline = renderPipelineInput.getValue();
boolean enabled = processorEnabled == null || processorEnabled.getValue();
if (enabled) {
RenderCallback callback = renderCallbackData.getRenderCallback(callbackId);
callback.renderCallback(renderPipeline, pipelineDataProvider, pipelineRenderingContext, pipelineRequirementsCallback);
}
output.setValue(renderPipeline);
}
};
}
Aggregations