{"version":3,"file":"TriangleBlurShader.cjs","sources":["../../src/shaders/TriangleBlurShader.ts"],"sourcesContent":["import { Vector2 } from 'three'\n\n/**\n * Triangle blur shader\n * based on glfx.js triangle blur shader\n * https://github.com/evanw/glfx.js\n *\n * A basic blur filter, which convolves the image with a\n * pyramid filter. The pyramid filter is separable and is applied as two\n * perpendicular triangle filters.\n */\n\nexport const TriangleBlurShader = {\n uniforms: {\n texture: { value: null },\n delta: { value: /* @__PURE__ */ new Vector2(1, 1) },\n },\n\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `,\n\n fragmentShader: /* glsl */ `\n #include \n\n #define ITERATIONS 10.0\n\n uniform sampler2D texture;\n uniform vec2 delta;\n\n varying vec2 vUv;\n\n void main() {\n\n \tvec4 color = vec4( 0.0 );\n\n \tfloat total = 0.0;\n\n // randomize the lookup values to hide the fixed number of samples\n\n \tfloat offset = rand( vUv );\n\n \tfor ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {\n\n \t\tfloat percent = ( t + offset - 0.5 ) / ITERATIONS;\n \t\tfloat weight = 1.0 - abs( percent );\n\n \t\tcolor += texture2D( texture, vUv + delta * percent ) * weight;\n \t\ttotal += weight;\n\n \t}\n\n \tgl_FragColor = color / total;\n\n }\n `,\n}\n"],"names":["Vector2"],"mappings":";;;AAYO,MAAM,qBAAqB;AAAA,EAChC,UAAU;AAAA,IACR,SAAS,EAAE,OAAO,KAAK;AAAA,IACvB,OAAO,EAAE,2BAA2BA,MAAQ,QAAA,GAAG,CAAC,EAAE;AAAA,EACpD;AAAA,EAEA;AAAA;AAAA,IAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWzB;AAAA;AAAA,IAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkC7B;;"}