This commit is contained in:
Anuken
2020-06-11 14:09:06 -04:00
parent e247b092dc
commit 1e954dc2be
8 changed files with 15 additions and 35 deletions

View File

@@ -146,7 +146,6 @@ public class AndroidLauncher extends AndroidApplication{
}, new AndroidApplicationConfiguration(){{ }, new AndroidApplicationConfiguration(){{
useImmersiveMode = true; useImmersiveMode = true;
hideStatusBar = true; hideStatusBar = true;
useGL30 = true;
errorHandler = CrashSender::log; errorHandler = CrashSender::log;
stencil = 8; stencil = 8;
}}); }});

View File

@@ -33,9 +33,6 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
@Override @Override
public void setup(){ public void setup(){
//array textures are gl30 only
if(gl30 == null) useArrayTextures = false;
loader = new LoadRenderer(); loader = new LoadRenderer();
Events.fire(new ClientCreateEvent()); Events.fire(new ClientCreateEvent());
@@ -70,9 +67,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
assets.load(new AssetDescriptor<>("sprites/sprites.atlas", TextureAtlas.class)).loaded = t -> { assets.load(new AssetDescriptor<>("sprites/sprites.atlas", TextureAtlas.class)).loaded = t -> {
atlas = (TextureAtlas)t; atlas = (TextureAtlas)t;
if(!useArrayTextures){ Fonts.mergeFontAtlas(atlas);
Fonts.mergeFontAtlas(atlas);
}
}; };
assets.loadRun("maps", Map.class, () -> maps.loadPreviews()); assets.loadRun("maps", Map.class, () -> maps.loadPreviews());

View File

@@ -38,8 +38,6 @@ public class Vars implements Loadable{
public static boolean loadedLogger = false, loadedFileLogger = false; public static boolean loadedLogger = false, loadedFileLogger = false;
/** Maximum schematic size.*/ /** Maximum schematic size.*/
public static final int maxSchematicSize = 32; public static final int maxSchematicSize = 32;
/** Whether to use array texture batches. */
public static boolean useArrayTextures = false;
/** All schematic base64 starts with this string.*/ /** All schematic base64 starts with this string.*/
public static final String schematicBaseStart ="bXNjaAB"; public static final String schematicBaseStart ="bXNjaAB";
/** IO buffer size. */ /** IO buffer size. */

View File

@@ -237,7 +237,6 @@ public class Renderer implements ApplicationListener{
if(settings.getBool("animatedshields")){ if(settings.getBool("animatedshields")){
Draw.drawRange(Layer.shields, 1f, () -> effectBuffer.begin(Color.clear), () -> { Draw.drawRange(Layer.shields, 1f, () -> effectBuffer.begin(Color.clear), () -> {
effectBuffer.end(); effectBuffer.end();
effectBuffer.blit(Shaders.shield); effectBuffer.blit(Shaders.shield);
}); });
} }

View File

@@ -10,10 +10,9 @@ import arc.math.geom.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.util.ArcAnnotate.*; import arc.util.ArcAnnotate.*;
import arc.util.*; import arc.util.*;
import mindustry.*;
import mindustry.type.*; import mindustry.type.*;
import static mindustry.Vars.renderer; import static mindustry.Vars.*;
public class Shaders{ public class Shaders{
public static BlockBuild blockbuild; public static BlockBuild blockbuild;
@@ -134,7 +133,7 @@ public class Shaders{
public static class FogShader extends LoadShader{ public static class FogShader extends LoadShader{
public FogShader(){ public FogShader(){
super("fog", "default", true); super("fog", "default");
} }
} }
@@ -144,7 +143,7 @@ public class Shaders{
public TextureRegion region; public TextureRegion region;
public UnitBuild(){ public UnitBuild(){
super("unitbuild", "default", true); super("unitbuild", "default");
} }
@Override @Override
@@ -164,7 +163,7 @@ public class Shaders{
public TextureRegion region = new TextureRegion(); public TextureRegion region = new TextureRegion();
public BlockBuild(){ public BlockBuild(){
super("blockbuild", "default", true); super("blockbuild", "default");
} }
@Override @Override
@@ -227,18 +226,7 @@ public class Shaders{
public static class LoadShader extends Shader{ public static class LoadShader extends Shader{
public LoadShader(String frag, String vert){ public LoadShader(String frag, String vert){
this(frag, vert, false); super(Core.files.internal("shaders/" + vert + ".vert").readString(), Core.files.internal("shaders/" + frag + ".frag").readString());
}
public LoadShader(String frag, String vert, boolean preprocess){
super(
preprocess && Core.gl30 != null && Vars.useArrayTextures ? ArrayTextureSpriteBatch.preprocessShader(
Core.files.internal("shaders/" + vert + ".vert").readString(), false) :
Core.files.internal("shaders/" + vert + ".vert").readString(),
preprocess && Core.gl30 != null && Vars.useArrayTextures ? ArrayTextureSpriteBatch.preprocessShader(
Core.files.internal("shaders/" + frag + ".frag").readString(), true) :
Core.files.internal("shaders/" + frag + ".frag").readString()
);
} }
} }
} }

View File

@@ -163,15 +163,17 @@ public class ForceProjector extends Block{
if(Core.settings.getBool("animatedshields")){ if(Core.settings.getBool("animatedshields")){
Fill.poly(x, y, 6, radius); Fill.poly(x, y, 6, radius);
Draw.z(Layer.shields + 0.1f); Draw.z(Layer.shields + 0.01f);
Draw.color(Color.white); if(hit > 0){
Draw.alpha(hit); Draw.color(Color.white);
Fill.poly(x, y, 6, radius); Draw.alpha(1f);
Draw.color(); Fill.poly(x, y, 6, radius);
Draw.color();
}
}else{ }else{
Lines.stroke(1.5f); Lines.stroke(1.5f);
Draw.alpha(0.09f + 0.08f * hit); Draw.alpha(0.09f + Mathf.clamp(0.08f * hit));
Fill.poly(x, y, 6, radius); Fill.poly(x, y, 6, radius);
Draw.alpha(1f); Draw.alpha(1f);
Lines.poly(x, y, 6, radius); Lines.poly(x, y, 6, radius);

View File

@@ -39,7 +39,6 @@ public class DesktopLauncher extends ClientLauncher{
new SdlApplication(new DesktopLauncher(arg), new SdlConfig(){{ new SdlApplication(new DesktopLauncher(arg), new SdlConfig(){{
title = "Mindustry"; title = "Mindustry";
maximized = true; maximized = true;
gl30 = true;
stencil = 8; stencil = 8;
width = 900; width = 900;
height = 700; height = 700;

View File

@@ -172,7 +172,7 @@ public class IOSLauncher extends IOSApplication.Delegate{
UINavigationController.attemptRotationToDeviceOrientation(); UINavigationController.attemptRotationToDeviceOrientation();
} }
}, new IOSApplicationConfiguration(){{ }, new IOSApplicationConfiguration(){{
useGL30 = true;
}}); }});
} }