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

@ -13,9 +13,7 @@ uniform float OriginalIntensity;
varying MED vec2 v_texCoords;
void main()
{
void main(){
vec4 original = texture2D(u_texture0, v_texCoords) * OriginalIntensity;
vec4 bloom = texture2D(u_texture1, v_texCoords) * BloomIntensity;
original = original * (vec4(1.0) - bloom);

View File

@ -16,8 +16,7 @@ varying MED vec2 v_texCoords4;
const float center = 0.2270270270;
const float close = 0.3162162162;
const float far = 0.0702702703;
void main()
{
void main(){
gl_FragColor = far * texture2D(u_texture, v_texCoords0)
+ close * texture2D(u_texture, v_texCoords1)
+ center * texture2D(u_texture, v_texCoords2)

View File

@ -9,8 +9,7 @@ precision lowp float;
uniform sampler2D u_texture0;
uniform vec2 threshold;
varying MED vec2 v_texCoords;
void main()
{
void main(){
vec4 color = texture2D(u_texture0, v_texCoords);
if(color.r + color.g + color.b > 0.5 * 3.0){
gl_FragColor = color;

View File

@ -13,8 +13,7 @@ uniform float OriginalIntensity;
varying MED vec2 v_texCoords;
void main()
{
void main(){
vec3 original = texture2D(u_texture0, v_texCoords).rgb;
vec3 bloom = texture2D(u_texture1, v_texCoords).rgb * BloomIntensity;

View File

@ -15,8 +15,8 @@ varying MED vec2 v_texCoords3;
varying MED vec2 v_texCoords4;
const vec2 futher = vec2(3.2307692308, 3.2307692308);
const vec2 closer = vec2(1.3846153846, 1.3846153846);
void main()
{
void main(){
vec2 sizeAndDir = dir / size;
vec2 f = futher*sizeAndDir;
vec2 c = closer*sizeAndDir;

View File

@ -16,8 +16,7 @@ varying MED vec2 v_texCoords4;
const float center = 0.2270270270;
const float close = 0.3162162162;
const float far = 0.0702702703;
void main()
{
void main(){
gl_FragColor.rgb = far * texture2D(u_texture, v_texCoords0).rgb
+ close * texture2D(u_texture, v_texCoords1).rgb
+ center * texture2D(u_texture, v_texCoords2).rgb

View File

@ -9,8 +9,8 @@ precision lowp float;
uniform sampler2D u_texture0;
uniform vec2 threshold;
varying MED vec2 v_texCoords;
void main()
{
void main(){
vec4 tex = texture2D(u_texture0, v_texCoords);
vec3 colors = (tex.rgb - threshold.r) * threshold.g * tex.a;
gl_FragColor = vec4(colors, tex.a);

View File

@ -6,8 +6,8 @@
attribute vec4 a_position;
attribute vec2 a_texCoord0;
varying MED vec2 v_texCoords;
void main()
{
void main(){
v_texCoords = a_texCoord0;
gl_Position = a_position;
}

View File

@ -9,7 +9,7 @@ precision lowp float;
uniform sampler2D u_texture0;
uniform vec2 threshold;
varying MED vec2 v_texCoords;
void main()
{
void main(){
gl_FragColor.rgb = (texture2D(u_texture0, v_texCoords).rgb - vec3(threshold.x)) * threshold.y;
}

View File

@ -9,7 +9,7 @@ varying vec2 v_texCoord;
uniform vec2 u_viewportInverse;
void main() {
void main(){
gl_Position = u_projTrans * a_position;
v_texCoord = a_texCoord0;
v_color = a_color;

View File

@ -13,6 +13,5 @@ varying vec2 v_texCoord;
void main(){
vec4 color = texture2D(u_texture, v_texCoord.xy);
//color.a = clamp(color.a, 0.0, 0.8);
gl_FragColor = clamp(vec4(mix(u_ambient.rgb, color.rgb, color.a), u_ambient.a - color.a), 0.0, 1.0);
}

View File

@ -1,44 +0,0 @@
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
#define p1 vec3(255.0,211.0,127.0)/255.0
#define p2 vec3(234.0,182.0,120.0)/255.0
#define p3 vec3(212.0,129.0,107.0)/255.0
#define p4 vec3(142.0,77.0,72.0)/255.0
#define roundm 0.2
uniform sampler2D u_texture;
uniform vec2 u_resolution;
uniform int u_time;
uniform vec2 u_uv;
uniform vec2 u_uv2;
uniform float u_scl;
varying vec4 v_color;
varying vec2 v_texCoord;
void main() {
ivec2 coords = ivec2((gl_FragCoord.xy - u_resolution/2.0)/u_scl);
//int roundx = 8;
//int roundy = roundx;
//coords.x = (coords.x / roundx) * roundx;
//coords.y = (coords.y / roundy) * roundy;
float d = (abs(float(coords.x)) - abs(float(coords.y)));
float m = abs(sin(-float(u_time)/50.0 + d/120.0));
if(m > 0.95) gl_FragColor.rgb = p1;
else if(m > 0.75) gl_FragColor.rgb = p2;
else if(m > 0.55) gl_FragColor.rgb = p3;
else if(m > 0.35) gl_FragColor.rgb = p4;
else gl_FragColor.rgb = vec3(0.0);
gl_FragColor.rgb *= 0.5;
gl_FragColor.a = mod(abs(float(coords.x)) + abs(float(coords.y)), 110.0) < 35.0 ? 1.0 : 0.0;
}

View File

@ -1,44 +0,0 @@
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
#define SPACE 2.0
uniform sampler2D u_texture;
uniform vec4 u_color;
uniform vec2 u_texsize;
uniform float u_scl;
varying vec4 v_color;
varying vec2 v_texCoord;
void main() {
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
vec4 c = texture2D(u_texture, v_texCoord.xy);
float spacing = SPACE * u_scl;
gl_FragColor = mix(vec4(0.0, 0.0, 0.0, min(c.a, u_color.a)), u_color,
(1.0-step(0.001, texture2D(u_texture, v_texCoord.xy).a)) *
step(0.001,
//cardinals
texture2D(u_texture, v_texCoord.xy + vec2(0, spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(0, -spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(spacing, 0) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, 0) * v).a +
//cardinal edges
texture2D(u_texture, v_texCoord.xy + vec2(spacing, spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(spacing, -spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, spacing) * v).a +
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, -spacing) * v).a +
//cardinals * 2
texture2D(u_texture, v_texCoord.xy + vec2(0, spacing) * v*2.0).a +
texture2D(u_texture, v_texCoord.xy + vec2(0, -spacing) * v*2.0).a +
texture2D(u_texture, v_texCoord.xy + vec2(spacing, 0) * v*2.0).a +
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, 0) * v*2.0).a
));
}

View File

@ -18,8 +18,7 @@ uniform vec2 u_offset;
varying vec4 v_color;
varying vec2 v_texCoord;
void main() {
void main(){
vec2 T = v_texCoord.xy;
vec2 coords = (T * u_texsize) + u_offset;

View File

@ -1,45 +0,0 @@
#define LIGHT
#ifdef LIGHT
#define LAYERS 30.
#define DEPTH .5
#define WIDTH .3
#define SPEED .6
#define SIZE 0.2
#else
#define LAYERS 200.
#define DEPTH .1
#define WIDTH .8
#define SPEED 1.5
#define SIZE 1.0
#endif
varying vec2 v_texCoords;
uniform vec2 u_pos;
uniform vec2 u_resolution;
uniform float u_time;
uniform sampler2D u_texture0;
void main(){
gl_FragColor = texture2D(u_texture0, v_texCoords);
vec2 uv = (v_texCoords * u_resolution + u_pos) / 1000.0;
const mat3 p = mat3(
13.3231, 23.5112, 21.7112,
21.1212, 28.7312, 11.9312,
21.8112, 14.7212, 61.3934
);
float dof = 5.*sin(u_time*.1);
//TODO this is very slow
for(float i=0.0; i<LAYERS; i++){
vec2 q = uv* (1.+i*DEPTH);
q += vec2(q.y* WIDTH * (fract(i*7.238917) - .5), SPEED * u_time / (1.+i*DEPTH*.03));
vec3 n = vec3(floor(q), 31.189+i), m = floor(n)/1e5 + fract(n), mp = (31.9+m) / fract(p*m), r = fract(mp);
vec2 s = abs(fract(q)-.5 +.9*r.xy-.45) + .01*abs(2.0*fract(10.*q.yx) - 1.0);
float d = .6 * (s.x+s.y) + max(s.x,s.y) -.01, edge = .005*SIZE + .05 * SIZE * min(.5* abs(i-5.-dof), 1.);
gl_FragColor += smoothstep(edge,-edge,d) * r.x / (1.+.02*i*DEPTH);
}
}

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);