text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.rextoonifypipelineplugin=t():e.rextoonifypipelineplugin=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=259)}({259:function(e,t,n){"use strict";n.r(t);var r="\n#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n\n// Scene buffer\nuniform sampler2D uMainSampler; \nvarying vec2 outTexCoord;\nuniform vec2 texSize;\n\n// Effect parameters\nuniform float edgeThreshold; // 0.2;\nuniform float hStep;  // 60\nuniform float sStep;  // 0.15\nuniform float vStep;  // 0.33\nuniform vec3 edgeColor; // (0, 0, 0);\n\nvec3 RGBToHSV(vec3 color) \n{\n  float minv, maxv, delta;\n  vec3 res;\n  minv = min(min(color.r, color.g), color.b);\n  maxv = max(max(color.r, color.g), color.b);\n  res.z = maxv;            // v\n\n  delta = maxv - minv;\n  if( maxv != 0.0 ) {\n    res.y = delta / maxv;      // s\n  } else {\n    // s = 0, v is undefined\n    res.y = 0.0;\n    res.x = -1.0;\n    return res;\n  }\n\n  if( color.r == maxv ) {\n    res.x = ( color.g - color.b ) / delta;      // between yellow & magenta\n  } else if( color.g == maxv ) {\n    res.x = 2.0 + ( color.b - color.r ) / delta;   // between cyan & yellow\n  } else {\n    res.x = 4.0 + ( color.r - color.g ) / delta;   // between magenta & cyan\n  }\n\n  res.x = res.x * 60.0;            // degrees\n  if( res.x < 0.0 ) {\n    res.x = res.x + 360.0;\n  }\n   \n  return res;\n}\n\nfloat AvgRGB(vec4 color) {\n    return (color.r + color.g + color.b)/3.0;\n}\n\n#define EDGEGAIN 5.0\nbool IsEdge(vec2 coords, vec2 texSize, float threshold) {\n  if (threshold > 1.0) {\n    return false;\n  }\n\n  vec2 tc = coords * texSize;\n  \n  float pixel[9];\n  int k = 0;\n  float delta;\n\n  // read neighboring pixel intensities\n  pixel[0] = AvgRGB( texture2D( uMainSampler, (tc + vec2(float(-1), float(-1))) / texSize )  );\n  pixel[1] = AvgRGB( texture2D( uMainSampler, (tc + vec2(float(-1), float( 0))) / texSize )  );\n  pixel[2] = AvgRGB( texture2D( uMainSampler, (tc + vec2(float(-1), float( 1))) / texSize )  );\n  pixel[3] = AvgRGB( texture2D( uMainSampler, (tc + vec2(float( 0), float(-1))) / texSize )  );\n  pixel[4] = AvgRGB( texture2D( uMainSampler, (tc + vec2(float( 0), float( 0))) / texSize )  );\n  pixel[5] = AvgRGB( texture2D( uMainSampler, (tc + vec2(float( 0), float( 1))) / texSize )  );\n  pixel[6] = AvgRGB( texture2D( uMainSampler, (tc + vec2(float( 1), float(-1))) / texSize )  );\n  pixel[7] = AvgRGB( texture2D( uMainSampler, (tc + vec2(float( 1), float( 0))) / texSize )  );\n  pixel[8] = AvgRGB( texture2D( uMainSampler, (tc + vec2(float( 1), float( 1))) / texSize )  );\n\n  // average color differences around neighboring pixels\n  delta = (abs(pixel[1]-pixel[7])+\n           abs(pixel[5]-pixel[3]) +\n           abs(pixel[0]-pixel[8])+\n           abs(pixel[2]-pixel[6])\n           )/4.0;\n\n  return (clamp(delta*EDGEGAIN, 0.0, 1.0) >= threshold);\n}\n\nvec3 HSVToRGB(float h, float s, float v) {\n  int i;\n  float f, p, q, t;\n  vec3 res;\n  if( s == 0.0 ) {\n    // achromatic (grey)\n    res.x = v;\n    res.y = v;\n    res.z = v;\n    return res;\n  }\n\n  h /= 60.0;         // sector 0 to 5\n  i = int(floor( h ));\n  f = h - float(i);         // factorial part of h\n  p = v * ( 1.0 - s );\n  q = v * ( 1.0 - s * f );\n  t = v * ( 1.0 - s * ( 1.0 - f ) );  \n  if (i == 0) {\n    res.x = v;\n    res.y = t;\n    res.z = p;\n  } else if (i == 1) {\n    res.x = q;\n    res.y = v;\n    res.z = p;\n  } else if (i == 2) {\n    res.x = p;\n    res.y = v;\n    res.z = t;\n  } else if (i == 3) {\n    res.x = p;\n    res.y = q;\n    res.z = v;\n  } else if (i == 4) {\n    res.x = t;\n    res.y = p;\n    res.z = v;\n  } else { // i == 5\n    res.x = v;\n    res.y = p;\n    res.z = q;\n  }\n  return res;\n}\n\nvoid main()\n{  \n  vec4 front = texture2D(uMainSampler, outTexCoord);  \n  vec3 colorLevel;\n  if ((hStep > 0.0) || (sStep > 0.0) || (vStep > 0.0)) {\n    vec3 colorHsv = RGBToHSV(front.rgb);  \n    if (hStep > 0.0) {\n      colorHsv.x = min(floor((colorHsv.x / hStep) + 0.5) * hStep, 360.0);\n    }\n    if (sStep > 0.0) {\n      colorHsv.y = min(floor((colorHsv.y / sStep) + 0.5) * sStep, 1.0);\n    }\n    if (vStep > 0.0) {\n      colorHsv.z = min(floor((colorHsv.z / vStep) + 0.5) * vStep, 1.0);\n    }\n    colorLevel = HSVToRGB(colorHsv.x, colorHsv.y, colorHsv.z);\n  } else {\n    colorLevel = front.rgb;\n  }\n\n  vec3 outColor = (IsEdge(outTexCoord, texSize, edgeThreshold))? edgeColor : colorLevel;\n  gl_FragColor = vec4(outColor, front.a);\n}\n";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t,n){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var f=Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline,c=Phaser.Utils.Objects.GetValue,p=Phaser.Display.Color.IntegerToRGB,v=Phaser.Display.Color,h=function(e){function t(e,n,i){var s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a,f,c=e.game;return a=this,(s=!(f=u(t).call(this,{game:c,renderer:c.renderer,fragShader:r}))||"object"!==o(f)&&"function"!=typeof f?l(a):f)._width=0,s._height=0,s._edgeGain=0,s._edgeThreshold=0,s._hueLevels=0,s._satLevels=0,s._valLevels=0,s._edgeColor=new v,c.renderer.addPipeline(n,l(s)),s.resetFromJSON(i),s}var n,h,d;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(t,f),n=t,(h=[{key:"resetFromJSON",value:function(e){return this.setEdgeThreshold(c(e,"edgeThreshold",.2)),this.setHueLevels(c(e,"hueLevels",0)),this.setSatLevels(c(e,"satLevels",0)),this.setValLevels(c(e,"valLevels",0)),this.setEdgeColor(c(e,"edgeColor",0)),this}},{key:"setEdgeThreshold",value:function(e){return this.edgeThreshold=e,this}},{key:"setHueLevels",value:function(e){return this.hueLevels=e,this}},{key:"setSatLevels",value:function(e){return this.satLevels=e,this}},{key:"setValLevels",value:function(e){return this.valLevels=e,this}},{key:"setEdgeColor",value:function(e){return this.edgeColor=e,this}},{key:"resize",value:function(e,n,r){return this._width=e,this._height=n,s(u(t.prototype),"resize",this).call(this,e,n,r),this.setFloat2("texSize",e,n),this}},{key:"edgeThreshold",get:function(){return this._edgeThreshold},set:function(e){this._edgeThreshold=e,this.setFloat1("edgeThreshold",e)}},{key:"hueLevels",get:function(){return this._hueLevels},set:function(e){this._hueLevels=e,e=e>0?360/e:0,this.setFloat1("hStep",e)}},{key:"satLevels",get:function(){return this._satLevels},set:function(e){this._satLevels=e,e=e>0?1/e:0,this.setFloat1("sStep",e)}},{key:"valLevels",get:function(){return this._valLevels},set:function(e){this._valLevels=e,e=e>0?1/e:0,this.setFloat1("vStep",e)}},{key:"edgeColor",get:function(){return this._edgeColor},set:function(e){"number"==typeof e&&(e=p(e));var t=this._edgeColor;t.setFromRGB(e),this.setFloat3("edgeColor",t.redGL,t.greenGL,t.blueGL)}}])&&i(n.prototype,h),d&&i(n,d),t}();function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var m=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),g(this,x(t).call(this,e))}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(t,Phaser.Plugins.BasePlugin),n=t,(r=[{key:"start",value:function(){this.game.events.once("destroy",this.destroy,this)}},{key:"add",value:function(e,t,n){return new h(e,t,n)}}])&&y(n.prototype,r),o&&y(n,o),t}();t.default=m}}).default});