Skip to content

Commit

Permalink
chore: migrate prePostComposite to glsl 330
Browse files Browse the repository at this point in the history
  • Loading branch information
pollend committed May 17, 2021
1 parent aef64eb commit 1749e1f
Showing 1 changed file with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.corerendering.rendering.dag.nodes;

import org.terasology.engine.rendering.assets.mesh.Mesh;
import org.terasology.engine.utilities.Assets;
import org.terasology.gestalt.assets.ResourceUrn;
import org.terasology.engine.config.Config;
import org.terasology.engine.config.RenderingConfig;
Expand Down Expand Up @@ -42,7 +31,6 @@
import static org.terasology.engine.rendering.dag.stateChanges.SetInputTextureFromFbo.FboTexturesTypes.DepthStencilTexture;
import static org.terasology.engine.rendering.dag.stateChanges.SetInputTextureFromFbo.FboTexturesTypes.LightAccumulationTexture;
import static org.terasology.engine.rendering.dag.stateChanges.SetInputTextureFromFbo.FboTexturesTypes.NormalsTexture;
import static org.terasology.engine.rendering.opengl.OpenGLUtils.renderFullscreenQuad;

/**
* An instance of this class takes advantage of the content of a number of previously filled buffers
Expand Down Expand Up @@ -110,12 +98,18 @@ public class PrePostCompositeNode extends AbstractNode implements PropertyChange
@Range(min = -0.1f, max = 0.1f)
private float volumetricFogHeightFalloff = -0.01f;

private Mesh renderQuad;

public PrePostCompositeNode(String nodeUri, Name providingModule, Context context) {
super(nodeUri, providingModule, context);

worldRenderer = context.get(WorldRenderer.class);
activeCamera = worldRenderer.getActiveCamera();
addOutputBufferPairConnection(1);

this.renderQuad = Assets.get(new ResourceUrn("engine:ScreenQuad"), Mesh.class)
.orElseThrow(() -> new RuntimeException("Failed to resolve render Quad"));

}

@Override
Expand Down Expand Up @@ -216,7 +210,7 @@ public void process() {

// Actual Node Processing

renderFullscreenQuad();
renderQuad.render();

PerformanceMonitor.endActivity();
}
Expand Down

0 comments on commit 1749e1f

Please sign in to comment.