FX cleanup and installation

This commit is contained in:
Anuken
2020-03-08 22:45:32 -04:00
parent 0ff3c1ee78
commit 1dc4fd0800
2 changed files with 26 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package mindustry.core;
import arc.*;
import arc.files.*;
import arc.fx.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.graphics.gl.*;
@@ -26,6 +27,7 @@ public class Renderer implements ApplicationListener{
public FrameBuffer effectBuffer = new FrameBuffer(2, 2);
private Bloom bloom;
private FxProcessor fx = new FxProcessor();
private Color clearColor = new Color(0f, 0f, 0f, 1f);
private float targetscale = Scl.scl(4);
private float camerascale = targetscale;
@@ -99,6 +101,8 @@ public class Renderer implements ApplicationListener{
if(settings.getBool("bloom")){
setupBloom();
}
fx.resize(width, height);
}
@Override
@@ -137,6 +141,23 @@ public class Renderer implements ApplicationListener{
}
}
void beginFx(){
if(!fx.hasEnabledEffects()) return;
Draw.flush();
fx.clear();
fx.begin();
}
void endFx(){
if(!fx.hasEnabledEffects()) return;
Draw.flush();
fx.end();
fx.applyEffects();
fx.render(0, 0, fx.getWidth(), fx.getHeight());
}
void updateShake(float scale){
if(shaketime > 0){
float intensity = shakeIntensity * (settings.getInt("screenshake", 4) / 4f) * scale;
@@ -164,6 +185,8 @@ public class Renderer implements ApplicationListener{
Draw.proj(camera.projection());
beginFx();
drawBackground();
blocks.floor.checkChanges();
@@ -226,6 +249,8 @@ public class Renderer implements ApplicationListener{
overlays.drawTop();
endFx();
if(!pixelator.enabled()){
Groups.drawNames();
}