Fixed water animation conflict

This commit is contained in:
Anuken 2020-04-23 15:08:32 -04:00
parent 87ed405916
commit cafd076f9c
5 changed files with 15 additions and 12 deletions

View File

@ -6,7 +6,7 @@ precision mediump int;
//shades of slag //shades of slag
#define S2 vec3(100.0, 93.0, 49.0) / 100.0 #define S2 vec3(100.0, 93.0, 49.0) / 100.0
#define S1 vec3(100.0, 60.0, 25.0) / 100.0 #define S1 vec3(100.0, 60.0, 25.0) / 100.0
#define NSCALE 280.0 / 2.0 #define NSCALE 200.0 / 2.0
uniform sampler2D u_texture; uniform sampler2D u_texture;
uniform sampler2D u_noise; uniform sampler2D u_noise;
@ -24,13 +24,15 @@ void main(){
float btime = u_time / 4000.0; float btime = u_time / 4000.0;
float noise = (texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(btime * 1.1) * vec2(0.8, -1.0)).r) / 2.0; float noise = (texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(btime * 1.1) * vec2(0.8, -1.0)).r) / 2.0;
vec3 color = texture2D(u_texture, c).rgb; vec4 color = texture2D(u_texture, c);
if(noise > 0.6){ if(color.a > 0.1){
color = S2; if(noise > 0.6){
}else if(noise > 0.54){ color.rgb = S2;
color = S1; }else if (noise > 0.54){
color.rgb = S1;
}
} }
gl_FragColor = vec4(color.rgb, 1.0); gl_FragColor = color;
} }

View File

@ -21,11 +21,11 @@ void main(){
float btime = u_time / 8000.0; float btime = u_time / 8000.0;
float noise = (texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(btime * 1.1) * vec2(-0.8, -1.0)).r) / 2.0; float noise = (texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(btime * 1.1) * vec2(-0.8, -1.0)).r) / 2.0;
vec3 color = texture2D(u_texture, c).rgb; vec4 color = texture2D(u_texture, c);
if(!(noise > 0.54 && noise < 0.58)){ if(!(noise > 0.54 && noise < 0.58)){
color *= 0.6; color.rgb *= 0.6;
} }
gl_FragColor = vec4(color.rgb, 1.0); gl_FragColor = color;
} }

View File

@ -8,7 +8,6 @@ import arc.graphics.gl.*;
import static mindustry.Vars.renderer; import static mindustry.Vars.renderer;
public enum CacheLayer{ public enum CacheLayer{
//TODO water animation breaks when tar/slag is present
water{ water{
@Override @Override
public void begin(){ public void begin(){

View File

@ -23,7 +23,7 @@ public class Layer{
//things drawn over blocks (intermediate layer) //things drawn over blocks (intermediate layer)
blockOver = 35, blockOver = 35,
//blocks currently in progress *shaders used* TODO perhaps put shaders into their own category //blocks currently in progress *shaders used*
blockBuilding = 40, blockBuilding = 40,
//ground units //ground units

View File

@ -135,6 +135,8 @@ public class MinimapRenderer implements Disposable{
} }
public void update(Tile tile){ public void update(Tile tile){
if(world.isGenerating()) return;
int color = colorFor(world.tile(tile.x, tile.y)); int color = colorFor(world.tile(tile.x, tile.y));
pixmap.draw(tile.x, pixmap.getHeight() - 1 - tile.y, color); pixmap.draw(tile.x, pixmap.getHeight() - 1 - tile.y, color);