Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate prePostComposite to glsl 330 #50

Merged
merged 2 commits into from
May 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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