'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var fragment = "\nin vec2 vTextureCoord;\nin vec4 vColor;\n\nout vec4 fragColor;\n\nuniform float uColorMatrix[20];\nuniform float uAlpha;\n\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n    vec4 color = texture(uSampler, vTextureCoord);\n    float randomValue = rand(gl_FragCoord.xy * 0.2);\n    float diff = (randomValue - 0.5) *  0.5;\n    \n    float[20] cm = uColorMatrix;\n\n\n    if (uAlpha == 0.0) {\n        fragColor = color;\n        return;\n    }\n\n    if (color.a > 0.0) {\n        color.rgb /= color.a;\n    }\n\n    vec4 result;\n\n    result.r = (cm[0] * color.r);\n        result.r += (cm[1] * color.g);\n        result.r += (cm[2] * color.b);\n        result.r += (cm[3] * color.a);\n        result.r += cm[4];\n\n    result.g = (cm[5] * color.r);\n        result.g += (cm[6] * color.g);\n        result.g += (cm[7] * color.b);\n        result.g += (cm[8] * color.a);\n        result.g += cm[9];\n\n    result.b = (cm[10] * color.r);\n       result.b += (cm[11] * color.g);\n       result.b += (cm[12] * color.b);\n       result.b += (cm[13] * color.a);\n       result.b += cm[14];\n\n    result.a = (cm[15] * color.r);\n       result.a += (cm[16] * color.g);\n       result.a += (cm[17] * color.b);\n       result.a += (cm[18] * color.a);\n       result.a += cm[19];\n\n    vec3 rgb = mix(color.rgb, result.rgb, uAlpha);\n\n    // Premultiply alpha again.\n    rgb *= result.a;\n\n    fragColor = vec4(rgb, result.a);\n}\n";

exports["default"] = fragment;
//# sourceMappingURL=colorMatrixFilter2.js.map
