Advertisement
KoctrX

Старый но рабочий

Feb 8th, 2022
2,417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cutoutFragmentClear: `#define GLSLIFY 1
  2.         varying vec2 vMaskCoord;
  3.         varying vec2 vTextureCoord;
  4.         uniform vec2 scale_diff;
  5.         uniform sampler2D uSampler;
  6.         uniform sampler2D mask;        
  7.         uniform float alpha;
  8.         uniform float r;
  9.         uniform float g;
  10.         uniform float b;
  11.         // Coords
  12.         uniform float w;
  13.         uniform float h;
  14.         uniform float x;
  15.         uniform vec4 maskClamp;
  16.         uniform float y;
  17.         uniform bool invert;
  18.          
  19.         varying vec4 temp;        
  20.         void main(void) {
  21.            vec2 maskyCord = (vTextureCoord - (vec2(1.0/w,1.0/h))-vec2(x/w,y/h));
  22.            
  23.             maskyCord.x = clamp(maskyCord.x, 0., 1.0);
  24.             maskyCord.y = clamp(maskyCord.y, 0., 1.0);
  25.            
  26.            vec4 color = texture2D(uSampler, vTextureCoord);
  27.            vec4 masky = texture2D(mask, maskyCord);
  28.            vec4 colorCoord = texture2D(uSampler, vTextureCoord);
  29.            
  30.            if(colorCoord.a == 0.0) {
  31.             gl_FragColor = colorCoord;
  32.            } else {
  33.             if(invert) {
  34.                 if (masky.a != 1.0 && maskyCord.x < 1.0 && maskyCord.y < 1.0) {
  35.                     color = vec4(color.rgb, 1.0) * masky.a;
  36.                 }
  37.                } else {
  38.                 if (masky.a != 0.0 && maskyCord.x < 1.0 && maskyCord.y < 1.0) {
  39.                     color = vec4(color.rgb, 1.0) * (1. - masky.a);
  40.                 }
  41.                }
  42.            
  43.                 gl_FragColor = color;
  44.            }
  45.         }`,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement