Team-colored shields

This commit is contained in:
Anuken
2020-06-26 18:42:29 -04:00
parent 0df4e26736
commit 7401c16ded
9 changed files with 23 additions and 30 deletions

View File

@@ -8,6 +8,7 @@
uniform sampler2D u_texture;
uniform vec2 u_texsize;
uniform vec2 u_invsize;
uniform float u_time;
uniform float u_dp;
uniform vec2 u_offset;
@@ -20,20 +21,19 @@ void main(){
vec2 coords = (T * u_texsize) + u_offset;
T += vec2(sin(coords.y / 3.0 + u_time / 20.0), sin(coords.x / 3.0 + u_time / 20.0)) / u_texsize;
float si = sin(u_time / 20.0) / 8.0;
vec4 color = texture2D(u_texture, T);
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
vec2 v = u_invsize;
if(texture2D(u_texture, T).a < 0.9 &&
(texture2D(u_texture, T + vec2(0, step) * v).a > 0.0 || texture2D(u_texture, T + vec2(0, -step) * v).a > 0.0 ||
texture2D(u_texture, T + vec2(step, 0) * v).a > 0.0 || texture2D(u_texture, T + vec2(-step, 0) * v).a > 0.0)){
vec4 maxed = max(max(max(texture2D(u_texture, T + vec2(0, step) * v), texture2D(u_texture, T + vec2(0, -step) * v)), texture2D(u_texture, T + vec2(step, 0) * v)), texture2D(u_texture, T + vec2(-step, 0) * v));
gl_FragColor = mix(u_shieldcolor, vec4(1.0), si);
if(texture2D(u_texture, T).a < 0.9 && maxed.a > 0.9){
gl_FragColor = vec4(maxed.rgb, maxed.a * 100.0);
}else{
if(color.a > 0.0){
if(mod(coords.x / u_dp + coords.y / u_dp + sin(floor(coords.x / u_dp) / 5.0) * 3.0 + sin(floor(coords.y / u_dp) / 5.0) * 3.0 + u_time / 4.0, 10.0) < 2.0){
if(mod(coords.x / u_dp + coords.y / u_dp + sin(coords.x / u_dp / 5.0) * 3.0 + sin(coords.y / u_dp / 5.0) * 3.0 + u_time / 4.0, 10.0) < 2.0){
color *= 1.65;
}