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

View File

@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=c1eab295b1a55397957fd54bec2f37daee0e8b4b archash=a67ae66be8a09f292d0beccbebda424fca6801d3