Search in sources :

Example 1 with RenderPipelineTask

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

the class WorldRendererImpl method render.

/**
 * TODO: update javadocs This method triggers the execution of the rendering pipeline and, eventually, sends the
 * output to the display or to a file, when grabbing a screenshot.
 * <p>
 * In this particular implementation this method can be called once per frame, when rendering to a standard display,
 * or twice, each time with a different rendering stage, when rendering to the head mounted display.
 * <p>
 * PerformanceMonitor.startActivity/endActivity statements are used in this method and in those it executes, to
 * provide statistics regarding the ongoing rendering and its individual steps (i.e. rendering shadows, reflections,
 * 2D filters...).
 *
 * @param renderingStage "MONO" for standard rendering and "LEFT_EYE" or "RIGHT_EYE" for stereoscopic
 *         displays.
 */
@Override
public void render(RenderingStage renderingStage) {
    preRenderUpdate(renderingStage);
    // TODO: Add a method here to check wireframe configuration and regenerate "renderPipelineTask" accordingly.
    // The following line re-establish OpenGL defaults, so that the nodes/tasks can rely on them.
    // A place where Terasology overrides the defaults is LwjglGraphics.initOpenGLParams(), but
    // there could be potentially other places, i.e. in the UI code. In the rendering engine we'd like
    // to eventually rely on a default OpenGL state.
    glDisable(GL_CULL_FACE);
    FBO lastUpdatedGBuffer = displayResolutionDependentFbo.getGBufferPair().getLastUpdatedFbo();
    glViewport(0, 0, lastUpdatedGBuffer.width(), lastUpdatedGBuffer.height());
    renderPipelineTaskList.forEach(RenderPipelineTask::process);
    // this line re-establish Terasology defaults, so that the rest of the application can rely on them.
    LwjglGraphicsUtil.initOpenGLParams();
    playerCamera.updatePrevViewProjectionMatrix();
}
Also used : FBO(org.terasology.engine.rendering.opengl.FBO) RenderPipelineTask(org.terasology.engine.rendering.dag.RenderPipelineTask)

Aggregations

RenderPipelineTask (org.terasology.engine.rendering.dag.RenderPipelineTask)1 FBO (org.terasology.engine.rendering.opengl.FBO)1