diff --git a/core/assets/shaders/blockbuild.fragment b/core/assets/shaders/blockbuild.fragment index f79b58b3c0..e683997ba4 100644 --- a/core/assets/shaders/blockbuild.fragment +++ b/core/assets/shaders/blockbuild.fragment @@ -29,10 +29,6 @@ bool cont(vec2 T, vec2 v){ id(T + vec2(step, 0) * v, base) || id(T + vec2(-step, 0) * v, base)); } -float rand(vec2 co){ - return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); -} - void main() { vec2 t = v_texCoord.xy; @@ -51,11 +47,11 @@ void main() { chance = 1.0-(u_progress-0.8)*5.0; } - if((mod(u_time / 1.5 + value, 20.0) < 5.0 && cont(t, v)) && rand(coords) < chance){ + if((mod(u_time / 1.5 + value, 20.0) < 5.0 && cont(t, v))){ gl_FragColor = u_color; }else if(dst > (1.0-u_progress) * (center.x)){ gl_FragColor = color; - }else if((dst + 1.0 > (1.0-u_progress) * (center.x)) && color.a > 0.1 && rand(coords) < chance){ + }else if((dst + 1.0 > (1.0-u_progress) * (center.x)) && color.a > 0.1){ gl_FragColor = u_color; }else{ gl_FragColor = vec4(0.0); diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index a11a7dbdcb..a1928e49a3 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -93,7 +93,6 @@ public class Vars{ public static boolean headless = false; public static float controllerMin = 0.25f; public static float baseControllerSpeed = 11f; - public static boolean snapCamera = true; public static ContentLoader content; public static GameState state; diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index 2d39a52c39..fdb4450779 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.graphics.Color; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; @@ -53,6 +52,7 @@ public class Renderer extends RendererModule{ public Renderer(){ Core.batch = new SpriteBatch(4096); + Graphics.setScaleEffects(false); Lines.setCircleVertices(14); @@ -109,7 +109,7 @@ public class Renderer extends RendererModule{ clearColor = new Color(0f, 0f, 0f, 1f); - effectSurface = Graphics.createSurface(Core.cameraScale); + effectSurface = Graphics.createSurface(1); pixelSurface = Graphics.createSurface(Core.cameraScale); } @@ -147,35 +147,17 @@ public class Renderer extends RendererModule{ if(core != null && players[0].spawner == -1){ smoothCamera(core.x, core.y, 0.08f); }else{ - smoothCamera(position.x + 0.0001f, position.y + 0.0001f, 0.08f); + smoothCamera(position.x, position.y, 0.08f); } }else if(!mobile){ - setCamera(position.x + 0.0001f, position.y + 0.0001f); + smoothCamera(position.x, position.y, 0.08f); } camera.position.x = Mathf.clamp(camera.position.x, -tilesize / 2f, world.width() * tilesize - tilesize / 2f); camera.position.y = Mathf.clamp(camera.position.y, -tilesize / 2f, world.height() * tilesize - tilesize / 2f); - float prex = camera.position.x, prey = camera.position.y; updateShake(0.75f); - float deltax = camera.position.x - prex, deltay = camera.position.y - prey; - float lastx = camera.position.x, lasty = camera.position.y; - - if(snapCamera){ - camera.position.set((int) camera.position.x, (int) camera.position.y, 0); - } - - if(Gdx.graphics.getHeight() / Core.cameraScale % 2 == 1){ - camera.position.add(0, -0.5f, 0); - } - - if(Gdx.graphics.getWidth() / Core.cameraScale % 2 == 1){ - camera.position.add(-0.5f, 0, 0); - } - draw(); - - camera.position.set(lastx - deltax, lasty - deltay, 0); } if(!ui.chatfrag.chatOpen()){ @@ -310,10 +292,10 @@ public class Renderer extends RendererModule{ Shaders.mix.color.set(Color.WHITE); //Graphics.beginShaders(Shaders.outline); - //Graphics.shader(Shaders.mix, true); + Graphics.shader(Shaders.mix, true); drawAndInterpolate(unitGroups[team.ordinal()], u -> u.isFlying() == flying && !u.isDead(), Unit::drawAll); drawAndInterpolate(playerGroup, p -> p.isFlying() == flying && p.getTeam() == team, Unit::drawAll); - //Graphics.shader(); + Graphics.shader(); blocks.drawTeamBlocks(Layer.turret, team); // Graphics.endShaders(); @@ -362,10 +344,6 @@ public class Renderer extends RendererModule{ public void setCameraScale(int amount){ targetscale = amount; clampScale(); - //scale up all surfaces in preparation for the zoom - for(Surface surface : Graphics.getSurfaces()){ - surface.setScale(targetscale); - } } public void scaleCamera(int amount){ diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index dfb707c43f..b575fb4aed 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -30,6 +30,7 @@ import io.anuke.ucore.core.*; import io.anuke.ucore.entities.EntityGroup; import io.anuke.ucore.entities.EntityQuery; import io.anuke.ucore.graphics.Draw; +import io.anuke.ucore.graphics.Fill; import io.anuke.ucore.graphics.Hue; import io.anuke.ucore.graphics.Lines; import io.anuke.ucore.util.*; @@ -385,11 +386,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra } public float snappedX(){ - return snapCamera && isLocal ? (int) (x + 0.0001f) : x; + return x; } public float snappedY(){ - return snapCamera && isLocal ? (int) (y + 0.0001f) : y; + return y; } public void drawName(){ diff --git a/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java b/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java index f9863fa670..1c351764b0 100644 --- a/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java @@ -34,12 +34,7 @@ public class OverlayRenderer{ if(!input.isDrawing() || player.isDead()) continue; - Shaders.outline.color.set(Palette.accent); - Graphics.beginShaders(Shaders.outline); - input.drawOutlined(); - - Graphics.endShaders(); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java index 21d50003f1..4b676c6aa6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java @@ -257,15 +257,16 @@ public class PowerNode extends PowerBlock{ Draw.color(Palette.power, Palette.powerLight, Mathf.absin(Timers.time(), 5f, 1f)); Lines.stroke(1f); - for(int i = 0; i < segments; i++){ - float f1 = (float)i / segments; - float f2 = (float)(i+1) / segments; - t1.trns(angle1 + 90f, Mathf.lerp(Mathf.sin(tile.entity.id * 124f + Timers.time()/tscl + f1 * space, scl, mag), 0f, Math.abs(f1 - 0.5f)*2f)); - t2.trns(angle1 + 90f, Mathf.lerp(Mathf.sin(tile.entity.id * 124f + Timers.time()/tscl + f2 * space, scl, mag), 0f, Math.abs(f2 - 0.5f)*2f)); + Lines.beginLine(); - Lines.line(x1 + (x2 - x1) * f1 + t1.x, y1 + (y2 - y1) * f1 + t1.y, - x1 + (x2 - x1) * f2 + t2.x, y1 + (y2 - y1) * f2 + t2.y); + for(int i = 0; i < segments + 1; i++){ + float f1 = (float)i / segments; + t1.trns(angle1 + 90f, Mathf.lerp(Mathf.sin(tile.entity.id * 124f + Timers.time()/tscl + f1 * space, scl, mag), 0f, Math.abs(f1 - 0.5f)*2f)); + + Lines.linePoint(x1 + (x2 - x1) * f1 + t1.x, y1 + (y2 - y1) * f1 + t1.y); } + + Lines.endLine(); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/StorageBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/StorageBlock.java index 417a7dd4a0..c9e494757b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/StorageBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/StorageBlock.java @@ -1,17 +1,12 @@ package io.anuke.mindustry.world.blocks.storage; -import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.Unit; -import io.anuke.mindustry.graphics.Palette; -import io.anuke.mindustry.graphics.Shaders; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; -import io.anuke.ucore.core.Graphics; -import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Fill; import static io.anuke.mindustry.Vars.tilesize; @@ -60,16 +55,16 @@ public abstract class StorageBlock extends Block{ if(entity.graph.getTiles().size > 1){ - Shaders.outline.color.set(Palette.accent); - Graphics.beginShaders(Shaders.outline); + //Shaders.outline.color.set(Palette.accent); + //Graphics.beginShaders(Shaders.outline); for(Tile other : entity.graph.getTiles()){ Fill.square(other.drawx(), other.drawy(), other.block().size * tilesize); } - Draw.color(Color.CLEAR); - Graphics.endShaders(); - Draw.color(); + // Draw.color(Color.CLEAR); + //Graphics.endShaders(); + //Draw.color(); } }