Search in sources :

Example 1 with RenderPipelineTask

use of org.terasology.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 = displayResolutionDependentFBOs.getGBufferPair().getLastUpdatedFbo();
    glViewport(0, 0, lastUpdatedGBuffer.width(), lastUpdatedGBuffer.height());
    // glDisable(GL_DEPTH_TEST);
    // glDisable(GL_NORMALIZE); // currently keeping these as they are, until we find where they are used.
    // glDepthFunc(GL_LESS);
    renderPipelineTaskList.forEach(RenderPipelineTask::process);
    // this line re-establish Terasology defaults, so that the rest of the application can rely on them.
    LwjglGraphics.initOpenGLParams();
    playerCamera.updatePrevViewProjectionMatrix();
}
Also used : SwappableFBO(org.terasology.rendering.opengl.SwappableFBO) FBO(org.terasology.rendering.opengl.FBO) RenderPipelineTask(org.terasology.rendering.dag.RenderPipelineTask)

Aggregations

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