diff --git a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java index c1e03c75d9..62c044f3f3 100644 --- a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java @@ -1,9 +1,11 @@ package io.anuke.mindustry.graphics; +import io.anuke.arc.Core; import io.anuke.arc.Events; import io.anuke.arc.collection.Array; import io.anuke.arc.collection.IntSet; import io.anuke.arc.collection.Sort; +import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.glutils.FrameBuffer; import io.anuke.arc.math.Mathf; @@ -27,7 +29,6 @@ public class BlockRenderer{ private Array requests = new Array<>(true, initialRequests, BlockRequest.class); private IntSet teamChecks = new IntSet(); private int lastCamX, lastCamY, lastRangeX, lastRangeY; - private Layer lastLayer; private int requestidx = 0; private int iterateidx = 0; private FrameBuffer shadows = new FrameBuffer(1, 1); @@ -71,7 +72,6 @@ public class BlockRenderer{ /**Process all blocks to draw, simultaneously updating the block shadow framebuffer.*/ public void processBlocks(){ iterateidx = 0; - lastLayer = null; int avgx = (int)(camera.position.x / tilesize); int avgy = (int)(camera.position.y / tilesize); @@ -89,8 +89,7 @@ public class BlockRenderer{ requestidx = 0; Draw.flush(); - Draw.proj() - .setOrtho(Mathf.round(camera.position.x, tilesize)-shadowW/2f, Mathf.round(camera.position.y, tilesize)-shadowH/2f, + Draw.proj().setOrtho(Mathf.round(camera.position.x, tilesize)-shadowW/2f, Mathf.round(camera.position.y, tilesize)-shadowH/2f, shadowW, shadowH); if(shadows.getWidth() != shadowW || shadows.getHeight() != shadowH){ @@ -98,6 +97,7 @@ public class BlockRenderer{ } shadows.begin(); + Core.graphics.clear(Color.CLEAR); int minx = Math.max(avgx - rangex - expandr, 0); int miny = Math.max(avgy - rangey - expandr, 0); @@ -137,9 +137,9 @@ public class BlockRenderer{ } } + Draw.flush(); shadows.end(); - Draw.flush(); Draw.proj(camera.projection()); Sort.instance().sort(requests.items, 0, requestidx); @@ -172,8 +172,6 @@ public class BlockRenderer{ }else if(req.layer == block.layer2){ block.drawLayer2(req.tile); } - - lastLayer = req.layer; } } diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java index 7177a189d3..065e2d3e65 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java @@ -135,6 +135,7 @@ public abstract class Turret extends Block{ Draw.rect(baseRegion, tile.drawx(), tile.drawy()); Draw.color(tile.getTeam().color, Color.WHITE, 0.45f); Draw.rect(baseTopRegion, tile.drawx(), tile.drawy()); + Draw.color(); } @Override @@ -177,6 +178,7 @@ public abstract class Turret extends Block{ public void drawPlace(int x, int y, int rotation, boolean valid){ Lines.stroke(1f, Palette.placing); Lines.dashCircle(x * tilesize + offset(), y * tilesize + offset(), range); + Draw.color(); } @Override