(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define(["exports"], factory);
  } else if (typeof exports !== "undefined") {
    factory(exports);
  } else {
    var mod = {
      exports: {}
    };
    factory(mod.exports);
    global.VerticalTiltShiftShader = mod.exports;
  }
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.VerticalTiltShiftShader = void 0;

  /**
   * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position
   *
   * - 9 samples per pass
   * - standard deviation 2.7
   * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
   * - "r" parameter control where "focused" horizontal line lies
   */
  var VerticalTiltShiftShader = {
    uniforms: {
      'tDiffuse': {
        value: null
      },
      'v': {
        value: 1.0 / 512.0
      },
      'r': {
        value: 0.35
      }
    },
    vertexShader:
    /* glsl */
    "\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
    fragmentShader:
    /* glsl */
    "\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tuniform float r;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tfloat vv = v * abs( r - vUv.y );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"
  };
  _exports.VerticalTiltShiftShader = VerticalTiltShiftShader;
});