diff --git a/demo/images/colormap.png b/demo/images/colormap.png new file mode 100644 index 000000000..122e07a52 Binary files /dev/null and b/demo/images/colormap.png differ diff --git a/demo/images/displacement_BG.jpg b/demo/images/displacement_BG.jpg new file mode 100644 index 000000000..7e666b203 Binary files /dev/null and b/demo/images/displacement_BG.jpg differ diff --git a/demo/images/displacement_fish1.png b/demo/images/displacement_fish1.png new file mode 100644 index 000000000..e7ddb254b Binary files /dev/null and b/demo/images/displacement_fish1.png differ diff --git a/demo/images/displacement_fish2.png b/demo/images/displacement_fish2.png new file mode 100644 index 000000000..86f458be1 Binary files /dev/null and b/demo/images/displacement_fish2.png differ diff --git a/demo/images/displacement_fish3.png b/demo/images/displacement_fish3.png new file mode 100644 index 000000000..cdaf13523 Binary files /dev/null and b/demo/images/displacement_fish3.png differ diff --git a/demo/images/displacement_fish4.png b/demo/images/displacement_fish4.png new file mode 100644 index 000000000..fbba4af27 Binary files /dev/null and b/demo/images/displacement_fish4.png differ diff --git a/demo/images/displacement_fish5.png b/demo/images/displacement_fish5.png new file mode 100644 index 000000000..35e3f5860 Binary files /dev/null and b/demo/images/displacement_fish5.png differ diff --git a/demo/images/displacement_map.png b/demo/images/displacement_map.png new file mode 100644 index 000000000..efcc9490d Binary files /dev/null and b/demo/images/displacement_map.png differ diff --git a/demo/images/lightmap.png b/demo/images/lightmap.png new file mode 100644 index 000000000..7cc852769 Binary files /dev/null and b/demo/images/lightmap.png differ diff --git a/demo/images/overlay.png b/demo/images/overlay.png new file mode 100644 index 000000000..0a3ed0f50 Binary files /dev/null and b/demo/images/overlay.png differ diff --git a/demo/images/pixijs-logo.png b/demo/images/pixijs-logo.png new file mode 100644 index 000000000..886cc017f Binary files /dev/null and b/demo/images/pixijs-logo.png differ diff --git a/demo/index.css b/demo/index.css new file mode 100644 index 000000000..62588979b --- /dev/null +++ b/demo/index.css @@ -0,0 +1,47 @@ +body { + margin:0; + padding:0; + font-family: Helvetica, sans-serif; + background:#333; + overflow: hidden; +} +#container { + top:0; + left:0; + width:100%; + height:100%; + position:absolute; + overflow: hidden; +} +#stage { + width:100%; + height:100%; + position:absolute; + display:block; + z-index: 0; +} +#logo { + position: absolute; + z-index:1; + width:245px; + height:69px; + top:0; + right:15px; + background:#000; + padding:10px 0; +} +.lil-gui.root { + top:89px !important; + max-height: calc(100% - 89px); +} +.lil-gui .title { + color: #999; +} +.lil-gui.enabled .title { + color: #ea4080; +} +#logo img { + display: block; + margin:8px auto 0; + width: 80%; +} \ No newline at end of file diff --git a/demo/index.html b/demo/index.html new file mode 100644 index 000000000..b459dde7a --- /dev/null +++ b/demo/index.html @@ -0,0 +1,20 @@ + + + + + + PixiJS Filters Demo + + + + + + + +
+ + +
+ + + diff --git a/demo/index.js b/demo/index.js new file mode 100644 index 000000000..6d531dd91 --- /dev/null +++ b/demo/index.js @@ -0,0 +1,12997 @@ +(function (require$$0) { + 'use strict'; + + function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + + function _mergeNamespaces(n, m) { + m.forEach(function (e) { + e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) { + if (k !== 'default' && !(k in n)) { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + }); + return Object.freeze(n); + } + + var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0); + + var lib = {}; + + var AdjustmentFilter$2 = {}; + + var _default$A = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var vertex = "in vec2 aPosition;\nout vec2 vTextureCoord;\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + exports["default"] = vertex; + })(_default$A); + + var default2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var wgslVertex = "struct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\nstruct VSOutput {\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n };\n\nfn filterVertexPosition(aPosition:vec2) -> vec4\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2 ) -> vec2\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2 ) -> vec2\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getSize() -> vec2\n{\n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2, \n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition)\n );\n}"; + exports["default"] = wgslVertex; + })(default2); + + var adjustment$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uGamma;\nuniform float uContrast;\nuniform float uSaturation;\nuniform float uBrightness;\nuniform vec4 uColor;\n\nvoid main()\n{\n vec4 c = texture(uTexture, vTextureCoord);\n\n if (c.a > 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / uGamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, uSaturation), uContrast);\n rgb.r *= uColor.r;\n rgb.g *= uColor.g;\n rgb.b *= uColor.b;\n c.rgb = rgb * uBrightness;\n\n c.rgb *= c.a;\n }\n\n finalColor = c * uColor.a;\n}\n"; + exports["default"] = fragment; + })(adjustment$3); + + var adjustment2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct AdjustmentUniforms {\n uGamma: f32,\n uContrast: f32,\n uSaturation: f32,\n uBrightness: f32,\n uColor: vec4,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var adjustmentUniforms : AdjustmentUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n var sample = textureSample(uTexture, uSampler, uv);\n let color = adjustmentUniforms.uColor;\n\n if (sample.a > 0.0) \n {\n sample = vec4(sample.rgb / sample.a, sample.a);\n var rgb: vec3 = pow(sample.rgb, vec3(1. / adjustmentUniforms.uGamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, adjustmentUniforms.uSaturation), adjustmentUniforms.uContrast);\n rgb.r *= color.r;\n rgb.g *= color.g;\n rgb.b *= color.b;\n sample = vec4(rgb.rgb * adjustmentUniforms.uBrightness, sample.a);\n sample = vec4(sample.rgb * sample.a, sample.a);\n }\n\n return sample * color.a;\n}"; + exports["default"] = source; + })(adjustment2); + + var __defProp$14 = Object.defineProperty; + var __getOwnPropSymbols$x = Object.getOwnPropertySymbols; + var __hasOwnProp$x = Object.prototype.hasOwnProperty; + var __propIsEnum$x = Object.prototype.propertyIsEnumerable; + var __defNormalProp$14 = (obj, key, value) => key in obj ? __defProp$14(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$x = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$x.call(b, prop)) + __defNormalProp$14(a, prop, b[prop]); + if (__getOwnPropSymbols$x) + for (var prop of __getOwnPropSymbols$x(b)) { + if (__propIsEnum$x.call(b, prop)) + __defNormalProp$14(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(AdjustmentFilter$2, "__esModule", { value: true }); + var pixi_js$B = require$$0__default["default"]; + var _default$1$y = _default$A; + var _default$z = default2; + var adjustment$1 = adjustment$3; + var adjustment$2 = adjustment2; + var __defProp2$x = Object.defineProperty; + var __defNormalProp2$x = (obj, key, value) => key in obj ? __defProp2$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$14 = (obj, key, value) => { + __defNormalProp2$x(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _AdjustmentFilter$1 = class _AdjustmentFilter2 extends pixi_js$B.Filter { + constructor(options) { + options = __spreadValues$x(__spreadValues$x({}, _AdjustmentFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$B.GpuProgram({ + vertex: { + source: _default$z["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: adjustment$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$B.GlProgram({ + vertex: _default$1$y["default"], + fragment: adjustment$1["default"], + name: "adjustment-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + adjustmentUniforms: { + uGamma: { value: options.gamma, type: "f32" }, + uContrast: { value: options.contrast, type: "f32" }, + uSaturation: { value: options.saturation, type: "f32" }, + uBrightness: { value: options.brightness, type: "f32" }, + uColor: { + value: [ + options.red, + options.green, + options.blue, + options.alpha + ], + type: "vec4" + } + } + } + }); + __publicField$14(this, "uniforms"); + this.uniforms = this.resources.adjustmentUniforms.uniforms; + } + /** + * Amount of luminance + * @default 1 + */ + get gamma() { + return this.uniforms.uGamma; + } + set gamma(value) { + this.uniforms.uGamma = value; + } + /** + * Amount of contrast + * @default 1 + */ + get contrast() { + return this.uniforms.uContrast; + } + set contrast(value) { + this.uniforms.uContrast = value; + } + /** + * Amount of color saturation + * @default 1 + */ + get saturation() { + return this.uniforms.uSaturation; + } + set saturation(value) { + this.uniforms.uSaturation = value; + } + /** + * The overall brightness + * @default 1 + */ + get brightness() { + return this.uniforms.uBrightness; + } + set brightness(value) { + this.uniforms.uBrightness = value; + } + /** + * The multiplied red channel + * @default 1 + */ + get red() { + return this.uniforms.uColor[0]; + } + set red(value) { + this.uniforms.uColor[0] = value; + } + /** + * The multiplied blue channel + * @default 1 + */ + get green() { + return this.uniforms.uColor[1]; + } + set green(value) { + this.uniforms.uColor[1] = value; + } + /** + * The multiplied green channel + * @default 1 + */ + get blue() { + return this.uniforms.uColor[2]; + } + set blue(value) { + this.uniforms.uColor[2] = value; + } + /** + * The overall alpha channel + * @default 1 + */ + get alpha() { + return this.uniforms.uColor[3]; + } + set alpha(value) { + this.uniforms.uColor[3] = value; + } + }; + __publicField$14(_AdjustmentFilter$1, "DEFAULT_OPTIONS", { + gamma: 1, + contrast: 1, + saturation: 1, + brightness: 1, + red: 1, + green: 1, + blue: 1, + alpha: 1 + }); + let AdjustmentFilter$1 = _AdjustmentFilter$1; + AdjustmentFilter$2.AdjustmentFilter = AdjustmentFilter$1; + + var AdvancedBloomFilter$2 = {}; + + var KawaseBlurFilter$5 = {}; + + var kawaseBlur$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n finalColor = color;\n}"; + exports["default"] = fragment; + })(kawaseBlur$3); + + var kawaseBlur2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct KawaseBlurUniforms {\n uOffset:vec2,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var kawaseBlurUniforms : KawaseBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uOffset = kawaseBlurUniforms.uOffset;\n var color: vec4 = vec4(0.0);\n\n // Sample top left pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x - uOffset.x, uv.y + uOffset.y));\n // Sample top right pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x + uOffset.x, uv.y + uOffset.y));\n // Sample bottom right pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x + uOffset.x, uv.y - uOffset.y));\n // Sample bottom left pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x - uOffset.x, uv.y - uOffset.y));\n // Average\n color *= 0.25;\n\n return color;\n}"; + exports["default"] = source; + })(kawaseBlur2); + + var kawaseBlurClamp$2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragmentClamp = "\nprecision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uOffset;\n\nuniform vec4 uInputClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Sample top right pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Sample bottom right pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Sample bottom left pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Average\n color *= 0.25;\n\n finalColor = color;\n}\n"; + exports["default"] = fragmentClamp; + })(kawaseBlurClamp$2); + + var kawaseBlurClamp2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var sourceClamp = "struct KawaseBlurUniforms {\n uOffset:vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var kawaseBlurUniforms : KawaseBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uOffset = kawaseBlurUniforms.uOffset;\n var color: vec4 = vec4(0.0);\n\n // Sample top left pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x - uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample top right pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x + uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample bottom right pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x + uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample bottom left pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x - uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Average\n color *= 0.25;\n \n return color;\n}"; + exports["default"] = sourceClamp; + })(kawaseBlurClamp2); + + var __defProp$13 = Object.defineProperty; + var __getOwnPropSymbols$w = Object.getOwnPropertySymbols; + var __hasOwnProp$w = Object.prototype.hasOwnProperty; + var __propIsEnum$w = Object.prototype.propertyIsEnumerable; + var __defNormalProp$13 = (obj, key, value) => key in obj ? __defProp$13(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$w = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$w.call(b, prop)) + __defNormalProp$13(a, prop, b[prop]); + if (__getOwnPropSymbols$w) + for (var prop of __getOwnPropSymbols$w(b)) { + if (__propIsEnum$w.call(b, prop)) + __defNormalProp$13(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(KawaseBlurFilter$5, "__esModule", { value: true }); + var pixi_js$A = require$$0__default["default"]; + var _default$1$x = _default$A; + var _default$y = default2; + var kawaseBlur$1 = kawaseBlur$3; + var kawaseBlur$2 = kawaseBlur2; + var kawaseBlurClamp$1 = kawaseBlurClamp$2; + var kawaseBlurClamp = kawaseBlurClamp2; + var __defProp2$w = Object.defineProperty; + var __defNormalProp2$w = (obj, key, value) => key in obj ? __defProp2$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$13 = (obj, key, value) => { + __defNormalProp2$w(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _KawaseBlurFilter$1 = class _KawaseBlurFilter2 extends pixi_js$A.Filter { + constructor(options) { + var _a, _b; + options = __spreadValues$w(__spreadValues$w({}, _KawaseBlurFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$A.GpuProgram({ + vertex: { + source: _default$y["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: (options == null ? void 0 : options.clamp) ? kawaseBlurClamp["default"] : kawaseBlur$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$A.GlProgram({ + vertex: _default$1$x["default"], + fragment: (options == null ? void 0 : options.clamp) ? kawaseBlurClamp$1["default"] : kawaseBlur$1["default"], + name: "kawase-blur-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + kawaseBlurUniforms: { + uOffset: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$13(this, "uniforms"); + __publicField$13(this, "_pixelSize", { x: 0, y: 0 }); + __publicField$13(this, "_clamp"); + __publicField$13(this, "_kernels", []); + __publicField$13(this, "_blur"); + __publicField$13(this, "_quality"); + this.uniforms = this.resources.kawaseBlurUniforms.uniforms; + this._pixelSize = (_a = options.pixelSize) != null ? _a : { x: 1, y: 1 }; + if (Array.isArray(options.strength)) { + this.kernels = options.strength; + } else if (typeof options.strength === "number") { + this._blur = options.strength; + this.quality = (_b = options.quality) != null ? _b : 3; + } + this._clamp = !!options.clamp; + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + const uvX = this.pixelSizeX / input.source.width; + const uvY = this.pixelSizeY / input.source.height; + let offset; + if (this._quality === 1 || this._blur === 0) { + offset = this._kernels[0] + 0.5; + this.uniforms.uOffset[0] = offset * uvX; + this.uniforms.uOffset[1] = offset * uvY; + filterManager.applyFilter(this, input, output, clearMode); + } else { + const renderTarget = pixi_js$A.TexturePool.getSameSizeTexture(input); + let source2 = input; + let target = renderTarget; + let tmp; + const last = this._quality - 1; + for (let i = 0; i < last; i++) { + offset = this._kernels[i] + 0.5; + this.uniforms.uOffset[0] = offset * uvX; + this.uniforms.uOffset[1] = offset * uvY; + filterManager.applyFilter(this, source2, target, true); + tmp = source2; + source2 = target; + target = tmp; + } + offset = this._kernels[last] + 0.5; + this.uniforms.uOffset[0] = offset * uvX; + this.uniforms.uOffset[1] = offset * uvY; + filterManager.applyFilter(this, source2, output, clearMode); + pixi_js$A.TexturePool.returnTexture(renderTarget); + } + } + /** + * The amount of blur, value greater than `0`. + * @default 4 + */ + get strength() { + return this._blur; + } + set strength(value) { + this._blur = value; + this._generateKernels(); + } + /** + * The quality of the filter, integer greater than `1`. + * @default 3 + */ + get quality() { + return this._quality; + } + set quality(value) { + this._quality = Math.max(1, Math.round(value)); + this._generateKernels(); + } + /** + * The kernel size of the blur filter, for advanced usage + * @default [0] + */ + get kernels() { + return this._kernels; + } + set kernels(value) { + if (Array.isArray(value) && value.length > 0) { + this._kernels = value; + this._quality = value.length; + this._blur = Math.max(...value); + } else { + this._kernels = [0]; + this._quality = 1; + } + } + /** + * The size of the pixels. Large size is blurrier. For advanced usage. + * @default {x:1,y:1} + */ + get pixelSize() { + return this._pixelSize; + } + set pixelSize(value) { + this._pixelSize = value; + } + /** + * The size of the pixels on the `x` axis. Large size is blurrier. For advanced usage. + * @default 1 + */ + get pixelSizeX() { + return this.pixelSize.x; + } + set pixelSizeX(value) { + this.pixelSize.x = value; + } + /** + * The size of the pixels on the `y` axis. Large size is blurrier. For advanced usage. + * @default 1 + */ + get pixelSizeY() { + return this.pixelSize.y; + } + set pixelSizeY(value) { + this.pixelSize.y = value; + } + /** + * Get the if the filter is clamped + * @default false + */ + get clamp() { + return this._clamp; + } + /** Update padding based on kernel data */ + _updatePadding() { + this.padding = Math.ceil(this._kernels.reduce((acc, v) => acc + v + 0.5, 0)); + } + /** Auto generate kernels by blur & quality */ + _generateKernels() { + const blur = this._blur; + const quality = this._quality; + const kernels = [blur]; + if (blur > 0) { + let k = blur; + const step = blur / quality; + for (let i = 1; i < quality; i++) { + k -= step; + kernels.push(k); + } + } + this._kernels = kernels; + this._updatePadding(); + } + }; + __publicField$13(_KawaseBlurFilter$1, "DEFAULT_OPTIONS", { + strength: 4, + quality: 3, + clamp: false, + pixelSize: { x: 1, y: 1 } + }); + let KawaseBlurFilter$4 = _KawaseBlurFilter$1; + KawaseBlurFilter$5.KawaseBlurFilter = KawaseBlurFilter$4; + + var advancedBloom2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMapTexture;\nuniform float uBloomScale;\nuniform float uBrightness;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n color.rgb *= uBrightness;\n vec4 bloomColor = vec4(texture(uMapTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= uBloomScale;\n finalColor = color + bloomColor;\n}\n"; + exports["default"] = fragment; + })(advancedBloom2); + + var advancedBloom$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct AdvancedBloomUniforms {\n uBloomScale: f32,\n uBrightness: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var advancedBloomUniforms : AdvancedBloomUniforms;\n@group(1) @binding(1) var uMapTexture: texture_2d;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color = textureSample(uTexture, uSampler, uv);\n color = vec4(color.rgb * advancedBloomUniforms.uBrightness, color.a);\n\n var bloomColor = vec4(textureSample(uMapTexture, uSampler, uv).rgb, 0.0);\n bloomColor = vec4(bloomColor.rgb * advancedBloomUniforms.uBloomScale, bloomColor.a);\n \n return color + bloomColor;\n}\n"; + exports["default"] = source; + })(advancedBloom$3); + + var ExtractBrightnessFilter$3 = {}; + + var extractBrightness$2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uThreshold;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > uThreshold) {\n finalColor = color;\n } else {\n finalColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n"; + exports["default"] = fragment; + })(extractBrightness$2); + + var extractBrightness2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct ExtractBrightnessUniforms {\n uThreshold: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var extractBrightnessUniforms : ExtractBrightnessUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let color: vec4 = textureSample(uTexture, uSampler, uv);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccurate, but good enough for this feature.\n let max: f32 = max(max(color.r, color.g), color.b);\n let min: f32 = min(min(color.r, color.g), color.b);\n let brightness: f32 = (max + min) * 0.5;\n\n return select(vec4(0.), color, brightness > extractBrightnessUniforms.uThreshold);\n}\n"; + exports["default"] = source; + })(extractBrightness2); + + var __defProp$12 = Object.defineProperty; + var __getOwnPropSymbols$v = Object.getOwnPropertySymbols; + var __hasOwnProp$v = Object.prototype.hasOwnProperty; + var __propIsEnum$v = Object.prototype.propertyIsEnumerable; + var __defNormalProp$12 = (obj, key, value) => key in obj ? __defProp$12(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$v = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$v.call(b, prop)) + __defNormalProp$12(a, prop, b[prop]); + if (__getOwnPropSymbols$v) + for (var prop of __getOwnPropSymbols$v(b)) { + if (__propIsEnum$v.call(b, prop)) + __defNormalProp$12(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(ExtractBrightnessFilter$3, "__esModule", { value: true }); + var pixi_js$z = require$$0__default["default"]; + var _default$1$w = _default$A; + var _default$x = default2; + var extractBrightness$1 = extractBrightness$2; + var extractBrightness = extractBrightness2; + var __defProp2$v = Object.defineProperty; + var __defNormalProp2$v = (obj, key, value) => key in obj ? __defProp2$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$12 = (obj, key, value) => { + __defNormalProp2$v(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ExtractBrightnessFilter$1 = class _ExtractBrightnessFilter2 extends pixi_js$z.Filter { + constructor(options) { + options = __spreadValues$v(__spreadValues$v({}, _ExtractBrightnessFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$z.GpuProgram({ + vertex: { + source: _default$x["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: extractBrightness["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$z.GlProgram({ + vertex: _default$1$w["default"], + fragment: extractBrightness$1["default"], + name: "extract-brightness-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + extractBrightnessUniforms: { + uThreshold: { value: options.threshold, type: "f32" } + } + } + }); + __publicField$12(this, "uniforms"); + this.uniforms = this.resources.extractBrightnessUniforms.uniforms; + } + /** + * Defines how bright a color needs to be extracted. + * @default 0.5 + */ + get threshold() { + return this.uniforms.uThreshold; + } + set threshold(value) { + this.uniforms.uThreshold = value; + } + }; + __publicField$12(_ExtractBrightnessFilter$1, "DEFAULT_OPTIONS", { + threshold: 0.5 + }); + let ExtractBrightnessFilter$2 = _ExtractBrightnessFilter$1; + ExtractBrightnessFilter$3.ExtractBrightnessFilter = ExtractBrightnessFilter$2; + + var __defProp$11 = Object.defineProperty; + var __getOwnPropSymbols$u = Object.getOwnPropertySymbols; + var __hasOwnProp$u = Object.prototype.hasOwnProperty; + var __propIsEnum$u = Object.prototype.propertyIsEnumerable; + var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$u = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$u.call(b, prop)) + __defNormalProp$11(a, prop, b[prop]); + if (__getOwnPropSymbols$u) + for (var prop of __getOwnPropSymbols$u(b)) { + if (__propIsEnum$u.call(b, prop)) + __defNormalProp$11(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(AdvancedBloomFilter$2, "__esModule", { value: true }); + var pixi_js$y = require$$0__default["default"]; + var _default$1$v = _default$A; + var _default$w = default2; + var KawaseBlurFilter$3 = KawaseBlurFilter$5; + var advancedBloom$1 = advancedBloom2; + var advancedBloom$2 = advancedBloom$3; + var ExtractBrightnessFilter$1 = ExtractBrightnessFilter$3; + var __defProp2$u = Object.defineProperty; + var __defNormalProp2$u = (obj, key, value) => key in obj ? __defProp2$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$11 = (obj, key, value) => { + __defNormalProp2$u(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _AdvancedBloomFilter$1 = class _AdvancedBloomFilter2 extends pixi_js$y.Filter { + constructor(options) { + var _a; + options = __spreadValues$u(__spreadValues$u({}, _AdvancedBloomFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$y.GpuProgram({ + vertex: { + source: _default$w["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: advancedBloom$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$y.GlProgram({ + vertex: _default$1$v["default"], + fragment: advancedBloom$1["default"], + name: "advanced-bloom-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + advancedBloomUniforms: { + uBloomScale: { value: options.bloomScale, type: "f32" }, + uBrightness: { value: options.brightness, type: "f32" } + }, + uMapTexture: pixi_js$y.Texture.WHITE + } + }); + __publicField$11(this, "uniforms"); + __publicField$11(this, "bloomScale", 1); + __publicField$11(this, "brightness", 1); + __publicField$11(this, "_extractFilter"); + __publicField$11(this, "_blurFilter"); + this.uniforms = this.resources.advancedBloomUniforms.uniforms; + this._extractFilter = new ExtractBrightnessFilter$1.ExtractBrightnessFilter({ + threshold: options.threshold + }); + this._blurFilter = new KawaseBlurFilter$3.KawaseBlurFilter({ + strength: (_a = options.kernels) != null ? _a : options.blur, + quality: options.kernels ? void 0 : options.quality + }); + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + const brightTarget = pixi_js$y.TexturePool.getSameSizeTexture(input); + this._extractFilter.apply(filterManager, input, brightTarget, true); + const bloomTarget = pixi_js$y.TexturePool.getSameSizeTexture(input); + this._blurFilter.apply(filterManager, brightTarget, bloomTarget, true); + this.uniforms.uBloomScale = this.bloomScale; + this.uniforms.uBrightness = this.brightness; + this.resources.uMapTexture = bloomTarget.source; + filterManager.applyFilter(this, input, output, clearMode); + pixi_js$y.TexturePool.returnTexture(bloomTarget); + pixi_js$y.TexturePool.returnTexture(brightTarget); + } + /** + * Defines how bright a color needs to be extracted. + * @default 0.5 + */ + get threshold() { + return this._extractFilter.threshold; + } + set threshold(value) { + this._extractFilter.threshold = value; + } + /** Sets the kernels of the Blur Filter */ + get kernels() { + return this._blurFilter.kernels; + } + set kernels(value) { + this._blurFilter.kernels = value; + } + /** + * Sets the strength of the Blur properties simultaneously + * @default 2 + */ + get blur() { + return this._blurFilter.strength; + } + set blur(value) { + this._blurFilter.strength = value; + } + /** + * Sets the quality of the Blur Filter + * @default 4 + */ + get quality() { + return this._blurFilter.quality; + } + set quality(value) { + this._blurFilter.quality = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter + * @default {x:1,y:1} + */ + get pixelSize() { + return this._blurFilter.pixelSize; + } + set pixelSize(value) { + this._blurFilter.pixelSize = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter on the `x` axis + * @default 1 + */ + get pixelSizeX() { + return this._blurFilter.pixelSizeX; + } + set pixelSizeX(value) { + this._blurFilter.pixelSizeX = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter on the `y` axis + * @default 1 + */ + get pixelSizeY() { + return this._blurFilter.pixelSizeY; + } + set pixelSizeY(value) { + this._blurFilter.pixelSizeY = value; + } + }; + __publicField$11(_AdvancedBloomFilter$1, "DEFAULT_OPTIONS", { + threshold: 0.5, + bloomScale: 1, + brightness: 1, + blur: 8, + quality: 4, + pixelSize: { x: 1, y: 1 } + }); + let AdvancedBloomFilter$1 = _AdvancedBloomFilter$1; + AdvancedBloomFilter$2.AdvancedBloomFilter = AdvancedBloomFilter$1; + + var AsciiFilter$2 = {}; + + var ascii$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uSize;\nuniform vec3 uColor;\nuniform float uReplaceColor;\n\nuniform vec4 uInputSize;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= uInputSize.xy;\n coord += uInputSize.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= uInputSize.zw;\n coord /= uInputSize.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor(coord / size) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod(coord, size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, 4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the grid position\n vec2 pixCoord = pixelate(coord, vec2(uSize));\n pixCoord = unmapCoord(pixCoord);\n\n // sample the color at grid position\n vec4 color = texture(uTexture, pixCoord);\n\n // brightness of the color as it's perceived by the human eye\n float gray = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;\n\n // determine the character to use\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(uSize));\n\n finalColor = (uReplaceColor > 0.5 ? vec4(uColor, 1.) : color) * character( n, vec2(-1.0) + modd * 2.0);\n}\n"; + exports["default"] = fragment; + })(ascii$3); + + var ascii2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct AsciiUniforms {\n uSize: f32,\n uColor: vec3,\n uReplaceColor: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var asciiUniforms : AsciiUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let pixelSize: f32 = asciiUniforms.uSize;\n let coord: vec2 = mapCoord(uv);\n\n // get the rounded color..\n var pixCoord: vec2 = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n var color = textureSample(uTexture, uSampler, pixCoord);\n\n // determine the character to use\n let gray: f32 = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;\n \n var n: f32 = 65536.0; // .\n if (gray > 0.2) {\n n = 65600.0; // :\n }\n if (gray > 0.3) {\n n = 332772.0; // *\n }\n if (gray > 0.4) {\n n = 15255086.0; // o\n }\n if (gray > 0.5) {\n n = 23385164.0; // &\n }\n if (gray > 0.6) {\n n = 15252014.0; // 8\n }\n if (gray > 0.7) {\n n = 13199452.0; // @\n }\n if (gray > 0.8) {\n n = 11512810.0; // #\n }\n\n // get the mod..\n let modd: vec2 = getMod(coord, vec2(pixelSize));\n return select(color, vec4(asciiUniforms.uColor, 1.), asciiUniforms.uReplaceColor > 0.5) * character(n, vec2(-1.0) + modd * 2.0);\n}\n\nfn pixelate(coord: vec2, size: vec2) -> vec2\n{\n return floor( coord / size ) * size;\n}\n\nfn getMod(coord: vec2, size: vec2) -> vec2\n{\n return moduloVec2( coord , size) / size;\n}\n\nfn character(n: f32, p: vec2) -> f32\n{\n var q: vec2 = floor(p*vec2(4.0, 4.0) + 2.5);\n\n if (clamp(q.x, 0.0, 4.0) == q.x)\n {\n if (clamp(q.y, 0.0, 4.0) == q.y)\n {\n if (i32(modulo(n/exp2(q.x + 5.0*q.y), 2.0)) == 1)\n {\n return 1.0;\n }\n }\n }\n\n return 0.0;\n}\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}\n\nfn moduloVec2(x: vec2, y: vec2) -> vec2\n{\n return x - y * floor(x/y);\n}\n\nfn mapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord *= gfu.uInputSize.xy;\n mappedCoord += gfu.uOutputFrame.xy;\n return mappedCoord;\n}\n\nfn unmapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord -= gfu.uOutputFrame.xy;\n mappedCoord /= gfu.uInputSize.xy;\n return mappedCoord;\n}"; + exports["default"] = source; + })(ascii2); + + var __defProp$10 = Object.defineProperty; + var __getOwnPropSymbols$t = Object.getOwnPropertySymbols; + var __hasOwnProp$t = Object.prototype.hasOwnProperty; + var __propIsEnum$t = Object.prototype.propertyIsEnumerable; + var __defNormalProp$10 = (obj, key, value) => key in obj ? __defProp$10(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$t = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$t.call(b, prop)) + __defNormalProp$10(a, prop, b[prop]); + if (__getOwnPropSymbols$t) + for (var prop of __getOwnPropSymbols$t(b)) { + if (__propIsEnum$t.call(b, prop)) + __defNormalProp$10(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(AsciiFilter$2, "__esModule", { value: true }); + var pixi_js$x = require$$0__default["default"]; + var _default$1$u = _default$A; + var _default$v = default2; + var ascii$1 = ascii$3; + var ascii$2 = ascii2; + var __defProp2$t = Object.defineProperty; + var __defNormalProp2$t = (obj, key, value) => key in obj ? __defProp2$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$10 = (obj, key, value) => { + __defNormalProp2$t(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _AsciiFilter$1 = class _AsciiFilter2 extends pixi_js$x.Filter { + constructor(options) { + var _a; + const replaceColor = (options == null ? void 0 : options.color) && options.replaceColor !== false; + options = __spreadValues$t(__spreadValues$t({}, _AsciiFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$x.GpuProgram({ + vertex: { + source: _default$v["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: ascii$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$x.GlProgram({ + vertex: _default$1$u["default"], + fragment: ascii$1["default"], + name: "ascii-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + asciiUniforms: { + uSize: { value: options.size, type: "f32" }, + uColor: { value: new Float32Array(3), type: "vec3" }, + uReplaceColor: { value: Number(replaceColor), type: "f32" } + } + } + }); + __publicField$10(this, "uniforms"); + __publicField$10(this, "_color"); + this.uniforms = this.resources.asciiUniforms.uniforms; + this._color = new pixi_js$x.Color(); + this.color = (_a = options.color) != null ? _a : 16777215; + } + /** + * The pixel size used by the filter. + * @default 8 + */ + get size() { + return this.uniforms.uSize; + } + set size(value) { + this.uniforms.uSize = value; + } + /** + * The resulting color of the ascii characters, as a 3 component RGB or numerical hex + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0xffffff + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * Determine whether or not to replace the source colors with the provided. + */ + get replaceColor() { + return this.uniforms.uReplaceColor > 0.5; + } + set replaceColor(value) { + this.uniforms.uReplaceColor = value ? 1 : 0; + } + }; + __publicField$10(_AsciiFilter$1, "DEFAULT_OPTIONS", { + size: 8, + color: 16777215, + replaceColor: false + }); + let AsciiFilter$1 = _AsciiFilter$1; + AsciiFilter$2.AsciiFilter = AsciiFilter$1; + + var BevelFilter$2 = {}; + + var bevel$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uTransform;\nuniform vec3 uLightColor;\nuniform float uLightAlpha;\nuniform vec3 uShadowColor;\nuniform float uShadowAlpha;\n\nuniform vec4 uInputSize;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / uInputSize) * vec2(uTransform.x, uTransform.y);\n vec4 color = texture(uTexture, vTextureCoord);\n float light = texture(uTexture, vTextureCoord - transform).a;\n float shadow = texture(uTexture, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, uLightColor, clamp((color.a - light) * uLightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, uShadowColor, clamp((color.a - shadow) * uShadowAlpha, 0.0, 1.0));\n finalColor = vec4(color.rgb * color.a, color.a);\n}\n"; + exports["default"] = fragment; + })(bevel$3); + + var bevel2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct BevelUniforms {\n uLightColor: vec3,\n uLightAlpha: f32,\n uShadowColor: vec3,\n uShadowAlpha: f32,\n uTransform: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var bevelUniforms : BevelUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let transform = vec2(1.0 / gfu.uInputSize.xy) * vec2(bevelUniforms.uTransform.x, bevelUniforms.uTransform.y);\n var color: vec4 = textureSample(uTexture, uSampler, uv);\n let lightSample: f32 = textureSample(uTexture, uSampler, uv - transform).a;\n let shadowSample: f32 = textureSample(uTexture, uSampler, uv + transform).a;\n\n let light = vec4(bevelUniforms.uLightColor, bevelUniforms.uLightAlpha);\n let shadow = vec4(bevelUniforms.uShadowColor, bevelUniforms.uShadowAlpha);\n\n color = vec4(mix(color.rgb, light.rgb, clamp((color.a - lightSample) * light.a, 0.0, 1.0)), color.a);\n color = vec4(mix(color.rgb, shadow.rgb, clamp((color.a - shadowSample) * shadow.a, 0.0, 1.0)), color.a);\n \n return vec4(color.rgb * color.a, color.a);\n}"; + exports["default"] = source; + })(bevel2); + + var __defProp$$ = Object.defineProperty; + var __getOwnPropSymbols$s = Object.getOwnPropertySymbols; + var __hasOwnProp$s = Object.prototype.hasOwnProperty; + var __propIsEnum$s = Object.prototype.propertyIsEnumerable; + var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$s = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$s.call(b, prop)) + __defNormalProp$$(a, prop, b[prop]); + if (__getOwnPropSymbols$s) + for (var prop of __getOwnPropSymbols$s(b)) { + if (__propIsEnum$s.call(b, prop)) + __defNormalProp$$(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(BevelFilter$2, "__esModule", { value: true }); + var pixi_js$w = require$$0__default["default"]; + var _default$1$t = _default$A; + var _default$u = default2; + var bevel$1 = bevel$3; + var bevel$2 = bevel2; + var __defProp2$s = Object.defineProperty; + var __defNormalProp2$s = (obj, key, value) => key in obj ? __defProp2$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$$ = (obj, key, value) => { + __defNormalProp2$s(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _BevelFilter$1 = class _BevelFilter2 extends pixi_js$w.Filter { + constructor(options) { + var _a, _b, _c; + options = __spreadValues$s(__spreadValues$s({}, _BevelFilter2.DEFAULT_OPTIONS), options); + const rotation = ((_a = options.rotation) != null ? _a : 45) * pixi_js$w.DEG_TO_RAD; + const gpuProgram = new pixi_js$w.GpuProgram({ + vertex: { + source: _default$u["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: bevel$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$w.GlProgram({ + vertex: _default$1$t["default"], + fragment: bevel$1["default"], + name: "bevel-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + bevelUniforms: { + uLightColor: { value: new Float32Array(3), type: "vec3" }, + uLightAlpha: { value: options.lightAlpha, type: "f32" }, + uShadowColor: { value: new Float32Array(3), type: "vec3" }, + uShadowAlpha: { value: options.shadowAlpha, type: "f32" }, + uTransform: { value: new Float32Array(2), type: "vec2" } + } + }, + // Workaround: https://github.com/pixijs/filters/issues/230 + // applies correctly only if there is at least a single-pixel padding with alpha=0 around an image + // To solve this problem, a padding of 1 put on the filter should suffice + padding: 1 + }); + __publicField$$(this, "uniforms"); + __publicField$$(this, "_thickness"); + __publicField$$(this, "_rotation"); + __publicField$$(this, "_lightColor"); + __publicField$$(this, "_shadowColor"); + this.uniforms = this.resources.bevelUniforms.uniforms; + this._lightColor = new pixi_js$w.Color(); + this._shadowColor = new pixi_js$w.Color(); + this.lightColor = (_b = options.lightColor) != null ? _b : 16777215; + this.shadowColor = (_c = options.shadowColor) != null ? _c : 0; + Object.assign(this, options, { rotation }); + } + /** + * The angle of the light in degrees + * @default 45 + */ + get rotation() { + return this._rotation / pixi_js$w.DEG_TO_RAD; + } + set rotation(value) { + this._rotation = value * pixi_js$w.DEG_TO_RAD; + this._updateTransform(); + } + /** + * The thickness of the bevel + * @default 2 + */ + get thickness() { + return this._thickness; + } + set thickness(value) { + this._thickness = value; + this._updateTransform(); + } + /** + * The color value of the left & top bevel. + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0xffffff + */ + get lightColor() { + return this._lightColor.value; + } + set lightColor(value) { + this._lightColor.setValue(value); + const [r, g, b] = this._lightColor.toArray(); + this.uniforms.uLightColor[0] = r; + this.uniforms.uLightColor[1] = g; + this.uniforms.uLightColor[2] = b; + } + /** + * The alpha value of the left & top bevel. + * @default 0.7 + */ + get lightAlpha() { + return this.uniforms.uLightAlpha; + } + set lightAlpha(value) { + this.uniforms.uLightAlpha = value; + } + /** + * The color value of the right & bottom bevel. + * @default 0xffffff + */ + get shadowColor() { + return this._shadowColor.value; + } + set shadowColor(value) { + this._shadowColor.setValue(value); + const [r, g, b] = this._shadowColor.toArray(); + this.uniforms.uShadowColor[0] = r; + this.uniforms.uShadowColor[1] = g; + this.uniforms.uShadowColor[2] = b; + } + /** + * The alpha value of the right & bottom bevel. + * @default 0.7 + */ + get shadowAlpha() { + return this.uniforms.uShadowAlpha; + } + set shadowAlpha(value) { + this.uniforms.uShadowAlpha = value; + } + /** + * Update the transform matrix of offset angle. + * @private + */ + _updateTransform() { + this.uniforms.uTransform[0] = this.thickness * Math.cos(this._rotation); + this.uniforms.uTransform[1] = this.thickness * Math.sin(this._rotation); + } + }; + __publicField$$(_BevelFilter$1, "DEFAULT_OPTIONS", { + rotation: 45, + thickness: 2, + lightColor: 16777215, + lightAlpha: 0.7, + shadowColor: 0, + shadowAlpha: 0.7 + }); + let BevelFilter$1 = _BevelFilter$1; + BevelFilter$2.BevelFilter = BevelFilter$1; + + var BloomFilter$2 = {}; + + var __defProp$_ = Object.defineProperty; + var __defProps$2 = Object.defineProperties; + var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors; + var __getOwnPropSymbols$r = Object.getOwnPropertySymbols; + var __hasOwnProp$r = Object.prototype.hasOwnProperty; + var __propIsEnum$r = Object.prototype.propertyIsEnumerable; + var __defNormalProp$_ = (obj, key, value) => key in obj ? __defProp$_(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$r = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$r.call(b, prop)) + __defNormalProp$_(a, prop, b[prop]); + if (__getOwnPropSymbols$r) + for (var prop of __getOwnPropSymbols$r(b)) { + if (__propIsEnum$r.call(b, prop)) + __defNormalProp$_(a, prop, b[prop]); + } + return a; + }; + var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b)); + Object.defineProperty(BloomFilter$2, "__esModule", { value: true }); + var pixi_js$v = require$$0__default["default"]; + var __defProp2$r = Object.defineProperty; + var __defNormalProp2$r = (obj, key, value) => key in obj ? __defProp2$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$_ = (obj, key, value) => { + __defNormalProp2$r(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _BloomFilter$1 = class _BloomFilter2 extends pixi_js$v.AlphaFilter { + constructor(options) { + options = __spreadValues$r(__spreadValues$r({}, _BloomFilter2.DEFAULT_OPTIONS), options); + super(); + __publicField$_(this, "_blurXFilter"); + __publicField$_(this, "_blurYFilter"); + __publicField$_(this, "_strength"); + this._strength = { x: 2, y: 2 }; + if (options.strength) { + if (typeof options.strength === "number") { + this._strength.x = options.strength; + this._strength.y = options.strength; + } else { + this._strength.x = options.strength.x; + this._strength.y = options.strength.y; + } + } + this._blurXFilter = new pixi_js$v.BlurFilterPass(__spreadProps$2(__spreadValues$r({}, options), { + horizontal: true, + strength: this.strengthX + })); + this._blurYFilter = new pixi_js$v.BlurFilterPass(__spreadProps$2(__spreadValues$r({}, options), { + horizontal: false, + strength: this.strengthY + })); + this._blurYFilter.blendMode = "screen"; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clear) { + const renderTarget = pixi_js$v.TexturePool.getSameSizeTexture(input); + filterManager.applyFilter(this, input, output, clear); + this._blurXFilter.apply(filterManager, input, renderTarget, true); + this._blurYFilter.apply(filterManager, renderTarget, output, false); + pixi_js$v.TexturePool.returnTexture(renderTarget); + } + /** + * Sets the strength of both the blurX and blurY properties simultaneously + * @default 2 + */ + get strength() { + return this._strength; + } + set strength(value) { + this._strength = typeof value === "number" ? { x: value, y: value } : value; + this._updateStrength(); + } + /** + * Sets the strength of the blur on the `x` axis + * @default 2 + */ + get strengthX() { + return this.strength.x; + } + set strengthX(value) { + this.strength.x = value; + this._updateStrength(); + } + /** + * Sets the strength of the blur on the `y` axis + * @default 2 + */ + get strengthY() { + return this.strength.y; + } + set strengthY(value) { + this.strength.y = value; + this._updateStrength(); + } + _updateStrength() { + this._blurXFilter.blur = this.strengthX; + this._blurYFilter.blur = this.strengthY; + } + }; + __publicField$_(_BloomFilter$1, "DEFAULT_OPTIONS", { + strength: { x: 2, y: 2 }, + quality: 4, + kernelSize: 5 + }); + let BloomFilter$1 = _BloomFilter$1; + BloomFilter$2.BloomFilter = BloomFilter$1; + + var BulgePinchFilter$2 = {}; + + var bulgePinch2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uDimensions;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform float uStrength;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * uInputSize.xy;\n coord -= uCenter * uDimensions.xy;\n float distance = length(coord);\n\n if (distance < uRadius) {\n float percent = distance / uRadius;\n if (uStrength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, uRadius / distance, percent), uStrength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + uStrength * 0.75) * uRadius / distance, 1.0 - percent);\n }\n }\n\n coord += uCenter * uDimensions.xy;\n coord /= uInputSize.xy;\n vec2 clampedCoord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n vec4 color = texture(uTexture, clampedCoord);\n\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n finalColor = color;\n}\n"; + exports["default"] = fragment; + })(bulgePinch2); + + var bulgePinch$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct BulgePinchUniforms {\n uDimensions: vec2,\n uCenter: vec2,\n uRadius: f32,\n uStrength: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var bulgePinchUniforms : BulgePinchUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let dimensions: vec2 = bulgePinchUniforms.uDimensions;\n let center: vec2 = bulgePinchUniforms.uCenter;\n let radius: f32 = bulgePinchUniforms.uRadius;\n let strength: f32 = bulgePinchUniforms.uStrength;\n var coord: vec2 = (uv * gfu.uInputSize.xy) - center * dimensions.xy;\n\n let distance: f32 = length(coord);\n\n if (distance < radius) {\n let percent: f32 = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += (center * dimensions.xy);\n coord /= gfu.uInputSize.xy;\n\n let clampedCoord: vec2 = clamp(coord, gfu.uInputClamp.xy, gfu.uInputClamp.zw);\n var color: vec4 = textureSample(uTexture, uSampler, clampedCoord);\n if (coord.x != clampedCoord.x && coord.y != clampedCoord.y) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n return color;\n}\n\nfn compareVec2(x: vec2, y: vec2) -> bool\n{\n if (x.x == y.x && x.y == y.y)\n {\n return true;\n }\n\n return false;\n}"; + exports["default"] = source; + })(bulgePinch$3); + + var __defProp$Z = Object.defineProperty; + var __getOwnPropSymbols$q = Object.getOwnPropertySymbols; + var __hasOwnProp$q = Object.prototype.hasOwnProperty; + var __propIsEnum$q = Object.prototype.propertyIsEnumerable; + var __defNormalProp$Z = (obj, key, value) => key in obj ? __defProp$Z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$q = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$q.call(b, prop)) + __defNormalProp$Z(a, prop, b[prop]); + if (__getOwnPropSymbols$q) + for (var prop of __getOwnPropSymbols$q(b)) { + if (__propIsEnum$q.call(b, prop)) + __defNormalProp$Z(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(BulgePinchFilter$2, "__esModule", { value: true }); + var pixi_js$u = require$$0__default["default"]; + var _default$1$s = _default$A; + var _default$t = default2; + var bulgePinch$1 = bulgePinch2; + var bulgePinch$2 = bulgePinch$3; + var __defProp2$q = Object.defineProperty; + var __defNormalProp2$q = (obj, key, value) => key in obj ? __defProp2$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$Z = (obj, key, value) => { + __defNormalProp2$q(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _BulgePinchFilter$1 = class _BulgePinchFilter2 extends pixi_js$u.Filter { + constructor(options) { + options = __spreadValues$q(__spreadValues$q({}, _BulgePinchFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$u.GpuProgram({ + vertex: { + source: _default$t["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: bulgePinch$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$u.GlProgram({ + vertex: _default$1$s["default"], + fragment: bulgePinch$1["default"], + name: "bulge-pinch-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + bulgePinchUniforms: { + uDimensions: { value: [0, 0], type: "vec2" }, + uCenter: { value: options.center, type: "vec2" }, + uRadius: { value: options.radius, type: "f32" }, + uStrength: { value: options.strength, type: "f32" } + } + } + }); + __publicField$Z(this, "uniforms"); + this.uniforms = this.resources.bulgePinchUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * Sets the center of the effect in normalized screen coords. + * { x: 0, y: 0 } means top-left and { x: 1, y: 1 } mean bottom-right + * @default {x:0.5,y:0.5} + */ + get center() { + return this.uniforms.uCenter; + } + set center(value) { + this.uniforms.uCenter = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `x` axis + * @default 0 + */ + get centerX() { + return this.uniforms.uCenter.x; + } + set centerX(value) { + this.uniforms.uCenter.x = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `y` axis + * @default 0 + */ + get centerY() { + return this.uniforms.uCenter.y; + } + set centerY(value) { + this.uniforms.uCenter.y = value; + } + /** + * The radius of the circle of effect + * @default 100 + */ + get radius() { + return this.uniforms.uRadius; + } + set radius(value) { + this.uniforms.uRadius = value; + } + /** + * A value between -1 and 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge) + * @default 1 + */ + get strength() { + return this.uniforms.uStrength; + } + set strength(value) { + this.uniforms.uStrength = value; + } + }; + __publicField$Z(_BulgePinchFilter$1, "DEFAULT_OPTIONS", { + center: { x: 0.5, y: 0.5 }, + radius: 100, + strength: 1 + }); + let BulgePinchFilter$1 = _BulgePinchFilter$1; + BulgePinchFilter$2.BulgePinchFilter = BulgePinchFilter$1; + + var ColorGradientFilter$3 = {}; + + var colorGradient$4 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nin vec2 vFilterCoord;\nout vec4 finalColor;\n\nconst int TYPE_LINEAR = 0;\nconst int TYPE_RADIAL = 1;\nconst int TYPE_CONIC = 2;\nconst int MAX_STOPS = 32;\n\nuniform sampler2D uTexture;\nuniform vec4 uOptions;\nuniform vec2 uCounts;\nuniform vec3 uColors[MAX_STOPS];\nuniform vec4 uStops[MAX_STOPS];\n\nconst float PI = 3.1415926538;\nconst float PI_2 = PI*2.;\n\nstruct ColorStop {\n float offset;\n vec3 color;\n float alpha;\n};\n\nmat2 rotate2d(float angle){\n return mat2(cos(angle), -sin(angle),\n sin(angle), cos(angle));\n}\n\nfloat projectLinearPosition(vec2 pos, float angle){\n vec2 center = vec2(0.5);\n vec2 result = pos - center;\n result = rotate2d(angle) * result;\n result = result + center;\n return clamp(result.x, 0., 1.);\n}\n\nfloat projectRadialPosition(vec2 pos) {\n float r = distance(pos, vec2(0.5));\n return clamp(2.*r, 0., 1.);\n}\n\nfloat projectAnglePosition(vec2 pos, float angle) {\n vec2 center = pos - vec2(0.5);\n float polarAngle=atan(-center.y, center.x);\n return mod(polarAngle + angle, PI_2) / PI_2;\n}\n\nfloat projectPosition(vec2 pos, int type, float angle) {\n if (type == TYPE_LINEAR) {\n return projectLinearPosition(pos, angle);\n } else if (type == TYPE_RADIAL) {\n return projectRadialPosition(pos);\n } else if (type == TYPE_CONIC) {\n return projectAnglePosition(pos, angle);\n }\n\n return pos.y;\n}\n\nvoid main(void) {\n int uType = int(uOptions[0]);\n float uAngle = uOptions[1];\n float uAlpha = uOptions[2];\n float uReplace = uOptions[3];\n\n int uNumStops = int(uCounts[0]);\n float uMaxColors = uCounts[1];\n\n // current/original color\n vec4 currentColor = texture(uTexture, vTextureCoord);\n\n // skip calculations if gradient alpha is 0\n if (0.0 == uAlpha) {\n finalColor = currentColor;\n return;\n }\n\n // project position\n float y = projectPosition(vFilterCoord, int(uType), radians(uAngle));\n\n // check gradient bounds\n float offsetMin = uStops[0][0];\n float offsetMax = 0.0;\n\n int numStops = int(uNumStops);\n\n for (int i = 0; i < MAX_STOPS; i++) {\n if (i == numStops-1){ // last index\n offsetMax = uStops[i][0];\n }\n }\n\n if (y < offsetMin || y > offsetMax) {\n finalColor = currentColor;\n return;\n }\n\n // limit colors\n if (uMaxColors > 0.) {\n float stepSize = 1./uMaxColors;\n float stepNumber = float(floor(y/stepSize));\n y = stepSize * (stepNumber + 0.5);// offset by 0.5 to use color from middle of segment\n }\n\n // find color stops\n ColorStop from;\n ColorStop to;\n\n for (int i = 0; i < MAX_STOPS; i++) {\n if (y >= uStops[i][0]) {\n from = ColorStop(uStops[i][0], uColors[i], uStops[i][1]);\n to = ColorStop(uStops[i+1][0], uColors[i+1], uStops[i+1][1]);\n }\n\n if (i == numStops-1){ // last index\n break;\n }\n }\n\n // mix colors from stops\n vec4 colorFrom = vec4(from.color * from.alpha, from.alpha);\n vec4 colorTo = vec4(to.color * to.alpha, to.alpha);\n\n float segmentHeight = to.offset - from.offset;\n float relativePos = y - from.offset;// position from 0 to [segmentHeight]\n float relativePercent = relativePos / segmentHeight;// position in percent between [from.offset] and [to.offset].\n\n float gradientAlpha = uAlpha * currentColor.a;\n vec4 gradientColor = mix(colorFrom, colorTo, relativePercent) * gradientAlpha;\n\n if (uReplace < 0.5) {\n // mix resulting color with current color\n finalColor = gradientColor + currentColor*(1.-gradientColor.a);\n } else {\n // replace with gradient color\n finalColor = gradientColor;\n }\n}\n"; + exports["default"] = fragment; + })(colorGradient$4); + + var colorGradient2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var vertex = "in vec2 aPosition;\nout vec2 vTextureCoord;\nout vec2 vFilterCoord;\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n vFilterCoord = vTextureCoord * uInputSize.xy / uOutputFrame.zw;\n}\n"; + exports["default"] = vertex; + })(colorGradient2); + + var colorGradient3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct BaseUniforms {\n uOptions: vec4,\n uCounts: vec2,\n};\n\nstruct StopsUniforms {\n uColors: array, MAX_STOPS>,\n uStops: array, MAX_STOPS>,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var baseUniforms : BaseUniforms;\n@group(1) @binding(1) var stopsUniforms : StopsUniforms;\n\nstruct VSOutput {\n @builtin(position) position: vec4,\n @location(0) uv : vec2,\n @location(1) coord : vec2\n};\n\nfn filterVertexPosition(aPosition:vec2) -> vec4\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2 ) -> vec2\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn filterCoord( vTextureCoord:vec2 ) -> vec2\n{\n return vTextureCoord * gfu.uInputSize.xy / gfu.uOutputFrame.zw;\n}\n\nfn globalTextureCoord( aPosition:vec2 ) -> vec2\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getSize() -> vec2\n{\n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2, \n) -> VSOutput {\n let vTextureCoord: vec2 = filterTextureCoord(aPosition);\n return VSOutput(\n filterVertexPosition(aPosition),\n vTextureCoord,\n filterCoord(vTextureCoord),\n );\n}\n\nstruct ColorStop {\n offset: f32,\n color: vec3,\n alpha: f32,\n};\n\nfn rotate2d(angle: f32) -> mat2x2{\n return mat2x2(cos(angle), -sin(angle),\n sin(angle), cos(angle));\n}\n\nfn projectLinearPosition(pos: vec2, angle: f32) -> f32 {\n var center: vec2 = vec2(0.5);\n var result: vec2 = pos - center;\n result = rotate2d(angle) * result;\n result = result + center;\n return clamp(result.x, 0.0, 1.0);\n}\n\nfn projectRadialPosition(pos: vec2) -> f32 {\n var r: f32 = distance(pos, vec2(0.5));\n return clamp(2.0 * r, 0.0, 1.0);\n}\n\nfn projectAnglePosition(pos: vec2, angle: f32) -> f32 {\n var center: vec2 = pos - vec2(0.5, 0.5);\n var polarAngle: f32 = atan2(-center.y, center.x);\n return ((polarAngle + angle) % PI_2) / PI_2;\n}\n\nfn projectPosition(pos: vec2, gradientType: i32, angle: f32) -> f32 {\n if (gradientType == TYPE_LINEAR) {\n return projectLinearPosition(pos, angle);\n } else if (gradientType == TYPE_RADIAL) {\n return projectRadialPosition(pos);\n } else if (gradientType == TYPE_CONIC) {\n return projectAnglePosition(pos, angle);\n }\n\n return pos.y;\n}\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2,\n @location(1) coord : vec2\n) -> @location(0) vec4 {\n let uType: i32 = i32(baseUniforms.uOptions[0]);\n let uAngle: f32 = baseUniforms.uOptions[1];\n let uAlpha: f32 = baseUniforms.uOptions[2];\n let uReplace: f32 = baseUniforms.uOptions[3];\n\n let uNumStops: i32 = i32(baseUniforms.uCounts[0]);\n let uMaxColors: f32 = baseUniforms.uCounts[1];\n\n // current/original color\n var currentColor: vec4 = textureSample(uTexture, uSampler, uv);\n\n // skip calculations if gradient alpha is 0\n if (uAlpha == 0.0) { return currentColor; }\n\n // project position\n var y: f32 = projectPosition(coord, uType, radians(uAngle));\n\n // check gradient bounds\n var offsetMin: f32 = stopsUniforms.uStops[0][0];\n var offsetMax: f32 = 0.0;\n\n let numStops: i32 = uNumStops;\n\n for (var i: i32 = 0; i < MAX_STOPS; i = i + 1) {\n if (i == numStops - 1) { // last index\n offsetMax = stopsUniforms.uStops[i][0];\n }\n }\n\n if (y < offsetMin || y > offsetMax) { return currentColor; }\n\n // limit colors\n if (uMaxColors > 0.0) {\n var stepSize: f32 = 1.0 / uMaxColors;\n var stepNumber: f32 = floor(y / stepSize);\n y = stepSize * (stepNumber + 0.5); // offset by 0.5 to use color from middle of segment\n }\n\n // find color stops\n var stopFrom: ColorStop;\n var stopTo: ColorStop;\n\n for (var i: i32 = 0; i < MAX_STOPS; i = i + 1) {\n if (y >= stopsUniforms.uStops[i][0]) {\n stopFrom = ColorStop(stopsUniforms.uStops[i][0], stopsUniforms.uColors[i], stopsUniforms.uStops[i][1]);\n stopTo = ColorStop(stopsUniforms.uStops[i + 1][0], stopsUniforms.uColors[i + 1], stopsUniforms.uStops[i + 1][1]);\n }\n\n if (i == numStops - 1) { // last index\n break;\n }\n }\n\n // mix colors from stops\n var colorFrom: vec4 = vec4(stopFrom.color * stopFrom.alpha, stopFrom.alpha);\n var colorTo: vec4 = vec4(stopTo.color * stopTo.alpha, stopTo.alpha);\n\n var segmentHeight: f32 = stopTo.offset - stopFrom.offset;\n var relativePos: f32 = y - stopFrom.offset; // position from 0 to [segmentHeight]\n var relativePercent: f32 = relativePos / segmentHeight; // position in percent between [from.offset] and [to.offset].\n\n var gradientAlpha: f32 = uAlpha * currentColor.a;\n var gradientColor: vec4 = mix(colorFrom, colorTo, relativePercent) * gradientAlpha;\n\n if (uReplace < 0.5) {\n // mix resulting color with current color\n return gradientColor + currentColor * (1.0 - gradientColor.a);\n } else {\n // replace with gradient color\n return gradientColor;\n }\n}\n\nconst PI: f32 = 3.14159265358979323846264;\nconst PI_2: f32 = PI * 2.0;\n\nconst TYPE_LINEAR: i32 = 0;\nconst TYPE_RADIAL: i32 = 1;\nconst TYPE_CONIC: i32 = 2;\nconst MAX_STOPS: i32 = 32;"; + exports["default"] = source; + })(colorGradient3); + + var CssGradientParser$2 = {}; + + var node$1 = {}; + + Object.defineProperty(node$1, "__esModule", { value: true }); + var GradientParser$1 = GradientParser$1 || {}; + GradientParser$1.stringify = /* @__PURE__ */ function() { + var visitor = { + "visit_linear-gradient": function(node2) { + return visitor.visit_gradient(node2); + }, + "visit_repeating-linear-gradient": function(node2) { + return visitor.visit_gradient(node2); + }, + "visit_radial-gradient": function(node2) { + return visitor.visit_gradient(node2); + }, + "visit_repeating-radial-gradient": function(node2) { + return visitor.visit_gradient(node2); + }, + "visit_gradient": function(node2) { + var orientation = visitor.visit(node2.orientation); + if (orientation) { + orientation += ", "; + } + return node2.type + "(" + orientation + visitor.visit(node2.colorStops) + ")"; + }, + "visit_shape": function(node2) { + var result = node2.value, at = visitor.visit(node2.at), style = visitor.visit(node2.style); + if (style) { + result += " " + style; + } + if (at) { + result += " at " + at; + } + return result; + }, + "visit_default-radial": function(node2) { + var result = "", at = visitor.visit(node2.at); + if (at) { + result += at; + } + return result; + }, + "visit_extent-keyword": function(node2) { + var result = node2.value, at = visitor.visit(node2.at); + if (at) { + result += " at " + at; + } + return result; + }, + "visit_position-keyword": function(node2) { + return node2.value; + }, + "visit_position": function(node2) { + return visitor.visit(node2.value.x) + " " + visitor.visit(node2.value.y); + }, + "visit_%": function(node2) { + return node2.value + "%"; + }, + "visit_em": function(node2) { + return node2.value + "em"; + }, + "visit_px": function(node2) { + return node2.value + "px"; + }, + "visit_literal": function(node2) { + return visitor.visit_color(node2.value, node2); + }, + "visit_hex": function(node2) { + return visitor.visit_color("#" + node2.value, node2); + }, + "visit_rgb": function(node2) { + return visitor.visit_color("rgb(" + node2.value.join(", ") + ")", node2); + }, + "visit_rgba": function(node2) { + return visitor.visit_color("rgba(" + node2.value.join(", ") + ")", node2); + }, + "visit_color": function(resultColor, node2) { + var result = resultColor, length = visitor.visit(node2.length); + if (length) { + result += " " + length; + } + return result; + }, + "visit_angular": function(node2) { + return node2.value + "deg"; + }, + "visit_directional": function(node2) { + return "to " + node2.value; + }, + "visit_array": function(elements) { + var result = "", size = elements.length; + elements.forEach(function(element, i) { + result += visitor.visit(element); + if (i < size - 1) { + result += ", "; + } + }); + return result; + }, + "visit": function(element) { + if (!element) { + return ""; + } + var result = ""; + if (element instanceof Array) { + return visitor.visit_array(element, result); + } else if (element.type) { + var nodeVisitor = visitor["visit_" + element.type]; + if (nodeVisitor) { + return nodeVisitor(element); + } else { + throw Error("Missing visitor visit_" + element.type); + } + } else { + throw Error("Invalid node."); + } + } + }; + return function(root) { + return visitor.visit(root); + }; + }(); + var GradientParser$1 = GradientParser$1 || {}; + GradientParser$1.parse = /* @__PURE__ */ function() { + var tokens = { + linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i, + repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i, + radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i, + repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i, + sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i, + extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/, + positionKeywords: /^(left|center|right|top|bottom)/i, + pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/, + percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/, + emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/, + angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/, + startCall: /^\(/, + endCall: /^\)/, + comma: /^,/, + hexColor: /^\#([0-9a-fA-F]+)/, + literalColor: /^([a-zA-Z]+)/, + rgbColor: /^rgb/i, + rgbaColor: /^rgba/i, + number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/ + }; + var input = ""; + function error(msg) { + var err = new Error(input + ": " + msg); + err.source = input; + throw err; + } + function getAST() { + var ast = matchListDefinitions(); + if (input.length > 0) { + error("Invalid input not EOF"); + } + return ast; + } + function matchListDefinitions() { + return matchListing(matchDefinition); + } + function matchDefinition() { + return matchGradient( + "linear-gradient", + tokens.linearGradient, + matchLinearOrientation + ) || matchGradient( + "repeating-linear-gradient", + tokens.repeatingLinearGradient, + matchLinearOrientation + ) || matchGradient( + "radial-gradient", + tokens.radialGradient, + matchListRadialOrientations + ) || matchGradient( + "repeating-radial-gradient", + tokens.repeatingRadialGradient, + matchListRadialOrientations + ); + } + function matchGradient(gradientType, pattern, orientationMatcher) { + return matchCall(pattern, function(captures) { + var orientation = orientationMatcher(); + if (orientation) { + if (!scan(tokens.comma)) { + error("Missing comma before color stops"); + } + } + return { + type: gradientType, + orientation, + colorStops: matchListing(matchColorStop) + }; + }); + } + function matchCall(pattern, callback) { + var captures = scan(pattern); + if (captures) { + if (!scan(tokens.startCall)) { + error("Missing ("); + } + var result = callback(captures); + if (!scan(tokens.endCall)) { + error("Missing )"); + } + return result; + } + } + function matchLinearOrientation() { + return matchSideOrCorner() || matchAngle(); + } + function matchSideOrCorner() { + return match("directional", tokens.sideOrCorner, 1); + } + function matchAngle() { + return match("angular", tokens.angleValue, 1); + } + function matchListRadialOrientations() { + var radialOrientations, radialOrientation = matchRadialOrientation(), lookaheadCache; + if (radialOrientation) { + radialOrientations = []; + radialOrientations.push(radialOrientation); + lookaheadCache = input; + if (scan(tokens.comma)) { + radialOrientation = matchRadialOrientation(); + if (radialOrientation) { + radialOrientations.push(radialOrientation); + } else { + input = lookaheadCache; + } + } + } + return radialOrientations; + } + function matchRadialOrientation() { + var radialType = matchCircle() || matchEllipse(); + if (radialType) { + radialType.at = matchAtPosition(); + } else { + var extent = matchExtentKeyword(); + if (extent) { + radialType = extent; + var positionAt = matchAtPosition(); + if (positionAt) { + radialType.at = positionAt; + } + } else { + var defaultPosition = matchPositioning(); + if (defaultPosition) { + radialType = { + type: "default-radial", + at: defaultPosition + }; + } + } + } + return radialType; + } + function matchCircle() { + var circle = match("shape", /^(circle)/i, 0); + if (circle) { + circle.style = matchLength() || matchExtentKeyword(); + } + return circle; + } + function matchEllipse() { + var ellipse = match("shape", /^(ellipse)/i, 0); + if (ellipse) { + ellipse.style = matchDistance() || matchExtentKeyword(); + } + return ellipse; + } + function matchExtentKeyword() { + return match("extent-keyword", tokens.extentKeywords, 1); + } + function matchAtPosition() { + if (match("position", /^at/, 0)) { + var positioning = matchPositioning(); + if (!positioning) { + error("Missing positioning value"); + } + return positioning; + } + } + function matchPositioning() { + var location = matchCoordinates(); + if (location.x || location.y) { + return { + type: "position", + value: location + }; + } + } + function matchCoordinates() { + return { + x: matchDistance(), + y: matchDistance() + }; + } + function matchListing(matcher) { + var captures = matcher(), result = []; + if (captures) { + result.push(captures); + while (scan(tokens.comma)) { + captures = matcher(); + if (captures) { + result.push(captures); + } else { + error("One extra comma"); + } + } + } + return result; + } + function matchColorStop() { + var color = matchColor(); + if (!color) { + error("Expected color definition"); + } + color.length = matchDistance(); + return color; + } + function matchColor() { + return matchHexColor() || matchRGBAColor() || matchRGBColor() || matchLiteralColor(); + } + function matchLiteralColor() { + return match("literal", tokens.literalColor, 0); + } + function matchHexColor() { + return match("hex", tokens.hexColor, 1); + } + function matchRGBColor() { + return matchCall(tokens.rgbColor, function() { + return { + type: "rgb", + value: matchListing(matchNumber) + }; + }); + } + function matchRGBAColor() { + return matchCall(tokens.rgbaColor, function() { + return { + type: "rgba", + value: matchListing(matchNumber) + }; + }); + } + function matchNumber() { + return scan(tokens.number)[1]; + } + function matchDistance() { + return match("%", tokens.percentageValue, 1) || matchPositionKeyword() || matchLength(); + } + function matchPositionKeyword() { + return match("position-keyword", tokens.positionKeywords, 1); + } + function matchLength() { + return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1); + } + function match(type, pattern, captureIndex) { + var captures = scan(pattern); + if (captures) { + return { + type, + value: captures[captureIndex] + }; + } + } + function scan(regexp) { + var captures, blankCaptures; + blankCaptures = /^[\n\r\t\s]+/.exec(input); + if (blankCaptures) { + consume(blankCaptures[0].length); + } + captures = regexp.exec(input); + if (captures) { + consume(captures[0].length); + } + return captures; + } + function consume(size) { + input = input.substr(size); + } + return function(code) { + input = code.toString(); + return getAST(); + }; + }(); + var parse$1 = GradientParser$1.parse; + GradientParser$1.stringify; + node$1.parse = parse$1; + + Object.defineProperty(CssGradientParser$2, "__esModule", { value: true }); + var node = node$1; + var pixi_js$t = require$$0__default["default"]; + function parseCssGradient$2(cssGradient) { + const cssGradientNodes = node.parse(trimCssGradient$2(cssGradient)); + if (cssGradientNodes.length === 0) { + throw new Error("Invalid CSS gradient."); + } else if (cssGradientNodes.length !== 1) { + throw new Error("Unsupported CSS gradient (multiple gradients is not supported)."); + } + const cssGradientNode = cssGradientNodes[0]; + const type = typeFromCssType$2(cssGradientNode.type); + const stops = stopsFromCssStops$2(cssGradientNode.colorStops); + const angle = angleFromCssOrientation$2(cssGradientNode.orientation); + return { + type, + stops, + angle + }; + } + function typeFromCssType$2(type) { + const supportedTypes = { + "linear-gradient": 0, + "radial-gradient": 1 + }; + if (!(type in supportedTypes)) { + throw new Error(`Unsupported gradient type "${type}"`); + } + return supportedTypes[type]; + } + function stopsFromCssStops$2(stops) { + const offsets = offsetsFromCssColorStops$2(stops); + const result = []; + const color = new pixi_js$t.Color(); + for (let i = 0; i < stops.length; i++) { + const colorString = colorAsStringFromCssStop$2(stops[i]); + const rgbaColor = color.setValue(colorString).toArray(); + result.push({ + offset: offsets[i], + color: rgbaColor.slice(0, 3), + alpha: rgbaColor[3] + }); + } + return result; + } + function colorAsStringFromCssStop$2(stop) { + switch (stop.type) { + case "hex": + return `#${stop.value}`; + case "literal": + return stop.value; + default: + return `${stop.type}(${stop.value.join(",")})`; + } + } + function offsetsFromCssColorStops$2(stops) { + const offsets = []; + const dynamicOffset = -1; + for (let i = 0; i < stops.length; i++) { + const cssStop = stops[i]; + let stopOffset = dynamicOffset; + if (cssStop.type === "literal") { + if (cssStop.length && "type" in cssStop.length && cssStop.length.type === "%" && "value" in cssStop.length) { + stopOffset = parseFloat(cssStop.length.value) / 100; + } + } + offsets.push(stopOffset); + } + const findNextFixedStop = (fromIndex) => { + for (let k = fromIndex; k < offsets.length; k++) { + if (offsets[k] !== dynamicOffset) { + return { + indexDelta: k - fromIndex, + offset: offsets[k] + }; + } + } + return { + indexDelta: offsets.length - 1 - fromIndex, + offset: 1 + }; + }; + let prevFixedOffset = 0; + for (let i = 0; i < offsets.length; i++) { + const offset = offsets[i]; + if (offset !== dynamicOffset) { + prevFixedOffset = offset; + } else if (i === 0) { + offsets[i] = 0; + } else if (i + 1 === offsets.length) { + offsets[i] = 1; + } else { + const nextFixed = findNextFixedStop(i); + const offsetDelta = nextFixed.offset - prevFixedOffset; + const stepSize = offsetDelta / (1 + nextFixed.indexDelta); + for (let s = 0; s <= nextFixed.indexDelta; s++) { + offsets[i + s] = prevFixedOffset + (s + 1) * stepSize; + } + i += nextFixed.indexDelta; + prevFixedOffset = offsets[i]; + } + } + return offsets.map(fixFloatRounding$1); + } + function fixFloatRounding$1(value) { + const maxLength = 6; + if (value.toString().length > maxLength) { + return parseFloat(value.toString().substring(0, maxLength)); + } + return value; + } + function angleFromCssOrientation$2(orientation) { + if (typeof orientation === "undefined") { + return 0; + } + if ("type" in orientation && "value" in orientation) { + switch (orientation.type) { + case "angular": + return parseFloat(orientation.value); + case "directional": + return angleFromDirectionalValue$2(orientation.value); + } + } + return 0; + } + function angleFromDirectionalValue$2(value) { + const supportedValues = { + left: 270, + top: 0, + bottom: 180, + right: 90, + "left top": 315, + "top left": 315, + "left bottom": 225, + "bottom left": 225, + "right top": 45, + "top right": 45, + "right bottom": 135, + "bottom right": 135 + }; + if (!(value in supportedValues)) { + throw new Error(`Unsupported directional value "${value}"`); + } + return supportedValues[value]; + } + function trimCssGradient$2(value) { + let value_ = value.replace(/\s{2,}/gu, " "); + value_ = value_.replace(/;/g, ""); + value_ = value_.replace(/ ,/g, ","); + value_ = value_.replace(/\( /g, "("); + value_ = value_.replace(/ \)/g, ")"); + return value_.trim(); + } + CssGradientParser$2.angleFromCssOrientation = angleFromCssOrientation$2; + CssGradientParser$2.angleFromDirectionalValue = angleFromDirectionalValue$2; + CssGradientParser$2.colorAsStringFromCssStop = colorAsStringFromCssStop$2; + CssGradientParser$2.offsetsFromCssColorStops = offsetsFromCssColorStops$2; + CssGradientParser$2.parseCssGradient = parseCssGradient$2; + CssGradientParser$2.stopsFromCssStops = stopsFromCssStops$2; + CssGradientParser$2.trimCssGradient = trimCssGradient$2; + CssGradientParser$2.typeFromCssType = typeFromCssType$2; + + var __defProp$Y = Object.defineProperty; + var __defProps$1 = Object.defineProperties; + var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors; + var __getOwnPropSymbols$p = Object.getOwnPropertySymbols; + var __hasOwnProp$p = Object.prototype.hasOwnProperty; + var __propIsEnum$p = Object.prototype.propertyIsEnumerable; + var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$p = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$p.call(b, prop)) + __defNormalProp$Y(a, prop, b[prop]); + if (__getOwnPropSymbols$p) + for (var prop of __getOwnPropSymbols$p(b)) { + if (__propIsEnum$p.call(b, prop)) + __defNormalProp$Y(a, prop, b[prop]); + } + return a; + }; + var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b)); + Object.defineProperty(ColorGradientFilter$3, "__esModule", { value: true }); + var pixi_js$s = require$$0__default["default"]; + var colorGradient$2 = colorGradient$4; + var colorGradient$1 = colorGradient2; + var colorGradient$3 = colorGradient3; + var CssGradientParser$1 = CssGradientParser$2; + var __defProp2$p = Object.defineProperty; + var __defNormalProp2$p = (obj, key, value) => key in obj ? __defProp2$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$Y = (obj, key, value) => { + __defNormalProp2$p(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const ANGLE_OFFSET$1 = 90; + function sortColorStops$1(stops) { + return [...stops].sort((a, b) => a.offset - b.offset); + } + const _ColorGradientFilter$1 = class _ColorGradientFilter2 extends pixi_js$s.Filter { + /** + * @param {DefaultOptions | CssOptions} [options] + * @param {number} [options.alpha=1.0] - Alpha value + * @param {number} [options.maxColors=0] - Maximum number of colors to render (0 = disabled) + */ + constructor(options) { + var _a, _b, _c; + if (options && "css" in options) { + options = __spreadProps$1(__spreadValues$p({}, CssGradientParser$1.parseCssGradient(options.css || "")), { + alpha: (_a = options.alpha) != null ? _a : _ColorGradientFilter2.defaults.alpha, + maxColors: (_b = options.maxColors) != null ? _b : _ColorGradientFilter2.defaults.maxColors + }); + } else { + options = __spreadValues$p(__spreadValues$p({}, _ColorGradientFilter2.defaults), options); + } + if (!options.stops || options.stops.length < 2) { + throw new Error("ColorGradientFilter requires at least 2 color stops."); + } + const gpuProgram = new pixi_js$s.GpuProgram({ + vertex: { + source: colorGradient$3["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: colorGradient$3["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$s.GlProgram({ + vertex: colorGradient$1["default"], + fragment: colorGradient$2["default"], + name: "color-gradient-filter" + }); + const maxStops = 32; + super({ + gpuProgram, + glProgram, + resources: { + baseUniforms: { + uOptions: { + value: [ + // Gradient Type + options.type, + // Gradient Angle + (_c = options.angle) != null ? _c : ANGLE_OFFSET$1, + // Master Alpha + options.alpha, + // Replace Base Color + options.replace ? 1 : 0 + ], + type: "vec4" + }, + uCounts: { + value: [ + // Number of Stops + options.stops.length, + // Max Gradient Colors + options.maxColors + ], + type: "vec2" + } + }, + stopsUniforms: { + uColors: { value: new Float32Array(maxStops * 3), type: "vec3", size: maxStops }, + // We only need vec2, but we need to pad to eliminate the WGSL warning, TODO: @Mat ? + uStops: { value: new Float32Array(maxStops * 4), type: "vec4", size: maxStops } + } + } + }); + __publicField$Y(this, "baseUniforms"); + __publicField$Y(this, "stopsUniforms"); + __publicField$Y(this, "_stops", []); + this.baseUniforms = this.resources.baseUniforms.uniforms; + this.stopsUniforms = this.resources.stopsUniforms.uniforms; + Object.assign(this, options); + } + get stops() { + return this._stops; + } + set stops(stops) { + const sortedStops = sortColorStops$1(stops); + const color = new pixi_js$s.Color(); + let r; + let g; + let b; + for (let i = 0; i < sortedStops.length; i++) { + color.setValue(sortedStops[i].color); + const indexStart = i * 3; + [r, g, b] = color.toArray(); + this.stopsUniforms.uColors[indexStart] = r; + this.stopsUniforms.uColors[indexStart + 1] = g; + this.stopsUniforms.uColors[indexStart + 2] = b; + this.stopsUniforms.uStops[i * 4] = sortedStops[i].offset; + this.stopsUniforms.uStops[i * 4 + 1] = sortedStops[i].alpha; + } + this.baseUniforms.uCounts[0] = sortedStops.length; + this._stops = sortedStops; + } + /** + * The type of gradient + * @default ColorGradientFilter.LINEAR + */ + get type() { + return this.baseUniforms.uOptions[0]; + } + set type(value) { + this.baseUniforms.uOptions[0] = value; + } + /** + * The angle of the gradient in degrees + * @default 90 + */ + get angle() { + return this.baseUniforms.uOptions[1] + ANGLE_OFFSET$1; + } + set angle(value) { + this.baseUniforms.uOptions[1] = value - ANGLE_OFFSET$1; + } + /** + * The alpha value of the gradient (0-1) + * @default 1 + */ + get alpha() { + return this.baseUniforms.uOptions[2]; + } + set alpha(value) { + this.baseUniforms.uOptions[2] = value; + } + /** + * The maximum number of colors to render (0 = no limit) + * @default 0 + */ + get maxColors() { + return this.baseUniforms.uCounts[1]; + } + set maxColors(value) { + this.baseUniforms.uCounts[1] = value; + } + /** + * If true, the gradient will replace the existing color, otherwise it + * will be multiplied with it + * @default false + */ + get replace() { + return this.baseUniforms.uOptions[3] > 0.5; + } + set replace(value) { + this.baseUniforms.uOptions[3] = value ? 1 : 0; + } + }; + __publicField$Y(_ColorGradientFilter$1, "LINEAR", 0); + __publicField$Y(_ColorGradientFilter$1, "RADIAL", 1); + __publicField$Y(_ColorGradientFilter$1, "CONIC", 2); + __publicField$Y(_ColorGradientFilter$1, "defaults", { + type: _ColorGradientFilter$1.LINEAR, + stops: [ + { offset: 0, color: 16711680, alpha: 1 }, + { offset: 1, color: 255, alpha: 1 } + ], + alpha: 1, + angle: 90, + maxColors: 0, + replace: false + }); + let ColorGradientFilter$2 = _ColorGradientFilter$1; + ColorGradientFilter$3.ColorGradientFilter = ColorGradientFilter$2; + + var ColorMapFilter$2 = {}; + + var colorMap$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMapTexture;\nuniform float uMix;\nuniform float uSize;\nuniform float uSliceSize;\nuniform float uSlicePixelSize;\nuniform float uSliceInnerSize;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord.xy);\n vec4 adjusted;\n\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = uSize - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = uSlicePixelSize * 0.5 + color.r * uSliceInnerSize;\n float s0 = xOffset + (zSlice0 * uSliceSize);\n float s1 = xOffset + (zSlice1 * uSliceSize);\n float yOffset = uSliceSize * 0.5 + color.g * (1.0 - uSliceSize);\n vec4 slice0Color = texture(uMapTexture, vec2(s0,yOffset));\n vec4 slice1Color = texture(uMapTexture, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n\n finalColor = vec4(mix(color, adjusted, uMix).rgb, color.a);\n\n}"; + exports["default"] = fragment; + })(colorMap$3); + + var colorMap2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct ColorMapUniforms {\n uMix: f32,\n uSize: f32,\n uSliceSize: f32,\n uSlicePixelSize: f32,\n uSliceInnerSize: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var colorMapUniforms : ColorMapUniforms;\n@group(1) @binding(1) var uMapTexture: texture_2d;\n@group(1) @binding(2) var uMapSampler: sampler;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color:vec4 = textureSample(uTexture, uSampler, uv);\n\n var adjusted: vec4;\n\n var altColor: vec4 = vec4(color.rgb / color.a, color.a);\n let innerWidth: f32 = colorMapUniforms.uSize - 1.0;\n let zSlice0: f32 = min(floor(color.b * innerWidth), innerWidth);\n let zSlice1: f32 = min(zSlice0 + 1.0, innerWidth);\n let xOffset: f32 = colorMapUniforms.uSlicePixelSize * 0.5 + color.r * colorMapUniforms.uSliceInnerSize;\n let s0: f32 = xOffset + (zSlice0 * colorMapUniforms.uSliceSize);\n let s1: f32 = xOffset + (zSlice1 * colorMapUniforms.uSliceSize);\n let yOffset: f32 = colorMapUniforms.uSliceSize * 0.5 + color.g * (1.0 - colorMapUniforms.uSliceSize);\n let slice0Color: vec4 = textureSample(uMapTexture, uMapSampler, vec2(s0,yOffset));\n let slice1Color: vec4 = textureSample(uMapTexture, uMapSampler, vec2(s1,yOffset));\n let zOffset: f32 = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n altColor = vec4(color.rgb * color.a, color.a);\n\n let realColor: vec4 = select(color, altColor, color.a > 0.0);\n\n return vec4(mix(realColor, adjusted, colorMapUniforms.uMix).rgb, realColor.a);\n}"; + exports["default"] = source; + })(colorMap2); + + var __defProp$X = Object.defineProperty; + var __getOwnPropSymbols$o = Object.getOwnPropertySymbols; + var __hasOwnProp$o = Object.prototype.hasOwnProperty; + var __propIsEnum$o = Object.prototype.propertyIsEnumerable; + var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$o = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$o.call(b, prop)) + __defNormalProp$X(a, prop, b[prop]); + if (__getOwnPropSymbols$o) + for (var prop of __getOwnPropSymbols$o(b)) { + if (__propIsEnum$o.call(b, prop)) + __defNormalProp$X(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(ColorMapFilter$2, "__esModule", { value: true }); + var pixi_js$r = require$$0__default["default"]; + var _default$1$r = _default$A; + var _default$s = default2; + var colorMap$1 = colorMap$3; + var colorMap$2 = colorMap2; + var __defProp2$o = Object.defineProperty; + var __defNormalProp2$o = (obj, key, value) => key in obj ? __defProp2$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$X = (obj, key, value) => { + __defNormalProp2$o(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ColorMapFilter$1 = class _ColorMapFilter2 extends pixi_js$r.Filter { + constructor(options) { + options = __spreadValues$o(__spreadValues$o({}, _ColorMapFilter2.DEFAULT_OPTIONS), options); + if (!options.colorMap) + throw Error("No color map texture source was provided to ColorMapFilter"); + const gpuProgram = new pixi_js$r.GpuProgram({ + vertex: { + source: _default$s["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: colorMap$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$r.GlProgram({ + vertex: _default$1$r["default"], + fragment: colorMap$1["default"], + name: "color-map-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + colorMapUniforms: { + uMix: { value: options.mix, type: "f32" }, + uSize: { value: 0, type: "f32" }, + uSliceSize: { value: 0, type: "f32" }, + uSlicePixelSize: { value: 0, type: "f32" }, + uSliceInnerSize: { value: 0, type: "f32" } + }, + uMapTexture: options.colorMap.source, + uMapSampler: options.colorMap.source.style + } + }); + __publicField$X(this, "uniforms"); + __publicField$X(this, "_size", 0); + __publicField$X(this, "_sliceSize", 0); + __publicField$X(this, "_slicePixelSize", 0); + __publicField$X(this, "_sliceInnerSize", 0); + __publicField$X(this, "_nearest", false); + __publicField$X(this, "_scaleMode", "linear"); + __publicField$X(this, "_colorMap"); + this.uniforms = this.resources.colorMapUniforms.uniforms; + Object.assign(this, options); + } + /** The mix from 0 to 1, where 0 is the original image and 1 is the color mapped image. */ + get mix() { + return this.uniforms.uMix; + } + set mix(value) { + this.uniforms.uMix = value; + } + /** + * The size of one color slice. + * @readonly + */ + get colorSize() { + return this._size; + } + /** The colorMap texture. */ + get colorMap() { + return this._colorMap; + } + set colorMap(value) { + if (!value || value === this.colorMap) + return; + const source2 = value instanceof pixi_js$r.Texture ? value.source : value; + source2.style.scaleMode = this._scaleMode; + source2.autoGenerateMipmaps = false; + this._size = source2.height; + this._sliceSize = 1 / this._size; + this._slicePixelSize = this._sliceSize / this._size; + this._sliceInnerSize = this._slicePixelSize * (this._size - 1); + this.uniforms.uSize = this._size; + this.uniforms.uSliceSize = this._sliceSize; + this.uniforms.uSlicePixelSize = this._slicePixelSize; + this.uniforms.uSliceInnerSize = this._sliceInnerSize; + this.resources.uMapTexture = source2; + this._colorMap = value; + } + /** Whether use NEAREST for colorMap texture. */ + get nearest() { + return this._nearest; + } + set nearest(nearest) { + this._nearest = nearest; + this._scaleMode = nearest ? "nearest" : "linear"; + const texture = this._colorMap; + if (texture && texture.source) { + texture.source.scaleMode = this._scaleMode; + texture.source.autoGenerateMipmaps = false; + texture.source.style.update(); + texture.source.update(); + } + } + /** + * If the colorMap is based on canvas, + * and the content of canvas has changed, then call `updateColorMap` for update texture. + */ + updateColorMap() { + const texture = this._colorMap; + if (texture == null ? void 0 : texture.source) { + texture.source.update(); + this.colorMap = texture; + } + } + /** + * Destroys this filter + * @default false + */ + destroy() { + var _a; + (_a = this._colorMap) == null ? void 0 : _a.destroy(); + super.destroy(); + } + }; + __publicField$X(_ColorMapFilter$1, "DEFAULT_OPTIONS", { + colorMap: pixi_js$r.Texture.WHITE, + nearest: false, + mix: 1 + }); + let ColorMapFilter$1 = _ColorMapFilter$1; + ColorMapFilter$2.ColorMapFilter = ColorMapFilter$1; + + var ColorOverlayFilter$2 = {}; + + var colorOverlay$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec3 uColor;\nuniform float uAlpha;\n\nvoid main(void) {\n vec4 c = texture(uTexture, vTextureCoord);\n finalColor = vec4(mix(c.rgb, uColor.rgb, c.a * uAlpha), c.a);\n}\n"; + exports["default"] = fragment; + })(colorOverlay$3); + + var colorOverlay2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct ColorOverlayUniforms {\n uColor: vec3,\n uAlpha: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var colorOverlayUniforms : ColorOverlayUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let c = textureSample(uTexture, uSampler, uv);\n return vec4(mix(c.rgb, colorOverlayUniforms.uColor.rgb, c.a * colorOverlayUniforms.uAlpha), c.a);\n}\n"; + exports["default"] = source; + })(colorOverlay2); + + var __defProp$W = Object.defineProperty; + var __getOwnPropSymbols$n = Object.getOwnPropertySymbols; + var __hasOwnProp$n = Object.prototype.hasOwnProperty; + var __propIsEnum$n = Object.prototype.propertyIsEnumerable; + var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$n = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$n.call(b, prop)) + __defNormalProp$W(a, prop, b[prop]); + if (__getOwnPropSymbols$n) + for (var prop of __getOwnPropSymbols$n(b)) { + if (__propIsEnum$n.call(b, prop)) + __defNormalProp$W(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(ColorOverlayFilter$2, "__esModule", { value: true }); + var pixi_js$q = require$$0__default["default"]; + var _default$1$q = _default$A; + var _default$r = default2; + var colorOverlay$1 = colorOverlay$3; + var colorOverlay$2 = colorOverlay2; + var __defProp2$n = Object.defineProperty; + var __defNormalProp2$n = (obj, key, value) => key in obj ? __defProp2$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$W = (obj, key, value) => { + __defNormalProp2$n(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ColorOverlayFilter$1 = class _ColorOverlayFilter2 extends pixi_js$q.Filter { + constructor(options = {}) { + var _a; + options = __spreadValues$n(__spreadValues$n({}, _ColorOverlayFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$q.GpuProgram({ + vertex: { + source: _default$r["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: colorOverlay$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$q.GlProgram({ + vertex: _default$1$q["default"], + fragment: colorOverlay$1["default"], + name: "color-overlay-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + colorOverlayUniforms: new pixi_js$q.UniformGroup({ + uColor: { value: new Float32Array(3), type: "vec3" }, + uAlpha: { value: options.alpha, type: "f32" } + }) + } + }); + __publicField$W(this, "uniforms"); + __publicField$W(this, "_color"); + this.uniforms = this.resources.colorOverlayUniforms.uniforms; + this._color = new pixi_js$q.Color(); + this.color = (_a = options.color) != null ? _a : 0; + } + /** + * The over color source + * @member {number|Array|Float32Array} + * @default 0x000000 + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * The alpha value of the color + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + }; + __publicField$W(_ColorOverlayFilter$1, "DEFAULT_OPTIONS", { + /** The color of the overlay */ + color: 0, + /** The alpha of the overlay */ + alpha: 1 + }); + let ColorOverlayFilter$1 = _ColorOverlayFilter$1; + ColorOverlayFilter$2.ColorOverlayFilter = ColorOverlayFilter$1; + + var ColorReplaceFilter$2 = {}; + + var colorReplace$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec3 uOriginalColor;\nuniform vec3 uTargetColor;\nuniform float uTolerance;\n\nvoid main(void) {\n vec4 c = texture(uTexture, vTextureCoord);\n vec3 colorDiff = uOriginalColor - (c.rgb / max(c.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, uTolerance);\n finalColor = vec4(mix(c.rgb, (uTargetColor + colorDiff) * c.a, doReplace), c.a);\n}\n"; + exports["default"] = fragment; + })(colorReplace$3); + + var colorReplace2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct ColorReplaceUniforms {\n uOriginalColor: vec3,\n uTargetColor: vec3,\n uTolerance: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var colorReplaceUniforms : ColorReplaceUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let sample: vec4 = textureSample(uTexture, uSampler, uv);\n\n let colorDiff: vec3 = colorReplaceUniforms.uOriginalColor - (sample.rgb / max(sample.a, 0.0000000001));\n let colorDistance: f32 = length(colorDiff);\n let doReplace: f32 = step(colorDistance, colorReplaceUniforms.uTolerance);\n\n return vec4(mix(sample.rgb, (colorReplaceUniforms.uTargetColor + colorDiff) * sample.a, doReplace), sample.a);\n}"; + exports["default"] = source; + })(colorReplace2); + + var __defProp$V = Object.defineProperty; + var __getOwnPropSymbols$m = Object.getOwnPropertySymbols; + var __hasOwnProp$m = Object.prototype.hasOwnProperty; + var __propIsEnum$m = Object.prototype.propertyIsEnumerable; + var __defNormalProp$V = (obj, key, value) => key in obj ? __defProp$V(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$m = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$m.call(b, prop)) + __defNormalProp$V(a, prop, b[prop]); + if (__getOwnPropSymbols$m) + for (var prop of __getOwnPropSymbols$m(b)) { + if (__propIsEnum$m.call(b, prop)) + __defNormalProp$V(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(ColorReplaceFilter$2, "__esModule", { value: true }); + var pixi_js$p = require$$0__default["default"]; + var _default$1$p = _default$A; + var _default$q = default2; + var colorReplace$1 = colorReplace$3; + var colorReplace$2 = colorReplace2; + var __defProp2$m = Object.defineProperty; + var __defNormalProp2$m = (obj, key, value) => key in obj ? __defProp2$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$V = (obj, key, value) => { + __defNormalProp2$m(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ColorReplaceFilter$1 = class _ColorReplaceFilter2 extends pixi_js$p.Filter { + constructor(options) { + var _a, _b; + options = __spreadValues$m(__spreadValues$m({}, _ColorReplaceFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$p.GpuProgram({ + vertex: { + source: _default$q["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: colorReplace$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$p.GlProgram({ + vertex: _default$1$p["default"], + fragment: colorReplace$1["default"], + name: "color-replace-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + colorReplaceUniforms: { + uOriginalColor: { value: new Float32Array(3), type: "vec3" }, + uTargetColor: { value: new Float32Array(3), type: "vec3" }, + uTolerance: { value: options.tolerance, type: "f32" } + } + } + }); + __publicField$V(this, "uniforms"); + __publicField$V(this, "_originalColor"); + __publicField$V(this, "_targetColor"); + this.uniforms = this.resources.colorReplaceUniforms.uniforms; + this._originalColor = new pixi_js$p.Color(); + this._targetColor = new pixi_js$p.Color(); + this.originalColor = (_a = options.originalColor) != null ? _a : 16711680; + this.targetColor = (_b = options.targetColor) != null ? _b : 0; + Object.assign(this, options); + } + /** + * The color that will be changed. + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0xff0000 + */ + get originalColor() { + return this._originalColor.value; + } + set originalColor(value) { + this._originalColor.setValue(value); + const [r, g, b] = this._originalColor.toArray(); + this.uniforms.uOriginalColor[0] = r; + this.uniforms.uOriginalColor[1] = g; + this.uniforms.uOriginalColor[2] = b; + } + /** + * The resulting color. + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0x000000 + */ + get targetColor() { + return this._targetColor.value; + } + set targetColor(value) { + this._targetColor.setValue(value); + const [r, g, b] = this._targetColor.toArray(); + this.uniforms.uTargetColor[0] = r; + this.uniforms.uTargetColor[1] = g; + this.uniforms.uTargetColor[2] = b; + } + /** + * Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive) + * @default 0.4 + */ + get tolerance() { + return this.uniforms.uTolerance; + } + set tolerance(value) { + this.uniforms.uTolerance = value; + } + }; + __publicField$V(_ColorReplaceFilter$1, "DEFAULT_OPTIONS", { + originalColor: 16711680, + targetColor: 0, + tolerance: 0.4 + }); + let ColorReplaceFilter$1 = _ColorReplaceFilter$1; + ColorReplaceFilter$2.ColorReplaceFilter = ColorReplaceFilter$1; + + var ConvolutionFilter$2 = {}; + + var convolution2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uTexelSize;\nuniform float uMatrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture(uTexture, vTextureCoord - uTexelSize); // top left\n vec4 c12 = texture(uTexture, vec2(vTextureCoord.x, vTextureCoord.y - uTexelSize.y)); // top center\n vec4 c13 = texture(uTexture, vec2(vTextureCoord.x + uTexelSize.x, vTextureCoord.y - uTexelSize.y)); // top right\n\n vec4 c21 = texture(uTexture, vec2(vTextureCoord.x - uTexelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture(uTexture, vTextureCoord); // mid center\n vec4 c23 = texture(uTexture, vec2(vTextureCoord.x + uTexelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture(uTexture, vec2(vTextureCoord.x - uTexelSize.x, vTextureCoord.y + uTexelSize.y)); // bottom left\n vec4 c32 = texture(uTexture, vec2(vTextureCoord.x, vTextureCoord.y + uTexelSize.y)); // bottom center\n vec4 c33 = texture(uTexture, vTextureCoord + uTexelSize); // bottom right\n\n finalColor =\n c11 * uMatrix[0] + c12 * uMatrix[1] + c13 * uMatrix[2] +\n c21 * uMatrix[3] + c22 * uMatrix[4] + c23 * uMatrix[5] +\n c31 * uMatrix[6] + c32 * uMatrix[7] + c33 * uMatrix[8];\n\n finalColor.a = c22.a;\n}\n"; + exports["default"] = fragment; + })(convolution2); + + var convolution$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct ConvolutionUniforms {\n uMatrix: array, 3>,\n uTexelSize: vec2,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var convolutionUniforms : ConvolutionUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let texelSize = convolutionUniforms.uTexelSize;\n let matrix = convolutionUniforms.uMatrix;\n\n let c11: vec4 = textureSample(uTexture, uSampler, uv - texelSize); // top left\n let c12: vec4 = textureSample(uTexture, uSampler, vec2(uv.x, uv.y - texelSize.y)); // top center\n let c13: vec4 = textureSample(uTexture, uSampler, vec2(uv.x + texelSize.x, uv.y - texelSize.y)); // top right\n\n let c21: vec4 = textureSample(uTexture, uSampler, vec2(uv.x - texelSize.x, uv.y)); // mid left\n let c22: vec4 = textureSample(uTexture, uSampler, uv); // mid center\n let c23: vec4 = textureSample(uTexture, uSampler, vec2(uv.x + texelSize.x, uv.y)); // mid right\n\n let c31: vec4 = textureSample(uTexture, uSampler, vec2(uv.x - texelSize.x, uv.y + texelSize.y)); // bottom left\n let c32: vec4 = textureSample(uTexture, uSampler, vec2(uv.x, uv.y + texelSize.y)); // bottom center\n let c33: vec4 = textureSample(uTexture, uSampler, uv + texelSize); // bottom right\n\n var finalColor: vec4 = vec4(\n c11 * matrix[0][0] + c12 * matrix[0][1] + c13 * matrix[0][2] +\n c21 * matrix[1][0] + c22 * matrix[1][1] + c23 * matrix[1][2] +\n c31 * matrix[2][0] + c32 * matrix[2][1] + c33 * matrix[2][2]\n );\n\n finalColor.a = c22.a;\n\n return finalColor;\n}"; + exports["default"] = source; + })(convolution$3); + + var __defProp$U = Object.defineProperty; + var __getOwnPropSymbols$l = Object.getOwnPropertySymbols; + var __hasOwnProp$l = Object.prototype.hasOwnProperty; + var __propIsEnum$l = Object.prototype.propertyIsEnumerable; + var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$l = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$l.call(b, prop)) + __defNormalProp$U(a, prop, b[prop]); + if (__getOwnPropSymbols$l) + for (var prop of __getOwnPropSymbols$l(b)) { + if (__propIsEnum$l.call(b, prop)) + __defNormalProp$U(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(ConvolutionFilter$2, "__esModule", { value: true }); + var pixi_js$o = require$$0__default["default"]; + var _default$1$o = _default$A; + var _default$p = default2; + var convolution$1 = convolution2; + var convolution$2 = convolution$3; + var __defProp2$l = Object.defineProperty; + var __defNormalProp2$l = (obj, key, value) => key in obj ? __defProp2$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$U = (obj, key, value) => { + __defNormalProp2$l(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ConvolutionFilter$1 = class _ConvolutionFilter2 extends pixi_js$o.Filter { + constructor(options) { + var _a, _b; + options = __spreadValues$l(__spreadValues$l({}, _ConvolutionFilter2.DEFAULT_OPTIONS), options); + const width = (_a = options.width) != null ? _a : 200; + const height = (_b = options.height) != null ? _b : 200; + const gpuProgram = new pixi_js$o.GpuProgram({ + vertex: { + source: _default$p["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: convolution$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$o.GlProgram({ + vertex: _default$1$o["default"], + fragment: convolution$1["default"], + name: "convolution-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + convolutionUniforms: { + uMatrix: { value: options.matrix, type: "vec3", size: 3 }, + uTexelSize: { value: [1 / width, 1 / height], type: "vec2" } + } + } + }); + __publicField$U(this, "uniforms"); + this.uniforms = this.resources.convolutionUniforms.uniforms; + this.width = width; + this.height = height; + } + /** + * An array of values used for matrix transformation, specified as a 9 point Array + * @example + * const matrix = new Float32Array(9); // 9 elements of value 0 + * const matrix = [0,0.5,0,0.5,1,0.5,0,0.5,0]; + * @default [0,0,0,0,0,0,0,0,0] + */ + get matrix() { + return this.uniforms.uMatrix; + } + set matrix(matrix) { + matrix.forEach((v, i) => { + this.uniforms.uMatrix[i] = v; + }); + } + /** + * Width of the object you are transforming + * @default 200 + */ + get width() { + return 1 / this.uniforms.uTexelSize[0]; + } + set width(value) { + this.uniforms.uTexelSize[0] = 1 / value; + } + /** + * Height of the object you are transforming + * @default 200 + */ + get height() { + return 1 / this.uniforms.uTexelSize[1]; + } + set height(value) { + this.uniforms.uTexelSize[1] = 1 / value; + } + }; + __publicField$U(_ConvolutionFilter$1, "DEFAULT_OPTIONS", { + matrix: new Float32Array(9), + width: 200, + height: 200 + }); + let ConvolutionFilter$1 = _ConvolutionFilter$1; + ConvolutionFilter$2.ConvolutionFilter = ConvolutionFilter$1; + + var CrossHatchFilter$2 = {}; + + var crosshatch2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\n\nvoid main(void)\n{\n float lum = length(texture(uTexture, vTextureCoord.xy).rgb);\n\n finalColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n finalColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n finalColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n finalColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n finalColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n"; + exports["default"] = fragment; + })(crosshatch2); + + var crosshatch$2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let lum: f32 = length(textureSample(uTexture, uSampler, uv).rgb);\n\n if (lum < 1.00)\n {\n if (modulo(position.x + position.y, 10.0) == 0.0)\n {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (modulo(position.x - position.y, 10.0) == 0.0)\n {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (modulo(position.x + position.y - 5.0, 10.0) == 0.0)\n {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (modulo(position.x - position.y - 5.0, 10.0) == 0.0)\n {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n return vec4(1.0);\n}\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}"; + exports["default"] = source; + })(crosshatch$2); + + Object.defineProperty(CrossHatchFilter$2, "__esModule", { value: true }); + var pixi_js$n = require$$0__default["default"]; + var _default$1$n = _default$A; + var _default$o = default2; + var crosshatch$1 = crosshatch2; + var crosshatch = crosshatch$2; + class CrossHatchFilter$1 extends pixi_js$n.Filter { + constructor() { + const gpuProgram = new pixi_js$n.GpuProgram({ + vertex: { + source: _default$o["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: crosshatch["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$n.GlProgram({ + vertex: _default$1$n["default"], + fragment: crosshatch$1["default"], + name: "cross-hatch-filter" + }); + super({ + gpuProgram, + glProgram, + resources: {} + }); + } + } + CrossHatchFilter$2.CrossHatchFilter = CrossHatchFilter$1; + + var CRTFilter$2 = {}; + + var crt$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec4 uLine;\nuniform vec2 uNoise;\nuniform vec3 uVignette;\nuniform float uSeed;\nuniform float uTime;\nuniform vec2 uDimensions;\n\nuniform vec4 uInputSize;\n\nconst float SQRT_2 = 1.414213;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nfloat vignette(vec3 co, vec2 coord)\n{\n float outter = SQRT_2 - uVignette[0] * SQRT_2;\n vec2 dir = vec2(0.5) - coord;\n dir.y *= uDimensions.y / uDimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + uVignette[2] * SQRT_2), 0.0, 1.0);\n return darker + (1.0 - darker) * (1.0 - uVignette[1]);\n}\n\nfloat noise(vec2 coord)\n{\n vec2 pixelCoord = coord * uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / uNoise[1]);\n pixelCoord.y = floor(pixelCoord.y / uNoise[1]);\n return (rand(pixelCoord * uNoise[1] * uSeed) - 0.5) * uNoise[0];\n}\n\nvec3 interlaceLines(vec3 co, vec2 coord)\n{\n vec3 color = co;\n\n float curvature = uLine[0];\n float lineWidth = uLine[1];\n float lineContrast = uLine[2];\n float verticalLine = uLine[3];\n\n vec2 dir = vec2(coord * uInputSize.xy / uDimensions - 0.5);\n\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ? (length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n float v = verticalLine > 0.5 ? uv.x * uDimensions.x : uv.y * uDimensions.y;\n v *= min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - uTime) * 0.5 * lineContrast;\n color *= j;\n\n float segment = verticalLine > 0.5 ? mod((dir.x + .5) * uDimensions.x, 4.) : mod((dir.y + .5) * uDimensions.y, 4.);\n color *= 0.99 + ceil(segment) * 0.015;\n\n return color;\n}\n\nvoid main(void)\n{\n finalColor = texture(uTexture, vTextureCoord);\n vec2 coord = vTextureCoord * uInputSize.xy / uDimensions;\n\n if (uNoise[0] > 0.0 && uNoise[1] > 0.0)\n {\n float n = noise(vTextureCoord);\n finalColor += vec4(n, n, n, finalColor.a);\n }\n\n if (uVignette[0] > 0.)\n {\n float v = vignette(finalColor.rgb, coord);\n finalColor *= vec4(v, v, v, finalColor.a);\n }\n\n if (uLine[1] > 0.0)\n {\n finalColor = vec4(interlaceLines(finalColor.rgb, vTextureCoord), finalColor.a); \n }\n}\n"; + exports["default"] = fragment; + })(crt$3); + + var crt2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct CRTUniforms {\n uLine: vec4,\n uNoise: vec2,\n uVignette: vec3,\n uSeed: f32,\n uTime: f32,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var crtUniforms : CRTUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n \n var color: vec4 = textureSample(uTexture, uSampler, uv);\n let coord: vec2 = uv * gfu.uInputSize.xy / crtUniforms.uDimensions;\n\n let uNoise = crtUniforms.uNoise;\n\n if (uNoise[0] > 0.0 && uNoise[1] > 0.0)\n {\n color += vec4(vec3(noise(uv)), color.a);\n }\n\n if (crtUniforms.uVignette[0] > 0.)\n {\n color *= vec4(vec3(vignette(color.rgb, coord)), color.a);\n }\n\n if (crtUniforms.uLine[1] > 0.0)\n {\n color = vec4(vec3(interlaceLines(color.rgb, uv)), color.a); \n }\n\n return color;\n}\n\nconst SQRT_2: f32 = 1.414213;\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}\n\nfn rand(co: vec2) -> f32\n{\n return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nfn vignette(co: vec3, coord: vec2) -> f32\n{\n let uVignette = crtUniforms.uVignette;\n let uDimensions = crtUniforms.uDimensions;\n \n let outter: f32 = SQRT_2 - uVignette[0] * SQRT_2;\n var dir: vec2 = vec2(0.5) - coord;\n dir.y *= uDimensions.y / uDimensions.x;\n let darker: f32 = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + uVignette[2] * SQRT_2), 0.0, 1.0);\n return darker + (1.0 - darker) * (1.0 - uVignette[1]);\n}\n\nfn noise(coord: vec2) -> f32\n{\n let uNoise = crtUniforms.uNoise;\n let uSeed = crtUniforms.uSeed;\n\n var pixelCoord: vec2 = coord * gfu.uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / uNoise[1]);\n pixelCoord.y = floor(pixelCoord.y / uNoise[1]);\n return (rand(pixelCoord * uNoise[1] * uSeed) - 0.5) * uNoise[0];\n}\n\nfn interlaceLines(co: vec3, coord: vec2) -> vec3\n{\n var color = co;\n\n let uDimensions = crtUniforms.uDimensions;\n\n let curvature: f32 = crtUniforms.uLine[0];\n let lineWidth: f32 = crtUniforms.uLine[1];\n let lineContrast: f32 = crtUniforms.uLine[2];\n let verticalLine: f32 = crtUniforms.uLine[3];\n\n let dir: vec2 = vec2(coord * gfu.uInputSize.xy / uDimensions - 0.5);\n\n let _c: f32 = select(1., curvature, curvature > 0.);\n let k: f32 = select(1., (length(dir * dir) * 0.25 * _c * _c + 0.935 * _c), curvature > 0.);\n let uv: vec2 = dir * k;\n let v: f32 = select(uv.y * uDimensions.y, uv.x * uDimensions.x, verticalLine > 0.5) * min(1.0, 2.0 / lineWidth ) / _c;\n let j: f32 = 1. + cos(v * 1.2 - crtUniforms.uTime) * 0.5 * lineContrast;\n color *= j;\n\n let segment: f32 = select(modulo((dir.y + .5) * uDimensions.y, 4.), modulo((dir.x + .5) * uDimensions.x, 4.), verticalLine > 0.5);\n color *= 0.99 + ceil(segment) * 0.015;\n\n return color;\n}"; + exports["default"] = source; + })(crt2); + + var __defProp$T = Object.defineProperty; + var __getOwnPropSymbols$k = Object.getOwnPropertySymbols; + var __hasOwnProp$k = Object.prototype.hasOwnProperty; + var __propIsEnum$k = Object.prototype.propertyIsEnumerable; + var __defNormalProp$T = (obj, key, value) => key in obj ? __defProp$T(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$k = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$k.call(b, prop)) + __defNormalProp$T(a, prop, b[prop]); + if (__getOwnPropSymbols$k) + for (var prop of __getOwnPropSymbols$k(b)) { + if (__propIsEnum$k.call(b, prop)) + __defNormalProp$T(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(CRTFilter$2, "__esModule", { value: true }); + var pixi_js$m = require$$0__default["default"]; + var _default$1$m = _default$A; + var _default$n = default2; + var crt$1 = crt$3; + var crt$2 = crt2; + var __defProp2$k = Object.defineProperty; + var __defNormalProp2$k = (obj, key, value) => key in obj ? __defProp2$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$T = (obj, key, value) => { + __defNormalProp2$k(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _CRTFilter$1 = class _CRTFilter2 extends pixi_js$m.Filter { + constructor(options) { + options = __spreadValues$k(__spreadValues$k({}, _CRTFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$m.GpuProgram({ + vertex: { + source: _default$n["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: crt$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$m.GlProgram({ + vertex: _default$1$m["default"], + fragment: crt$1["default"], + name: "crt-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + crtUniforms: { + uLine: { value: new Float32Array(4), type: "vec4" }, + uNoise: { value: new Float32Array(2), type: "vec2" }, + uVignette: { value: new Float32Array(3), type: "vec3" }, + uSeed: { value: options.seed, type: "f32" }, + uTime: { value: options.time, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$T(this, "uniforms"); + __publicField$T(this, "seed"); + __publicField$T(this, "time"); + this.uniforms = this.resources.crtUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + this.uniforms.uSeed = this.seed; + this.uniforms.uTime = this.time; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * Bend of interlaced lines, higher value means more bend + * @default 1 + */ + get curvature() { + return this.uniforms.uLine[0]; + } + set curvature(value) { + this.uniforms.uLine[0] = value; + } + /** + * Width of interlaced lines + * @default 1 + */ + get lineWidth() { + return this.uniforms.uLine[1]; + } + set lineWidth(value) { + this.uniforms.uLine[1] = value; + } + /** + * Contrast of interlaced lines + * @default 0.25 + */ + get lineContrast() { + return this.uniforms.uLine[2]; + } + set lineContrast(value) { + this.uniforms.uLine[2] = value; + } + /** + * The orientation of the line: + * + * `true` create vertical lines, `false` creates horizontal lines + * @default false + */ + get verticalLine() { + return this.uniforms.uLine[3] > 0.5; + } + set verticalLine(value) { + this.uniforms.uLine[3] = value ? 1 : 0; + } + /** + * Opacity/intensity of the noise effect between `0` and `1` + * @default 0.3 + */ + get noise() { + return this.uniforms.uNoise[0]; + } + set noise(value) { + this.uniforms.uNoise[0] = value; + } + /** + * The size of the noise particles + * @default 0 + */ + get noiseSize() { + return this.uniforms.uNoise[1]; + } + set noiseSize(value) { + this.uniforms.uNoise[1] = value; + } + /** + * The radius of the vignette effect, smaller values produces a smaller vignette + * @default 0.3 + */ + get vignetting() { + return this.uniforms.uVignette[0]; + } + set vignetting(value) { + this.uniforms.uVignette[0] = value; + } + /** + * Amount of opacity of vignette + * @default 1 + */ + get vignettingAlpha() { + return this.uniforms.uVignette[1]; + } + set vignettingAlpha(value) { + this.uniforms.uVignette[1] = value; + } + /** + * Blur intensity of the vignette + * @default 0.3 + */ + get vignettingBlur() { + return this.uniforms.uVignette[2]; + } + set vignettingBlur(value) { + this.uniforms.uVignette[2] = value; + } + }; + __publicField$T(_CRTFilter$1, "DEFAULT_OPTIONS", { + curvature: 1, + lineWidth: 1, + lineContrast: 0.25, + verticalLine: false, + noise: 0, + noiseSize: 1, + vignetting: 0.3, + vignettingAlpha: 1, + vignettingBlur: 0.3, + time: 0, + seed: 0 + }); + let CRTFilter$1 = _CRTFilter$1; + CRTFilter$2.CRTFilter = CRTFilter$1; + + var DotFilter$2 = {}; + + var dot$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uAngle;\nuniform float uScale;\nuniform bool uGrayScale;\n\nuniform vec4 uInputSize;\n\nfloat pattern()\n{\n float s = sin(uAngle), c = cos(uAngle);\n vec2 tex = vTextureCoord * uInputSize.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * uScale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n }\n\n void main()\n {\n vec4 color = texture(uTexture, vTextureCoord);\n vec3 colorRGB = vec3(color);\n\n if (uGrayScale)\n {\n colorRGB = vec3(color.r + color.g + color.b) / 3.0;\n }\n\n finalColor = vec4(colorRGB * 10.0 - 5.0 + pattern(), color.a);\n}\n"; + exports["default"] = fragment; + })(dot$3); + + var dot2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct DotUniforms {\n uScale:f32,\n uAngle:f32,\n uGrayScale:f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var dotUniforms : DotUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let color: vec4 = textureSample(uTexture, uSampler, uv);\n let gray: vec3 = vec3(dot(color.rgb, vec3(0.299, 0.587, 0.114)));\n // dotUniforms.uGrayScale == 1 doesn't ever pass so it is converted to a float and compared to 0.5 instead \n let finalColor: vec3 = select(color.rgb, gray, f32(dotUniforms.uGrayScale) >= 0.5);\n\n return vec4(finalColor * 10.0 - 5.0 + pattern(uv), color.a);\n}\n\nfn pattern(uv: vec2) -> f32\n{\n let s: f32 = sin(dotUniforms.uAngle);\n let c: f32 = cos(dotUniforms.uAngle);\n \n let tex: vec2 = uv * gfu.uInputSize.xy;\n \n let p: vec2 = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * dotUniforms.uScale;\n\n return (sin(p.x) * sin(p.y)) * 4.0;\n}"; + exports["default"] = source; + })(dot2); + + var __defProp$S = Object.defineProperty; + var __getOwnPropSymbols$j = Object.getOwnPropertySymbols; + var __hasOwnProp$j = Object.prototype.hasOwnProperty; + var __propIsEnum$j = Object.prototype.propertyIsEnumerable; + var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$j = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$j.call(b, prop)) + __defNormalProp$S(a, prop, b[prop]); + if (__getOwnPropSymbols$j) + for (var prop of __getOwnPropSymbols$j(b)) { + if (__propIsEnum$j.call(b, prop)) + __defNormalProp$S(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(DotFilter$2, "__esModule", { value: true }); + var pixi_js$l = require$$0__default["default"]; + var _default$1$l = _default$A; + var _default$m = default2; + var dot$1 = dot$3; + var dot$2 = dot2; + var __defProp2$j = Object.defineProperty; + var __defNormalProp2$j = (obj, key, value) => key in obj ? __defProp2$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$S = (obj, key, value) => { + __defNormalProp2$j(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _DotFilter$1 = class _DotFilter2 extends pixi_js$l.Filter { + constructor(options) { + options = __spreadValues$j(__spreadValues$j({}, _DotFilter2.DEFAULT_OPTIONS), options); + const dotUniforms = { + uScale: { value: options.scale, type: "f32" }, + uAngle: { value: options.angle, type: "f32" }, + uGrayScale: { value: options.grayscale ? 1 : 0, type: "f32" } + }; + const gpuProgram = new pixi_js$l.GpuProgram({ + vertex: { + source: _default$m["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: dot$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$l.GlProgram({ + vertex: _default$1$l["default"], + fragment: dot$1["default"], + name: "dot-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + dotUniforms + } + }); + } + /** + * The scale of the effect. + * @default 1 + */ + get scale() { + return this.resources.dotUniforms.uniforms.uScale; + } + set scale(value) { + this.resources.dotUniforms.uniforms.uScale = value; + } + /** + * The radius of the effect. + * @default 5 + */ + get angle() { + return this.resources.dotUniforms.uniforms.uAngle; + } + set angle(value) { + this.resources.dotUniforms.uniforms.uAngle = value; + } + /** + * Whether to rendering it in gray scale. + * @default true + */ + get grayscale() { + return this.resources.dotUniforms.uniforms.uGrayScale === 1; + } + set grayscale(value) { + this.resources.dotUniforms.uniforms.uGrayScale = value ? 1 : 0; + } + }; + __publicField$S(_DotFilter$1, "DEFAULT_OPTIONS", { + scale: 1, + angle: 5, + grayscale: true + }); + let DotFilter$1 = _DotFilter$1; + DotFilter$2.DotFilter = DotFilter$1; + + var DropShadowFilter$2 = {}; + + var dropShadow$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uAlpha;\nuniform vec3 uColor;\nuniform vec2 uOffset;\n\nuniform vec4 uInputSize;\n\nvoid main(void){\n vec4 sample = texture(uTexture, vTextureCoord - uOffset * uInputSize.zw);\n\n // Premultiply alpha\n sample.rgb = uColor.rgb * sample.a;\n\n // alpha user alpha\n sample *= uAlpha;\n\n finalColor = sample;\n}"; + exports["default"] = fragment; + })(dropShadow$3); + + var dropShadow2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct DropShadowUniforms {\n uAlpha: f32,\n uColor: vec3,\n uOffset: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var dropShadowUniforms : DropShadowUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color: vec4 = textureSample(uTexture, uSampler, uv - dropShadowUniforms.uOffset * gfu.uInputSize.zw);\n\n // Premultiply alpha\n color = vec4(vec3(dropShadowUniforms.uColor.rgb * color.a), color.a);\n // alpha user alpha\n color *= dropShadowUniforms.uAlpha;\n\n return color;\n}"; + exports["default"] = source; + })(dropShadow2); + + var __defProp$R = Object.defineProperty; + var __getOwnPropSymbols$i = Object.getOwnPropertySymbols; + var __hasOwnProp$i = Object.prototype.hasOwnProperty; + var __propIsEnum$i = Object.prototype.propertyIsEnumerable; + var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$i = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$i.call(b, prop)) + __defNormalProp$R(a, prop, b[prop]); + if (__getOwnPropSymbols$i) + for (var prop of __getOwnPropSymbols$i(b)) { + if (__propIsEnum$i.call(b, prop)) + __defNormalProp$R(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(DropShadowFilter$2, "__esModule", { value: true }); + var pixi_js$k = require$$0__default["default"]; + var _default$1$k = _default$A; + var _default$l = default2; + var KawaseBlurFilter$2 = KawaseBlurFilter$5; + var dropShadow$1 = dropShadow$3; + var dropShadow$2 = dropShadow2; + var __defProp2$i = Object.defineProperty; + var __defNormalProp2$i = (obj, key, value) => key in obj ? __defProp2$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$R = (obj, key, value) => { + __defNormalProp2$i(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _DropShadowFilter$1 = class _DropShadowFilter2 extends pixi_js$k.Filter { + constructor(options) { + var _a, _b; + options = __spreadValues$i(__spreadValues$i({}, _DropShadowFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$k.GpuProgram({ + vertex: { + source: _default$l["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: dropShadow$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$k.GlProgram({ + vertex: _default$1$k["default"], + fragment: dropShadow$1["default"], + name: "drop-shadow-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + dropShadowUniforms: { + uAlpha: { value: options.alpha, type: "f32" }, + uColor: { value: new Float32Array(3), type: "vec3" }, + uOffset: { value: options.offset, type: "vec2" } + } + } + }); + __publicField$R(this, "uniforms"); + __publicField$R(this, "shadowOnly", false); + __publicField$R(this, "_color"); + __publicField$R(this, "_blurFilter"); + __publicField$R(this, "_basePass"); + this.uniforms = this.resources.dropShadowUniforms.uniforms; + this._color = new pixi_js$k.Color(); + this.color = (_a = options.color) != null ? _a : 0; + this._blurFilter = new KawaseBlurFilter$2.KawaseBlurFilter({ + strength: (_b = options.kernels) != null ? _b : options.blur, + quality: options.kernels ? void 0 : options.quality + }); + this._basePass = new pixi_js$k.Filter({ + gpuProgram: new pixi_js$k.GpuProgram({ + vertex: { + source: _default$l["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: ` + @group(0) @binding(1) var uTexture: texture_2d; + @group(0) @binding(2) var uSampler: sampler; + @fragment + fn mainFragment( + @builtin(position) position: vec4, + @location(0) uv : vec2 + ) -> @location(0) vec4 { + return textureSample(uTexture, uSampler, uv); + } + `, + entryPoint: "mainFragment" + } + }), + glProgram: new pixi_js$k.GlProgram({ + vertex: _default$1$k["default"], + fragment: ` + in vec2 vTextureCoord; + out vec4 finalColor; + uniform sampler2D uTexture; + + void main(void){ + finalColor = texture(uTexture, vTextureCoord); + } + `, + name: "drop-shadow-filter" + }), + resources: {} + }); + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + const renderTarget = pixi_js$k.TexturePool.getSameSizeTexture(input); + filterManager.applyFilter(this, input, renderTarget, true); + this._blurFilter.apply(filterManager, renderTarget, output, clearMode); + if (!this.shadowOnly) { + filterManager.applyFilter(this._basePass, input, output, false); + } + pixi_js$k.TexturePool.returnTexture(renderTarget); + } + /** + * Set the offset position of the drop-shadow relative to the original image. + * @default [4,4] + */ + get offset() { + return this.uniforms.uOffset; + } + set offset(value) { + this.uniforms.uOffset = value; + this._updatePadding(); + } + /** + * Set the offset position of the drop-shadow relative to the original image on the `x` axis + * @default 4 + */ + get offsetX() { + return this.offset.x; + } + set offsetX(value) { + this.offset.x = value; + this._updatePadding(); + } + /** + * Set the offset position of the drop-shadow relative to the original image on the `y` axis + * @default 4 + */ + get offsetY() { + return this.offset.y; + } + set offsetY(value) { + this.offset.y = value; + this._updatePadding(); + } + /** + * The color value of shadow. + * @example [0.0, 0.0, 0.0] = 0x000000 + * @default 0x000000 + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * Coefficient for alpha multiplication + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + /** + * The strength of the shadow's blur. + * @default 2 + */ + get blur() { + return this._blurFilter.strength; + } + set blur(value) { + this._blurFilter.strength = value; + this._updatePadding(); + } + /** + * Sets the quality of the Blur Filter + * @default 4 + */ + get quality() { + return this._blurFilter.quality; + } + set quality(value) { + this._blurFilter.quality = value; + this._updatePadding(); + } + /** Sets the kernels of the Blur Filter */ + get kernels() { + return this._blurFilter.kernels; + } + set kernels(value) { + this._blurFilter.kernels = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter + * @default [1,1] + */ + get pixelSize() { + return this._blurFilter.pixelSize; + } + set pixelSize(value) { + this._blurFilter.pixelSize = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter on the `x` axis + * @default 1 + */ + get pixelSizeX() { + return this._blurFilter.pixelSizeX; + } + set pixelSizeX(value) { + this._blurFilter.pixelSizeX = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter on the `y` axis + * @default 1 + */ + get pixelSizeY() { + return this._blurFilter.pixelSizeY; + } + set pixelSizeY(value) { + this._blurFilter.pixelSizeY = value; + } + /** + * Recalculate the proper padding amount. + * @private + */ + _updatePadding() { + const offsetPadding = Math.max( + Math.abs(this.offsetX), + Math.abs(this.offsetY) + ); + this.padding = offsetPadding + this.blur * 2 + this.quality * 4; + } + }; + __publicField$R(_DropShadowFilter$1, "DEFAULT_OPTIONS", { + offset: { x: 4, y: 4 }, + color: 0, + alpha: 0.5, + shadowOnly: false, + kernels: void 0, + blur: 2, + quality: 3, + pixelSize: { x: 1, y: 1 } + }); + let DropShadowFilter$1 = _DropShadowFilter$1; + DropShadowFilter$2.DropShadowFilter = DropShadowFilter$1; + + var EmbossFilter$2 = {}; + + var emboss$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uStrength;\n\nuniform vec4 uInputSize;\n\nvoid main(void)\n{\n vec2 onePixel = vec2(1.0 / uInputSize);\n\n vec4 color;\n\n color.rgb = vec3(0.5);\n\n color -= texture(uTexture, vTextureCoord - onePixel) * uStrength;\n color += texture(uTexture, vTextureCoord + onePixel) * uStrength;\n\n color.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n float alpha = texture(uTexture, vTextureCoord).a;\n\n finalColor = vec4(color.rgb * alpha, alpha);\n}\n"; + exports["default"] = fragment; + })(emboss$3); + + var emboss2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct EmbossUniforms {\n uStrength:f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var embossUniforms : EmbossUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let onePixel: vec2 = vec2(1.0 / gfu.uInputSize.xy);\n var color: vec3 = vec3(0.5);\n\n color -= (textureSample(uTexture, uSampler, uv - onePixel) * embossUniforms.uStrength).rgb;\n color += (textureSample(uTexture, uSampler, uv + onePixel) * embossUniforms.uStrength).rgb;\n\n color = vec3((color.r + color.g + color.b) / 3.0);\n\n let blendColor: vec4 = textureSample(uTexture, uSampler, uv);\n\n return vec4(color.rgb * blendColor.a, blendColor.a);\n}"; + exports["default"] = source; + })(emboss2); + + var __defProp$Q = Object.defineProperty; + var __getOwnPropSymbols$h = Object.getOwnPropertySymbols; + var __hasOwnProp$h = Object.prototype.hasOwnProperty; + var __propIsEnum$h = Object.prototype.propertyIsEnumerable; + var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$h = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$h.call(b, prop)) + __defNormalProp$Q(a, prop, b[prop]); + if (__getOwnPropSymbols$h) + for (var prop of __getOwnPropSymbols$h(b)) { + if (__propIsEnum$h.call(b, prop)) + __defNormalProp$Q(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(EmbossFilter$2, "__esModule", { value: true }); + var pixi_js$j = require$$0__default["default"]; + var _default$1$j = _default$A; + var _default$k = default2; + var emboss$1 = emboss$3; + var emboss$2 = emboss2; + var __defProp2$h = Object.defineProperty; + var __defNormalProp2$h = (obj, key, value) => key in obj ? __defProp2$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$Q = (obj, key, value) => { + __defNormalProp2$h(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _EmbossFilter$1 = class _EmbossFilter2 extends pixi_js$j.Filter { + constructor(options) { + options = __spreadValues$h(__spreadValues$h({}, _EmbossFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$j.GpuProgram({ + vertex: { + source: _default$k["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: emboss$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$j.GlProgram({ + vertex: _default$1$j["default"], + fragment: emboss$1["default"], + name: "emboss-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + embossUniforms: { + uStrength: { value: options.strength, type: "f32" } + } + } + }); + __publicField$Q(this, "uniforms"); + this.uniforms = this.resources.embossUniforms.uniforms; + } + /** + * Strength of the emboss + * @default 5 + */ + get strength() { + return this.uniforms.uStrength; + } + set strength(value) { + this.uniforms.uStrength = value; + } + }; + __publicField$Q(_EmbossFilter$1, "DEFAULT_OPTIONS", { + strength: 5 + }); + let EmbossFilter$1 = _EmbossFilter$1; + EmbossFilter$2.EmbossFilter = EmbossFilter$1; + + var GlitchFilter$2 = {}; + + var glitch2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uDisplacementMap;\nuniform float uSeed;\nuniform vec2 uDimensions;\nuniform float uAspect;\nuniform float uFillMode;\nuniform float uOffset;\nuniform float uDirection;\nuniform vec2 uRed;\nuniform vec2 uGreen;\nuniform vec2 uBlue;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * uInputSize.xy) / uDimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float sinDir = sin(uDirection);\n float cosDir = cos(uDirection);\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * uAspect;\n float ny = (-sinDir * cx + cosDir * cy) / uAspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture(uDisplacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (uOffset / uInputSize.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * uAspect);\n\n int fillMode = int(uFillMode);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n } else {\n if( coord.x > uInputClamp.z ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x -= uInputClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = uInputClamp.z * 2.0 - coord.x;\n }\n } else if( coord.x < uInputClamp.x ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x += uInputClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -uInputClamp.z;\n }\n }\n\n if( coord.y > uInputClamp.w ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y -= uInputClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = uInputClamp.w * 2.0 - coord.y;\n }\n } else if( coord.y < uInputClamp.y ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y += uInputClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -uInputClamp.w;\n }\n }\n }\n\n finalColor.r = texture(uTexture, coord + uRed * (1.0 - uSeed * 0.4) / uInputSize.xy).r;\n finalColor.g = texture(uTexture, coord + uGreen * (1.0 - uSeed * 0.3) / uInputSize.xy).g;\n finalColor.b = texture(uTexture, coord + uBlue * (1.0 - uSeed * 0.2) / uInputSize.xy).b;\n finalColor.a = texture(uTexture, coord).a;\n}\n"; + exports["default"] = fragment; + })(glitch2); + + var glitch$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct GlitchUniforms {\n uSeed: f32,\n uDimensions: vec2,\n uAspect: f32,\n uFillMode: f32,\n uOffset: f32,\n uDirection: f32,\n uRed: vec2,\n uGreen: vec2,\n uBlue: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var glitchUniforms : GlitchUniforms;\n@group(1) @binding(1) var uDisplacementMap: texture_2d; \n@group(1) @binding(2) var uDisplacementSampler: sampler; \n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uSeed: f32 = glitchUniforms.uSeed;\n let uDimensions: vec2 = glitchUniforms.uDimensions;\n let uAspect: f32 = glitchUniforms.uAspect;\n let uOffset: f32 = glitchUniforms.uOffset;\n let uDirection: f32 = glitchUniforms.uDirection;\n let uRed: vec2 = glitchUniforms.uRed;\n let uGreen: vec2 = glitchUniforms.uGreen;\n let uBlue: vec2 = glitchUniforms.uBlue;\n\n let uInputSize: vec4 = gfu.uInputSize;\n let uInputClamp: vec4 = gfu.uInputClamp;\n\n var discarded: bool = false;\n var coord: vec2 = (uv * uInputSize.xy) / uDimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n discarded = true;\n }\n\n let sinDir: f32 = sin(uDirection);\n let cosDir: f32 = cos(uDirection);\n\n let cx: f32 = coord.x - 0.5;\n let cy: f32 = (coord.y - 0.5) * uAspect;\n var ny: f32 = (-sinDir * cx + cosDir * cy) / uAspect + 0.5;\n\n ny = select(select(ny, -ny, ny < 0.0), 2.0 - ny, ny > 1.0);\n\n let dc: vec4 = textureSample(uDisplacementMap, uDisplacementSampler, vec2(0.5, ny));\n\n let displacement: f32 = (dc.r - dc.g) * (uOffset / uInputSize.x);\n\n coord = uv + vec2(cosDir * displacement, sinDir * displacement * uAspect);\n\n let fillMode: i32 = i32(glitchUniforms.uFillMode);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n } else {\n if (coord.x > uInputClamp.z) {\n if (fillMode == TRANSPARENT) {\n discarded = true;\n } else if (fillMode == LOOP) {\n coord.x = coord.x - uInputClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = uInputClamp.z * 2.0 - coord.x;\n }\n } else if (coord.x < uInputClamp.x) {\n if (fillMode == TRANSPARENT) {\n discarded = true;\n } else if (fillMode == LOOP) {\n coord.x = coord.x + uInputClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = coord.x * -uInputClamp.z;\n }\n }\n\n if (coord.y > uInputClamp.w) {\n if (fillMode == TRANSPARENT) {\n discarded = true;\n } else if (fillMode == LOOP) {\n coord.y = coord.y - uInputClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = uInputClamp.w * 2.0 - coord.y;\n }\n } else if (coord.y < uInputClamp.y) {\n if (fillMode == TRANSPARENT) {\n discarded = true;\n } else if (fillMode == LOOP) {\n coord.y = coord.y + uInputClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = coord.y * -uInputClamp.w;\n }\n }\n }\n\n let seedR: f32 = 1.0 - uSeed * 0.4;\n let seedG: f32 = 1.0 - uSeed * 0.3;\n let seedB: f32 = 1.0 - uSeed * 0.2;\n\n let offsetR: vec2 = vec2(uRed.x * seedR / uInputSize.x, uRed.y * seedR / uInputSize.y);\n let offsetG: vec2 = vec2(uGreen.x * seedG / uInputSize.x, uGreen.y * seedG / uInputSize.y);\n let offsetB: vec2 = vec2(uBlue.x * seedB / uInputSize.x, uBlue.y * seedB / uInputSize.y);\n\n let r = textureSample(uTexture, uSampler, coord + offsetR).r;\n let g = textureSample(uTexture, uSampler, coord + offsetG).g;\n let b = textureSample(uTexture, uSampler, coord + offsetB).b;\n let a = textureSample(uTexture, uSampler, coord).a;\n\n return select(vec4(r, g, b, a), vec4(0.0,0.0,0.0,0.0), discarded);\n}\n\nconst TRANSPARENT: i32 = 0;\nconst ORIGINAL: i32 = 1;\nconst LOOP: i32 = 2;\nconst CLAMP: i32 = 3;\nconst MIRROR: i32 = 4;"; + exports["default"] = source; + })(glitch$3); + + var __defProp$P = Object.defineProperty; + var __getOwnPropSymbols$g = Object.getOwnPropertySymbols; + var __hasOwnProp$g = Object.prototype.hasOwnProperty; + var __propIsEnum$g = Object.prototype.propertyIsEnumerable; + var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$g = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$g.call(b, prop)) + __defNormalProp$P(a, prop, b[prop]); + if (__getOwnPropSymbols$g) + for (var prop of __getOwnPropSymbols$g(b)) { + if (__propIsEnum$g.call(b, prop)) + __defNormalProp$P(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(GlitchFilter$2, "__esModule", { value: true }); + var pixi_js$i = require$$0__default["default"]; + var _default$1$i = _default$A; + var _default$j = default2; + var glitch$1 = glitch2; + var glitch$2 = glitch$3; + var __defProp2$g = Object.defineProperty; + var __defNormalProp2$g = (obj, key, value) => key in obj ? __defProp2$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$P = (obj, key, value) => { + __defNormalProp2$g(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _GlitchFilter$1 = class _GlitchFilter2 extends pixi_js$i.Filter { + constructor(options) { + var _a, _b, _c, _d, _e; + options = __spreadValues$g(__spreadValues$g({}, _GlitchFilter2.defaults), options); + const gpuProgram = new pixi_js$i.GpuProgram({ + vertex: { + source: _default$j["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: glitch$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$i.GlProgram({ + vertex: _default$1$i["default"], + fragment: glitch$1["default"], + name: "glitch-filter" + }); + const canvas = document.createElement("canvas"); + canvas.width = 4; + canvas.height = (_a = options.sampleSize) != null ? _a : 512; + const texture = pixi_js$i.getCanvasTexture(canvas, { scaleMode: "nearest" }); + super({ + gpuProgram, + glProgram, + resources: { + glitchUniforms: { + uSeed: { value: (_b = options == null ? void 0 : options.seed) != null ? _b : 0, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" }, + uAspect: { value: 1, type: "f32" }, + uFillMode: { value: (_c = options == null ? void 0 : options.fillMode) != null ? _c : 0, type: "f32" }, + uOffset: { value: (_d = options == null ? void 0 : options.offset) != null ? _d : 100, type: "f32" }, + uDirection: { value: (_e = options == null ? void 0 : options.direction) != null ? _e : 0, type: "f32" }, + uRed: { value: options.red, type: "vec2" }, + uGreen: { value: options.green, type: "vec2" }, + uBlue: { value: options.blue, type: "vec2" } + }, + uDisplacementMap: texture.source, + uDisplacementSampler: texture.source.style + } + }); + __publicField$P(this, "uniforms"); + __publicField$P(this, "average", false); + __publicField$P(this, "minSize", 8); + __publicField$P(this, "sampleSize", 512); + __publicField$P(this, "_canvas"); + __publicField$P(this, "texture"); + __publicField$P(this, "_slices", 0); + __publicField$P(this, "_sizes", new Float32Array(1)); + __publicField$P(this, "_offsets", new Float32Array(1)); + this.uniforms = this.resources.glitchUniforms.uniforms; + this._canvas = canvas; + this.texture = texture; + Object.assign(this, options); + } + /** + * Override existing apply method in Filter + * @private + */ + apply(filterManager, input, output, clearMode) { + const { width, height } = input.frame; + this.uniforms.uDimensions[0] = width; + this.uniforms.uDimensions[1] = height; + this.uniforms.uAspect = height / width; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * Randomize the slices size (heights). + * + * @private + */ + _randomizeSizes() { + const arr = this._sizes; + const last = this._slices - 1; + const size = this.sampleSize; + const min = Math.min(this.minSize / size, 0.9 / this._slices); + if (this.average) { + const count = this._slices; + let rest = 1; + for (let i = 0; i < last; i++) { + const averageWidth = rest / (count - i); + const w = Math.max(averageWidth * (1 - Math.random() * 0.6), min); + arr[i] = w; + rest -= w; + } + arr[last] = rest; + } else { + let rest = 1; + const ratio = Math.sqrt(1 / this._slices); + for (let i = 0; i < last; i++) { + const w = Math.max(ratio * rest * Math.random(), min); + arr[i] = w; + rest -= w; + } + arr[last] = rest; + } + this.shuffle(); + } + /** + * Shuffle the sizes of the slices, advanced usage. + */ + shuffle() { + const arr = this._sizes; + const last = this._slices - 1; + for (let i = last; i > 0; i--) { + const rand = Math.random() * i >> 0; + const temp = arr[i]; + arr[i] = arr[rand]; + arr[rand] = temp; + } + } + /** + * Randomize the values for offset from -1 to 1 + * + * @private + */ + _randomizeOffsets() { + for (let i = 0; i < this._slices; i++) { + this._offsets[i] = Math.random() * (Math.random() < 0.5 ? -1 : 1); + } + } + /** + * Regenerating random size, offsets for slices. + */ + refresh() { + this._randomizeSizes(); + this._randomizeOffsets(); + this.redraw(); + } + /** + * Redraw displacement bitmap texture, advanced usage. + */ + redraw() { + const size = this.sampleSize; + const texture = this.texture; + const ctx = this._canvas.getContext("2d"); + ctx.clearRect(0, 0, 8, size); + let offset; + let y = 0; + for (let i = 0; i < this._slices; i++) { + offset = Math.floor(this._offsets[i] * 256); + const height = this._sizes[i] * size; + const red = offset > 0 ? offset : 0; + const green = offset < 0 ? -offset : 0; + ctx.fillStyle = `rgba(${red}, ${green}, 0, 1)`; + ctx.fillRect(0, y >> 0, size, height + 1 >> 0); + y += height; + } + texture.source.update(); + } + /** + * Manually custom slices size (height) of displacement bitmap + * + * @member {number[]|Float32Array} + */ + set sizes(sizes) { + const len = Math.min(this._slices, sizes.length); + for (let i = 0; i < len; i++) { + this._sizes[i] = sizes[i]; + } + } + get sizes() { + return this._sizes; + } + /** + * Manually set custom slices offset of displacement bitmap, this is + * a collection of values from -1 to 1. To change the max offset value + * set `offset`. + * + * @member {number[]|Float32Array} + */ + set offsets(offsets) { + const len = Math.min(this._slices, offsets.length); + for (let i = 0; i < len; i++) { + this._offsets[i] = offsets[i]; + } + } + get offsets() { + return this._offsets; + } + /** + * The count of slices. + * @default 5 + */ + get slices() { + return this._slices; + } + set slices(value) { + if (this._slices === value) + return; + this._slices = value; + this._sizes = new Float32Array(value); + this._offsets = new Float32Array(value); + this.refresh(); + } + /** + * The maximum offset amount of slices. + * @default 100 + */ + get offset() { + return this.uniforms.uOffset; + } + set offset(value) { + this.uniforms.uOffset = value; + } + /** + * A seed value for randomizing glitch effect. + * @default 0 + */ + get seed() { + return this.uniforms.uSeed; + } + set seed(value) { + this.uniforms.uSeed = value; + } + /** + * The fill mode of the space after the offset. + * @default FILL_MODES.TRANSPARENT + */ + get fillMode() { + return this.uniforms.uFillMode; + } + set fillMode(value) { + this.uniforms.uFillMode = value; + } + /** + * The angle in degree of the offset of slices. + * @default 0 + */ + get direction() { + return this.uniforms.uDirection / pixi_js$i.DEG_TO_RAD; + } + set direction(value) { + this.uniforms.uDirection = value * pixi_js$i.DEG_TO_RAD; + } + /** + * Red channel offset. + * @default {x:0,y:0} + */ + get red() { + return this.uniforms.uRed; + } + set red(value) { + this.uniforms.uRed = value; + } + /** + * Green channel offset. + * @default {x:0,y:0} + */ + get green() { + return this.uniforms.uGreen; + } + set green(value) { + this.uniforms.uGreen = value; + } + /** + * Blue offset. + * @default {x:0,y:0} + */ + get blue() { + return this.uniforms.uBlue; + } + set blue(value) { + this.uniforms.uBlue = value; + } + /** + * Removes all references + */ + destroy() { + var _a; + (_a = this.texture) == null ? void 0 : _a.destroy(true); + this.texture = this._canvas = this.red = this.green = this.blue = this._sizes = this._offsets = null; + } + }; + __publicField$P(_GlitchFilter$1, "defaults", { + slices: 5, + offset: 100, + direction: 0, + fillMode: 0, + average: false, + seed: 0, + red: { x: 0, y: 0 }, + green: { x: 0, y: 0 }, + blue: { x: 0, y: 0 }, + minSize: 8, + sampleSize: 512 + }); + let GlitchFilter$1 = _GlitchFilter$1; + GlitchFilter$2.GlitchFilter = GlitchFilter$1; + + var GlowFilter$2 = {}; + + var glow$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uStrength;\nuniform vec3 uColor;\nuniform float uKnockout;\nuniform float uAlpha;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nconst float PI = 3.14159265358979323846264;\n\n// Hard-assignment of DIST and ANGLE_STEP_SIZE instead of using uDistance and uQuality to allow them to be use on GLSL loop conditions\nconst float DIST = __DIST__;\nconst float ANGLE_STEP_SIZE = min(__ANGLE_STEP_SIZE__, PI * 2.);\nconst float ANGLE_STEP_NUM = ceil(PI * 2. / ANGLE_STEP_SIZE);\nconst float MAX_TOTAL_ALPHA = ANGLE_STEP_NUM * DIST * (DIST + 1.) / 2.;\n\nvoid main(void) {\n vec2 px = vec2(1.) / uInputSize.xy;\n\n float totalAlpha = 0.;\n\n vec2 direction;\n vec2 displaced;\n vec4 curColor;\n\n for (float angle = 0.; angle < PI * 2.; angle += ANGLE_STEP_SIZE) {\n direction = vec2(cos(angle), sin(angle)) * px;\n\n for (float curDistance = 0.; curDistance < DIST; curDistance++) {\n displaced = clamp(vTextureCoord + direction * (curDistance + 1.), uInputClamp.xy, uInputClamp.zw);\n curColor = texture(uTexture, displaced);\n totalAlpha += (DIST - curDistance) * curColor.a;\n }\n }\n \n curColor = texture(uTexture, vTextureCoord);\n\n vec4 glowColor = vec4(uColor, uAlpha);\n bool knockout = uKnockout > .5;\n float innerStrength = uStrength[0];\n float outerStrength = uStrength[1];\n\n float alphaRatio = totalAlpha / MAX_TOTAL_ALPHA;\n float innerGlowAlpha = (1. - alphaRatio) * innerStrength * curColor.a * uAlpha;\n float innerGlowStrength = min(1., innerGlowAlpha);\n \n vec4 innerColor = mix(curColor, glowColor, innerGlowStrength);\n float outerGlowAlpha = alphaRatio * outerStrength * (1. - curColor.a) * uAlpha;\n float outerGlowStrength = min(1. - innerColor.a, outerGlowAlpha);\n vec4 outerGlowColor = outerGlowStrength * glowColor.rgba;\n\n if (knockout) {\n float resultAlpha = outerGlowAlpha + innerGlowAlpha;\n finalColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);\n }\n else {\n finalColor = innerColor + outerGlowColor;\n }\n}\n"; + exports["default"] = fragment; + })(glow$3); + + var glow2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct GlowUniforms {\n uDistance: f32,\n uStrength: vec2,\n uColor: vec3,\n uAlpha: f32,\n uQuality: f32,\n uKnockout: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var glowUniforms : GlowUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let quality = glowUniforms.uQuality;\n let distance = glowUniforms.uDistance;\n\n let dist: f32 = glowUniforms.uDistance;\n let angleStepSize: f32 = min(1. / quality / distance, PI * 2.0);\n let angleStepNum: f32 = ceil(PI * 2.0 / angleStepSize);\n\n let px: vec2 = vec2(1.0 / gfu.uInputSize.xy);\n\n var totalAlpha: f32 = 0.0;\n\n var direction: vec2;\n var displaced: vec2;\n var curColor: vec4;\n\n for (var angle = 0.0; angle < PI * 2.0; angle += angleStepSize) {\n direction = vec2(cos(angle), sin(angle)) * px;\n for (var curDistance = 0.0; curDistance < dist; curDistance+=1) {\n displaced = vec2(clamp(uv + direction * (curDistance + 1.0), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n curColor = textureSample(uTexture, uSampler, displaced);\n totalAlpha += (dist - curDistance) * curColor.a;\n }\n }\n \n curColor = textureSample(uTexture, uSampler, uv);\n\n let glowColorRGB = glowUniforms.uColor;\n let glowAlpha = glowUniforms.uAlpha;\n let glowColor = vec4(glowColorRGB, glowAlpha);\n let knockout: bool = glowUniforms.uKnockout > 0.5;\n let innerStrength = glowUniforms.uStrength[0];\n let outerStrength = glowUniforms.uStrength[1];\n\n let alphaRatio: f32 = (totalAlpha / (angleStepNum * dist * (dist + 1.0) / 2.0));\n let innerGlowAlpha: f32 = (1.0 - alphaRatio) * innerStrength * curColor.a * glowAlpha;\n let innerGlowStrength: f32 = min(1.0, innerGlowAlpha);\n \n let innerColor: vec4 = mix(curColor, glowColor, innerGlowStrength);\n let outerGlowAlpha: f32 = alphaRatio * outerStrength * (1. - curColor.a) * glowAlpha;\n let outerGlowStrength: f32 = min(1.0 - innerColor.a, outerGlowAlpha);\n let outerGlowColor: vec4 = outerGlowStrength * glowColor.rgba;\n \n if (knockout) {\n let resultAlpha: f32 = outerGlowAlpha + innerGlowAlpha;\n return vec4(glowColor.rgb * resultAlpha, resultAlpha);\n }\n else {\n return innerColor + outerGlowColor;\n }\n}\n\nconst PI: f32 = 3.14159265358979323846264;"; + exports["default"] = source; + })(glow2); + + var __defProp$O = Object.defineProperty; + var __getOwnPropSymbols$f = Object.getOwnPropertySymbols; + var __hasOwnProp$f = Object.prototype.hasOwnProperty; + var __propIsEnum$f = Object.prototype.propertyIsEnumerable; + var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$f = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$f.call(b, prop)) + __defNormalProp$O(a, prop, b[prop]); + if (__getOwnPropSymbols$f) + for (var prop of __getOwnPropSymbols$f(b)) { + if (__propIsEnum$f.call(b, prop)) + __defNormalProp$O(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(GlowFilter$2, "__esModule", { value: true }); + var pixi_js$h = require$$0__default["default"]; + var _default$1$h = _default$A; + var _default$i = default2; + var glow$1 = glow$3; + var glow$2 = glow2; + var __defProp2$f = Object.defineProperty; + var __defNormalProp2$f = (obj, key, value) => key in obj ? __defProp2$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$O = (obj, key, value) => { + __defNormalProp2$f(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _GlowFilter$1 = class _GlowFilter2 extends pixi_js$h.Filter { + constructor(options) { + var _a, _b, _c, _d; + options = __spreadValues$f(__spreadValues$f({}, _GlowFilter2.DEFAULT_OPTIONS), options); + const distance = (_a = options.distance) != null ? _a : 10; + const quality = (_b = options.quality) != null ? _b : 0.1; + const gpuProgram = new pixi_js$h.GpuProgram({ + vertex: { + source: _default$i["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: glow$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$h.GlProgram({ + vertex: _default$1$h["default"], + fragment: glow$1["default"].replace(/__ANGLE_STEP_SIZE__/gi, `${(1 / quality / distance).toFixed(7)}`).replace(/__DIST__/gi, `${distance.toFixed(0)}.0`), + name: "glow-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + glowUniforms: { + uDistance: { value: distance, type: "f32" }, + uStrength: { value: [options.innerStrength, options.outerStrength], type: "vec2" }, + uColor: { value: new Float32Array(3), type: "vec3" }, + uAlpha: { value: options.alpha, type: "f32" }, + uQuality: { value: quality, type: "f32" }, + uKnockout: { value: ((_c = options == null ? void 0 : options.knockout) != null ? _c : false) ? 1 : 0, type: "f32" } + } + }, + padding: distance + }); + __publicField$O(this, "uniforms"); + __publicField$O(this, "_color"); + this.uniforms = this.resources.glowUniforms.uniforms; + this._color = new pixi_js$h.Color(); + this.color = (_d = options.color) != null ? _d : 16777215; + } + /** + * Only draw the glow, not the texture itself + * @default false + */ + get distance() { + return this.uniforms.uDistance; + } + set distance(value) { + this.uniforms.uDistance = this.padding = value; + } + /** + * The strength of the glow inward from the edge of the sprite. + * @default 0 + */ + get innerStrength() { + return this.uniforms.uStrength[0]; + } + set innerStrength(value) { + this.uniforms.uStrength[0] = value; + } + /** + * The strength of the glow outward from the edge of the sprite. + * @default 4 + */ + get outerStrength() { + return this.uniforms.uStrength[1]; + } + set outerStrength(value) { + this.uniforms.uStrength[1] = value; + } + /** + * The color of the glow. + * @default 0xFFFFFF + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * The alpha of the glow + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + /** + * A number between 0 and 1 that describes the quality of the glow. The higher the number the less performant + * @default 0.1 + */ + get quality() { + return this.uniforms.uQuality; + } + set quality(value) { + this.uniforms.uQuality = value; + } + /** + * Only draw the glow, not the texture itself + * @default false + */ + get knockout() { + return this.uniforms.uKnockout === 1; + } + set knockout(value) { + this.uniforms.uKnockout = value ? 1 : 0; + } + }; + __publicField$O(_GlowFilter$1, "DEFAULT_OPTIONS", { + distance: 10, + outerStrength: 4, + innerStrength: 0, + color: 16777215, + alpha: 1, + quality: 0.1, + knockout: false + }); + let GlowFilter$1 = _GlowFilter$1; + GlowFilter$2.GlowFilter = GlowFilter$1; + + var GodrayFilter$2 = {}; + + var godRay$2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uDimensions;\nuniform float uParallel;\nuniform vec2 uLight;\nuniform float uAspect;\nuniform float uTime;\nuniform vec3 uRay;\n\nuniform vec4 uInputSize;\n\n${PERLIN}\n\nvoid main(void) {\n vec2 uDimensions = uDimensions;\n bool uParallel = uParallel > 0.5;\n vec2 uLight = uLight;\n float uAspect = uAspect;\n\n vec2 coord = vTextureCoord * uInputSize.xy / uDimensions;\n\n float d;\n\n if (uParallel) {\n float _cos = uLight.x;\n float _sin = uLight.y;\n d = (_cos * coord.x) + (_sin * coord.y * uAspect);\n } else {\n float dx = coord.x - uLight.x / uDimensions.x;\n float dy = (coord.y - uLight.y / uDimensions.y) * uAspect;\n float dis = sqrt(dx * dx + dy * dy) + 0.00001;\n d = dy / dis;\n }\n\n float uTime = uTime;\n vec3 uRay = uRay;\n\n float gain = uRay[0];\n float lacunarity = uRay[1];\n float alpha = uRay[2];\n\n vec3 dir = vec3(d, d, 0.0);\n float noise = turb(dir + vec3(uTime, 0.0, 62.1 + uTime) * 0.05, vec3(480.0, 320.0, 480.0), lacunarity, gain);\n noise = mix(noise, 0.0, 0.3);\n //fade vertically.\n vec4 mist = vec4(vec3(noise), 1.0) * (1.0 - coord.y);\n mist.a = 1.0;\n // apply user alpha\n mist *= alpha;\n\n finalColor = texture(uTexture, vTextureCoord) + mist;\n}\n"; + exports["default"] = fragment; + })(godRay$2); + + var godRay2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct GodrayUniforms {\n uLight: vec2,\n uParallel: f32,\n uAspect: f32,\n uTime: f32,\n uRay: vec3,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var godrayUniforms : GodrayUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uDimensions: vec2 = godrayUniforms.uDimensions;\n let uParallel: bool = godrayUniforms.uParallel > 0.5;\n let uLight: vec2 = godrayUniforms.uLight;\n let uAspect: f32 = godrayUniforms.uAspect;\n\n let coord: vec2 = uv * gfu.uInputSize.xy / uDimensions;\n\n var d: f32;\n\n if (uParallel) {\n let _cos: f32 = uLight.x;\n let _sin: f32 = uLight.y;\n d = (_cos * coord.x) + (_sin * coord.y * uAspect);\n } else {\n let dx: f32 = coord.x - uLight.x / uDimensions.x;\n let dy: f32 = (coord.y - uLight.y / uDimensions.y) * uAspect;\n let dis: f32 = sqrt(dx * dx + dy * dy) + 0.00001;\n d = dy / dis;\n }\n\n let uTime: f32 = godrayUniforms.uTime;\n let uRay: vec3 = godrayUniforms.uRay;\n \n let gain = uRay[0];\n let lacunarity = uRay[1];\n let alpha = uRay[2];\n\n let dir: vec3 = vec3(d, d, 0.0);\n var noise: f32 = turb(dir + vec3(uTime, 0.0, 62.1 + uTime) * 0.05, vec3(480.0, 320.0, 480.0), lacunarity, gain);\n noise = mix(noise, 0.0, 0.3);\n //fade vertically.\n var mist: vec4 = vec4(vec3(noise), 1.0) * (1.0 - coord.y);\n mist.a = 1.0;\n // apply user alpha\n mist *= alpha;\n return textureSample(uTexture, uSampler, uv) + mist;\n}\n\n${PERLIN}"; + exports["default"] = source; + })(godRay2); + + var perlin$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var perlin = "vec3 mod289(vec3 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 permute(vec4 x)\n{\n return mod289(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nvec3 fade(vec3 t)\n{\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\n// Classic Perlin noise, periodic variant\nfloat pnoise(vec3 P, vec3 rep)\n{\n vec3 Pi0 = mod(floor(P), rep); // Integer part, modulo period\n vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec3 Pf0 = fract(P); // Fractional part for interpolation\n vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0);\n vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n vec4 gx1 = ixy1 * (1.0 / 7.0);\n vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g000 = vec3(gx0.x, gy0.x, gz0.x);\n vec3 g100 = vec3(gx0.y, gy0.y, gz0.y);\n vec3 g010 = vec3(gx0.z, gy0.z, gz0.z);\n vec3 g110 = vec3(gx0.w, gy0.w, gz0.w);\n vec3 g001 = vec3(gx1.x, gy1.x, gz1.x);\n vec3 g101 = vec3(gx1.y, gy1.y, gz1.y);\n vec3 g011 = vec3(gx1.z, gy1.z, gz1.z);\n vec3 g111 = vec3(gx1.w, gy1.w, gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\nfloat turb(vec3 P, vec3 rep, float lacunarity, float gain)\n{\n float sum = 0.0;\n float sc = 1.0;\n float totalgain = 1.0;\n for (float i = 0.0; i < 6.0; i++)\n {\n sum += totalgain * pnoise(P * sc, rep);\n sc *= lacunarity;\n totalgain *= gain;\n }\n return abs(sum);\n}\n"; + exports["default"] = perlin; + })(perlin$3); + + var perlin2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var sourcePerlin = "// Taken from https://gist.github.com/munrocket/236ed5ba7e409b8bdf1ff6eca5dcdc39\n\nfn moduloVec3(x: vec3, y: vec3) -> vec3\n{\n return x - y * floor(x/y);\n}\nfn mod289Vec3(x: vec3) -> vec3\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nfn mod289Vec4(x: vec4) -> vec4\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nfn permute4(x: vec4) -> vec4\n{\n return mod289Vec4(((x * 34.0) + 1.0) * x);\n}\nfn taylorInvSqrt(r: vec4) -> vec4\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nfn fade3(t: vec3) -> vec3\n{\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\nfn fade2(t: vec2) -> vec2 { return t * t * t * (t * (t * 6. - 15.) + 10.); }\n\nfn perlinNoise2(P: vec2) -> f32 {\n var Pi: vec4 = floor(P.xyxy) + vec4(0., 0., 1., 1.);\n let Pf = fract(P.xyxy) - vec4(0., 0., 1., 1.);\n Pi = Pi % vec4(289.); // To avoid truncation effects in permutation\n let ix = Pi.xzxz;\n let iy = Pi.yyww;\n let fx = Pf.xzxz;\n let fy = Pf.yyww;\n let i = permute4(permute4(ix) + iy);\n var gx: vec4 = 2. * fract(i * 0.0243902439) - 1.; // 1/41 = 0.024...\n let gy = abs(gx) - 0.5;\n let tx = floor(gx + 0.5);\n gx = gx - tx;\n var g00: vec2 = vec2(gx.x, gy.x);\n var g10: vec2 = vec2(gx.y, gy.y);\n var g01: vec2 = vec2(gx.z, gy.z);\n var g11: vec2 = vec2(gx.w, gy.w);\n let norm = 1.79284291400159 - 0.85373472095314 *\n vec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11));\n g00 = g00 * norm.x;\n g01 = g01 * norm.y;\n g10 = g10 * norm.z;\n g11 = g11 * norm.w;\n let n00 = dot(g00, vec2(fx.x, fy.x));\n let n10 = dot(g10, vec2(fx.y, fy.y));\n let n01 = dot(g01, vec2(fx.z, fy.z));\n let n11 = dot(g11, vec2(fx.w, fy.w));\n let fade_xy = fade2(Pf.xy);\n let n_x = mix(vec2(n00, n01), vec2(n10, n11), vec2(fade_xy.x));\n let n_xy = mix(n_x.x, n_x.y, fade_xy.y);\n return 2.3 * n_xy;\n}\n\n// Classic Perlin noise, periodic variant\nfn perlinNoise3(P: vec3, rep: vec3) -> f32\n{\n var Pi0: vec3 = moduloVec3(floor(P), rep); // Integer part, modulo period\n var Pi1: vec3 = moduloVec3(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n Pi0 = mod289Vec3(Pi0);\n Pi1 = mod289Vec3(Pi1);\n let Pf0: vec3 = fract(P); // Fractional part for interpolation\n let Pf1: vec3 = Pf0 - vec3(1.0); // Fractional part - 1.0\n let ix: vec4 = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n let iy: vec4 = vec4(Pi0.yy, Pi1.yy);\n let iz0: vec4 = Pi0.zzzz;\n let iz1: vec4 = Pi1.zzzz;\n let ixy: vec4 = permute4(permute4(ix) + iy);\n let ixy0: vec4 = permute4(ixy + iz0);\n let ixy1: vec4 = permute4(ixy + iz1);\n var gx0: vec4 = ixy0 * (1.0 / 7.0);\n var gy0: vec4 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n let gz0: vec4 = vec4(0.5) - abs(gx0) - abs(gy0);\n let sz0: vec4 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(vec4(0.0), gx0) - 0.5);\n gy0 -= sz0 * (step(vec4(0.0), gy0) - 0.5);\n var gx1: vec4 = ixy1 * (1.0 / 7.0);\n var gy1: vec4 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n let gz1: vec4 = vec4(0.5) - abs(gx1) - abs(gy1);\n let sz1: vec4 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(vec4(0.0), gx1) - 0.5);\n gy1 -= sz1 * (step(vec4(0.0), gy1) - 0.5);\n var g000: vec3 = vec3(gx0.x, gy0.x, gz0.x);\n var g100: vec3 = vec3(gx0.y, gy0.y, gz0.y);\n var g010: vec3 = vec3(gx0.z, gy0.z, gz0.z);\n var g110: vec3 = vec3(gx0.w, gy0.w, gz0.w);\n var g001: vec3 = vec3(gx1.x, gy1.x, gz1.x);\n var g101: vec3 = vec3(gx1.y, gy1.y, gz1.y);\n var g011: vec3 = vec3(gx1.z, gy1.z, gz1.z);\n var g111: vec3 = vec3(gx1.w, gy1.w, gz1.w);\n let norm0: vec4 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n let norm1: vec4 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n let n000: f32 = dot(g000, Pf0);\n let n100: f32 = dot(g100, vec3(Pf1.x, Pf0.yz));\n let n010: f32 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n let n110: f32 = dot(g110, vec3(Pf1.xy, Pf0.z));\n let n001: f32 = dot(g001, vec3(Pf0.xy, Pf1.z));\n let n101: f32 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n let n011: f32 = dot(g011, vec3(Pf0.x, Pf1.yz));\n let n111: f32 = dot(g111, Pf1);\n let fade_xyz: vec3 = fade3(Pf0);\n let n_z: vec4 = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n let n_yz: vec2 = mix(n_z.xy, n_z.zw, fade_xyz.y);\n let n_xyz: f32 = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\nfn turb(P: vec3, rep: vec3, lacunarity: f32, gain: f32) -> f32\n{\n var sum: f32 = 0.0;\n var sc: f32 = 1.0;\n var totalgain: f32 = 1.0;\n for (var i = 0.0; i < 6.0; i += 1)\n {\n sum += totalgain * perlinNoise3(P * sc, rep);\n sc *= lacunarity;\n totalgain *= gain;\n }\n return abs(sum);\n}"; + exports["default"] = sourcePerlin; + })(perlin2); + + var __defProp$N = Object.defineProperty; + var __getOwnPropSymbols$e = Object.getOwnPropertySymbols; + var __hasOwnProp$e = Object.prototype.hasOwnProperty; + var __propIsEnum$e = Object.prototype.propertyIsEnumerable; + var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$e = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$e.call(b, prop)) + __defNormalProp$N(a, prop, b[prop]); + if (__getOwnPropSymbols$e) + for (var prop of __getOwnPropSymbols$e(b)) { + if (__propIsEnum$e.call(b, prop)) + __defNormalProp$N(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(GodrayFilter$2, "__esModule", { value: true }); + var pixi_js$g = require$$0__default["default"]; + var _default$1$g = _default$A; + var _default$h = default2; + var godRay$1 = godRay$2; + var godRay = godRay2; + var perlin$1 = perlin$3; + var perlin$2 = perlin2; + var __defProp2$e = Object.defineProperty; + var __defNormalProp2$e = (obj, key, value) => key in obj ? __defProp2$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$N = (obj, key, value) => { + __defNormalProp2$e(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _GodrayFilter$1 = class _GodrayFilter2 extends pixi_js$g.Filter { + constructor(options) { + options = __spreadValues$e(__spreadValues$e({}, _GodrayFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$g.GpuProgram({ + vertex: { + source: _default$h["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: godRay["default"].replace("${PERLIN}", perlin$2["default"]), + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$g.GlProgram({ + vertex: _default$1$g["default"], + fragment: godRay$1["default"].replace("${PERLIN}", perlin$1["default"]), + name: "god-ray-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + godrayUniforms: { + uLight: { value: new Float32Array(2), type: "vec2" }, + uParallel: { value: 0, type: "f32" }, + uAspect: { value: 0, type: "f32" }, + uTime: { value: options.time, type: "f32" }, + uRay: { value: new Float32Array(3), type: "vec3" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$N(this, "uniforms"); + __publicField$N(this, "time", 0); + __publicField$N(this, "_angleLight", [0, 0]); + __publicField$N(this, "_angle", 0); + __publicField$N(this, "_center"); + this.uniforms = this.resources.godrayUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in Filter + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + const width = input.frame.width; + const height = input.frame.height; + this.uniforms.uLight[0] = this.parallel ? this._angleLight[0] : this._center.x; + this.uniforms.uLight[1] = this.parallel ? this._angleLight[1] : this._center.y; + this.uniforms.uDimensions[0] = width; + this.uniforms.uDimensions[1] = height; + this.uniforms.uAspect = height / width; + this.uniforms.uTime = this.time; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * The angle/light-source of the rays in degrees. For instance, + * a value of 0 is vertical rays, values of 90 or -90 produce horizontal rays + * @default 30 + */ + get angle() { + return this._angle; + } + set angle(value) { + this._angle = value; + const radians = value * pixi_js$g.DEG_TO_RAD; + this._angleLight[0] = Math.cos(radians); + this._angleLight[1] = Math.sin(radians); + } + /** + * `true` if light rays are parallel (uses angle), `false` to use the focal `center` point + * @default true + */ + get parallel() { + return this.uniforms.uParallel > 0.5; + } + set parallel(value) { + this.uniforms.uParallel = value ? 1 : 0; + } + /** + * Focal point for non-parallel rays, to use this `parallel` must be set to `false`. + * @default {x:0,y:0} + */ + get center() { + return this._center; + } + set center(value) { + this._center = value; + } + /** + * Focal point for non-parallel rays on the `x` axis, to use this `parallel` must be set to `false`. + * @default 0 + */ + get centerX() { + return this.center.x; + } + set centerX(value) { + this.center.x = value; + } + /** + * Focal point for non-parallel rays on the `y` axis, to use this `parallel` must be set to `false`. + * @default 0 + */ + get centerY() { + return this.center.y; + } + set centerY(value) { + this.center.y = value; + } + /** + * General intensity of the effect. A value closer to 1 will produce a more intense effect, + * where a value closer to 0 will produce a subtler effect + * @default 0.5 + */ + get gain() { + return this.uniforms.uRay[0]; + } + set gain(value) { + this.uniforms.uRay[0] = value; + } + /** + * The density of the fractal noise. + * A higher amount produces more rays and a smaller amount produces fewer waves + * @default 2.5 + */ + get lacunarity() { + return this.uniforms.uRay[1]; + } + set lacunarity(value) { + this.uniforms.uRay[1] = value; + } + /** + * The alpha (opacity) of the rays. 0 is fully transparent, 1 is fully opaque. + * @default 1 + */ + get alpha() { + return this.uniforms.uRay[2]; + } + set alpha(value) { + this.uniforms.uRay[2] = value; + } + }; + __publicField$N(_GodrayFilter$1, "DEFAULT_OPTIONS", { + angle: 30, + gain: 0.5, + lacunarity: 2.5, + parallel: true, + time: 0, + center: { x: 0, y: 0 }, + alpha: 1 + }); + let GodrayFilter$1 = _GodrayFilter$1; + GodrayFilter$2.GodrayFilter = GodrayFilter$1; + + var GrayscaleFilter$2 = {}; + + var grayscale2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\n\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\n\n// https://en.wikipedia.org/wiki/Luma_(video)\nconst vec3 weight = vec3(0.299, 0.587, 0.114);\n\nvoid main()\n{\n vec4 c = texture(uTexture, vTextureCoord);\n finalColor = vec4(\n vec3(c.r * weight.r + c.g * weight.g + c.b * weight.b),\n c.a\n );\n}\n"; + exports["default"] = fragment; + })(grayscale2); + + var grayscale$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let color: vec4 = textureSample(uTexture, uSampler, uv);\n\n let g: f32 = dot(color.rgb, vec3(0.299, 0.587, 0.114));\n return vec4(vec3(g), 1.);\n}"; + exports["default"] = source; + })(grayscale$3); + + Object.defineProperty(GrayscaleFilter$2, "__esModule", { value: true }); + var pixi_js$f = require$$0__default["default"]; + var _default$1$f = _default$A; + var _default$g = default2; + var grayscale$1 = grayscale2; + var grayscale$2 = grayscale$3; + class GrayscaleFilter$1 extends pixi_js$f.Filter { + constructor() { + const gpuProgram = new pixi_js$f.GpuProgram({ + vertex: { + source: _default$g["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: grayscale$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$f.GlProgram({ + vertex: _default$1$f["default"], + fragment: grayscale$1["default"], + name: "grayscale-filter" + }); + super({ + gpuProgram, + glProgram, + resources: {} + }); + } + } + GrayscaleFilter$2.GrayscaleFilter = GrayscaleFilter$1; + + var HslAdjustmentFilter$2 = {}; + + var hsladjustment2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec3 uHsl;\nuniform float uAlpha;\nuniform float uColorize;\n\n// https://en.wikipedia.org/wiki/Luma_(video)\nconst vec3 weight = vec3(0.299, 0.587, 0.114);\n\nfloat getWeightedAverage(vec3 rgb) {\n return rgb.r * weight.r + rgb.g * weight.g + rgb.b * weight.b;\n}\n\n// https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786?permalink_comment_id=3195243#gistcomment-3195243\nconst vec3 k = vec3(0.57735, 0.57735, 0.57735);\n\nvec3 hueShift(vec3 color, float angle) {\n float cosAngle = cos(angle);\n return vec3(\n color * cosAngle +\n cross(k, color) * sin(angle) +\n k * dot(k, color) * (1.0 - cosAngle)\n );\n}\n\nvoid main()\n{\n vec4 color = texture(uTexture, vTextureCoord);\n vec3 resultRGB = color.rgb;\n\n float hue = uHsl[0];\n float saturation = uHsl[1];\n float lightness = uHsl[2];\n\n // colorize\n if (uColorize > 0.5) {\n resultRGB = vec3(getWeightedAverage(resultRGB), 0., 0.);\n }\n\n // hue\n resultRGB = hueShift(resultRGB, hue);\n\n // saturation\n // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/huesaturation.js\n float average = (resultRGB.r + resultRGB.g + resultRGB.b) / 3.0;\n\n if (saturation > 0.) {\n resultRGB += (average - resultRGB) * (1. - 1. / (1.001 - saturation));\n } else {\n resultRGB -= (average - resultRGB) * saturation;\n }\n\n // lightness\n resultRGB = mix(resultRGB, vec3(ceil(lightness)) * color.a, abs(lightness));\n\n // alpha\n finalColor = mix(color, vec4(resultRGB, color.a), uAlpha);\n}\n"; + exports["default"] = fragment; + })(hsladjustment2); + + var hsladjustment$2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct HslUniforms {\n uHsl:vec3,\n uColorize:f32,\n uAlpha:f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var hslUniforms : HslUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let color: vec4 = textureSample(uTexture, uSampler, uv);\n var resultRGB: vec3 = color.rgb;\n\n let hue: f32 = hslUniforms.uHsl[0];\n let saturation: f32 = hslUniforms.uHsl[1];\n let lightness: f32 = hslUniforms.uHsl[2];\n\n // colorize\n if (hslUniforms.uColorize > 0.5) {\n resultRGB = vec3(dot(color.rgb, vec3(0.299, 0.587, 0.114)), 0., 0.);\n }\n\n // hue\n resultRGB = hueShift(resultRGB, hue);\n\n // saturation\n // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/huesaturation.js\n let average: f32 = (resultRGB.r + resultRGB.g + resultRGB.b) / 3.0;\n\n if (saturation > 0.) {\n resultRGB += (average - resultRGB) * (1. - 1. / (1.001 - saturation));\n } else {\n resultRGB -= (average - resultRGB) * saturation;\n }\n\n // lightness\n resultRGB = mix(resultRGB, vec3(ceil(lightness)) * color.a, abs(lightness));\n\n // alpha\n return mix(color, vec4(resultRGB, color.a), hslUniforms.uAlpha);\n}\n\n// https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786?permalink_comment_id=3195243#gistcomment-3195243\nconst k: vec3 = vec3(0.57735, 0.57735, 0.57735);\n\nfn hueShift(color: vec3, angle: f32) -> vec3 \n{\n let cosAngle: f32 = cos(angle);\n return vec3(\n color * cosAngle +\n cross(k, color) * sin(angle) +\n k * dot(k, color) * (1.0 - cosAngle)\n );\n}"; + exports["default"] = source; + })(hsladjustment$2); + + var __defProp$M = Object.defineProperty; + var __getOwnPropSymbols$d = Object.getOwnPropertySymbols; + var __hasOwnProp$d = Object.prototype.hasOwnProperty; + var __propIsEnum$d = Object.prototype.propertyIsEnumerable; + var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$d = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$d.call(b, prop)) + __defNormalProp$M(a, prop, b[prop]); + if (__getOwnPropSymbols$d) + for (var prop of __getOwnPropSymbols$d(b)) { + if (__propIsEnum$d.call(b, prop)) + __defNormalProp$M(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(HslAdjustmentFilter$2, "__esModule", { value: true }); + var pixi_js$e = require$$0__default["default"]; + var _default$1$e = _default$A; + var _default$f = default2; + var hsladjustment$1 = hsladjustment2; + var hsladjustment = hsladjustment$2; + var __defProp2$d = Object.defineProperty; + var __defNormalProp2$d = (obj, key, value) => key in obj ? __defProp2$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$M = (obj, key, value) => { + __defNormalProp2$d(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _HslAdjustmentFilter$1 = class _HslAdjustmentFilter2 extends pixi_js$e.Filter { + constructor(options) { + options = __spreadValues$d(__spreadValues$d({}, _HslAdjustmentFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$e.GpuProgram({ + vertex: { + source: _default$f["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: hsladjustment["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$e.GlProgram({ + vertex: _default$1$e["default"], + fragment: hsladjustment$1["default"], + name: "hsl-adjustment-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + hslUniforms: { + uHsl: { value: new Float32Array(3), type: "vec3" }, + uColorize: { value: options.colorize ? 1 : 0, type: "f32" }, + uAlpha: { value: options.alpha, type: "f32" } + } + } + }); + __publicField$M(this, "uniforms"); + __publicField$M(this, "_hue"); + this.uniforms = this.resources.hslUniforms.uniforms; + this.hue = options.hue; + } + /** + * The amount of hue in degrees (-180 to 180) + * @default 0 + */ + get hue() { + return this._hue; + } + set hue(value) { + this._hue = value; + this.resources.hslUniforms.uniforms.uHsl[0] = value * (Math.PI / 180); + } + /** + * The amount of lightness (-1 to 1) + * @default 0 + */ + get saturation() { + return this.resources.hslUniforms.uniforms.uHsl[1]; + } + set saturation(value) { + this.resources.hslUniforms.uniforms.uHsl[1] = value; + } + /** + * The amount of lightness (-1 to 1) + * @default 0 + */ + get lightness() { + return this.resources.hslUniforms.uniforms.uHsl[2]; + } + set lightness(value) { + this.resources.hslUniforms.uniforms.uHsl[2] = value; + } + /** + * Whether to colorize the image + * @default false + */ + get colorize() { + return this.resources.hslUniforms.uniforms.uColorize === 1; + } + set colorize(value) { + this.resources.hslUniforms.uniforms.uColorize = value ? 1 : 0; + } + /** + * The amount of alpha (0 to 1) + * @default 1 + */ + get alpha() { + return this.resources.hslUniforms.uniforms.uAlpha; + } + set alpha(value) { + this.resources.hslUniforms.uniforms.uAlpha = value; + } + }; + __publicField$M(_HslAdjustmentFilter$1, "DEFAULT_OPTIONS", { + hue: 0, + saturation: 0, + lightness: 0, + colorize: false, + alpha: 1 + }); + let HslAdjustmentFilter$1 = _HslAdjustmentFilter$1; + HslAdjustmentFilter$2.HslAdjustmentFilter = HslAdjustmentFilter$1; + + var MotionBlurFilter$2 = {}; + + var motionBlur$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uVelocity;\nuniform int uKernelSize;\nuniform float uOffset;\n\nuniform vec4 uInputSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\n// Notice:\n// the perfect way:\n// int kernelSize = min(uKernelSize, MAX_KERNELSIZE);\n// BUT in real use-case , uKernelSize < MAX_KERNELSIZE almost always.\n// So use uKernelSize directly.\n\nvoid main(void)\n{\n vec4 color = texture(uTexture, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n finalColor = color;\n return;\n }\n\n vec2 velocity = uVelocity / uInputSize.xy;\n float offset = -uOffset / length(uVelocity) - 0.5;\n int k = uKernelSize - 1;\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n vec2 bias = velocity * (float(i) / float(k) + offset);\n color += texture(uTexture, vTextureCoord + bias);\n }\n finalColor = color / float(uKernelSize);\n}\n"; + exports["default"] = fragment; + })(motionBlur$3); + + var motionBlur2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct MotionBlurUniforms {\n uVelocity: vec2,\n uKernelSize: f32,\n uOffset: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var motionBlurUniforms : MotionBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uVelocity = motionBlurUniforms.uVelocity;\n let uKernelSize = motionBlurUniforms.uKernelSize;\n let uOffset = motionBlurUniforms.uOffset;\n\n let velocity: vec2 = uVelocity / gfu.uInputSize.xy;\n let offset: f32 = -uOffset / length(uVelocity) - 0.5;\n let k: i32 = i32(min(uKernelSize - 1, MAX_KERNEL_SIZE - 1));\n\n var color: vec4 = textureSample(uTexture, uSampler, uv);\n\n for(var i: i32 = 0; i < k; i += 1) {\n let bias: vec2 = velocity * (f32(i) / f32(k) + offset);\n color += textureSample(uTexture, uSampler, uv + bias);\n }\n \n return select(color / f32(uKernelSize), textureSample(uTexture, uSampler, uv), uKernelSize == 0);\n}\n\nconst MAX_KERNEL_SIZE: f32 = 2048;"; + exports["default"] = source; + })(motionBlur2); + + var __defProp$L = Object.defineProperty; + var __getOwnPropSymbols$c = Object.getOwnPropertySymbols; + var __hasOwnProp$c = Object.prototype.hasOwnProperty; + var __propIsEnum$c = Object.prototype.propertyIsEnumerable; + var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$c = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$c.call(b, prop)) + __defNormalProp$L(a, prop, b[prop]); + if (__getOwnPropSymbols$c) + for (var prop of __getOwnPropSymbols$c(b)) { + if (__propIsEnum$c.call(b, prop)) + __defNormalProp$L(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(MotionBlurFilter$2, "__esModule", { value: true }); + var pixi_js$d = require$$0__default["default"]; + var _default$1$d = _default$A; + var _default$e = default2; + var motionBlur$1 = motionBlur$3; + var motionBlur$2 = motionBlur2; + var __defProp2$c = Object.defineProperty; + var __defNormalProp2$c = (obj, key, value) => key in obj ? __defProp2$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$L = (obj, key, value) => { + __defNormalProp2$c(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _MotionBlurFilter$1 = class _MotionBlurFilter2 extends pixi_js$d.Filter { + constructor(options) { + var _a; + options = __spreadValues$c(__spreadValues$c({}, _MotionBlurFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$d.GpuProgram({ + vertex: { + source: _default$e["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: motionBlur$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$d.GlProgram({ + vertex: _default$1$d["default"], + fragment: motionBlur$1["default"], + name: "motion-blur-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + motionBlurUniforms: { + uVelocity: { value: options.velocity, type: "vec2" }, + uKernelSize: { value: Math.trunc((_a = options.kernelSize) != null ? _a : 5), type: "f32" }, + uOffset: { value: options.offset, type: "f32" } + } + } + }); + __publicField$L(this, "uniforms"); + __publicField$L(this, "_kernelSize"); + this.uniforms = this.resources.motionBlurUniforms.uniforms; + Object.assign(this, options); + } + /** + * Sets the velocity of the motion for blur effect + * This should be a size 2 array or an object containing `x` and `y` values, you cannot change types + * once defined in the constructor + * @default {x:0,y:0} + */ + get velocity() { + return this.uniforms.uVelocity; + } + set velocity(value) { + this.uniforms.uVelocity = value; + this._updateDirty(); + } + /** + * Sets the velocity of the motion for blur effect on the `x` axis + * @default 0 + */ + get velocityX() { + return this.velocity.x; + } + set velocityX(value) { + this.velocity.x = value; + this._updateDirty(); + } + /** + * Sets the velocity of the motion for blur effect on the `x` axis + * @default 0 + */ + get velocityY() { + return this.velocity.y; + } + set velocityY(value) { + this.velocity.y = value; + this._updateDirty(); + } + /** + * The kernelSize of the blur filter. Must be odd number >= 5 + * @default 5 + */ + get kernelSize() { + return this._kernelSize; + } + set kernelSize(value) { + this._kernelSize = value; + this._updateDirty(); + } + /** + * The offset of the blur filter + * @default 0 + */ + get offset() { + return this.uniforms.uOffset; + } + set offset(value) { + this.uniforms.uOffset = value; + } + _updateDirty() { + this.padding = (Math.max(Math.abs(this.velocityX), Math.abs(this.velocityY)) >> 0) + 1; + this.uniforms.uKernelSize = this.velocityX !== 0 || this.velocityY !== 0 ? this._kernelSize : 0; + } + }; + __publicField$L(_MotionBlurFilter$1, "DEFAULT_OPTIONS", { + velocity: { x: 0, y: 0 }, + kernelSize: 5, + offset: 0 + }); + let MotionBlurFilter$1 = _MotionBlurFilter$1; + MotionBlurFilter$2.MotionBlurFilter = MotionBlurFilter$1; + + var MultiColorReplaceFilter$2 = {}; + + var multiColorReplace2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nconst int MAX_COLORS = ${MAX_COLORS};\n\nuniform sampler2D uTexture;\nuniform vec3 uOriginalColors[MAX_COLORS];\nuniform vec3 uTargetColors[MAX_COLORS];\nuniform float uTolerance;\n\nvoid main(void)\n{\n finalColor = texture(uTexture, vTextureCoord);\n\n float alpha = finalColor.a;\n if (alpha < 0.0001)\n {\n return;\n }\n\n vec3 color = finalColor.rgb / alpha;\n\n for(int i = 0; i < MAX_COLORS; i++)\n {\n vec3 origColor = uOriginalColors[i];\n if (origColor.r < 0.0)\n {\n break;\n }\n vec3 colorDiff = origColor - color;\n if (length(colorDiff) < uTolerance)\n {\n vec3 targetColor = uTargetColors[i];\n finalColor = vec4((targetColor + colorDiff) * alpha, alpha);\n return;\n }\n }\n}\n"; + exports["default"] = fragment; + })(multiColorReplace2); + + var multiColorReplace$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct MultiColorReplaceUniforms {\n uOriginalColors: array, MAX_COLORS>,\n uTargetColors: array, MAX_COLORS>,\n uTolerance:f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var multiColorReplaceUniforms : MultiColorReplaceUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uOriginalColors = multiColorReplaceUniforms.uOriginalColors;\n let uTargetColors = multiColorReplaceUniforms.uTargetColors;\n let uTolerance = multiColorReplaceUniforms.uTolerance;\n\n var color: vec4 = textureSample(uTexture, uSampler, uv);\n\n let alpha: f32 = color.a;\n\n if (alpha > 0.0001)\n {\n var modColor: vec3 = vec3(color.rgb) / alpha;\n\n for(var i: i32 = 0; i < MAX_COLORS; i += 1)\n {\n let origColor: vec3 = uOriginalColors[i];\n if (origColor.r < 0.0)\n {\n break;\n }\n let colorDiff: vec3 = origColor - modColor;\n \n if (length(colorDiff) < uTolerance)\n {\n let targetColor: vec3 = uTargetColors[i];\n color = vec4((targetColor + colorDiff) * alpha, alpha);\n return color;\n }\n }\n }\n\n return color;\n}\n\nconst MAX_COLORS: i32 = ${MAX_COLORS};"; + exports["default"] = source; + })(multiColorReplace$3); + + var __defProp$K = Object.defineProperty; + var __getOwnPropSymbols$b = Object.getOwnPropertySymbols; + var __hasOwnProp$b = Object.prototype.hasOwnProperty; + var __propIsEnum$b = Object.prototype.propertyIsEnumerable; + var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$b = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$b.call(b, prop)) + __defNormalProp$K(a, prop, b[prop]); + if (__getOwnPropSymbols$b) + for (var prop of __getOwnPropSymbols$b(b)) { + if (__propIsEnum$b.call(b, prop)) + __defNormalProp$K(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(MultiColorReplaceFilter$2, "__esModule", { value: true }); + var pixi_js$c = require$$0__default["default"]; + var _default$1$c = _default$A; + var _default$d = default2; + var multiColorReplace$1 = multiColorReplace2; + var multiColorReplace$2 = multiColorReplace$3; + var __defProp2$b = Object.defineProperty; + var __defNormalProp2$b = (obj, key, value) => key in obj ? __defProp2$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$K = (obj, key, value) => { + __defNormalProp2$b(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _MultiColorReplaceFilter$1 = class _MultiColorReplaceFilter2 extends pixi_js$c.Filter { + constructor(options) { + var _a; + options = __spreadValues$b(__spreadValues$b({}, _MultiColorReplaceFilter2.DEFAULT_OPTIONS), options); + const maxColors = (_a = options.maxColors) != null ? _a : options.replacements.length; + const gpuProgram = new pixi_js$c.GpuProgram({ + vertex: { + source: _default$d["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: multiColorReplace$2["default"].replace(/\$\{MAX_COLORS\}/g, maxColors.toFixed(0)), + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$c.GlProgram({ + vertex: _default$1$c["default"], + fragment: multiColorReplace$1["default"].replace(/\$\{MAX_COLORS\}/g, maxColors.toFixed(0)), + name: "multi-color-replace-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + multiColorReplaceUniforms: { + uOriginalColors: { + value: new Float32Array(3 * maxColors), + type: "vec3", + size: maxColors + }, + uTargetColors: { + value: new Float32Array(3 * maxColors), + type: "vec3", + size: maxColors + }, + uTolerance: { value: options.tolerance, type: "f32" } + } + } + }); + __publicField$K(this, "uniforms"); + __publicField$K(this, "_replacements", []); + __publicField$K(this, "_maxColors"); + this._maxColors = maxColors; + this.uniforms = this.resources.multiColorReplaceUniforms.uniforms; + this.replacements = options.replacements; + } + /** + * The collection of replacement items. Each item is color-pair + * (an array length is 2). In the pair, the first value is original color , the second value is target color + */ + set replacements(replacements) { + const originals = this.uniforms.uOriginalColors; + const targets = this.uniforms.uTargetColors; + const colorCount = replacements.length; + const color = new pixi_js$c.Color(); + if (colorCount > this._maxColors) { + throw new Error(`Length of replacements (${colorCount}) exceeds the maximum colors length (${this._maxColors})`); + } + originals[colorCount * 3] = -1; + let r; + let g; + let b; + for (let i = 0; i < colorCount; i++) { + const pair = replacements[i]; + color.setValue(pair[0]); + [r, g, b] = color.toArray(); + originals[i * 3] = r; + originals[i * 3 + 1] = g; + originals[i * 3 + 2] = b; + color.setValue(pair[1]); + [r, g, b] = color.toArray(); + targets[i * 3] = r; + targets[i * 3 + 1] = g; + targets[i * 3 + 2] = b; + } + this._replacements = replacements; + } + get replacements() { + return this._replacements; + } + /** + * Should be called after changing any of the contents of the replacements. + * This is a convenience method for resetting the `replacements`. + * @todo implement nested proxy to remove the need for this function + */ + refresh() { + this.replacements = this._replacements; + } + /** + * The maximum number of color replacements supported by this filter. Can be changed + * _only_ during construction. + * @readonly + */ + get maxColors() { + return this._maxColors; + } + /** + * Tolerance of the floating-point comparison between colors (lower = more exact, higher = more inclusive) + * @default 0.05 + */ + get tolerance() { + return this.uniforms.uTolerance; + } + set tolerance(value) { + this.uniforms.uTolerance = value; + } + }; + __publicField$K(_MultiColorReplaceFilter$1, "DEFAULT_OPTIONS", { + replacements: [[16711680, 255]], + tolerance: 0.05, + maxColors: void 0 + }); + let MultiColorReplaceFilter$1 = _MultiColorReplaceFilter$1; + MultiColorReplaceFilter$2.MultiColorReplaceFilter = MultiColorReplaceFilter$1; + + var OldFilmFilter$2 = {}; + + var oldFilm$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uSepia;\nuniform vec2 uNoise;\nuniform vec3 uScratch;\nuniform vec3 uVignette;\nuniform float uSeed;\nuniform vec2 uDimensions;\n\nuniform vec4 uInputSize;\n\nconst float SQRT_2 = 1.414213;\nconst vec3 SEPIA_RGB = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvec3 Overlay(vec3 src, vec3 dst)\n{\n // if (dst <= 0.5) then: 2 * src * dst\n // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n finalColor = texture(uTexture, vTextureCoord);\n vec3 color = finalColor.rgb;\n\n if (uSepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + uSepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * uInputSize.xy / uDimensions.xy;\n\n float vignette = uVignette[0];\n float vignetteAlpha = uVignette[1];\n float vignetteBlur = uVignette[2];\n\n if (vignette > 0.0)\n {\n float outter = SQRT_2 - vignette * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= uDimensions.y / uDimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignetteBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignetteAlpha);\n }\n\n float scratch = uScratch[0];\n float scratchDensity = uScratch[1];\n float scratchWidth = uScratch[2];\n\n if (scratchDensity > uSeed && scratch != 0.0)\n {\n float phase = uSeed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(uSeed * dist, abs(s - uSeed * dist)));\n if (d < uSeed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / uDimensions.x * (0.75 + uSeed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n float noise = uNoise[0];\n float noiseSize = uNoise[1];\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + uSeed * 512.0, 1024.0 - uSeed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * uSeed) - 0.5;\n color += _noise * noise;\n }\n\n finalColor.rgb = color;\n}\n"; + exports["default"] = fragment; + })(oldFilm$3); + + var oldFilm2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct OldFilmUniforms {\n uSepia: f32,\n uNoise: vec2,\n uScratch: vec3,\n uVignette: vec3,\n uSeed: f32,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var oldFilmUniforms : OldFilmUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color: vec4 = textureSample(uTexture, uSampler, uv);\n\n if (oldFilmUniforms.uSepia > 0.)\n {\n color = vec4(sepia(color.rgb), color.a);\n }\n\n let coord: vec2 = uv * gfu.uInputSize.xy / oldFilmUniforms.uDimensions;\n\n if (oldFilmUniforms.uVignette[0] > 0.)\n {\n color *= vec4(vec3(vignette(color.rgb, coord)), color.a);\n }\n\n let uScratch = oldFilmUniforms.uScratch; \n\n if (uScratch[1] > oldFilmUniforms.uSeed && uScratch[0] != 0.)\n {\n color = vec4(scratch(color.rgb, coord), color.a);\n }\n\n let uNoise = oldFilmUniforms.uNoise;\n\n if (uNoise[0] > 0.0 && uNoise[1] > 0.0)\n {\n color += vec4(vec3(noise(uv)), color.a);\n }\n\n return color;\n}\n\nconst SQRT_2: f32 = 1.414213;\nconst SEPIA_RGB: vec3 = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}\n\nfn rand(co: vec2) -> f32\n{\n return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nfn overlay(src: vec3, dst: vec3) -> vec3\n{\n // if (dst <= 0.5) then: 2 * src * dst\n // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n\n return vec3(\n select((1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)), (2.0 * src.x * dst.x), (dst.x <= 0.5)), \n select((1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)), (2.0 * src.y * dst.y), (dst.y <= 0.5)),\n select((1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)), (2.0 * src.z * dst.z), (dst.z <= 0.5))\n );\n}\n\nfn sepia(co: vec3) -> vec3\n{\n let gray: f32 = (co.x + co.y + co.z) / 3.0;\n let grayscale: vec3 = vec3(gray);\n let color = overlay(SEPIA_RGB, grayscale);\n return grayscale + oldFilmUniforms.uSepia * (color - grayscale);\n}\n\nfn vignette(co: vec3, coord: vec2) -> f32\n{\n let uVignette = oldFilmUniforms.uVignette;\n let uDimensions = oldFilmUniforms.uDimensions;\n \n let outter: f32 = SQRT_2 - uVignette[0] * SQRT_2;\n var dir: vec2 = vec2(vec2(0.5) - coord);\n dir.y *= uDimensions.y / uDimensions.x;\n let darker: f32 = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + uVignette[2] * SQRT_2), 0.0, 1.0);\n return darker + (1.0 - darker) * (1.0 - uVignette[1]);\n}\n\nfn scratch(co: vec3, coord: vec2) -> vec3\n{\n var color = co;\n let uScratch = oldFilmUniforms.uScratch;\n let uSeed = oldFilmUniforms.uSeed;\n let uDimensions = oldFilmUniforms.uDimensions;\n\n let phase: f32 = uSeed * 256.0;\n let s: f32 = modulo(floor(phase), 2.0);\n let dist: f32 = 1.0 / uScratch[1];\n let d: f32 = distance(coord, vec2(uSeed * dist, abs(s - uSeed * dist)));\n\n if (d < uSeed * 0.6 + 0.4)\n {\n let period: f32 = uScratch[1] * 10.0;\n\n let xx: f32 = coord.x * period + phase;\n let aa: f32 = abs(modulo(xx, 0.5) * 4.0);\n let bb: f32 = modulo(floor(xx / 0.5), 2.0);\n let yy: f32 = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n let kk: f32 = 2.0 * period;\n let dw: f32 = uScratch[2] / uDimensions.x * (0.75 + uSeed);\n let dh: f32 = dw * kk;\n\n var tine: f32 = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n let _sign: f32 = sign(uScratch[0]);\n\n tine = s * tine / period + uScratch[0] + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color *= tine;\n }\n }\n\n return color;\n}\n\nfn noise(coord: vec2) -> f32\n{\n let uNoise = oldFilmUniforms.uNoise;\n let uSeed = oldFilmUniforms.uSeed;\n\n var pixelCoord: vec2 = coord * gfu.uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / uNoise[1]);\n pixelCoord.y = floor(pixelCoord.y / uNoise[1]);\n return (rand(pixelCoord * uNoise[1] * uSeed) - 0.5) * uNoise[0];\n}"; + exports["default"] = source; + })(oldFilm2); + + var __defProp$J = Object.defineProperty; + var __getOwnPropSymbols$a = Object.getOwnPropertySymbols; + var __hasOwnProp$a = Object.prototype.hasOwnProperty; + var __propIsEnum$a = Object.prototype.propertyIsEnumerable; + var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$a = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$a.call(b, prop)) + __defNormalProp$J(a, prop, b[prop]); + if (__getOwnPropSymbols$a) + for (var prop of __getOwnPropSymbols$a(b)) { + if (__propIsEnum$a.call(b, prop)) + __defNormalProp$J(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(OldFilmFilter$2, "__esModule", { value: true }); + var pixi_js$b = require$$0__default["default"]; + var _default$1$b = _default$A; + var _default$c = default2; + var oldFilm$1 = oldFilm$3; + var oldFilm$2 = oldFilm2; + var __defProp2$a = Object.defineProperty; + var __defNormalProp2$a = (obj, key, value) => key in obj ? __defProp2$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$J = (obj, key, value) => { + __defNormalProp2$a(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _OldFilmFilter$1 = class _OldFilmFilter2 extends pixi_js$b.Filter { + constructor(options) { + options = __spreadValues$a(__spreadValues$a({}, _OldFilmFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$b.GpuProgram({ + vertex: { + source: _default$c["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: oldFilm$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$b.GlProgram({ + vertex: _default$1$b["default"], + fragment: oldFilm$1["default"], + name: "old-film-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + oldFilmUniforms: { + uSepia: { value: options.sepia, type: "f32" }, + uNoise: { value: new Float32Array(2), type: "vec2" }, + uScratch: { value: new Float32Array(3), type: "vec3" }, + uVignette: { value: new Float32Array(3), type: "vec3" }, + uSeed: { value: options.seed, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$J(this, "uniforms"); + __publicField$J(this, "seed"); + this.uniforms = this.resources.oldFilmUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + this.uniforms.uSeed = this.seed; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * The amount of saturation of sepia effect, + * a value of `1` is more saturation and closer to `0` is less, and a value of `0` produces no sepia effect + * @default 0.3 + */ + get sepia() { + return this.uniforms.uSepia; + } + set sepia(value) { + this.uniforms.uSepia = value; + } + /** + * Opacity/intensity of the noise effect between `0` and `1` + * @default 0.3 + */ + get noise() { + return this.uniforms.uNoise[0]; + } + set noise(value) { + this.uniforms.uNoise[0] = value; + } + /** + * The size of the noise particles + * @default 1 + */ + get noiseSize() { + return this.uniforms.uNoise[1]; + } + set noiseSize(value) { + this.uniforms.uNoise[1] = value; + } + /** + * How often scratches appear + * @default 0.5 + */ + get scratch() { + return this.uniforms.uScratch[0]; + } + set scratch(value) { + this.uniforms.uScratch[0] = value; + } + /** + * The density of the number of scratches + * @default 0.3 + */ + get scratchDensity() { + return this.uniforms.uScratch[1]; + } + set scratchDensity(value) { + this.uniforms.uScratch[1] = value; + } + /** + * The width of the scratches + * @default 1 + */ + get scratchWidth() { + return this.uniforms.uScratch[2]; + } + set scratchWidth(value) { + this.uniforms.uScratch[2] = value; + } + /** + * The radius of the vignette effect, smaller values produces a smaller vignette + * @default 0.3 + */ + get vignette() { + return this.uniforms.uVignette[0]; + } + set vignette(value) { + this.uniforms.uVignette[0] = value; + } + /** + * Amount of opacity on the vignette + * @default 1 + */ + get vignetteAlpha() { + return this.uniforms.uVignette[1]; + } + set vignetteAlpha(value) { + this.uniforms.uVignette[1] = value; + } + /** + * Blur intensity of the vignette + * @default 1 + */ + get vignetteBlur() { + return this.uniforms.uVignette[2]; + } + set vignetteBlur(value) { + this.uniforms.uVignette[2] = value; + } + }; + __publicField$J(_OldFilmFilter$1, "DEFAULT_OPTIONS", { + sepia: 0.3, + noise: 0.3, + noiseSize: 1, + scratch: 0.5, + scratchDensity: 0.3, + scratchWidth: 1, + vignette: 0.3, + vignetteAlpha: 1, + vignetteBlur: 0.3, + seed: 0 + }); + let OldFilmFilter$1 = _OldFilmFilter$1; + OldFilmFilter$2.OldFilmFilter = OldFilmFilter$1; + + var OutlineFilter$2 = {}; + + var outline2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uThickness;\nuniform vec3 uColor;\nuniform float uAlpha;\nuniform float uKnockout;\n\nuniform vec4 uInputClamp;\n\nconst float DOUBLE_PI = 2. * 3.14159265358979323846264;\nconst float ANGLE_STEP = ${ANGLE_STEP};\n\nfloat outlineMaxAlphaAtPos(vec2 pos) {\n if (uThickness.x == 0. || uThickness.y == 0.) {\n return 0.;\n }\n\n vec4 displacedColor;\n vec2 displacedPos;\n float maxAlpha = 0.;\n\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ANGLE_STEP) {\n displacedPos.x = vTextureCoord.x + uThickness.x * cos(angle);\n displacedPos.y = vTextureCoord.y + uThickness.y * sin(angle);\n displacedColor = texture(uTexture, clamp(displacedPos, uInputClamp.xy, uInputClamp.zw));\n maxAlpha = max(maxAlpha, displacedColor.a);\n }\n\n return maxAlpha;\n}\n\nvoid main(void) {\n vec4 sourceColor = texture(uTexture, vTextureCoord);\n vec4 contentColor = sourceColor * float(uKnockout < 0.5);\n float outlineAlpha = uAlpha * outlineMaxAlphaAtPos(vTextureCoord.xy) * (1.-sourceColor.a);\n vec4 outlineColor = vec4(vec3(uColor) * outlineAlpha, outlineAlpha);\n finalColor = contentColor + outlineColor;\n}\n"; + exports["default"] = fragment; + })(outline2); + + var outline$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct OutlineUniforms {\n uThickness:vec2,\n uColor:vec3,\n uAlpha:f32,\n uAngleStep:f32,\n uKnockout:f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var outlineUniforms : OutlineUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let sourceColor: vec4 = textureSample(uTexture, uSampler, uv);\n let contentColor: vec4 = sourceColor * (1. - outlineUniforms.uKnockout);\n \n let outlineAlpha: f32 = outlineUniforms.uAlpha * outlineMaxAlphaAtPos(uv) * (1. - sourceColor.a);\n let outlineColor: vec4 = vec4(vec3(outlineUniforms.uColor) * outlineAlpha, outlineAlpha);\n \n return contentColor + outlineColor;\n}\n\nfn outlineMaxAlphaAtPos(uv: vec2) -> f32 {\n let thickness = outlineUniforms.uThickness;\n\n if (thickness.x == 0. || thickness.y == 0.) {\n return 0.;\n }\n \n let angleStep = outlineUniforms.uAngleStep;\n\n var displacedColor: vec4;\n var displacedPos: vec2;\n\n var maxAlpha: f32 = 0.;\n var displaced: vec2;\n var curColor: vec4;\n\n for (var angle = 0.; angle <= DOUBLE_PI; angle += angleStep)\n {\n displaced.x = uv.x + thickness.x * cos(angle);\n displaced.y = uv.y + thickness.y * sin(angle);\n curColor = textureSample(uTexture, uSampler, clamp(displaced, gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n\n return maxAlpha;\n}\n\nconst DOUBLE_PI: f32 = 3.14159265358979323846264 * 2.;"; + exports["default"] = source; + })(outline$3); + + var __defProp$I = Object.defineProperty; + var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols; + var __hasOwnProp$9 = Object.prototype.hasOwnProperty; + var __propIsEnum$9 = Object.prototype.propertyIsEnumerable; + var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$9 = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$9.call(b, prop)) + __defNormalProp$I(a, prop, b[prop]); + if (__getOwnPropSymbols$9) + for (var prop of __getOwnPropSymbols$9(b)) { + if (__propIsEnum$9.call(b, prop)) + __defNormalProp$I(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(OutlineFilter$2, "__esModule", { value: true }); + var pixi_js$a = require$$0__default["default"]; + var _default$1$a = _default$A; + var _default$b = default2; + var outline$1 = outline2; + var outline$2 = outline$3; + var __defProp2$9 = Object.defineProperty; + var __defNormalProp2$9 = (obj, key, value) => key in obj ? __defProp2$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$I = (obj, key, value) => { + __defNormalProp2$9(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _OutlineFilter$1 = class _OutlineFilter2 extends pixi_js$a.Filter { + constructor(options) { + var _a, _b; + options = __spreadValues$9(__spreadValues$9({}, _OutlineFilter2.DEFAULT_OPTIONS), options); + const quality = (_a = options.quality) != null ? _a : 0.1; + const gpuProgram = new pixi_js$a.GpuProgram({ + vertex: { + source: _default$b["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: outline$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$a.GlProgram({ + vertex: _default$1$a["default"], + fragment: outline$1["default"].replace(/\$\{ANGLE_STEP\}/, _OutlineFilter2.getAngleStep(quality).toFixed(7)), + name: "outline-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + outlineUniforms: { + uThickness: { value: new Float32Array(2), type: "vec2" }, + uColor: { value: new Float32Array(3), type: "vec3" }, + uAlpha: { value: options.alpha, type: "f32" }, + uAngleStep: { value: 0, type: "f32" }, + uKnockout: { value: options.knockout ? 1 : 0, type: "f32" } + } + } + }); + __publicField$I(this, "uniforms"); + __publicField$I(this, "_thickness"); + __publicField$I(this, "_quality"); + __publicField$I(this, "_color"); + this.uniforms = this.resources.outlineUniforms.uniforms; + this.uniforms.uAngleStep = _OutlineFilter2.getAngleStep(quality); + this._color = new pixi_js$a.Color(); + this.color = (_b = options.color) != null ? _b : 0; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uThickness[0] = this.thickness / input.source.width; + this.uniforms.uThickness[1] = this.thickness / input.source.height; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * Get the angleStep by quality + * @param quality + */ + static getAngleStep(quality) { + return parseFloat((Math.PI * 2 / Math.max( + quality * _OutlineFilter2.MAX_SAMPLES, + _OutlineFilter2.MIN_SAMPLES + )).toFixed(7)); + } + /** + * The thickness of the outline + * @default 1 + */ + get thickness() { + return this._thickness; + } + set thickness(value) { + this._thickness = this.padding = value; + } + /** + * The color value of the ambient color + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0x000000 + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * Coefficient for alpha multiplication + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + /** + * The quality of the outline from `0` to `1`. + * Using a higher quality setting will result in more accuracy but slower performance + * @default 0.1 + */ + get quality() { + return this._quality; + } + set quality(value) { + this._quality = value; + this.uniforms.uAngleStep = _OutlineFilter2.getAngleStep(value); + } + /** + * Whether to only render outline, not the contents. + * @default false + */ + get knockout() { + return this.uniforms.uKnockout === 1; + } + set knockout(value) { + this.uniforms.uKnockout = value ? 1 : 0; + } + }; + __publicField$I(_OutlineFilter$1, "DEFAULT_OPTIONS", { + thickness: 1, + color: 0, + alpha: 1, + quality: 0.1, + knockout: false + }); + __publicField$I(_OutlineFilter$1, "MIN_SAMPLES", 1); + __publicField$I(_OutlineFilter$1, "MAX_SAMPLES", 100); + let OutlineFilter$1 = _OutlineFilter$1; + OutlineFilter$2.OutlineFilter = OutlineFilter$1; + + var PixelateFilter$2 = {}; + + var pixelate$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform vec2 uSize;\nuniform sampler2D uTexture;\nuniform vec4 uInputSize;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= uInputSize.xy;\n coord += uInputSize.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= uInputSize.zw;\n coord /= uInputSize.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 uSize)\n{\n return floor( coord / uSize ) * uSize;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n coord = pixelate(coord, uSize);\n coord = unmapCoord(coord);\n finalColor = texture(uTexture, coord);\n}\n"; + exports["default"] = fragment; + })(pixelate$3); + + var pixelate2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct PixelateUniforms {\n uSize:vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var pixelateUniforms : PixelateUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let pixelSize: vec2 = pixelateUniforms.uSize;\n let coord: vec2 = mapCoord(uv);\n\n var pixCoord: vec2 = pixelate(coord, pixelSize);\n pixCoord = unmapCoord(pixCoord);\n\n return textureSample(uTexture, uSampler, pixCoord);\n}\n\nfn mapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord *= gfu.uInputSize.xy;\n mappedCoord += gfu.uOutputFrame.xy;\n return mappedCoord;\n}\n\nfn unmapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord -= gfu.uOutputFrame.xy;\n mappedCoord /= gfu.uInputSize.xy;\n return mappedCoord;\n}\n\nfn pixelate(coord: vec2, size: vec2) -> vec2\n{\n return floor( coord / size ) * size;\n}\n\n"; + exports["default"] = source; + })(pixelate2); + + Object.defineProperty(PixelateFilter$2, "__esModule", { value: true }); + var pixi_js$9 = require$$0__default["default"]; + var _default$1$9 = _default$A; + var _default$a = default2; + var pixelate$1 = pixelate$3; + var pixelate$2 = pixelate2; + var __defProp$H = Object.defineProperty; + var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$H = (obj, key, value) => { + __defNormalProp$H(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _PixelateFilter$1 = class _PixelateFilter2 extends pixi_js$9.Filter { + /** + * @param {Point|Array|number} [size=10] - Either the width/height of the size of the pixels, or square size + */ + constructor(size) { + size = size != null ? size : _PixelateFilter2.DEFAULT_SIZE; + const pixelateUniforms = new pixi_js$9.UniformGroup({ + uSize: { value: new Float32Array(2), type: "vec2" } + }); + const gpuProgram = new pixi_js$9.GpuProgram({ + vertex: { + source: _default$a["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: pixelate$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$9.GlProgram({ + vertex: _default$1$9["default"], + fragment: pixelate$1["default"], + name: "pixelate-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + pixelateUniforms + } + }); + this.size = size; + } + /** + * The size of the pixels + * @default [10,10] + */ + get size() { + return this.resources.pixelateUniforms.uniforms.uSize; + } + set size(value) { + if (value instanceof pixi_js$9.Point) { + this.sizeX = value.x; + this.sizeY = value.y; + } else if (Array.isArray(value)) { + this.resources.pixelateUniforms.uniforms.uSize = value; + } else { + this.sizeX = this.sizeY = value; + } + } + /** + * The size of the pixels on the `x` axis + * @default 10 + */ + get sizeX() { + return this.resources.pixelateUniforms.uniforms.uSize[0]; + } + set sizeX(value) { + this.resources.pixelateUniforms.uniforms.uSize[0] = value; + } + /** + * The size of the pixels on the `y` axis + * @default 10 + */ + get sizeY() { + return this.resources.pixelateUniforms.uniforms.uSize[1]; + } + set sizeY(value) { + this.resources.pixelateUniforms.uniforms.uSize[1] = value; + } + }; + __publicField$H(_PixelateFilter$1, "DEFAULT_SIZE", 10); + let PixelateFilter$1 = _PixelateFilter$1; + PixelateFilter$2.PixelateFilter = PixelateFilter$1; + + var RadialBlurFilter$2 = {}; + + var radialBlur$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nuniform vec4 uInputSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture(uTexture, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n finalColor = color;\n return;\n }\n\n float aspect = uInputSize.y / uInputSize.x;\n vec2 center = uCenter.xy / uInputSize.xy;\n float gradient = uRadius / uInputSize.x * 0.3;\n float radius = uRadius / uInputSize.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n finalColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture(uTexture, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n finalColor = color / float(uKernelSize);\n}\n"; + exports["default"] = fragment; + })(radialBlur$3); + + var radialBlur2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct RadialBlurUniforms {\n uRadian: f32,\n uCenter: vec2,\n uKernelSize: f32,\n uRadius: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var radialBlurUniforms : RadialBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uRadian = radialBlurUniforms.uRadian;\n let uCenter = radialBlurUniforms.uCenter;\n let uKernelSize = radialBlurUniforms.uKernelSize;\n let uRadius = radialBlurUniforms.uRadius;\n \n var returnColorOnly = false;\n\n if (uKernelSize == 0)\n {\n returnColorOnly = true;\n }\n\n let aspect: f32 = gfu.uInputSize.y / gfu.uInputSize.x;\n let center: vec2 = uCenter.xy / gfu.uInputSize.xy;\n let gradient: f32 = uRadius / gfu.uInputSize.x * 0.3;\n let radius: f32 = uRadius / gfu.uInputSize.x - gradient * 0.5;\n let k: i32 = i32(uKernelSize - 1);\n\n var coord: vec2 = uv;\n let dir: vec2 = vec2(center - coord);\n let dist: f32 = length(vec2(dir.x, dir.y * aspect));\n\n var radianStep: f32 = uRadian;\n \n if (radius >= 0.0 && dist > radius)\n {\n let delta: f32 = dist - radius;\n let gap: f32 = gradient;\n let scale: f32 = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n returnColorOnly = true;\n }\n radianStep *= scale;\n }\n\n radianStep /= f32(k);\n\n let s: f32 = sin(radianStep);\n let c: f32 = cos(radianStep);\n let rotationMatrix: mat2x2 = mat2x2(vec2(c, -s), vec2(s, c));\n \n var color: vec4 = textureSample(uTexture, uSampler, uv);\n let baseColor = vec4(color);\n\n let minK: i32 = min(i32(uKernelSize) - 1, MAX_KERNEL_SIZE - 1);\n\n for(var i: i32 = 0; i < minK; i += 1) \n {\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n let sample: vec4 = textureSample(uTexture, uSampler, coord);\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n color += sample;\n }\n\n return select(color / f32(uKernelSize), baseColor, returnColorOnly);\n}\n\nconst MAX_KERNEL_SIZE: i32 = 2048;"; + exports["default"] = source; + })(radialBlur2); + + var __defProp$G = Object.defineProperty; + var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols; + var __hasOwnProp$8 = Object.prototype.hasOwnProperty; + var __propIsEnum$8 = Object.prototype.propertyIsEnumerable; + var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$8 = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$8.call(b, prop)) + __defNormalProp$G(a, prop, b[prop]); + if (__getOwnPropSymbols$8) + for (var prop of __getOwnPropSymbols$8(b)) { + if (__propIsEnum$8.call(b, prop)) + __defNormalProp$G(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(RadialBlurFilter$2, "__esModule", { value: true }); + var pixi_js$8 = require$$0__default["default"]; + var _default$1$8 = _default$A; + var _default$9 = default2; + var radialBlur$1 = radialBlur$3; + var radialBlur$2 = radialBlur2; + var __defProp2$8 = Object.defineProperty; + var __defNormalProp2$8 = (obj, key, value) => key in obj ? __defProp2$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$G = (obj, key, value) => { + __defNormalProp2$8(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _RadialBlurFilter$1 = class _RadialBlurFilter2 extends pixi_js$8.Filter { + constructor(options) { + options = __spreadValues$8(__spreadValues$8({}, _RadialBlurFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$8.GpuProgram({ + vertex: { + source: _default$9["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: radialBlur$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$8.GlProgram({ + vertex: _default$1$8["default"], + fragment: radialBlur$1["default"], + name: "radial-blur-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + radialBlurUniforms: { + uRadian: { value: 0, type: "f32" }, + uCenter: { value: options.center, type: "vec2" }, + uKernelSize: { value: options.kernelSize, type: "f32" }, + uRadius: { value: options.radius, type: "f32" } + } + } + }); + __publicField$G(this, "uniforms"); + __publicField$G(this, "_angle"); + __publicField$G(this, "_kernelSize"); + this.uniforms = this.resources.radialBlurUniforms.uniforms; + Object.assign(this, options); + } + _updateKernelSize() { + this.uniforms.uKernelSize = this._angle !== 0 ? this.kernelSize : 0; + } + /** + * Sets the angle in degrees of the motion for blur effect. + * @default 0 + */ + get angle() { + return this._angle; + } + set angle(value) { + this._angle = value; + this.uniforms.uRadian = value * Math.PI / 180; + this._updateKernelSize(); + } + /** + * The `x` and `y` offset coordinates to change the position of the center of the circle of effect. + * This should be a size 2 array or an object containing `x` and `y` values, you cannot change types + * once defined in the constructor + * @default {x:0,y:0} + */ + get center() { + return this.uniforms.uCenter; + } + set center(value) { + this.uniforms.uCenter = value; + } + /** + * Sets the velocity of the motion for blur effect on the `x` axis + * @default 0 + */ + get centerX() { + return this.center.x; + } + set centerX(value) { + this.center.x = value; + } + /** + * Sets the velocity of the motion for blur effect on the `x` axis + * @default 0 + */ + get centerY() { + return this.center.y; + } + set centerY(value) { + this.center.y = value; + } + /** + * The kernelSize of the blur filter. Must be odd number >= 3 + * @default 5 + */ + get kernelSize() { + return this._kernelSize; + } + set kernelSize(value) { + this._kernelSize = value; + this._updateKernelSize(); + } + /** + * The maximum size of the blur radius, less than `0` equates to infinity + * @default -1 + */ + get radius() { + return this.uniforms.uRadius; + } + set radius(value) { + this.uniforms.uRadius = value < 0 || value === Infinity ? -1 : value; + } + }; + __publicField$G(_RadialBlurFilter$1, "DEFAULT_OPTIONS", { + angle: 0, + center: { x: 0, y: 0 }, + kernelSize: 5, + radius: -1 + }); + let RadialBlurFilter$1 = _RadialBlurFilter$1; + RadialBlurFilter$2.RadialBlurFilter = RadialBlurFilter$1; + + var ReflectionFilter$2 = {}; + + var reflection$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uMirror;\nuniform float uBoundary;\nuniform vec2 uAmplitude;\nuniform vec2 uWavelength;\nuniform vec2 uAlpha;\nuniform float uTime;\nuniform vec2 uDimensions;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * uInputSize.xy;\n vec2 coord = pixelCoord / uDimensions;\n\n if (coord.y < uBoundary) {\n finalColor = texture(uTexture, vTextureCoord);\n return;\n }\n\n float k = (coord.y - uBoundary) / (1. - uBoundary + 0.0001);\n float areaY = uBoundary * uDimensions.y / uInputSize.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = uMirror > 0.5 ? v : vTextureCoord.y;\n\n float _amplitude = ((uAmplitude.y - uAmplitude.x) * k + uAmplitude.x ) / uInputSize.x;\n float _waveLength = ((uWavelength.y - uWavelength.x) * k + uWavelength.x) / uInputSize.y;\n float _alpha = (uAlpha.y - uAlpha.x) * k + uAlpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - uTime) * _amplitude;\n x = clamp(x, uInputClamp.x, uInputClamp.z);\n\n vec4 color = texture(uTexture, vec2(x, y));\n\n finalColor = color * _alpha;\n}\n"; + exports["default"] = fragment; + })(reflection$3); + + var reflection2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct ReflectionUniforms {\n uMirror: f32,\n uBoundary: f32,\n uAmplitude: vec2,\n uWavelength: vec2,\n uAlpha: vec2,\n uTime: f32,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var reflectionUniforms : ReflectionUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uDimensions: vec2 = reflectionUniforms.uDimensions;\n let uBoundary: f32 = reflectionUniforms.uBoundary;\n let uMirror: bool = reflectionUniforms.uMirror > 0.5;\n let uAmplitude: vec2 = reflectionUniforms.uAmplitude;\n let uWavelength: vec2 = reflectionUniforms.uWavelength;\n let uAlpha: vec2 = reflectionUniforms.uAlpha;\n let uTime: f32 = reflectionUniforms.uTime;\n\n let pixelCoord: vec2 = uv * gfu.uInputSize.xy;\n let coord: vec2 = pixelCoord /uDimensions;\n var returnColorOnly: bool = false;\n\n if (coord.y < uBoundary) {\n returnColorOnly = true;\n }\n\n let k: f32 = (coord.y - uBoundary) / (1. - uBoundary + 0.0001);\n let areaY: f32 = uBoundary * uDimensions.y / gfu.uInputSize.y;\n let v: f32 = areaY + areaY - uv.y;\n let y: f32 = select(uv.y, v, uMirror);\n\n let amplitude: f32 = ((uAmplitude.y - uAmplitude.x) * k + uAmplitude.x ) / gfu.uInputSize.x;\n let waveLength: f32 = ((uWavelength.y - uWavelength.x) * k + uWavelength.x) / gfu.uInputSize.y;\n let alpha: f32 = select((uAlpha.y - uAlpha.x) * k + uAlpha.x, 1., returnColorOnly);\n\n var x: f32 = uv.x + cos(v * 6.28 / waveLength - uTime) * amplitude;\n x = clamp(x, gfu.uInputClamp.x, gfu.uInputClamp.z);\n \n return textureSample(uTexture, uSampler, select(vec2(x, y), uv, returnColorOnly)) * alpha;\n}\n\nfn rand(co: vec2) -> f32 \n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}"; + exports["default"] = source; + })(reflection2); + + var __defProp$F = Object.defineProperty; + var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols; + var __hasOwnProp$7 = Object.prototype.hasOwnProperty; + var __propIsEnum$7 = Object.prototype.propertyIsEnumerable; + var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$7 = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$7.call(b, prop)) + __defNormalProp$F(a, prop, b[prop]); + if (__getOwnPropSymbols$7) + for (var prop of __getOwnPropSymbols$7(b)) { + if (__propIsEnum$7.call(b, prop)) + __defNormalProp$F(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(ReflectionFilter$2, "__esModule", { value: true }); + var pixi_js$7 = require$$0__default["default"]; + var _default$1$7 = _default$A; + var _default$8 = default2; + var reflection$1 = reflection$3; + var reflection$2 = reflection2; + var __defProp2$7 = Object.defineProperty; + var __defNormalProp2$7 = (obj, key, value) => key in obj ? __defProp2$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$F = (obj, key, value) => { + __defNormalProp2$7(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ReflectionFilter$1 = class _ReflectionFilter2 extends pixi_js$7.Filter { + constructor(options) { + options = __spreadValues$7(__spreadValues$7({}, _ReflectionFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$7.GpuProgram({ + vertex: { + source: _default$8["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: reflection$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$7.GlProgram({ + vertex: _default$1$7["default"], + fragment: reflection$1["default"], + name: "reflection-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + reflectionUniforms: { + uMirror: { value: options.mirror ? 1 : 0, type: "f32" }, + uBoundary: { value: options.boundary, type: "f32" }, + uAmplitude: { value: options.amplitude, type: "vec2" }, + uWavelength: { value: options.waveLength, type: "vec2" }, + uAlpha: { value: options.alpha, type: "vec2" }, + uTime: { value: options.time, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$F(this, "uniforms"); + __publicField$F(this, "time", 0); + this.uniforms = this.resources.reflectionUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + this.uniforms.uTime = this.time; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * `true` to reflect the image, `false` for waves-only + * @default true + */ + get mirror() { + return this.uniforms.uMirror > 0.5; + } + set mirror(value) { + this.uniforms.uMirror = value ? 1 : 0; + } + /** + * Vertical position of the reflection point, default is 50% (middle) + * smaller numbers produce a larger reflection, larger numbers produce a smaller reflection. + * @default 0.5 + */ + get boundary() { + return this.uniforms.uBoundary; + } + set boundary(value) { + this.uniforms.uBoundary = value; + } + /** + * Starting and ending amplitude of waves + * @default [0,20] + */ + get amplitude() { + return Array.from(this.uniforms.uAmplitude); + } + set amplitude(value) { + this.uniforms.uAmplitude[0] = value[0]; + this.uniforms.uAmplitude[1] = value[1]; + } + /** + * Starting amplitude of waves + * @default 0 + */ + get amplitudeStart() { + return this.uniforms.uAmplitude[0]; + } + set amplitudeStart(value) { + this.uniforms.uAmplitude[0] = value; + } + /** + * Starting amplitude of waves + * @default 20 + */ + get amplitudeEnd() { + return this.uniforms.uAmplitude[1]; + } + set amplitudeEnd(value) { + this.uniforms.uAmplitude[1] = value; + } + /** + * Starting and ending length of waves + * @default [30,100] + */ + get waveLength() { + return Array.from(this.uniforms.uWavelength); + } + set waveLength(value) { + this.uniforms.uWavelength[0] = value[0]; + this.uniforms.uWavelength[1] = value[1]; + } + /** + * Starting wavelength of waves + * @default 30 + */ + get wavelengthStart() { + return this.uniforms.uWavelength[0]; + } + set wavelengthStart(value) { + this.uniforms.uWavelength[0] = value; + } + /** + * Starting wavelength of waves + * @default 100 + */ + get wavelengthEnd() { + return this.uniforms.uWavelength[1]; + } + set wavelengthEnd(value) { + this.uniforms.uWavelength[1] = value; + } + /** + * Starting and ending alpha values + * @default [1,1] + */ + get alpha() { + return Array.from(this.uniforms.uAlpha); + } + set alpha(value) { + this.uniforms.uAlpha[0] = value[0]; + this.uniforms.uAlpha[1] = value[1]; + } + /** + * Starting wavelength of waves + * @default 1 + */ + get alphaStart() { + return this.uniforms.uAlpha[0]; + } + set alphaStart(value) { + this.uniforms.uAlpha[0] = value; + } + /** + * Starting wavelength of waves + * @default 1 + */ + get alphaEnd() { + return this.uniforms.uAlpha[1]; + } + set alphaEnd(value) { + this.uniforms.uAlpha[1] = value; + } + }; + __publicField$F(_ReflectionFilter$1, "DEFAULT_OPTIONS", { + mirror: true, + boundary: 0.5, + amplitude: [0, 20], + waveLength: [30, 100], + alpha: [1, 1], + time: 0 + }); + let ReflectionFilter$1 = _ReflectionFilter$1; + ReflectionFilter$2.ReflectionFilter = ReflectionFilter$1; + + var RGBSplitFilter$2 = {}; + + var rgbSplit$2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec4 uInputSize;\nuniform vec2 uRed;\nuniform vec2 uGreen;\nuniform vec2 uBlue;\n\nvoid main(void)\n{\n float r = texture(uTexture, vTextureCoord + uRed/uInputSize.xy).r;\n float g = texture(uTexture, vTextureCoord + uGreen/uInputSize.xy).g;\n float b = texture(uTexture, vTextureCoord + uBlue/uInputSize.xy).b;\n float a = texture(uTexture, vTextureCoord).a;\n finalColor = vec4(r, g, b, a);\n}\n"; + exports["default"] = fragment; + })(rgbSplit$2); + + var rgbSplit2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct RgbSplitUniforms {\n uRed: vec2,\n uGreen: vec2,\n uBlue: vec3,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var rgbSplitUniforms : RgbSplitUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let r = textureSample(uTexture, uSampler, uv + vec2(rgbSplitUniforms.uRed.x / gfu.uInputSize.x, rgbSplitUniforms.uRed.y / gfu.uInputSize.y)).r;\n let g = textureSample(uTexture, uSampler, uv + vec2(rgbSplitUniforms.uGreen.x / gfu.uInputSize.x, rgbSplitUniforms.uGreen.y / gfu.uInputSize.y)).g;\n let b = textureSample(uTexture, uSampler, uv + vec2(rgbSplitUniforms.uBlue.x / gfu.uInputSize.x, rgbSplitUniforms.uBlue.y / gfu.uInputSize.y)).b;\n let a = textureSample(uTexture, uSampler, uv).a;\n return vec4(r, g, b, a);\n}\n"; + exports["default"] = source; + })(rgbSplit2); + + var __defProp$E = Object.defineProperty; + var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols; + var __hasOwnProp$6 = Object.prototype.hasOwnProperty; + var __propIsEnum$6 = Object.prototype.propertyIsEnumerable; + var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$6 = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$6.call(b, prop)) + __defNormalProp$E(a, prop, b[prop]); + if (__getOwnPropSymbols$6) + for (var prop of __getOwnPropSymbols$6(b)) { + if (__propIsEnum$6.call(b, prop)) + __defNormalProp$E(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(RGBSplitFilter$2, "__esModule", { value: true }); + var pixi_js$6 = require$$0__default["default"]; + var _default$1$6 = _default$A; + var _default$7 = default2; + var rgbSplit$1 = rgbSplit$2; + var rgbSplit = rgbSplit2; + var __defProp2$6 = Object.defineProperty; + var __defNormalProp2$6 = (obj, key, value) => key in obj ? __defProp2$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$E = (obj, key, value) => { + __defNormalProp2$6(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _RGBSplitFilter$1 = class _RGBSplitFilter2 extends pixi_js$6.Filter { + constructor(options) { + options = __spreadValues$6(__spreadValues$6({}, _RGBSplitFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$6.GpuProgram({ + vertex: { + source: _default$7["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: rgbSplit["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$6.GlProgram({ + vertex: _default$1$6["default"], + fragment: rgbSplit$1["default"], + name: "rgb-split-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + rgbSplitUniforms: { + uRed: { value: options.red, type: "vec2" }, + uGreen: { value: options.green, type: "vec2" }, + uBlue: { value: options.blue, type: "vec2" } + } + } + }); + __publicField$E(this, "uniforms"); + this.uniforms = this.resources.rgbSplitUniforms.uniforms; + } + /** + * Red channel offset. + * @default {x:-10,y:0} + */ + get red() { + return this.uniforms.uRed; + } + set red(value) { + this.uniforms.uRed = value; + } + /** + * Amount of x-axis offset for the red channel. + * @default -10 + */ + get redX() { + return this.red.x; + } + set redX(value) { + this.red.x = value; + } + /** + * Amount of y-axis offset for the red channel. + * @default 0 + */ + get redY() { + return this.red.y; + } + set redY(value) { + this.red.y = value; + } + /** + * Green channel offset. + * @default {x:0,y:10} + */ + get green() { + return this.uniforms.uGreen; + } + set green(value) { + this.uniforms.uGreen = value; + } + /** + * Amount of x-axis offset for the green channel. + * @default 0 + */ + get greenX() { + return this.green.x; + } + set greenX(value) { + this.green.x = value; + } + /** + * Amount of y-axis offset for the green channel. + * @default 10 + */ + get greenY() { + return this.green.y; + } + set greenY(value) { + this.green.y = value; + } + /** + * Blue channel offset. + * @default {x:0,y:0} + */ + get blue() { + return this.uniforms.uBlue; + } + set blue(value) { + this.uniforms.uBlue = value; + } + /** + * Amount of x-axis offset for the blue channel. + * @default 0 + */ + get blueX() { + return this.blue.x; + } + set blueX(value) { + this.blue.x = value; + } + /** + * Amount of y-axis offset for the blue channel. + * @default 0 + */ + get blueY() { + return this.blue.y; + } + set blueY(value) { + this.blue.y = value; + } + }; + __publicField$E(_RGBSplitFilter$1, "DEFAULT_OPTIONS", { + red: { x: -10, y: 0 }, + green: { x: 0, y: 10 }, + blue: { x: 0, y: 0 } + }); + let RGBSplitFilter$1 = _RGBSplitFilter$1; + RGBSplitFilter$2.RGBSplitFilter = RGBSplitFilter$1; + + var ShockwaveFilter$2 = {}; + + var shockwave$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "\nprecision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uCenter;\nuniform float uTime;\nuniform float uSpeed;\nuniform vec4 uWave;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float uAmplitude = uWave[0];\n float uWavelength = uWave[1];\n float uBrightness = uWave[2];\n float uRadius = uWave[3];\n\n float halfWavelength = uWavelength * 0.5 / uInputSize.x;\n float maxRadius = uRadius / uInputSize.x;\n float currentRadius = uTime * uSpeed / uInputSize.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n finalColor = texture(uTexture, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - uCenter / uInputSize.xy);\n dir.y *= uInputSize.y / uInputSize.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n finalColor = texture(uTexture, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( uAmplitude * fade );\n\n vec2 offset = diffUV * powDiff / uInputSize.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n vec4 color = texture(uTexture, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // finalColor = texture(uTexture, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (uBrightness - 1.0) * p * fade;\n\n finalColor = color;\n}\n"; + exports["default"] = fragment; + })(shockwave$3); + + var shockwave2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "\nstruct ShockWaveUniforms {\n uTime: f32,\n uOffset: vec2,\n uSpeed: f32,\n uWave: vec4,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var shockwaveUniforms : ShockWaveUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n\n let uTime = shockwaveUniforms.uTime;\n let uOffset = shockwaveUniforms.uOffset;\n let uSpeed = shockwaveUniforms.uSpeed;\n let uAmplitude = shockwaveUniforms.uWave[0];\n let uWavelength = shockwaveUniforms.uWave[1];\n let uBrightness = shockwaveUniforms.uWave[2];\n let uRadius = shockwaveUniforms.uWave[3];\n let halfWavelength: f32 = uWavelength * 0.5 / gfu.uInputSize.x;\n let maxRadius: f32 = uRadius / gfu.uInputSize.x;\n let currentRadius: f32 = uTime * uSpeed / gfu.uInputSize.x;\n var fade: f32 = 1.0;\n var returnColorOnly: bool = false;\n \n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n returnColorOnly = true;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n var dir: vec2 = vec2(uv - uOffset / gfu.uInputSize.xy);\n dir.y *= gfu.uInputSize.y / gfu.uInputSize.x;\n\n let dist:f32 = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n returnColorOnly = true;\n }\n\n let diffUV: vec2 = normalize(dir);\n let diff: f32 = (dist - currentRadius) / halfWavelength;\n let p: f32 = 1.0 - pow(abs(diff), 2.0);\n let powDiff: f32 = 1.25 * sin(diff * PI) * p * ( uAmplitude * fade );\n let offset: vec2 = diffUV * powDiff / gfu.uInputSize.xy;\n // Do clamp :\n let coord: vec2 = uv + offset;\n let clampedCoord: vec2 = clamp(coord, gfu.uInputClamp.xy, gfu.uInputClamp.zw);\n\n var clampedColor: vec4 = textureSample(uTexture, uSampler, clampedCoord);\n \n if (boolVec2(coord, clampedCoord)) \n {\n clampedColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n // No clamp :\n return select(clampedColor * vec4(vec3(1.0 + (uBrightness - 1.0) * p * fade), clampedColor.a), textureSample(uTexture, uSampler, uv), returnColorOnly);\n}\n\nfn boolVec2(x: vec2, y: vec2) -> bool\n{\n if (x.x == y.x && x.y == y.y)\n {\n return true;\n }\n \n return false;\n}\n\nconst PI: f32 = 3.14159265358979323846264;\n"; + exports["default"] = source; + })(shockwave2); + + var __defProp$D = Object.defineProperty; + var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols; + var __hasOwnProp$5 = Object.prototype.hasOwnProperty; + var __propIsEnum$5 = Object.prototype.propertyIsEnumerable; + var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$5 = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$5.call(b, prop)) + __defNormalProp$D(a, prop, b[prop]); + if (__getOwnPropSymbols$5) + for (var prop of __getOwnPropSymbols$5(b)) { + if (__propIsEnum$5.call(b, prop)) + __defNormalProp$D(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(ShockwaveFilter$2, "__esModule", { value: true }); + var pixi_js$5 = require$$0__default["default"]; + var _default$1$5 = _default$A; + var _default$6 = default2; + var shockwave$1 = shockwave$3; + var shockwave$2 = shockwave2; + var __defProp2$5 = Object.defineProperty; + var __defNormalProp2$5 = (obj, key, value) => key in obj ? __defProp2$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$D = (obj, key, value) => { + __defNormalProp2$5(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ShockwaveFilter$1 = class _ShockwaveFilter2 extends pixi_js$5.Filter { + /** + * @param options + */ + constructor(options) { + options = __spreadValues$5(__spreadValues$5({}, _ShockwaveFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$5.GpuProgram({ + vertex: { + source: _default$6["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: shockwave$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$5.GlProgram({ + vertex: _default$1$5["default"], + fragment: shockwave$1["default"], + name: "shockwave-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + shockwaveUniforms: new pixi_js$5.UniformGroup({ + uTime: { value: 0, type: "f32" }, + uCenter: { value: options.center, type: "vec2" }, + uSpeed: { value: options.speed, type: "f32" }, + uWave: { value: new Float32Array(4), type: "vec4" } + }) + } + }); + __publicField$D(this, "uniforms"); + __publicField$D(this, "time"); + this.time = 0; + this.uniforms = this.resources.shockwaveUniforms.uniforms; + Object.assign(this, options); + } + apply(filterManager, input, output, clearMode) { + this.uniforms.uTime = this.time; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * The `x` and `y` center coordinates to change the position of the center of the circle of effect. + * @default [0,0] + */ + get center() { + return this.uniforms.uCenter; + } + set center(value) { + this.uniforms.uCenter = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `x` axis + * @default 0 + */ + get centerX() { + return this.uniforms.uCenter.x; + } + set centerX(value) { + this.uniforms.uCenter.x = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `y` axis + * @default 0 + */ + get centerY() { + return this.uniforms.uCenter.y; + } + set centerY(value) { + this.uniforms.uCenter.y = value; + } + /** + * The speed about the shockwave ripples out. The unit is `pixel-per-second` + * @default 500 + */ + get speed() { + return this.uniforms.uSpeed; + } + set speed(value) { + this.uniforms.uSpeed = value; + } + /** + * The amplitude of the shockwave + * @default 30 + */ + get amplitude() { + return this.uniforms.uWave[0]; + } + set amplitude(value) { + this.uniforms.uWave[0] = value; + } + /** + * The wavelength of the shockwave + * @default 160 + */ + get wavelength() { + return this.uniforms.uWave[1]; + } + set wavelength(value) { + this.uniforms.uWave[1] = value; + } + /** + * The brightness of the shockwave + * @default 1 + */ + get brightness() { + return this.uniforms.uWave[2]; + } + set brightness(value) { + this.uniforms.uWave[2] = value; + } + /** + * The maximum radius of shockwave. less than `0` means the max is an infinite distance + * @default -1 + */ + get radius() { + return this.uniforms.uWave[3]; + } + set radius(value) { + this.uniforms.uWave[3] = value; + } + }; + __publicField$D(_ShockwaveFilter$1, "DEFAULT_OPTIONS", { + /** The `x` and `y` center coordinates to change the position of the center of the circle of effect. */ + center: { x: 0, y: 0 }, + /** The speed about the shockwave ripples out. The unit is `pixel-per-second` */ + speed: 500, + /** The amplitude of the shockwave */ + amplitude: 30, + /** The wavelength of the shockwave */ + wavelength: 160, + /** The brightness of the shockwave */ + brightness: 1, + /** The maximum radius of shockwave. less than `0` means the max is an infinite distance */ + radius: -1 + }); + let ShockwaveFilter$1 = _ShockwaveFilter$1; + ShockwaveFilter$2.ShockwaveFilter = ShockwaveFilter$1; + + var SimpleLightmapFilter$2 = {}; + + var simpleLightmap2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMapTexture;\nuniform vec3 uColor;\nuniform float uAlpha;\nuniform vec2 uDimensions;\n\nuniform vec4 uInputSize;\n\nvoid main() {\n vec4 diffuseColor = texture(uTexture, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * uInputSize.xy) / uDimensions;\n vec4 light = texture(uMapTexture, lightCoord);\n vec3 ambient = uColor.rgb * uAlpha;\n vec3 intensity = ambient + light.rgb;\n vec3 color = diffuseColor.rgb * intensity;\n finalColor = vec4(color, diffuseColor.a);\n}\n"; + exports["default"] = fragment; + })(simpleLightmap2); + + var simpleLightmap$2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct SimpleLightmapUniforms {\n uColor: vec3,\n uAlpha: f32,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var simpleLightmapUniforms : SimpleLightmapUniforms;\n@group(1) @binding(1) var uMapTexture: texture_2d;\n@group(1) @binding(2) var uMapSampler: sampler;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2,\n) -> @location(0) vec4 {\n let uColor = simpleLightmapUniforms.uColor;\n let uAlpha = simpleLightmapUniforms.uAlpha;\n let uDimensions = simpleLightmapUniforms.uDimensions;\n\n let diffuseColor: vec4 = textureSample(uTexture, uSampler, uv);\n let lightCoord: vec2 = (uv * gfu.uInputSize.xy) / simpleLightmapUniforms.uDimensions;\n let light: vec4 = textureSample(uMapTexture, uMapSampler, lightCoord);\n let ambient: vec3 = uColor * uAlpha;\n let intensity: vec3 = ambient + light.rgb;\n let finalColor: vec3 = diffuseColor.rgb * intensity;\n return vec4(finalColor, diffuseColor.a);\n}"; + exports["default"] = source; + })(simpleLightmap$2); + + var __defProp$C = Object.defineProperty; + var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols; + var __hasOwnProp$4 = Object.prototype.hasOwnProperty; + var __propIsEnum$4 = Object.prototype.propertyIsEnumerable; + var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$4 = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$4.call(b, prop)) + __defNormalProp$C(a, prop, b[prop]); + if (__getOwnPropSymbols$4) + for (var prop of __getOwnPropSymbols$4(b)) { + if (__propIsEnum$4.call(b, prop)) + __defNormalProp$C(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(SimpleLightmapFilter$2, "__esModule", { value: true }); + var pixi_js$4 = require$$0__default["default"]; + var _default$1$4 = _default$A; + var _default$5 = default2; + var simpleLightmap$1 = simpleLightmap2; + var simpleLightmap = simpleLightmap$2; + var __defProp2$4 = Object.defineProperty; + var __defNormalProp2$4 = (obj, key, value) => key in obj ? __defProp2$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$C = (obj, key, value) => { + __defNormalProp2$4(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _SimpleLightmapFilter$1 = class _SimpleLightmapFilter2 extends pixi_js$4.Filter { + constructor(options) { + var _a; + options = __spreadValues$4(__spreadValues$4({}, _SimpleLightmapFilter2.DEFAULT_OPTIONS), options); + if (!options.lightMap) + throw Error("No light map texture source was provided to SimpleLightmapFilter"); + const gpuProgram = new pixi_js$4.GpuProgram({ + vertex: { + source: _default$5["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: simpleLightmap["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$4.GlProgram({ + vertex: _default$1$4["default"], + fragment: simpleLightmap$1["default"], + name: "simple-lightmap-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + simpleLightmapUniforms: { + uColor: { value: new Float32Array(3), type: "vec3" }, + uAlpha: { value: options.alpha, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + }, + uMapTexture: options.lightMap.source, + uMapSampler: options.lightMap.source.style + } + }); + __publicField$C(this, "uniforms"); + __publicField$C(this, "_color"); + __publicField$C(this, "_lightMap"); + this.uniforms = this.resources.simpleLightmapUniforms.uniforms; + this._color = new pixi_js$4.Color(); + this.color = (_a = options.color) != null ? _a : 0; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + filterManager.applyFilter(this, input, output, clearMode); + } + /** A sprite where your lightmap is rendered */ + get lightMap() { + return this._lightMap; + } + set lightMap(value) { + this._lightMap = value; + this.resources.uMapTexture = value.source; + this.resources.uMapSampler = value.source.style; + } + /** + * The color value of the ambient color + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0x000000 + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * Coefficient for alpha multiplication + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + }; + __publicField$C(_SimpleLightmapFilter$1, "DEFAULT_OPTIONS", { + lightMap: pixi_js$4.Texture.WHITE, + color: 0, + alpha: 1 + }); + let SimpleLightmapFilter$1 = _SimpleLightmapFilter$1; + SimpleLightmapFilter$2.SimpleLightmapFilter = SimpleLightmapFilter$1; + + var TiltShiftAxisFilter$3 = {}; + + var tiltShift$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uBlur;\nuniform vec2 uStart;\nuniform vec2 uEnd;\nuniform vec2 uDelta;\nuniform vec2 uTexSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float blur = uBlur[0];\n float gradientBlur = uBlur[1];\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(uStart.y - uEnd.y, uEnd.x - uStart.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * uTexSize - uStart, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture(uTexture, vTextureCoord + uDelta / uTexSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n finalColor = color;\n}\n"; + exports["default"] = fragment; + })(tiltShift$3); + + var tiltShift2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct TiltShiftUniforms {\n uBlur: vec2,\n uStart: vec2,\n uEnd: vec2,\n uDelta: vec2,\n uTexSize: vec2,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var tiltShiftUniforms : TiltShiftUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uBlur = tiltShiftUniforms.uBlur[0];\n let uBlurGradient = tiltShiftUniforms.uBlur[1];\n let uStart = tiltShiftUniforms.uStart;\n let uEnd = tiltShiftUniforms.uEnd;\n let uDelta = tiltShiftUniforms.uDelta;\n let uTexSize = tiltShiftUniforms.uTexSize;\n\n var color: vec4 = vec4(0.0);\n var total: f32 = 0.0;\n\n let offset: f32 = random(position, vec3(12.9898, 78.233, 151.7182), 0.0);\n let normal: vec2 = normalize(vec2(uStart.y - uEnd.y, uEnd.x - uStart.x));\n let radius: f32 = smoothstep(0.0, 1.0, abs(dot(uv * uTexSize - uStart, normal)) / uBlurGradient) * uBlur;\n\n for (var t: f32 = -30.0; t <= 30.0; t += 1.0)\n {\n var percent: f32 = (t + offset - 0.5) / 30.0;\n var weight: f32 = 1.0 - abs(percent);\n var sample: vec4 = textureSample(uTexture, uSampler, uv + uDelta / uTexSize * percent * radius);\n sample = vec4(sample.xyz * sample.a, sample.a); // multiply sample.rgb with sample.a\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color = vec4(color.xyz / (color.a + 0.00001), color.a); // divide color.rgb by color.a + 0.00001\n\n return color;\n}\n\n\nfn random(position: vec4, scale: vec3, seed: f32) -> f32\n{\n return fract(sin(dot(position.xyz + seed, scale)) * 43758.5453 + seed);\n}"; + exports["default"] = source; + })(tiltShift2); + + var __defProp$B = Object.defineProperty; + var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols; + var __hasOwnProp$3 = Object.prototype.hasOwnProperty; + var __propIsEnum$3 = Object.prototype.propertyIsEnumerable; + var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$3 = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$3.call(b, prop)) + __defNormalProp$B(a, prop, b[prop]); + if (__getOwnPropSymbols$3) + for (var prop of __getOwnPropSymbols$3(b)) { + if (__propIsEnum$3.call(b, prop)) + __defNormalProp$B(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(TiltShiftAxisFilter$3, "__esModule", { value: true }); + var pixi_js$3 = require$$0__default["default"]; + var _default$1$3 = _default$A; + var _default$4 = default2; + var tiltShift$1 = tiltShift$3; + var tiltShift$2 = tiltShift2; + var __defProp2$3 = Object.defineProperty; + var __defNormalProp2$3 = (obj, key, value) => key in obj ? __defProp2$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$B = (obj, key, value) => { + __defNormalProp2$3(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _TiltShiftAxisFilter$1 = class _TiltShiftAxisFilter2 extends pixi_js$3.Filter { + constructor(options) { + var _a, _b; + options = __spreadValues$3(__spreadValues$3({}, _TiltShiftAxisFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$3.GpuProgram({ + vertex: { + source: _default$4["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: tiltShift$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$3.GlProgram({ + vertex: _default$1$3["default"], + fragment: tiltShift$1["default"], + name: "tilt-shift-axis-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + tiltShiftUniforms: { + uBlur: { + value: new Float32Array([ + (_a = options.blur) != null ? _a : 100, + (_b = options.gradientBlur) != null ? _b : 600 + ]), + type: "vec2" + }, + uStart: { value: options.start, type: "vec2" }, + uEnd: { value: options.end, type: "vec2" }, + uDelta: { value: new Float32Array([30, 30]), type: "vec2" }, + uTexSize: { value: new Float32Array([window.innerWidth, window.innerHeight]), type: "vec2" } + } + } + }); + __publicField$B(this, "uniforms"); + __publicField$B(this, "_tiltAxis"); + this.uniforms = this.resources.tiltShiftUniforms.uniforms; + this._tiltAxis = options.axis; + this.updateDelta(); + } + /** Updates the filter delta values. */ + updateDelta() { + this.uniforms.uDelta[0] = 0; + this.uniforms.uDelta[1] = 0; + if (this._tiltAxis === void 0) + return; + const end = this.uniforms.uEnd; + const start = this.uniforms.uStart; + const dx = end.x - start.x; + const dy = end.y - start.y; + const d = Math.sqrt(dx * dx + dy * dy); + const isVert = this._tiltAxis === "vertical"; + this.uniforms.uDelta[0] = !isVert ? dx / d : -dy / d; + this.uniforms.uDelta[1] = !isVert ? dy / d : dx / d; + } + // /** The strength of the blur. */ + // get blur(): number { return this.uniforms.uBlur[0]; } + // set blur(value: number) { this.uniforms.uBlur[0] = value; } + // /** The strength of the gradient blur. */ + // get gradientBlur(): number { return this.uniforms.uBlur[1]; } + // set gradientBlur(value: number) { this.uniforms.uBlur[1] = value; } + // /** The start position of the effect. */ + // get start(): PointData { return this.uniforms.uStart; } + // set start(value: PointData) + // { + // this.uniforms.uStart = value; + // this.updateDelta(); + // } + // /** The start position of the effect on the `x` axis. */ + // get startX(): number { return this.start.x; } + // set startX(value: number) + // { + // this.start.x = value; + // this.updateDelta(); + // } + // /** The start position of the effect on the `y` axis. */ + // get startY(): number { return this.startY; } + // set startY(value: number) + // { + // this.start.y = value; + // this.updateDelta(); + // } + // /** The end position of the effect. */ + // get end(): PointData { return this.uniforms.uEnd; } + // set end(value: PointData) + // { + // this.uniforms.uEnd = value; + // this.updateDelta(); + // } + // /** The end position of the effect on the `x` axis. */ + // get endX(): number { return this.end.x; } + // set endX(value: number) + // { + // this.end.x = value; + // this.updateDelta(); + // } + // /** The end position of the effect on the `y` axis. */ + // get endY(): number { return this.end.y; } + // set endY(value: number) + // { + // this.end.y = value; + // this.updateDelta(); + // } + }; + __publicField$B(_TiltShiftAxisFilter$1, "DEFAULT_OPTIONS", { + /** The strength of the blur. */ + blur: 100, + /** The strength of the blur gradient */ + gradientBlur: 600, + /** The position to start the effect at. */ + start: { x: 0, y: window.innerHeight / 2 }, + /** The position to end the effect at. */ + end: { x: 600, y: window.innerHeight / 2 } + }); + let TiltShiftAxisFilter$2 = _TiltShiftAxisFilter$1; + TiltShiftAxisFilter$3.TiltShiftAxisFilter = TiltShiftAxisFilter$2; + + var TiltShiftFilter$2 = {}; + + var __defProp$A = Object.defineProperty; + var __defProps = Object.defineProperties; + var __getOwnPropDescs = Object.getOwnPropertyDescriptors; + var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols; + var __hasOwnProp$2 = Object.prototype.hasOwnProperty; + var __propIsEnum$2 = Object.prototype.propertyIsEnumerable; + var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$2 = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$2.call(b, prop)) + __defNormalProp$A(a, prop, b[prop]); + if (__getOwnPropSymbols$2) + for (var prop of __getOwnPropSymbols$2(b)) { + if (__propIsEnum$2.call(b, prop)) + __defNormalProp$A(a, prop, b[prop]); + } + return a; + }; + var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); + Object.defineProperty(TiltShiftFilter$2, "__esModule", { value: true }); + var pixi_js$2 = require$$0__default["default"]; + var TiltShiftAxisFilter$1 = TiltShiftAxisFilter$3; + var __defProp2$2 = Object.defineProperty; + var __defNormalProp2$2 = (obj, key, value) => key in obj ? __defProp2$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$A = (obj, key, value) => { + __defNormalProp2$2(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + class TiltShiftFilter$1 extends TiltShiftAxisFilter$1.TiltShiftAxisFilter { + constructor(options) { + options = __spreadValues$2(__spreadValues$2({}, TiltShiftAxisFilter$1.TiltShiftAxisFilter.DEFAULT_OPTIONS), options); + super(__spreadProps(__spreadValues$2({}, options), { axis: "horizontal" })); + __publicField$A(this, "_tiltShiftYFilter"); + this._tiltShiftYFilter = new TiltShiftAxisFilter$1.TiltShiftAxisFilter(__spreadProps(__spreadValues$2({}, options), { axis: "vertical" })); + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + const renderTarget = pixi_js$2.TexturePool.getSameSizeTexture(input); + filterManager.applyFilter(this, input, renderTarget, true); + filterManager.applyFilter(this._tiltShiftYFilter, renderTarget, output, clearMode); + pixi_js$2.TexturePool.returnTexture(renderTarget); + } + /** The strength of the blur. */ + get blur() { + return this.uniforms.uBlur[0]; + } + set blur(value) { + this.uniforms.uBlur[0] = this._tiltShiftYFilter.uniforms.uBlur[0] = value; + } + /** The strength of the gradient blur. */ + get gradientBlur() { + return this.uniforms.uBlur[1]; + } + set gradientBlur(value) { + this.uniforms.uBlur[1] = this._tiltShiftYFilter.uniforms.uBlur[1] = value; + } + /** The position to start the effect at. */ + get start() { + return this.uniforms.uStart; + } + set start(value) { + this.uniforms.uStart = this._tiltShiftYFilter.uniforms.uStart = value; + } + /** The position to start the effect at on the `x` axis. */ + get startX() { + return this.start.x; + } + set startX(value) { + this.start.x = value; + } + /** The position to start the effect at on the `x` axis. */ + get startY() { + return this.start.y; + } + set startY(value) { + this.start.y = value; + } + /** The position to end the effect at. */ + get end() { + return this.uniforms.uEnd; + } + set end(value) { + this.uniforms.uEnd = this._tiltShiftYFilter.uniforms.uEnd = value; + } + /** The position to end the effect at on the `x` axis. */ + get endX() { + return this.end.x; + } + set endX(value) { + this.end.x = value; + } + /** The position to end the effect at on the `y` axis. */ + get endY() { + return this.end.y; + } + set endY(value) { + this.end.y = value; + } + } + TiltShiftFilter$2.TiltShiftFilter = TiltShiftFilter$1; + + var TwistFilter$2 = {}; + + var twist$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uTwist;\nuniform vec2 uOffset;\nuniform vec4 uInputSize;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= uInputSize.xy;\n coord += uInputSize.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= uInputSize.zw;\n coord /= uInputSize.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= uOffset;\n\n float dist = length(coord);\n float uRadius = uTwist[0];\n float uAngle = uTwist[1];\n\n if (dist < uRadius)\n {\n float ratioDist = (uRadius - dist) / uRadius;\n float angleMod = ratioDist * ratioDist * uAngle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += uOffset;\n\n return coord;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n coord = twist(coord);\n coord = unmapCoord(coord);\n finalColor = texture(uTexture, coord);\n}\n"; + exports["default"] = fragment; + })(twist$3); + + var twist2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct TwistUniforms {\n uTwist:vec2,\n uOffset:vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var twistUniforms : TwistUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n return textureSample(uTexture, uSampler, unmapCoord(twist(mapCoord(uv))));\n}\n\nfn mapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord *= gfu.uInputSize.xy;\n mappedCoord += gfu.uOutputFrame.xy;\n return mappedCoord;\n}\n\nfn unmapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord -= gfu.uOutputFrame.xy;\n mappedCoord /= gfu.uInputSize.xy;\n return mappedCoord;\n}\n\nfn twist(coord: vec2) -> vec2\n{\n var twistedCoord: vec2 = coord;\n let uRadius = twistUniforms.uTwist[0];\n let uAngle = twistUniforms.uTwist[1];\n let uOffset = twistUniforms.uOffset;\n\n twistedCoord -= uOffset;\n \n let dist = length(twistedCoord);\n\n if (dist < uRadius)\n {\n let ratioDist: f32 = (uRadius - dist) / uRadius;\n let angleMod: f32 = ratioDist * ratioDist * uAngle;\n let s: f32 = sin(angleMod);\n let c: f32 = cos(angleMod);\n twistedCoord = vec2(twistedCoord.x * c - twistedCoord.y * s, twistedCoord.x * s + twistedCoord.y * c);\n }\n\n twistedCoord += uOffset;\n return twistedCoord;\n}\n"; + exports["default"] = source; + })(twist2); + + var __defProp$z = Object.defineProperty; + var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; + var __hasOwnProp$1 = Object.prototype.hasOwnProperty; + var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; + var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues$1 = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp$1.call(b, prop)) + __defNormalProp$z(a, prop, b[prop]); + if (__getOwnPropSymbols$1) + for (var prop of __getOwnPropSymbols$1(b)) { + if (__propIsEnum$1.call(b, prop)) + __defNormalProp$z(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(TwistFilter$2, "__esModule", { value: true }); + var pixi_js$1 = require$$0__default["default"]; + var _default$1$2 = _default$A; + var _default$3 = default2; + var twist$1 = twist$3; + var twist$2 = twist2; + var __defProp2$1 = Object.defineProperty; + var __defNormalProp2$1 = (obj, key, value) => key in obj ? __defProp2$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$z = (obj, key, value) => { + __defNormalProp2$1(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _TwistFilter$1 = class _TwistFilter2 extends pixi_js$1.Filter { + constructor(options) { + var _a, _b; + options = __spreadValues$1(__spreadValues$1({}, _TwistFilter2.DEFAULT_OPTIONS), options); + const gpuProgram = new pixi_js$1.GpuProgram({ + vertex: { + source: _default$3["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: twist$2["default"], + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js$1.GlProgram({ + vertex: _default$1$2["default"], + fragment: twist$1["default"], + name: "twist-filter" + }); + super(__spreadValues$1({ + gpuProgram, + glProgram, + resources: { + twistUniforms: { + uTwist: { + value: [(_a = options.radius) != null ? _a : 0, (_b = options.angle) != null ? _b : 0], + type: "vec2" + }, + uOffset: { + value: options.offset, + type: "vec2" + } + } + } + }, options)); + __publicField$z(this, "uniforms"); + this.uniforms = this.resources.twistUniforms.uniforms; + } + /** + * The radius of the twist + * @default 200 + */ + get radius() { + return this.uniforms.uTwist[0]; + } + set radius(value) { + this.uniforms.uTwist[0] = value; + } + /** + * The angle of the twist + * @default 4 + */ + get angle() { + return this.uniforms.uTwist[1]; + } + set angle(value) { + this.uniforms.uTwist[1] = value; + } + /** + * The `x` offset coordinate to change the position of the center of the circle of effect + * @default 0 + */ + get offset() { + return this.uniforms.uOffset; + } + set offset(value) { + this.uniforms.uOffset = value; + } + /** + * The `x` offset coordinate to change the position of the center of the circle of effect + * @default 0 + */ + get offsetX() { + return this.offset.x; + } + set offsetX(value) { + this.offset.x = value; + } + /** + * The `y` offset coordinate to change the position of the center of the circle of effect + * @default 0 + */ + get offsetY() { + return this.offset.y; + } + set offsetY(value) { + this.offset.y = value; + } + }; + __publicField$z(_TwistFilter$1, "DEFAULT_OPTIONS", { + padding: 20, + radius: 200, + angle: 4, + offset: { x: 0, y: 0 } + }); + let TwistFilter$1 = _TwistFilter$1; + TwistFilter$2.TwistFilter = TwistFilter$1; + + var ZoomBlurFilter$2 = {}; + + var zoomBlur$3 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uStrength;\nuniform vec2 uCenter;\nuniform vec2 uRadii;\n\nuniform vec4 uInputSize;\n\nconst float MAX_KERNEL_SIZE = ${MAX_KERNEL_SIZE};\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n float minGradient = uRadii[0] * 0.3;\n float innerRadius = (uRadii[0] + minGradient * 0.5) / uInputSize.x;\n\n float gradient = uRadii[1] * 0.3;\n float radius = (uRadii[1] - gradient * 0.5) / uInputSize.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / uInputSize.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * uInputSize.y / uInputSize.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / uInputSize.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture(uTexture, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture(uTexture, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"; + exports["default"] = fragment; + })(zoomBlur$3); + + var zoomBlur2 = {}; + + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var source = "struct ZoomBlurUniforms {\n uStrength:f32,\n uCenter:vec2,\n uRadii:vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var zoomBlurUniforms : ZoomBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uStrength = zoomBlurUniforms.uStrength;\n let uCenter = zoomBlurUniforms.uCenter;\n let uRadii = zoomBlurUniforms.uRadii;\n\n let minGradient: f32 = uRadii[0] * 0.3;\n let innerRadius: f32 = (uRadii[0] + minGradient * 0.5) / gfu.uInputSize.x;\n\n let gradient: f32 = uRadii[1] * 0.3;\n let radius: f32 = (uRadii[1] - gradient * 0.5) / gfu.uInputSize.x;\n\n let MAX_KERNEL_SIZE: f32 = ${MAX_KERNEL_SIZE};\n\n var countLimit: f32 = MAX_KERNEL_SIZE;\n\n var dir: vec2 = vec2(uCenter / gfu.uInputSize.xy - uv);\n let dist: f32 = length(vec2(dir.x, dir.y * gfu.uInputSize.y / gfu.uInputSize.x));\n\n var strength: f32 = uStrength;\n\n var delta: f32 = 0.0;\n var gap: f32;\n\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n var returnColorOnly: bool = false;\n\n if (delta > 0.0) {\n let normalCount: f32 = gap / gfu.uInputSize.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n \n if (countLimit < 1.0)\n {\n returnColorOnly = true;;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n let offset: f32 = rand(uv, 0.0);\n\n var total: f32 = 0.0;\n var color: vec4 = vec4(0.);\n\n dir *= strength;\n\n for (var t = 0.0; t < MAX_KERNEL_SIZE; t += 1.0) {\n let percent: f32 = (t + offset) / MAX_KERNEL_SIZE;\n let weight: f32 = 4.0 * (percent - percent * percent);\n let p: vec2 = uv + dir * percent;\n let sample: vec4 = textureSample(uTexture, uSampler, p);\n \n if (t < countLimit)\n {\n color += sample * weight;\n total += weight;\n }\n }\n\n color /= total;\n\n return select(color, textureSample(uTexture, uSampler, uv), returnColorOnly);\n}\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nfn rand(co: vec2, seed: f32) -> f32\n{\n let a: f32 = 12.9898;\n let b: f32 = 78.233;\n let c: f32 = 43758.5453;\n let dt: f32 = dot(co + seed, vec2(a, b));\n let sn: f32 = modulo(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}"; + exports["default"] = source; + })(zoomBlur2); + + var __defProp$y = Object.defineProperty; + var __getOwnPropSymbols = Object.getOwnPropertySymbols; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __propIsEnum = Object.prototype.propertyIsEnumerable; + var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) + __defNormalProp$y(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) + __defNormalProp$y(a, prop, b[prop]); + } + return a; + }; + Object.defineProperty(ZoomBlurFilter$2, "__esModule", { value: true }); + var pixi_js = require$$0__default["default"]; + var _default$1$1 = _default$A; + var _default$2 = default2; + var zoomBlur$1 = zoomBlur$3; + var zoomBlur$2 = zoomBlur2; + var __defProp2 = Object.defineProperty; + var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$y = (obj, key, value) => { + __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ZoomBlurFilter$1 = class _ZoomBlurFilter2 extends pixi_js.Filter { + constructor(options) { + var _a; + options = __spreadValues(__spreadValues({}, _ZoomBlurFilter2.DEFAULT_OPTIONS), options); + const kernelSize = (_a = options.maxKernelSize) != null ? _a : 32; + const gpuProgram = new pixi_js.GpuProgram({ + vertex: { + source: _default$2["default"], + entryPoint: "mainVertex" + }, + fragment: { + source: zoomBlur$2["default"].replace("${MAX_KERNEL_SIZE}", kernelSize.toFixed(1)), + entryPoint: "mainFragment" + } + }); + const glProgram = new pixi_js.GlProgram({ + vertex: _default$1$1["default"], + fragment: zoomBlur$1["default"].replace("${MAX_KERNEL_SIZE}", kernelSize.toFixed(1)), + name: "zoom-blur-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + zoomBlurUniforms: { + uStrength: { value: options.strength, type: "f32" }, + uCenter: { value: options.center, type: "vec2" }, + uRadii: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$y(this, "uniforms"); + this.uniforms = this.resources.zoomBlurUniforms.uniforms; + Object.assign(this, options); + } + /** + * Sets the strength of the zoom blur effect + * @default 0.1 + */ + get strength() { + return this.uniforms.uStrength; + } + set strength(value) { + this.uniforms.uStrength = value; + } + /** + * The center of the zoom + * @default [0,0] + */ + get center() { + return this.uniforms.uCenter; + } + set center(value) { + this.uniforms.uCenter = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `x` axis + * @default 0 + */ + get centerX() { + return this.uniforms.uCenter.x; + } + set centerX(value) { + this.uniforms.uCenter.x = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `y` axis + * @default 0 + */ + get centerY() { + return this.uniforms.uCenter.y; + } + set centerY(value) { + this.uniforms.uCenter.y = value; + } + /** + * The inner radius of zoom. The part in inner circle won't apply zoom blur effect + * @default 0 + */ + get innerRadius() { + return this.uniforms.uRadii[0]; + } + set innerRadius(value) { + this.uniforms.uRadii[0] = value; + } + /** + * Outer radius of the effect. less than `0` equates to infinity + * @default -1 + */ + get radius() { + return this.uniforms.uRadii[1]; + } + set radius(value) { + this.uniforms.uRadii[1] = value < 0 || value === Infinity ? -1 : value; + } + }; + __publicField$y(_ZoomBlurFilter$1, "DEFAULT_OPTIONS", { + strength: 0.1, + center: { x: 0, y: 0 }, + innerRadius: 0, + radius: -1, + maxKernelSize: 32 + }); + let ZoomBlurFilter$1 = _ZoomBlurFilter$1; + ZoomBlurFilter$2.ZoomBlurFilter = ZoomBlurFilter$1; + + Object.defineProperty(lib, "__esModule", { value: true }); + var AdjustmentFilter = AdjustmentFilter$2; + var AdvancedBloomFilter = AdvancedBloomFilter$2; + var AsciiFilter = AsciiFilter$2; + var BevelFilter = BevelFilter$2; + var BloomFilter = BloomFilter$2; + var BulgePinchFilter = BulgePinchFilter$2; + var ColorGradientFilter$1 = ColorGradientFilter$3; + var CssGradientParser = CssGradientParser$2; + var ColorMapFilter = ColorMapFilter$2; + var ColorOverlayFilter = ColorOverlayFilter$2; + var ColorReplaceFilter = ColorReplaceFilter$2; + var ConvolutionFilter = ConvolutionFilter$2; + var CrossHatchFilter = CrossHatchFilter$2; + var CRTFilter = CRTFilter$2; + var _default = _default$A; + var _default$1 = default2; + var DotFilter = DotFilter$2; + var DropShadowFilter = DropShadowFilter$2; + var EmbossFilter = EmbossFilter$2; + var GlitchFilter = GlitchFilter$2; + var GlowFilter = GlowFilter$2; + var GodrayFilter = GodrayFilter$2; + var GrayscaleFilter = GrayscaleFilter$2; + var HslAdjustmentFilter = HslAdjustmentFilter$2; + var KawaseBlurFilter$1 = KawaseBlurFilter$5; + var MotionBlurFilter = MotionBlurFilter$2; + var MultiColorReplaceFilter = MultiColorReplaceFilter$2; + var OldFilmFilter = OldFilmFilter$2; + var OutlineFilter = OutlineFilter$2; + var PixelateFilter = PixelateFilter$2; + var RadialBlurFilter = RadialBlurFilter$2; + var ReflectionFilter = ReflectionFilter$2; + var RGBSplitFilter = RGBSplitFilter$2; + var ShockwaveFilter = ShockwaveFilter$2; + var SimpleLightmapFilter = SimpleLightmapFilter$2; + var TiltShiftAxisFilter = TiltShiftAxisFilter$3; + var TiltShiftFilter = TiltShiftFilter$2; + var TwistFilter = TwistFilter$2; + var ZoomBlurFilter = ZoomBlurFilter$2; + var AdjustmentFilter_1 = lib.AdjustmentFilter = AdjustmentFilter.AdjustmentFilter; + var AdvancedBloomFilter_1 = lib.AdvancedBloomFilter = AdvancedBloomFilter.AdvancedBloomFilter; + var AsciiFilter_1 = lib.AsciiFilter = AsciiFilter.AsciiFilter; + var BevelFilter_1 = lib.BevelFilter = BevelFilter.BevelFilter; + var BloomFilter_1 = lib.BloomFilter = BloomFilter.BloomFilter; + var BulgePinchFilter_1 = lib.BulgePinchFilter = BulgePinchFilter.BulgePinchFilter; + var ColorGradientFilter_1 = lib.ColorGradientFilter = ColorGradientFilter$1.ColorGradientFilter; + var angleFromCssOrientation$1 = lib.angleFromCssOrientation = CssGradientParser.angleFromCssOrientation; + var angleFromDirectionalValue$1 = lib.angleFromDirectionalValue = CssGradientParser.angleFromDirectionalValue; + var colorAsStringFromCssStop$1 = lib.colorAsStringFromCssStop = CssGradientParser.colorAsStringFromCssStop; + var offsetsFromCssColorStops$1 = lib.offsetsFromCssColorStops = CssGradientParser.offsetsFromCssColorStops; + var parseCssGradient$1 = lib.parseCssGradient = CssGradientParser.parseCssGradient; + var stopsFromCssStops$1 = lib.stopsFromCssStops = CssGradientParser.stopsFromCssStops; + var trimCssGradient$1 = lib.trimCssGradient = CssGradientParser.trimCssGradient; + var typeFromCssType$1 = lib.typeFromCssType = CssGradientParser.typeFromCssType; + var ColorMapFilter_1 = lib.ColorMapFilter = ColorMapFilter.ColorMapFilter; + var ColorOverlayFilter_1 = lib.ColorOverlayFilter = ColorOverlayFilter.ColorOverlayFilter; + var ColorReplaceFilter_1 = lib.ColorReplaceFilter = ColorReplaceFilter.ColorReplaceFilter; + var ConvolutionFilter_1 = lib.ConvolutionFilter = ConvolutionFilter.ConvolutionFilter; + var CrossHatchFilter_1 = lib.CrossHatchFilter = CrossHatchFilter.CrossHatchFilter; + var CRTFilter_1 = lib.CRTFilter = CRTFilter.CRTFilter; + var vertex$2 = lib.vertex = _default["default"]; + var wgslVertex$1 = lib.wgslVertex = _default$1["default"]; + var DotFilter_1 = lib.DotFilter = DotFilter.DotFilter; + var DropShadowFilter_1 = lib.DropShadowFilter = DropShadowFilter.DropShadowFilter; + var EmbossFilter_1 = lib.EmbossFilter = EmbossFilter.EmbossFilter; + var GlitchFilter_1 = lib.GlitchFilter = GlitchFilter.GlitchFilter; + var GlowFilter_1 = lib.GlowFilter = GlowFilter.GlowFilter; + var GodrayFilter_1 = lib.GodrayFilter = GodrayFilter.GodrayFilter; + var GrayscaleFilter_1 = lib.GrayscaleFilter = GrayscaleFilter.GrayscaleFilter; + var HslAdjustmentFilter_1 = lib.HslAdjustmentFilter = HslAdjustmentFilter.HslAdjustmentFilter; + var KawaseBlurFilter_1 = lib.KawaseBlurFilter = KawaseBlurFilter$1.KawaseBlurFilter; + var MotionBlurFilter_1 = lib.MotionBlurFilter = MotionBlurFilter.MotionBlurFilter; + var MultiColorReplaceFilter_1 = lib.MultiColorReplaceFilter = MultiColorReplaceFilter.MultiColorReplaceFilter; + var OldFilmFilter_1 = lib.OldFilmFilter = OldFilmFilter.OldFilmFilter; + var OutlineFilter_1 = lib.OutlineFilter = OutlineFilter.OutlineFilter; + var PixelateFilter_1 = lib.PixelateFilter = PixelateFilter.PixelateFilter; + var RadialBlurFilter_1 = lib.RadialBlurFilter = RadialBlurFilter.RadialBlurFilter; + var ReflectionFilter_1 = lib.ReflectionFilter = ReflectionFilter.ReflectionFilter; + var RGBSplitFilter_1 = lib.RGBSplitFilter = RGBSplitFilter.RGBSplitFilter; + var ShockwaveFilter_1 = lib.ShockwaveFilter = ShockwaveFilter.ShockwaveFilter; + var SimpleLightmapFilter_1 = lib.SimpleLightmapFilter = SimpleLightmapFilter.SimpleLightmapFilter; + var TiltShiftAxisFilter_1 = lib.TiltShiftAxisFilter = TiltShiftAxisFilter.TiltShiftAxisFilter; + var TiltShiftFilter_1 = lib.TiltShiftFilter = TiltShiftFilter.TiltShiftFilter; + var TwistFilter_1 = lib.TwistFilter = TwistFilter.TwistFilter; + var ZoomBlurFilter_1 = lib.ZoomBlurFilter = ZoomBlurFilter.ZoomBlurFilter; + + var filters$1 = /*#__PURE__*/_mergeNamespaces({ + __proto__: null, + AdjustmentFilter: AdjustmentFilter_1, + AdvancedBloomFilter: AdvancedBloomFilter_1, + AsciiFilter: AsciiFilter_1, + BevelFilter: BevelFilter_1, + BloomFilter: BloomFilter_1, + BulgePinchFilter: BulgePinchFilter_1, + ColorGradientFilter: ColorGradientFilter_1, + angleFromCssOrientation: angleFromCssOrientation$1, + angleFromDirectionalValue: angleFromDirectionalValue$1, + colorAsStringFromCssStop: colorAsStringFromCssStop$1, + offsetsFromCssColorStops: offsetsFromCssColorStops$1, + parseCssGradient: parseCssGradient$1, + stopsFromCssStops: stopsFromCssStops$1, + trimCssGradient: trimCssGradient$1, + typeFromCssType: typeFromCssType$1, + ColorMapFilter: ColorMapFilter_1, + ColorOverlayFilter: ColorOverlayFilter_1, + ColorReplaceFilter: ColorReplaceFilter_1, + ConvolutionFilter: ConvolutionFilter_1, + CrossHatchFilter: CrossHatchFilter_1, + CRTFilter: CRTFilter_1, + vertex: vertex$2, + wgslVertex: wgslVertex$1, + DotFilter: DotFilter_1, + DropShadowFilter: DropShadowFilter_1, + EmbossFilter: EmbossFilter_1, + GlitchFilter: GlitchFilter_1, + GlowFilter: GlowFilter_1, + GodrayFilter: GodrayFilter_1, + GrayscaleFilter: GrayscaleFilter_1, + HslAdjustmentFilter: HslAdjustmentFilter_1, + KawaseBlurFilter: KawaseBlurFilter_1, + MotionBlurFilter: MotionBlurFilter_1, + MultiColorReplaceFilter: MultiColorReplaceFilter_1, + OldFilmFilter: OldFilmFilter_1, + OutlineFilter: OutlineFilter_1, + PixelateFilter: PixelateFilter_1, + RadialBlurFilter: RadialBlurFilter_1, + ReflectionFilter: ReflectionFilter_1, + RGBSplitFilter: RGBSplitFilter_1, + ShockwaveFilter: ShockwaveFilter_1, + SimpleLightmapFilter: SimpleLightmapFilter_1, + TiltShiftAxisFilter: TiltShiftAxisFilter_1, + TiltShiftFilter: TiltShiftFilter_1, + TwistFilter: TwistFilter_1, + ZoomBlurFilter: ZoomBlurFilter_1, + 'default': lib + }, [lib]); + + class DemoApplication extends require$$0.Application { + constructor() { + const gui = new lil.GUI(); + gui.useLocalStorage = false; + const domElement = document.querySelector("#container"); + const initWidth = domElement.offsetWidth; + const initHeight = domElement.offsetHeight; + super(); + this.domElement = domElement; + this.resources = null; + this.initWidth = initWidth; + this.initHeight = initHeight; + this.animating = true; + this.rendering = true; + this.events = new require$$0.EventEmitter(); + this.animateTimer = 0; + this.bg = null; + this.pond = null; + this.fishCount = 20; + this.fishes = []; + this.fishFilters = []; + this.pondFilters = []; + this.filterArea = new require$$0.Rectangle(); + this.padding = 100; + this.bounds = new require$$0.Rectangle( + -this.padding, + -this.padding, + initWidth + this.padding * 2, + initHeight + this.padding * 2 + ); + this.enabledFilters = []; + const app = this; + this.gui = gui; + this.gui.add(this, "rendering").name("• Rendering").onChange((value) => { + if (!value) { + app.stop(); + } else { + app.start(); + } + }); + this.gui.add(this, "animating").name("• Animating"); + } + /** override init */ + init() { + return super.init({ + hello: true, + width: this.initWidth, + height: this.initHeight, + autoStart: false + }); + } + /** + * Load resources + * @param {object} manifest Collection of resources to load + */ + async load(manifest) { + require$$0.Assets.addBundle("bundle", manifest); + this.resources = await require$$0.Assets.loadBundle("bundle"); + this.setup(); + this.start(); + } + setup() { + document.body.appendChild(this.canvas); + const { resources } = this; + const { bounds, initWidth, initHeight } = this; + this.pond = new require$$0.Container(); + this.pond.filterArea = this.filterArea; + this.pond.filters = this.pondFilters; + this.stage.addChild(this.pond); + this.bg = new require$$0.Sprite(resources.background); + this.pond.addChild(this.bg); + const fishVariations = 5; + for (let i = 0; i < this.fishCount; i++) { + const id = `fish${i % fishVariations + 1}`; + const fish = new require$$0.Sprite(resources[id]); + fish.anchor.set(0.5); + fish.filters = this.fishFilters; + fish.direction = Math.random() * Math.PI * 2; + fish.speed = 2 + Math.random() * 2; + fish.turnSpeed = Math.random() - 0.8; + fish.x = Math.random() * bounds.width; + fish.y = Math.random() * bounds.height; + fish.scale.set(0.8 + Math.random() * 0.3); + this.pond.addChild(fish); + this.fishes.push(fish); + } + this.overlay = new require$$0.TilingSprite({ + texture: resources.overlay, + width: initWidth, + height: initHeight + }); + this.pond.addChild(this.overlay); + window.addEventListener("resize", this.handleResize.bind(this)); + this.handleResize(); + this.ticker.add(this.animate, this); + } + /** + * Resize the demo when the window resizes + */ + handleResize() { + const { padding, bg, overlay, filterArea, bounds } = this; + const width = this.domElement.offsetWidth; + const height = this.domElement.offsetHeight; + const filterAreaPadding = 0; + const bgAspect = bg.texture.width / bg.texture.height; + const winAspect = width / height; + if (winAspect > bgAspect) { + bg.width = width; + bg.height = width / bgAspect; + } else { + bg.height = height; + bg.width = height * bgAspect; + } + bg.x = (width - bg.width) / 2; + bg.y = (height - bg.height) / 2; + overlay.width = width; + overlay.height = height; + bounds.x = -padding; + bounds.y = -padding; + bounds.width = width + padding * 2; + bounds.height = height + padding * 2; + filterArea.x = filterAreaPadding; + filterArea.y = filterAreaPadding; + filterArea.width = width - filterAreaPadding * 2; + filterArea.height = height - filterAreaPadding * 2; + this.events.emit("resize", width, height); + this.renderer.resize(width, height); + this.render(); + } + /** + * Animate the fish, overlay and filters (if applicable) + * @param {number} delta - % difference in time from last frame render + */ + animate(time) { + const delta = time.deltaTime; + this.animateTimer += delta; + const { bounds, animateTimer, overlay } = this; + this.events.emit("animate", delta, animateTimer); + this.pond.filters = this.pondFilters; + if (!this.animating) { + return; + } + overlay.tilePosition.x = animateTimer * -1; + overlay.tilePosition.y = animateTimer * -1; + for (let i = 0; i < this.fishes.length; i++) { + const fish = this.fishes[i]; + fish.direction += fish.turnSpeed * 0.01; + fish.filters = this.fishFilters; + fish.x += Math.sin(fish.direction) * fish.speed; + fish.y += Math.cos(fish.direction) * fish.speed; + fish.rotation = -fish.direction - Math.PI / 2; + if (fish.x < bounds.x) { + fish.x += bounds.width; + } + if (fish.x > bounds.x + bounds.width) { + fish.x -= bounds.width; + } + if (fish.y < bounds.y) { + fish.y += bounds.height; + } + if (fish.y > bounds.y + bounds.height) { + fish.y -= bounds.height; + } + } + } + /** + * Add a new filter + * @param {string} id Class name + * @param {object|function} options The class name of filter or options + * @param {string} [options.id] The name of the filter class + * @param {boolean} [options.global] Filter is in pixi.js + * @param {array} [options.args] Constructor arguments + * @param {boolean} [options.fishOnly=false] Apply to fish only, not whole scene + * @param {boolean} [options.enabled=false] Filter is enabled by default + * @param {function} [oncreate] Function takes filter and gui folder as + * arguments and is scoped to the Demo application. + * @return {Filter} Instance of new filter + */ + addFilter(id, options) { + if (typeof options === "function") { + options = { oncreate: options }; + } + options = Object.assign({ + name: id, + enabled: false, + opened: false, + args: null, + fishOnly: false, + global: false, + oncreate: null + }, options); + if (options.global) { + options.name += " (pixi.js)"; + } + const app = this; + const folder = this.gui.addFolder(options.name).close(); + const ClassRef = filters$1[id] || require$$0__default["default"][id]; + if (!ClassRef) { + throw new Error(`Unable to find class name with "${id}"`); + } + const filter = new ClassRef(options.args); + filter.enabled = options.enabled && this.enabledFilters.length === 0 || this.enabledFilters.includes(id); + const toggleFilter = (enabled) => { + if (enabled) { + if (options.fishOnly) { + this.fishFilters.push(filter); + } else { + this.pondFilters.push(filter); + } + } else if (options.fishOnly) { + const index = this.fishFilters.indexOf(filter); + if (index !== -1) + this.fishFilters.splice(index, 1); + } else { + const index = this.pondFilters.indexOf(filter); + if (index !== -1) + this.pondFilters.splice(index, 1); + } + }; + folder.add(filter, "enabled").onChange((enabled) => { + ga("send", "event", id, enabled ? "enabled" : "disabled"); + toggleFilter(enabled); + app.events.emit("enable", enabled); + this.render(); + if (enabled) { + folder.domElement.className += " enabled"; + } else { + folder.domElement.className = folder.domElement.className.replace(" enabled", ""); + } + }); + if (filter.enabled) { + folder.open(); + folder.domElement.className += " enabled"; + } + if (options.oncreate) { + options.oncreate.call(filter, folder); + } + toggleFilter(filter.enabled); + return filter; + } + } + + function adjustment() { + this.addFilter("AdjustmentFilter", { + oncreate(folder) { + folder.add(this, "gamma", 0, 5); + folder.add(this, "saturation", 0, 5); + folder.add(this, "contrast", 0, 5); + folder.add(this, "brightness", 0, 5); + folder.add(this, "red", 0, 5); + folder.add(this, "green", 0, 5); + folder.add(this, "blue", 0, 5); + folder.add(this, "alpha", 0, 1); + } + }); + } + + function advancedBloom() { + this.addFilter("AdvancedBloomFilter", function(folder) { + folder.add(this, "threshold", 0.1, 0.9); + folder.add(this, "bloomScale", 0.5, 1.5); + folder.add(this, "brightness", 0.5, 1.5); + folder.add(this, "blur", 0, 20); + folder.add(this, "quality", 0, 20); + }); + } + + function alpha() { + this.addFilter("AlphaFilter", { + global: true, + oncreate(folder) { + folder.add(this, "alpha", 0, 1); + } + }); + } + + function ascii() { + this.addFilter("AsciiFilter", function(folder) { + folder.add(this, "size", 2, 20); + folder.addColor(this, "color"); + folder.add(this, "replaceColor"); + }); + } + + function bevel() { + this.addFilter("BevelFilter", { + fishOnly: true, + oncreate(folder) { + folder.add(this, "rotation", 0, 360); + folder.add(this, "thickness", 0, 10); + folder.addColor(this, "lightColor"); + folder.add(this, "lightAlpha", 0, 1); + folder.addColor(this, "shadowColor"); + folder.add(this, "shadowAlpha", 0, 1); + } + }); + } + + function bloom() { + this.addFilter("BloomFilter", function(folder) { + const strength = { value: this.strengthX }; + folder.add(strength, "value", 0, 20).onChange((value) => { + this.strengthX = value; + this.strengthY = value; + }); + folder.add(this, "strengthX", 0, 20); + folder.add(this, "strengthY", 0, 20); + }); + } + + function blur() { + this.addFilter("BlurFilter", { + global: true, + oncreate(folder) { + folder.add(this, "blur", 0, 100); + folder.add(this, "quality", 1, 10); + } + }); + } + + function bulgePinch() { + this.addFilter("BulgePinchFilter", function(folder) { + folder.add(this, "radius", 0, 1e3); + folder.add(this, "strength", -1, 1); + folder.add(this, "centerX", 0, 1).name("center.x"); + folder.add(this, "centerY", 0, 1).name("center.y"); + }); + } + + var vertex$1 = "in vec2 aPosition;\nout vec2 vTextureCoord;\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + + var wgslVertex = "struct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\nstruct VSOutput {\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n };\n\nfn filterVertexPosition(aPosition:vec2) -> vec4\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2 ) -> vec2\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2 ) -> vec2\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getSize() -> vec2\n{\n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2, \n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition)\n );\n}"; + + var fragment$w = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uGamma;\nuniform float uContrast;\nuniform float uSaturation;\nuniform float uBrightness;\nuniform vec4 uColor;\n\nvoid main()\n{\n vec4 c = texture(uTexture, vTextureCoord);\n\n if (c.a > 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / uGamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, uSaturation), uContrast);\n rgb.r *= uColor.r;\n rgb.g *= uColor.g;\n rgb.b *= uColor.b;\n c.rgb = rgb * uBrightness;\n\n c.rgb *= c.a;\n }\n\n finalColor = c * uColor.a;\n}\n"; + + var source$w = "struct AdjustmentUniforms {\n uGamma: f32,\n uContrast: f32,\n uSaturation: f32,\n uBrightness: f32,\n uColor: vec4,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var adjustmentUniforms : AdjustmentUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n var sample = textureSample(uTexture, uSampler, uv);\n let color = adjustmentUniforms.uColor;\n\n if (sample.a > 0.0) \n {\n sample = vec4(sample.rgb / sample.a, sample.a);\n var rgb: vec3 = pow(sample.rgb, vec3(1. / adjustmentUniforms.uGamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, adjustmentUniforms.uSaturation), adjustmentUniforms.uContrast);\n rgb.r *= color.r;\n rgb.g *= color.g;\n rgb.b *= color.b;\n sample = vec4(rgb.rgb * adjustmentUniforms.uBrightness, sample.a);\n sample = vec4(sample.rgb * sample.a, sample.a);\n }\n\n return sample * color.a;\n}"; + + var __defProp$x = Object.defineProperty; + var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$x = (obj, key, value) => { + __defNormalProp$x(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _AdjustmentFilter = class _AdjustmentFilter extends require$$0.Filter { + constructor(options) { + options = { ..._AdjustmentFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$w, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$w, + name: "adjustment-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + adjustmentUniforms: { + uGamma: { value: options.gamma, type: "f32" }, + uContrast: { value: options.contrast, type: "f32" }, + uSaturation: { value: options.saturation, type: "f32" }, + uBrightness: { value: options.brightness, type: "f32" }, + uColor: { + value: [ + options.red, + options.green, + options.blue, + options.alpha + ], + type: "vec4" + } + } + } + }); + __publicField$x(this, "uniforms"); + this.uniforms = this.resources.adjustmentUniforms.uniforms; + } + /** + * Amount of luminance + * @default 1 + */ + get gamma() { + return this.uniforms.uGamma; + } + set gamma(value) { + this.uniforms.uGamma = value; + } + /** + * Amount of contrast + * @default 1 + */ + get contrast() { + return this.uniforms.uContrast; + } + set contrast(value) { + this.uniforms.uContrast = value; + } + /** + * Amount of color saturation + * @default 1 + */ + get saturation() { + return this.uniforms.uSaturation; + } + set saturation(value) { + this.uniforms.uSaturation = value; + } + /** + * The overall brightness + * @default 1 + */ + get brightness() { + return this.uniforms.uBrightness; + } + set brightness(value) { + this.uniforms.uBrightness = value; + } + /** + * The multiplied red channel + * @default 1 + */ + get red() { + return this.uniforms.uColor[0]; + } + set red(value) { + this.uniforms.uColor[0] = value; + } + /** + * The multiplied blue channel + * @default 1 + */ + get green() { + return this.uniforms.uColor[1]; + } + set green(value) { + this.uniforms.uColor[1] = value; + } + /** + * The multiplied green channel + * @default 1 + */ + get blue() { + return this.uniforms.uColor[2]; + } + set blue(value) { + this.uniforms.uColor[2] = value; + } + /** + * The overall alpha channel + * @default 1 + */ + get alpha() { + return this.uniforms.uColor[3]; + } + set alpha(value) { + this.uniforms.uColor[3] = value; + } + }; + /** Default values for options. */ + __publicField$x(_AdjustmentFilter, "DEFAULT_OPTIONS", { + gamma: 1, + contrast: 1, + saturation: 1, + brightness: 1, + red: 1, + green: 1, + blue: 1, + alpha: 1 + }); + + var fragment$v = "\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n finalColor = color;\n}"; + + var source$v = "struct KawaseBlurUniforms {\n uOffset:vec2,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var kawaseBlurUniforms : KawaseBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uOffset = kawaseBlurUniforms.uOffset;\n var color: vec4 = vec4(0.0);\n\n // Sample top left pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x - uOffset.x, uv.y + uOffset.y));\n // Sample top right pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x + uOffset.x, uv.y + uOffset.y));\n // Sample bottom right pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x + uOffset.x, uv.y - uOffset.y));\n // Sample bottom left pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x - uOffset.x, uv.y - uOffset.y));\n // Average\n color *= 0.25;\n\n return color;\n}"; + + var fragmentClamp = "\nprecision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uOffset;\n\nuniform vec4 uInputClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Sample top right pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Sample bottom right pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Sample bottom left pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Average\n color *= 0.25;\n\n finalColor = color;\n}\n"; + + var sourceClamp = "struct KawaseBlurUniforms {\n uOffset:vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var kawaseBlurUniforms : KawaseBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uOffset = kawaseBlurUniforms.uOffset;\n var color: vec4 = vec4(0.0);\n\n // Sample top left pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x - uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample top right pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x + uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample bottom right pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x + uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample bottom left pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x - uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Average\n color *= 0.25;\n \n return color;\n}"; + + var __defProp$w = Object.defineProperty; + var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$w = (obj, key, value) => { + __defNormalProp$w(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _KawaseBlurFilter = class _KawaseBlurFilter extends require$$0.Filter { + constructor(options) { + options = { ..._KawaseBlurFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: options?.clamp ? sourceClamp : source$v, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: options?.clamp ? fragmentClamp : fragment$v, + name: "kawase-blur-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + kawaseBlurUniforms: { + uOffset: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$w(this, "uniforms"); + __publicField$w(this, "_pixelSize", { x: 0, y: 0 }); + __publicField$w(this, "_clamp"); + __publicField$w(this, "_kernels", []); + __publicField$w(this, "_blur"); + __publicField$w(this, "_quality"); + this.uniforms = this.resources.kawaseBlurUniforms.uniforms; + this._pixelSize = options.pixelSize ?? { x: 1, y: 1 }; + if (Array.isArray(options.strength)) { + this.kernels = options.strength; + } else if (typeof options.strength === "number") { + this._blur = options.strength; + this.quality = options.quality ?? 3; + } + this._clamp = !!options.clamp; + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + const uvX = this.pixelSizeX / input.source.width; + const uvY = this.pixelSizeY / input.source.height; + let offset; + if (this._quality === 1 || this._blur === 0) { + offset = this._kernels[0] + 0.5; + this.uniforms.uOffset[0] = offset * uvX; + this.uniforms.uOffset[1] = offset * uvY; + filterManager.applyFilter(this, input, output, clearMode); + } else { + const renderTarget = require$$0.TexturePool.getSameSizeTexture(input); + let source2 = input; + let target = renderTarget; + let tmp; + const last = this._quality - 1; + for (let i = 0; i < last; i++) { + offset = this._kernels[i] + 0.5; + this.uniforms.uOffset[0] = offset * uvX; + this.uniforms.uOffset[1] = offset * uvY; + filterManager.applyFilter(this, source2, target, true); + tmp = source2; + source2 = target; + target = tmp; + } + offset = this._kernels[last] + 0.5; + this.uniforms.uOffset[0] = offset * uvX; + this.uniforms.uOffset[1] = offset * uvY; + filterManager.applyFilter(this, source2, output, clearMode); + require$$0.TexturePool.returnTexture(renderTarget); + } + } + /** + * The amount of blur, value greater than `0`. + * @default 4 + */ + get strength() { + return this._blur; + } + set strength(value) { + this._blur = value; + this._generateKernels(); + } + /** + * The quality of the filter, integer greater than `1`. + * @default 3 + */ + get quality() { + return this._quality; + } + set quality(value) { + this._quality = Math.max(1, Math.round(value)); + this._generateKernels(); + } + /** + * The kernel size of the blur filter, for advanced usage + * @default [0] + */ + get kernels() { + return this._kernels; + } + set kernels(value) { + if (Array.isArray(value) && value.length > 0) { + this._kernels = value; + this._quality = value.length; + this._blur = Math.max(...value); + } else { + this._kernels = [0]; + this._quality = 1; + } + } + /** + * The size of the pixels. Large size is blurrier. For advanced usage. + * @default {x:1,y:1} + */ + get pixelSize() { + return this._pixelSize; + } + set pixelSize(value) { + this._pixelSize = value; + } + /** + * The size of the pixels on the `x` axis. Large size is blurrier. For advanced usage. + * @default 1 + */ + get pixelSizeX() { + return this.pixelSize.x; + } + set pixelSizeX(value) { + this.pixelSize.x = value; + } + /** + * The size of the pixels on the `y` axis. Large size is blurrier. For advanced usage. + * @default 1 + */ + get pixelSizeY() { + return this.pixelSize.y; + } + set pixelSizeY(value) { + this.pixelSize.y = value; + } + /** + * Get the if the filter is clamped + * @default false + */ + get clamp() { + return this._clamp; + } + /** Update padding based on kernel data */ + _updatePadding() { + this.padding = Math.ceil(this._kernels.reduce((acc, v) => acc + v + 0.5, 0)); + } + /** Auto generate kernels by blur & quality */ + _generateKernels() { + const blur = this._blur; + const quality = this._quality; + const kernels = [blur]; + if (blur > 0) { + let k = blur; + const step = blur / quality; + for (let i = 1; i < quality; i++) { + k -= step; + kernels.push(k); + } + } + this._kernels = kernels; + this._updatePadding(); + } + }; + /** Default values for options. */ + __publicField$w(_KawaseBlurFilter, "DEFAULT_OPTIONS", { + strength: 4, + quality: 3, + clamp: false, + pixelSize: { x: 1, y: 1 } + }); + let KawaseBlurFilter = _KawaseBlurFilter; + + var fragment$u = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMapTexture;\nuniform float uBloomScale;\nuniform float uBrightness;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n color.rgb *= uBrightness;\n vec4 bloomColor = vec4(texture(uMapTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= uBloomScale;\n finalColor = color + bloomColor;\n}\n"; + + var source$u = "struct AdvancedBloomUniforms {\n uBloomScale: f32,\n uBrightness: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var advancedBloomUniforms : AdvancedBloomUniforms;\n@group(1) @binding(1) var uMapTexture: texture_2d;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color = textureSample(uTexture, uSampler, uv);\n color = vec4(color.rgb * advancedBloomUniforms.uBrightness, color.a);\n\n var bloomColor = vec4(textureSample(uMapTexture, uSampler, uv).rgb, 0.0);\n bloomColor = vec4(bloomColor.rgb * advancedBloomUniforms.uBloomScale, bloomColor.a);\n \n return color + bloomColor;\n}\n"; + + var fragment$t = "\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uThreshold;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > uThreshold) {\n finalColor = color;\n } else {\n finalColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n"; + + var source$t = "struct ExtractBrightnessUniforms {\n uThreshold: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var extractBrightnessUniforms : ExtractBrightnessUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let color: vec4 = textureSample(uTexture, uSampler, uv);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccurate, but good enough for this feature.\n let max: f32 = max(max(color.r, color.g), color.b);\n let min: f32 = min(min(color.r, color.g), color.b);\n let brightness: f32 = (max + min) * 0.5;\n\n return select(vec4(0.), color, brightness > extractBrightnessUniforms.uThreshold);\n}\n"; + + var __defProp$v = Object.defineProperty; + var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$v = (obj, key, value) => { + __defNormalProp$v(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ExtractBrightnessFilter = class _ExtractBrightnessFilter extends require$$0.Filter { + constructor(options) { + options = { ..._ExtractBrightnessFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$t, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$t, + name: "extract-brightness-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + extractBrightnessUniforms: { + uThreshold: { value: options.threshold, type: "f32" } + } + } + }); + __publicField$v(this, "uniforms"); + this.uniforms = this.resources.extractBrightnessUniforms.uniforms; + } + /** + * Defines how bright a color needs to be extracted. + * @default 0.5 + */ + get threshold() { + return this.uniforms.uThreshold; + } + set threshold(value) { + this.uniforms.uThreshold = value; + } + }; + /** Default values for options. */ + __publicField$v(_ExtractBrightnessFilter, "DEFAULT_OPTIONS", { + threshold: 0.5 + }); + let ExtractBrightnessFilter = _ExtractBrightnessFilter; + + var __defProp$u = Object.defineProperty; + var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$u = (obj, key, value) => { + __defNormalProp$u(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _AdvancedBloomFilter = class _AdvancedBloomFilter extends require$$0.Filter { + constructor(options) { + options = { ..._AdvancedBloomFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$u, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$u, + name: "advanced-bloom-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + advancedBloomUniforms: { + uBloomScale: { value: options.bloomScale, type: "f32" }, + uBrightness: { value: options.brightness, type: "f32" } + }, + uMapTexture: require$$0.Texture.WHITE + } + }); + __publicField$u(this, "uniforms"); + /** To adjust the strength of the bloom. Higher values is more intense brightness. */ + __publicField$u(this, "bloomScale", 1); + /** The brightness, lower value is more subtle brightness, higher value is blown-out. */ + __publicField$u(this, "brightness", 1); + __publicField$u(this, "_extractFilter"); + __publicField$u(this, "_blurFilter"); + this.uniforms = this.resources.advancedBloomUniforms.uniforms; + this._extractFilter = new ExtractBrightnessFilter({ + threshold: options.threshold + }); + this._blurFilter = new KawaseBlurFilter({ + strength: options.kernels ?? options.blur, + quality: options.kernels ? void 0 : options.quality + }); + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + const brightTarget = require$$0.TexturePool.getSameSizeTexture(input); + this._extractFilter.apply(filterManager, input, brightTarget, true); + const bloomTarget = require$$0.TexturePool.getSameSizeTexture(input); + this._blurFilter.apply(filterManager, brightTarget, bloomTarget, true); + this.uniforms.uBloomScale = this.bloomScale; + this.uniforms.uBrightness = this.brightness; + this.resources.uMapTexture = bloomTarget.source; + filterManager.applyFilter(this, input, output, clearMode); + require$$0.TexturePool.returnTexture(bloomTarget); + require$$0.TexturePool.returnTexture(brightTarget); + } + /** + * Defines how bright a color needs to be extracted. + * @default 0.5 + */ + get threshold() { + return this._extractFilter.threshold; + } + set threshold(value) { + this._extractFilter.threshold = value; + } + /** Sets the kernels of the Blur Filter */ + get kernels() { + return this._blurFilter.kernels; + } + set kernels(value) { + this._blurFilter.kernels = value; + } + /** + * Sets the strength of the Blur properties simultaneously + * @default 2 + */ + get blur() { + return this._blurFilter.strength; + } + set blur(value) { + this._blurFilter.strength = value; + } + /** + * Sets the quality of the Blur Filter + * @default 4 + */ + get quality() { + return this._blurFilter.quality; + } + set quality(value) { + this._blurFilter.quality = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter + * @default {x:1,y:1} + */ + get pixelSize() { + return this._blurFilter.pixelSize; + } + set pixelSize(value) { + this._blurFilter.pixelSize = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter on the `x` axis + * @default 1 + */ + get pixelSizeX() { + return this._blurFilter.pixelSizeX; + } + set pixelSizeX(value) { + this._blurFilter.pixelSizeX = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter on the `y` axis + * @default 1 + */ + get pixelSizeY() { + return this._blurFilter.pixelSizeY; + } + set pixelSizeY(value) { + this._blurFilter.pixelSizeY = value; + } + }; + /** Default values for options. */ + __publicField$u(_AdvancedBloomFilter, "DEFAULT_OPTIONS", { + threshold: 0.5, + bloomScale: 1, + brightness: 1, + blur: 8, + quality: 4, + pixelSize: { x: 1, y: 1 } + }); + + var fragment$s = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uSize;\nuniform vec3 uColor;\nuniform float uReplaceColor;\n\nuniform vec4 uInputSize;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= uInputSize.xy;\n coord += uInputSize.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= uInputSize.zw;\n coord /= uInputSize.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor(coord / size) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod(coord, size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, 4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the grid position\n vec2 pixCoord = pixelate(coord, vec2(uSize));\n pixCoord = unmapCoord(pixCoord);\n\n // sample the color at grid position\n vec4 color = texture(uTexture, pixCoord);\n\n // brightness of the color as it's perceived by the human eye\n float gray = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;\n\n // determine the character to use\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(uSize));\n\n finalColor = (uReplaceColor > 0.5 ? vec4(uColor, 1.) : color) * character( n, vec2(-1.0) + modd * 2.0);\n}\n"; + + var source$s = "struct AsciiUniforms {\n uSize: f32,\n uColor: vec3,\n uReplaceColor: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var asciiUniforms : AsciiUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let pixelSize: f32 = asciiUniforms.uSize;\n let coord: vec2 = mapCoord(uv);\n\n // get the rounded color..\n var pixCoord: vec2 = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n var color = textureSample(uTexture, uSampler, pixCoord);\n\n // determine the character to use\n let gray: f32 = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;\n \n var n: f32 = 65536.0; // .\n if (gray > 0.2) {\n n = 65600.0; // :\n }\n if (gray > 0.3) {\n n = 332772.0; // *\n }\n if (gray > 0.4) {\n n = 15255086.0; // o\n }\n if (gray > 0.5) {\n n = 23385164.0; // &\n }\n if (gray > 0.6) {\n n = 15252014.0; // 8\n }\n if (gray > 0.7) {\n n = 13199452.0; // @\n }\n if (gray > 0.8) {\n n = 11512810.0; // #\n }\n\n // get the mod..\n let modd: vec2 = getMod(coord, vec2(pixelSize));\n return select(color, vec4(asciiUniforms.uColor, 1.), asciiUniforms.uReplaceColor > 0.5) * character(n, vec2(-1.0) + modd * 2.0);\n}\n\nfn pixelate(coord: vec2, size: vec2) -> vec2\n{\n return floor( coord / size ) * size;\n}\n\nfn getMod(coord: vec2, size: vec2) -> vec2\n{\n return moduloVec2( coord , size) / size;\n}\n\nfn character(n: f32, p: vec2) -> f32\n{\n var q: vec2 = floor(p*vec2(4.0, 4.0) + 2.5);\n\n if (clamp(q.x, 0.0, 4.0) == q.x)\n {\n if (clamp(q.y, 0.0, 4.0) == q.y)\n {\n if (i32(modulo(n/exp2(q.x + 5.0*q.y), 2.0)) == 1)\n {\n return 1.0;\n }\n }\n }\n\n return 0.0;\n}\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}\n\nfn moduloVec2(x: vec2, y: vec2) -> vec2\n{\n return x - y * floor(x/y);\n}\n\nfn mapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord *= gfu.uInputSize.xy;\n mappedCoord += gfu.uOutputFrame.xy;\n return mappedCoord;\n}\n\nfn unmapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord -= gfu.uOutputFrame.xy;\n mappedCoord /= gfu.uInputSize.xy;\n return mappedCoord;\n}"; + + var __defProp$t = Object.defineProperty; + var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$t = (obj, key, value) => { + __defNormalProp$t(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _AsciiFilter = class _AsciiFilter extends require$$0.Filter { + constructor(options) { + const replaceColor = options?.color && options.replaceColor !== false; + options = { ..._AsciiFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$s, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$s, + name: "ascii-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + asciiUniforms: { + uSize: { value: options.size, type: "f32" }, + uColor: { value: new Float32Array(3), type: "vec3" }, + uReplaceColor: { value: Number(replaceColor), type: "f32" } + } + } + }); + __publicField$t(this, "uniforms"); + __publicField$t(this, "_color"); + this.uniforms = this.resources.asciiUniforms.uniforms; + this._color = new require$$0.Color(); + this.color = options.color ?? 16777215; + } + /** + * The pixel size used by the filter. + * @default 8 + */ + get size() { + return this.uniforms.uSize; + } + set size(value) { + this.uniforms.uSize = value; + } + /** + * The resulting color of the ascii characters, as a 3 component RGB or numerical hex + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0xffffff + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * Determine whether or not to replace the source colors with the provided. + */ + get replaceColor() { + return this.uniforms.uReplaceColor > 0.5; + } + set replaceColor(value) { + this.uniforms.uReplaceColor = value ? 1 : 0; + } + }; + /** Default values for options. */ + __publicField$t(_AsciiFilter, "DEFAULT_OPTIONS", { + size: 8, + color: 16777215, + replaceColor: false + }); + + var fragment$r = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uTransform;\nuniform vec3 uLightColor;\nuniform float uLightAlpha;\nuniform vec3 uShadowColor;\nuniform float uShadowAlpha;\n\nuniform vec4 uInputSize;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / uInputSize) * vec2(uTransform.x, uTransform.y);\n vec4 color = texture(uTexture, vTextureCoord);\n float light = texture(uTexture, vTextureCoord - transform).a;\n float shadow = texture(uTexture, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, uLightColor, clamp((color.a - light) * uLightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, uShadowColor, clamp((color.a - shadow) * uShadowAlpha, 0.0, 1.0));\n finalColor = vec4(color.rgb * color.a, color.a);\n}\n"; + + var source$r = "struct BevelUniforms {\n uLightColor: vec3,\n uLightAlpha: f32,\n uShadowColor: vec3,\n uShadowAlpha: f32,\n uTransform: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var bevelUniforms : BevelUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let transform = vec2(1.0 / gfu.uInputSize.xy) * vec2(bevelUniforms.uTransform.x, bevelUniforms.uTransform.y);\n var color: vec4 = textureSample(uTexture, uSampler, uv);\n let lightSample: f32 = textureSample(uTexture, uSampler, uv - transform).a;\n let shadowSample: f32 = textureSample(uTexture, uSampler, uv + transform).a;\n\n let light = vec4(bevelUniforms.uLightColor, bevelUniforms.uLightAlpha);\n let shadow = vec4(bevelUniforms.uShadowColor, bevelUniforms.uShadowAlpha);\n\n color = vec4(mix(color.rgb, light.rgb, clamp((color.a - lightSample) * light.a, 0.0, 1.0)), color.a);\n color = vec4(mix(color.rgb, shadow.rgb, clamp((color.a - shadowSample) * shadow.a, 0.0, 1.0)), color.a);\n \n return vec4(color.rgb * color.a, color.a);\n}"; + + var __defProp$s = Object.defineProperty; + var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$s = (obj, key, value) => { + __defNormalProp$s(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _BevelFilter = class _BevelFilter extends require$$0.Filter { + constructor(options) { + options = { ..._BevelFilter.DEFAULT_OPTIONS, ...options }; + const rotation = (options.rotation ?? 45) * require$$0.DEG_TO_RAD; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$r, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$r, + name: "bevel-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + bevelUniforms: { + uLightColor: { value: new Float32Array(3), type: "vec3" }, + uLightAlpha: { value: options.lightAlpha, type: "f32" }, + uShadowColor: { value: new Float32Array(3), type: "vec3" }, + uShadowAlpha: { value: options.shadowAlpha, type: "f32" }, + uTransform: { value: new Float32Array(2), type: "vec2" } + } + }, + // Workaround: https://github.com/pixijs/filters/issues/230 + // applies correctly only if there is at least a single-pixel padding with alpha=0 around an image + // To solve this problem, a padding of 1 put on the filter should suffice + padding: 1 + }); + __publicField$s(this, "uniforms"); + __publicField$s(this, "_thickness"); + __publicField$s(this, "_rotation"); + __publicField$s(this, "_lightColor"); + __publicField$s(this, "_shadowColor"); + this.uniforms = this.resources.bevelUniforms.uniforms; + this._lightColor = new require$$0.Color(); + this._shadowColor = new require$$0.Color(); + this.lightColor = options.lightColor ?? 16777215; + this.shadowColor = options.shadowColor ?? 0; + Object.assign(this, options, { rotation }); + } + /** + * The angle of the light in degrees + * @default 45 + */ + get rotation() { + return this._rotation / require$$0.DEG_TO_RAD; + } + set rotation(value) { + this._rotation = value * require$$0.DEG_TO_RAD; + this._updateTransform(); + } + /** + * The thickness of the bevel + * @default 2 + */ + get thickness() { + return this._thickness; + } + set thickness(value) { + this._thickness = value; + this._updateTransform(); + } + /** + * The color value of the left & top bevel. + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0xffffff + */ + get lightColor() { + return this._lightColor.value; + } + set lightColor(value) { + this._lightColor.setValue(value); + const [r, g, b] = this._lightColor.toArray(); + this.uniforms.uLightColor[0] = r; + this.uniforms.uLightColor[1] = g; + this.uniforms.uLightColor[2] = b; + } + /** + * The alpha value of the left & top bevel. + * @default 0.7 + */ + get lightAlpha() { + return this.uniforms.uLightAlpha; + } + set lightAlpha(value) { + this.uniforms.uLightAlpha = value; + } + /** + * The color value of the right & bottom bevel. + * @default 0xffffff + */ + get shadowColor() { + return this._shadowColor.value; + } + set shadowColor(value) { + this._shadowColor.setValue(value); + const [r, g, b] = this._shadowColor.toArray(); + this.uniforms.uShadowColor[0] = r; + this.uniforms.uShadowColor[1] = g; + this.uniforms.uShadowColor[2] = b; + } + /** + * The alpha value of the right & bottom bevel. + * @default 0.7 + */ + get shadowAlpha() { + return this.uniforms.uShadowAlpha; + } + set shadowAlpha(value) { + this.uniforms.uShadowAlpha = value; + } + /** + * Update the transform matrix of offset angle. + * @private + */ + _updateTransform() { + this.uniforms.uTransform[0] = this.thickness * Math.cos(this._rotation); + this.uniforms.uTransform[1] = this.thickness * Math.sin(this._rotation); + } + }; + /** Default values for options. */ + __publicField$s(_BevelFilter, "DEFAULT_OPTIONS", { + rotation: 45, + thickness: 2, + lightColor: 16777215, + lightAlpha: 0.7, + shadowColor: 0, + shadowAlpha: 0.7 + }); + + var __defProp$r = Object.defineProperty; + var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$r = (obj, key, value) => { + __defNormalProp$r(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _BloomFilter = class _BloomFilter extends require$$0.AlphaFilter { + constructor(options) { + options = { ..._BloomFilter.DEFAULT_OPTIONS, ...options }; + super(); + __publicField$r(this, "_blurXFilter"); + __publicField$r(this, "_blurYFilter"); + __publicField$r(this, "_strength"); + this._strength = { x: 2, y: 2 }; + if (options.strength) { + if (typeof options.strength === "number") { + this._strength.x = options.strength; + this._strength.y = options.strength; + } else { + this._strength.x = options.strength.x; + this._strength.y = options.strength.y; + } + } + this._blurXFilter = new require$$0.BlurFilterPass({ + ...options, + horizontal: true, + strength: this.strengthX + }); + this._blurYFilter = new require$$0.BlurFilterPass({ + ...options, + horizontal: false, + strength: this.strengthY + }); + this._blurYFilter.blendMode = "screen"; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clear) { + const renderTarget = require$$0.TexturePool.getSameSizeTexture(input); + filterManager.applyFilter(this, input, output, clear); + this._blurXFilter.apply(filterManager, input, renderTarget, true); + this._blurYFilter.apply(filterManager, renderTarget, output, false); + require$$0.TexturePool.returnTexture(renderTarget); + } + /** + * Sets the strength of both the blurX and blurY properties simultaneously + * @default 2 + */ + get strength() { + return this._strength; + } + set strength(value) { + this._strength = typeof value === "number" ? { x: value, y: value } : value; + this._updateStrength(); + } + /** + * Sets the strength of the blur on the `x` axis + * @default 2 + */ + get strengthX() { + return this.strength.x; + } + set strengthX(value) { + this.strength.x = value; + this._updateStrength(); + } + /** + * Sets the strength of the blur on the `y` axis + * @default 2 + */ + get strengthY() { + return this.strength.y; + } + set strengthY(value) { + this.strength.y = value; + this._updateStrength(); + } + _updateStrength() { + this._blurXFilter.blur = this.strengthX; + this._blurYFilter.blur = this.strengthY; + } + }; + /** Default values for options. */ + __publicField$r(_BloomFilter, "DEFAULT_OPTIONS", { + strength: { x: 2, y: 2 }, + quality: 4, + kernelSize: 5 + }); + + var fragment$q = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uDimensions;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform float uStrength;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * uInputSize.xy;\n coord -= uCenter * uDimensions.xy;\n float distance = length(coord);\n\n if (distance < uRadius) {\n float percent = distance / uRadius;\n if (uStrength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, uRadius / distance, percent), uStrength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + uStrength * 0.75) * uRadius / distance, 1.0 - percent);\n }\n }\n\n coord += uCenter * uDimensions.xy;\n coord /= uInputSize.xy;\n vec2 clampedCoord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n vec4 color = texture(uTexture, clampedCoord);\n\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n finalColor = color;\n}\n"; + + var source$q = "struct BulgePinchUniforms {\n uDimensions: vec2,\n uCenter: vec2,\n uRadius: f32,\n uStrength: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var bulgePinchUniforms : BulgePinchUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let dimensions: vec2 = bulgePinchUniforms.uDimensions;\n let center: vec2 = bulgePinchUniforms.uCenter;\n let radius: f32 = bulgePinchUniforms.uRadius;\n let strength: f32 = bulgePinchUniforms.uStrength;\n var coord: vec2 = (uv * gfu.uInputSize.xy) - center * dimensions.xy;\n\n let distance: f32 = length(coord);\n\n if (distance < radius) {\n let percent: f32 = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += (center * dimensions.xy);\n coord /= gfu.uInputSize.xy;\n\n let clampedCoord: vec2 = clamp(coord, gfu.uInputClamp.xy, gfu.uInputClamp.zw);\n var color: vec4 = textureSample(uTexture, uSampler, clampedCoord);\n if (coord.x != clampedCoord.x && coord.y != clampedCoord.y) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n return color;\n}\n\nfn compareVec2(x: vec2, y: vec2) -> bool\n{\n if (x.x == y.x && x.y == y.y)\n {\n return true;\n }\n\n return false;\n}"; + + var __defProp$q = Object.defineProperty; + var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$q = (obj, key, value) => { + __defNormalProp$q(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _BulgePinchFilter = class _BulgePinchFilter extends require$$0.Filter { + constructor(options) { + options = { ..._BulgePinchFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$q, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$q, + name: "bulge-pinch-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + bulgePinchUniforms: { + uDimensions: { value: [0, 0], type: "vec2" }, + uCenter: { value: options.center, type: "vec2" }, + uRadius: { value: options.radius, type: "f32" }, + uStrength: { value: options.strength, type: "f32" } + } + } + }); + __publicField$q(this, "uniforms"); + this.uniforms = this.resources.bulgePinchUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * Sets the center of the effect in normalized screen coords. + * { x: 0, y: 0 } means top-left and { x: 1, y: 1 } mean bottom-right + * @default {x:0.5,y:0.5} + */ + get center() { + return this.uniforms.uCenter; + } + set center(value) { + this.uniforms.uCenter = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `x` axis + * @default 0 + */ + get centerX() { + return this.uniforms.uCenter.x; + } + set centerX(value) { + this.uniforms.uCenter.x = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `y` axis + * @default 0 + */ + get centerY() { + return this.uniforms.uCenter.y; + } + set centerY(value) { + this.uniforms.uCenter.y = value; + } + /** + * The radius of the circle of effect + * @default 100 + */ + get radius() { + return this.uniforms.uRadius; + } + set radius(value) { + this.uniforms.uRadius = value; + } + /** + * A value between -1 and 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge) + * @default 1 + */ + get strength() { + return this.uniforms.uStrength; + } + set strength(value) { + this.uniforms.uStrength = value; + } + }; + /** Default values for options. */ + __publicField$q(_BulgePinchFilter, "DEFAULT_OPTIONS", { + center: { x: 0.5, y: 0.5 }, + radius: 100, + strength: 1 + }); + + var fragment$p = "precision highp float;\nin vec2 vTextureCoord;\nin vec2 vFilterCoord;\nout vec4 finalColor;\n\nconst int TYPE_LINEAR = 0;\nconst int TYPE_RADIAL = 1;\nconst int TYPE_CONIC = 2;\nconst int MAX_STOPS = 32;\n\nuniform sampler2D uTexture;\nuniform vec4 uOptions;\nuniform vec2 uCounts;\nuniform vec3 uColors[MAX_STOPS];\nuniform vec4 uStops[MAX_STOPS];\n\nconst float PI = 3.1415926538;\nconst float PI_2 = PI*2.;\n\nstruct ColorStop {\n float offset;\n vec3 color;\n float alpha;\n};\n\nmat2 rotate2d(float angle){\n return mat2(cos(angle), -sin(angle),\n sin(angle), cos(angle));\n}\n\nfloat projectLinearPosition(vec2 pos, float angle){\n vec2 center = vec2(0.5);\n vec2 result = pos - center;\n result = rotate2d(angle) * result;\n result = result + center;\n return clamp(result.x, 0., 1.);\n}\n\nfloat projectRadialPosition(vec2 pos) {\n float r = distance(pos, vec2(0.5));\n return clamp(2.*r, 0., 1.);\n}\n\nfloat projectAnglePosition(vec2 pos, float angle) {\n vec2 center = pos - vec2(0.5);\n float polarAngle=atan(-center.y, center.x);\n return mod(polarAngle + angle, PI_2) / PI_2;\n}\n\nfloat projectPosition(vec2 pos, int type, float angle) {\n if (type == TYPE_LINEAR) {\n return projectLinearPosition(pos, angle);\n } else if (type == TYPE_RADIAL) {\n return projectRadialPosition(pos);\n } else if (type == TYPE_CONIC) {\n return projectAnglePosition(pos, angle);\n }\n\n return pos.y;\n}\n\nvoid main(void) {\n int uType = int(uOptions[0]);\n float uAngle = uOptions[1];\n float uAlpha = uOptions[2];\n float uReplace = uOptions[3];\n\n int uNumStops = int(uCounts[0]);\n float uMaxColors = uCounts[1];\n\n // current/original color\n vec4 currentColor = texture(uTexture, vTextureCoord);\n\n // skip calculations if gradient alpha is 0\n if (0.0 == uAlpha) {\n finalColor = currentColor;\n return;\n }\n\n // project position\n float y = projectPosition(vFilterCoord, int(uType), radians(uAngle));\n\n // check gradient bounds\n float offsetMin = uStops[0][0];\n float offsetMax = 0.0;\n\n int numStops = int(uNumStops);\n\n for (int i = 0; i < MAX_STOPS; i++) {\n if (i == numStops-1){ // last index\n offsetMax = uStops[i][0];\n }\n }\n\n if (y < offsetMin || y > offsetMax) {\n finalColor = currentColor;\n return;\n }\n\n // limit colors\n if (uMaxColors > 0.) {\n float stepSize = 1./uMaxColors;\n float stepNumber = float(floor(y/stepSize));\n y = stepSize * (stepNumber + 0.5);// offset by 0.5 to use color from middle of segment\n }\n\n // find color stops\n ColorStop from;\n ColorStop to;\n\n for (int i = 0; i < MAX_STOPS; i++) {\n if (y >= uStops[i][0]) {\n from = ColorStop(uStops[i][0], uColors[i], uStops[i][1]);\n to = ColorStop(uStops[i+1][0], uColors[i+1], uStops[i+1][1]);\n }\n\n if (i == numStops-1){ // last index\n break;\n }\n }\n\n // mix colors from stops\n vec4 colorFrom = vec4(from.color * from.alpha, from.alpha);\n vec4 colorTo = vec4(to.color * to.alpha, to.alpha);\n\n float segmentHeight = to.offset - from.offset;\n float relativePos = y - from.offset;// position from 0 to [segmentHeight]\n float relativePercent = relativePos / segmentHeight;// position in percent between [from.offset] and [to.offset].\n\n float gradientAlpha = uAlpha * currentColor.a;\n vec4 gradientColor = mix(colorFrom, colorTo, relativePercent) * gradientAlpha;\n\n if (uReplace < 0.5) {\n // mix resulting color with current color\n finalColor = gradientColor + currentColor*(1.-gradientColor.a);\n } else {\n // replace with gradient color\n finalColor = gradientColor;\n }\n}\n"; + + var vertex = "in vec2 aPosition;\nout vec2 vTextureCoord;\nout vec2 vFilterCoord;\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n vFilterCoord = vTextureCoord * uInputSize.xy / uOutputFrame.zw;\n}\n"; + + var source$p = "struct BaseUniforms {\n uOptions: vec4,\n uCounts: vec2,\n};\n\nstruct StopsUniforms {\n uColors: array, MAX_STOPS>,\n uStops: array, MAX_STOPS>,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var baseUniforms : BaseUniforms;\n@group(1) @binding(1) var stopsUniforms : StopsUniforms;\n\nstruct VSOutput {\n @builtin(position) position: vec4,\n @location(0) uv : vec2,\n @location(1) coord : vec2\n};\n\nfn filterVertexPosition(aPosition:vec2) -> vec4\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2 ) -> vec2\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn filterCoord( vTextureCoord:vec2 ) -> vec2\n{\n return vTextureCoord * gfu.uInputSize.xy / gfu.uOutputFrame.zw;\n}\n\nfn globalTextureCoord( aPosition:vec2 ) -> vec2\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getSize() -> vec2\n{\n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2, \n) -> VSOutput {\n let vTextureCoord: vec2 = filterTextureCoord(aPosition);\n return VSOutput(\n filterVertexPosition(aPosition),\n vTextureCoord,\n filterCoord(vTextureCoord),\n );\n}\n\nstruct ColorStop {\n offset: f32,\n color: vec3,\n alpha: f32,\n};\n\nfn rotate2d(angle: f32) -> mat2x2{\n return mat2x2(cos(angle), -sin(angle),\n sin(angle), cos(angle));\n}\n\nfn projectLinearPosition(pos: vec2, angle: f32) -> f32 {\n var center: vec2 = vec2(0.5);\n var result: vec2 = pos - center;\n result = rotate2d(angle) * result;\n result = result + center;\n return clamp(result.x, 0.0, 1.0);\n}\n\nfn projectRadialPosition(pos: vec2) -> f32 {\n var r: f32 = distance(pos, vec2(0.5));\n return clamp(2.0 * r, 0.0, 1.0);\n}\n\nfn projectAnglePosition(pos: vec2, angle: f32) -> f32 {\n var center: vec2 = pos - vec2(0.5, 0.5);\n var polarAngle: f32 = atan2(-center.y, center.x);\n return ((polarAngle + angle) % PI_2) / PI_2;\n}\n\nfn projectPosition(pos: vec2, gradientType: i32, angle: f32) -> f32 {\n if (gradientType == TYPE_LINEAR) {\n return projectLinearPosition(pos, angle);\n } else if (gradientType == TYPE_RADIAL) {\n return projectRadialPosition(pos);\n } else if (gradientType == TYPE_CONIC) {\n return projectAnglePosition(pos, angle);\n }\n\n return pos.y;\n}\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2,\n @location(1) coord : vec2\n) -> @location(0) vec4 {\n let uType: i32 = i32(baseUniforms.uOptions[0]);\n let uAngle: f32 = baseUniforms.uOptions[1];\n let uAlpha: f32 = baseUniforms.uOptions[2];\n let uReplace: f32 = baseUniforms.uOptions[3];\n\n let uNumStops: i32 = i32(baseUniforms.uCounts[0]);\n let uMaxColors: f32 = baseUniforms.uCounts[1];\n\n // current/original color\n var currentColor: vec4 = textureSample(uTexture, uSampler, uv);\n\n // skip calculations if gradient alpha is 0\n if (uAlpha == 0.0) { return currentColor; }\n\n // project position\n var y: f32 = projectPosition(coord, uType, radians(uAngle));\n\n // check gradient bounds\n var offsetMin: f32 = stopsUniforms.uStops[0][0];\n var offsetMax: f32 = 0.0;\n\n let numStops: i32 = uNumStops;\n\n for (var i: i32 = 0; i < MAX_STOPS; i = i + 1) {\n if (i == numStops - 1) { // last index\n offsetMax = stopsUniforms.uStops[i][0];\n }\n }\n\n if (y < offsetMin || y > offsetMax) { return currentColor; }\n\n // limit colors\n if (uMaxColors > 0.0) {\n var stepSize: f32 = 1.0 / uMaxColors;\n var stepNumber: f32 = floor(y / stepSize);\n y = stepSize * (stepNumber + 0.5); // offset by 0.5 to use color from middle of segment\n }\n\n // find color stops\n var stopFrom: ColorStop;\n var stopTo: ColorStop;\n\n for (var i: i32 = 0; i < MAX_STOPS; i = i + 1) {\n if (y >= stopsUniforms.uStops[i][0]) {\n stopFrom = ColorStop(stopsUniforms.uStops[i][0], stopsUniforms.uColors[i], stopsUniforms.uStops[i][1]);\n stopTo = ColorStop(stopsUniforms.uStops[i + 1][0], stopsUniforms.uColors[i + 1], stopsUniforms.uStops[i + 1][1]);\n }\n\n if (i == numStops - 1) { // last index\n break;\n }\n }\n\n // mix colors from stops\n var colorFrom: vec4 = vec4(stopFrom.color * stopFrom.alpha, stopFrom.alpha);\n var colorTo: vec4 = vec4(stopTo.color * stopTo.alpha, stopTo.alpha);\n\n var segmentHeight: f32 = stopTo.offset - stopFrom.offset;\n var relativePos: f32 = y - stopFrom.offset; // position from 0 to [segmentHeight]\n var relativePercent: f32 = relativePos / segmentHeight; // position in percent between [from.offset] and [to.offset].\n\n var gradientAlpha: f32 = uAlpha * currentColor.a;\n var gradientColor: vec4 = mix(colorFrom, colorTo, relativePercent) * gradientAlpha;\n\n if (uReplace < 0.5) {\n // mix resulting color with current color\n return gradientColor + currentColor * (1.0 - gradientColor.a);\n } else {\n // replace with gradient color\n return gradientColor;\n }\n}\n\nconst PI: f32 = 3.14159265358979323846264;\nconst PI_2: f32 = PI * 2.0;\n\nconst TYPE_LINEAR: i32 = 0;\nconst TYPE_RADIAL: i32 = 1;\nconst TYPE_CONIC: i32 = 2;\nconst MAX_STOPS: i32 = 32;"; + + // Copyright (c) 2014 Rafael Caricio. All rights reserved. + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + + var GradientParser = (GradientParser || {}); + + GradientParser.stringify = (function() { + + var visitor = { + + 'visit_linear-gradient': function(node) { + return visitor.visit_gradient(node); + }, + + 'visit_repeating-linear-gradient': function(node) { + return visitor.visit_gradient(node); + }, + + 'visit_radial-gradient': function(node) { + return visitor.visit_gradient(node); + }, + + 'visit_repeating-radial-gradient': function(node) { + return visitor.visit_gradient(node); + }, + + 'visit_gradient': function(node) { + var orientation = visitor.visit(node.orientation); + if (orientation) { + orientation += ', '; + } + + return node.type + '(' + orientation + visitor.visit(node.colorStops) + ')'; + }, + + 'visit_shape': function(node) { + var result = node.value, + at = visitor.visit(node.at), + style = visitor.visit(node.style); + + if (style) { + result += ' ' + style; + } + + if (at) { + result += ' at ' + at; + } + + return result; + }, + + 'visit_default-radial': function(node) { + var result = '', + at = visitor.visit(node.at); + + if (at) { + result += at; + } + return result; + }, + + 'visit_extent-keyword': function(node) { + var result = node.value, + at = visitor.visit(node.at); + + if (at) { + result += ' at ' + at; + } + + return result; + }, + + 'visit_position-keyword': function(node) { + return node.value; + }, + + 'visit_position': function(node) { + return visitor.visit(node.value.x) + ' ' + visitor.visit(node.value.y); + }, + + 'visit_%': function(node) { + return node.value + '%'; + }, + + 'visit_em': function(node) { + return node.value + 'em'; + }, + + 'visit_px': function(node) { + return node.value + 'px'; + }, + + 'visit_literal': function(node) { + return visitor.visit_color(node.value, node); + }, + + 'visit_hex': function(node) { + return visitor.visit_color('#' + node.value, node); + }, + + 'visit_rgb': function(node) { + return visitor.visit_color('rgb(' + node.value.join(', ') + ')', node); + }, + + 'visit_rgba': function(node) { + return visitor.visit_color('rgba(' + node.value.join(', ') + ')', node); + }, + + 'visit_color': function(resultColor, node) { + var result = resultColor, + length = visitor.visit(node.length); + + if (length) { + result += ' ' + length; + } + return result; + }, + + 'visit_angular': function(node) { + return node.value + 'deg'; + }, + + 'visit_directional': function(node) { + return 'to ' + node.value; + }, + + 'visit_array': function(elements) { + var result = '', + size = elements.length; + + elements.forEach(function(element, i) { + result += visitor.visit(element); + if (i < size - 1) { + result += ', '; + } + }); + + return result; + }, + + 'visit': function(element) { + if (!element) { + return ''; + } + var result = ''; + + if (element instanceof Array) { + return visitor.visit_array(element, result); + } else if (element.type) { + var nodeVisitor = visitor['visit_' + element.type]; + if (nodeVisitor) { + return nodeVisitor(element); + } else { + throw Error('Missing visitor visit_' + element.type); + } + } else { + throw Error('Invalid node.'); + } + } + + }; + + return function(root) { + return visitor.visit(root); + }; + })(); + + // Copyright (c) 2014 Rafael Caricio. All rights reserved. + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + + var GradientParser = (GradientParser || {}); + + GradientParser.parse = (function() { + + var tokens = { + linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i, + repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i, + radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i, + repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i, + sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i, + extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/, + positionKeywords: /^(left|center|right|top|bottom)/i, + pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/, + percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/, + emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/, + angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/, + startCall: /^\(/, + endCall: /^\)/, + comma: /^,/, + hexColor: /^\#([0-9a-fA-F]+)/, + literalColor: /^([a-zA-Z]+)/, + rgbColor: /^rgb/i, + rgbaColor: /^rgba/i, + number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/ + }; + + var input = ''; + + function error(msg) { + var err = new Error(input + ': ' + msg); + err.source = input; + throw err; + } + + function getAST() { + var ast = matchListDefinitions(); + + if (input.length > 0) { + error('Invalid input not EOF'); + } + + return ast; + } + + function matchListDefinitions() { + return matchListing(matchDefinition); + } + + function matchDefinition() { + return matchGradient( + 'linear-gradient', + tokens.linearGradient, + matchLinearOrientation) || + + matchGradient( + 'repeating-linear-gradient', + tokens.repeatingLinearGradient, + matchLinearOrientation) || + + matchGradient( + 'radial-gradient', + tokens.radialGradient, + matchListRadialOrientations) || + + matchGradient( + 'repeating-radial-gradient', + tokens.repeatingRadialGradient, + matchListRadialOrientations); + } + + function matchGradient(gradientType, pattern, orientationMatcher) { + return matchCall(pattern, function(captures) { + + var orientation = orientationMatcher(); + if (orientation) { + if (!scan(tokens.comma)) { + error('Missing comma before color stops'); + } + } + + return { + type: gradientType, + orientation: orientation, + colorStops: matchListing(matchColorStop) + }; + }); + } + + function matchCall(pattern, callback) { + var captures = scan(pattern); + + if (captures) { + if (!scan(tokens.startCall)) { + error('Missing ('); + } + + var result = callback(captures); + + if (!scan(tokens.endCall)) { + error('Missing )'); + } + + return result; + } + } + + function matchLinearOrientation() { + return matchSideOrCorner() || + matchAngle(); + } + + function matchSideOrCorner() { + return match('directional', tokens.sideOrCorner, 1); + } + + function matchAngle() { + return match('angular', tokens.angleValue, 1); + } + + function matchListRadialOrientations() { + var radialOrientations, + radialOrientation = matchRadialOrientation(), + lookaheadCache; + + if (radialOrientation) { + radialOrientations = []; + radialOrientations.push(radialOrientation); + + lookaheadCache = input; + if (scan(tokens.comma)) { + radialOrientation = matchRadialOrientation(); + if (radialOrientation) { + radialOrientations.push(radialOrientation); + } else { + input = lookaheadCache; + } + } + } + + return radialOrientations; + } + + function matchRadialOrientation() { + var radialType = matchCircle() || + matchEllipse(); + + if (radialType) { + radialType.at = matchAtPosition(); + } else { + var extent = matchExtentKeyword(); + if (extent) { + radialType = extent; + var positionAt = matchAtPosition(); + if (positionAt) { + radialType.at = positionAt; + } + } else { + var defaultPosition = matchPositioning(); + if (defaultPosition) { + radialType = { + type: 'default-radial', + at: defaultPosition + }; + } + } + } + + return radialType; + } + + function matchCircle() { + var circle = match('shape', /^(circle)/i, 0); + + if (circle) { + circle.style = matchLength() || matchExtentKeyword(); + } + + return circle; + } + + function matchEllipse() { + var ellipse = match('shape', /^(ellipse)/i, 0); + + if (ellipse) { + ellipse.style = matchDistance() || matchExtentKeyword(); + } + + return ellipse; + } + + function matchExtentKeyword() { + return match('extent-keyword', tokens.extentKeywords, 1); + } + + function matchAtPosition() { + if (match('position', /^at/, 0)) { + var positioning = matchPositioning(); + + if (!positioning) { + error('Missing positioning value'); + } + + return positioning; + } + } + + function matchPositioning() { + var location = matchCoordinates(); + + if (location.x || location.y) { + return { + type: 'position', + value: location + }; + } + } + + function matchCoordinates() { + return { + x: matchDistance(), + y: matchDistance() + }; + } + + function matchListing(matcher) { + var captures = matcher(), + result = []; + + if (captures) { + result.push(captures); + while (scan(tokens.comma)) { + captures = matcher(); + if (captures) { + result.push(captures); + } else { + error('One extra comma'); + } + } + } + + return result; + } + + function matchColorStop() { + var color = matchColor(); + + if (!color) { + error('Expected color definition'); + } + + color.length = matchDistance(); + return color; + } + + function matchColor() { + return matchHexColor() || + matchRGBAColor() || + matchRGBColor() || + matchLiteralColor(); + } + + function matchLiteralColor() { + return match('literal', tokens.literalColor, 0); + } + + function matchHexColor() { + return match('hex', tokens.hexColor, 1); + } + + function matchRGBColor() { + return matchCall(tokens.rgbColor, function() { + return { + type: 'rgb', + value: matchListing(matchNumber) + }; + }); + } + + function matchRGBAColor() { + return matchCall(tokens.rgbaColor, function() { + return { + type: 'rgba', + value: matchListing(matchNumber) + }; + }); + } + + function matchNumber() { + return scan(tokens.number)[1]; + } + + function matchDistance() { + return match('%', tokens.percentageValue, 1) || + matchPositionKeyword() || + matchLength(); + } + + function matchPositionKeyword() { + return match('position-keyword', tokens.positionKeywords, 1); + } + + function matchLength() { + return match('px', tokens.pixelValue, 1) || + match('em', tokens.emValue, 1); + } + + function match(type, pattern, captureIndex) { + var captures = scan(pattern); + if (captures) { + return { + type: type, + value: captures[captureIndex] + }; + } + } + + function scan(regexp) { + var captures, + blankCaptures; + + blankCaptures = /^[\n\r\t\s]+/.exec(input); + if (blankCaptures) { + consume(blankCaptures[0].length); + } + + captures = regexp.exec(input); + if (captures) { + consume(captures[0].length); + } + + return captures; + } + + function consume(size) { + input = input.substr(size); + } + + return function(code) { + input = code.toString(); + return getAST(); + }; + })(); + + var parse = GradientParser.parse; + GradientParser.stringify; + + function parseCssGradient(cssGradient) { + const cssGradientNodes = parse(trimCssGradient(cssGradient)); + if (cssGradientNodes.length === 0) { + throw new Error("Invalid CSS gradient."); + } else if (cssGradientNodes.length !== 1) { + throw new Error("Unsupported CSS gradient (multiple gradients is not supported)."); + } + const cssGradientNode = cssGradientNodes[0]; + const type = typeFromCssType(cssGradientNode.type); + const stops = stopsFromCssStops(cssGradientNode.colorStops); + const angle = angleFromCssOrientation(cssGradientNode.orientation); + return { + type, + stops, + angle + }; + } + function typeFromCssType(type) { + const supportedTypes = { + "linear-gradient": 0, + "radial-gradient": 1 + }; + if (!(type in supportedTypes)) { + throw new Error(`Unsupported gradient type "${type}"`); + } + return supportedTypes[type]; + } + function stopsFromCssStops(stops) { + const offsets = offsetsFromCssColorStops(stops); + const result = []; + const color = new require$$0.Color(); + for (let i = 0; i < stops.length; i++) { + const colorString = colorAsStringFromCssStop(stops[i]); + const rgbaColor = color.setValue(colorString).toArray(); + result.push({ + offset: offsets[i], + color: rgbaColor.slice(0, 3), + alpha: rgbaColor[3] + }); + } + return result; + } + function colorAsStringFromCssStop(stop) { + switch (stop.type) { + case "hex": + return `#${stop.value}`; + case "literal": + return stop.value; + default: + return `${stop.type}(${stop.value.join(",")})`; + } + } + function offsetsFromCssColorStops(stops) { + const offsets = []; + const dynamicOffset = -1; + for (let i = 0; i < stops.length; i++) { + const cssStop = stops[i]; + let stopOffset = dynamicOffset; + if (cssStop.type === "literal") { + if (cssStop.length && "type" in cssStop.length && cssStop.length.type === "%" && "value" in cssStop.length) { + stopOffset = parseFloat(cssStop.length.value) / 100; + } + } + offsets.push(stopOffset); + } + const findNextFixedStop = (fromIndex) => { + for (let k = fromIndex; k < offsets.length; k++) { + if (offsets[k] !== dynamicOffset) { + return { + indexDelta: k - fromIndex, + offset: offsets[k] + }; + } + } + return { + indexDelta: offsets.length - 1 - fromIndex, + offset: 1 + }; + }; + let prevFixedOffset = 0; + for (let i = 0; i < offsets.length; i++) { + const offset = offsets[i]; + if (offset !== dynamicOffset) { + prevFixedOffset = offset; + } else if (i === 0) { + offsets[i] = 0; + } else if (i + 1 === offsets.length) { + offsets[i] = 1; + } else { + const nextFixed = findNextFixedStop(i); + const offsetDelta = nextFixed.offset - prevFixedOffset; + const stepSize = offsetDelta / (1 + nextFixed.indexDelta); + for (let s = 0; s <= nextFixed.indexDelta; s++) { + offsets[i + s] = prevFixedOffset + (s + 1) * stepSize; + } + i += nextFixed.indexDelta; + prevFixedOffset = offsets[i]; + } + } + return offsets.map(fixFloatRounding); + } + function fixFloatRounding(value) { + const maxLength = 6; + if (value.toString().length > maxLength) { + return parseFloat(value.toString().substring(0, maxLength)); + } + return value; + } + function angleFromCssOrientation(orientation) { + if (typeof orientation === "undefined") { + return 0; + } + if ("type" in orientation && "value" in orientation) { + switch (orientation.type) { + case "angular": + return parseFloat(orientation.value); + case "directional": + return angleFromDirectionalValue(orientation.value); + } + } + return 0; + } + function angleFromDirectionalValue(value) { + const supportedValues = { + left: 270, + top: 0, + bottom: 180, + right: 90, + "left top": 315, + "top left": 315, + "left bottom": 225, + "bottom left": 225, + "right top": 45, + "top right": 45, + "right bottom": 135, + "bottom right": 135 + }; + if (!(value in supportedValues)) { + throw new Error(`Unsupported directional value "${value}"`); + } + return supportedValues[value]; + } + function trimCssGradient(value) { + let value_ = value.replace(/\s{2,}/gu, " "); + value_ = value_.replace(/;/g, ""); + value_ = value_.replace(/ ,/g, ","); + value_ = value_.replace(/\( /g, "("); + value_ = value_.replace(/ \)/g, ")"); + return value_.trim(); + } + + var __defProp$p = Object.defineProperty; + var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$p = (obj, key, value) => { + __defNormalProp$p(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const ANGLE_OFFSET = 90; + function sortColorStops(stops) { + return [...stops].sort((a, b) => a.offset - b.offset); + } + const _ColorGradientFilter = class _ColorGradientFilter extends require$$0.Filter { + /** + * @param {DefaultOptions | CssOptions} [options] + * @param {number} [options.alpha=1.0] - Alpha value + * @param {number} [options.maxColors=0] - Maximum number of colors to render (0 = disabled) + */ + constructor(options) { + if (options && "css" in options) { + options = { + ...parseCssGradient(options.css || ""), + alpha: options.alpha ?? _ColorGradientFilter.defaults.alpha, + maxColors: options.maxColors ?? _ColorGradientFilter.defaults.maxColors + }; + } else { + options = { ..._ColorGradientFilter.defaults, ...options }; + } + if (!options.stops || options.stops.length < 2) { + throw new Error("ColorGradientFilter requires at least 2 color stops."); + } + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: source$p, + entryPoint: "mainVertex" + }, + fragment: { + source: source$p, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex, + fragment: fragment$p, + name: "color-gradient-filter" + }); + const maxStops = 32; + super({ + gpuProgram, + glProgram, + resources: { + baseUniforms: { + uOptions: { + value: [ + // Gradient Type + options.type, + // Gradient Angle + options.angle ?? ANGLE_OFFSET, + // Master Alpha + options.alpha, + // Replace Base Color + options.replace ? 1 : 0 + ], + type: "vec4" + }, + uCounts: { + value: [ + // Number of Stops + options.stops.length, + // Max Gradient Colors + options.maxColors + ], + type: "vec2" + } + }, + stopsUniforms: { + uColors: { value: new Float32Array(maxStops * 3), type: "vec3", size: maxStops }, + // We only need vec2, but we need to pad to eliminate the WGSL warning, TODO: @Mat ? + uStops: { value: new Float32Array(maxStops * 4), type: "vec4", size: maxStops } + } + } + }); + __publicField$p(this, "baseUniforms"); + __publicField$p(this, "stopsUniforms"); + __publicField$p(this, "_stops", []); + this.baseUniforms = this.resources.baseUniforms.uniforms; + this.stopsUniforms = this.resources.stopsUniforms.uniforms; + Object.assign(this, options); + } + get stops() { + return this._stops; + } + set stops(stops) { + const sortedStops = sortColorStops(stops); + const color = new require$$0.Color(); + let r; + let g; + let b; + for (let i = 0; i < sortedStops.length; i++) { + color.setValue(sortedStops[i].color); + const indexStart = i * 3; + [r, g, b] = color.toArray(); + this.stopsUniforms.uColors[indexStart] = r; + this.stopsUniforms.uColors[indexStart + 1] = g; + this.stopsUniforms.uColors[indexStart + 2] = b; + this.stopsUniforms.uStops[i * 4] = sortedStops[i].offset; + this.stopsUniforms.uStops[i * 4 + 1] = sortedStops[i].alpha; + } + this.baseUniforms.uCounts[0] = sortedStops.length; + this._stops = sortedStops; + } + /** + * The type of gradient + * @default ColorGradientFilter.LINEAR + */ + get type() { + return this.baseUniforms.uOptions[0]; + } + set type(value) { + this.baseUniforms.uOptions[0] = value; + } + /** + * The angle of the gradient in degrees + * @default 90 + */ + get angle() { + return this.baseUniforms.uOptions[1] + ANGLE_OFFSET; + } + set angle(value) { + this.baseUniforms.uOptions[1] = value - ANGLE_OFFSET; + } + /** + * The alpha value of the gradient (0-1) + * @default 1 + */ + get alpha() { + return this.baseUniforms.uOptions[2]; + } + set alpha(value) { + this.baseUniforms.uOptions[2] = value; + } + /** + * The maximum number of colors to render (0 = no limit) + * @default 0 + */ + get maxColors() { + return this.baseUniforms.uCounts[1]; + } + set maxColors(value) { + this.baseUniforms.uCounts[1] = value; + } + /** + * If true, the gradient will replace the existing color, otherwise it + * will be multiplied with it + * @default false + */ + get replace() { + return this.baseUniforms.uOptions[3] > 0.5; + } + set replace(value) { + this.baseUniforms.uOptions[3] = value ? 1 : 0; + } + }; + /** Gradient types */ + __publicField$p(_ColorGradientFilter, "LINEAR", 0); + __publicField$p(_ColorGradientFilter, "RADIAL", 1); + __publicField$p(_ColorGradientFilter, "CONIC", 2); + /** Default constructor options */ + __publicField$p(_ColorGradientFilter, "defaults", { + type: _ColorGradientFilter.LINEAR, + stops: [ + { offset: 0, color: 16711680, alpha: 1 }, + { offset: 1, color: 255, alpha: 1 } + ], + alpha: 1, + angle: 90, + maxColors: 0, + replace: false + }); + let ColorGradientFilter = _ColorGradientFilter; + + var fragment$o = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMapTexture;\nuniform float uMix;\nuniform float uSize;\nuniform float uSliceSize;\nuniform float uSlicePixelSize;\nuniform float uSliceInnerSize;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord.xy);\n vec4 adjusted;\n\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = uSize - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = uSlicePixelSize * 0.5 + color.r * uSliceInnerSize;\n float s0 = xOffset + (zSlice0 * uSliceSize);\n float s1 = xOffset + (zSlice1 * uSliceSize);\n float yOffset = uSliceSize * 0.5 + color.g * (1.0 - uSliceSize);\n vec4 slice0Color = texture(uMapTexture, vec2(s0,yOffset));\n vec4 slice1Color = texture(uMapTexture, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n\n finalColor = vec4(mix(color, adjusted, uMix).rgb, color.a);\n\n}"; + + var source$o = "struct ColorMapUniforms {\n uMix: f32,\n uSize: f32,\n uSliceSize: f32,\n uSlicePixelSize: f32,\n uSliceInnerSize: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var colorMapUniforms : ColorMapUniforms;\n@group(1) @binding(1) var uMapTexture: texture_2d;\n@group(1) @binding(2) var uMapSampler: sampler;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color:vec4 = textureSample(uTexture, uSampler, uv);\n\n var adjusted: vec4;\n\n var altColor: vec4 = vec4(color.rgb / color.a, color.a);\n let innerWidth: f32 = colorMapUniforms.uSize - 1.0;\n let zSlice0: f32 = min(floor(color.b * innerWidth), innerWidth);\n let zSlice1: f32 = min(zSlice0 + 1.0, innerWidth);\n let xOffset: f32 = colorMapUniforms.uSlicePixelSize * 0.5 + color.r * colorMapUniforms.uSliceInnerSize;\n let s0: f32 = xOffset + (zSlice0 * colorMapUniforms.uSliceSize);\n let s1: f32 = xOffset + (zSlice1 * colorMapUniforms.uSliceSize);\n let yOffset: f32 = colorMapUniforms.uSliceSize * 0.5 + color.g * (1.0 - colorMapUniforms.uSliceSize);\n let slice0Color: vec4 = textureSample(uMapTexture, uMapSampler, vec2(s0,yOffset));\n let slice1Color: vec4 = textureSample(uMapTexture, uMapSampler, vec2(s1,yOffset));\n let zOffset: f32 = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n altColor = vec4(color.rgb * color.a, color.a);\n\n let realColor: vec4 = select(color, altColor, color.a > 0.0);\n\n return vec4(mix(realColor, adjusted, colorMapUniforms.uMix).rgb, realColor.a);\n}"; + + var __defProp$o = Object.defineProperty; + var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$o = (obj, key, value) => { + __defNormalProp$o(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ColorMapFilter = class _ColorMapFilter extends require$$0.Filter { + constructor(options) { + options = { ..._ColorMapFilter.DEFAULT_OPTIONS, ...options }; + if (!options.colorMap) + throw Error("No color map texture source was provided to ColorMapFilter"); + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$o, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$o, + name: "color-map-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + colorMapUniforms: { + uMix: { value: options.mix, type: "f32" }, + uSize: { value: 0, type: "f32" }, + uSliceSize: { value: 0, type: "f32" }, + uSlicePixelSize: { value: 0, type: "f32" }, + uSliceInnerSize: { value: 0, type: "f32" } + }, + uMapTexture: options.colorMap.source, + uMapSampler: options.colorMap.source.style + } + }); + __publicField$o(this, "uniforms"); + __publicField$o(this, "_size", 0); + __publicField$o(this, "_sliceSize", 0); + __publicField$o(this, "_slicePixelSize", 0); + __publicField$o(this, "_sliceInnerSize", 0); + __publicField$o(this, "_nearest", false); + __publicField$o(this, "_scaleMode", "linear"); + __publicField$o(this, "_colorMap"); + this.uniforms = this.resources.colorMapUniforms.uniforms; + Object.assign(this, options); + } + /** The mix from 0 to 1, where 0 is the original image and 1 is the color mapped image. */ + get mix() { + return this.uniforms.uMix; + } + set mix(value) { + this.uniforms.uMix = value; + } + /** + * The size of one color slice. + * @readonly + */ + get colorSize() { + return this._size; + } + /** The colorMap texture. */ + get colorMap() { + return this._colorMap; + } + set colorMap(value) { + if (!value || value === this.colorMap) + return; + const source2 = value instanceof require$$0.Texture ? value.source : value; + source2.style.scaleMode = this._scaleMode; + source2.autoGenerateMipmaps = false; + this._size = source2.height; + this._sliceSize = 1 / this._size; + this._slicePixelSize = this._sliceSize / this._size; + this._sliceInnerSize = this._slicePixelSize * (this._size - 1); + this.uniforms.uSize = this._size; + this.uniforms.uSliceSize = this._sliceSize; + this.uniforms.uSlicePixelSize = this._slicePixelSize; + this.uniforms.uSliceInnerSize = this._sliceInnerSize; + this.resources.uMapTexture = source2; + this._colorMap = value; + } + /** Whether use NEAREST for colorMap texture. */ + get nearest() { + return this._nearest; + } + set nearest(nearest) { + this._nearest = nearest; + this._scaleMode = nearest ? "nearest" : "linear"; + const texture = this._colorMap; + if (texture && texture.source) { + texture.source.scaleMode = this._scaleMode; + texture.source.autoGenerateMipmaps = false; + texture.source.style.update(); + texture.source.update(); + } + } + /** + * If the colorMap is based on canvas, + * and the content of canvas has changed, then call `updateColorMap` for update texture. + */ + updateColorMap() { + const texture = this._colorMap; + if (texture?.source) { + texture.source.update(); + this.colorMap = texture; + } + } + /** + * Destroys this filter + * @default false + */ + destroy() { + this._colorMap?.destroy( + /** true | TODO: Should base texture be destroyed? **/ + ); + super.destroy(); + } + }; + /** Default values for options. */ + __publicField$o(_ColorMapFilter, "DEFAULT_OPTIONS", { + colorMap: require$$0.Texture.WHITE, + nearest: false, + mix: 1 + }); + + var fragment$n = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec3 uColor;\nuniform float uAlpha;\n\nvoid main(void) {\n vec4 c = texture(uTexture, vTextureCoord);\n finalColor = vec4(mix(c.rgb, uColor.rgb, c.a * uAlpha), c.a);\n}\n"; + + var source$n = "struct ColorOverlayUniforms {\n uColor: vec3,\n uAlpha: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var colorOverlayUniforms : ColorOverlayUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let c = textureSample(uTexture, uSampler, uv);\n return vec4(mix(c.rgb, colorOverlayUniforms.uColor.rgb, c.a * colorOverlayUniforms.uAlpha), c.a);\n}\n"; + + var __defProp$n = Object.defineProperty; + var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$n = (obj, key, value) => { + __defNormalProp$n(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ColorOverlayFilter = class _ColorOverlayFilter extends require$$0.Filter { + constructor(options = {}) { + options = { ..._ColorOverlayFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$n, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$n, + name: "color-overlay-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + colorOverlayUniforms: new require$$0.UniformGroup({ + uColor: { value: new Float32Array(3), type: "vec3" }, + uAlpha: { value: options.alpha, type: "f32" } + }) + } + }); + __publicField$n(this, "uniforms"); + __publicField$n(this, "_color"); + this.uniforms = this.resources.colorOverlayUniforms.uniforms; + this._color = new require$$0.Color(); + this.color = options.color ?? 0; + } + /** + * The over color source + * @member {number|Array|Float32Array} + * @default 0x000000 + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * The alpha value of the color + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + }; + /** Default shockwave filter options */ + __publicField$n(_ColorOverlayFilter, "DEFAULT_OPTIONS", { + /** The color of the overlay */ + color: 0, + /** The alpha of the overlay */ + alpha: 1 + }); + + var fragment$m = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec3 uOriginalColor;\nuniform vec3 uTargetColor;\nuniform float uTolerance;\n\nvoid main(void) {\n vec4 c = texture(uTexture, vTextureCoord);\n vec3 colorDiff = uOriginalColor - (c.rgb / max(c.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, uTolerance);\n finalColor = vec4(mix(c.rgb, (uTargetColor + colorDiff) * c.a, doReplace), c.a);\n}\n"; + + var source$m = "struct ColorReplaceUniforms {\n uOriginalColor: vec3,\n uTargetColor: vec3,\n uTolerance: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var colorReplaceUniforms : ColorReplaceUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let sample: vec4 = textureSample(uTexture, uSampler, uv);\n\n let colorDiff: vec3 = colorReplaceUniforms.uOriginalColor - (sample.rgb / max(sample.a, 0.0000000001));\n let colorDistance: f32 = length(colorDiff);\n let doReplace: f32 = step(colorDistance, colorReplaceUniforms.uTolerance);\n\n return vec4(mix(sample.rgb, (colorReplaceUniforms.uTargetColor + colorDiff) * sample.a, doReplace), sample.a);\n}"; + + var __defProp$m = Object.defineProperty; + var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$m = (obj, key, value) => { + __defNormalProp$m(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ColorReplaceFilter = class _ColorReplaceFilter extends require$$0.Filter { + constructor(options) { + options = { ..._ColorReplaceFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$m, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$m, + name: "color-replace-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + colorReplaceUniforms: { + uOriginalColor: { value: new Float32Array(3), type: "vec3" }, + uTargetColor: { value: new Float32Array(3), type: "vec3" }, + uTolerance: { value: options.tolerance, type: "f32" } + } + } + }); + __publicField$m(this, "uniforms"); + __publicField$m(this, "_originalColor"); + __publicField$m(this, "_targetColor"); + this.uniforms = this.resources.colorReplaceUniforms.uniforms; + this._originalColor = new require$$0.Color(); + this._targetColor = new require$$0.Color(); + this.originalColor = options.originalColor ?? 16711680; + this.targetColor = options.targetColor ?? 0; + Object.assign(this, options); + } + /** + * The color that will be changed. + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0xff0000 + */ + get originalColor() { + return this._originalColor.value; + } + set originalColor(value) { + this._originalColor.setValue(value); + const [r, g, b] = this._originalColor.toArray(); + this.uniforms.uOriginalColor[0] = r; + this.uniforms.uOriginalColor[1] = g; + this.uniforms.uOriginalColor[2] = b; + } + /** + * The resulting color. + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0x000000 + */ + get targetColor() { + return this._targetColor.value; + } + set targetColor(value) { + this._targetColor.setValue(value); + const [r, g, b] = this._targetColor.toArray(); + this.uniforms.uTargetColor[0] = r; + this.uniforms.uTargetColor[1] = g; + this.uniforms.uTargetColor[2] = b; + } + /** + * Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive) + * @default 0.4 + */ + get tolerance() { + return this.uniforms.uTolerance; + } + set tolerance(value) { + this.uniforms.uTolerance = value; + } + }; + /** Default values for options. */ + __publicField$m(_ColorReplaceFilter, "DEFAULT_OPTIONS", { + originalColor: 16711680, + targetColor: 0, + tolerance: 0.4 + }); + + var fragment$l = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uTexelSize;\nuniform float uMatrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture(uTexture, vTextureCoord - uTexelSize); // top left\n vec4 c12 = texture(uTexture, vec2(vTextureCoord.x, vTextureCoord.y - uTexelSize.y)); // top center\n vec4 c13 = texture(uTexture, vec2(vTextureCoord.x + uTexelSize.x, vTextureCoord.y - uTexelSize.y)); // top right\n\n vec4 c21 = texture(uTexture, vec2(vTextureCoord.x - uTexelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture(uTexture, vTextureCoord); // mid center\n vec4 c23 = texture(uTexture, vec2(vTextureCoord.x + uTexelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture(uTexture, vec2(vTextureCoord.x - uTexelSize.x, vTextureCoord.y + uTexelSize.y)); // bottom left\n vec4 c32 = texture(uTexture, vec2(vTextureCoord.x, vTextureCoord.y + uTexelSize.y)); // bottom center\n vec4 c33 = texture(uTexture, vTextureCoord + uTexelSize); // bottom right\n\n finalColor =\n c11 * uMatrix[0] + c12 * uMatrix[1] + c13 * uMatrix[2] +\n c21 * uMatrix[3] + c22 * uMatrix[4] + c23 * uMatrix[5] +\n c31 * uMatrix[6] + c32 * uMatrix[7] + c33 * uMatrix[8];\n\n finalColor.a = c22.a;\n}\n"; + + var source$l = "struct ConvolutionUniforms {\n uMatrix: array, 3>,\n uTexelSize: vec2,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var convolutionUniforms : ConvolutionUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let texelSize = convolutionUniforms.uTexelSize;\n let matrix = convolutionUniforms.uMatrix;\n\n let c11: vec4 = textureSample(uTexture, uSampler, uv - texelSize); // top left\n let c12: vec4 = textureSample(uTexture, uSampler, vec2(uv.x, uv.y - texelSize.y)); // top center\n let c13: vec4 = textureSample(uTexture, uSampler, vec2(uv.x + texelSize.x, uv.y - texelSize.y)); // top right\n\n let c21: vec4 = textureSample(uTexture, uSampler, vec2(uv.x - texelSize.x, uv.y)); // mid left\n let c22: vec4 = textureSample(uTexture, uSampler, uv); // mid center\n let c23: vec4 = textureSample(uTexture, uSampler, vec2(uv.x + texelSize.x, uv.y)); // mid right\n\n let c31: vec4 = textureSample(uTexture, uSampler, vec2(uv.x - texelSize.x, uv.y + texelSize.y)); // bottom left\n let c32: vec4 = textureSample(uTexture, uSampler, vec2(uv.x, uv.y + texelSize.y)); // bottom center\n let c33: vec4 = textureSample(uTexture, uSampler, uv + texelSize); // bottom right\n\n var finalColor: vec4 = vec4(\n c11 * matrix[0][0] + c12 * matrix[0][1] + c13 * matrix[0][2] +\n c21 * matrix[1][0] + c22 * matrix[1][1] + c23 * matrix[1][2] +\n c31 * matrix[2][0] + c32 * matrix[2][1] + c33 * matrix[2][2]\n );\n\n finalColor.a = c22.a;\n\n return finalColor;\n}"; + + var __defProp$l = Object.defineProperty; + var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$l = (obj, key, value) => { + __defNormalProp$l(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ConvolutionFilter = class _ConvolutionFilter extends require$$0.Filter { + constructor(options) { + options = { ..._ConvolutionFilter.DEFAULT_OPTIONS, ...options }; + const width = options.width ?? 200; + const height = options.height ?? 200; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$l, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$l, + name: "convolution-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + convolutionUniforms: { + uMatrix: { value: options.matrix, type: "vec3", size: 3 }, + uTexelSize: { value: [1 / width, 1 / height], type: "vec2" } + } + } + }); + __publicField$l(this, "uniforms"); + this.uniforms = this.resources.convolutionUniforms.uniforms; + this.width = width; + this.height = height; + } + /** + * An array of values used for matrix transformation, specified as a 9 point Array + * @example + * const matrix = new Float32Array(9); // 9 elements of value 0 + * const matrix = [0,0.5,0,0.5,1,0.5,0,0.5,0]; + * @default [0,0,0,0,0,0,0,0,0] + */ + get matrix() { + return this.uniforms.uMatrix; + } + set matrix(matrix) { + matrix.forEach((v, i) => { + this.uniforms.uMatrix[i] = v; + }); + } + /** + * Width of the object you are transforming + * @default 200 + */ + get width() { + return 1 / this.uniforms.uTexelSize[0]; + } + set width(value) { + this.uniforms.uTexelSize[0] = 1 / value; + } + /** + * Height of the object you are transforming + * @default 200 + */ + get height() { + return 1 / this.uniforms.uTexelSize[1]; + } + set height(value) { + this.uniforms.uTexelSize[1] = 1 / value; + } + }; + /** Default values for options. */ + __publicField$l(_ConvolutionFilter, "DEFAULT_OPTIONS", { + matrix: new Float32Array(9), + width: 200, + height: 200 + }); + + var fragment$k = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec4 uLine;\nuniform vec2 uNoise;\nuniform vec3 uVignette;\nuniform float uSeed;\nuniform float uTime;\nuniform vec2 uDimensions;\n\nuniform vec4 uInputSize;\n\nconst float SQRT_2 = 1.414213;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nfloat vignette(vec3 co, vec2 coord)\n{\n float outter = SQRT_2 - uVignette[0] * SQRT_2;\n vec2 dir = vec2(0.5) - coord;\n dir.y *= uDimensions.y / uDimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + uVignette[2] * SQRT_2), 0.0, 1.0);\n return darker + (1.0 - darker) * (1.0 - uVignette[1]);\n}\n\nfloat noise(vec2 coord)\n{\n vec2 pixelCoord = coord * uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / uNoise[1]);\n pixelCoord.y = floor(pixelCoord.y / uNoise[1]);\n return (rand(pixelCoord * uNoise[1] * uSeed) - 0.5) * uNoise[0];\n}\n\nvec3 interlaceLines(vec3 co, vec2 coord)\n{\n vec3 color = co;\n\n float curvature = uLine[0];\n float lineWidth = uLine[1];\n float lineContrast = uLine[2];\n float verticalLine = uLine[3];\n\n vec2 dir = vec2(coord * uInputSize.xy / uDimensions - 0.5);\n\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ? (length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n float v = verticalLine > 0.5 ? uv.x * uDimensions.x : uv.y * uDimensions.y;\n v *= min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - uTime) * 0.5 * lineContrast;\n color *= j;\n\n float segment = verticalLine > 0.5 ? mod((dir.x + .5) * uDimensions.x, 4.) : mod((dir.y + .5) * uDimensions.y, 4.);\n color *= 0.99 + ceil(segment) * 0.015;\n\n return color;\n}\n\nvoid main(void)\n{\n finalColor = texture(uTexture, vTextureCoord);\n vec2 coord = vTextureCoord * uInputSize.xy / uDimensions;\n\n if (uNoise[0] > 0.0 && uNoise[1] > 0.0)\n {\n float n = noise(vTextureCoord);\n finalColor += vec4(n, n, n, finalColor.a);\n }\n\n if (uVignette[0] > 0.)\n {\n float v = vignette(finalColor.rgb, coord);\n finalColor *= vec4(v, v, v, finalColor.a);\n }\n\n if (uLine[1] > 0.0)\n {\n finalColor = vec4(interlaceLines(finalColor.rgb, vTextureCoord), finalColor.a); \n }\n}\n"; + + var source$k = "struct CRTUniforms {\n uLine: vec4,\n uNoise: vec2,\n uVignette: vec3,\n uSeed: f32,\n uTime: f32,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var crtUniforms : CRTUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n \n var color: vec4 = textureSample(uTexture, uSampler, uv);\n let coord: vec2 = uv * gfu.uInputSize.xy / crtUniforms.uDimensions;\n\n let uNoise = crtUniforms.uNoise;\n\n if (uNoise[0] > 0.0 && uNoise[1] > 0.0)\n {\n color += vec4(vec3(noise(uv)), color.a);\n }\n\n if (crtUniforms.uVignette[0] > 0.)\n {\n color *= vec4(vec3(vignette(color.rgb, coord)), color.a);\n }\n\n if (crtUniforms.uLine[1] > 0.0)\n {\n color = vec4(vec3(interlaceLines(color.rgb, uv)), color.a); \n }\n\n return color;\n}\n\nconst SQRT_2: f32 = 1.414213;\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}\n\nfn rand(co: vec2) -> f32\n{\n return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nfn vignette(co: vec3, coord: vec2) -> f32\n{\n let uVignette = crtUniforms.uVignette;\n let uDimensions = crtUniforms.uDimensions;\n \n let outter: f32 = SQRT_2 - uVignette[0] * SQRT_2;\n var dir: vec2 = vec2(0.5) - coord;\n dir.y *= uDimensions.y / uDimensions.x;\n let darker: f32 = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + uVignette[2] * SQRT_2), 0.0, 1.0);\n return darker + (1.0 - darker) * (1.0 - uVignette[1]);\n}\n\nfn noise(coord: vec2) -> f32\n{\n let uNoise = crtUniforms.uNoise;\n let uSeed = crtUniforms.uSeed;\n\n var pixelCoord: vec2 = coord * gfu.uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / uNoise[1]);\n pixelCoord.y = floor(pixelCoord.y / uNoise[1]);\n return (rand(pixelCoord * uNoise[1] * uSeed) - 0.5) * uNoise[0];\n}\n\nfn interlaceLines(co: vec3, coord: vec2) -> vec3\n{\n var color = co;\n\n let uDimensions = crtUniforms.uDimensions;\n\n let curvature: f32 = crtUniforms.uLine[0];\n let lineWidth: f32 = crtUniforms.uLine[1];\n let lineContrast: f32 = crtUniforms.uLine[2];\n let verticalLine: f32 = crtUniforms.uLine[3];\n\n let dir: vec2 = vec2(coord * gfu.uInputSize.xy / uDimensions - 0.5);\n\n let _c: f32 = select(1., curvature, curvature > 0.);\n let k: f32 = select(1., (length(dir * dir) * 0.25 * _c * _c + 0.935 * _c), curvature > 0.);\n let uv: vec2 = dir * k;\n let v: f32 = select(uv.y * uDimensions.y, uv.x * uDimensions.x, verticalLine > 0.5) * min(1.0, 2.0 / lineWidth ) / _c;\n let j: f32 = 1. + cos(v * 1.2 - crtUniforms.uTime) * 0.5 * lineContrast;\n color *= j;\n\n let segment: f32 = select(modulo((dir.y + .5) * uDimensions.y, 4.), modulo((dir.x + .5) * uDimensions.x, 4.), verticalLine > 0.5);\n color *= 0.99 + ceil(segment) * 0.015;\n\n return color;\n}"; + + var __defProp$k = Object.defineProperty; + var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$k = (obj, key, value) => { + __defNormalProp$k(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _CRTFilter = class _CRTFilter extends require$$0.Filter { + constructor(options) { + options = { ..._CRTFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$k, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$k, + name: "crt-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + crtUniforms: { + uLine: { value: new Float32Array(4), type: "vec4" }, + uNoise: { value: new Float32Array(2), type: "vec2" }, + uVignette: { value: new Float32Array(3), type: "vec3" }, + uSeed: { value: options.seed, type: "f32" }, + uTime: { value: options.time, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$k(this, "uniforms"); + /** + * A seed value to apply to the random noise generation + * @default 0 + */ + __publicField$k(this, "seed"); + /** + * Opacity/intensity of the noise effect between `0` and `1` + * @default 0.3 + */ + __publicField$k(this, "time"); + this.uniforms = this.resources.crtUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + this.uniforms.uSeed = this.seed; + this.uniforms.uTime = this.time; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * Bend of interlaced lines, higher value means more bend + * @default 1 + */ + get curvature() { + return this.uniforms.uLine[0]; + } + set curvature(value) { + this.uniforms.uLine[0] = value; + } + /** + * Width of interlaced lines + * @default 1 + */ + get lineWidth() { + return this.uniforms.uLine[1]; + } + set lineWidth(value) { + this.uniforms.uLine[1] = value; + } + /** + * Contrast of interlaced lines + * @default 0.25 + */ + get lineContrast() { + return this.uniforms.uLine[2]; + } + set lineContrast(value) { + this.uniforms.uLine[2] = value; + } + /** + * The orientation of the line: + * + * `true` create vertical lines, `false` creates horizontal lines + * @default false + */ + get verticalLine() { + return this.uniforms.uLine[3] > 0.5; + } + set verticalLine(value) { + this.uniforms.uLine[3] = value ? 1 : 0; + } + /** + * Opacity/intensity of the noise effect between `0` and `1` + * @default 0.3 + */ + get noise() { + return this.uniforms.uNoise[0]; + } + set noise(value) { + this.uniforms.uNoise[0] = value; + } + /** + * The size of the noise particles + * @default 0 + */ + get noiseSize() { + return this.uniforms.uNoise[1]; + } + set noiseSize(value) { + this.uniforms.uNoise[1] = value; + } + /** + * The radius of the vignette effect, smaller values produces a smaller vignette + * @default 0.3 + */ + get vignetting() { + return this.uniforms.uVignette[0]; + } + set vignetting(value) { + this.uniforms.uVignette[0] = value; + } + /** + * Amount of opacity of vignette + * @default 1 + */ + get vignettingAlpha() { + return this.uniforms.uVignette[1]; + } + set vignettingAlpha(value) { + this.uniforms.uVignette[1] = value; + } + /** + * Blur intensity of the vignette + * @default 0.3 + */ + get vignettingBlur() { + return this.uniforms.uVignette[2]; + } + set vignettingBlur(value) { + this.uniforms.uVignette[2] = value; + } + }; + /** Default values for options. */ + __publicField$k(_CRTFilter, "DEFAULT_OPTIONS", { + curvature: 1, + lineWidth: 1, + lineContrast: 0.25, + verticalLine: false, + noise: 0, + noiseSize: 1, + vignetting: 0.3, + vignettingAlpha: 1, + vignettingBlur: 0.3, + time: 0, + seed: 0 + }); + + var fragment$j = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uAngle;\nuniform float uScale;\nuniform bool uGrayScale;\n\nuniform vec4 uInputSize;\n\nfloat pattern()\n{\n float s = sin(uAngle), c = cos(uAngle);\n vec2 tex = vTextureCoord * uInputSize.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * uScale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n }\n\n void main()\n {\n vec4 color = texture(uTexture, vTextureCoord);\n vec3 colorRGB = vec3(color);\n\n if (uGrayScale)\n {\n colorRGB = vec3(color.r + color.g + color.b) / 3.0;\n }\n\n finalColor = vec4(colorRGB * 10.0 - 5.0 + pattern(), color.a);\n}\n"; + + var source$j = "struct DotUniforms {\n uScale:f32,\n uAngle:f32,\n uGrayScale:f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var dotUniforms : DotUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let color: vec4 = textureSample(uTexture, uSampler, uv);\n let gray: vec3 = vec3(dot(color.rgb, vec3(0.299, 0.587, 0.114)));\n // dotUniforms.uGrayScale == 1 doesn't ever pass so it is converted to a float and compared to 0.5 instead \n let finalColor: vec3 = select(color.rgb, gray, f32(dotUniforms.uGrayScale) >= 0.5);\n\n return vec4(finalColor * 10.0 - 5.0 + pattern(uv), color.a);\n}\n\nfn pattern(uv: vec2) -> f32\n{\n let s: f32 = sin(dotUniforms.uAngle);\n let c: f32 = cos(dotUniforms.uAngle);\n \n let tex: vec2 = uv * gfu.uInputSize.xy;\n \n let p: vec2 = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * dotUniforms.uScale;\n\n return (sin(p.x) * sin(p.y)) * 4.0;\n}"; + + var __defProp$j = Object.defineProperty; + var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$j = (obj, key, value) => { + __defNormalProp$j(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _DotFilter = class _DotFilter extends require$$0.Filter { + constructor(options) { + options = { ..._DotFilter.DEFAULT_OPTIONS, ...options }; + const dotUniforms = { + uScale: { value: options.scale, type: "f32" }, + uAngle: { value: options.angle, type: "f32" }, + uGrayScale: { value: options.grayscale ? 1 : 0, type: "f32" } + }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$j, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$j, + name: "dot-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + dotUniforms + } + }); + } + /** + * The scale of the effect. + * @default 1 + */ + get scale() { + return this.resources.dotUniforms.uniforms.uScale; + } + set scale(value) { + this.resources.dotUniforms.uniforms.uScale = value; + } + /** + * The radius of the effect. + * @default 5 + */ + get angle() { + return this.resources.dotUniforms.uniforms.uAngle; + } + set angle(value) { + this.resources.dotUniforms.uniforms.uAngle = value; + } + /** + * Whether to rendering it in gray scale. + * @default true + */ + get grayscale() { + return this.resources.dotUniforms.uniforms.uGrayScale === 1; + } + set grayscale(value) { + this.resources.dotUniforms.uniforms.uGrayScale = value ? 1 : 0; + } + }; + /** Default values for options. */ + __publicField$j(_DotFilter, "DEFAULT_OPTIONS", { + scale: 1, + angle: 5, + grayscale: true + }); + + var fragment$i = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uAlpha;\nuniform vec3 uColor;\nuniform vec2 uOffset;\n\nuniform vec4 uInputSize;\n\nvoid main(void){\n vec4 sample = texture(uTexture, vTextureCoord - uOffset * uInputSize.zw);\n\n // Premultiply alpha\n sample.rgb = uColor.rgb * sample.a;\n\n // alpha user alpha\n sample *= uAlpha;\n\n finalColor = sample;\n}"; + + var source$i = "struct DropShadowUniforms {\n uAlpha: f32,\n uColor: vec3,\n uOffset: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var dropShadowUniforms : DropShadowUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color: vec4 = textureSample(uTexture, uSampler, uv - dropShadowUniforms.uOffset * gfu.uInputSize.zw);\n\n // Premultiply alpha\n color = vec4(vec3(dropShadowUniforms.uColor.rgb * color.a), color.a);\n // alpha user alpha\n color *= dropShadowUniforms.uAlpha;\n\n return color;\n}"; + + var __defProp$i = Object.defineProperty; + var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$i = (obj, key, value) => { + __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _DropShadowFilter = class _DropShadowFilter extends require$$0.Filter { + constructor(options) { + options = { ..._DropShadowFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$i, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$i, + name: "drop-shadow-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + dropShadowUniforms: { + uAlpha: { value: options.alpha, type: "f32" }, + uColor: { value: new Float32Array(3), type: "vec3" }, + uOffset: { value: options.offset, type: "vec2" } + } + } + }); + __publicField$i(this, "uniforms"); + /** + * Hide the contents, only show the shadow. + * @default false + */ + __publicField$i(this, "shadowOnly", false); + __publicField$i(this, "_color"); + __publicField$i(this, "_blurFilter"); + __publicField$i(this, "_basePass"); + this.uniforms = this.resources.dropShadowUniforms.uniforms; + this._color = new require$$0.Color(); + this.color = options.color ?? 0; + this._blurFilter = new KawaseBlurFilter({ + strength: options.kernels ?? options.blur, + quality: options.kernels ? void 0 : options.quality + }); + this._basePass = new require$$0.Filter({ + gpuProgram: new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: ` + @group(0) @binding(1) var uTexture: texture_2d; + @group(0) @binding(2) var uSampler: sampler; + @fragment + fn mainFragment( + @builtin(position) position: vec4, + @location(0) uv : vec2 + ) -> @location(0) vec4 { + return textureSample(uTexture, uSampler, uv); + } + `, + entryPoint: "mainFragment" + } + }), + glProgram: new require$$0.GlProgram({ + vertex: vertex$1, + fragment: ` + in vec2 vTextureCoord; + out vec4 finalColor; + uniform sampler2D uTexture; + + void main(void){ + finalColor = texture(uTexture, vTextureCoord); + } + `, + name: "drop-shadow-filter" + }), + resources: {} + }); + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + const renderTarget = require$$0.TexturePool.getSameSizeTexture(input); + filterManager.applyFilter(this, input, renderTarget, true); + this._blurFilter.apply(filterManager, renderTarget, output, clearMode); + if (!this.shadowOnly) { + filterManager.applyFilter(this._basePass, input, output, false); + } + require$$0.TexturePool.returnTexture(renderTarget); + } + /** + * Set the offset position of the drop-shadow relative to the original image. + * @default [4,4] + */ + get offset() { + return this.uniforms.uOffset; + } + set offset(value) { + this.uniforms.uOffset = value; + this._updatePadding(); + } + /** + * Set the offset position of the drop-shadow relative to the original image on the `x` axis + * @default 4 + */ + get offsetX() { + return this.offset.x; + } + set offsetX(value) { + this.offset.x = value; + this._updatePadding(); + } + /** + * Set the offset position of the drop-shadow relative to the original image on the `y` axis + * @default 4 + */ + get offsetY() { + return this.offset.y; + } + set offsetY(value) { + this.offset.y = value; + this._updatePadding(); + } + /** + * The color value of shadow. + * @example [0.0, 0.0, 0.0] = 0x000000 + * @default 0x000000 + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * Coefficient for alpha multiplication + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + /** + * The strength of the shadow's blur. + * @default 2 + */ + get blur() { + return this._blurFilter.strength; + } + set blur(value) { + this._blurFilter.strength = value; + this._updatePadding(); + } + /** + * Sets the quality of the Blur Filter + * @default 4 + */ + get quality() { + return this._blurFilter.quality; + } + set quality(value) { + this._blurFilter.quality = value; + this._updatePadding(); + } + /** Sets the kernels of the Blur Filter */ + get kernels() { + return this._blurFilter.kernels; + } + set kernels(value) { + this._blurFilter.kernels = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter + * @default [1,1] + */ + get pixelSize() { + return this._blurFilter.pixelSize; + } + set pixelSize(value) { + this._blurFilter.pixelSize = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter on the `x` axis + * @default 1 + */ + get pixelSizeX() { + return this._blurFilter.pixelSizeX; + } + set pixelSizeX(value) { + this._blurFilter.pixelSizeX = value; + } + /** + * Sets the pixelSize of the Kawase Blur filter on the `y` axis + * @default 1 + */ + get pixelSizeY() { + return this._blurFilter.pixelSizeY; + } + set pixelSizeY(value) { + this._blurFilter.pixelSizeY = value; + } + /** + * Recalculate the proper padding amount. + * @private + */ + _updatePadding() { + const offsetPadding = Math.max( + Math.abs(this.offsetX), + Math.abs(this.offsetY) + ); + this.padding = offsetPadding + this.blur * 2 + this.quality * 4; + } + }; + /** Default values for options. */ + __publicField$i(_DropShadowFilter, "DEFAULT_OPTIONS", { + offset: { x: 4, y: 4 }, + color: 0, + alpha: 0.5, + shadowOnly: false, + kernels: void 0, + blur: 2, + quality: 3, + pixelSize: { x: 1, y: 1 } + }); + + var fragment$h = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uStrength;\n\nuniform vec4 uInputSize;\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / uInputSize);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture(uTexture, vTextureCoord - onePixel) * uStrength;\n\tcolor += texture(uTexture, vTextureCoord + onePixel) * uStrength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture(uTexture, vTextureCoord).a;\n\n\tfinalColor = vec4(color.rgb * alpha, alpha);\n}\n"; + + var source$h = "struct EmbossUniforms {\n uStrength:f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var embossUniforms : EmbossUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let onePixel: vec2 = vec2(1.0 / gfu.uInputSize.xy);\n\tvar color: vec3 = vec3(0.5);\n\n\tcolor -= (textureSample(uTexture, uSampler, uv - onePixel) * embossUniforms.uStrength).rgb;\n\tcolor += (textureSample(uTexture, uSampler, uv + onePixel) * embossUniforms.uStrength).rgb;\n\n\tcolor = vec3((color.r + color.g + color.b) / 3.0);\n\n\tlet blendColor: vec4 = textureSample(uTexture, uSampler, uv);\n\n\treturn vec4(color.rgb * blendColor.a, blendColor.a);\n}"; + + var __defProp$h = Object.defineProperty; + var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$h = (obj, key, value) => { + __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _EmbossFilter = class _EmbossFilter extends require$$0.Filter { + constructor(options) { + options = { ..._EmbossFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$h, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$h, + name: "emboss-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + embossUniforms: { + uStrength: { value: options.strength, type: "f32" } + } + } + }); + __publicField$h(this, "uniforms"); + this.uniforms = this.resources.embossUniforms.uniforms; + } + /** + * Strength of the emboss + * @default 5 + */ + get strength() { + return this.uniforms.uStrength; + } + set strength(value) { + this.uniforms.uStrength = value; + } + }; + /** Default values for options. */ + __publicField$h(_EmbossFilter, "DEFAULT_OPTIONS", { + strength: 5 + }); + + var fragment$g = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uDisplacementMap;\nuniform float uSeed;\nuniform vec2 uDimensions;\nuniform float uAspect;\nuniform float uFillMode;\nuniform float uOffset;\nuniform float uDirection;\nuniform vec2 uRed;\nuniform vec2 uGreen;\nuniform vec2 uBlue;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * uInputSize.xy) / uDimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float sinDir = sin(uDirection);\n float cosDir = cos(uDirection);\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * uAspect;\n float ny = (-sinDir * cx + cosDir * cy) / uAspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture(uDisplacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (uOffset / uInputSize.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * uAspect);\n\n int fillMode = int(uFillMode);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n } else {\n if( coord.x > uInputClamp.z ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x -= uInputClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = uInputClamp.z * 2.0 - coord.x;\n }\n } else if( coord.x < uInputClamp.x ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x += uInputClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -uInputClamp.z;\n }\n }\n\n if( coord.y > uInputClamp.w ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y -= uInputClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = uInputClamp.w * 2.0 - coord.y;\n }\n } else if( coord.y < uInputClamp.y ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y += uInputClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -uInputClamp.w;\n }\n }\n }\n\n finalColor.r = texture(uTexture, coord + uRed * (1.0 - uSeed * 0.4) / uInputSize.xy).r;\n finalColor.g = texture(uTexture, coord + uGreen * (1.0 - uSeed * 0.3) / uInputSize.xy).g;\n finalColor.b = texture(uTexture, coord + uBlue * (1.0 - uSeed * 0.2) / uInputSize.xy).b;\n finalColor.a = texture(uTexture, coord).a;\n}\n"; + + var source$g = "struct GlitchUniforms {\n uSeed: f32,\n uDimensions: vec2,\n uAspect: f32,\n uFillMode: f32,\n uOffset: f32,\n uDirection: f32,\n uRed: vec2,\n uGreen: vec2,\n uBlue: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var glitchUniforms : GlitchUniforms;\n@group(1) @binding(1) var uDisplacementMap: texture_2d; \n@group(1) @binding(2) var uDisplacementSampler: sampler; \n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uSeed: f32 = glitchUniforms.uSeed;\n let uDimensions: vec2 = glitchUniforms.uDimensions;\n let uAspect: f32 = glitchUniforms.uAspect;\n let uOffset: f32 = glitchUniforms.uOffset;\n let uDirection: f32 = glitchUniforms.uDirection;\n let uRed: vec2 = glitchUniforms.uRed;\n let uGreen: vec2 = glitchUniforms.uGreen;\n let uBlue: vec2 = glitchUniforms.uBlue;\n\n let uInputSize: vec4 = gfu.uInputSize;\n let uInputClamp: vec4 = gfu.uInputClamp;\n\n var discarded: bool = false;\n var coord: vec2 = (uv * uInputSize.xy) / uDimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n discarded = true;\n }\n\n let sinDir: f32 = sin(uDirection);\n let cosDir: f32 = cos(uDirection);\n\n let cx: f32 = coord.x - 0.5;\n let cy: f32 = (coord.y - 0.5) * uAspect;\n var ny: f32 = (-sinDir * cx + cosDir * cy) / uAspect + 0.5;\n\n ny = select(select(ny, -ny, ny < 0.0), 2.0 - ny, ny > 1.0);\n\n let dc: vec4 = textureSample(uDisplacementMap, uDisplacementSampler, vec2(0.5, ny));\n\n let displacement: f32 = (dc.r - dc.g) * (uOffset / uInputSize.x);\n\n coord = uv + vec2(cosDir * displacement, sinDir * displacement * uAspect);\n\n let fillMode: i32 = i32(glitchUniforms.uFillMode);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n } else {\n if (coord.x > uInputClamp.z) {\n if (fillMode == TRANSPARENT) {\n discarded = true;\n } else if (fillMode == LOOP) {\n coord.x = coord.x - uInputClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = uInputClamp.z * 2.0 - coord.x;\n }\n } else if (coord.x < uInputClamp.x) {\n if (fillMode == TRANSPARENT) {\n discarded = true;\n } else if (fillMode == LOOP) {\n coord.x = coord.x + uInputClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = coord.x * -uInputClamp.z;\n }\n }\n\n if (coord.y > uInputClamp.w) {\n if (fillMode == TRANSPARENT) {\n discarded = true;\n } else if (fillMode == LOOP) {\n coord.y = coord.y - uInputClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = uInputClamp.w * 2.0 - coord.y;\n }\n } else if (coord.y < uInputClamp.y) {\n if (fillMode == TRANSPARENT) {\n discarded = true;\n } else if (fillMode == LOOP) {\n coord.y = coord.y + uInputClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = coord.y * -uInputClamp.w;\n }\n }\n }\n\n let seedR: f32 = 1.0 - uSeed * 0.4;\n let seedG: f32 = 1.0 - uSeed * 0.3;\n let seedB: f32 = 1.0 - uSeed * 0.2;\n\n let offsetR: vec2 = vec2(uRed.x * seedR / uInputSize.x, uRed.y * seedR / uInputSize.y);\n let offsetG: vec2 = vec2(uGreen.x * seedG / uInputSize.x, uGreen.y * seedG / uInputSize.y);\n let offsetB: vec2 = vec2(uBlue.x * seedB / uInputSize.x, uBlue.y * seedB / uInputSize.y);\n\n let r = textureSample(uTexture, uSampler, coord + offsetR).r;\n let g = textureSample(uTexture, uSampler, coord + offsetG).g;\n let b = textureSample(uTexture, uSampler, coord + offsetB).b;\n let a = textureSample(uTexture, uSampler, coord).a;\n\n return select(vec4(r, g, b, a), vec4(0.0,0.0,0.0,0.0), discarded);\n}\n\nconst TRANSPARENT: i32 = 0;\nconst ORIGINAL: i32 = 1;\nconst LOOP: i32 = 2;\nconst CLAMP: i32 = 3;\nconst MIRROR: i32 = 4;"; + + var __defProp$g = Object.defineProperty; + var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$g = (obj, key, value) => { + __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _GlitchFilter = class _GlitchFilter extends require$$0.Filter { + constructor(options) { + options = { ..._GlitchFilter.defaults, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$g, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$g, + name: "glitch-filter" + }); + const canvas = document.createElement("canvas"); + canvas.width = 4; + canvas.height = options.sampleSize ?? 512; + const texture = require$$0.getCanvasTexture(canvas, { scaleMode: "nearest" }); + super({ + gpuProgram, + glProgram, + resources: { + glitchUniforms: { + uSeed: { value: options?.seed ?? 0, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" }, + uAspect: { value: 1, type: "f32" }, + uFillMode: { value: options?.fillMode ?? 0, type: "f32" }, + uOffset: { value: options?.offset ?? 100, type: "f32" }, + uDirection: { value: options?.direction ?? 0, type: "f32" }, + uRed: { value: options.red, type: "vec2" }, + uGreen: { value: options.green, type: "vec2" }, + uBlue: { value: options.blue, type: "vec2" } + }, + uDisplacementMap: texture.source, + uDisplacementSampler: texture.source.style + } + }); + __publicField$g(this, "uniforms"); + /** + * `true` will divide the bands roughly based on equal amounts + * where as setting to `false` will vary the band sizes dramatically (more random looking). + */ + __publicField$g(this, "average", false); + /** Minimum size of slices as a portion of the `sampleSize` */ + __publicField$g(this, "minSize", 8); + /** Height of the displacement map canvas. */ + __publicField$g(this, "sampleSize", 512); + /** Internally generated canvas. */ + __publicField$g(this, "_canvas"); + /** + * The displacement map is used to generate the bands. + * If using your own texture, `slices` will be ignored. + * + * @member {Texture} + * @readonly + */ + __publicField$g(this, "texture"); + /** Internal number of slices */ + __publicField$g(this, "_slices", 0); + __publicField$g(this, "_sizes", new Float32Array(1)); + __publicField$g(this, "_offsets", new Float32Array(1)); + this.uniforms = this.resources.glitchUniforms.uniforms; + this._canvas = canvas; + this.texture = texture; + Object.assign(this, options); + } + /** + * Override existing apply method in Filter + * @private + */ + apply(filterManager, input, output, clearMode) { + const { width, height } = input.frame; + this.uniforms.uDimensions[0] = width; + this.uniforms.uDimensions[1] = height; + this.uniforms.uAspect = height / width; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * Randomize the slices size (heights). + * + * @private + */ + _randomizeSizes() { + const arr = this._sizes; + const last = this._slices - 1; + const size = this.sampleSize; + const min = Math.min(this.minSize / size, 0.9 / this._slices); + if (this.average) { + const count = this._slices; + let rest = 1; + for (let i = 0; i < last; i++) { + const averageWidth = rest / (count - i); + const w = Math.max(averageWidth * (1 - Math.random() * 0.6), min); + arr[i] = w; + rest -= w; + } + arr[last] = rest; + } else { + let rest = 1; + const ratio = Math.sqrt(1 / this._slices); + for (let i = 0; i < last; i++) { + const w = Math.max(ratio * rest * Math.random(), min); + arr[i] = w; + rest -= w; + } + arr[last] = rest; + } + this.shuffle(); + } + /** + * Shuffle the sizes of the slices, advanced usage. + */ + shuffle() { + const arr = this._sizes; + const last = this._slices - 1; + for (let i = last; i > 0; i--) { + const rand = Math.random() * i >> 0; + const temp = arr[i]; + arr[i] = arr[rand]; + arr[rand] = temp; + } + } + /** + * Randomize the values for offset from -1 to 1 + * + * @private + */ + _randomizeOffsets() { + for (let i = 0; i < this._slices; i++) { + this._offsets[i] = Math.random() * (Math.random() < 0.5 ? -1 : 1); + } + } + /** + * Regenerating random size, offsets for slices. + */ + refresh() { + this._randomizeSizes(); + this._randomizeOffsets(); + this.redraw(); + } + /** + * Redraw displacement bitmap texture, advanced usage. + */ + redraw() { + const size = this.sampleSize; + const texture = this.texture; + const ctx = this._canvas.getContext("2d"); + ctx.clearRect(0, 0, 8, size); + let offset; + let y = 0; + for (let i = 0; i < this._slices; i++) { + offset = Math.floor(this._offsets[i] * 256); + const height = this._sizes[i] * size; + const red = offset > 0 ? offset : 0; + const green = offset < 0 ? -offset : 0; + ctx.fillStyle = `rgba(${red}, ${green}, 0, 1)`; + ctx.fillRect(0, y >> 0, size, height + 1 >> 0); + y += height; + } + texture.source.update(); + } + /** + * Manually custom slices size (height) of displacement bitmap + * + * @member {number[]|Float32Array} + */ + set sizes(sizes) { + const len = Math.min(this._slices, sizes.length); + for (let i = 0; i < len; i++) { + this._sizes[i] = sizes[i]; + } + } + get sizes() { + return this._sizes; + } + /** + * Manually set custom slices offset of displacement bitmap, this is + * a collection of values from -1 to 1. To change the max offset value + * set `offset`. + * + * @member {number[]|Float32Array} + */ + set offsets(offsets) { + const len = Math.min(this._slices, offsets.length); + for (let i = 0; i < len; i++) { + this._offsets[i] = offsets[i]; + } + } + get offsets() { + return this._offsets; + } + /** + * The count of slices. + * @default 5 + */ + get slices() { + return this._slices; + } + set slices(value) { + if (this._slices === value) + return; + this._slices = value; + this._sizes = new Float32Array(value); + this._offsets = new Float32Array(value); + this.refresh(); + } + /** + * The maximum offset amount of slices. + * @default 100 + */ + get offset() { + return this.uniforms.uOffset; + } + set offset(value) { + this.uniforms.uOffset = value; + } + /** + * A seed value for randomizing glitch effect. + * @default 0 + */ + get seed() { + return this.uniforms.uSeed; + } + set seed(value) { + this.uniforms.uSeed = value; + } + /** + * The fill mode of the space after the offset. + * @default FILL_MODES.TRANSPARENT + */ + get fillMode() { + return this.uniforms.uFillMode; + } + set fillMode(value) { + this.uniforms.uFillMode = value; + } + /** + * The angle in degree of the offset of slices. + * @default 0 + */ + get direction() { + return this.uniforms.uDirection / require$$0.DEG_TO_RAD; + } + set direction(value) { + this.uniforms.uDirection = value * require$$0.DEG_TO_RAD; + } + /** + * Red channel offset. + * @default {x:0,y:0} + */ + get red() { + return this.uniforms.uRed; + } + set red(value) { + this.uniforms.uRed = value; + } + /** + * Green channel offset. + * @default {x:0,y:0} + */ + get green() { + return this.uniforms.uGreen; + } + set green(value) { + this.uniforms.uGreen = value; + } + /** + * Blue offset. + * @default {x:0,y:0} + */ + get blue() { + return this.uniforms.uBlue; + } + set blue(value) { + this.uniforms.uBlue = value; + } + /** + * Removes all references + */ + destroy() { + this.texture?.destroy(true); + this.texture = this._canvas = this.red = this.green = this.blue = this._sizes = this._offsets = null; + } + }; + /** Default constructor options. */ + __publicField$g(_GlitchFilter, "defaults", { + slices: 5, + offset: 100, + direction: 0, + fillMode: 0, + average: false, + seed: 0, + red: { x: 0, y: 0 }, + green: { x: 0, y: 0 }, + blue: { x: 0, y: 0 }, + minSize: 8, + sampleSize: 512 + }); + + var fragment$f = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uStrength;\nuniform vec3 uColor;\nuniform float uKnockout;\nuniform float uAlpha;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nconst float PI = 3.14159265358979323846264;\n\n// Hard-assignment of DIST and ANGLE_STEP_SIZE instead of using uDistance and uQuality to allow them to be use on GLSL loop conditions\nconst float DIST = __DIST__;\nconst float ANGLE_STEP_SIZE = min(__ANGLE_STEP_SIZE__, PI * 2.);\nconst float ANGLE_STEP_NUM = ceil(PI * 2. / ANGLE_STEP_SIZE);\nconst float MAX_TOTAL_ALPHA = ANGLE_STEP_NUM * DIST * (DIST + 1.) / 2.;\n\nvoid main(void) {\n vec2 px = vec2(1.) / uInputSize.xy;\n\n float totalAlpha = 0.;\n\n vec2 direction;\n vec2 displaced;\n vec4 curColor;\n\n for (float angle = 0.; angle < PI * 2.; angle += ANGLE_STEP_SIZE) {\n direction = vec2(cos(angle), sin(angle)) * px;\n\n for (float curDistance = 0.; curDistance < DIST; curDistance++) {\n displaced = clamp(vTextureCoord + direction * (curDistance + 1.), uInputClamp.xy, uInputClamp.zw);\n curColor = texture(uTexture, displaced);\n totalAlpha += (DIST - curDistance) * curColor.a;\n }\n }\n \n curColor = texture(uTexture, vTextureCoord);\n\n vec4 glowColor = vec4(uColor, uAlpha);\n bool knockout = uKnockout > .5;\n float innerStrength = uStrength[0];\n float outerStrength = uStrength[1];\n\n float alphaRatio = totalAlpha / MAX_TOTAL_ALPHA;\n float innerGlowAlpha = (1. - alphaRatio) * innerStrength * curColor.a * uAlpha;\n float innerGlowStrength = min(1., innerGlowAlpha);\n \n vec4 innerColor = mix(curColor, glowColor, innerGlowStrength);\n float outerGlowAlpha = alphaRatio * outerStrength * (1. - curColor.a) * uAlpha;\n float outerGlowStrength = min(1. - innerColor.a, outerGlowAlpha);\n vec4 outerGlowColor = outerGlowStrength * glowColor.rgba;\n\n if (knockout) {\n float resultAlpha = outerGlowAlpha + innerGlowAlpha;\n finalColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);\n }\n else {\n finalColor = innerColor + outerGlowColor;\n }\n}\n"; + + var source$f = "struct GlowUniforms {\n uDistance: f32,\n uStrength: vec2,\n uColor: vec3,\n uAlpha: f32,\n uQuality: f32,\n uKnockout: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var glowUniforms : GlowUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let quality = glowUniforms.uQuality;\n let distance = glowUniforms.uDistance;\n\n let dist: f32 = glowUniforms.uDistance;\n let angleStepSize: f32 = min(1. / quality / distance, PI * 2.0);\n let angleStepNum: f32 = ceil(PI * 2.0 / angleStepSize);\n\n let px: vec2 = vec2(1.0 / gfu.uInputSize.xy);\n\n var totalAlpha: f32 = 0.0;\n\n var direction: vec2;\n var displaced: vec2;\n var curColor: vec4;\n\n for (var angle = 0.0; angle < PI * 2.0; angle += angleStepSize) {\n direction = vec2(cos(angle), sin(angle)) * px;\n for (var curDistance = 0.0; curDistance < dist; curDistance+=1) {\n displaced = vec2(clamp(uv + direction * (curDistance + 1.0), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n curColor = textureSample(uTexture, uSampler, displaced);\n totalAlpha += (dist - curDistance) * curColor.a;\n }\n }\n \n curColor = textureSample(uTexture, uSampler, uv);\n\n let glowColorRGB = glowUniforms.uColor;\n let glowAlpha = glowUniforms.uAlpha;\n let glowColor = vec4(glowColorRGB, glowAlpha);\n let knockout: bool = glowUniforms.uKnockout > 0.5;\n let innerStrength = glowUniforms.uStrength[0];\n let outerStrength = glowUniforms.uStrength[1];\n\n let alphaRatio: f32 = (totalAlpha / (angleStepNum * dist * (dist + 1.0) / 2.0));\n let innerGlowAlpha: f32 = (1.0 - alphaRatio) * innerStrength * curColor.a * glowAlpha;\n let innerGlowStrength: f32 = min(1.0, innerGlowAlpha);\n \n let innerColor: vec4 = mix(curColor, glowColor, innerGlowStrength);\n let outerGlowAlpha: f32 = alphaRatio * outerStrength * (1. - curColor.a) * glowAlpha;\n let outerGlowStrength: f32 = min(1.0 - innerColor.a, outerGlowAlpha);\n let outerGlowColor: vec4 = outerGlowStrength * glowColor.rgba;\n \n if (knockout) {\n let resultAlpha: f32 = outerGlowAlpha + innerGlowAlpha;\n return vec4(glowColor.rgb * resultAlpha, resultAlpha);\n }\n else {\n return innerColor + outerGlowColor;\n }\n}\n\nconst PI: f32 = 3.14159265358979323846264;"; + + var __defProp$f = Object.defineProperty; + var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$f = (obj, key, value) => { + __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _GlowFilter = class _GlowFilter extends require$$0.Filter { + constructor(options) { + options = { ..._GlowFilter.DEFAULT_OPTIONS, ...options }; + const distance = options.distance ?? 10; + const quality = options.quality ?? 0.1; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$f, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$f.replace(/__ANGLE_STEP_SIZE__/gi, `${(1 / quality / distance).toFixed(7)}`).replace(/__DIST__/gi, `${distance.toFixed(0)}.0`), + name: "glow-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + glowUniforms: { + uDistance: { value: distance, type: "f32" }, + uStrength: { value: [options.innerStrength, options.outerStrength], type: "vec2" }, + uColor: { value: new Float32Array(3), type: "vec3" }, + uAlpha: { value: options.alpha, type: "f32" }, + uQuality: { value: quality, type: "f32" }, + uKnockout: { value: options?.knockout ?? false ? 1 : 0, type: "f32" } + } + }, + padding: distance + }); + __publicField$f(this, "uniforms"); + __publicField$f(this, "_color"); + this.uniforms = this.resources.glowUniforms.uniforms; + this._color = new require$$0.Color(); + this.color = options.color ?? 16777215; + } + /** + * Only draw the glow, not the texture itself + * @default false + */ + get distance() { + return this.uniforms.uDistance; + } + set distance(value) { + this.uniforms.uDistance = this.padding = value; + } + /** + * The strength of the glow inward from the edge of the sprite. + * @default 0 + */ + get innerStrength() { + return this.uniforms.uStrength[0]; + } + set innerStrength(value) { + this.uniforms.uStrength[0] = value; + } + /** + * The strength of the glow outward from the edge of the sprite. + * @default 4 + */ + get outerStrength() { + return this.uniforms.uStrength[1]; + } + set outerStrength(value) { + this.uniforms.uStrength[1] = value; + } + /** + * The color of the glow. + * @default 0xFFFFFF + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * The alpha of the glow + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + /** + * A number between 0 and 1 that describes the quality of the glow. The higher the number the less performant + * @default 0.1 + */ + get quality() { + return this.uniforms.uQuality; + } + set quality(value) { + this.uniforms.uQuality = value; + } + /** + * Only draw the glow, not the texture itself + * @default false + */ + get knockout() { + return this.uniforms.uKnockout === 1; + } + set knockout(value) { + this.uniforms.uKnockout = value ? 1 : 0; + } + }; + /** Default values for options. */ + __publicField$f(_GlowFilter, "DEFAULT_OPTIONS", { + distance: 10, + outerStrength: 4, + innerStrength: 0, + color: 16777215, + alpha: 1, + quality: 0.1, + knockout: false + }); + + var fragment$e = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uDimensions;\nuniform float uParallel;\nuniform vec2 uLight;\nuniform float uAspect;\nuniform float uTime;\nuniform vec3 uRay;\n\nuniform vec4 uInputSize;\n\n${PERLIN}\n\nvoid main(void) {\n vec2 uDimensions = uDimensions;\n bool uParallel = uParallel > 0.5;\n vec2 uLight = uLight;\n float uAspect = uAspect;\n\n vec2 coord = vTextureCoord * uInputSize.xy / uDimensions;\n\n float d;\n\n if (uParallel) {\n float _cos = uLight.x;\n float _sin = uLight.y;\n d = (_cos * coord.x) + (_sin * coord.y * uAspect);\n } else {\n float dx = coord.x - uLight.x / uDimensions.x;\n float dy = (coord.y - uLight.y / uDimensions.y) * uAspect;\n float dis = sqrt(dx * dx + dy * dy) + 0.00001;\n d = dy / dis;\n }\n\n float uTime = uTime;\n vec3 uRay = uRay;\n\n float gain = uRay[0];\n float lacunarity = uRay[1];\n float alpha = uRay[2];\n\n vec3 dir = vec3(d, d, 0.0);\n float noise = turb(dir + vec3(uTime, 0.0, 62.1 + uTime) * 0.05, vec3(480.0, 320.0, 480.0), lacunarity, gain);\n noise = mix(noise, 0.0, 0.3);\n //fade vertically.\n vec4 mist = vec4(vec3(noise), 1.0) * (1.0 - coord.y);\n mist.a = 1.0;\n // apply user alpha\n mist *= alpha;\n\n finalColor = texture(uTexture, vTextureCoord) + mist;\n}\n"; + + var source$e = "struct GodrayUniforms {\n uLight: vec2,\n uParallel: f32,\n uAspect: f32,\n uTime: f32,\n uRay: vec3,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var godrayUniforms : GodrayUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uDimensions: vec2 = godrayUniforms.uDimensions;\n let uParallel: bool = godrayUniforms.uParallel > 0.5;\n let uLight: vec2 = godrayUniforms.uLight;\n let uAspect: f32 = godrayUniforms.uAspect;\n\n let coord: vec2 = uv * gfu.uInputSize.xy / uDimensions;\n\n var d: f32;\n\n if (uParallel) {\n let _cos: f32 = uLight.x;\n let _sin: f32 = uLight.y;\n d = (_cos * coord.x) + (_sin * coord.y * uAspect);\n } else {\n let dx: f32 = coord.x - uLight.x / uDimensions.x;\n let dy: f32 = (coord.y - uLight.y / uDimensions.y) * uAspect;\n let dis: f32 = sqrt(dx * dx + dy * dy) + 0.00001;\n d = dy / dis;\n }\n\n let uTime: f32 = godrayUniforms.uTime;\n let uRay: vec3 = godrayUniforms.uRay;\n \n let gain = uRay[0];\n let lacunarity = uRay[1];\n let alpha = uRay[2];\n\n let dir: vec3 = vec3(d, d, 0.0);\n var noise: f32 = turb(dir + vec3(uTime, 0.0, 62.1 + uTime) * 0.05, vec3(480.0, 320.0, 480.0), lacunarity, gain);\n noise = mix(noise, 0.0, 0.3);\n //fade vertically.\n var mist: vec4 = vec4(vec3(noise), 1.0) * (1.0 - coord.y);\n mist.a = 1.0;\n // apply user alpha\n mist *= alpha;\n return textureSample(uTexture, uSampler, uv) + mist;\n}\n\n${PERLIN}"; + + var perlin = "vec3 mod289(vec3 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 permute(vec4 x)\n{\n return mod289(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nvec3 fade(vec3 t)\n{\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\n// Classic Perlin noise, periodic variant\nfloat pnoise(vec3 P, vec3 rep)\n{\n vec3 Pi0 = mod(floor(P), rep); // Integer part, modulo period\n vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec3 Pf0 = fract(P); // Fractional part for interpolation\n vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0);\n vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n vec4 gx1 = ixy1 * (1.0 / 7.0);\n vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g000 = vec3(gx0.x, gy0.x, gz0.x);\n vec3 g100 = vec3(gx0.y, gy0.y, gz0.y);\n vec3 g010 = vec3(gx0.z, gy0.z, gz0.z);\n vec3 g110 = vec3(gx0.w, gy0.w, gz0.w);\n vec3 g001 = vec3(gx1.x, gy1.x, gz1.x);\n vec3 g101 = vec3(gx1.y, gy1.y, gz1.y);\n vec3 g011 = vec3(gx1.z, gy1.z, gz1.z);\n vec3 g111 = vec3(gx1.w, gy1.w, gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\nfloat turb(vec3 P, vec3 rep, float lacunarity, float gain)\n{\n float sum = 0.0;\n float sc = 1.0;\n float totalgain = 1.0;\n for (float i = 0.0; i < 6.0; i++)\n {\n sum += totalgain * pnoise(P * sc, rep);\n sc *= lacunarity;\n totalgain *= gain;\n }\n return abs(sum);\n}\n"; + + var sourcePerlin = "// Taken from https://gist.github.com/munrocket/236ed5ba7e409b8bdf1ff6eca5dcdc39\n\nfn moduloVec3(x: vec3, y: vec3) -> vec3\n{\n return x - y * floor(x/y);\n}\nfn mod289Vec3(x: vec3) -> vec3\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nfn mod289Vec4(x: vec4) -> vec4\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nfn permute4(x: vec4) -> vec4\n{\n return mod289Vec4(((x * 34.0) + 1.0) * x);\n}\nfn taylorInvSqrt(r: vec4) -> vec4\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nfn fade3(t: vec3) -> vec3\n{\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\nfn fade2(t: vec2) -> vec2 { return t * t * t * (t * (t * 6. - 15.) + 10.); }\n\nfn perlinNoise2(P: vec2) -> f32 {\n var Pi: vec4 = floor(P.xyxy) + vec4(0., 0., 1., 1.);\n let Pf = fract(P.xyxy) - vec4(0., 0., 1., 1.);\n Pi = Pi % vec4(289.); // To avoid truncation effects in permutation\n let ix = Pi.xzxz;\n let iy = Pi.yyww;\n let fx = Pf.xzxz;\n let fy = Pf.yyww;\n let i = permute4(permute4(ix) + iy);\n var gx: vec4 = 2. * fract(i * 0.0243902439) - 1.; // 1/41 = 0.024...\n let gy = abs(gx) - 0.5;\n let tx = floor(gx + 0.5);\n gx = gx - tx;\n var g00: vec2 = vec2(gx.x, gy.x);\n var g10: vec2 = vec2(gx.y, gy.y);\n var g01: vec2 = vec2(gx.z, gy.z);\n var g11: vec2 = vec2(gx.w, gy.w);\n let norm = 1.79284291400159 - 0.85373472095314 *\n vec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11));\n g00 = g00 * norm.x;\n g01 = g01 * norm.y;\n g10 = g10 * norm.z;\n g11 = g11 * norm.w;\n let n00 = dot(g00, vec2(fx.x, fy.x));\n let n10 = dot(g10, vec2(fx.y, fy.y));\n let n01 = dot(g01, vec2(fx.z, fy.z));\n let n11 = dot(g11, vec2(fx.w, fy.w));\n let fade_xy = fade2(Pf.xy);\n let n_x = mix(vec2(n00, n01), vec2(n10, n11), vec2(fade_xy.x));\n let n_xy = mix(n_x.x, n_x.y, fade_xy.y);\n return 2.3 * n_xy;\n}\n\n// Classic Perlin noise, periodic variant\nfn perlinNoise3(P: vec3, rep: vec3) -> f32\n{\n var Pi0: vec3 = moduloVec3(floor(P), rep); // Integer part, modulo period\n var Pi1: vec3 = moduloVec3(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n Pi0 = mod289Vec3(Pi0);\n Pi1 = mod289Vec3(Pi1);\n let Pf0: vec3 = fract(P); // Fractional part for interpolation\n let Pf1: vec3 = Pf0 - vec3(1.0); // Fractional part - 1.0\n let ix: vec4 = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n let iy: vec4 = vec4(Pi0.yy, Pi1.yy);\n let iz0: vec4 = Pi0.zzzz;\n let iz1: vec4 = Pi1.zzzz;\n let ixy: vec4 = permute4(permute4(ix) + iy);\n let ixy0: vec4 = permute4(ixy + iz0);\n let ixy1: vec4 = permute4(ixy + iz1);\n var gx0: vec4 = ixy0 * (1.0 / 7.0);\n var gy0: vec4 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n let gz0: vec4 = vec4(0.5) - abs(gx0) - abs(gy0);\n let sz0: vec4 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(vec4(0.0), gx0) - 0.5);\n gy0 -= sz0 * (step(vec4(0.0), gy0) - 0.5);\n var gx1: vec4 = ixy1 * (1.0 / 7.0);\n var gy1: vec4 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n let gz1: vec4 = vec4(0.5) - abs(gx1) - abs(gy1);\n let sz1: vec4 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(vec4(0.0), gx1) - 0.5);\n gy1 -= sz1 * (step(vec4(0.0), gy1) - 0.5);\n var g000: vec3 = vec3(gx0.x, gy0.x, gz0.x);\n var g100: vec3 = vec3(gx0.y, gy0.y, gz0.y);\n var g010: vec3 = vec3(gx0.z, gy0.z, gz0.z);\n var g110: vec3 = vec3(gx0.w, gy0.w, gz0.w);\n var g001: vec3 = vec3(gx1.x, gy1.x, gz1.x);\n var g101: vec3 = vec3(gx1.y, gy1.y, gz1.y);\n var g011: vec3 = vec3(gx1.z, gy1.z, gz1.z);\n var g111: vec3 = vec3(gx1.w, gy1.w, gz1.w);\n let norm0: vec4 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n let norm1: vec4 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n let n000: f32 = dot(g000, Pf0);\n let n100: f32 = dot(g100, vec3(Pf1.x, Pf0.yz));\n let n010: f32 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n let n110: f32 = dot(g110, vec3(Pf1.xy, Pf0.z));\n let n001: f32 = dot(g001, vec3(Pf0.xy, Pf1.z));\n let n101: f32 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n let n011: f32 = dot(g011, vec3(Pf0.x, Pf1.yz));\n let n111: f32 = dot(g111, Pf1);\n let fade_xyz: vec3 = fade3(Pf0);\n let n_z: vec4 = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n let n_yz: vec2 = mix(n_z.xy, n_z.zw, fade_xyz.y);\n let n_xyz: f32 = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\nfn turb(P: vec3, rep: vec3, lacunarity: f32, gain: f32) -> f32\n{\n var sum: f32 = 0.0;\n var sc: f32 = 1.0;\n var totalgain: f32 = 1.0;\n for (var i = 0.0; i < 6.0; i += 1)\n {\n sum += totalgain * perlinNoise3(P * sc, rep);\n sc *= lacunarity;\n totalgain *= gain;\n }\n return abs(sum);\n}"; + + var __defProp$e = Object.defineProperty; + var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$e = (obj, key, value) => { + __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _GodrayFilter = class _GodrayFilter extends require$$0.Filter { + constructor(options) { + options = { ..._GodrayFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$e.replace("${PERLIN}", sourcePerlin), + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$e.replace("${PERLIN}", perlin), + name: "god-ray-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + godrayUniforms: { + uLight: { value: new Float32Array(2), type: "vec2" }, + uParallel: { value: 0, type: "f32" }, + uAspect: { value: 0, type: "f32" }, + uTime: { value: options.time, type: "f32" }, + uRay: { value: new Float32Array(3), type: "vec3" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$e(this, "uniforms"); + /** + * The current time position + * @default 0 + */ + __publicField$e(this, "time", 0); + __publicField$e(this, "_angleLight", [0, 0]); + __publicField$e(this, "_angle", 0); + __publicField$e(this, "_center"); + this.uniforms = this.resources.godrayUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in Filter + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + const width = input.frame.width; + const height = input.frame.height; + this.uniforms.uLight[0] = this.parallel ? this._angleLight[0] : this._center.x; + this.uniforms.uLight[1] = this.parallel ? this._angleLight[1] : this._center.y; + this.uniforms.uDimensions[0] = width; + this.uniforms.uDimensions[1] = height; + this.uniforms.uAspect = height / width; + this.uniforms.uTime = this.time; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * The angle/light-source of the rays in degrees. For instance, + * a value of 0 is vertical rays, values of 90 or -90 produce horizontal rays + * @default 30 + */ + get angle() { + return this._angle; + } + set angle(value) { + this._angle = value; + const radians = value * require$$0.DEG_TO_RAD; + this._angleLight[0] = Math.cos(radians); + this._angleLight[1] = Math.sin(radians); + } + /** + * `true` if light rays are parallel (uses angle), `false` to use the focal `center` point + * @default true + */ + get parallel() { + return this.uniforms.uParallel > 0.5; + } + set parallel(value) { + this.uniforms.uParallel = value ? 1 : 0; + } + /** + * Focal point for non-parallel rays, to use this `parallel` must be set to `false`. + * @default {x:0,y:0} + */ + get center() { + return this._center; + } + set center(value) { + this._center = value; + } + /** + * Focal point for non-parallel rays on the `x` axis, to use this `parallel` must be set to `false`. + * @default 0 + */ + get centerX() { + return this.center.x; + } + set centerX(value) { + this.center.x = value; + } + /** + * Focal point for non-parallel rays on the `y` axis, to use this `parallel` must be set to `false`. + * @default 0 + */ + get centerY() { + return this.center.y; + } + set centerY(value) { + this.center.y = value; + } + /** + * General intensity of the effect. A value closer to 1 will produce a more intense effect, + * where a value closer to 0 will produce a subtler effect + * @default 0.5 + */ + get gain() { + return this.uniforms.uRay[0]; + } + set gain(value) { + this.uniforms.uRay[0] = value; + } + /** + * The density of the fractal noise. + * A higher amount produces more rays and a smaller amount produces fewer waves + * @default 2.5 + */ + get lacunarity() { + return this.uniforms.uRay[1]; + } + set lacunarity(value) { + this.uniforms.uRay[1] = value; + } + /** + * The alpha (opacity) of the rays. 0 is fully transparent, 1 is fully opaque. + * @default 1 + */ + get alpha() { + return this.uniforms.uRay[2]; + } + set alpha(value) { + this.uniforms.uRay[2] = value; + } + }; + /** Default values for options. */ + __publicField$e(_GodrayFilter, "DEFAULT_OPTIONS", { + angle: 30, + gain: 0.5, + lacunarity: 2.5, + parallel: true, + time: 0, + center: { x: 0, y: 0 }, + alpha: 1 + }); + + var fragment$d = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec3 uHsl;\nuniform float uAlpha;\nuniform float uColorize;\n\n// https://en.wikipedia.org/wiki/Luma_(video)\nconst vec3 weight = vec3(0.299, 0.587, 0.114);\n\nfloat getWeightedAverage(vec3 rgb) {\n return rgb.r * weight.r + rgb.g * weight.g + rgb.b * weight.b;\n}\n\n// https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786?permalink_comment_id=3195243#gistcomment-3195243\nconst vec3 k = vec3(0.57735, 0.57735, 0.57735);\n\nvec3 hueShift(vec3 color, float angle) {\n float cosAngle = cos(angle);\n return vec3(\n color * cosAngle +\n cross(k, color) * sin(angle) +\n k * dot(k, color) * (1.0 - cosAngle)\n );\n}\n\nvoid main()\n{\n vec4 color = texture(uTexture, vTextureCoord);\n vec3 resultRGB = color.rgb;\n\n float hue = uHsl[0];\n float saturation = uHsl[1];\n float lightness = uHsl[2];\n\n // colorize\n if (uColorize > 0.5) {\n resultRGB = vec3(getWeightedAverage(resultRGB), 0., 0.);\n }\n\n // hue\n resultRGB = hueShift(resultRGB, hue);\n\n // saturation\n // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/huesaturation.js\n float average = (resultRGB.r + resultRGB.g + resultRGB.b) / 3.0;\n\n if (saturation > 0.) {\n resultRGB += (average - resultRGB) * (1. - 1. / (1.001 - saturation));\n } else {\n resultRGB -= (average - resultRGB) * saturation;\n }\n\n // lightness\n resultRGB = mix(resultRGB, vec3(ceil(lightness)) * color.a, abs(lightness));\n\n // alpha\n finalColor = mix(color, vec4(resultRGB, color.a), uAlpha);\n}\n"; + + var source$d = "struct HslUniforms {\n uHsl:vec3,\n uColorize:f32,\n uAlpha:f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var hslUniforms : HslUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let color: vec4 = textureSample(uTexture, uSampler, uv);\n var resultRGB: vec3 = color.rgb;\n\n let hue: f32 = hslUniforms.uHsl[0];\n let saturation: f32 = hslUniforms.uHsl[1];\n let lightness: f32 = hslUniforms.uHsl[2];\n\n // colorize\n if (hslUniforms.uColorize > 0.5) {\n resultRGB = vec3(dot(color.rgb, vec3(0.299, 0.587, 0.114)), 0., 0.);\n }\n\n // hue\n resultRGB = hueShift(resultRGB, hue);\n\n // saturation\n // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/huesaturation.js\n let average: f32 = (resultRGB.r + resultRGB.g + resultRGB.b) / 3.0;\n\n if (saturation > 0.) {\n resultRGB += (average - resultRGB) * (1. - 1. / (1.001 - saturation));\n } else {\n resultRGB -= (average - resultRGB) * saturation;\n }\n\n // lightness\n resultRGB = mix(resultRGB, vec3(ceil(lightness)) * color.a, abs(lightness));\n\n // alpha\n return mix(color, vec4(resultRGB, color.a), hslUniforms.uAlpha);\n}\n\n// https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786?permalink_comment_id=3195243#gistcomment-3195243\nconst k: vec3 = vec3(0.57735, 0.57735, 0.57735);\n\nfn hueShift(color: vec3, angle: f32) -> vec3 \n{\n let cosAngle: f32 = cos(angle);\n return vec3(\n color * cosAngle +\n cross(k, color) * sin(angle) +\n k * dot(k, color) * (1.0 - cosAngle)\n );\n}"; + + var __defProp$d = Object.defineProperty; + var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$d = (obj, key, value) => { + __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _HslAdjustmentFilter = class _HslAdjustmentFilter extends require$$0.Filter { + constructor(options) { + options = { ..._HslAdjustmentFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$d, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$d, + name: "hsl-adjustment-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + hslUniforms: { + uHsl: { value: new Float32Array(3), type: "vec3" }, + uColorize: { value: options.colorize ? 1 : 0, type: "f32" }, + uAlpha: { value: options.alpha, type: "f32" } + } + } + }); + __publicField$d(this, "uniforms"); + __publicField$d(this, "_hue"); + this.uniforms = this.resources.hslUniforms.uniforms; + this.hue = options.hue; + } + /** + * The amount of hue in degrees (-180 to 180) + * @default 0 + */ + get hue() { + return this._hue; + } + set hue(value) { + this._hue = value; + this.resources.hslUniforms.uniforms.uHsl[0] = value * (Math.PI / 180); + } + /** + * The amount of lightness (-1 to 1) + * @default 0 + */ + get saturation() { + return this.resources.hslUniforms.uniforms.uHsl[1]; + } + set saturation(value) { + this.resources.hslUniforms.uniforms.uHsl[1] = value; + } + /** + * The amount of lightness (-1 to 1) + * @default 0 + */ + get lightness() { + return this.resources.hslUniforms.uniforms.uHsl[2]; + } + set lightness(value) { + this.resources.hslUniforms.uniforms.uHsl[2] = value; + } + /** + * Whether to colorize the image + * @default false + */ + get colorize() { + return this.resources.hslUniforms.uniforms.uColorize === 1; + } + set colorize(value) { + this.resources.hslUniforms.uniforms.uColorize = value ? 1 : 0; + } + /** + * The amount of alpha (0 to 1) + * @default 1 + */ + get alpha() { + return this.resources.hslUniforms.uniforms.uAlpha; + } + set alpha(value) { + this.resources.hslUniforms.uniforms.uAlpha = value; + } + }; + /** Default values for options. */ + __publicField$d(_HslAdjustmentFilter, "DEFAULT_OPTIONS", { + hue: 0, + saturation: 0, + lightness: 0, + colorize: false, + alpha: 1 + }); + + var fragment$c = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uVelocity;\nuniform int uKernelSize;\nuniform float uOffset;\n\nuniform vec4 uInputSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\n// Notice:\n// the perfect way:\n// int kernelSize = min(uKernelSize, MAX_KERNELSIZE);\n// BUT in real use-case , uKernelSize < MAX_KERNELSIZE almost always.\n// So use uKernelSize directly.\n\nvoid main(void)\n{\n vec4 color = texture(uTexture, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n finalColor = color;\n return;\n }\n\n vec2 velocity = uVelocity / uInputSize.xy;\n float offset = -uOffset / length(uVelocity) - 0.5;\n int k = uKernelSize - 1;\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n vec2 bias = velocity * (float(i) / float(k) + offset);\n color += texture(uTexture, vTextureCoord + bias);\n }\n finalColor = color / float(uKernelSize);\n}\n"; + + var source$c = "struct MotionBlurUniforms {\n uVelocity: vec2,\n uKernelSize: f32,\n uOffset: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var motionBlurUniforms : MotionBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uVelocity = motionBlurUniforms.uVelocity;\n let uKernelSize = motionBlurUniforms.uKernelSize;\n let uOffset = motionBlurUniforms.uOffset;\n\n let velocity: vec2 = uVelocity / gfu.uInputSize.xy;\n let offset: f32 = -uOffset / length(uVelocity) - 0.5;\n let k: i32 = i32(min(uKernelSize - 1, MAX_KERNEL_SIZE - 1));\n\n var color: vec4 = textureSample(uTexture, uSampler, uv);\n\n for(var i: i32 = 0; i < k; i += 1) {\n let bias: vec2 = velocity * (f32(i) / f32(k) + offset);\n color += textureSample(uTexture, uSampler, uv + bias);\n }\n \n return select(color / f32(uKernelSize), textureSample(uTexture, uSampler, uv), uKernelSize == 0);\n}\n\nconst MAX_KERNEL_SIZE: f32 = 2048;"; + + var __defProp$c = Object.defineProperty; + var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$c = (obj, key, value) => { + __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _MotionBlurFilter = class _MotionBlurFilter extends require$$0.Filter { + constructor(options) { + options = { ..._MotionBlurFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$c, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$c, + name: "motion-blur-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + motionBlurUniforms: { + uVelocity: { value: options.velocity, type: "vec2" }, + uKernelSize: { value: Math.trunc(options.kernelSize ?? 5), type: "f32" }, + uOffset: { value: options.offset, type: "f32" } + } + } + }); + __publicField$c(this, "uniforms"); + __publicField$c(this, "_kernelSize"); + this.uniforms = this.resources.motionBlurUniforms.uniforms; + Object.assign(this, options); + } + /** + * Sets the velocity of the motion for blur effect + * This should be a size 2 array or an object containing `x` and `y` values, you cannot change types + * once defined in the constructor + * @default {x:0,y:0} + */ + get velocity() { + return this.uniforms.uVelocity; + } + set velocity(value) { + this.uniforms.uVelocity = value; + this._updateDirty(); + } + /** + * Sets the velocity of the motion for blur effect on the `x` axis + * @default 0 + */ + get velocityX() { + return this.velocity.x; + } + set velocityX(value) { + this.velocity.x = value; + this._updateDirty(); + } + /** + * Sets the velocity of the motion for blur effect on the `x` axis + * @default 0 + */ + get velocityY() { + return this.velocity.y; + } + set velocityY(value) { + this.velocity.y = value; + this._updateDirty(); + } + /** + * The kernelSize of the blur filter. Must be odd number >= 5 + * @default 5 + */ + get kernelSize() { + return this._kernelSize; + } + set kernelSize(value) { + this._kernelSize = value; + this._updateDirty(); + } + /** + * The offset of the blur filter + * @default 0 + */ + get offset() { + return this.uniforms.uOffset; + } + set offset(value) { + this.uniforms.uOffset = value; + } + _updateDirty() { + this.padding = (Math.max(Math.abs(this.velocityX), Math.abs(this.velocityY)) >> 0) + 1; + this.uniforms.uKernelSize = this.velocityX !== 0 || this.velocityY !== 0 ? this._kernelSize : 0; + } + }; + /** Default values for options. */ + __publicField$c(_MotionBlurFilter, "DEFAULT_OPTIONS", { + velocity: { x: 0, y: 0 }, + kernelSize: 5, + offset: 0 + }); + + var fragment$b = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nconst int MAX_COLORS = ${MAX_COLORS};\n\nuniform sampler2D uTexture;\nuniform vec3 uOriginalColors[MAX_COLORS];\nuniform vec3 uTargetColors[MAX_COLORS];\nuniform float uTolerance;\n\nvoid main(void)\n{\n finalColor = texture(uTexture, vTextureCoord);\n\n float alpha = finalColor.a;\n if (alpha < 0.0001)\n {\n return;\n }\n\n vec3 color = finalColor.rgb / alpha;\n\n for(int i = 0; i < MAX_COLORS; i++)\n {\n vec3 origColor = uOriginalColors[i];\n if (origColor.r < 0.0)\n {\n break;\n }\n vec3 colorDiff = origColor - color;\n if (length(colorDiff) < uTolerance)\n {\n vec3 targetColor = uTargetColors[i];\n finalColor = vec4((targetColor + colorDiff) * alpha, alpha);\n return;\n }\n }\n}\n"; + + var source$b = "struct MultiColorReplaceUniforms {\n uOriginalColors: array, MAX_COLORS>,\n uTargetColors: array, MAX_COLORS>,\n uTolerance:f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var multiColorReplaceUniforms : MultiColorReplaceUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uOriginalColors = multiColorReplaceUniforms.uOriginalColors;\n let uTargetColors = multiColorReplaceUniforms.uTargetColors;\n let uTolerance = multiColorReplaceUniforms.uTolerance;\n\n var color: vec4 = textureSample(uTexture, uSampler, uv);\n\n let alpha: f32 = color.a;\n\n if (alpha > 0.0001)\n {\n var modColor: vec3 = vec3(color.rgb) / alpha;\n\n for(var i: i32 = 0; i < MAX_COLORS; i += 1)\n {\n let origColor: vec3 = uOriginalColors[i];\n if (origColor.r < 0.0)\n {\n break;\n }\n let colorDiff: vec3 = origColor - modColor;\n \n if (length(colorDiff) < uTolerance)\n {\n let targetColor: vec3 = uTargetColors[i];\n color = vec4((targetColor + colorDiff) * alpha, alpha);\n return color;\n }\n }\n }\n\n return color;\n}\n\nconst MAX_COLORS: i32 = ${MAX_COLORS};"; + + var __defProp$b = Object.defineProperty; + var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$b = (obj, key, value) => { + __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _MultiColorReplaceFilter = class _MultiColorReplaceFilter extends require$$0.Filter { + constructor(options) { + options = { ..._MultiColorReplaceFilter.DEFAULT_OPTIONS, ...options }; + const maxColors = options.maxColors ?? options.replacements.length; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$b.replace(/\$\{MAX_COLORS\}/g, maxColors.toFixed(0)), + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$b.replace(/\$\{MAX_COLORS\}/g, maxColors.toFixed(0)), + name: "multi-color-replace-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + multiColorReplaceUniforms: { + uOriginalColors: { + value: new Float32Array(3 * maxColors), + type: "vec3", + size: maxColors + }, + uTargetColors: { + value: new Float32Array(3 * maxColors), + type: "vec3", + size: maxColors + }, + uTolerance: { value: options.tolerance, type: "f32" } + } + } + }); + __publicField$b(this, "uniforms"); + __publicField$b(this, "_replacements", []); + __publicField$b(this, "_maxColors"); + this._maxColors = maxColors; + this.uniforms = this.resources.multiColorReplaceUniforms.uniforms; + this.replacements = options.replacements; + } + /** + * The collection of replacement items. Each item is color-pair + * (an array length is 2). In the pair, the first value is original color , the second value is target color + */ + set replacements(replacements) { + const originals = this.uniforms.uOriginalColors; + const targets = this.uniforms.uTargetColors; + const colorCount = replacements.length; + const color = new require$$0.Color(); + if (colorCount > this._maxColors) { + throw new Error(`Length of replacements (${colorCount}) exceeds the maximum colors length (${this._maxColors})`); + } + originals[colorCount * 3] = -1; + let r; + let g; + let b; + for (let i = 0; i < colorCount; i++) { + const pair = replacements[i]; + color.setValue(pair[0]); + [r, g, b] = color.toArray(); + originals[i * 3] = r; + originals[i * 3 + 1] = g; + originals[i * 3 + 2] = b; + color.setValue(pair[1]); + [r, g, b] = color.toArray(); + targets[i * 3] = r; + targets[i * 3 + 1] = g; + targets[i * 3 + 2] = b; + } + this._replacements = replacements; + } + get replacements() { + return this._replacements; + } + /** + * Should be called after changing any of the contents of the replacements. + * This is a convenience method for resetting the `replacements`. + * @todo implement nested proxy to remove the need for this function + */ + refresh() { + this.replacements = this._replacements; + } + /** + * The maximum number of color replacements supported by this filter. Can be changed + * _only_ during construction. + * @readonly + */ + get maxColors() { + return this._maxColors; + } + /** + * Tolerance of the floating-point comparison between colors (lower = more exact, higher = more inclusive) + * @default 0.05 + */ + get tolerance() { + return this.uniforms.uTolerance; + } + set tolerance(value) { + this.uniforms.uTolerance = value; + } + }; + /** Default values for options. */ + __publicField$b(_MultiColorReplaceFilter, "DEFAULT_OPTIONS", { + replacements: [[16711680, 255]], + tolerance: 0.05, + maxColors: void 0 + }); + + var fragment$a = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uSepia;\nuniform vec2 uNoise;\nuniform vec3 uScratch;\nuniform vec3 uVignette;\nuniform float uSeed;\nuniform vec2 uDimensions;\n\nuniform vec4 uInputSize;\n\nconst float SQRT_2 = 1.414213;\nconst vec3 SEPIA_RGB = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvec3 Overlay(vec3 src, vec3 dst)\n{\n // if (dst <= 0.5) then: 2 * src * dst\n // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n finalColor = texture(uTexture, vTextureCoord);\n vec3 color = finalColor.rgb;\n\n if (uSepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + uSepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * uInputSize.xy / uDimensions.xy;\n\n float vignette = uVignette[0];\n float vignetteAlpha = uVignette[1];\n float vignetteBlur = uVignette[2];\n\n if (vignette > 0.0)\n {\n float outter = SQRT_2 - vignette * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= uDimensions.y / uDimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignetteBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignetteAlpha);\n }\n\n float scratch = uScratch[0];\n float scratchDensity = uScratch[1];\n float scratchWidth = uScratch[2];\n\n if (scratchDensity > uSeed && scratch != 0.0)\n {\n float phase = uSeed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(uSeed * dist, abs(s - uSeed * dist)));\n if (d < uSeed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / uDimensions.x * (0.75 + uSeed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n float noise = uNoise[0];\n float noiseSize = uNoise[1];\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + uSeed * 512.0, 1024.0 - uSeed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * uSeed) - 0.5;\n color += _noise * noise;\n }\n\n finalColor.rgb = color;\n}\n"; + + var source$a = "struct OldFilmUniforms {\n uSepia: f32,\n uNoise: vec2,\n uScratch: vec3,\n uVignette: vec3,\n uSeed: f32,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var oldFilmUniforms : OldFilmUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color: vec4 = textureSample(uTexture, uSampler, uv);\n\n if (oldFilmUniforms.uSepia > 0.)\n {\n color = vec4(sepia(color.rgb), color.a);\n }\n\n let coord: vec2 = uv * gfu.uInputSize.xy / oldFilmUniforms.uDimensions;\n\n if (oldFilmUniforms.uVignette[0] > 0.)\n {\n color *= vec4(vec3(vignette(color.rgb, coord)), color.a);\n }\n\n let uScratch = oldFilmUniforms.uScratch; \n\n if (uScratch[1] > oldFilmUniforms.uSeed && uScratch[0] != 0.)\n {\n color = vec4(scratch(color.rgb, coord), color.a);\n }\n\n let uNoise = oldFilmUniforms.uNoise;\n\n if (uNoise[0] > 0.0 && uNoise[1] > 0.0)\n {\n color += vec4(vec3(noise(uv)), color.a);\n }\n\n return color;\n}\n\nconst SQRT_2: f32 = 1.414213;\nconst SEPIA_RGB: vec3 = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}\n\nfn rand(co: vec2) -> f32\n{\n return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nfn overlay(src: vec3, dst: vec3) -> vec3\n{\n // if (dst <= 0.5) then: 2 * src * dst\n // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n\n return vec3(\n select((1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)), (2.0 * src.x * dst.x), (dst.x <= 0.5)), \n select((1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)), (2.0 * src.y * dst.y), (dst.y <= 0.5)),\n select((1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)), (2.0 * src.z * dst.z), (dst.z <= 0.5))\n );\n}\n\nfn sepia(co: vec3) -> vec3\n{\n let gray: f32 = (co.x + co.y + co.z) / 3.0;\n let grayscale: vec3 = vec3(gray);\n let color = overlay(SEPIA_RGB, grayscale);\n return grayscale + oldFilmUniforms.uSepia * (color - grayscale);\n}\n\nfn vignette(co: vec3, coord: vec2) -> f32\n{\n let uVignette = oldFilmUniforms.uVignette;\n let uDimensions = oldFilmUniforms.uDimensions;\n \n let outter: f32 = SQRT_2 - uVignette[0] * SQRT_2;\n var dir: vec2 = vec2(vec2(0.5) - coord);\n dir.y *= uDimensions.y / uDimensions.x;\n let darker: f32 = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + uVignette[2] * SQRT_2), 0.0, 1.0);\n return darker + (1.0 - darker) * (1.0 - uVignette[1]);\n}\n\nfn scratch(co: vec3, coord: vec2) -> vec3\n{\n var color = co;\n let uScratch = oldFilmUniforms.uScratch;\n let uSeed = oldFilmUniforms.uSeed;\n let uDimensions = oldFilmUniforms.uDimensions;\n\n let phase: f32 = uSeed * 256.0;\n let s: f32 = modulo(floor(phase), 2.0);\n let dist: f32 = 1.0 / uScratch[1];\n let d: f32 = distance(coord, vec2(uSeed * dist, abs(s - uSeed * dist)));\n\n if (d < uSeed * 0.6 + 0.4)\n {\n let period: f32 = uScratch[1] * 10.0;\n\n let xx: f32 = coord.x * period + phase;\n let aa: f32 = abs(modulo(xx, 0.5) * 4.0);\n let bb: f32 = modulo(floor(xx / 0.5), 2.0);\n let yy: f32 = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n let kk: f32 = 2.0 * period;\n let dw: f32 = uScratch[2] / uDimensions.x * (0.75 + uSeed);\n let dh: f32 = dw * kk;\n\n var tine: f32 = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n let _sign: f32 = sign(uScratch[0]);\n\n tine = s * tine / period + uScratch[0] + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color *= tine;\n }\n }\n\n return color;\n}\n\nfn noise(coord: vec2) -> f32\n{\n let uNoise = oldFilmUniforms.uNoise;\n let uSeed = oldFilmUniforms.uSeed;\n\n var pixelCoord: vec2 = coord * gfu.uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / uNoise[1]);\n pixelCoord.y = floor(pixelCoord.y / uNoise[1]);\n return (rand(pixelCoord * uNoise[1] * uSeed) - 0.5) * uNoise[0];\n}"; + + var __defProp$a = Object.defineProperty; + var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$a = (obj, key, value) => { + __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _OldFilmFilter = class _OldFilmFilter extends require$$0.Filter { + constructor(options) { + options = { ..._OldFilmFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$a, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$a, + name: "old-film-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + oldFilmUniforms: { + uSepia: { value: options.sepia, type: "f32" }, + uNoise: { value: new Float32Array(2), type: "vec2" }, + uScratch: { value: new Float32Array(3), type: "vec3" }, + uVignette: { value: new Float32Array(3), type: "vec3" }, + uSeed: { value: options.seed, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$a(this, "uniforms"); + /** + * A seed value to apply to the random noise generation + * @default 0 + */ + __publicField$a(this, "seed"); + this.uniforms = this.resources.oldFilmUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + this.uniforms.uSeed = this.seed; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * The amount of saturation of sepia effect, + * a value of `1` is more saturation and closer to `0` is less, and a value of `0` produces no sepia effect + * @default 0.3 + */ + get sepia() { + return this.uniforms.uSepia; + } + set sepia(value) { + this.uniforms.uSepia = value; + } + /** + * Opacity/intensity of the noise effect between `0` and `1` + * @default 0.3 + */ + get noise() { + return this.uniforms.uNoise[0]; + } + set noise(value) { + this.uniforms.uNoise[0] = value; + } + /** + * The size of the noise particles + * @default 1 + */ + get noiseSize() { + return this.uniforms.uNoise[1]; + } + set noiseSize(value) { + this.uniforms.uNoise[1] = value; + } + /** + * How often scratches appear + * @default 0.5 + */ + get scratch() { + return this.uniforms.uScratch[0]; + } + set scratch(value) { + this.uniforms.uScratch[0] = value; + } + /** + * The density of the number of scratches + * @default 0.3 + */ + get scratchDensity() { + return this.uniforms.uScratch[1]; + } + set scratchDensity(value) { + this.uniforms.uScratch[1] = value; + } + /** + * The width of the scratches + * @default 1 + */ + get scratchWidth() { + return this.uniforms.uScratch[2]; + } + set scratchWidth(value) { + this.uniforms.uScratch[2] = value; + } + /** + * The radius of the vignette effect, smaller values produces a smaller vignette + * @default 0.3 + */ + get vignette() { + return this.uniforms.uVignette[0]; + } + set vignette(value) { + this.uniforms.uVignette[0] = value; + } + /** + * Amount of opacity on the vignette + * @default 1 + */ + get vignetteAlpha() { + return this.uniforms.uVignette[1]; + } + set vignetteAlpha(value) { + this.uniforms.uVignette[1] = value; + } + /** + * Blur intensity of the vignette + * @default 1 + */ + get vignetteBlur() { + return this.uniforms.uVignette[2]; + } + set vignetteBlur(value) { + this.uniforms.uVignette[2] = value; + } + }; + /** Default values for options. */ + __publicField$a(_OldFilmFilter, "DEFAULT_OPTIONS", { + sepia: 0.3, + noise: 0.3, + noiseSize: 1, + scratch: 0.5, + scratchDensity: 0.3, + scratchWidth: 1, + vignette: 0.3, + vignetteAlpha: 1, + vignetteBlur: 0.3, + seed: 0 + }); + + var fragment$9 = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uThickness;\nuniform vec3 uColor;\nuniform float uAlpha;\nuniform float uKnockout;\n\nuniform vec4 uInputClamp;\n\nconst float DOUBLE_PI = 2. * 3.14159265358979323846264;\nconst float ANGLE_STEP = ${ANGLE_STEP};\n\nfloat outlineMaxAlphaAtPos(vec2 pos) {\n if (uThickness.x == 0. || uThickness.y == 0.) {\n return 0.;\n }\n\n vec4 displacedColor;\n vec2 displacedPos;\n float maxAlpha = 0.;\n\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ANGLE_STEP) {\n displacedPos.x = vTextureCoord.x + uThickness.x * cos(angle);\n displacedPos.y = vTextureCoord.y + uThickness.y * sin(angle);\n displacedColor = texture(uTexture, clamp(displacedPos, uInputClamp.xy, uInputClamp.zw));\n maxAlpha = max(maxAlpha, displacedColor.a);\n }\n\n return maxAlpha;\n}\n\nvoid main(void) {\n vec4 sourceColor = texture(uTexture, vTextureCoord);\n vec4 contentColor = sourceColor * float(uKnockout < 0.5);\n float outlineAlpha = uAlpha * outlineMaxAlphaAtPos(vTextureCoord.xy) * (1.-sourceColor.a);\n vec4 outlineColor = vec4(vec3(uColor) * outlineAlpha, outlineAlpha);\n finalColor = contentColor + outlineColor;\n}\n"; + + var source$9 = "struct OutlineUniforms {\n uThickness:vec2,\n uColor:vec3,\n uAlpha:f32,\n uAngleStep:f32,\n uKnockout:f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var outlineUniforms : OutlineUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let sourceColor: vec4 = textureSample(uTexture, uSampler, uv);\n let contentColor: vec4 = sourceColor * (1. - outlineUniforms.uKnockout);\n \n let outlineAlpha: f32 = outlineUniforms.uAlpha * outlineMaxAlphaAtPos(uv) * (1. - sourceColor.a);\n let outlineColor: vec4 = vec4(vec3(outlineUniforms.uColor) * outlineAlpha, outlineAlpha);\n \n return contentColor + outlineColor;\n}\n\nfn outlineMaxAlphaAtPos(uv: vec2) -> f32 {\n let thickness = outlineUniforms.uThickness;\n\n if (thickness.x == 0. || thickness.y == 0.) {\n return 0.;\n }\n \n let angleStep = outlineUniforms.uAngleStep;\n\n var displacedColor: vec4;\n var displacedPos: vec2;\n\n var maxAlpha: f32 = 0.;\n var displaced: vec2;\n var curColor: vec4;\n\n for (var angle = 0.; angle <= DOUBLE_PI; angle += angleStep)\n {\n displaced.x = uv.x + thickness.x * cos(angle);\n displaced.y = uv.y + thickness.y * sin(angle);\n curColor = textureSample(uTexture, uSampler, clamp(displaced, gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n\n return maxAlpha;\n}\n\nconst DOUBLE_PI: f32 = 3.14159265358979323846264 * 2.;"; + + var __defProp$9 = Object.defineProperty; + var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$9 = (obj, key, value) => { + __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _OutlineFilter = class _OutlineFilter extends require$$0.Filter { + constructor(options) { + options = { ..._OutlineFilter.DEFAULT_OPTIONS, ...options }; + const quality = options.quality ?? 0.1; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$9, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$9.replace(/\$\{ANGLE_STEP\}/, _OutlineFilter.getAngleStep(quality).toFixed(7)), + name: "outline-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + outlineUniforms: { + uThickness: { value: new Float32Array(2), type: "vec2" }, + uColor: { value: new Float32Array(3), type: "vec3" }, + uAlpha: { value: options.alpha, type: "f32" }, + uAngleStep: { value: 0, type: "f32" }, + uKnockout: { value: options.knockout ? 1 : 0, type: "f32" } + } + } + }); + __publicField$9(this, "uniforms"); + __publicField$9(this, "_thickness"); + __publicField$9(this, "_quality"); + __publicField$9(this, "_color"); + this.uniforms = this.resources.outlineUniforms.uniforms; + this.uniforms.uAngleStep = _OutlineFilter.getAngleStep(quality); + this._color = new require$$0.Color(); + this.color = options.color ?? 0; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uThickness[0] = this.thickness / input.source.width; + this.uniforms.uThickness[1] = this.thickness / input.source.height; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * Get the angleStep by quality + * @param quality + */ + static getAngleStep(quality) { + return parseFloat((Math.PI * 2 / Math.max( + quality * _OutlineFilter.MAX_SAMPLES, + _OutlineFilter.MIN_SAMPLES + )).toFixed(7)); + } + /** + * The thickness of the outline + * @default 1 + */ + get thickness() { + return this._thickness; + } + set thickness(value) { + this._thickness = this.padding = value; + } + /** + * The color value of the ambient color + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0x000000 + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * Coefficient for alpha multiplication + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + /** + * The quality of the outline from `0` to `1`. + * Using a higher quality setting will result in more accuracy but slower performance + * @default 0.1 + */ + get quality() { + return this._quality; + } + set quality(value) { + this._quality = value; + this.uniforms.uAngleStep = _OutlineFilter.getAngleStep(value); + } + /** + * Whether to only render outline, not the contents. + * @default false + */ + get knockout() { + return this.uniforms.uKnockout === 1; + } + set knockout(value) { + this.uniforms.uKnockout = value ? 1 : 0; + } + }; + /** Default values for options. */ + __publicField$9(_OutlineFilter, "DEFAULT_OPTIONS", { + thickness: 1, + color: 0, + alpha: 1, + quality: 0.1, + knockout: false + }); + /** The minimum number of samples for rendering outline. */ + __publicField$9(_OutlineFilter, "MIN_SAMPLES", 1); + /** The maximum number of samples for rendering outline. */ + __publicField$9(_OutlineFilter, "MAX_SAMPLES", 100); + + var fragment$8 = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform vec2 uSize;\nuniform sampler2D uTexture;\nuniform vec4 uInputSize;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= uInputSize.xy;\n coord += uInputSize.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= uInputSize.zw;\n coord /= uInputSize.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 uSize)\n{\n\treturn floor( coord / uSize ) * uSize;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n coord = pixelate(coord, uSize);\n coord = unmapCoord(coord);\n finalColor = texture(uTexture, coord);\n}\n"; + + var source$8 = "struct PixelateUniforms {\n uSize:vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var pixelateUniforms : PixelateUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let pixelSize: vec2 = pixelateUniforms.uSize;\n let coord: vec2 = mapCoord(uv);\n\n var pixCoord: vec2 = pixelate(coord, pixelSize);\n pixCoord = unmapCoord(pixCoord);\n\n return textureSample(uTexture, uSampler, pixCoord);\n}\n\nfn mapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord *= gfu.uInputSize.xy;\n mappedCoord += gfu.uOutputFrame.xy;\n return mappedCoord;\n}\n\nfn unmapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord -= gfu.uOutputFrame.xy;\n mappedCoord /= gfu.uInputSize.xy;\n return mappedCoord;\n}\n\nfn pixelate(coord: vec2, size: vec2) -> vec2\n{\n return floor( coord / size ) * size;\n}\n\n"; + + var __defProp$8 = Object.defineProperty; + var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$8 = (obj, key, value) => { + __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _PixelateFilter = class _PixelateFilter extends require$$0.Filter { + /** + * @param {Point|Array|number} [size=10] - Either the width/height of the size of the pixels, or square size + */ + constructor(size) { + size = size ?? _PixelateFilter.DEFAULT_SIZE; + const pixelateUniforms = new require$$0.UniformGroup({ + uSize: { value: new Float32Array(2), type: "vec2" } + }); + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$8, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$8, + name: "pixelate-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + pixelateUniforms + } + }); + this.size = size; + } + /** + * The size of the pixels + * @default [10,10] + */ + get size() { + return this.resources.pixelateUniforms.uniforms.uSize; + } + set size(value) { + if (value instanceof require$$0.Point) { + this.sizeX = value.x; + this.sizeY = value.y; + } else if (Array.isArray(value)) { + this.resources.pixelateUniforms.uniforms.uSize = value; + } else { + this.sizeX = this.sizeY = value; + } + } + /** + * The size of the pixels on the `x` axis + * @default 10 + */ + get sizeX() { + return this.resources.pixelateUniforms.uniforms.uSize[0]; + } + set sizeX(value) { + this.resources.pixelateUniforms.uniforms.uSize[0] = value; + } + /** + * The size of the pixels on the `y` axis + * @default 10 + */ + get sizeY() { + return this.resources.pixelateUniforms.uniforms.uSize[1]; + } + set sizeY(value) { + this.resources.pixelateUniforms.uniforms.uSize[1] = value; + } + }; + /** Default values for options. */ + __publicField$8(_PixelateFilter, "DEFAULT_SIZE", 10); + + var fragment$7 = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nuniform vec4 uInputSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture(uTexture, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n finalColor = color;\n return;\n }\n\n float aspect = uInputSize.y / uInputSize.x;\n vec2 center = uCenter.xy / uInputSize.xy;\n float gradient = uRadius / uInputSize.x * 0.3;\n float radius = uRadius / uInputSize.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n finalColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture(uTexture, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n finalColor = color / float(uKernelSize);\n}\n"; + + var source$7 = "struct RadialBlurUniforms {\n uRadian: f32,\n uCenter: vec2,\n uKernelSize: f32,\n uRadius: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var radialBlurUniforms : RadialBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uRadian = radialBlurUniforms.uRadian;\n let uCenter = radialBlurUniforms.uCenter;\n let uKernelSize = radialBlurUniforms.uKernelSize;\n let uRadius = radialBlurUniforms.uRadius;\n \n var returnColorOnly = false;\n\n if (uKernelSize == 0)\n {\n returnColorOnly = true;\n }\n\n let aspect: f32 = gfu.uInputSize.y / gfu.uInputSize.x;\n let center: vec2 = uCenter.xy / gfu.uInputSize.xy;\n let gradient: f32 = uRadius / gfu.uInputSize.x * 0.3;\n let radius: f32 = uRadius / gfu.uInputSize.x - gradient * 0.5;\n let k: i32 = i32(uKernelSize - 1);\n\n var coord: vec2 = uv;\n let dir: vec2 = vec2(center - coord);\n let dist: f32 = length(vec2(dir.x, dir.y * aspect));\n\n var radianStep: f32 = uRadian;\n \n if (radius >= 0.0 && dist > radius)\n {\n let delta: f32 = dist - radius;\n let gap: f32 = gradient;\n let scale: f32 = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n returnColorOnly = true;\n }\n radianStep *= scale;\n }\n\n radianStep /= f32(k);\n\n let s: f32 = sin(radianStep);\n let c: f32 = cos(radianStep);\n let rotationMatrix: mat2x2 = mat2x2(vec2(c, -s), vec2(s, c));\n \n var color: vec4 = textureSample(uTexture, uSampler, uv);\n let baseColor = vec4(color);\n\n let minK: i32 = min(i32(uKernelSize) - 1, MAX_KERNEL_SIZE - 1);\n\n for(var i: i32 = 0; i < minK; i += 1) \n {\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n let sample: vec4 = textureSample(uTexture, uSampler, coord);\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n color += sample;\n }\n\n return select(color / f32(uKernelSize), baseColor, returnColorOnly);\n}\n\nconst MAX_KERNEL_SIZE: i32 = 2048;"; + + var __defProp$7 = Object.defineProperty; + var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$7 = (obj, key, value) => { + __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _RadialBlurFilter = class _RadialBlurFilter extends require$$0.Filter { + constructor(options) { + options = { ..._RadialBlurFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$7, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$7, + name: "radial-blur-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + radialBlurUniforms: { + uRadian: { value: 0, type: "f32" }, + uCenter: { value: options.center, type: "vec2" }, + uKernelSize: { value: options.kernelSize, type: "f32" }, + uRadius: { value: options.radius, type: "f32" } + } + } + }); + __publicField$7(this, "uniforms"); + __publicField$7(this, "_angle"); + __publicField$7(this, "_kernelSize"); + this.uniforms = this.resources.radialBlurUniforms.uniforms; + Object.assign(this, options); + } + _updateKernelSize() { + this.uniforms.uKernelSize = this._angle !== 0 ? this.kernelSize : 0; + } + /** + * Sets the angle in degrees of the motion for blur effect. + * @default 0 + */ + get angle() { + return this._angle; + } + set angle(value) { + this._angle = value; + this.uniforms.uRadian = value * Math.PI / 180; + this._updateKernelSize(); + } + /** + * The `x` and `y` offset coordinates to change the position of the center of the circle of effect. + * This should be a size 2 array or an object containing `x` and `y` values, you cannot change types + * once defined in the constructor + * @default {x:0,y:0} + */ + get center() { + return this.uniforms.uCenter; + } + set center(value) { + this.uniforms.uCenter = value; + } + /** + * Sets the velocity of the motion for blur effect on the `x` axis + * @default 0 + */ + get centerX() { + return this.center.x; + } + set centerX(value) { + this.center.x = value; + } + /** + * Sets the velocity of the motion for blur effect on the `x` axis + * @default 0 + */ + get centerY() { + return this.center.y; + } + set centerY(value) { + this.center.y = value; + } + /** + * The kernelSize of the blur filter. Must be odd number >= 3 + * @default 5 + */ + get kernelSize() { + return this._kernelSize; + } + set kernelSize(value) { + this._kernelSize = value; + this._updateKernelSize(); + } + /** + * The maximum size of the blur radius, less than `0` equates to infinity + * @default -1 + */ + get radius() { + return this.uniforms.uRadius; + } + set radius(value) { + this.uniforms.uRadius = value < 0 || value === Infinity ? -1 : value; + } + }; + /** Default values for options. */ + __publicField$7(_RadialBlurFilter, "DEFAULT_OPTIONS", { + angle: 0, + center: { x: 0, y: 0 }, + kernelSize: 5, + radius: -1 + }); + + var fragment$6 = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uMirror;\nuniform float uBoundary;\nuniform vec2 uAmplitude;\nuniform vec2 uWavelength;\nuniform vec2 uAlpha;\nuniform float uTime;\nuniform vec2 uDimensions;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * uInputSize.xy;\n vec2 coord = pixelCoord / uDimensions;\n\n if (coord.y < uBoundary) {\n finalColor = texture(uTexture, vTextureCoord);\n return;\n }\n\n float k = (coord.y - uBoundary) / (1. - uBoundary + 0.0001);\n float areaY = uBoundary * uDimensions.y / uInputSize.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = uMirror > 0.5 ? v : vTextureCoord.y;\n\n float _amplitude = ((uAmplitude.y - uAmplitude.x) * k + uAmplitude.x ) / uInputSize.x;\n float _waveLength = ((uWavelength.y - uWavelength.x) * k + uWavelength.x) / uInputSize.y;\n float _alpha = (uAlpha.y - uAlpha.x) * k + uAlpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - uTime) * _amplitude;\n x = clamp(x, uInputClamp.x, uInputClamp.z);\n\n vec4 color = texture(uTexture, vec2(x, y));\n\n finalColor = color * _alpha;\n}\n"; + + var source$6 = "struct ReflectionUniforms {\n uMirror: f32,\n uBoundary: f32,\n uAmplitude: vec2,\n uWavelength: vec2,\n uAlpha: vec2,\n uTime: f32,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var reflectionUniforms : ReflectionUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uDimensions: vec2 = reflectionUniforms.uDimensions;\n let uBoundary: f32 = reflectionUniforms.uBoundary;\n let uMirror: bool = reflectionUniforms.uMirror > 0.5;\n let uAmplitude: vec2 = reflectionUniforms.uAmplitude;\n let uWavelength: vec2 = reflectionUniforms.uWavelength;\n let uAlpha: vec2 = reflectionUniforms.uAlpha;\n let uTime: f32 = reflectionUniforms.uTime;\n\n let pixelCoord: vec2 = uv * gfu.uInputSize.xy;\n let coord: vec2 = pixelCoord /uDimensions;\n var returnColorOnly: bool = false;\n\n if (coord.y < uBoundary) {\n returnColorOnly = true;\n }\n\n let k: f32 = (coord.y - uBoundary) / (1. - uBoundary + 0.0001);\n let areaY: f32 = uBoundary * uDimensions.y / gfu.uInputSize.y;\n let v: f32 = areaY + areaY - uv.y;\n let y: f32 = select(uv.y, v, uMirror);\n\n let amplitude: f32 = ((uAmplitude.y - uAmplitude.x) * k + uAmplitude.x ) / gfu.uInputSize.x;\n let waveLength: f32 = ((uWavelength.y - uWavelength.x) * k + uWavelength.x) / gfu.uInputSize.y;\n let alpha: f32 = select((uAlpha.y - uAlpha.x) * k + uAlpha.x, 1., returnColorOnly);\n\n var x: f32 = uv.x + cos(v * 6.28 / waveLength - uTime) * amplitude;\n x = clamp(x, gfu.uInputClamp.x, gfu.uInputClamp.z);\n \n return textureSample(uTexture, uSampler, select(vec2(x, y), uv, returnColorOnly)) * alpha;\n}\n\nfn rand(co: vec2) -> f32 \n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}"; + + var __defProp$6 = Object.defineProperty; + var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$6 = (obj, key, value) => { + __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ReflectionFilter = class _ReflectionFilter extends require$$0.Filter { + constructor(options) { + options = { ..._ReflectionFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$6, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$6, + name: "reflection-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + reflectionUniforms: { + uMirror: { value: options.mirror ? 1 : 0, type: "f32" }, + uBoundary: { value: options.boundary, type: "f32" }, + uAmplitude: { value: options.amplitude, type: "vec2" }, + uWavelength: { value: options.waveLength, type: "vec2" }, + uAlpha: { value: options.alpha, type: "vec2" }, + uTime: { value: options.time, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField$6(this, "uniforms"); + /** + * Time for animating position of waves + * @default 0 + */ + __publicField$6(this, "time", 0); + this.uniforms = this.resources.reflectionUniforms.uniforms; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + this.uniforms.uTime = this.time; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * `true` to reflect the image, `false` for waves-only + * @default true + */ + get mirror() { + return this.uniforms.uMirror > 0.5; + } + set mirror(value) { + this.uniforms.uMirror = value ? 1 : 0; + } + /** + * Vertical position of the reflection point, default is 50% (middle) + * smaller numbers produce a larger reflection, larger numbers produce a smaller reflection. + * @default 0.5 + */ + get boundary() { + return this.uniforms.uBoundary; + } + set boundary(value) { + this.uniforms.uBoundary = value; + } + /** + * Starting and ending amplitude of waves + * @default [0,20] + */ + get amplitude() { + return Array.from(this.uniforms.uAmplitude); + } + set amplitude(value) { + this.uniforms.uAmplitude[0] = value[0]; + this.uniforms.uAmplitude[1] = value[1]; + } + /** + * Starting amplitude of waves + * @default 0 + */ + get amplitudeStart() { + return this.uniforms.uAmplitude[0]; + } + set amplitudeStart(value) { + this.uniforms.uAmplitude[0] = value; + } + /** + * Starting amplitude of waves + * @default 20 + */ + get amplitudeEnd() { + return this.uniforms.uAmplitude[1]; + } + set amplitudeEnd(value) { + this.uniforms.uAmplitude[1] = value; + } + /** + * Starting and ending length of waves + * @default [30,100] + */ + get waveLength() { + return Array.from(this.uniforms.uWavelength); + } + set waveLength(value) { + this.uniforms.uWavelength[0] = value[0]; + this.uniforms.uWavelength[1] = value[1]; + } + /** + * Starting wavelength of waves + * @default 30 + */ + get wavelengthStart() { + return this.uniforms.uWavelength[0]; + } + set wavelengthStart(value) { + this.uniforms.uWavelength[0] = value; + } + /** + * Starting wavelength of waves + * @default 100 + */ + get wavelengthEnd() { + return this.uniforms.uWavelength[1]; + } + set wavelengthEnd(value) { + this.uniforms.uWavelength[1] = value; + } + /** + * Starting and ending alpha values + * @default [1,1] + */ + get alpha() { + return Array.from(this.uniforms.uAlpha); + } + set alpha(value) { + this.uniforms.uAlpha[0] = value[0]; + this.uniforms.uAlpha[1] = value[1]; + } + /** + * Starting wavelength of waves + * @default 1 + */ + get alphaStart() { + return this.uniforms.uAlpha[0]; + } + set alphaStart(value) { + this.uniforms.uAlpha[0] = value; + } + /** + * Starting wavelength of waves + * @default 1 + */ + get alphaEnd() { + return this.uniforms.uAlpha[1]; + } + set alphaEnd(value) { + this.uniforms.uAlpha[1] = value; + } + }; + /** Default values for options. */ + __publicField$6(_ReflectionFilter, "DEFAULT_OPTIONS", { + mirror: true, + boundary: 0.5, + amplitude: [0, 20], + waveLength: [30, 100], + alpha: [1, 1], + time: 0 + }); + + var fragment$5 = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec4 uInputSize;\nuniform vec2 uRed;\nuniform vec2 uGreen;\nuniform vec2 uBlue;\n\nvoid main(void)\n{\n float r = texture(uTexture, vTextureCoord + uRed/uInputSize.xy).r;\n float g = texture(uTexture, vTextureCoord + uGreen/uInputSize.xy).g;\n float b = texture(uTexture, vTextureCoord + uBlue/uInputSize.xy).b;\n float a = texture(uTexture, vTextureCoord).a;\n finalColor = vec4(r, g, b, a);\n}\n"; + + var source$5 = "struct RgbSplitUniforms {\n uRed: vec2,\n uGreen: vec2,\n uBlue: vec3,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var rgbSplitUniforms : RgbSplitUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let r = textureSample(uTexture, uSampler, uv + vec2(rgbSplitUniforms.uRed.x / gfu.uInputSize.x, rgbSplitUniforms.uRed.y / gfu.uInputSize.y)).r;\n let g = textureSample(uTexture, uSampler, uv + vec2(rgbSplitUniforms.uGreen.x / gfu.uInputSize.x, rgbSplitUniforms.uGreen.y / gfu.uInputSize.y)).g;\n let b = textureSample(uTexture, uSampler, uv + vec2(rgbSplitUniforms.uBlue.x / gfu.uInputSize.x, rgbSplitUniforms.uBlue.y / gfu.uInputSize.y)).b;\n let a = textureSample(uTexture, uSampler, uv).a;\n return vec4(r, g, b, a);\n}\n"; + + var __defProp$5 = Object.defineProperty; + var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$5 = (obj, key, value) => { + __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _RGBSplitFilter = class _RGBSplitFilter extends require$$0.Filter { + constructor(options) { + options = { ..._RGBSplitFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$5, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$5, + name: "rgb-split-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + rgbSplitUniforms: { + uRed: { value: options.red, type: "vec2" }, + uGreen: { value: options.green, type: "vec2" }, + uBlue: { value: options.blue, type: "vec2" } + } + } + }); + __publicField$5(this, "uniforms"); + this.uniforms = this.resources.rgbSplitUniforms.uniforms; + } + /** + * Red channel offset. + * @default {x:-10,y:0} + */ + get red() { + return this.uniforms.uRed; + } + set red(value) { + this.uniforms.uRed = value; + } + /** + * Amount of x-axis offset for the red channel. + * @default -10 + */ + get redX() { + return this.red.x; + } + set redX(value) { + this.red.x = value; + } + /** + * Amount of y-axis offset for the red channel. + * @default 0 + */ + get redY() { + return this.red.y; + } + set redY(value) { + this.red.y = value; + } + /** + * Green channel offset. + * @default {x:0,y:10} + */ + get green() { + return this.uniforms.uGreen; + } + set green(value) { + this.uniforms.uGreen = value; + } + /** + * Amount of x-axis offset for the green channel. + * @default 0 + */ + get greenX() { + return this.green.x; + } + set greenX(value) { + this.green.x = value; + } + /** + * Amount of y-axis offset for the green channel. + * @default 10 + */ + get greenY() { + return this.green.y; + } + set greenY(value) { + this.green.y = value; + } + /** + * Blue channel offset. + * @default {x:0,y:0} + */ + get blue() { + return this.uniforms.uBlue; + } + set blue(value) { + this.uniforms.uBlue = value; + } + /** + * Amount of x-axis offset for the blue channel. + * @default 0 + */ + get blueX() { + return this.blue.x; + } + set blueX(value) { + this.blue.x = value; + } + /** + * Amount of y-axis offset for the blue channel. + * @default 0 + */ + get blueY() { + return this.blue.y; + } + set blueY(value) { + this.blue.y = value; + } + }; + /** Default values for options. */ + __publicField$5(_RGBSplitFilter, "DEFAULT_OPTIONS", { + red: { x: -10, y: 0 }, + green: { x: 0, y: 10 }, + blue: { x: 0, y: 0 } + }); + + var fragment$4 = "\nprecision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uCenter;\nuniform float uTime;\nuniform float uSpeed;\nuniform vec4 uWave;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float uAmplitude = uWave[0];\n float uWavelength = uWave[1];\n float uBrightness = uWave[2];\n float uRadius = uWave[3];\n\n float halfWavelength = uWavelength * 0.5 / uInputSize.x;\n float maxRadius = uRadius / uInputSize.x;\n float currentRadius = uTime * uSpeed / uInputSize.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n finalColor = texture(uTexture, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - uCenter / uInputSize.xy);\n dir.y *= uInputSize.y / uInputSize.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n finalColor = texture(uTexture, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( uAmplitude * fade );\n\n vec2 offset = diffUV * powDiff / uInputSize.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n vec4 color = texture(uTexture, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // finalColor = texture(uTexture, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (uBrightness - 1.0) * p * fade;\n\n finalColor = color;\n}\n"; + + var source$4 = "\nstruct ShockWaveUniforms {\n uTime: f32,\n uOffset: vec2,\n uSpeed: f32,\n uWave: vec4,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var shockwaveUniforms : ShockWaveUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n\n let uTime = shockwaveUniforms.uTime;\n let uOffset = shockwaveUniforms.uOffset;\n let uSpeed = shockwaveUniforms.uSpeed;\n let uAmplitude = shockwaveUniforms.uWave[0];\n let uWavelength = shockwaveUniforms.uWave[1];\n let uBrightness = shockwaveUniforms.uWave[2];\n let uRadius = shockwaveUniforms.uWave[3];\n let halfWavelength: f32 = uWavelength * 0.5 / gfu.uInputSize.x;\n let maxRadius: f32 = uRadius / gfu.uInputSize.x;\n let currentRadius: f32 = uTime * uSpeed / gfu.uInputSize.x;\n var fade: f32 = 1.0;\n var returnColorOnly: bool = false;\n \n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n returnColorOnly = true;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n var dir: vec2 = vec2(uv - uOffset / gfu.uInputSize.xy);\n dir.y *= gfu.uInputSize.y / gfu.uInputSize.x;\n\n let dist:f32 = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n returnColorOnly = true;\n }\n\n let diffUV: vec2 = normalize(dir);\n let diff: f32 = (dist - currentRadius) / halfWavelength;\n let p: f32 = 1.0 - pow(abs(diff), 2.0);\n let powDiff: f32 = 1.25 * sin(diff * PI) * p * ( uAmplitude * fade );\n let offset: vec2 = diffUV * powDiff / gfu.uInputSize.xy;\n // Do clamp :\n let coord: vec2 = uv + offset;\n let clampedCoord: vec2 = clamp(coord, gfu.uInputClamp.xy, gfu.uInputClamp.zw);\n\n var clampedColor: vec4 = textureSample(uTexture, uSampler, clampedCoord);\n \n if (boolVec2(coord, clampedCoord)) \n {\n clampedColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n // No clamp :\n return select(clampedColor * vec4(vec3(1.0 + (uBrightness - 1.0) * p * fade), clampedColor.a), textureSample(uTexture, uSampler, uv), returnColorOnly);\n}\n\nfn boolVec2(x: vec2, y: vec2) -> bool\n{\n if (x.x == y.x && x.y == y.y)\n {\n return true;\n }\n \n return false;\n}\n\nconst PI: f32 = 3.14159265358979323846264;\n"; + + var __defProp$4 = Object.defineProperty; + var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$4 = (obj, key, value) => { + __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ShockwaveFilter = class _ShockwaveFilter extends require$$0.Filter { + /** + * @param options + */ + constructor(options) { + options = { ..._ShockwaveFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$4, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$4, + name: "shockwave-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + shockwaveUniforms: new require$$0.UniformGroup({ + uTime: { value: 0, type: "f32" }, + uCenter: { value: options.center, type: "vec2" }, + uSpeed: { value: options.speed, type: "f32" }, + uWave: { value: new Float32Array(4), type: "vec4" } + }) + } + }); + __publicField$4(this, "uniforms"); + /** Sets the elapsed time of the shockwave. It could control the current size of shockwave. */ + __publicField$4(this, "time"); + this.time = 0; + this.uniforms = this.resources.shockwaveUniforms.uniforms; + Object.assign(this, options); + } + apply(filterManager, input, output, clearMode) { + this.uniforms.uTime = this.time; + filterManager.applyFilter(this, input, output, clearMode); + } + /** + * The `x` and `y` center coordinates to change the position of the center of the circle of effect. + * @default [0,0] + */ + get center() { + return this.uniforms.uCenter; + } + set center(value) { + this.uniforms.uCenter = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `x` axis + * @default 0 + */ + get centerX() { + return this.uniforms.uCenter.x; + } + set centerX(value) { + this.uniforms.uCenter.x = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `y` axis + * @default 0 + */ + get centerY() { + return this.uniforms.uCenter.y; + } + set centerY(value) { + this.uniforms.uCenter.y = value; + } + /** + * The speed about the shockwave ripples out. The unit is `pixel-per-second` + * @default 500 + */ + get speed() { + return this.uniforms.uSpeed; + } + set speed(value) { + this.uniforms.uSpeed = value; + } + /** + * The amplitude of the shockwave + * @default 30 + */ + get amplitude() { + return this.uniforms.uWave[0]; + } + set amplitude(value) { + this.uniforms.uWave[0] = value; + } + /** + * The wavelength of the shockwave + * @default 160 + */ + get wavelength() { + return this.uniforms.uWave[1]; + } + set wavelength(value) { + this.uniforms.uWave[1] = value; + } + /** + * The brightness of the shockwave + * @default 1 + */ + get brightness() { + return this.uniforms.uWave[2]; + } + set brightness(value) { + this.uniforms.uWave[2] = value; + } + /** + * The maximum radius of shockwave. less than `0` means the max is an infinite distance + * @default -1 + */ + get radius() { + return this.uniforms.uWave[3]; + } + set radius(value) { + this.uniforms.uWave[3] = value; + } + }; + /** Default shockwave filter options */ + __publicField$4(_ShockwaveFilter, "DEFAULT_OPTIONS", { + /** The `x` and `y` center coordinates to change the position of the center of the circle of effect. */ + center: { x: 0, y: 0 }, + /** The speed about the shockwave ripples out. The unit is `pixel-per-second` */ + speed: 500, + /** The amplitude of the shockwave */ + amplitude: 30, + /** The wavelength of the shockwave */ + wavelength: 160, + /** The brightness of the shockwave */ + brightness: 1, + /** The maximum radius of shockwave. less than `0` means the max is an infinite distance */ + radius: -1 + }); + + var fragment$3 = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMapTexture;\nuniform vec3 uColor;\nuniform float uAlpha;\nuniform vec2 uDimensions;\n\nuniform vec4 uInputSize;\n\nvoid main() {\n vec4 diffuseColor = texture(uTexture, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * uInputSize.xy) / uDimensions;\n vec4 light = texture(uMapTexture, lightCoord);\n vec3 ambient = uColor.rgb * uAlpha;\n vec3 intensity = ambient + light.rgb;\n vec3 color = diffuseColor.rgb * intensity;\n finalColor = vec4(color, diffuseColor.a);\n}\n"; + + var source$3 = "struct SimpleLightmapUniforms {\n uColor: vec3,\n uAlpha: f32,\n uDimensions: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var simpleLightmapUniforms : SimpleLightmapUniforms;\n@group(1) @binding(1) var uMapTexture: texture_2d;\n@group(1) @binding(2) var uMapSampler: sampler;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2,\n) -> @location(0) vec4 {\n let uColor = simpleLightmapUniforms.uColor;\n let uAlpha = simpleLightmapUniforms.uAlpha;\n let uDimensions = simpleLightmapUniforms.uDimensions;\n\n let diffuseColor: vec4 = textureSample(uTexture, uSampler, uv);\n let lightCoord: vec2 = (uv * gfu.uInputSize.xy) / simpleLightmapUniforms.uDimensions;\n let light: vec4 = textureSample(uMapTexture, uMapSampler, lightCoord);\n let ambient: vec3 = uColor * uAlpha;\n let intensity: vec3 = ambient + light.rgb;\n let finalColor: vec3 = diffuseColor.rgb * intensity;\n return vec4(finalColor, diffuseColor.a);\n}"; + + var __defProp$3 = Object.defineProperty; + var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$3 = (obj, key, value) => { + __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _SimpleLightmapFilter = class _SimpleLightmapFilter extends require$$0.Filter { + constructor(options) { + options = { ..._SimpleLightmapFilter.DEFAULT_OPTIONS, ...options }; + if (!options.lightMap) + throw Error("No light map texture source was provided to SimpleLightmapFilter"); + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$3, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$3, + name: "simple-lightmap-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + simpleLightmapUniforms: { + uColor: { value: new Float32Array(3), type: "vec3" }, + uAlpha: { value: options.alpha, type: "f32" }, + uDimensions: { value: new Float32Array(2), type: "vec2" } + }, + uMapTexture: options.lightMap.source, + uMapSampler: options.lightMap.source.style + } + }); + __publicField$3(this, "uniforms"); + __publicField$3(this, "_color"); + __publicField$3(this, "_lightMap"); + this.uniforms = this.resources.simpleLightmapUniforms.uniforms; + this._color = new require$$0.Color(); + this.color = options.color ?? 0; + Object.assign(this, options); + } + /** + * Override existing apply method in `Filter` + * @override + * @ignore + */ + apply(filterManager, input, output, clearMode) { + this.uniforms.uDimensions[0] = input.frame.width; + this.uniforms.uDimensions[1] = input.frame.height; + filterManager.applyFilter(this, input, output, clearMode); + } + /** A sprite where your lightmap is rendered */ + get lightMap() { + return this._lightMap; + } + set lightMap(value) { + this._lightMap = value; + this.resources.uMapTexture = value.source; + this.resources.uMapSampler = value.source.style; + } + /** + * The color value of the ambient color + * @example [1.0, 1.0, 1.0] = 0xffffff + * @default 0x000000 + */ + get color() { + return this._color.value; + } + set color(value) { + this._color.setValue(value); + const [r, g, b] = this._color.toArray(); + this.uniforms.uColor[0] = r; + this.uniforms.uColor[1] = g; + this.uniforms.uColor[2] = b; + } + /** + * Coefficient for alpha multiplication + * @default 1 + */ + get alpha() { + return this.uniforms.uAlpha; + } + set alpha(value) { + this.uniforms.uAlpha = value; + } + }; + /** Default values for options. */ + __publicField$3(_SimpleLightmapFilter, "DEFAULT_OPTIONS", { + lightMap: require$$0.Texture.WHITE, + color: 0, + alpha: 1 + }); + + var fragment$2 = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uBlur;\nuniform vec2 uStart;\nuniform vec2 uEnd;\nuniform vec2 uDelta;\nuniform vec2 uTexSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float blur = uBlur[0];\n float gradientBlur = uBlur[1];\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(uStart.y - uEnd.y, uEnd.x - uStart.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * uTexSize - uStart, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture(uTexture, vTextureCoord + uDelta / uTexSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n finalColor = color;\n}\n"; + + var source$2 = "struct TiltShiftUniforms {\n uBlur: vec2,\n uStart: vec2,\n uEnd: vec2,\n uDelta: vec2,\n uTexSize: vec2,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var tiltShiftUniforms : TiltShiftUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uBlur = tiltShiftUniforms.uBlur[0];\n let uBlurGradient = tiltShiftUniforms.uBlur[1];\n let uStart = tiltShiftUniforms.uStart;\n let uEnd = tiltShiftUniforms.uEnd;\n let uDelta = tiltShiftUniforms.uDelta;\n let uTexSize = tiltShiftUniforms.uTexSize;\n\n var color: vec4 = vec4(0.0);\n var total: f32 = 0.0;\n\n let offset: f32 = random(position, vec3(12.9898, 78.233, 151.7182), 0.0);\n let normal: vec2 = normalize(vec2(uStart.y - uEnd.y, uEnd.x - uStart.x));\n let radius: f32 = smoothstep(0.0, 1.0, abs(dot(uv * uTexSize - uStart, normal)) / uBlurGradient) * uBlur;\n\n for (var t: f32 = -30.0; t <= 30.0; t += 1.0)\n {\n var percent: f32 = (t + offset - 0.5) / 30.0;\n var weight: f32 = 1.0 - abs(percent);\n var sample: vec4 = textureSample(uTexture, uSampler, uv + uDelta / uTexSize * percent * radius);\n sample = vec4(sample.xyz * sample.a, sample.a); // multiply sample.rgb with sample.a\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color = vec4(color.xyz / (color.a + 0.00001), color.a); // divide color.rgb by color.a + 0.00001\n\n return color;\n}\n\n\nfn random(position: vec4, scale: vec3, seed: f32) -> f32\n{\n return fract(sin(dot(position.xyz + seed, scale)) * 43758.5453 + seed);\n}"; + + var __defProp$2 = Object.defineProperty; + var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$2 = (obj, key, value) => { + __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _TiltShiftAxisFilter = class _TiltShiftAxisFilter extends require$$0.Filter { + constructor(options) { + options = { ..._TiltShiftAxisFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$2, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$2, + name: "tilt-shift-axis-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + tiltShiftUniforms: { + uBlur: { + value: new Float32Array([ + options.blur ?? 100, + options.gradientBlur ?? 600 + ]), + type: "vec2" + }, + uStart: { value: options.start, type: "vec2" }, + uEnd: { value: options.end, type: "vec2" }, + uDelta: { value: new Float32Array([30, 30]), type: "vec2" }, + uTexSize: { value: new Float32Array([window.innerWidth, window.innerHeight]), type: "vec2" } + } + } + }); + __publicField$2(this, "uniforms"); + __publicField$2(this, "_tiltAxis"); + this.uniforms = this.resources.tiltShiftUniforms.uniforms; + this._tiltAxis = options.axis; + this.updateDelta(); + } + /** Updates the filter delta values. */ + updateDelta() { + this.uniforms.uDelta[0] = 0; + this.uniforms.uDelta[1] = 0; + if (this._tiltAxis === void 0) + return; + const end = this.uniforms.uEnd; + const start = this.uniforms.uStart; + const dx = end.x - start.x; + const dy = end.y - start.y; + const d = Math.sqrt(dx * dx + dy * dy); + const isVert = this._tiltAxis === "vertical"; + this.uniforms.uDelta[0] = !isVert ? dx / d : -dy / d; + this.uniforms.uDelta[1] = !isVert ? dy / d : dx / d; + } + // /** The strength of the blur. */ + // get blur(): number { return this.uniforms.uBlur[0]; } + // set blur(value: number) { this.uniforms.uBlur[0] = value; } + // /** The strength of the gradient blur. */ + // get gradientBlur(): number { return this.uniforms.uBlur[1]; } + // set gradientBlur(value: number) { this.uniforms.uBlur[1] = value; } + // /** The start position of the effect. */ + // get start(): PointData { return this.uniforms.uStart; } + // set start(value: PointData) + // { + // this.uniforms.uStart = value; + // this.updateDelta(); + // } + // /** The start position of the effect on the `x` axis. */ + // get startX(): number { return this.start.x; } + // set startX(value: number) + // { + // this.start.x = value; + // this.updateDelta(); + // } + // /** The start position of the effect on the `y` axis. */ + // get startY(): number { return this.startY; } + // set startY(value: number) + // { + // this.start.y = value; + // this.updateDelta(); + // } + // /** The end position of the effect. */ + // get end(): PointData { return this.uniforms.uEnd; } + // set end(value: PointData) + // { + // this.uniforms.uEnd = value; + // this.updateDelta(); + // } + // /** The end position of the effect on the `x` axis. */ + // get endX(): number { return this.end.x; } + // set endX(value: number) + // { + // this.end.x = value; + // this.updateDelta(); + // } + // /** The end position of the effect on the `y` axis. */ + // get endY(): number { return this.end.y; } + // set endY(value: number) + // { + // this.end.y = value; + // this.updateDelta(); + // } + }; + /** Default values for options. */ + __publicField$2(_TiltShiftAxisFilter, "DEFAULT_OPTIONS", { + /** The strength of the blur. */ + blur: 100, + /** The strength of the blur gradient */ + gradientBlur: 600, + /** The position to start the effect at. */ + start: { x: 0, y: window.innerHeight / 2 }, + /** The position to end the effect at. */ + end: { x: 600, y: window.innerHeight / 2 } + }); + + var fragment$1 = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uTwist;\nuniform vec2 uOffset;\nuniform vec4 uInputSize;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= uInputSize.xy;\n coord += uInputSize.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= uInputSize.zw;\n coord /= uInputSize.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= uOffset;\n\n float dist = length(coord);\n float uRadius = uTwist[0];\n float uAngle = uTwist[1];\n\n if (dist < uRadius)\n {\n float ratioDist = (uRadius - dist) / uRadius;\n float angleMod = ratioDist * ratioDist * uAngle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += uOffset;\n\n return coord;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n coord = twist(coord);\n coord = unmapCoord(coord);\n finalColor = texture(uTexture, coord);\n}\n"; + + var source$1 = "struct TwistUniforms {\n uTwist:vec2,\n uOffset:vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var twistUniforms : TwistUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n return textureSample(uTexture, uSampler, unmapCoord(twist(mapCoord(uv))));\n}\n\nfn mapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord *= gfu.uInputSize.xy;\n mappedCoord += gfu.uOutputFrame.xy;\n return mappedCoord;\n}\n\nfn unmapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord -= gfu.uOutputFrame.xy;\n mappedCoord /= gfu.uInputSize.xy;\n return mappedCoord;\n}\n\nfn twist(coord: vec2) -> vec2\n{\n var twistedCoord: vec2 = coord;\n let uRadius = twistUniforms.uTwist[0];\n let uAngle = twistUniforms.uTwist[1];\n let uOffset = twistUniforms.uOffset;\n\n twistedCoord -= uOffset;\n \n let dist = length(twistedCoord);\n\n if (dist < uRadius)\n {\n let ratioDist: f32 = (uRadius - dist) / uRadius;\n let angleMod: f32 = ratioDist * ratioDist * uAngle;\n let s: f32 = sin(angleMod);\n let c: f32 = cos(angleMod);\n twistedCoord = vec2(twistedCoord.x * c - twistedCoord.y * s, twistedCoord.x * s + twistedCoord.y * c);\n }\n\n twistedCoord += uOffset;\n return twistedCoord;\n}\n"; + + var __defProp$1 = Object.defineProperty; + var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField$1 = (obj, key, value) => { + __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _TwistFilter = class _TwistFilter extends require$$0.Filter { + constructor(options) { + options = { ..._TwistFilter.DEFAULT_OPTIONS, ...options }; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source$1, + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment$1, + name: "twist-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + twistUniforms: { + uTwist: { + value: [options.radius ?? 0, options.angle ?? 0], + type: "vec2" + }, + uOffset: { + value: options.offset, + type: "vec2" + } + } + }, + ...options + }); + __publicField$1(this, "uniforms"); + this.uniforms = this.resources.twistUniforms.uniforms; + } + /** + * The radius of the twist + * @default 200 + */ + get radius() { + return this.uniforms.uTwist[0]; + } + set radius(value) { + this.uniforms.uTwist[0] = value; + } + /** + * The angle of the twist + * @default 4 + */ + get angle() { + return this.uniforms.uTwist[1]; + } + set angle(value) { + this.uniforms.uTwist[1] = value; + } + /** + * The `x` offset coordinate to change the position of the center of the circle of effect + * @default 0 + */ + get offset() { + return this.uniforms.uOffset; + } + set offset(value) { + this.uniforms.uOffset = value; + } + /** + * The `x` offset coordinate to change the position of the center of the circle of effect + * @default 0 + */ + get offsetX() { + return this.offset.x; + } + set offsetX(value) { + this.offset.x = value; + } + /** + * The `y` offset coordinate to change the position of the center of the circle of effect + * @default 0 + */ + get offsetY() { + return this.offset.y; + } + set offsetY(value) { + this.offset.y = value; + } + }; + /** Default values for options. */ + __publicField$1(_TwistFilter, "DEFAULT_OPTIONS", { + padding: 20, + radius: 200, + angle: 4, + offset: { x: 0, y: 0 } + }); + + var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uStrength;\nuniform vec2 uCenter;\nuniform vec2 uRadii;\n\nuniform vec4 uInputSize;\n\nconst float MAX_KERNEL_SIZE = ${MAX_KERNEL_SIZE};\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n float minGradient = uRadii[0] * 0.3;\n float innerRadius = (uRadii[0] + minGradient * 0.5) / uInputSize.x;\n\n float gradient = uRadii[1] * 0.3;\n float radius = (uRadii[1] - gradient * 0.5) / uInputSize.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / uInputSize.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * uInputSize.y / uInputSize.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / uInputSize.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture(uTexture, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture(uTexture, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"; + + var source = "struct ZoomBlurUniforms {\n uStrength:f32,\n uCenter:vec2,\n uRadii:vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var zoomBlurUniforms : ZoomBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uStrength = zoomBlurUniforms.uStrength;\n let uCenter = zoomBlurUniforms.uCenter;\n let uRadii = zoomBlurUniforms.uRadii;\n\n let minGradient: f32 = uRadii[0] * 0.3;\n let innerRadius: f32 = (uRadii[0] + minGradient * 0.5) / gfu.uInputSize.x;\n\n let gradient: f32 = uRadii[1] * 0.3;\n let radius: f32 = (uRadii[1] - gradient * 0.5) / gfu.uInputSize.x;\n\n let MAX_KERNEL_SIZE: f32 = ${MAX_KERNEL_SIZE};\n\n var countLimit: f32 = MAX_KERNEL_SIZE;\n\n var dir: vec2 = vec2(uCenter / gfu.uInputSize.xy - uv);\n let dist: f32 = length(vec2(dir.x, dir.y * gfu.uInputSize.y / gfu.uInputSize.x));\n\n var strength: f32 = uStrength;\n\n var delta: f32 = 0.0;\n var gap: f32;\n\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n var returnColorOnly: bool = false;\n\n if (delta > 0.0) {\n let normalCount: f32 = gap / gfu.uInputSize.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n \n if (countLimit < 1.0)\n {\n returnColorOnly = true;;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n let offset: f32 = rand(uv, 0.0);\n\n var total: f32 = 0.0;\n var color: vec4 = vec4(0.);\n\n dir *= strength;\n\n for (var t = 0.0; t < MAX_KERNEL_SIZE; t += 1.0) {\n let percent: f32 = (t + offset) / MAX_KERNEL_SIZE;\n let weight: f32 = 4.0 * (percent - percent * percent);\n let p: vec2 = uv + dir * percent;\n let sample: vec4 = textureSample(uTexture, uSampler, p);\n \n if (t < countLimit)\n {\n color += sample * weight;\n total += weight;\n }\n }\n\n color /= total;\n\n return select(color, textureSample(uTexture, uSampler, uv), returnColorOnly);\n}\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nfn rand(co: vec2, seed: f32) -> f32\n{\n let a: f32 = 12.9898;\n let b: f32 = 78.233;\n let c: f32 = 43758.5453;\n let dt: f32 = dot(co + seed, vec2(a, b));\n let sn: f32 = modulo(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}"; + + var __defProp = Object.defineProperty; + var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; + var __publicField = (obj, key, value) => { + __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; + }; + const _ZoomBlurFilter = class _ZoomBlurFilter extends require$$0.Filter { + constructor(options) { + options = { ..._ZoomBlurFilter.DEFAULT_OPTIONS, ...options }; + const kernelSize = options.maxKernelSize ?? 32; + const gpuProgram = new require$$0.GpuProgram({ + vertex: { + source: wgslVertex, + entryPoint: "mainVertex" + }, + fragment: { + source: source.replace("${MAX_KERNEL_SIZE}", kernelSize.toFixed(1)), + entryPoint: "mainFragment" + } + }); + const glProgram = new require$$0.GlProgram({ + vertex: vertex$1, + fragment: fragment.replace("${MAX_KERNEL_SIZE}", kernelSize.toFixed(1)), + name: "zoom-blur-filter" + }); + super({ + gpuProgram, + glProgram, + resources: { + zoomBlurUniforms: { + uStrength: { value: options.strength, type: "f32" }, + uCenter: { value: options.center, type: "vec2" }, + uRadii: { value: new Float32Array(2), type: "vec2" } + } + } + }); + __publicField(this, "uniforms"); + this.uniforms = this.resources.zoomBlurUniforms.uniforms; + Object.assign(this, options); + } + /** + * Sets the strength of the zoom blur effect + * @default 0.1 + */ + get strength() { + return this.uniforms.uStrength; + } + set strength(value) { + this.uniforms.uStrength = value; + } + /** + * The center of the zoom + * @default [0,0] + */ + get center() { + return this.uniforms.uCenter; + } + set center(value) { + this.uniforms.uCenter = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `x` axis + * @default 0 + */ + get centerX() { + return this.uniforms.uCenter.x; + } + set centerX(value) { + this.uniforms.uCenter.x = value; + } + /** + * Sets the center of the effect in normalized screen coords on the `y` axis + * @default 0 + */ + get centerY() { + return this.uniforms.uCenter.y; + } + set centerY(value) { + this.uniforms.uCenter.y = value; + } + /** + * The inner radius of zoom. The part in inner circle won't apply zoom blur effect + * @default 0 + */ + get innerRadius() { + return this.uniforms.uRadii[0]; + } + set innerRadius(value) { + this.uniforms.uRadii[0] = value; + } + /** + * Outer radius of the effect. less than `0` equates to infinity + * @default -1 + */ + get radius() { + return this.uniforms.uRadii[1]; + } + set radius(value) { + this.uniforms.uRadii[1] = value < 0 || value === Infinity ? -1 : value; + } + }; + /** Default values for options. */ + __publicField(_ZoomBlurFilter, "DEFAULT_OPTIONS", { + strength: 0.1, + center: { x: 0, y: 0 }, + innerRadius: 0, + radius: -1, + maxKernelSize: 32 + }); + + const deepCopy = (value) => JSON.parse(JSON.stringify(value)); + function colorGradient() { + let stops = deepCopy(ColorGradientFilter.defaults.stops); + const ctrlIndex = { + enabled: 0, + resetOptions: 1, + cssGradient: 2, + type: 3, + alpha: 4, + angle: 5, + maxColors: 6 + }; + this.addFilter("ColorGradientFilter", { + enabled: false, + fishOnly: true, + args: ctrlIndex, + oncreate(folder) { + let miscControls = {}; + const removeColorStopControllers = () => { + for (let i = folder.controllers.length - 1; i > 0; i--) { + if (folder.controllers[i]._name.includes("stop")) { + folder.controllers[i].destroy(); + } + } + }; + const onStopChange = () => { + this.stops = stops; + }; + const createColorStopControllers = (stops2) => { + removeColorStopControllers(); + for (let i = 0; i < stops2.length; i++) { + folder.addColor(stops2[i], "color").name(`stops[${i}].color`).onChange(onStopChange); + folder.add(stops2[i], "offset", 0, 1).name(`stops[${i}].offset`).onChange(onStopChange); + folder.add(stops2[i], "alpha", 0, 1).name(`stops[${i}].alpha`).onChange(onStopChange); + } + const canRemoveStops = stops2.length > 2; + folder.add(miscControls, "remove color stop").disable(!canRemoveStops); + folder.add(miscControls, "add color stop"); + }; + const setColorStops = (newStops, scaleOffsets = false) => { + if (scaleOffsets) { + const scaleFactor = (this.stops.length - 1) / (newStops.length - 1); + const lastIndexToScale = Math.min(newStops.length, this.stops.length); + for (let i = 0; i < lastIndexToScale; i++) { + newStops[i].offset *= scaleFactor; + } + } + createColorStopControllers(newStops); + stops = newStops; + onStopChange(); + }; + const onCssGradientChange = (css) => { + let filter; + const inputStyle = folder.controllers[ctrlIndex.cssGradient].domElement.style; + inputStyle.border = ""; + if (css.trim().length === 0) { + return; + } + try { + filter = new ColorGradientFilter({ css }); + } catch (e) { + inputStyle.border = "2px solid red"; + return; + } + folder.controllers[ctrlIndex.type].setValue(filter.type); + folder.controllers[ctrlIndex.alpha].setValue(1); + folder.controllers[ctrlIndex.angle].setValue(filter.angle); + folder.controllers[ctrlIndex.maxColors].setValue(0); + setColorStops(filter.stops, false); + }; + const applyDefaultOptions = () => { + const defaults = deepCopy(ColorGradientFilter.defaults); + folder.controllers[ctrlIndex.type].setValue(defaults.type); + folder.controllers[ctrlIndex.alpha].setValue(defaults.alpha); + folder.controllers[ctrlIndex.angle].setValue(defaults.angle); + folder.controllers[ctrlIndex.maxColors].setValue(defaults.maxColors); + folder.controllers[ctrlIndex.cssGradient].setValue(""); + setColorStops(defaults.stops, false); + }; + const addColorStop = () => { + const getRandomColor = () => [0, 0, 0].map(Math.random); + const newColorStop = { + offset: 1, + alpha: 1, + color: getRandomColor() + }; + setColorStops([...this.stops].concat([newColorStop]), true); + }; + const removeLastColorStop = () => { + const newStops = [...this.stops.slice(0, -1)]; + setColorStops(newStops, true); + }; + miscControls = Object.assign(miscControls, { + "reset options": applyDefaultOptions, + "add color stop": addColorStop, + "remove color stop": removeLastColorStop, + cssGradient: "" + }); + folder.add(miscControls, "reset options"); + folder.add(miscControls, "cssGradient").name("from CSS gradient").onChange(onCssGradientChange); + folder.add(this, "type", { LINEAR: 0, RADIAL: 1, CONIC: 2 }); + folder.add(this, "alpha", 0, 1); + folder.add(this, "angle", 0, 360, 1); + folder.add(this, "maxColors", 0, 24, 1); + folder.add(this, "replace", false); + applyDefaultOptions(); + } + }); + } + + function colorMap() { + const colorMap = this.resources.colormap; + this.addFilter("ColorMapFilter", { + enabled: false, + args: { colorMap }, + oncreate(folder) { + folder.add(this, "mix", 0, 1); + folder.add(this, "nearest"); + this._noop = () => { + }; + folder.add(this, "_noop").name(''); + } + }); + } + + function colorMatrix() { + this.addFilter("ColorMatrixFilter", { + global: true, + oncreate(folder) { + folder.add(this, "reset"); + folder.add(this, "sepia"); + folder.add(this, "negative"); + folder.add({ kodachrome: this.kodachrome.bind(this, true) }, "kodachrome"); + folder.add({ lsd: this.lsd.bind(this, true) }, "lsd"); + folder.add(this, "polaroid"); + folder.add(this, "desaturate"); + folder.add({ contrast: this.contrast.bind(this, 1) }, "contrast"); + folder.add({ grayscale: this.grayscale.bind(this, 1) }, "grayscale"); + folder.add({ predator: this.predator.bind(this, 1) }, "predator"); + folder.add({ saturate: this.saturate.bind(this, 1) }, "saturate"); + } + }); + } + + function colorOverlay() { + this.addFilter("ColorOverlayFilter", { + fishOnly: true, + args: { color: 16711680, alpha: 1 }, + oncreate(folder) { + folder.addColor(this, "color"); + folder.add(this, "alpha", 0, 1); + } + }); + } + + function colorReplace() { + this.addFilter("ColorReplaceFilter", function(folder) { + folder.addColor(this, "originalColor"); + folder.addColor(this, "targetColor"); + folder.add(this, "tolerance", 0, 1); + }); + } + + function convolution() { + this.addFilter("ConvolutionFilter", { + args: { matrix: [0, 0.5, 0, 0.5, 1, 0.5, 0, 0.5, 0], width: 300, height: 300 }, + oncreate(folder) { + folder.add(this, "width", 0, 500); + folder.add(this, "height", 0, 500); + for (let i = 0; i < this.matrix.length; i++) { + folder.add(this.matrix, i, 0, 1, 0.01).name(`matrix[${i}]`); + } + } + }); + } + + function crossHatch() { + this.addFilter("CrossHatchFilter"); + } + + function crt() { + const app = this; + app.addFilter("CRTFilter", { + args: { + lineWidth: 3, + lineContrast: 0.3, + noise: 0.2, + time: 0.5 + }, + oncreate(folder) { + const filter = this; + filter.animating = true; + app.events.on("enable", function(enabled) { + if (enabled && filter.animating) { + filter.time = 0; + } + }); + app.events.on("animate", function() { + if (filter.animating) { + filter.seed = Math.random(); + filter.time += 0.5; + } + }); + folder.add(this, "animating").name("(animating)"); + folder.add(this, "curvature", 0, 10); + folder.add(this, "lineWidth", 0, 5); + folder.add(this, "lineContrast", 0, 1); + folder.add(this, "verticalLine"); + folder.add(this, "noise", 0, 1); + folder.add(this, "noiseSize", 1, 10); + folder.add(this, "vignetting", 0, 1); + folder.add(this, "vignettingAlpha", 0, 1); + folder.add(this, "vignettingBlur", 0, 1); + folder.add(this, "seed", 0, 1); + folder.add(this, "time", 0, 20); + } + }); + } + + function displacement() { + const app = this; + this.resources.map.source.addressMode = "repeat"; + const displacementSprite = new require$$0.Sprite(this.resources.map); + this.addFilter("DisplacementFilter", { + enabled: true, + global: true, + args: { sprite: displacementSprite, scale: 1, width: this.initWidth, height: this.initHeight }, + oncreate(folder) { + const { uScale } = this.resources.filterUniforms.uniforms; + uScale.x = 50; + uScale.y = 50; + folder.add(uScale, "x", 1, 200).name("scale.x"); + folder.add(uScale, "y", 1, 200).name("scale.y"); + app.events.on("resize", (width, height) => { + displacementSprite.width = width; + displacementSprite.height = height; + }); + } + }); + } + + function dot() { + this.addFilter("DotFilter", function(folder) { + folder.add(this, "scale", 0.3, 1); + folder.add(this, "angle", 0, 5); + folder.add(this, "grayscale"); + }); + } + + function dropShadow() { + this.addFilter("DropShadowFilter", { + fishOnly: true, + oncreate(folder) { + folder.add(this, "blur", 0, 20); + folder.add(this, "quality", 0, 20); + folder.add(this, "alpha", 0, 1); + folder.add(this, "offsetX", -50, 50).name("offset.x"); + folder.add(this, "offsetY", -50, 50).name("offset.y"); + folder.addColor(this, "color"); + folder.add(this, "shadowOnly"); + } + }); + } + + function emboss() { + this.addFilter("EmbossFilter", function(folder) { + folder.add(this, "strength", 0, 20); + }); + } + + function glitch() { + const app = this; + const fillMode = 2; + app.addFilter("GlitchFilter", { + args: { + slices: 10, + offset: 100, + direction: 0, + fillMode, + average: false, + red: { x: 2, y: 2 }, + green: { x: -10, y: 4 }, + blue: { x: 10, y: -4 }, + seed: 0.5 + }, + oncreate(folder) { + this.animating = true; + app.events.on("animate", () => { + if (this.animating) { + this.seed = Math.random(); + } + }); + folder.add(this, "animating").name("(animating)"); + folder.add(this, "seed", 0, 1); + folder.add(this, "slices", 2, 20).onChange((value) => { + this.slices = value >> 0; + }); + folder.add(this, "offset", -400, 400); + folder.add(this, "direction", -180, 180); + const fillModeOptions = { + TRANSPARENT: 0, + ORIGINAL: 1, + LOOP: 2, + CLAMP: 3, + MIRROR: 4 + }; + folder.add(this, "fillMode", fillModeOptions); + folder.add(this.red, "x", -50, 50).name("red.x"); + folder.add(this.red, "y", -50, 50).name("red.y"); + folder.add(this.blue, "x", -50, 50).name("blue.x"); + folder.add(this.blue, "y", -50, 50).name("blue.y"); + folder.add(this.green, "x", -50, 50).name("green.x"); + folder.add(this.green, "y", -50, 50).name("green.y"); + folder.add(this, "refresh"); + } + }); + } + + function glow() { + this.addFilter("GlowFilter", { + fishOnly: true, + args: { + distance: 15, + outerStrength: 2, + innerStrength: 0, + color: 16777215, + quality: 0.2, + knockout: false + }, + oncreate(folder) { + folder.add(this, "distance", 0, 20); + folder.add(this, "innerStrength", 0, 20); + folder.add(this, "outerStrength", 0, 20); + folder.addColor(this, "color"); + folder.add(this, "quality", 0, 1); + folder.add(this, "alpha", 0, 1); + folder.add(this, "knockout"); + } + }); + } + + function godray() { + const app = this; + this.addFilter("GodrayFilter", { + enabled: false, + args: { center: { x: app.initWidth * 0.5, y: -100 } }, + oncreate(folder) { + this.alpha = 1; + this.light = 30; + this.gain = 0.6; + this.lacunarity = 2.75; + this.animating = true; + app.events.on("enable", (enabled) => { + if (enabled && this.animating) { + this.time = 0; + } + }); + app.events.on("animate", () => { + if (this.animating) { + this.time += app.ticker.elapsedMS / 1e3; + } + }); + folder.add(this, "animating").name("(animating)"); + folder.add(this, "time", 0, 1); + folder.add(this, "gain", 0, 1); + folder.add(this, "lacunarity", 0, 5); + folder.add(this, "alpha", 0, 1); + folder.add(this, "parallel"); + folder.add(this, "angle", -60, 60); + folder.add(this, "centerX", -100, app.initWidth + 100).name("center.x"); + folder.add(this, "centerY", -1e3, -100).name("center.y"); + } + }); + } + + function grayscale() { + this.addFilter("GrayscaleFilter"); + } + + function hslAdjustment() { + this.addFilter("HslAdjustmentFilter", { + enabled: false, + fishOnly: false, + oncreate(folder) { + folder.add(this, "hue", -180, 180); + folder.add(this, "saturation", -1, 1); + folder.add(this, "lightness", -1, 1); + folder.add(this, "colorize"); + folder.add(this, "alpha", 0, 1); + } + }); + } + + function kawaseBlur() { + const app = this; + app.addFilter("KawaseBlurFilter", { + args: { strength: 4, quality: 3, clamp: true }, + oncreate(folder) { + folder.add(this, "strength", 0, 20); + folder.add(this, "quality", 1, 20); + folder.add(this, "pixelSizeX", 0, 10).name("pixelSize.x"); + folder.add(this, "pixelSizeY", 0, 10).name("pixelSize.y"); + } + }); + } + + function motionBlur() { + const app = this; + app.addFilter("MotionBlurFilter", { + enabled: false, + args: { velocity: { x: 40, y: 40 }, kernelSize: 15 }, + oncreate(folder) { + const filter = this; + folder.add(filter, "velocityX", -90, 90).name("velocity.x"); + folder.add(filter, "velocityY", -90, 90).name("velocity.y"); + folder.add(filter, "kernelSize", [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]).name("kernelSize"); + folder.add(filter, "offset", -150, 150).name("offset"); + } + }); + } + + function multiColorReplace() { + const replacements = [ + [3238359, 16711680], + [938417, 65280], + [1464209, 16776960] + ]; + this.addFilter("MultiColorReplaceFilter", { + args: { replacements, tolerance: 0.2 }, + oncreate(folder) { + const refresh = this.refresh.bind(this); + folder.addColor(replacements[0], "0").name("original 0").onChange(refresh); + folder.addColor(replacements[0], "1").name("target 0").onChange(refresh); + folder.addColor(replacements[1], "0").name("original 1").onChange(refresh); + folder.addColor(replacements[1], "1").name("target 1").onChange(refresh); + folder.addColor(replacements[2], "0").name("original 2").onChange(refresh); + folder.addColor(replacements[2], "1").name("target 2").onChange(refresh); + folder.add(this, "tolerance", 0, 1); + } + }); + } + + function noise() { + this.addFilter("NoiseFilter", { + global: true, + oncreate(folder) { + folder.add(this, "noise", 0, 1); + folder.add(this, "seed", 0.01, 0.99); + } + }); + } + + function oldFilm() { + const app = this; + app.addFilter("OldFilmFilter", { + enabled: false, + global: false, + args: [[app.initWidth / 2, app.initHeight / 2]], + oncreate(folder) { + const filter = this; + app.events.on("animate", function() { + filter.seed = Math.random(); + }); + folder.add(this, "sepia", 0, 1); + folder.add(this, "noise", 0, 1); + folder.add(this, "noiseSize", 1, 10); + folder.add(this, "scratch", -1, 1); + folder.add(this, "scratchDensity", 0, 1); + folder.add(this, "scratchWidth", 1, 20); + folder.add(this, "vignette", 0, 1); + folder.add(this, "vignetteAlpha", 0, 1); + folder.add(this, "vignetteBlur", 0, 1); + } + }); + } + + function outline() { + this.addFilter("OutlineFilter", { + enabled: false, + fishOnly: true, + args: { thickness: 4, color: 0, quality: 0.25, alpha: 1, knockout: false }, + oncreate(folder) { + folder.add(this, "thickness", 0, 10); + folder.addColor(this, "color"); + folder.add(this, "alpha", 0, 1); + folder.add(this, "knockout"); + } + }); + } + + function pixelate() { + this.addFilter("PixelateFilter", function(folder) { + folder.add(this, "sizeX", 4, 40).name("size.x"); + folder.add(this, "sizeY", 4, 40).name("size.y"); + }); + } + + function radialBlur() { + const app = this; + app.addFilter("RadialBlurFilter", { + args: { angle: 20, center: { x: app.initWidth / 2, y: app.initHeight / 2 }, kernelSize: 15, radius: 300 }, + enabled: false, + oncreate(folder) { + folder.add(this, "angle", -180, 180); + folder.add(this, "centerX", 0, app.initWidth).name("center.x"); + folder.add(this, "centerY", 0, app.initHeight).name("center.y"); + folder.add(this, "radius", -1, Math.max(app.initWidth, app.initHeight)); + folder.add(this, "kernelSize", [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25]).name("kernelSize"); + } + }); + } + + function reflection() { + const app = this; + app.addFilter("ReflectionFilter", { + oncreate(folder) { + const filter = this; + filter.animating = true; + app.events.on("enable", function(enabled) { + if (enabled && filter.animating) { + filter.time = 0; + } + }); + app.events.on("animate", function() { + if (filter.animating) { + filter.time += 0.1; + } + }); + folder.add(this, "animating").name("(animating)"); + folder.add(this, "mirror"); + folder.add(this, "boundary", 0, 1); + folder.add(this, "amplitudeStart", 0, 50).name("amplitude.start"); + folder.add(this, "amplitudeEnd", 0, 50).name("amplitude.end"); + folder.add(this, "wavelengthStart", 10, 200).name("waveLength.start"); + folder.add(this, "wavelengthEnd", 10, 200).name("waveLength.end"); + folder.add(this, "alphaStart", 0, 1).name("alpha.start"); + folder.add(this, "alphaEnd", 0, 1).name("alpha.end"); + folder.add(this, "time", 0, 20); + } + }); + } + + function rgb() { + this.addFilter("RGBSplitFilter", function(folder) { + folder.add(this, "redX", -20, 20).name("red.x"); + folder.add(this, "redY", -20, 20).name("red.y"); + folder.add(this, "blueX", -20, 20).name("blue.x"); + folder.add(this, "blueY", -20, 20).name("blue.y"); + folder.add(this, "greenX", -20, 20).name("green.x"); + folder.add(this, "greenY", -20, 20).name("green.y"); + }); + } + + function shockwave() { + const app = this; + this.addFilter("ShockwaveFilter", { + enabled: false, + args: { center: { x: app.initWidth / 2, y: app.initHeight / 2 } }, + oncreate(folder) { + const filter = this; + const maxTime = 2.5; + filter.animating = true; + app.events.on("enable", function(enabled) { + if (enabled && filter.animating) { + filter.time = 0; + } + }); + app.events.on("animate", function() { + if (filter.animating) { + filter.time += app.ticker.elapsedMS / 1e3; + filter.time %= maxTime; + } + }); + folder.add(this, "animating").name("(animating)"); + folder.add(this, "speed", 500, 2e3); + folder.add(this, "amplitude", 1, 100); + folder.add(this, "wavelength", 2, 400); + folder.add(this, "brightness", 0.2, 2); + folder.add(this, "radius", 100, 2e3); + folder.add(this, "centerX", 0, app.initWidth).name("center.x"); + folder.add(this, "centerY", 0, app.initHeight).name("center.y"); + } + }); + } + + function lightmap() { + this.addFilter("SimpleLightmapFilter", { + args: { lightMap: this.resources.lightmap, color: 6710886 }, + oncreate(folder) { + folder.addColor(this, "color"); + folder.add(this, "alpha", 0, 1); + this._noop = () => { + }; + folder.add(this, "_noop").name(''); + } + }); + } + + function tiltShift() { + this.addFilter("TiltShiftFilter", function(folder) { + folder.add(this, "blur", 0, 200); + folder.add(this, "gradientBlur", 0, 1e3); + }); + } + + function twist() { + const app = this; + this.addFilter("TwistFilter", function(folder) { + this.offsetX = app.initWidth / 2; + this.offsetY = app.initHeight / 2; + folder.add(this, "angle", -10, 10); + folder.add(this, "radius", 0, app.initWidth); + folder.add(this, "offsetX", 0, app.initWidth); + folder.add(this, "offsetY", 0, app.initHeight); + }); + } + + function zoomBlur() { + const app = this; + this.addFilter("ZoomBlurFilter", { + args: { + strength: 0.1, + center: { x: app.initWidth / 2, y: app.initHeight / 2 }, + innerRadius: 80 + }, + oncreate(folder) { + folder.add(this, "strength", 0.01, 0.5); + folder.add(this, "centerX", 0, app.initWidth).name("center.x"); + folder.add(this, "centerY", 0, app.initHeight).name("center.y"); + folder.add(this, "innerRadius", 0, app.initWidth / 2); + folder.add(this, "radius", 0, app.initWidth / 2); + } + }); + } + + var filters = /*#__PURE__*/Object.freeze({ + __proto__: null, + adjustment: adjustment, + advancedBloom: advancedBloom, + alpha: alpha, + ascii: ascii, + bevel: bevel, + bloom: bloom, + blur: blur, + bulgePinch: bulgePinch, + colorGradient: colorGradient, + colorMap: colorMap, + colorMatrix: colorMatrix, + colorOverlay: colorOverlay, + colorReplace: colorReplace, + convolution: convolution, + crossHatch: crossHatch, + crt: crt, + displacement: displacement, + dot: dot, + dropShadow: dropShadow, + emboss: emboss, + glitch: glitch, + glow: glow, + godray: godray, + grayscale: grayscale, + hslAdjustment: hslAdjustment, + kawaseBlur: kawaseBlur, + motionBlur: motionBlur, + multiColorReplace: multiColorReplace, + noise: noise, + oldFilm: oldFilm, + outline: outline, + pixelate: pixelate, + radialBlur: radialBlur, + reflection: reflection, + rgb: rgb, + shockwave: shockwave, + simpleLightmap: lightmap, + tiltShift: tiltShift, + twist: twist, + zoomBlur: zoomBlur + }); + + function getEnabledFiltersFromQueryString() { + const params = new URLSearchParams(window.location.search); + if (!params.has("enabled")) { + return []; + } + return params.get("enabled").split(","); + } + + (function(i, s, o, g, r, a, m) { + i.GoogleAnalyticsObject = r; + i[r] = i[r] || function() { + (i[r].q = i[r].q || []).push(arguments); + }, i[r].l = Number(/* @__PURE__ */ new Date()); + a = s.createElement(o), m = s.getElementsByTagName(o)[0]; + a.async = 1; + a.src = g; + m.parentNode.insertBefore(a, m); + })(window, document, "script", "https://www.google-analytics.com/analytics.js", "ga"); + ga("create", "UA-103772589-3", "auto"); + ga("send", "pageview"); + + const main = async () => { + const app = new DemoApplication(); + app.enabledFilters = getEnabledFiltersFromQueryString(); + await app.init(); + await app.load([ + { alias: "background", src: "images/displacement_BG.jpg" }, + { alias: "overlay", src: "images/overlay.png" }, + { alias: "map", src: "images/displacement_map.png" }, + { alias: "fish1", src: "images/displacement_fish1.png" }, + { alias: "fish2", src: "images/displacement_fish2.png" }, + { alias: "fish3", src: "images/displacement_fish3.png" }, + { alias: "fish4", src: "images/displacement_fish4.png" }, + { alias: "fish5", src: "images/displacement_fish5.png" }, + { alias: "lightmap", src: "images/lightmap.png" }, + { alias: "colormap", src: "images/colormap.png" } + ]); + for (const i in filters) { + filters[i].call(app); + } + }; + main(); + +})(PIXI); diff --git a/docs/AdjustmentFilter.html b/docs/AdjustmentFilter.html new file mode 100644 index 000000000..bc43bc2ba --- /dev/null +++ b/docs/AdjustmentFilter.html @@ -0,0 +1,2482 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: AdjustmentFilter

+ + + +
+ +
+
+

+ AdjustmentFilter + + +

+ + + +

The ability to adjust gamma, contrast, saturation, brightness, alpha or color-channel shift. +This is a faster and much simpler to use than +ColorMatrixFilter +because it does not use a matrix.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + AdjustmentFilter.DEFAULT_OPTIONS + AdjustmentFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

The overall alpha channel

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + blue + number + + + + +

+
+
+
+ + +
+

The multiplied green channel

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + brightness + number + + + + +

+
+
+
+ + +
+

The overall brightness

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + contrast + number + + + + +

+
+
+
+ + +
+

Amount of contrast

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + gamma + number + + + + +

+
+
+
+ + +
+

Amount of luminance

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + green + number + + + + +

+
+
+
+ + +
+

The multiplied blue channel

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + red + number + + + + +

+
+
+
+ + +
+

The multiplied red channel

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + saturation + number + + + + +

+
+
+
+ + +
+

Amount of color saturation

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/AdvancedBloomFilter.html b/docs/AdvancedBloomFilter.html new file mode 100644 index 000000000..7d9e8b66b --- /dev/null +++ b/docs/AdvancedBloomFilter.html @@ -0,0 +1,2527 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: AdvancedBloomFilter

+ + + +
+ +
+
+

+ AdvancedBloomFilter + + +

+ + + +

The AdvancedBloomFilter applies a Bloom Effect to an object. Unlike the normal BloomFilter +this had some advanced controls for adjusting the look of the bloom. Note: this filter +is slower than normal BloomFilter.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + AdvancedBloomFilter.DEFAULT_OPTIONS + AdvancedBloomFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + bloomScale + number + + + + +

+
+
+
+ +

To adjust the strength of the bloom. Higher values is more intense brightness.

+ + + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + blur + number + + + + +

+
+
+
+ + +
+

Sets the strength of the Blur properties simultaneously

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 2
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + brightness + number + + + + +

+
+
+
+ +

The brightness, lower value is more subtle brightness, higher value is blown-out.

+ + + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + kernels + number[] + + + + +

+
+
+
+ +

Sets the kernels of the Blur Filter

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + pixelSize + PointData + + + + +

+
+
+
+ + +
+

Sets the pixelSize of the Kawase Blur filter

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:1,y:1}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + pixelSizeX + number + + + + +

+
+
+
+ + +
+

Sets the pixelSize of the Kawase Blur filter on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + pixelSizeY + number + + + + +

+
+
+
+ + +
+

Sets the pixelSize of the Kawase Blur filter on the y axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + quality + number + + + + +

+
+
+
+ + +
+

Sets the quality of the Blur Filter

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 4
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + threshold + number + + + + +

+
+
+
+ + +
+

Defines how bright a color needs to be extracted.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.5
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/AsciiFilter.html b/docs/AsciiFilter.html new file mode 100644 index 000000000..64e71b8b1 --- /dev/null +++ b/docs/AsciiFilter.html @@ -0,0 +1,2204 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: AsciiFilter

+ + + +
+ +
+
+

+ AsciiFilter + + +

+ + + +

An ASCII filter.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + AsciiFilter.DEFAULT_OPTIONS + AsciiFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + color + ColorSource + + + + +

+
+
+
+ + +
+

The resulting color of the ascii characters, as a 3 component RGB or numerical hex

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0xffffff
+ + + + + + + +
+ + + +
Example
+ +
[1.0, 1.0, 1.0] = 0xffffff
+ + +
+ + + +
+
+

+ + replaceColor + boolean + + + + +

+
+
+
+ +

Determine whether or not to replace the source colors with the provided.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + size + number + + + + +

+
+
+
+ + +
+

The pixel size used by the filter.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 8
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/BevelFilter.html b/docs/BevelFilter.html new file mode 100644 index 000000000..f0f77df02 --- /dev/null +++ b/docs/BevelFilter.html @@ -0,0 +1,2374 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: BevelFilter

+ + + +
+ +
+
+

+ BevelFilter + + +

+ + + +

Bevel Filter.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + BevelFilter.DEFAULT_OPTIONS + BevelFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + lightAlpha + number + + + + +

+
+
+
+ + +
+

The alpha value of the left & top bevel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.7
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + lightColor + ColorSource + + + + +

+
+
+
+ + +
+

The color value of the left & top bevel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0xffffff
+ + + + + + + +
+ + + +
Example
+ +
[1.0, 1.0, 1.0] = 0xffffff
+ + +
+ + + +
+
+

+ + rotation + number + + + + +

+
+
+
+ + +
+

The angle of the light in degrees

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 45
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + shadowAlpha + number + + + + +

+
+
+
+ + +
+

The alpha value of the right & bottom bevel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.7
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + shadowColor + ColorSource + + + + +

+
+
+
+ + +
+

The color value of the right & bottom bevel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0xffffff
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + thickness + number + + + + +

+
+
+
+ + +
+

The thickness of the bevel

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 2
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/BloomFilter.html b/docs/BloomFilter.html new file mode 100644 index 000000000..2d24f199e --- /dev/null +++ b/docs/BloomFilter.html @@ -0,0 +1,2205 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: BloomFilter

+ + + +
+ +
+
+

+ BloomFilter + + +

+ + + +

The BloomFilter applies a Gaussian blur to an object. +The strength of the blur can be set for x- and y-axis separately.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + BloomFilter.DEFAULT_OPTIONS + BloomFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + strength + PointData + + + + +

+
+
+
+ + +
+

Sets the strength of both the blurX and blurY properties simultaneously

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 2
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + strengthX + number + + + + +

+
+
+
+ + +
+

Sets the strength of the blur on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 2
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + strengthY + number + + + + +

+
+
+
+ + +
+

Sets the strength of the blur on the y axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 2
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/BulgePinchFilter.html b/docs/BulgePinchFilter.html new file mode 100644 index 000000000..2ac465ad0 --- /dev/null +++ b/docs/BulgePinchFilter.html @@ -0,0 +1,2315 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: BulgePinchFilter

+ + + +
+ +
+
+

+ BulgePinchFilter + + +

+ + + +

Bulges or pinches the image in a circle.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + BulgePinchFilter.DEFAULT_OPTIONS + BulgePinchFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + center + PointData + + + + +

+
+
+
+ + +
+

Sets the center of the effect in normalized screen coords. +{ x: 0, y: 0 } means top-left and { x: 1, y: 1 } mean bottom-right

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:0.5,y:0.5}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerX + number + + + + +

+
+
+
+ + +
+

Sets the center of the effect in normalized screen coords on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerY + number + + + + +

+
+
+
+ + +
+

Sets the center of the effect in normalized screen coords on the y axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + radius + number + + + + +

+
+
+
+ + +
+

The radius of the circle of effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 100
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + strength + number + + + + +

+
+
+
+ + +
+

A value between -1 and 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/CRTFilter.html b/docs/CRTFilter.html new file mode 100644 index 000000000..2d3c6bc5d --- /dev/null +++ b/docs/CRTFilter.html @@ -0,0 +1,2646 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: CRTFilter

+ + + +
+ +
+
+

+ CRTFilter + + +

+ + + +

The CRTFilter applies a CRT effect to an object.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + CRTFilter.DEFAULT_OPTIONS + CRTFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + curvature + number + + + + +

+
+
+
+ + +
+

Bend of interlaced lines, higher value means more bend

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + lineContrast + number + + + + +

+
+
+
+ + +
+

Contrast of interlaced lines

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.25
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + lineWidth + number + + + + +

+
+
+
+ + +
+

Width of interlaced lines

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + noise + number + + + + +

+
+
+
+ + +
+

Opacity/intensity of the noise effect between 0 and 1

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.3
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + noiseSize + number + + + + +

+
+
+
+ + +
+

The size of the noise particles

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + seed + number + + + + +

+
+
+
+ + +
+

A seed value to apply to the random noise generation

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + time + number + + + + +

+
+
+
+ + +
+

Opacity/intensity of the noise effect between 0 and 1

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.3
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + verticalLine + boolean + + + + +

+
+
+
+ +

The orientation of the line:

+ + +
+

true create vertical lines, false creates horizontal lines

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + vignetting + number + + + + +

+
+
+
+ + +
+

The radius of the vignette effect, smaller values produces a smaller vignette

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.3
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + vignettingAlpha + number + + + + +

+
+
+
+ + +
+

Amount of opacity of vignette

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + vignettingBlur + number + + + + +

+
+
+
+ + +
+

Blur intensity of the vignette

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.3
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/ColorGradientFilter.html b/docs/ColorGradientFilter.html new file mode 100644 index 000000000..59e79c6e1 --- /dev/null +++ b/docs/ColorGradientFilter.html @@ -0,0 +1,2579 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: ColorGradientFilter

+ + + +
+ +
+
+

+ ColorGradientFilter + + +

+ + + +

Render a colored gradient.
+originalfilter

+ +
+
+ +
+
+ + +
+
+

+ + + + new ColorGradientFilter + + + (options) + + + + +

+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
options + + DefaultOptions | CssOptions + + + + <optional>
+ + + + + +
+ + + + +
options.alpha + + number + + + + <optional>
+ + + + + +
+ + 1.0 + + +

Alpha value

+ +
options.maxColors + + number + + + + <optional>
+ + + + + +
+ + 0 + + +

Maximum number of colors to render (0 = disabled)

+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + ColorGradientFilter.defaults + DefaultOptions + + staticreadonly + + +

+
+
+
+ +

Default constructor options

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + ColorGradientFilter.LINEAR + number + + staticreadonly + + +

+
+
+
+ +

Gradient types

+ + + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

The alpha value of the gradient (0-1)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + angle + number + + + + +

+
+
+
+ + +
+

The angle of the gradient in degrees

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 90
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + maxColors + number + + + + +

+
+
+
+ + +
+

The maximum number of colors to render (0 = no limit)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + replace + boolean + + + + +

+
+
+
+ + +
+

If true, the gradient will replace the existing color, otherwise it +will be multiplied with it

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + type + number + + + + +

+
+
+
+ + +
+

The type of gradient

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • ColorGradientFilter.LINEAR
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/ColorMapFilter.html b/docs/ColorMapFilter.html new file mode 100644 index 000000000..0c6bb43d6 --- /dev/null +++ b/docs/ColorMapFilter.html @@ -0,0 +1,2397 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: ColorMapFilter

+ + + +
+ +
+
+

+ ColorMapFilter + + +

+ + + +

The ColorMapFilter applies a color-map effect to an object.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + ColorMapFilter.DEFAULT_OPTIONS + ColorMapFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + colorMap + ColorMapTexture + + + + +

+
+
+
+ +

The colorMap texture.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + colorSize + number + + readonly + + +

+
+
+
+ + +
+

The size of one color slice.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + mix + number + + + + +

+
+
+
+ +

The mix from 0 to 1, where 0 is the original image and 1 is the color mapped image.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + nearest + boolean + + + + +

+
+
+
+ +

Whether use NEAREST for colorMap texture.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + +

Methods

+ + + +
+
+

+ + + + destroy + + + () void + + + + +

+ + +
+
+
+ + +
+

Destroys this filter

+
+ + + + + + + + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+
+

+ + + + updateColorMap + + + () void + + + + +

+ + +
+
+
+ + +
+

If the colorMap is based on canvas, +and the content of canvas has changed, then call updateColorMap for update texture.

+
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/ColorOverlayFilter.html b/docs/ColorOverlayFilter.html new file mode 100644 index 000000000..e56d029b2 --- /dev/null +++ b/docs/ColorOverlayFilter.html @@ -0,0 +1,2246 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: ColorOverlayFilter

+ + + +
+ +
+
+

+ ColorOverlayFilter + + +

+ + +

Overlay a source graphic with a color.

+ + +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + ColorOverlayFilter.DEFAULT_OPTIONS + ColorOverlayFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default shockwave filter options

+ + + + +
+ + +
Properties:
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDefaultDescription
alpha + + number + + + + 1 + + +

The alpha of the overlay

+ + +
color + + number + + + + 0 + + +

The color of the overlay

+ + +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

The alpha value of the color

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + color + number | number<Array> | Float32Array + + + + +

+
+
+
+ + +
+

The over color source

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0x000000
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/ColorReplaceFilter.html b/docs/ColorReplaceFilter.html new file mode 100644 index 000000000..f0539fa1e --- /dev/null +++ b/docs/ColorReplaceFilter.html @@ -0,0 +1,2233 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: ColorReplaceFilter

+ + + +
+ +
+
+

+ ColorReplaceFilter + + +

+ + + +

ColorReplaceFilter, originally by mishaa, updated by timetocode +http://www.html5gamedevs.com/topic/10640-outline-a-sprite-change-certain-colors/?p=69966
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +

Example

+ +
// replaces true red with true blue
+someSprite.filters = [new ColorReplaceFilter({
+ originalColor: [1, 0, 0],
+ targetColor: [0, 0, 1],
+ tolerance: 0.001
+ })];
+// replaces the RGB color 220, 220, 220 with the RGB color 225, 200, 215
+someOtherSprite.filters = [new ColorReplaceFilter({
+ originalColor: [220/255.0, 220/255.0, 220/255.0],
+ targetColor: [225/255.0, 200/255.0, 215/255.0],
+ tolerance: 0.001
+ })];
+// replaces the RGB color 220, 220, 220 with the RGB color 225, 200, 215
+someOtherSprite.filters = [new ColorReplaceFilter({ originalColor: 0xdcdcdc, targetColor: 0xe1c8d7, tolerance: 0.001 })];
+ + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + ColorReplaceFilter.DEFAULT_OPTIONS + ColorReplaceFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + originalColor + ColorSource + + + + +

+
+
+
+ + +
+

The color that will be changed.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0xff0000
+ + + + + + + +
+ + + +
Example
+ +
[1.0, 1.0, 1.0] = 0xffffff
+ + +
+ + + +
+
+

+ + targetColor + ColorSource + + + + +

+
+
+
+ + +
+

The resulting color.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0x000000
+ + + + + + + +
+ + + +
Example
+ +
[1.0, 1.0, 1.0] = 0xffffff
+ + +
+ + + +
+
+

+ + tolerance + number + + + + +

+
+
+
+ + +
+

Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.4
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/ColorReplaceFilterOptions.html b/docs/ColorReplaceFilterOptions.html new file mode 100644 index 000000000..6ed961166 --- /dev/null +++ b/docs/ColorReplaceFilterOptions.html @@ -0,0 +1,2276 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Interface: ColorReplaceFilterOptions

+ + + +
+ +
+
+

+ ColorReplaceFilterOptions + + +

+ + + +

This WebGPU filter has been ported from the WebGL renderer that was originally created by mishaa, updated by timetocode +http://www.html5gamedevs.com/topic/10640-outline-a-sprite-change-certain-colors/?p=69966

+ +
+
+ +
+
+ + + +
+ + +
Properties:
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDefaultDescription
originalColor + + ColorSource + + + + 0xff0000 + + + +

The color that will be changed.

+ +
targetColor + + ColorSource + + + + 0x000000 + + + +

The resulting color.

+ +
tolerance + + number + + + + 0.4 + + + +

Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive)

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + originalColor + ColorSource + + + + +

+
+
+
+ + +
+

The color that will be changed.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0xff0000
+ + + + + + + +
+ + + +
Example
+ +
[1.0, 1.0, 1.0] = 0xffffff
+ + +
+ + + +
+
+

+ + targetColor + ColorSource + + + + +

+
+
+
+ + +
+

The resulting color.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0x000000
+ + + + + + + +
+ + + +
Example
+ +
[1.0, 1.0, 1.0] = 0xffffff
+ + +
+ + + +
+
+

+ + tolerance + number + + + + +

+
+
+
+ + +
+

Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.4
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/ConvolutionFilter.html b/docs/ConvolutionFilter.html new file mode 100644 index 000000000..48a28330b --- /dev/null +++ b/docs/ConvolutionFilter.html @@ -0,0 +1,2214 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: ConvolutionFilter

+ + + +
+ +
+
+

+ ConvolutionFilter + + +

+ + + +

The ConvolutionFilter class applies a matrix convolution filter effect. +A convolution combines pixels in the input image with neighboring pixels to produce a new image. +A wide variety of image effects can be achieved through convolutions, including blurring, edge +detection, sharpening, embossing, and beveling. The matrix should be specified as a 9 point Array. +See https://docs.gimp.org/2.10/en/gimp-filter-convolution-matrix.html for more info.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + ConvolutionFilter.DEFAULT_OPTIONS + ConvolutionFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + height + number + + + + +

+
+
+
+ + +
+

Height of the object you are transforming

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 200
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + matrix + ConvolutionMatrix + + + + +

+
+
+
+ + +
+

An array of values used for matrix transformation, specified as a 9 point Array

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [0,0,0,0,0,0,0,0,0]
+ + + + + + + +
+ + + +
Example
+ +
const matrix = new Float32Array(9); // 9 elements of value 0
+const matrix = [0,0.5,0,0.5,1,0.5,0,0.5,0];
+ + +
+ + + +
+
+

+ + width + number + + + + +

+
+
+
+ + +
+

Width of the object you are transforming

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 200
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/CrossHatchFilter.html b/docs/CrossHatchFilter.html new file mode 100644 index 000000000..d1a99389d --- /dev/null +++ b/docs/CrossHatchFilter.html @@ -0,0 +1,1985 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: CrossHatchFilter

+ + + +
+ +
+
+

+ CrossHatchFilter + + +

+ + + +

A Cross Hatch effect filter.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/DotFilter.html b/docs/DotFilter.html new file mode 100644 index 000000000..724615eb6 --- /dev/null +++ b/docs/DotFilter.html @@ -0,0 +1,2205 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: DotFilter

+ + + +
+ +
+
+

+ DotFilter + + +

+ + + +

This filter applies a dotscreen effect making display objects appear to be made out of +black and white halftone dots like an old printer.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + DotFilter.DEFAULT_OPTIONS + DotFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + angle + number + + + + +

+
+
+
+ + +
+

The radius of the effect.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 5
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + grayscale + boolean + + + + +

+
+
+
+ + +
+

Whether to rendering it in gray scale.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • true
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + scale + number + + + + +

+
+
+
+ + +
+

The scale of the effect.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/DotFilterOptions.html b/docs/DotFilterOptions.html new file mode 100644 index 000000000..9b3f3b613 --- /dev/null +++ b/docs/DotFilterOptions.html @@ -0,0 +1,2266 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Interface: DotFilterOptions

+ + + +
+ +
+
+

+ DotFilterOptions + + +

+ + + +

This WebGPU filter has been ported from the WebGL renderer that was originally created by Mat Groves (@GoodBoyDigital) +Original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/fun/dotscreen.js

+ +
+
+ +
+
+ + + +
+ + +
Properties:
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDefaultDescription
angle + + number + + + + 5 + + + +

The angle of the effect

+ +
grayscale + + boolean + + + + true + + + +

Whether to rendering it in gray scale

+ +
scale + + number + + + + 1 + + + +

The scale of the effect

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + angle + number + + + + +

+
+
+
+ + +
+

The angle of the effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 5
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + grayscale + boolean + + + + +

+
+
+
+ + +
+

Whether to rendering it in gray scale

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • true
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + scale + number + + + + +

+
+
+
+ + +
+

The scale of the effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/DropShadowFilter.html b/docs/DropShadowFilter.html new file mode 100644 index 000000000..bacb2a33b --- /dev/null +++ b/docs/DropShadowFilter.html @@ -0,0 +1,2699 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: DropShadowFilter

+ + + +
+ +
+
+

+ DropShadowFilter + + +

+ + + +

Drop shadow filter.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + DropShadowFilter.DEFAULT_OPTIONS + DropShadowFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

Coefficient for alpha multiplication

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + blur + number + + + + +

+
+
+
+ + +
+

The strength of the shadow's blur.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 2
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + color + ColorSource + + + + +

+
+
+
+ + +
+

The color value of shadow.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0x000000
+ + + + + + + +
+ + + +
Example
+ +
[0.0, 0.0, 0.0] = 0x000000
+ + +
+ + + +
+
+

+ + kernels + number[] + + + + +

+
+
+
+ +

Sets the kernels of the Blur Filter

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + offset + PointData + + + + +

+
+
+
+ + +
+

Set the offset position of the drop-shadow relative to the original image.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [4,4]
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + offsetX + number + + + + +

+
+
+
+ + +
+

Set the offset position of the drop-shadow relative to the original image on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 4
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + offsetY + number + + + + +

+
+
+
+ + +
+

Set the offset position of the drop-shadow relative to the original image on the y axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 4
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + pixelSize + PointData + + + + +

+
+
+
+ + +
+

Sets the pixelSize of the Kawase Blur filter

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [1,1]
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + pixelSizeX + number + + + + +

+
+
+
+ + +
+

Sets the pixelSize of the Kawase Blur filter on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + pixelSizeY + number + + + + +

+
+
+
+ + +
+

Sets the pixelSize of the Kawase Blur filter on the y axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + quality + number + + + + +

+
+
+
+ + +
+

Sets the quality of the Blur Filter

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 4
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + shadowOnly + boolean + + + + +

+
+
+
+ + +
+

Hide the contents, only show the shadow.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/EmbossFilter.html b/docs/EmbossFilter.html new file mode 100644 index 000000000..10f0de764 --- /dev/null +++ b/docs/EmbossFilter.html @@ -0,0 +1,2094 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: EmbossFilter

+ + + +
+ +
+
+

+ EmbossFilter + + +

+ + + +

An RGB Split Filter.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + EmbossFilter.DEFAULT_OPTIONS + EmbossFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + strength + number + + + + +

+
+
+
+ + +
+

Strength of the emboss

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 5
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/GlitchFilter.html b/docs/GlitchFilter.html new file mode 100644 index 000000000..33202e4cc --- /dev/null +++ b/docs/GlitchFilter.html @@ -0,0 +1,3090 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: GlitchFilter

+ + + +
+ +
+
+

+ GlitchFilter + + +

+ + + +

The GlitchFilter applies a glitch effect to an object.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + GlitchFilter.defaults + GlitchFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default constructor options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + average + boolean + + + + +

+
+
+
+ + +
+

true will divide the bands roughly based on equal amounts +where as setting to false will vary the band sizes dramatically (more random looking).

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + blue + PointData + + + + +

+
+
+
+ + +
+

Blue offset.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:0,y:0}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + direction + number + + + + +

+
+
+
+ + +
+

The angle in degree of the offset of slices.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + fillMode + FILL_MODES + + + + +

+
+
+
+ + +
+

The fill mode of the space after the offset.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • FILL_MODES.TRANSPARENT
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + green + PointData + + + + +

+
+
+
+ + +
+

Green channel offset.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:0,y:0}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + minSize + number + + + + +

+
+
+
+ +

Minimum size of slices as a portion of the sampleSize

+ + + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 8
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + offset + number + + + + +

+
+
+
+ + +
+

The maximum offset amount of slices.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 100
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + offsets + Array<number> | Float32Array + + + + +

+
+
+
+ + +
+

Manually set custom slices offset of displacement bitmap, this is +a collection of values from -1 to 1. To change the max offset value +set offset.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + red + PointData + + + + +

+
+
+
+ + +
+

Red channel offset.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:0,y:0}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + sampleSize + number + + + + +

+
+
+
+ +

Height of the displacement map canvas.

+ + + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 512
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + seed + number + + + + +

+
+
+
+ + +
+

A seed value for randomizing glitch effect.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + sizes + Array<number> | Float32Array + + + + +

+
+
+
+ +

Manually custom slices size (height) of displacement bitmap

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + slices + number + + + + +

+
+
+
+ + +
+

The count of slices.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 5
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + texture + Texture + + readonly + + +

+
+
+
+ + +
+

The displacement map is used to generate the bands. +If using your own texture, slices will be ignored.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + +

Methods

+ + + +
+
+

+ + + + destroy + + + () void + + + + +

+ + +
+
+
+ +

Removes all references

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+
+

+ + + + redraw + + + () void + + + + +

+ + +
+
+
+ +

Redraw displacement bitmap texture, advanced usage.

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+
+

+ + + + refresh + + + () void + + + + +

+ + +
+
+
+ +

Regenerating random size, offsets for slices.

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+
+

+ + + + shuffle + + + () void + + + + +

+ + +
+
+
+ +

Shuffle the sizes of the slices, advanced usage.

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/GlowFilter.html b/docs/GlowFilter.html new file mode 100644 index 000000000..4c27d6901 --- /dev/null +++ b/docs/GlowFilter.html @@ -0,0 +1,2618 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: GlowFilter

+ + + +
+ +
+
+

+ GlowFilter + + +

+ + + +

GlowFilter, originally by mishaa +codepen.
+originalfilter

+ +
+
+ +
+
+ + +
+
+

+ + + + new GlowFilter + + + (options) + + + + +

+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + GlowFilterOptions + + + + <optional>
+ + + + + +
+ + +
+ + + + +
+ + +
Properties:
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
glProgram + + + +

Altering uDistance and uQuality won't have any affect on WebGL +since we hard-assign them during creation to allow +for the values to be used in GLSL loops

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +

Example

+ +
someSprite.filters = [
+    new GlowFilter({ distance: 15, outerStrength: 2 })
+];
+ + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + GlowFilter.DEFAULT_OPTIONS + GlowFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

The alpha of the glow

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + color + ColorSource + + + + +

+
+
+
+ + +
+

The color of the glow.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0xFFFFFF
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + distance + number + + + + +

+
+
+
+ + +
+

Only draw the glow, not the texture itself

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + innerStrength + number + + + + +

+
+
+
+ + +
+

The strength of the glow inward from the edge of the sprite.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + knockout + boolean + + + + +

+
+
+
+ + +
+

Only draw the glow, not the texture itself

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + outerStrength + number + + + + +

+
+
+
+ + +
+

The strength of the glow outward from the edge of the sprite.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 4
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + quality + number + + + + +

+
+
+
+ + +
+

A number between 0 and 1 that describes the quality of the glow. The higher the number the less performant

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/GlowFilterOptions.html b/docs/GlowFilterOptions.html new file mode 100644 index 000000000..c48cc7f39 --- /dev/null +++ b/docs/GlowFilterOptions.html @@ -0,0 +1,2618 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Interface: GlowFilterOptions

+ + + +
+ +
+
+

+ GlowFilterOptions + + +

+ + + +

This WebGPU filter has been ported from the WebGL renderer that was originally created by mishaa +http://codepen.io/mishaa/pen/raKzrm

+ +
+
+ +
+
+ + + +
+ + +
Properties:
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDefaultDescription
alpha + + number + + + + 1 + + + +

The alpha of the glow

+ +
color + + ColorSource + + + + 0xffffff + + + +

The color of the glow

+ +
distance + + number + + + + 10 + + + +

The distance of the glow

+ +
innerStrength + + number + + + + 0 + + + +

The strength of the glow inward from the edge of the sprite

+ +
knockout + + boolean + + + + false + + + +

Toggle to hide the contents and only show glow

+ +
outerStrength + + number + + + + 4 + + + +

The strength of the glow outward from the edge of the sprite

+ +
quality + + number + + + + 0.1 + + + +

A number between 0 and 1 that describes the quality of the glow. The higher the number the less performant

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

The alpha of the glow

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + color + ColorSource + + + + +

+
+
+
+ + +
+

The color of the glow

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0xffffff
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + distance + number + + + + +

+
+
+
+ + +
+

The distance of the glow

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 10
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + innerStrength + number + + + + +

+
+
+
+ + +
+

The strength of the glow inward from the edge of the sprite

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + knockout + boolean + + + + +

+
+
+
+ + +
+

Toggle to hide the contents and only show glow

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + outerStrength + number + + + + +

+
+
+
+ + +
+

The strength of the glow outward from the edge of the sprite

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 4
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + quality + number + + + + +

+
+
+
+ + +
+

A number between 0 and 1 that describes the quality of the glow. The higher the number the less performant

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/GodrayFilter.html b/docs/GodrayFilter.html new file mode 100644 index 000000000..3ebc478cc --- /dev/null +++ b/docs/GodrayFilter.html @@ -0,0 +1,2543 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: GodrayFilter

+ + + +
+ +
+
+

+ GodrayFilter + + +

+ + +

GordayFilter, originally by Alain Galvan

+ + +

originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +

Example

+ +
displayObject.filters = [new GodrayFilter()];
+ + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + GodrayFilter.DEFAULT_OPTIONS + GodrayFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

The alpha (opacity) of the rays. 0 is fully transparent, 1 is fully opaque.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + angle + number + + + + +

+
+
+
+ + +
+

The angle/light-source of the rays in degrees. For instance, +a value of 0 is vertical rays, values of 90 or -90 produce horizontal rays

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 30
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + center + PointData + + + + +

+
+
+
+ + +
+

Focal point for non-parallel rays, to use this parallel must be set to false.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:0,y:0}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerX + number + + + + +

+
+
+
+ + +
+

Focal point for non-parallel rays on the x axis, to use this parallel must be set to false.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerY + number + + + + +

+
+
+
+ + +
+

Focal point for non-parallel rays on the y axis, to use this parallel must be set to false.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + gain + number + + + + +

+
+
+
+ + +
+

General intensity of the effect. A value closer to 1 will produce a more intense effect, +where a value closer to 0 will produce a subtler effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.5
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + lacunarity + number + + + + +

+
+
+
+ + +
+

The density of the fractal noise. +A higher amount produces more rays and a smaller amount produces fewer waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 2.5
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + parallel + boolean + + + + +

+
+
+
+ + +
+

true if light rays are parallel (uses angle), false to use the focal center point

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • true
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + time + number + + + + +

+
+
+
+ + +
+

The current time position

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/GrayscaleFilter.html b/docs/GrayscaleFilter.html new file mode 100644 index 000000000..3eb060611 --- /dev/null +++ b/docs/GrayscaleFilter.html @@ -0,0 +1,1985 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: GrayscaleFilter

+ + + +
+ +
+
+

+ GrayscaleFilter + + +

+ + + +

This filter applies a grayscale effect.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/HslAdjustmentFilter.html b/docs/HslAdjustmentFilter.html new file mode 100644 index 000000000..a8186f771 --- /dev/null +++ b/docs/HslAdjustmentFilter.html @@ -0,0 +1,2313 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: HslAdjustmentFilter

+ + + +
+ +
+
+

+ HslAdjustmentFilter + + +

+ + +

originalfilter

+ + +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + HslAdjustmentFilter.DEFAULT_OPTIONS + HslAdjustmentFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

The amount of alpha (0 to 1)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + colorize + boolean + + + + +

+
+
+
+ + +
+

Whether to colorize the image

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + hue + number + + + + +

+
+
+
+ + +
+

The amount of hue in degrees (-180 to 180)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + lightness + number + + + + +

+
+
+
+ + +
+

The amount of lightness (-1 to 1)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + saturation + number + + + + +

+
+
+
+ + +
+

The amount of lightness (-1 to 1)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/KawaseBlurFilter.html b/docs/KawaseBlurFilter.html new file mode 100644 index 000000000..6f8e4d52c --- /dev/null +++ b/docs/KawaseBlurFilter.html @@ -0,0 +1,2426 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: KawaseBlurFilter

+ + + +
+ +
+
+

+ KawaseBlurFilter + + +

+ + + +

A much faster blur than Gaussian blur, but more complicated to use.
+originalfilter

+ +
+
+ +
+ + + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + KawaseBlurFilter.DEFAULT_OPTIONS + KawaseBlurFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + clamp + boolean + + + + +

+
+
+
+ + +
+

Get the if the filter is clamped

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + kernels + number[] + + + + +

+
+
+
+ + +
+

The kernel size of the blur filter, for advanced usage

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [0]
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + pixelSize + PointData + + + + +

+
+
+
+ + +
+

The size of the pixels. Large size is blurrier. For advanced usage.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:1,y:1}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + pixelSizeX + number + + + + +

+
+
+
+ + +
+

The size of the pixels on the x axis. Large size is blurrier. For advanced usage.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + pixelSizeY + number + + + + +

+
+
+
+ + +
+

The size of the pixels on the y axis. Large size is blurrier. For advanced usage.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + quality + number + + + + +

+
+
+
+ + +
+

The quality of the filter, integer greater than 1.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 3
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + strength + number + + + + +

+
+
+
+ + +
+

The amount of blur, value greater than 0.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 4
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/MotionBlurFilter.html b/docs/MotionBlurFilter.html new file mode 100644 index 000000000..bf51efb98 --- /dev/null +++ b/docs/MotionBlurFilter.html @@ -0,0 +1,2316 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: MotionBlurFilter

+ + + +
+ +
+
+

+ MotionBlurFilter + + +

+ + + +

The MotionBlurFilter applies a Motion blur to an object.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + MotionBlurFilter.DEFAULT_OPTIONS + MotionBlurFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + kernelSize + number + + + + +

+
+
+
+ + +
+

The kernelSize of the blur filter. Must be odd number >= 5

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 5
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + offset + number + + + + +

+
+
+
+ + +
+

The offset of the blur filter

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + velocity + PointData + + + + +

+
+
+
+ + +
+

Sets the velocity of the motion for blur effect +This should be a size 2 array or an object containing x and y values, you cannot change types +once defined in the constructor

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:0,y:0}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + velocityX + number + + + + +

+
+
+
+ + +
+

Sets the velocity of the motion for blur effect on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + velocityY + number + + + + +

+
+
+
+ + +
+

Sets the velocity of the motion for blur effect on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/MultiColorReplaceFilter.html b/docs/MultiColorReplaceFilter.html new file mode 100644 index 000000000..79105eca5 --- /dev/null +++ b/docs/MultiColorReplaceFilter.html @@ -0,0 +1,2308 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: MultiColorReplaceFilter

+ + + +
+ +
+
+

+ MultiColorReplaceFilter + + +

+ + + +

Filter for replacing a color with another color. Similar to ColorReplaceFilter, but support multiple +colors.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +

Example

+ +
  // replaces pure red with pure blue, and replaces pure green with pure white
+  someSprite.filters = [new MultiColorReplaceFilter({
+    replacements: [
+      [0xFF0000, 0x0000FF],
+      [0x00FF00, 0xFFFFFF]
+    ],
+    tolerance: 0.001
+  })];
+
+  You also could use [R, G, B] as the color
+  someOtherSprite.filters = [new MultiColorReplaceFilter({
+    replacements: [
+      [ [1,0,0], [0,0,1] ],
+      [ [0,1,0], [1,1,1] ]
+    ],
+    tolerance: 0.001
+  })];
+ + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + MultiColorReplaceFilter.DEFAULT_OPTIONS + MultiColorReplaceFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + maxColors + number + + readonly + + +

+
+
+
+ + +
+

The maximum number of color replacements supported by this filter. Can be changed +only during construction.

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + replacements + Array<[ColorSource, ColorSource]> + + + + +

+
+
+
+ + +
+

The collection of replacement items. Each item is color-pair +(an array length is 2). In the pair, the first value is original color , the second value is target color

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + tolerance + number + + + + +

+
+
+
+ + +
+

Tolerance of the floating-point comparison between colors (lower = more exact, higher = more inclusive)

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.05
+ + + + + + + +
+ + + +
+ + + + + + + + + +

Methods

+ + + +
+
+

+ + + + refresh + + + () void + + + + +

+ + +
+
+
+ + +
+

Should be called after changing any of the contents of the replacements. +This is a convenience method for resetting the replacements.

+
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
TODO
+
+
    +
  • implement nested proxy to remove the need for this function
  • +
+
+ +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/OldFilmFilter.html b/docs/OldFilmFilter.html new file mode 100644 index 000000000..090930c38 --- /dev/null +++ b/docs/OldFilmFilter.html @@ -0,0 +1,2590 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: OldFilmFilter

+ + + +
+ +
+
+

+ OldFilmFilter + + +

+ + + +

The OldFilmFilter applies a Old film effect to an object.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + OldFilmFilter.DEFAULT_OPTIONS + OldFilmFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + noise + number + + + + +

+
+
+
+ + +
+

Opacity/intensity of the noise effect between 0 and 1

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.3
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + noiseSize + number + + + + +

+
+
+
+ + +
+

The size of the noise particles

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + scratch + number + + + + +

+
+
+
+ + +
+

How often scratches appear

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.5
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + scratchDensity + number + + + + +

+
+
+
+ + +
+

The density of the number of scratches

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.3
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + scratchWidth + number + + + + +

+
+
+
+ + +
+

The width of the scratches

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + seed + number + + + + +

+
+
+
+ + +
+

A seed value to apply to the random noise generation

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + sepia + number + + + + +

+
+
+
+ + +
+

The amount of saturation of sepia effect, +a value of 1 is more saturation and closer to 0 is less, and a value of 0 produces no sepia effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.3
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + vignette + number + + + + +

+
+
+
+ + +
+

The radius of the vignette effect, smaller values produces a smaller vignette

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.3
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + vignetteAlpha + number + + + + +

+
+
+
+ + +
+

Amount of opacity on the vignette

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + vignetteBlur + number + + + + +

+
+
+
+ + +
+

Blur intensity of the vignette

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/OutlineFilter.html b/docs/OutlineFilter.html new file mode 100644 index 000000000..8bd10706c --- /dev/null +++ b/docs/OutlineFilter.html @@ -0,0 +1,2433 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: OutlineFilter

+ + + +
+ +
+
+

+ OutlineFilter + + +

+ + + +

OutlineFilter, originally by mishaa +http://www.html5gamedevs.com/topic/10640-outline-a-sprite-change-certain-colors/?p=69966 +http://codepen.io/mishaa/pen/emGNRB
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +

Example

+ +
someSprite.filters = [new OutlineFilter(2, 0x99ff99)];
+ + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + OutlineFilter.DEFAULT_OPTIONS + OutlineFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + OutlineFilter.MAX_SAMPLES + number + + static + + +

+
+
+
+ +

The maximum number of samples for rendering outline.

+ + + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 100
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + OutlineFilter.MIN_SAMPLES + number + + static + + +

+
+
+
+ +

The minimum number of samples for rendering outline.

+ + + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

Coefficient for alpha multiplication

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + color + ColorSource + + + + +

+
+
+
+ + +
+

The color value of the ambient color

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0x000000
+ + + + + + + +
+ + + +
Example
+ +
[1.0, 1.0, 1.0] = 0xffffff
+ + +
+ + + +
+
+

+ + knockout + boolean + + + + +

+
+
+
+ + +
+

Whether to only render outline, not the contents.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • false
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + quality + number + + + + +

+
+
+
+ + +
+

The quality of the outline from 0 to 1. +Using a higher quality setting will result in more accuracy but slower performance

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + thickness + number + + + + +

+
+
+
+ + +
+

The thickness of the outline

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/PixelateFilter.html b/docs/PixelateFilter.html new file mode 100644 index 000000000..06daa0829 --- /dev/null +++ b/docs/PixelateFilter.html @@ -0,0 +1,2344 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: PixelateFilter

+ + + +
+ +
+
+

+ PixelateFilter + + +

+ + + +

This filter applies a pixelate effect making display objects appear 'blocky'.
+originalfilter

+ +
+
+ +
+
+ + +
+
+

+ + + + new PixelateFilter + + + (size) + + + + +

+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
size + + Point | number<Array> | number + + + + <optional>
+ + + + + +
+ + 10 + + +

Either the width/height of the size of the pixels, or square size

+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + PixelateFilter.DEFAULT_SIZE + Size + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 10
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + size + Size + + + + +

+
+
+
+ + +
+

The size of the pixels

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [10,10]
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + sizeX + number + + + + +

+
+
+
+ + +
+

The size of the pixels on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 10
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + sizeY + number + + + + +

+
+
+
+ + +
+

The size of the pixels on the y axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 10
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/RGBSplitFilter.html b/docs/RGBSplitFilter.html new file mode 100644 index 000000000..d28f9e17e --- /dev/null +++ b/docs/RGBSplitFilter.html @@ -0,0 +1,2534 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: RGBSplitFilter

+ + + +
+ +
+
+

+ RGBSplitFilter + + +

+ + + +

An RGB Split Filter.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + RGBSplitFilter.DEFAULT_OPTIONS + RGBSplitFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + blue + PointData + + + + +

+
+
+
+ + +
+

Blue channel offset.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:0,y:0}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + blueX + number + + + + +

+
+
+
+ + +
+

Amount of x-axis offset for the blue channel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + blueY + number + + + + +

+
+
+
+ + +
+

Amount of y-axis offset for the blue channel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + green + PointData + + + + +

+
+
+
+ + +
+

Green channel offset.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:0,y:10}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + greenX + number + + + + +

+
+
+
+ + +
+

Amount of x-axis offset for the green channel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + greenY + number + + + + +

+
+
+
+ + +
+

Amount of y-axis offset for the green channel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 10
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + red + PointData + + + + +

+
+
+
+ + +
+

Red channel offset.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:-10,y:0}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + redX + number + + + + +

+
+
+
+ + +
+

Amount of x-axis offset for the red channel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • -10
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + redY + number + + + + +

+
+
+
+ + +
+

Amount of y-axis offset for the red channel.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/RadialBlurFilter.html b/docs/RadialBlurFilter.html new file mode 100644 index 000000000..bb301ca96 --- /dev/null +++ b/docs/RadialBlurFilter.html @@ -0,0 +1,2371 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: RadialBlurFilter

+ + + +
+ +
+
+

+ RadialBlurFilter + + +

+ + + +

The RadialBlurFilter applies a Motion blur to an object.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + RadialBlurFilter.DEFAULT_OPTIONS + RadialBlurFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + angle + number + + + + +

+
+
+
+ + +
+

Sets the angle in degrees of the motion for blur effect.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + center + PointData + + + + +

+
+
+
+ + +
+

The x and y offset coordinates to change the position of the center of the circle of effect. +This should be a size 2 array or an object containing x and y values, you cannot change types +once defined in the constructor

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • {x:0,y:0}
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerX + number + + + + +

+
+
+
+ + +
+

Sets the velocity of the motion for blur effect on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerY + number + + + + +

+
+
+
+ + +
+

Sets the velocity of the motion for blur effect on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + kernelSize + number + + + + +

+
+
+
+ + +
+

The kernelSize of the blur filter. Must be odd number >= 3

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 5
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + radius + number + + + + +

+
+
+
+ + +
+

The maximum size of the blur radius, less than 0 equates to infinity

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • -1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/ReflectionFilter.html b/docs/ReflectionFilter.html new file mode 100644 index 000000000..e9cfcfc70 --- /dev/null +++ b/docs/ReflectionFilter.html @@ -0,0 +1,2700 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: ReflectionFilter

+ + + +
+ +
+
+

+ ReflectionFilter + + +

+ + + +

Applies a reflection effect to simulate the reflection on water with waves.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + ReflectionFilter.DEFAULT_OPTIONS + ReflectionFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + Range + + + + +

+
+
+
+ + +
+

Starting and ending alpha values

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [1,1]
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + alphaEnd + number + + + + +

+
+
+
+ + +
+

Starting wavelength of waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + alphaStart + number + + + + +

+
+
+
+ + +
+

Starting wavelength of waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + amplitude + Range + + + + +

+
+
+
+ + +
+

Starting and ending amplitude of waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [0,20]
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + amplitudeEnd + number + + + + +

+
+
+
+ + +
+

Starting amplitude of waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 20
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + amplitudeStart + number + + + + +

+
+
+
+ + +
+

Starting amplitude of waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + boundary + number + + + + +

+
+
+
+ + +
+

Vertical position of the reflection point, default is 50% (middle) +smaller numbers produce a larger reflection, larger numbers produce a smaller reflection.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.5
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + mirror + boolean + + + + +

+
+
+
+ + +
+

true to reflect the image, false for waves-only

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • true
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + time + number + + + + +

+
+
+
+ + +
+

Time for animating position of waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + waveLength + Range + + + + +

+
+
+
+ + +
+

Starting and ending length of waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [30,100]
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + wavelengthEnd + number + + + + +

+
+
+
+ + +
+

Starting wavelength of waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 100
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + wavelengthStart + number + + + + +

+
+
+
+ + +
+

Starting wavelength of waves

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 30
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/ShockwaveFilter.html b/docs/ShockwaveFilter.html new file mode 100644 index 000000000..03b5c8511 --- /dev/null +++ b/docs/ShockwaveFilter.html @@ -0,0 +1,2876 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: ShockwaveFilter

+ + + +
+ +
+
+

+ ShockwaveFilter + + +

+ + +

A Noise effect filter.

+ + +

original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js

+ +
+
+ +
+
+ + +
+
+

+ + + + new ShockwaveFilter + + + (options) + + + + +

+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + ShockwaveFilterOptions + + + + <optional>
+ + + + + +
+ + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + ShockwaveFilter.DEFAULT_OPTIONS + ShockwaveFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default shockwave filter options

+ + + + +
+ + +
Properties:
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDefaultDescription
amplitude + + number + + + + 30 + + +

The amplitude of the shockwave

+ + +
brightness + + number + + + + 1 + + +

The brightness of the shockwave

+ + +
center + + + + +

The x and y center coordinates to change the position of the center of the circle of effect.

+ + +
radius + + number + + + + -1 + + +

The maximum radius of shockwave. less than 0 means the max is an infinite distance

+ + +
speed + + number + + + + 500 + + +

The speed about the shockwave ripples out. The unit is pixel-per-second

+ + +
wavelength + + number + + + + 160 + + +

The wavelength of the shockwave

+ + +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + amplitude + number + + + + +

+
+
+
+ + +
+

The amplitude of the shockwave

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 30
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + brightness + number + + + + +

+
+
+
+ + +
+

The brightness of the shockwave

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + center + PointData + + + + +

+
+
+
+ + +
+

The x and y center coordinates to change the position of the center of the circle of effect.

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [0,0]
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerX + number + + + + +

+
+
+
+ + +
+

Sets the center of the effect in normalized screen coords on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerY + number + + + + +

+
+
+
+ + +
+

Sets the center of the effect in normalized screen coords on the y axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + radius + number + + + + +

+
+
+
+ + +
+

The maximum radius of shockwave. less than 0 means the max is an infinite distance

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • -1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + speed + number + + + + +

+
+
+
+ + +
+

The speed about the shockwave ripples out. The unit is pixel-per-second

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 500
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + time + number + + + + +

+
+
+
+ +

Sets the elapsed time of the shockwave. It could control the current size of shockwave.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + wavelength + number + + + + +

+
+
+
+ + +
+

The wavelength of the shockwave

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 160
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/SimpleLightmapFilter.html b/docs/SimpleLightmapFilter.html new file mode 100644 index 000000000..396bf63d3 --- /dev/null +++ b/docs/SimpleLightmapFilter.html @@ -0,0 +1,2214 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: SimpleLightmapFilter

+ + + +
+ +
+
+

+ SimpleLightmapFilter + + +

+ + + +

SimpleLightmap, originally by Oza94 +http://www.html5gamedevs.com/topic/20027-pixijs-simple-lightmapping/ +http://codepen.io/Oza94/pen/EPoRxj

+

You have to specify filterArea, or suffer consequences. +You may have to use it with filter.dontFit = true, +until we rewrite this using same approach as for DisplacementFilter.

+

originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +

Example

+ +
displayObject.filters = [new SimpleLightmapFilter(texture, 0x666666)];
+ + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + SimpleLightmapFilter.DEFAULT_OPTIONS + SimpleLightmapFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + alpha + number + + + + +

+
+
+
+ + +
+

Coefficient for alpha multiplication

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + color + ColorSource + + + + +

+
+
+
+ + +
+

The color value of the ambient color

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0x000000
+ + + + + + + +
+ + + +
Example
+ +
[1.0, 1.0, 1.0] = 0xffffff
+ + +
+ + + +
+
+

+ + lightMap + Texture + + + + +

+
+
+
+ +

A sprite where your lightmap is rendered

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/TiltShiftAxisFilterOptions.html b/docs/TiltShiftAxisFilterOptions.html new file mode 100644 index 000000000..bde44c11a --- /dev/null +++ b/docs/TiltShiftAxisFilterOptions.html @@ -0,0 +1,2384 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Interface: TiltShiftAxisFilterOptions

+ + + +
+ +
+
+

+ TiltShiftAxisFilterOptions + + +

+ + +

Options for creating filter.

+ + +
+
+ +
+
+ + + +
+ + +
Properties:
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
axis + + "vertical" | "horizontal" + + +

The axis that the filter is calculating for.

+ + +
blur + + number + + +

The strength of the blur.

+ + +
end + + PointData + + +

The position to end the effect at.

+ + +
gradientBlur + + number + + +

The strength of the blur gradient

+ + +
start + + PointData + + +

The position to start the effect at.

+ + +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + axis + "vertical" | "horizontal" + + + + +

+
+
+
+ +

The axis that the filter is calculating for.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + blur + number + + + + +

+
+
+
+ +

The strength of the blur.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + end + PointData + + + + +

+
+
+
+ +

The position to end the effect at.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + gradientBlur + number + + + + +

+
+
+
+ +

The strength of the blur gradient

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + start + PointData + + + + +

+
+
+
+ +

The position to start the effect at.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/TiltShiftFilter.html b/docs/TiltShiftFilter.html new file mode 100644 index 000000000..2695fe49e --- /dev/null +++ b/docs/TiltShiftFilter.html @@ -0,0 +1,2389 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: TiltShiftFilter

+ + + +
+ +
+
+

+ TiltShiftFilter + + +

+ + + +

A TiltShift Filter. Manages the pass of both a TiltShiftXFilter and TiltShiftYFilter.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + blur + number + + + + +

+
+
+
+ +

The strength of the blur.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + end + PointData + + + + +

+
+
+
+ +

The position to end the effect at.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + endX + number + + + + +

+
+
+
+ +

The position to end the effect at on the x axis.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + endY + number + + + + +

+
+
+
+ +

The position to end the effect at on the y axis.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + gradientBlur + number + + + + +

+
+
+
+ +

The strength of the gradient blur.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + start + PointData + + + + +

+
+
+
+ +

The position to start the effect at.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + startX + number + + + + +

+
+
+
+ +

The position to start the effect at on the x axis.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + startY + number + + + + +

+
+
+
+ +

The position to start the effect at on the x axis.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/TwistFilter.html b/docs/TwistFilter.html new file mode 100644 index 000000000..568173dd3 --- /dev/null +++ b/docs/TwistFilter.html @@ -0,0 +1,2314 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: TwistFilter

+ + + +
+ +
+
+

+ TwistFilter + + +

+ + + +

This filter applies a twist effect making display objects appear twisted in the given direction.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + TwistFilter.DEFAULT_OPTIONS + TwistFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + angle + number + + + + +

+
+
+
+ + +
+

The angle of the twist

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 4
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + offset + PointData + + + + +

+
+
+
+ + +
+

The x offset coordinate to change the position of the center of the circle of effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + offsetX + number + + + + +

+
+
+
+ + +
+

The x offset coordinate to change the position of the center of the circle of effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + offsetY + number + + + + +

+
+
+
+ + +
+

The y offset coordinate to change the position of the center of the circle of effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + radius + number + + + + +

+
+
+
+ + +
+

The radius of the twist

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 200
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/ZoomBlurFilter.html b/docs/ZoomBlurFilter.html new file mode 100644 index 000000000..b87a38a5b --- /dev/null +++ b/docs/ZoomBlurFilter.html @@ -0,0 +1,2369 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Class: ZoomBlurFilter

+ + + +
+ +
+
+

+ ZoomBlurFilter + + +

+ + + +

The ZoomFilter applies a Zoom blur to an object.
+originalfilter

+ +
+
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
See:
+
+ +
+ + + +
+ + + +
+ + +

Extends

+ +
    + + +
  • Filter
  • + +
+ + + + + + + + + + + + + + + + + +

Members

+ + + +
+
+

+ + ZoomBlurFilter.DEFAULT_OPTIONS + ZoomBlurFilterOptions + + staticreadonly + + +

+
+
+
+ +

Default values for options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

+ + center + PointData + + + + +

+
+
+
+ + +
+

The center of the zoom

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • [0,0]
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerX + number + + + + +

+
+
+
+ + +
+

Sets the center of the effect in normalized screen coords on the x axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + centerY + number + + + + +

+
+
+
+ + +
+

Sets the center of the effect in normalized screen coords on the y axis

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + innerRadius + number + + + + +

+
+
+
+ + +
+

The inner radius of zoom. The part in inner circle won't apply zoom blur effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + radius + number + + + + +

+
+
+
+ + +
+

Outer radius of the effect. less than 0 equates to infinity

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • -1
+ + + + + + + +
+ + + +
+ + + +
+
+

+ + strength + number + + + + +

+
+
+
+ + +
+

Sets the strength of the zoom blur effect

+
+ + + +
+ + + + + + + + + + + + + + + +
Default Value:
+
  • 0.1
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/fonts/OpenSans-Bold.svg b/docs/fonts/OpenSans-Bold.svg new file mode 100644 index 000000000..464e98400 --- /dev/null +++ b/docs/fonts/OpenSans-Bold.svg @@ -0,0 +1,958 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-Bold.ttf b/docs/fonts/OpenSans-Bold.ttf new file mode 100644 index 000000000..cf53e6e46 Binary files /dev/null and b/docs/fonts/OpenSans-Bold.ttf differ diff --git a/docs/fonts/OpenSans-Bold.woff b/docs/fonts/OpenSans-Bold.woff new file mode 100644 index 000000000..c668e4537 Binary files /dev/null and b/docs/fonts/OpenSans-Bold.woff differ diff --git a/docs/fonts/OpenSans-Bold.woff2 b/docs/fonts/OpenSans-Bold.woff2 new file mode 100644 index 000000000..c80b2d2af Binary files /dev/null and b/docs/fonts/OpenSans-Bold.woff2 differ diff --git a/docs/fonts/OpenSans-BoldItalic.svg b/docs/fonts/OpenSans-BoldItalic.svg new file mode 100644 index 000000000..cc7332505 --- /dev/null +++ b/docs/fonts/OpenSans-BoldItalic.svg @@ -0,0 +1,958 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-BoldItalic.ttf b/docs/fonts/OpenSans-BoldItalic.ttf new file mode 100644 index 000000000..11d107ba5 Binary files /dev/null and b/docs/fonts/OpenSans-BoldItalic.ttf differ diff --git a/docs/fonts/OpenSans-BoldItalic.woff b/docs/fonts/OpenSans-BoldItalic.woff new file mode 100644 index 000000000..ced8f6971 Binary files /dev/null and b/docs/fonts/OpenSans-BoldItalic.woff differ diff --git a/docs/fonts/OpenSans-BoldItalic.woff2 b/docs/fonts/OpenSans-BoldItalic.woff2 new file mode 100644 index 000000000..60d8de4f6 Binary files /dev/null and b/docs/fonts/OpenSans-BoldItalic.woff2 differ diff --git a/docs/fonts/OpenSans-Italic.svg b/docs/fonts/OpenSans-Italic.svg new file mode 100644 index 000000000..f773016b7 --- /dev/null +++ b/docs/fonts/OpenSans-Italic.svg @@ -0,0 +1,958 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-Italic.ttf b/docs/fonts/OpenSans-Italic.ttf new file mode 100644 index 000000000..a30932742 Binary files /dev/null and b/docs/fonts/OpenSans-Italic.ttf differ diff --git a/docs/fonts/OpenSans-Italic.woff b/docs/fonts/OpenSans-Italic.woff new file mode 100644 index 000000000..1ed8ab956 Binary files /dev/null and b/docs/fonts/OpenSans-Italic.woff differ diff --git a/docs/fonts/OpenSans-Italic.woff2 b/docs/fonts/OpenSans-Italic.woff2 new file mode 100644 index 000000000..440b74c39 Binary files /dev/null and b/docs/fonts/OpenSans-Italic.woff2 differ diff --git a/docs/fonts/OpenSans-Light.svg b/docs/fonts/OpenSans-Light.svg new file mode 100644 index 000000000..e481f2c56 --- /dev/null +++ b/docs/fonts/OpenSans-Light.svg @@ -0,0 +1,958 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-Light.ttf b/docs/fonts/OpenSans-Light.ttf new file mode 100644 index 000000000..dddcc62a9 Binary files /dev/null and b/docs/fonts/OpenSans-Light.ttf differ diff --git a/docs/fonts/OpenSans-Light.woff b/docs/fonts/OpenSans-Light.woff new file mode 100644 index 000000000..937323df0 Binary files /dev/null and b/docs/fonts/OpenSans-Light.woff differ diff --git a/docs/fonts/OpenSans-Light.woff2 b/docs/fonts/OpenSans-Light.woff2 new file mode 100644 index 000000000..d0b43e0ad Binary files /dev/null and b/docs/fonts/OpenSans-Light.woff2 differ diff --git a/docs/fonts/OpenSans-LightItalic.svg b/docs/fonts/OpenSans-LightItalic.svg new file mode 100644 index 000000000..162f95c7a --- /dev/null +++ b/docs/fonts/OpenSans-LightItalic.svg @@ -0,0 +1,958 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-LightItalic.ttf b/docs/fonts/OpenSans-LightItalic.ttf new file mode 100644 index 000000000..9338bd99e Binary files /dev/null and b/docs/fonts/OpenSans-LightItalic.ttf differ diff --git a/docs/fonts/OpenSans-LightItalic.woff b/docs/fonts/OpenSans-LightItalic.woff new file mode 100644 index 000000000..bc83d1db5 Binary files /dev/null and b/docs/fonts/OpenSans-LightItalic.woff differ diff --git a/docs/fonts/OpenSans-LightItalic.woff2 b/docs/fonts/OpenSans-LightItalic.woff2 new file mode 100644 index 000000000..21a92a7e8 Binary files /dev/null and b/docs/fonts/OpenSans-LightItalic.woff2 differ diff --git a/docs/fonts/OpenSans-Regular.svg b/docs/fonts/OpenSans-Regular.svg new file mode 100644 index 000000000..067c09c1d --- /dev/null +++ b/docs/fonts/OpenSans-Regular.svg @@ -0,0 +1,958 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-Regular.ttf b/docs/fonts/OpenSans-Regular.ttf new file mode 100644 index 000000000..a135120e0 Binary files /dev/null and b/docs/fonts/OpenSans-Regular.ttf differ diff --git a/docs/fonts/OpenSans-Regular.woff b/docs/fonts/OpenSans-Regular.woff new file mode 100644 index 000000000..bd0f824b2 Binary files /dev/null and b/docs/fonts/OpenSans-Regular.woff differ diff --git a/docs/fonts/OpenSans-Regular.woff2 b/docs/fonts/OpenSans-Regular.woff2 new file mode 100644 index 000000000..f778f9c84 Binary files /dev/null and b/docs/fonts/OpenSans-Regular.woff2 differ diff --git a/docs/fonts/glyphicons-halflings-regular.eot b/docs/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 000000000..b93a4953f Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.eot differ diff --git a/docs/fonts/glyphicons-halflings-regular.svg b/docs/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 000000000..94fb5490a --- /dev/null +++ b/docs/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/glyphicons-halflings-regular.ttf b/docs/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 000000000..1413fc609 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.ttf differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff b/docs/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 000000000..9e612858f Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.woff differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff2 b/docs/fonts/glyphicons-halflings-regular.woff2 new file mode 100644 index 000000000..64539b54c Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.woff2 differ diff --git a/docs/icons/chevron-down.svg b/docs/icons/chevron-down.svg new file mode 100644 index 000000000..0ba78a537 --- /dev/null +++ b/docs/icons/chevron-down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 000000000..656fff56d --- /dev/null +++ b/docs/index.html @@ -0,0 +1,2131 @@ + + + + + PixiJS Filters API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+

Home

+ + + + + + + +
+

PixiJS Filters

+

Node.js CI npm version

+

Demo

+

View the PixiJS Filters Demo to interactively play with filters to see how they work.

+

Filters

+

All filters work with PixiJS v8.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FilterPreview
AdjustmentFilter
pixi-filters/adjustment
View demo
adjustment
AdvancedBloomFilter
pixi-filters/advanced-bloom
View demo
advanced-bloom
AsciiFilter
pixi-filters/ascii
View demo
ascii
BevelFilter
pixi-filters/bevel
View demo
bevel
BloomFilter
pixi-filters/bloom
View demo
bloom
BulgePinchFilter
pixi-filters/bulge-pinch
View demo
bulge-pinch
ColorGradientFilter
pixi-filters/color-gradient
View demo
color-gradient
ColorMapFilter
pixi-filters/color-map
View demo
color-map
ColorOverlayFilter
pixi-filters/color-overlay
View demo
color-overlay
ColorReplaceFilter
pixi-filters/color-replace
View demo
color-replace
ConvolutionFilter
pixi-filters/convolution
View demo
convolution
CrossHatchFilter
pixi-filters/cross-hatch
View demo
cross-hatch
CRTFilter
pixi-filters/crt
View demo
crt
DotFilter
pixi-filters/dot
View demo
dot
DropShadowFilter
pixi-filters/drop-shadow
View demo
drop-shadow
EmbossFilter
pixi-filters/emboss
View demo
emboss
GlitchFilter
pixi-filters/glitch
View demo
glitch
GlowFilter
pixi-filters/glow
View demo
glow
GodrayFilter
pixi-filters/godray
View demo
godray
GrayscaleFilter
pixi-filters/grayscale
View demo
grayscale
HslAdjustmentFilter
pixi-filters/hsl-adjustment
View demo
hsl-adjustment
KawaseBlurFilter
pixi-filters/kawase-blur
View demo
kawase-blur
MotionBlurFilter
pixi-filters/motion-blur
View demo
motion-blur
MultiColorReplaceFilter
pixi-filters/multi-color-replace
View demo
multi-color-replace
OldFilmFilter
pixi-filters/old-film
View demo
old-film
OutlineFilter
pixi-filters/outline
View demo
outline
PixelateFilter
pixi-filters/pixelate
View demo
pixelate
RadialBlurFilter
pixi-filters/radial-blur
View demo
radial-blur
ReflectionFilter
pixi-filters/reflection
View demo
reflection
RGBSplitFilter
pixi-filters/rgb-split
View demo
rgb split
ShockwaveFilter
pixi-filters/shockwave
View demo
shockwave
SimpleLightmapFilter
pixi-filters/simple-lightmap
View demo
simple-lightmap
TiltShiftFilter
pixi-filters/tilt-shift
View demo
tilt-shift
TwistFilter
pixi-filters/twist
View demo
twist
ZoomBlurFilter
pixi-filters/zoom-blur
View demo
zoom-blur
+

Built-In Filters

+

PixiJS has a handful of core filters that are built-in to the PixiJS library.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FilterPreview
AlphaFilter
View demo
alpha
BlurFilter
View demo
blur
ColorMatrixFilter (contrast)
View demo
color-matrix-contrast
ColorMatrixFilter (desaturate)
View demo
color-matrix-desaturate
ColorMatrixFilter (kodachrome)
View demo
color-matrix-kodachrome
ColorMatrixFilter (lsd)
View demo
color-matrix-lsd
ColorMatrixFilter (negative)
View demo
color-matrix-negative
ColorMatrixFilter (polaroid)
View demo
color-matrix-polaroid
ColorMatrixFilter (predator)
View demo
color-matrix-predator
ColorMatrixFilter (saturate)
View demo
color-matrix-saturate
ColorMatrixFilter (sepia)
View demo
color-matrix-sepia
DisplacementFilter
View demo
displacement
NoiseFilter
View demo
noise
+

Installation

+

Installation is available using NPM:

+
npm install pixi-filters
+
+

Alternatively, you can use a CDN such as JSDelivr:

+
<script src="https://cdn.jsdelivr.net/npm/pixi-filters@latest/dist/browser/pixi-filters.min.js"></script>
+
+

If all else failes, you can manually download the bundled file from the releases section and include it in your project.

+

Building

+

PixiJS Filters uses Lerna under-the-hood to build all of the filters separately. Install all dependencies by simply running the following.

+
npm install
+
+

Build all filters, demo and screenshots by running the following:

+
npm run build
+
+

Watch all filters and demo (auto-rebuild upon src changes):

+
npm run watch
+
+

Documentation

+

API documention can be found here.

+ +
+
+ + + + + + + + + +
+ +
+
+
+ + + + + + + + diff --git a/docs/scripts/Apache-License-2.0.txt b/docs/scripts/Apache-License-2.0.txt new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/docs/scripts/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/docs/scripts/bootstrap.min.js b/docs/scripts/bootstrap.min.js new file mode 100644 index 000000000..1a6258efc --- /dev/null +++ b/docs/scripts/bootstrap.min.js @@ -0,0 +1,7 @@ +/*! + * Bootstrap v3.0.3 (http://getbootstrap.com) + * Copyright 2013 Twitter, Inc. + * Licensed under http://www.apache.org/licenses/LICENSE-2.0 + */ + +if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]'),b=!0;if(a.length){var c=this.$element.find("input");"radio"===c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?b=!1:a.find(".active").removeClass("active")),b&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}b&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); \ No newline at end of file diff --git a/docs/scripts/jquery.min.js b/docs/scripts/jquery.min.js new file mode 100644 index 000000000..9a85bd346 --- /dev/null +++ b/docs/scripts/jquery.min.js @@ -0,0 +1,6 @@ +/*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license +//@ sourceMappingURL=jquery.min.map +*/ +(function(e,undefined){var t,n,r=typeof undefined,i=e.location,o=e.document,s=o.documentElement,a=e.jQuery,u=e.$,l={},c=[],p="2.0.3",f=c.concat,h=c.push,d=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,x=function(e,n){return new x.fn.init(e,n,t)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^-ms-/,N=/-([\da-z])/gi,E=function(e,t){return t.toUpperCase()},S=function(){o.removeEventListener("DOMContentLoaded",S,!1),e.removeEventListener("load",S,!1),x.ready()};x.fn=x.prototype={jquery:p,constructor:x,init:function(e,t,n){var r,i;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:T.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:o,!0)),C.test(r[1])&&x.isPlainObject(t))for(r in t)x.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=o.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?n.ready(e):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,l=!1;for("boolean"==typeof s&&(l=s,s=arguments[1]||{},a=2),"object"==typeof s||x.isFunction(s)||(s={}),u===a&&(s=this,--a);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(l&&r&&(x.isPlainObject(r)||(i=x.isArray(r)))?(i?(i=!1,o=n&&x.isArray(n)?n:[]):o=n&&x.isPlainObject(n)?n:{},s[t]=x.extend(l,o,r)):r!==undefined&&(s[t]=r));return s},x.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=a),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){(e===!0?--x.readyWait:x.isReady)||(x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(o,[x]),x.fn.trigger&&x(o).trigger("ready").off("ready")))},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&x.error("Invalid XML: "+e),t},noop:function(){},globalEval:function(e){var t,n=eval;e=x.trim(e),e&&(1===e.indexOf("use strict")?(t=o.createElement("script"),t.text=e,o.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(k,"ms-").replace(N,E)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,s=j(e);if(n){if(s){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(s){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":v.call(e)},makeArray:function(e,t){var n=t||[];return null!=e&&(j(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:g.call(t,e,n)},merge:function(e,t){var n=t.length,r=e.length,i=0;if("number"==typeof n)for(;n>i;i++)e[r++]=t[i];else while(t[i]!==undefined)e[r++]=t[i++];return e.length=r,e},grep:function(e,t,n){var r,i=[],o=0,s=e.length;for(n=!!n;s>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,s=j(e),a=[];if(s)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(a[a.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(a[a.length]=r);return f.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),x.isFunction(e)?(r=d.call(arguments,2),i=function(){return e.apply(t||this,r.concat(d.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):undefined},access:function(e,t,n,r,i,o,s){var a=0,u=e.length,l=null==n;if("object"===x.type(n)){i=!0;for(a in n)x.access(e,t,a,n[a],!0,o,s)}else if(r!==undefined&&(i=!0,x.isFunction(r)||(s=!0),l&&(s?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(x(e),n)})),t))for(;u>a;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:l?t.call(e):u?t(e[0],n):o},now:Date.now,swap:function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=s[o];return i}}),x.ready.promise=function(t){return n||(n=x.Deferred(),"complete"===o.readyState?setTimeout(x.ready):(o.addEventListener("DOMContentLoaded",S,!1),e.addEventListener("load",S,!1))),n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function j(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}t=x(o),function(e,undefined){var t,n,r,i,o,s,a,u,l,c,p,f,h,d,g,m,y,v="sizzle"+-new Date,b=e.document,w=0,T=0,C=st(),k=st(),N=st(),E=!1,S=function(e,t){return e===t?(E=!0,0):0},j=typeof undefined,D=1<<31,A={}.hasOwnProperty,L=[],q=L.pop,H=L.push,O=L.push,F=L.slice,P=L.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",W="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",$=W.replace("w","w#"),B="\\["+M+"*("+W+")"+M+"*(?:([*^$|!~]?=)"+M+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+$+")|)|)"+M+"*\\]",I=":("+W+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+B.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=RegExp("^"+M+"*,"+M+"*"),X=RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=RegExp(M+"*[+~]"),Y=RegExp("="+M+"*([^\\]'\"]*)"+M+"*\\]","g"),V=RegExp(I),G=RegExp("^"+$+"$"),J={ID:RegExp("^#("+W+")"),CLASS:RegExp("^\\.("+W+")"),TAG:RegExp("^("+W.replace("w","w*")+")"),ATTR:RegExp("^"+B),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:RegExp("^(?:"+R+")$","i"),needsContext:RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Q=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/^(?:input|select|textarea|button)$/i,et=/^h\d$/i,tt=/'|\\/g,nt=RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{O.apply(L=F.call(b.childNodes),b.childNodes),L[b.childNodes.length].nodeType}catch(it){O={apply:L.length?function(e,t){H.apply(e,F.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function ot(e,t,r,i){var o,s,a,u,l,f,g,m,x,w;if((t?t.ownerDocument||t:b)!==p&&c(t),t=t||p,r=r||[],!e||"string"!=typeof e)return r;if(1!==(u=t.nodeType)&&9!==u)return[];if(h&&!i){if(o=K.exec(e))if(a=o[1]){if(9===u){if(s=t.getElementById(a),!s||!s.parentNode)return r;if(s.id===a)return r.push(s),r}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(a))&&y(t,s)&&s.id===a)return r.push(s),r}else{if(o[2])return O.apply(r,t.getElementsByTagName(e)),r;if((a=o[3])&&n.getElementsByClassName&&t.getElementsByClassName)return O.apply(r,t.getElementsByClassName(a)),r}if(n.qsa&&(!d||!d.test(e))){if(m=g=v,x=t,w=9===u&&e,1===u&&"object"!==t.nodeName.toLowerCase()){f=gt(e),(g=t.getAttribute("id"))?m=g.replace(tt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",l=f.length;while(l--)f[l]=m+mt(f[l]);x=U.test(e)&&t.parentNode||t,w=f.join(",")}if(w)try{return O.apply(r,x.querySelectorAll(w)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,r,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>i.cacheLength&&delete t[e.shift()],t[n]=r}return t}function at(e){return e[v]=!0,e}function ut(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),r=e.length;while(r--)i.attrHandle[n[r]]=t}function ct(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return at(function(t){return t=+t,at(function(n,r){var i,o=e([],n.length,t),s=o.length;while(s--)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},n=ot.support={},c=ot.setDocument=function(e){var t=e?e.ownerDocument||e:b,r=t.defaultView;return t!==p&&9===t.nodeType&&t.documentElement?(p=t,f=t.documentElement,h=!s(t),r&&r.attachEvent&&r!==r.top&&r.attachEvent("onbeforeunload",function(){c()}),n.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ut(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=ut(function(e){return e.innerHTML="
",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),n.getById=ut(function(e){return f.appendChild(e).id=v,!t.getElementsByName||!t.getElementsByName(v).length}),n.getById?(i.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete i.find.ID,i.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=n.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==j?t.getElementsByTagName(e):undefined}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.CLASS=n.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==j&&h?t.getElementsByClassName(e):undefined},g=[],d=[],(n.qsa=Q.test(t.querySelectorAll))&&(ut(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll(":checked").length||d.push(":checked")}),ut(function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&d.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||d.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),d.push(",.*:")})),(n.matchesSelector=Q.test(m=f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&ut(function(e){n.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",I)}),d=d.length&&RegExp(d.join("|")),g=g.length&&RegExp(g.join("|")),y=Q.test(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},S=f.compareDocumentPosition?function(e,r){if(e===r)return E=!0,0;var i=r.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(r);return i?1&i||!n.sortDetached&&r.compareDocumentPosition(e)===i?e===t||y(b,e)?-1:r===t||y(b,r)?1:l?P.call(l,e)-P.call(l,r):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,o=e.parentNode,s=n.parentNode,a=[e],u=[n];if(e===n)return E=!0,0;if(!o||!s)return e===t?-1:n===t?1:o?-1:s?1:l?P.call(l,e)-P.call(l,n):0;if(o===s)return ct(e,n);r=e;while(r=r.parentNode)a.unshift(r);r=n;while(r=r.parentNode)u.unshift(r);while(a[i]===u[i])i++;return i?ct(a[i],u[i]):a[i]===b?-1:u[i]===b?1:0},t):p},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Y,"='$1']"),!(!n.matchesSelector||!h||g&&g.test(t)||d&&d.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&c(e);var r=i.attrHandle[t.toLowerCase()],o=r&&A.call(i.attrHandle,t.toLowerCase())?r(e,t,!h):undefined;return o===undefined?n.attributes||!h?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null:o},ot.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,o=0;if(E=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(S),E){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return e},o=ot.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=ot.selectors={cacheLength:50,createPseudo:at,match:J,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[4]||e[5]||"").replace(nt,rt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return J.CHILD.test(e[0])?null:(e[3]&&e[4]!==undefined?e[2]=e[4]:n&&V.test(n)&&(t=gt(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=C[e+" "];return t||(t=RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&C(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,h,d,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,y=a&&t.nodeName.toLowerCase(),x=!u&&!a;if(m){if(o){while(g){p=t;while(p=p[g])if(a?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&x){c=m[v]||(m[v]={}),l=c[e]||[],h=l[0]===w&&l[1],f=l[0]===w&&l[2],p=h&&m.childNodes[h];while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[w,h,f];break}}else if(x&&(l=(t[v]||(t[v]={}))[e])&&l[0]===w)f=l[1];else while(p=++h&&p&&p[g]||(f=h=0)||d.pop())if((a?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(x&&((p[v]||(p[v]={}))[e]=[w,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return r[v]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var i,o=r(e,t),s=o.length;while(s--)i=P.call(e,o[s]),e[i]=!(n[i]=o[s])}):function(e){return r(e,0,n)}):r}},pseudos:{not:at(function(e){var t=[],n=[],r=a(e.replace(z,"$1"));return r[v]?at(function(e,t,n,i){var o,s=r(e,null,i,[]),a=e.length;while(a--)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:at(function(e){return G.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return et.test(e.nodeName)},input:function(e){return Z.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},i.pseudos.nth=i.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[t]=pt(t);for(t in{submit:!0,reset:!0})i.pseudos[t]=ft(t);function dt(){}dt.prototype=i.filters=i.pseudos,i.setFilters=new dt;function gt(e,t){var n,r,o,s,a,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);a=e,u=[],l=i.preFilter;while(a){(!n||(r=_.exec(a)))&&(r&&(a=a.slice(r[0].length)||a),u.push(o=[])),n=!1,(r=X.exec(a))&&(n=r.shift(),o.push({value:n,type:r[0].replace(z," ")}),a=a.slice(n.length));for(s in i.filter)!(r=J[s].exec(a))||l[s]&&!(r=l[s](r))||(n=r.shift(),o.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?ot.error(e):k(e,u).slice(0)}function mt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function yt(e,t,n){var i=t.dir,o=n&&"parentNode"===i,s=T++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,a){var u,l,c,p=w+" "+s;if(a){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,a))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[v]||(t[v]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,a)||r,l[1]===!0)return!0}}function vt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,s=[],a=0,u=e.length,l=null!=t;for(;u>a;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),l&&t.push(a));return s}function bt(e,t,n,r,i,o){return r&&!r[v]&&(r=bt(r)),i&&!i[v]&&(i=bt(i,o)),at(function(o,s,a,u){var l,c,p,f=[],h=[],d=s.length,g=o||Ct(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:xt(g,f,e,a,u),y=n?i||(o?e:d||r)?[]:s:m;if(n&&n(m,y,a,u),r){l=xt(y,h),r(l,[],a,u),c=l.length;while(c--)(p=l[c])&&(y[h[c]]=!(m[h[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?P.call(o,p):f[c])>-1&&(o[l]=!(s[l]=p))}}else y=xt(y===s?y.splice(d,y.length):y),i?i(null,s,y,u):O.apply(s,y)})}function wt(e){var t,n,r,o=e.length,s=i.relative[e[0].type],a=s||i.relative[" "],l=s?1:0,c=yt(function(e){return e===t},a,!0),p=yt(function(e){return P.call(t,e)>-1},a,!0),f=[function(e,n,r){return!s&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>l;l++)if(n=i.relative[e[l].type])f=[yt(vt(f),n)];else{if(n=i.filter[e[l].type].apply(null,e[l].matches),n[v]){for(r=++l;o>r;r++)if(i.relative[e[r].type])break;return bt(l>1&&vt(f),l>1&&mt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&wt(e.slice(l,r)),o>r&&wt(e=e.slice(r)),o>r&&mt(e))}f.push(n)}return vt(f)}function Tt(e,t){var n=0,o=t.length>0,s=e.length>0,a=function(a,l,c,f,h){var d,g,m,y=[],v=0,x="0",b=a&&[],T=null!=h,C=u,k=a||s&&i.find.TAG("*",h&&l.parentNode||l),N=w+=null==C?1:Math.random()||.1;for(T&&(u=l!==p&&l,r=n);null!=(d=k[x]);x++){if(s&&d){g=0;while(m=e[g++])if(m(d,l,c)){f.push(d);break}T&&(w=N,r=++n)}o&&((d=!m&&d)&&v--,a&&b.push(d))}if(v+=x,o&&x!==v){g=0;while(m=t[g++])m(b,y,l,c);if(a){if(v>0)while(x--)b[x]||y[x]||(y[x]=q.call(f));y=xt(y)}O.apply(f,y),T&&!a&&y.length>0&&v+t.length>1&&ot.uniqueSort(f)}return T&&(w=N,u=C),b};return o?at(a):a}a=ot.compile=function(e,t){var n,r=[],i=[],o=N[e+" "];if(!o){t||(t=gt(e)),n=t.length;while(n--)o=wt(t[n]),o[v]?r.push(o):i.push(o);o=N(e,Tt(i,r))}return o};function Ct(e,t,n){var r=0,i=t.length;for(;i>r;r++)ot(e,t[r],n);return n}function kt(e,t,r,o){var s,u,l,c,p,f=gt(e);if(!o&&1===f.length){if(u=f[0]=f[0].slice(0),u.length>2&&"ID"===(l=u[0]).type&&n.getById&&9===t.nodeType&&h&&i.relative[u[1].type]){if(t=(i.find.ID(l.matches[0].replace(nt,rt),t)||[])[0],!t)return r;e=e.slice(u.shift().value.length)}s=J.needsContext.test(e)?0:u.length;while(s--){if(l=u[s],i.relative[c=l.type])break;if((p=i.find[c])&&(o=p(l.matches[0].replace(nt,rt),U.test(u[0].type)&&t.parentNode||t))){if(u.splice(s,1),e=o.length&&mt(u),!e)return O.apply(r,o),r;break}}}return a(e,f)(o,t,!h,r,U.test(e)),r}n.sortStable=v.split("").sort(S).join("")===v,n.detectDuplicates=E,c(),n.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(p.createElement("div"))}),ut(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||lt("type|href|height|width",function(e,t,n){return n?undefined:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ut(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||lt("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?undefined:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||lt(R,function(e,t,n){var r;return n?undefined:(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===!0?t.toLowerCase():null}),x.find=ot,x.expr=ot.selectors,x.expr[":"]=x.expr.pseudos,x.unique=ot.uniqueSort,x.text=ot.getText,x.isXMLDoc=ot.isXML,x.contains=ot.contains}(e);var D={};function A(e){var t=D[e]={};return x.each(e.match(w)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?D[e]||A(e):x.extend({},e);var t,n,r,i,o,s,a=[],u=!e.once&&[],l=function(p){for(t=e.memory&&p,n=!0,s=i||0,i=0,o=a.length,r=!0;a&&o>s;s++)if(a[s].apply(p[0],p[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,a&&(u?u.length&&l(u.shift()):t?a=[]:c.disable())},c={add:function(){if(a){var n=a.length;(function s(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&c.has(n)||a.push(n):n&&n.length&&"string"!==r&&s(n)})})(arguments),r?o=a.length:t&&(i=n,l(t))}return this},remove:function(){return a&&x.each(arguments,function(e,t){var n;while((n=x.inArray(t,a,n))>-1)a.splice(n,1),r&&(o>=n&&o--,s>=n&&s--)}),this},has:function(e){return e?x.inArray(e,a)>-1:!(!a||!a.length)},empty:function(){return a=[],o=0,this},disable:function(){return a=u=t=undefined,this},disabled:function(){return!a},lock:function(){return u=undefined,t||c.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!a||n&&!u||(t=t||[],t=[e,t.slice?t.slice():t],r?u.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var s=o[0],a=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=s.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=d.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),s=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?d.call(arguments):r,n===a?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},a,u,l;if(r>1)for(a=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(s(t,l,n)).fail(o.reject).progress(s(t,u,a)):--i;return i||o.resolveWith(l,n),o.promise()}}),x.support=function(t){var n=o.createElement("input"),r=o.createDocumentFragment(),i=o.createElement("div"),s=o.createElement("select"),a=s.appendChild(o.createElement("option"));return n.type?(n.type="checkbox",t.checkOn=""!==n.value,t.optSelected=a.selected,t.reliableMarginRight=!0,t.boxSizingReliable=!0,t.pixelPosition=!1,n.checked=!0,t.noCloneChecked=n.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!a.disabled,n=o.createElement("input"),n.value="t",n.type="radio",t.radioValue="t"===n.value,n.setAttribute("checked","t"),n.setAttribute("name","t"),r.appendChild(n),t.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,t.focusinBubbles="onfocusin"in e,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===i.style.backgroundClip,x(function(){var n,r,s="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",a=o.getElementsByTagName("body")[0];a&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(i),i.innerHTML="",i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",x.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===i.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(i,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(i,null)||{width:"4px"}).width,r=i.appendChild(o.createElement("div")),r.style.cssText=i.style.cssText=s,r.style.marginRight=r.style.width="0",i.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),a.removeChild(n))}),t):t}({});var L,q,H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,O=/([A-Z])/g;function F(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=x.expando+Math.random()}F.uid=1,F.accepts=function(e){return e.nodeType?1===e.nodeType||9===e.nodeType:!0},F.prototype={key:function(e){if(!F.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=F.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,x.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),o=this.cache[i];if("string"==typeof t)o[t]=n;else if(x.isEmptyObject(o))x.extend(this.cache[i],t);else for(r in t)o[r]=t[r];return o},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){var r;return t===undefined||t&&"string"==typeof t&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,x.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,o=this.key(e),s=this.cache[o];if(t===undefined)this.cache[o]={};else{x.isArray(t)?r=t.concat(t.map(x.camelCase)):(i=x.camelCase(t),t in s?r=[t,i]:(r=i,r=r in s?[r]:r.match(w)||[])),n=r.length;while(n--)delete s[r[n]]}},hasData:function(e){return!x.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}},L=new F,q=new F,x.extend({acceptData:F.accepts,hasData:function(e){return L.hasData(e)||q.hasData(e)},data:function(e,t,n){return L.access(e,t,n)},removeData:function(e,t){L.remove(e,t)},_data:function(e,t,n){return q.access(e,t,n)},_removeData:function(e,t){q.remove(e,t)}}),x.fn.extend({data:function(e,t){var n,r,i=this[0],o=0,s=null;if(e===undefined){if(this.length&&(s=L.get(i),1===i.nodeType&&!q.get(i,"hasDataAttrs"))){for(n=i.attributes;n.length>o;o++)r=n[o].name,0===r.indexOf("data-")&&(r=x.camelCase(r.slice(5)),P(i,r,s[r]));q.set(i,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){L.set(this,e)}):x.access(this,function(t){var n,r=x.camelCase(e);if(i&&t===undefined){if(n=L.get(i,e),n!==undefined)return n;if(n=L.get(i,r),n!==undefined)return n;if(n=P(i,r,undefined),n!==undefined)return n}else this.each(function(){var n=L.get(this,r);L.set(this,r,t),-1!==e.indexOf("-")&&n!==undefined&&L.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){L.remove(this,e)})}});function P(e,t,n){var r;if(n===undefined&&1===e.nodeType)if(r="data-"+t.replace(O,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:H.test(n)?JSON.parse(n):n}catch(i){}L.set(e,t,n)}else n=undefined;return n}x.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=q.get(e,t),n&&(!r||x.isArray(n)?r=q.access(e,t,x.makeArray(n)):r.push(n)),r||[]):undefined},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),s=function(){x.dequeue(e,t) +};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return q.get(e,n)||q.access(e,n,{empty:x.Callbacks("once memory").add(function(){q.remove(e,[t+"queue",n])})})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?x.queue(this[0],e):t===undefined?this:this.each(function(){var n=x.queue(this,e,t);x._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=x.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=undefined),e=e||"fx";while(s--)n=q.get(o[s],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var R,M,W=/[\t\r\n\f]/g,$=/\r/g,B=/^(?:input|select|textarea|button)$/i;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[x.propFix[e]||e]})},addClass:function(e){var t,n,r,i,o,s=0,a=this.length,u="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(W," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,i=0,o=x(this),s=e.match(w)||[];while(t=s[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===r||"boolean"===n)&&(this.className&&q.set(this,"__className__",this.className),this.className=this.className||e===!1?"":q.get(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(W," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=x.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,x(this).val()):e,null==i?i="":"number"==typeof i?i+="":x.isArray(i)&&(i=x.map(i,function(e){return null==e?"":e+""})),t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,i,"value")!==undefined||(this.value=i))});if(i)return t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,"string"==typeof n?n.replace($,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,s=o?null:[],a=o?i+1:r.length,u=0>i?a:o?i:0;for(;a>u;u++)if(n=r[u],!(!n.selected&&u!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),s=i.length;while(s--)r=i[s],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,t,n){var i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===r?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(t=t.toLowerCase(),i=x.attrHooks[t]||(x.expr.match.bool.test(t)?M:R)),n===undefined?i&&"get"in i&&null!==(o=i.get(e,t))?o:(o=x.find.attr(e,t),null==o?undefined:o):null!==n?i&&"set"in i&&(o=i.set(e,n,t))!==undefined?o:(e.setAttribute(t,n+""),n):(x.removeAttr(e,t),undefined))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!x.isXMLDoc(e),o&&(t=x.propFix[t]||t,i=x.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||B.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),M={set:function(e,t,n){return t===!1?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,t){var n=x.expr.attrHandle[t]||x.find.attr;x.expr.attrHandle[t]=function(e,t,r){var i=x.expr.attrHandle[t],o=r?undefined:(x.expr.attrHandle[t]=undefined)!=n(e,t,r)?t.toLowerCase():null;return x.expr.attrHandle[t]=i,o}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,t){return x.isArray(t)?e.checked=x.inArray(x(e).val(),t)>=0:undefined}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var I=/^key/,z=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,X=/^([^.]*)(?:\.(.+)|)$/;function U(){return!0}function Y(){return!1}function V(){try{return o.activeElement}catch(e){}}x.event={global:{},add:function(e,t,n,i,o){var s,a,u,l,c,p,f,h,d,g,m,y=q.get(e);if(y){n.handler&&(s=n,n=s.handler,o=s.selector),n.guid||(n.guid=x.guid++),(l=y.events)||(l=y.events={}),(a=y.handle)||(a=y.handle=function(e){return typeof x===r||e&&x.event.triggered===e.type?undefined:x.event.dispatch.apply(a.elem,arguments)},a.elem=e),t=(t||"").match(w)||[""],c=t.length;while(c--)u=X.exec(t[c])||[],d=m=u[1],g=(u[2]||"").split(".").sort(),d&&(f=x.event.special[d]||{},d=(o?f.delegateType:f.bindType)||d,f=x.event.special[d]||{},p=x.extend({type:d,origType:m,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&x.expr.match.needsContext.test(o),namespace:g.join(".")},s),(h=l[d])||(h=l[d]=[],h.delegateCount=0,f.setup&&f.setup.call(e,i,g,a)!==!1||e.addEventListener&&e.addEventListener(d,a,!1)),f.add&&(f.add.call(e,p),p.handler.guid||(p.handler.guid=n.guid)),o?h.splice(h.delegateCount++,0,p):h.push(p),x.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var o,s,a,u,l,c,p,f,h,d,g,m=q.hasData(e)&&q.get(e);if(m&&(u=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(a=X.exec(t[l])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h){p=x.event.special[h]||{},h=(r?p.delegateType:p.bindType)||h,f=u[h]||[],a=a[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=f.length;while(o--)c=f[o],!i&&g!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(f.splice(o,1),c.selector&&f.delegateCount--,p.remove&&p.remove.call(e,c));s&&!f.length&&(p.teardown&&p.teardown.call(e,d,m.handle)!==!1||x.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)x.event.remove(e,h+t[l],n,r,!0);x.isEmptyObject(u)&&(delete m.handle,q.remove(e,"events"))}},trigger:function(t,n,r,i){var s,a,u,l,c,p,f,h=[r||o],d=y.call(t,"type")?t.type:t,g=y.call(t,"namespace")?t.namespace.split("."):[];if(a=u=r=r||o,3!==r.nodeType&&8!==r.nodeType&&!_.test(d+x.event.triggered)&&(d.indexOf(".")>=0&&(g=d.split("."),d=g.shift(),g.sort()),c=0>d.indexOf(":")&&"on"+d,t=t[x.expando]?t:new x.Event(d,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=g.join("."),t.namespace_re=t.namespace?RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=null==n?[t]:x.makeArray(n,[t]),f=x.event.special[d]||{},i||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!i&&!f.noBubble&&!x.isWindow(r)){for(l=f.delegateType||d,_.test(l+d)||(a=a.parentNode);a;a=a.parentNode)h.push(a),u=a;u===(r.ownerDocument||o)&&h.push(u.defaultView||u.parentWindow||e)}s=0;while((a=h[s++])&&!t.isPropagationStopped())t.type=s>1?l:f.bindType||d,p=(q.get(a,"events")||{})[t.type]&&q.get(a,"handle"),p&&p.apply(a,n),p=c&&a[c],p&&x.acceptData(a)&&p.apply&&p.apply(a,n)===!1&&t.preventDefault();return t.type=d,i||t.isDefaultPrevented()||f._default&&f._default.apply(h.pop(),n)!==!1||!x.acceptData(r)||c&&x.isFunction(r[d])&&!x.isWindow(r)&&(u=r[c],u&&(r[c]=null),x.event.triggered=d,r[d](),x.event.triggered=undefined,u&&(r[c]=u)),t.result}},dispatch:function(e){e=x.event.fix(e);var t,n,r,i,o,s=[],a=d.call(arguments),u=(q.get(this,"events")||{})[e.type]||[],l=x.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),t=0;while((i=s[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((x.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,a),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,s=[],a=t.delegateCount,u=e.target;if(a&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!==this;u=u.parentNode||this)if(u.disabled!==!0||"click"!==e.type){for(r=[],n=0;a>n;n++)o=t[n],i=o.selector+" ",r[i]===undefined&&(r[i]=o.needsContext?x(i,this).index(u)>=0:x.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&s.push({elem:u,handlers:r})}return t.length>a&&s.push({elem:this,handlers:t.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||o,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),e.which||s===undefined||(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,s=e,a=this.fixHooks[i];a||(this.fixHooks[i]=a=z.test(i)?this.mouseHooks:I.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new x.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=o),3===e.target.nodeType&&(e.target=e.target.parentNode),a.filter?a.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==V()&&this.focus?(this.focus(),!1):undefined},delegateType:"focusin"},blur:{trigger:function(){return this===V()&&this.blur?(this.blur(),!1):undefined},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&x.nodeName(this,"input")?(this.click(),!1):undefined},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},x.Event=function(e,t){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.getPreventDefault&&e.getPreventDefault()?U:Y):this.type=e,t&&x.extend(this,t),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,undefined):new x.Event(e,t)},x.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=U,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=U,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=U,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,t,n,r,i){var o,s;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=undefined);for(s in e)this.on(s,t,n,e[s],i);return this}if(null==n&&null==r?(r=t,n=t=undefined):null==r&&("string"==typeof t?(r=n,n=undefined):(r=n,n=t,t=undefined)),r===!1)r=Y;else if(!r)return this;return 1===i&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),this.each(function(){x.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,x(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=undefined),n===!1&&(n=Y),this.each(function(){x.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?x.event.trigger(e,t,n,!0):undefined}});var G=/^.[^:#\[\.,]*$/,J=/^(?:parents|prev(?:Until|All))/,Q=x.expr.match.needsContext,K={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t=x(e,this),n=t.length;return this.filter(function(){var e=0;for(;n>e;e++)if(x.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(et(this,e||[],!0))},filter:function(e){return this.pushStack(et(this,e||[],!1))},is:function(e){return!!et(this,"string"==typeof e&&Q.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],s=Q.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(s?s.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?g.call(x(e),this[0]):g.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function Z(e,t){while((e=e[t])&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return Z(e,"nextSibling")},prev:function(e){return Z(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return e.contentDocument||x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(K[e]||x.unique(i),J.test(e)&&i.reverse()),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function et(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(G.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return g.call(t,e)>=0!==n})}var tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,nt=/<([\w:]+)/,rt=/<|&#?\w+;/,it=/<(?:script|style|link)/i,ot=/^(?:checkbox|radio)$/i,st=/checked\s*(?:[^=]|=\s*.checked.)/i,at=/^$|\/(?:java|ecma)script/i,ut=/^true\/(.*)/,lt=/^\s*\s*$/g,ct={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ct.optgroup=ct.option,ct.tbody=ct.tfoot=ct.colgroup=ct.caption=ct.thead,ct.th=ct.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===undefined?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=pt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(mt(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&dt(mt(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(mt(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!it.test(e)&&!ct[(nt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(tt,"<$1>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(x.cleanData(mt(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=f.apply([],e);var r,i,o,s,a,u,l=0,c=this.length,p=this,h=c-1,d=e[0],g=x.isFunction(d);if(g||!(1>=c||"string"!=typeof d||x.support.checkClone)&&st.test(d))return this.each(function(r){var i=p.eq(r);g&&(e[0]=d.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(r=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),i=r.firstChild,1===r.childNodes.length&&(r=i),i)){for(o=x.map(mt(r,"script"),ft),s=o.length;c>l;l++)a=r,l!==h&&(a=x.clone(a,!0,!0),s&&x.merge(o,mt(a,"script"))),t.call(this[l],a,l);if(s)for(u=o[o.length-1].ownerDocument,x.map(o,ht),l=0;s>l;l++)a=o[l],at.test(a.type||"")&&!q.access(a,"globalEval")&&x.contains(u,a)&&(a.src?x._evalUrl(a.src):x.globalEval(a.textContent.replace(lt,"")))}return this}}),x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=[],i=x(e),o=i.length-1,s=0;for(;o>=s;s++)n=s===o?this:this.clone(!0),x(i[s])[t](n),h.apply(r,n.get());return this.pushStack(r)}}),x.extend({clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),u=x.contains(e.ownerDocument,e);if(!(x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(s=mt(a),o=mt(e),r=0,i=o.length;i>r;r++)yt(o[r],s[r]);if(t)if(n)for(o=o||mt(e),s=s||mt(a),r=0,i=o.length;i>r;r++)gt(o[r],s[r]);else gt(e,a);return s=mt(a,"script"),s.length>0&&dt(s,!u&&mt(e,"script")),a},buildFragment:function(e,t,n,r){var i,o,s,a,u,l,c=0,p=e.length,f=t.createDocumentFragment(),h=[];for(;p>c;c++)if(i=e[c],i||0===i)if("object"===x.type(i))x.merge(h,i.nodeType?[i]:i);else if(rt.test(i)){o=o||f.appendChild(t.createElement("div")),s=(nt.exec(i)||["",""])[1].toLowerCase(),a=ct[s]||ct._default,o.innerHTML=a[1]+i.replace(tt,"<$1>")+a[2],l=a[0];while(l--)o=o.lastChild;x.merge(h,o.childNodes),o=f.firstChild,o.textContent=""}else h.push(t.createTextNode(i));f.textContent="",c=0;while(i=h[c++])if((!r||-1===x.inArray(i,r))&&(u=x.contains(i.ownerDocument,i),o=mt(f.appendChild(i),"script"),u&&dt(o),n)){l=0;while(i=o[l++])at.test(i.type||"")&&n.push(i)}return f},cleanData:function(e){var t,n,r,i,o,s,a=x.event.special,u=0;for(;(n=e[u])!==undefined;u++){if(F.accepts(n)&&(o=n[q.expando],o&&(t=q.cache[o]))){if(r=Object.keys(t.events||{}),r.length)for(s=0;(i=r[s])!==undefined;s++)a[i]?x.event.remove(n,i):x.removeEvent(n,i,t.handle);q.cache[o]&&delete q.cache[o]}delete L.cache[n[L.expando]]}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}});function pt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function ht(e){var t=ut.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function dt(e,t){var n=e.length,r=0;for(;n>r;r++)q.set(e[r],"globalEval",!t||q.get(t[r],"globalEval"))}function gt(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(q.hasData(e)&&(o=q.access(e),s=q.set(t,o),l=o.events)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)x.event.add(t,i,l[i][n])}L.hasData(e)&&(a=L.access(e),u=x.extend({},a),L.set(t,u))}}function mt(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&x.nodeName(e,t)?x.merge([e],n):n}function yt(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ot.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}x.fn.extend({wrapAll:function(e){var t;return x.isFunction(e)?this.each(function(t){x(this).wrapAll(e.call(this,t))}):(this[0]&&(t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var vt,xt,bt=/^(none|table(?!-c[ea]).+)/,wt=/^margin/,Tt=RegExp("^("+b+")(.*)$","i"),Ct=RegExp("^("+b+")(?!px)[a-z%]+$","i"),kt=RegExp("^([+-])=("+b+")","i"),Nt={BODY:"block"},Et={position:"absolute",visibility:"hidden",display:"block"},St={letterSpacing:0,fontWeight:400},jt=["Top","Right","Bottom","Left"],Dt=["Webkit","O","Moz","ms"];function At(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Dt.length;while(i--)if(t=Dt[i]+n,t in e)return t;return r}function Lt(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function qt(t){return e.getComputedStyle(t,null)}function Ht(e,t){var n,r,i,o=[],s=0,a=e.length;for(;a>s;s++)r=e[s],r.style&&(o[s]=q.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Lt(r)&&(o[s]=q.access(r,"olddisplay",Rt(r.nodeName)))):o[s]||(i=Lt(r),(n&&"none"!==n||!i)&&q.set(r,"olddisplay",i?n:x.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}x.fn.extend({css:function(e,t){return x.access(this,function(e,t,n){var r,i,o={},s=0;if(x.isArray(t)){for(r=qt(e),i=t.length;i>s;s++)o[t[s]]=x.css(e,t[s],!1,r);return o}return n!==undefined?x.style(e,t,n):x.css(e,t)},e,t,arguments.length>1)},show:function(){return Ht(this,!0)},hide:function(){return Ht(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Lt(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=vt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=x.camelCase(t),u=e.style;return t=x.cssProps[a]||(x.cssProps[a]=At(u,a)),s=x.cssHooks[t]||x.cssHooks[a],n===undefined?s&&"get"in s&&(i=s.get(e,!1,r))!==undefined?i:u[t]:(o=typeof n,"string"===o&&(i=kt.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(x.css(e,t)),o="number"),null==n||"number"===o&&isNaN(n)||("number"!==o||x.cssNumber[a]||(n+="px"),x.support.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&(n=s.set(e,n,r))===undefined||(u[t]=n)),undefined)}},css:function(e,t,n,r){var i,o,s,a=x.camelCase(t);return t=x.cssProps[a]||(x.cssProps[a]=At(e.style,a)),s=x.cssHooks[t]||x.cssHooks[a],s&&"get"in s&&(i=s.get(e,!0,n)),i===undefined&&(i=vt(e,t,r)),"normal"===i&&t in St&&(i=St[t]),""===n||n?(o=parseFloat(i),n===!0||x.isNumeric(o)?o||0:i):i}}),vt=function(e,t,n){var r,i,o,s=n||qt(e),a=s?s.getPropertyValue(t)||s[t]:undefined,u=e.style;return s&&(""!==a||x.contains(e.ownerDocument,e)||(a=x.style(e,t)),Ct.test(a)&&wt.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=s.width,u.width=r,u.minWidth=i,u.maxWidth=o)),a};function Ot(e,t,n){var r=Tt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Ft(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;for(;4>o;o+=2)"margin"===n&&(s+=x.css(e,n+jt[o],!0,i)),r?("content"===n&&(s-=x.css(e,"padding"+jt[o],!0,i)),"margin"!==n&&(s-=x.css(e,"border"+jt[o]+"Width",!0,i))):(s+=x.css(e,"padding"+jt[o],!0,i),"padding"!==n&&(s+=x.css(e,"border"+jt[o]+"Width",!0,i)));return s}function Pt(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=qt(e),s=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=vt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Ct.test(i))return i;r=s&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+Ft(e,t,n||(s?"border":"content"),r,o)+"px"}function Rt(e){var t=o,n=Nt[e];return n||(n=Mt(e,t),"none"!==n&&n||(xt=(xt||x("