use of com.gempukku.libgdx.graph.plugin.callback.RenderCallback in project gdx-graph by MarcinSc.
the class Episode3Scene method loadPipelineRenderer.
private PipelineRenderer loadPipelineRenderer() {
PipelineRenderer pipelineRenderer = PipelineLoader.loadPipelineRenderer(Gdx.files.local("episodes/episode3.json"), timeKeeper);
pipelineRenderer.getPluginData(UIPluginPublicData.class).setStage("", stage);
pipelineRenderer.getPluginData(RenderCallbackPublicData.class).setRenderCallback("Callback", new RenderCallback() {
@Override
public void renderCallback(RenderPipeline renderPipeline, PipelineDataProvider pipelineDataProvider, PipelineRenderingContext pipelineRenderingContext, PipelineNode.PipelineRequirementsCallback pipelineRequirementsCallback) {
RenderPipelineBuffer currentBuffer = renderPipeline.getDefaultBuffer();
int width = currentBuffer.getWidth();
int height = currentBuffer.getHeight();
float viewportWidth = camera.viewportWidth;
float viewportHeight = camera.viewportHeight;
if (width != viewportWidth || height != viewportHeight) {
camera.viewportWidth = width;
camera.viewportHeight = height;
camera.update();
}
currentBuffer.beginColor();
modelBatch.begin(camera);
modelBatch.render(renderableProviders, environment);
modelBatch.end();
currentBuffer.endColor();
}
});
return pipelineRenderer;
}
use of com.gempukku.libgdx.graph.plugin.callback.RenderCallback in project gdx-graph by MarcinSc.
the class Episode2Scene method loadPipelineRenderer.
private PipelineRenderer loadPipelineRenderer() {
PipelineRenderer pipelineRenderer = PipelineLoader.loadPipelineRenderer(Gdx.files.local("episodes/episode2.json"), timeKeeper);
pipelineRenderer.getPluginData(UIPluginPublicData.class).setStage("", stage);
pipelineRenderer.getPluginData(RenderCallbackPublicData.class).setRenderCallback("Callback", new RenderCallback() {
@Override
public void renderCallback(RenderPipeline renderPipeline, PipelineDataProvider pipelineDataProvider, PipelineRenderingContext pipelineRenderingContext, PipelineNode.PipelineRequirementsCallback pipelineRequirementsCallback) {
RenderPipelineBuffer currentBuffer = renderPipeline.getDefaultBuffer();
int width = currentBuffer.getWidth();
int height = currentBuffer.getHeight();
float viewportWidth = camera.viewportWidth;
float viewportHeight = camera.viewportHeight;
if (width != viewportWidth || height != viewportHeight) {
camera.viewportWidth = width;
camera.viewportHeight = height;
camera.update();
}
currentBuffer.beginColor();
modelBatch.begin(camera);
modelBatch.render(renderableProviders, environment);
modelBatch.end();
currentBuffer.endColor();
}
});
return pipelineRenderer;
}
use of com.gempukku.libgdx.graph.plugin.callback.RenderCallback 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);
}
};
}
use of com.gempukku.libgdx.graph.plugin.callback.RenderCallback in project gdx-graph by MarcinSc.
the class ShadowShaderTestScene method loadPipelineRenderer.
private PipelineRenderer loadPipelineRenderer() {
PipelineRenderer pipelineRenderer = PipelineLoader.loadPipelineRenderer(Gdx.files.local("test/shadow-shader-test.json"), timeKeeper);
pipelineRenderer.setPipelineProperty("Camera", camera);
pipelineRenderer.getPluginData(RenderCallbackPublicData.class).setRenderCallback("Callback", new RenderCallback() {
@Override
public void renderCallback(RenderPipeline renderPipeline, PipelineDataProvider pipelineDataProvider, PipelineRenderingContext pipelineRenderingContext, PipelineNode.PipelineRequirementsCallback pipelineRequirementsCallback) {
RenderPipelineBuffer currentBuffer = renderPipeline.getDefaultBuffer();
Directional3DLight firstLight = environment.getDirectionalLights().get(0);
RenderPipelineBuffer shadowFrameBuffer = firstLight.getShadowFrameBuffer();
renderPipeline.drawTexture(shadowFrameBuffer, currentBuffer, pipelineRenderingContext, pipelineDataProvider.getFullScreenRender());
}
});
return pipelineRenderer;
}
Aggregations