Shield shader simplification
This commit is contained in:
@@ -6,9 +6,10 @@ precision highp int;
|
||||
#define MAX_HITS 64
|
||||
#define HIT_RADIUS 12.0
|
||||
#define ALPHA 0.18
|
||||
#define thickness 1.0
|
||||
#define step 2.0
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform vec4 u_color;
|
||||
uniform vec2 u_texsize;
|
||||
uniform float u_time;
|
||||
uniform float u_scaling;
|
||||
@@ -25,29 +26,19 @@ float round(float f){
|
||||
void main() {
|
||||
|
||||
vec2 T = v_texCoord.xy;
|
||||
|
||||
vec2 coords = (T * u_texsize) + u_offset;
|
||||
|
||||
T += vec2(sin(coords.y / 3.0 + u_time / 20.0) / 240.0, sin(coords.x / 3.0 + u_time / 20.0) / 240.0) * u_scaling;
|
||||
|
||||
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);
|
||||
|
||||
bool any = false;
|
||||
if(texture2D(u_texture, T).a < 0.1 &&
|
||||
(texture2D(u_texture, T + vec2(0, step) * v).a > 0.1 || texture2D(u_texture, T + vec2(0, -step) * v).a > 0.1 ||
|
||||
texture2D(u_texture, T + vec2(step, 0) * v).a > 0.1 || texture2D(u_texture, T + vec2(-step, 0) * v).a > 0.1)){
|
||||
|
||||
float thickness = 1.0;
|
||||
float step = 2.0;
|
||||
|
||||
if(texture2D(u_texture, T).a < 0.1 &&
|
||||
(texture2D(u_texture, T + vec2(0, step) * v).a > 0.1 || texture2D(u_texture, T + vec2(0, -step) * v).a > 0.1 ||
|
||||
texture2D(u_texture, T + vec2(step, 0) * v).a > 0.1 || texture2D(u_texture, T + vec2(-step, 0) * v).a > 0.1))
|
||||
any = true;
|
||||
|
||||
if(any){
|
||||
gl_FragColor = mix(u_color, vec4(1.0), si);
|
||||
gl_FragColor = mix(v_color, vec4(1.0), si);
|
||||
}else{
|
||||
|
||||
if(color.a > 0.1){
|
||||
|
||||
Reference in New Issue
Block a user