From 13e5df62c9a8661c818460339f74d4f9eaf026c6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 10 Dec 2018 14:12:50 -0500 Subject: [PATCH] Removed fog classes --- core/src/io/anuke/mindustry/Vars.java | 1 - .../src/io/anuke/mindustry/core/Renderer.java | 15 --------- core/src/io/anuke/mindustry/game/Saves.java | 1 - core/src/io/anuke/mindustry/ui/Minimap.java | 31 +------------------ 4 files changed, 1 insertion(+), 47 deletions(-) diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index aee86eacf6..15b7d9c44d 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -93,7 +93,6 @@ public class Vars{ //camera zoom displayed on startup public static int baseCameraScale; public static boolean showBlockDebug = false; - public static boolean showFog = false; public static boolean headless = false; public static float controllerMin = 0.25f; public static float baseControllerSpeed = 11f; diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index f73c15d7f5..ff4ee81b21 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -1,6 +1,5 @@ package io.anuke.mindustry.core; -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Pixmap; @@ -53,7 +52,6 @@ public class Renderer extends RendererModule{ public final BlockRenderer blocks = new BlockRenderer(); public final MinimapRenderer minimap = new MinimapRenderer(); public final OverlayRenderer overlays = new OverlayRenderer(); - public final FogRenderer fog = new FogRenderer(); private int targetscale = baseCameraScale; private Rectangle rect = new Rectangle(), rect2 = new Rectangle(); @@ -249,12 +247,6 @@ public class Renderer extends RendererModule{ overlays.drawTop(); - if(showFog){ - batch.end(); - fog.draw(); - batch.begin(); - } - batch.getTransformMatrix().idt(); //Graphics.beginCam(); @@ -333,11 +325,6 @@ public class Renderer extends RendererModule{ camera.position.set(lastX, lastY, 0f); } - @Override - public void dispose(){ - fog.dispose(); - } - public Vector2 averagePosition(){ avgPosition.setZero(); @@ -365,7 +352,6 @@ public class Renderer extends RendererModule{ float vpW = Core.camera.viewportWidth, vpH = Core.camera.viewportHeight; int w = world.width()*tilesize, h = world.height()*tilesize; int pw = pixelSurface.width(), ph = pixelSurface.height(); - showFog = false; disableUI = true; pixelSurface.setSize(w, h, true); Graphics.getEffectSurface().setSize(w, h, true); @@ -376,7 +362,6 @@ public class Renderer extends RendererModule{ draw(); - showFog = true; disableUI = false; Core.camera.viewportWidth = vpW; Core.camera.viewportHeight = vpH; diff --git a/core/src/io/anuke/mindustry/game/Saves.java b/core/src/io/anuke/mindustry/game/Saves.java index 0a2f2fcf28..432679ffd4 100644 --- a/core/src/io/anuke/mindustry/game/Saves.java +++ b/core/src/io/anuke/mindustry/game/Saves.java @@ -165,7 +165,6 @@ public class Saves{ public void save(){ long time = totalPlaytime; - renderer.fog.writeFog(); long prev = totalPlaytime; totalPlaytime = time; diff --git a/core/src/io/anuke/mindustry/ui/Minimap.java b/core/src/io/anuke/mindustry/ui/Minimap.java index 69be4be5b4..df5a2f9015 100644 --- a/core/src/io/anuke/mindustry/ui/Minimap.java +++ b/core/src/io/anuke/mindustry/ui/Minimap.java @@ -1,8 +1,5 @@ package io.anuke.mindustry.ui; -import com.badlogic.gdx.graphics.Texture.TextureFilter; -import com.badlogic.gdx.graphics.g2d.TextureRegion; -import io.anuke.mindustry.graphics.Shaders; import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Graphics; import io.anuke.ucore.graphics.Draw; @@ -11,7 +8,7 @@ import io.anuke.ucore.scene.event.InputEvent; import io.anuke.ucore.scene.event.InputListener; import io.anuke.ucore.scene.ui.layout.Table; -import static io.anuke.mindustry.Vars.*; +import static io.anuke.mindustry.Vars.renderer; public class Minimap extends Table{ @@ -20,8 +17,6 @@ public class Minimap extends Table{ margin(5); - TextureRegion r = new TextureRegion(); - Element elem = new Element(){ @Override public void draw(){ @@ -32,30 +27,6 @@ public class Minimap extends Table{ if(renderer.minimap.getTexture() != null){ renderer.minimap.drawEntities(x, y, width, height); } - - if(showFog){ - renderer.fog.getTexture().setFilter(TextureFilter.Nearest, TextureFilter.Nearest); - - r.setRegion(renderer.minimap.getRegion()); - float pad = renderer.fog.getPadding(); - - float px = r.getU() * world.width() + pad; - float py = r.getV() * world.height() + pad; - float px2 = r.getU2() * world.width() + pad; - float py2 = r.getV2() * world.height() + pad; - - r.setTexture(renderer.fog.getTexture()); - r.setU(px / (world.width() + pad*2f)); - r.setV(1f - py / (world.height() + pad*2f)); - r.setU2(px2 / (world.width() + pad*2f)); - r.setV2(1f - py2 / (world.height() + pad*2f)); - - Graphics.shader(Shaders.fog); - Draw.crect(r, x, y, width, height); - Graphics.shader(); - - renderer.fog.getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); - } } };