Removal of unused assets/classes

This commit is contained in:
Anuken
2020-05-11 00:41:35 -04:00
parent a344c1a5d0
commit 3ea2360290
22 changed files with 35 additions and 221 deletions

View File

@@ -145,7 +145,8 @@ public class ContentLoader{
}
public void dispose(){
//clear all content, currently not used
initialize(Content::dispose);
clear();
}
/** Get last piece of content created for error-handling purposes. */

View File

@@ -1,13 +1,13 @@
package mindustry.ctype;
import arc.files.*;
import arc.util.*;
import arc.util.ArcAnnotate.*;
import mindustry.*;
import mindustry.mod.Mods.*;
/** Base class for a content type that is loaded in {@link mindustry.core.ContentLoader}. */
public abstract class Content implements Comparable<Content>{
public abstract class Content implements Comparable<Content>, Disposable{
public final short id;
/** Info on which mod this content was loaded from. */
public @NonNull ModContentInfo minfo = new ModContentInfo();
@@ -40,6 +40,11 @@ public abstract class Content implements Comparable<Content>{
return minfo.error != null;
}
@Override
public void dispose(){
//does nothing by default
}
@Override
public int compareTo(Content c){
return Integer.compare(id, c.id);

View File

@@ -15,12 +15,10 @@ import mindustry.type.*;
import static mindustry.Vars.renderer;
public class Shaders{
public static Shadow shadow;
public static BlockBuild blockbuild;
public static @Nullable Shield shield;
public static UnitBuild build;
public static FogShader fog;
public static MenuShader menu;
public static LightShader light;
public static SurfaceShader water, tar, slag;
public static PlanetShader planet;
@@ -30,7 +28,6 @@ public class Shaders{
public static Shader unlit;
public static void init(){
shadow = new Shadow();
blockbuild = new BlockBuild();
try{
shield = new Shield();
@@ -41,7 +38,6 @@ public class Shaders{
}
build = new UnitBuild();
fog = new FogShader();
menu = new MenuShader();
light = new LightShader();
water = new SurfaceShader("water");
tar = new SurfaceShader("tar");
@@ -131,25 +127,6 @@ public class Shaders{
}
public static class MenuShader extends LoadShader{
float time = 0f;
public MenuShader(){
super("menu", "default");
}
@Override
public void apply(){
time = time % 158;
setUniformf("u_resolution", Core.graphics.getWidth(), Core.graphics.getHeight());
setUniformi("u_time", (int)(time += Core.graphics.getDeltaTime() * 60f));
setUniformf("u_uv", Core.atlas.white().getU(), Core.atlas.white().getV());
setUniformf("u_scl", Scl.scl(1f));
setUniformf("u_uv2", Core.atlas.white().getU2(), Core.atlas.white().getV2());
}
}
public static class FogShader extends LoadShader{
public FogShader(){
super("fog", "default");
@@ -176,23 +153,6 @@ public class Shaders{
}
}
public static class Shadow extends LoadShader{
public Color color = new Color();
public TextureRegion region = new TextureRegion();
public float scl;
public Shadow(){
super("shadow", "default");
}
@Override
public void apply(){
setUniformf("u_color", color);
setUniformf("u_scl", scl);
setUniformf("u_texsize", region.getTexture().getWidth(), region.getTexture().getHeight());
}
}
public static class BlockBuild extends LoadShader{
public Color color = new Color();
public float progress;

View File

@@ -1,19 +0,0 @@
package mindustry.graphics;
import arc.*;
import arc.fx.*;
public class SnowFilter extends FxFilter{
public SnowFilter(){
super(compileShader(Core.files.internal("shaders/screenspace.vert"), Core.files.internal("shaders/snow.frag")));
autobind = true;
}
@Override
public void setParams(){
shader.setUniformf("u_time", time / 60f);
shader.setUniformf("u_pos", Core.camera.position.x - Core.camera.width / 2, Core.camera.position.y - Core.camera.height / 2);
shader.setUniformf("u_resolution", Core.camera.width, Core.camera.height);
}
}

View File

@@ -25,10 +25,10 @@ public enum Category{
public static final Category[] all = values();
public Category prev(){
return all[(this.ordinal() - 1 + all.length) % all.length];
return all[(ordinal() - 1 + all.length) % all.length];
}
public Category next(){
return all[(this.ordinal() + 1) % all.length];
return all[(ordinal() + 1) % all.length];
}
}

View File

@@ -9,8 +9,8 @@ import mindustry.ctype.ContentType;
import mindustry.ui.*;
public class Liquid extends UnlockableContent{
/** Color used in pipes and on the ground. */
public final @NonNull Color color;
/** Color used in bars. */
public @Nullable Color barColor;
/** Color used to draw lights. Note that the alpha channel is used to dictate brightness. */

View File

@@ -186,6 +186,14 @@ public class Planet extends UnlockableContent{
mesh = meshLoader.get();
}
@Override
public void dispose(){
if(mesh != null){
mesh.dispose();
mesh = null;
}
}
/** Gets a sector a tile position. */
public Sector getSector(Ptile tile){
return sectors.get(tile.id);