From 55129f2d70f3b9c7dd49b2ecabc0cc8dad41928c Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Fri, 27 Nov 2020 12:47:06 +0000 Subject: [PATCH] Phaser 3.50 Beta 11 build --- dist/phaser-arcade-physics.js | 61542 +++++++++++++++------------ dist/phaser-arcade-physics.min.js | 2 +- dist/phaser.js | 62499 ++++++++++++++++------------ dist/phaser.min.js | 2 +- 4 files changed, 72593 insertions(+), 51452 deletions(-) diff --git a/dist/phaser-arcade-physics.js b/dist/phaser-arcade-physics.js index f72aa89e8..a9e495a23 100644 --- a/dist/phaser-arcade-physics.js +++ b/dist/phaser-arcade-physics.js @@ -91,7 +91,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1455); +/******/ return __webpack_require__(__webpack_require__.s = 1519); /******/ }) /************************************************************************/ /******/ ([ @@ -432,7 +432,7 @@ module.exports = GetFastValue; // and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl var Class = __webpack_require__(0); -var FuzzyEqual = __webpack_require__(109); +var FuzzyEqual = __webpack_require__(121); /** * @classdesc @@ -1205,7 +1205,7 @@ module.exports = Vector2; */ var Class = __webpack_require__(0); -var GEOM_CONST = __webpack_require__(49); +var GEOM_CONST = __webpack_require__(55); /** * @classdesc @@ -1233,7 +1233,7 @@ var Point = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Point#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -1298,7 +1298,7 @@ module.exports = Point; */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); /** @@ -1428,6 +1428,8 @@ var GameObjectFactory = new Class({ this.displayList.add(child); } + // For when custom objects have overridden `preUpdate` but don't hook into the ADDED_TO_SCENE event: + // Adding to the list multiple times is safe, as it won't add duplicates into the list anyway. if (child.preUpdate) { this.updateList.add(child); @@ -1725,12 +1727,12 @@ module.exports = FileTypesManager; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(50); -var GetPoint = __webpack_require__(161); -var GetPoints = __webpack_require__(283); -var GEOM_CONST = __webpack_require__(49); -var Line = __webpack_require__(40); -var Random = __webpack_require__(164); +var Contains = __webpack_require__(56); +var GetPoint = __webpack_require__(162); +var GetPoints = __webpack_require__(298); +var GEOM_CONST = __webpack_require__(55); +var Line = __webpack_require__(45); +var Random = __webpack_require__(165); /** * @classdesc @@ -1762,7 +1764,7 @@ var Rectangle = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Rectangle#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -1855,7 +1857,7 @@ var Rectangle = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - The number of points to return. Set to `false` or 0 to return an arbitrary number of points (`perimeter / stepRate`) evenly spaced around the Rectangle based on the `stepRate`. + * @param {number} quantity - The number of points to return. Set to `false` or 0 to return an arbitrary number of points (`perimeter / stepRate`) evenly spaced around the Rectangle based on the `stepRate`. * @param {number} [stepRate] - If `quantity` is 0, determines the normalized distance between each returned point. * @param {(array|Phaser.Geom.Point[])} [output] - An array to which to append the points. * @@ -2227,298 +2229,6 @@ module.exports = Rectangle; /***/ }), /* 10 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @author Matthew Groves <@doormat> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Generate shader source to test maximum ifs. - * - * @private - * @param {number} maxIfs - The number of if statements to generate - */ -function GenerateSrc (maxIfs) -{ - var src = ''; - - for (var i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += 'if(test == ' + i + '.0){}'; - } - } - - return src; -} - -/** - * @namespace Phaser.Renderer.WebGL.Utils - * @since 3.0.0 - */ -module.exports = { - - /** - * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats - * @since 3.0.0 - * - * @param {number} r - Red component in a range from 0.0 to 1.0 - * @param {number} g - Green component in a range from 0.0 to 1.0 - * @param {number} b - Blue component in a range from 0.0 to 1.0 - * @param {number} a - Alpha component in a range from 0.0 to 1.0 - * - * @return {number} The packed RGBA values as a Uint32. - */ - getTintFromFloats: function (r, g, b, a) - { - var ur = ((r * 255.0)|0) & 0xFF; - var ug = ((g * 255.0)|0) & 0xFF; - var ub = ((b * 255.0)|0) & 0xFF; - var ua = ((a * 255.0)|0) & 0xFF; - - return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; - }, - - /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha - * @since 3.0.0 - * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component - * - * @return {number} Packed RGBA as Uint32 - */ - getTintAppendFloatAlpha: function (rgb, a) - { - var ua = ((a * 255.0)|0) & 0xFF; - return ((ua << 24) | rgb) >>> 0; - }, - - /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a - * swizzled Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap - * @since 3.0.0 - * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component - * - * @return {number} Packed RGBA as Uint32 - */ - getTintAppendFloatAlphaAndSwap: function (rgb, a) - { - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; - var ua = ((a * 255.0)|0) & 0xFF; - - return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; - }, - - /** - * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 - * - * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB - * @since 3.0.0 - * - * @param {number} rgb - RGB packed as a Uint24 - * - * @return {array} Array of floats representing each component as a float - */ - getFloatsFromUintRGB: function (rgb) - { - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; - - return [ ur / 255.0, ug / 255.0, ub / 255.0 ]; - }, - - /** - * Counts how many attributes of 32 bits a vertex has - * - * @function Phaser.Renderer.WebGL.Utils.getComponentCount - * @since 3.0.0 - * - * @param {array} attributes - Array of attributes - * @param {WebGLRenderingContext} glContext - WebGLContext used for check types - * - * @return {number} Count of 32 bit attributes in vertex - */ - getComponentCount: function (attributes, glContext) - { - var count = 0; - - for (var index = 0; index < attributes.length; ++index) - { - var element = attributes[index]; - - if (element.type === glContext.FLOAT) - { - count += element.size; - } - else - { - count += 1; // We'll force any other type to be 32 bit. for now - } - } - - return count; - }, - - /** - * Check to see how many texture units the GPU supports, based on the given config value. - * Then tests this against the maximum number of iterations GLSL can support. - * - * @function Phaser.Renderer.WebGL.Utils.checkShaderMax - * @since 3.50.0 - * - * @param {WebGLRenderingContext} gl - The WebGLContext used to create the shaders. - * @param {number} maxTextures - The Game Config maxTextures value. - * - * @return {number} The number of texture units that is supported by this browser and GPU. - */ - checkShaderMax: function (gl, maxTextures) - { - if (!maxTextures || maxTextures === -1) - { - maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); - } - - var shader = gl.createShader(gl.FRAGMENT_SHADER); - - var fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}' - ].join('\n'); - - // eslint-disable-next-line no-constant-condition - while (true) - { - var fragmentSrc = fragTemplate.replace(/%forloop%/gi, GenerateSrc(maxTextures)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxTextures = (maxTextures / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxTextures; - }, - - /** - * Checks the given Fragment Shader Source for `%count%` and `%forloop%` declarations and - * replaces those with GLSL code for setting `texture = texture2D(uMainSampler[i], outTexCoord)`. - * - * @function Phaser.Renderer.WebGL.Utils.parseFragmentShaderMaxTextures - * @since 3.50.0 - * - * @param {string} fragmentShaderSource - The Fragment Shader source code to operate on. - * @param {number} maxTextures - The number of maxTextures value. - * - * @return {string} The modified Fragment Shader source. - */ - parseFragmentShaderMaxTextures: function (fragmentShaderSource, maxTextures) - { - var src = ''; - - for (var i = 0; i < maxTextures; i++) - { - if (i > 0) - { - src += '\n\telse '; - } - - if (i < maxTextures - 1) - { - src += 'if (outTexId < ' + i + '.5)'; - } - - src += '\n\t{'; - src += '\n\t\ttexture = texture2D(uMainSampler[' + i + '], outTexCoord);'; - src += '\n\t}'; - } - - fragmentShaderSource = fragmentShaderSource.replace(/%count%/gi, maxTextures.toString()); - - return fragmentShaderSource.replace(/%forloop%/gi, src); - } -}; - - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.GameObjects.Components - */ - -module.exports = { - - Alpha: __webpack_require__(562), - AlphaSingle: __webpack_require__(280), - BlendMode: __webpack_require__(281), - ComputedSize: __webpack_require__(563), - Crop: __webpack_require__(564), - Depth: __webpack_require__(282), - Flip: __webpack_require__(565), - GetBounds: __webpack_require__(566), - Mask: __webpack_require__(286), - Origin: __webpack_require__(583), - PathFollower: __webpack_require__(584), - Pipeline: __webpack_require__(165), - ScrollFactor: __webpack_require__(289), - Size: __webpack_require__(585), - Texture: __webpack_require__(586), - TextureCrop: __webpack_require__(587), - Tint: __webpack_require__(588), - ToJSON: __webpack_require__(290), - Transform: __webpack_require__(291), - TransformMatrix: __webpack_require__(31), - Visible: __webpack_require__(292) - -}; - - -/***/ }), -/* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2860,6 +2570,273 @@ if (true) { } +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Components + */ + +module.exports = { + + Alpha: __webpack_require__(601), + AlphaSingle: __webpack_require__(295), + BlendMode: __webpack_require__(296), + ComputedSize: __webpack_require__(602), + Crop: __webpack_require__(603), + Depth: __webpack_require__(297), + Flip: __webpack_require__(604), + GetBounds: __webpack_require__(605), + Mask: __webpack_require__(301), + Origin: __webpack_require__(622), + PathFollower: __webpack_require__(623), + Pipeline: __webpack_require__(166), + ScrollFactor: __webpack_require__(304), + Size: __webpack_require__(624), + Texture: __webpack_require__(625), + TextureCrop: __webpack_require__(626), + Tint: __webpack_require__(627), + ToJSON: __webpack_require__(168), + Transform: __webpack_require__(305), + TransformMatrix: __webpack_require__(24), + Visible: __webpack_require__(306) + +}; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @author Matthew Groves <@doormat> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Generate shader source to test maximum ifs. + * + * @private + * @ignore + * @param {number} maxIfs - The number of if statements to generate + */ +function GenerateSrc (maxIfs) +{ + var src = ''; + + for (var i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += 'if(test == ' + i + '.0){}'; + } + } + + return src; +} + +/** + * @namespace Phaser.Renderer.WebGL.Utils + * @since 3.0.0 + */ +module.exports = { + + /** + * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats + * @since 3.0.0 + * + * @param {number} r - Red component in a range from 0.0 to 1.0 + * @param {number} g - Green component in a range from 0.0 to 1.0 + * @param {number} b - Blue component in a range from 0.0 to 1.0 + * @param {number} a - Alpha component in a range from 0.0 to 1.0 + * + * @return {number} The packed RGBA values as a Uint32. + */ + getTintFromFloats: function (r, g, b, a) + { + var ur = ((r * 255) | 0) & 0xff; + var ug = ((g * 255) | 0) & 0xff; + var ub = ((b * 255) | 0) & 0xff; + var ua = ((a * 255) | 0) & 0xff; + + return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; + }, + + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlpha: function (rgb, a) + { + var ua = ((a * 255) | 0) & 0xff; + + return ((ua << 24) | rgb) >>> 0; + }, + + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a + * swizzled Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlphaAndSwap: function (rgb, a) + { + var ur = ((rgb >> 16) | 0) & 0xff; + var ug = ((rgb >> 8) | 0) & 0xff; + var ub = (rgb | 0) & 0xff; + var ua = ((a * 255) | 0) & 0xff; + + return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; + }, + + /** + * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 + * + * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB + * @since 3.0.0 + * + * @param {number} rgb - RGB packed as a Uint24 + * + * @return {array} Array of floats representing each component as a float + */ + getFloatsFromUintRGB: function (rgb) + { + var ur = ((rgb >> 16) | 0) & 0xff; + var ug = ((rgb >> 8) | 0) & 0xff; + var ub = (rgb | 0) & 0xff; + + return [ ur / 255, ug / 255, ub / 255 ]; + }, + + /** + * Check to see how many texture units the GPU supports, based on the given config value. + * Then tests this against the maximum number of iterations GLSL can support. + * + * @function Phaser.Renderer.WebGL.Utils.checkShaderMax + * @since 3.50.0 + * + * @param {WebGLRenderingContext} gl - The WebGLContext used to create the shaders. + * @param {number} maxTextures - The Game Config maxTextures value. + * + * @return {number} The number of texture units that is supported by this browser and GPU. + */ + checkShaderMax: function (gl, maxTextures) + { + if (!maxTextures || maxTextures === -1) + { + maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + } + + var shader = gl.createShader(gl.FRAGMENT_SHADER); + + var fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}' + ].join('\n'); + + // eslint-disable-next-line no-constant-condition + while (true) + { + var fragmentSrc = fragTemplate.replace(/%forloop%/gi, GenerateSrc(maxTextures)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxTextures = (maxTextures / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxTextures; + }, + + /** + * Checks the given Fragment Shader Source for `%count%` and `%forloop%` declarations and + * replaces those with GLSL code for setting `texture = texture2D(uMainSampler[i], outTexCoord)`. + * + * @function Phaser.Renderer.WebGL.Utils.parseFragmentShaderMaxTextures + * @since 3.50.0 + * + * @param {string} fragmentShaderSource - The Fragment Shader source code to operate on. + * @param {number} maxTextures - The number of maxTextures value. + * + * @return {string} The modified Fragment Shader source. + */ + parseFragmentShaderMaxTextures: function (fragmentShaderSource, maxTextures) + { + if (!fragmentShaderSource) + { + return ''; + } + + var src = ''; + + for (var i = 0; i < maxTextures; i++) + { + if (i > 0) + { + src += '\n\telse '; + } + + if (i < maxTextures - 1) + { + src += 'if (outTexId < ' + i + '.5)'; + } + + src += '\n\t{'; + src += '\n\t\ttexture = texture2D(uMainSampler[' + i + '], outTexCoord);'; + src += '\n\t}'; + } + + fragmentShaderSource = fragmentShaderSource.replace(/%count%/gi, maxTextures.toString()); + + return fragmentShaderSource.replace(/%forloop%/gi, src); + } +}; + + /***/ }), /* 13 */ /***/ (function(module, exports) { @@ -2963,10 +2940,10 @@ module.exports = MATH_CONST; */ var Class = __webpack_require__(0); -var ComponentsToJSON = __webpack_require__(290); -var DataManager = __webpack_require__(120); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(29); +var ComponentsToJSON = __webpack_require__(168); +var DataManager = __webpack_require__(97); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(32); /** * @classdesc @@ -2994,16 +2971,33 @@ var GameObject = new Class({ EventEmitter.call(this); /** - * The Scene to which this Game Object belongs. + * A reference to the Scene to which this Game Object belongs. + * * Game Objects can only belong to one Scene. * + * You should consider this property as being read-only. You cannot move a + * Game Object to another Scene by simply changing it. + * * @name Phaser.GameObjects.GameObject#scene * @type {Phaser.Scene} - * @protected * @since 3.0.0 */ this.scene = scene; + /** + * Holds a reference to the Display List that contains this Game Object. + * + * This is set automatically when this Game Object is added to a Scene or Layer. + * + * You should treat this property as being read-only. + * + * @name Phaser.GameObjects.GameObject#displayList + * @type {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} + * @default null + * @since 3.50.0 + */ + this.displayList = null; + /** * A textual representation of this Game Object, i.e. `sprite`. * Used internally by Phaser but is available for your own custom classes to populate. @@ -3025,7 +3019,7 @@ var GameObject = new Class({ * If you need to store complex data about your Game Object, look at using the Data Component instead. * * @name Phaser.GameObjects.GameObject#state - * @type {(integer|string)} + * @type {(number|string)} * @since 3.16.0 */ this.state = 0; @@ -3067,7 +3061,7 @@ var GameObject = new Class({ * Reserved for future use by plugins and the Input Manager. * * @name Phaser.GameObjects.GameObject#tabIndex - * @type {integer} + * @type {number} * @default -1 * @since 3.0.0 */ @@ -3091,7 +3085,7 @@ var GameObject = new Class({ * If those components are not used by your custom class then you can use this bitmask as you wish. * * @name Phaser.GameObjects.GameObject#renderFlags - * @type {integer} + * @type {number} * @default 15 * @since 3.0.0 */ @@ -3199,7 +3193,7 @@ var GameObject = new Class({ * @method Phaser.GameObjects.GameObject#setState * @since 3.16.0 * - * @param {(integer|string)} value - The state of the Game Object. + * @param {(number|string)} value - The state of the Game Object. * * @return {this} This GameObject. */ @@ -3565,7 +3559,7 @@ var GameObject = new Class({ * @method Phaser.GameObjects.GameObject#getIndexList * @since 3.4.0 * - * @return {integer[]} An array of display list position indexes. + * @return {number[]} An array of display list position indexes. */ getIndexList: function () { @@ -3634,16 +3628,15 @@ var GameObject = new Class({ this.emit(Events.DESTROY, this); - var sys = this.scene.sys; - if (!fromScene) { - sys.displayList.remove(this); + this.displayList.remove(this); } if (this.input) { - sys.input.clear(this); + this.scene.sys.input.clear(this); + this.input = undefined; } @@ -3657,20 +3650,23 @@ var GameObject = new Class({ if (this.body) { this.body.destroy(); + this.body = undefined; } + this.resetPostPipeline(true); + // Tell the Scene to re-sort the children if (!fromScene) { - sys.queueDepthSort(); + this.displayList.queueDepthSort(); } this.active = false; this.visible = false; this.scene = undefined; - + this.displayList = undefined; this.parentContainer = undefined; this.removeAllListeners(); @@ -3681,7 +3677,7 @@ var GameObject = new Class({ /** * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not. * - * @constant {integer} RENDER_MASK + * @constant {number} RENDER_MASK * @memberof Phaser.GameObjects.GameObject * @default */ @@ -3700,7 +3696,7 @@ module.exports = GameObject; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MATH = __webpack_require__(180); +var MATH = __webpack_require__(185); var GetValue = __webpack_require__(6); /** @@ -3779,6 +3775,36 @@ module.exports = GetAdvancedValue; /***/ }), /* 16 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Force a value within the boundaries by clamping it to the range `min`, `max`. + * + * @function Phaser.Math.Clamp + * @since 3.0.0 + * + * @param {number} value - The value to be clamped. + * @param {number} min - The minimum bounds. + * @param {number} max - The maximum bounds. + * + * @return {number} The clamped value. + */ +var Clamp = function (value, min, max) +{ + return Math.max(min, Math.min(max, value)); +}; + +module.exports = Clamp; + + +/***/ }), +/* 17 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -3788,7 +3814,7 @@ module.exports = GetAdvancedValue; */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); /** @@ -3957,190 +3983,8 @@ PluginCache.register('GameObjectCreator', GameObjectCreator, 'make'); module.exports = GameObjectCreator; -/***/ }), -/* 17 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Force a value within the boundaries by clamping it to the range `min`, `max`. - * - * @function Phaser.Math.Clamp - * @since 3.0.0 - * - * @param {number} value - The value to be clamped. - * @param {number} min - The minimum bounds. - * @param {number} max - The maximum bounds. - * - * @return {number} The clamped value. - */ -var Clamp = function (value, min, max) -{ - return Math.max(min, Math.min(max, value)); -}; - -module.exports = Clamp; - - /***/ }), /* 18 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var FILE_CONST = { - - /** - * The Loader is idle. - * - * @name Phaser.Loader.LOADER_IDLE - * @type {integer} - * @since 3.0.0 - */ - LOADER_IDLE: 0, - - /** - * The Loader is actively loading. - * - * @name Phaser.Loader.LOADER_LOADING - * @type {integer} - * @since 3.0.0 - */ - LOADER_LOADING: 1, - - /** - * The Loader is processing files is has loaded. - * - * @name Phaser.Loader.LOADER_PROCESSING - * @type {integer} - * @since 3.0.0 - */ - LOADER_PROCESSING: 2, - - /** - * The Loader has completed loading and processing. - * - * @name Phaser.Loader.LOADER_COMPLETE - * @type {integer} - * @since 3.0.0 - */ - LOADER_COMPLETE: 3, - - /** - * The Loader is shutting down. - * - * @name Phaser.Loader.LOADER_SHUTDOWN - * @type {integer} - * @since 3.0.0 - */ - LOADER_SHUTDOWN: 4, - - /** - * The Loader has been destroyed. - * - * @name Phaser.Loader.LOADER_DESTROYED - * @type {integer} - * @since 3.0.0 - */ - LOADER_DESTROYED: 5, - - /** - * File is in the load queue but not yet started - * - * @name Phaser.Loader.FILE_PENDING - * @type {integer} - * @since 3.0.0 - */ - FILE_PENDING: 10, - - /** - * File has been started to load by the loader (onLoad called) - * - * @name Phaser.Loader.FILE_LOADING - * @type {integer} - * @since 3.0.0 - */ - FILE_LOADING: 11, - - /** - * File has loaded successfully, awaiting processing - * - * @name Phaser.Loader.FILE_LOADED - * @type {integer} - * @since 3.0.0 - */ - FILE_LOADED: 12, - - /** - * File failed to load - * - * @name Phaser.Loader.FILE_FAILED - * @type {integer} - * @since 3.0.0 - */ - FILE_FAILED: 13, - - /** - * File is being processed (onProcess callback) - * - * @name Phaser.Loader.FILE_PROCESSING - * @type {integer} - * @since 3.0.0 - */ - FILE_PROCESSING: 14, - - /** - * The File has errored somehow during processing. - * - * @name Phaser.Loader.FILE_ERRORED - * @type {integer} - * @since 3.0.0 - */ - FILE_ERRORED: 16, - - /** - * File has finished processing. - * - * @name Phaser.Loader.FILE_COMPLETE - * @type {integer} - * @since 3.0.0 - */ - FILE_COMPLETE: 17, - - /** - * File has been destroyed - * - * @name Phaser.Loader.FILE_DESTROYED - * @type {integer} - * @since 3.0.0 - */ - FILE_DESTROYED: 18, - - /** - * File was populated from local data and doesn't need an HTTP request - * - * @name Phaser.Loader.FILE_POPULATED - * @type {integer} - * @since 3.0.0 - */ - FILE_POPULATED: 19 - -}; - -module.exports = FILE_CONST; - - -/***/ }), -/* 19 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -4240,6 +4084,158 @@ var Extend = function () module.exports = Extend; +/***/ }), +/* 19 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var FILE_CONST = { + + /** + * The Loader is idle. + * + * @name Phaser.Loader.LOADER_IDLE + * @type {number} + * @since 3.0.0 + */ + LOADER_IDLE: 0, + + /** + * The Loader is actively loading. + * + * @name Phaser.Loader.LOADER_LOADING + * @type {number} + * @since 3.0.0 + */ + LOADER_LOADING: 1, + + /** + * The Loader is processing files is has loaded. + * + * @name Phaser.Loader.LOADER_PROCESSING + * @type {number} + * @since 3.0.0 + */ + LOADER_PROCESSING: 2, + + /** + * The Loader has completed loading and processing. + * + * @name Phaser.Loader.LOADER_COMPLETE + * @type {number} + * @since 3.0.0 + */ + LOADER_COMPLETE: 3, + + /** + * The Loader is shutting down. + * + * @name Phaser.Loader.LOADER_SHUTDOWN + * @type {number} + * @since 3.0.0 + */ + LOADER_SHUTDOWN: 4, + + /** + * The Loader has been destroyed. + * + * @name Phaser.Loader.LOADER_DESTROYED + * @type {number} + * @since 3.0.0 + */ + LOADER_DESTROYED: 5, + + /** + * File is in the load queue but not yet started + * + * @name Phaser.Loader.FILE_PENDING + * @type {number} + * @since 3.0.0 + */ + FILE_PENDING: 10, + + /** + * File has been started to load by the loader (onLoad called) + * + * @name Phaser.Loader.FILE_LOADING + * @type {number} + * @since 3.0.0 + */ + FILE_LOADING: 11, + + /** + * File has loaded successfully, awaiting processing + * + * @name Phaser.Loader.FILE_LOADED + * @type {number} + * @since 3.0.0 + */ + FILE_LOADED: 12, + + /** + * File failed to load + * + * @name Phaser.Loader.FILE_FAILED + * @type {number} + * @since 3.0.0 + */ + FILE_FAILED: 13, + + /** + * File is being processed (onProcess callback) + * + * @name Phaser.Loader.FILE_PROCESSING + * @type {number} + * @since 3.0.0 + */ + FILE_PROCESSING: 14, + + /** + * The File has errored somehow during processing. + * + * @name Phaser.Loader.FILE_ERRORED + * @type {number} + * @since 3.0.0 + */ + FILE_ERRORED: 16, + + /** + * File has finished processing. + * + * @name Phaser.Loader.FILE_COMPLETE + * @type {number} + * @since 3.0.0 + */ + FILE_COMPLETE: 17, + + /** + * File has been destroyed + * + * @name Phaser.Loader.FILE_DESTROYED + * @type {number} + * @since 3.0.0 + */ + FILE_DESTROYED: 18, + + /** + * File was populated from local data and doesn't need an HTTP request + * + * @name Phaser.Loader.FILE_POPULATED + * @type {number} + * @since 3.0.0 + */ + FILE_POPULATED: 19 + +}; + +module.exports = FILE_CONST; + + /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { @@ -4256,27 +4252,27 @@ module.exports = Extend; module.exports = { - ADDED_TO_SCENE: __webpack_require__(733), - BOOT: __webpack_require__(734), - CREATE: __webpack_require__(735), - DESTROY: __webpack_require__(736), - PAUSE: __webpack_require__(737), - POST_UPDATE: __webpack_require__(738), - PRE_UPDATE: __webpack_require__(739), - READY: __webpack_require__(740), - REMOVED_FROM_SCENE: __webpack_require__(741), - RENDER: __webpack_require__(742), - RESUME: __webpack_require__(743), - SHUTDOWN: __webpack_require__(744), - SLEEP: __webpack_require__(745), - START: __webpack_require__(746), - TRANSITION_COMPLETE: __webpack_require__(747), - TRANSITION_INIT: __webpack_require__(748), - TRANSITION_OUT: __webpack_require__(749), - TRANSITION_START: __webpack_require__(750), - TRANSITION_WAKE: __webpack_require__(751), - UPDATE: __webpack_require__(752), - WAKE: __webpack_require__(753) + ADDED_TO_SCENE: __webpack_require__(774), + BOOT: __webpack_require__(775), + CREATE: __webpack_require__(776), + DESTROY: __webpack_require__(777), + PAUSE: __webpack_require__(778), + POST_UPDATE: __webpack_require__(779), + PRE_UPDATE: __webpack_require__(780), + READY: __webpack_require__(781), + REMOVED_FROM_SCENE: __webpack_require__(782), + RENDER: __webpack_require__(783), + RESUME: __webpack_require__(784), + SHUTDOWN: __webpack_require__(785), + SLEEP: __webpack_require__(786), + START: __webpack_require__(787), + TRANSITION_COMPLETE: __webpack_require__(788), + TRANSITION_INIT: __webpack_require__(789), + TRANSITION_OUT: __webpack_require__(790), + TRANSITION_START: __webpack_require__(791), + TRANSITION_WAKE: __webpack_require__(792), + UPDATE: __webpack_require__(793), + WAKE: __webpack_require__(794) }; @@ -4291,31 +4287,66 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var TransformMatrix = __webpack_require__(24); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); + +var result = { camera: tempMatrix1, sprite: tempMatrix2, calc: tempMatrix3 }; + /** - * @namespace Phaser.Core.Events + * Calculates the Transform Matrix of the given Game Object and Camera, factoring in + * the parent matrix if provided. + * + * Note that the object this results contains _references_ to the Transform Matrices, + * not new instances of them. Therefore, you should use their values immediately, or + * copy them to your own matrix, as they will be replaced as soon as another Game + * Object is rendered. + * + * @function Phaser.GameObjects.GetCalcMatrix + * @memberof Phaser.GameObjects + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} src - The Game Object to calculate the transform matrix for. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera being used to render the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - The transform matrix of the parent container, if any. + * + * @return {Phaser.Types.GameObjects.GetCalcMatrixResults} The results object containing the updated transform matrices. */ +var GetCalcMatrix = function (src, camera, parentMatrix) +{ + var camMatrix = tempMatrix1; + var spriteMatrix = tempMatrix2; + var calcMatrix = tempMatrix3; -module.exports = { + spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - BLUR: __webpack_require__(567), - BOOT: __webpack_require__(568), - CONTEXT_LOST: __webpack_require__(569), - CONTEXT_RESTORED: __webpack_require__(570), - DESTROY: __webpack_require__(571), - FOCUS: __webpack_require__(572), - HIDDEN: __webpack_require__(573), - PAUSE: __webpack_require__(574), - POST_RENDER: __webpack_require__(575), - POST_STEP: __webpack_require__(576), - PRE_RENDER: __webpack_require__(577), - PRE_STEP: __webpack_require__(578), - READY: __webpack_require__(579), - RESUME: __webpack_require__(580), - STEP: __webpack_require__(581), - VISIBLE: __webpack_require__(582) + camMatrix.copyFrom(camera.matrix); + if (parentMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = src.x; + spriteMatrix.f = src.y; + } + else + { + spriteMatrix.e -= camera.scrollX * src.scrollFactorX; + spriteMatrix.f -= camera.scrollY * src.scrollFactorY; + } + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + + return result; }; +module.exports = GetCalcMatrix; + /***/ }), /* 22 */ @@ -4328,13 +4359,13 @@ module.exports = { */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); -var Events = __webpack_require__(84); +var CONST = __webpack_require__(19); +var Events = __webpack_require__(89); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(146); -var MergeXHRSettings = __webpack_require__(226); -var XHRLoader = __webpack_require__(477); -var XHRSettings = __webpack_require__(147); +var GetURL = __webpack_require__(148); +var MergeXHRSettings = __webpack_require__(232); +var XHRLoader = __webpack_require__(494); +var XHRSettings = __webpack_require__(149); /** * @classdesc @@ -4400,7 +4431,18 @@ var File = new Class({ if (!this.type || !this.key) { - throw new Error('Error calling \'Loader.' + this.type + '\' invalid key provided.'); + throw new Error('Invalid Loader.' + this.type + ' key'); + } + + var url = GetFastValue(fileConfig, 'url'); + + if (url === undefined) + { + url = loader.path + loadKey + '.' + GetFastValue(fileConfig, 'extension', ''); + } + else if (typeof url === 'string' && !url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)) + { + url = loader.path + url; } /** @@ -4414,16 +4456,7 @@ var File = new Class({ * @type {object|string} * @since 3.0.0 */ - this.url = GetFastValue(fileConfig, 'url'); - - if (this.url === undefined) - { - this.url = loader.path + loadKey + '.' + GetFastValue(fileConfig, 'extension', ''); - } - else if (typeof this.url === 'string' && this.url.indexOf('blob:') !== 0 && this.url.indexOf('data:') !== 0) - { - this.url = loader.path + this.url; - } + this.url = url; /** * The final URL this file will load from, including baseURL and path. @@ -4462,7 +4495,7 @@ var File = new Class({ * The current state of the file. One of the FILE_CONST values. * * @name Phaser.Loader.File#state - * @type {integer} + * @type {number} * @since 3.0.0 */ this.state = (typeof(this.url) === 'function') ? CONST.FILE_POPULATED : CONST.FILE_PENDING; @@ -4867,857 +4900,6 @@ module.exports = File; /***/ }), /* 23 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -// Contains the plugins that Phaser uses globally and locally. -// These are the source objects, not instantiated. -var corePlugins = {}; - -// Contains the plugins that the dev has loaded into their game -// These are the source objects, not instantiated. -var customPlugins = {}; - -var PluginCache = {}; - -/** - * @namespace Phaser.Plugins.PluginCache - */ - -/** - * Static method called directly by the Core internal Plugins. - * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) - * Plugin is the object to instantiate to create the plugin - * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) - * - * @method Phaser.Plugins.PluginCache.register - * @since 3.8.0 - * - * @param {string} key - A reference used to get this plugin from the plugin cache. - * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. - * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. - * @param {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin? - */ -PluginCache.register = function (key, plugin, mapping, custom) -{ - if (custom === undefined) { custom = false; } - - corePlugins[key] = { plugin: plugin, mapping: mapping, custom: custom }; -}; - -/** - * Stores a custom plugin in the global plugin cache. - * The key must be unique, within the scope of the cache. - * - * @method Phaser.Plugins.PluginCache.registerCustom - * @since 3.8.0 - * - * @param {string} key - A reference used to get this plugin from the plugin cache. - * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. - * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. - * @param {?any} data - A value to be passed to the plugin's `init` method. - */ -PluginCache.registerCustom = function (key, plugin, mapping, data) -{ - customPlugins[key] = { plugin: plugin, mapping: mapping, data: data }; -}; - -/** - * Checks if the given key is already being used in the core plugin cache. - * - * @method Phaser.Plugins.PluginCache.hasCore - * @since 3.8.0 - * - * @param {string} key - The key to check for. - * - * @return {boolean} `true` if the key is already in use in the core cache, otherwise `false`. - */ -PluginCache.hasCore = function (key) -{ - return corePlugins.hasOwnProperty(key); -}; - -/** - * Checks if the given key is already being used in the custom plugin cache. - * - * @method Phaser.Plugins.PluginCache.hasCustom - * @since 3.8.0 - * - * @param {string} key - The key to check for. - * - * @return {boolean} `true` if the key is already in use in the custom cache, otherwise `false`. - */ -PluginCache.hasCustom = function (key) -{ - return customPlugins.hasOwnProperty(key); -}; - -/** - * Returns the core plugin object from the cache based on the given key. - * - * @method Phaser.Plugins.PluginCache.getCore - * @since 3.8.0 - * - * @param {string} key - The key of the core plugin to get. - * - * @return {Phaser.Types.Plugins.CorePluginContainer} The core plugin object. - */ -PluginCache.getCore = function (key) -{ - return corePlugins[key]; -}; - -/** - * Returns the custom plugin object from the cache based on the given key. - * - * @method Phaser.Plugins.PluginCache.getCustom - * @since 3.8.0 - * - * @param {string} key - The key of the custom plugin to get. - * - * @return {Phaser.Types.Plugins.CustomPluginContainer} The custom plugin object. - */ -PluginCache.getCustom = function (key) -{ - return customPlugins[key]; -}; - -/** - * Returns an object from the custom cache based on the given key that can be instantiated. - * - * @method Phaser.Plugins.PluginCache.getCustomClass - * @since 3.8.0 - * - * @param {string} key - The key of the custom plugin to get. - * - * @return {function} The custom plugin object. - */ -PluginCache.getCustomClass = function (key) -{ - return (customPlugins.hasOwnProperty(key)) ? customPlugins[key].plugin : null; -}; - -/** - * Removes a core plugin based on the given key. - * - * @method Phaser.Plugins.PluginCache.remove - * @since 3.8.0 - * - * @param {string} key - The key of the core plugin to remove. - */ -PluginCache.remove = function (key) -{ - if (corePlugins.hasOwnProperty(key)) - { - delete corePlugins[key]; - } -}; - -/** - * Removes a custom plugin based on the given key. - * - * @method Phaser.Plugins.PluginCache.removeCustom - * @since 3.8.0 - * - * @param {string} key - The key of the custom plugin to remove. - */ -PluginCache.removeCustom = function (key) -{ - if (customPlugins.hasOwnProperty(key)) - { - delete customPlugins[key]; - } -}; - -/** - * Removes all Core Plugins. - * - * This includes all of the internal system plugins that Phaser needs, like the Input Plugin and Loader Plugin. - * So be sure you only call this if you do not wish to run Phaser again. - * - * @method Phaser.Plugins.PluginCache.destroyCorePlugins - * @since 3.12.0 - */ -PluginCache.destroyCorePlugins = function () -{ - for (var key in corePlugins) - { - if (corePlugins.hasOwnProperty(key)) - { - delete corePlugins[key]; - } - } -}; - -/** - * Removes all Custom Plugins. - * - * @method Phaser.Plugins.PluginCache.destroyCustomPlugins - * @since 3.12.0 - */ -PluginCache.destroyCustomPlugins = function () -{ - for (var key in customPlugins) - { - if (customPlugins.hasOwnProperty(key)) - { - delete customPlugins[key]; - } - } -}; - -module.exports = PluginCache; - - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var GetFastValue = __webpack_require__(2); - -/** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * - * @function Phaser.Tilemaps.Components.GetTilesWithin - * @since 3.0.0 - * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.GetTilesWithinFilteringOptions} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. - */ -var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) -{ - if (tileX === undefined) { tileX = 0; } - if (tileY === undefined) { tileY = 0; } - if (width === undefined) { width = layer.width; } - if (height === undefined) { height = layer.height; } - - var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); - var isColliding = GetFastValue(filteringOptions, 'isColliding', false); - var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); - - // Clip x, y to top left of map, while shrinking width/height to match. - if (tileX < 0) - { - width += tileX; - tileX = 0; - } - - if (tileY < 0) - { - height += tileY; - tileY = 0; - } - - // Clip width and height to bottom right of map. - if (tileX + width > layer.width) - { - width = Math.max(layer.width - tileX, 0); - } - - if (tileY + height > layer.height) - { - height = Math.max(layer.height - tileY, 0); - } - - var results = []; - - for (var ty = tileY; ty < tileY + height; ty++) - { - for (var tx = tileX; tx < tileX + width; tx++) - { - var tile = layer.data[ty][tx]; - - if (tile !== null) - { - if (isNotEmpty && tile.index === -1) - { - continue; - } - - if (isColliding && !tile.collides) - { - continue; - } - - if (hasInterestingFace && !tile.hasInterestingFace) - { - continue; - } - - results.push(tile); - } - } - } - - return results; -}; - -module.exports = GetTilesWithin; - - -/***/ }), -/* 25 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `PropertyValueSet(group.getChildren(), key, value, step)` - * - * @function Phaser.Actions.PropertyValueSet - * @since 3.3.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {string} key - The property to be updated. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var PropertyValueSet = function (items, key, value, step, index, direction) -{ - if (step === undefined) { step = 0; } - if (index === undefined) { index = 0; } - if (direction === undefined) { direction = 1; } - - var i; - var t = 0; - var end = items.length; - - if (direction === 1) - { - // Start to End - for (i = index; i < end; i++) - { - items[i][key] = value + (t * step); - t++; - } - } - else - { - // End to Start - for (i = index; i >= 0; i--) - { - items[i][key] = value + (t * step); - t++; - } - } - - return items; -}; - -module.exports = PropertyValueSet; - - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(34); -var Smoothing = __webpack_require__(177); - -// The pool into which the canvas elements are placed. -var pool = []; - -// Automatically apply smoothing(false) to created Canvas elements -var _disableContextSmoothing = false; - -/** - * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. - * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, - * which is useless for some of the Phaser pipelines / renderer. - * - * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. - * Which means all instances of Phaser Games on the same page can share the one single pool. - * - * @namespace Phaser.Display.Canvas.CanvasPool - * @since 3.0.0 - */ -var CanvasPool = function () -{ - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? - * - * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool - */ - var create = function (parent, width, height, canvasType, selfParent) - { - if (width === undefined) { width = 1; } - if (height === undefined) { height = 1; } - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - if (selfParent === undefined) { selfParent = false; } - - var canvas; - var container = first(canvasType); - - if (container === null) - { - container = { - parent: parent, - canvas: document.createElement('canvas'), - type: canvasType - }; - - if (canvasType === CONST.CANVAS) - { - pool.push(container); - } - - canvas = container.canvas; - } - else - { - container.parent = parent; - - canvas = container.canvas; - } - - if (selfParent) - { - container.parent = canvas; - } - - canvas.width = width; - canvas.height = height; - - if (_disableContextSmoothing && canvasType === CONST.CANVAS) - { - Smoothing.disable(canvas.getContext('2d')); - } - - return canvas; - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create2D - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} The created canvas. - */ - var create2D = function (parent, width, height) - { - return create(parent, width, height, CONST.CANVAS); - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.createWebGL - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} The created WebGL canvas. - */ - var createWebGL = function (parent, width, height) - { - return create(parent, width, height, CONST.WEBGL); - }; - - /** - * Gets the first free canvas index from the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.first - * @since 3.0.0 - * - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * - * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases. - */ - var first = function (canvasType) - { - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - - if (canvasType === CONST.WEBGL) - { - return null; - } - - for (var i = 0; i < pool.length; i++) - { - var container = pool[i]; - - if (!container.parent && container.type === canvasType) - { - return container; - } - } - - return null; - }; - - /** - * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. - * The canvas has its width and height set to 1, and its parent attribute nulled. - * - * @function Phaser.Display.Canvas.CanvasPool.remove - * @since 3.0.0 - * - * @param {*} parent - The canvas or the parent of the canvas to free. - */ - var remove = function (parent) - { - // Check to see if the parent is a canvas object - var isCanvas = parent instanceof HTMLCanvasElement; - - pool.forEach(function (container) - { - if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) - { - container.parent = null; - container.canvas.width = 1; - container.canvas.height = 1; - } - }); - }; - - /** - * Gets the total number of used canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.total - * @since 3.0.0 - * - * @return {integer} The number of used canvases. - */ - var total = function () - { - var c = 0; - - pool.forEach(function (container) - { - if (container.parent) - { - c++; - } - }); - - return c; - }; - - /** - * Gets the total number of free canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.free - * @since 3.0.0 - * - * @return {integer} The number of free canvases. - */ - var free = function () - { - return pool.length - total(); - }; - - /** - * Disable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing - * @since 3.0.0 - */ - var disableSmoothing = function () - { - _disableContextSmoothing = true; - }; - - /** - * Enable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing - * @since 3.0.0 - */ - var enableSmoothing = function () - { - _disableContextSmoothing = false; - }; - - return { - create2D: create2D, - create: create, - createWebGL: createWebGL, - disableSmoothing: disableSmoothing, - enableSmoothing: enableSmoothing, - first: first, - free: free, - pool: pool, - remove: remove, - total: total - }; -}; - -// If we export the called function here, it'll only be invoked once (not every time it's required). -module.exports = CanvasPool(); - - -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var BlendModes = __webpack_require__(54); -var GetAdvancedValue = __webpack_require__(15); - -/** - * Builds a Game Object using the provided configuration object. - * - * @function Phaser.GameObjects.BuildGameObject - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - A reference to the Scene. - * @param {Phaser.GameObjects.GameObject} gameObject - The initial GameObject. - * @param {Phaser.Types.GameObjects.GameObjectConfig} config - The config to build the GameObject with. - * - * @return {Phaser.GameObjects.GameObject} The built Game Object. - */ -var BuildGameObject = function (scene, gameObject, config) -{ - // Position - - gameObject.x = GetAdvancedValue(config, 'x', 0); - gameObject.y = GetAdvancedValue(config, 'y', 0); - gameObject.depth = GetAdvancedValue(config, 'depth', 0); - - // Flip - - gameObject.flipX = GetAdvancedValue(config, 'flipX', false); - gameObject.flipY = GetAdvancedValue(config, 'flipY', false); - - // Scale - // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} - - var scale = GetAdvancedValue(config, 'scale', null); - - if (typeof scale === 'number') - { - gameObject.setScale(scale); - } - else if (scale !== null) - { - gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); - gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); - } - - // ScrollFactor - // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} - - var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); - - if (typeof scrollFactor === 'number') - { - gameObject.setScrollFactor(scrollFactor); - } - else if (scrollFactor !== null) - { - gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); - gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); - } - - // Rotation - - gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); - - var angle = GetAdvancedValue(config, 'angle', null); - - if (angle !== null) - { - gameObject.angle = angle; - } - - // Alpha - - gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); - - // Origin - // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} - - var origin = GetAdvancedValue(config, 'origin', null); - - if (typeof origin === 'number') - { - gameObject.setOrigin(origin); - } - else if (origin !== null) - { - var ox = GetAdvancedValue(origin, 'x', 0.5); - var oy = GetAdvancedValue(origin, 'y', 0.5); - - gameObject.setOrigin(ox, oy); - } - - // BlendMode - - gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); - - // Visible - - gameObject.visible = GetAdvancedValue(config, 'visible', true); - - // Add to Scene - - var add = GetAdvancedValue(config, 'add', true); - - if (add) - { - scene.sys.displayList.add(gameObject); - } - - if (gameObject.preUpdate) - { - scene.sys.updateList.add(gameObject); - } - - return gameObject; -}; - -module.exports = BuildGameObject; - - -/***/ }), -/* 28 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix - * and then performs the following steps: - * - * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. - * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. - * 3. Sets the blend mode of the context to be that used by the Game Object. - * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. - * 5. Saves the context state. - * 6. Sets the final matrix values into the context via setTransform. - * 7. If Renderer.antialias, or the frame.source.scaleMode is set, then imageSmoothingEnabled is set. - * - * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. - * - * @function Phaser.Renderer.Canvas.SetTransform - * @since 3.12.0 - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {CanvasRenderingContext2D} ctx - The canvas context to set the transform on. - * @param {Phaser.GameObjects.GameObject} src - The Game Object being rendered. Can be any type that extends the base class. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A parent transform matrix to apply to the Game Object before rendering. - * - * @return {boolean} `true` if the Game Object context was set, otherwise `false`. - */ -var SetTransform = function (renderer, ctx, src, camera, parentMatrix) -{ - var alpha = camera.alpha * src.alpha; - - if (alpha <= 0) - { - // Nothing to see, so don't waste time calculating stuff - return false; - } - - var camMatrix = renderer._tempMatrix1.copyFromArray(camera.matrix.matrix); - var gameObjectMatrix = renderer._tempMatrix2.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - var calcMatrix = renderer._tempMatrix3; - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - gameObjectMatrix.e = src.x; - gameObjectMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(gameObjectMatrix, calcMatrix); - } - else - { - gameObjectMatrix.e -= camera.scrollX * src.scrollFactorX; - gameObjectMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(gameObjectMatrix, calcMatrix); - } - - // Blend Mode - ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; - - // Alpha - ctx.globalAlpha = alpha; - - ctx.save(); - - calcMatrix.setToContext(ctx); - - ctx.imageSmoothingEnabled = !(!renderer.antialias || (src.frame && src.frame.source.scaleMode)); - - return true; -}; - -module.exports = SetTransform; - - -/***/ }), -/* 29 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -5727,330 +4909,33 @@ module.exports = SetTransform; */ /** - * @namespace Phaser.GameObjects.Events + * @namespace Phaser.Core.Events */ module.exports = { - ADDED_TO_SCENE: __webpack_require__(593), - DESTROY: __webpack_require__(594), - REMOVED_FROM_SCENE: __webpack_require__(595), - VIDEO_COMPLETE: __webpack_require__(596), - VIDEO_CREATED: __webpack_require__(597), - VIDEO_ERROR: __webpack_require__(598), - VIDEO_LOOP: __webpack_require__(599), - VIDEO_PLAY: __webpack_require__(600), - VIDEO_SEEKED: __webpack_require__(601), - VIDEO_SEEKING: __webpack_require__(602), - VIDEO_STOP: __webpack_require__(603), - VIDEO_TIMEOUT: __webpack_require__(604), - VIDEO_UNLOCKED: __webpack_require__(605) + BLUR: __webpack_require__(606), + BOOT: __webpack_require__(607), + CONTEXT_LOST: __webpack_require__(608), + CONTEXT_RESTORED: __webpack_require__(609), + DESTROY: __webpack_require__(610), + FOCUS: __webpack_require__(611), + HIDDEN: __webpack_require__(612), + PAUSE: __webpack_require__(613), + POST_RENDER: __webpack_require__(614), + POST_STEP: __webpack_require__(615), + PRE_RENDER: __webpack_require__(616), + PRE_STEP: __webpack_require__(617), + READY: __webpack_require__(618), + RESUME: __webpack_require__(619), + STEP: __webpack_require__(620), + VISIBLE: __webpack_require__(621) }; /***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(14); -var Line = __webpack_require__(40); - -/** - * @classdesc - * The Shape Game Object is a base class for the various different shapes, such as the Arc, Star or Polygon. - * You cannot add a Shape directly to your Scene, it is meant as a base for your own custom Shape classes. - * - * @class Shape - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 - * - * @extends Phaser.GameObjects.Components.AlphaSingle - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.ComputedSize - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {string} [type] - The internal type of the Shape. - * @param {any} [data] - The data of the source shape geometry, if any. - */ -var Shape = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.AlphaSingle, - Components.BlendMode, - Components.ComputedSize, - Components.Depth, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.Pipeline, - Components.ScrollFactor, - Components.Transform, - Components.Visible - ], - - initialize: - - function Shape (scene, type, data) - { - if (type === undefined) { type = 'Shape'; } - - GameObject.call(this, scene, type); - - /** - * The source Shape data. Typically a geometry object. - * You should not manipulate this directly. - * - * @name Phaser.GameObjects.Shape#geom - * @type {any} - * @readonly - * @since 3.13.0 - */ - this.geom = data; - - /** - * Holds the polygon path data for filled rendering. - * - * @name Phaser.GameObjects.Shape#pathData - * @type {number[]} - * @readonly - * @since 3.13.0 - */ - this.pathData = []; - - /** - * Holds the earcut polygon path index data for filled rendering. - * - * @name Phaser.GameObjects.Shape#pathIndexes - * @type {integer[]} - * @readonly - * @since 3.13.0 - */ - this.pathIndexes = []; - - /** - * The fill color used by this Shape. - * - * @name Phaser.GameObjects.Shape#fillColor - * @type {number} - * @since 3.13.0 - */ - this.fillColor = 0xffffff; - - /** - * The fill alpha value used by this Shape. - * - * @name Phaser.GameObjects.Shape#fillAlpha - * @type {number} - * @since 3.13.0 - */ - this.fillAlpha = 1; - - /** - * The stroke color used by this Shape. - * - * @name Phaser.GameObjects.Shape#strokeColor - * @type {number} - * @since 3.13.0 - */ - this.strokeColor = 0xffffff; - - /** - * The stroke alpha value used by this Shape. - * - * @name Phaser.GameObjects.Shape#strokeAlpha - * @type {number} - * @since 3.13.0 - */ - this.strokeAlpha = 1; - - /** - * The stroke line width used by this Shape. - * - * @name Phaser.GameObjects.Shape#lineWidth - * @type {number} - * @since 3.13.0 - */ - this.lineWidth = 1; - - /** - * Controls if this Shape is filled or not. - * Note that some Shapes do not support being filled (such as Line shapes) - * - * @name Phaser.GameObjects.Shape#isFilled - * @type {boolean} - * @since 3.13.0 - */ - this.isFilled = false; - - /** - * Controls if this Shape is stroked or not. - * Note that some Shapes do not support being stroked (such as Iso Box shapes) - * - * @name Phaser.GameObjects.Shape#isStroked - * @type {boolean} - * @since 3.13.0 - */ - this.isStroked = false; - - /** - * Controls if this Shape path is closed during rendering when stroked. - * Note that some Shapes are always closed when stroked (such as Ellipse shapes) - * - * @name Phaser.GameObjects.Shape#closePath - * @type {boolean} - * @since 3.13.0 - */ - this.closePath = true; - - /** - * Private internal value. - * A Line used when parsing internal path data to avoid constant object re-creation. - * - * @name Phaser.GameObjects.Curve#_tempLine - * @type {Phaser.Geom.Line} - * @private - * @since 3.13.0 - */ - this._tempLine = new Line(); - - this.initPipeline(); - }, - - /** - * Sets the fill color and alpha for this Shape. - * - * If you wish for the Shape to not be filled then call this method with no arguments, or just set `isFilled` to `false`. - * - * Note that some Shapes do not support fill colors, such as the Line shape. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Shape#setFillStyle - * @since 3.13.0 - * - * @param {number} [color] - The color used to fill this shape. If not provided the Shape will not be filled. - * @param {number} [alpha=1] - The alpha value used when filling this shape, if a fill color is given. - * - * @return {this} This Game Object instance. - */ - setFillStyle: function (color, alpha) - { - if (alpha === undefined) { alpha = 1; } - - if (color === undefined) - { - this.isFilled = false; - } - else - { - this.fillColor = color; - this.fillAlpha = alpha; - this.isFilled = true; - } - - return this; - }, - - /** - * Sets the stroke color and alpha for this Shape. - * - * If you wish for the Shape to not be stroked then call this method with no arguments, or just set `isStroked` to `false`. - * - * Note that some Shapes do not support being stroked, such as the Iso Box shape. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Shape#setStrokeStyle - * @since 3.13.0 - * - * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked. - * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked. - * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given. - * - * @return {this} This Game Object instance. - */ - setStrokeStyle: function (lineWidth, color, alpha) - { - if (alpha === undefined) { alpha = 1; } - - if (lineWidth === undefined) - { - this.isStroked = false; - } - else - { - this.lineWidth = lineWidth; - this.strokeColor = color; - this.strokeAlpha = alpha; - this.isStroked = true; - } - - return this; - }, - - /** - * Sets if this Shape path is closed during rendering when stroked. - * Note that some Shapes are always closed when stroked (such as Ellipse shapes) - * - * This call can be chained. - * - * @method Phaser.GameObjects.Shape#setClosePath - * @since 3.13.0 - * - * @param {boolean} value - Set to `true` if the Shape should be closed when stroked, otherwise `false`. - * - * @return {this} This Game Object instance. - */ - setClosePath: function (value) - { - this.closePath = value; - - return this; - }, - - /** - * Internal destroy handler, called as part of the destroy process. - * - * @method Phaser.GameObjects.Shape#preDestroy - * @protected - * @since 3.13.0 - */ - preDestroy: function () - { - this.geom = null; - this._tempLine = null; - this.pathData = []; - this.pathIndexes = []; - } - -}); - -module.exports = Shape; - - -/***/ }), -/* 31 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -7069,10 +5954,947 @@ var TransformMatrix = new Class({ module.exports = TransformMatrix; +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Contains the plugins that Phaser uses globally and locally. +// These are the source objects, not instantiated. +var corePlugins = {}; + +// Contains the plugins that the dev has loaded into their game +// These are the source objects, not instantiated. +var customPlugins = {}; + +var PluginCache = {}; + +/** + * @namespace Phaser.Plugins.PluginCache + */ + +/** + * Static method called directly by the Core internal Plugins. + * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) + * Plugin is the object to instantiate to create the plugin + * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) + * + * @method Phaser.Plugins.PluginCache.register + * @since 3.8.0 + * + * @param {string} key - A reference used to get this plugin from the plugin cache. + * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. + * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @param {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin? + */ +PluginCache.register = function (key, plugin, mapping, custom) +{ + if (custom === undefined) { custom = false; } + + corePlugins[key] = { plugin: plugin, mapping: mapping, custom: custom }; +}; + +/** + * Stores a custom plugin in the global plugin cache. + * The key must be unique, within the scope of the cache. + * + * @method Phaser.Plugins.PluginCache.registerCustom + * @since 3.8.0 + * + * @param {string} key - A reference used to get this plugin from the plugin cache. + * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. + * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @param {?any} data - A value to be passed to the plugin's `init` method. + */ +PluginCache.registerCustom = function (key, plugin, mapping, data) +{ + customPlugins[key] = { plugin: plugin, mapping: mapping, data: data }; +}; + +/** + * Checks if the given key is already being used in the core plugin cache. + * + * @method Phaser.Plugins.PluginCache.hasCore + * @since 3.8.0 + * + * @param {string} key - The key to check for. + * + * @return {boolean} `true` if the key is already in use in the core cache, otherwise `false`. + */ +PluginCache.hasCore = function (key) +{ + return corePlugins.hasOwnProperty(key); +}; + +/** + * Checks if the given key is already being used in the custom plugin cache. + * + * @method Phaser.Plugins.PluginCache.hasCustom + * @since 3.8.0 + * + * @param {string} key - The key to check for. + * + * @return {boolean} `true` if the key is already in use in the custom cache, otherwise `false`. + */ +PluginCache.hasCustom = function (key) +{ + return customPlugins.hasOwnProperty(key); +}; + +/** + * Returns the core plugin object from the cache based on the given key. + * + * @method Phaser.Plugins.PluginCache.getCore + * @since 3.8.0 + * + * @param {string} key - The key of the core plugin to get. + * + * @return {Phaser.Types.Plugins.CorePluginContainer} The core plugin object. + */ +PluginCache.getCore = function (key) +{ + return corePlugins[key]; +}; + +/** + * Returns the custom plugin object from the cache based on the given key. + * + * @method Phaser.Plugins.PluginCache.getCustom + * @since 3.8.0 + * + * @param {string} key - The key of the custom plugin to get. + * + * @return {Phaser.Types.Plugins.CustomPluginContainer} The custom plugin object. + */ +PluginCache.getCustom = function (key) +{ + return customPlugins[key]; +}; + +/** + * Returns an object from the custom cache based on the given key that can be instantiated. + * + * @method Phaser.Plugins.PluginCache.getCustomClass + * @since 3.8.0 + * + * @param {string} key - The key of the custom plugin to get. + * + * @return {function} The custom plugin object. + */ +PluginCache.getCustomClass = function (key) +{ + return (customPlugins.hasOwnProperty(key)) ? customPlugins[key].plugin : null; +}; + +/** + * Removes a core plugin based on the given key. + * + * @method Phaser.Plugins.PluginCache.remove + * @since 3.8.0 + * + * @param {string} key - The key of the core plugin to remove. + */ +PluginCache.remove = function (key) +{ + if (corePlugins.hasOwnProperty(key)) + { + delete corePlugins[key]; + } +}; + +/** + * Removes a custom plugin based on the given key. + * + * @method Phaser.Plugins.PluginCache.removeCustom + * @since 3.8.0 + * + * @param {string} key - The key of the custom plugin to remove. + */ +PluginCache.removeCustom = function (key) +{ + if (customPlugins.hasOwnProperty(key)) + { + delete customPlugins[key]; + } +}; + +/** + * Removes all Core Plugins. + * + * This includes all of the internal system plugins that Phaser needs, like the Input Plugin and Loader Plugin. + * So be sure you only call this if you do not wish to run Phaser again. + * + * @method Phaser.Plugins.PluginCache.destroyCorePlugins + * @since 3.12.0 + */ +PluginCache.destroyCorePlugins = function () +{ + for (var key in corePlugins) + { + if (corePlugins.hasOwnProperty(key)) + { + delete corePlugins[key]; + } + } +}; + +/** + * Removes all Custom Plugins. + * + * @method Phaser.Plugins.PluginCache.destroyCustomPlugins + * @since 3.12.0 + */ +PluginCache.destroyCustomPlugins = function () +{ + for (var key in customPlugins) + { + if (customPlugins.hasOwnProperty(key)) + { + delete customPlugins[key]; + } + } +}; + +module.exports = PluginCache; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetFastValue = __webpack_require__(2); + +/** + * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. + * + * @function Phaser.Tilemaps.Components.GetTilesWithin + * @since 3.0.0 + * + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + */ +var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) +{ + if (tileX === undefined) { tileX = 0; } + if (tileY === undefined) { tileY = 0; } + if (width === undefined) { width = layer.width; } + if (height === undefined) { height = layer.height; } + if (!filteringOptions) { filteringOptions = {}; } + + var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); + var isColliding = GetFastValue(filteringOptions, 'isColliding', false); + var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); + + // Clip x, y to top left of map, while shrinking width/height to match. + if (tileX < 0) + { + width += tileX; + tileX = 0; + } + + if (tileY < 0) + { + height += tileY; + tileY = 0; + } + + // Clip width and height to bottom right of map. + if (tileX + width > layer.width) + { + width = Math.max(layer.width - tileX, 0); + } + + if (tileY + height > layer.height) + { + height = Math.max(layer.height - tileY, 0); + } + + var results = []; + + for (var ty = tileY; ty < tileY + height; ty++) + { + for (var tx = tileX; tx < tileX + width; tx++) + { + var tile = layer.data[ty][tx]; + + if (tile !== null) + { + if (isNotEmpty && tile.index === -1) + { + continue; + } + + if (isColliding && !tile.collides) + { + continue; + } + + if (hasInterestingFace && !tile.hasInterestingFace) + { + continue; + } + + results.push(tile); + } + } + } + + return results; +}; + +module.exports = GetTilesWithin; + + +/***/ }), +/* 27 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `PropertyValueSet(group.getChildren(), key, value, step)` + * + * @function Phaser.Actions.PropertyValueSet + * @since 3.3.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {string} key - The property to be updated. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var PropertyValueSet = function (items, key, value, step, index, direction) +{ + if (step === undefined) { step = 0; } + if (index === undefined) { index = 0; } + if (direction === undefined) { direction = 1; } + + var i; + var t = 0; + var end = items.length; + + if (direction === 1) + { + // Start to End + for (i = index; i < end; i++) + { + items[i][key] = value + (t * step); + t++; + } + } + else + { + // End to Start + for (i = index; i >= 0; i--) + { + items[i][key] = value + (t * step); + t++; + } + } + + return items; +}; + +module.exports = PropertyValueSet; + + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BlendModes = __webpack_require__(48); +var GetAdvancedValue = __webpack_require__(15); + +/** + * Builds a Game Object using the provided configuration object. + * + * @function Phaser.GameObjects.BuildGameObject + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - A reference to the Scene. + * @param {Phaser.GameObjects.GameObject} gameObject - The initial GameObject. + * @param {Phaser.Types.GameObjects.GameObjectConfig} config - The config to build the GameObject with. + * + * @return {Phaser.GameObjects.GameObject} The built Game Object. + */ +var BuildGameObject = function (scene, gameObject, config) +{ + // Position + + gameObject.x = GetAdvancedValue(config, 'x', 0); + gameObject.y = GetAdvancedValue(config, 'y', 0); + gameObject.depth = GetAdvancedValue(config, 'depth', 0); + + // Flip + + gameObject.flipX = GetAdvancedValue(config, 'flipX', false); + gameObject.flipY = GetAdvancedValue(config, 'flipY', false); + + // Scale + // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} + + var scale = GetAdvancedValue(config, 'scale', null); + + if (typeof scale === 'number') + { + gameObject.setScale(scale); + } + else if (scale !== null) + { + gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); + gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); + } + + // ScrollFactor + // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} + + var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); + + if (typeof scrollFactor === 'number') + { + gameObject.setScrollFactor(scrollFactor); + } + else if (scrollFactor !== null) + { + gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); + gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); + } + + // Rotation + + gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); + + var angle = GetAdvancedValue(config, 'angle', null); + + if (angle !== null) + { + gameObject.angle = angle; + } + + // Alpha + + gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); + + // Origin + // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} + + var origin = GetAdvancedValue(config, 'origin', null); + + if (typeof origin === 'number') + { + gameObject.setOrigin(origin); + } + else if (origin !== null) + { + var ox = GetAdvancedValue(origin, 'x', 0.5); + var oy = GetAdvancedValue(origin, 'y', 0.5); + + gameObject.setOrigin(ox, oy); + } + + // BlendMode + + gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); + + // Visible + + gameObject.visible = GetAdvancedValue(config, 'visible', true); + + // Add to Scene + + var add = GetAdvancedValue(config, 'add', true); + + if (add) + { + scene.sys.displayList.add(gameObject); + } + + if (gameObject.preUpdate) + { + scene.sys.updateList.add(gameObject); + } + + return gameObject; +}; + +module.exports = BuildGameObject; + + +/***/ }), +/* 29 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Phaser Tilemap constants for orientation. + * + * @namespace Phaser.Tilemaps.Orientation + * @memberof Phaser.Tilemaps + * @since 3.50.0 + */ + +/** + * Phaser Tilemap constants for orientation. + * + * To find out what each mode does please see [Phaser.Tilemaps.Orientation]{@link Phaser.Tilemaps.Orientation}. + * + * @typedef {Phaser.Tilemaps.Orientation} Phaser.Tilemaps.OrientationType + * @memberof Phaser.Tilemaps + * @since 3.50.0 + */ + +module.exports = { + + /** + * Orthogonal Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.ORTHOGONAL + * @type {number} + * @const + * @since 3.50.0 + */ + ORTHOGONAL: 0, + + /** + * Isometric Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.ISOMETRIC + * @type {number} + * @const + * @since 3.50.0 + */ + ISOMETRIC: 1, + + /** + * Staggered Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.STAGGERED + * @type {number} + * @const + * @since 3.50.0 + */ + STAGGERED: 2, + + /** + * Hexagonal Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.HEXAGONAL + * @type {number} + * @const + * @since 3.50.0 + */ + HEXAGONAL: 3 + +}; + + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetCalcMatrix = __webpack_require__(21); + +/** + * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix + * and then performs the following steps: + * + * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. + * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. + * 3. Sets the blend mode of the context to be that used by the Game Object. + * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. + * 5. Saves the context state. + * 6. Sets the final matrix values into the context via setTransform. + * 7. If Renderer.antialias, or the frame.source.scaleMode is set, then imageSmoothingEnabled is set. + * + * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. + * + * @function Phaser.Renderer.Canvas.SetTransform + * @since 3.12.0 + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {CanvasRenderingContext2D} ctx - The canvas context to set the transform on. + * @param {Phaser.GameObjects.GameObject} src - The Game Object being rendered. Can be any type that extends the base class. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A parent transform matrix to apply to the Game Object before rendering. + * + * @return {boolean} `true` if the Game Object context was set, otherwise `false`. + */ +var SetTransform = function (renderer, ctx, src, camera, parentMatrix) +{ + var alpha = camera.alpha * src.alpha; + + if (alpha <= 0) + { + // Nothing to see, so don't waste time calculating stuff + return false; + } + + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + // Blend Mode + ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; + + // Alpha + ctx.globalAlpha = alpha; + + ctx.save(); + + calcMatrix.setToContext(ctx); + + ctx.imageSmoothingEnabled = !(!renderer.antialias || (src.frame && src.frame.source.scaleMode)); + + return true; +}; + +module.exports = SetTransform; + + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(39); +var Smoothing = __webpack_require__(184); + +// The pool into which the canvas elements are placed. +var pool = []; + +// Automatically apply smoothing(false) to created Canvas elements +var _disableContextSmoothing = false; + +/** + * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. + * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, + * which is useless for some of the Phaser pipelines / renderer. + * + * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. + * Which means all instances of Phaser Games on the same page can share the one single pool. + * + * @namespace Phaser.Display.Canvas.CanvasPool + * @since 3.0.0 + */ +var CanvasPool = function () +{ + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {number} [width=1] - The width of the Canvas. + * @param {number} [height=1] - The height of the Canvas. + * @param {number} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? + * + * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool + */ + var create = function (parent, width, height, canvasType, selfParent) + { + if (width === undefined) { width = 1; } + if (height === undefined) { height = 1; } + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + if (selfParent === undefined) { selfParent = false; } + + var canvas; + var container = first(canvasType); + + if (container === null) + { + container = { + parent: parent, + canvas: document.createElement('canvas'), + type: canvasType + }; + + if (canvasType === CONST.CANVAS) + { + pool.push(container); + } + + canvas = container.canvas; + } + else + { + container.parent = parent; + + canvas = container.canvas; + } + + if (selfParent) + { + container.parent = canvas; + } + + canvas.width = width; + canvas.height = height; + + if (_disableContextSmoothing && canvasType === CONST.CANVAS) + { + Smoothing.disable(canvas.getContext('2d')); + } + + return canvas; + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create2D + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {number} [width=1] - The width of the Canvas. + * @param {number} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created canvas. + */ + var create2D = function (parent, width, height) + { + return create(parent, width, height, CONST.CANVAS); + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.createWebGL + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {number} [width=1] - The width of the Canvas. + * @param {number} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created WebGL canvas. + */ + var createWebGL = function (parent, width, height) + { + return create(parent, width, height, CONST.WEBGL); + }; + + /** + * Gets the first free canvas index from the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.first + * @since 3.0.0 + * + * @param {number} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * + * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases. + */ + var first = function (canvasType) + { + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + + if (canvasType === CONST.WEBGL) + { + return null; + } + + for (var i = 0; i < pool.length; i++) + { + var container = pool[i]; + + if (!container.parent && container.type === canvasType) + { + return container; + } + } + + return null; + }; + + /** + * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. + * The canvas has its width and height set to 1, and its parent attribute nulled. + * + * @function Phaser.Display.Canvas.CanvasPool.remove + * @since 3.0.0 + * + * @param {*} parent - The canvas or the parent of the canvas to free. + */ + var remove = function (parent) + { + // Check to see if the parent is a canvas object + var isCanvas = parent instanceof HTMLCanvasElement; + + pool.forEach(function (container) + { + if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) + { + container.parent = null; + container.canvas.width = 1; + container.canvas.height = 1; + } + }); + }; + + /** + * Gets the total number of used canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.total + * @since 3.0.0 + * + * @return {number} The number of used canvases. + */ + var total = function () + { + var c = 0; + + pool.forEach(function (container) + { + if (container.parent) + { + c++; + } + }); + + return c; + }; + + /** + * Gets the total number of free canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.free + * @since 3.0.0 + * + * @return {number} The number of free canvases. + */ + var free = function () + { + return pool.length - total(); + }; + + /** + * Disable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing + * @since 3.0.0 + */ + var disableSmoothing = function () + { + _disableContextSmoothing = true; + }; + + /** + * Enable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing + * @since 3.0.0 + */ + var enableSmoothing = function () + { + _disableContextSmoothing = false; + }; + + return { + create2D: create2D, + create: create, + createWebGL: createWebGL, + disableSmoothing: disableSmoothing, + enableSmoothing: enableSmoothing, + first: first, + free: free, + pool: pool, + remove: remove, + total: total + }; +}; + +// If we export the called function here, it'll only be invoked once (not every time it's required). +module.exports = CanvasPool(); + + /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Events + */ + +module.exports = { + + ADDED_TO_SCENE: __webpack_require__(633), + DESTROY: __webpack_require__(634), + REMOVED_FROM_SCENE: __webpack_require__(635), + VIDEO_COMPLETE: __webpack_require__(636), + VIDEO_CREATED: __webpack_require__(637), + VIDEO_ERROR: __webpack_require__(638), + VIDEO_LOOP: __webpack_require__(639), + VIDEO_PLAY: __webpack_require__(640), + VIDEO_SEEKED: __webpack_require__(641), + VIDEO_SEEKING: __webpack_require__(642), + VIDEO_STOP: __webpack_require__(643), + VIDEO_TIMEOUT: __webpack_require__(644), + VIDEO_UNLOCKED: __webpack_require__(645) + +}; + + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + /** * @author Richard Davey * @copyright 2020 Photon Storm Ltd. @@ -7080,10 +6902,481 @@ module.exports = TransformMatrix; */ var Class = __webpack_require__(0); -var GetColor = __webpack_require__(175); -var GetColor32 = __webpack_require__(308); -var HSVToRGB = __webpack_require__(176); -var RGBToHSV = __webpack_require__(309); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(14); +var Line = __webpack_require__(45); +var PIPELINES_CONST = __webpack_require__(82); + +/** + * @classdesc + * The Shape Game Object is a base class for the various different shapes, such as the Arc, Star or Polygon. + * You cannot add a Shape directly to your Scene, it is meant as a base for your own custom Shape classes. + * + * @class Shape + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {string} [type] - The internal type of the Shape. + * @param {any} [data] - The data of the source shape geometry, if any. + */ +var Shape = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.ScrollFactor, + Components.Transform, + Components.Visible + ], + + initialize: + + function Shape (scene, type, data) + { + if (type === undefined) { type = 'Shape'; } + + GameObject.call(this, scene, type); + + /** + * The source Shape data. Typically a geometry object. + * You should not manipulate this directly. + * + * @name Phaser.GameObjects.Shape#geom + * @type {any} + * @readonly + * @since 3.13.0 + */ + this.geom = data; + + /** + * Holds the polygon path data for filled rendering. + * + * @name Phaser.GameObjects.Shape#pathData + * @type {number[]} + * @readonly + * @since 3.13.0 + */ + this.pathData = []; + + /** + * Holds the earcut polygon path index data for filled rendering. + * + * @name Phaser.GameObjects.Shape#pathIndexes + * @type {number[]} + * @readonly + * @since 3.13.0 + */ + this.pathIndexes = []; + + /** + * The fill color used by this Shape. + * + * @name Phaser.GameObjects.Shape#fillColor + * @type {number} + * @since 3.13.0 + */ + this.fillColor = 0xffffff; + + /** + * The fill alpha value used by this Shape. + * + * @name Phaser.GameObjects.Shape#fillAlpha + * @type {number} + * @since 3.13.0 + */ + this.fillAlpha = 1; + + /** + * The stroke color used by this Shape. + * + * @name Phaser.GameObjects.Shape#strokeColor + * @type {number} + * @since 3.13.0 + */ + this.strokeColor = 0xffffff; + + /** + * The stroke alpha value used by this Shape. + * + * @name Phaser.GameObjects.Shape#strokeAlpha + * @type {number} + * @since 3.13.0 + */ + this.strokeAlpha = 1; + + /** + * The stroke line width used by this Shape. + * + * @name Phaser.GameObjects.Shape#lineWidth + * @type {number} + * @since 3.13.0 + */ + this.lineWidth = 1; + + /** + * Controls if this Shape is filled or not. + * Note that some Shapes do not support being filled (such as Line shapes) + * + * @name Phaser.GameObjects.Shape#isFilled + * @type {boolean} + * @since 3.13.0 + */ + this.isFilled = false; + + /** + * Controls if this Shape is stroked or not. + * Note that some Shapes do not support being stroked (such as Iso Box shapes) + * + * @name Phaser.GameObjects.Shape#isStroked + * @type {boolean} + * @since 3.13.0 + */ + this.isStroked = false; + + /** + * Controls if this Shape path is closed during rendering when stroked. + * Note that some Shapes are always closed when stroked (such as Ellipse shapes) + * + * @name Phaser.GameObjects.Shape#closePath + * @type {boolean} + * @since 3.13.0 + */ + this.closePath = true; + + /** + * Private internal value. + * A Line used when parsing internal path data to avoid constant object re-creation. + * + * @name Phaser.GameObjects.Shape#_tempLine + * @type {Phaser.Geom.Line} + * @private + * @since 3.13.0 + */ + this._tempLine = new Line(); + + /** + * The native (un-scaled) width of this Game Object. + * + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayWidth` property. + * + * @name Phaser.GameObjects.Shape#width + * @type {number} + * @since 3.13.0 + */ + this.width = 0; + + /** + * The native (un-scaled) height of this Game Object. + * + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayHeight` property. + * + * @name Phaser.GameObjects.Shape#height + * @type {number} + * @since 3.0.0 + */ + this.height = 0; + + this.initPipeline(PIPELINES_CONST.GRAPHICS_PIPELINE); + }, + + /** + * Sets the fill color and alpha for this Shape. + * + * If you wish for the Shape to not be filled then call this method with no arguments, or just set `isFilled` to `false`. + * + * Note that some Shapes do not support fill colors, such as the Line shape. + * + * This call can be chained. + * + * @method Phaser.GameObjects.Shape#setFillStyle + * @since 3.13.0 + * + * @param {number} [color] - The color used to fill this shape. If not provided the Shape will not be filled. + * @param {number} [alpha=1] - The alpha value used when filling this shape, if a fill color is given. + * + * @return {this} This Game Object instance. + */ + setFillStyle: function (color, alpha) + { + if (alpha === undefined) { alpha = 1; } + + if (color === undefined) + { + this.isFilled = false; + } + else + { + this.fillColor = color; + this.fillAlpha = alpha; + this.isFilled = true; + } + + return this; + }, + + /** + * Sets the stroke color and alpha for this Shape. + * + * If you wish for the Shape to not be stroked then call this method with no arguments, or just set `isStroked` to `false`. + * + * Note that some Shapes do not support being stroked, such as the Iso Box shape. + * + * This call can be chained. + * + * @method Phaser.GameObjects.Shape#setStrokeStyle + * @since 3.13.0 + * + * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked. + * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked. + * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given. + * + * @return {this} This Game Object instance. + */ + setStrokeStyle: function (lineWidth, color, alpha) + { + if (alpha === undefined) { alpha = 1; } + + if (lineWidth === undefined) + { + this.isStroked = false; + } + else + { + this.lineWidth = lineWidth; + this.strokeColor = color; + this.strokeAlpha = alpha; + this.isStroked = true; + } + + return this; + }, + + /** + * Sets if this Shape path is closed during rendering when stroked. + * Note that some Shapes are always closed when stroked (such as Ellipse shapes) + * + * This call can be chained. + * + * @method Phaser.GameObjects.Shape#setClosePath + * @since 3.13.0 + * + * @param {boolean} value - Set to `true` if the Shape should be closed when stroked, otherwise `false`. + * + * @return {this} This Game Object instance. + */ + setClosePath: function (value) + { + this.closePath = value; + + return this; + }, + + /** + * Sets the internal size of this Game Object, as used for frame or physics body creation. + * + * This will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or call the + * `setDisplaySize` method, which is the same thing as changing the scale but allows you + * to do so by giving pixel values. + * + * If you have enabled this Game Object for input, changing the size will _not_ change the + * size of the hit area. To do this you should adjust the `input.hitArea` object directly. + * + * @method Phaser.GameObjects.Shape#setSize + * @private + * @since 3.13.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {this} This Game Object instance. + */ + setSize: function (width, height) + { + this.width = width; + this.height = height; + + return this; + }, + + /** + * Internal destroy handler, called as part of the destroy process. + * + * @method Phaser.GameObjects.Shape#preDestroy + * @protected + * @since 3.13.0 + */ + preDestroy: function () + { + this.geom = null; + this._tempLine = null; + this.pathData = []; + this.pathIndexes = []; + }, + + /** + * The displayed width of this Game Object. + * + * This value takes into account the scale factor. + * + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.Shape#displayWidth + * @type {number} + * @since 3.13.0 + */ + displayWidth: { + + get: function () + { + return this.scaleX * this.width; + }, + + set: function (value) + { + this.scaleX = value / this.width; + } + + }, + + /** + * The displayed height of this Game Object. + * + * This value takes into account the scale factor. + * + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.Shape#displayHeight + * @type {number} + * @since 3.13.0 + */ + displayHeight: { + + get: function () + { + return this.scaleY * this.height; + }, + + set: function (value) + { + this.scaleY = value / this.height; + } + + } + +}); + +module.exports = Shape; + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(13); + +/** + * Convert the given angle from degrees, to the equivalent angle in radians. + * + * @function Phaser.Math.DegToRad + * @since 3.0.0 + * + * @param {number} degrees - The angle (in degrees) to convert to radians. + * + * @return {number} The given angle converted to radians. + */ +var DegToRad = function (degrees) +{ + return degrees * CONST.DEG_TO_RAD; +}; + +module.exports = DegToRad; + + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Cameras.Scene2D.Events + */ + +module.exports = { + + DESTROY: __webpack_require__(711), + FADE_IN_COMPLETE: __webpack_require__(712), + FADE_IN_START: __webpack_require__(713), + FADE_OUT_COMPLETE: __webpack_require__(714), + FADE_OUT_START: __webpack_require__(715), + FLASH_COMPLETE: __webpack_require__(716), + FLASH_START: __webpack_require__(717), + FOLLOW_UPDATE: __webpack_require__(718), + PAN_COMPLETE: __webpack_require__(719), + PAN_START: __webpack_require__(720), + POST_RENDER: __webpack_require__(721), + PRE_RENDER: __webpack_require__(722), + ROTATE_COMPLETE: __webpack_require__(723), + ROTATE_START: __webpack_require__(724), + SHAKE_COMPLETE: __webpack_require__(725), + SHAKE_START: __webpack_require__(726), + ZOOM_COMPLETE: __webpack_require__(727), + ZOOM_START: __webpack_require__(728) + +}; + + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var GetColor = __webpack_require__(100); +var GetColor32 = __webpack_require__(320); +var HSVToRGB = __webpack_require__(180); +var RGBToHSV = __webpack_require__(321); /** * @namespace Phaser.Display.Color @@ -7098,10 +7391,10 @@ var RGBToHSV = __webpack_require__(309); * @constructor * @since 3.0.0 * - * @param {integer} [red=0] - The red color value. A number between 0 and 255. - * @param {integer} [green=0] - The green color value. A number between 0 and 255. - * @param {integer} [blue=0] - The blue color value. A number between 0 and 255. - * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255. + * @param {number} [red=0] - The red color value. A number between 0 and 255. + * @param {number} [green=0] - The green color value. A number between 0 and 255. + * @param {number} [blue=0] - The blue color value. A number between 0 and 255. + * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. */ var Color = new Class({ @@ -7277,10 +7570,10 @@ var Color = new Class({ * @method Phaser.Display.Color#setTo * @since 3.0.0 * - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255. + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. * @param {boolean} [updateHSV=true] - Update the HSV values after setting the RGB values? * * @return {Phaser.Display.Color} This Color object. @@ -7450,7 +7743,7 @@ var Color = new Class({ * @method Phaser.Display.Color#gray * @since 3.13.0 * - * @param {integer} shade - A value between 0 and 255. + * @param {number} shade - A value between 0 and 255. * * @return {Phaser.Display.Color} This Color object. */ @@ -7465,8 +7758,8 @@ var Color = new Class({ * @method Phaser.Display.Color#random * @since 3.13.0 * - * @param {integer} [min=0] - The minimum random color value. Between 0 and 255. - * @param {integer} [max=255] - The maximum random color value. Between 0 and 255. + * @param {number} [min=0] - The minimum random color value. Between 0 and 255. + * @param {number} [max=255] - The maximum random color value. Between 0 and 255. * * @return {Phaser.Display.Color} This Color object. */ @@ -7488,8 +7781,8 @@ var Color = new Class({ * @method Phaser.Display.Color#randomGray * @since 3.13.0 * - * @param {integer} [min=0] - The minimum random color value. Between 0 and 255. - * @param {integer} [max=255] - The maximum random color value. Between 0 and 255. + * @param {number} [min=0] - The minimum random color value. Between 0 and 255. + * @param {number} [max=255] - The maximum random color value. Between 0 and 255. * * @return {Phaser.Display.Color} This Color object. */ @@ -7510,7 +7803,7 @@ var Color = new Class({ * @method Phaser.Display.Color#saturate * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7528,7 +7821,7 @@ var Color = new Class({ * @method Phaser.Display.Color#desaturate * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7545,7 +7838,7 @@ var Color = new Class({ * @method Phaser.Display.Color#lighten * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7562,7 +7855,7 @@ var Color = new Class({ * @method Phaser.Display.Color#darken * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7579,7 +7872,7 @@ var Color = new Class({ * @method Phaser.Display.Color#brighten * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7933,7 +8226,1053 @@ module.exports = Color; /***/ }), -/* 33 */ +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + +var Class = __webpack_require__(0); + +/** + * @classdesc + * A representation of a vector in 3D space. + * + * A three-component vector. + * + * @class Vector3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + */ +var Vector3 = new Class({ + + initialize: + + function Vector3 (x, y, z) + { + /** + * The x component of this Vector. + * + * @name Phaser.Math.Vector3#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector3#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector3#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + }, + + /** + * Set this Vector to point up. + * + * Sets the y component of the vector to 1, and the others to 0. + * + * @method Phaser.Math.Vector3#up + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + up: function () + { + this.x = 0; + this.y = 1; + this.z = 0; + + return this; + }, + + /** + * Sets the components of this Vector to be the `Math.min` result from the given vector. + * + * @method Phaser.Math.Vector3#min + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to check the minimum values against. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + min: function (v) + { + this.x = Math.min(this.x, v.x); + this.y = Math.min(this.y, v.y); + this.z = Math.min(this.z, v.z); + + return this; + }, + + /** + * Sets the components of this Vector to be the `Math.max` result from the given vector. + * + * @method Phaser.Math.Vector3#max + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to check the maximum values against. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + max: function (v) + { + this.x = Math.max(this.x, v.x); + this.y = Math.max(this.y, v.y); + this.z = Math.max(this.z, v.z); + + return this; + }, + + /** + * Make a clone of this Vector3. + * + * @method Phaser.Math.Vector3#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. + */ + clone: function () + { + return new Vector3(this.x, this.y, this.z); + }, + + /** + * Adds the two given Vector3s and sets the results into this Vector3. + * + * @method Phaser.Math.Vector3#addVectors + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} a - The first Vector to add. + * @param {Phaser.Math.Vector3} b - The second Vector to add. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + addVectors: function (a, b) + { + this.x = a.x + b.x; + this.y = a.y + b.y; + this.z = a.z + b.z; + + return this; + }, + + /** + * Calculate the cross (vector) product of two given Vectors. + * + * @method Phaser.Math.Vector3#crossVectors + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} a - The first Vector to multiply. + * @param {Phaser.Math.Vector3} b - The second Vector to multiply. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + crossVectors: function (a, b) + { + var ax = a.x; + var ay = a.y; + var az = a.z; + var bx = b.x; + var by = b.y; + var bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Check whether this Vector is equal to a given Vector. + * + * Performs a strict equality check against each Vector's components. + * + * @method Phaser.Math.Vector3#equals + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. + * + * @return {boolean} True if the two vectors strictly match, otherwise false. + */ + equals: function (v) + { + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); + }, + + /** + * Copy the components of a given Vector into this Vector. + * + * @method Phaser.Math.Vector3#copy + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + + return this; + }, + + /** + * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. + * + * @method Phaser.Math.Vector3#set + * @since 3.0.0 + * + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. + * @param {number} [y] - The y value to set for this Vector. + * @param {number} [z] - The z value to set for this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + set: function (x, y, z) + { + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + + return this; + }, + + /** + * Sets the components of this Vector3 from the position of the given Matrix4. + * + * @method Phaser.Math.Vector3#setFromMatrixPosition + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to get the position from. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + setFromMatrixPosition: function (m) + { + return this.fromArray(m.val, 12); + }, + + /** + * Sets the components of this Vector3 from the Matrix4 column specified. + * + * @method Phaser.Math.Vector3#setFromMatrixColumn + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to get the column from. + * @param {number} index - The column index. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + setFromMatrixColumn: function (mat4, index) + { + return this.fromArray(mat4.val, index * 4); + }, + + /** + * Sets the components of this Vector3 from the given array, based on the offset. + * + * Vector3.x = array[offset] + * Vector3.y = array[offset + 1] + * Vector3.z = array[offset + 2] + * + * @method Phaser.Math.Vector3#fromArray + * @since 3.50.0 + * + * @param {number[]} array - The array of values to get this Vector from. + * @param {number} [offset=0] - The offset index into the array. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + fromArray: function (array, offset) + { + if (offset === undefined) { offset = 0; } + + this.x = array[offset]; + this.y = array[offset + 1]; + this.z = array[offset + 2]; + + return this; + }, + + /** + * Add a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector3#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + + return this; + }, + + /** + * Add the given value to each component of this Vector. + * + * @method Phaser.Math.Vector3#addScalar + * @since 3.50.0 + * + * @param {number} s - The amount to add to this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + addScalar: function (s) + { + this.x += s; + this.y += s; + this.z += s; + + return this; + }, + + /** + * Add and scale a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector3#addScale + * @since 3.50.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. + * @param {number} scale - The amount to scale `v` by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + addScale: function (v, scale) + { + this.x += v.x * scale; + this.y += v.y * scale; + this.z += v.z * scale || 0; + + return this; + }, + + /** + * Subtract the given Vector from this Vector. Subtraction is component-wise. + * + * @method Phaser.Math.Vector3#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + + return this; + }, + + /** + * Perform a component-wise multiplication between this Vector and the given Vector. + * + * Multiplies this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + multiply: function (v) + { + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + + return this; + }, + + /** + * Scale this Vector by the given value. + * + * @method Phaser.Math.Vector3#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + scale: function (scale) + { + if (isFinite(scale)) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + } + else + { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + /** + * Perform a component-wise division between this Vector and the given Vector. + * + * Divides this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#divide + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + divide: function (v) + { + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + + return this; + }, + + /** + * Negate the `x`, `y` and `z` components of this Vector. + * + * @method Phaser.Math.Vector3#negate + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + negate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + + return this; + }, + + /** + * Calculate the distance between this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#distance + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector. + */ + distance: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return Math.sqrt(dx * dx + dy * dy + dz * dz); + }, + + /** + * Calculate the distance between this Vector and the given Vector, squared. + * + * @method Phaser.Math.Vector3#distanceSq + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector, squared. + */ + distanceSq: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return dx * dx + dy * dy + dz * dz; + }, + + /** + * Calculate the length (or magnitude) of this Vector. + * + * @method Phaser.Math.Vector3#length + * @since 3.0.0 + * + * @return {number} The length of this Vector. + */ + length: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return Math.sqrt(x * x + y * y + z * z); + }, + + /** + * Calculate the length of this Vector squared. + * + * @method Phaser.Math.Vector3#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Vector, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return x * x + y * y + z * z; + }, + + /** + * Normalize this Vector. + * + * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * + * @method Phaser.Math.Vector3#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + normalize: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var len = x * x + y * y + z * z; + + if (len > 0) + { + len = 1 / Math.sqrt(len); + + this.x = x * len; + this.y = y * len; + this.z = z * len; + } + + return this; + }, + + /** + * Calculate the dot product of this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#dot + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. + * + * @return {number} The dot product of this Vector and `v`. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + /** + * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. + * + * @method Phaser.Math.Vector3#cross + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector to cross product with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + cross: function (v) + { + var ax = this.x; + var ay = this.y; + var az = this.z; + var bx = v.x; + var by = v.y; + var bz = v.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Linearly interpolate between this Vector and the given Vector. + * + * Interpolates this Vector towards the given Vector. + * + * @method Phaser.Math.Vector3#lerp + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + lerp: function (v, t) + { + if (t === undefined) { t = 0; } + + var ax = this.x; + var ay = this.y; + var az = this.z; + + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + + return this; + }, + + /** + * Takes a Matrix3 and applies it to this Vector3. + * + * @method Phaser.Math.Vector3#applyMatrix3 + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix3} mat3 - The Matrix3 to apply to this Vector3. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + applyMatrix3: function (mat3) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat3.val; + + this.x = m[0] * x + m[3] * y + m[6] * z; + this.y = m[1] * x + m[4] * y + m[7] * z; + this.z = m[2] * x + m[5] * y + m[8] * z; + + return this; + }, + + /** + * Takes a Matrix4 and applies it to this Vector3. + * + * @method Phaser.Math.Vector3#applyMatrix4 + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to apply to this Vector3. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + applyMatrix4: function (mat4) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat4.val; + + var w = 1 / (m[3] * x + m[7] * y + m[11] * z + m[15]); + + this.x = (m[0] * x + m[4] * y + m[8] * z + m[12]) * w; + this.y = (m[1] * x + m[5] * y + m[9] * z + m[13]) * w; + this.z = (m[2] * x + m[6] * y + m[10] * z + m[14]) * w; + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector3#transformMat3 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat3: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = x * m[0] + y * m[3] + z * m[6]; + this.y = x * m[1] + y * m[4] + z * m[7]; + this.z = x * m[2] + y * m[5] + z * m[8]; + + return this; + }, + + /** + * Transform this Vector with the given Matrix4. + * + * @method Phaser.Math.Vector3#transformMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat4: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; + this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; + this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; + + return this; + }, + + /** + * Transforms the coordinates of this Vector3 with the given Matrix4. + * + * @method Phaser.Math.Vector3#transformCoordinates + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformCoordinates: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; + var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; + var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; + var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + + this.x = tx / tw; + this.y = ty / tw; + this.z = tz / tw; + + return this; + }, + + /** + * Transform this Vector with the given Quaternion. + * + * @method Phaser.Math.Vector3#transformQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformQuat: function (q) + { + // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations + var x = this.x; + var y = this.y; + var z = this.z; + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + + // calculate quat * vec + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = -qx * x - qy * y - qz * z; + + // calculate result * inverse quat + this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; + this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; + this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; + + return this; + }, + + /** + * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, + * e.g. unprojecting a 2D point into 3D space. + * + * @method Phaser.Math.Vector3#project + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + project: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var a00 = m[0]; + var a01 = m[1]; + var a02 = m[2]; + var a03 = m[3]; + var a10 = m[4]; + var a11 = m[5]; + var a12 = m[6]; + var a13 = m[7]; + var a20 = m[8]; + var a21 = m[9]; + var a22 = m[10]; + var a23 = m[11]; + var a30 = m[12]; + var a31 = m[13]; + var a32 = m[14]; + var a33 = m[15]; + + var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); + + this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; + this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; + this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; + + return this; + }, + + /** + * Multiplies this Vector3 by the given view and projection matrices. + * + * @method Phaser.Math.Vector3#projectViewMatrix + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} viewMatrix - A View Matrix. + * @param {Phaser.Math.Matrix4} projectionMatrix - A Projection Matrix. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + projectViewMatrix: function (viewMatrix, projectionMatrix) + { + return this.applyMatrix4(viewMatrix).applyMatrix4(projectionMatrix); + }, + + /** + * Multiplies this Vector3 by the given inversed projection matrix and world matrix. + * + * @method Phaser.Math.Vector3#unprojectViewMatrix + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} projectionMatrix - An inversed Projection Matrix. + * @param {Phaser.Math.Matrix4} worldMatrix - A World View Matrix. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + unprojectViewMatrix: function (projectionMatrix, worldMatrix) + { + return this.applyMatrix4(projectionMatrix).applyMatrix4(worldMatrix); + }, + + /** + * Unproject this point from 2D space to 3D space. + * The point should have its x and y properties set to + * 2D screen space, and the z either at 0 (near plane) + * or 1 (far plane). The provided matrix is assumed to already + * be combined, i.e. projection * view * model. + * + * After this operation, this vector's (x, y, z) components will + * represent the unprojected 3D coordinate. + * + * @method Phaser.Math.Vector3#unproject + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. + * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + unproject: function (viewport, invProjectionView) + { + var viewX = viewport.x; + var viewY = viewport.y; + var viewWidth = viewport.z; + var viewHeight = viewport.w; + + var x = this.x - viewX; + var y = (viewHeight - this.y - 1) - viewY; + var z = this.z; + + this.x = (2 * x) / viewWidth - 1; + this.y = (2 * y) / viewHeight - 1; + this.z = 2 * z - 1; + + return this.project(invProjectionView); + }, + + /** + * Make this Vector the zero vector (0, 0, 0). + * + * @method Phaser.Math.Vector3#reset + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + reset: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + + return this; + } + +}); + +/** + * A static zero Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ZERO + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ZERO = new Vector3(); + +/** + * A static right Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.RIGHT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.RIGHT = new Vector3(1, 0, 0); + +/** + * A static left Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.LEFT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.LEFT = new Vector3(-1, 0, 0); + +/** + * A static up Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.UP + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.UP = new Vector3(0, -1, 0); + +/** + * A static down Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.DOWN + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.DOWN = new Vector3(0, 1, 0); + +/** + * A static forward Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.FORWARD + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.FORWARD = new Vector3(0, 0, 1); + +/** + * A static back Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.BACK + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.BACK = new Vector3(0, 0, -1); + +/** + * A static one Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ONE + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ONE = new Vector3(1, 1, 1); + +module.exports = Vector3; + + +/***/ }), +/* 38 */ /***/ (function(module, exports) { /** @@ -7988,7 +9327,7 @@ module.exports = { /***/ }), -/* 34 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -8013,48 +9352,54 @@ var CONST = { * @type {string} * @since 3.0.0 */ - VERSION: '3.50.0-beta.5', + VERSION: '3.50.0-beta.11', - BlendModes: __webpack_require__(54), + BlendModes: __webpack_require__(48), - ScaleModes: __webpack_require__(247), + ScaleModes: __webpack_require__(260), /** - * AUTO Detect Renderer. + * This setting will auto-detect if the browser is capable of suppporting WebGL. + * If it is, it will use the WebGL Renderer. If not, it will fall back to the Canvas Renderer. * * @name Phaser.AUTO * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ AUTO: 0, /** - * Canvas Renderer. + * Forces Phaser to only use the Canvas Renderer, regardless if the browser supports + * WebGL or not. * * @name Phaser.CANVAS * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ CANVAS: 1, /** - * WebGL Renderer. + * Forces Phaser to use the WebGL Renderer. If the browser does not support it, there is + * no fallback to Canvas with this setting, so you should trap it and display a suitable + * message to the user. * * @name Phaser.WEBGL * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ WEBGL: 2, /** - * Headless Renderer. + * A Headless Renderer doesn't create either a Canvas or WebGL Renderer. However, it still + * absolutely relies on the DOM being present and available. This mode is meant for unit testing, + * not for running Phaser on the server, which is something you really shouldn't do. * * @name Phaser.HEADLESS * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ HEADLESS: 3, @@ -8065,7 +9410,7 @@ var CONST = { * * @name Phaser.FOREVER * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ FOREVER: -1, @@ -8075,7 +9420,7 @@ var CONST = { * * @name Phaser.NONE * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ NONE: 4, @@ -8085,7 +9430,7 @@ var CONST = { * * @name Phaser.UP * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ UP: 5, @@ -8095,7 +9440,7 @@ var CONST = { * * @name Phaser.DOWN * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ DOWN: 6, @@ -8105,7 +9450,7 @@ var CONST = { * * @name Phaser.LEFT * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ LEFT: 7, @@ -8115,7 +9460,7 @@ var CONST = { * * @name Phaser.RIGHT * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ RIGHT: 8 @@ -8126,7 +9471,7 @@ module.exports = CONST; /***/ }), -/* 35 */ +/* 40 */ /***/ (function(module, exports) { /** @@ -8154,7 +9499,7 @@ module.exports = GetBottom; /***/ }), -/* 36 */ +/* 41 */ /***/ (function(module, exports) { /** @@ -8182,7 +9527,7 @@ module.exports = GetLeft; /***/ }), -/* 37 */ +/* 42 */ /***/ (function(module, exports) { /** @@ -8210,7 +9555,7 @@ module.exports = GetRight; /***/ }), -/* 38 */ +/* 43 */ /***/ (function(module, exports) { /** @@ -8238,7 +9583,7 @@ module.exports = GetTop; /***/ }), -/* 39 */ +/* 44 */ /***/ (function(module, exports) { /** @@ -8264,8 +9609,8 @@ module.exports = GetTop; * @param {string} key - The property to be updated. * @param {number} value - The amount to be added to the property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -8305,7 +9650,7 @@ module.exports = PropertyValueInc; /***/ }), -/* 40 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -8315,10 +9660,10 @@ module.exports = PropertyValueInc; */ var Class = __webpack_require__(0); -var GetPoint = __webpack_require__(284); -var GetPoints = __webpack_require__(162); -var GEOM_CONST = __webpack_require__(49); -var Random = __webpack_require__(163); +var GetPoint = __webpack_require__(299); +var GetPoints = __webpack_require__(163); +var GEOM_CONST = __webpack_require__(55); +var Random = __webpack_require__(164); var Vector2 = __webpack_require__(3); /** @@ -8351,7 +9696,7 @@ var Line = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Line#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -8425,8 +9770,8 @@ var Line = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. - * @param {integer} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. + * @param {number} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. + * @param {number} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. * @param {(array|Phaser.Geom.Point[])} [output] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line. * * @return {(array|Phaser.Geom.Point[])} An array of Points, or point-like objects, containing the coordinates of the points on the line. @@ -8642,74 +9987,7 @@ module.exports = Line; /***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(13); - -/** - * Convert the given angle from degrees, to the equivalent angle in radians. - * - * @function Phaser.Math.DegToRad - * @since 3.0.0 - * - * @param {integer} degrees - The angle (in degrees) to convert to radians. - * - * @return {number} The given angle converted to radians. - */ -var DegToRad = function (degrees) -{ - return degrees * CONST.DEG_TO_RAD; -}; - -module.exports = DegToRad; - - -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Cameras.Scene2D.Events - */ - -module.exports = { - - DESTROY: __webpack_require__(671), - FADE_IN_COMPLETE: __webpack_require__(672), - FADE_IN_START: __webpack_require__(673), - FADE_OUT_COMPLETE: __webpack_require__(674), - FADE_OUT_START: __webpack_require__(675), - FLASH_COMPLETE: __webpack_require__(676), - FLASH_START: __webpack_require__(677), - PAN_COMPLETE: __webpack_require__(678), - PAN_START: __webpack_require__(679), - POST_RENDER: __webpack_require__(680), - PRE_RENDER: __webpack_require__(681), - ROTATE_COMPLETE: __webpack_require__(682), - ROTATE_START: __webpack_require__(683), - SHAKE_COMPLETE: __webpack_require__(684), - SHAKE_START: __webpack_require__(685), - ZOOM_COMPLETE: __webpack_require__(686), - ZOOM_START: __webpack_require__(687) - -}; - - -/***/ }), -/* 43 */ +/* 46 */ /***/ (function(module, exports) { /** @@ -8746,8 +10024,658 @@ module.exports = FillStyleCanvas; /***/ }), -/* 44 */, -/* 45 */ +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * A MultiFile is a special kind of parent that contains two, or more, Files as children and looks after + * the loading and processing of them all. It is commonly extended and used as a base class for file types such as AtlasJSON or BitmapFont. + * + * You shouldn't create an instance of a MultiFile directly, but should extend it with your own class, setting a custom type and processing methods. + * + * @class MultiFile + * @memberof Phaser.Loader + * @constructor + * @since 3.7.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File. + * @param {string} type - The file type string for sorting within the Loader. + * @param {string} key - The key of the file within the loader. + * @param {Phaser.Loader.File[]} files - An array of Files that make-up this MultiFile. + */ +var MultiFile = new Class({ + + initialize: + + function MultiFile (loader, type, key, files) + { + var finalFiles = []; + + // Clean out any potential 'null' or 'undefined' file entries + files.forEach(function (file) + { + if (file) + { + finalFiles.push(file); + } + }); + + /** + * A reference to the Loader that is going to load this file. + * + * @name Phaser.Loader.MultiFile#loader + * @type {Phaser.Loader.LoaderPlugin} + * @since 3.7.0 + */ + this.loader = loader; + + /** + * The file type string for sorting within the Loader. + * + * @name Phaser.Loader.MultiFile#type + * @type {string} + * @since 3.7.0 + */ + this.type = type; + + /** + * Unique cache key (unique within its file type) + * + * @name Phaser.Loader.MultiFile#key + * @type {string} + * @since 3.7.0 + */ + this.key = key; + + /** + * The current index being used by multi-file loaders to avoid key clashes. + * + * @name Phaser.Loader.MultiFile#multiKeyIndex + * @type {number} + * @private + * @since 3.20.0 + */ + this.multiKeyIndex = loader.multiKeyIndex++; + + /** + * Array of files that make up this MultiFile. + * + * @name Phaser.Loader.MultiFile#files + * @type {Phaser.Loader.File[]} + * @since 3.7.0 + */ + this.files = finalFiles; + + /** + * The completion status of this MultiFile. + * + * @name Phaser.Loader.MultiFile#complete + * @type {boolean} + * @default false + * @since 3.7.0 + */ + this.complete = false; + + /** + * The number of files to load. + * + * @name Phaser.Loader.MultiFile#pending + * @type {number} + * @since 3.7.0 + */ + + this.pending = finalFiles.length; + + /** + * The number of files that failed to load. + * + * @name Phaser.Loader.MultiFile#failed + * @type {number} + * @default 0 + * @since 3.7.0 + */ + this.failed = 0; + + /** + * A storage container for transient data that the loading files need. + * + * @name Phaser.Loader.MultiFile#config + * @type {any} + * @since 3.7.0 + */ + this.config = {}; + + /** + * A reference to the Loaders baseURL at the time this MultiFile was created. + * Used to populate child-files. + * + * @name Phaser.Loader.MultiFile#baseURL + * @type {string} + * @since 3.20.0 + */ + this.baseURL = loader.baseURL; + + /** + * A reference to the Loaders path at the time this MultiFile was created. + * Used to populate child-files. + * + * @name Phaser.Loader.MultiFile#path + * @type {string} + * @since 3.20.0 + */ + this.path = loader.path; + + /** + * A reference to the Loaders prefix at the time this MultiFile was created. + * Used to populate child-files. + * + * @name Phaser.Loader.MultiFile#prefix + * @type {string} + * @since 3.20.0 + */ + this.prefix = loader.prefix; + + // Link the files + for (var i = 0; i < finalFiles.length; i++) + { + finalFiles[i].multiFile = this; + } + }, + + /** + * Checks if this MultiFile is ready to process its children or not. + * + * @method Phaser.Loader.MultiFile#isReadyToProcess + * @since 3.7.0 + * + * @return {boolean} `true` if all children of this MultiFile have loaded, otherwise `false`. + */ + isReadyToProcess: function () + { + return (this.pending === 0 && this.failed === 0 && !this.complete); + }, + + /** + * Adds another child to this MultiFile, increases the pending count and resets the completion status. + * + * @method Phaser.Loader.MultiFile#addToMultiFile + * @since 3.7.0 + * + * @param {Phaser.Loader.File} files - The File to add to this MultiFile. + * + * @return {Phaser.Loader.MultiFile} This MultiFile instance. + */ + addToMultiFile: function (file) + { + this.files.push(file); + + file.multiFile = this; + + this.pending++; + + this.complete = false; + + return this; + }, + + /** + * Called by each File when it finishes loading. + * + * @method Phaser.Loader.MultiFile#onFileComplete + * @since 3.7.0 + * + * @param {Phaser.Loader.File} file - The File that has completed processing. + */ + onFileComplete: function (file) + { + var index = this.files.indexOf(file); + + if (index !== -1) + { + this.pending--; + } + }, + + /** + * Called by each File that fails to load. + * + * @method Phaser.Loader.MultiFile#onFileFailed + * @since 3.7.0 + * + * @param {Phaser.Loader.File} file - The File that has failed to load. + */ + onFileFailed: function (file) + { + var index = this.files.indexOf(file); + + if (index !== -1) + { + this.failed++; + } + } + +}); + +module.exports = MultiFile; + + +/***/ }), +/* 48 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Phaser Blend Modes. + * + * @namespace Phaser.BlendModes + * @since 3.0.0 + */ + +module.exports = { + + /** + * Skips the Blend Mode check in the renderer. + * + * @name Phaser.BlendModes.SKIP_CHECK + * @type {number} + * @const + * @since 3.0.0 + */ + SKIP_CHECK: -1, + + /** + * Normal blend mode. For Canvas and WebGL. + * This is the default setting and draws new shapes on top of the existing canvas content. + * + * @name Phaser.BlendModes.NORMAL + * @type {number} + * @const + * @since 3.0.0 + */ + NORMAL: 0, + + /** + * Add blend mode. For Canvas and WebGL. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.ADD + * @type {number} + * @const + * @since 3.0.0 + */ + ADD: 1, + + /** + * Multiply blend mode. For Canvas and WebGL. + * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. + * + * @name Phaser.BlendModes.MULTIPLY + * @type {number} + * @const + * @since 3.0.0 + */ + MULTIPLY: 2, + + /** + * Screen blend mode. For Canvas and WebGL. + * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) + * + * @name Phaser.BlendModes.SCREEN + * @type {number} + * @const + * @since 3.0.0 + */ + SCREEN: 3, + + /** + * Overlay blend mode. For Canvas only. + * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. + * + * @name Phaser.BlendModes.OVERLAY + * @type {number} + * @const + * @since 3.0.0 + */ + OVERLAY: 4, + + /** + * Darken blend mode. For Canvas only. + * Retains the darkest pixels of both layers. + * + * @name Phaser.BlendModes.DARKEN + * @type {number} + * @const + * @since 3.0.0 + */ + DARKEN: 5, + + /** + * Lighten blend mode. For Canvas only. + * Retains the lightest pixels of both layers. + * + * @name Phaser.BlendModes.LIGHTEN + * @type {number} + * @const + * @since 3.0.0 + */ + LIGHTEN: 6, + + /** + * Color Dodge blend mode. For Canvas only. + * Divides the bottom layer by the inverted top layer. + * + * @name Phaser.BlendModes.COLOR_DODGE + * @type {number} + * @const + * @since 3.0.0 + */ + COLOR_DODGE: 7, + + /** + * Color Burn blend mode. For Canvas only. + * Divides the inverted bottom layer by the top layer, and then inverts the result. + * + * @name Phaser.BlendModes.COLOR_BURN + * @type {number} + * @const + * @since 3.0.0 + */ + COLOR_BURN: 8, + + /** + * Hard Light blend mode. For Canvas only. + * A combination of multiply and screen like overlay, but with top and bottom layer swapped. + * + * @name Phaser.BlendModes.HARD_LIGHT + * @type {number} + * @const + * @since 3.0.0 + */ + HARD_LIGHT: 9, + + /** + * Soft Light blend mode. For Canvas only. + * A softer version of hard-light. Pure black or white does not result in pure black or white. + * + * @name Phaser.BlendModes.SOFT_LIGHT + * @type {number} + * @const + * @since 3.0.0 + */ + SOFT_LIGHT: 10, + + /** + * Difference blend mode. For Canvas only. + * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. + * + * @name Phaser.BlendModes.DIFFERENCE + * @type {number} + * @const + * @since 3.0.0 + */ + DIFFERENCE: 11, + + /** + * Exclusion blend mode. For Canvas only. + * Like difference, but with lower contrast. + * + * @name Phaser.BlendModes.EXCLUSION + * @type {number} + * @const + * @since 3.0.0 + */ + EXCLUSION: 12, + + /** + * Hue blend mode. For Canvas only. + * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. + * + * @name Phaser.BlendModes.HUE + * @type {number} + * @const + * @since 3.0.0 + */ + HUE: 13, + + /** + * Saturation blend mode. For Canvas only. + * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. + * + * @name Phaser.BlendModes.SATURATION + * @type {number} + * @const + * @since 3.0.0 + */ + SATURATION: 14, + + /** + * Color blend mode. For Canvas only. + * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. + * + * @name Phaser.BlendModes.COLOR + * @type {number} + * @const + * @since 3.0.0 + */ + COLOR: 15, + + /** + * Luminosity blend mode. For Canvas only. + * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. + * + * @name Phaser.BlendModes.LUMINOSITY + * @type {number} + * @const + * @since 3.0.0 + */ + LUMINOSITY: 16, + + /** + * Alpha erase blend mode. For Canvas and WebGL. + * + * @name Phaser.BlendModes.ERASE + * @type {number} + * @const + * @since 3.0.0 + */ + ERASE: 17, + + /** + * Source-in blend mode. For Canvas only. + * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.SOURCE_IN + * @type {number} + * @const + * @since 3.0.0 + */ + SOURCE_IN: 18, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is drawn where it doesn't overlap the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_OUT + * @type {number} + * @const + * @since 3.0.0 + */ + SOURCE_OUT: 19, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is only drawn where it overlaps the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_ATOP + * @type {number} + * @const + * @since 3.0.0 + */ + SOURCE_ATOP: 20, + + /** + * Destination-over blend mode. For Canvas only. + * New shapes are drawn behind the existing canvas content. + * + * @name Phaser.BlendModes.DESTINATION_OVER + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_OVER: 21, + + /** + * Destination-in blend mode. For Canvas only. + * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.DESTINATION_IN + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_IN: 22, + + /** + * Destination-out blend mode. For Canvas only. + * The existing content is kept where it doesn't overlap the new shape. + * + * @name Phaser.BlendModes.DESTINATION_OUT + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_OUT: 23, + + /** + * Destination-out blend mode. For Canvas only. + * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. + * + * @name Phaser.BlendModes.DESTINATION_ATOP + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_ATOP: 24, + + /** + * Lighten blend mode. For Canvas only. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.LIGHTER + * @type {number} + * @const + * @since 3.0.0 + */ + LIGHTER: 25, + + /** + * Copy blend mode. For Canvas only. + * Only the new shape is shown. + * + * @name Phaser.BlendModes.COPY + * @type {number} + * @const + * @since 3.0.0 + */ + COPY: 26, + + /** + * Xor blend mode. For Canvas only. + * Shapes are made transparent where both overlap and drawn normal everywhere else. + * + * @name Phaser.BlendModes.XOR + * @type {number} + * @const + * @since 3.0.0 + */ + XOR: 27 + +}; + + +/***/ }), +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Input.Events + */ + +module.exports = { + + BOOT: __webpack_require__(908), + DESTROY: __webpack_require__(909), + DRAG_END: __webpack_require__(910), + DRAG_ENTER: __webpack_require__(911), + DRAG: __webpack_require__(912), + DRAG_LEAVE: __webpack_require__(913), + DRAG_OVER: __webpack_require__(914), + DRAG_START: __webpack_require__(915), + DROP: __webpack_require__(916), + GAME_OUT: __webpack_require__(917), + GAME_OVER: __webpack_require__(918), + GAMEOBJECT_DOWN: __webpack_require__(919), + GAMEOBJECT_DRAG_END: __webpack_require__(920), + GAMEOBJECT_DRAG_ENTER: __webpack_require__(921), + GAMEOBJECT_DRAG: __webpack_require__(922), + GAMEOBJECT_DRAG_LEAVE: __webpack_require__(923), + GAMEOBJECT_DRAG_OVER: __webpack_require__(924), + GAMEOBJECT_DRAG_START: __webpack_require__(925), + GAMEOBJECT_DROP: __webpack_require__(926), + GAMEOBJECT_MOVE: __webpack_require__(927), + GAMEOBJECT_OUT: __webpack_require__(928), + GAMEOBJECT_OVER: __webpack_require__(929), + GAMEOBJECT_POINTER_DOWN: __webpack_require__(930), + GAMEOBJECT_POINTER_MOVE: __webpack_require__(931), + GAMEOBJECT_POINTER_OUT: __webpack_require__(932), + GAMEOBJECT_POINTER_OVER: __webpack_require__(933), + GAMEOBJECT_POINTER_UP: __webpack_require__(934), + GAMEOBJECT_POINTER_WHEEL: __webpack_require__(935), + GAMEOBJECT_UP: __webpack_require__(936), + GAMEOBJECT_WHEEL: __webpack_require__(937), + MANAGER_BOOT: __webpack_require__(938), + MANAGER_PROCESS: __webpack_require__(939), + MANAGER_UPDATE: __webpack_require__(940), + POINTER_DOWN: __webpack_require__(941), + POINTER_DOWN_OUTSIDE: __webpack_require__(942), + POINTER_MOVE: __webpack_require__(943), + POINTER_OUT: __webpack_require__(944), + POINTER_OVER: __webpack_require__(945), + POINTER_UP: __webpack_require__(946), + POINTER_UP_OUTSIDE: __webpack_require__(947), + POINTER_WHEEL: __webpack_require__(948), + POINTERLOCK_CHANGE: __webpack_require__(949), + PRE_UPDATE: __webpack_require__(950), + SHUTDOWN: __webpack_require__(951), + START: __webpack_require__(952), + UPDATE: __webpack_require__(953) + +}; + + +/***/ }), +/* 50 */, +/* 51 */ /***/ (function(module, exports) { /** @@ -8780,7 +10708,7 @@ module.exports = SetTop; /***/ }), -/* 46 */ +/* 52 */ /***/ (function(module, exports) { /** @@ -8813,7 +10741,7 @@ module.exports = SetLeft; /***/ }), -/* 47 */ +/* 53 */ /***/ (function(module, exports) { /** @@ -8846,7 +10774,7 @@ module.exports = SetRight; /***/ }), -/* 48 */ +/* 54 */ /***/ (function(module, exports) { /** @@ -8879,7 +10807,7 @@ module.exports = SetBottom; /***/ }), -/* 49 */ +/* 55 */ /***/ (function(module, exports) { /** @@ -8894,7 +10822,7 @@ var GEOM_CONST = { * A Circle Geometry object type. * * @name Phaser.Geom.CIRCLE - * @type {integer} + * @type {number} * @since 3.19.0 */ CIRCLE: 0, @@ -8903,7 +10831,7 @@ var GEOM_CONST = { * An Ellipse Geometry object type. * * @name Phaser.Geom.ELLIPSE - * @type {integer} + * @type {number} * @since 3.19.0 */ ELLIPSE: 1, @@ -8912,7 +10840,7 @@ var GEOM_CONST = { * A Line Geometry object type. * * @name Phaser.Geom.LINE - * @type {integer} + * @type {number} * @since 3.19.0 */ LINE: 2, @@ -8921,7 +10849,7 @@ var GEOM_CONST = { * A Point Geometry object type. * * @name Phaser.Geom.POINT - * @type {integer} + * @type {number} * @since 3.19.0 */ POINT: 3, @@ -8930,7 +10858,7 @@ var GEOM_CONST = { * A Polygon Geometry object type. * * @name Phaser.Geom.POLYGON - * @type {integer} + * @type {number} * @since 3.19.0 */ POLYGON: 4, @@ -8939,7 +10867,7 @@ var GEOM_CONST = { * A Rectangle Geometry object type. * * @name Phaser.Geom.RECTANGLE - * @type {integer} + * @type {number} * @since 3.19.0 */ RECTANGLE: 5, @@ -8948,7 +10876,7 @@ var GEOM_CONST = { * A Triangle Geometry object type. * * @name Phaser.Geom.TRIANGLE - * @type {integer} + * @type {number} * @since 3.19.0 */ TRIANGLE: 6 @@ -8959,7 +10887,7 @@ module.exports = GEOM_CONST; /***/ }), -/* 50 */ +/* 56 */ /***/ (function(module, exports) { /** @@ -8994,7 +10922,7 @@ module.exports = Contains; /***/ }), -/* 51 */ +/* 57 */ /***/ (function(module, exports) { /** @@ -9032,7 +10960,237 @@ module.exports = LineStyleCanvas; /***/ }), -/* 52 */ +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var CONST = __webpack_require__(19); +var File = __webpack_require__(22); +var FileTypesManager = __webpack_require__(8); +var GetFastValue = __webpack_require__(2); +var GetValue = __webpack_require__(6); +var IsPlainObject = __webpack_require__(7); + +/** + * @classdesc + * A single JSON File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#json method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#json. + * + * @class JSONFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + */ +var JSONFile = new Class({ + + Extends: File, + + initialize: + + // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object + // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing + + function JSONFile (loader, key, url, xhrSettings, dataKey) + { + var extension = 'json'; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + dataKey = GetFastValue(config, 'dataKey', dataKey); + } + + var fileConfig = { + type: 'json', + cache: loader.cacheManager.json, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings, + config: dataKey + }; + + File.call(this, loader, fileConfig); + + if (IsPlainObject(url)) + { + // Object provided instead of a URL, so no need to actually load it (populate data with value) + if (dataKey) + { + this.data = GetValue(url, dataKey); + } + else + { + this.data = url; + } + + this.state = CONST.FILE_POPULATED; + } + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.JSONFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + if (this.state !== CONST.FILE_POPULATED) + { + this.state = CONST.FILE_PROCESSING; + + var json = JSON.parse(this.xhrLoader.responseText); + + var key = this.config; + + if (typeof key === 'string') + { + this.data = GetValue(json, key, json); + } + else + { + this.data = json; + } + } + + this.onProcessComplete(); + } + +}); + +/** + * Adds a JSON file, or array of JSON files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.json('wavedata', 'files/AlienWaveData.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the JSON Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.json({ + * key: 'wavedata', + * url: 'files/AlienWaveData.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.JSONFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.json('wavedata', 'files/AlienWaveData.json'); + * // and later in your game ... + * var data = this.cache.json.get('wavedata'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and + * this is what you would use to retrieve the text from the JSON Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" + * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, + * rather than the whole file. For example, if your JSON data had a structure like this: + * + * ```json + * { + * "level1": { + * "baddies": { + * "aliens": {}, + * "boss": {} + * } + * }, + * "level2": {}, + * "level3": {} + * } + * ``` + * + * And you only wanted to store the `boss` data in the Cache, then you could pass `level1.baddies.boss`as the `dataKey`. + * + * Note: The ability to load this type of file will only be available if the JSON File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#json + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. + * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('json', function (key, url, dataKey, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new JSONFile(this, key[i])); + } + } + else + { + this.addFile(new JSONFile(this, key, url, xhrSettings, dataKey)); + } + + return this; +}); + +module.exports = JSONFile; + + +/***/ }), +/* 59 */ /***/ (function(module, exports) { /** @@ -9161,7 +11319,7 @@ module.exports = CONST; /***/ }), -/* 53 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -9170,8 +11328,8 @@ module.exports = CONST; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTileAt = __webpack_require__(150); -var GetTilesWithin = __webpack_require__(24); +var GetTileAt = __webpack_require__(151); +var GetTilesWithin = __webpack_require__(26); /** * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the @@ -9181,10 +11339,10 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.CalculateFacesWithin * @since 3.0.0 * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var CalculateFacesWithin = function (tileX, tileY, width, height, layer) @@ -9226,346 +11384,7 @@ module.exports = CalculateFacesWithin; /***/ }), -/* 54 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Phaser Blend Modes. - * - * @namespace Phaser.BlendModes - * @since 3.0.0 - */ - -module.exports = { - - /** - * Skips the Blend Mode check in the renderer. - * - * @name Phaser.BlendModes.SKIP_CHECK - * @type {integer} - * @const - * @since 3.0.0 - */ - SKIP_CHECK: -1, - - /** - * Normal blend mode. For Canvas and WebGL. - * This is the default setting and draws new shapes on top of the existing canvas content. - * - * @name Phaser.BlendModes.NORMAL - * @type {integer} - * @const - * @since 3.0.0 - */ - NORMAL: 0, - - /** - * Add blend mode. For Canvas and WebGL. - * Where both shapes overlap the color is determined by adding color values. - * - * @name Phaser.BlendModes.ADD - * @type {integer} - * @const - * @since 3.0.0 - */ - ADD: 1, - - /** - * Multiply blend mode. For Canvas and WebGL. - * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. - * - * @name Phaser.BlendModes.MULTIPLY - * @type {integer} - * @const - * @since 3.0.0 - */ - MULTIPLY: 2, - - /** - * Screen blend mode. For Canvas and WebGL. - * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) - * - * @name Phaser.BlendModes.SCREEN - * @type {integer} - * @const - * @since 3.0.0 - */ - SCREEN: 3, - - /** - * Overlay blend mode. For Canvas only. - * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. - * - * @name Phaser.BlendModes.OVERLAY - * @type {integer} - * @const - * @since 3.0.0 - */ - OVERLAY: 4, - - /** - * Darken blend mode. For Canvas only. - * Retains the darkest pixels of both layers. - * - * @name Phaser.BlendModes.DARKEN - * @type {integer} - * @const - * @since 3.0.0 - */ - DARKEN: 5, - - /** - * Lighten blend mode. For Canvas only. - * Retains the lightest pixels of both layers. - * - * @name Phaser.BlendModes.LIGHTEN - * @type {integer} - * @const - * @since 3.0.0 - */ - LIGHTEN: 6, - - /** - * Color Dodge blend mode. For Canvas only. - * Divides the bottom layer by the inverted top layer. - * - * @name Phaser.BlendModes.COLOR_DODGE - * @type {integer} - * @const - * @since 3.0.0 - */ - COLOR_DODGE: 7, - - /** - * Color Burn blend mode. For Canvas only. - * Divides the inverted bottom layer by the top layer, and then inverts the result. - * - * @name Phaser.BlendModes.COLOR_BURN - * @type {integer} - * @const - * @since 3.0.0 - */ - COLOR_BURN: 8, - - /** - * Hard Light blend mode. For Canvas only. - * A combination of multiply and screen like overlay, but with top and bottom layer swapped. - * - * @name Phaser.BlendModes.HARD_LIGHT - * @type {integer} - * @const - * @since 3.0.0 - */ - HARD_LIGHT: 9, - - /** - * Soft Light blend mode. For Canvas only. - * A softer version of hard-light. Pure black or white does not result in pure black or white. - * - * @name Phaser.BlendModes.SOFT_LIGHT - * @type {integer} - * @const - * @since 3.0.0 - */ - SOFT_LIGHT: 10, - - /** - * Difference blend mode. For Canvas only. - * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. - * - * @name Phaser.BlendModes.DIFFERENCE - * @type {integer} - * @const - * @since 3.0.0 - */ - DIFFERENCE: 11, - - /** - * Exclusion blend mode. For Canvas only. - * Like difference, but with lower contrast. - * - * @name Phaser.BlendModes.EXCLUSION - * @type {integer} - * @const - * @since 3.0.0 - */ - EXCLUSION: 12, - - /** - * Hue blend mode. For Canvas only. - * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. - * - * @name Phaser.BlendModes.HUE - * @type {integer} - * @const - * @since 3.0.0 - */ - HUE: 13, - - /** - * Saturation blend mode. For Canvas only. - * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. - * - * @name Phaser.BlendModes.SATURATION - * @type {integer} - * @const - * @since 3.0.0 - */ - SATURATION: 14, - - /** - * Color blend mode. For Canvas only. - * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. - * - * @name Phaser.BlendModes.COLOR - * @type {integer} - * @const - * @since 3.0.0 - */ - COLOR: 15, - - /** - * Luminosity blend mode. For Canvas only. - * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. - * - * @name Phaser.BlendModes.LUMINOSITY - * @type {integer} - * @const - * @since 3.0.0 - */ - LUMINOSITY: 16, - - /** - * Alpha erase blend mode. For Canvas and WebGL. - * - * @name Phaser.BlendModes.ERASE - * @type {integer} - * @const - * @since 3.0.0 - */ - ERASE: 17, - - /** - * Source-in blend mode. For Canvas only. - * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. - * - * @name Phaser.BlendModes.SOURCE_IN - * @type {integer} - * @const - * @since 3.0.0 - */ - SOURCE_IN: 18, - - /** - * Source-out blend mode. For Canvas only. - * The new shape is drawn where it doesn't overlap the existing canvas content. - * - * @name Phaser.BlendModes.SOURCE_OUT - * @type {integer} - * @const - * @since 3.0.0 - */ - SOURCE_OUT: 19, - - /** - * Source-out blend mode. For Canvas only. - * The new shape is only drawn where it overlaps the existing canvas content. - * - * @name Phaser.BlendModes.SOURCE_ATOP - * @type {integer} - * @const - * @since 3.0.0 - */ - SOURCE_ATOP: 20, - - /** - * Destination-over blend mode. For Canvas only. - * New shapes are drawn behind the existing canvas content. - * - * @name Phaser.BlendModes.DESTINATION_OVER - * @type {integer} - * @const - * @since 3.0.0 - */ - DESTINATION_OVER: 21, - - /** - * Destination-in blend mode. For Canvas only. - * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. - * - * @name Phaser.BlendModes.DESTINATION_IN - * @type {integer} - * @const - * @since 3.0.0 - */ - DESTINATION_IN: 22, - - /** - * Destination-out blend mode. For Canvas only. - * The existing content is kept where it doesn't overlap the new shape. - * - * @name Phaser.BlendModes.DESTINATION_OUT - * @type {integer} - * @const - * @since 3.0.0 - */ - DESTINATION_OUT: 23, - - /** - * Destination-out blend mode. For Canvas only. - * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. - * - * @name Phaser.BlendModes.DESTINATION_ATOP - * @type {integer} - * @const - * @since 3.0.0 - */ - DESTINATION_ATOP: 24, - - /** - * Lighten blend mode. For Canvas only. - * Where both shapes overlap the color is determined by adding color values. - * - * @name Phaser.BlendModes.LIGHTER - * @type {integer} - * @const - * @since 3.0.0 - */ - LIGHTER: 25, - - /** - * Copy blend mode. For Canvas only. - * Only the new shape is shown. - * - * @name Phaser.BlendModes.COPY - * @type {integer} - * @const - * @since 3.0.0 - */ - COPY: 26, - - /** - * Xor blend mode. For Canvas only. - * Shapes are made transparent where both overlap and drawn normal everywhere else. - * - * @name Phaser.BlendModes.XOR - * @type {integer} - * @const - * @since 3.0.0 - */ - XOR: 27 - -}; - - -/***/ }), -/* 55 */ +/* 61 */ /***/ (function(module, exports) { /** @@ -9599,73 +11418,7 @@ module.exports = DistanceBetween; /***/ }), -/* 56 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Input.Events - */ - -module.exports = { - - BOOT: __webpack_require__(852), - DESTROY: __webpack_require__(853), - DRAG_END: __webpack_require__(854), - DRAG_ENTER: __webpack_require__(855), - DRAG: __webpack_require__(856), - DRAG_LEAVE: __webpack_require__(857), - DRAG_OVER: __webpack_require__(858), - DRAG_START: __webpack_require__(859), - DROP: __webpack_require__(860), - GAME_OUT: __webpack_require__(861), - GAME_OVER: __webpack_require__(862), - GAMEOBJECT_DOWN: __webpack_require__(863), - GAMEOBJECT_DRAG_END: __webpack_require__(864), - GAMEOBJECT_DRAG_ENTER: __webpack_require__(865), - GAMEOBJECT_DRAG: __webpack_require__(866), - GAMEOBJECT_DRAG_LEAVE: __webpack_require__(867), - GAMEOBJECT_DRAG_OVER: __webpack_require__(868), - GAMEOBJECT_DRAG_START: __webpack_require__(869), - GAMEOBJECT_DROP: __webpack_require__(870), - GAMEOBJECT_MOVE: __webpack_require__(871), - GAMEOBJECT_OUT: __webpack_require__(872), - GAMEOBJECT_OVER: __webpack_require__(873), - GAMEOBJECT_POINTER_DOWN: __webpack_require__(874), - GAMEOBJECT_POINTER_MOVE: __webpack_require__(875), - GAMEOBJECT_POINTER_OUT: __webpack_require__(876), - GAMEOBJECT_POINTER_OVER: __webpack_require__(877), - GAMEOBJECT_POINTER_UP: __webpack_require__(878), - GAMEOBJECT_POINTER_WHEEL: __webpack_require__(879), - GAMEOBJECT_UP: __webpack_require__(880), - GAMEOBJECT_WHEEL: __webpack_require__(881), - MANAGER_BOOT: __webpack_require__(882), - MANAGER_PROCESS: __webpack_require__(883), - MANAGER_UPDATE: __webpack_require__(884), - POINTER_DOWN: __webpack_require__(885), - POINTER_DOWN_OUTSIDE: __webpack_require__(886), - POINTER_MOVE: __webpack_require__(887), - POINTER_OUT: __webpack_require__(888), - POINTER_OVER: __webpack_require__(889), - POINTER_UP: __webpack_require__(890), - POINTER_UP_OUTSIDE: __webpack_require__(891), - POINTER_WHEEL: __webpack_require__(892), - POINTERLOCK_CHANGE: __webpack_require__(893), - PRE_UPDATE: __webpack_require__(894), - SHUTDOWN: __webpack_require__(895), - START: __webpack_require__(896), - UPDATE: __webpack_require__(897) - -}; - - -/***/ }), -/* 57 */ +/* 62 */ /***/ (function(module, exports) { /** @@ -9706,7 +11459,7 @@ module.exports = Contains; /***/ }), -/* 58 */ +/* 63 */ /***/ (function(module, exports) { /** @@ -9734,7 +11487,7 @@ module.exports = Length; /***/ }), -/* 59 */ +/* 64 */ /***/ (function(module, exports) { /** @@ -9766,7 +11519,7 @@ module.exports = Wrap; /***/ }), -/* 60 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10530,7 +12283,7 @@ module.exports = earcut; /***/ }), -/* 61 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -10545,35 +12298,35 @@ module.exports = earcut; module.exports = { - COMPLETE: __webpack_require__(917), - DECODED: __webpack_require__(918), - DECODED_ALL: __webpack_require__(919), - DESTROY: __webpack_require__(920), - DETUNE: __webpack_require__(921), - GLOBAL_DETUNE: __webpack_require__(922), - GLOBAL_MUTE: __webpack_require__(923), - GLOBAL_RATE: __webpack_require__(924), - GLOBAL_VOLUME: __webpack_require__(925), - LOOP: __webpack_require__(926), - LOOPED: __webpack_require__(927), - MUTE: __webpack_require__(928), - PAUSE_ALL: __webpack_require__(929), - PAUSE: __webpack_require__(930), - PLAY: __webpack_require__(931), - RATE: __webpack_require__(932), - RESUME_ALL: __webpack_require__(933), - RESUME: __webpack_require__(934), - SEEK: __webpack_require__(935), - STOP_ALL: __webpack_require__(936), - STOP: __webpack_require__(937), - UNLOCKED: __webpack_require__(938), - VOLUME: __webpack_require__(939) + COMPLETE: __webpack_require__(973), + DECODED: __webpack_require__(974), + DECODED_ALL: __webpack_require__(975), + DESTROY: __webpack_require__(976), + DETUNE: __webpack_require__(977), + GLOBAL_DETUNE: __webpack_require__(978), + GLOBAL_MUTE: __webpack_require__(979), + GLOBAL_RATE: __webpack_require__(980), + GLOBAL_VOLUME: __webpack_require__(981), + LOOP: __webpack_require__(982), + LOOPED: __webpack_require__(983), + MUTE: __webpack_require__(984), + PAUSE_ALL: __webpack_require__(985), + PAUSE: __webpack_require__(986), + PLAY: __webpack_require__(987), + RATE: __webpack_require__(988), + RESUME_ALL: __webpack_require__(989), + RESUME: __webpack_require__(990), + SEEK: __webpack_require__(991), + STOP_ALL: __webpack_require__(992), + STOP: __webpack_require__(993), + UNLOCKED: __webpack_require__(994), + VOLUME: __webpack_require__(995) }; /***/ }), -/* 62 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -10583,45 +12336,42 @@ module.exports = { */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(6); var IsPlainObject = __webpack_require__(7); /** * @classdesc - * A single JSON File suitable for loading by the Loader. + * A single Image File suitable for loading by the Loader. * - * These are created when you use the Phaser.Loader.LoaderPlugin#json method and are not typically created directly. + * These are created when you use the Phaser.Loader.LoaderPlugin#image method and are not typically created directly. * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#json. + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#image. * - * @class JSONFile + * @class ImageFile * @extends Phaser.Loader.File * @memberof Phaser.Loader.FileTypes * @constructor * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. + * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets. */ -var JSONFile = new Class({ +var ImageFile = new Class({ Extends: File, initialize: - // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object - // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing - - function JSONFile (loader, key, url, xhrSettings, dataKey) + function ImageFile (loader, key, url, xhrSettings, frameConfig) { - var extension = 'json'; + var extension = 'png'; + var normalMapURL; if (IsPlainObject(key)) { @@ -10629,37 +12379,41 @@ var JSONFile = new Class({ key = GetFastValue(config, 'key'); url = GetFastValue(config, 'url'); + normalMapURL = GetFastValue(config, 'normalMap'); xhrSettings = GetFastValue(config, 'xhrSettings'); extension = GetFastValue(config, 'extension', extension); - dataKey = GetFastValue(config, 'dataKey', dataKey); + frameConfig = GetFastValue(config, 'frameConfig'); + } + + if (Array.isArray(url)) + { + normalMapURL = url[1]; + url = url[0]; } var fileConfig = { - type: 'json', - cache: loader.cacheManager.json, + type: 'image', + cache: loader.textureManager, extension: extension, - responseType: 'text', + responseType: 'blob', key: key, url: url, xhrSettings: xhrSettings, - config: dataKey + config: frameConfig }; File.call(this, loader, fileConfig); - if (IsPlainObject(url)) + // Do we have a normal map to load as well? + if (normalMapURL) { - // Object provided instead of a URL, so no need to actually load it (populate data with value) - if (dataKey) - { - this.data = GetValue(url, dataKey); - } - else - { - this.data = url; - } + var normalMap = new ImageFile(loader, this.key, normalMapURL, xhrSettings, frameConfig); - this.state = CONST.FILE_POPULATED; + normalMap.type = 'normalMap'; + + this.setLink(normalMap); + + loader.addFile(normalMap); } }, @@ -10667,43 +12421,81 @@ var JSONFile = new Class({ * Called automatically by Loader.nextFile. * This method controls what extra work this File does with its loaded data. * - * @method Phaser.Loader.FileTypes.JSONFile#onProcess + * @method Phaser.Loader.FileTypes.ImageFile#onProcess * @since 3.7.0 */ onProcess: function () { - if (this.state !== CONST.FILE_POPULATED) + this.state = CONST.FILE_PROCESSING; + + this.data = new Image(); + + this.data.crossOrigin = this.crossOrigin; + + var _this = this; + + this.data.onload = function () { - this.state = CONST.FILE_PROCESSING; + File.revokeObjectURL(_this.data); - var json = JSON.parse(this.xhrLoader.responseText); + _this.onProcessComplete(); + }; - var key = this.config; + this.data.onerror = function () + { + File.revokeObjectURL(_this.data); - if (typeof key === 'string') + _this.onProcessError(); + }; + + File.createObjectURL(this.data, this.xhrLoader.response, 'image/png'); + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.ImageFile#addToCache + * @since 3.7.0 + */ + addToCache: function () + { + var texture; + var linkFile = this.linkFile; + + if (linkFile && linkFile.state === CONST.FILE_COMPLETE) + { + if (this.type === 'image') { - this.data = GetValue(json, key, json); + texture = this.cache.addImage(this.key, this.data, linkFile.data); } else { - this.data = json; + texture = this.cache.addImage(linkFile.key, linkFile.data, this.data); } - } - this.onProcessComplete(); + this.pendingDestroy(texture); + + linkFile.pendingDestroy(texture); + } + else if (!linkFile) + { + texture = this.cache.addImage(this.key, this.data); + + this.pendingDestroy(texture); + } } }); /** - * Adds a JSON file, or array of JSON files, to the current load queue. + * Adds an Image, or array of Images, to the current load queue. * * You can call this method from within your Scene's `preload`, along with any other files you wish to load: * * ```javascript * function preload () * { - * this.load.json('wavedata', 'files/AlienWaveData.json'); + * this.load.image('logo', 'images/phaserLogo.png'); * } * ``` * @@ -10715,330 +12507,101 @@ var JSONFile = new Class({ * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been * loaded. * - * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback + * of animated gifs to Canvas elements. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the JSON Cache first, before loading a new one. + * then remove it from the Texture Manager first, before loading a new one. * * Instead of passing arguments you can pass a configuration object, such as: * * ```javascript - * this.load.json({ - * key: 'wavedata', - * url: 'files/AlienWaveData.json' + * this.load.image({ + * key: 'logo', + * url: 'images/AtariLogo.png' * }); * ``` * - * See the documentation for `Phaser.Types.Loader.FileTypes.JSONFileConfig` for more details. + * See the documentation for `Phaser.Types.Loader.FileTypes.ImageFileConfig` for more details. * - * Once the file has finished loading you can access it from its Cache using its key: + * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: * * ```javascript - * this.load.json('wavedata', 'files/AlienWaveData.json'); + * this.load.image('logo', 'images/AtariLogo.png'); * // and later in your game ... - * var data = this.cache.json.get('wavedata'); + * this.add.image(x, y, 'logo'); * ``` * * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and - * this is what you would use to retrieve the text from the JSON Cache. + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. * * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" - * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. * - * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, - * rather than the whole file. For example, if your JSON data had a structure like this: + * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, + * then you can specify it by providing an array as the `url` where the second element is the normal map: * - * ```json - * { - * "level1": { - * "baddies": { - * "aliens": {}, - * "boss": {} - * } - * }, - * "level2": {}, - * "level3": {} - * } + * ```javascript + * this.load.image('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ]); * ``` * - * And you only wanted to store the `boss` data in the Cache, then you could pass `level1.baddies.boss`as the `dataKey`. + * Or, if you are using a config object use the `normalMap` property: * - * Note: The ability to load this type of file will only be available if the JSON File type has been built into Phaser. + * ```javascript + * this.load.image({ + * key: 'logo', + * url: 'images/AtariLogo.png', + * normalMap: 'images/AtariLogo-n.png' + * }); + * ``` + * + * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. + * Normal maps are a WebGL only feature. + * + * Note: The ability to load this type of file will only be available if the Image File type has been built into Phaser. * It is available in the default build but can be excluded from custom builds. * - * @method Phaser.Loader.LoaderPlugin#json + * @method Phaser.Loader.LoaderPlugin#image * @fires Phaser.Loader.LoaderPlugin#ADD * @since 3.0.0 * - * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. - * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {this} The Loader instance. */ -FileTypesManager.register('json', function (key, url, dataKey, xhrSettings) +FileTypesManager.register('image', function (key, url, xhrSettings) { if (Array.isArray(key)) { for (var i = 0; i < key.length; i++) { // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new JSONFile(this, key[i])); + this.addFile(new ImageFile(this, key[i])); } } else { - this.addFile(new JSONFile(this, key, url, xhrSettings, dataKey)); + this.addFile(new ImageFile(this, key, url, xhrSettings)); } return this; }); -module.exports = JSONFile; +module.exports = ImageFile; /***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); - -/** - * @classdesc - * A MultiFile is a special kind of parent that contains two, or more, Files as children and looks after - * the loading and processing of them all. It is commonly extended and used as a base class for file types such as AtlasJSON or BitmapFont. - * - * You shouldn't create an instance of a MultiFile directly, but should extend it with your own class, setting a custom type and processing methods. - * - * @class MultiFile - * @memberof Phaser.Loader - * @constructor - * @since 3.7.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File. - * @param {string} type - The file type string for sorting within the Loader. - * @param {string} key - The key of the file within the loader. - * @param {Phaser.Loader.File[]} files - An array of Files that make-up this MultiFile. - */ -var MultiFile = new Class({ - - initialize: - - function MultiFile (loader, type, key, files) - { - /** - * A reference to the Loader that is going to load this file. - * - * @name Phaser.Loader.MultiFile#loader - * @type {Phaser.Loader.LoaderPlugin} - * @since 3.7.0 - */ - this.loader = loader; - - /** - * The file type string for sorting within the Loader. - * - * @name Phaser.Loader.MultiFile#type - * @type {string} - * @since 3.7.0 - */ - this.type = type; - - /** - * Unique cache key (unique within its file type) - * - * @name Phaser.Loader.MultiFile#key - * @type {string} - * @since 3.7.0 - */ - this.key = key; - - /** - * The current index being used by multi-file loaders to avoid key clashes. - * - * @name Phaser.Loader.MultiFile#multiKeyIndex - * @type {integer} - * @private - * @since 3.20.0 - */ - this.multiKeyIndex = loader.multiKeyIndex++; - - /** - * Array of files that make up this MultiFile. - * - * @name Phaser.Loader.MultiFile#files - * @type {Phaser.Loader.File[]} - * @since 3.7.0 - */ - this.files = files; - - /** - * The completion status of this MultiFile. - * - * @name Phaser.Loader.MultiFile#complete - * @type {boolean} - * @default false - * @since 3.7.0 - */ - this.complete = false; - - /** - * The number of files to load. - * - * @name Phaser.Loader.MultiFile#pending - * @type {integer} - * @since 3.7.0 - */ - - this.pending = files.length; - - /** - * The number of files that failed to load. - * - * @name Phaser.Loader.MultiFile#failed - * @type {integer} - * @default 0 - * @since 3.7.0 - */ - this.failed = 0; - - /** - * A storage container for transient data that the loading files need. - * - * @name Phaser.Loader.MultiFile#config - * @type {any} - * @since 3.7.0 - */ - this.config = {}; - - /** - * A reference to the Loaders baseURL at the time this MultiFile was created. - * Used to populate child-files. - * - * @name Phaser.Loader.MultiFile#baseURL - * @type {string} - * @since 3.20.0 - */ - this.baseURL = loader.baseURL; - - /** - * A reference to the Loaders path at the time this MultiFile was created. - * Used to populate child-files. - * - * @name Phaser.Loader.MultiFile#path - * @type {string} - * @since 3.20.0 - */ - this.path = loader.path; - - /** - * A reference to the Loaders prefix at the time this MultiFile was created. - * Used to populate child-files. - * - * @name Phaser.Loader.MultiFile#prefix - * @type {string} - * @since 3.20.0 - */ - this.prefix = loader.prefix; - - // Link the files - for (var i = 0; i < files.length; i++) - { - files[i].multiFile = this; - } - }, - - /** - * Checks if this MultiFile is ready to process its children or not. - * - * @method Phaser.Loader.MultiFile#isReadyToProcess - * @since 3.7.0 - * - * @return {boolean} `true` if all children of this MultiFile have loaded, otherwise `false`. - */ - isReadyToProcess: function () - { - return (this.pending === 0 && this.failed === 0 && !this.complete); - }, - - /** - * Adds another child to this MultiFile, increases the pending count and resets the completion status. - * - * @method Phaser.Loader.MultiFile#addToMultiFile - * @since 3.7.0 - * - * @param {Phaser.Loader.File} files - The File to add to this MultiFile. - * - * @return {Phaser.Loader.MultiFile} This MultiFile instance. - */ - addToMultiFile: function (file) - { - this.files.push(file); - - file.multiFile = this; - - this.pending++; - - this.complete = false; - - return this; - }, - - /** - * Called by each File when it finishes loading. - * - * @method Phaser.Loader.MultiFile#onFileComplete - * @since 3.7.0 - * - * @param {Phaser.Loader.File} file - The File that has completed processing. - */ - onFileComplete: function (file) - { - var index = this.files.indexOf(file); - - if (index !== -1) - { - this.pending--; - } - }, - - /** - * Called by each File that fails to load. - * - * @method Phaser.Loader.MultiFile#onFileFailed - * @since 3.7.0 - * - * @param {Phaser.Loader.File} file - The File that has failed to load. - */ - onFileFailed: function (file) - { - var index = this.files.indexOf(file); - - if (index !== -1) - { - this.failed++; - } - } - -}); - -module.exports = MultiFile; - - -/***/ }), -/* 64 */, -/* 65 */ +/* 68 */, +/* 69 */ /***/ (function(module, exports) { /** @@ -11073,8 +12636,8 @@ module.exports = SetTileCollision; /***/ }), -/* 66 */ -/***/ (function(module, exports) { +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -11082,98 +12645,481 @@ module.exports = SetTileCollision; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var AnimationState = __webpack_require__(157); +var Class = __webpack_require__(0); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(14); +var GameObjectEvents = __webpack_require__(32); +var SpriteRender = __webpack_require__(1048); + /** - * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the - * layer's position, scale and scroll. + * @classdesc + * A Sprite Game Object. * - * @function Phaser.Tilemaps.Components.WorldToTileX + * A Sprite Game Object is used for the display of both static and animated images in your game. + * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled + * and animated. + * + * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. + * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation + * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. + * + * @class Sprite + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor * @since 3.0.0 * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.TextureCrop + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible * - * @return {number} The X location in tile units. + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ -var WorldToTileX = function (worldX, snapToFloor, camera, layer) -{ - if (snapToFloor === undefined) { snapToFloor = true; } +var Sprite = new Class({ - var tileWidth = layer.baseTileWidth; - var tilemapLayer = layer.tilemapLayer; + Extends: GameObject, - if (tilemapLayer) + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.ScrollFactor, + Components.Size, + Components.TextureCrop, + Components.Tint, + Components.Transform, + Components.Visible, + SpriteRender + ], + + initialize: + + function Sprite (scene, x, y, texture, frame) { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } + GameObject.call(this, scene, 'Sprite'); - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's horizontal scroll - worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + /** + * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. + * + * @name Phaser.GameObjects.Sprite#_crop + * @type {object} + * @private + * @since 3.11.0 + */ + this._crop = this.resetCropObject(); - tileWidth *= tilemapLayer.scaleX; + /** + * The Animation State component of this Sprite. + * + * This component provides features to apply animations to this Sprite. + * It is responsible for playing, loading, queuing animations for later playback, + * mixing between animations and setting the current animation frame to this Sprite. + * + * @name Phaser.GameObjects.Sprite#anims + * @type {Phaser.Animations.AnimationState} + * @since 3.0.0 + */ + this.anims = new AnimationState(this); + + this.setTexture(texture, frame); + this.setPosition(x, y); + this.setSizeToFrame(); + this.setOriginFromFrame(); + this.initPipeline(); + + this.on(GameObjectEvents.ADDED_TO_SCENE, this.addedToScene, this); + this.on(GameObjectEvents.REMOVED_FROM_SCENE, this.removedFromScene, this); + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); + }, + + /** + * Update this Sprite's animations. + * + * @method Phaser.GameObjects.Sprite#preUpdate + * @protected + * @since 3.0.0 + * + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. + */ + preUpdate: function (time, delta) + { + this.anims.update(time, delta); + }, + + /** + * Start playing the given animation on this Sprite. + * + * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. + * + * The benefit of a global animation is that multiple Sprites can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any Sprite. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Sprite. + * + * With the animation created, either globally or locally, you can now play it on this Sprite: + * + * ```javascript + * this.add.sprite(x, y).play('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config + * object instead: + * + * ```javascript + * this.add.sprite(x, y).play({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Sprite to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.GameObjects.Sprite#play + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.0.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * + * @return {this} This Game Object. + */ + play: function (key, ignoreIfPlaying) + { + return this.anims.play(key, ignoreIfPlaying); + }, + + /** + * Start playing the given animation on this Sprite, in reverse. + * + * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. + * + * The benefit of a global animation is that multiple Sprites can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any Sprite. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Sprite. + * + * With the animation created, either globally or locally, you can now play it on this Sprite: + * + * ```javascript + * this.add.sprite(x, y).playReverse('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config + * object instead: + * + * ```javascript + * this.add.sprite(x, y).playReverse({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Sprite to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.GameObjects.Sprite#playReverse + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * + * @return {this} This Game Object. + */ + playReverse: function (key, ignoreIfPlaying) + { + return this.anims.playReverse(key, ignoreIfPlaying); + }, + + /** + * Waits for the specified delay, in milliseconds, then starts playback of the given animation. + * + * If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here. + * + * If an animation is already running and a new animation is given to this method, it will wait for + * the given delay before starting the new animation. + * + * If no animation is currently running, the given one begins after the delay. + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * Prior to Phaser 3.50 this method was called 'delayedPlay'. + * + * @method Phaser.GameObjects.Sprite#playAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} delay - The delay, in milliseconds, to wait before starting the animation playing. + * + * @return {this} This Game Object. + */ + playAfterDelay: function (key, delay) + { + return this.anims.playAfterDelay(key, delay); + }, + + /** + * Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback + * of the given animation. + * + * You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an + * idle animation to a walking animation, by making them blend smoothly into each other. + * + * If no animation is currently running, the given one will start immediately. + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * @method Phaser.GameObjects.Sprite#playAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} [repeatCount=1] - How many times should the animation repeat before the next one starts? + * + * @return {this} This Game Object. + */ + playAfterRepeat: function (key, repeatCount) + { + return this.anims.playAfterRepeat(key, repeatCount); + }, + + /** + * Sets an animation, or an array of animations, to be played immediately after the current one completes or stops. + * + * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, + * or have the `stop` method called directly on it. + * + * An animation set to repeat forever will never enter a completed state. + * + * You can chain a new animation at any point, including before the current one starts playing, during it, + * or when it ends (via its `animationcomplete` event). + * + * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained + * animations without impacting the animation they're playing. + * + * Call this method with no arguments to reset all currently chained animations. + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * @method Phaser.GameObjects.Sprite#chain + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig|string[]|Phaser.Animations.Animation[]|Phaser.Types.Animations.PlayAnimationConfig[])} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object, or an array of them. + * + * @return {this} This Game Object. + */ + chain: function (key) + { + return this.anims.chain(key); + }, + + /** + * Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` events. + * + * If no animation is playing, no event will be dispatched. + * + * If there is another animation queued (via the `chain` method) then it will start playing immediately. + * + * @method Phaser.GameObjects.Sprite#stop + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 + * + * @return {this} This Game Object. + */ + stop: function () + { + return this.anims.stop(); + }, + + /** + * Stops the current animation from playing after the specified time delay, given in milliseconds. + * + * It then dispatches the `ANIMATION_STOP` event. + * + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Sprite#stopAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 + * + * @param {number} delay - The number of milliseconds to wait before stopping this animation. + * + * @return {this} This Game Object. + */ + stopAfterDelay: function (delay) + { + return this.anims.stopAfterDelay(delay); + }, + + /** + * Stops the current animation from playing after the given number of repeats. + * + * It then dispatches the `ANIMATION_STOP` event. + * + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Sprite#stopAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 + * + * @param {number} [repeatCount=1] - How many times should the animation repeat before stopping? + * + * @return {this} This Game Object. + */ + stopAfterRepeat: function (repeatCount) + { + return this.anims.stopAfterRepeat(repeatCount); + }, + + /** + * Stops the current animation from playing when it next sets the given frame. + * If this frame doesn't exist within the animation it will not stop it from playing. + * + * It then dispatches the `ANIMATION_STOP` event. + * + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Sprite#stopOnFrame + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 + * + * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. + * + * @return {this} This Game Object. + */ + stopOnFrame: function (frame) + { + return this.anims.stopOnFrame(frame); + }, + + /** + * Build a JSON representation of this Sprite. + * + * @method Phaser.GameObjects.Sprite#toJSON + * @since 3.0.0 + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. + */ + toJSON: function () + { + return Components.ToJSON(this); + }, + + /** + * Handles the pre-destroy step for the Sprite, which removes the Animation component. + * + * @method Phaser.GameObjects.Sprite#preDestroy + * @private + * @since 3.14.0 + */ + preDestroy: function () + { + this.anims.destroy(); + + this.anims = undefined; } - return snapToFloor - ? Math.floor(worldX / tileWidth) - : worldX / tileWidth; -}; +}); -module.exports = WorldToTileX; +module.exports = Sprite; /***/ }), -/* 67 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the - * layer's position, scale and scroll. - * - * @function Phaser.Tilemaps.Components.WorldToTileY - * @since 3.0.0 - * - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} The Y location in tile units. - */ -var WorldToTileY = function (worldY, snapToFloor, camera, layer) -{ - if (snapToFloor === undefined) { snapToFloor = true; } - - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - - if (tilemapLayer) - { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's vertical scroll - worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - - tileHeight *= tilemapLayer.scaleY; - } - - return snapToFloor - ? Math.floor(worldY / tileHeight) - : worldY / tileHeight; -}; - -module.exports = WorldToTileY; - - -/***/ }), -/* 68 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11183,11 +13129,11 @@ module.exports = WorldToTileY; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(57); -var GetPoint = __webpack_require__(277); -var GetPoints = __webpack_require__(278); -var GEOM_CONST = __webpack_require__(49); -var Random = __webpack_require__(160); +var Contains = __webpack_require__(62); +var GetPoint = __webpack_require__(292); +var GetPoints = __webpack_require__(293); +var GEOM_CONST = __webpack_require__(55); +var Random = __webpack_require__(161); /** * @classdesc @@ -11221,7 +13167,7 @@ var Circle = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Circle#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -11313,7 +13259,7 @@ var Circle = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -11548,7 +13494,3876 @@ module.exports = Circle; /***/ }), -/* 69 */ +/* 72 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using floor. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. + * As will `14` snap to `10`... but `16` will snap to `15`. + * + * @function Phaser.Math.Snap.Floor + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapFloor = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.floor(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapFloor; + + +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Vector3 = __webpack_require__(37); + +/** + * @ignore + */ +var EPSILON = 0.000001; + +/** + * @classdesc + * A four-dimensional matrix. + * + * Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji + * and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + * + * @class Matrix4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. + */ +var Matrix4 = new Class({ + + initialize: + + function Matrix4 (m) + { + /** + * The matrix values. + * + * @name Phaser.Math.Matrix4#val + * @type {Float32Array} + * @since 3.0.0 + */ + this.val = new Float32Array(16); + + if (m) + { + // Assume Matrix4 with val: + this.copy(m); + } + else + { + // Default to identity + this.identity(); + } + }, + + /** + * Make a clone of this Matrix4. + * + * @method Phaser.Math.Matrix4#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} A clone of this Matrix4. + */ + clone: function () + { + return new Matrix4(this); + }, + + /** + * This method is an alias for `Matrix4.copy`. + * + * @method Phaser.Math.Matrix4#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. + * + * @return {this} This Matrix4. + */ + set: function (src) + { + return this.copy(src); + }, + + /** + * Sets all values of this Matrix4. + * + * @method Phaser.Math.Matrix4#setValues + * @since 3.50.0 + * + * @param {number} m00 - The m00 value. + * @param {number} m01 - The m01 value. + * @param {number} m02 - The m02 value. + * @param {number} m03 - The m03 value. + * @param {number} m10 - The m10 value. + * @param {number} m11 - The m11 value. + * @param {number} m12 - The m12 value. + * @param {number} m13 - The m13 value. + * @param {number} m20 - The m20 value. + * @param {number} m21 - The m21 value. + * @param {number} m22 - The m22 value. + * @param {number} m23 - The m23 value. + * @param {number} m30 - The m30 value. + * @param {number} m31 - The m31 value. + * @param {number} m32 - The m32 value. + * @param {number} m33 - The m33 value. + * + * @return {this} This Matrix4 instance. + */ + setValues: function (m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) + { + var out = this.val; + + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m03; + out[4] = m10; + out[5] = m11; + out[6] = m12; + out[7] = m13; + out[8] = m20; + out[9] = m21; + out[10] = m22; + out[11] = m23; + out[12] = m30; + out[13] = m31; + out[14] = m32; + out[15] = m33; + + return this; + }, + + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix4#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. + * + * @return {this} This Matrix4. + */ + copy: function (src) + { + var a = src.val; + + return this.setValues(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); + }, + + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix4#fromArray + * @since 3.0.0 + * + * @param {number[]} a - The array to copy the values from. Must have at least 16 elements. + * + * @return {this} This Matrix4. + */ + fromArray: function (a) + { + return this.setValues(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); + }, + + /** + * Reset this Matrix. + * + * Sets all values to `0`. + * + * @method Phaser.Math.Matrix4#zero + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + zero: function () + { + return this.setValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + }, + + /** + * Generates a transform matrix based on the given position, scale and rotation. + * + * @method Phaser.Math.Matrix4#transform + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} position - The position vector. + * @param {Phaser.Math.Vector3} scale - The scale vector. + * @param {Phaser.Math.Quaternion} rotation - The rotation quaternion. + * + * @return {this} This Matrix4. + */ + transform: function (position, scale, rotation) + { + var rotMatrix = _tempMat1.fromQuat(rotation); + + var rm = rotMatrix.val; + + var sx = scale.x; + var sy = scale.y; + var sz = scale.z; + + return this.setValues( + rm[0] * sx, + rm[1] * sx, + rm[2] * sx, + 0, + + rm[4] * sy, + rm[5] * sy, + rm[6] * sy, + 0, + + rm[8] * sz, + rm[9] * sz, + rm[10] * sz, + 0, + + position.x, + position.y, + position.z, + 1 + ); + }, + + /** + * Set the `x`, `y` and `z` values of this Matrix. + * + * @method Phaser.Math.Matrix4#xyz + * @since 3.0.0 + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {number} z - The z value. + * + * @return {this} This Matrix4. + */ + xyz: function (x, y, z) + { + this.identity(); + + var out = this.val; + + out[12] = x; + out[13] = y; + out[14] = z; + + return this; + }, + + /** + * Set the scaling values of this Matrix. + * + * @method Phaser.Math.Matrix4#scaling + * @since 3.0.0 + * + * @param {number} x - The x scaling value. + * @param {number} y - The y scaling value. + * @param {number} z - The z scaling value. + * + * @return {this} This Matrix4. + */ + scaling: function (x, y, z) + { + this.zero(); + + var out = this.val; + + out[0] = x; + out[5] = y; + out[10] = z; + out[15] = 1; + + return this; + }, + + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix4#identity + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + identity: function () + { + return this.setValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + }, + + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix4#transpose + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + transpose: function () + { + var a = this.val; + + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a12 = a[6]; + var a13 = a[7]; + var a23 = a[11]; + + a[1] = a[4]; + a[2] = a[8]; + a[3] = a[12]; + a[4] = a01; + a[6] = a[9]; + a[7] = a[13]; + a[8] = a02; + a[9] = a12; + a[11] = a[14]; + a[12] = a03; + a[13] = a13; + a[14] = a23; + + return this; + }, + + /** + * Copies the given Matrix4 into this Matrix and then inverses it. + * + * @method Phaser.Math.Matrix4#getInverse + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to invert into this Matrix4. + * + * @return {this} This Matrix4. + */ + getInverse: function (m) + { + this.copy(m); + + return this.invert(); + }, + + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix4#invert + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + invert: function () + { + var a = this.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) + { + return this; + } + + det = 1 / det; + + return this.setValues( + (a11 * b11 - a12 * b10 + a13 * b09) * det, + (a02 * b10 - a01 * b11 - a03 * b09) * det, + (a31 * b05 - a32 * b04 + a33 * b03) * det, + (a22 * b04 - a21 * b05 - a23 * b03) * det, + (a12 * b08 - a10 * b11 - a13 * b07) * det, + (a00 * b11 - a02 * b08 + a03 * b07) * det, + (a32 * b02 - a30 * b05 - a33 * b01) * det, + (a20 * b05 - a22 * b02 + a23 * b01) * det, + (a10 * b10 - a11 * b08 + a13 * b06) * det, + (a01 * b08 - a00 * b10 - a03 * b06) * det, + (a30 * b04 - a31 * b02 + a33 * b00) * det, + (a21 * b02 - a20 * b04 - a23 * b00) * det, + (a11 * b07 - a10 * b09 - a12 * b06) * det, + (a00 * b09 - a01 * b07 + a02 * b06) * det, + (a31 * b01 - a30 * b03 - a32 * b00) * det, + (a20 * b03 - a21 * b01 + a22 * b00) * det + ); + }, + + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix4#adjoint + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + adjoint: function () + { + var a = this.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + return this.setValues( + (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)), + -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)), + (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)), + -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)), + -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)), + (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)), + -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)), + (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)), + (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)), + -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)), + (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)), + -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)), + -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)), + (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)), + -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)), + (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)) + ); + }, + + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix4#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: function () + { + var a = this.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + }, + + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix4#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. + * + * @return {this} This Matrix4. + */ + multiply: function (src) + { + var a = this.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b = src.val; + + // Cache only the current line of the second matrix + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + + a[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + + a[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + + a[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + + a[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + return this; + }, + + /** + * Multiply the values of this Matrix4 by those given in the `src` argument. + * + * @method Phaser.Math.Matrix4#multiplyLocal + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The source Matrix4 that this Matrix4 is multiplied by. + * + * @return {this} This Matrix4. + */ + multiplyLocal: function (src) + { + var a = this.val; + var b = src.val; + + return this.setValues( + a[0] * b[0] + a[1] * b[4] + a[2] * b[8] + a[3] * b[12], + a[0] * b[1] + a[1] * b[5] + a[2] * b[9] + a[3] * b[13], + a[0] * b[2] + a[1] * b[6] + a[2] * b[10] + a[3] * b[14], + a[0] * b[3] + a[1] * b[7] + a[2] * b[11] + a[3] * b[15], + + a[4] * b[0] + a[5] * b[4] + a[6] * b[8] + a[7] * b[12], + a[4] * b[1] + a[5] * b[5] + a[6] * b[9] + a[7] * b[13], + a[4] * b[2] + a[5] * b[6] + a[6] * b[10] + a[7] * b[14], + a[4] * b[3] + a[5] * b[7] + a[6] * b[11] + a[7] * b[15], + + a[8] * b[0] + a[9] * b[4] + a[10] * b[8] + a[11] * b[12], + a[8] * b[1] + a[9] * b[5] + a[10] * b[9] + a[11] * b[13], + a[8] * b[2] + a[9] * b[6] + a[10] * b[10] + a[11] * b[14], + a[8] * b[3] + a[9] * b[7] + a[10] * b[11] + a[11] * b[15], + + a[12] * b[0] + a[13] * b[4] + a[14] * b[8] + a[15] * b[12], + a[12] * b[1] + a[13] * b[5] + a[14] * b[9] + a[15] * b[13], + a[12] * b[2] + a[13] * b[6] + a[14] * b[10] + a[15] * b[14], + a[12] * b[3] + a[13] * b[7] + a[14] * b[11] + a[15] * b[15] + ); + }, + + /** + * Multiplies the given Matrix4 object with this Matrix. + * + * This is the same as calling `multiplyMatrices(m, this)`. + * + * @method Phaser.Math.Matrix4#premultiply + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to multiply with this one. + * + * @return {this} This Matrix4. + */ + premultiply: function (m) + { + return this.multiplyMatrices(m, this); + }, + + /** + * Multiplies the two given Matrix4 objects and stores the results in this Matrix. + * + * @method Phaser.Math.Matrix4#multiplyMatrices + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} a - The first Matrix4 to multiply. + * @param {Phaser.Math.Matrix4} b - The second Matrix4 to multiply. + * + * @return {this} This Matrix4. + */ + multiplyMatrices: function (a, b) + { + var am = a.val; + var bm = b.val; + + var a11 = am[0]; + var a12 = am[4]; + var a13 = am[8]; + var a14 = am[12]; + var a21 = am[1]; + var a22 = am[5]; + var a23 = am[9]; + var a24 = am[13]; + var a31 = am[2]; + var a32 = am[6]; + var a33 = am[10]; + var a34 = am[14]; + var a41 = am[3]; + var a42 = am[7]; + var a43 = am[11]; + var a44 = am[15]; + + var b11 = bm[0]; + var b12 = bm[4]; + var b13 = bm[8]; + var b14 = bm[12]; + var b21 = bm[1]; + var b22 = bm[5]; + var b23 = bm[9]; + var b24 = bm[13]; + var b31 = bm[2]; + var b32 = bm[6]; + var b33 = bm[10]; + var b34 = bm[14]; + var b41 = bm[3]; + var b42 = bm[7]; + var b43 = bm[11]; + var b44 = bm[15]; + + return this.setValues( + a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41, + a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41, + a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41, + a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41, + a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42, + a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42, + a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42, + a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42, + a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43, + a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43, + a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43, + a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43, + a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44, + a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44, + a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44, + a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44 + ); + }, + + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix4#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {this} This Matrix4. + */ + translate: function (v) + { + return this.translateXYZ(v.x, v.y, v.z); + }, + + /** + * Translate this Matrix using the given values. + * + * @method Phaser.Math.Matrix4#translateXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Matrix4. + */ + translateXYZ: function (x, y, z) + { + var a = this.val; + + a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + + return this; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix4#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {this} This Matrix4. + */ + scale: function (v) + { + return this.scaleXYZ(v.x, v.y, v.z); + }, + + /** + * Apply a scale transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#scaleXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Matrix4. + */ + scaleXYZ: function (x, y, z) + { + var a = this.val; + + a[0] = a[0] * x; + a[1] = a[1] * x; + a[2] = a[2] * x; + a[3] = a[3] * x; + + a[4] = a[4] * y; + a[5] = a[5] * y; + a[6] = a[6] * y; + a[7] = a[7] * y; + + a[8] = a[8] * z; + a[9] = a[9] * z; + a[10] = a[10] * z; + a[11] = a[11] * z; + + return this; + }, + + /** + * Derive a rotation matrix around the given axis. + * + * @method Phaser.Math.Matrix4#makeRotationAxis + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. + * @param {number} angle - The rotation angle in radians. + * + * @return {this} This Matrix4. + */ + makeRotationAxis: function (axis, angle) + { + // Based on http://www.gamedev.net/reference/articles/article1199.asp + + var c = Math.cos(angle); + var s = Math.sin(angle); + var t = 1 - c; + var x = axis.x; + var y = axis.y; + var z = axis.z; + var tx = t * x; + var ty = t * y; + + return this.setValues( + tx * x + c, tx * y - s * z, tx * z + s * y, 0, + tx * y + s * z, ty * y + c, ty * z - s * x, 0, + tx * z - s * y, ty * z + s * x, t * z * z + c, 0, + 0, 0, 0, 1 + ); + }, + + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. + * + * @return {this} This Matrix4. + */ + rotate: function (rad, axis) + { + var a = this.val; + var x = axis.x; + var y = axis.y; + var z = axis.z; + var len = Math.sqrt(x * x + y * y + z * z); + + if (Math.abs(len) < EPSILON) + { + return this; + } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + var s = Math.sin(rad); + var c = Math.cos(rad); + var t = 1 - c; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + // Construct the elements of the rotation matrix + var b00 = x * x * t + c; + var b01 = y * x * t + z * s; + var b02 = z * x * t - y * s; + + var b10 = x * y * t - z * s; + var b11 = y * y * t + c; + var b12 = z * y * t + x * s; + + var b20 = x * z * t + y * s; + var b21 = y * z * t - x * s; + var b22 = z * z * t + c; + + // Perform rotation-specific matrix multiplication + return this.setValues( + a00 * b00 + a10 * b01 + a20 * b02, + a01 * b00 + a11 * b01 + a21 * b02, + a02 * b00 + a12 * b01 + a22 * b02, + a03 * b00 + a13 * b01 + a23 * b02, + a00 * b10 + a10 * b11 + a20 * b12, + a01 * b10 + a11 * b11 + a21 * b12, + a02 * b10 + a12 * b11 + a22 * b12, + a03 * b10 + a13 * b11 + a23 * b12, + a00 * b20 + a10 * b21 + a20 * b22, + a01 * b20 + a11 * b21 + a21 * b22, + a02 * b20 + a12 * b21 + a22 * b22, + a03 * b20 + a13 * b21 + a23 * b22, + a30, a31, a32, a33 + ); + }, + + /** + * Rotate this matrix on its X axis. + * + * @method Phaser.Math.Matrix4#rotateX + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {this} This Matrix4. + */ + rotateX: function (rad) + { + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + // Perform axis-specific matrix multiplication + a[4] = a10 * c + a20 * s; + a[5] = a11 * c + a21 * s; + a[6] = a12 * c + a22 * s; + a[7] = a13 * c + a23 * s; + a[8] = a20 * c - a10 * s; + a[9] = a21 * c - a11 * s; + a[10] = a22 * c - a12 * s; + a[11] = a23 * c - a13 * s; + + return this; + }, + + /** + * Rotate this matrix on its Y axis. + * + * @method Phaser.Math.Matrix4#rotateY + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {this} This Matrix4. + */ + rotateY: function (rad) + { + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + // Perform axis-specific matrix multiplication + a[0] = a00 * c - a20 * s; + a[1] = a01 * c - a21 * s; + a[2] = a02 * c - a22 * s; + a[3] = a03 * c - a23 * s; + a[8] = a00 * s + a20 * c; + a[9] = a01 * s + a21 * c; + a[10] = a02 * s + a22 * c; + a[11] = a03 * s + a23 * c; + + return this; + }, + + /** + * Rotate this matrix on its Z axis. + * + * @method Phaser.Math.Matrix4#rotateZ + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {this} This Matrix4. + */ + rotateZ: function (rad) + { + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + // Perform axis-specific matrix multiplication + a[0] = a00 * c + a10 * s; + a[1] = a01 * c + a11 * s; + a[2] = a02 * c + a12 * s; + a[3] = a03 * c + a13 * s; + a[4] = a10 * c - a00 * s; + a[5] = a11 * c - a01 * s; + a[6] = a12 * c - a02 * s; + a[7] = a13 * c - a03 * s; + + return this; + }, + + /** + * Set the values of this Matrix from the given rotation Quaternion and translation Vector. + * + * @method Phaser.Math.Matrix4#fromRotationTranslation + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. + * @param {Phaser.Math.Vector3} v - The Vector to set translation from. + * + * @return {this} This Matrix4. + */ + fromRotationTranslation: function (q, v) + { + // Quaternion math + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; + + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + + return this.setValues( + 1 - (yy + zz), + xy + wz, + xz - wy, + 0, + + xy - wz, + 1 - (xx + zz), + yz + wx, + 0, + + xz + wy, + yz - wx, + 1 - (xx + yy), + 0, + + v.x, + v.y, + v.z, + 1 + ); + }, + + /** + * Set the values of this Matrix from the given Quaternion. + * + * @method Phaser.Math.Matrix4#fromQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {this} This Matrix4. + */ + fromQuat: function (q) + { + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; + + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + + return this.setValues( + 1 - (yy + zz), + xy + wz, + xz - wy, + 0, + + xy - wz, + 1 - (xx + zz), + yz + wx, + 0, + + xz + wy, + yz - wx, + 1 - (xx + yy), + 0, + + 0, + 0, + 0, + 1 + ); + }, + + /** + * Generate a frustum matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#frustum + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {this} This Matrix4. + */ + frustum: function (left, right, bottom, top, near, far) + { + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + var nf = 1 / (near - far); + + return this.setValues( + (near * 2) * rl, + 0, + 0, + 0, + + 0, + (near * 2) * tb, + 0, + 0, + + (right + left) * rl, + (top + bottom) * tb, + (far + near) * nf, + -1, + + 0, + 0, + (far * near * 2) * nf, + 0 + ); + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspective + * @since 3.0.0 + * + * @param {number} fovy - Vertical field of view in radians + * @param {number} aspect - Aspect ratio. Typically viewport width /height. + * @param {number} near - Near bound of the frustum. + * @param {number} far - Far bound of the frustum. + * + * @return {this} This Matrix4. + */ + perspective: function (fovy, aspect, near, far) + { + var f = 1.0 / Math.tan(fovy / 2); + var nf = 1 / (near - far); + + return this.setValues( + f / aspect, + 0, + 0, + 0, + + 0, + f, + 0, + 0, + + 0, + 0, + (far + near) * nf, + -1, + + 0, + 0, + (2 * far * near) * nf, + 0 + ); + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspectiveLH + * @since 3.0.0 + * + * @param {number} width - The width of the frustum. + * @param {number} height - The height of the frustum. + * @param {number} near - Near bound of the frustum. + * @param {number} far - Far bound of the frustum. + * + * @return {this} This Matrix4. + */ + perspectiveLH: function (width, height, near, far) + { + return this.setValues( + (2 * near) / width, + 0, + 0, + 0, + + 0, + (2 * near) / height, + 0, + 0, + + 0, + 0, + -far / (near - far), + 1, + + 0, + 0, + (near * far) / (near - far), + 0 + ); + }, + + /** + * Generate an orthogonal projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#ortho + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {this} This Matrix4. + */ + ortho: function (left, right, bottom, top, near, far) + { + var lr = left - right; + var bt = bottom - top; + var nf = near - far; + + // Avoid division by zero + lr = (lr === 0) ? lr : 1 / lr; + bt = (bt === 0) ? bt : 1 / bt; + nf = (nf === 0) ? nf : 1 / nf; + + return this.setValues( + -2 * lr, + 0, + 0, + 0, + + 0, + -2 * bt, + 0, + 0, + + 0, + 0, + 2 * nf, + 0, + + (left + right) * lr, + (top + bottom) * bt, + (far + near) * nf, + 1 + ); + }, + + /** + * Generate a right-handed look-at matrix with the given eye position, target and up axis. + * + * @method Phaser.Math.Matrix4#lookAtRH + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} eye - Position of the viewer. + * @param {Phaser.Math.Vector3} target - Point the viewer is looking at. + * @param {Phaser.Math.Vector3} up - vec3 pointing up. + * + * @return {this} This Matrix4. + */ + lookAtRH: function (eye, target, up) + { + var m = this.val; + + _z.subVectors(eye, target); + + if (_z.getLengthSquared() === 0) + { + // eye and target are in the same position + _z.z = 1; + } + + _z.normalize(); + _x.crossVectors(up, _z); + + if (_x.getLengthSquared() === 0) + { + // up and z are parallel + + if (Math.abs(up.z) === 1) + { + _z.x += 0.0001; + } + else + { + _z.z += 0.0001; + } + + _z.normalize(); + _x.crossVectors(up, _z); + } + + _x.normalize(); + _y.crossVectors(_z, _x); + + m[0] = _x.x; + m[1] = _x.y; + m[2] = _x.z; + m[4] = _y.x; + m[5] = _y.y; + m[6] = _y.z; + m[8] = _z.x; + m[9] = _z.y; + m[10] = _z.z; + + return this; + }, + + /** + * Generate a look-at matrix with the given eye position, focal point, and up axis. + * + * @method Phaser.Math.Matrix4#lookAt + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} eye - Position of the viewer + * @param {Phaser.Math.Vector3} center - Point the viewer is looking at + * @param {Phaser.Math.Vector3} up - vec3 pointing up. + * + * @return {this} This Matrix4. + */ + lookAt: function (eye, center, up) + { + var eyex = eye.x; + var eyey = eye.y; + var eyez = eye.z; + + var upx = up.x; + var upy = up.y; + var upz = up.z; + + var centerx = center.x; + var centery = center.y; + var centerz = center.z; + + if (Math.abs(eyex - centerx) < EPSILON && + Math.abs(eyey - centery) < EPSILON && + Math.abs(eyez - centerz) < EPSILON) + { + return this.identity(); + } + + var z0 = eyex - centerx; + var z1 = eyey - centery; + var z2 = eyez - centerz; + + var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + + z0 *= len; + z1 *= len; + z2 *= len; + + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; + + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + + if (!len) + { + x0 = 0; + x1 = 0; + x2 = 0; + } + else + { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + var y0 = z1 * x2 - z2 * x1; + var y1 = z2 * x0 - z0 * x2; + var y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + + if (!len) + { + y0 = 0; + y1 = 0; + y2 = 0; + } + else + { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + return this.setValues( + x0, + y0, + z0, + 0, + + x1, + y1, + z1, + 0, + + x2, + y2, + z2, + 0, + + -(x0 * eyex + x1 * eyey + x2 * eyez), + -(y0 * eyex + y1 * eyey + y2 * eyez), + -(z0 * eyex + z1 * eyey + z2 * eyez), + 1 + ); + }, + + /** + * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. + * + * @method Phaser.Math.Matrix4#yawPitchRoll + * @since 3.0.0 + * + * @param {number} yaw - The yaw value. + * @param {number} pitch - The pitch value. + * @param {number} roll - The roll value. + * + * @return {this} This Matrix4. + */ + yawPitchRoll: function (yaw, pitch, roll) + { + this.zero(); + _tempMat1.zero(); + _tempMat2.zero(); + + var m0 = this.val; + var m1 = _tempMat1.val; + var m2 = _tempMat2.val; + + // Rotate Z + var s = Math.sin(roll); + var c = Math.cos(roll); + + m0[10] = 1; + m0[15] = 1; + m0[0] = c; + m0[1] = s; + m0[4] = -s; + m0[5] = c; + + // Rotate X + s = Math.sin(pitch); + c = Math.cos(pitch); + + m1[0] = 1; + m1[15] = 1; + m1[5] = c; + m1[10] = c; + m1[9] = -s; + m1[6] = s; + + // Rotate Y + s = Math.sin(yaw); + c = Math.cos(yaw); + + m2[5] = 1; + m2[15] = 1; + m2[0] = c; + m2[2] = -s; + m2[8] = s; + m2[10] = c; + + this.multiplyLocal(_tempMat1); + this.multiplyLocal(_tempMat2); + + return this; + }, + + /** + * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. + * + * @method Phaser.Math.Matrix4#setWorldMatrix + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. + * @param {Phaser.Math.Vector3} position - The position of the world matrix. + * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. + * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. + * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. + * + * @return {this} This Matrix4. + */ + setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) + { + this.yawPitchRoll(rotation.y, rotation.x, rotation.z); + + _tempMat1.scaling(scale.x, scale.y, scale.z); + _tempMat2.xyz(position.x, position.y, position.z); + + this.multiplyLocal(_tempMat1); + this.multiplyLocal(_tempMat2); + + if (viewMatrix) + { + this.multiplyLocal(viewMatrix); + } + + if (projectionMatrix) + { + this.multiplyLocal(projectionMatrix); + } + + return this; + }, + + /** + * Multiplies this Matrix4 by the given `src` Matrix4 and stores the results in the `out` Matrix4. + * + * @method Phaser.Math.Matrix4#multiplyToMat4 + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix4 to multiply with this one. + * @param {Phaser.Math.Matrix4} out - The receiving Matrix. + * + * @return {Phaser.Math.Matrix4} This `out` Matrix4. + */ + multiplyToMat4: function (src, out) + { + var a = this.val; + var b = src.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b00 = b[0]; + var b01 = b[1]; + var b02 = b[2]; + var b03 = b[3]; + var b10 = b[4]; + var b11 = b[5]; + var b12 = b[6]; + var b13 = b[7]; + var b20 = b[8]; + var b21 = b[9]; + var b22 = b[10]; + var b23 = b[11]; + var b30 = b[12]; + var b31 = b[13]; + var b32 = b[14]; + var b33 = b[15]; + + return out.setValues( + b00 * a00 + b01 * a10 + b02 * a20 + b03 * a30, + b01 * a01 + b01 * a11 + b02 * a21 + b03 * a31, + b02 * a02 + b01 * a12 + b02 * a22 + b03 * a32, + b03 * a03 + b01 * a13 + b02 * a23 + b03 * a33, + + b10 * a00 + b11 * a10 + b12 * a20 + b13 * a30, + b10 * a01 + b11 * a11 + b12 * a21 + b13 * a31, + b10 * a02 + b11 * a12 + b12 * a22 + b13 * a32, + b10 * a03 + b11 * a13 + b12 * a23 + b13 * a33, + + b20 * a00 + b21 * a10 + b22 * a20 + b23 * a30, + b20 * a01 + b21 * a11 + b22 * a21 + b23 * a31, + b20 * a02 + b21 * a12 + b22 * a22 + b23 * a32, + b20 * a03 + b21 * a13 + b22 * a23 + b23 * a33, + + b30 * a00 + b31 * a10 + b32 * a20 + b33 * a30, + b30 * a01 + b31 * a11 + b32 * a21 + b33 * a31, + b30 * a02 + b31 * a12 + b32 * a22 + b33 * a32, + b30 * a03 + b31 * a13 + b32 * a23 + b33 * a33 + ); + }, + + /** + * Takes the rotation and position vectors and builds this Matrix4 from them. + * + * @method Phaser.Math.Matrix4#fromRotationXYTranslation + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} rotation - The rotation vector. + * @param {Phaser.Math.Vector3} position - The position vector. + * @param {boolean} translateFirst - Should the operation translate then rotate (`true`), or rotate then translate? (`false`) + * + * @return {this} This Matrix4. + */ + fromRotationXYTranslation: function (rotation, position, translateFirst) + { + var x = position.x; + var y = position.y; + var z = position.z; + + var sx = Math.sin(rotation.x); + var cx = Math.cos(rotation.x); + + var sy = Math.sin(rotation.y); + var cy = Math.cos(rotation.y); + + var a30 = x; + var a31 = y; + var a32 = z; + + // Rotate X + + var b21 = -sx; + + // Rotate Y + + var c01 = 0 - b21 * sy; + + var c02 = 0 - cx * sy; + + var c21 = b21 * cy; + + var c22 = cx * cy; + + // Translate + if (!translateFirst) + { + // a30 = cy * x + 0 * y + sy * z; + a30 = cy * x + sy * z; + a31 = c01 * x + cx * y + c21 * z; + a32 = c02 * x + sx * y + c22 * z; + } + + return this.setValues( + cy, + c01, + c02, + 0, + 0, + cx, + sx, + 0, + sy, + c21, + c22, + 0, + a30, + a31, + a32, + 1 + ); + }, + + /** + * Returns the maximum axis scale from this Matrix4. + * + * @method Phaser.Math.Matrix4#getMaxScaleOnAxis + * @since 3.50.0 + * + * @return {number} The maximum axis scale. + */ + getMaxScaleOnAxis: function () + { + var m = this.val; + + var scaleXSq = m[0] * m[0] + m[1] * m[1] + m[2] * m[2]; + var scaleYSq = m[4] * m[4] + m[5] * m[5] + m[6] * m[6]; + var scaleZSq = m[8] * m[8] + m[9] * m[9] + m[10] * m[10]; + + return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq)); + } + +}); + +/** + * @ignore + */ +var _tempMat1 = new Matrix4(); + +/** + * @ignore + */ +var _tempMat2 = new Matrix4(); + +/** + * @ignore + */ +var _x = new Vector3(); + +/** + * @ignore + */ +var _y = new Vector3(); + +/** + * @ignore + */ +var _z = new Vector3(); + +module.exports = Matrix4; + + +/***/ }), +/* 74 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var WEBGL_CONST = { + + /** + * 8-bit twos complement signed integer. + * + * @name Phaser.Renderer.WebGL.BYTE + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + BYTE: { enum: 0x1400, size: 1 }, + + /** + * 8-bit twos complement unsigned integer. + * + * @name Phaser.Renderer.WebGL.UNSIGNED_BYTE + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + UNSIGNED_BYTE: { enum: 0x1401, size: 1 }, + + /** + * 16-bit twos complement signed integer. + * + * @name Phaser.Renderer.WebGL.SHORT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + SHORT: { enum: 0x1402, size: 2 }, + + /** + * 16-bit twos complement unsigned integer. + * + * @name Phaser.Renderer.WebGL.UNSIGNED_SHORT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + UNSIGNED_SHORT: { enum: 0x1403, size: 2 }, + + /** + * 32-bit twos complement signed integer. + * + * @name Phaser.Renderer.WebGL.INT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + INT: { enum: 0x1404, size: 4 }, + + /** + * 32-bit twos complement unsigned integer. + * + * @name Phaser.Renderer.WebGL.UNSIGNED_INT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + UNSIGNED_INT: { enum: 0x1405, size: 4 }, + + /** + * 32-bit IEEE floating point number. + * + * @name Phaser.Renderer.WebGL.FLOAT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + FLOAT: { enum: 0x1406, size: 4 } + +}; + +module.exports = WEBGL_CONST; + + +/***/ }), +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var DeepCopy = __webpack_require__(167); +var Events = __webpack_require__(190); +var GetFastValue = __webpack_require__(2); +var Matrix4 = __webpack_require__(73); +var RenderTarget = __webpack_require__(263); +var Utils = __webpack_require__(12); +var WebGLShader = __webpack_require__(574); + +/** + * @classdesc + * The `WebGLPipeline` is a base class used by all of the core Phaser pipelines. + * + * It describes the way elements will be rendered in WebGL. Internally, it handles + * compiling the shaders, creating vertex buffers, assigning primitive topology and + * binding vertex attributes, all based on the given configuration data. + * + * The pipeline is configured by passing in a `WebGLPipelineConfig` object. Please + * see the documentation for this type to fully understand the configuration options + * available to you. + * + * Usually, you would not extend from this class directly, but would instead extend + * from one of the core pipelines, such as the Multi Pipeline. + * + * The pipeline flow per render-step is as follows: + * + * 1) onPreRender - called once at the start of the render step + * 2) onRender - call for each Scene Camera that needs to render (so can be multiple times per render step) + * 3) Internal flow: + * 3a) bind (only called if a Game Object is using this pipeline and it's not currently active) + * 3b) onBind (called for every Game Object that uses this pipeline) + * 3c) flush (can be called by a Game Object, internal method or from outside by changing pipeline) + * 4) onPostRender - called once at the end of the render step + * + * @class WebGLPipeline + * @memberof Phaser.Renderer.WebGL + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. + */ +var WebGLPipeline = new Class({ + + initialize: + + function WebGLPipeline (config) + { + var game = config.game; + var renderer = game.renderer; + var gl = renderer.gl; + + /** + * Name of the pipeline. Used for identification and setting from Game Objects. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#name + * @type {string} + * @since 3.0.0 + */ + this.name = GetFastValue(config, 'name', 'WebGLPipeline'); + + /** + * The Phaser Game instance to which this pipeline is bound. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; + + /** + * The WebGL Renderer instance to which this pipeline is bound. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.0.0 + */ + this.renderer = renderer; + + /** + * A reference to the WebGL Pipeline Manager. + * + * This is initially undefined and only set when this pipeline is added + * to the manager. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#manager + * @type {?Phaser.Renderer.WebGL.PipelineManager} + * @since 3.50.0 + */ + this.manager; + + /** + * The WebGL context this WebGL Pipeline uses. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#gl + * @type {WebGLRenderingContext} + * @since 3.0.0 + */ + this.gl = gl; + + /** + * The canvas which this WebGL Pipeline renders to. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#view + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.view = game.canvas; + + /** + * Width of the current viewport. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#width + * @type {number} + * @since 3.0.0 + */ + this.width = 0; + + /** + * Height of the current viewport. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#height + * @type {number} + * @since 3.0.0 + */ + this.height = 0; + + /** + * The current number of vertices that have been added to the pipeline batch. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.vertexCount = 0; + + /** + * The total number of vertices that this pipeline batch can hold before it will flush. + * + * This defaults to `renderer batchSize * 7`, where `batchSize` is defined in the Renderer Config. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity + * @type {number} + * @since 3.0.0 + */ + this.vertexCapacity = 0; + + /** + * Raw byte buffer of vertices. + * + * Either set via the config object, or generates a new Array Buffer of size `vertexCapacity * vertexSize`. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData + * @type {ArrayBuffer} + * @readonly + * @since 3.0.0 + */ + this.vertexData; + + /** + * The WebGLBuffer that holds the vertex data. + * + * Created from the `vertices` config ArrayBuffer that was passed in, or set by default, by the pipeline. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer + * @type {WebGLBuffer} + * @readonly + * @since 3.0.0 + */ + this.vertexBuffer; + + /** + * The primitive topology which the pipeline will use to submit draw calls. + * + * Defaults to GL_TRIANGLES if not otherwise set in the config. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#topology + * @type {GLenum} + * @since 3.0.0 + */ + this.topology = GetFastValue(config, 'topology', gl.TRIANGLES); + + /** + * Uint8 view to the `vertexData` ArrayBuffer. Used for uploading vertex buffer resources to the GPU. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes + * @type {Uint8Array} + * @since 3.0.0 + */ + this.bytes; + + /** + * Float32 view of the array buffer containing the pipeline's vertices. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32; + + /** + * Uint32 view of the array buffer containing the pipeline's vertices. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexViewU32 + * @type {Uint32Array} + * @since 3.0.0 + */ + this.vertexViewU32; + + /** + * Indicates if the current pipeline is active, or not, for this frame only. + * + * Reset to `true` in the `onRender` method. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#active + * @type {boolean} + * @since 3.10.0 + */ + this.active = false; + + /** + * Holds the most recently assigned texture unit. + + * Treat this value as read-only. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentUnit + * @type {number} + * @since 3.50.0 + */ + this.currentUnit = 0; + + /** + * Some pipelines require the forced use of texture zero (like the light pipeline). + * + * This property should be set when that is the case. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#forceZero + * @type {boolean} + * @since 3.50.0 + */ + this.forceZero = GetFastValue(config, 'forceZero', false); + + /** + * Indicates if this pipeline has booted or not. + * + * A pipeline boots only when the Game instance itself, and all associated systems, is + * fully ready. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#hasBooted + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.hasBooted = false; + + /** + * Indicates if this is a Post FX Pipeline, or not. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#isPostFX + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.isPostFX = false; + + /** + * An array of RenderTarget instances that belong to this pipeline. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#renderTargets + * @type {Phaser.Renderer.WebGL.RenderTarget[]} + * @since 3.50.0 + */ + this.renderTargets = []; + + /** + * A reference to the currently bound Render Target instance from the `WebGLPipeline.renderTargets` array. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentRenderTarget + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.currentRenderTarget; + + /** + * An array of all the WebGLShader instances that belong to this pipeline. + * + * Shaders manage their own attributes and uniforms, but share the same vertex data buffer, + * which belongs to this pipeline. + * + * Shaders are set in a call to the `setShadersFromConfig` method, which happens automatically, + * but can also be called at any point in your game. See the method documentation for details. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#shaders + * @type {Phaser.Renderer.WebGL.WebGLShader[]} + * @since 3.50.0 + */ + this.shaders = []; + + /** + * A reference to the currently bound WebGLShader instance from the `WebGLPipeline.shaders` array. + * + * For lots of pipelines, this is the only shader, so it is a quick way to reference it without + * an array look-up. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.currentShader; + + /** + * The Projection matrix, used by shaders as 'uProjectionMatrix' uniform. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#projectionMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.projectionMatrix; + + /** + * The configuration object that was used to create this pipeline. + * + * Treat this object as 'read only', because changing it post-creation will not + * impact this pipeline in any way. However, it is used internally for cloning + * and post-boot set-up. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#config + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} + * @since 3.50.0 + */ + this.config = config; + }, + + /** + * Called when the Game has fully booted and the Renderer has finished setting up. + * + * By this stage all Game level systems are now in place. You can perform any final tasks that the + * pipeline may need, that relies on game systems such as the Texture Manager being ready. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#boot + * @since 3.11.0 + */ + boot: function () + { + var i; + var gl = this.gl; + var config = this.config; + var renderer = this.renderer; + + if (!this.isPostFX) + { + this.projectionMatrix = new Matrix4().identity(); + } + + // Create the Render Targets + + var renderTargets = this.renderTargets; + + var targets = GetFastValue(config, 'renderTarget', false); + + // If boolean, set to number = 1 + if (typeof(targets) === 'boolean' && targets) + { + targets = 1; + } + + var width = renderer.width; + var height = renderer.height; + + if (typeof(targets) === 'number') + { + // Create this many default RTs + for (i = 0; i < targets; i++) + { + renderTargets.push(new RenderTarget(renderer, width, height, 1, 0, true)); + } + } + else if (Array.isArray(targets)) + { + for (i = 0; i < targets.length; i++) + { + var scale = GetFastValue(targets[i], 'scale', 1); + var minFilter = GetFastValue(targets[i], 'minFilter', 0); + var autoClear = GetFastValue(targets[i], 'autoClear', 1); + + renderTargets.push(new RenderTarget(renderer, width, height, scale, minFilter, autoClear)); + } + } + + if (renderTargets.length) + { + // Default to the first one in the array + this.currentRenderTarget = renderTargets[0]; + } + + // Create the Shaders + + this.setShadersFromConfig(config); + + // Which shader has the largest vertex size? + var shaders = this.shaders; + var vertexSize = 0; + + for (i = 0; i < shaders.length; i++) + { + if (shaders[i].vertexSize > vertexSize) + { + vertexSize = shaders[i].vertexSize; + } + } + + var batchSize = GetFastValue(config, 'batchSize', renderer.config.batchSize); + + // * 6 because there are 6 vertices in a quad and 'batchSize' represents the quantity of quads in the batch + + this.vertexCapacity = batchSize * 6; + + var data = GetFastValue(config, 'vertices', new ArrayBuffer(this.vertexCapacity * vertexSize)); + + this.vertexData = data; + + if (GetFastValue(config, 'vertices', null)) + { + this.vertexBuffer = renderer.createVertexBuffer(data, gl.STATIC_DRAW); + } + else + { + this.vertexBuffer = renderer.createVertexBuffer(data.byteLength, gl.DYNAMIC_DRAW); + } + + this.bytes = new Uint8Array(data); + + this.vertexViewF32 = new Float32Array(data); + + this.vertexViewU32 = new Uint32Array(data); + + // Set-up shaders + + this.renderer.setVertexBuffer(this.vertexBuffer); + + for (i = 0; i < shaders.length; i++) + { + shaders[i].rebind(); + } + + this.currentShader.bind(); + + this.hasBooted = true; + + renderer.on(Events.RESIZE, this.resize, this); + renderer.on(Events.PRE_RENDER, this.onPreRender, this); + renderer.on(Events.RENDER, this.onRender, this); + renderer.on(Events.POST_RENDER, this.onPostRender, this); + + this.onBoot(); + }, + + /** + * This method is called once when this pipeline has finished being set-up + * at the end of the boot process. By the time this method is called, all + * of the shaders are ready and configured. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBoot + * @since 3.50.0 + */ + onBoot: function () + { + }, + + /** + * This method is called once when this pipeline has finished being set-up + * at the end of the boot process. By the time this method is called, all + * of the shaders are ready and configured. It's also called if the renderer + * changes size. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onResize + * @since 3.50.0 + * + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + */ + onResize: function () + { + }, + + /** + * Sets the currently active shader within this pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setShader + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} shader - The shader to set as being current. + * @param {boolean} [setAttributes=false] - Should the vertex attribute pointers be set? + * + * @return {this} This WebGLPipeline instance. + */ + setShader: function (shader, setAttributes) + { + var renderer = this.renderer; + + if (shader !== this.currentShader || renderer.currentProgram !== this.currentShader.program) + { + this.flush(); + + renderer.resetTextures(); + + renderer.setVertexBuffer(this.vertexBuffer); + + shader.bind(setAttributes, false); + + this.currentShader = shader; + } + + return this; + }, + + /** + * Searches all shaders in this pipeline for one matching the given name, then returns it. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#getShaderByName + * @since 3.50.0 + * + * @param {string} name - The index of the shader to set. + * + * @return {Phaser.Renderer.WebGL.WebGLShader} The WebGLShader instance, if found. + */ + getShaderByName: function (name) + { + var shaders = this.shaders; + + for (var i = 0; i < shaders.length; i++) + { + if (shaders[i].name === name) + { + return shaders[i]; + } + } + }, + + /** + * Destroys all shaders currently set in the `WebGLPipeline.shaders` array and then parses the given + * `config` object, extracting the shaders from it, creating `WebGLShader` instances and finally + * setting them into the `shaders` array of this pipeline. + * + * This is a destructive process. Be very careful when you call it, should you need to. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setShadersFromConfig + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. + * + * @return {this} This WebGLPipeline instance. + */ + setShadersFromConfig: function (config) + { + var i; + var shaders = this.shaders; + var renderer = this.renderer; + + for (i = 0; i < shaders.length; i++) + { + shaders[i].destroy(); + } + + var vName = 'vertShader'; + var fName = 'fragShader'; + var uName = 'uniforms'; + var aName = 'attributes'; + + var defaultVertShader = GetFastValue(config, vName, null); + var defaultFragShader = Utils.parseFragmentShaderMaxTextures(GetFastValue(config, fName, null), renderer.maxTextures); + var defaultUniforms = GetFastValue(config, uName, null); + var defaultAttribs = GetFastValue(config, aName, null); + + var configShaders = GetFastValue(config, 'shaders', []); + + var len = configShaders.length; + + if (len === 0) + { + if (defaultVertShader && defaultFragShader) + { + this.shaders = [ new WebGLShader(this, 'default', defaultVertShader, defaultFragShader, DeepCopy(defaultAttribs), DeepCopy(defaultUniforms)) ]; + } + } + else + { + var newShaders = []; + + for (i = 0; i < len; i++) + { + var shaderEntry = configShaders[i]; + + var name = GetFastValue(shaderEntry, 'name', 'default'); + + var vertShader = GetFastValue(shaderEntry, vName, defaultVertShader); + var fragShader = Utils.parseFragmentShaderMaxTextures(GetFastValue(shaderEntry, fName, defaultFragShader), renderer.maxTextures); + var attributes = GetFastValue(shaderEntry, aName, defaultAttribs); + var uniforms = GetFastValue(shaderEntry, uName, defaultUniforms); + + if (vertShader && fragShader) + { + newShaders.push(new WebGLShader(this, name, vertShader, fragShader, DeepCopy(attributes), DeepCopy(uniforms))); + } + } + + this.shaders = newShaders; + } + + if (this.shaders.length === 0) + { + console.warn('Pipeline: ' + this.name + ' - Invalid shader config'); + } + else + { + this.currentShader = this.shaders[0]; + } + + return this; + }, + + /** + * Custom pipelines can use this method in order to perform any required pre-batch tasks + * for the given Game Object. It must return the texture unit the Game Object was assigned. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setGameObject + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. + * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. + * + * @return {number} The texture unit the Game Object has been assigned. + */ + setGameObject: function (gameObject, frame) + { + if (frame === undefined) { frame = gameObject.frame; } + + this.currentUnit = this.renderer.setTextureSource(frame.source); + + return this.currentUnit; + }, + + /** + * Check if the current batch of vertices is full. + * + * You can optionally provide an `amount` parameter. If given, it will check if the batch + * needs to flush _if_ the `amount` is added to it. This allows you to test if you should + * flush before populating the batch. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush + * @since 3.0.0 + * + * @param {number} [amount=0] - Will the batch need to flush if this many vertices are added to it? + * + * @return {boolean} `true` if the current batch should be flushed, otherwise `false`. + */ + shouldFlush: function (amount) + { + if (amount === undefined) { amount = 0; } + + return (this.vertexCount + amount > this.vertexCapacity); + }, + + /** + * Resizes the properties used to describe the viewport. + * + * This method is called automatically by the renderer during its resize handler. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#resize + * @since 3.0.0 + * + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + * + * @return {this} This WebGLPipeline instance. + */ + resize: function (width, height) + { + if (width !== this.width || height !== this.height) + { + this.flush(); + } + + this.width = width; + this.height = height; + + var projectionMatrix = this.projectionMatrix; + + // Because Post FX Pipelines don't have them + if (projectionMatrix) + { + projectionMatrix.ortho(0, width, height, 0, -1000, 1000); + } + + var i; + + var targets = this.renderTargets; + + for (i = 0; i < targets.length; i++) + { + targets[i].resize(width, height); + } + + var shaders = this.shaders; + + for (i = 0; i < shaders.length; i++) + { + var shader = shaders[i]; + + if (shader.hasUniform('uProjectionMatrix')) + { + this.setMatrix4fv('uProjectionMatrix', false, projectionMatrix.val, shader); + } + } + + this.onResize(width, height); + + return this; + }, + + /** + * This method is called every time the Pipeline Manager makes this pipeline the currently active one. + * + * It binds the resources and shader needed for this pipeline, including setting the vertex buffer + * and attribute pointers. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bind + * @since 3.0.0 + * + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * + * @return {this} This WebGLPipeline instance. + */ + bind: function (currentShader) + { + if (currentShader === undefined) { currentShader = this.currentShader; } + + var wasBound = this.renderer.setVertexBuffer(this.vertexBuffer); + + currentShader.bind(wasBound); + + this.currentShader = currentShader; + + return this; + }, + + /** + * This method is called every time the Pipeline Manager rebinds this pipeline. + * + * It resets all shaders this pipeline uses, setting their attributes again. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#rebind + * @since 3.0.0 + * + * @return {this} This WebGLPipeline instance. + */ + rebind: function () + { + this.renderer.setVertexBuffer(this.vertexBuffer); + + var shaders = this.shaders; + + for (var i = 0; i < shaders.length; i++) + { + shaders[i].rebind(); + } + + this.currentShader = shaders[0]; + + this.onRebind(); + + return this; + }, + + /** + * This method is called as a result of the `WebGLPipeline.batchQuad` method, right before a quad + * belonging to a Game Object is about to be added to the batch. When this is called, the + * renderer has just performed a flush. It will bind the current render target, if any are set + * and finally call the `onPreBatch` hook. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#preBatch + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.Cameras.Scene2D.Camera)} [gameObject] - The Game Object or Camera that invoked this pipeline, if any. + * + * @return {this} This WebGLPipeline instance. + */ + preBatch: function (gameObject) + { + if (this.currentRenderTarget) + { + this.currentRenderTarget.bind(); + } + + this.onPreBatch(gameObject); + + return this; + }, + + /** + * This method is called as a result of the `WebGLPipeline.batchQuad` method, right after a quad + * belonging to a Game Object has been added to the batch. When this is called, the + * renderer has just performed a flush. + * + * It calls the `onDraw` hook followed by the `onPostBatch` hook, which can be used to perform + * additional Post FX Pipeline processing. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#postBatch + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.Cameras.Scene2D.Camera)} [gameObject] - The Game Object or Camera that invoked this pipeline, if any. + * + * @return {this} This WebGLPipeline instance. + */ + postBatch: function (gameObject) + { + this.onDraw(this.currentRenderTarget); + + this.onPostBatch(gameObject); + + return this; + }, + + /** + * This method is only used by Post FX Pipelines and those that extend from them. + * + * This method is called every time the `postBatch` method is called and is passed a + * reference to the current render target. + * + * At the very least a Post FX Pipeline should call `this.bindAndDraw(renderTarget)`, + * however, you can do as much additional processing as you like in this method if + * you override it from within your own pipelines. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onDraw + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} renderTarget - The Render Target. + */ + onDraw: function () + { + }, + + /** + * This method is called every time the Pipeline Manager deactivates this pipeline, swapping from + * it to another one. This happens after a call to `flush` and before the new pipeline is bound. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#unbind + * @since 3.50.0 + */ + unbind: function () + { + if (this.currentRenderTarget) + { + this.currentRenderTarget.unbind(); + } + }, + + /** + * Uploads the vertex data and emits a draw call for the current batch of vertices. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#flush + * @since 3.0.0 + * + * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? + * + * @return {this} This WebGLPipeline instance. + */ + flush: function (isPostFlush) + { + if (isPostFlush === undefined) { isPostFlush = false; } + + var vertexCount = this.vertexCount; + + if (vertexCount > 0) + { + this.onBeforeFlush(isPostFlush); + + var gl = this.gl; + var vertexSize = this.currentShader.vertexSize; + + if (vertexCount === this.vertexCapacity) + { + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.DYNAMIC_DRAW); + } + else + { + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); + } + + gl.drawArrays(this.topology, 0, vertexCount); + + this.vertexCount = 0; + + this.onAfterFlush(isPostFlush); + } + + return this; + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called every time a **Game Object** asks the Pipeline Manager to use this pipeline. + * + * Unlike the `bind` method, which is only called once per frame, this is called for every object + * that requests use of this pipeline, allowing you to perform per-object set-up, such as loading + * shader uniform data. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + */ + onBind: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called when the Pipeline Manager needs to rebind this pipeline. This happens after a + * pipeline has been cleared, usually when passing control over to a 3rd party WebGL library, like Spine, + * and then returing to Phaser again. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onRebind + * @since 3.50.0 + */ + onRebind: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called every time the `batchQuad` or `batchTri` methods are called. If this was + * as a result of a Game Object, then the Game Object refernce is passed to this hook too. + * + * This hook is called _after_ the quad (or tri) has been added to the batch, so you can safely + * call 'flush' from within this. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + */ + onBatch: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called immediately before a **Game Object** is about to add itself to the batch. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + */ + onPreBatch: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called immediately after a **Game Object** has been added to the batch. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + */ + onPostBatch: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called once per frame, right before anything has been rendered, but after the canvas + * has been cleared. If this pipeline has a targetTexture, it will be cleared. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender + * @since 3.50.0 + */ + onPreRender: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called once per frame, for every Camera in a Scene that wants to render. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender + * @since 3.50.0 + * + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. + */ + onRender: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called once per frame, after all rendering has happened and snapshots have been taken. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender + * @since 3.50.0 + */ + onPostRender: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called every time this pipeline is asked to flush its batch. + * + * It is called immediately before the gl.bufferData and gl.drawArray calls are made, so you can + * perform any final pre-render modifications. To apply changes post-render, see `onPostBatch`. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBeforeFlush + * @since 3.50.0 + * + * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? + */ + onBeforeFlush: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called immediately after this pipeline has finished flushing its batch. + * + * It is called after the `gl.drawArrays` call. + * + * You can perform additional post-render effects, but be careful not to call `flush` + * on this pipeline from within this method, or you'll cause an infinite loop. + * + * To apply changes pre-render, see `onBeforeFlush`. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onAfterFlush + * @since 3.50.0 + * + * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? + */ + onAfterFlush: function () + { + }, + + /** + * Adds a single vertex to the current vertex buffer and increments the + * `vertexCount` property by 1. + * + * This method is called directly by `batchTri` and `batchQuad`. + * + * It does not perform any batch limit checking itself, so if you need to call + * this method directly, do so in the same way that `batchQuad` does, for example. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#batchVert + * @since 3.50.0 + * + * @param {number} x - The vertex x position. + * @param {number} y - The vertex y position. + * @param {number} u - UV u value. + * @param {number} v - UV v value. + * @param {number} unit - Texture unit to which the texture needs to be bound. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {number} tint - The tint color value. + */ + batchVert: function (x, y, u, v, unit, tintEffect, tint) + { + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; + + vertexViewF32[++vertexOffset] = x; + vertexViewF32[++vertexOffset] = y; + vertexViewF32[++vertexOffset] = u; + vertexViewF32[++vertexOffset] = v; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tint; + + this.vertexCount++; + }, + + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 6 vertices in the following arrangement: + * + * ``` + * 0----3 + * |\ B| + * | \ | + * | \ | + * | A \| + * | \ + * 1----2 + * ``` + * + * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#batchQuad + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|null)} gameObject - The Game Object, if any, drawing this quad. + * @param {number} x0 - The top-left x position. + * @param {number} y0 - The top-left y position. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} u0 - UV u0 value. + * @param {number} v0 - UV v0 value. + * @param {number} u1 - UV u1 value. + * @param {number} v1 - UV v1 value. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * @param {number} tintBR - The bottom-right tint color value. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {number} [unit=0] - Texture unit to which the texture needs to be bound. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchQuad: function (gameObject, x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) + { + if (unit === undefined) { unit = this.currentUnit; } + + var hasFlushed = false; + + if (this.shouldFlush(6)) + { + this.flush(); + + hasFlushed = true; + + unit = this.setTexture2D(texture); + } + + this.batchVert(x0, y0, u0, v0, unit, tintEffect, tintTL); + this.batchVert(x1, y1, u0, v1, unit, tintEffect, tintBL); + this.batchVert(x2, y2, u1, v1, unit, tintEffect, tintBR); + this.batchVert(x0, y0, u0, v0, unit, tintEffect, tintTL); + this.batchVert(x2, y2, u1, v1, unit, tintEffect, tintBR); + this.batchVert(x3, y3, u1, v0, unit, tintEffect, tintTR); + + this.onBatch(gameObject); + + return hasFlushed; + }, + + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 3 vertices in the following arrangement: + * + * ``` + * 0 + * |\ + * | \ + * | \ + * | \ + * | \ + * 1-----2 + * ``` + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#batchTri + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|null)} gameObject - The Game Object, if any, drawing this quad. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} u0 - UV u0 value. + * @param {number} v0 - UV v0 value. + * @param {number} u1 - UV u1 value. + * @param {number} v1 - UV v1 value. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {number} [unit=0] - Texture unit to which the texture needs to be bound. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchTri: function (gameObject, x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) + { + if (unit === undefined) { unit = this.currentUnit; } + + var hasFlushed = false; + + if (this.shouldFlush(3)) + { + this.flush(); + + hasFlushed = true; + + unit = this.setTexture2D(texture); + } + + this.batchVert(x0, y0, u0, v0, unit, tintEffect, tintTL); + this.batchVert(x1, y1, u0, v1, unit, tintEffect, tintTR); + this.batchVert(x2, y2, u1, v1, unit, tintEffect, tintBL); + + this.onBatch(gameObject); + + return hasFlushed; + }, + + /** + * Pushes a filled rectangle into the vertex batch. + * + * The dimensions are run through `Math.floor` before the quad is generated. + * + * Rectangle has no transform values and isn't transformed into the local space. + * + * Used for directly batching untransformed rectangles, such as Camera background colors. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#drawFillRect + * @since 3.50.0 + * + * @param {number} x - Horizontal top left coordinate of the rectangle. + * @param {number} y - Vertical top left coordinate of the rectangle. + * @param {number} width - Width of the rectangle. + * @param {number} height - Height of the rectangle. + * @param {number} color - Color of the rectangle to draw. + * @param {number} alpha - Alpha value of the rectangle to draw. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {boolean} [flipUV=true] - Flip the vertical UV coordinates of the texture before rendering? + */ + drawFillRect: function (x, y, width, height, color, alpha, texture, flipUV) + { + if (texture === undefined) { texture = this.renderer.whiteTexture.glTexture; } + if (flipUV === undefined) { flipUV = true; } + + x = Math.floor(x); + y = Math.floor(y); + + var xw = Math.floor(x + width); + var yh = Math.floor(y + height); + + var unit = this.setTexture2D(texture); + + var tint = Utils.getTintAppendFloatAlphaAndSwap(color, alpha); + + var u0 = 0; + var v0 = 0; + var u1 = 1; + var v1 = 1; + + if (flipUV) + { + v0 = 1; + v1 = 0; + } + + this.batchQuad(null, x, y, x, yh, xw, yh, xw, y, u0, v0, u1, v1, tint, tint, tint, tint, 0, texture, unit); + }, + + /** + * Sets the texture to be bound to the next available texture unit and returns + * the unit id. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setTexture2D + * @since 3.50.0 + * + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses `whiteTexture`. + * + * @return {number} The assigned texture unit. + */ + setTexture2D: function (texture) + { + if (texture === undefined) { texture = this.renderer.whiteTexture.glTexture; } + + this.currentUnit = this.renderer.setTexture2D(texture); + + return this.currentUnit; + }, + + /** + * Activates the given WebGL Texture and binds it to the requested texture slot. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bindTexture + * @since 3.50.0 + * + * @param {WebGLTexture} [target] - The WebGLTexture to activate and bind. + * @param {number} [unit=0] - The WebGL texture ID to activate. Defaults to `gl.TEXTURE0`. + * + * @return {this} This WebGL Pipeline instance. + */ + bindTexture: function (texture, unit) + { + if (unit === undefined) { unit = 0; } + + var gl = this.gl; + + gl.activeTexture(gl.TEXTURE0 + unit); + + gl.bindTexture(gl.TEXTURE_2D, texture); + + return this; + }, + + /** + * Activates the given Render Target texture and binds it to the + * requested WebGL texture slot. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bindRenderTarget + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The Render Target to activate and bind. + * @param {number} [unit=0] - The WebGL texture ID to activate. Defaults to `gl.TEXTURE0`. + * + * @return {this} This WebGL Pipeline instance. + */ + bindRenderTarget: function (target, unit) + { + return this.bindTexture(target.texture, unit); + }, + + /** + * Sets the current duration into a 1f uniform value based on the given name. + * + * This can be used for mapping time uniform values, such as `iTime`. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setTime + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * + * @return {this} This WebGLPipeline instance. + */ + setTime: function (uniform) + { + this.set1f(uniform, this.game.loop.getDuration()); + + return this; + }, + + /** + * Sets a 1f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `float` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1f: function (name, x, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set1f(name, x); + + return this; + }, + + /** + * Sets a 2f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec2` uniform. + * @param {number} y - The new Y component of the `vec2` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2f: function (name, x, y, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set2f(name, x, y); + + return this; + }, + + /** + * Sets a 3f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec3` uniform. + * @param {number} y - The new Y component of the `vec3` uniform. + * @param {number} z - The new Z component of the `vec3` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3f: function (name, x, y, z, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set3f(name, x, y, z); + + return this; + }, + + /** + * Sets a 4f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform + * @param {number} y - Y component of the uniform + * @param {number} z - Z component of the uniform + * @param {number} w - W component of the uniform + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4f: function (name, x, y, z, w, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set4f(name, x, y, z, w); + + return this; + }, + + /** + * Sets a 1fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set1fv(name, arr); + + return this; + }, + + /** + * Sets a 2fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set2fv(name, arr); + + return this; + }, + + /** + * Sets a 3fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set3fv(name, arr); + + return this; + }, + + /** + * Sets a 4fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set4fv(name, arr); + + return this; + }, + + /** + * Sets a 1iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set1iv(name, arr); + + return this; + }, + + /** + * Sets a 2iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set2iv(name, arr); + + return this; + }, + + /** + * Sets a 3iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set3iv(name, arr); + + return this; + }, + + /** + * Sets a 4iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set4iv(name, arr); + + return this; + }, + + /** + * Sets a 1i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `int` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1i: function (name, x, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set1i(name, x); + + return this; + }, + + /** + * Sets a 2i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec2` uniform. + * @param {number} y - The new Y component of the `ivec2` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2i: function (name, x, y, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set2i(name, x, y); + + return this; + }, + + /** + * Sets a 3i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec3` uniform. + * @param {number} y - The new Y component of the `ivec3` uniform. + * @param {number} z - The new Z component of the `ivec3` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3i: function (name, x, y, z, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set3i(name, x, y, z); + + return this; + }, + + /** + * Sets a 4i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform. + * @param {number} y - Y component of the uniform. + * @param {number} z - Z component of the uniform. + * @param {number} w - W component of the uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4i: function (name, x, y, z, w, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set4i(name, x, y, z, w); + + return this; + }, + + /** + * Sets a matrix 2fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {number[]|Float32Array} matrix - The new values for the `mat2` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setMatrix2fv: function (name, transpose, matrix, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.setMatrix2fv(name, transpose, matrix); + + return this; + }, + + /** + * Sets a matrix 3fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat3` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setMatrix3fv: function (name, transpose, matrix, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.setMatrix3fv(name, transpose, matrix); + + return this; + }, + + /** + * Sets a matrix 4fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Should the matrix be transpose + * @param {Float32Array} matrix - Matrix data + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setMatrix4fv: function (name, transpose, matrix, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.setMatrix4fv(name, transpose, matrix); + + return this; + }, + + /** + * Destroys all shader instances, removes all object references and nulls all external references. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy + * @since 3.0.0 + * + * @return {this} This WebGLPipeline instance. + */ + destroy: function () + { + var i; + + var shaders = this.shaders; + + for (i = 0; i < shaders.length; i++) + { + shaders[i].destroy(); + } + + var targets = this.renderTargets; + + for (i = 0; i < targets.length; i++) + { + targets[i].destroy(); + } + + this.gl.deleteBuffer(this.vertexBuffer); + + var renderer = this.renderer; + + renderer.off(Events.RESIZE, this.resize, this); + renderer.off(Events.PRE_RENDER, this.onPreRender, this); + renderer.off(Events.RENDER, this.onRender, this); + renderer.off(Events.POST_RENDER, this.onPostRender, this); + + this.game = null; + this.renderer = null; + this.manager = null; + this.gl = null; + this.view = null; + this.shaders = null; + this.renderTargets = null; + this.bytes = null; + this.vertexViewF32 = null; + this.vertexViewU32 = null; + this.vertexData = null; + this.vertexBuffer = null; + this.currentShader = null; + this.currentRenderTarget = null; + + return this; + } + +}); + +module.exports = WebGLPipeline; + + +/***/ }), +/* 76 */ /***/ (function(module, exports) { /** @@ -11563,9 +17378,9 @@ module.exports = Circle; * @function Phaser.Utils.Objects.Clone * @since 3.0.0 * - * @param {object} obj - the object from which to clone + * @param {object} obj - The object to clone. * - * @return {object} a new object with the same properties as the input obj + * @return {object} A new object with the same properties as the input object. */ var Clone = function (obj) { @@ -11590,7 +17405,7 @@ module.exports = Clone; /***/ }), -/* 70 */ +/* 77 */ /***/ (function(module, exports) { /** @@ -11606,8 +17421,8 @@ module.exports = Clone; * @since 3.4.0 * * @param {array} array - The array to check. - * @param {integer} startIndex - The start index. - * @param {integer} endIndex - The end index. + * @param {number} startIndex - The start index. + * @param {number} endIndex - The end index. * @param {boolean} [throwError=true] - Throw an error if the range is out of bounds. * * @return {boolean} True if the range is safe, otherwise false. @@ -11639,7 +17454,7 @@ module.exports = SafeRange; /***/ }), -/* 71 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11648,8 +17463,8 @@ module.exports = SafeRange; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var EaseMap = __webpack_require__(123); -var UppercaseFirst = __webpack_require__(191); +var EaseMap = __webpack_require__(129); +var UppercaseFirst = __webpack_require__(196); /** * This internal function is used to return the correct ease function for a Tween. @@ -11748,7 +17563,7 @@ module.exports = GetEaseFunction; /***/ }), -/* 72 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11757,7 +17572,7 @@ module.exports = GetEaseFunction; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders a stroke outline around the given Shape. @@ -11775,7 +17590,7 @@ var Utils = __webpack_require__(10); var StrokePathWebGL = function (pipeline, src, alpha, dx, dy) { var strokeTint = pipeline.strokeTint; - var strokeTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.strokeColor, src.strokeAlpha * alpha); + var strokeTintColor = Utils.getTintAppendFloatAlpha(src.strokeColor, src.strokeAlpha * alpha); strokeTint.TL = strokeTintColor; strokeTint.TR = strokeTintColor; @@ -11800,8 +17615,6 @@ var StrokePathWebGL = function (pipeline, src, alpha, dx, dy) var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - pipeline.setTexture2D(); - pipeline.batchLine( px1, py1, @@ -11823,7 +17636,7 @@ module.exports = StrokePathWebGL; /***/ }), -/* 73 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11833,12 +17646,12 @@ module.exports = StrokePathWebGL; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(85); -var GetPoint = __webpack_require__(443); -var GetPoints = __webpack_require__(444); -var GEOM_CONST = __webpack_require__(49); -var Line = __webpack_require__(40); -var Random = __webpack_require__(168); +var Contains = __webpack_require__(110); +var GetPoint = __webpack_require__(453); +var GetPoints = __webpack_require__(454); +var GEOM_CONST = __webpack_require__(55); +var Line = __webpack_require__(45); +var Random = __webpack_require__(173); /** * @classdesc @@ -11876,7 +17689,7 @@ var Triangle = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Triangle#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -11985,7 +17798,7 @@ var Triangle = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - Number of points to be generated. Can be falsey when `stepRate` should be used. All points have the same distance along the triangle. + * @param {number} quantity - Number of points to be generated. Can be falsey when `stepRate` should be used. All points have the same distance along the triangle. * @param {number} [stepRate] - Distance between two points. Will only be used when `quantity` is falsey. * @param {(array|Phaser.Geom.Point[])} [output] - Optional Array for writing the calculated points into. Otherwise a new array will be created. * @@ -12270,281 +18083,7 @@ module.exports = Triangle; /***/ }), -/* 74 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); -var File = __webpack_require__(22); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); - -/** - * @classdesc - * A single Image File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#image method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#image. - * - * @class ImageFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets. - */ -var ImageFile = new Class({ - - Extends: File, - - initialize: - - function ImageFile (loader, key, url, xhrSettings, frameConfig) - { - var extension = 'png'; - var normalMapURL; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - normalMapURL = GetFastValue(config, 'normalMap'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - frameConfig = GetFastValue(config, 'frameConfig'); - } - - if (Array.isArray(url)) - { - normalMapURL = url[1]; - url = url[0]; - } - - var fileConfig = { - type: 'image', - cache: loader.textureManager, - extension: extension, - responseType: 'blob', - key: key, - url: url, - xhrSettings: xhrSettings, - config: frameConfig - }; - - File.call(this, loader, fileConfig); - - // Do we have a normal map to load as well? - if (normalMapURL) - { - var normalMap = new ImageFile(loader, this.key, normalMapURL, xhrSettings, frameConfig); - - normalMap.type = 'normalMap'; - - this.setLink(normalMap); - - loader.addFile(normalMap); - } - }, - - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.ImageFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; - - this.data = new Image(); - - this.data.crossOrigin = this.crossOrigin; - - var _this = this; - - this.data.onload = function () - { - File.revokeObjectURL(_this.data); - - _this.onProcessComplete(); - }; - - this.data.onerror = function () - { - File.revokeObjectURL(_this.data); - - _this.onProcessError(); - }; - - File.createObjectURL(this.data, this.xhrLoader.response, 'image/png'); - }, - - /** - * Adds this file to its target cache upon successful loading and processing. - * - * @method Phaser.Loader.FileTypes.ImageFile#addToCache - * @since 3.7.0 - */ - addToCache: function () - { - var texture; - var linkFile = this.linkFile; - - if (linkFile && linkFile.state === CONST.FILE_COMPLETE) - { - if (this.type === 'image') - { - texture = this.cache.addImage(this.key, this.data, linkFile.data); - } - else - { - texture = this.cache.addImage(linkFile.key, linkFile.data, this.data); - } - - this.pendingDestroy(texture); - - linkFile.pendingDestroy(texture); - } - else if (!linkFile) - { - texture = this.cache.addImage(this.key, this.data); - - this.pendingDestroy(texture); - } - } - -}); - -/** - * Adds an Image, or array of Images, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.image('logo', 'images/phaserLogo.png'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. - * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback - * of animated gifs to Canvas elements. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.image({ - * key: 'logo', - * url: 'images/AtariLogo.png' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.ImageFileConfig` for more details. - * - * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: - * - * ```javascript - * this.load.image('logo', 'images/AtariLogo.png'); - * // and later in your game ... - * this.add.image(x, y, 'logo'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, - * then you can specify it by providing an array as the `url` where the second element is the normal map: - * - * ```javascript - * this.load.image('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ]); - * ``` - * - * Or, if you are using a config object use the `normalMap` property: - * - * ```javascript - * this.load.image({ - * key: 'logo', - * url: 'images/AtariLogo.png', - * normalMap: 'images/AtariLogo-n.png' - * }); - * ``` - * - * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. - * Normal maps are a WebGL only feature. - * - * Note: The ability to load this type of file will only be available if the Image File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#image - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('image', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new ImageFile(this, key[i])); - } - } - else - { - this.addFile(new ImageFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = ImageFile; - - -/***/ }), -/* 75 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -12553,9 +18092,10 @@ module.exports = ImageFile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CONST = __webpack_require__(29); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Rectangle = __webpack_require__(465); +var Rectangle = __webpack_require__(479); /** * @classdesc @@ -12573,15 +18113,15 @@ var Rectangle = __webpack_require__(465); * @extends Phaser.GameObjects.Components.Visible * * @param {Phaser.Tilemaps.LayerData} layer - The LayerData object in the Tilemap that this tile belongs to. - * @param {integer} index - The unique index of this tile within the map. - * @param {integer} x - The x coordinate of this tile in tile coordinates. - * @param {integer} y - The y coordinate of this tile in tile coordinates. - * @param {integer} width - Width of the tile in pixels. - * @param {integer} height - Height of the tile in pixels. - * @param {integer} baseWidth - The base width a tile in the map (in pixels). Tiled maps support + * @param {number} index - The unique index of this tile within the map. + * @param {number} x - The x coordinate of this tile in tile coordinates. + * @param {number} y - The y coordinate of this tile in tile coordinates. + * @param {number} width - Width of the tile in pixels. + * @param {number} height - Height of the tile in pixels. + * @param {number} baseWidth - The base width a tile in the map (in pixels). Tiled maps support * multiple tileset sizes within one map, but they are still placed at intervals of the base * tile width. - * @param {integer} baseHeight - The base height of the tile in pixels (in pixels). Tiled maps + * @param {number} baseHeight - The base height of the tile in pixels (in pixels). Tiled maps * support multiple tileset sizes within one map, but they are still placed at intervals of the * base tile height. */ @@ -12611,7 +18151,7 @@ var Tile = new Class({ * represents a blank tile. * * @name Phaser.Tilemaps.Tile#index - * @type {integer} + * @type {number} * @since 3.0.0 */ this.index = index; @@ -12620,7 +18160,7 @@ var Tile = new Class({ * The x map coordinate of this tile in tile units. * * @name Phaser.Tilemaps.Tile#x - * @type {integer} + * @type {number} * @since 3.0.0 */ this.x = x; @@ -12629,7 +18169,7 @@ var Tile = new Class({ * The y map coordinate of this tile in tile units. * * @name Phaser.Tilemaps.Tile#y - * @type {integer} + * @type {number} * @since 3.0.0 */ this.y = y; @@ -12638,7 +18178,7 @@ var Tile = new Class({ * The width of the tile in pixels. * * @name Phaser.Tilemaps.Tile#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width = width; @@ -12647,27 +18187,49 @@ var Tile = new Class({ * The height of the tile in pixels. * * @name Phaser.Tilemaps.Tile#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height = height; /** - * The map's base width of a tile in pixels. Tiled maps support multiple tileset sizes + * The right of the tile in pixels. + * + * Set in the `updatePixelXY` method. + * + * @name Phaser.Tilemaps.Tile#right + * @type {number} + * @since 3.50.0 + */ + this.right; + + /** + * The bottom of the tile in pixels. + * + * Set in the `updatePixelXY` method. + * + * @name Phaser.Tilemaps.Tile#bottom + * @type {number} + * @since 3.50.0 + */ + this.bottom; + + /** + * The maps base width of a tile in pixels. Tiled maps support multiple tileset sizes * within one map, but they are still placed at intervals of the base tile size. * * @name Phaser.Tilemaps.Tile#baseWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.baseWidth = (baseWidth !== undefined) ? baseWidth : width; /** - * The map's base height of a tile in pixels. Tiled maps support multiple tileset sizes + * The maps base height of a tile in pixels. Tiled maps support multiple tileset sizes * within one map, but they are still placed at intervals of the base tile size. * * @name Phaser.Tilemaps.Tile#baseHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.baseHeight = (baseHeight !== undefined) ? baseHeight : height; @@ -12751,7 +18313,7 @@ var Tile = new Class({ this.collideDown = false; /** - * Whether the tile's left edge is interesting for collisions. + * Whether the tiles left edge is interesting for collisions. * * @name Phaser.Tilemaps.Tile#faceLeft * @type {boolean} @@ -12760,7 +18322,7 @@ var Tile = new Class({ this.faceLeft = false; /** - * Whether the tile's right edge is interesting for collisions. + * Whether the tiles right edge is interesting for collisions. * * @name Phaser.Tilemaps.Tile#faceRight * @type {boolean} @@ -12769,7 +18331,7 @@ var Tile = new Class({ this.faceRight = false; /** - * Whether the tile's top edge is interesting for collisions. + * Whether the tiles top edge is interesting for collisions. * * @name Phaser.Tilemaps.Tile#faceTop * @type {boolean} @@ -12778,7 +18340,7 @@ var Tile = new Class({ this.faceTop = false; /** - * Whether the tile's bottom edge is interesting for collisions. + * Whether the tiles bottom edge is interesting for collisions. * * @name Phaser.Tilemaps.Tile#faceBottom * @type {boolean} @@ -12793,7 +18355,7 @@ var Tile = new Class({ * @type {function} * @since 3.0.0 */ - this.collisionCallback = null; + this.collisionCallback = undefined; /** * The context in which the collision callback will be called. @@ -12851,7 +18413,7 @@ var Tile = new Class({ * * @param {Phaser.Tilemaps.Tile} tile - The tile to copy from. * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ copy: function (tile) { @@ -12880,7 +18442,7 @@ var Tile = new Class({ * @method Phaser.Tilemaps.Tile#getCollisionGroup * @since 3.0.0 * - * @return {?object} tileset + * @return {?object} The collision group for this Tile, as defined in the Tileset, or `null` if no group was defined. */ getCollisionGroup: function () { @@ -12896,7 +18458,7 @@ var Tile = new Class({ * @method Phaser.Tilemaps.Tile#getTileData * @since 3.0.0 * - * @return {?object} tileset + * @return {?object} The tile data for this Tile, as defined in the Tileset, or `null` if no data was defined. */ getTileData: function () { @@ -12912,7 +18474,7 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The left (x) value of this tile. */ getLeft: function (camera) { @@ -12930,7 +18492,7 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The right (x) value of this tile. */ getRight: function (camera) { @@ -12948,7 +18510,7 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The top (y) value of this tile. */ getTop: function (camera) { @@ -12971,11 +18533,12 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The bottom (y) value of this tile. */ getBottom: function (camera) { var tilemapLayer = this.tilemapLayer; + return tilemapLayer ? this.getTop(camera) + this.height * tilemapLayer.scaleY : this.getTop(camera) + this.height; @@ -12992,7 +18555,7 @@ var Tile = new Class({ * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * @param {Phaser.Geom.Rectangle} [output] - Optional Rectangle object to store the results in. * - * @return {(Phaser.Geom.Rectangle|object)} + * @return {(Phaser.Geom.Rectangle|object)} The bounds of this Tile. */ getBounds: function (camera, output) { @@ -13015,7 +18578,7 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The center x position of this Tile. */ getCenterX: function (camera) { @@ -13031,26 +18594,13 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The center y position of this Tile. */ getCenterY: function (camera) { return (this.getTop(camera) + this.getBottom(camera)) / 2; }, - /** - * Clean up memory. - * - * @method Phaser.Tilemaps.Tile#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.collisionCallback = undefined; - this.collisionCallbackContext = undefined; - this.properties = undefined; - }, - /** * Check for intersection with this tile. This does not factor in camera scroll, layer scale or * layer position. @@ -13063,7 +18613,7 @@ var Tile = new Class({ * @param {number} right - The right point. * @param {number} bottom - The bottom point. * - * @return {boolean} + * @return {boolean} `true` if the Tile intersects with the given dimensions, otherwise `false`. */ intersects: function (x, y, right, bottom) { @@ -13086,9 +18636,19 @@ var Tile = new Class({ */ isInteresting: function (collides, faces) { - if (collides && faces) { return (this.canCollide || this.hasInterestingFace); } - else if (collides) { return this.collides; } - else if (faces) { return this.hasInterestingFace; } + if (collides && faces) + { + return (this.canCollide || this.hasInterestingFace); + } + else if (collides) + { + return this.collides; + } + else if (faces) + { + return this.hasInterestingFace; + } + return false; }, @@ -13100,7 +18660,7 @@ var Tile = new Class({ * * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces for this tile and its neighbors. * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ resetCollision: function (recalculateFaces) { @@ -13135,7 +18695,7 @@ var Tile = new Class({ * @method Phaser.Tilemaps.Tile#resetFaces * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ resetFaces: function () { @@ -13157,10 +18717,9 @@ var Tile = new Class({ * @param {boolean} [right] - Indicating collide with any object on the right. * @param {boolean} [up] - Indicating collide with any object on the top. * @param {boolean} [down] - Indicating collide with any object on the bottom. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces - * for this tile and its neighbors. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces for this tile and its neighbors. * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ setCollision: function (left, right, up, down, recalculateFaces) { @@ -13202,7 +18761,7 @@ var Tile = new Class({ * @param {function} callback - Callback function. * @param {object} context - Callback will be called within this context. * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ setCollisionCallback: function (callback, context) { @@ -13226,12 +18785,12 @@ var Tile = new Class({ * @method Phaser.Tilemaps.Tile#setSize * @since 3.0.0 * - * @param {integer} tileWidth - The width of the tile in pixels. - * @param {integer} tileHeight - The height of the tile in pixels. - * @param {integer} baseWidth - The base width a tile in the map (in pixels). - * @param {integer} baseHeight - The base height of the tile in pixels (in pixels). + * @param {number} tileWidth - The width of the tile in pixels. + * @param {number} tileHeight - The height of the tile in pixels. + * @param {number} baseWidth - The base width a tile in the map (in pixels). + * @param {number} baseHeight - The base height of the tile in pixels (in pixels). * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ setSize: function (tileWidth, tileHeight, baseWidth, baseHeight) { @@ -13246,26 +18805,67 @@ var Tile = new Class({ }, /** - * Used internally. Updates the tile's world XY position based on the current tile size. + * Used internally. Updates the tiles world XY position based on the current tile size. * * @method Phaser.Tilemaps.Tile#updatePixelXY * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ updatePixelXY: function () { - // Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the - // bottom left, while the Phaser renderer assumes the origin is the top left. The y - // coordinate needs to be adjusted by the difference. - this.pixelX = this.x * this.baseWidth; - this.pixelY = this.y * this.baseHeight; + var orientation = this.layer.orientation; - // this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight); + if (orientation === CONST.ORTHOGONAL) + { + // In orthogonal mode, Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the + // bottom left, while the Phaser renderer assumes the origin is the top left. The y + // coordinate needs to be adjusted by the difference. + + this.pixelX = this.x * this.baseWidth; + this.pixelY = this.y * this.baseHeight; + } + else if (orientation === CONST.ISOMETRIC) + { + // Reminder: For the tilemap to be centered we have to move the image to the right with the camera! + // This is crucial for wordtotile, tiletoworld to work. + + this.pixelX = (this.x - this.y) * this.baseWidth * 0.5; + this.pixelY = (this.x + this.y) * this.baseHeight * 0.5; + } + else if (orientation === CONST.STAGGERED) + { + this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); + this.pixelY = this.y * (this.baseHeight / 2); + } + else if (orientation === CONST.HEXAGONAL) + { + var len = this.layer.hexSideLength; + var rowHeight = ((this.baseHeight - len) / 2 + len); + + this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); + this.pixelY = this.y * rowHeight; + } + + this.right = this.pixelX + this.baseWidth; + this.bottom = this.pixelY + this.baseHeight; return this; }, + /** + * Clean up memory. + * + * @method Phaser.Tilemaps.Tile#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.collisionCallback = undefined; + this.collisionCallbackContext = undefined; + this.properties = undefined; + }, + /** * True if this tile can collide on any of its faces or has a collision callback set. * @@ -13275,10 +18875,12 @@ var Tile = new Class({ * @since 3.0.0 */ canCollide: { + get: function () { - return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown || this.collisionCallback); + return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown || (this.collisionCallback !== undefined)); } + }, /** @@ -13290,10 +18892,12 @@ var Tile = new Class({ * @since 3.0.0 */ collides: { + get: function () { return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown); } + }, /** @@ -13305,16 +18909,18 @@ var Tile = new Class({ * @since 3.0.0 */ hasInterestingFace: { + get: function () { return (this.faceTop || this.faceBottom || this.faceLeft || this.faceRight); } + }, /** * The tileset that contains this Tile. This is null if accessed from a LayerData instance - * before the tile is placed in a StaticTilemapLayer or DynamicTilemapLayer, or if the tile has - * an index that doesn't correspond to any of the map's tilesets. + * before the tile is placed in a TilemapLayer, or if the tile has an index that doesn't correspond + * to any of the maps tilesets. * * @name Phaser.Tilemaps.Tile#tileset * @type {?Phaser.Tilemaps.Tileset} @@ -13344,24 +18950,25 @@ var Tile = new Class({ /** * The tilemap layer that contains this Tile. This will only return null if accessed from a - * LayerData instance before the tile is placed within a StaticTilemapLayer or - * DynamicTilemapLayer. + * LayerData instance before the tile is placed within a TilemapLayer. * * @name Phaser.Tilemaps.Tile#tilemapLayer - * @type {?Phaser.Tilemaps.StaticTilemapLayer|Phaser.Tilemaps.DynamicTilemapLayer} + * @type {?Phaser.Tilemaps.TilemapLayer} * @readonly * @since 3.0.0 */ tilemapLayer: { + get: function () { return this.layer.tilemapLayer; } + }, /** * The tilemap that contains this Tile. This will only return null if accessed from a LayerData - * instance before the tile is placed within a StaticTilemapLayer or DynamicTilemapLayer. + * instance before the tile is placed within a TilemapLayer. * * @name Phaser.Tilemaps.Tile#tilemap * @type {?Phaser.Tilemaps.Tilemap} @@ -13369,11 +18976,14 @@ var Tile = new Class({ * @since 3.0.0 */ tilemap: { + get: function () { var tilemapLayer = this.tilemapLayer; + return tilemapLayer ? tilemapLayer.tilemap : null; } + } }); @@ -13382,8 +18992,8 @@ module.exports = Tile; /***/ }), -/* 76 */ -/***/ (function(module, exports, __webpack_require__) { +/* 82 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -13391,481 +19001,94 @@ module.exports = Tile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AnimationState = __webpack_require__(157); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); -var SpriteRender = __webpack_require__(991); - -/** - * @classdesc - * A Sprite Game Object. - * - * A Sprite Game Object is used for the display of both static and animated images in your game. - * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled - * and animated. - * - * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. - * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation - * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. - * - * @class Sprite - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.TextureCrop - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - */ -var Sprite = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.Pipeline, - Components.ScrollFactor, - Components.Size, - Components.TextureCrop, - Components.Tint, - Components.Transform, - Components.Visible, - SpriteRender - ], - - initialize: - - function Sprite (scene, x, y, texture, frame) - { - GameObject.call(this, scene, 'Sprite'); - - /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. - * - * @name Phaser.GameObjects.Sprite#_crop - * @type {object} - * @private - * @since 3.11.0 - */ - this._crop = this.resetCropObject(); - - /** - * The Animation State component of this Sprite. - * - * This component provides features to apply animations to this Sprite. - * It is responsible for playing, loading, queuing animations for later playback, - * mixing between animations and setting the current animation frame to this Sprite. - * - * @name Phaser.GameObjects.Sprite#anims - * @type {Phaser.Animations.AnimationState} - * @since 3.0.0 - */ - this.anims = new AnimationState(this); - - this.setTexture(texture, frame); - this.setPosition(x, y); - this.setSizeToFrame(); - this.setOriginFromFrame(); - this.initPipeline(); - - this.on(GameObjectEvents.ADDED_TO_SCENE, this.addedToScene, this); - this.on(GameObjectEvents.REMOVED_FROM_SCENE, this.removedFromScene, this); - }, - - // Overrides Game Object method - addedToScene: function () - { - this.scene.sys.updateList.add(this); - }, - - // Overrides Game Object method - removedFromScene: function () - { - this.scene.sys.updateList.remove(this); - }, +var PIPELINE_CONST = { /** - * Update this Sprite's animations. + * The Bitmap Mask Pipeline. * - * @method Phaser.GameObjects.Sprite#preUpdate - * @protected - * @since 3.0.0 - * - * @param {number} time - The current timestamp. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. - */ - preUpdate: function (time, delta) - { - this.anims.update(time, delta); - }, - - /** - * Start playing the given animation on this Sprite. - * - * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. - * - * The benefit of a global animation is that multiple Sprites can all play the same animation, without - * having to duplicate the data. You can just create it once and then play it on any Sprite. - * - * The following code shows how to create a global repeating animation. The animation will be created - * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': - * - * ```javascript - * var config = { - * key: 'run', - * frames: 'muybridge', - * frameRate: 15, - * repeat: -1 - * }; - * - * // This code should be run from within a Scene: - * this.anims.create(config); - * ``` - * - * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, - * you can call the `Animation.create` method instead. It accepts the exact same parameters as when - * creating a global animation, however the resulting data is kept locally in this Sprite. - * - * With the animation created, either globally or locally, you can now play it on this Sprite: - * - * ```javascript - * this.add.sprite(x, y).play('run'); - * ``` - * - * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config - * object instead: - * - * ```javascript - * this.add.sprite(x, y).play({ key: 'run', frameRate: 24 }); - * ``` - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * If you need a Sprite to be able to play both local and global animations, make sure they don't - * have conflicting keys. - * - * See the documentation for the `PlayAnimationConfig` config object for more details about this. - * - * Also, see the documentation in the Animation Manager for further details on creating animations. - * - * @method Phaser.GameObjects.Sprite#play - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.0.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. - * - * @return {this} This Game Object. - */ - play: function (key, ignoreIfPlaying) - { - return this.anims.play(key, ignoreIfPlaying); - }, - - /** - * Start playing the given animation on this Sprite, in reverse. - * - * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. - * - * The benefit of a global animation is that multiple Sprites can all play the same animation, without - * having to duplicate the data. You can just create it once and then play it on any Sprite. - * - * The following code shows how to create a global repeating animation. The animation will be created - * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': - * - * ```javascript - * var config = { - * key: 'run', - * frames: 'muybridge', - * frameRate: 15, - * repeat: -1 - * }; - * - * // This code should be run from within a Scene: - * this.anims.create(config); - * ``` - * - * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, - * you can call the `Animation.create` method instead. It accepts the exact same parameters as when - * creating a global animation, however the resulting data is kept locally in this Sprite. - * - * With the animation created, either globally or locally, you can now play it on this Sprite: - * - * ```javascript - * this.add.sprite(x, y).playReverse('run'); - * ``` - * - * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config - * object instead: - * - * ```javascript - * this.add.sprite(x, y).playReverse({ key: 'run', frameRate: 24 }); - * ``` - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * If you need a Sprite to be able to play both local and global animations, make sure they don't - * have conflicting keys. - * - * See the documentation for the `PlayAnimationConfig` config object for more details about this. - * - * Also, see the documentation in the Animation Manager for further details on creating animations. - * - * @method Phaser.GameObjects.Sprite#playReverse - * @fires Phaser.Animations.Events#ANIMATION_START + * @name Phaser.Renderer.WebGL.Pipelines.BITMAPMASK_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. - * - * @return {this} This Game Object. */ - playReverse: function (key, ignoreIfPlaying) - { - return this.anims.playReverse(key, ignoreIfPlaying); - }, + BITMAPMASK_PIPELINE: 'BitmapMaskPipeline', /** - * Waits for the specified delay, in milliseconds, then starts playback of the given animation. + * The Light 2D Pipeline. * - * If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here. - * - * If an animation is already running and a new animation is given to this method, it will wait for - * the given delay before starting the new animation. - * - * If no animation is currently running, the given one begins after the delay. - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * Prior to Phaser 3.50 this method was called 'delayedPlay'. - * - * @method Phaser.GameObjects.Components.Animation#playAfterDelay - * @fires Phaser.Animations.Events#ANIMATION_START + * @name Phaser.Renderer.WebGL.Pipelines.LIGHT_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {integer} delay - The delay, in milliseconds, to wait before starting the animation playing. - * - * @return {this} This Game Object. */ - playAfterDelay: function (key, delay) - { - return this.anims.playAfterDelay(key, delay); - }, + LIGHT_PIPELINE: 'Light2D', /** - * Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback - * of the given animation. + * The Single Texture Pipeline. * - * You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an - * idle animation to a walking animation, by making them blend smoothly into each other. - * - * If no animation is currently running, the given one will start immediately. - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * @method Phaser.GameObjects.Components.Animation#playAfterRepeat - * @fires Phaser.Animations.Events#ANIMATION_START + * @name Phaser.Renderer.WebGL.Pipelines.SINGLE_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {integer} [repeatCount=1] - How many times should the animation repeat before the next one starts? - * - * @return {this} This Game Object. */ - playAfterRepeat: function (key, repeatCount) - { - return this.anims.playAfterRepeat(key, repeatCount); - }, + SINGLE_PIPELINE: 'SinglePipeline', /** - * Sets an animation, or an array of animations, to be played immediately after the current one completes or stops. + * The Multi Texture Pipeline. * - * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, - * or have the `stop` method called directly on it. - * - * An animation set to repeat forever will never enter a completed state. - * - * You can chain a new animation at any point, including before the current one starts playing, during it, - * or when it ends (via its `animationcomplete` event). - * - * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained - * animations without impacting the animation they're playing. - * - * Call this method with no arguments to reset all currently chained animations. - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * @method Phaser.GameObjects.Sprite#chain + * @name Phaser.Renderer.WebGL.Pipelines.MULTI_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig|string[]|Phaser.Animations.Animation[]|Phaser.Types.Animations.PlayAnimationConfig[])} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object, or an array of them. - * - * @return {this} This Game Object. */ - chain: function (key) - { - return this.anims.chain(key); - }, + MULTI_PIPELINE: 'MultiPipeline', /** - * Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` events. + * The Rope Pipeline. * - * If no animation is playing, no event will be dispatched. - * - * If there is another animation queued (via the `chain` method) then it will start playing immediately. - * - * @method Phaser.GameObjects.Sprite#stop - * @fires Phaser.Animations.Events#ANIMATION_STOP + * @name Phaser.Renderer.WebGL.Pipelines.ROPE_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @return {this} This Game Object. */ - stop: function () - { - return this.anims.stop(); - }, + ROPE_PIPELINE: 'RopePipeline', /** - * Stops the current animation from playing after the specified time delay, given in milliseconds. + * The Graphics and Shapes Pipeline. * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * @method Phaser.GameObjects.Sprite#stopAfterDelay - * @fires Phaser.Animations.Events#ANIMATION_STOP + * @name Phaser.Renderer.WebGL.Pipelines.GRAPHICS_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {integer} delay - The number of milliseconds to wait before stopping this animation. - * - * @return {this} This Game Object. */ - stopAfterDelay: function (delay) - { - return this.anims.stopAfterDelay(delay); - }, + GRAPHICS_PIPELINE: 'GraphicsPipeline', /** - * Stops the current animation from playing after the given number of repeats. + * The Post FX Pipeline. * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * @method Phaser.GameObjects.Sprite#stopAfterRepeat - * @fires Phaser.Animations.Events#ANIMATION_STOP + * @name Phaser.Renderer.WebGL.Pipelines.POSTFX_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {integer} [repeatCount=1] - How many times should the animation repeat before stopping? - * - * @return {this} This Game Object. */ - stopAfterRepeat: function (repeatCount) - { - return this.anims.stopAfterRepeat(repeatCount); - }, + POSTFX_PIPELINE: 'PostFXPipeline', /** - * Stops the current animation from playing when it next sets the given frame. - * If this frame doesn't exist within the animation it will not stop it from playing. + * The Utility Pipeline. * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * @method Phaser.GameObjects.Sprite#stopOnFrame - * @fires Phaser.Animations.Events#ANIMATION_STOP + * @name Phaser.Renderer.WebGL.Pipelines.UTILITY_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. - * - * @return {this} This Game Object. */ - stopOnFrame: function (frame) - { - return this.anims.stopOnFrame(frame); - }, + UTILITY_PIPELINE: 'UtilityPipeline' +}; - /** - * Build a JSON representation of this Sprite. - * - * @method Phaser.GameObjects.Sprite#toJSON - * @since 3.0.0 - * - * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. - */ - toJSON: function () - { - return Components.ToJSON(this); - }, - - /** - * Handles the pre-destroy step for the Sprite, which removes the Animation component. - * - * @method Phaser.GameObjects.Sprite#preDestroy - * @private - * @since 3.14.0 - */ - preDestroy: function () - { - this.anims.destroy(); - - this.anims = undefined; - } - -}); - -module.exports = Sprite; +module.exports = PIPELINE_CONST; /***/ }), -/* 77 */ +/* 83 */ /***/ (function(module, exports) { /** @@ -13893,7 +19116,7 @@ module.exports = GetCenterX; /***/ }), -/* 78 */ +/* 84 */ /***/ (function(module, exports) { /** @@ -13928,7 +19151,7 @@ module.exports = SetCenterX; /***/ }), -/* 79 */ +/* 85 */ /***/ (function(module, exports) { /** @@ -13956,7 +19179,7 @@ module.exports = GetCenterY; /***/ }), -/* 80 */ +/* 86 */ /***/ (function(module, exports) { /** @@ -13991,7 +19214,7 @@ module.exports = SetCenterY; /***/ }), -/* 81 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -14000,854 +19223,87 @@ module.exports = SetCenterY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - -var Class = __webpack_require__(0); +var SpliceOne = __webpack_require__(103); /** - * @classdesc - * A representation of a vector in 3D space. + * Removes the given item, or array of items, from the array. * - * A three-component vector. + * The array is modified in-place. * - * @class Vector3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 + * You can optionally specify a callback to be invoked for each item successfully removed from the array. * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. + * @function Phaser.Utils.Array.Remove + * @since 3.4.0 + * + * @param {array} array - The array to be modified. + * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. + * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. */ -var Vector3 = new Class({ - - initialize: - - function Vector3 (x, y, z) - { - /** - * The x component of this Vector. - * - * @name Phaser.Math.Vector3#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; - - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector3#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; - - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector3#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.z = 0; - - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - }, - - /** - * Set this Vector to point up. - * - * Sets the y component of the vector to 1, and the others to 0. - * - * @method Phaser.Math.Vector3#up - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - up: function () - { - this.x = 0; - this.y = 1; - this.z = 0; - - return this; - }, - - /** - * Make a clone of this Vector3. - * - * @method Phaser.Math.Vector3#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. - */ - clone: function () - { - return new Vector3(this.x, this.y, this.z); - }, - - /** - * Calculate the cross (vector) product of two given Vectors. - * - * @method Phaser.Math.Vector3#crossVectors - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} a - The first Vector to multiply. - * @param {Phaser.Math.Vector3} b - The second Vector to multiply. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - crossVectors: function (a, b) - { - var ax = a.x; - var ay = a.y; - var az = a.z; - var bx = b.x; - var by = b.y; - var bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict equality check against each Vector's components. - * - * @method Phaser.Math.Vector3#equals - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. - * - * @return {boolean} True if the two vectors strictly match, otherwise false. - */ - equals: function (v) - { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); - }, - - /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector3#copy - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - - return this; - }, - - /** - * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. - * - * @method Phaser.Math.Vector3#set - * @since 3.0.0 - * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. - * @param {number} [y] - The y value to set for this Vector. - * @param {number} [z] - The z value to set for this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - set: function (x, y, z) - { - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - - return this; - }, - - /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector3#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - - return this; - }, - - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector3#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - - return this; - }, - - /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - multiply: function (v) - { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - - return this; - }, - - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector3#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - scale: function (scale) - { - if (isFinite(scale)) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - } - else - { - this.x = 0; - this.y = 0; - this.z = 0; - } - - return this; - }, - - /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#divide - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - - return this; - }, - - /** - * Negate the `x`, `y` and `z` components of this Vector. - * - * @method Phaser.Math.Vector3#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - - return this; - }, - - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#distance - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - distance: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return Math.sqrt(dx * dx + dy * dy + dz * dz); - }, - - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector3#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - distanceSq: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return dx * dx + dy * dy + dz * dz; - }, - - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector3#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return Math.sqrt(x * x + y * y + z * z); - }, - - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector3#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return x * x + y * y + z * z; - }, - - /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. - * - * @method Phaser.Math.Vector3#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - normalize: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var len = x * x + y * y + z * z; - - if (len > 0) - { - len = 1 / Math.sqrt(len); - - this.x = x * len; - this.y = y * len; - this.z = z * len; - } - - return this; - }, - - /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#dot - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. - * - * @return {number} The dot product of this Vector and `v`. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z; - }, - - /** - * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. - * - * @method Phaser.Math.Vector3#cross - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector to cross product with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - cross: function (v) - { - var ax = this.x; - var ay = this.y; - var az = this.z; - var bx = v.x; - var by = v.y; - var bz = v.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Linearly interpolate between this Vector and the given Vector. - * - * Interpolates this Vector towards the given Vector. - * - * @method Phaser.Math.Vector3#lerp - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - lerp: function (v, t) - { - if (t === undefined) { t = 0; } - - var ax = this.x; - var ay = this.y; - var az = this.z; - - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat3: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = x * m[0] + y * m[3] + z * m[6]; - this.y = x * m[1] + y * m[4] + z * m[7]; - this.z = x * m[2] + y * m[5] + z * m[8]; - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; - this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; - this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; - - return this; - }, - - /** - * Transforms the coordinates of this Vector3 with the given Matrix4. - * - * @method Phaser.Math.Vector3#transformCoordinates - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformCoordinates: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; - var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; - var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; - var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; - - this.x = tx / tw; - this.y = ty / tw; - this.z = tz / tw; - - return this; - }, - - /** - * Transform this Vector with the given Quaternion. - * - * @method Phaser.Math.Vector3#transformQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformQuat: function (q) - { - // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations - var x = this.x; - var y = this.y; - var z = this.z; - var qx = q.x; - var qy = q.y; - var qz = q.z; - var qw = q.w; - - // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; - - // calculate result * inverse quat - this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; - this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; - this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; - - return this; - }, - - /** - * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, - * e.g. unprojecting a 2D point into 3D space. - * - * @method Phaser.Math.Vector3#project - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - project: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var a00 = m[0]; - var a01 = m[1]; - var a02 = m[2]; - var a03 = m[3]; - var a10 = m[4]; - var a11 = m[5]; - var a12 = m[6]; - var a13 = m[7]; - var a20 = m[8]; - var a21 = m[9]; - var a22 = m[10]; - var a23 = m[11]; - var a30 = m[12]; - var a31 = m[13]; - var a32 = m[14]; - var a33 = m[15]; - - var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); - - this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; - this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; - this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; - - return this; - }, - - /** - * Unproject this point from 2D space to 3D space. - * The point should have its x and y properties set to - * 2D screen space, and the z either at 0 (near plane) - * or 1 (far plane). The provided matrix is assumed to already - * be combined, i.e. projection * view * model. - * - * After this operation, this vector's (x, y, z) components will - * represent the unprojected 3D coordinate. - * - * @method Phaser.Math.Vector3#unproject - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. - * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - unproject: function (viewport, invProjectionView) - { - var viewX = viewport.x; - var viewY = viewport.y; - var viewWidth = viewport.z; - var viewHeight = viewport.w; - - var x = this.x - viewX; - var y = (viewHeight - this.y - 1) - viewY; - var z = this.z; - - this.x = (2 * x) / viewWidth - 1; - this.y = (2 * y) / viewHeight - 1; - this.z = 2 * z - 1; - - return this.project(invProjectionView); - }, - - /** - * Make this Vector the zero vector (0, 0, 0). - * - * @method Phaser.Math.Vector3#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - - return this; - } - -}); - -/** - * A static zero Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.ZERO - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.ZERO = new Vector3(); - -/** - * A static right Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.RIGHT - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.RIGHT = new Vector3(1, 0, 0); - -/** - * A static left Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.LEFT - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.LEFT = new Vector3(-1, 0, 0); - -/** - * A static up Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.UP - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.UP = new Vector3(0, -1, 0); - -/** - * A static down Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.DOWN - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.DOWN = new Vector3(0, 1, 0); - -/** - * A static forward Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.FORWARD - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.FORWARD = new Vector3(0, 0, 1); - -/** - * A static back Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.BACK - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.BACK = new Vector3(0, 0, -1); - -/** - * A static one Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.ONE - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.ONE = new Vector3(1, 1, 1); - -module.exports = Vector3; - - -/***/ }), -/* 82 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Removes a single item from an array and returns it without creating gc, like the native splice does. - * Based on code by Mike Reinstein. - * - * @function Phaser.Utils.Array.SpliceOne - * @since 3.0.0 - * - * @param {array} array - The array to splice from. - * @param {integer} index - The index of the item which should be spliced. - * - * @return {*} The item which was spliced (removed). - */ -var SpliceOne = function (array, index) +var Remove = function (array, item, callback, context) { - if (index >= array.length) + if (context === undefined) { context = array; } + + var index; + + // Fast path to avoid array mutation and iteration + if (!Array.isArray(item)) { - return; + index = array.indexOf(item); + + if (index !== -1) + { + SpliceOne(array, index); + + if (callback) + { + callback.call(context, item); + } + + return item; + } + else + { + return null; + } } - var len = array.length - 1; + // If we got this far, we have an array of items to remove - var item = array[index]; + var itemLength = item.length - 1; + var removed = []; - for (var i = index; i < len; i++) + while (itemLength >= 0) { - array[i] = array[i + 1]; + var entry = item[itemLength]; + + index = array.indexOf(entry); + + if (index !== -1) + { + SpliceOne(array, index); + + removed.push(entry); + + if (callback) + { + callback.call(context, entry); + } + } + + itemLength--; } - array.length = len; - - return item; + return removed; }; -module.exports = SpliceOne; +module.exports = Remove; /***/ }), -/* 83 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -14857,7 +19313,7 @@ module.exports = SpliceOne; */ var Class = __webpack_require__(0); -var FromPoints = __webpack_require__(186); +var FromPoints = __webpack_require__(191); var Rectangle = __webpack_require__(9); var Vector2 = __webpack_require__(3); @@ -14893,7 +19349,7 @@ var Curve = new Class({ * The default number of divisions within the curve. * * @name Phaser.Curves.Curve#defaultDivisions - * @type {integer} + * @type {number} * @default 5 * @since 3.0.0 */ @@ -14903,7 +19359,7 @@ var Curve = new Class({ * The quantity of arc length divisions within the curve. * * @name Phaser.Curves.Curve#arcLengthDivisions - * @type {integer} + * @type {number} * @default 100 * @since 3.0.0 */ @@ -14972,7 +19428,7 @@ var Curve = new Class({ * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] * * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. - * @param {integer} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. + * @param {number} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. * * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. */ @@ -14994,7 +19450,7 @@ var Curve = new Class({ * @since 3.0.0 * * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. If falsey a new object will be created. - * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. + * @param {number} [accuracy=16] - The accuracy of the bounds calculations. * * @return {Phaser.Geom.Rectangle} A Rectangle object holding the bounds of this curve. If `out` was given it will be this object. */ @@ -15025,7 +19481,7 @@ var Curve = new Class({ * @method Phaser.Curves.Curve#getDistancePoints * @since 3.0.0 * - * @param {integer} distance - The distance, in pixels, between each point along the curve. + * @param {number} distance - The distance, in pixels, between each point along the curve. * * @return {Phaser.Geom.Point[]} An Array of Point objects. */ @@ -15085,7 +19541,7 @@ var Curve = new Class({ * @method Phaser.Curves.Curve#getLengths * @since 3.0.0 * - * @param {integer} [divisions] - The number of divisions or segments. + * @param {number} [divisions] - The number of divisions or segments. * * @return {number[]} An array of cumulative lengths. */ @@ -15167,7 +19623,7 @@ var Curve = new Class({ * * @generic {Phaser.Math.Vector2[]} O - [out,$return] * - * @param {integer} [divisions] - The number of divisions to make. + * @param {number} [divisions] - The number of divisions to make. * @param {number} [stepRate] - The curve distance between points, implying `divisions`. * @param {(array|Phaser.Math.Vector2[])} [out] - An optional array to store the points in. * @@ -15227,7 +19683,7 @@ var Curve = new Class({ * @method Phaser.Curves.Curve#getSpacedPoints * @since 3.0.0 * - * @param {integer} [divisions=this.defaultDivisions] - The number of divisions to make. + * @param {number} [divisions=this.defaultDivisions] - The number of divisions to make. * @param {number} [stepRate] - Step between points. Used to calculate the number of points to return when divisions is falsy. Ignored if divisions is positive. * @param {(array|Phaser.Math.Vector2[])} [out] - An optional array to store the points in. * @@ -15347,8 +19803,8 @@ var Curve = new Class({ * @method Phaser.Curves.Curve#getTFromDistance * @since 3.0.0 * - * @param {integer} distance - The distance, in pixels. - * @param {integer} [divisions] - Optional amount of divisions. + * @param {number} distance - The distance, in pixels. + * @param {number} [divisions] - Optional amount of divisions. * * @return {number} The distance. */ @@ -15369,8 +19825,8 @@ var Curve = new Class({ * @since 3.0.0 * * @param {number} u - A float between 0 and 1. - * @param {integer} distance - The distance, in pixels. - * @param {integer} [divisions] - Optional amount of divisions. + * @param {number} distance - The distance, in pixels. + * @param {number} [divisions] - Optional amount of divisions. * * @return {number} The equidistant value. */ @@ -15464,7 +19920,7 @@ module.exports = Curve; /***/ }), -/* 84 */ +/* 89 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15479,75 +19935,198 @@ module.exports = Curve; module.exports = { - ADD: __webpack_require__(898), - COMPLETE: __webpack_require__(899), - FILE_COMPLETE: __webpack_require__(900), - FILE_KEY_COMPLETE: __webpack_require__(901), - FILE_LOAD_ERROR: __webpack_require__(902), - FILE_LOAD: __webpack_require__(903), - FILE_PROGRESS: __webpack_require__(904), - POST_PROCESS: __webpack_require__(905), - PROGRESS: __webpack_require__(906), - START: __webpack_require__(907) + ADD: __webpack_require__(954), + COMPLETE: __webpack_require__(955), + FILE_COMPLETE: __webpack_require__(956), + FILE_KEY_COMPLETE: __webpack_require__(957), + FILE_LOAD_ERROR: __webpack_require__(958), + FILE_LOAD: __webpack_require__(959), + FILE_PROGRESS: __webpack_require__(960), + POST_PROCESS: __webpack_require__(961), + PROGRESS: __webpack_require__(962), + START: __webpack_require__(963) }; /***/ }), -/* 85 */ +/* 90 */ /***/ (function(module, exports) { /** * @author Richard Davey + * @author Angry Bytes (and contributors) * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// http://www.blackpawn.com/texts/pointinpoly/ +/** + * The comparator function. + * + * @ignore + * + * @param {*} a - The first item to test. + * @param {*} b - The second itemt to test. + * + * @return {boolean} True if they localCompare, otherwise false. + */ +function Compare (a, b) +{ + return String(a).localeCompare(b); +} /** - * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds. + * Process the array contents. * - * @function Phaser.Geom.Triangle.Contains + * @ignore + * + * @param {array} array - The array to process. + * @param {function} compare - The comparison function. + * + * @return {array} - The processed array. + */ +function Process (array, compare) +{ + // Short-circuit when there's nothing to sort. + var len = array.length; + + if (len <= 1) + { + return array; + } + + // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc. + // Chunks are the size of the left or right hand in merge sort. + // Stop when the left-hand covers all of the array. + var buffer = new Array(len); + + for (var chk = 1; chk < len; chk *= 2) + { + RunPass(array, compare, chk, buffer); + + var tmp = array; + + array = buffer; + + buffer = tmp; + } + + return array; +} + +/** + * Run a single pass with the given chunk size. + * + * @ignore + * + * @param {array} arr - The array to run the pass on. + * @param {function} comp - The comparison function. + * @param {number} chk - The number of iterations. + * @param {array} result - The array to store the result in. + */ +function RunPass (arr, comp, chk, result) +{ + var len = arr.length; + var i = 0; + + // Step size / double chunk size. + var dbl = chk * 2; + + // Bounds of the left and right chunks. + var l, r, e; + + // Iterators over the left and right chunk. + var li, ri; + + // Iterate over pairs of chunks. + for (l = 0; l < len; l += dbl) + { + r = l + chk; + e = r + chk; + + if (r > len) + { + r = len; + } + + if (e > len) + { + e = len; + } + + // Iterate both chunks in parallel. + li = l; + ri = r; + + while (true) + { + // Compare the chunks. + if (li < r && ri < e) + { + // This works for a regular `sort()` compatible comparator, + // but also for a simple comparator like: `a > b` + if (comp(arr[li], arr[ri]) <= 0) + { + result[i++] = arr[li++]; + } + else + { + result[i++] = arr[ri++]; + } + } + else if (li < r) + { + // Nothing to compare, just flush what's left. + result[i++] = arr[li++]; + } + else if (ri < e) + { + result[i++] = arr[ri++]; + } + else + { + // Both iterators are at the chunk ends. + break; + } + } + } +} + +/** + * An in-place stable array sort, because `Array#sort()` is not guaranteed stable. + * + * This is an implementation of merge sort, without recursion. + * + * Function based on the Two-Screen/stable sort 0.1.8 from https://github.com/Two-Screen/stable + * + * @function Phaser.Utils.Array.StableSort * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to check. - * @param {number} x - The X coordinate of the point to check. - * @param {number} y - The Y coordinate of the point to check. + * @param {array} array - The input array to be sorted. + * @param {function} [compare] - The comparison function. * - * @return {boolean} `true` if the point is inside the Triangle, otherwise `false`. + * @return {array} The sorted result. */ -var Contains = function (triangle, x, y) +var StableSort = function (array, compare) { - var v0x = triangle.x3 - triangle.x1; - var v0y = triangle.y3 - triangle.y1; + if (compare === undefined) { compare = Compare; } - var v1x = triangle.x2 - triangle.x1; - var v1y = triangle.y2 - triangle.y1; + var result = Process(array, compare); - var v2x = x - triangle.x1; - var v2y = y - triangle.y1; + // This simply copies back if the result isn't in the original array, which happens on an odd number of passes. + if (result !== array) + { + RunPass(result, null, array.length, array); + } - var dot00 = (v0x * v0x) + (v0y * v0y); - var dot01 = (v0x * v1x) + (v0y * v1y); - var dot02 = (v0x * v2x) + (v0y * v2y); - var dot11 = (v1x * v1x) + (v1y * v1y); - var dot12 = (v1x * v2x) + (v1y * v2y); - - // Compute barycentric coordinates - var b = ((dot00 * dot11) - (dot01 * dot01)); - var inv = (b === 0) ? 0 : (1 / b); - var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; - var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; - - return (u >= 0 && v >= 0 && (u + v < 1)); + return array; }; -module.exports = Contains; +module.exports = StableSort; /***/ }), -/* 86 */ +/* 91 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15623,7 +20202,7 @@ module.exports = LineToLine; /***/ }), -/* 87 */ +/* 92 */ /***/ (function(module, exports) { /** @@ -15651,8 +20230,8 @@ module.exports = Angle; /***/ }), -/* 88 */, -/* 89 */ +/* 93 */, +/* 94 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15661,7 +20240,7 @@ module.exports = Angle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); /** * Return a value based on the range between `min` and `max` and the percentage given. @@ -15686,7 +20265,7 @@ module.exports = FromPercent; /***/ }), -/* 90 */ +/* 95 */ /***/ (function(module, exports) { /** @@ -15727,7 +20306,7 @@ module.exports = GetBoolean; /***/ }), -/* 91 */ +/* 96 */ /***/ (function(module, exports) { /** @@ -15742,7 +20321,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.CREATED - * @type {integer} + * @type {number} * @since 3.0.0 */ CREATED: 0, @@ -15751,7 +20330,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.INIT - * @type {integer} + * @type {number} * @since 3.0.0 */ INIT: 1, @@ -15760,7 +20339,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ DELAY: 2, @@ -15769,7 +20348,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.OFFSET_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ OFFSET_DELAY: 3, @@ -15778,7 +20357,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.PENDING_RENDER - * @type {integer} + * @type {number} * @since 3.0.0 */ PENDING_RENDER: 4, @@ -15787,7 +20366,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.PLAYING_FORWARD - * @type {integer} + * @type {number} * @since 3.0.0 */ PLAYING_FORWARD: 5, @@ -15796,7 +20375,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.PLAYING_BACKWARD - * @type {integer} + * @type {number} * @since 3.0.0 */ PLAYING_BACKWARD: 6, @@ -15805,7 +20384,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.HOLD_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ HOLD_DELAY: 7, @@ -15814,7 +20393,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.REPEAT_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ REPEAT_DELAY: 8, @@ -15823,7 +20402,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.COMPLETE - * @type {integer} + * @type {number} * @since 3.0.0 */ COMPLETE: 9, @@ -15834,7 +20413,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.PENDING_ADD - * @type {integer} + * @type {number} * @since 3.0.0 */ PENDING_ADD: 20, @@ -15843,7 +20422,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.PAUSED - * @type {integer} + * @type {number} * @since 3.0.0 */ PAUSED: 21, @@ -15852,7 +20431,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.LOOP_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ LOOP_DELAY: 22, @@ -15861,7 +20440,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.ACTIVE - * @type {integer} + * @type {number} * @since 3.0.0 */ ACTIVE: 23, @@ -15870,7 +20449,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.COMPLETE_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ COMPLETE_DELAY: 24, @@ -15879,7 +20458,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.PENDING_REMOVE - * @type {integer} + * @type {number} * @since 3.0.0 */ PENDING_REMOVE: 25, @@ -15888,7 +20467,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.REMOVED - * @type {integer} + * @type {number} * @since 3.0.0 */ REMOVED: 26 @@ -15899,7 +20478,714 @@ module.exports = TWEEN_CONST; /***/ }), -/* 92 */ +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Events = __webpack_require__(307); + +/** + * @callback DataEachCallback + * + * @param {*} parent - The parent object of the DataManager. + * @param {string} key - The key of the value. + * @param {*} value - The value. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. + */ + +/** + * @classdesc + * The Data Manager Component features a means to store pieces of data specific to a Game Object, System or Plugin. + * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, + * or have a property called `events` that is an instance of it. + * + * @class DataManager + * @memberof Phaser.Data + * @constructor + * @since 3.0.0 + * + * @param {object} parent - The object that this DataManager belongs to. + * @param {Phaser.Events.EventEmitter} [eventEmitter] - The DataManager's event emitter. + */ +var DataManager = new Class({ + + initialize: + + function DataManager (parent, eventEmitter) + { + /** + * The object that this DataManager belongs to. + * + * @name Phaser.Data.DataManager#parent + * @type {*} + * @since 3.0.0 + */ + this.parent = parent; + + /** + * The DataManager's event emitter. + * + * @name Phaser.Data.DataManager#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 + */ + this.events = eventEmitter; + + if (!eventEmitter) + { + this.events = (parent.events) ? parent.events : parent; + } + + /** + * The data list. + * + * @name Phaser.Data.DataManager#list + * @type {Object.} + * @default {} + * @since 3.0.0 + */ + this.list = {}; + + /** + * The public values list. You can use this to access anything you have stored + * in this Data Manager. For example, if you set a value called `gold` you can + * access it via: + * + * ```javascript + * this.data.values.gold; + * ``` + * + * You can also modify it directly: + * + * ```javascript + * this.data.values.gold += 1000; + * ``` + * + * Doing so will emit a `setdata` event from the parent of this Data Manager. + * + * Do not modify this object directly. Adding properties directly to this object will not + * emit any events. Always use `DataManager.set` to create new items the first time around. + * + * @name Phaser.Data.DataManager#values + * @type {Object.} + * @default {} + * @since 3.10.0 + */ + this.values = {}; + + /** + * Whether setting data is frozen for this DataManager. + * + * @name Phaser.Data.DataManager#_frozen + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this._frozen = false; + + if (!parent.hasOwnProperty('sys') && this.events) + { + this.events.once(Events.DESTROY, this.destroy, this); + } + }, + + /** + * Retrieves the value for the given key, or undefined if it doesn't exist. + * + * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: + * + * ```javascript + * this.data.get('gold'); + * ``` + * + * Or access the value directly: + * + * ```javascript + * this.data.values.gold; + * ``` + * + * You can also pass in an array of keys, in which case an array of values will be returned: + * + * ```javascript + * this.data.get([ 'gold', 'armor', 'health' ]); + * ``` + * + * This approach is useful for destructuring arrays in ES6. + * + * @method Phaser.Data.DataManager#get + * @since 3.0.0 + * + * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. + * + * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. + */ + get: function (key) + { + var list = this.list; + + if (Array.isArray(key)) + { + var output = []; + + for (var i = 0; i < key.length; i++) + { + output.push(list[key[i]]); + } + + return output; + } + else + { + return list[key]; + } + }, + + /** + * Retrieves all data values in a new object. + * + * @method Phaser.Data.DataManager#getAll + * @since 3.0.0 + * + * @return {Object.} All data values. + */ + getAll: function () + { + var results = {}; + + for (var key in this.list) + { + if (this.list.hasOwnProperty(key)) + { + results[key] = this.list[key]; + } + } + + return results; + }, + + /** + * Queries the DataManager for the values of keys matching the given regular expression. + * + * @method Phaser.Data.DataManager#query + * @since 3.0.0 + * + * @param {RegExp} search - A regular expression object. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj). + * + * @return {Object.} The values of the keys matching the search string. + */ + query: function (search) + { + var results = {}; + + for (var key in this.list) + { + if (this.list.hasOwnProperty(key) && key.match(search)) + { + results[key] = this.list[key]; + } + } + + return results; + }, + + /** + * Sets a value for the given key. If the key doesn't already exist in the Data Manager then it is created. + * + * ```javascript + * data.set('name', 'Red Gem Stone'); + * ``` + * + * You can also pass in an object of key value pairs as the first argument: + * + * ```javascript + * data.set({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); + * ``` + * + * To get a value back again you can call `get`: + * + * ```javascript + * data.get('gold'); + * ``` + * + * Or you can access the value directly via the `values` property, where it works like any other variable: + * + * ```javascript + * data.values.gold += 50; + * ``` + * + * When the value is first set, a `setdata` event is emitted. + * + * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. + * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. + * + * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.Data.DataManager#set + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.0.0 + * + * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. + * @param {*} data - The value to set for the given key. If an object is provided as the key this argument is ignored. + * + * @return {this} This DataManager object. + */ + set: function (key, data) + { + if (this._frozen) + { + return this; + } + + if (typeof key === 'string') + { + return this.setValue(key, data); + } + else + { + for (var entry in key) + { + this.setValue(entry, key[entry]); + } + } + + return this; + }, + + /** + * Increase a value for the given key. If the key doesn't already exist in the Data Manager then it is increased from 0. + * + * When the value is first set, a `setdata` event is emitted. + * + * @method Phaser.Data.DataManager#inc + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.23.0 + * + * @param {(string|object)} key - The key to increase the value for. + * @param {*} [data] - The value to increase for the given key. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + inc: function (key, data) + { + if (this._frozen) + { + return this; + } + + if (data === undefined) + { + data = 1; + } + + var value = this.get(key); + if (value === undefined) + { + value = 0; + } + + this.set(key, (value + data)); + + return this; + }, + + /** + * Toggle a boolean value for the given key. If the key doesn't already exist in the Data Manager then it is toggled from false. + * + * When the value is first set, a `setdata` event is emitted. + * + * @method Phaser.Data.DataManager#toggle + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.23.0 + * + * @param {(string|object)} key - The key to toggle the value for. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + toggle: function (key) + { + if (this._frozen) + { + return this; + } + + this.set(key, !this.get(key)); + + return this; + }, + + /** + * Internal value setter, called automatically by the `set` method. + * + * @method Phaser.Data.DataManager#setValue + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @private + * @since 3.10.0 + * + * @param {string} key - The key to set the value for. + * @param {*} data - The value to set. + * + * @return {this} This DataManager object. + */ + setValue: function (key, data) + { + if (this._frozen) + { + return this; + } + + if (this.has(key)) + { + // Hit the key getter, which will in turn emit the events. + this.values[key] = data; + } + else + { + var _this = this; + var list = this.list; + var events = this.events; + var parent = this.parent; + + Object.defineProperty(this.values, key, { + + enumerable: true, + + configurable: true, + + get: function () + { + return list[key]; + }, + + set: function (value) + { + if (!_this._frozen) + { + var previousValue = list[key]; + list[key] = value; + + events.emit(Events.CHANGE_DATA, parent, key, value, previousValue); + events.emit(Events.CHANGE_DATA_KEY + key, parent, value, previousValue); + } + } + + }); + + list[key] = data; + + events.emit(Events.SET_DATA, parent, key, data); + } + + return this; + }, + + /** + * Passes all data entries to the given callback. + * + * @method Phaser.Data.DataManager#each + * @since 3.0.0 + * + * @param {DataEachCallback} callback - The function to call. + * @param {*} [context] - Value to use as `this` when executing callback. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. + * + * @return {this} This DataManager object. + */ + each: function (callback, context) + { + var args = [ this.parent, null, undefined ]; + + for (var i = 1; i < arguments.length; i++) + { + args.push(arguments[i]); + } + + for (var key in this.list) + { + args[1] = key; + args[2] = this.list[key]; + + callback.apply(context, args); + } + + return this; + }, + + /** + * Merge the given object of key value pairs into this DataManager. + * + * Any newly created values will emit a `setdata` event. Any updated values (see the `overwrite` argument) + * will emit a `changedata` event. + * + * @method Phaser.Data.DataManager#merge + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.0.0 + * + * @param {Object.} data - The data to merge. + * @param {boolean} [overwrite=true] - Whether to overwrite existing data. Defaults to true. + * + * @return {this} This DataManager object. + */ + merge: function (data, overwrite) + { + if (overwrite === undefined) { overwrite = true; } + + // Merge data from another component into this one + for (var key in data) + { + if (data.hasOwnProperty(key) && (overwrite || (!overwrite && !this.has(key)))) + { + this.setValue(key, data[key]); + } + } + + return this; + }, + + /** + * Remove the value for the given key. + * + * If the key is found in this Data Manager it is removed from the internal lists and a + * `removedata` event is emitted. + * + * You can also pass in an array of keys, in which case all keys in the array will be removed: + * + * ```javascript + * this.data.remove([ 'gold', 'armor', 'health' ]); + * ``` + * + * @method Phaser.Data.DataManager#remove + * @fires Phaser.Data.Events#REMOVE_DATA + * @since 3.0.0 + * + * @param {(string|string[])} key - The key to remove, or an array of keys to remove. + * + * @return {this} This DataManager object. + */ + remove: function (key) + { + if (this._frozen) + { + return this; + } + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + this.removeValue(key[i]); + } + } + else + { + return this.removeValue(key); + } + + return this; + }, + + /** + * Internal value remover, called automatically by the `remove` method. + * + * @method Phaser.Data.DataManager#removeValue + * @private + * @fires Phaser.Data.Events#REMOVE_DATA + * @since 3.10.0 + * + * @param {string} key - The key to set the value for. + * + * @return {this} This DataManager object. + */ + removeValue: function (key) + { + if (this.has(key)) + { + var data = this.list[key]; + + delete this.list[key]; + delete this.values[key]; + + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); + } + + return this; + }, + + /** + * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it. + * + * @method Phaser.Data.DataManager#pop + * @fires Phaser.Data.Events#REMOVE_DATA + * @since 3.0.0 + * + * @param {string} key - The key of the value to retrieve and delete. + * + * @return {*} The value of the given key. + */ + pop: function (key) + { + var data = undefined; + + if (!this._frozen && this.has(key)) + { + data = this.list[key]; + + delete this.list[key]; + delete this.values[key]; + + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); + } + + return data; + }, + + /** + * Determines whether the given key is set in this Data Manager. + * + * Please note that the keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.Data.DataManager#has + * @since 3.0.0 + * + * @param {string} key - The key to check. + * + * @return {boolean} Returns `true` if the key exists, otherwise `false`. + */ + has: function (key) + { + return this.list.hasOwnProperty(key); + }, + + /** + * Freeze or unfreeze this Data Manager. A frozen Data Manager will block all attempts + * to create new values or update existing ones. + * + * @method Phaser.Data.DataManager#setFreeze + * @since 3.0.0 + * + * @param {boolean} value - Whether to freeze or unfreeze the Data Manager. + * + * @return {this} This DataManager object. + */ + setFreeze: function (value) + { + this._frozen = value; + + return this; + }, + + /** + * Delete all data in this Data Manager and unfreeze it. + * + * @method Phaser.Data.DataManager#reset + * @since 3.0.0 + * + * @return {this} This DataManager object. + */ + reset: function () + { + for (var key in this.list) + { + delete this.list[key]; + delete this.values[key]; + } + + this._frozen = false; + + return this; + }, + + /** + * Destroy this data manager. + * + * @method Phaser.Data.DataManager#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.reset(); + + this.events.off(Events.CHANGE_DATA); + this.events.off(Events.SET_DATA); + this.events.off(Events.REMOVE_DATA); + + this.parent = null; + }, + + /** + * Gets or sets the frozen state of this Data Manager. + * A frozen Data Manager will block all attempts to create new values or update existing ones. + * + * @name Phaser.Data.DataManager#freeze + * @type {boolean} + * @since 3.0.0 + */ + freeze: { + + get: function () + { + return this._frozen; + }, + + set: function (value) + { + this._frozen = (value) ? true : false; + } + + }, + + /** + * Return the total number of entries in this Data Manager. + * + * @name Phaser.Data.DataManager#count + * @type {number} + * @since 3.0.0 + */ + count: { + + get: function () + { + var i = 0; + + for (var key in this.list) + { + if (this.list[key] !== undefined) + { + i++; + } + } + + return i; + } + + } + +}); + +module.exports = DataManager; + + +/***/ }), +/* 98 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15922,7 +21208,7 @@ var Class = __webpack_require__(0); /** * @classdesc * The keys of a Map can be arbitrary values. - * + * * ```javascript * var map = new Map([ * [ 1, 'one' ], @@ -16176,7 +21462,9 @@ var Map = new Class({ }, /** - * Passes all entries in this Map to the given callback. + * Iterates through all entries in this Map, passing each one to the given callback. + * + * If the callback returns `false`, the iteration will break. * * @method Phaser.Structs.Map#each * @since 3.0.0 @@ -16272,7 +21560,7 @@ module.exports = Map; /***/ }), -/* 93 */ +/* 99 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -16283,12 +21571,12 @@ module.exports = Map; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DegToRad = __webpack_require__(41); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(42); +var DegToRad = __webpack_require__(34); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(35); var Rectangle = __webpack_require__(9); -var TransformMatrix = __webpack_require__(31); -var ValueToColor = __webpack_require__(174); +var TransformMatrix = __webpack_require__(24); +var ValueToColor = __webpack_require__(179); var Vector2 = __webpack_require__(3); /** @@ -16311,10 +21599,10 @@ var Vector2 = __webpack_require__(3); * * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, * allowing you to filter Game Objects out on a per-Camera basis. - * + * * The Base Camera is extended by the Camera class, which adds in special effects including Fade, * Flash and Camera Shake, as well as the ability to follow Game Objects. - * + * * The Base Camera was introduced in Phaser 3.12. It was split off from the Camera class, to allow * you to isolate special effects as needed. Therefore the 'since' values for properties of this class relate * to when they were added to the Camera class. @@ -16323,7 +21611,7 @@ var Vector2 = __webpack_require__(3); * @memberof Phaser.Cameras.Scene2D * @constructor * @since 3.12.0 - * + * * @extends Phaser.Events.EventEmitter * @extends Phaser.GameObjects.Components.Alpha * @extends Phaser.GameObjects.Components.Visible @@ -16394,7 +21682,7 @@ var BaseCamera = new Class({ * This value is a bitmask. * * @name Phaser.Cameras.Scene2D.BaseCamera#id - * @type {integer} + * @type {number} * @readonly * @since 3.11.0 */ @@ -16410,19 +21698,6 @@ var BaseCamera = new Class({ */ this.name = ''; - /** - * This property is un-used in v3.16. - * - * The resolution of the Game, used in most Camera calculations. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#resolution - * @type {number} - * @readonly - * @deprecated - * @since 3.12.0 - */ - this.resolution = 1; - /** * Should this camera round its pixel values to integers? * @@ -16472,9 +21747,9 @@ var BaseCamera = new Class({ /** * Is this Camera dirty? - * + * * A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame. - * + * * This flag is cleared during the `postRenderCamera` method of the renderer. * * @name Phaser.Cameras.Scene2D.BaseCamera#dirty @@ -16508,46 +21783,6 @@ var BaseCamera = new Class({ */ this._y = y; - /** - * Internal Camera X value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cx - * @type {number} - * @private - * @since 3.12.0 - */ - this._cx = 0; - - /** - * Internal Camera Y value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cy - * @type {number} - * @private - * @since 3.12.0 - */ - this._cy = 0; - - /** - * Internal Camera Width value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cw - * @type {number} - * @private - * @since 3.12.0 - */ - this._cw = 0; - - /** - * Internal Camera Height value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_ch - * @type {number} - * @private - * @since 3.12.0 - */ - this._ch = 0; - /** * The width of the Camera viewport, in pixels. * @@ -16621,7 +21856,7 @@ var BaseCamera = new Class({ this._scrollY = 0; /** - * The Camera zoom value. Change this value to zoom in, or out of, a Scene. + * The Camera horizontal zoom value. Change this value to zoom in, or out of, a Scene. * * A value of 0.5 would zoom the Camera out, so you can now see twice as much * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel @@ -16631,13 +21866,32 @@ var BaseCamera = new Class({ * * Be careful to never set this value to zero. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_zoom + * @name Phaser.Cameras.Scene2D.BaseCamera#_zoomX * @type {number} * @private * @default 1 - * @since 3.11.0 + * @since 3.50.0 */ - this._zoom = 1; + this._zoomX = 1; + + /** + * The Camera vertical zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_zoomY + * @type {number} + * @private + * @default 1 + * @since 3.50.0 + */ + this._zoomY = 1; /** * The rotation of the Camera in radians. @@ -16790,7 +22044,7 @@ var BaseCamera = new Class({ /** * The Camera that this Camera uses for translation during masking. - * + * * If the mask is fixed in position this will be a reference to * the CameraManager.default instance. Otherwise, it'll be a reference * to itself. @@ -17123,19 +22377,18 @@ var BaseCamera = new Class({ var c = Math.cos(this.rotation); var s = Math.sin(this.rotation); - var zoom = this.zoom; - var res = this.resolution; + var zoomX = this.zoomX; + var zoomY = this.zoomY; var scrollX = this.scrollX; var scrollY = this.scrollY; - // Works for zoom of 1 with any resolution, but resolution > 1 and zoom !== 1 breaks - var sx = x + ((scrollX * c - scrollY * s) * zoom); - var sy = y + ((scrollX * s + scrollY * c) * zoom); + var sx = x + ((scrollX * c - scrollY * s) * zoomX); + var sy = y + ((scrollX * s + scrollY * c) * zoomY); // Apply transform to point - output.x = (sx * ima + sy * imc) * res + ime; - output.y = (sx * imb + sy * imd) * res + imf; + output.x = (sx * ima + sy * imc) + ime; + output.y = (sx * imb + sy * imd) + imf; return output; }, @@ -17187,10 +22440,8 @@ var BaseCamera = new Class({ * @method Phaser.Cameras.Scene2D.BaseCamera#preRender * @protected * @since 3.0.0 - * - * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (resolution) + preRender: function () { var width = this.width; var height = this.height; @@ -17198,7 +22449,8 @@ var BaseCamera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * resolution; + var zoomX = this.zoomX; + var zoomY = this.zoomY; var matrix = this.matrix; var originX = width * this.originX; @@ -17230,8 +22482,8 @@ var BaseCamera = new Class({ // Basically the pixel value of what it's looking at in the middle of the cam this.midPoint.set(midX, midY); - var displayWidth = width / zoom; - var displayHeight = height / zoom; + var displayWidth = width / zoomX; + var displayHeight = height / zoomY; this.worldView.setTo( midX - (displayWidth / 2), @@ -17240,7 +22492,7 @@ var BaseCamera = new Class({ displayHeight ); - matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoomX, zoomY); matrix.translate(-originX, -originY); }, @@ -17381,15 +22633,15 @@ var BaseCamera = new Class({ /** * Set the bounds of the Camera. The bounds are an axis-aligned rectangle. - * + * * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the * edges and into blank space. It does not limit the placement of Game Objects, or where * the Camera viewport can be positioned. - * + * * Temporarily disable the bounds by changing the boolean `Camera.useBounds`. - * + * * Clear the bounds entirely by calling `Camera.removeBounds`. - * + * * If you set bounds that are smaller than the viewport it will stop the Camera from being * able to scroll. The bounds can be positioned where-ever you wish. By default they are from * 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of @@ -17401,10 +22653,10 @@ var BaseCamera = new Class({ * @method Phaser.Cameras.Scene2D.BaseCamera#setBounds * @since 3.0.0 * - * @param {integer} x - The top-left x coordinate of the bounds. - * @param {integer} y - The top-left y coordinate of the bounds. - * @param {integer} width - The width of the bounds, in pixels. - * @param {integer} height - The height of the bounds, in pixels. + * @param {number} x - The top-left x coordinate of the bounds. + * @param {number} y - The top-left y coordinate of the bounds. + * @param {number} width - The width of the bounds, in pixels. + * @param {number} height - The height of the bounds, in pixels. * @param {boolean} [centerOn=false] - If `true` the Camera will automatically be centered on the new bounds. * * @return {this} This Camera instance. @@ -17433,9 +22685,9 @@ var BaseCamera = new Class({ /** * Returns a rectangle containing the bounds of the Camera. - * + * * If the Camera does not have any bounds the rectangle will be empty. - * + * * The rectangle is a copy of the bounds, so is safe to modify. * * @method Phaser.Cameras.Scene2D.BaseCamera#getBounds @@ -17522,7 +22774,7 @@ var BaseCamera = new Class({ /** * Should the Camera round pixel values to whole integers when rendering Game Objects? - * + * * In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing. * * @method Phaser.Cameras.Scene2D.BaseCamera#setRoundPixels @@ -17541,8 +22793,6 @@ var BaseCamera = new Class({ /** * Sets the Scene the Camera is bound to. - * - * Also populates the `resolution` property and updates the internal size values. * * @method Phaser.Cameras.Scene2D.BaseCamera#setScene * @since 3.0.0 @@ -17566,15 +22816,6 @@ var BaseCamera = new Class({ this.scaleManager = sys.scale; this.cameraManager = sys.cameras; - var res = this.scaleManager.resolution; - - this.resolution = res; - - this._cx = this._x * res; - this._cy = this._y * res; - this._cw = this._width * res; - this._ch = this._height * res; - this.updateSystem(); return this; @@ -17615,8 +22856,8 @@ var BaseCamera = new Class({ * @method Phaser.Cameras.Scene2D.BaseCamera#setSize * @since 3.0.0 * - * @param {integer} width - The width of the Camera viewport. - * @param {integer} [height=width] - The height of the Camera viewport. + * @param {number} width - The width of the Camera viewport. + * @param {number} [height=width] - The height of the Camera viewport. * * @return {this} This Camera instance. */ @@ -17646,8 +22887,8 @@ var BaseCamera = new Class({ * * @param {number} x - The top-left x coordinate of the Camera viewport. * @param {number} y - The top-left y coordinate of the Camera viewport. - * @param {integer} width - The width of the Camera viewport. - * @param {integer} [height=width] - The height of the Camera viewport. + * @param {number} width - The width of the Camera viewport. + * @param {number} [height=width] - The height of the Camera viewport. * * @return {this} This Camera instance. */ @@ -17671,23 +22912,33 @@ var BaseCamera = new Class({ * * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. * + * As of Phaser 3.50 you can now set the horizontal and vertical zoom values independently. + * * @method Phaser.Cameras.Scene2D.BaseCamera#setZoom * @since 3.0.0 * - * @param {number} [value=1] - The zoom value of the Camera. The minimum it can be is 0.001. + * @param {number} [x=1] - The horizontal zoom value of the Camera. The minimum it can be is 0.001. + * @param {number} [y=x] - The vertical zoom value of the Camera. The minimum it can be is 0.001. * * @return {this} This Camera instance. */ - setZoom: function (value) + setZoom: function (x, y) { - if (value === undefined) { value = 1; } + if (x === undefined) { x = 1; } + if (y === undefined) { y = x; } - if (value === 0) + if (x === 0) { - value = 0.001; + x = 0.001; } - this.zoom = value; + if (y === 0) + { + y = 0.001; + } + + this.zoomX = x; + this.zoomY = y; return this; }, @@ -17696,14 +22947,14 @@ var BaseCamera = new Class({ * Sets the mask to be applied to this Camera during rendering. * * The mask must have been previously created and can be either a GeometryMask or a BitmapMask. - * + * * Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. * * If a mask is already set on this Camera it will be immediately replaced. - * + * * Masks have no impact on physics or input detection. They are purely a rendering component * that allows you to limit what is visible during the render pass. - * + * * Note: You cannot mask a Camera that has `renderToTexture` set. * * @method Phaser.Cameras.Scene2D.BaseCamera#setMask @@ -17806,7 +23057,7 @@ var BaseCamera = new Class({ * @protected * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function () @@ -17850,9 +23101,9 @@ var BaseCamera = new Class({ /** * Destroys this Camera instance and its internal properties and references. * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. - * + * * This method is called automatically by `CameraManager.remove` if that methods `runDestroy` argument is `true`, which is the default. - * + * * Unless you have a specific reason otherwise, always use `CameraManager.remove` and allow it to handle the camera destruction, * rather than calling this method directly. * @@ -17903,7 +23154,6 @@ var BaseCamera = new Class({ set: function (value) { this._x = value; - this._cx = value * this.resolution; this.updateSystem(); } @@ -17928,7 +23178,6 @@ var BaseCamera = new Class({ set: function (value) { this._y = value; - this._cy = value * this.resolution; this.updateSystem(); } @@ -17954,7 +23203,6 @@ var BaseCamera = new Class({ set: function (value) { this._width = value; - this._cw = value * this.resolution; this.updateSystem(); } @@ -17980,7 +23228,6 @@ var BaseCamera = new Class({ set: function (value) { this._height = value; - this._ch = value * this.resolution; this.updateSystem(); } @@ -18066,12 +23313,76 @@ var BaseCamera = new Class({ get: function () { - return this._zoom; + return (this._zoomX + this._zoomY) / 2; }, set: function (value) { - this._zoom = value; + this._zoomX = value; + this._zoomY = value; + + this.dirty = true; + } + + }, + + /** + * The Camera horizontal zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#zoomX + * @type {number} + * @default 1 + * @since 3.50.0 + */ + zoomX: { + + get: function () + { + return this._zoomX; + }, + + set: function (value) + { + this._zoomX = value; + this.dirty = true; + } + + }, + + /** + * The Camera vertical zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#zoomY + * @type {number} + * @default 1 + * @since 3.50.0 + */ + zoomY: { + + get: function () + { + return this._zoomY; + }, + + set: function (value) + { + this._zoomY = value; this.dirty = true; } @@ -18159,7 +23470,7 @@ var BaseCamera = new Class({ get: function () { - return this.width / this.zoom; + return this.width / this.zoomX; } }, @@ -18182,7 +23493,7 @@ var BaseCamera = new Class({ get: function () { - return this.height / this.zoom; + return this.height / this.zoomY; } } @@ -18193,7 +23504,37 @@ module.exports = BaseCamera; /***/ }), -/* 94 */ +/* 100 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Given 3 separate color values this will return an integer representation of it. + * + * @function Phaser.Display.Color.GetColor + * @since 3.0.0 + * + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * + * @return {number} The combined color value. + */ +var GetColor = function (red, green, blue) +{ + return red << 16 | green << 8 | blue; +}; + +module.exports = GetColor; + + +/***/ }), +/* 101 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -18208,18 +23549,203 @@ module.exports = BaseCamera; module.exports = { - ENTER_FULLSCREEN: __webpack_require__(727), - FULLSCREEN_FAILED: __webpack_require__(728), - FULLSCREEN_UNSUPPORTED: __webpack_require__(729), - LEAVE_FULLSCREEN: __webpack_require__(730), - ORIENTATION_CHANGE: __webpack_require__(731), - RESIZE: __webpack_require__(732) + ENTER_FULLSCREEN: __webpack_require__(768), + FULLSCREEN_FAILED: __webpack_require__(769), + FULLSCREEN_UNSUPPORTED: __webpack_require__(770), + LEAVE_FULLSCREEN: __webpack_require__(771), + ORIENTATION_CHANGE: __webpack_require__(772), + RESIZE: __webpack_require__(773) }; /***/ }), -/* 95 */ +/* 102 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Determines the operating system of the device running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.os` from within any Scene. + * + * @typedef {object} Phaser.Device.OS + * @since 3.0.0 + * + * @property {boolean} android - Is running on android? + * @property {boolean} chromeOS - Is running on chromeOS? + * @property {boolean} cordova - Is the game running under Apache Cordova? + * @property {boolean} crosswalk - Is the game running under the Intel Crosswalk XDK? + * @property {boolean} desktop - Is running on a desktop? + * @property {boolean} ejecta - Is the game running under Ejecta? + * @property {boolean} electron - Is the game running under GitHub Electron? + * @property {boolean} iOS - Is running on iOS? + * @property {boolean} iPad - Is running on iPad? + * @property {boolean} iPhone - Is running on iPhone? + * @property {boolean} kindle - Is running on an Amazon Kindle? + * @property {boolean} linux - Is running on linux? + * @property {boolean} macOS - Is running on macOS? + * @property {boolean} node - Is the game running under Node.js? + * @property {boolean} nodeWebkit - Is the game running under Node-Webkit? + * @property {boolean} webApp - Set to true if running as a WebApp, i.e. within a WebView + * @property {boolean} windows - Is running on windows? + * @property {boolean} windowsPhone - Is running on a Windows Phone? + * @property {number} iOSVersion - If running in iOS this will contain the major version number. + * @property {number} pixelRatio - PixelRatio of the host device? + */ +var OS = { + + android: false, + chromeOS: false, + cordova: false, + crosswalk: false, + desktop: false, + ejecta: false, + electron: false, + iOS: false, + iOSVersion: 0, + iPad: false, + iPhone: false, + kindle: false, + linux: false, + macOS: false, + node: false, + nodeWebkit: false, + pixelRatio: 1, + webApp: false, + windows: false, + windowsPhone: false + +}; + +function init () +{ + var ua = navigator.userAgent; + + if ((/Windows/).test(ua)) + { + OS.windows = true; + } + else if ((/Mac OS/).test(ua) && !((/like Mac OS/).test(ua))) + { + // Because iOS 13 identifies as Mac OS: + if (navigator.maxTouchPoints && navigator.maxTouchPoints > 2) + { + OS.iOS = true; + OS.iPad = true; + + (navigator.appVersion).match(/Version\/(\d+)/); + + OS.iOSVersion = parseInt(RegExp.$1, 10); + } + else + { + OS.macOS = true; + } + } + else if ((/Android/).test(ua)) + { + OS.android = true; + } + else if ((/Linux/).test(ua)) + { + OS.linux = true; + } + else if ((/iP[ao]d|iPhone/i).test(ua)) + { + OS.iOS = true; + + (navigator.appVersion).match(/OS (\d+)/); + + OS.iOSVersion = parseInt(RegExp.$1, 10); + + OS.iPhone = ua.toLowerCase().indexOf('iphone') !== -1; + OS.iPad = ua.toLowerCase().indexOf('ipad') !== -1; + } + else if ((/Kindle/).test(ua) || (/\bKF[A-Z][A-Z]+/).test(ua) || (/Silk.*Mobile Safari/).test(ua)) + { + OS.kindle = true; + + // This will NOT detect early generations of Kindle Fire, I think there is no reliable way... + // E.g. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" + } + else if ((/CrOS/).test(ua)) + { + OS.chromeOS = true; + } + + if ((/Windows Phone/i).test(ua) || (/IEMobile/i).test(ua)) + { + OS.android = false; + OS.iOS = false; + OS.macOS = false; + OS.windows = true; + OS.windowsPhone = true; + } + + var silk = (/Silk/).test(ua); + + if (OS.windows || OS.macOS || (OS.linux && !silk) || OS.chromeOS) + { + OS.desktop = true; + } + + // Windows Phone / Table reset + if (OS.windowsPhone || (((/Windows NT/i).test(ua)) && ((/Touch/i).test(ua)))) + { + OS.desktop = false; + } + + // WebApp mode in iOS + if (navigator.standalone) + { + OS.webApp = true; + } + + if (window.cordova !== undefined) + { + OS.cordova = true; + } + + if (typeof process !== 'undefined' && process.versions && process.versions.node) + { + OS.node = true; + } + + if (OS.node && typeof process.versions === 'object') + { + OS.nodeWebkit = !!process.versions['node-webkit']; + + OS.electron = !!process.versions.electron; + } + + if (window.ejecta !== undefined) + { + OS.ejecta = true; + } + + if ((/Crosswalk/).test(ua)) + { + OS.crosswalk = true; + } + + OS.pixelRatio = window['devicePixelRatio'] || 1; + + return OS; +} + +module.exports = init(); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(796))) + +/***/ }), +/* 103 */ /***/ (function(module, exports) { /** @@ -18229,132 +23755,43 @@ module.exports = { */ /** - * Snap a value to nearest grid slice, using floor. + * Removes a single item from an array and returns it without creating gc, like the native splice does. + * Based on code by Mike Reinstein. * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. - * As will `14` snap to `10`... but `16` will snap to `15`. - * - * @function Phaser.Math.Snap.Floor + * @function Phaser.Utils.Array.SpliceOne * @since 3.0.0 * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * @param {array} array - The array to splice from. + * @param {number} index - The index of the item which should be spliced. * - * @return {number} The snapped value. + * @return {*} The item which was spliced (removed). */ -var SnapFloor = function (value, gap, start, divide) +var SpliceOne = function (array, index) { - if (start === undefined) { start = 0; } - - if (gap === 0) + if (index >= array.length) { - return value; + return; } - value -= start; - value = gap * Math.floor(value / gap); + var len = array.length - 1; - return (divide) ? (start + value) / gap : start + value; -}; + var item = array[index]; -module.exports = SnapFloor; - - -/***/ }), -/* 96 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var SpliceOne = __webpack_require__(82); - -/** - * Removes the given item, or array of items, from the array. - * - * The array is modified in-place. - * - * You can optionally specify a callback to be invoked for each item successfully removed from the array. - * - * @function Phaser.Utils.Array.Remove - * @since 3.4.0 - * - * @param {array} array - The array to be modified. - * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. - * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. - * @param {object} [context] - The context in which the callback is invoked. - * - * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. - */ -var Remove = function (array, item, callback, context) -{ - if (context === undefined) { context = array; } - - var index; - - // Fast path to avoid array mutation and iteration - if (!Array.isArray(item)) + for (var i = index; i < len; i++) { - index = array.indexOf(item); - - if (index !== -1) - { - SpliceOne(array, index); - - if (callback) - { - callback.call(context, item); - } - - return item; - } - else - { - return null; - } + array[i] = array[i + 1]; } - // If we got this far, we have an array of items to remove - - var itemLength = item.length - 1; - - while (itemLength >= 0) - { - var entry = item[itemLength]; - - index = array.indexOf(entry); - - if (index !== -1) - { - SpliceOne(array, index); - - if (callback) - { - callback.call(context, entry); - } - } - else - { - // Item wasn't found in the array, so remove it from our return results - item.pop(); - } - - itemLength--; - } + array.length = len; return item; }; -module.exports = Remove; +module.exports = SpliceOne; /***/ }), -/* 97 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -18364,8 +23801,8 @@ module.exports = Remove; */ var Class = __webpack_require__(0); -var Clamp = __webpack_require__(17); -var Extend = __webpack_require__(19); +var Clamp = __webpack_require__(16); +var Extend = __webpack_require__(18); /** * @classdesc @@ -18377,8 +23814,8 @@ var Extend = __webpack_require__(19); * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture this Frame is a part of. - * @param {(integer|string)} name - The name of this Frame. The name is unique within the Texture. - * @param {integer} sourceIndex - The index of the TextureSource that this Frame is a part of. + * @param {(number|string)} name - The name of this Frame. The name is unique within the Texture. + * @param {number} sourceIndex - The index of the TextureSource that this Frame is a part of. * @param {number} x - The x coordinate of the top-left of this Frame. * @param {number} y - The y coordinate of the top-left of this Frame. * @param {number} width - The width of this Frame. @@ -18422,7 +23859,7 @@ var Frame = new Class({ * The index of the TextureSource in the Texture sources array. * * @name Phaser.Textures.Frame#sourceIndex - * @type {integer} + * @type {number} * @since 3.0.0 */ this.sourceIndex = sourceIndex; @@ -18441,7 +23878,7 @@ var Frame = new Class({ * X position within the source image to cut from. * * @name Phaser.Textures.Frame#cutX - * @type {integer} + * @type {number} * @since 3.0.0 */ this.cutX; @@ -18450,7 +23887,7 @@ var Frame = new Class({ * Y position within the source image to cut from. * * @name Phaser.Textures.Frame#cutY - * @type {integer} + * @type {number} * @since 3.0.0 */ this.cutY; @@ -18459,7 +23896,7 @@ var Frame = new Class({ * The width of the area in the source image to cut. * * @name Phaser.Textures.Frame#cutWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.cutWidth; @@ -18468,7 +23905,7 @@ var Frame = new Class({ * The height of the area in the source image to cut. * * @name Phaser.Textures.Frame#cutHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.cutHeight; @@ -18477,7 +23914,7 @@ var Frame = new Class({ * The X rendering offset of this Frame, taking trim into account. * * @name Phaser.Textures.Frame#x - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -18487,7 +23924,7 @@ var Frame = new Class({ * The Y rendering offset of this Frame, taking trim into account. * * @name Phaser.Textures.Frame#y - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -18497,7 +23934,7 @@ var Frame = new Class({ * The rendering width of this Frame, taking trim into account. * * @name Phaser.Textures.Frame#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width; @@ -18506,7 +23943,7 @@ var Frame = new Class({ * The rendering height of this Frame, taking trim into account. * * @name Phaser.Textures.Frame#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height; @@ -18516,7 +23953,7 @@ var Frame = new Class({ * Precalculated for the renderer. * * @name Phaser.Textures.Frame#halfWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.halfWidth; @@ -18526,7 +23963,7 @@ var Frame = new Class({ * Precalculated for the renderer. * * @name Phaser.Textures.Frame#halfHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.halfHeight; @@ -18535,7 +23972,7 @@ var Frame = new Class({ * The x center of this frame, floored. * * @name Phaser.Textures.Frame#centerX - * @type {integer} + * @type {number} * @since 3.0.0 */ this.centerX; @@ -18544,7 +23981,7 @@ var Frame = new Class({ * The y center of this frame, floored. * * @name Phaser.Textures.Frame#centerY - * @type {integer} + * @type {number} * @since 3.0.0 */ this.centerY; @@ -18600,7 +24037,7 @@ var Frame = new Class({ * 1 = Round * * @name Phaser.Textures.Frame#autoRound - * @type {integer} + * @type {number} * @default -1 * @since 3.0.0 */ @@ -18706,10 +24143,10 @@ var Frame = new Class({ * @method Phaser.Textures.Frame#setSize * @since 3.7.0 * - * @param {integer} width - The width of the frame before being trimmed. - * @param {integer} height - The height of the frame before being trimmed. - * @param {integer} [x=0] - The x coordinate of the top-left of this Frame. - * @param {integer} [y=0] - The y coordinate of the top-left of this Frame. + * @param {number} width - The width of the frame before being trimmed. + * @param {number} height - The height of the frame before being trimmed. + * @param {number} [x=0] - The x coordinate of the top-left of this Frame. + * @param {number} [y=0] - The y coordinate of the top-left of this Frame. * * @return {Phaser.Textures.Frame} This Frame object. */ @@ -19211,7 +24648,823 @@ module.exports = Frame; /***/ }), -/* 98 */ +/* 105 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ArrayUtils = __webpack_require__(199); +var Class = __webpack_require__(0); +var NOOP = __webpack_require__(1); +var StableSort = __webpack_require__(90); + +/** + * @callback EachListCallback + * + * @param {I} item - The item which is currently being processed. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + */ + +/** + * @classdesc + * List is a generic implementation of an ordered list which contains utility methods for retrieving, manipulating, and iterating items. + * + * @class List + * @memberof Phaser.Structs + * @constructor + * @since 3.0.0 + * + * @generic T + * + * @param {*} parent - The parent of this list. + */ +var List = new Class({ + + initialize: + + function List (parent) + { + /** + * The parent of this list. + * + * @name Phaser.Structs.List#parent + * @type {*} + * @since 3.0.0 + */ + this.parent = parent; + + /** + * The objects that belong to this collection. + * + * @genericUse {T[]} - [$type] + * + * @name Phaser.Structs.List#list + * @type {Array.<*>} + * @default [] + * @since 3.0.0 + */ + this.list = []; + + /** + * The index of the current element. + * + * This is used internally when iterating through the list with the {@link #first}, {@link #last}, {@link #get}, and {@link #previous} properties. + * + * @name Phaser.Structs.List#position + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.position = 0; + + /** + * A callback that is invoked every time a child is added to this list. + * + * @name Phaser.Structs.List#addCallback + * @type {function} + * @since 3.4.0 + */ + this.addCallback = NOOP; + + /** + * A callback that is invoked every time a child is removed from this list. + * + * @name Phaser.Structs.List#removeCallback + * @type {function} + * @since 3.4.0 + */ + this.removeCallback = NOOP; + + /** + * The property key to sort by. + * + * @name Phaser.Structs.List#_sortKey + * @type {string} + * @since 3.4.0 + */ + this._sortKey = ''; + }, + + /** + * Adds the given item to the end of the list. Each item must be unique. + * + * @method Phaser.Structs.List#add + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*|Array.<*>} child - The item, or array of items, to add to the list. + * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. + * + * @return {*} The list's underlying array. + */ + add: function (child, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.Add(this.list, child); + } + else + { + return ArrayUtils.Add(this.list, child, 0, this.addCallback, this); + } + }, + + /** + * Adds an item to list, starting at a specified index. Each item must be unique within the list. + * + * @method Phaser.Structs.List#addAt + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item, or array of items, to add to the list. + * @param {number} [index=0] - The index in the list at which the element(s) will be inserted. + * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. + * + * @return {*} The List's underlying array. + */ + addAt: function (child, index, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.AddAt(this.list, child, index); + } + else + { + return ArrayUtils.AddAt(this.list, child, index, 0, this.addCallback, this); + } + }, + + /** + * Retrieves the item at a given position inside the List. + * + * @method Phaser.Structs.List#getAt + * @since 3.0.0 + * + * @genericUse {T} - [$return] + * + * @param {number} index - The index of the item. + * + * @return {*} The retrieved item, or `undefined` if it's outside the List's bounds. + */ + getAt: function (index) + { + return this.list[index]; + }, + + /** + * Locates an item within the List and returns its index. + * + * @method Phaser.Structs.List#getIndex + * @since 3.0.0 + * + * @genericUse {T} - [child] + * + * @param {*} child - The item to locate. + * + * @return {number} The index of the item within the List, or -1 if it's not in the List. + */ + getIndex: function (child) + { + // Return -1 if given child isn't a child of this display list + return this.list.indexOf(child); + }, + + /** + * Sort the contents of this List so the items are in order based on the given property. + * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. + * + * @method Phaser.Structs.List#sort + * @since 3.0.0 + * + * @genericUse {T[]} - [children,$return] + * + * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. + * + * @return {Phaser.Structs.List} This List object. + */ + sort: function (property, handler) + { + if (!property) + { + return this; + } + + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } + + StableSort(this.list, handler); + + return this; + }, + + /** + * Searches for the first instance of a child with its `name` + * property matching the given argument. Should more than one child have + * the same name only the first is returned. + * + * @method Phaser.Structs.List#getByName + * @since 3.0.0 + * + * @genericUse {T | null} - [$return] + * + * @param {string} name - The name to search for. + * + * @return {?*} The first child with a matching name, or null if none were found. + */ + getByName: function (name) + { + return ArrayUtils.GetFirst(this.list, 'name', name); + }, + + /** + * Returns a random child from the group. + * + * @method Phaser.Structs.List#getRandom + * @since 3.0.0 + * + * @genericUse {T | null} - [$return] + * + * @param {number} [startIndex=0] - Offset from the front of the group (lowest child). + * @param {number} [length=(to top)] - Restriction on the number of values you want to randomly select from. + * + * @return {?*} A random child of this Group. + */ + getRandom: function (startIndex, length) + { + return ArrayUtils.GetRandom(this.list, startIndex, length); + }, + + /** + * Returns the first element in a given part of the List which matches a specific criterion. + * + * @method Phaser.Structs.List#getFirst + * @since 3.0.0 + * + * @genericUse {T | null} - [$return] + * + * @param {string} property - The name of the property to test or a falsey value to have no criterion. + * @param {*} value - The value to test the `property` against, or `undefined` to allow any value and only check for existence. + * @param {number} [startIndex=0] - The position in the List to start the search at. + * @param {number} [endIndex] - The position in the List to optionally stop the search at. It won't be checked. + * + * @return {?*} The first item which matches the given criterion, or `null` if no such item exists. + */ + getFirst: function (property, value, startIndex, endIndex) + { + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); + }, + + /** + * Returns all children in this List. + * + * You can optionally specify a matching criteria using the `property` and `value` arguments. + * + * For example: `getAll('parent')` would return only children that have a property called `parent`. + * + * You can also specify a value to compare the property to: + * + * `getAll('visible', true)` would return only children that have their visible property set to `true`. + * + * Optionally you can specify a start and end index. For example if this List had 100 children, + * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only + * the first 50 children in the List. + * + * @method Phaser.Structs.List#getAll + * @since 3.0.0 + * + * @genericUse {T} - [value] + * @genericUse {T[]} - [$return] + * + * @param {string} [property] - An optional property to test against the value argument. + * @param {*} [value] - If property is set then Child.property must strictly equal this value to be included in the results. + * @param {number} [startIndex] - The first child index to start the search from. + * @param {number} [endIndex] - The last child index to search up until. + * + * @return {Array.<*>} All items of the List which match the given criterion, if any. + */ + getAll: function (property, value, startIndex, endIndex) + { + return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex); + }, + + /** + * Returns the total number of items in the List which have a property matching the given value. + * + * @method Phaser.Structs.List#count + * @since 3.0.0 + * + * @genericUse {T} - [value] + * + * @param {string} property - The property to test on each item. + * @param {*} value - The value to test the property against. + * + * @return {number} The total number of matching elements. + */ + count: function (property, value) + { + return ArrayUtils.CountAllMatching(this.list, property, value); + }, + + /** + * Swaps the positions of two items in the list. + * + * @method Phaser.Structs.List#swap + * @since 3.0.0 + * + * @genericUse {T} - [child1,child2] + * + * @param {*} child1 - The first item to swap. + * @param {*} child2 - The second item to swap. + */ + swap: function (child1, child2) + { + ArrayUtils.Swap(this.list, child1, child2); + }, + + /** + * Moves an item in the List to a new position. + * + * @method Phaser.Structs.List#moveTo + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to move. + * @param {number} index - Moves an item in the List to a new position. + * + * @return {*} The item that was moved. + */ + moveTo: function (child, index) + { + return ArrayUtils.MoveTo(this.list, child, index); + }, + + /** + * Removes one or many items from the List. + * + * @method Phaser.Structs.List#remove + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item, or array of items, to remove. + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {*} The item, or array of items, which were successfully removed from the List. + */ + remove: function (child, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.Remove(this.list, child); + } + else + { + return ArrayUtils.Remove(this.list, child, this.removeCallback, this); + } + }, + + /** + * Removes the item at the given position in the List. + * + * @method Phaser.Structs.List#removeAt + * @since 3.0.0 + * + * @genericUse {T} - [$return] + * + * @param {number} index - The position to remove the item from. + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {*} The item that was removed. + */ + removeAt: function (index, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.RemoveAt(this.list, index); + } + else + { + return ArrayUtils.RemoveAt(this.list, index, this.removeCallback, this); + } + }, + + /** + * Removes the items within the given range in the List. + * + * @method Phaser.Structs.List#removeBetween + * @since 3.0.0 + * + * @genericUse {T[]} - [$return] + * + * @param {number} [startIndex=0] - The index to start removing from. + * @param {number} [endIndex] - The position to stop removing at. The item at this position won't be removed. + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {Array.<*>} An array of the items which were removed. + */ + removeBetween: function (startIndex, endIndex, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex); + } + else + { + return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeCallback, this); + } + }, + + /** + * Removes all the items. + * + * @method Phaser.Structs.List#removeAll + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.List.} - [$return] + * + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {Phaser.Structs.List} This List object. + */ + removeAll: function (skipCallback) + { + var i = this.list.length; + + while (i--) + { + this.remove(this.list[i], skipCallback); + } + + return this; + }, + + /** + * Brings the given child to the top of this List. + * + * @method Phaser.Structs.List#bringToTop + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to bring to the top of the List. + * + * @return {*} The item which was moved. + */ + bringToTop: function (child) + { + return ArrayUtils.BringToTop(this.list, child); + }, + + /** + * Sends the given child to the bottom of this List. + * + * @method Phaser.Structs.List#sendToBack + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to send to the back of the list. + * + * @return {*} The item which was moved. + */ + sendToBack: function (child) + { + return ArrayUtils.SendToBack(this.list, child); + }, + + /** + * Moves the given child up one place in this group unless it's already at the top. + * + * @method Phaser.Structs.List#moveUp + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to move up. + * + * @return {*} The item which was moved. + */ + moveUp: function (child) + { + ArrayUtils.MoveUp(this.list, child); + + return child; + }, + + /** + * Moves the given child down one place in this group unless it's already at the bottom. + * + * @method Phaser.Structs.List#moveDown + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to move down. + * + * @return {*} The item which was moved. + */ + moveDown: function (child) + { + ArrayUtils.MoveDown(this.list, child); + + return child; + }, + + /** + * Reverses the order of all children in this List. + * + * @method Phaser.Structs.List#reverse + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.List.} - [$return] + * + * @return {Phaser.Structs.List} This List object. + */ + reverse: function () + { + this.list.reverse(); + + return this; + }, + + /** + * Shuffles the items in the list. + * + * @method Phaser.Structs.List#shuffle + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.List.} - [$return] + * + * @return {Phaser.Structs.List} This List object. + */ + shuffle: function () + { + ArrayUtils.Shuffle(this.list); + + return this; + }, + + /** + * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List. + * + * @method Phaser.Structs.List#replace + * @since 3.0.0 + * + * @genericUse {T} - [oldChild,newChild,$return] + * + * @param {*} oldChild - The child in this List that will be replaced. + * @param {*} newChild - The child to be inserted into this List. + * + * @return {*} Returns the oldChild that was replaced within this group. + */ + replace: function (oldChild, newChild) + { + return ArrayUtils.Replace(this.list, oldChild, newChild); + }, + + /** + * Checks if an item exists within the List. + * + * @method Phaser.Structs.List#exists + * @since 3.0.0 + * + * @genericUse {T} - [child] + * + * @param {*} child - The item to check for the existence of. + * + * @return {boolean} `true` if the item is found in the list, otherwise `false`. + */ + exists: function (child) + { + return (this.list.indexOf(child) > -1); + }, + + /** + * Sets the property `key` to the given value on all members of this List. + * + * @method Phaser.Structs.List#setAll + * @since 3.0.0 + * + * @genericUse {T} - [value] + * + * @param {string} property - The name of the property to set. + * @param {*} value - The value to set the property to. + * @param {number} [startIndex] - The first child index to start the search from. + * @param {number} [endIndex] - The last child index to search up until. + */ + setAll: function (property, value, startIndex, endIndex) + { + ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex); + + return this; + }, + + /** + * Passes all children to the given callback. + * + * @method Phaser.Structs.List#each + * @since 3.0.0 + * + * @genericUse {EachListCallback.} - [callback] + * + * @param {EachListCallback} callback - The function to call. + * @param {*} [context] - Value to use as `this` when executing callback. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + */ + each: function (callback, context) + { + var args = [ null ]; + + for (var i = 2; i < arguments.length; i++) + { + args.push(arguments[i]); + } + + for (i = 0; i < this.list.length; i++) + { + args[0] = this.list[i]; + + callback.apply(context, args); + } + }, + + /** + * Clears the List and recreates its internal array. + * + * @method Phaser.Structs.List#shutdown + * @since 3.0.0 + */ + shutdown: function () + { + this.removeAll(); + + this.list = []; + }, + + /** + * Destroys this List. + * + * @method Phaser.Structs.List#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.removeAll(); + + this.parent = null; + this.addCallback = null; + this.removeCallback = null; + }, + + /** + * The number of items inside the List. + * + * @name Phaser.Structs.List#length + * @type {number} + * @readonly + * @since 3.0.0 + */ + length: { + + get: function () + { + return this.list.length; + } + + }, + + /** + * The first item in the List or `null` for an empty List. + * + * @name Phaser.Structs.List#first + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + first: { + + get: function () + { + this.position = 0; + + if (this.list.length > 0) + { + return this.list[0]; + } + else + { + return null; + } + } + + }, + + /** + * The last item in the List, or `null` for an empty List. + * + * @name Phaser.Structs.List#last + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + last: { + + get: function () + { + if (this.list.length > 0) + { + this.position = this.list.length - 1; + + return this.list[this.position]; + } + else + { + return null; + } + } + + }, + + /** + * The next item in the List, or `null` if the entire List has been traversed. + * + * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List. + * + * @name Phaser.Structs.List#next + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + next: { + + get: function () + { + if (this.position < this.list.length) + { + this.position++; + + return this.list[this.position]; + } + else + { + return null; + } + } + + }, + + /** + * The previous item in the List, or `null` if the entire List has been traversed. + * + * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards. + * + * @name Phaser.Structs.List#previous + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + previous: { + + get: function () + { + if (this.position > 0) + { + this.position--; + + return this.list[this.position]; + } + else + { + return null; + } + } + + } + +}); + +module.exports = List; + + +/***/ }), +/* 106 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19221,11 +25474,11 @@ module.exports = Frame; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(99); -var GetPoint = __webpack_require__(412); -var GetPoints = __webpack_require__(413); -var GEOM_CONST = __webpack_require__(49); -var Random = __webpack_require__(167); +var Contains = __webpack_require__(107); +var GetPoint = __webpack_require__(422); +var GetPoints = __webpack_require__(423); +var GEOM_CONST = __webpack_require__(55); +var Random = __webpack_require__(172); /** * @classdesc @@ -19261,7 +25514,7 @@ var Ellipse = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Ellipse#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -19353,7 +25606,7 @@ var Ellipse = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -19593,7 +25846,7 @@ module.exports = Ellipse; /***/ }), -/* 99 */ +/* 107 */ /***/ (function(module, exports) { /** @@ -19635,7 +25888,7 @@ module.exports = Contains; /***/ }), -/* 100 */ +/* 108 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -19644,16 +25897,17 @@ module.exports = Contains; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Actions = __webpack_require__(252); +var Actions = __webpack_require__(267); var Class = __webpack_require__(0); -var Events = __webpack_require__(29); -var GetAll = __webpack_require__(193); +var Events = __webpack_require__(32); +var EventEmitter = __webpack_require__(10); +var GetAll = __webpack_require__(198); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); var IsPlainObject = __webpack_require__(7); -var Range = __webpack_require__(404); -var Set = __webpack_require__(141); -var Sprite = __webpack_require__(76); +var Range = __webpack_require__(414); +var Set = __webpack_require__(145); +var Sprite = __webpack_require__(70); /** * @classdesc @@ -19665,6 +25919,7 @@ var Sprite = __webpack_require__(76); * * @class Group * @memberof Phaser.GameObjects + * @extends Phaser.Events.EventEmitter * @constructor * @since 3.0.0 * @param {Phaser.Scene} scene - The scene this group belongs to. @@ -19676,10 +25931,14 @@ var Sprite = __webpack_require__(76); */ var Group = new Class({ + Extends: EventEmitter, + initialize: function Group (scene, children, config) { + EventEmitter.call(this); + // They can pass in any of the following as the first argument: // 1) A single child @@ -19789,7 +26048,7 @@ var Group = new Class({ * The maximum size of this group, if used as a pool. -1 is no limit. * * @name Phaser.GameObjects.Group#maxSize - * @type {integer} + * @type {number} * @since 3.0.0 * @default -1 */ @@ -19811,7 +26070,7 @@ var Group = new Class({ * A default texture frame to use when creating new group members. * * @name Phaser.GameObjects.Group#defaultFrame - * @type {(string|integer)} + * @type {(string|number)} * @since 3.0.0 */ this.defaultFrame = GetFastValue(config, 'defaultFrame', null); @@ -19885,6 +26144,21 @@ var Group = new Class({ { this.createMultiple(config); } + + this.on(Events.ADDED_TO_SCENE, this.addedToScene, this); + this.on(Events.REMOVED_FROM_SCENE, this.removedFromScene, this); + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); }, /** @@ -19898,7 +26172,7 @@ var Group = new Class({ * @param {number} [x=0] - The horizontal position of the new Game Object in the world. * @param {number} [y=0] - The vertical position of the new Game Object in the world. * @param {string} [key=defaultKey] - The texture key of the new Game Object. - * @param {(string|integer)} [frame=defaultFrame] - The texture frame of the new Game Object. + * @param {(string|number)} [frame=defaultFrame] - The texture frame of the new Game Object. * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of the new Game Object. * @param {boolean} [active=true] - The {@link Phaser.GameObjects.GameObject#active} state of the new Game Object. * @@ -20374,7 +26648,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getLength * @since 3.0.0 * - * @return {integer} + * @return {number} */ getLength: function () { @@ -20395,14 +26669,14 @@ var Group = new Class({ * * @param {string} [property] - The property to test on each array element. * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex] - An optional start index to search from. - * @param {integer} [endIndex] - An optional end index to search to. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * * @return {any[]} An array of matching Group members. The array will be empty if nothing matched. */ getMatching: function (property, value, startIndex, endIndex) { - return GetAll(this.children, property, value, startIndex, endIndex); + return GetAll(this.children.entries, property, value, startIndex, endIndex); }, /** @@ -20420,7 +26694,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -20440,13 +26714,13 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getFirstNth * @since 3.6.0 * - * @param {integer} nth - The nth matching Group member to search for. + * @param {number} nth - The nth matching Group member to search for. * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -20471,7 +26745,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -20491,13 +26765,13 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getLastNth * @since 3.6.0 * - * @param {integer} nth - The nth matching Group member to search for. + * @param {number} nth - The nth matching Group member to search for. * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -20519,13 +26793,13 @@ var Group = new Class({ * @since 3.6.0 * * @param {boolean} forwards - Search front to back or back to front? - * @param {integer} nth - Stop matching after nth successful matches. + * @param {number} nth - Stop matching after nth successful matches. * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -20624,7 +26898,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first inactive group member, or a newly created member, or null. @@ -20648,7 +26922,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {any} The first active group member, or a newly created member, or null. @@ -20673,7 +26947,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {any} The first inactive group member, or a newly created member, or null. @@ -20729,7 +27003,7 @@ var Group = new Class({ * * @param {boolean} [value=true] - Count active (true) or inactive (false) group members. * - * @return {integer} The number of group members with an active state matching the `active` argument. + * @return {number} The number of group members with an active state matching the `active` argument. */ countActive: function (value) { @@ -20754,7 +27028,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getTotalUsed * @since 3.0.0 * - * @return {integer} The number of group members with an active state of true. + * @return {number} The number of group members with an active state of true. */ getTotalUsed: function () { @@ -20769,7 +27043,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getTotalFree * @since 3.0.0 * - * @return {integer} maxSize minus the number of active group numbers; or a large number (if maxSize is -1). + * @return {number} maxSize minus the number of active group numbers; or a large number (if maxSize is -1). */ getTotalFree: function () { @@ -20824,8 +27098,8 @@ var Group = new Class({ * @param {string} key - The property to be updated. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {this} This Group object. */ @@ -20845,8 +27119,8 @@ var Group = new Class({ * @param {string} key - The property to be updated. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {this} This Group object. */ @@ -20980,7 +27254,7 @@ var Group = new Class({ * * @param {number} x - The x coordinate to place the first item in the array at. * @param {number} y - The y coordinate to place the first item in the array at. - * @param {integer} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. + * @param {number} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. * * @return {this} This Group object. */ @@ -21286,8 +27560,8 @@ var Group = new Class({ * @since 3.21.0 * * @param {boolean} value - The value to set the property to. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {this} This Group object. */ @@ -21345,7 +27619,7 @@ module.exports = Group; /***/ }), -/* 101 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -21354,7 +27628,7 @@ module.exports = Group; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders a filled path for the given Shape. @@ -21372,7 +27646,7 @@ var Utils = __webpack_require__(10); */ var FillPathWebGL = function (pipeline, calcMatrix, src, alpha, dx, dy) { - var fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha); + var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); var path = src.pathData; var pathIndexes = src.pathIndexes; @@ -21399,9 +27673,7 @@ var FillPathWebGL = function (pipeline, calcMatrix, src, alpha, dx, dy) var tx2 = calcMatrix.getX(x2, y2); var ty2 = calcMatrix.getY(x2, y2); - pipeline.setTexture2D(); - - pipeline.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, fillTintColor, fillTintColor, fillTintColor, pipeline.tintEffect); + pipeline.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, fillTintColor, fillTintColor, fillTintColor); } }; @@ -21409,9 +27681,959 @@ module.exports = FillPathWebGL; /***/ }), -/* 102 */, -/* 103 */, -/* 104 */ +/* 110 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// http://www.blackpawn.com/texts/pointinpoly/ + +/** + * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds. + * + * @function Phaser.Geom.Triangle.Contains + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. + * + * @return {boolean} `true` if the point is inside the Triangle, otherwise `false`. + */ +var Contains = function (triangle, x, y) +{ + var v0x = triangle.x3 - triangle.x1; + var v0y = triangle.y3 - triangle.y1; + + var v1x = triangle.x2 - triangle.x1; + var v1y = triangle.y2 - triangle.y1; + + var v2x = x - triangle.x1; + var v2y = y - triangle.y1; + + var dot00 = (v0x * v0x) + (v0y * v0y); + var dot01 = (v0x * v1x) + (v0y * v1y); + var dot02 = (v0x * v2x) + (v0y * v2y); + var dot11 = (v1x * v1x) + (v1y * v1y); + var dot12 = (v1x * v2x) + (v1y * v2y); + + // Compute barycentric coordinates + var b = ((dot00 * dot11) - (dot01 * dot01)); + var inv = (b === 0) ? 0 : (1 / b); + var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; + var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; + + return (u >= 0 && v >= 0 && (u + v < 1)); +}; + +module.exports = Contains; + + +/***/ }), +/* 111 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Rectangle = __webpack_require__(9); +var RectangleToRectangle = __webpack_require__(112); +var Vector2 = __webpack_require__(3); + +/** + * Returns the length of the line. + * + * @ignore + * @private + * + * @param {number} x1 - The x1 coordinate. + * @param {number} y1 - The y1 coordinate. + * @param {number} x2 - The x2 coordinate. + * @param {number} y2 - The y2 coordinate. + * + * @return {number} The length of the line. + */ +function GetLength (x1, y1, x2, y2) +{ + var x = x1 - x2; + var y = y1 - y2; + var magnitude = (x * x) + (y * y); + + return Math.sqrt(magnitude); +} + +/** + * @classdesc + * A Face Geometry Object. + * + * A Face is used by the Mesh Game Object. A Mesh consists of one, or more, faces that are + * used to render the Mesh Game Objects in WebGL. + * + * A Face consists of 3 Vertex instances, for the 3 corners of the face and methods to help + * you modify and test them. + * + * @class Face + * @memberof Phaser.Geom.Mesh + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Vertex} vertex1 - The first vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex2 - The second vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex3 - The third vertex of the Face. + */ +var Face = new Class({ + + initialize: + + function Face (vertex1, vertex2, vertex3) + { + /** + * The first vertex in this Face. + * + * @name Phaser.Geom.Mesh.Face#vertex1 + * @type {Phaser.Geom.Mesh.Vertex} + * @since 3.50.0 + */ + this.vertex1 = vertex1; + + /** + * The second vertex in this Face. + * + * @name Phaser.Geom.Mesh.Face#vertex2 + * @type {Phaser.Geom.Mesh.Vertex} + * @since 3.50.0 + */ + this.vertex2 = vertex2; + + /** + * The third vertex in this Face. + * + * @name Phaser.Geom.Mesh.Face#vertex3 + * @type {Phaser.Geom.Mesh.Vertex} + * @since 3.50.0 + */ + this.vertex3 = vertex3; + + /** + * The bounds of this Face. + * + * Be sure to call the `Face.updateBounds` method _before_ using this property. + * + * @name Phaser.Geom.Mesh.Face#bounds + * @type {Phaser.Geom.Rectangle} + * @since 3.50.0 + */ + this.bounds = new Rectangle(); + + /** + * The face inCenter. Do not access directly, instead use the `getInCenter` method. + * + * @name Phaser.Geom.Mesh.Face#_inCenter + * @type {Phaser.Math.Vector2} + * @private + * @since 3.50.0 + */ + this._inCenter = new Vector2(); + }, + + /** + * Calculates and returns the in-center position of this Face. + * + * @method Phaser.Geom.Mesh.Face#getInCenter + * @since 3.50.0 + * + * @param {boolean} [local=true] Return the in center from the un-transformed vertex positions (`true`), or transformed? (`false`) + * + * @return {Phaser.Math.Vector2} A Vector2 containing the in center position of this Face. + */ + getInCenter: function (local) + { + if (local === undefined) { local = true; } + + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + var v1x; + var v1y; + + var v2x; + var v2y; + + var v3x; + var v3y; + + if (local) + { + v1x = v1.x; + v1y = v1.y; + + v2x = v2.x; + v2y = v2.y; + + v3x = v3.x; + v3y = v3.y; + } + else + { + v1x = v1.vx; + v1y = v1.vy; + + v2x = v2.vx; + v2y = v2.vy; + + v3x = v3.vx; + v3y = v3.vy; + } + + var d1 = GetLength(v3x, v3y, v2x, v2y); + var d2 = GetLength(v1x, v1y, v3x, v3y); + var d3 = GetLength(v2x, v2y, v1x, v1y); + + var p = d1 + d2 + d3; + + return this._inCenter.set( + (v1x * d1 + v2x * d2 + v3x * d3) / p, + (v1y * d1 + v2y * d2 + v3y * d3) / p + ); + }, + + /** + * Checks if the given coordinates are within this Face. + * + * You can optionally provide a transform matrix. If given, the Face vertices + * will be transformed first, before being checked against the coordinates. + * + * @method Phaser.Geom.Mesh.Face#contains + * @since 3.50.0 + * + * @param {number} x - The horizontal position to check. + * @param {number} y - The vertical position to check. + * @param {Phaser.GameObjects.Components.TransformMatrix} [calcMatrix] - Optional transform matrix to apply to the vertices before comparison. + * + * @return {boolean} `true` if the coordinates lay within this Face, otherwise `false`. + */ + contains: function (x, y, calcMatrix) + { + var vertex1 = this.vertex1; + var vertex2 = this.vertex2; + var vertex3 = this.vertex3; + + var v1x = vertex1.vx; + var v1y = vertex1.vy; + + var v2x = vertex2.vx; + var v2y = vertex2.vy; + + var v3x = vertex3.vx; + var v3y = vertex3.vy; + + if (calcMatrix) + { + var a = calcMatrix.a; + var b = calcMatrix.b; + var c = calcMatrix.c; + var d = calcMatrix.d; + var e = calcMatrix.e; + var f = calcMatrix.f; + + v1x = vertex1.vx * a + vertex1.vy * c + e; + v1y = vertex1.vx * b + vertex1.vy * d + f; + + v2x = vertex2.vx * a + vertex2.vy * c + e; + v2y = vertex2.vx * b + vertex2.vy * d + f; + + v3x = vertex3.vx * a + vertex3.vy * c + e; + v3y = vertex3.vx * b + vertex3.vy * d + f; + } + + var t0x = v3x - v1x; + var t0y = v3y - v1y; + + var t1x = v2x - v1x; + var t1y = v2y - v1y; + + var t2x = x - v1x; + var t2y = y - v1y; + + var dot00 = (t0x * t0x) + (t0y * t0y); + var dot01 = (t0x * t1x) + (t0y * t1y); + var dot02 = (t0x * t2x) + (t0y * t2y); + var dot11 = (t1x * t1x) + (t1y * t1y); + var dot12 = (t1x * t2x) + (t1y * t2y); + + // Compute barycentric coordinates + var bc = ((dot00 * dot11) - (dot01 * dot01)); + var inv = (bc === 0) ? 0 : (1 / bc); + var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; + var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; + + return (u >= 0 && v >= 0 && (u + v < 1)); + }, + + /** + * Checks if the vertices in this Face are orientated counter-clockwise, or not. + * + * It checks the transformed position of the vertices, not the local one. + * + * @method Phaser.Geom.Mesh.Face#isCounterClockwise + * @since 3.50.0 + * + * @param {number} z - The z-axis value to test against. Typically the `Mesh.modelPosition.z`. + * + * @return {boolean} `true` if the vertices in this Face run counter-clockwise, otherwise `false`. + */ + isCounterClockwise: function (z) + { + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + var d = (v2.vx - v1.vx) * (v3.vy - v1.vy) - (v2.vy - v1.vy) * (v3.vx - v1.vx); + + return (z <= 0) ? d >= 0 : d < 0; + }, + + /** + * Loads the data from this Vertex into the given Typed Arrays. + * + * @method Phaser.Geom.Mesh.Face#load + * @since 3.50.0 + * + * @param {Float32Array} F32 - A Float32 Array to insert the position, UV and unit data in to. + * @param {Uint32Array} U32 - A Uint32 Array to insert the color and alpha data in to. + * @param {number} offset - The index of the array to insert this Vertex to. + * @param {number} textureUnit - The texture unit currently in use. + * @param {number} alpha - The alpha of the parent object. + * @param {number} a - The parent transform matrix data a component. + * @param {number} b - The parent transform matrix data b component. + * @param {number} c - The parent transform matrix data c component. + * @param {number} d - The parent transform matrix data d component. + * @param {number} e - The parent transform matrix data e component. + * @param {number} f - The parent transform matrix data f component. + * @param {boolean} roundPixels - Round the vertex position or not? + * + * @return {number} The new vertex index array offset. + */ + load: function (F32, U32, offset, textureUnit, tintEffect) + { + offset = this.vertex1.load(F32, U32, offset, textureUnit, tintEffect); + offset = this.vertex2.load(F32, U32, offset, textureUnit, tintEffect); + offset = this.vertex3.load(F32, U32, offset, textureUnit, tintEffect); + + return offset; + }, + + /** + * Transforms all Face vertices by the given matrix, storing the results in their `vx`, `vy` and `vz` properties. + * + * @method Phaser.Geom.Mesh.Face#transformCoordinatesLocal + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} transformMatrix - The transform matrix to apply to this vertex. + * @param {number} width - The width of the parent Mesh. + * @param {number} height - The height of the parent Mesh. + * @param {number} cameraZ - The z position of the MeshCamera. + * + * @return {this} This Face instance. + */ + transformCoordinatesLocal: function (transformMatrix, width, height, cameraZ) + { + this.vertex1.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); + this.vertex2.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); + this.vertex3.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); + + return this; + }, + + /** + * Updates the bounds of this Face, based on the translated values of the vertices. + * + * Call this method prior to accessing the `Face.bounds` property. + * + * @method Phaser.Geom.Mesh.Face#updateBounds + * @since 3.50.0 + * + * @return {this} This Face instance. + */ + updateBounds: function () + { + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + var bounds = this.bounds; + + bounds.x = Math.min(v1.vx, v2.vx, v3.vx); + bounds.y = Math.min(v1.vy, v2.vy, v3.vy); + bounds.width = Math.max(v1.vx, v2.vx, v3.vx) - bounds.x; + bounds.height = Math.max(v1.vy, v2.vy, v3.vy) - bounds.y; + + return this; + }, + + /** + * Checks if this Face is within the view of the given Camera. + * + * This method is called in the `MeshWebGLRenderer` function. It performs the following tasks: + * + * First, the `Vertex.update` method is called on each of the vertices. This populates them + * with the new translated values, updating their `tx`, `ty` and `ta` properties. + * + * Then it tests to see if this face is visible due to the alpha values, if not, it returns. + * + * After this, if `hideCCW` is set, it calls `isCounterClockwise` and returns if not. + * + * Finally, it will update the `Face.bounds` based on the newly translated vertex values + * and return the results of an intersection test between the bounds and the camera world view + * rectangle. + * + * @method Phaser.Geom.Mesh.Face#isInView + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against. + * @param {boolean} hideCCW - Test the counter-clockwise orientation of the verts? + * @param {number} z - The Cameras z position, used in the CCW test. + * @param {number} alpha - The alpha of the parent object. + * @param {number} a - The parent transform matrix data a component. + * @param {number} b - The parent transform matrix data b component. + * @param {number} c - The parent transform matrix data c component. + * @param {number} d - The parent transform matrix data d component. + * @param {number} e - The parent transform matrix data e component. + * @param {number} f - The parent transform matrix data f component. + * @param {boolean} roundPixels - Round the vertex position or not? + * + * @return {boolean} `true` if this Face can be seen by the Camera. + */ + isInView: function (camera, hideCCW, z, alpha, a, b, c, d, e, f, roundPixels) + { + var v1 = this.vertex1.update(a, b, c, d, e, f, roundPixels, alpha); + var v2 = this.vertex2.update(a, b, c, d, e, f, roundPixels, alpha); + var v3 = this.vertex3.update(a, b, c, d, e, f, roundPixels, alpha); + + // Alpha check first + if (v1.ta <= 0 && v2.ta <= 0 && v3.ta <= 0) + { + return false; + } + + // CCW check + if (hideCCW && !this.isCounterClockwise(z)) + { + return false; + } + + // Bounds check + var bounds = this.bounds; + + bounds.x = Math.min(v1.tx, v2.tx, v3.tx); + bounds.y = Math.min(v1.ty, v2.ty, v3.ty); + bounds.width = Math.max(v1.tx, v2.tx, v3.tx) - bounds.x; + bounds.height = Math.max(v1.ty, v2.ty, v3.ty) - bounds.y; + + return RectangleToRectangle(bounds, camera.worldView); + }, + + /** + * Translates the vertices of this Face by the given amounts. + * + * The actual vertex positions are adjusted, not their transformed position. + * + * Therefore, this updates the vertex data directly. + * + * @method Phaser.Geom.Mesh.Face#translate + * @since 3.50.0 + * + * @param {number} x - The amount to horizontally translate by. + * @param {number} [y=0] - The amount to vertically translate by. + * + * @return {this} This Face instance. + */ + translate: function (x, y) + { + if (y === undefined) { y = 0; } + + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + v1.x += x; + v1.y += y; + + v2.x += x; + v2.y += y; + + v3.x += x; + v3.y += y; + + return this; + }, + + /** + * The x coordinate of this Face, based on the in center position of the Face. + * + * @name Phaser.Geom.Mesh.Face#x + * @type {number} + * @since 3.50.0 + */ + x: { + + get: function () + { + return this.getInCenter().x; + }, + + set: function (value) + { + var current = this.getInCenter(); + + this.translate(value - current.x, 0); + } + + }, + + /** + * The y coordinate of this Face, based on the in center position of the Face. + * + * @name Phaser.Geom.Mesh.Face#y + * @type {number} + * @since 3.50.0 + */ + y: { + + get: function () + { + return this.getInCenter().y; + }, + + set: function (value) + { + var current = this.getInCenter(); + + this.translate(0, value - current.y); + } + + }, + + /** + * Set the alpha value of this Face. + * + * Each vertex is given the same value. If you need to adjust the alpha on a per-vertex basis + * then use the `Vertex.alpha` property instead. + * + * When getting the alpha of this Face, it will return an average of the alpha + * component of all three vertices. + * + * @name Phaser.Geom.Mesh.Face#alpha + * @type {number} + * @since 3.50.0 + */ + alpha: { + + get: function () + { + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + return (v1.alpha + v2.alpha + v3.alpha) / 3; + }, + + set: function (value) + { + this.vertex1.alpha = value; + this.vertex2.alpha = value; + this.vertex3.alpha = value; + } + + }, + + /** + * The depth of this Face, which is an average of the z component of all three vertices. + * + * The depth is calculated based on the transformed z value, not the local one. + * + * @name Phaser.Geom.Mesh.Face#depth + * @type {number} + * @readonly + * @since 3.50.0 + */ + depth: { + + get: function () + { + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + return (v1.vz + v2.vz + v3.vz) / 3; + } + + }, + + /** + * Destroys this Face and nulls the references to the vertices. + * + * @method Phaser.Geom.Mesh.Face#destroy + * @since 3.50.0 + */ + destroy: function () + { + this.vertex1 = null; + this.vertex2 = null; + this.vertex3 = null; + } + +}); + +module.exports = Face; + + +/***/ }), +/* 112 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Checks if two Rectangles intersect. + * + * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. + * As such, the two Rectangles are considered "solid". + * A Rectangle with no width or no height will never intersect another Rectangle. + * + * @function Phaser.Geom.Intersects.RectangleToRectangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. + * + * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`. + */ +var RectangleToRectangle = function (rectA, rectB) +{ + if (rectA.width <= 0 || rectA.height <= 0 || rectB.width <= 0 || rectB.height <= 0) + { + return false; + } + + return !(rectA.right < rectB.x || rectA.bottom < rectB.y || rectA.x > rectB.right || rectA.y > rectB.bottom); +}; + +module.exports = RectangleToRectangle; + + +/***/ }), +/* 113 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Utils = __webpack_require__(12); +var Vector3 = __webpack_require__(37); + +/** + * @classdesc + * A Vertex Geometry Object. + * + * This class consists of all the information required for a single vertex within a Face Geometry Object. + * + * Faces, and thus Vertex objects, are used by the Mesh Game Object in order to render objects in WebGL. + * + * @class Vertex + * @memberof Phaser.Geom.Mesh + * @constructor + * @extends Phaser.Math.Vector3 + * @since 3.50.0 + * + * @param {number} x - The x position of the vertex. + * @param {number} y - The y position of the vertex. + * @param {number} z - The z position of the vertex. + * @param {number} u - The UV u coordinate of the vertex. + * @param {number} v - The UV v coordinate of the vertex. + * @param {number} [color=0xffffff] - The color value of the vertex. + * @param {number} [alpha=1] - The alpha value of the vertex. + * @param {number} [nx=0] - The x normal value of the vertex. + * @param {number} [ny=0] - The y normal value of the vertex. + * @param {number} [nz=0] - The z normal value of the vertex. + */ +var Vertex = new Class({ + + Extends: Vector3, + + initialize: + + function Vertex (x, y, z, u, v, color, alpha, nx, ny, nz) + { + if (color === undefined) { color = 0xffffff; } + if (alpha === undefined) { alpha = 1; } + if (nx === undefined) { nx = 0; } + if (ny === undefined) { ny = 0; } + if (nz === undefined) { nz = 0; } + + Vector3.call(this, x, y, z); + + /** + * The projected x coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#vx + * @type {number} + * @since 3.50.0 + */ + this.vx = 0; + + /** + * The projected y coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#vy + * @type {number} + * @since 3.50.0 + */ + this.vy = 0; + + /** + * The projected z coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#vz + * @type {number} + * @since 3.50.0 + */ + this.vz = 0; + + /** + * The projected x coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#nx + * @type {number} + * @since 3.50.0 + */ + this.nx = nx; + + /** + * The projected y coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#ny + * @type {number} + * @since 3.50.0 + */ + this.ny = ny; + + /** + * The projected z coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#nz + * @type {number} + * @since 3.50.0 + */ + this.nz = nz; + + /** + * UV u coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#u + * @type {number} + * @since 3.50.0 + */ + this.u = u; + + /** + * UV v coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#v + * @type {number} + * @since 3.50.0 + */ + this.v = v; + + /** + * The color value of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#color + * @type {number} + * @since 3.50.0 + */ + this.color = color; + + /** + * The alpha value of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#alpha + * @type {number} + * @since 3.50.0 + */ + this.alpha = alpha; + + /** + * The translated x coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#tx + * @type {number} + * @since 3.50.0 + */ + this.tx = 0; + + /** + * The translated y coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#ty + * @type {number} + * @since 3.50.0 + */ + this.ty = 0; + + /** + * The translated alpha value of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#ta + * @type {number} + * @since 3.50.0 + */ + this.ta = 0; + }, + + /** + * Sets the U and V properties. + * + * @method Phaser.Geom.Mesh.Vertex#setUVs + * @since 3.50.0 + * + * @param {number} u - The UV u coordinate of the vertex. + * @param {number} v - The UV v coordinate of the vertex. + * + * @return {this} This Vertex. + */ + setUVs: function (u, v) + { + this.u = u; + this.v = v; + + return this; + }, + + /** + * Transforms this vertex by the given matrix, storing the results in `vx`, `vy` and `vz`. + * + * @method Phaser.Geom.Mesh.Vertex#transformCoordinatesLocal + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} transformMatrix - The transform matrix to apply to this vertex. + * @param {number} width - The width of the parent Mesh. + * @param {number} height - The height of the parent Mesh. + * @param {number} cameraZ - The z position of the MeshCamera. + */ + transformCoordinatesLocal: function (transformMatrix, width, height, cameraZ) + { + var x = this.x; + var y = this.y; + var z = this.z; + + var m = transformMatrix.val; + + var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; + var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; + var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; + var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + + this.vx = (tx / tw) * width; + this.vy = -(ty / tw) * height; + + if (cameraZ <= 0) + { + this.vz = (tz / tw); + } + else + { + this.vz = -(tz / tw); + } + }, + + /** + * Updates this Vertex based on the given transform. + * + * @method Phaser.Geom.Mesh.Vertex#update + * @since 3.50.0 + * + * @param {number} a - The parent transform matrix data a component. + * @param {number} b - The parent transform matrix data b component. + * @param {number} c - The parent transform matrix data c component. + * @param {number} d - The parent transform matrix data d component. + * @param {number} e - The parent transform matrix data e component. + * @param {number} f - The parent transform matrix data f component. + * @param {boolean} roundPixels - Round the vertex position or not? + * @param {number} alpha - The alpha of the parent object. + * + * @return {this} This Vertex. + */ + update: function (a, b, c, d, e, f, roundPixels, alpha) + { + var tx = this.vx * a + this.vy * c + e; + var ty = this.vx * b + this.vy * d + f; + + if (roundPixels) + { + tx = Math.round(tx); + ty = Math.round(ty); + } + + this.tx = tx; + this.ty = ty; + this.ta = this.alpha * alpha; + + return this; + }, + + /** + * Loads the data from this Vertex into the given Typed Arrays. + * + * @method Phaser.Geom.Mesh.Vertex#load + * @since 3.50.0 + * + * @param {Float32Array} F32 - A Float32 Array to insert the position, UV and unit data in to. + * @param {Uint32Array} U32 - A Uint32 Array to insert the color and alpha data in to. + * @param {number} offset - The index of the array to insert this Vertex to. + * @param {number} textureUnit - The texture unit currently in use. + * + * @return {number} The new array offset. + */ + load: function (F32, U32, offset, textureUnit, tintEffect) + { + F32[++offset] = this.tx; + F32[++offset] = this.ty; + F32[++offset] = this.u; + F32[++offset] = this.v; + F32[++offset] = textureUnit; + F32[++offset] = tintEffect; + U32[++offset] = Utils.getTintAppendFloatAlpha(this.color, this.ta); + + return offset; + } + +}); + +module.exports = Vertex; + + +/***/ }), +/* 114 */, +/* 115 */, +/* 116 */ /***/ (function(module, exports) { /** @@ -21426,8 +28648,8 @@ module.exports = FillPathWebGL; * @function Phaser.Tilemaps.Components.IsInLayerBounds * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {boolean} `true` if the tile coordinates are within the bounds of the layer, otherwise `false`. @@ -21441,7 +28663,7 @@ module.exports = IsInLayerBounds; /***/ }), -/* 105 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -21451,12 +28673,13 @@ module.exports = IsInLayerBounds; */ var Class = __webpack_require__(0); +var CONST = __webpack_require__(29); var GetFastValue = __webpack_require__(2); /** * @classdesc * A class for representing data about about a layer in a map. Maps are parsed from CSV, Tiled, - * etc. into this format. Tilemap, StaticTilemapLayer and DynamicTilemapLayer have a reference + * etc. into this format. Tilemap and TilemapLayer objects have a reference * to this data and use it to look up and perform operations on tiles. * * @class LayerData @@ -21555,6 +28778,15 @@ var LayerData = new Class({ */ this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); + /** + * The layers orientation, necessary to be able to determine a tiles pixelX and pixelY as well as the layers width and height. + * + * @name Phaser.Tilemaps.LayerData#orientation + * @type {Phaser.Tilemaps.OrientationType} + * @since 3.50.0 + */ + this.orientation = GetFastValue(config, 'orientation', CONST.ORTHOGONAL); + /** * The width in pixels of the entire layer. * @@ -21649,10 +28881,20 @@ var LayerData = new Class({ * A reference to the Tilemap layer that owns this data. * * @name Phaser.Tilemaps.LayerData#tilemapLayer - * @type {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} + * @type {Phaser.Tilemaps.TilemapLayer} * @since 3.0.0 */ this.tilemapLayer = GetFastValue(config, 'tilemapLayer', null); + + /** + * The length of the horizontal sides of the hexagon. + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.LayerData#hexSideLength + * @type {number} + * @since 3.50.0 + */ + this.hexSideLength = GetFastValue(config, 'hexSideLength', 0); } }); @@ -21661,7 +28903,7 @@ module.exports = LayerData; /***/ }), -/* 106 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -21671,6 +28913,7 @@ module.exports = LayerData; */ var Class = __webpack_require__(0); +var CONST = __webpack_require__(29); var GetFastValue = __webpack_require__(2); /** @@ -21696,7 +28939,7 @@ var MapData = new Class({ /** * The key in the Phaser cache that corresponds to the loaded tilemap data. - * + * * @name Phaser.Tilemaps.MapData#name * @type {string} * @since 3.0.0 @@ -21705,7 +28948,7 @@ var MapData = new Class({ /** * The width of the entire tilemap. - * + * * @name Phaser.Tilemaps.MapData#width * @type {number} * @since 3.0.0 @@ -21714,7 +28957,7 @@ var MapData = new Class({ /** * The height of the entire tilemap. - * + * * @name Phaser.Tilemaps.MapData#height * @type {number} * @since 3.0.0 @@ -21732,7 +28975,7 @@ var MapData = new Class({ /** * The width of the tiles. - * + * * @name Phaser.Tilemaps.MapData#tileWidth * @type {number} * @since 3.0.0 @@ -21741,7 +28984,7 @@ var MapData = new Class({ /** * The height of the tiles. - * + * * @name Phaser.Tilemaps.MapData#tileHeight * @type {number} * @since 3.0.0 @@ -21750,7 +28993,7 @@ var MapData = new Class({ /** * The width in pixels of the entire tilemap. - * + * * @name Phaser.Tilemaps.MapData#widthInPixels * @type {number} * @since 3.0.0 @@ -21759,7 +29002,7 @@ var MapData = new Class({ /** * The height in pixels of the entire tilemap. - * + * * @name Phaser.Tilemaps.MapData#heightInPixels * @type {number} * @since 3.0.0 @@ -21768,30 +29011,30 @@ var MapData = new Class({ /** * The format of the map data. - * + * * @name Phaser.Tilemaps.MapData#format - * @type {integer} + * @type {number} * @since 3.0.0 */ this.format = GetFastValue(config, 'format', null); /** * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. - * + * * @name Phaser.Tilemaps.MapData#orientation - * @type {string} - * @since 3.0.0 + * @type {Phaser.Tilemaps.OrientationType} + * @since 3.50.0 */ - this.orientation = GetFastValue(config, 'orientation', 'orthogonal'); + this.orientation = GetFastValue(config, 'orientation', CONST.ORTHOGONAL); /** * Determines the draw order of tilemap. Default is right-down - * + * * 0, or 'right-down' * 1, or 'left-down' * 2, or 'right-up' * 3, or 'left-up' - * + * * @name Phaser.Tilemaps.MapData#renderOrder * @type {string} * @since 3.12.0 @@ -21800,7 +29043,7 @@ var MapData = new Class({ /** * The version of the map data (as specified in Tiled). - * + * * @name Phaser.Tilemaps.MapData#version * @type {string} * @since 3.0.0 @@ -21809,7 +29052,7 @@ var MapData = new Class({ /** * Map specific properties (can be specified in Tiled) - * + * * @name Phaser.Tilemaps.MapData#properties * @type {object} * @since 3.0.0 @@ -21818,7 +29061,7 @@ var MapData = new Class({ /** * An array with all the layers configured to the MapData. - * + * * @name Phaser.Tilemaps.MapData#layers * @type {(Phaser.Tilemaps.LayerData[]|Phaser.Tilemaps.ObjectLayer)} * @since 3.0.0 @@ -21827,7 +29070,7 @@ var MapData = new Class({ /** * An array of Tiled Image Layers. - * + * * @name Phaser.Tilemaps.MapData#images * @type {array} * @since 3.0.0 @@ -21836,7 +29079,7 @@ var MapData = new Class({ /** * An object of Tiled Object Layers. - * + * * @name Phaser.Tilemaps.MapData#objects * @type {object} * @since 3.0.0 @@ -21845,7 +29088,7 @@ var MapData = new Class({ /** * An object of collision data. Must be created as physics object or will return undefined. - * + * * @name Phaser.Tilemaps.MapData#collision * @type {object} * @since 3.0.0 @@ -21854,7 +29097,7 @@ var MapData = new Class({ /** * An array of Tilesets. - * + * * @name Phaser.Tilemaps.MapData#tilesets * @type {Phaser.Tilemaps.Tileset[]} * @since 3.0.0 @@ -21863,7 +29106,7 @@ var MapData = new Class({ /** * The collection of images the map uses(specified in Tiled) - * + * * @name Phaser.Tilemaps.MapData#imageCollections * @type {array} * @since 3.0.0 @@ -21872,12 +29115,22 @@ var MapData = new Class({ /** * An array of tile instances. - * + * * @name Phaser.Tilemaps.MapData#tiles * @type {array} * @since 3.0.0 */ this.tiles = GetFastValue(config, 'tiles', []); + + /** + * The length of the horizontal sides of the hexagon. + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.MapData#hexSideLength + * @type {number} + * @since 3.50.0 + */ + this.hexSideLength = GetFastValue(config, 'hexSideLength', 0); } }); @@ -21886,7 +29139,7 @@ module.exports = MapData; /***/ }), -/* 107 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -21908,11 +29161,11 @@ var Class = __webpack_require__(0); * @since 3.0.0 * * @param {string} name - The name of the tileset in the map data. - * @param {integer} firstgid - The first tile index this tileset contains. - * @param {integer} [tileWidth=32] - Width of each tile (in pixels). - * @param {integer} [tileHeight=32] - Height of each tile (in pixels). - * @param {integer} [tileMargin=0] - The margin around all tiles in the sheet (in pixels). - * @param {integer} [tileSpacing=0] - The spacing between each tile in the sheet (in pixels). + * @param {number} firstgid - The first tile index this tileset contains. + * @param {number} [tileWidth=32] - Width of each tile (in pixels). + * @param {number} [tileHeight=32] - Height of each tile (in pixels). + * @param {number} [tileMargin=0] - The margin around all tiles in the sheet (in pixels). + * @param {number} [tileSpacing=0] - The spacing between each tile in the sheet (in pixels). * @param {object} [tileProperties={}] - Custom properties defined per tile in the Tileset. * These typically are custom properties created in Tiled when editing a tileset. * @param {object} [tileData={}] - Data stored per tile. These typically are created in Tiled @@ -21944,7 +29197,7 @@ var Tileset = new Class({ * The starting index of the first tile index this Tileset contains. * * @name Phaser.Tilemaps.Tileset#firstgid - * @type {integer} + * @type {number} * @since 3.0.0 */ this.firstgid = firstgid; @@ -21953,7 +29206,7 @@ var Tileset = new Class({ * The width of each tile (in pixels). Use setTileSize to change. * * @name Phaser.Tilemaps.Tileset#tileWidth - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -21963,7 +29216,7 @@ var Tileset = new Class({ * The height of each tile (in pixels). Use setTileSize to change. * * @name Phaser.Tilemaps.Tileset#tileHeight - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -21973,7 +29226,7 @@ var Tileset = new Class({ * The margin around the tiles in the sheet (in pixels). Use `setSpacing` to change. * * @name Phaser.Tilemaps.Tileset#tileMargin - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -21983,7 +29236,7 @@ var Tileset = new Class({ * The spacing between each the tile in the sheet (in pixels). Use `setSpacing` to change. * * @name Phaser.Tilemaps.Tileset#tileSpacing - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -22033,7 +29286,7 @@ var Tileset = new Class({ * The number of tile rows in the the tileset. * * @name Phaser.Tilemaps.Tileset#rows - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -22043,7 +29296,7 @@ var Tileset = new Class({ * The number of tile columns in the tileset. * * @name Phaser.Tilemaps.Tileset#columns - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -22053,7 +29306,7 @@ var Tileset = new Class({ * The total number of tiles in the tileset. * * @name Phaser.Tilemaps.Tileset#total - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -22078,7 +29331,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#getTileProperties * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {?(object|undefined)} */ @@ -22097,7 +29350,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#getTileData * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {?object|undefined} */ @@ -22115,7 +29368,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#getTileCollisionGroup * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {?object} */ @@ -22132,7 +29385,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#containsTileIndex * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {boolean} */ @@ -22151,7 +29404,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#getTileTextureCoordinates * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {?object} Object in the form { x, y } representing the top-left UV coordinate * within the Tileset image. @@ -22190,8 +29443,8 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#setTileSize * @since 3.0.0 * - * @param {integer} [tileWidth] - The width of a tile in pixels. - * @param {integer} [tileHeight] - The height of a tile in pixels. + * @param {number} [tileWidth] - The width of a tile in pixels. + * @param {number} [tileHeight] - The height of a tile in pixels. * * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ @@ -22214,8 +29467,8 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#setSpacing * @since 3.0.0 * - * @param {integer} [margin] - The margin around the tiles in the sheet (in pixels). - * @param {integer} [spacing] - The spacing between the tiles in the sheet (in pixels). + * @param {number} [margin] - The margin around the tiles in the sheet (in pixels). + * @param {number} [spacing] - The spacing between the tiles in the sheet (in pixels). * * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ @@ -22238,8 +29491,8 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#updateTileData * @since 3.0.0 * - * @param {integer} imageWidth - The (expected) width of the image to slice. - * @param {integer} imageHeight - The (expected) height of the image to slice. + * @param {number} imageWidth - The (expected) width of the image to slice. + * @param {number} imageHeight - The (expected) height of the image to slice. * * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ @@ -22290,7 +29543,7 @@ module.exports = Tileset; /***/ }), -/* 108 */ +/* 120 */ /***/ (function(module, exports) { /** @@ -22306,7 +29559,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.TOP_LEFT * @since 3.0.0 - * @type {integer} + * @type {number} */ TOP_LEFT: 0, @@ -22315,7 +29568,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.TOP_CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ TOP_CENTER: 1, @@ -22324,7 +29577,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.TOP_RIGHT * @since 3.0.0 - * @type {integer} + * @type {number} */ TOP_RIGHT: 2, @@ -22333,7 +29586,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.LEFT_TOP * @since 3.0.0 - * @type {integer} + * @type {number} */ LEFT_TOP: 3, @@ -22342,7 +29595,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.LEFT_CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ LEFT_CENTER: 4, @@ -22351,7 +29604,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.LEFT_BOTTOM * @since 3.0.0 - * @type {integer} + * @type {number} */ LEFT_BOTTOM: 5, @@ -22360,7 +29613,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ CENTER: 6, @@ -22369,7 +29622,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.RIGHT_TOP * @since 3.0.0 - * @type {integer} + * @type {number} */ RIGHT_TOP: 7, @@ -22378,7 +29631,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.RIGHT_CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ RIGHT_CENTER: 8, @@ -22387,7 +29640,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.RIGHT_BOTTOM * @since 3.0.0 - * @type {integer} + * @type {number} */ RIGHT_BOTTOM: 9, @@ -22396,7 +29649,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.BOTTOM_LEFT * @since 3.0.0 - * @type {integer} + * @type {number} */ BOTTOM_LEFT: 10, @@ -22405,7 +29658,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.BOTTOM_CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ BOTTOM_CENTER: 11, @@ -22414,7 +29667,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.BOTTOM_RIGHT * @since 3.0.0 - * @type {integer} + * @type {number} */ BOTTOM_RIGHT: 12 @@ -22424,7 +29677,7 @@ module.exports = ALIGN_CONST; /***/ }), -/* 109 */ +/* 121 */ /***/ (function(module, exports) { /** @@ -22458,2541 +29711,7 @@ module.exports = Equal; /***/ }), -/* 110 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var PIPELINE_CONST = { - - /** - * The Bitmap Mask Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.BITMAPMASK_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - BITMAPMASK_PIPELINE: 'BitmapMaskPipeline', - - /** - * The Light 2D Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.LIGHT_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - LIGHT_PIPELINE: 'Light2D', - - /** - * The Single Texture Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.SINGLE_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - SINGLE_PIPELINE: 'SinglePipeline', - - /** - * The Multi Texture Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.MULTI_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - MULTI_PIPELINE: 'MultiPipeline', - - /** - * The Rope Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.ROPE_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - ROPE_PIPELINE: 'RopePipeline' - -}; - -module.exports = PIPELINE_CONST; - - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var Utils = __webpack_require__(10); - -/** - * @classdesc - * - * The `WebGLPipeline` is a base class used by all of the core Phaser pipelines. - * - * It describes the way elements will be rendered in WebGL. Internally, it handles - * compiling the shaders, creating vertex buffers, assigning primitive topolgy and - * binding vertex attributes, all based on the given configuration data. - * - * The pipeline is configured by passing in a `WebGLPipelineConfig` object. Please - * see the documentation for this type to fully understand the configuration options - * available to you. - * - * Usually, you would not extend from this class directly, but would instead extend - * from one of the core pipelines, such as the Multi Pipeline or Rope Pipeline. - * - * @class WebGLPipeline - * @memberof Phaser.Renderer.WebGL - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. - */ -var WebGLPipeline = new Class({ - - initialize: - - function WebGLPipeline (config) - { - var game = config.game; - var renderer = game.renderer; - var gl = renderer.gl; - - /** - * Name of the pipeline. Used for identification. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#name - * @type {string} - * @since 3.0.0 - */ - this.name = GetFastValue(config, 'name', 'WebGLPipeline'); - - /** - * The Phaser Game instance to which this pipeline is bound. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; - - /** - * The WebGL Renderer instance to which this pipeline is bound. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer - * @type {Phaser.Renderer.WebGL.WebGLRenderer} - * @since 3.0.0 - */ - this.renderer = renderer; - - /** - * The WebGL context this WebGL Pipeline uses. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#gl - * @type {WebGLRenderingContext} - * @since 3.0.0 - */ - this.gl = gl; - - /** - * The canvas which this WebGL Pipeline renders to. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#view - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.view = game.canvas; - - /** - * The current game resolution. - * This is hard-coded to 1. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#resolution - * @type {number} - * @since 3.0.0 - */ - this.resolution = 1; - - /** - * Width of the current viewport. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#width - * @type {number} - * @since 3.0.0 - */ - this.width = 0; - - /** - * Height of the current viewport. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#height - * @type {number} - * @since 3.0.0 - */ - this.height = 0; - - /** - * The current number of vertices that have been added to the pipeline batch. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.vertexCount = 0; - - /** - * The total number of vertices that the pipeline batch can hold before it will flush. - * This defaults to `batchSize * 6`, where `batchSize` is defined in the Renderer Config. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity - * @type {integer} - * @since 3.0.0 - */ - this.vertexCapacity = GetFastValue(config, 'vertexCapacity', renderer.config.batchSize * 6); - - /** - * The size in bytes of a vertex. - * - * Derived by adding together all of the vertex attributes. - * - * For example, the Texture Tint Pipeline has 2 + 2 + 1 + 1 + 4 for the attributes - * `inPosition` (size 2), `inTexCoord` (size 2), `inTexId` (size 1), `inTintEffect` (size 1) - * and `inTint` (size 4), for a total of 28, which is the default for this property. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexSize - * @type {integer} - * @since 3.0.0 - */ - this.vertexSize = GetFastValue(config, 'vertexSize', 28); - - /** - * Raw byte buffer of vertices. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData - * @type {ArrayBuffer} - * @since 3.0.0 - */ - this.vertexData = GetFastValue(config, 'vertices', new ArrayBuffer(this.vertexCapacity * this.vertexSize)); - - /** - * The WebGLBuffer that holds the vertex data. - * Created from the `vertices` config ArrayBuffer that was passed in, or set by default, by the pipeline. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer - * @type {WebGLBuffer} - * @since 3.0.0 - */ - if (GetFastValue(config, 'vertices', null)) - { - this.vertexBuffer = this.renderer.createVertexBuffer(this.vertexData, this.gl.STREAM_DRAW); - } - else - { - this.vertexBuffer = this.renderer.createVertexBuffer(this.vertexData.byteLength, this.gl.STREAM_DRAW); - } - - /** - * The handle to a WebGL program. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#program - * @type {WebGLProgram} - * @since 3.0.0 - */ - this.program = this.renderer.createProgram(config.vertShader, config.fragShader); - - /** - * Array of objects that describe the vertex attributes. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#attributes - * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributesConfig} - * @since 3.0.0 - */ - this.attributes = config.attributes; - - /** - * The primitive topology which the pipeline will use to submit draw calls. - * Defaults to GL_TRIANGLES if not otherwise set. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#topology - * @type {GLenum} - * @since 3.0.0 - */ - this.topology = GetFastValue(config, 'topology', gl.TRIANGLES); - - /** - * Uint8 view to the vertex raw buffer. Used for uploading vertex buffer resources to the GPU. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes - * @type {Uint8Array} - * @since 3.0.0 - */ - this.bytes = new Uint8Array(this.vertexData); - - /** - * This will store the amount of components of 32 bit length. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexComponentCount - * @type {integer} - * @since 3.0.0 - */ - this.vertexComponentCount = Utils.getComponentCount(this.attributes, gl); - - /** - * Indicates if the current pipeline is flushing the contents to the GPU. - * When the variable is set the flush function will be locked. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#flushLocked - * @type {boolean} - * @since 3.1.0 - */ - this.flushLocked = false; - - /** - * Indicates if the current pipeline is active or not for this frame only. - * Reset in the onRender method. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#active - * @type {boolean} - * @since 3.10.0 - */ - this.active = false; - - /** - * Holds the most recently assigned texture unit. - * Treat this value as read-only. - * - * @name Phaser.Renderer.WebGL.Pipelines.WebGLPipeline#currentUnit - * @type {number} - * @since 3.50.0 - */ - this.currentUnit = 0; - - /** - * Some pipelines require the forced use of texture zero (like the light pipeline). - * This boolean should be set when that is the case. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#forceZero - * @type {boolean} - * @since 3.50.0 - */ - this.forceZero = false; - - /** - * Indicates if the current pipeline has booted or not. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#hasBooted - * @type {boolean} - * @readonly - * @since 3.50.0 - */ - this.hasBooted = false; - }, - - /** - * Called when the Game has fully booted and the Renderer has finished setting up. - * - * By this stage all Game level systems are now in place and you can perform any final - * tasks that the pipeline may need that relied on game systems such as the Texture Manager. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#boot - * @since 3.11.0 - */ - boot: function () - { - var renderer = this.renderer; - - renderer.setProgram(this.program); - renderer.setVertexBuffer(this.vertexBuffer); - - this.setAttribPointers(true); - - this.hasBooted = true; - - return this; - }, - - /** - * Custom pipelines can use this method in order to perform any required pre-batch tasks - * for the given Game Object. It must return the texture unit the Game Object was assigned. - * - * @method Phaser.Renderer.WebGL.Pipelines.WebGLPipeline#setGameObject - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. - * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. - * - * @return {number} The texture unit the Game Object has been assigned. - */ - setGameObject: function (gameObject, frame) - { - if (frame === undefined) { frame = gameObject.frame; } - - this.currentUnit = this.renderer.setTextureSource(frame.source); - - return this.currentUnit; - }, - - /** - * Adds a description of vertex attribute to the pipeline - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#addAttribute - * @since 3.2.0 - * - * @param {string} name - Name of the vertex attribute - * @param {integer} size - Vertex component size - * @param {integer} type - Type of the attribute - * @param {boolean} normalized - Is the value normalized to a range - * @param {integer} offset - Byte offset to the beginning of the first element in the vertex - * - * @return {this} This WebGLPipeline instance. - */ - addAttribute: function (name, size, type, normalized, offset) - { - this.attributes.push({ - name: name, - size: size, - type: this.renderer.glFormats[type], - normalized: normalized, - offset: offset, - enabled: false, - location: -1 - }); - - this.vertexComponentCount = Utils.getComponentCount( - this.attributes, - this.gl - ); - return this; - }, - - /** - * Check if the current batch of vertices is full. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush - * @since 3.0.0 - * - * @return {boolean} `true` if the current batch should be flushed, otherwise `false`. - */ - shouldFlush: function () - { - return (this.vertexCount >= this.vertexCapacity); - }, - - /** - * Resizes the properties used to describe the viewport - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#resize - * @since 3.0.0 - * - * @param {number} width - The new width of this WebGL Pipeline. - * @param {number} height - The new height of this WebGL Pipeline. - * @param {number} resolution - The resolution this WebGL Pipeline should be resized to. - * - * @return {this} This WebGLPipeline instance. - */ - resize: function (width, height, resolution) - { - this.width = width * resolution; - this.height = height * resolution; - this.resolution = resolution; - - return this; - }, - - /** - * Binds the pipeline resources, including the program, vertex buffer and attribute pointers. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#bind - * @since 3.0.0 - * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? - * - * @return {this} This WebGLPipeline instance. - */ - bind: function (reset) - { - if (reset === undefined) { reset = false; } - - var vertexBuffer = this.vertexBuffer; - var program = this.program; - var renderer = this.renderer; - - renderer.setProgram(program); - renderer.setVertexBuffer(vertexBuffer); - - this.setAttribPointers(reset); - - return this; - }, - - /** - * Sets the vertex attribute pointers. - * This should only be called after the vertex buffer has been bound. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setAttribPointers - * @since 3.50.0 - * - * @param {boolean} [reset=false] - Reset the vertex attribute locations? - * - * @return {this} This WebGLPipeline instance. - */ - setAttribPointers: function (reset) - { - if (reset === undefined) { reset = false; } - - var gl = this.gl; - var attributes = this.attributes; - var vertexSize = this.vertexSize; - var program = this.program; - - for (var i = 0; i < attributes.length; i++) - { - var element = attributes[i]; - - if (reset) - { - var location = gl.getAttribLocation(program, element.name); - - if (location >= 0) - { - gl.enableVertexAttribArray(location); - gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexSize, element.offset); - element.enabled = true; - element.location = location; - } - else if (location !== -1) - { - gl.disableVertexAttribArray(location); - } - } - else if (element.enabled) - { - gl.vertexAttribPointer(element.location, element.size, element.type, element.normalized, vertexSize, element.offset); - } - else if (!element.enabled && element.location > -1) - { - gl.disableVertexAttribArray(element.location); - element.location = -1; - } - } - }, - - /** - * Set whenever this WebGL Pipeline is bound to a WebGL Renderer. - * - * This method is called every time the WebGL Pipeline is attempted to be bound, even if it already is the current pipeline. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - onBind: function () - { - // This is for updating uniform data it's called on each bind attempt. - return this; - }, - - /** - * Called before each frame is rendered, but after the canvas has been cleared. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - onPreRender: function () - { - // called once every frame - return this; - }, - - /** - * Called before a Scene's Camera is rendered. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene being rendered. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. - * - * @return {this} This WebGLPipeline instance. - */ - onRender: function () - { - // called for each camera - return this; - }, - - /** - * Called after each frame has been completely rendered and snapshots have been taken. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - onPostRender: function () - { - // called once every frame - return this; - }, - - /** - * Uploads the vertex data and emits a draw call - * for the current batch of vertices. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#flush - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - flush: function () - { - if (this.flushLocked) { return this; } - - this.flushLocked = true; - - var gl = this.gl; - var vertexCount = this.vertexCount; - var topology = this.topology; - var vertexSize = this.vertexSize; - - if (vertexCount === 0) - { - this.flushLocked = false; - return; - } - - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - gl.drawArrays(topology, 0, vertexCount); - - this.vertexCount = 0; - this.flushLocked = false; - - return this; - }, - - /** - * Removes all object references in this WebGL Pipeline and removes its program from the WebGL context. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - destroy: function () - { - var gl = this.gl; - - gl.deleteProgram(this.program); - gl.deleteBuffer(this.vertexBuffer); - - delete this.program; - delete this.vertexBuffer; - delete this.gl; - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat1 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The new value of the `float` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat1: function (name, x) - { - this.renderer.setFloat1(this.program, name, x); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat2 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The new X component of the `vec2` uniform. - * @param {number} y - The new Y component of the `vec2` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat2: function (name, x, y) - { - this.renderer.setFloat2(this.program, name, x, y); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat3 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The new X component of the `vec3` uniform. - * @param {number} y - The new Y component of the `vec3` uniform. - * @param {number} z - The new Z component of the `vec3` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat3: function (name, x, y, z) - { - this.renderer.setFloat3(this.program, name, x, y, z); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat4 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - X component of the uniform - * @param {number} y - Y component of the uniform - * @param {number} z - Z component of the uniform - * @param {number} w - W component of the uniform - * - * @return {this} This WebGLPipeline instance. - */ - setFloat4: function (name, x, y, z, w) - { - this.renderer.setFloat4(this.program, name, x, y, z, w); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat1v - * @since 3.13.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat1v: function (name, arr) - { - this.renderer.setFloat1v(this.program, name, arr); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat2v - * @since 3.13.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat2v: function (name, arr) - { - this.renderer.setFloat2v(this.program, name, arr); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat3v - * @since 3.13.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat3v: function (name, arr) - { - this.renderer.setFloat3v(this.program, name, arr); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat4v - * @since 3.13.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat4v: function (name, arr) - { - this.renderer.setFloat4v(this.program, name, arr); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt1 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The new value of the `int` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setInt1: function (name, x) - { - this.renderer.setInt1(this.program, name, x); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt2 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The new X component of the `ivec2` uniform. - * @param {integer} y - The new Y component of the `ivec2` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setInt2: function (name, x, y) - { - this.renderer.setInt2(this.program, name, x, y); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt3 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The new X component of the `ivec3` uniform. - * @param {integer} y - The new Y component of the `ivec3` uniform. - * @param {integer} z - The new Z component of the `ivec3` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setInt3: function (name, x, y, z) - { - this.renderer.setInt3(this.program, name, x, y, z); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt4 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - X component of the uniform - * @param {integer} y - Y component of the uniform - * @param {integer} z - Z component of the uniform - * @param {integer} w - W component of the uniform - * - * @return {this} This WebGLPipeline instance. - */ - setInt4: function (name, x, y, z, w) - { - this.renderer.setInt4(this.program, name, x, y, z, w); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. - * @param {Float32Array} matrix - The new values for the `mat2` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setMatrix2: function (name, transpose, matrix) - { - this.renderer.setMatrix2(this.program, name, transpose, matrix); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. - * @param {Float32Array} matrix - The new values for the `mat3` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setMatrix3: function (name, transpose, matrix) - { - this.renderer.setMatrix3(this.program, name, transpose, matrix); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - Should the matrix be transpose - * @param {Float32Array} matrix - Matrix data - * - * @return {this} This WebGLPipeline instance. - */ - setMatrix4: function (name, transpose, matrix) - { - this.renderer.setMatrix4(this.program, name, transpose, matrix); - - return this; - } - -}); - -module.exports = WebGLPipeline; - - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Earcut = __webpack_require__(60); -var GetFastValue = __webpack_require__(2); -var ModelViewProjection = __webpack_require__(113); -var ProjectOrtho = __webpack_require__(185); -var ShaderSourceFS = __webpack_require__(810); -var ShaderSourceVS = __webpack_require__(811); -var TransformMatrix = __webpack_require__(31); -var Utils = __webpack_require__(10); -var WebGLPipeline = __webpack_require__(111); - -/** - * @classdesc - * - * The Multi Pipeline is the core 2D texture rendering pipeline used by Phaser in WebGL. - * Virtually all Game Objects use this pipeline by default, including Sprites, Graphics - * and Tilemaps. It handles the batching of quads and tris, as well as methods for - * drawing and batching geometry data. - * - * Prior to Phaser v3.50 this pipeline was called the `TextureTintPipeline`. - * - * In previous versions of Phaser only one single texture unit was supported at any one time. - * The Multi Pipeline is an evolution of the old Texture Tint Pipeline, updated to support - * multi-textures for increased performance. - * - * The fragment shader it uses can be found in `shaders/src/Multi.frag`. - * The vertex shader it uses can be found in `shaders/src/Multi.vert`. - * - * The default shader attributes for this pipeline are: - * - * `inPosition` (vec2, offset 0) - * `inTexCoord` (vec2, offset 8) - * `inTexId` (float, offset 16) - * `inTintEffect` (float, offset 20) - * `inTint` (vec4, offset 24, normalized) - * - * The default shader uniforms for this pipeline are: - * - * `uProjectionMatrix` (mat4) - * `uViewMatrix` (mat4) - * `uModelMatrix` (mat4) - * `uMainSampler` (sampler2D array) - * - * If you wish to create a custom pipeline extending from this one, you can use two string - * declarations in your fragment shader source: `%count%` and `%forloop%`, where `count` is - * used to set the number of `sampler2Ds` available, and `forloop` is a block of GLSL code - * that will get the currently bound texture unit. - * - * This pipeline will automatically inject that code for you, should those values exist - * in your shader source. If you wish to handle this yourself, you can also use the - * function `Utils.parseFragmentShaderMaxTextures`. - * - * If you wish to create a pipeline that works from a single texture, or that doesn't have - * internal texture iteration, please see the `SinglePipeline` instead. - * - * @class MultiPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.50.0 - * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. - */ -var MultiPipeline = new Class({ - - Extends: WebGLPipeline, - - Mixins: [ - ModelViewProjection - ], - - initialize: - - function MultiPipeline (config) - { - var renderer = config.game.renderer; - var gl = renderer.gl; - - var fragmentShaderSource = GetFastValue(config, 'fragShader', ShaderSourceFS); - - // Vertex Size = attribute size added together (2 + 2 + 1 + 1 + 4) inc maxTextures - - config.fragShader = Utils.parseFragmentShaderMaxTextures(fragmentShaderSource, renderer.maxTextures); - config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0, - enabled: false, - location: -1 - }, - { - name: 'inTexCoord', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 8, - enabled: false, - location: -1 - }, - { - name: 'inTexId', - size: 1, - type: gl.FLOAT, - normalized: false, - offset: 16, - enabled: false, - location: -1 - }, - { - name: 'inTintEffect', - size: 1, - type: gl.FLOAT, - normalized: false, - offset: 20, - enabled: false, - location: -1 - }, - { - name: 'inTint', - size: 4, - type: gl.UNSIGNED_BYTE, - normalized: true, - offset: 24, - enabled: false, - location: -1 - } - ]); - - WebGLPipeline.call(this, config); - - /** - * Float32 view of the array buffer containing the pipeline's vertices. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#vertexViewF32 - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertexViewF32 = new Float32Array(this.vertexData); - - /** - * Uint32 view of the array buffer containing the pipeline's vertices. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#vertexViewU32 - * @type {Uint32Array} - * @since 3.0.0 - */ - this.vertexViewU32 = new Uint32Array(this.vertexData); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix1 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix2 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix3 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix4 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix4 = new TransformMatrix(); - - /** - * Used internally to draw stroked triangles. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempTriangle - * @type {array} - * @private - * @since 3.12.0 - */ - this.tempTriangle = [ - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 } - ]; - - /** - * The tint effect to be applied by the shader in the next geometry draw: - * - * 0 = texture multiplied by color - * 1 = solid color + texture alpha - * 2 = solid color, no texture - * 3 = solid texture, no color - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tintEffect - * @type {number} - * @private - * @since 3.12.0 - */ - this.tintEffect = 2; - - /** - * Cached stroke tint. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#strokeTint - * @type {object} - * @private - * @since 3.12.0 - */ - this.strokeTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; - - /** - * Cached fill tint. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#fillTint - * @type {object} - * @private - * @since 3.12.0 - */ - this.fillTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; - - /** - * Internal texture frame reference. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#currentFrame - * @type {Phaser.Textures.Frame} - * @private - * @since 3.12.0 - */ - this.currentFrame = { u0: 0, v0: 0, u1: 1, v1: 1 }; - - /** - * Internal path quad cache. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#firstQuad - * @type {array} - * @private - * @since 3.12.0 - */ - this.firstQuad = [ 0, 0, 0, 0, 0 ]; - - /** - * Internal path quad cache. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#prevQuad - * @type {array} - * @private - * @since 3.12.0 - */ - this.prevQuad = [ 0, 0, 0, 0, 0 ]; - - /** - * Used internally for triangulating a polygon. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#polygonCache - * @type {array} - * @private - * @since 3.12.0 - */ - this.polygonCache = []; - - this.mvpInit(); - }, - - /** - * Called every time the pipeline is bound by the renderer. - * Sets the shader program, vertex buffer and other resources. - * Should only be called when changing pipeline. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#bind - * @since 3.50.0 - * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? - * - * @return {this} This WebGLPipeline instance. - */ - bind: function (reset) - { - if (reset === undefined) { reset = false; } - - WebGLPipeline.prototype.bind.call(this, reset); - - this.renderer.setInt1iv(this.program, 'uMainSampler', this.renderer.textureIndexes); - - return this; - }, - - /** - * Called every time a Game Object needs to use this pipeline. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#onBind - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. - * - * @return {this} This WebGLPipeline instance. - */ - onBind: function () - { - this.mvpUpdate(); - - return this; - }, - - /** - * Resizes this pipeline and updates the projection. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#resize - * @since 3.0.0 - * - * @param {number} width - The new width. - * @param {number} height - The new height. - * @param {number} resolution - The resolution. - * - * @return {this} This WebGLPipeline instance. - */ - resize: function (width, height, resolution) - { - WebGLPipeline.prototype.resize.call(this, width, height, resolution); - - ProjectOrtho(this, 0, this.width, this.height, 0, -1000, 1000); - - return this; - }, - - /** - * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#setTexture2D - * @since 3.1.0 - * - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. - * - * @return {number} The assigned texture unit. - */ - setTexture2D: function (texture) - { - if (texture === undefined) { texture = this.renderer.blankTexture.glTexture; } - - this.currentUnit = this.renderer.setTexture2D(texture); - - return this.currentUnit; - }, - - /** - * Uploads the vertex data and emits a draw call for the current batch of vertices. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#flush - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - flush: function () - { - var gl = this.gl; - var vertexCount = this.vertexCount; - var vertexSize = this.vertexSize; - - if (vertexCount > 0) - { - if (vertexCount === this.vertexCapacity) - { - gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.DYNAMIC_DRAW); - } - else - { - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - } - - gl.drawArrays(this.topology, 0, vertexCount); - - this.vertexCount = 0; - } - - return this; - }, - - /** - * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchSprite - * @since 3.0.0 - * - * @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} sprite - The texture based Game Object to add to the batch. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. - */ - batchSprite: function (sprite, camera, parentTransformMatrix) - { - // Will cause a flush if this isn't the current pipeline, vertexbuffer or program - this.renderer.pipelines.set(this); - - var camMatrix = this._tempMatrix1; - var spriteMatrix = this._tempMatrix2; - var calcMatrix = this._tempMatrix3; - - var frame = sprite.frame; - var texture = frame.glTexture; - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - var frameX = frame.x; - var frameY = frame.y; - var frameWidth = frame.cutWidth; - var frameHeight = frame.cutHeight; - var customPivot = frame.customPivot; - - var displayOriginX = sprite.displayOriginX; - var displayOriginY = sprite.displayOriginY; - - var x = -displayOriginX + frameX; - var y = -displayOriginY + frameY; - - if (sprite.isCropped) - { - var crop = sprite._crop; - - if (crop.flipX !== sprite.flipX || crop.flipY !== sprite.flipY) - { - frame.updateCropUVs(crop, sprite.flipX, sprite.flipY); - } - - u0 = crop.u0; - v0 = crop.v0; - u1 = crop.u1; - v1 = crop.v1; - - frameWidth = crop.width; - frameHeight = crop.height; - - frameX = crop.x; - frameY = crop.y; - - x = -displayOriginX + frameX; - y = -displayOriginY + frameY; - } - - var flipX = 1; - var flipY = 1; - - if (sprite.flipX) - { - if (!customPivot) - { - x += (-frame.realWidth + (displayOriginX * 2)); - } - - flipX = -1; - } - - // Auto-invert the flipY if this is coming from a GLTexture - if (sprite.flipY || (frame.source.isGLTexture && !texture.flipY)) - { - if (!customPivot) - { - y += (-frame.realHeight + (displayOriginY * 2)); - } - - flipY = -1; - } - - spriteMatrix.applyITRS(sprite.x, sprite.y, sprite.rotation, sprite.scaleX * flipX, sprite.scaleY * flipY); - - camMatrix.copyFrom(camera.matrix); - - if (parentTransformMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * sprite.scrollFactorX, -camera.scrollY * sprite.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = sprite.x; - spriteMatrix.f = sprite.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * sprite.scrollFactorX; - spriteMatrix.f -= camera.scrollY * sprite.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - var xw = x + frameWidth; - var yh = y + frameHeight; - - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); - - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); - - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); - - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); - - var tintTL = Utils.getTintAppendFloatAlpha(sprite._tintTL, camera.alpha * sprite._alphaTL); - var tintTR = Utils.getTintAppendFloatAlpha(sprite._tintTR, camera.alpha * sprite._alphaTR); - var tintBL = Utils.getTintAppendFloatAlpha(sprite._tintBL, camera.alpha * sprite._alphaBL); - var tintBR = Utils.getTintAppendFloatAlpha(sprite._tintBR, camera.alpha * sprite._alphaBR); - - if (camera.roundPixels) - { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); - - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); - - tx2 = Math.round(tx2); - ty2 = Math.round(ty2); - - tx3 = Math.round(tx3); - ty3 = Math.round(ty3); - } - - // So batchQuad never assigns a unit to the glTexture, but to the textureSource instead - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } - - var unit = this.setGameObject(sprite); - - var tintEffect = (sprite._isTinted && sprite.tintFill); - - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit); - }, - - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 6 vertices in the following arrangement: - * - * ``` - * 0----3 - * |\ B| - * | \ | - * | \ | - * | A \| - * | \ - * 1----2 - * ``` - * - * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchQuad - * @since 3.12.0 - * - * @param {number} x0 - The top-left x position. - * @param {number} y0 - The top-left y position. - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {number} tintBR - The bottom-right tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) - { - if (unit === undefined) { unit = this.currentUnit; } - - var hasFlushed = false; - - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - - hasFlushed = true; - - unit = this.setTexture2D(texture); - } - - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - - var vertexOffset = (this.vertexCount * this.vertexComponentCount) - 1; - - vertexViewF32[++vertexOffset] = x0; - vertexViewF32[++vertexOffset] = y0; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x1; - vertexViewF32[++vertexOffset] = y1; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBR; - - vertexViewF32[++vertexOffset] = x0; - vertexViewF32[++vertexOffset] = y0; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBR; - - vertexViewF32[++vertexOffset] = x3; - vertexViewF32[++vertexOffset] = y3; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTR; - - this.vertexCount += 6; - - return hasFlushed; - }, - - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 3 vertices in the following arrangement: - * - * ``` - * 0 - * |\ - * | \ - * | \ - * | \ - * | \ - * 1-----2 - * ``` - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTri - * @since 3.12.0 - * - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) - { - if (unit === undefined) { unit = this.currentUnit; } - - var hasFlushed = false; - - if (this.vertexCount + 3 > this.vertexCapacity) - { - this.flush(); - - hasFlushed = true; - - unit = this.setTexture2D(texture); - } - - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - - var vertexOffset = (this.vertexCount * this.vertexComponentCount) - 1; - - vertexViewF32[++vertexOffset] = x1; - vertexViewF32[++vertexOffset] = y1; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTR; - - vertexViewF32[++vertexOffset] = x3; - vertexViewF32[++vertexOffset] = y3; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBL; - - this.vertexCount += 3; - - return hasFlushed; - }, - - /** - * Generic function for batching a textured quad using argument values instead of a Game Object. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTexture - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject. - * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad. - * @param {integer} textureWidth - Real texture width. - * @param {integer} textureHeight - Real texture height. - * @param {number} srcX - X coordinate of the quad. - * @param {number} srcY - Y coordinate of the quad. - * @param {number} srcWidth - Width of the quad. - * @param {number} srcHeight - Height of the quad. - * @param {number} scaleX - X component of scale. - * @param {number} scaleY - Y component of scale. - * @param {number} rotation - Rotation of the quad. - * @param {boolean} flipX - Indicates if the quad is horizontally flipped. - * @param {boolean} flipY - Indicates if the quad is vertically flipped. - * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll. - * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll. - * @param {number} displayOriginX - Horizontal origin in pixels. - * @param {number} displayOriginY - Vertical origin in pixels. - * @param {number} frameX - X coordinate of the texture frame. - * @param {number} frameY - Y coordinate of the texture frame. - * @param {number} frameWidth - Width of the texture frame. - * @param {number} frameHeight - Height of the texture frame. - * @param {integer} tintTL - Tint for top left. - * @param {integer} tintTR - Tint for top right. - * @param {integer} tintBL - Tint for bottom left. - * @param {integer} tintBR - Tint for bottom right. - * @param {number} tintEffect - The tint effect. - * @param {number} uOffset - Horizontal offset on texture coordinate. - * @param {number} vOffset - Vertical offset on texture coordinate. - * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container. - * @param {boolean} [skipFlip=false] - Skip the renderTexture check. - * @param {number} [textureUnit] - Use the currently bound texture unit? - */ - batchTexture: function ( - gameObject, - texture, - textureWidth, textureHeight, - srcX, srcY, - srcWidth, srcHeight, - scaleX, scaleY, - rotation, - flipX, flipY, - scrollFactorX, scrollFactorY, - displayOriginX, displayOriginY, - frameX, frameY, frameWidth, frameHeight, - tintTL, tintTR, tintBL, tintBR, tintEffect, - uOffset, vOffset, - camera, - parentTransformMatrix, - skipFlip, - textureUnit) - { - var renderer = this.renderer; - - renderer.pipelines.set(this, gameObject); - - var camMatrix = this._tempMatrix1; - var spriteMatrix = this._tempMatrix2; - var calcMatrix = this._tempMatrix3; - - var u0 = (frameX / textureWidth) + uOffset; - var v0 = (frameY / textureHeight) + vOffset; - var u1 = (frameX + frameWidth) / textureWidth + uOffset; - var v1 = (frameY + frameHeight) / textureHeight + vOffset; - - var width = srcWidth; - var height = srcHeight; - - var x = -displayOriginX; - var y = -displayOriginY; - - if (gameObject.isCropped) - { - var crop = gameObject._crop; - - width = crop.width; - height = crop.height; - - srcWidth = crop.width; - srcHeight = crop.height; - - frameX = crop.x; - frameY = crop.y; - - var ox = frameX; - var oy = frameY; - - if (flipX) - { - ox = (frameWidth - crop.x - crop.width); - } - - if (flipY && !texture.isRenderTexture) - { - oy = (frameHeight - crop.y - crop.height); - } - - u0 = (ox / textureWidth) + uOffset; - v0 = (oy / textureHeight) + vOffset; - u1 = (ox + crop.width) / textureWidth + uOffset; - v1 = (oy + crop.height) / textureHeight + vOffset; - - x = -displayOriginX + frameX; - y = -displayOriginY + frameY; - } - - // Invert the flipY if this is a RenderTexture - flipY = flipY ^ (!skipFlip && texture.isRenderTexture ? 1 : 0); - - if (flipX) - { - width *= -1; - x += srcWidth; - } - - if (flipY) - { - height *= -1; - y += srcHeight; - } - - var xw = x + width; - var yh = y + height; - - spriteMatrix.applyITRS(srcX, srcY, rotation, scaleX, scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentTransformMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = srcX; - spriteMatrix.f = srcY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * scrollFactorX; - spriteMatrix.f -= camera.scrollY * scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); - - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); - - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); - - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); - - if (camera.roundPixels) - { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); - - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); - - tx2 = Math.round(tx2); - ty2 = Math.round(ty2); - - tx3 = Math.round(tx3); - ty3 = Math.round(ty3); - } - - if (textureUnit === undefined) - { - textureUnit = this.renderer.setTexture2D(texture); - } - - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); - }, - - /** - * Adds a Texture Frame into the batch for rendering. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTextureFrame - * @since 3.12.0 - * - * @param {Phaser.Textures.Frame} frame - The Texture Frame to be rendered. - * @param {number} x - The horizontal position to render the texture at. - * @param {number} y - The vertical position to render the texture at. - * @param {number} tint - The tint color. - * @param {number} alpha - The alpha value. - * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - The Transform Matrix to use for the texture. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - A parent Transform Matrix. - */ - batchTextureFrame: function ( - frame, - x, y, - tint, alpha, - transformMatrix, - parentTransformMatrix - ) - { - this.renderer.pipelines.set(this); - - var spriteMatrix = this._tempMatrix1.copyFrom(transformMatrix); - var calcMatrix = this._tempMatrix2; - - var xw = x + frame.width; - var yh = y + frame.height; - - if (parentTransformMatrix) - { - spriteMatrix.multiply(parentTransformMatrix, calcMatrix); - } - else - { - calcMatrix = spriteMatrix; - } - - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); - - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); - - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); - - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); - - // this.setTexture2D(frame.glTexture, 0); - var unit = this.renderer.setTextureSource(frame.source); - - tint = Utils.getTintAppendFloatAlpha(tint, alpha); - - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0, frame.glTexture, unit); - }, - - /** - * Pushes a filled rectangle into the vertex batch. - * - * The dimensions are run through `Math.floor` before the quad is generated. - * - * Rectangle has no transform values and isn't transformed into the local space. - * - * Used for directly batching untransformed rectangles, such as Camera background colors. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#drawFillRect - * @since 3.12.0 - * - * @param {number} x - Horizontal top left coordinate of the rectangle. - * @param {number} y - Vertical top left coordinate of the rectangle. - * @param {number} width - Width of the rectangle. - * @param {number} height - Height of the rectangle. - * @param {number} color - Color of the rectangle to draw. - * @param {number} alpha - Alpha value of the rectangle to draw. - */ - drawFillRect: function (x, y, width, height, color, alpha) - { - x = Math.floor(x); - y = Math.floor(y); - - var xw = Math.floor(x + width); - var yh = Math.floor(y + height); - - var blank = this.renderer.blankTexture.glTexture; - - var unit = this.renderer.setTexture2D(blank); - - var tint = Utils.getTintAppendFloatAlphaAndSwap(color, alpha); - - this.batchQuad(x, y, x, yh, xw, yh, xw, y, 0, 0, 1, 1, tint, tint, tint, tint, 2, blank, unit); - }, - - /** - * Pushes a filled rectangle into the vertex batch. - * Rectangle factors in the given transform matrices before adding to the batch. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillRect - * @since 3.12.0 - * - * @param {number} x - Horizontal top left coordinate of the rectangle. - * @param {number} y - Vertical top left coordinate of the rectangle. - * @param {number} width - Width of the rectangle. - * @param {number} height - Height of the rectangle. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchFillRect: function (x, y, width, height, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - var calcMatrix = this._tempMatrix3; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var xw = x + width; - var yh = y + height; - - var x0 = calcMatrix.getX(x, y); - var y0 = calcMatrix.getY(x, y); - - var x1 = calcMatrix.getX(x, yh); - var y1 = calcMatrix.getY(x, yh); - - var x2 = calcMatrix.getX(xw, yh); - var y2 = calcMatrix.getY(xw, yh); - - var x3 = calcMatrix.getX(xw, y); - var y3 = calcMatrix.getY(xw, y); - - var frame = this.currentFrame; - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - - var tint = this.fillTint; - - this.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tint.TL, tint.TR, tint.BL, tint.BR, this.tintEffect); - }, - - /** - * Pushes a filled triangle into the vertex batch. - * Triangle factors in the given transform matrices before adding to the batch. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillTriangle - * @since 3.12.0 - * - * @param {number} x0 - Point 0 x coordinate. - * @param {number} y0 - Point 0 y coordinate. - * @param {number} x1 - Point 1 x coordinate. - * @param {number} y1 - Point 1 y coordinate. - * @param {number} x2 - Point 2 x coordinate. - * @param {number} y2 - Point 2 y coordinate. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchFillTriangle: function (x0, y0, x1, y1, x2, y2, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - var calcMatrix = this._tempMatrix3; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var tx0 = calcMatrix.getX(x0, y0); - var ty0 = calcMatrix.getY(x0, y0); - - var tx1 = calcMatrix.getX(x1, y1); - var ty1 = calcMatrix.getY(x1, y1); - - var tx2 = calcMatrix.getX(x2, y2); - var ty2 = calcMatrix.getY(x2, y2); - - var frame = this.currentFrame; - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - - this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, u0, v0, u1, v1, this.fillTint.TL, this.fillTint.TR, this.fillTint.BL, this.tintEffect); - }, - - /** - * Pushes a stroked triangle into the vertex batch. - * Triangle factors in the given transform matrices before adding to the batch. - * The triangle is created from 3 lines and drawn using the `batchStrokePath` method. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchStrokeTriangle - * @since 3.12.0 - * - * @param {number} x0 - Point 0 x coordinate. - * @param {number} y0 - Point 0 y coordinate. - * @param {number} x1 - Point 1 x coordinate. - * @param {number} y1 - Point 1 y coordinate. - * @param {number} x2 - Point 2 x coordinate. - * @param {number} y2 - Point 2 y coordinate. - * @param {number} lineWidth - The width of the line in pixels. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchStrokeTriangle: function (x0, y0, x1, y1, x2, y2, lineWidth, currentMatrix, parentMatrix) - { - var tempTriangle = this.tempTriangle; - - tempTriangle[0].x = x0; - tempTriangle[0].y = y0; - tempTriangle[0].width = lineWidth; - - tempTriangle[1].x = x1; - tempTriangle[1].y = y1; - tempTriangle[1].width = lineWidth; - - tempTriangle[2].x = x2; - tempTriangle[2].y = y2; - tempTriangle[2].width = lineWidth; - - tempTriangle[3].x = x0; - tempTriangle[3].y = y0; - tempTriangle[3].width = lineWidth; - - this.batchStrokePath(tempTriangle, lineWidth, false, currentMatrix, parentMatrix); - }, - - /** - * Adds the given path to the vertex batch for rendering. - * - * It works by taking the array of path data and then passing it through Earcut, which - * creates a list of polygons. Each polygon is then added to the batch. - * - * The path is always automatically closed because it's filled. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillPath - * @since 3.12.0 - * - * @param {array} path - Collection of points that represent the path. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchFillPath: function (path, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - var calcMatrix = this._tempMatrix3; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var length = path.length; - var polygonCache = this.polygonCache; - var polygonIndexArray; - var point; - - var tintTL = this.fillTint.TL; - var tintTR = this.fillTint.TR; - var tintBL = this.fillTint.BL; - var tintEffect = this.tintEffect; - - for (var pathIndex = 0; pathIndex < length; ++pathIndex) - { - point = path[pathIndex]; - polygonCache.push(point.x, point.y); - } - - polygonIndexArray = Earcut(polygonCache); - length = polygonIndexArray.length; - - var frame = this.currentFrame; - - for (var index = 0; index < length; index += 3) - { - var p0 = polygonIndexArray[index + 0] * 2; - var p1 = polygonIndexArray[index + 1] * 2; - var p2 = polygonIndexArray[index + 2] * 2; - - var x0 = polygonCache[p0 + 0]; - var y0 = polygonCache[p0 + 1]; - var x1 = polygonCache[p1 + 0]; - var y1 = polygonCache[p1 + 1]; - var x2 = polygonCache[p2 + 0]; - var y2 = polygonCache[p2 + 1]; - - var tx0 = calcMatrix.getX(x0, y0); - var ty0 = calcMatrix.getY(x0, y0); - - var tx1 = calcMatrix.getX(x1, y1); - var ty1 = calcMatrix.getY(x1, y1); - - var tx2 = calcMatrix.getX(x2, y2); - var ty2 = calcMatrix.getY(x2, y2); - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - - this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect); - } - - polygonCache.length = 0; - }, - - /** - * Adds the given path to the vertex batch for rendering. - * - * It works by taking the array of path data and calling `batchLine` for each section - * of the path. - * - * The path is optionally closed at the end. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchStrokePath - * @since 3.12.0 - * - * @param {array} path - Collection of points that represent the path. - * @param {number} lineWidth - The width of the line segments in pixels. - * @param {boolean} pathOpen - Indicates if the path should be closed or left open. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchStrokePath: function (path, lineWidth, pathOpen, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - // Reset the closePath booleans - this.prevQuad[4] = 0; - this.firstQuad[4] = 0; - - var pathLength = path.length - 1; - - for (var pathIndex = 0; pathIndex < pathLength; pathIndex++) - { - var point0 = path[pathIndex]; - var point1 = path[pathIndex + 1]; - - this.batchLine( - point0.x, - point0.y, - point1.x, - point1.y, - point0.width / 2, - point1.width / 2, - lineWidth, - pathIndex, - !pathOpen && (pathIndex === pathLength - 1), - currentMatrix, - parentMatrix - ); - } - }, - - /** - * Creates a line out of 4 quads and adds it to the vertex batch based on the given line values. - * Assumes a texture has already been set, prior to calling this function. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchLine - * @since 3.12.0 - * - * @param {number} ax - X coordinate to the start of the line - * @param {number} ay - Y coordinate to the start of the line - * @param {number} bx - X coordinate to the end of the line - * @param {number} by - Y coordinate to the end of the line - * @param {number} aLineWidth - Width of the start of the line - * @param {number} bLineWidth - Width of the end of the line - * @param {Float32Array} currentMatrix - Parent matrix, generally used by containers - */ - batchLine: function (ax, ay, bx, by, aLineWidth, bLineWidth, lineWidth, index, closePath, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - var calcMatrix = this._tempMatrix3; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var dx = bx - ax; - var dy = by - ay; - - var len = Math.sqrt(dx * dx + dy * dy); - var al0 = aLineWidth * (by - ay) / len; - var al1 = aLineWidth * (ax - bx) / len; - var bl0 = bLineWidth * (by - ay) / len; - var bl1 = bLineWidth * (ax - bx) / len; - - var lx0 = bx - bl0; - var ly0 = by - bl1; - var lx1 = ax - al0; - var ly1 = ay - al1; - var lx2 = bx + bl0; - var ly2 = by + bl1; - var lx3 = ax + al0; - var ly3 = ay + al1; - - // tx0 = bottom right - var brX = calcMatrix.getX(lx0, ly0); - var brY = calcMatrix.getY(lx0, ly0); - - // tx1 = bottom left - var blX = calcMatrix.getX(lx1, ly1); - var blY = calcMatrix.getY(lx1, ly1); - - // tx2 = top right - var trX = calcMatrix.getX(lx2, ly2); - var trY = calcMatrix.getY(lx2, ly2); - - // tx3 = top left - var tlX = calcMatrix.getX(lx3, ly3); - var tlY = calcMatrix.getY(lx3, ly3); - - var tint = this.strokeTint; - var tintEffect = this.tintEffect; - - var tintTL = tint.TL; - var tintTR = tint.TR; - var tintBL = tint.BL; - var tintBR = tint.BR; - - var frame = this.currentFrame; - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - - // TL, BL, BR, TR - this.batchQuad(tlX, tlY, blX, blY, brX, brY, trX, trY, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); - - if (lineWidth <= 2) - { - // No point doing a linejoin if the line isn't thick enough - return; - } - - var prev = this.prevQuad; - var first = this.firstQuad; - - if (index > 0 && prev[4]) - { - this.batchQuad(tlX, tlY, blX, blY, prev[0], prev[1], prev[2], prev[3], u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); - } - else - { - first[0] = tlX; - first[1] = tlY; - first[2] = blX; - first[3] = blY; - first[4] = 1; - } - - if (closePath && first[4]) - { - // Add a join for the final path segment - this.batchQuad(brX, brY, trX, trY, first[0], first[1], first[2], first[3], u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); - } - else - { - // Store it - - prev[0] = brX; - prev[1] = brY; - prev[2] = trX; - prev[3] = trY; - prev[4] = 1; - } - } - -}); - -module.exports = MultiPipeline; - - -/***/ }), -/* 113 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Implements a model view projection matrices. - * Pipelines can implement this for doing 2D and 3D rendering. - * - * @namespace Phaser.Renderer.WebGL.Pipelines.ModelViewProjection - * @since 3.0.0 - */ -var ModelViewProjection = { - - /** - * Dirty flag for checking if model matrix needs to be updated on GPU. - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelMatrixDirty - * @type {boolean} - * @since 3.0.0 - */ - modelMatrixDirty: false, - - /** - * Dirty flag for checking if view matrix needs to be updated on GPU. - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewMatrixDirty - * @type {boolean} - * @since 3.0.0 - */ - viewMatrixDirty: false, - - /** - * Dirty flag for checking if projection matrix needs to be updated on GPU. - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#projectionMatrixDirty - * @type {boolean} - * @since 3.0.0 - */ - projectionMatrixDirty: false, - - /** - * Model matrix - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelMatrix - * @type {?Float32Array} - * @since 3.0.0 - */ - modelMatrix: null, - - /** - * View matrix - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewMatrix - * @type {?Float32Array} - * @since 3.0.0 - */ - viewMatrix: null, - - /** - * Projection matrix - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#projectionMatrix - * @type {?Float32Array} - * @since 3.0.0 - */ - projectionMatrix: null, - - /** - * Initializes MVP matrices with an identity matrix - * - * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#mvpInit - * @since 3.0.0 - */ - mvpInit: function () - { - this.modelMatrixDirty = true; - this.viewMatrixDirty = true; - this.projectionMatrixDirty = true; - - this.modelMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - this.viewMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - this.projectionMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - return this; - }, - - /** - * If dirty flags are set then the matrices are uploaded to the GPU. - * - * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#mvpUpdate - * @since 3.0.0 - */ - mvpUpdate: function () - { - var program = this.program; - - if (this.modelMatrixDirty) - { - this.renderer.setMatrix4(program, 'uModelMatrix', false, this.modelMatrix); - this.modelMatrixDirty = false; - } - - if (this.viewMatrixDirty) - { - this.renderer.setMatrix4(program, 'uViewMatrix', false, this.viewMatrix); - this.viewMatrixDirty = false; - } - - if (this.projectionMatrixDirty) - { - this.renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); - this.projectionMatrixDirty = false; - } - - return this; - } -}; - -module.exports = ModelViewProjection; - - -/***/ }), -/* 114 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -25004,7 +29723,7 @@ module.exports = ModelViewProjection; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var ImageRender = __webpack_require__(994); +var ImageRender = __webpack_require__(1051); /** * @classdesc @@ -25040,7 +29759,7 @@ var ImageRender = __webpack_require__(994); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ var Image = new Class({ @@ -25093,7 +29812,7 @@ module.exports = Image; /***/ }), -/* 115 */ +/* 123 */ /***/ (function(module, exports) { /** @@ -25122,8 +29841,8 @@ module.exports = HasValue; /***/ }), -/* 116 */, -/* 117 */ +/* 124 */, +/* 125 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -25132,14 +29851,14 @@ module.exports = HasValue; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(54); -var Circle = __webpack_require__(68); -var CircleContains = __webpack_require__(57); +var BlendModes = __webpack_require__(48); +var Circle = __webpack_require__(71); +var CircleContains = __webpack_require__(62); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(50); +var RectangleContains = __webpack_require__(56); /** * @classdesc @@ -25222,7 +29941,7 @@ var Zone = new Class({ * display lists without causing a batch flush. * * @name Phaser.GameObjects.Zone#blendMode - * @type {integer} + * @type {number} * @since 3.0.0 */ this.blendMode = BlendModes.NORMAL; @@ -25436,7 +30155,7 @@ module.exports = Zone; /***/ }), -/* 118 */ +/* 126 */ /***/ (function(module, exports) { /** @@ -25464,743 +30183,7 @@ module.exports = Perimeter; /***/ }), -/* 119 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Given a hex color value, such as 0xff00ff (for purple), it will return a - * numeric representation of it (i.e. 16711935) for use in WebGL tinting. - * - * @function Phaser.Display.Color.GetColorFromValue - * @since 3.50.0 - * - * @param {number} red - The hex color value, such as 0xff0000. - * - * @return {number} The combined color value. - */ -var GetColorFromValue = function (value) -{ - return (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); -}; - -module.exports = GetColorFromValue; - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Events = __webpack_require__(293); - -/** - * @callback DataEachCallback - * - * @param {*} parent - The parent object of the DataManager. - * @param {string} key - The key of the value. - * @param {*} value - The value. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. - */ - -/** - * @classdesc - * The Data Manager Component features a means to store pieces of data specific to a Game Object, System or Plugin. - * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, - * or have a property called `events` that is an instance of it. - * - * @class DataManager - * @memberof Phaser.Data - * @constructor - * @since 3.0.0 - * - * @param {object} parent - The object that this DataManager belongs to. - * @param {Phaser.Events.EventEmitter} [eventEmitter] - The DataManager's event emitter. - */ -var DataManager = new Class({ - - initialize: - - function DataManager (parent, eventEmitter) - { - /** - * The object that this DataManager belongs to. - * - * @name Phaser.Data.DataManager#parent - * @type {*} - * @since 3.0.0 - */ - this.parent = parent; - - /** - * The DataManager's event emitter. - * - * @name Phaser.Data.DataManager#events - * @type {Phaser.Events.EventEmitter} - * @since 3.0.0 - */ - this.events = eventEmitter; - - if (!eventEmitter) - { - this.events = (parent.events) ? parent.events : parent; - } - - /** - * The data list. - * - * @name Phaser.Data.DataManager#list - * @type {Object.} - * @default {} - * @since 3.0.0 - */ - this.list = {}; - - /** - * The public values list. You can use this to access anything you have stored - * in this Data Manager. For example, if you set a value called `gold` you can - * access it via: - * - * ```javascript - * this.data.values.gold; - * ``` - * - * You can also modify it directly: - * - * ```javascript - * this.data.values.gold += 1000; - * ``` - * - * Doing so will emit a `setdata` event from the parent of this Data Manager. - * - * Do not modify this object directly. Adding properties directly to this object will not - * emit any events. Always use `DataManager.set` to create new items the first time around. - * - * @name Phaser.Data.DataManager#values - * @type {Object.} - * @default {} - * @since 3.10.0 - */ - this.values = {}; - - /** - * Whether setting data is frozen for this DataManager. - * - * @name Phaser.Data.DataManager#_frozen - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this._frozen = false; - - if (!parent.hasOwnProperty('sys') && this.events) - { - this.events.once('destroy', this.destroy, this); - } - }, - - /** - * Retrieves the value for the given key, or undefined if it doesn't exist. - * - * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: - * - * ```javascript - * this.data.get('gold'); - * ``` - * - * Or access the value directly: - * - * ```javascript - * this.data.values.gold; - * ``` - * - * You can also pass in an array of keys, in which case an array of values will be returned: - * - * ```javascript - * this.data.get([ 'gold', 'armor', 'health' ]); - * ``` - * - * This approach is useful for destructuring arrays in ES6. - * - * @method Phaser.Data.DataManager#get - * @since 3.0.0 - * - * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. - * - * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. - */ - get: function (key) - { - var list = this.list; - - if (Array.isArray(key)) - { - var output = []; - - for (var i = 0; i < key.length; i++) - { - output.push(list[key[i]]); - } - - return output; - } - else - { - return list[key]; - } - }, - - /** - * Retrieves all data values in a new object. - * - * @method Phaser.Data.DataManager#getAll - * @since 3.0.0 - * - * @return {Object.} All data values. - */ - getAll: function () - { - var results = {}; - - for (var key in this.list) - { - if (this.list.hasOwnProperty(key)) - { - results[key] = this.list[key]; - } - } - - return results; - }, - - /** - * Queries the DataManager for the values of keys matching the given regular expression. - * - * @method Phaser.Data.DataManager#query - * @since 3.0.0 - * - * @param {RegExp} search - A regular expression object. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj). - * - * @return {Object.} The values of the keys matching the search string. - */ - query: function (search) - { - var results = {}; - - for (var key in this.list) - { - if (this.list.hasOwnProperty(key) && key.match(search)) - { - results[key] = this.list[key]; - } - } - - return results; - }, - - /** - * Sets a value for the given key. If the key doesn't already exist in the Data Manager then it is created. - * - * ```javascript - * data.set('name', 'Red Gem Stone'); - * ``` - * - * You can also pass in an object of key value pairs as the first argument: - * - * ```javascript - * data.set({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); - * ``` - * - * To get a value back again you can call `get`: - * - * ```javascript - * data.get('gold'); - * ``` - * - * Or you can access the value directly via the `values` property, where it works like any other variable: - * - * ```javascript - * data.values.gold += 50; - * ``` - * - * When the value is first set, a `setdata` event is emitted. - * - * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. - * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. - * - * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. - * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. - * - * @method Phaser.Data.DataManager#set - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @since 3.0.0 - * - * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. - * @param {*} data - The value to set for the given key. If an object is provided as the key this argument is ignored. - * - * @return {this} This DataManager object. - */ - set: function (key, data) - { - if (this._frozen) - { - return this; - } - - if (typeof key === 'string') - { - return this.setValue(key, data); - } - else - { - for (var entry in key) - { - this.setValue(entry, key[entry]); - } - } - - return this; - }, - - /** - * Increase a value for the given key. If the key doesn't already exist in the Data Manager then it is increased from 0. - * - * When the value is first set, a `setdata` event is emitted. - * - * @method Phaser.Data.DataManager#inc - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @since 3.23.0 - * - * @param {(string|object)} key - The key to increase the value for. - * @param {*} [data] - The value to increase for the given key. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - inc: function (key, data) - { - if (this._frozen) - { - return this; - } - - if (data === undefined) - { - data = 1; - } - - var value = this.get(key); - if (value === undefined) - { - value = 0; - } - - this.set(key, (value + data)); - - return this; - }, - - /** - * Toggle a boolean value for the given key. If the key doesn't already exist in the Data Manager then it is toggled from false. - * - * When the value is first set, a `setdata` event is emitted. - * - * @method Phaser.Data.DataManager#toggle - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @since 3.23.0 - * - * @param {(string|object)} key - The key to toggle the value for. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - toggle: function (key) - { - if (this._frozen) - { - return this; - } - - this.set(key, !this.get(key)); - - return this; - }, - - /** - * Internal value setter, called automatically by the `set` method. - * - * @method Phaser.Data.DataManager#setValue - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @private - * @since 3.10.0 - * - * @param {string} key - The key to set the value for. - * @param {*} data - The value to set. - * - * @return {this} This DataManager object. - */ - setValue: function (key, data) - { - if (this._frozen) - { - return this; - } - - if (this.has(key)) - { - // Hit the key getter, which will in turn emit the events. - this.values[key] = data; - } - else - { - var _this = this; - var list = this.list; - var events = this.events; - var parent = this.parent; - - Object.defineProperty(this.values, key, { - - enumerable: true, - - configurable: true, - - get: function () - { - return list[key]; - }, - - set: function (value) - { - if (!_this._frozen) - { - var previousValue = list[key]; - list[key] = value; - - events.emit(Events.CHANGE_DATA, parent, key, value, previousValue); - events.emit(Events.CHANGE_DATA_KEY + key, parent, value, previousValue); - } - } - - }); - - list[key] = data; - - events.emit(Events.SET_DATA, parent, key, data); - } - - return this; - }, - - /** - * Passes all data entries to the given callback. - * - * @method Phaser.Data.DataManager#each - * @since 3.0.0 - * - * @param {DataEachCallback} callback - The function to call. - * @param {*} [context] - Value to use as `this` when executing callback. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. - * - * @return {this} This DataManager object. - */ - each: function (callback, context) - { - var args = [ this.parent, null, undefined ]; - - for (var i = 1; i < arguments.length; i++) - { - args.push(arguments[i]); - } - - for (var key in this.list) - { - args[1] = key; - args[2] = this.list[key]; - - callback.apply(context, args); - } - - return this; - }, - - /** - * Merge the given object of key value pairs into this DataManager. - * - * Any newly created values will emit a `setdata` event. Any updated values (see the `overwrite` argument) - * will emit a `changedata` event. - * - * @method Phaser.Data.DataManager#merge - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @since 3.0.0 - * - * @param {Object.} data - The data to merge. - * @param {boolean} [overwrite=true] - Whether to overwrite existing data. Defaults to true. - * - * @return {this} This DataManager object. - */ - merge: function (data, overwrite) - { - if (overwrite === undefined) { overwrite = true; } - - // Merge data from another component into this one - for (var key in data) - { - if (data.hasOwnProperty(key) && (overwrite || (!overwrite && !this.has(key)))) - { - this.setValue(key, data[key]); - } - } - - return this; - }, - - /** - * Remove the value for the given key. - * - * If the key is found in this Data Manager it is removed from the internal lists and a - * `removedata` event is emitted. - * - * You can also pass in an array of keys, in which case all keys in the array will be removed: - * - * ```javascript - * this.data.remove([ 'gold', 'armor', 'health' ]); - * ``` - * - * @method Phaser.Data.DataManager#remove - * @fires Phaser.Data.Events#REMOVE_DATA - * @since 3.0.0 - * - * @param {(string|string[])} key - The key to remove, or an array of keys to remove. - * - * @return {this} This DataManager object. - */ - remove: function (key) - { - if (this._frozen) - { - return this; - } - - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - this.removeValue(key[i]); - } - } - else - { - return this.removeValue(key); - } - - return this; - }, - - /** - * Internal value remover, called automatically by the `remove` method. - * - * @method Phaser.Data.DataManager#removeValue - * @private - * @fires Phaser.Data.Events#REMOVE_DATA - * @since 3.10.0 - * - * @param {string} key - The key to set the value for. - * - * @return {this} This DataManager object. - */ - removeValue: function (key) - { - if (this.has(key)) - { - var data = this.list[key]; - - delete this.list[key]; - delete this.values[key]; - - this.events.emit(Events.REMOVE_DATA, this.parent, key, data); - } - - return this; - }, - - /** - * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it. - * - * @method Phaser.Data.DataManager#pop - * @fires Phaser.Data.Events#REMOVE_DATA - * @since 3.0.0 - * - * @param {string} key - The key of the value to retrieve and delete. - * - * @return {*} The value of the given key. - */ - pop: function (key) - { - var data = undefined; - - if (!this._frozen && this.has(key)) - { - data = this.list[key]; - - delete this.list[key]; - delete this.values[key]; - - this.events.emit(Events.REMOVE_DATA, this.parent, key, data); - } - - return data; - }, - - /** - * Determines whether the given key is set in this Data Manager. - * - * Please note that the keys are case-sensitive and must be valid JavaScript Object property strings. - * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. - * - * @method Phaser.Data.DataManager#has - * @since 3.0.0 - * - * @param {string} key - The key to check. - * - * @return {boolean} Returns `true` if the key exists, otherwise `false`. - */ - has: function (key) - { - return this.list.hasOwnProperty(key); - }, - - /** - * Freeze or unfreeze this Data Manager. A frozen Data Manager will block all attempts - * to create new values or update existing ones. - * - * @method Phaser.Data.DataManager#setFreeze - * @since 3.0.0 - * - * @param {boolean} value - Whether to freeze or unfreeze the Data Manager. - * - * @return {this} This DataManager object. - */ - setFreeze: function (value) - { - this._frozen = value; - - return this; - }, - - /** - * Delete all data in this Data Manager and unfreeze it. - * - * @method Phaser.Data.DataManager#reset - * @since 3.0.0 - * - * @return {this} This DataManager object. - */ - reset: function () - { - for (var key in this.list) - { - delete this.list[key]; - delete this.values[key]; - } - - this._frozen = false; - - return this; - }, - - /** - * Destroy this data manager. - * - * @method Phaser.Data.DataManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.reset(); - - this.events.off(Events.CHANGE_DATA); - this.events.off(Events.SET_DATA); - this.events.off(Events.REMOVE_DATA); - - this.parent = null; - }, - - /** - * Gets or sets the frozen state of this Data Manager. - * A frozen Data Manager will block all attempts to create new values or update existing ones. - * - * @name Phaser.Data.DataManager#freeze - * @type {boolean} - * @since 3.0.0 - */ - freeze: { - - get: function () - { - return this._frozen; - }, - - set: function (value) - { - this._frozen = (value) ? true : false; - } - - }, - - /** - * Return the total number of entries in this Data Manager. - * - * @name Phaser.Data.DataManager#count - * @type {integer} - * @since 3.0.0 - */ - count: { - - get: function () - { - var i = 0; - - for (var key in this.list) - { - if (this.list[key] !== undefined) - { - i++; - } - } - - return i; - } - - } - -}); - -module.exports = DataManager; - - -/***/ }), -/* 121 */ +/* 127 */ /***/ (function(module, exports) { /** @@ -26241,7 +30224,7 @@ module.exports = Shuffle; /***/ }), -/* 122 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -26256,23 +30239,23 @@ module.exports = Shuffle; module.exports = { - ADD_ANIMATION: __webpack_require__(652), - ANIMATION_COMPLETE: __webpack_require__(653), - ANIMATION_COMPLETE_KEY: __webpack_require__(654), - ANIMATION_REPEAT: __webpack_require__(655), - ANIMATION_RESTART: __webpack_require__(656), - ANIMATION_START: __webpack_require__(657), - ANIMATION_STOP: __webpack_require__(658), - ANIMATION_UPDATE: __webpack_require__(659), - PAUSE_ALL: __webpack_require__(660), - REMOVE_ANIMATION: __webpack_require__(661), - RESUME_ALL: __webpack_require__(662) + ADD_ANIMATION: __webpack_require__(692), + ANIMATION_COMPLETE: __webpack_require__(693), + ANIMATION_COMPLETE_KEY: __webpack_require__(694), + ANIMATION_REPEAT: __webpack_require__(695), + ANIMATION_RESTART: __webpack_require__(696), + ANIMATION_START: __webpack_require__(697), + ANIMATION_STOP: __webpack_require__(698), + ANIMATION_UPDATE: __webpack_require__(699), + PAUSE_ALL: __webpack_require__(700), + REMOVE_ANIMATION: __webpack_require__(701), + RESUME_ALL: __webpack_require__(702) }; /***/ }), -/* 123 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -26281,18 +30264,18 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Back = __webpack_require__(315); -var Bounce = __webpack_require__(316); -var Circular = __webpack_require__(317); -var Cubic = __webpack_require__(318); -var Elastic = __webpack_require__(319); -var Expo = __webpack_require__(320); -var Linear = __webpack_require__(321); -var Quadratic = __webpack_require__(322); -var Quartic = __webpack_require__(323); -var Quintic = __webpack_require__(324); -var Sine = __webpack_require__(325); -var Stepped = __webpack_require__(326); +var Back = __webpack_require__(326); +var Bounce = __webpack_require__(327); +var Circular = __webpack_require__(328); +var Cubic = __webpack_require__(329); +var Elastic = __webpack_require__(330); +var Expo = __webpack_require__(331); +var Linear = __webpack_require__(332); +var Quadratic = __webpack_require__(333); +var Quartic = __webpack_require__(334); +var Quintic = __webpack_require__(335); +var Sine = __webpack_require__(336); +var Stepped = __webpack_require__(337); // EaseMap module.exports = { @@ -26353,7 +30336,7 @@ module.exports = { /***/ }), -/* 124 */ +/* 130 */ /***/ (function(module, exports) { /** @@ -26383,179 +30366,7 @@ module.exports = Linear; /***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(process) {/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Determines the operating system of the device running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.os` from within any Scene. - * - * @typedef {object} Phaser.Device.OS - * @since 3.0.0 - * - * @property {boolean} android - Is running on android? - * @property {boolean} chromeOS - Is running on chromeOS? - * @property {boolean} cordova - Is the game running under Apache Cordova? - * @property {boolean} crosswalk - Is the game running under the Intel Crosswalk XDK? - * @property {boolean} desktop - Is running on a desktop? - * @property {boolean} ejecta - Is the game running under Ejecta? - * @property {boolean} electron - Is the game running under GitHub Electron? - * @property {boolean} iOS - Is running on iOS? - * @property {boolean} iPad - Is running on iPad? - * @property {boolean} iPhone - Is running on iPhone? - * @property {boolean} kindle - Is running on an Amazon Kindle? - * @property {boolean} linux - Is running on linux? - * @property {boolean} macOS - Is running on macOS? - * @property {boolean} node - Is the game running under Node.js? - * @property {boolean} nodeWebkit - Is the game running under Node-Webkit? - * @property {boolean} webApp - Set to true if running as a WebApp, i.e. within a WebView - * @property {boolean} windows - Is running on windows? - * @property {boolean} windowsPhone - Is running on a Windows Phone? - * @property {number} iOSVersion - If running in iOS this will contain the major version number. - * @property {number} pixelRatio - PixelRatio of the host device? - */ -var OS = { - - android: false, - chromeOS: false, - cordova: false, - crosswalk: false, - desktop: false, - ejecta: false, - electron: false, - iOS: false, - iOSVersion: 0, - iPad: false, - iPhone: false, - kindle: false, - linux: false, - macOS: false, - node: false, - nodeWebkit: false, - pixelRatio: 1, - webApp: false, - windows: false, - windowsPhone: false - -}; - -function init () -{ - var ua = navigator.userAgent; - - if ((/Windows/).test(ua)) - { - OS.windows = true; - } - else if ((/Mac OS/).test(ua) && !((/like Mac OS/).test(ua))) - { - OS.macOS = true; - } - else if ((/Android/).test(ua)) - { - OS.android = true; - } - else if ((/Linux/).test(ua)) - { - OS.linux = true; - } - else if ((/iP[ao]d|iPhone/i).test(ua)) - { - OS.iOS = true; - - (navigator.appVersion).match(/OS (\d+)/); - - OS.iOSVersion = parseInt(RegExp.$1, 10); - - OS.iPhone = ua.toLowerCase().indexOf('iphone') !== -1; - OS.iPad = ua.toLowerCase().indexOf('ipad') !== -1; - } - else if ((/Kindle/).test(ua) || (/\bKF[A-Z][A-Z]+/).test(ua) || (/Silk.*Mobile Safari/).test(ua)) - { - OS.kindle = true; - - // This will NOT detect early generations of Kindle Fire, I think there is no reliable way... - // E.g. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" - } - else if ((/CrOS/).test(ua)) - { - OS.chromeOS = true; - } - - if ((/Windows Phone/i).test(ua) || (/IEMobile/i).test(ua)) - { - OS.android = false; - OS.iOS = false; - OS.macOS = false; - OS.windows = true; - OS.windowsPhone = true; - } - - var silk = (/Silk/).test(ua); - - if (OS.windows || OS.macOS || (OS.linux && !silk) || OS.chromeOS) - { - OS.desktop = true; - } - - // Windows Phone / Table reset - if (OS.windowsPhone || (((/Windows NT/i).test(ua)) && ((/Touch/i).test(ua)))) - { - OS.desktop = false; - } - - // WebApp mode in iOS - if (navigator.standalone) - { - OS.webApp = true; - } - - if (window.cordova !== undefined) - { - OS.cordova = true; - } - - if (typeof process !== 'undefined' && process.versions && process.versions.node) - { - OS.node = true; - } - - if (OS.node && typeof process.versions === 'object') - { - OS.nodeWebkit = !!process.versions['node-webkit']; - - OS.electron = !!process.versions.electron; - } - - if (window.ejecta !== undefined) - { - OS.ejecta = true; - } - - if ((/Crosswalk/).test(ua)) - { - OS.crosswalk = true; - } - - OS.pixelRatio = window['devicePixelRatio'] || 1; - - return OS; -} - -module.exports = init(); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(755))) - -/***/ }), -/* 126 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -26564,7 +30375,7 @@ module.exports = init(); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var OS = __webpack_require__(125); +var OS = __webpack_require__(102); /** * Determines the browser type and version running this Phaser Game instance. @@ -26665,7 +30476,7 @@ module.exports = init(); /***/ }), -/* 127 */ +/* 132 */ /***/ (function(module, exports) { /** @@ -26694,7 +30505,7 @@ module.exports = FloatBetween; /***/ }), -/* 128 */ +/* 133 */ /***/ (function(module, exports) { /** @@ -26724,7 +30535,51 @@ module.exports = IsSizePowerOfTwo; /***/ }), -/* 129 */ +/* 134 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using ceil. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. + * As will `14` snap to `15`... but `16` will snap to `20`. + * + * @function Phaser.Math.Snap.Ceil + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapCeil = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.ceil(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapCeil; + + +/***/ }), +/* 135 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -27269,7 +31124,7 @@ module.exports = Vector4; /***/ }), -/* 130 */ +/* 136 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -27284,17 +31139,17 @@ module.exports = Vector4; module.exports = { - ADD: __webpack_require__(814), - ERROR: __webpack_require__(815), - LOAD: __webpack_require__(816), - READY: __webpack_require__(817), - REMOVE: __webpack_require__(818) + ADD: __webpack_require__(869), + ERROR: __webpack_require__(870), + LOAD: __webpack_require__(871), + READY: __webpack_require__(872), + REMOVE: __webpack_require__(873) }; /***/ }), -/* 131 */ +/* 137 */ /***/ (function(module, exports) { /** @@ -27352,7 +31207,7 @@ module.exports = AddToDOM; /***/ }), -/* 132 */ +/* 138 */ /***/ (function(module, exports) { /** @@ -27375,7 +31230,7 @@ var KeyCodes = { * The BACKSPACE key. * * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE - * @type {integer} + * @type {number} * @since 3.0.0 */ BACKSPACE: 8, @@ -27384,7 +31239,7 @@ var KeyCodes = { * The TAB key. * * @name Phaser.Input.Keyboard.KeyCodes.TAB - * @type {integer} + * @type {number} * @since 3.0.0 */ TAB: 9, @@ -27393,7 +31248,7 @@ var KeyCodes = { * The ENTER key. * * @name Phaser.Input.Keyboard.KeyCodes.ENTER - * @type {integer} + * @type {number} * @since 3.0.0 */ ENTER: 13, @@ -27402,7 +31257,7 @@ var KeyCodes = { * The SHIFT key. * * @name Phaser.Input.Keyboard.KeyCodes.SHIFT - * @type {integer} + * @type {number} * @since 3.0.0 */ SHIFT: 16, @@ -27411,7 +31266,7 @@ var KeyCodes = { * The CTRL key. * * @name Phaser.Input.Keyboard.KeyCodes.CTRL - * @type {integer} + * @type {number} * @since 3.0.0 */ CTRL: 17, @@ -27420,7 +31275,7 @@ var KeyCodes = { * The ALT key. * * @name Phaser.Input.Keyboard.KeyCodes.ALT - * @type {integer} + * @type {number} * @since 3.0.0 */ ALT: 18, @@ -27429,7 +31284,7 @@ var KeyCodes = { * The PAUSE key. * * @name Phaser.Input.Keyboard.KeyCodes.PAUSE - * @type {integer} + * @type {number} * @since 3.0.0 */ PAUSE: 19, @@ -27438,7 +31293,7 @@ var KeyCodes = { * The CAPS_LOCK key. * * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK - * @type {integer} + * @type {number} * @since 3.0.0 */ CAPS_LOCK: 20, @@ -27447,7 +31302,7 @@ var KeyCodes = { * The ESC key. * * @name Phaser.Input.Keyboard.KeyCodes.ESC - * @type {integer} + * @type {number} * @since 3.0.0 */ ESC: 27, @@ -27456,7 +31311,7 @@ var KeyCodes = { * The SPACE key. * * @name Phaser.Input.Keyboard.KeyCodes.SPACE - * @type {integer} + * @type {number} * @since 3.0.0 */ SPACE: 32, @@ -27465,7 +31320,7 @@ var KeyCodes = { * The PAGE_UP key. * * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP - * @type {integer} + * @type {number} * @since 3.0.0 */ PAGE_UP: 33, @@ -27474,7 +31329,7 @@ var KeyCodes = { * The PAGE_DOWN key. * * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN - * @type {integer} + * @type {number} * @since 3.0.0 */ PAGE_DOWN: 34, @@ -27483,7 +31338,7 @@ var KeyCodes = { * The END key. * * @name Phaser.Input.Keyboard.KeyCodes.END - * @type {integer} + * @type {number} * @since 3.0.0 */ END: 35, @@ -27492,7 +31347,7 @@ var KeyCodes = { * The HOME key. * * @name Phaser.Input.Keyboard.KeyCodes.HOME - * @type {integer} + * @type {number} * @since 3.0.0 */ HOME: 36, @@ -27501,7 +31356,7 @@ var KeyCodes = { * The LEFT key. * * @name Phaser.Input.Keyboard.KeyCodes.LEFT - * @type {integer} + * @type {number} * @since 3.0.0 */ LEFT: 37, @@ -27510,7 +31365,7 @@ var KeyCodes = { * The UP key. * * @name Phaser.Input.Keyboard.KeyCodes.UP - * @type {integer} + * @type {number} * @since 3.0.0 */ UP: 38, @@ -27519,7 +31374,7 @@ var KeyCodes = { * The RIGHT key. * * @name Phaser.Input.Keyboard.KeyCodes.RIGHT - * @type {integer} + * @type {number} * @since 3.0.0 */ RIGHT: 39, @@ -27528,7 +31383,7 @@ var KeyCodes = { * The DOWN key. * * @name Phaser.Input.Keyboard.KeyCodes.DOWN - * @type {integer} + * @type {number} * @since 3.0.0 */ DOWN: 40, @@ -27537,7 +31392,7 @@ var KeyCodes = { * The PRINT_SCREEN key. * * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN - * @type {integer} + * @type {number} * @since 3.0.0 */ PRINT_SCREEN: 42, @@ -27546,7 +31401,7 @@ var KeyCodes = { * The INSERT key. * * @name Phaser.Input.Keyboard.KeyCodes.INSERT - * @type {integer} + * @type {number} * @since 3.0.0 */ INSERT: 45, @@ -27555,7 +31410,7 @@ var KeyCodes = { * The DELETE key. * * @name Phaser.Input.Keyboard.KeyCodes.DELETE - * @type {integer} + * @type {number} * @since 3.0.0 */ DELETE: 46, @@ -27564,7 +31419,7 @@ var KeyCodes = { * The ZERO key. * * @name Phaser.Input.Keyboard.KeyCodes.ZERO - * @type {integer} + * @type {number} * @since 3.0.0 */ ZERO: 48, @@ -27573,7 +31428,7 @@ var KeyCodes = { * The ONE key. * * @name Phaser.Input.Keyboard.KeyCodes.ONE - * @type {integer} + * @type {number} * @since 3.0.0 */ ONE: 49, @@ -27582,7 +31437,7 @@ var KeyCodes = { * The TWO key. * * @name Phaser.Input.Keyboard.KeyCodes.TWO - * @type {integer} + * @type {number} * @since 3.0.0 */ TWO: 50, @@ -27591,7 +31446,7 @@ var KeyCodes = { * The THREE key. * * @name Phaser.Input.Keyboard.KeyCodes.THREE - * @type {integer} + * @type {number} * @since 3.0.0 */ THREE: 51, @@ -27600,7 +31455,7 @@ var KeyCodes = { * The FOUR key. * * @name Phaser.Input.Keyboard.KeyCodes.FOUR - * @type {integer} + * @type {number} * @since 3.0.0 */ FOUR: 52, @@ -27609,7 +31464,7 @@ var KeyCodes = { * The FIVE key. * * @name Phaser.Input.Keyboard.KeyCodes.FIVE - * @type {integer} + * @type {number} * @since 3.0.0 */ FIVE: 53, @@ -27618,7 +31473,7 @@ var KeyCodes = { * The SIX key. * * @name Phaser.Input.Keyboard.KeyCodes.SIX - * @type {integer} + * @type {number} * @since 3.0.0 */ SIX: 54, @@ -27627,7 +31482,7 @@ var KeyCodes = { * The SEVEN key. * * @name Phaser.Input.Keyboard.KeyCodes.SEVEN - * @type {integer} + * @type {number} * @since 3.0.0 */ SEVEN: 55, @@ -27636,7 +31491,7 @@ var KeyCodes = { * The EIGHT key. * * @name Phaser.Input.Keyboard.KeyCodes.EIGHT - * @type {integer} + * @type {number} * @since 3.0.0 */ EIGHT: 56, @@ -27645,7 +31500,7 @@ var KeyCodes = { * The NINE key. * * @name Phaser.Input.Keyboard.KeyCodes.NINE - * @type {integer} + * @type {number} * @since 3.0.0 */ NINE: 57, @@ -27654,7 +31509,7 @@ var KeyCodes = { * The NUMPAD_ZERO key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ZERO - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_ZERO: 96, @@ -27663,7 +31518,7 @@ var KeyCodes = { * The NUMPAD_ONE key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ONE - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_ONE: 97, @@ -27672,7 +31527,7 @@ var KeyCodes = { * The NUMPAD_TWO key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_TWO - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_TWO: 98, @@ -27681,7 +31536,7 @@ var KeyCodes = { * The NUMPAD_THREE key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_THREE - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_THREE: 99, @@ -27690,7 +31545,7 @@ var KeyCodes = { * The NUMPAD_FOUR key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FOUR - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_FOUR: 100, @@ -27699,7 +31554,7 @@ var KeyCodes = { * The NUMPAD_FIVE key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FIVE - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_FIVE: 101, @@ -27708,7 +31563,7 @@ var KeyCodes = { * The NUMPAD_SIX key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SIX - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_SIX: 102, @@ -27717,7 +31572,7 @@ var KeyCodes = { * The NUMPAD_SEVEN key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SEVEN - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_SEVEN: 103, @@ -27726,7 +31581,7 @@ var KeyCodes = { * The NUMPAD_EIGHT key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_EIGHT - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_EIGHT: 104, @@ -27735,7 +31590,7 @@ var KeyCodes = { * The NUMPAD_NINE key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_NINE - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_NINE: 105, @@ -27744,7 +31599,7 @@ var KeyCodes = { * The Numpad Addition (+) key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ADD - * @type {integer} + * @type {number} * @since 3.21.0 */ NUMPAD_ADD: 107, @@ -27753,7 +31608,7 @@ var KeyCodes = { * The Numpad Subtraction (-) key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SUBTRACT - * @type {integer} + * @type {number} * @since 3.21.0 */ NUMPAD_SUBTRACT: 109, @@ -27762,7 +31617,7 @@ var KeyCodes = { * The A key. * * @name Phaser.Input.Keyboard.KeyCodes.A - * @type {integer} + * @type {number} * @since 3.0.0 */ A: 65, @@ -27771,7 +31626,7 @@ var KeyCodes = { * The B key. * * @name Phaser.Input.Keyboard.KeyCodes.B - * @type {integer} + * @type {number} * @since 3.0.0 */ B: 66, @@ -27780,7 +31635,7 @@ var KeyCodes = { * The C key. * * @name Phaser.Input.Keyboard.KeyCodes.C - * @type {integer} + * @type {number} * @since 3.0.0 */ C: 67, @@ -27789,7 +31644,7 @@ var KeyCodes = { * The D key. * * @name Phaser.Input.Keyboard.KeyCodes.D - * @type {integer} + * @type {number} * @since 3.0.0 */ D: 68, @@ -27798,7 +31653,7 @@ var KeyCodes = { * The E key. * * @name Phaser.Input.Keyboard.KeyCodes.E - * @type {integer} + * @type {number} * @since 3.0.0 */ E: 69, @@ -27807,7 +31662,7 @@ var KeyCodes = { * The F key. * * @name Phaser.Input.Keyboard.KeyCodes.F - * @type {integer} + * @type {number} * @since 3.0.0 */ F: 70, @@ -27816,7 +31671,7 @@ var KeyCodes = { * The G key. * * @name Phaser.Input.Keyboard.KeyCodes.G - * @type {integer} + * @type {number} * @since 3.0.0 */ G: 71, @@ -27825,7 +31680,7 @@ var KeyCodes = { * The H key. * * @name Phaser.Input.Keyboard.KeyCodes.H - * @type {integer} + * @type {number} * @since 3.0.0 */ H: 72, @@ -27834,7 +31689,7 @@ var KeyCodes = { * The I key. * * @name Phaser.Input.Keyboard.KeyCodes.I - * @type {integer} + * @type {number} * @since 3.0.0 */ I: 73, @@ -27843,7 +31698,7 @@ var KeyCodes = { * The J key. * * @name Phaser.Input.Keyboard.KeyCodes.J - * @type {integer} + * @type {number} * @since 3.0.0 */ J: 74, @@ -27852,7 +31707,7 @@ var KeyCodes = { * The K key. * * @name Phaser.Input.Keyboard.KeyCodes.K - * @type {integer} + * @type {number} * @since 3.0.0 */ K: 75, @@ -27861,7 +31716,7 @@ var KeyCodes = { * The L key. * * @name Phaser.Input.Keyboard.KeyCodes.L - * @type {integer} + * @type {number} * @since 3.0.0 */ L: 76, @@ -27870,7 +31725,7 @@ var KeyCodes = { * The M key. * * @name Phaser.Input.Keyboard.KeyCodes.M - * @type {integer} + * @type {number} * @since 3.0.0 */ M: 77, @@ -27879,7 +31734,7 @@ var KeyCodes = { * The N key. * * @name Phaser.Input.Keyboard.KeyCodes.N - * @type {integer} + * @type {number} * @since 3.0.0 */ N: 78, @@ -27888,7 +31743,7 @@ var KeyCodes = { * The O key. * * @name Phaser.Input.Keyboard.KeyCodes.O - * @type {integer} + * @type {number} * @since 3.0.0 */ O: 79, @@ -27897,7 +31752,7 @@ var KeyCodes = { * The P key. * * @name Phaser.Input.Keyboard.KeyCodes.P - * @type {integer} + * @type {number} * @since 3.0.0 */ P: 80, @@ -27906,7 +31761,7 @@ var KeyCodes = { * The Q key. * * @name Phaser.Input.Keyboard.KeyCodes.Q - * @type {integer} + * @type {number} * @since 3.0.0 */ Q: 81, @@ -27915,7 +31770,7 @@ var KeyCodes = { * The R key. * * @name Phaser.Input.Keyboard.KeyCodes.R - * @type {integer} + * @type {number} * @since 3.0.0 */ R: 82, @@ -27924,7 +31779,7 @@ var KeyCodes = { * The S key. * * @name Phaser.Input.Keyboard.KeyCodes.S - * @type {integer} + * @type {number} * @since 3.0.0 */ S: 83, @@ -27933,7 +31788,7 @@ var KeyCodes = { * The T key. * * @name Phaser.Input.Keyboard.KeyCodes.T - * @type {integer} + * @type {number} * @since 3.0.0 */ T: 84, @@ -27942,7 +31797,7 @@ var KeyCodes = { * The U key. * * @name Phaser.Input.Keyboard.KeyCodes.U - * @type {integer} + * @type {number} * @since 3.0.0 */ U: 85, @@ -27951,7 +31806,7 @@ var KeyCodes = { * The V key. * * @name Phaser.Input.Keyboard.KeyCodes.V - * @type {integer} + * @type {number} * @since 3.0.0 */ V: 86, @@ -27960,7 +31815,7 @@ var KeyCodes = { * The W key. * * @name Phaser.Input.Keyboard.KeyCodes.W - * @type {integer} + * @type {number} * @since 3.0.0 */ W: 87, @@ -27969,7 +31824,7 @@ var KeyCodes = { * The X key. * * @name Phaser.Input.Keyboard.KeyCodes.X - * @type {integer} + * @type {number} * @since 3.0.0 */ X: 88, @@ -27978,7 +31833,7 @@ var KeyCodes = { * The Y key. * * @name Phaser.Input.Keyboard.KeyCodes.Y - * @type {integer} + * @type {number} * @since 3.0.0 */ Y: 89, @@ -27987,7 +31842,7 @@ var KeyCodes = { * The Z key. * * @name Phaser.Input.Keyboard.KeyCodes.Z - * @type {integer} + * @type {number} * @since 3.0.0 */ Z: 90, @@ -27996,7 +31851,7 @@ var KeyCodes = { * The F1 key. * * @name Phaser.Input.Keyboard.KeyCodes.F1 - * @type {integer} + * @type {number} * @since 3.0.0 */ F1: 112, @@ -28005,7 +31860,7 @@ var KeyCodes = { * The F2 key. * * @name Phaser.Input.Keyboard.KeyCodes.F2 - * @type {integer} + * @type {number} * @since 3.0.0 */ F2: 113, @@ -28014,7 +31869,7 @@ var KeyCodes = { * The F3 key. * * @name Phaser.Input.Keyboard.KeyCodes.F3 - * @type {integer} + * @type {number} * @since 3.0.0 */ F3: 114, @@ -28023,7 +31878,7 @@ var KeyCodes = { * The F4 key. * * @name Phaser.Input.Keyboard.KeyCodes.F4 - * @type {integer} + * @type {number} * @since 3.0.0 */ F4: 115, @@ -28032,7 +31887,7 @@ var KeyCodes = { * The F5 key. * * @name Phaser.Input.Keyboard.KeyCodes.F5 - * @type {integer} + * @type {number} * @since 3.0.0 */ F5: 116, @@ -28041,7 +31896,7 @@ var KeyCodes = { * The F6 key. * * @name Phaser.Input.Keyboard.KeyCodes.F6 - * @type {integer} + * @type {number} * @since 3.0.0 */ F6: 117, @@ -28050,7 +31905,7 @@ var KeyCodes = { * The F7 key. * * @name Phaser.Input.Keyboard.KeyCodes.F7 - * @type {integer} + * @type {number} * @since 3.0.0 */ F7: 118, @@ -28059,7 +31914,7 @@ var KeyCodes = { * The F8 key. * * @name Phaser.Input.Keyboard.KeyCodes.F8 - * @type {integer} + * @type {number} * @since 3.0.0 */ F8: 119, @@ -28068,7 +31923,7 @@ var KeyCodes = { * The F9 key. * * @name Phaser.Input.Keyboard.KeyCodes.F9 - * @type {integer} + * @type {number} * @since 3.0.0 */ F9: 120, @@ -28077,7 +31932,7 @@ var KeyCodes = { * The F10 key. * * @name Phaser.Input.Keyboard.KeyCodes.F10 - * @type {integer} + * @type {number} * @since 3.0.0 */ F10: 121, @@ -28086,7 +31941,7 @@ var KeyCodes = { * The F11 key. * * @name Phaser.Input.Keyboard.KeyCodes.F11 - * @type {integer} + * @type {number} * @since 3.0.0 */ F11: 122, @@ -28095,7 +31950,7 @@ var KeyCodes = { * The F12 key. * * @name Phaser.Input.Keyboard.KeyCodes.F12 - * @type {integer} + * @type {number} * @since 3.0.0 */ F12: 123, @@ -28104,7 +31959,7 @@ var KeyCodes = { * The SEMICOLON key. * * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON - * @type {integer} + * @type {number} * @since 3.0.0 */ SEMICOLON: 186, @@ -28113,7 +31968,7 @@ var KeyCodes = { * The PLUS key. * * @name Phaser.Input.Keyboard.KeyCodes.PLUS - * @type {integer} + * @type {number} * @since 3.0.0 */ PLUS: 187, @@ -28122,7 +31977,7 @@ var KeyCodes = { * The COMMA key. * * @name Phaser.Input.Keyboard.KeyCodes.COMMA - * @type {integer} + * @type {number} * @since 3.0.0 */ COMMA: 188, @@ -28131,7 +31986,7 @@ var KeyCodes = { * The MINUS key. * * @name Phaser.Input.Keyboard.KeyCodes.MINUS - * @type {integer} + * @type {number} * @since 3.0.0 */ MINUS: 189, @@ -28140,7 +31995,7 @@ var KeyCodes = { * The PERIOD key. * * @name Phaser.Input.Keyboard.KeyCodes.PERIOD - * @type {integer} + * @type {number} * @since 3.0.0 */ PERIOD: 190, @@ -28149,7 +32004,7 @@ var KeyCodes = { * The FORWARD_SLASH key. * * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH - * @type {integer} + * @type {number} * @since 3.0.0 */ FORWARD_SLASH: 191, @@ -28158,7 +32013,7 @@ var KeyCodes = { * The BACK_SLASH key. * * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH - * @type {integer} + * @type {number} * @since 3.0.0 */ BACK_SLASH: 220, @@ -28167,7 +32022,7 @@ var KeyCodes = { * The QUOTES key. * * @name Phaser.Input.Keyboard.KeyCodes.QUOTES - * @type {integer} + * @type {number} * @since 3.0.0 */ QUOTES: 222, @@ -28176,7 +32031,7 @@ var KeyCodes = { * The BACKTICK key. * * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK - * @type {integer} + * @type {number} * @since 3.0.0 */ BACKTICK: 192, @@ -28185,7 +32040,7 @@ var KeyCodes = { * The OPEN_BRACKET key. * * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET - * @type {integer} + * @type {number} * @since 3.0.0 */ OPEN_BRACKET: 219, @@ -28194,7 +32049,7 @@ var KeyCodes = { * The CLOSED_BRACKET key. * * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET - * @type {integer} + * @type {number} * @since 3.0.0 */ CLOSED_BRACKET: 221, @@ -28203,7 +32058,7 @@ var KeyCodes = { * The SEMICOLON_FIREFOX key. * * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON_FIREFOX - * @type {integer} + * @type {number} * @since 3.0.0 */ SEMICOLON_FIREFOX: 59, @@ -28212,7 +32067,7 @@ var KeyCodes = { * The COLON key. * * @name Phaser.Input.Keyboard.KeyCodes.COLON - * @type {integer} + * @type {number} * @since 3.0.0 */ COLON: 58, @@ -28221,7 +32076,7 @@ var KeyCodes = { * The COMMA_FIREFOX_WINDOWS key. * * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX_WINDOWS - * @type {integer} + * @type {number} * @since 3.0.0 */ COMMA_FIREFOX_WINDOWS: 60, @@ -28230,7 +32085,7 @@ var KeyCodes = { * The COMMA_FIREFOX key. * * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX - * @type {integer} + * @type {number} * @since 3.0.0 */ COMMA_FIREFOX: 62, @@ -28239,7 +32094,7 @@ var KeyCodes = { * The BRACKET_RIGHT_FIREFOX key. * * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_RIGHT_FIREFOX - * @type {integer} + * @type {number} * @since 3.0.0 */ BRACKET_RIGHT_FIREFOX: 174, @@ -28248,7 +32103,7 @@ var KeyCodes = { * The BRACKET_LEFT_FIREFOX key. * * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_LEFT_FIREFOX - * @type {integer} + * @type {number} * @since 3.0.0 */ BRACKET_LEFT_FIREFOX: 175 @@ -28258,7 +32113,7 @@ module.exports = KeyCodes; /***/ }), -/* 133 */ +/* 139 */ /***/ (function(module, exports) { /** @@ -28280,7 +32135,7 @@ var CONST = { * * @name Phaser.Scenes.PENDING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ PENDING: 0, @@ -28290,7 +32145,7 @@ var CONST = { * * @name Phaser.Scenes.INIT * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ INIT: 1, @@ -28300,7 +32155,7 @@ var CONST = { * * @name Phaser.Scenes.START * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ START: 2, @@ -28310,7 +32165,7 @@ var CONST = { * * @name Phaser.Scenes.LOADING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ LOADING: 3, @@ -28320,7 +32175,7 @@ var CONST = { * * @name Phaser.Scenes.CREATING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ CREATING: 4, @@ -28330,7 +32185,7 @@ var CONST = { * * @name Phaser.Scenes.RUNNING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ RUNNING: 5, @@ -28340,7 +32195,7 @@ var CONST = { * * @name Phaser.Scenes.PAUSED * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ PAUSED: 6, @@ -28350,7 +32205,7 @@ var CONST = { * * @name Phaser.Scenes.SLEEPING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ SLEEPING: 7, @@ -28360,7 +32215,7 @@ var CONST = { * * @name Phaser.Scenes.SHUTDOWN * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ SHUTDOWN: 8, @@ -28370,7 +32225,7 @@ var CONST = { * * @name Phaser.Scenes.DESTROYED * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ DESTROYED: 9 @@ -28381,7 +32236,7 @@ module.exports = CONST; /***/ }), -/* 134 */ +/* 140 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -28390,7 +32245,7 @@ module.exports = CONST; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Creates a new Object using all values from obj1 and obj2. @@ -28426,7 +32281,7 @@ module.exports = Merge; /***/ }), -/* 135 */ +/* 141 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -28437,13 +32292,13 @@ module.exports = Merge; */ var Class = __webpack_require__(0); -var Clone = __webpack_require__(69); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(61); -var GameEvents = __webpack_require__(21); +var Clone = __webpack_require__(76); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(66); +var GameEvents = __webpack_require__(23); var NOOP = __webpack_require__(1); -var GetAll = __webpack_require__(193); -var GetFirst = __webpack_require__(395); +var GetAll = __webpack_require__(198); +var GetFirst = __webpack_require__(405); /** * @classdesc @@ -29140,7 +32995,7 @@ module.exports = BaseSoundManager; /***/ }), -/* 136 */ +/* 142 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29151,9 +33006,9 @@ module.exports = BaseSoundManager; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(61); -var Extend = __webpack_require__(19); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(66); +var Extend = __webpack_require__(18); var NOOP = __webpack_require__(1); /** @@ -29640,7 +33495,7 @@ module.exports = BaseSound; /***/ }), -/* 137 */ +/* 143 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29649,824 +33504,8 @@ module.exports = BaseSound; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayUtils = __webpack_require__(194); -var Class = __webpack_require__(0); -var NOOP = __webpack_require__(1); -var StableSort = __webpack_require__(139); - -/** - * @callback EachListCallback - * - * @param {I} item - The item which is currently being processed. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - */ - -/** - * @classdesc - * List is a generic implementation of an ordered list which contains utility methods for retrieving, manipulating, and iterating items. - * - * @class List - * @memberof Phaser.Structs - * @constructor - * @since 3.0.0 - * - * @generic T - * - * @param {*} parent - The parent of this list. - */ -var List = new Class({ - - initialize: - - function List (parent) - { - /** - * The parent of this list. - * - * @name Phaser.Structs.List#parent - * @type {*} - * @since 3.0.0 - */ - this.parent = parent; - - /** - * The objects that belong to this collection. - * - * @genericUse {T[]} - [$type] - * - * @name Phaser.Structs.List#list - * @type {Array.<*>} - * @default [] - * @since 3.0.0 - */ - this.list = []; - - /** - * The index of the current element. - * - * This is used internally when iterating through the list with the {@link #first}, {@link #last}, {@link #get}, and {@link #previous} properties. - * - * @name Phaser.Structs.List#position - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.position = 0; - - /** - * A callback that is invoked every time a child is added to this list. - * - * @name Phaser.Structs.List#addCallback - * @type {function} - * @since 3.4.0 - */ - this.addCallback = NOOP; - - /** - * A callback that is invoked every time a child is removed from this list. - * - * @name Phaser.Structs.List#removeCallback - * @type {function} - * @since 3.4.0 - */ - this.removeCallback = NOOP; - - /** - * The property key to sort by. - * - * @name Phaser.Structs.List#_sortKey - * @type {string} - * @since 3.4.0 - */ - this._sortKey = ''; - }, - - /** - * Adds the given item to the end of the list. Each item must be unique. - * - * @method Phaser.Structs.List#add - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*|Array.<*>} child - The item, or array of items, to add to the list. - * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. - * - * @return {*} The list's underlying array. - */ - add: function (child, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.Add(this.list, child); - } - else - { - return ArrayUtils.Add(this.list, child, 0, this.addCallback, this); - } - }, - - /** - * Adds an item to list, starting at a specified index. Each item must be unique within the list. - * - * @method Phaser.Structs.List#addAt - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item, or array of items, to add to the list. - * @param {integer} [index=0] - The index in the list at which the element(s) will be inserted. - * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. - * - * @return {*} The List's underlying array. - */ - addAt: function (child, index, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.AddAt(this.list, child, index); - } - else - { - return ArrayUtils.AddAt(this.list, child, index, 0, this.addCallback, this); - } - }, - - /** - * Retrieves the item at a given position inside the List. - * - * @method Phaser.Structs.List#getAt - * @since 3.0.0 - * - * @genericUse {T} - [$return] - * - * @param {integer} index - The index of the item. - * - * @return {*} The retrieved item, or `undefined` if it's outside the List's bounds. - */ - getAt: function (index) - { - return this.list[index]; - }, - - /** - * Locates an item within the List and returns its index. - * - * @method Phaser.Structs.List#getIndex - * @since 3.0.0 - * - * @genericUse {T} - [child] - * - * @param {*} child - The item to locate. - * - * @return {integer} The index of the item within the List, or -1 if it's not in the List. - */ - getIndex: function (child) - { - // Return -1 if given child isn't a child of this display list - return this.list.indexOf(child); - }, - - /** - * Sort the contents of this List so the items are in order based on the given property. - * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. - * - * @method Phaser.Structs.List#sort - * @since 3.0.0 - * - * @genericUse {T[]} - [children,$return] - * - * @param {string} property - The property to lexically sort by. - * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. - * - * @return {Phaser.Structs.List} This List object. - */ - sort: function (property, handler) - { - if (!property) - { - return this; - } - - if (handler === undefined) - { - handler = function (childA, childB) - { - return childA[property] - childB[property]; - }; - } - - StableSort(this.list, handler); - - return this; - }, - - /** - * Searches for the first instance of a child with its `name` - * property matching the given argument. Should more than one child have - * the same name only the first is returned. - * - * @method Phaser.Structs.List#getByName - * @since 3.0.0 - * - * @genericUse {T | null} - [$return] - * - * @param {string} name - The name to search for. - * - * @return {?*} The first child with a matching name, or null if none were found. - */ - getByName: function (name) - { - return ArrayUtils.GetFirst(this.list, 'name', name); - }, - - /** - * Returns a random child from the group. - * - * @method Phaser.Structs.List#getRandom - * @since 3.0.0 - * - * @genericUse {T | null} - [$return] - * - * @param {integer} [startIndex=0] - Offset from the front of the group (lowest child). - * @param {integer} [length=(to top)] - Restriction on the number of values you want to randomly select from. - * - * @return {?*} A random child of this Group. - */ - getRandom: function (startIndex, length) - { - return ArrayUtils.GetRandom(this.list, startIndex, length); - }, - - /** - * Returns the first element in a given part of the List which matches a specific criterion. - * - * @method Phaser.Structs.List#getFirst - * @since 3.0.0 - * - * @genericUse {T | null} - [$return] - * - * @param {string} property - The name of the property to test or a falsey value to have no criterion. - * @param {*} value - The value to test the `property` against, or `undefined` to allow any value and only check for existence. - * @param {number} [startIndex=0] - The position in the List to start the search at. - * @param {number} [endIndex] - The position in the List to optionally stop the search at. It won't be checked. - * - * @return {?*} The first item which matches the given criterion, or `null` if no such item exists. - */ - getFirst: function (property, value, startIndex, endIndex) - { - return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); - }, - - /** - * Returns all children in this List. - * - * You can optionally specify a matching criteria using the `property` and `value` arguments. - * - * For example: `getAll('parent')` would return only children that have a property called `parent`. - * - * You can also specify a value to compare the property to: - * - * `getAll('visible', true)` would return only children that have their visible property set to `true`. - * - * Optionally you can specify a start and end index. For example if this List had 100 children, - * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only - * the first 50 children in the List. - * - * @method Phaser.Structs.List#getAll - * @since 3.0.0 - * - * @genericUse {T} - [value] - * @genericUse {T[]} - [$return] - * - * @param {string} [property] - An optional property to test against the value argument. - * @param {*} [value] - If property is set then Child.property must strictly equal this value to be included in the results. - * @param {integer} [startIndex] - The first child index to start the search from. - * @param {integer} [endIndex] - The last child index to search up until. - * - * @return {Array.<*>} All items of the List which match the given criterion, if any. - */ - getAll: function (property, value, startIndex, endIndex) - { - return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex); - }, - - /** - * Returns the total number of items in the List which have a property matching the given value. - * - * @method Phaser.Structs.List#count - * @since 3.0.0 - * - * @genericUse {T} - [value] - * - * @param {string} property - The property to test on each item. - * @param {*} value - The value to test the property against. - * - * @return {integer} The total number of matching elements. - */ - count: function (property, value) - { - return ArrayUtils.CountAllMatching(this.list, property, value); - }, - - /** - * Swaps the positions of two items in the list. - * - * @method Phaser.Structs.List#swap - * @since 3.0.0 - * - * @genericUse {T} - [child1,child2] - * - * @param {*} child1 - The first item to swap. - * @param {*} child2 - The second item to swap. - */ - swap: function (child1, child2) - { - ArrayUtils.Swap(this.list, child1, child2); - }, - - /** - * Moves an item in the List to a new position. - * - * @method Phaser.Structs.List#moveTo - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to move. - * @param {integer} index - Moves an item in the List to a new position. - * - * @return {*} The item that was moved. - */ - moveTo: function (child, index) - { - return ArrayUtils.MoveTo(this.list, child, index); - }, - - /** - * Removes one or many items from the List. - * - * @method Phaser.Structs.List#remove - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item, or array of items, to remove. - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {*} The item, or array of items, which were successfully removed from the List. - */ - remove: function (child, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.Remove(this.list, child); - } - else - { - return ArrayUtils.Remove(this.list, child, this.removeCallback, this); - } - }, - - /** - * Removes the item at the given position in the List. - * - * @method Phaser.Structs.List#removeAt - * @since 3.0.0 - * - * @genericUse {T} - [$return] - * - * @param {integer} index - The position to remove the item from. - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {*} The item that was removed. - */ - removeAt: function (index, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.RemoveAt(this.list, index); - } - else - { - return ArrayUtils.RemoveAt(this.list, index, this.removeCallback, this); - } - }, - - /** - * Removes the items within the given range in the List. - * - * @method Phaser.Structs.List#removeBetween - * @since 3.0.0 - * - * @genericUse {T[]} - [$return] - * - * @param {integer} [startIndex=0] - The index to start removing from. - * @param {integer} [endIndex] - The position to stop removing at. The item at this position won't be removed. - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {Array.<*>} An array of the items which were removed. - */ - removeBetween: function (startIndex, endIndex, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex); - } - else - { - return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeCallback, this); - } - }, - - /** - * Removes all the items. - * - * @method Phaser.Structs.List#removeAll - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.List.} - [$return] - * - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {Phaser.Structs.List} This List object. - */ - removeAll: function (skipCallback) - { - var i = this.list.length; - - while (i--) - { - this.remove(this.list[i], skipCallback); - } - - return this; - }, - - /** - * Brings the given child to the top of this List. - * - * @method Phaser.Structs.List#bringToTop - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to bring to the top of the List. - * - * @return {*} The item which was moved. - */ - bringToTop: function (child) - { - return ArrayUtils.BringToTop(this.list, child); - }, - - /** - * Sends the given child to the bottom of this List. - * - * @method Phaser.Structs.List#sendToBack - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to send to the back of the list. - * - * @return {*} The item which was moved. - */ - sendToBack: function (child) - { - return ArrayUtils.SendToBack(this.list, child); - }, - - /** - * Moves the given child up one place in this group unless it's already at the top. - * - * @method Phaser.Structs.List#moveUp - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to move up. - * - * @return {*} The item which was moved. - */ - moveUp: function (child) - { - ArrayUtils.MoveUp(this.list, child); - - return child; - }, - - /** - * Moves the given child down one place in this group unless it's already at the bottom. - * - * @method Phaser.Structs.List#moveDown - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to move down. - * - * @return {*} The item which was moved. - */ - moveDown: function (child) - { - ArrayUtils.MoveDown(this.list, child); - - return child; - }, - - /** - * Reverses the order of all children in this List. - * - * @method Phaser.Structs.List#reverse - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.List.} - [$return] - * - * @return {Phaser.Structs.List} This List object. - */ - reverse: function () - { - this.list.reverse(); - - return this; - }, - - /** - * Shuffles the items in the list. - * - * @method Phaser.Structs.List#shuffle - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.List.} - [$return] - * - * @return {Phaser.Structs.List} This List object. - */ - shuffle: function () - { - ArrayUtils.Shuffle(this.list); - - return this; - }, - - /** - * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List. - * - * @method Phaser.Structs.List#replace - * @since 3.0.0 - * - * @genericUse {T} - [oldChild,newChild,$return] - * - * @param {*} oldChild - The child in this List that will be replaced. - * @param {*} newChild - The child to be inserted into this List. - * - * @return {*} Returns the oldChild that was replaced within this group. - */ - replace: function (oldChild, newChild) - { - return ArrayUtils.Replace(this.list, oldChild, newChild); - }, - - /** - * Checks if an item exists within the List. - * - * @method Phaser.Structs.List#exists - * @since 3.0.0 - * - * @genericUse {T} - [child] - * - * @param {*} child - The item to check for the existence of. - * - * @return {boolean} `true` if the item is found in the list, otherwise `false`. - */ - exists: function (child) - { - return (this.list.indexOf(child) > -1); - }, - - /** - * Sets the property `key` to the given value on all members of this List. - * - * @method Phaser.Structs.List#setAll - * @since 3.0.0 - * - * @genericUse {T} - [value] - * - * @param {string} property - The name of the property to set. - * @param {*} value - The value to set the property to. - * @param {integer} [startIndex] - The first child index to start the search from. - * @param {integer} [endIndex] - The last child index to search up until. - */ - setAll: function (property, value, startIndex, endIndex) - { - ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex); - - return this; - }, - - /** - * Passes all children to the given callback. - * - * @method Phaser.Structs.List#each - * @since 3.0.0 - * - * @genericUse {EachListCallback.} - [callback] - * - * @param {EachListCallback} callback - The function to call. - * @param {*} [context] - Value to use as `this` when executing callback. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - */ - each: function (callback, context) - { - var args = [ null ]; - - for (var i = 2; i < arguments.length; i++) - { - args.push(arguments[i]); - } - - for (i = 0; i < this.list.length; i++) - { - args[0] = this.list[i]; - - callback.apply(context, args); - } - }, - - /** - * Clears the List and recreates its internal array. - * - * @method Phaser.Structs.List#shutdown - * @since 3.0.0 - */ - shutdown: function () - { - this.removeAll(); - - this.list = []; - }, - - /** - * Destroys this List. - * - * @method Phaser.Structs.List#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.removeAll(); - - this.parent = null; - this.addCallback = null; - this.removeCallback = null; - }, - - /** - * The number of items inside the List. - * - * @name Phaser.Structs.List#length - * @type {integer} - * @readonly - * @since 3.0.0 - */ - length: { - - get: function () - { - return this.list.length; - } - - }, - - /** - * The first item in the List or `null` for an empty List. - * - * @name Phaser.Structs.List#first - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - first: { - - get: function () - { - this.position = 0; - - if (this.list.length > 0) - { - return this.list[0]; - } - else - { - return null; - } - } - - }, - - /** - * The last item in the List, or `null` for an empty List. - * - * @name Phaser.Structs.List#last - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - last: { - - get: function () - { - if (this.list.length > 0) - { - this.position = this.list.length - 1; - - return this.list[this.position]; - } - else - { - return null; - } - } - - }, - - /** - * The next item in the List, or `null` if the entire List has been traversed. - * - * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List. - * - * @name Phaser.Structs.List#next - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - next: { - - get: function () - { - if (this.position < this.list.length) - { - this.position++; - - return this.list[this.position]; - } - else - { - return null; - } - } - - }, - - /** - * The previous item in the List, or `null` if the entire List has been traversed. - * - * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards. - * - * @name Phaser.Structs.List#previous - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - previous: { - - get: function () - { - if (this.position > 0) - { - this.position--; - - return this.list[this.position]; - } - else - { - return null; - } - } - - } - -}); - -module.exports = List; - - -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CheckMatrix = __webpack_require__(195); -var TransposeMatrix = __webpack_require__(402); +var CheckMatrix = __webpack_require__(200); +var TransposeMatrix = __webpack_require__(412); /** * Rotates the array matrix based on the given rotation value. @@ -30476,6 +33515,20 @@ var TransposeMatrix = __webpack_require__(402); * * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.RotateMatrix * @since 3.0.0 * @@ -30528,183 +33581,7 @@ module.exports = RotateMatrix; /***/ }), -/* 139 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @author Angry Bytes (and contributors) - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The comparator function. - * - * @ignore - * - * @param {*} a - The first item to test. - * @param {*} b - The second itemt to test. - * - * @return {boolean} True if they localCompare, otherwise false. - */ -function Compare (a, b) -{ - return String(a).localeCompare(b); -} - -/** - * Process the array contents. - * - * @ignore - * - * @param {array} array - The array to process. - * @param {function} compare - The comparison function. - * - * @return {array} - The processed array. - */ -function Process (array, compare) -{ - // Short-circuit when there's nothing to sort. - var len = array.length; - - if (len <= 1) - { - return array; - } - - // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc. - // Chunks are the size of the left or right hand in merge sort. - // Stop when the left-hand covers all of the array. - var buffer = new Array(len); - - for (var chk = 1; chk < len; chk *= 2) - { - RunPass(array, compare, chk, buffer); - - var tmp = array; - - array = buffer; - - buffer = tmp; - } - - return array; -} - -/** - * Run a single pass with the given chunk size. - * - * @ignore - * - * @param {array} arr - The array to run the pass on. - * @param {function} comp - The comparison function. - * @param {number} chk - The number of iterations. - * @param {array} result - The array to store the result in. - */ -function RunPass (arr, comp, chk, result) -{ - var len = arr.length; - var i = 0; - - // Step size / double chunk size. - var dbl = chk * 2; - - // Bounds of the left and right chunks. - var l, r, e; - - // Iterators over the left and right chunk. - var li, ri; - - // Iterate over pairs of chunks. - for (l = 0; l < len; l += dbl) - { - r = l + chk; - e = r + chk; - - if (r > len) - { - r = len; - } - - if (e > len) - { - e = len; - } - - // Iterate both chunks in parallel. - li = l; - ri = r; - - while (true) - { - // Compare the chunks. - if (li < r && ri < e) - { - // This works for a regular `sort()` compatible comparator, - // but also for a simple comparator like: `a > b` - if (comp(arr[li], arr[ri]) <= 0) - { - result[i++] = arr[li++]; - } - else - { - result[i++] = arr[ri++]; - } - } - else if (li < r) - { - // Nothing to compare, just flush what's left. - result[i++] = arr[li++]; - } - else if (ri < e) - { - result[i++] = arr[ri++]; - } - else - { - // Both iterators are at the chunk ends. - break; - } - } - } -} - -/** - * An in-place stable array sort, because `Array#sort()` is not guaranteed stable. - * - * This is an implementation of merge sort, without recursion. - * - * Function based on the Two-Screen/stable sort 0.1.8 from https://github.com/Two-Screen/stable - * - * @function Phaser.Utils.Array.StableSort - * @since 3.0.0 - * - * @param {array} array - The input array to be sorted. - * @param {function} [compare] - The comparison function. - * - * @return {array} The sorted result. - */ -var StableSort = function (array, compare) -{ - if (compare === undefined) { compare = Compare; } - - var result = Process(array, compare); - - // This simply copies back if the result isn't in the original array, which happens on an odd number of passes. - if (result !== array) - { - RunPass(result, null, array.length, array); - } - - return array; -}; - -module.exports = StableSort; - - -/***/ }), -/* 140 */ +/* 144 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -30714,15 +33591,14 @@ module.exports = StableSort; */ var Class = __webpack_require__(0); -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var GetColorFromValue = __webpack_require__(119); -var GetBitmapTextSize = __webpack_require__(969); -var ParseFromAtlas = __webpack_require__(970); -var ParseXMLBitmapFont = __webpack_require__(198); +var GetBitmapTextSize = __webpack_require__(1026); +var ParseFromAtlas = __webpack_require__(1027); +var ParseXMLBitmapFont = __webpack_require__(203); var Rectangle = __webpack_require__(9); -var Render = __webpack_require__(971); +var Render = __webpack_require__(1028); /** * @classdesc @@ -30770,7 +33646,7 @@ var Render = __webpack_require__(971); * @param {string} font - The key of the font to use from the Bitmap Font cache. * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. * @param {number} [size] - The font size of this Bitmap Text. - * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. */ var BitmapText = new Class({ @@ -30874,7 +33750,7 @@ var BitmapText = new Class({ * The alignment position is based on the longest line of text. * * @name Phaser.GameObjects.BitmapText#_align - * @type {integer} + * @type {number} * @private * @since 3.11.0 */ @@ -30955,22 +33831,13 @@ var BitmapText = new Class({ /** * The color of the drop shadow. * - * @name Phaser.GameObjects.BitmapText#_dropShadowColor - * @type {number} - * @private - * @since 3.50.0 - */ - this._dropShadowColor = 0x000000; - - /** - * The GL encoded color of the drop shadow. + * You can set this directly, or use `Phaser.GameObjects.BitmapText#setDropShadow`. * - * @name Phaser.GameObjects.BitmapText#_dropShadowColorGL + * @name Phaser.GameObjects.BitmapText#dropShadowColor * @type {number} - * @private * @since 3.50.0 */ - this._dropShadowColorGL = 0x000000; + this.dropShadowColor = 0x000000; /** * The alpha value of the drop shadow. @@ -31195,10 +34062,10 @@ var BitmapText = new Class({ * @param {number} [start=0] - The starting character to begin the tint at. If negative, it counts back from the end of the text. * @param {number} [length=1] - The number of characters to tint. Remember that spaces count as a character too. Pass -1 to tint all characters from `start` onwards. * @param {boolean} [tintFill=false] - Use a fill-based tint (true), or an additive tint (false) - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the character. If not other values are given this value is applied evenly, tinting the whole character. - * @param {integer} [topRight] - The tint being applied to the top-right of the character. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the character. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the character. + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the character. If not other values are given this value is applied evenly, tinting the whole character. + * @param {number} [topRight] - The tint being applied to the top-right of the character. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the character. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the character. * * @return {this} This BitmapText Object. */ @@ -31245,27 +34112,23 @@ var BitmapText = new Class({ else { var tintEffect = (tintFill) ? 1 : 0; - var tintTL = GetColorFromValue(topLeft); - var tintTR = GetColorFromValue(topRight); - var tintBL = GetColorFromValue(bottomLeft); - var tintBR = GetColorFromValue(bottomRight); if (color) { color.tintEffect = tintEffect; - color.tintTL = tintTL; - color.tintTR = tintTR; - color.tintBL = tintBL; - color.tintBR = tintBR; + color.tintTL = topLeft; + color.tintTR = topRight; + color.tintBL = bottomLeft; + color.tintBR = bottomRight; } else { charColors[i] = { tintEffect: tintEffect, - tintTL: tintTL, - tintTR: tintTR, - tintBL: tintBL, - tintBR: tintBR + tintTL: topLeft, + tintTR: topRight, + tintBL: bottomLeft, + tintBR: bottomRight }; } } @@ -31308,10 +34171,10 @@ var BitmapText = new Class({ * @param {(string|number)} word - The word to search for. Either a string, or an index of the word in the words array. * @param {number} [count=1] - The number of matching words to tint. Pass -1 to tint all matching words. * @param {boolean} [tintFill=false] - Use a fill-based tint (true), or an additive tint (false) - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the word. If not other values are given this value is applied evenly, tinting the whole word. - * @param {integer} [topRight] - The tint being applied to the top-right of the word. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the word. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the word. + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the word. If not other values are given this value is applied evenly, tinting the whole word. + * @param {number} [topRight] - The tint being applied to the top-right of the word. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the word. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the word. * * @return {this} This BitmapText Object. */ @@ -31462,7 +34325,7 @@ var BitmapText = new Class({ * * @param {string} font - The key of the font to use from the Bitmap Font cache. * @param {number} [size] - The font size of this Bitmap Text. If not specified the current size will be used. - * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object. If not specified the current alignment will be used. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. If not specified the current alignment will be used. * * @return {this} This BitmapText Object. */ @@ -31540,7 +34403,7 @@ var BitmapText = new Class({ * The alignment position is based on the longest line of text. * * @name Phaser.GameObjects.BitmapText#align - * @type {integer} + * @type {number} * @since 3.11.0 */ align: { @@ -31698,31 +34561,6 @@ var BitmapText = new Class({ }, - /** - * The color of the drop shadow. - * - * You can also set this via `Phaser.GameObjects.BitmapText#setDropShadow`. - * - * @name Phaser.GameObjects.BitmapText#dropShadowColor - * @type {number} - * @since 3.50.0 - */ - dropShadowColor: { - - get: function () - { - return this._dropShadowColor; - }, - - set: function (value) - { - this._dropShadowColor = value; - - this._dropShadowColorGL = GetColorFromValue(value); - } - - }, - /** * Build a JSON representation of this Bitmap Text. * @@ -31770,7 +34608,7 @@ var BitmapText = new Class({ * Left align the text characters in a multi-line BitmapText object. * * @name Phaser.GameObjects.BitmapText.ALIGN_LEFT - * @type {integer} + * @type {number} * @since 3.11.0 */ BitmapText.ALIGN_LEFT = 0; @@ -31779,7 +34617,7 @@ BitmapText.ALIGN_LEFT = 0; * Center align the text characters in a multi-line BitmapText object. * * @name Phaser.GameObjects.BitmapText.ALIGN_CENTER - * @type {integer} + * @type {number} * @since 3.11.0 */ BitmapText.ALIGN_CENTER = 1; @@ -31788,7 +34626,7 @@ BitmapText.ALIGN_CENTER = 1; * Right align the text characters in a multi-line BitmapText object. * * @name Phaser.GameObjects.BitmapText.ALIGN_RIGHT - * @type {integer} + * @type {number} * @since 3.11.0 */ BitmapText.ALIGN_RIGHT = 2; @@ -31806,8 +34644,8 @@ BitmapText.ALIGN_RIGHT = 2; * @param {string} textureKey - The key of the BitmapFont's texture. * @param {string} frameKey - The key of the BitmapFont texture's frame. * @param {string} xmlKey - The key of the XML data of the font to parse. - * @param {integer} [xSpacing] - The x-axis spacing to add between each letter. - * @param {integer} [ySpacing] - The y-axis spacing to add to the line height. + * @param {number} [xSpacing] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing] - The y-axis spacing to add to the line height. * * @return {boolean} Whether the parsing was successful or not. */ @@ -31821,8 +34659,8 @@ BitmapText.ParseFromAtlas = ParseFromAtlas; * * @param {XMLDocument} xml - The XML Document to parse the font from. * @param {Phaser.Textures.Frame} frame - The texture frame to take into account when creating the uv data. - * @param {integer} [xSpacing=0] - The x-axis spacing to add between each letter. - * @param {integer} [ySpacing=0] - The y-axis spacing to add to the line height. + * @param {number} [xSpacing=0] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing=0] - The y-axis spacing to add to the line height. * * @return {Phaser.Types.GameObjects.BitmapText.BitmapFontData} The parsed Bitmap Font data. */ @@ -31832,7 +34670,7 @@ module.exports = BitmapText; /***/ }), -/* 141 */ +/* 145 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32251,7 +35089,7 @@ var Set = new Class({ * Increasing the size larger than the current size has no effect. * * @name Phaser.Structs.Set#size - * @type {integer} + * @type {number} * @since 3.0.0 */ size: { @@ -32281,216 +35119,7 @@ module.exports = Set; /***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(14); -var MeshRender = __webpack_require__(1097); -var NOOP = __webpack_require__(1); - -/** - * @classdesc - * A Mesh Game Object. - * - * @class Mesh - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @webglOnly - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * @extends Phaser.GameObjects.Components.ScrollFactor - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number[]} vertices - An array containing the vertices data for this Mesh. - * @param {number[]} uv - An array containing the uv data for this Mesh. - * @param {number[]} colors - An array containing the color data for this Mesh. - * @param {number[]} alphas - An array containing the alpha data for this Mesh. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - */ -var Mesh = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.BlendMode, - Components.Depth, - Components.Mask, - Components.Pipeline, - Components.Size, - Components.Texture, - Components.Transform, - Components.Visible, - Components.ScrollFactor, - MeshRender - ], - - initialize: - - function Mesh (scene, x, y, vertices, uv, colors, alphas, texture, frame) - { - GameObject.call(this, scene, 'Mesh'); - - if (vertices.length !== uv.length) - { - throw new Error('Mesh Vertex count must match UV count'); - } - - var verticesUB = (vertices.length / 2) | 0; - - if (colors.length > 0 && colors.length < verticesUB) - { - throw new Error('Mesh Color count must match Vertex count'); - } - - if (alphas.length > 0 && alphas.length < verticesUB) - { - throw new Error('Mesh Alpha count must match Vertex count'); - } - - var i; - - if (colors.length === 0) - { - for (i = 0; i < verticesUB; ++i) - { - colors[i] = 0xFFFFFF; - } - } - - if (alphas.length === 0) - { - for (i = 0; i < verticesUB; ++i) - { - alphas[i] = 1.0; - } - } - - /** - * An array containing the vertices data for this Mesh. - * - * @name Phaser.GameObjects.Mesh#vertices - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertices = new Float32Array(vertices); - - /** - * An array containing the uv data for this Mesh. - * - * @name Phaser.GameObjects.Mesh#uv - * @type {Float32Array} - * @since 3.0.0 - */ - this.uv = new Float32Array(uv); - - /** - * An array containing the color data for this Mesh. - * - * @name Phaser.GameObjects.Mesh#colors - * @type {Uint32Array} - * @since 3.0.0 - */ - this.colors = new Uint32Array(colors); - - /** - * An array containing the alpha data for this Mesh. - * - * @name Phaser.GameObjects.Mesh#alphas - * @type {Float32Array} - * @since 3.0.0 - */ - this.alphas = new Float32Array(alphas); - - /** - * Fill or additive mode used when blending the color values? - * - * @name Phaser.GameObjects.Mesh#tintFill - * @type {boolean} - * @default false - * @since 3.11.0 - */ - this.tintFill = false; - - this.setTexture(texture, frame); - this.setPosition(x, y); - this.setSizeToFrame(); - this.initPipeline(); - }, - - /** - * This method is left intentionally empty and does not do anything. - * It is retained to allow a Mesh or Quad to be added to a Container. - * - * @method Phaser.GameObjects.Mesh#setAlpha - * @since 3.17.0 - */ - setAlpha: NOOP - -}); - -module.exports = Mesh; - - -/***/ }), -/* 143 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Checks if two Rectangles intersect. - * - * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. - * As such, the two Rectangles are considered "solid". - * A Rectangle with no width or no height will never intersect another Rectangle. - * - * @function Phaser.Geom.Intersects.RectangleToRectangle - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. - * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. - * - * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`. - */ -var RectangleToRectangle = function (rectA, rectB) -{ - if (rectA.width <= 0 || rectA.height <= 0 || rectB.width <= 0 || rectB.height <= 0) - { - return false; - } - - return !(rectA.right < rectB.x || rectA.bottom < rectB.y || rectA.x > rectB.right || rectA.y > rectB.bottom); -}; - -module.exports = RectangleToRectangle; - - -/***/ }), -/* 144 */ +/* 146 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32598,7 +35227,7 @@ module.exports = InputPluginCache; /***/ }), -/* 145 */ +/* 147 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32613,19 +35242,19 @@ module.exports = InputPluginCache; module.exports = { - ANY_KEY_DOWN: __webpack_require__(1239), - ANY_KEY_UP: __webpack_require__(1240), - COMBO_MATCH: __webpack_require__(1241), - DOWN: __webpack_require__(1242), - KEY_DOWN: __webpack_require__(1243), - KEY_UP: __webpack_require__(1244), - UP: __webpack_require__(1245) + ANY_KEY_DOWN: __webpack_require__(1303), + ANY_KEY_UP: __webpack_require__(1304), + COMBO_MATCH: __webpack_require__(1305), + DOWN: __webpack_require__(1306), + KEY_DOWN: __webpack_require__(1307), + KEY_UP: __webpack_require__(1308), + UP: __webpack_require__(1309) }; /***/ }), -/* 146 */ +/* 148 */ /***/ (function(module, exports) { /** @@ -32666,7 +35295,7 @@ module.exports = GetURL; /***/ }), -/* 147 */ +/* 149 */ /***/ (function(module, exports) { /** @@ -32685,7 +35314,7 @@ module.exports = GetURL; * @param {boolean} [async=true] - Should the XHR request use async or not? * @param {string} [user=''] - Optional username for the XHR request. * @param {string} [password=''] - Optional password for the XHR request. - * @param {integer} [timeout=0] - Optional XHR timeout value. + * @param {number} [timeout=0] - Optional XHR timeout value. * @param {boolean} [withCredentials=false] - Optional XHR withCredentials value. * * @return {Phaser.Types.Loader.XHRSettingsObject} The XHRSettings object as used by the Loader. @@ -32736,7 +35365,7 @@ module.exports = XHRSettings; /***/ }), -/* 148 */ +/* 150 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32746,8 +35375,8 @@ module.exports = XHRSettings; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(228); -var Sprite = __webpack_require__(76); +var Components = __webpack_require__(235); +var Sprite = __webpack_require__(70); /** * @classdesc @@ -32773,6 +35402,7 @@ var Sprite = __webpack_require__(76); * @extends Phaser.Physics.Arcade.Components.Gravity * @extends Phaser.Physics.Arcade.Components.Immovable * @extends Phaser.Physics.Arcade.Components.Mass + * @extends Phaser.Physics.Arcade.Components.Pushable * @extends Phaser.Physics.Arcade.Components.Size * @extends Phaser.Physics.Arcade.Components.Velocity * @extends Phaser.GameObjects.Components.Alpha @@ -32793,7 +35423,7 @@ var Sprite = __webpack_require__(76); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ var ArcadeSprite = new Class({ @@ -32810,6 +35440,7 @@ var ArcadeSprite = new Class({ Components.Gravity, Components.Immovable, Components.Mass, + Components.Pushable, Components.Size, Components.Velocity ], @@ -32837,7 +35468,7 @@ module.exports = ArcadeSprite; /***/ }), -/* 149 */ +/* 151 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32846,71 +35477,7 @@ module.exports = ArcadeSprite; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Tilemaps.Components - */ - -module.exports = { - - CalculateFacesAt: __webpack_require__(235), - CalculateFacesWithin: __webpack_require__(53), - Copy: __webpack_require__(1326), - CreateFromTiles: __webpack_require__(1327), - CullTiles: __webpack_require__(1328), - Fill: __webpack_require__(1329), - FilterTiles: __webpack_require__(1330), - FindByIndex: __webpack_require__(1331), - FindTile: __webpack_require__(1332), - ForEachTile: __webpack_require__(1333), - GetTileAt: __webpack_require__(150), - GetTileAtWorldXY: __webpack_require__(1334), - GetTilesWithin: __webpack_require__(24), - GetTilesWithinShape: __webpack_require__(1335), - GetTilesWithinWorldXY: __webpack_require__(1336), - HasTileAt: __webpack_require__(504), - HasTileAtWorldXY: __webpack_require__(1337), - IsInLayerBounds: __webpack_require__(104), - PutTileAt: __webpack_require__(236), - PutTileAtWorldXY: __webpack_require__(1338), - PutTilesAt: __webpack_require__(1339), - Randomize: __webpack_require__(1340), - RemoveTileAt: __webpack_require__(505), - RemoveTileAtWorldXY: __webpack_require__(1341), - RenderDebug: __webpack_require__(1342), - ReplaceByIndex: __webpack_require__(503), - SetCollision: __webpack_require__(1343), - SetCollisionBetween: __webpack_require__(1344), - SetCollisionByExclusion: __webpack_require__(1345), - SetCollisionByProperty: __webpack_require__(1346), - SetCollisionFromCollisionGroup: __webpack_require__(1347), - SetLayerCollisionIndex: __webpack_require__(153), - SetTileCollision: __webpack_require__(65), - SetTileIndexCallback: __webpack_require__(1348), - SetTileLocationCallback: __webpack_require__(1349), - Shuffle: __webpack_require__(1350), - SwapByIndex: __webpack_require__(1351), - TileToWorldX: __webpack_require__(151), - TileToWorldXY: __webpack_require__(1352), - TileToWorldY: __webpack_require__(152), - WeightedRandomize: __webpack_require__(1353), - WorldToTileX: __webpack_require__(66), - WorldToTileXY: __webpack_require__(1354), - WorldToTileY: __webpack_require__(67) - -}; - - -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var IsInLayerBounds = __webpack_require__(104); +var IsInLayerBounds = __webpack_require__(116); /** * Gets a tile at the given tile coordinates from the given layer. @@ -32918,13 +35485,12 @@ var IsInLayerBounds = __webpack_require__(104); * @function Phaser.Tilemaps.Components.GetTileAt * @since 3.0.0 * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {boolean} nonNull - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates - * were invalid. + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. */ var GetTileAt = function (tileX, tileY, nonNull, layer) { @@ -32933,7 +35499,8 @@ var GetTileAt = function (tileX, tileY, nonNull, layer) if (IsInLayerBounds(tileX, tileY, layer)) { var tile = layer.data[tileY][tileX] || null; - if (tile === null) + + if (!tile) { return null; } @@ -32955,50 +35522,6 @@ var GetTileAt = function (tileX, tileY, nonNull, layer) module.exports = GetTileAt; -/***/ }), -/* 151 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the - * layer's position, scale and scroll. - * - * @function Phaser.Tilemaps.Components.TileToWorldX - * @since 3.0.0 - * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} - */ -var TileToWorldX = function (tileX, camera, layer) -{ - var tileWidth = layer.baseTileWidth; - var tilemapLayer = layer.tilemapLayer; - var layerWorldX = 0; - - if (tilemapLayer) - { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - - layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); - - tileWidth *= tilemapLayer.scaleX; - } - - return layerWorldX + tileX * tileWidth; -}; - -module.exports = TileToWorldX; - - /***/ }), /* 152 */ /***/ (function(module, exports) { @@ -33010,37 +35533,119 @@ module.exports = TileToWorldX; */ /** - * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layer's position, scale and scroll. + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. * - * @function Phaser.Tilemaps.Components.TileToWorldY - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.RunCull + * @since 3.50.0 * - * @param {integer} tileY - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {object} bounds - An object containing the `left`, `right`, `top` and `bottom` bounds. + * @param {number} renderOrder - The rendering order constant. + * @param {array} outputArray - The array to store the Tile objects within. * - * @return {number} + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ -var TileToWorldY = function (tileY, camera, layer) +var RunCull = function (layer, bounds, renderOrder, outputArray) { - var tileHeight = layer.baseTileHeight; + var mapData = layer.data; + var mapWidth = layer.width; + var mapHeight = layer.height; + var tilemapLayer = layer.tilemapLayer; - var layerWorldY = 0; - if (tilemapLayer) + var drawLeft = Math.max(0, bounds.left); + var drawRight = Math.min(mapWidth, bounds.right); + var drawTop = Math.max(0, bounds.top); + var drawBottom = Math.min(mapHeight, bounds.bottom); + + var x; + var y; + var tile; + + if (renderOrder === 0) { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } + // right-down - layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + tile = mapData[y][x]; - tileHeight *= tilemapLayer.scaleY; + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + else if (renderOrder === 1) + { + // left-down + + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + else if (renderOrder === 2) + { + // right-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + else if (renderOrder === 3) + { + // left-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } } - return layerWorldY + tileY * tileHeight; + tilemapLayer.tilesDrawn = outputArray.length; + tilemapLayer.tilesTotal = mapWidth * mapHeight; + + return outputArray; }; -module.exports = TileToWorldY; +module.exports = RunCull; /***/ }), @@ -33060,8 +35665,8 @@ module.exports = TileToWorldY; * @function Phaser.Tilemaps.Components.SetLayerCollisionIndex * @since 3.0.0 * - * @param {integer} tileIndex - The tile index to set the collision boolean for. - * @param {boolean} [collides=true] - Should the tile index collide or not? + * @param {number} tileIndex - The tile index to set the collision boolean for. + * @param {boolean} collides - Should the tile index collide or not? * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SetLayerCollisionIndex = function (tileIndex, collides, layer) @@ -33216,17 +35821,17 @@ module.exports = GetNewValue; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Defaults = __webpack_require__(243); +var Defaults = __webpack_require__(256); var GetAdvancedValue = __webpack_require__(15); -var GetBoolean = __webpack_require__(90); -var GetEaseFunction = __webpack_require__(71); +var GetBoolean = __webpack_require__(95); +var GetEaseFunction = __webpack_require__(78); var GetNewValue = __webpack_require__(155); -var GetProps = __webpack_require__(526); -var GetTargets = __webpack_require__(241); +var GetProps = __webpack_require__(562); +var GetTargets = __webpack_require__(254); var GetValue = __webpack_require__(6); -var GetValueOp = __webpack_require__(242); -var Tween = __webpack_require__(244); -var TweenData = __webpack_require__(246); +var GetValueOp = __webpack_require__(255); +var Tween = __webpack_require__(257); +var TweenData = __webpack_require__(259); /** * Creates a new Tween. @@ -33350,10 +35955,10 @@ module.exports = TweenBuilder; */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(92); +var CustomMap = __webpack_require__(98); var GetFastValue = __webpack_require__(2); -var Events = __webpack_require__(122); -var Animation = __webpack_require__(172); +var Events = __webpack_require__(128); +var Animation = __webpack_require__(177); /** * @classdesc @@ -33783,7 +36388,7 @@ var AnimationState = new Class({ * 3 = Waiting for specific frame * * @name Phaser.Animations.AnimationState#_pendingStop - * @type {integer} + * @type {number} * @private * @since 3.4.0 */ @@ -34025,7 +36630,7 @@ var AnimationState = new Class({ * @since 3.50.0 * * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {integer} delay - The delay, in milliseconds, to wait before starting the animation playing. + * @param {number} delay - The delay, in milliseconds, to wait before starting the animation playing. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -34071,7 +36676,7 @@ var AnimationState = new Class({ * @since 3.50.0 * * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {integer} [repeatCount=1] - How many times should the animation repeat before the next one starts? + * @param {number} [repeatCount=1] - How many times should the animation repeat before the next one starts? * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -34520,7 +37125,7 @@ var AnimationState = new Class({ * @method Phaser.Animations.AnimationState#setRepeat * @since 3.4.0 * - * @param {integer} value - The number of times that the animation should repeat. + * @param {number} value - The number of times that the animation should repeat. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -34696,7 +37301,7 @@ var AnimationState = new Class({ * @fires Phaser.Animations.Events#ANIMATION_STOP * @since 3.4.0 * - * @param {integer} delay - The number of milliseconds to wait before stopping this animation. + * @param {number} delay - The number of milliseconds to wait before stopping this animation. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -34724,7 +37329,7 @@ var AnimationState = new Class({ * @fires Phaser.Animations.Events#ANIMATION_STOP * @since 3.50.0 * - * @param {integer} [repeatCount=1] - How many times should the animation repeat before stopping? + * @param {number} [repeatCount=1] - How many times should the animation repeat before stopping? * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -34777,7 +37382,7 @@ var AnimationState = new Class({ * @method Phaser.Animations.AnimationState#getTotalFrames * @since 3.4.0 * - * @return {integer} The total number of frames in the current animation, or zero if no animation has been loaded. + * @return {number} The total number of frames in the current animation, or zero if no animation has been loaded. */ getTotalFrames: function () { @@ -34974,11 +37579,11 @@ var AnimationState = new Class({ * * @param {string} key - The key of the Animation to retrieve. * - * @return {Phaser.Animations.Animation} The Animation, or `undefined` if the key is invalid. + * @return {Phaser.Animations.Animation} The Animation, or `null` if the key is invalid. */ get: function (key) { - return (this.anims && this.anims.get(key)); + return (this.anims) ? this.anims.get(key) : null; }, /** @@ -34989,11 +37594,11 @@ var AnimationState = new Class({ * * @param {string} key - The key of the Animation to check. * - * @return {boolean} `true` if the Animation exists locally, or `false` if the key is available. + * @return {boolean} `true` if the Animation exists locally, or `false` if the key is available, or there are no local animations. */ exists: function (key) { - return (this.anims && this.anims.has(key)); + return (this.anims) ? this.anims.has(key) : false; }, /** @@ -35046,6 +37651,99 @@ var AnimationState = new Class({ return anim; }, + /** + * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. + * + * Generates objects with string based frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNames}. + * + * It's a helper method, designed to make it easier for you to extract all of the frame names from texture atlases. + * If you're working with a sprite sheet, see the `generateFrameNumbers` method instead. + * + * Example: + * + * If you have a texture atlases loaded called `gems` and it contains 6 frames called `ruby_0001`, `ruby_0002`, and so on, + * then you can call this method using: `this.anims.generateFrameNames('gems', { prefix: 'ruby_', end: 6, zeroPad: 4 })`. + * + * The `end` value tells it to look for 6 frames, incrementally numbered, all starting with the prefix `ruby_`. The `zeroPad` + * value tells it how many zeroes pad out the numbers. To create an animation using this method, you can do: + * + * ```javascript + * this.anims.create({ + * key: 'ruby', + * repeat: -1, + * frames: this.anims.generateFrameNames('gems', { + * prefix: 'ruby_', + * end: 6, + * zeroPad: 4 + * }) + * }); + * ``` + * + * Please see the animation examples for further details. + * + * @method Phaser.Animations.AnimationState#generateFrameNames + * @since 3.50.0 + * + * @param {string} key - The key for the texture containing the animation frames. + * @param {Phaser.Types.Animations.GenerateFrameNames} [config] - The configuration object for the animation frame names. + * + * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. + */ + generateFrameNames: function (key, config) + { + return this.animationManager.generateFrameNames(key, config); + }, + + /** + * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. + * + * Generates objects with numbered frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNumbers}. + * + * If you're working with a texture atlas, see the `generateFrameNames` method instead. + * + * It's a helper method, designed to make it easier for you to extract frames from sprite sheets. + * If you're working with a texture atlas, see the `generateFrameNames` method instead. + * + * Example: + * + * If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using: + * `this.anims.generateFrameNumbers('explosion', { start: 0, end: 12 })`. + * + * The `end` value tells it to stop after 12 frames. To create an animation using this method, you can do: + * + * ```javascript + * this.anims.create({ + * key: 'boom', + * frames: this.anims.generateFrameNames('explosion', { + * start: 0, + * end: 12 + * }) + * }); + * ``` + * + * Note that `start` is optional and you don't need to include it if the animation starts from frame 0. + * + * To specify an animation in reverse, swap the `start` and `end` values. + * + * If the frames are not sequential, you may pass an array of frame numbers instead, for example: + * + * `this.anims.generateFrameNumbers('explosion', { frames: [ 0, 1, 2, 1, 2, 3, 4, 0, 1, 2 ] })` + * + * Please see the animation examples and `GenerateFrameNumbers` config docs for further details. + * + * @method Phaser.Animations.AnimationState#generateFrameNumbers + * @since 3.50.0 + * + * @param {string} key - The key for the texture containing the animation frames. + * @param {Phaser.Types.Animations.GenerateFrameNumbers} config - The configuration object for the animation frames. + * + * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. + */ + generateFrameNumbers: function (key, config) + { + return this.animationManager.generateFrameNumbers(key, config); + }, + /** * Removes a locally created Animation from this Sprite, based on the given key. * @@ -35124,8 +37822,570 @@ module.exports = AnimationState; /***/ }), -/* 158 */, -/* 159 */ +/* 158 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var GetFastValue = __webpack_require__(2); +var ShaderSourceFS = __webpack_require__(860); +var ShaderSourceVS = __webpack_require__(861); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); + +/** + * @classdesc + * + * The Multi Pipeline is the core 2D texture rendering pipeline used by Phaser in WebGL. + * Virtually all Game Objects use this pipeline by default, including Sprites, Graphics + * and Tilemaps. It handles the batching of quads and tris, as well as methods for + * drawing and batching geometry data. + * + * Prior to Phaser v3.50 this pipeline was called the `TextureTintPipeline`. + * + * In previous versions of Phaser only one single texture unit was supported at any one time. + * The Multi Pipeline is an evolution of the old Texture Tint Pipeline, updated to support + * multi-textures for increased performance. + * + * The fragment shader it uses can be found in `shaders/src/Multi.frag`. + * The vertex shader it uses can be found in `shaders/src/Multi.vert`. + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * `inTexId` (float, offset 16) + * `inTintEffect` (float, offset 20) + * `inTint` (vec4, offset 24, normalized) + * + * The default shader uniforms for this pipeline are: + * + * `uProjectionMatrix` (mat4) + * `uMainSampler` (sampler2D array) + * + * If you wish to create a custom pipeline extending from this one, you can use two string + * declarations in your fragment shader source: `%count%` and `%forloop%`, where `count` is + * used to set the number of `sampler2Ds` available, and `forloop` is a block of GLSL code + * that will get the currently bound texture unit. + * + * This pipeline will automatically inject that code for you, should those values exist + * in your shader source. If you wish to handle this yourself, you can also use the + * function `Utils.parseFragmentShaderMaxTextures`. + * + * If you wish to create a pipeline that works from a single texture, or that doesn't have + * internal texture iteration, please see the `SinglePipeline` instead. + * + * @class MultiPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + */ +var MultiPipeline = new Class({ + + Extends: WebGLPipeline, + + initialize: + + function MultiPipeline (config) + { + var renderer = config.game.renderer; + + var fragmentShaderSource = GetFastValue(config, 'fragShader', ShaderSourceFS); + + config.fragShader = Utils.parseFragmentShaderMaxTextures(fragmentShaderSource, renderer.maxTextures); + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTexCoord', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTexId', + size: 1, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTintEffect', + size: 1, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTint', + size: 4, + type: WEBGL_CONST.UNSIGNED_BYTE, + normalized: true + } + ]); + config.uniforms = GetFastValue(config, 'uniforms', [ + 'uProjectionMatrix', + 'uMainSampler' + ]); + + WebGLPipeline.call(this, config); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix1 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this._tempMatrix1 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix2 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this._tempMatrix2 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix3 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this._tempMatrix3 = new TransformMatrix(); + }, + + /** + * Called every time the pipeline is bound by the renderer. + * Sets the shader program, vertex buffer and other resources. + * Should only be called when changing pipeline. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#bind + * @since 3.50.0 + * + * @return {this} This WebGLPipeline instance. + */ + boot: function () + { + WebGLPipeline.prototype.boot.call(this); + + this.currentShader.set1iv('uMainSampler', this.renderer.textureIndexes); + }, + + /** + * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchSprite + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} gameObject - The texture based Game Object to add to the batch. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. + */ + batchSprite: function (gameObject, camera, parentTransformMatrix) + { + this.manager.set(this, gameObject); + + var camMatrix = this._tempMatrix1; + var spriteMatrix = this._tempMatrix2; + var calcMatrix = this._tempMatrix3; + + var frame = gameObject.frame; + var texture = frame.glTexture; + + var u0 = frame.u0; + var v0 = frame.v0; + var u1 = frame.u1; + var v1 = frame.v1; + var frameX = frame.x; + var frameY = frame.y; + var frameWidth = frame.cutWidth; + var frameHeight = frame.cutHeight; + var customPivot = frame.customPivot; + + var displayOriginX = gameObject.displayOriginX; + var displayOriginY = gameObject.displayOriginY; + + var x = -displayOriginX + frameX; + var y = -displayOriginY + frameY; + + if (gameObject.isCropped) + { + var crop = gameObject._crop; + + if (crop.flipX !== gameObject.flipX || crop.flipY !== gameObject.flipY) + { + frame.updateCropUVs(crop, gameObject.flipX, gameObject.flipY); + } + + u0 = crop.u0; + v0 = crop.v0; + u1 = crop.u1; + v1 = crop.v1; + + frameWidth = crop.width; + frameHeight = crop.height; + + frameX = crop.x; + frameY = crop.y; + + x = -displayOriginX + frameX; + y = -displayOriginY + frameY; + } + + var flipX = 1; + var flipY = 1; + + if (gameObject.flipX) + { + if (!customPivot) + { + x += (-frame.realWidth + (displayOriginX * 2)); + } + + flipX = -1; + } + + // Auto-invert the flipY if this is coming from a GLTexture + + if (gameObject.flipY || (frame.source.isGLTexture && !texture.flipY)) + { + if (!customPivot) + { + y += (-frame.realHeight + (displayOriginY * 2)); + } + + flipY = -1; + } + + spriteMatrix.applyITRS(gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX * flipX, gameObject.scaleY * flipY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * gameObject.scrollFactorX, -camera.scrollY * gameObject.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = gameObject.x; + spriteMatrix.f = gameObject.y; + } + else + { + spriteMatrix.e -= camera.scrollX * gameObject.scrollFactorX; + spriteMatrix.f -= camera.scrollY * gameObject.scrollFactorY; + } + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + + var xw = x + frameWidth; + var yh = y + frameHeight; + + var roundPixels = camera.roundPixels; + + var tx0 = calcMatrix.getXRound(x, y, roundPixels); + var ty0 = calcMatrix.getYRound(x, y, roundPixels); + + var tx1 = calcMatrix.getXRound(x, yh, roundPixels); + var ty1 = calcMatrix.getYRound(x, yh, roundPixels); + + var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); + var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); + + var tx3 = calcMatrix.getXRound(xw, y, roundPixels); + var ty3 = calcMatrix.getYRound(xw, y, roundPixels); + + var getTint = Utils.getTintAppendFloatAlpha; + var cameraAlpha = camera.alpha; + + var tintTL = getTint(gameObject.tintTopLeft, cameraAlpha * gameObject._alphaTL); + var tintTR = getTint(gameObject.tintTopRight, cameraAlpha * gameObject._alphaTR); + var tintBL = getTint(gameObject.tintBottomLeft, cameraAlpha * gameObject._alphaBL); + var tintBR = getTint(gameObject.tintBottomRight, cameraAlpha * gameObject._alphaBR); + + if (this.shouldFlush(6)) + { + this.flush(); + } + + var unit = this.setGameObject(gameObject, frame); + + this.manager.preBatch(gameObject); + + this.batchQuad(gameObject, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, gameObject.tintEffect, texture, unit); + + this.manager.postBatch(gameObject); + }, + + /** + * Generic function for batching a textured quad using argument values instead of a Game Object. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTexture + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject. + * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad. + * @param {number} textureWidth - Real texture width. + * @param {number} textureHeight - Real texture height. + * @param {number} srcX - X coordinate of the quad. + * @param {number} srcY - Y coordinate of the quad. + * @param {number} srcWidth - Width of the quad. + * @param {number} srcHeight - Height of the quad. + * @param {number} scaleX - X component of scale. + * @param {number} scaleY - Y component of scale. + * @param {number} rotation - Rotation of the quad. + * @param {boolean} flipX - Indicates if the quad is horizontally flipped. + * @param {boolean} flipY - Indicates if the quad is vertically flipped. + * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll. + * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll. + * @param {number} displayOriginX - Horizontal origin in pixels. + * @param {number} displayOriginY - Vertical origin in pixels. + * @param {number} frameX - X coordinate of the texture frame. + * @param {number} frameY - Y coordinate of the texture frame. + * @param {number} frameWidth - Width of the texture frame. + * @param {number} frameHeight - Height of the texture frame. + * @param {number} tintTL - Tint for top left. + * @param {number} tintTR - Tint for top right. + * @param {number} tintBL - Tint for bottom left. + * @param {number} tintBR - Tint for bottom right. + * @param {number} tintEffect - The tint effect. + * @param {number} uOffset - Horizontal offset on texture coordinate. + * @param {number} vOffset - Vertical offset on texture coordinate. + * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container. + * @param {boolean} [skipFlip=false] - Skip the renderTexture check. + * @param {number} [textureUnit] - Use the currently bound texture unit? + */ + batchTexture: function ( + gameObject, + texture, + textureWidth, textureHeight, + srcX, srcY, + srcWidth, srcHeight, + scaleX, scaleY, + rotation, + flipX, flipY, + scrollFactorX, scrollFactorY, + displayOriginX, displayOriginY, + frameX, frameY, frameWidth, frameHeight, + tintTL, tintTR, tintBL, tintBR, tintEffect, + uOffset, vOffset, + camera, + parentTransformMatrix, + skipFlip, + textureUnit) + { + this.manager.set(this, gameObject); + + var camMatrix = this._tempMatrix1; + var spriteMatrix = this._tempMatrix2; + var calcMatrix = this._tempMatrix3; + + var u0 = (frameX / textureWidth) + uOffset; + var v0 = (frameY / textureHeight) + vOffset; + var u1 = (frameX + frameWidth) / textureWidth + uOffset; + var v1 = (frameY + frameHeight) / textureHeight + vOffset; + + var width = srcWidth; + var height = srcHeight; + + var x = -displayOriginX; + var y = -displayOriginY; + + if (gameObject.isCropped) + { + var crop = gameObject._crop; + + var cropWidth = crop.width; + var cropHeight = crop.height; + + width = cropWidth; + height = cropHeight; + + srcWidth = cropWidth; + srcHeight = cropHeight; + + frameX = crop.x; + frameY = crop.y; + + var ox = frameX; + var oy = frameY; + + if (flipX) + { + ox = (frameWidth - crop.x - cropWidth); + } + + if (flipY) + { + oy = (frameHeight - crop.y - cropHeight); + } + + u0 = (ox / textureWidth) + uOffset; + v0 = (oy / textureHeight) + vOffset; + u1 = (ox + cropWidth) / textureWidth + uOffset; + v1 = (oy + cropHeight) / textureHeight + vOffset; + + x = -displayOriginX + frameX; + y = -displayOriginY + frameY; + } + + // Invert the flipY if this is a RenderTexture + flipY = flipY ^ (!skipFlip && texture.isRenderTexture ? 1 : 0); + + if (flipX) + { + width *= -1; + x += srcWidth; + } + + if (flipY) + { + height *= -1; + y += srcHeight; + } + + var xw = x + width; + var yh = y + height; + + spriteMatrix.applyITRS(srcX, srcY, rotation, scaleX, scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = srcX; + spriteMatrix.f = srcY; + } + else + { + spriteMatrix.e -= camera.scrollX * scrollFactorX; + spriteMatrix.f -= camera.scrollY * scrollFactorY; + } + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + + var roundPixels = camera.roundPixels; + + var tx0 = calcMatrix.getXRound(x, y, roundPixels); + var ty0 = calcMatrix.getYRound(x, y, roundPixels); + + var tx1 = calcMatrix.getXRound(x, yh, roundPixels); + var ty1 = calcMatrix.getYRound(x, yh, roundPixels); + + var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); + var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); + + var tx3 = calcMatrix.getXRound(xw, y, roundPixels); + var ty3 = calcMatrix.getYRound(xw, y, roundPixels); + + if (textureUnit === undefined) + { + textureUnit = this.renderer.setTexture2D(texture); + } + + if (gameObject) + { + this.manager.preBatch(gameObject); + } + + this.batchQuad(gameObject, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); + + if (gameObject) + { + this.manager.postBatch(gameObject); + } + }, + + /** + * Adds a Texture Frame into the batch for rendering. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTextureFrame + * @since 3.12.0 + * + * @param {Phaser.Textures.Frame} frame - The Texture Frame to be rendered. + * @param {number} x - The horizontal position to render the texture at. + * @param {number} y - The vertical position to render the texture at. + * @param {number} tint - The tint color. + * @param {number} alpha - The alpha value. + * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - The Transform Matrix to use for the texture. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - A parent Transform Matrix. + */ + batchTextureFrame: function ( + frame, + x, y, + tint, alpha, + transformMatrix, + parentTransformMatrix + ) + { + this.manager.set(this); + + var spriteMatrix = this._tempMatrix1.copyFrom(transformMatrix); + var calcMatrix = this._tempMatrix2; + + var xw = x + frame.width; + var yh = y + frame.height; + + if (parentTransformMatrix) + { + spriteMatrix.multiply(parentTransformMatrix, calcMatrix); + } + else + { + calcMatrix = spriteMatrix; + } + + var tx0 = calcMatrix.getX(x, y); + var ty0 = calcMatrix.getY(x, y); + + var tx1 = calcMatrix.getX(x, yh); + var ty1 = calcMatrix.getY(x, yh); + + var tx2 = calcMatrix.getX(xw, yh); + var ty2 = calcMatrix.getY(xw, yh); + + var tx3 = calcMatrix.getX(xw, y); + var ty3 = calcMatrix.getY(xw, y); + + var unit = this.renderer.setTextureSource(frame.source); + + tint = Utils.getTintAppendFloatAlpha(tint, alpha); + + this.batchQuad(null, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0, frame.glTexture, unit); + } + +}); + +module.exports = MultiPipeline; + + +/***/ }), +/* 159 */, +/* 160 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35164,7 +38424,7 @@ module.exports = CircumferencePoint; /***/ }), -/* 160 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35208,7 +38468,7 @@ module.exports = Random; /***/ }), -/* 161 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35217,7 +38477,7 @@ module.exports = Random; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Perimeter = __webpack_require__(118); +var Perimeter = __webpack_require__(126); var Point = __webpack_require__(4); /** @@ -35289,7 +38549,7 @@ module.exports = GetPoint; /***/ }), -/* 162 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35298,7 +38558,7 @@ module.exports = GetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); var Point = __webpack_require__(4); /** @@ -35315,7 +38575,7 @@ var Point = __webpack_require__(4); * @generic {Phaser.Geom.Point[]} O - [out,$return] * * @param {Phaser.Geom.Line} line - The line. - * @param {integer} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. + * @param {number} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. * @param {number} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. * @param {(array|Phaser.Geom.Point[])} [out] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line. * @@ -35354,7 +38614,7 @@ module.exports = GetPoints; /***/ }), -/* 163 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35394,7 +38654,7 @@ module.exports = Random; /***/ }), -/* 164 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35432,7 +38692,7 @@ module.exports = Random; /***/ }), -/* 165 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35441,7 +38701,8 @@ module.exports = Random; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PIPELINE_CONST = __webpack_require__(110); +var DeepCopy = __webpack_require__(167); +var PIPELINE_CONST = __webpack_require__(82); /** * Provides methods used for setting the WebGL rendering pipeline of a Game Object. @@ -35456,6 +38717,8 @@ var Pipeline = { /** * The initial WebGL pipeline of this Game Object. * + * If you call `resetPipeline` on this Game Object, the pipeline is reset to this default. + * * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline * @type {Phaser.Renderer.WebGL.WebGLPipeline} * @default null @@ -35475,61 +38738,251 @@ var Pipeline = { */ pipeline: null, + /** + * Does this Game Object have any Post Pipelines set? + * + * @name Phaser.GameObjects.Components.Pipeline#hasPostPipeline + * @type {boolean} + * @webglOnly + * @since 3.50.0 + */ + hasPostPipeline: false, + + /** + * Does this Game Object manage its Post Pipeline directly? + * + * @name Phaser.GameObjects.Components.Pipeline#manualPostPipeline + * @type {boolean} + * @webglOnly + * @since 3.50.0 + */ + manualPostPipeline: false, + + /** + * The WebGL Post FX Pipelines this Game Object uses for post-render effects. + * + * The pipelines are processed in the order in which they appear in this array. + * + * If you modify this array directly, be sure to set the + * `hasPostPipeline` property accordingly. + * + * @name Phaser.GameObjects.Components.Pipeline#postPipeline + * @type {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[]} + * @webglOnly + * @since 3.50.0 + */ + postPipelines: null, + + /** + * An object to store pipeline specific data in, to be read by the pipelines this Game Object uses. + * + * @name Phaser.GameObjects.Components.Pipeline#pipelineData + * @type {object} + * @webglOnly + * @since 3.50.0 + */ + pipelineData: null, + /** * Sets the initial WebGL Pipeline of this Game Object. * - * This should only be called during the instantiation of the Game Object. + * This should only be called during the instantiation of the Game Object. After that, use `setPipeline`. * * @method Phaser.GameObjects.Components.Pipeline#initPipeline * @webglOnly * @since 3.0.0 * - * @param {string} [name=MultiPipeline] - The name of the pipeline to set on this Game Object. Defaults to the Multi Pipeline. + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set. * * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. */ - initPipeline: function (name) + initPipeline: function (pipeline) { - if (name === undefined) { name = PIPELINE_CONST.MULTI_PIPELINE; } + if (pipeline === undefined) { pipeline = PIPELINE_CONST.MULTI_PIPELINE; } - var renderer = this.scene.sys.game.renderer; + var renderer = this.scene.sys.renderer; var pipelines = renderer.pipelines; - if (pipelines && pipelines.has(name)) - { - this.defaultPipeline = pipelines.get(name); - this.pipeline = this.defaultPipeline; + this.postPipelines = []; + this.pipelineData = {}; - return true; + if (pipelines) + { + var instance = pipelines.get(pipeline); + + if (instance) + { + this.defaultPipeline = instance; + this.pipeline = instance; + + return true; + } } return false; }, /** - * Sets the active WebGL Pipeline of this Game Object. + * Sets the main WebGL Pipeline of this Game Object. + * + * Also sets the `pipelineData` property, if the parameter is given. + * + * Both the pipeline and post pipelines share the same pipeline data object. * * @method Phaser.GameObjects.Components.Pipeline#setPipeline * @webglOnly * @since 3.0.0 * - * @param {string} name - The name of the pipeline to set on this Game Object. + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set. + * @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object. + * @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. * * @return {this} This Game Object instance. */ - setPipeline: function (name) + setPipeline: function (pipeline, pipelineData, copyData) { - var renderer = this.scene.sys.game.renderer; + var renderer = this.scene.sys.renderer; var pipelines = renderer.pipelines; - if (pipelines && pipelines.has(name)) + if (pipelines) { - this.pipeline = pipelines.get(name); + var instance = pipelines.get(pipeline); + + if (instance) + { + this.pipeline = instance; + } + + if (pipelineData) + { + this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData; + } } return this; }, + /** + * Sets one, or more, Post Pipelines on this Game Object. + * + * Post Pipelines are invoked after this Game Object has rendered to its target and + * are commonly used for post-fx. + * + * The post pipelines are appended to the `postPipelines` array belonging to this + * Game Object. When the renderer processes this Game Object, it iterates through the post + * pipelines in the order in which they appear in the array. If you are stacking together + * multiple effects, be aware that the order is important. + * + * If you call this method multiple times, the new pipelines will be appended to any existing + * post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required. + * + * You can optionally also sets the `pipelineData` property, if the parameter is given. + * + * Both the pipeline and post pipelines share the pipeline data object together. + * + * @method Phaser.GameObjects.Components.Pipeline#setPostPipeline + * @webglOnly + * @since 3.50.0 + * + * @param {(string|string[]|function|function[]|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[])} pipelines - Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them. + * @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object. + * @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. + * + * @return {this} This Game Object instance. + */ + setPostPipeline: function (pipelines, pipelineData, copyData) + { + var renderer = this.scene.sys.renderer; + var pipelineManager = renderer.pipelines; + + if (pipelineManager) + { + if (!Array.isArray(pipelines)) + { + pipelines = [ pipelines ]; + } + + for (var i = 0; i < pipelines.length; i++) + { + var instance = pipelineManager.getPostPipeline(pipelines[i], this); + + if (instance) + { + this.postPipelines.push(instance); + } + } + + if (pipelineData) + { + this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData; + } + } + + this.hasPostPipeline = (this.postPipelines.length > 0); + + return this; + }, + + /** + * Adds an entry to the `pipelineData` object belonging to this Game Object. + * + * If the 'key' already exists, its value is updated. If it doesn't exist, it is created. + * + * If `value` is undefined, and `key` exists, `key` is removed from the data object. + * + * Both the pipeline and post pipelines share the pipeline data object together. + * + * @method Phaser.GameObjects.Components.Pipeline#setPipelineData + * @webglOnly + * @since 3.50.0 + * + * @param {string} key - The key of the pipeline data to set, update, or delete. + * @param {any} [value] - The value to be set with the key. If `undefined` then `key` will be deleted from the object. + * + * @return {this} This Game Object instance. + */ + setPipelineData: function (key, value) + { + var data = this.pipelineData; + + if (value === undefined) + { + delete data[key]; + } + else + { + data[key] = value; + } + + return this; + }, + + /** + * Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it. + * + * @method Phaser.GameObjects.Components.Pipeline#getPostPipeline + * @webglOnly + * @since 3.50.0 + * + * @param {string} name - The name of the Post Pipeline to get. + * + * @return {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} The first Post Pipeline matching the name, or undefined if no match. + */ + getPostPipeline: function (pipeline) + { + var pipelines = this.postPipelines; + + for (var i = 0; i < pipelines.length; i++) + { + var instance = pipelines[i]; + + if ((typeof pipeline === 'string' && instance.name === name) || instance instanceof pipeline) + { + return instance; + } + } + }, + /** * Resets the WebGL Pipeline of this Game Object back to the default it was created with. * @@ -35537,15 +38990,62 @@ var Pipeline = { * @webglOnly * @since 3.0.0 * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. + * @param {boolean} [resetPostPipelines=false] - Reset all of the post pipelines? + * @param {boolean} [resetData=false] - Reset the `pipelineData` object to being an empty object? + * + * @return {boolean} `true` if the pipeline was reset successfully, otherwise `false`. */ - resetPipeline: function () + resetPipeline: function (resetPostPipelines, resetData) { + if (resetPostPipelines === undefined) { resetPostPipelines = false; } + if (resetData === undefined) { resetData = false; } + this.pipeline = this.defaultPipeline; + if (resetPostPipelines) + { + this.postPipelines = []; + this.hasPostPipeline = false; + } + + if (resetData) + { + this.pipelineData = {}; + } + return (this.pipeline !== null); }, + /** + * Resets the WebGL Post Pipelines of this Game Object. It does this by calling + * the `destroy` method on each post pipeline and then clearing the local array. + * + * @method Phaser.GameObjects.Components.Pipeline#resetPostPipeline + * @webglOnly + * @since 3.50.0 + * + * @param {boolean} [resetData=false] - Reset the `pipelineData` object to being an empty object? + */ + resetPostPipeline: function (resetData) + { + if (resetData === undefined) { resetData = false; } + + var pipelines = this.postPipelines; + + for (var i = 0; i < pipelines.length; i++) + { + pipelines[i].destroy(); + } + + this.postPipelines = []; + this.hasPostPipeline = false; + + if (resetData) + { + this.pipelineData = {}; + } + }, + /** * Gets the name of the WebGL Pipeline this Game Object is currently using. * @@ -35566,7 +39066,117 @@ module.exports = Pipeline; /***/ }), -/* 166 */ +/* 167 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Deep Copy the given object or array. + * + * @function Phaser.Utils.Objects.DeepCopy + * @since 3.50.0 + * + * @param {object} obj - The object to deep copy. + * + * @return {object} A deep copy of the original object. + */ +var DeepCopy = function (inObject) +{ + var outObject; + var value; + var key; + + if (typeof inObject !== 'object' || inObject === null) + { + // inObject is not an object + return inObject; + } + + // Create an array or object to hold the values + outObject = Array.isArray(inObject) ? [] : {}; + + for (key in inObject) + { + value = inObject[key]; + + // Recursively (deep) copy for nested objects, including arrays + outObject[key] = DeepCopy(value); + } + + return outObject; +}; + +module.exports = DeepCopy; + + +/***/ }), +/* 168 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Build a JSON representation of the given Game Object. + * + * This is typically extended further by Game Object specific implementations. + * + * @method Phaser.GameObjects.Components.ToJSON + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON. + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. + */ +var ToJSON = function (gameObject) +{ + var out = { + name: gameObject.name, + type: gameObject.type, + x: gameObject.x, + y: gameObject.y, + depth: gameObject.depth, + scale: { + x: gameObject.scaleX, + y: gameObject.scaleY + }, + origin: { + x: gameObject.originX, + y: gameObject.originY + }, + flipX: gameObject.flipX, + flipY: gameObject.flipY, + rotation: gameObject.rotation, + alpha: gameObject.alpha, + visible: gameObject.visible, + blendMode: gameObject.blendMode, + textureKey: '', + frameKey: '', + data: {} + }; + + if (gameObject.texture) + { + out.textureKey = gameObject.texture.key; + out.frameKey = gameObject.frame.name; + } + + return out; +}; + +module.exports = ToJSON; + + +/***/ }), +/* 169 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35621,7 +39231,87 @@ module.exports = TransformXY; /***/ }), -/* 167 */ +/* 170 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Moves the element at the start of the array to the end, shifting all items in the process. + * The "rotation" happens to the left. + * + * @function Phaser.Utils.Array.RotateLeft + * @since 3.0.0 + * + * @param {array} array - The array to shift to the left. This array is modified in place. + * @param {number} [total=1] - The number of times to shift the array. + * + * @return {*} The most recently shifted element. + */ +var RotateLeft = function (array, total) +{ + if (total === undefined) { total = 1; } + + var element = null; + + for (var i = 0; i < total; i++) + { + element = array.shift(); + array.push(element); + } + + return element; +}; + +module.exports = RotateLeft; + + +/***/ }), +/* 171 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Moves the element at the end of the array to the start, shifting all items in the process. + * The "rotation" happens to the right. + * + * @function Phaser.Utils.Array.RotateRight + * @since 3.0.0 + * + * @param {array} array - The array to shift to the right. This array is modified in place. + * @param {number} [total=1] - The number of times to shift the array. + * + * @return {*} The most recently shifted element. + */ +var RotateRight = function (array, total) +{ + if (total === undefined) { total = 1; } + + var element = null; + + for (var i = 0; i < total; i++) + { + element = array.pop(); + array.unshift(element); + } + + return element; +}; + +module.exports = RotateRight; + + +/***/ }), +/* 172 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35662,7 +39352,7 @@ module.exports = Random; /***/ }), -/* 168 */ +/* 173 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35718,7 +39408,7 @@ module.exports = Random; /***/ }), -/* 169 */ +/* 174 */ /***/ (function(module, exports) { /** @@ -35759,7 +39449,7 @@ module.exports = RotateAroundDistance; /***/ }), -/* 170 */ +/* 175 */ /***/ (function(module, exports) { /** @@ -35798,7 +39488,7 @@ module.exports = SmootherStep; /***/ }), -/* 171 */ +/* 176 */ /***/ (function(module, exports) { /** @@ -35845,7 +39535,7 @@ module.exports = SmoothStep; /***/ }), -/* 172 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35854,13 +39544,13 @@ module.exports = SmoothStep; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(122); -var FindClosestInSorted = __webpack_require__(298); -var Frame = __webpack_require__(299); +var Events = __webpack_require__(128); +var FindClosestInSorted = __webpack_require__(310); +var Frame = __webpack_require__(311); var GetValue = __webpack_require__(6); -var SortByDigits = __webpack_require__(300); +var SortByDigits = __webpack_require__(312); /** * @classdesc @@ -35938,7 +39628,7 @@ var Animation = new Class({ * The frame rate of playback in frames per second (default 24 if duration is null) * * @name Phaser.Animations.Animation#frameRate - * @type {integer} + * @type {number} * @default 24 * @since 3.0.0 */ @@ -35950,7 +39640,7 @@ var Animation = new Class({ * otherwise the `frameRate` is derived from `duration`. * * @name Phaser.Animations.Animation#duration - * @type {integer} + * @type {number} * @since 3.0.0 */ this.duration = GetValue(config, 'duration', null); @@ -35959,7 +39649,7 @@ var Animation = new Class({ * How many ms per frame, not including frame specific modifiers. * * @name Phaser.Animations.Animation#msPerFrame - * @type {integer} + * @type {number} * @since 3.0.0 */ this.msPerFrame; @@ -35978,7 +39668,7 @@ var Animation = new Class({ * The delay in ms before the playback will begin. * * @name Phaser.Animations.Animation#delay - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -35988,7 +39678,7 @@ var Animation = new Class({ * Number of times to repeat the animation. Set to -1 to repeat forever. * * @name Phaser.Animations.Animation#repeat - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -35998,7 +39688,7 @@ var Animation = new Class({ * The delay in ms before the a repeat play starts. * * @name Phaser.Animations.Animation#repeatDelay - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -36072,7 +39762,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#calculateDuration * @since 3.50.0 * - * @param {(Phaser.Animations.Animation|Phaser.GameObjects.Components.Animation)} target - The target to set the values on. + * @param {Phaser.Animations.Animation} target - The target to set the values on. * @param {number} totalFrames - The total number of frames in the animation. * @param {number} duration - The duration to calculate the frame rate from. * @param {number} frameRate - The frame ate to calculate the duration from. @@ -36126,7 +39816,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#addFrameAt * @since 3.0.0 * - * @param {integer} index - The index to insert the frame at within the animation. + * @param {number} index - The index to insert the frame at within the animation. * @param {(string|Phaser.Types.Animations.AnimationFrame[])} config - Either a string, in which case it will use all frames from a texture with the matching key, or an array of Animation Frame configuration objects. * * @return {this} This Animation object. @@ -36165,7 +39855,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#checkFrame * @since 3.0.0 * - * @param {integer} index - The index to be checked. + * @param {number} index - The index to be checked. * * @return {boolean} `true` if the index is valid, otherwise `false`. */ @@ -36182,14 +39872,14 @@ var Animation = new Class({ * @protected * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component belonging to the Game Object invoking this call. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - getFirstTick: function (component) + getFirstTick: function (state) { // When is the first update due? - component.accumulator = 0; + state.accumulator = 0; - component.nextTick = component.msPerFrame + component.currentFrame.duration; + state.nextTick = state.msPerFrame + state.currentFrame.duration; }, /** @@ -36199,7 +39889,7 @@ var Animation = new Class({ * @protected * @since 3.0.0 * - * @param {integer} index - The index in the AnimationFrame array + * @param {number} index - The index in the AnimationFrame array * * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence */ @@ -36323,13 +40013,13 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#getNextTick * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component belonging to the Game Object invoking this call. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - getNextTick: function (component) + getNextTick: function (state) { - component.accumulator -= component.nextTick; + state.accumulator -= state.nextTick; - component.nextTick = component.msPerFrame + component.currentFrame.duration; + state.nextTick = state.msPerFrame + state.currentFrame.duration; }, /** @@ -36355,42 +40045,42 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#nextFrame * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + * @param {Phaser.Animations.AnimationState} state - The Animation State to advance. */ - nextFrame: function (component) + nextFrame: function (state) { - var frame = component.currentFrame; + var frame = state.currentFrame; if (frame.isLast) { // We're at the end of the animation // Yoyo? (happens before repeat) - if (component.yoyo) + if (state.yoyo) { - this.handleYoyoFrame(component, false); + this.handleYoyoFrame(state, false); } - else if (component.repeatCounter > 0) + else if (state.repeatCounter > 0) { // Repeat (happens before complete) - if (component.inReverse && component.forward) + if (state.inReverse && state.forward) { - component.forward = false; + state.forward = false; } else { - this.repeatAnimation(component); + this.repeatAnimation(state); } } else { - component.complete(); + state.complete(); } } else { - this.updateAndGetNextTick(component, frame.nextFrame); + this.updateAndGetNextTick(state, frame.nextFrame); } }, @@ -36401,37 +40091,37 @@ var Animation = new Class({ * @private * @since 3.12.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + * @param {Phaser.Animations.AnimationState} state - The Animation State to advance. * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) */ - handleYoyoFrame: function (component, isReverse) + handleYoyoFrame: function (state, isReverse) { if (!isReverse) { isReverse = false; } - if (component.inReverse === !isReverse && component.repeatCounter > 0) + if (state.inReverse === !isReverse && state.repeatCounter > 0) { - if (component.repeatDelay === 0 || component.pendingRepeat) + if (state.repeatDelay === 0 || state.pendingRepeat) { - component.forward = isReverse; + state.forward = isReverse; } - this.repeatAnimation(component); + this.repeatAnimation(state); return; } - if (component.inReverse !== isReverse && component.repeatCounter === 0) + if (state.inReverse !== isReverse && state.repeatCounter === 0) { - component.complete(); + state.complete(); return; } - component.forward = isReverse; + state.forward = isReverse; - var frame = (isReverse) ? component.currentFrame.nextFrame : component.currentFrame.prevFrame; + var frame = (isReverse) ? state.currentFrame.nextFrame : state.currentFrame.prevFrame; - this.updateAndGetNextTick(component, frame); + this.updateAndGetNextTick(state, frame); }, /** @@ -36440,7 +40130,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#getLastFrame * @since 3.12.0 * - * @return {Phaser.Animations.AnimationFrame} component - The Animation Last Frame. + * @return {Phaser.Animations.AnimationFrame} The last Animation Frame. */ getLastFrame: function () { @@ -36454,41 +40144,41 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#previousFrame * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component belonging to the Game Object invoking this call. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - previousFrame: function (component) + previousFrame: function (state) { - var frame = component.currentFrame; + var frame = state.currentFrame; if (frame.isFirst) { // We're at the start of the animation - if (component.yoyo) + if (state.yoyo) { - this.handleYoyoFrame(component, true); + this.handleYoyoFrame(state, true); } - else if (component.repeatCounter > 0) + else if (state.repeatCounter > 0) { - if (component.inReverse && !component.forward) + if (state.inReverse && !state.forward) { - this.repeatAnimation(component); + this.repeatAnimation(state); } else { // Repeat (happens before complete) - component.forward = true; + state.forward = true; - this.repeatAnimation(component); + this.repeatAnimation(state); } } else { - component.complete(); + state.complete(); } } else { - this.updateAndGetNextTick(component, frame.prevFrame); + this.updateAndGetNextTick(state, frame.prevFrame); } }, @@ -36499,13 +40189,14 @@ var Animation = new Class({ * @private * @since 3.12.0 * + * @param {Phaser.Animations.AnimationState} state - The Animation State. * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. */ - updateAndGetNextTick: function (component, frame) + updateAndGetNextTick: function (state, frame) { - component.setCurrentFrame(frame); + state.setCurrentFrame(frame); - this.getNextTick(component); + this.getNextTick(state); }, /** @@ -36538,7 +40229,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#removeFrameAt * @since 3.0.0 * - * @param {integer} index - The index in the AnimationFrame array + * @param {number} index - The index in the AnimationFrame array * * @return {this} This Animation object. */ @@ -36561,46 +40252,46 @@ var Animation = new Class({ * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component belonging to the Game Object invoking this call. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - repeatAnimation: function (component) + repeatAnimation: function (state) { - if (component._pendingStop === 2) + if (state._pendingStop === 2) { - if (component._pendingStopValue === 0) + if (state._pendingStopValue === 0) { - return component.stop(); + return state.stop(); } else { - component._pendingStopValue--; + state._pendingStopValue--; } } - if (component.repeatDelay > 0 && !component.pendingRepeat) + if (state.repeatDelay > 0 && !state.pendingRepeat) { - component.pendingRepeat = true; - component.accumulator -= component.nextTick; - component.nextTick += component.repeatDelay; + state.pendingRepeat = true; + state.accumulator -= state.nextTick; + state.nextTick += state.repeatDelay; } else { - component.repeatCounter--; + state.repeatCounter--; - if (component.forward) + if (state.forward) { - component.setCurrentFrame(component.currentFrame.nextFrame); + state.setCurrentFrame(state.currentFrame.nextFrame); } else { - component.setCurrentFrame(component.currentFrame.prevFrame); + state.setCurrentFrame(state.currentFrame.prevFrame); } - if (component.isPlaying) + if (state.isPlaying) { - this.getNextTick(component); + this.getNextTick(state); - component.handleRepeat(); + state.handleRepeat(); } } }, @@ -36759,7 +40450,7 @@ module.exports = Animation; /***/ }), -/* 173 */ +/* 178 */ /***/ (function(module, exports) { /** @@ -36792,9 +40483,9 @@ module.exports = Animation; * @since 3.0.0 * * @param {string|number|object} str - The target string. `toString()` will be called on the string, which means you can also pass in common data types like numbers. - * @param {integer} [len=0] - The number of characters to be added. + * @param {number} [len=0] - The number of characters to be added. * @param {string} [pad=" "] - The string to pad it out with (defaults to a space). - * @param {integer} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). + * @param {number} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). * * @return {string} The padded string. */ @@ -36835,7 +40526,7 @@ module.exports = Pad; /***/ }), -/* 174 */ +/* 179 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -36844,10 +40535,10 @@ module.exports = Pad; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HexStringToColor = __webpack_require__(307); -var IntegerToColor = __webpack_require__(310); -var ObjectToColor = __webpack_require__(312); -var RGBStringToColor = __webpack_require__(313); +var HexStringToColor = __webpack_require__(319); +var IntegerToColor = __webpack_require__(322); +var ObjectToColor = __webpack_require__(323); +var RGBStringToColor = __webpack_require__(324); /** * Converts the given source color value into an instance of a Color class. @@ -36891,37 +40582,7 @@ module.exports = ValueToColor; /***/ }), -/* 175 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Given 3 separate color values this will return an integer representation of it. - * - * @function Phaser.Display.Color.GetColor - * @since 3.0.0 - * - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * - * @return {number} The combined color value. - */ -var GetColor = function (red, green, blue) -{ - return red << 16 | green << 8 | blue; -}; - -module.exports = GetColor; - - -/***/ }), -/* 176 */ +/* 180 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -36930,7 +40591,7 @@ module.exports = GetColor; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetColor = __webpack_require__(175); +var GetColor = __webpack_require__(100); /** * RGB space conversion. @@ -37002,7 +40663,7 @@ module.exports = HSVToRGB; /***/ }), -/* 177 */ +/* 181 */ /***/ (function(module, exports) { /** @@ -37011,130 +40672,46 @@ module.exports = HSVToRGB; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Browser specific prefix, so not going to change between contexts, only between browsers -var prefix = ''; - /** - * @namespace Phaser.Display.Canvas.Smoothing + * Return the component parts of a color as an Object with the properties alpha, red, green, blue. + * + * Alpha will only be set if it exists in the given color (0xAARRGGBB) + * + * @function Phaser.Display.Color.IntegerToRGB * @since 3.0.0 + * + * @param {number} input - The color value to convert into a Color object. + * + * @return {Phaser.Types.Display.ColorObject} An object with the red, green and blue values set in the r, g and b properties. */ -var Smoothing = function () +var IntegerToRGB = function (color) { - /** - * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. - * - * @function Phaser.Display.Canvas.Smoothing.getPrefix - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The canvas context to check. - * - * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported. - */ - var getPrefix = function (context) + if (color > 16777215) { - var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; - - for (var i = 0; i < vendors.length; i++) - { - var s = vendors[i] + 'mageSmoothingEnabled'; - - if (s in context) - { - return s; - } - } - - return null; - }; - - /** - * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. - * By default browsers have image smoothing enabled, which isn't always what you visually want, especially - * when using pixel art in a game. Note that this sets the property on the context itself, so that any image - * drawn to the context will be affected. This sets the property across all current browsers but support is - * patchy on earlier browsers, especially on mobile. - * - * @function Phaser.Display.Canvas.Smoothing.enable - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to enable smoothing. - * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. - */ - var enable = function (context) + // The color value has an alpha component + return { + a: color >>> 24, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } + else { - if (prefix === '') - { - prefix = getPrefix(context); - } - - if (prefix) - { - context[prefix] = true; - } - - return context; - }; - - /** - * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. - * By default browsers have image smoothing enabled, which isn't always what you visually want, especially - * when using pixel art in a game. Note that this sets the property on the context itself, so that any image - * drawn to the context will be affected. This sets the property across all current browsers but support is - * patchy on earlier browsers, especially on mobile. - * - * @function Phaser.Display.Canvas.Smoothing.disable - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to disable smoothing. - * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. - */ - var disable = function (context) - { - if (prefix === '') - { - prefix = getPrefix(context); - } - - if (prefix) - { - context[prefix] = false; - } - - return context; - }; - - /** - * Returns `true` if the given context has image smoothing enabled, otherwise returns `false`. - * Returns null if no smoothing prefix is available. - * - * @function Phaser.Display.Canvas.Smoothing.isEnabled - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context to check. - * - * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported. - */ - var isEnabled = function (context) - { - return (prefix !== null) ? context[prefix] : null; - }; - - return { - disable: disable, - enable: enable, - getPrefix: getPrefix, - isEnabled: isEnabled - }; - + return { + a: 255, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } }; -module.exports = Smoothing(); +module.exports = IntegerToRGB; /***/ }), -/* 178 */ +/* 182 */ /***/ (function(module, exports) { /** @@ -37171,7 +40748,7 @@ module.exports = CenterOn; /***/ }), -/* 179 */ +/* 183 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37180,9 +40757,9 @@ module.exports = CenterOn; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var OS = __webpack_require__(125); -var Browser = __webpack_require__(126); -var CanvasPool = __webpack_require__(26); +var OS = __webpack_require__(102); +var Browser = __webpack_require__(131); +var CanvasPool = __webpack_require__(31); /** * Determines the features of the browser running this Phaser Game instance. @@ -37363,7 +40940,139 @@ module.exports = init(); /***/ }), -/* 180 */ +/* 184 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Browser specific prefix, so not going to change between contexts, only between browsers +var prefix = ''; + +/** + * @namespace Phaser.Display.Canvas.Smoothing + * @since 3.0.0 + */ +var Smoothing = function () +{ + /** + * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. + * + * @function Phaser.Display.Canvas.Smoothing.getPrefix + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The canvas context to check. + * + * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported. + */ + var getPrefix = function (context) + { + var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; + + for (var i = 0; i < vendors.length; i++) + { + var s = vendors[i] + 'mageSmoothingEnabled'; + + if (s in context) + { + return s; + } + } + + return null; + }; + + /** + * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. + * By default browsers have image smoothing enabled, which isn't always what you visually want, especially + * when using pixel art in a game. Note that this sets the property on the context itself, so that any image + * drawn to the context will be affected. This sets the property across all current browsers but support is + * patchy on earlier browsers, especially on mobile. + * + * @function Phaser.Display.Canvas.Smoothing.enable + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to enable smoothing. + * + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + */ + var enable = function (context) + { + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = true; + } + + return context; + }; + + /** + * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. + * By default browsers have image smoothing enabled, which isn't always what you visually want, especially + * when using pixel art in a game. Note that this sets the property on the context itself, so that any image + * drawn to the context will be affected. This sets the property across all current browsers but support is + * patchy on earlier browsers, especially on mobile. + * + * @function Phaser.Display.Canvas.Smoothing.disable + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to disable smoothing. + * + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + */ + var disable = function (context) + { + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = false; + } + + return context; + }; + + /** + * Returns `true` if the given context has image smoothing enabled, otherwise returns `false`. + * Returns null if no smoothing prefix is available. + * + * @function Phaser.Display.Canvas.Smoothing.isEnabled + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context to check. + * + * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported. + */ + var isEnabled = function (context) + { + return (prefix !== null) ? context[prefix] : null; + }; + + return { + disable: disable, + enable: enable, + getPrefix: getPrefix, + isEnabled: isEnabled + }; + +}; + +module.exports = Smoothing(); + + +/***/ }), +/* 185 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37373,7 +41082,7 @@ module.exports = init(); */ var CONST = __webpack_require__(13); -var Extend = __webpack_require__(19); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Math @@ -37382,63 +41091,64 @@ var Extend = __webpack_require__(19); var PhaserMath = { // Collections of functions - Angle: __webpack_require__(760), - Distance: __webpack_require__(769), - Easing: __webpack_require__(774), - Fuzzy: __webpack_require__(775), - Interpolation: __webpack_require__(778), - Pow2: __webpack_require__(783), - Snap: __webpack_require__(785), + Angle: __webpack_require__(801), + Distance: __webpack_require__(810), + Easing: __webpack_require__(815), + Fuzzy: __webpack_require__(816), + Interpolation: __webpack_require__(819), + Pow2: __webpack_require__(824), + Snap: __webpack_require__(826), // Expose the RNG Class - RandomDataGenerator: __webpack_require__(787), + RandomDataGenerator: __webpack_require__(828), // Single functions - Average: __webpack_require__(788), - Bernstein: __webpack_require__(337), - Between: __webpack_require__(182), - CatmullRom: __webpack_require__(181), - CeilTo: __webpack_require__(789), - Clamp: __webpack_require__(17), - DegToRad: __webpack_require__(41), - Difference: __webpack_require__(790), - Factorial: __webpack_require__(338), - FloatBetween: __webpack_require__(127), - FloorTo: __webpack_require__(791), - FromPercent: __webpack_require__(89), - GetSpeed: __webpack_require__(792), - IsEven: __webpack_require__(793), - IsEvenStrict: __webpack_require__(794), - Linear: __webpack_require__(124), - MaxAdd: __webpack_require__(795), - MinSub: __webpack_require__(796), - Percent: __webpack_require__(797), - RadToDeg: __webpack_require__(183), - RandomXY: __webpack_require__(798), - RandomXYZ: __webpack_require__(799), - RandomXYZW: __webpack_require__(800), - Rotate: __webpack_require__(344), - RotateAround: __webpack_require__(285), - RotateAroundDistance: __webpack_require__(169), - RotateTo: __webpack_require__(801), - RoundAwayFromZero: __webpack_require__(345), - RoundTo: __webpack_require__(802), - SinCosTableGenerator: __webpack_require__(803), - SmootherStep: __webpack_require__(170), - SmoothStep: __webpack_require__(171), - ToXY: __webpack_require__(804), - TransformXY: __webpack_require__(166), - Within: __webpack_require__(805), - Wrap: __webpack_require__(59), + Average: __webpack_require__(829), + Bernstein: __webpack_require__(348), + Between: __webpack_require__(187), + CatmullRom: __webpack_require__(186), + CeilTo: __webpack_require__(830), + Clamp: __webpack_require__(16), + DegToRad: __webpack_require__(34), + Difference: __webpack_require__(831), + Euler: __webpack_require__(832), + Factorial: __webpack_require__(349), + FloatBetween: __webpack_require__(132), + FloorTo: __webpack_require__(833), + FromPercent: __webpack_require__(94), + GetSpeed: __webpack_require__(834), + IsEven: __webpack_require__(835), + IsEvenStrict: __webpack_require__(836), + Linear: __webpack_require__(130), + MaxAdd: __webpack_require__(837), + MinSub: __webpack_require__(838), + Percent: __webpack_require__(839), + RadToDeg: __webpack_require__(188), + RandomXY: __webpack_require__(840), + RandomXYZ: __webpack_require__(841), + RandomXYZW: __webpack_require__(842), + Rotate: __webpack_require__(354), + RotateAround: __webpack_require__(300), + RotateAroundDistance: __webpack_require__(174), + RotateTo: __webpack_require__(843), + RoundAwayFromZero: __webpack_require__(355), + RoundTo: __webpack_require__(844), + SinCosTableGenerator: __webpack_require__(845), + SmootherStep: __webpack_require__(175), + SmoothStep: __webpack_require__(176), + ToXY: __webpack_require__(846), + TransformXY: __webpack_require__(169), + Within: __webpack_require__(847), + Wrap: __webpack_require__(64), // Vector classes Vector2: __webpack_require__(3), - Vector3: __webpack_require__(81), - Vector4: __webpack_require__(129), - Matrix3: __webpack_require__(346), - Matrix4: __webpack_require__(347), - Quaternion: __webpack_require__(348), - RotateVec3: __webpack_require__(806) + Vector3: __webpack_require__(37), + Vector4: __webpack_require__(135), + Matrix3: __webpack_require__(356), + Matrix4: __webpack_require__(73), + Quaternion: __webpack_require__(357), + RotateVec3: __webpack_require__(848) }; @@ -37452,7 +41162,7 @@ module.exports = PhaserMath; /***/ }), -/* 181 */ +/* 186 */ /***/ (function(module, exports) { /** @@ -37489,7 +41199,7 @@ module.exports = CatmullRom; /***/ }), -/* 182 */ +/* 187 */ /***/ (function(module, exports) { /** @@ -37504,10 +41214,10 @@ module.exports = CatmullRom; * @function Phaser.Math.Between * @since 3.0.0 * - * @param {integer} min - The minimum value. - * @param {integer} max - The maximum value. + * @param {number} min - The minimum value. + * @param {number} max - The maximum value. * - * @return {integer} The random integer. + * @return {number} The random integer. */ var Between = function (min, max) { @@ -37518,7 +41228,7 @@ module.exports = Between; /***/ }), -/* 183 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37537,7 +41247,7 @@ var CONST = __webpack_require__(13); * * @param {number} radians - The angle in radians to convert ot degrees. * - * @return {integer} The given angle converted to degrees. + * @return {number} The given angle converted to degrees. */ var RadToDeg = function (radians) { @@ -37548,7 +41258,7 @@ module.exports = RadToDeg; /***/ }), -/* 184 */ +/* 189 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37558,11 +41268,11 @@ module.exports = RadToDeg; */ /** - * @typedef {object} Phaser.Plugins.DefaultPlugins - * - * @property {array} Global - These are the Global Managers that are created by the Phaser.Game instance. - * @property {array} CoreScene - These are the core plugins that are installed into every Scene.Systems instance, no matter what. - * @property {array} DefaultScene - These plugins are created in Scene.Systems in addition to the CoreScenePlugins. + * The Default Plugins. + * + * @namespace Phaser.Plugins.DefaultPlugins + * @memberof Phaser.Plugins + * @since 3.0.0 */ var DefaultPlugins = { @@ -37584,7 +41294,8 @@ var DefaultPlugins = { 'registry', 'scale', 'sound', - 'textures' + 'textures', + 'renderer' ], @@ -37649,8 +41360,8 @@ module.exports = DefaultPlugins; /***/ }), -/* 185 */ -/***/ (function(module, exports) { +/* 190 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -37659,55 +41370,21 @@ module.exports = DefaultPlugins; */ /** - * Translates the model matrix by the given values. - * - * @method Phaser.Renderer.WebGL.MVP.ProjectOrtho - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * @param {number} left - The left value. - * @param {number} right - The right value. - * @param {number} bottom - The bottom value. - * @param {number} top - The top value. - * @param {number} near - The near value. - * @param {number} far - The far value. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. + * @namespace Phaser.Renderer.WebGL.Events */ -var ProjectOrtho = function (model, left, right, bottom, top, near, far) -{ - var projectionMatrix = model.projectionMatrix; - var leftRight = 1 / (left - right); - var bottomTop = 1 / (bottom - top); - var nearFar = 1 / (near - far); - projectionMatrix[0] = -2 * leftRight; - projectionMatrix[1] = 0; - projectionMatrix[2] = 0; - projectionMatrix[3] = 0; - projectionMatrix[4] = 0; - projectionMatrix[5] = -2 * bottomTop; - projectionMatrix[6] = 0; - projectionMatrix[7] = 0; - projectionMatrix[8] = 0; - projectionMatrix[9] = 0; - projectionMatrix[10] = 2 * nearFar; - projectionMatrix[11] = 0; - projectionMatrix[12] = (left + right) * leftRight; - projectionMatrix[13] = (top + bottom) * bottomTop; - projectionMatrix[14] = (far + near) * nearFar; - projectionMatrix[15] = 1; +module.exports = { - model.projectionMatrixDirty = true; + POST_RENDER: __webpack_require__(849), + PRE_RENDER: __webpack_require__(850), + RENDER: __webpack_require__(851), + RESIZE: __webpack_require__(852) - return model; }; -module.exports = ProjectOrtho; - /***/ }), -/* 186 */ +/* 191 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37793,7 +41470,7 @@ module.exports = FromPoints; /***/ }), -/* 187 */ +/* 192 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37804,10 +41481,10 @@ module.exports = FromPoints; var CONST = { - CENTER: __webpack_require__(370), - ORIENTATION: __webpack_require__(371), - SCALE_MODE: __webpack_require__(372), - ZOOM: __webpack_require__(373) + CENTER: __webpack_require__(380), + ORIENTATION: __webpack_require__(381), + SCALE_MODE: __webpack_require__(382), + ZOOM: __webpack_require__(383) }; @@ -37815,7 +41492,7 @@ module.exports = CONST; /***/ }), -/* 188 */ +/* 193 */ /***/ (function(module, exports) { /** @@ -37844,7 +41521,7 @@ module.exports = RemoveFromDOM; /***/ }), -/* 189 */ +/* 194 */ /***/ (function(module, exports) { /** @@ -37859,7 +41536,7 @@ var INPUT_CONST = { * The mouse pointer is being held down. * * @name Phaser.Input.MOUSE_DOWN - * @type {integer} + * @type {number} * @since 3.10.0 */ MOUSE_DOWN: 0, @@ -37868,7 +41545,7 @@ var INPUT_CONST = { * The mouse pointer is being moved. * * @name Phaser.Input.MOUSE_MOVE - * @type {integer} + * @type {number} * @since 3.10.0 */ MOUSE_MOVE: 1, @@ -37877,7 +41554,7 @@ var INPUT_CONST = { * The mouse pointer is released. * * @name Phaser.Input.MOUSE_UP - * @type {integer} + * @type {number} * @since 3.10.0 */ MOUSE_UP: 2, @@ -37886,7 +41563,7 @@ var INPUT_CONST = { * A touch pointer has been started. * * @name Phaser.Input.TOUCH_START - * @type {integer} + * @type {number} * @since 3.10.0 */ TOUCH_START: 3, @@ -37895,7 +41572,7 @@ var INPUT_CONST = { * A touch pointer has been started. * * @name Phaser.Input.TOUCH_MOVE - * @type {integer} + * @type {number} * @since 3.10.0 */ TOUCH_MOVE: 4, @@ -37904,7 +41581,7 @@ var INPUT_CONST = { * A touch pointer has been started. * * @name Phaser.Input.TOUCH_END - * @type {integer} + * @type {number} * @since 3.10.0 */ TOUCH_END: 5, @@ -37913,7 +41590,7 @@ var INPUT_CONST = { * The pointer lock has changed. * * @name Phaser.Input.POINTER_LOCK_CHANGE - * @type {integer} + * @type {number} * @since 3.10.0 */ POINTER_LOCK_CHANGE: 6, @@ -37922,7 +41599,7 @@ var INPUT_CONST = { * A touch pointer has been been cancelled by the browser. * * @name Phaser.Input.TOUCH_CANCEL - * @type {integer} + * @type {number} * @since 3.15.0 */ TOUCH_CANCEL: 7, @@ -37931,7 +41608,7 @@ var INPUT_CONST = { * The mouse wheel changes. * * @name Phaser.Input.MOUSE_WHEEL - * @type {integer} + * @type {number} * @since 3.18.0 */ MOUSE_WHEEL: 8 @@ -37942,7 +41619,7 @@ module.exports = INPUT_CONST; /***/ }), -/* 190 */ +/* 195 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -37952,13 +41629,13 @@ module.exports = INPUT_CONST; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(133); -var DefaultPlugins = __webpack_require__(184); +var CONST = __webpack_require__(139); +var DefaultPlugins = __webpack_require__(189); var Events = __webpack_require__(20); -var GetPhysicsPlugins = __webpack_require__(386); -var GetScenePlugins = __webpack_require__(387); +var GetPhysicsPlugins = __webpack_require__(396); +var GetScenePlugins = __webpack_require__(397); var NOOP = __webpack_require__(1); -var Settings = __webpack_require__(388); +var Settings = __webpack_require__(398); /** * @classdesc @@ -38312,13 +41989,15 @@ var Systems = new Class({ */ step: function (time, delta) { - this.events.emit(Events.PRE_UPDATE, time, delta); + var events = this.events; - this.events.emit(Events.UPDATE, time, delta); + events.emit(Events.PRE_UPDATE, time, delta); + + events.emit(Events.UPDATE, time, delta); this.sceneUpdate.call(this.scene, time, delta); - this.events.emit(Events.POST_UPDATE, time, delta); + events.emit(Events.POST_UPDATE, time, delta); }, /** @@ -38378,13 +42057,16 @@ var Systems = new Class({ */ pause: function (data) { + var events = this.events; + var settings = this.settings; + if (this.settings.active) { - this.settings.status = CONST.PAUSED; + settings.status = CONST.PAUSED; - this.settings.active = false; + settings.active = false; - this.events.emit(Events.PAUSE, this, data); + events.emit(Events.PAUSE, this, data); } return this; @@ -38403,13 +42085,16 @@ var Systems = new Class({ */ resume: function (data) { + var events = this.events; + var settings = this.settings; + if (!this.settings.active) { - this.settings.status = CONST.RUNNING; + settings.status = CONST.RUNNING; - this.settings.active = true; + settings.active = true; - this.events.emit(Events.RESUME, this, data); + events.emit(Events.RESUME, this, data); } return this; @@ -38433,12 +42118,15 @@ var Systems = new Class({ */ sleep: function (data) { - this.settings.status = CONST.SLEEPING; + var events = this.events; + var settings = this.settings; - this.settings.active = false; - this.settings.visible = false; + settings.status = CONST.SLEEPING; - this.events.emit(Events.SLEEP, this, data); + settings.active = false; + settings.visible = false; + + events.emit(Events.SLEEP, this, data); return this; }, @@ -38456,6 +42144,7 @@ var Systems = new Class({ */ wake: function (data) { + var events = this.events; var settings = this.settings; settings.status = CONST.RUNNING; @@ -38463,11 +42152,11 @@ var Systems = new Class({ settings.active = true; settings.visible = true; - this.events.emit(Events.WAKE, this, data); + events.emit(Events.WAKE, this, data); if (settings.isTransition) { - this.events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); + events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); } return this; @@ -38636,21 +42325,24 @@ var Systems = new Class({ */ start: function (data) { + var events = this.events; + var settings = this.settings; + if (data) { - this.settings.data = data; + settings.data = data; } - this.settings.status = CONST.START; + settings.status = CONST.START; - this.settings.active = true; - this.settings.visible = true; + settings.active = true; + settings.visible = true; // For plugins to listen out for - this.events.emit(Events.START, this); + events.emit(Events.START, this); // For user-land code to listen out for - this.events.emit(Events.READY, this, data); + events.emit(Events.READY, this, data); }, /** @@ -38668,17 +42360,20 @@ var Systems = new Class({ */ shutdown: function (data) { - this.events.off(Events.TRANSITION_INIT); - this.events.off(Events.TRANSITION_START); - this.events.off(Events.TRANSITION_COMPLETE); - this.events.off(Events.TRANSITION_OUT); + var events = this.events; + var settings = this.settings; - this.settings.status = CONST.SHUTDOWN; + events.off(Events.TRANSITION_INIT); + events.off(Events.TRANSITION_START); + events.off(Events.TRANSITION_COMPLETE); + events.off(Events.TRANSITION_OUT); - this.settings.active = false; - this.settings.visible = false; + settings.status = CONST.SHUTDOWN; - this.events.emit(Events.SHUTDOWN, this, data); + settings.active = false; + settings.visible = false; + + events.emit(Events.SHUTDOWN, this, data); }, /** @@ -38693,14 +42388,17 @@ var Systems = new Class({ */ destroy: function () { - this.settings.status = CONST.DESTROYED; + var events = this.events; + var settings = this.settings; - this.settings.active = false; - this.settings.visible = false; + settings.status = CONST.DESTROYED; - this.events.emit(Events.DESTROY, this); + settings.active = false; + settings.visible = false; - this.events.removeAllListeners(); + events.emit(Events.DESTROY, this); + + events.removeAllListeners(); var props = [ 'scene', 'game', 'anims', 'cache', 'plugins', 'registry', 'sound', 'textures', 'add', 'camera', 'displayList', 'events', 'make', 'scenePlugin', 'updateList' ]; @@ -38716,7 +42414,7 @@ module.exports = Systems; /***/ }), -/* 191 */ +/* 196 */ /***/ (function(module, exports) { /** @@ -38753,7 +42451,7 @@ module.exports = UppercaseFirst; /***/ }), -/* 192 */ +/* 197 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -38763,8 +42461,8 @@ module.exports = UppercaseFirst; */ var Class = __webpack_require__(0); -var Frame = __webpack_require__(97); -var TextureSource = __webpack_require__(391); +var Frame = __webpack_require__(104); +var TextureSource = __webpack_require__(401); var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; @@ -38774,7 +42472,7 @@ var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; * The Frames represent the different areas of the Texture. For example a texture atlas * may have many Frames, one for each element within the atlas. Where-as a single image would have * just one frame, that encompasses the whole image. - * + * * Every Texture, no matter where it comes from, always has at least 1 frame called the `__BASE` frame. * This frame represents the entirety of the source image. * @@ -38873,12 +42571,12 @@ var Texture = new Class({ /** * The total number of Frames in this Texture, including the `__BASE` frame. - * + * * A Texture will always contain at least 1 frame because every Texture contains a `__BASE` frame by default, * in addition to any extra frames that have been added to it, such as when parsing a Sprite Sheet or Texture Atlas. * * @name Phaser.Textures.Texture#frameTotal - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -38895,14 +42593,14 @@ var Texture = new Class({ * Adds a new Frame to this Texture. * * A Frame is a rectangular region of a TextureSource with a unique index or string-based key. - * + * * The name given must be unique within this Texture. If it already exists, this method will return `null`. * * @method Phaser.Textures.Texture#add * @since 3.0.0 * - * @param {(integer|string)} name - The name of this Frame. The name is unique within the Texture. - * @param {integer} sourceIndex - The index of the TextureSource that this Frame is a part of. + * @param {(number|string)} name - The name of this Frame. The name is unique within the Texture. + * @param {number} sourceIndex - The index of the TextureSource that this Frame is a part of. * @param {number} x - The x coordinate of the top-left of this Frame. * @param {number} y - The y coordinate of the top-left of this Frame. * @param {number} width - The width of this Frame. @@ -38937,7 +42635,7 @@ var Texture = new Class({ /** * Removes the given Frame from this Texture. The Frame is destroyed immediately. - * + * * Any Game Objects using this Frame should stop using it _before_ you remove it, * as it does not happen automatically. * @@ -38989,7 +42687,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#get * @since 3.0.0 * - * @param {(string|integer)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. * * @return {Phaser.Textures.Frame} The Texture Frame. */ @@ -39024,7 +42722,7 @@ var Texture = new Class({ * * @param {Phaser.Textures.TextureSource} source - The TextureSource to check. * - * @return {integer} The index of the TextureSource within this Texture, or -1 if not in this Texture. + * @return {number} The index of the TextureSource within this Texture, or -1 if not in this Texture. */ getTextureSourceIndex: function (source) { @@ -39045,7 +42743,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#getFramesFromTextureSource * @since 3.0.0 * - * @param {integer} sourceIndex - The index of the TextureSource to get the Frames from. + * @param {number} sourceIndex - The index of the TextureSource to get the Frames from. * @param {boolean} [includeBase=false] - Include the `__BASE` Frame in the output array? * * @return {Phaser.Textures.Frame[]} An array of Texture Frames. @@ -39114,7 +42812,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#getSourceImage * @since 3.0.0 * - * @param {(string|integer)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. * * @return {(HTMLImageElement|HTMLCanvasElement|Phaser.GameObjects.RenderTexture)} The DOM Image, Canvas Element or Render Texture. */ @@ -39148,7 +42846,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#getDataSourceImage * @since 3.7.0 * - * @param {(string|integer)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. * * @return {(HTMLImageElement|HTMLCanvasElement)} The DOM Image or Canvas Element. */ @@ -39193,7 +42891,7 @@ var Texture = new Class({ { data = [ data ]; } - + for (var i = 0; i < data.length; i++) { var source = this.source[i]; @@ -39273,7 +42971,7 @@ module.exports = Texture; /***/ }), -/* 193 */ +/* 198 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39282,7 +42980,7 @@ module.exports = Texture; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Returns all elements in the array. @@ -39301,8 +42999,8 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {string} [property] - The property to test on each array element. * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex] - An optional start index to search from. - * @param {integer} [endIndex] - An optional end index to search to. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * * @return {array} All matching elements from the array. */ @@ -39335,7 +43033,7 @@ module.exports = GetAll; /***/ }), -/* 194 */ +/* 199 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39350,46 +43048,46 @@ module.exports = GetAll; module.exports = { - Matrix: __webpack_require__(942), + Matrix: __webpack_require__(998), - Add: __webpack_require__(949), - AddAt: __webpack_require__(950), - BringToTop: __webpack_require__(951), - CountAllMatching: __webpack_require__(952), - Each: __webpack_require__(953), - EachInRange: __webpack_require__(954), - FindClosestInSorted: __webpack_require__(298), - GetAll: __webpack_require__(193), - GetFirst: __webpack_require__(395), - GetRandom: __webpack_require__(196), - MoveDown: __webpack_require__(955), - MoveTo: __webpack_require__(956), - MoveUp: __webpack_require__(957), - NumberArray: __webpack_require__(302), - NumberArrayStep: __webpack_require__(958), - QuickSelect: __webpack_require__(403), - Range: __webpack_require__(404), - Remove: __webpack_require__(96), - RemoveAt: __webpack_require__(959), - RemoveBetween: __webpack_require__(960), - RemoveRandomElement: __webpack_require__(961), - Replace: __webpack_require__(962), - RotateLeft: __webpack_require__(295), - RotateRight: __webpack_require__(296), - SafeRange: __webpack_require__(70), - SendToBack: __webpack_require__(963), - SetAll: __webpack_require__(964), - Shuffle: __webpack_require__(121), - SortByDigits: __webpack_require__(300), - SpliceOne: __webpack_require__(82), - StableSort: __webpack_require__(139), - Swap: __webpack_require__(965) + Add: __webpack_require__(1006), + AddAt: __webpack_require__(1007), + BringToTop: __webpack_require__(1008), + CountAllMatching: __webpack_require__(1009), + Each: __webpack_require__(1010), + EachInRange: __webpack_require__(1011), + FindClosestInSorted: __webpack_require__(310), + GetAll: __webpack_require__(198), + GetFirst: __webpack_require__(405), + GetRandom: __webpack_require__(201), + MoveDown: __webpack_require__(1012), + MoveTo: __webpack_require__(1013), + MoveUp: __webpack_require__(1014), + NumberArray: __webpack_require__(314), + NumberArrayStep: __webpack_require__(1015), + QuickSelect: __webpack_require__(413), + Range: __webpack_require__(414), + Remove: __webpack_require__(87), + RemoveAt: __webpack_require__(1016), + RemoveBetween: __webpack_require__(1017), + RemoveRandomElement: __webpack_require__(1018), + Replace: __webpack_require__(1019), + RotateLeft: __webpack_require__(170), + RotateRight: __webpack_require__(171), + SafeRange: __webpack_require__(77), + SendToBack: __webpack_require__(1020), + SetAll: __webpack_require__(1021), + Shuffle: __webpack_require__(127), + SortByDigits: __webpack_require__(312), + SpliceOne: __webpack_require__(103), + StableSort: __webpack_require__(90), + Swap: __webpack_require__(1022) }; /***/ }), -/* 195 */ +/* 200 */ /***/ (function(module, exports) { /** @@ -39401,22 +43099,23 @@ module.exports = { /** * Checks if an array can be used as a matrix. * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) have the same length. There must be at least two rows: + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: * * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] * ``` * * @function Phaser.Utils.Array.Matrix.CheckMatrix * @since 3.0.0 - * + * * @generic T * @genericUse {T[][]} - [matrix] * @@ -39450,7 +43149,7 @@ module.exports = CheckMatrix; /***/ }), -/* 196 */ +/* 201 */ /***/ (function(module, exports) { /** @@ -39466,8 +43165,8 @@ module.exports = CheckMatrix; * @since 3.0.0 * * @param {array} array - The array to select the random entry from. - * @param {integer} [startIndex=0] - An optional start index. - * @param {integer} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from. + * @param {number} [startIndex=0] - An optional start index. + * @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from. * * @return {*} A random element from the array, or `null` if no element could be found in the range given. */ @@ -39485,7 +43184,7 @@ module.exports = GetRandom; /***/ }), -/* 197 */ +/* 202 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39495,8 +43194,8 @@ module.exports = GetRandom; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(405); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(415); /** * @classdesc @@ -39572,7 +43271,7 @@ var ProcessQueue = new Class({ * The total number of items awaiting processing. * * @name Phaser.Structs.ProcessQueue#_toProcess - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -39754,7 +43453,7 @@ var ProcessQueue = new Class({ * The number of entries in the active list. * * @name Phaser.Structs.ProcessQueue#length - * @type {integer} + * @type {number} * @readonly * @since 3.20.0 */ @@ -39788,7 +43487,7 @@ module.exports = ProcessQueue; /***/ }), -/* 198 */ +/* 203 */ /***/ (function(module, exports) { /** @@ -39807,7 +43506,7 @@ module.exports = ProcessQueue; * @param {Node} node - The XML Node. * @param {string} attribute - The attribute to read. * - * @return {integer} The parsed value. + * @return {number} The parsed value. */ function getValue (node, attribute) { @@ -39823,8 +43522,8 @@ function getValue (node, attribute) * * @param {XMLDocument} xml - The XML Document to parse the font from. * @param {Phaser.Textures.Frame} frame - The texture frame to take into account when creating the uv data. - * @param {integer} [xSpacing=0] - The x-axis spacing to add between each letter. - * @param {integer} [ySpacing=0] - The y-axis spacing to add to the line height. + * @param {number} [xSpacing=0] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing=0] - The y-axis spacing to add to the line height. * @param {Phaser.Textures.Texture} [texture] - If provided, each glyph in the Bitmap Font will be added to this texture as a frame. * * @return {Phaser.Types.GameObjects.BitmapText.BitmapFontData} The parsed Bitmap Font data. @@ -39949,7 +43648,7 @@ module.exports = ParseXMLBitmapFont; /***/ }), -/* 199 */ +/* 204 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39958,19 +43657,19 @@ module.exports = ParseXMLBitmapFont; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlitterRender = __webpack_require__(975); -var Bob = __webpack_require__(407); +var BlitterRender = __webpack_require__(1032); +var Bob = __webpack_require__(417); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Frame = __webpack_require__(97); +var Frame = __webpack_require__(104); var GameObject = __webpack_require__(14); -var List = __webpack_require__(137); +var List = __webpack_require__(105); /** * @callback CreateCallback * * @param {Phaser.GameObjects.Bob} bob - The Bob that was created by the Blitter. - * @param {integer} index - The position of the Bob within the Blitter display list. + * @param {number} index - The position of the Bob within the Blitter display list. */ /** @@ -40010,7 +43709,7 @@ var List = __webpack_require__(137); * @param {number} [x=0] - The x coordinate of this Game Object in world space. * @param {number} [y=0] - The y coordinate of this Game Object in world space. * @param {string} [texture='__DEFAULT'] - The key of the texture this Game Object will use for rendering. The Texture must already exist in the Texture Manager. - * @param {(string|integer)} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet. + * @param {(string|number)} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet. */ var Blitter = new Class({ @@ -40084,9 +43783,9 @@ var Blitter = new Class({ * * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. - * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. * @param {boolean} [visible=true] - Should the created Bob render or not? - * @param {integer} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. + * @param {number} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. * * @return {Phaser.GameObjects.Bob} The newly created Bob object. */ @@ -40120,8 +43819,8 @@ var Blitter = new Class({ * @since 3.0.0 * * @param {CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. - * @param {integer} quantity - The quantity of Bob objects to create. - * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. + * @param {number} quantity - The quantity of Bob objects to create. + * @param {(string|number|Phaser.Textures.Frame|string[]|number[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. @@ -40151,8 +43850,8 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#createMultiple * @since 3.0.0 * - * @param {integer} quantity - The quantity of Bob objects to create. - * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. + * @param {number} quantity - The quantity of Bob objects to create. + * @param {(string|number|Phaser.Textures.Frame|string[]|number[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. @@ -40248,7 +43947,7 @@ module.exports = Blitter; /***/ }), -/* 200 */ +/* 205 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -40258,16 +43957,15 @@ module.exports = Blitter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayUtils = __webpack_require__(194); -var BlendModes = __webpack_require__(54); +var ArrayUtils = __webpack_require__(199); +var BlendModes = __webpack_require__(48); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Events = __webpack_require__(29); +var Events = __webpack_require__(32); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); var Rectangle = __webpack_require__(9); -var Render = __webpack_require__(978); -var Union = __webpack_require__(408); +var Render = __webpack_require__(1035); +var Union = __webpack_require__(418); var Vector2 = __webpack_require__(3); /** @@ -40298,6 +43996,9 @@ var Vector2 = __webpack_require__(3); * Containers can be enabled for input. Because they do not have a texture you need to provide a shape for them * to use as their hit area. Container children can also be enabled for input, independent of the Container. * + * If input enabling a _child_ you should not set both the `origin` and a **negative** scale factor on the child, + * or the input area will become misaligned. + * * Containers can be given a physics body for either Arcade Physics, Impact Physics or Matter Physics. However, * if Container _children_ are enabled for physics you may get unexpected results, such as offset bodies, * if the Container itself, or any of its ancestors, is positioned anywhere other than at 0 x 0. Container children @@ -40321,6 +44022,7 @@ var Vector2 = __webpack_require__(3); * @extends Phaser.GameObjects.Components.ComputedSize * @extends Phaser.GameObjects.Components.Depth * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline * @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Visible * @@ -40339,6 +44041,7 @@ var Container = new Class({ Components.ComputedSize, Components.Depth, Components.Mask, + Components.Pipeline, Components.Transform, Components.Visible, Render @@ -40385,7 +44088,7 @@ var Container = new Class({ * the maximum limit the Container can grow in size to. * * @name Phaser.GameObjects.Container#maxSize - * @type {integer} + * @type {number} * @default -1 * @since 3.4.0 */ @@ -40395,7 +44098,7 @@ var Container = new Class({ * The cursor position. * * @name Phaser.GameObjects.Container#position - * @type {integer} + * @type {number} * @since 3.4.0 */ this.position = 0; @@ -40472,7 +44175,7 @@ var Container = new Class({ * @name Phaser.GameObjects.Container#scrollFactorX * @type {number} * @default 1 - * @since 3.0.0 + * @since 3.4.0 */ this.scrollFactorX = 1; @@ -40499,10 +44202,12 @@ var Container = new Class({ * @name Phaser.GameObjects.Container#scrollFactorY * @type {number} * @default 1 - * @since 3.0.0 + * @since 3.4.0 */ this.scrollFactorY = 1; + this.initPipeline(); + this.setPosition(x, y); this.clearAlpha(); @@ -40710,7 +44415,7 @@ var Container = new Class({ // Is only on the Display List via this Container if (!this.scene.sys.displayList.exists(gameObject)) { - gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); + gameObject.emit(Events.ADDED_TO_SCENE, gameObject, this.scene); } }, @@ -40735,7 +44440,7 @@ var Container = new Class({ // Is only on the Display List via this Container if (!this.scene.sys.displayList.exists(gameObject)) { - gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + gameObject.emit(Events.REMOVED_FROM_SCENE, gameObject, this.scene); } }, @@ -40821,7 +44526,7 @@ var Container = new Class({ * @since 3.4.0 * * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to add to the Container. - * @param {integer} [index=0] - The position to insert the Game Object/s at. + * @param {number} [index=0] - The position to insert the Game Object/s at. * * @return {this} This Container instance. */ @@ -40838,7 +44543,7 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#getAt * @since 3.4.0 * - * @param {integer} index - The position to get the Game Object from. + * @param {number} index - The position to get the Game Object from. * * @return {?Phaser.GameObjects.GameObject} The Game Object at the specified index, or `null` if none found. */ @@ -40855,7 +44560,7 @@ var Container = new Class({ * * @param {Phaser.GameObjects.GameObject} child - The Game Object to search for in this Container. * - * @return {integer} The index of the Game Object in this Container, or -1 if not found. + * @return {number} The index of the Game Object in this Container, or -1 if not found. */ getIndex: function (child) { @@ -40916,8 +44621,8 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#getRandom * @since 3.4.0 * - * @param {integer} [startIndex=0] - An optional start index. - * @param {integer} [length] - An optional length, the total number of elements (from the startIndex) to choose from. + * @param {number} [startIndex=0] - An optional start index. + * @param {number} [length] - An optional length, the total number of elements (from the startIndex) to choose from. * * @return {?Phaser.GameObjects.GameObject} A random child from the Container, or `null` if the Container is empty. */ @@ -40941,8 +44646,8 @@ var Container = new Class({ * * @param {string} property - The property to test on each Game Object in the Container. * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * * @return {?Phaser.GameObjects.GameObject} The first matching Game Object, or `null` if none was found. */ @@ -40971,8 +44676,8 @@ var Container = new Class({ * * @param {string} [property] - The property to test on each Game Object in the Container. * @param {any} [value] - If property is set then the `property` must strictly equal this value to be included in the results. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * * @return {Phaser.GameObjects.GameObject[]} An array of matching Game Objects from this Container. */ @@ -40994,10 +44699,10 @@ var Container = new Class({ * * @param {string} property - The property to check. * @param {any} value - The value to check. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * - * @return {integer} The total number of Game Objects in this Container with a property matching the given value. + * @return {number} The total number of Game Objects in this Container with a property matching the given value. */ count: function (property, value, startIndex, endIndex) { @@ -41035,7 +44740,7 @@ var Container = new Class({ * @since 3.4.0 * * @param {Phaser.GameObjects.GameObject} child - The Game Object to move. - * @param {integer} index - The new position of the Game Object in this Container. + * @param {number} index - The new position of the Game Object in this Container. * * @return {this} This Container instance. */ @@ -41089,7 +44794,7 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#removeAt * @since 3.4.0 * - * @param {integer} index - The index of the Game Object to be removed. + * @param {number} index - The index of the Game Object to be removed. * @param {boolean} [destroyChild=false] - Optionally call `destroy` on the Game Object if successfully removed from this Container. * * @return {this} This Container instance. @@ -41114,8 +44819,8 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#removeBetween * @since 3.4.0 * - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each Game Object successfully removed from this Container. * * @return {this} This Container instance. @@ -41322,8 +45027,8 @@ var Container = new Class({ * * @param {string} property - The property that must exist on the Game Object. * @param {any} value - The value to get the property to. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * * @return {this} This Container instance. */ @@ -41435,7 +45140,7 @@ var Container = new Class({ * them from physics bodies if not accounted for in your code. * * @method Phaser.GameObjects.Container#setScrollFactor - * @since 3.0.0 + * @since 3.4.0 * * @param {number} x - The horizontal scroll factor of this Game Object. * @param {number} [y=x] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. @@ -41464,7 +45169,7 @@ var Container = new Class({ * The number of Game Objects inside this Container. * * @name Phaser.GameObjects.Container#length - * @type {integer} + * @type {number} * @readonly * @since 3.4.0 */ @@ -41613,7 +45318,7 @@ module.exports = Container; /***/ }), -/* 201 */ +/* 206 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41622,9 +45327,9 @@ module.exports = Container; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(140); +var BitmapText = __webpack_require__(144); var Class = __webpack_require__(0); -var Render = __webpack_require__(983); +var Render = __webpack_require__(1040); /** * @classdesc @@ -41666,7 +45371,7 @@ var Render = __webpack_require__(983); * @param {string} font - The key of the font to use from the Bitmap Font cache. * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. * @param {number} [size] - The font size of this Bitmap Text. - * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. */ var DynamicBitmapText = new Class({ @@ -41846,7 +45551,7 @@ module.exports = DynamicBitmapText; /***/ }), -/* 202 */ +/* 207 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41855,26 +45560,24 @@ module.exports = DynamicBitmapText; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCamera = __webpack_require__(93); +var BaseCamera = __webpack_require__(99); var Class = __webpack_require__(0); -var Commands = __webpack_require__(203); -var ComponentsAlpha = __webpack_require__(280); -var ComponentsBlendMode = __webpack_require__(281); -var ComponentsDepth = __webpack_require__(282); -var ComponentsMask = __webpack_require__(286); -var ComponentsPipeline = __webpack_require__(165); -var ComponentsTransform = __webpack_require__(291); -var ComponentsVisible = __webpack_require__(292); -var ComponentsScrollFactor = __webpack_require__(289); - -var TransformMatrix = __webpack_require__(31); - -var Ellipse = __webpack_require__(98); +var Commands = __webpack_require__(208); +var ComponentsAlpha = __webpack_require__(295); +var ComponentsBlendMode = __webpack_require__(296); +var ComponentsDepth = __webpack_require__(297); +var ComponentsMask = __webpack_require__(301); +var ComponentsPipeline = __webpack_require__(166); +var ComponentsScrollFactor = __webpack_require__(304); +var ComponentsTransform = __webpack_require__(305); +var ComponentsVisible = __webpack_require__(306); +var Ellipse = __webpack_require__(106); var GameObject = __webpack_require__(14); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); var MATH_CONST = __webpack_require__(13); -var Render = __webpack_require__(989); +var PIPELINES_CONST = __webpack_require__(82); +var Render = __webpack_require__(1046); /** * @classdesc @@ -41961,7 +45664,7 @@ var Graphics = new Class({ GameObject.call(this, scene, 'Graphics'); this.setPosition(x, y); - this.initPipeline(); + this.initPipeline(PIPELINES_CONST.GRAPHICS_PIPELINE); /** * The horizontal display origin of the Graphics. @@ -42053,36 +45756,6 @@ var Graphics = new Class({ */ this._lineWidth = 1.0; - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.GameObjects.Graphics#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.17.0 - */ - this._tempMatrix1 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.GameObjects.Graphics#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.17.0 - */ - this._tempMatrix2 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.GameObjects.Graphics#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.17.0 - */ - this._tempMatrix3 = new TransformMatrix(); - this.setDefaultStyles(options); }, @@ -42186,21 +45859,28 @@ var Graphics = new Class({ * @webglOnly * @since 3.12.0 * - * @param {integer} topLeft - The tint being applied to the top-left of the Game Object. - * @param {integer} topRight - The tint being applied to the top-right of the Game Object. - * @param {integer} bottomLeft - The tint being applied to the bottom-left of the Game Object. - * @param {integer} bottomRight - The tint being applied to the bottom-right of the Game Object. - * @param {number} [alpha=1] - The fill alpha. + * @param {number} topLeft - The top left fill color. + * @param {number} topRight - The top right fill color. + * @param {number} bottomLeft - The bottom left fill color. + * @param {number} bottomRight - The bottom right fill color. Not used when filling triangles. + * @param {number} [alphaTopLeft=1] - The top left alpha value. If you give only this value, it's used for all corners. + * @param {number} [alphaTopRight=1] - The top right alpha value. + * @param {number} [alphaBottomLeft=1] - The bottom left alpha value. + * @param {number} [alphaBottomRight=1] - The bottom right alpha value. * * @return {this} This Game Object. */ - fillGradientStyle: function (topLeft, topRight, bottomLeft, bottomRight, alpha) + fillGradientStyle: function (topLeft, topRight, bottomLeft, bottomRight, alphaTopLeft, alphaTopRight, alphaBottomLeft, alphaBottomRight) { - if (alpha === undefined) { alpha = 1; } + if (alphaTopLeft === undefined) { alphaTopLeft = 1; } + if (alphaTopRight === undefined) { alphaTopRight = alphaTopLeft; } + if (alphaBottomLeft === undefined) { alphaBottomLeft = alphaTopLeft; } + if (alphaBottomRight === undefined) { alphaBottomRight = alphaTopLeft; } this.commandBuffer.push( Commands.GRADIENT_FILL_STYLE, - alpha, topLeft, topRight, bottomLeft, bottomRight + alphaTopLeft, alphaTopRight, alphaBottomLeft, alphaBottomRight, + topLeft, topRight, bottomLeft, bottomRight ); return this; @@ -42224,10 +45904,10 @@ var Graphics = new Class({ * @since 3.12.0 * * @param {number} lineWidth - The stroke width. - * @param {integer} topLeft - The tint being applied to the top-left of the Game Object. - * @param {integer} topRight - The tint being applied to the top-right of the Game Object. - * @param {integer} bottomLeft - The tint being applied to the bottom-left of the Game Object. - * @param {integer} bottomRight - The tint being applied to the bottom-right of the Game Object. + * @param {number} topLeft - The tint being applied to the top-left of the Game Object. + * @param {number} topRight - The tint being applied to the top-right of the Game Object. + * @param {number} bottomLeft - The tint being applied to the bottom-left of the Game Object. + * @param {number} bottomRight - The tint being applied to the bottom-right of the Game Object. * @param {number} [alpha=1] - The fill alpha. * * @return {this} This Game Object. @@ -42244,62 +45924,6 @@ var Graphics = new Class({ return this; }, - /** - * Sets the texture frame this Graphics Object will use when drawing all shapes defined after calling this. - * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. - * - * Once set, all shapes will use this texture. Call this method with no arguments to clear it. - * - * The textures are not tiled. They are stretched to the dimensions of the shapes being rendered. For this reason, - * it works best with seamless / tileable textures. - * - * The mode argument controls how the textures are combined with the fill colors. The default value (0) will - * multiply the texture by the fill color. A value of 1 will use just the fill color, but the alpha data from the texture, - * and a value of 2 will use just the texture and no fill color at all. - * - * @method Phaser.GameObjects.Graphics#setTexture - * @since 3.12.0 - * @webglOnly - * - * @param {string} [key] - The key of the texture to be used, as stored in the Texture Manager. Leave blank to clear a previously set texture. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. - * @param {number} [mode=0] - The texture tint mode. 0 is multiply, 1 is alpha only and 2 is texture only. - * - * @return {this} This Game Object. - */ - setTexture: function (key, frame, mode) - { - if (mode === undefined) { mode = 0; } - - if (key === undefined) - { - this.commandBuffer.push( - Commands.CLEAR_TEXTURE - ); - } - else - { - var textureFrame = this.scene.sys.textures.getFrame(key, frame); - - if (textureFrame) - { - if (mode === 2) - { - mode = 3; - } - - this.commandBuffer.push( - Commands.SET_TEXTURE, - textureFrame, - mode - ); - } - } - - return this; - }, - /** * Start a new shape path. * @@ -42655,12 +46279,16 @@ var Graphics = new Class({ this.beginPath(); this.moveTo(x + tl, y); this.lineTo(x + width - tr, y); + this.moveTo(x + width - tr, y); this.arc(x + width - tr, y + tr, tr, -MATH_CONST.TAU, 0); this.lineTo(x + width, y + height - br); + this.moveTo(x + width, y + height - br); this.arc(x + width - br, y + height - br, br, 0, MATH_CONST.TAU); this.lineTo(x + bl, y + height); + this.moveTo(x + bl, y + height); this.arc(x + bl, y + height - bl, bl, MATH_CONST.TAU, Math.PI); this.lineTo(x, y + tl); + this.moveTo(x, y + tl); this.arc(x + tl, y + tl, tl, -Math.PI, -MATH_CONST.TAU); this.strokePath(); @@ -42894,7 +46522,7 @@ var Graphics = new Class({ * @param {(array|Phaser.Geom.Point[])} points - The points to stroke. * @param {boolean} [closeShape=false] - When `true`, the shape is closed by joining the last point to the first point. * @param {boolean} [closePath=false] - When `true`, the path is closed before being stroked. - * @param {integer} [endIndex] - The index of `points` to stop drawing at. Defaults to `points.length`. + * @param {number} [endIndex] - The index of `points` to stop drawing at. Defaults to `points.length`. * * @return {this} This Game Object. */ @@ -42941,7 +46569,7 @@ var Graphics = new Class({ * @param {(array|Phaser.Geom.Point[])} points - The points to fill. * @param {boolean} [closeShape=false] - When `true`, the shape is closed by joining the last point to the first point. * @param {boolean} [closePath=false] - When `true`, the path is closed before being stroked. - * @param {integer} [endIndex] - The index of `points` to stop at. Defaults to `points.length`. + * @param {number} [endIndex] - The index of `points` to stop at. Defaults to `points.length`. * * @return {this} This Game Object. */ @@ -42982,7 +46610,7 @@ var Graphics = new Class({ * @since 3.0.0 * * @param {Phaser.Geom.Ellipse} ellipse - The ellipse to stroke. - * @param {integer} [smoothness=32] - The number of points to draw the ellipse with. + * @param {number} [smoothness=32] - The number of points to draw the ellipse with. * * @return {this} This Game Object. */ @@ -43005,7 +46633,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the center of the ellipse. * @param {number} width - The width of the ellipse. * @param {number} height - The height of the ellipse. - * @param {integer} [smoothness=32] - The number of points to draw the ellipse with. + * @param {number} [smoothness=32] - The number of points to draw the ellipse with. * * @return {this} This Game Object. */ @@ -43027,7 +46655,7 @@ var Graphics = new Class({ * @since 3.0.0 * * @param {Phaser.Geom.Ellipse} ellipse - The ellipse to fill. - * @param {integer} [smoothness=32] - The number of points to draw the ellipse with. + * @param {number} [smoothness=32] - The number of points to draw the ellipse with. * * @return {this} This Game Object. */ @@ -43050,7 +46678,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the center of the ellipse. * @param {number} width - The width of the ellipse. * @param {number} height - The height of the ellipse. - * @param {integer} [smoothness=32] - The number of points to draw the ellipse with. + * @param {number} [smoothness=32] - The number of points to draw the ellipse with. * * @return {this} This Game Object. */ @@ -43307,8 +46935,8 @@ var Graphics = new Class({ * @since 3.0.0 * * @param {(string|HTMLCanvasElement)} key - The key to store the texture with in the Texture Manager, or a Canvas to draw to. - * @param {integer} [width] - The width of the graphics to generate. - * @param {integer} [height] - The height of the graphics to generate. + * @param {number} [width] - The width of the graphics to generate. + * @param {number} [height] - The height of the graphics to generate. * * @return {this} This Game Object. */ @@ -43361,8 +46989,8 @@ var Graphics = new Class({ if (ctx) { - // var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix, renderTargetCtx, allowClip) - this.renderCanvas(renderer, this, 0, Graphics.TargetCamera, null, ctx, false); + // var GraphicsCanvasRenderer = function (renderer, src, camera, parentMatrix, renderTargetCtx, allowClip) + this.renderCanvas(renderer, this, Graphics.TargetCamera, null, ctx, false); if (texture) { @@ -43400,7 +47028,7 @@ module.exports = Graphics; /***/ }), -/* 203 */ +/* 208 */ /***/ (function(module, exports) { /** @@ -43428,8 +47056,6 @@ module.exports = { TRANSLATE: 16, SCALE: 17, ROTATE: 18, - SET_TEXTURE: 19, - CLEAR_TEXTURE: 20, GRADIENT_FILL_STYLE: 21, GRADIENT_LINE_STYLE: 22 @@ -43437,7 +47063,7 @@ module.exports = { /***/ }), -/* 204 */ +/* 209 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43479,7 +47105,763 @@ module.exports = CircumferencePoint; /***/ }), -/* 205 */ +/* 210 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BlendModes = __webpack_require__(48); +var Class = __webpack_require__(0); +var Components = __webpack_require__(11); +var ComponentsToJSON = __webpack_require__(168); +var DataManager = __webpack_require__(97); +var EventEmitter = __webpack_require__(10); +var GameObjectEvents = __webpack_require__(32); +var List = __webpack_require__(105); +var Render = __webpack_require__(1054); +var SceneEvents = __webpack_require__(20); +var StableSort = __webpack_require__(90); + +/** + * @classdesc + * A Layer Game Object. + * + * A Layer is a special type of Game Object that acts as a Display List. You can add any type of Game Object + * to a Layer, just as you would to a Scene. Layers can be used to visually group together 'layers' of Game + * Objects: + * + * ```javascript + * const spaceman = this.add.sprite(150, 300, 'spaceman'); + * const bunny = this.add.sprite(400, 300, 'bunny'); + * const elephant = this.add.sprite(650, 300, 'elephant'); + * + * const layer = this.add.layer(); + * + * layer.add([ spaceman, bunny, elephant ]); + * ``` + * + * The 3 sprites in the example above will now be managed by the Layer they were added to. Therefore, + * if you then set `layer.setVisible(false)` they would all vanish from the display. + * + * You can also control the depth of the Game Objects within the Layer. For example, calling the + * `setDepth` method of a child of a Layer will allow you to adjust the depth of that child _within the + * Layer itself_, rather than the whole Scene. The Layer, too, can have its depth set as well. + * + * The Layer class also offers many different methods for manipulating the list, such as the + * methods `moveUp`, `moveDown`, `sendToBack`, `bringToTop` and so on. These allow you to change the + * display list position of the Layers children, causing it to adjust the order in which they are + * rendered. Using `setDepth` on a child allows you to override this. + * + * Layers can have Post FX Pipelines set, which allows you to easily enable a post pipeline across + * a whole range of children, which, depending on the effect, can often be far more efficient that doing so + * on a per-child basis. + * + * Layers have no position or size within the Scene. This means you cannot enable a Layer for + * physics or input, or change the position, rotation or scale of a Layer. They also have no scroll + * factor, texture, tint, origin, crop or bounds. + * + * If you need those kind of features then you should use a Container instead. Containers can be added + * to Layers, but Layers cannot be added to Containers. + * + * However, you can set the Alpha, Blend Mode, Depth, Mask and Visible state of a Layer. These settings + * will impact all children being rendered by the Layer. + * + * @class Layer + * @extends Phaser.Structs.List. + * @memberof Phaser.GameObjects + * @constructor + * @since 3.50.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Layer. + */ +var Layer = new Class({ + + Extends: List, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.Mask, + Components.Pipeline, + Components.Visible, + EventEmitter, + Render + ], + + initialize: + + function Layer (scene, children) + { + List.call(this, scene); + EventEmitter.call(this); + + /** + * A reference to the Scene to which this Game Object belongs. + * + * Game Objects can only belong to one Scene. + * + * You should consider this property as being read-only. You cannot move a + * Game Object to another Scene by simply changing it. + * + * @name Phaser.GameObjects.Layer#scene + * @type {Phaser.Scene} + * @since 3.50.0 + */ + this.scene = scene; + + /** + * Holds a reference to the Display List that contains this Game Object. + * + * This is set automatically when this Game Object is added to a Scene or Layer. + * + * You should treat this property as being read-only. + * + * @name Phaser.GameObjects.Layer#displayList + * @type {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} + * @default null + * @since 3.50.0 + */ + this.displayList = null; + + /** + * A textual representation of this Game Object, i.e. `sprite`. + * Used internally by Phaser but is available for your own custom classes to populate. + * + * @name Phaser.GameObjects.Layer#type + * @type {string} + * @since 3.50.0 + */ + this.type = 'Layer'; + + /** + * The current state of this Game Object. + * + * Phaser itself will never modify this value, although plugins may do so. + * + * Use this property to track the state of a Game Object during its lifetime. For example, it could change from + * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant + * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @name Phaser.GameObjects.Layer#state + * @type {(number|string)} + * @since 3.50.0 + */ + this.state = 0; + + /** + * The name of this Game Object. + * Empty by default and never populated by Phaser, this is left for developers to use. + * + * @name Phaser.GameObjects.Layer#name + * @type {string} + * @default '' + * @since 3.50.0 + */ + this.name = ''; + + /** + * The active state of this Game Object. + * A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it. + * An active object is one which is having its logic and internal systems updated. + * + * @name Phaser.GameObjects.Layer#active + * @type {boolean} + * @default true + * @since 3.50.0 + */ + this.active = true; + + /** + * A Data Manager. + * It allows you to store, query and get key/value paired information specific to this Game Object. + * `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`. + * + * @name Phaser.GameObjects.Layer#data + * @type {Phaser.Data.DataManager} + * @default null + * @since 3.50.0 + */ + this.data = null; + + /** + * The flags that are compared against `RENDER_MASK` to determine if this Game Object will render or not. + * The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively. + * If those components are not used by your custom class then you can use this bitmask as you wish. + * + * @name Phaser.GameObjects.Layer#renderFlags + * @type {number} + * @default 15 + * @since 3.50.0 + */ + this.renderFlags = 15; + + /** + * A bitmask that controls if this Game Object is drawn by a Camera or not. + * Not usually set directly, instead call `Camera.ignore`, however you can + * set this property directly using the Camera.id property: + * + * @example + * this.cameraFilter |= camera.id + * + * @name Phaser.GameObjects.Layer#cameraFilter + * @type {number} + * @default 0 + * @since 3.50.0 + */ + this.cameraFilter = 0; + + /** + * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`. + * This includes calls that may come from a Group, Container or the Scene itself. + * While it allows you to persist a Game Object across Scenes, please understand you are entirely + * responsible for managing references to and from this Game Object. + * + * @name Phaser.GameObjects.Layer#ignoreDestroy + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.ignoreDestroy = false; + + /** + * A reference to the Scene Systems. + * + * @name Phaser.GameObjects.Layer#systems + * @type {Phaser.Scenes.Systems} + * @since 3.50.0 + */ + this.systems = scene.sys; + + /** + * A reference to the Scene Event Emitter. + * + * @name Phaser.GameObjects.Layer#events + * @type {Phaser.Events.EventEmitter} + * @since 3.50.0 + */ + this.events = scene.sys.events; + + /** + * The flag the determines whether Game Objects should be sorted when `depthSort()` is called. + * + * @name Phaser.GameObjects.Layer#sortChildrenFlag + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.sortChildrenFlag = false; + + // Set the List callbacks + this.addCallback = this.addChildCallback; + this.removeCallback = this.removeChildCallback; + + this.initPipeline(); + + this.clearAlpha(); + + this.setBlendMode(BlendModes.SKIP_CHECK); + + if (children) + { + this.add(children); + } + + // Tell the Scene to re-sort the children + scene.sys.queueDepthSort(); + }, + + /** + * Sets the `active` property of this Game Object and returns this Game Object for further chaining. + * A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList. + * + * @method Phaser.GameObjects.Layer#setActive + * @since 3.50.0 + * + * @param {boolean} value - True if this Game Object should be set as active, false if not. + * + * @return {this} This GameObject. + */ + setActive: function (value) + { + this.active = value; + + return this; + }, + + /** + * Sets the `name` property of this Game Object and returns this Game Object for further chaining. + * The `name` property is not populated by Phaser and is presented for your own use. + * + * @method Phaser.GameObjects.Layer#setName + * @since 3.50.0 + * + * @param {string} value - The name to be given to this Game Object. + * + * @return {this} This GameObject. + */ + setName: function (value) + { + this.name = value; + + return this; + }, + + /** + * Sets the current state of this Game Object. + * + * Phaser itself will never modify the State of a Game Object, although plugins may do so. + * + * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. + * The state value should typically be an integer (ideally mapped to a constant + * in your game code), but could also be a string. It is recommended to keep it light and simple. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @method Phaser.GameObjects.Layer#setState + * @since 3.50.0 + * + * @param {(number|string)} value - The state of the Game Object. + * + * @return {this} This GameObject. + */ + setState: function (value) + { + this.state = value; + + return this; + }, + + /** + * Adds a Data Manager component to this Game Object. + * + * @method Phaser.GameObjects.Layer#setDataEnabled + * @since 3.50.0 + * @see Phaser.Data.DataManager + * + * @return {this} This GameObject. + */ + setDataEnabled: function () + { + if (!this.data) + { + this.data = new DataManager(this); + } + + return this; + }, + + /** + * Allows you to store a key value pair within this Game Objects Data Manager. + * + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. + * + * If the key doesn't already exist in the Data Manager then it is created. + * + * ```javascript + * sprite.setData('name', 'Red Gem Stone'); + * ``` + * + * You can also pass in an object of key value pairs as the first argument: + * + * ```javascript + * sprite.setData({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); + * ``` + * + * To get a value back again you can call `getData`: + * + * ```javascript + * sprite.getData('gold'); + * ``` + * + * Or you can access the value directly via the `values` property, where it works like any other variable: + * + * ```javascript + * sprite.data.values.gold += 50; + * ``` + * + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. + * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. + * + * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.GameObjects.Layer#setData + * @since 3.50.0 + * + * @param {(string|object)} key - The key to set the value for. Or an object of key value pairs. If an object the `data` argument is ignored. + * @param {*} [data] - The value to set for the given key. If an object is provided as the key this argument is ignored. + * + * @return {this} This GameObject. + */ + setData: function (key, value) + { + if (!this.data) + { + this.data = new DataManager(this); + } + + this.data.set(key, value); + + return this; + }, + + /** + * Increase a value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is increased from 0. + * + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. + * + * If the key doesn't already exist in the Data Manager then it is created. + * + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * @method Phaser.GameObjects.Layer#incData + * @since 3.50.0 + * + * @param {(string|object)} key - The key to increase the value for. + * @param {*} [data] - The value to increase for the given key. + * + * @return {this} This GameObject. + */ + incData: function (key, value) + { + if (!this.data) + { + this.data = new DataManager(this); + } + + this.data.inc(key, value); + + return this; + }, + + /** + * Toggle a boolean value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is toggled from false. + * + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. + * + * If the key doesn't already exist in the Data Manager then it is created. + * + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * @method Phaser.GameObjects.Layer#toggleData + * @since 3.50.0 + * + * @param {(string|object)} key - The key to toggle the value for. + * + * @return {this} This GameObject. + */ + toggleData: function (key) + { + if (!this.data) + { + this.data = new DataManager(this); + } + + this.data.toggle(key); + + return this; + }, + + /** + * Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist. + * + * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: + * + * ```javascript + * sprite.getData('gold'); + * ``` + * + * Or access the value directly: + * + * ```javascript + * sprite.data.values.gold; + * ``` + * + * You can also pass in an array of keys, in which case an array of values will be returned: + * + * ```javascript + * sprite.getData([ 'gold', 'armor', 'health' ]); + * ``` + * + * This approach is useful for destructuring arrays in ES6. + * + * @method Phaser.GameObjects.Layer#getData + * @since 3.50.0 + * + * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. + * + * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. + */ + getData: function (key) + { + if (!this.data) + { + this.data = new DataManager(this); + } + + return this.data.get(key); + }, + + /** + * This callback is invoked when this Game Object is added to a Scene. + * + * Can be overriden by custom Game Objects, but be aware of some Game Objects that + * will use this, such as Sprites, to add themselves into the Update List. + * + * You can also listen for the `ADDED_TO_SCENE` event from this Game Object. + * + * @method Phaser.GameObjects.Layer#addedToScene + * @since 3.50.0 + */ + addedToScene: function () + { + }, + + /** + * This callback is invoked when this Game Object is removed from a Scene. + * + * Can be overriden by custom Game Objects, but be aware of some Game Objects that + * will use this, such as Sprites, to removed themselves from the Update List. + * + * You can also listen for the `REMOVED_FROM_SCENE` event from this Game Object. + * + * @method Phaser.GameObjects.Layer#removedFromScene + * @since 3.50.0 + */ + removedFromScene: function () + { + }, + + /** + * To be overridden by custom GameObjects. Allows base objects to be used in a Pool. + * + * @method Phaser.GameObjects.Layer#update + * @since 3.50.0 + * + * @param {...*} [args] - args + */ + update: function () + { + }, + + /** + * Returns a JSON representation of the Game Object. + * + * @method Phaser.GameObjects.Layer#toJSON + * @since 3.50.0 + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. + */ + toJSON: function () + { + return ComponentsToJSON(this); + }, + + /** + * Compares the renderMask with the renderFlags to see if this Game Object will render or not. + * Also checks the Game Object against the given Cameras exclusion list. + * + * @method Phaser.GameObjects.Layer#willRender + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. + * + * @return {boolean} True if the Game Object should be rendered, otherwise false. + */ + willRender: function (camera) + { + return !(this.renderFlags !== 15 || this.list.length === 0 || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); + }, + + /** + * Internal method called from `List.addCallback`. + * + * @method Phaser.GameObjects.Layer#addChildCallback + * @private + * @fires Phaser.Scenes.Events#ADDED_TO_SCENE + * @fires Phaser.GameObjects.Events#ADDED_TO_SCENE + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the list. + */ + addChildCallback: function (gameObject) + { + gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); + + if (gameObject.displayList) + { + gameObject.displayList.remove(gameObject); + } + + gameObject.displayList = this; + + this.queueDepthSort(); + + this.events.emit(SceneEvents.ADDED_TO_SCENE, gameObject, this.scene); + }, + + /** + * Internal method called from `List.removeCallback`. + * + * @method Phaser.GameObjects.Layer#removeChildCallback + * @private + * @fires Phaser.Scenes.Events#REMOVED_FROM_SCENE + * @fires Phaser.GameObjects.Events#REMOVED_FROM_SCENE + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the list. + */ + removeChildCallback: function (gameObject) + { + gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + + gameObject.displayList = null; + + this.queueDepthSort(); + + this.events.emit(SceneEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + }, + + /** + * Force a sort of the display list on the next call to depthSort. + * + * @method Phaser.GameObjects.Layer#queueDepthSort + * @since 3.50.0 + */ + queueDepthSort: function () + { + this.sortChildrenFlag = true; + }, + + /** + * Immediately sorts the display list if the flag is set. + * + * @method Phaser.GameObjects.Layer#depthSort + * @since 3.50.0 + */ + depthSort: function () + { + if (this.sortChildrenFlag) + { + StableSort(this.list, this.sortByDepth); + + this.sortChildrenFlag = false; + } + }, + + /** + * Compare the depth of two Game Objects. + * + * @method Phaser.GameObjects.Layer#sortByDepth + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} childA - The first Game Object. + * @param {Phaser.GameObjects.GameObject} childB - The second Game Object. + * + * @return {number} The difference between the depths of each Game Object. + */ + sortByDepth: function (childA, childB) + { + return childA._depth - childB._depth; + }, + + /** + * Returns an array which contains all Game Objects within this Layer. + * + * This is a reference to the main list array, not a copy of it, so be careful not to modify it. + * + * @method Phaser.GameObjects.Layer#getChildren + * @since 3.50.0 + * + * @return {Phaser.GameObjects.GameObject[]} The group members. + */ + getChildren: function () + { + return this.list; + }, + + /** + * Destroys this Game Object removing it from the Display List and Update List and + * severing all ties to parent resources. + * + * Use this to remove a Game Object from your game if you don't ever plan to use it again. + * As long as no reference to it exists within your own code it should become free for + * garbage collection by the browser. + * + * If you just want to temporarily disable an object then look at using the + * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. + * + * @method Phaser.GameObjects.Layer#destroy + * @fires Phaser.GameObjects.Events#DESTROY + * @since 3.50.0 + * + * @param {boolean} [fromScene=false] - Is this Game Object being destroyed as the result of a Scene shutdown? + */ + destroy: function (fromScene) + { + if (fromScene === undefined) { fromScene = false; } + + // This Game Object has already been destroyed + if (!this.scene || this.ignoreDestroy) + { + return; + } + + this.removeAll(); + this.removeAllListeners(); + this.resetPostPipeline(true); + + this.emit(GameObjectEvents.DESTROY, this); + + if (!fromScene && this.displayList) + { + this.displayList.remove(this); + this.displayList.queueDepthSort(); + } + + if (this.data) + { + this.data.destroy(); + + this.data = undefined; + } + + this.active = false; + this.visible = false; + + this.scene = undefined; + this.displayList = undefined; + this.systems = undefined; + this.events = undefined; + } + +}); + +module.exports = Layer; + + +/***/ }), +/* 211 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43491,11 +47873,11 @@ module.exports = CircumferencePoint; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); -var GravityWell = __webpack_require__(417); -var List = __webpack_require__(137); -var ParticleEmitter = __webpack_require__(419); -var Render = __webpack_require__(998); +var GameObjectEvents = __webpack_require__(32); +var GravityWell = __webpack_require__(427); +var List = __webpack_require__(105); +var ParticleEmitter = __webpack_require__(429); +var Render = __webpack_require__(1058); /** * @classdesc @@ -43515,7 +47897,7 @@ var Render = __webpack_require__(998); * * @param {Phaser.Scene} scene - The Scene to which this Emitter Manager belongs. * @param {string} texture - The key of the Texture this Emitter Manager will use to render particles, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Emitter Manager will use to render particles. + * @param {(string|number)} [frame] - An optional frame from the Texture this Emitter Manager will use to render particles. * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig|Phaser.Types.GameObjects.Particles.ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. */ var ParticleEmitterManager = new Class({ @@ -43542,7 +47924,7 @@ var ParticleEmitterManager = new Class({ * The blend mode applied to all emitters and particles. * * @name Phaser.GameObjects.Particles.ParticleEmitterManager#blendMode - * @type {integer} + * @type {number} * @default -1 * @private * @since 3.0.0 @@ -43658,7 +48040,7 @@ var ParticleEmitterManager = new Class({ * @since 3.0.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Emitter Manager. */ @@ -43679,7 +48061,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setFrame * @since 3.0.0 * - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Emitter Manager. */ @@ -43828,7 +48210,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#emitParticle * @since 3.0.0 * - * @param {integer} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. + * @param {number} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. * @param {number} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location. * @param {number} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location. * @@ -43859,7 +48241,7 @@ var ParticleEmitterManager = new Class({ * * @param {number} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location. * @param {number} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location. - * @param {integer} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. + * @param {number} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. * * @return {this} This Emitter Manager. */ @@ -43921,7 +48303,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#preUpdate * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ preUpdate: function (time, delta) @@ -43984,7 +48366,7 @@ module.exports = ParticleEmitterManager; /***/ }), -/* 206 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43993,19 +48375,20 @@ module.exports = ParticleEmitterManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(54); -var Camera = __webpack_require__(93); -var CanvasPool = __webpack_require__(26); +var BlendModes = __webpack_require__(48); +var Camera = __webpack_require__(99); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var CONST = __webpack_require__(34); -var Frame = __webpack_require__(97); +var CONST = __webpack_require__(39); +var Frame = __webpack_require__(104); var GameObject = __webpack_require__(14); var NOOP = __webpack_require__(1); -var ProjectOrtho = __webpack_require__(185); -var Render = __webpack_require__(1002); -var Utils = __webpack_require__(10); -var UUID = __webpack_require__(207); +var PIPELINE_CONST = __webpack_require__(82); +var Render = __webpack_require__(1062); +var RenderTarget = __webpack_require__(263); +var Utils = __webpack_require__(12); +var UUID = __webpack_require__(213); /** * @classdesc @@ -44044,8 +48427,8 @@ var UUID = __webpack_require__(207); * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. * @param {number} [x=0] - The horizontal position of this Game Object in the world. * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {integer} [width=32] - The width of the Render Texture. - * @param {integer} [height=32] - The height of the Render Texture. + * @param {number} [width=32] - The width of the Render Texture. + * @param {number} [height=32] - The height of the Render Texture. * @property {string} [key] - The texture key to make the RenderTexture from. * @property {string} [frame] - the frame to make the RenderTexture from. */ @@ -44089,7 +48472,7 @@ var RenderTexture = new Class({ * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} * @since 3.2.0 */ - this.renderer = scene.sys.game.renderer; + this.renderer = scene.sys.renderer; /** * A reference to the Texture Manager. @@ -44129,16 +48512,6 @@ var RenderTexture = new Class({ */ this.canvas = null; - /** - * A reference to the GL Frame Buffer this Render Texture is drawing to. - * This is only set if Phaser is running with the WebGL Renderer. - * - * @name Phaser.GameObjects.RenderTexture#framebuffer - * @type {?WebGLFramebuffer} - * @since 3.2.0 - */ - this.framebuffer = null; - /** * Is this Render Texture dirty or not? If not it won't spend time clearing or filling itself. * @@ -44243,25 +48616,17 @@ var RenderTexture = new Class({ this.camera = new Camera(0, 0, width, height); /** - * A reference to the WebGL Rendering Context. + * The Render Target that belongs to this Render Texture. * - * @name Phaser.GameObjects.RenderTexture#gl - * @type {WebGLRenderingContext} - * @default null - * @since 3.0.0 - */ - this.gl = null; - - /** - * A reference to the WebGLTexture that is being rendered to in a WebGL Context. + * A Render Target encapsulates a framebuffer and texture for the WebGL Renderer. * - * @name Phaser.GameObjects.RenderTexture#glTexture - * @type {WebGLTexture} - * @default null - * @readonly - * @since 3.19.0 + * This property remains `null` under Canvas. + * + * @name Phaser.GameObjects.RenderTexture#renderTarget + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 */ - this.glTexture = null; + this.renderTarget = null; var renderer = this.renderer; @@ -44271,12 +48636,9 @@ var RenderTexture = new Class({ } else if (renderer.type === CONST.WEBGL) { - var gl = renderer.gl; - - this.gl = gl; - this.glTexture = this.frame.source.glTexture; this.drawGameObject = this.batchGameObjectWebGL; - this.framebuffer = renderer.createFramebuffer(width, height, this.glTexture, false); + + this.renderTarget = new RenderTarget(renderer, width, height, 1, 0, false); } else if (renderer.type === CONST.CANVAS) { @@ -44293,7 +48655,8 @@ var RenderTexture = new Class({ } this.setOrigin(0, 0); - this.initPipeline(); + + this.initPipeline(PIPELINE_CONST.SINGLE_PIPELINE); }, /** @@ -44319,8 +48682,10 @@ var RenderTexture = new Class({ * texture will not change. * * If Render Texture was not created from specific frame, the following will happen: + * * In WebGL it will destroy and then re-create the frame buffer being used by the Render Texture. * In Canvas it will resize the underlying canvas element. + * * Both approaches will erase everything currently drawn to the Render Texture. * * If the dimensions given are the same as those already being used, calling this method will do nothing. @@ -44338,7 +48703,6 @@ var RenderTexture = new Class({ if (height === undefined) { height = width; } var frame = this.frame; - var renderer = this.renderer; if (width !== this.width || height !== this.height) { @@ -44352,30 +48716,48 @@ var RenderTexture = new Class({ this.texture.width = width; this.texture.height = height; - if (this.gl) + var renderTarget = this.renderTarget; + + if (renderTarget) { - var gl = this.gl; + renderTarget.resize(width, height); - renderer.deleteTexture(frame.source.glTexture); - renderer.deleteFramebuffer(this.framebuffer); - - var glTexture = renderer.createTexture2D(0, gl.NEAREST, gl.NEAREST, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE, gl.RGBA, null, width, height, false); - - this.framebuffer = renderer.createFramebuffer(width, height, glTexture, false); + frame.glTexture = renderTarget.texture; frame.source.isRenderTexture = true; - - frame.source.glTexture = glTexture; - - frame.glTexture = glTexture; - - this.glTexture = glTexture; + frame.source.isGLTexture = true; + frame.source.glTexture = renderTarget.texture; } + var camera = this.camera; + frame.source.width = width; frame.source.height = height; - this.camera.setSize(width, height); + var renderer = this.renderer; + var rendererWidth = renderer.width; + var rendererHeight = renderer.height; + + var zoomX = rendererWidth / width; + var zoomY = rendererHeight / height; + + camera.setSize(width, height); + camera.setZoom(zoomX, zoomY); + + var ox = 0.5; + var oy = 0.5; + + if (width !== rendererWidth) + { + ox = 0; + } + + if (height !== rendererHeight) + { + oy = 0; + } + + camera.setOrigin(ox, oy); frame.setSize(width, height); @@ -44421,7 +48803,7 @@ var RenderTexture = new Class({ * @method Phaser.GameObjects.RenderTexture#setGlobalTint * @since 3.2.0 * - * @param {integer} tint - The tint value. + * @param {number} tint - The tint value. * * @return {this} This Render Texture. */ @@ -44506,9 +48888,7 @@ var RenderTexture = new Class({ */ fill: function (rgb, alpha, x, y, width, height) { - var gl = this.gl; var frame = this.frame; - var texture = this.texture; var camera = this.camera; var renderer = this.renderer; @@ -44518,47 +48898,38 @@ var RenderTexture = new Class({ if (width === undefined) { width = frame.cutWidth; } if (height === undefined) { height = frame.cutHeight; } - var r = ((rgb >> 16) | 0) & 0xff; - var g = ((rgb >> 8) | 0) & 0xff; - var b = (rgb | 0) & 0xff; + var r = (rgb >> 16 & 0xFF) / 255; + var g = (rgb >> 8 & 0xFF) / 255; + var b = (rgb & 0xFF) / 255; - camera.preRender(1, 1); + var renderTarget = this.renderTarget; - if (gl) + camera.preRender(); + + if (renderTarget) { - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; - - renderer.resetTextures(true); - - renderer.pushScissor(cx, cy, cw, -ch); - - renderer.setFramebuffer(this.framebuffer, false); + renderTarget.bind(true); var pipeline = this.pipeline; - var tw = texture.width; - var th = texture.height; + pipeline.manager.set(pipeline); - var rw = pipeline.width; - var rh = pipeline.height; + var tw = renderTarget.width; + var th = renderTarget.height; + + var rw = renderer.width; + var rh = renderer.height; var sx = rw / tw; var sy = rh / th; pipeline.drawFillRect( - x * sx, (th - height - y) * sy, width * sx, height * sy, - Utils.getTintFromFloats(r / 255, g / 255, b / 255, 1), + x * sx, y * sy, width * sx, height * sy, + Utils.getTintFromFloats(b, g, r, 1), alpha ); - pipeline.flush(); - - renderer.setFramebuffer(null, false); - - renderer.popScissor(); + renderTarget.unbind(true); } else { @@ -44589,23 +48960,11 @@ var RenderTexture = new Class({ { if (this.dirty) { - var gl = this.gl; + var renderTarget = this.renderTarget; - if (gl) + if (renderTarget) { - var renderer = this.renderer; - - renderer.setFramebuffer(this.framebuffer, true); - - if (this.frame.cutWidth !== this.canvas.width || this.frame.cutHeight !== this.canvas.height) - { - gl.scissor(this.frame.cutX, this.frame.cutY, this.frame.cutWidth, this.frame.cutHeight); - } - - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - - renderer.setFramebuffer(null, true); + renderTarget.clear(); } else { @@ -44757,37 +49116,21 @@ var RenderTexture = new Class({ entries = [ entries ]; } - var gl = this.gl; var camera = this.camera; var renderer = this.renderer; + var renderTarget = this.renderTarget; - camera.preRender(1, 1); + camera.preRender(); - if (gl) + if (renderTarget) { - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; + renderTarget.bind(true); renderer.resetTextures(true); - renderer.setFramebuffer(this.framebuffer, false); - - renderer.pushScissor(cx, cy, cw, ch, ch); - - var pipeline = this.pipeline; - - ProjectOrtho(pipeline, 0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0); - this.batchList(entries, x, y, alpha, tint); - // Causes a flush + popScissor - renderer.setFramebuffer(null, true); - - renderer.resetTextures(true); - - ProjectOrtho(pipeline, 0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); + renderTarget.unbind(true); } else { @@ -44825,7 +49168,7 @@ var RenderTexture = new Class({ * @since 3.12.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * @param {number} [x=0] - The x position to draw the frame at. * @param {number} [y=0] - The y position to draw the frame at. * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property. @@ -44848,41 +49191,21 @@ var RenderTexture = new Class({ tint = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16); } - var gl = this.gl; var camera = this.camera; - var renderer = this.renderer; + var renderTarget = this.renderTarget; var textureFrame = this.textureManager.getFrame(key, frame); if (textureFrame) { - camera.preRender(1, 1); + camera.preRender(); - if (gl) + if (renderTarget) { - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; + renderTarget.bind(true); - renderer.resetTextures(true); + this.pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, camera.matrix, null); - renderer.setFramebuffer(this.framebuffer, false); - - renderer.pushScissor(cx, cy, cw, ch, ch); - - var pipeline = this.pipeline; - - ProjectOrtho(pipeline, 0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0); - - pipeline.batchTextureFrame(textureFrame, x + this.frame.cutX, y + this.frame.cutY, tint, alpha, camera.matrix, null); - - pipeline.flush(); - - renderer.setFramebuffer(null, false); - - renderer.popScissor(); - - ProjectOrtho(pipeline, 0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); + renderTarget.unbind(true); } else { @@ -44948,7 +49271,7 @@ var RenderTexture = new Class({ }, /** - * Internal method that handles the drawing a Phaser Group contents. + * Internal method that handles drawing a Phaser Group contents. * * @method Phaser.GameObjects.RenderTexture#batchGroup * @private @@ -44970,7 +49293,7 @@ var RenderTexture = new Class({ { var entry = children[i]; - if (entry.willRender()) + if (entry.willRender(this.camera)) { var tx = entry.x + x; var ty = entry.y + y; @@ -45006,7 +49329,7 @@ var RenderTexture = new Class({ gameObject.setPosition(x + this.frame.cutX, y + this.frame.cutY); - gameObject.renderWebGL(this.renderer, gameObject, 0, this.camera, null); + gameObject.renderWebGL(this.renderer, gameObject, this.camera); gameObject.setPosition(prevX, prevY); }, @@ -45039,7 +49362,7 @@ var RenderTexture = new Class({ gameObject.setPosition(x + this.frame.cutX, y + this.frame.cutY); - gameObject.renderCanvas(this.renderer, gameObject, 0, this.camera, null); + gameObject.renderCanvas(this.renderer, gameObject, this.camera, null); gameObject.setPosition(prevX, prevY); @@ -45057,7 +49380,7 @@ var RenderTexture = new Class({ * @since 3.12.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * @param {number} [x=0] - The x position to offset the Game Object by. * @param {number} [y=0] - The y position to offset the Game Object by. * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property. @@ -45093,7 +49416,9 @@ var RenderTexture = new Class({ x += this.frame.cutX; y += this.frame.cutY; - if (this.gl) + var renderTarget = this.renderTarget; + + if (renderTarget) { this.pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, this.camera.matrix, null); } @@ -45128,10 +49453,10 @@ var RenderTexture = new Class({ * @method Phaser.GameObjects.RenderTexture#snapshotArea * @since 3.19.0 * - * @param {integer} x - The x coordinate to grab from. - * @param {integer} y - The y coordinate to grab from. - * @param {integer} width - The width of the area to grab. - * @param {integer} height - The height of the area to grab. + * @param {number} x - The x coordinate to grab from. + * @param {number} y - The y coordinate to grab from. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. @@ -45140,9 +49465,9 @@ var RenderTexture = new Class({ */ snapshotArea: function (x, y, width, height, callback, type, encoderOptions) { - if (this.gl) + if (this.renderTarget) { - this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, false, x, y, width, height, type, encoderOptions); + this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, false, x, y, width, height, type, encoderOptions); } else { @@ -45175,9 +49500,9 @@ var RenderTexture = new Class({ */ snapshot: function (callback, type, encoderOptions) { - if (this.gl) + if (this.renderTarget) { - this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, false, 0, 0, this.width, this.height, type, encoderOptions); + this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, false, 0, 0, this.width, this.height, type, encoderOptions); } else { @@ -45201,17 +49526,17 @@ var RenderTexture = new Class({ * @method Phaser.GameObjects.RenderTexture#snapshotPixel * @since 3.19.0 * - * @param {integer} x - The x coordinate of the pixel to get. - * @param {integer} y - The y coordinate of the pixel to get. + * @param {number} x - The x coordinate of the pixel to get. + * @param {number} y - The y coordinate of the pixel to get. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. * * @return {this} This Render Texture instance. */ snapshotPixel: function (x, y, callback) { - if (this.gl) + if (this.renderTarget) { - this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, true, x, y); + this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, true, x, y); } else { @@ -45234,9 +49559,9 @@ var RenderTexture = new Class({ { CanvasPool.remove(this.canvas); - if (this.gl) + if (this.renderTarget) { - this.renderer.deleteFramebuffer(this.framebuffer); + this.renderTarget.destroy(); } this.texture.destroy(); @@ -45244,9 +49569,7 @@ var RenderTexture = new Class({ this.canvas = null; this.context = null; - this.framebuffer = null; this.texture = null; - this.glTexture = null; } } @@ -45256,7 +49579,7 @@ module.exports = RenderTexture; /***/ }), -/* 207 */ +/* 213 */ /***/ (function(module, exports) { /** @@ -45291,7 +49614,7 @@ module.exports = UUID; /***/ }), -/* 208 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -45304,9 +49627,9 @@ var AnimationState = __webpack_require__(157); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); -var PIPELINE_CONST = __webpack_require__(110); -var RopeRender = __webpack_require__(1008); +var GameObjectEvents = __webpack_require__(32); +var PIPELINE_CONST = __webpack_require__(82); +var RopeRender = __webpack_require__(1068); var Vector2 = __webpack_require__(3); /** @@ -45345,8 +49668,8 @@ var Vector2 = __webpack_require__(3); * @param {number} [x=0] - The horizontal position of this Game Object in the world. * @param {number} [y=0] - The vertical position of this Game Object in the world. * @param {string} [texture] - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. If not given, `__DEFAULT` is used. - * @param {(string|integer|null)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {(integer|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. See `setPoints` to set this post-creation. + * @param {(string|number|null)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. See `setPoints` to set this post-creation. * @param {boolean} [horizontal=true] - Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? * @param {number[]} [colors] - An optional array containing the color data for this Rope. You should provide one color value per pair of vertices. * @param {number[]} [alphas] - An optional array containing the alpha data for this Rope. You should provide one alpha value per pair of vertices. @@ -45384,7 +49707,7 @@ var Rope = new Class({ * The Animation State of this Rope. * * @name Phaser.GameObjects.Rope#anims - * @type {Phaser.Animation.AnimationState} + * @type {Phaser.Animations.AnimationState} * @since 3.23.0 */ this.anims = new AnimationState(this); @@ -45463,15 +49786,14 @@ var Rope = new Class({ /** * The tint fill mode. * - * 0 = An additive tint (the default), where vertices colors are blended with the texture. - * 1 = A fill tint, where the vertices colors replace the texture, but respects texture alpha. - * 2 = A complete tint, where the vertices colors replace the texture, including alpha, entirely. + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. * * @name Phaser.GameObjects.Rope#tintFill - * @type {integer} + * @type {boolean} * @since 3.23.0 */ - this.tintFill = (texture === '__DEFAULT') ? 2 : 0; + this.tintFill = (texture === '__DEFAULT') ? true : false; /** * If the Rope is marked as `dirty` it will automatically recalculate its vertices @@ -45630,7 +49952,7 @@ var Rope = new Class({ * * @param {string} key - The string-based key of the animation to play. * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. - * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index. + * @param {number} [startFrame=0] - Optionally start the animation playing from this frame index. * * @return {this} This Game Object. */ @@ -45667,7 +49989,7 @@ var Rope = new Class({ * @method Phaser.GameObjects.Rope#setHorizontal * @since 3.23.0 * - * @param {(integer|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. * @param {(number|number[])} [colors] - Either a single color value, or an array of values. * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. * @@ -45696,7 +50018,7 @@ var Rope = new Class({ * @method Phaser.GameObjects.Rope#setVertical * @since 3.23.0 * - * @param {(integer|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. * @param {(number|number[])} [colors] - Either a single color value, or an array of values. * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. * @@ -45719,28 +50041,26 @@ var Rope = new Class({ /** * Sets the tint fill mode. * - * Mode 0 is an additive tint, the default, which blends the vertices colors with the texture. + * Mode 0 (`false`) is an additive tint, the default, which blends the vertices colors with the texture. * This mode respects the texture alpha. * - * Mode 1 is a fill tint. Unlike an additive tint, a fill-tint literally replaces the pixel colors + * Mode 1 (`true`) is a fill tint. Unlike an additive tint, a fill-tint literally replaces the pixel colors * from the texture with those in the tint. You can use this for effects such as making a player flash 'white' * if hit by something. This mode respects the texture alpha. * - * Mode 2 is a complete tint. The texture colors and alpha are replaced entirely by the vertices colors. - * * See the `setColors` method for details of how to color each of the vertices. * * @method Phaser.GameObjects.Rope#setTintFill * @webglOnly * @since 3.23.0 * - * @param {integer} [value=0] - Set to 0 for an Additive tint, 1 for a fill tint with alpha, or 2 for a fill tint without alpha. + * @param {boolean} [value=false] - Set to `false` for an Additive tint or `true` fill tint with alpha. * * @return {this} This Game Object instance. */ setTintFill: function (value) { - if (value === undefined) { value = 0; } + if (value === undefined) { value = false; } this.tintFill = value; @@ -45966,7 +50286,7 @@ var Rope = new Class({ * @method Phaser.GameObjects.Rope#setPoints * @since 3.23.0 * - * @param {(integer|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. * @param {(number|number[])} [colors] - Either a single color value, or an array of values. * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. * @@ -46146,7 +50466,7 @@ var Rope = new Class({ * @method Phaser.GameObjects.Rope#resizeArrays * @since 3.23.0 * - * @param {integer} newSize - The amount of segments to split the Rope in to. + * @param {number} newSize - The amount of segments to split the Rope in to. * * @return {this} This Game Object instance. */ @@ -46247,9 +50567,10 @@ var Rope = new Class({ /** * This method enables rendering of the Rope vertices to the given Graphics instance. * - * If you enable this feature, you must call `Graphics.clear()` in your Scene `update`, - * otherwise the Graphics instance will fill-in with draw calls. This is not done automatically - * to allow for you to debug render multiple Rope objects to a single Graphics instance. + * If you enable this feature, you **must** call `Graphics.clear()` in your Scene `update`, + * otherwise the Graphics instance you provide to debug will fill-up with draw calls, + * eventually crashing the browser. This is not done automatically to allow you to debug + * draw multiple Rope objects to a single Graphics instance. * * The Rope class has a built-in debug rendering callback `Rope.renderDebugVerts`, however * you can also provide your own callback to be used instead. Do this by setting the `callback` parameter. @@ -46304,7 +50625,7 @@ var Rope = new Class({ * @since 3.23.0 * * @param {Phaser.GameObjects.Rope} src - The Rope object being rendered. - * @param {integer} meshLength - The number of vertices in the mesh. + * @param {number} meshLength - The number of vertices in the mesh. * @param {number[]} verts - An array of translated vertex coordinates. */ renderDebugVerts: function (src, meshLength, verts) @@ -46422,7 +50743,7 @@ module.exports = Rope; /***/ }), -/* 209 */ +/* 215 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -46431,26 +50752,26 @@ module.exports = Rope; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AddToDOM = __webpack_require__(131); -var CanvasPool = __webpack_require__(26); +var AddToDOM = __webpack_require__(137); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); var GameObject = __webpack_require__(14); -var GetTextSize = __webpack_require__(425); +var GetTextSize = __webpack_require__(435); var GetValue = __webpack_require__(6); -var RemoveFromDOM = __webpack_require__(188); -var TextRender = __webpack_require__(1011); -var TextStyle = __webpack_require__(426); +var RemoveFromDOM = __webpack_require__(193); +var TextRender = __webpack_require__(1071); +var TextStyle = __webpack_require__(436); /** * @classdesc * A Text Game Object. - * + * * Text objects work by creating their own internal hidden Canvas and then renders text to it using * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered * to your game during the render pass. - * + * * Because it uses the Canvas API you can take advantage of all the features this offers, such as * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts * loaded externally, such as Google or TypeKit Web fonts. @@ -46473,7 +50794,7 @@ var TextStyle = __webpack_require__(426); * * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts * across mobile browsers. - * + * * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of @@ -46547,7 +50868,7 @@ var Text = new Class({ * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} * @since 3.12.0 */ - this.renderer = scene.sys.game.renderer; + this.renderer = scene.sys.renderer; this.setPosition(x, y); this.setOrigin(0, 0); @@ -46647,7 +50968,7 @@ var Text = new Class({ * The line spacing value. * This value is added to the font height to calculate the overall line height. * Only has an effect if this Text object contains multiple lines of text. - * + * * If you update this property directly, instead of using the `setLineSpacing` method, then * be sure to call `updateText` after, or you won't see the change reflected in the Text object. * @@ -46667,10 +50988,10 @@ var Text = new Class({ */ this.dirty = false; - // If resolution wasn't set, then we get it from the game config + // If resolution wasn't set, force it to 1 if (this.style.resolution === 0) { - this.style.resolution = scene.sys.game.config.resolution; + this.style.resolution = 1; } /** @@ -46947,7 +51268,12 @@ var Text = new Class({ { var word = words[j]; var wordWidth = context.measureText(word).width; - var wordWidthWithSpace = wordWidth + whiteSpaceWidth; + var wordWidthWithSpace = wordWidth; + + if (j < lastWordIndex) + { + wordWidthWithSpace += whiteSpaceWidth; + } if (wordWidthWithSpace > spaceLeft) { @@ -47107,10 +51433,10 @@ var Text = new Class({ * ```javascript * Text.setFont('"Press Start 2P"'); * ``` - * + * * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all * quoted properly, too: - * + * * ```javascript * Text.setFont('Georgia, "Goudy Bookletter 1911", Times, serif'); * ``` @@ -47378,9 +51704,9 @@ var Text = new Class({ /** * Set the alignment of the text in this Text object. - * + * * The argument can be one of: `left`, `right`, `center` or `justify`. - * + * * Alignment only works if the Text object has more than one line of text. * * @method Phaser.GameObjects.Text#setAlign @@ -47400,10 +51726,10 @@ var Text = new Class({ * * By default it will be set to match the resolution set in the Game Config, * but you can override it via this method, or by specifying it in the Text style configuration object. - * + * * It allows for much clearer text on High DPI devices, at the cost of memory because it uses larger * internal Canvas textures for the Text. - * + * * Therefore, please use with caution, as the more high res Text you have, the more memory it uses. * * @method Phaser.GameObjects.Text#setResolution @@ -47510,7 +51836,7 @@ var Text = new Class({ * @method Phaser.GameObjects.Text#setMaxLines * @since 3.0.0 * - * @param {integer} [max=0] - The maximum number of lines to draw. + * @param {number} [max=0] - The maximum number of lines to draw. * * @return {this} This Text object. */ @@ -47660,9 +51986,9 @@ var Text = new Class({ var spaceSize = context.measureText(' ').width; var trimmedLine = lines[i].trim(); var array = trimmedLine.split(' '); - + extraSpace += (lines[i].length - trimmedLine.length) * spaceSize; - + var extraSpaceCharacters = Math.floor(extraSpace / spaceSize); var idx = 0; @@ -47672,7 +51998,7 @@ var Text = new Class({ idx = (idx + 1) % (array.length - 1 || 1); --extraSpaceCharacters; } - + lines[i] = array.join(' '); } } @@ -47834,7 +52160,7 @@ module.exports = Text; /***/ }), -/* 210 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -47843,14 +52169,14 @@ module.exports = Text; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); var GameObject = __webpack_require__(14); -var GetPowerOfTwo = __webpack_require__(342); -var Smoothing = __webpack_require__(177); -var TileSpriteRender = __webpack_require__(1014); +var GetPowerOfTwo = __webpack_require__(353); +var Smoothing = __webpack_require__(184); +var TileSpriteRender = __webpack_require__(1074); var Vector2 = __webpack_require__(3); // bitmask flag for GameObject.renderMask @@ -47865,10 +52191,10 @@ var _FLAG = 8; // 1000 * * You shouldn't ever create a TileSprite any larger than your actual canvas size. If you want to create a large repeating background * that scrolls across the whole map of your game, then you create a TileSprite that fits the canvas size and then use the `tilePosition` - * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will + * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will * consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to * adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs. - * + * * An important note about Tile Sprites and NPOT textures: Internally, TileSprite textures use GL_REPEAT to provide * seamless repeating of the textures. This, combined with the way in which the textures are handled in WebGL, means * they need to be POT (power-of-two) sizes in order to wrap. If you provide a NPOT (non power-of-two) texture to a @@ -47903,10 +52229,10 @@ var _FLAG = 8; // 1000 * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. - * @param {integer} width - The width of the Game Object. If zero it will use the size of the texture frame. - * @param {integer} height - The height of the Game Object. If zero it will use the size of the texture frame. + * @param {number} width - The width of the Game Object. If zero it will use the size of the texture frame. + * @param {number} height - The height of the Game Object. If zero it will use the size of the texture frame. * @param {string} textureKey - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frameKey] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frameKey] - An optional frame from the Texture this Game Object is rendering with. */ var TileSprite = new Class({ @@ -47934,7 +52260,7 @@ var TileSprite = new Class({ function TileSprite (scene, x, y, width, height, textureKey, frameKey) { - var renderer = scene.sys.game.renderer; + var renderer = scene.sys.renderer; GameObject.call(this, scene, 'TileSprite'); @@ -48065,7 +52391,7 @@ var TileSprite = new Class({ * The next power of two value from the width of the Fill Pattern frame. * * @name Phaser.GameObjects.TileSprite#potWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.potWidth = GetPowerOfTwo(displayFrame.width); @@ -48074,7 +52400,7 @@ var TileSprite = new Class({ * The next power of two value from the height of the Fill Pattern frame. * * @name Phaser.GameObjects.TileSprite#potHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.potHeight = GetPowerOfTwo(displayFrame.height); @@ -48134,7 +52460,7 @@ var TileSprite = new Class({ * @since 3.0.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Game Object instance. */ @@ -48155,7 +52481,7 @@ var TileSprite = new Class({ * @method Phaser.GameObjects.TileSprite#setFrame * @since 3.0.0 * - * @param {(string|integer)} frame - The name or index of the frame within the Texture. + * @param {(string|number)} frame - The name or index of the frame within the Texture. * * @return {this} This Game Object instance. */ @@ -48486,7 +52812,7 @@ module.exports = TileSprite; /***/ }), -/* 211 */ +/* 217 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -48496,64 +52822,65 @@ module.exports = TileSprite; */ var Class = __webpack_require__(0); -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Components = __webpack_require__(11); -var Events = __webpack_require__(29); -var GameEvents = __webpack_require__(21); +var Events = __webpack_require__(32); +var GameEvents = __webpack_require__(23); +var InputEvents = __webpack_require__(49); var GameObject = __webpack_require__(14); -var SoundEvents = __webpack_require__(61); -var UUID = __webpack_require__(207); -var VideoRender = __webpack_require__(1017); +var SoundEvents = __webpack_require__(66); +var UUID = __webpack_require__(213); +var VideoRender = __webpack_require__(1077); var MATH_CONST = __webpack_require__(13); /** * @classdesc * A Video Game Object. - * + * * This Game Object is capable of handling playback of a previously loaded video from the Phaser Video Cache, * or playing a video based on a given URL. Videos can be either local, or streamed. - * + * * ```javascript * preload () { * this.load.video('pixar', 'nemo.mp4'); * } - * + * * create () { * this.add.video(400, 300, 'pixar'); * } * ``` - * + * * To all intents and purposes, a video is a standard Game Object, just like a Sprite. And as such, you can do * all the usual things to it, such as scaling, rotating, cropping, tinting, making interactive, giving a * physics body, etc. - * + * * Transparent videos are also possible via the WebM file format. Providing the video file has was encoded with * an alpha channel, and providing the browser supports WebM playback (not all of them do), then it will render * in-game with full transparency. - * + * * ### Autoplaying Videos - * + * * Videos can only autoplay if the browser has been unlocked with an interaction, or satisfies the MEI settings. * The policies that control autoplaying are vast and vary between browser. - * You can, ahd should, read more about it here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide - * + * You can, and should, read more about it here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide + * * If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is _loaded_, * and it will often allow the video to play immediately: - * + * * ```javascript * preload () { * this.load.video('pixar', 'nemo.mp4', 'loadeddata', false, true); * } * ``` - * + * * The 5th parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without * audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies * the browsers MEI settings. See the MDN Autoplay Guide for further details. - * + * * Note that due to a bug in IE11 you cannot play a video texture to a Sprite in WebGL. For IE11 force Canvas mode. - * + * * More details about video playback and the supported media formats can be found on MDN: - * + * * https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement * https://developer.mozilla.org/en-US/docs/Web/Media/Formats * @@ -48698,7 +53025,7 @@ var Video = new Class({ * state in this manner until the `retryLimit` is reached and then abort. * * @name Phaser.GameObjects.Video#retryLimit - * @type {integer} + * @type {number} * @since 3.20.0 */ this.retryLimit = 20; @@ -48707,7 +53034,7 @@ var Video = new Class({ * The current retry attempt. * * @name Phaser.GameObjects.Video#retry - * @type {integer} + * @type {number} * @since 3.20.0 */ this.retry = 0; @@ -48716,7 +53043,7 @@ var Video = new Class({ * The number of ms between each retry while monitoring the ready state of a downloading video. * * @name Phaser.GameObjects.Video#retryInterval - * @type {integer} + * @type {number} * @since 3.20.0 */ this.retryInterval = 500; @@ -48725,7 +53052,7 @@ var Video = new Class({ * The setTimeout callback ID. * * @name Phaser.GameObjects.Video#_retryID - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -48811,7 +53138,7 @@ var Video = new Class({ * The in marker. * * @name Phaser.GameObjects.Video#_markerIn - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -48821,7 +53148,7 @@ var Video = new Class({ * The out marker. * * @name Phaser.GameObjects.Video#_markerOut - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -48831,7 +53158,7 @@ var Video = new Class({ * The last time the TextureSource was updated. * * @name Phaser.GameObjects.Video#_lastUpdate - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -48886,40 +53213,55 @@ var Video = new Class({ { sound.on(SoundEvents.GLOBAL_MUTE, this.globalMute, this); } + + this.on(Events.ADDED_TO_SCENE, this.addedToScene, this); + this.on(Events.REMOVED_FROM_SCENE, this.removedFromScene, this); + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); }, /** * Starts this video playing. * * If the video is already playing, or has been queued to play with `changeSource` then this method just returns. - * + * * Videos can only autoplay if the browser has been unlocked. This happens if you have interacted with the browser, i.e. * by clicking on it or pressing a key, or due to server settings. The policies that control autoplaying are vast and * vary between browser. You can read more here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide - * + * * If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is loaded, * and it will often allow the video to play immediately: - * + * * ```javascript * preload () { * this.load.video('pixar', 'nemo.mp4', 'loadeddata', false, true); * } * ``` - * + * * The 5th parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without * audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies * the browsers MEI settings. See the MDN Autoplay Guide for details. - * + * * If you need audio in your videos, then you'll have to consider the fact that the video cannot start playing until the * user has interacted with the browser, into your game flow. * * @method Phaser.GameObjects.Video#play * @since 3.20.0 - * + * * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. - * @param {integer} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. - * @param {integer} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. - * + * @param {number} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. + * @param {number} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. + * * @return {this} This Video Game Object for method chaining. */ play: function (loop, markerIn, markerOut) @@ -48941,7 +53283,7 @@ var Video = new Class({ if (loop === undefined) { loop = video.loop; } var sound = this.scene.sys.sound; - + if (sound && sound.mute) { // Mute will be set based on the global mute state of the Sound Manager (if there is one) @@ -48995,20 +53337,20 @@ var Video = new Class({ * This method allows you to change the source of the current video element. It works by first stopping the * current video, if playing. Then deleting the video texture, if one has been created. Finally, it makes a * new video texture and starts playback of the new source through the existing video element. - * + * * The reason you may wish to do this is because videos that require interaction to unlock, remain in an unlocked * state, even if you change the source of the video. By changing the source to a new video you avoid having to * go through the unlock process again. * * @method Phaser.GameObjects.Video#changeSource * @since 3.20.0 - * + * * @param {string} key - The key of the Video this Game Object will swap to playing, as stored in the Video Cache. * @param {boolean} [autoplay=true] - Should the video start playing immediately, once the swap is complete? * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. - * @param {integer} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. - * @param {integer} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. - * + * @param {number} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. + * @param {number} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. + * * @return {this} This Video Game Object for method chaining. */ changeSource: function (key, autoplay, loop, markerIn, markerOut) @@ -49040,7 +53382,7 @@ var Video = new Class({ this.videoTexture = this.scene.sys.textures.create(this._key, newVideo, newVideo.videoWidth, newVideo.videoHeight); this.videoTextureSource = this.videoTexture.source[0]; this.videoTexture.add('__BASE', 0, 0, 0, newVideo.videoWidth, newVideo.videoHeight); - + this.setTexture(this.videoTexture); this.setSizeToFrame(); this.updateDisplayOrigin(); @@ -49071,23 +53413,23 @@ var Video = new Class({ /** * Adds a sequence marker to this video. - * + * * Markers allow you to split a video up into sequences, delineated by a start and end time, given in seconds. - * + * * You can then play back specific markers via the `playMarker` method. - * + * * Note that marker timing is _not_ frame-perfect. You should construct your videos in such a way that you allow for * plenty of extra padding before and after each sequence to allow for discrepancies in browser seek and currentTime accuracy. - * + * * See https://github.com/w3c/media-and-entertainment/issues/4 for more details about this issue. * * @method Phaser.GameObjects.Video#addMarker * @since 3.20.0 - * + * * @param {string} key - A unique name to give this marker. - * @param {integer} markerIn - The time, in seconds, representing the start of this marker. - * @param {integer} markerOut - The time, in seconds, representing the end of this marker. - * + * @param {number} markerIn - The time, in seconds, representing the start of this marker. + * @param {number} markerOut - The time, in seconds, representing the end of this marker. + * * @return {this} This Video Game Object for method chaining. */ addMarker: function (key, markerIn, markerOut) @@ -49102,21 +53444,21 @@ var Video = new Class({ /** * Plays a pre-defined sequence in this video. - * + * * Markers allow you to split a video up into sequences, delineated by a start and end time, given in seconds and * specified via the `addMarker` method. - * + * * Note that marker timing is _not_ frame-perfect. You should construct your videos in such a way that you allow for * plenty of extra padding before and after each sequence to allow for discrepancies in browser seek and currentTime accuracy. - * + * * See https://github.com/w3c/media-and-entertainment/issues/4 for more details about this issue. * * @method Phaser.GameObjects.Video#playMarker * @since 3.20.0 - * + * * @param {string} key - The name of the marker sequence to play. * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. - * + * * @return {this} This Video Game Object for method chaining. */ playMarker: function (key, loop) @@ -49133,14 +53475,14 @@ var Video = new Class({ /** * Removes a previously set marker from this video. - * + * * If the marker is currently playing it will _not_ stop playback. * * @method Phaser.GameObjects.Video#removeMarker * @since 3.20.0 - * + * * @param {string} key - The name of the marker to remove. - * + * * @return {this} This Video Game Object for method chaining. */ removeMarker: function (key) @@ -49153,17 +53495,17 @@ var Video = new Class({ /** * Takes a snapshot of the current frame of the video and renders it to a CanvasTexture object, * which is then returned. You can optionally resize the grab by passing a width and height. - * + * * This method returns a reference to the `Video.snapshotTexture` object. Calling this method * multiple times will overwrite the previous snapshot with the most recent one. * * @method Phaser.GameObjects.Video#snapshot * @since 3.20.0 - * - * @param {integer} [width] - The width of the resulting CanvasTexture. - * @param {integer} [height] - The height of the resulting CanvasTexture. - * - * @return {Phaser.Textures.CanvasTexture} + * + * @param {number} [width] - The width of the resulting CanvasTexture. + * @param {number} [height] - The height of the resulting CanvasTexture. + * + * @return {Phaser.Textures.CanvasTexture} */ snapshot: function (width, height) { @@ -49176,21 +53518,21 @@ var Video = new Class({ /** * Takes a snapshot of the specified area of the current frame of the video and renders it to a CanvasTexture object, * which is then returned. You can optionally resize the grab by passing a different `destWidth` and `destHeight`. - * + * * This method returns a reference to the `Video.snapshotTexture` object. Calling this method * multiple times will overwrite the previous snapshot with the most recent one. * * @method Phaser.GameObjects.Video#snapshotArea * @since 3.20.0 - * - * @param {integer} [x=0] - The horizontal location of the top-left of the area to grab from. - * @param {integer} [y=0] - The vertical location of the top-left of the area to grab from. - * @param {integer} [srcWidth] - The width of area to grab from the video. If not given it will grab the full video dimensions. - * @param {integer} [srcHeight] - The height of area to grab from the video. If not given it will grab the full video dimensions. - * @param {integer} [destWidth] - The destination width of the grab, allowing you to resize it. - * @param {integer} [destHeight] - The destination height of the grab, allowing you to resize it. - * - * @return {Phaser.Textures.CanvasTexture} + * + * @param {number} [x=0] - The horizontal location of the top-left of the area to grab from. + * @param {number} [y=0] - The vertical location of the top-left of the area to grab from. + * @param {number} [srcWidth] - The width of area to grab from the video. If not given it will grab the full video dimensions. + * @param {number} [srcHeight] - The height of area to grab from the video. If not given it will grab the full video dimensions. + * @param {number} [destWidth] - The destination width of the grab, allowing you to resize it. + * @param {number} [destHeight] - The destination height of the grab, allowing you to resize it. + * + * @return {Phaser.Textures.CanvasTexture} */ snapshotArea: function (x, y, srcWidth, srcHeight, destWidth, destHeight) { @@ -49230,27 +53572,27 @@ var Video = new Class({ /** * Stores a copy of this Videos `snapshotTexture` in the Texture Manager using the given key. - * + * * This texture is created when the `snapshot` or `snapshotArea` methods are called. - * + * * After doing this, any texture based Game Object, such as a Sprite, can use the contents of the * snapshot by using the texture key: - * + * * ```javascript * var vid = this.add.video(0, 0, 'intro'); - * + * * vid.snapshot(); - * + * * vid.saveSnapshotTexture('doodle'); - * + * * this.add.image(400, 300, 'doodle'); * ``` - * + * * Updating the contents of the `snapshotTexture`, for example by calling `snapshot` again, * will automatically update _any_ Game Object that is using it as a texture. * Calling `saveSnapshotTexture` again will not save another copy of the same texture, * it will just rename the existing one. - * + * * By default it will create a single base texture. You can add frames to the texture * by using the `Texture.add` method. After doing this, you can then allow Game Objects * to use a specific frame. @@ -49278,18 +53620,18 @@ var Video = new Class({ /** * Loads a Video from the given URL, ready for playback with the `Video.play` method. - * + * * You can control at what point the browser determines the video as being ready for playback via * the `loadEvent` parameter. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement * for more details. * * @method Phaser.GameObjects.Video#loadURL * @since 3.20.0 - * + * * @param {string} url - The URL of the video to load or be streamed. * @param {string} [loadEvent='loadeddata'] - The load event to listen for. Either `loadeddata`, `canplay` or `canplaythrough`. * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. - * + * * @return {this} This Video Game Object for method chaining. */ loadURL: function (url, loadEvent, noAudio) @@ -49308,7 +53650,7 @@ var Video = new Class({ } var video = document.createElement('video'); - + video.controls = false; if (noAudio) @@ -49333,6 +53675,70 @@ var Video = new Class({ return this; }, + /** + * Loads a Video from the given MediaStream object, ready for playback with the `Video.play` method. + * + * You can control at what point the browser determines the video as being ready for playback via + * the `loadEvent` parameter. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement + * for more details. + * + * @method Phaser.GameObjects.Video#loadMediaStream + * @since 3.50.0 + * + * @param {string} stream - The MediaStream object. + * @param {string} [loadEvent='loadeddata'] - The load event to listen for. Either `loadeddata`, `canplay` or `canplaythrough`. + * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. + * + * @return {this} This Video Game Object for method chaining. + */ + loadMediaStream: function (stream, loadEvent, noAudio) + { + if (loadEvent === undefined) { loadEvent = 'loadeddata'; } + if (noAudio === undefined) { noAudio = false; } + + if (this.video) + { + this.stop(); + } + + if (this.videoTexture) + { + this.scene.sys.textures.remove(this._key); + } + + var video = document.createElement('video'); + + video.controls = false; + + if (noAudio) + { + video.muted = true; + video.defaultMuted = true; + + video.setAttribute('autoplay', 'autoplay'); + } + + video.setAttribute('playsinline', 'playsinline'); + video.setAttribute('preload', 'auto'); + + video.addEventListener('error', this._callbacks.error, true); + + try + { + video.srcObject = stream; + } + catch (error) + { + video.src = window.URL.createObjectURL(stream); + } + + video.load(); + + this.video = video; + + return this; + }, + /** * This internal method is called automatically if the playback Promise resolves successfully. * @@ -49360,12 +53766,12 @@ var Video = new Class({ * @fires Phaser.GameObjects.Events#VIDEO_ERROR * @private * @since 3.20.0 - * + * * @param {any} error - The Promise resolution error. */ playPromiseErrorHandler: function (error) { - this.scene.sys.input.once('pointerdown', this.unlockHandler, this); + this.scene.sys.input.once(InputEvents.POINTER_DOWN, this.unlockHandler, this); this.touchLocked = true; this.playWhenUnlocked = true; @@ -49375,7 +53781,7 @@ var Video = new Class({ /** * Called when the video emits a `playing` event during load. - * + * * This is only listened for if the browser doesn't support Promises. * * @method Phaser.GameObjects.Video#playHandler @@ -49387,7 +53793,7 @@ var Video = new Class({ this.touchLocked = false; this.emit(Events.VIDEO_PLAY, this); - + this.video.removeEventListener('playing', this._callbacks.play, true); }, @@ -49398,7 +53804,7 @@ var Video = new Class({ * @fires Phaser.GameObjects.Events#VIDEO_ERROR * @private * @since 3.20.0 - * + * * @param {Event} event - The error Event. */ loadErrorHandler: function (event) @@ -49417,7 +53823,7 @@ var Video = new Class({ * @fires Phaser.GameObjects.Events#VIDEO_PLAY * @private * @since 3.20.0 - * + * * @param {any} error - The Promise resolution error. */ unlockHandler: function () @@ -49439,7 +53845,7 @@ var Video = new Class({ /** * Called when the video completes playback, i.e. reaches an `ended` state. - * + * * This will never happen if the video is coming from a live stream, where the duration is `Infinity`. * * @method Phaser.GameObjects.Video#completeHandler @@ -49453,7 +53859,7 @@ var Video = new Class({ /** * Called when the video emits a `timeUpdate` event during playback. - * + * * This event is too slow and irregular to be used for actual video timing or texture updating, * but we can use it to determine if a video has looped. * @@ -49566,11 +53972,11 @@ var Video = new Class({ this.videoTexture = this.scene.sys.textures.create(this._key, video, width, height); this.videoTextureSource = this.videoTexture.source[0]; this.videoTexture.add('__BASE', 0, 0, 0, width, height); - + this.setTexture(this.videoTexture); this.setSizeToFrame(); this.updateDisplayOrigin(); - + this.emit(Events.VIDEO_CREATED, this, width, height); } else @@ -49583,7 +53989,7 @@ var Video = new Class({ textureSource.width = width; textureSource.height = height; } - + textureSource.update(); } }, @@ -49594,7 +54000,7 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#getVideoKey * @since 3.20.0 - * + * * @return {string} The key of the video being played from the Video Cache, if any. */ getVideoKey: function () @@ -49605,19 +54011,19 @@ var Video = new Class({ /** * Seeks to a given point in the video. The value is given as a float between 0 and 1, * where 0 represents the start of the video and 1 represents the end. - * + * * Seeking only works if the video has a duration, so will not work for live streams. - * + * * When seeking begins, this video will emit a `seeking` event. When the video completes * seeking (i.e. reaches its designated timestamp) it will emit a `seeked` event. - * + * * If you wish to seek based on time instead, use the `Video.setCurrentTime` method. * * @method Phaser.GameObjects.Video#seekTo * @since 3.20.0 - * + * * @param {number} value - The point in the video to seek to. A value between 0 and 1. - * + * * @return {this} This Video Game Object for method chaining. */ seekTo: function (value) @@ -49645,7 +54051,7 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#getCurrentTime * @since 3.20.0 - * + * * @return {number} A double-precision floating-point value indicating the current playback time in seconds. */ getCurrentTime: function () @@ -49655,22 +54061,22 @@ var Video = new Class({ /** * Seeks to a given playback time in the video. The value is given in _seconds_ or as a string. - * + * * Seeking only works if the video has a duration, so will not work for live streams. - * + * * When seeking begins, this video will emit a `seeking` event. When the video completes * seeking (i.e. reaches its designated timestamp) it will emit a `seeked` event. - * + * * You can provide a string prefixed with either a `+` or a `-`, such as `+2.5` or `-2.5`. * In this case it will seek to +/- the value given, relative to the _current time_. - * + * * If you wish to seek based on a duration percentage instead, use the `Video.seekTo` method. * * @method Phaser.GameObjects.Video#setCurrentTime * @since 3.20.0 - * + * * @param {(string|number)} value - The playback time to seek to in seconds. Can be expressed as a string, such as `+2` to seek 2 seconds ahead from the current time. - * + * * @return {this} This Video Game Object for method chaining. */ setCurrentTime: function (value) @@ -49707,7 +54113,7 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#isSeeking * @since 3.20.0 - * + * * @return {boolean} A boolean indicating if this Video is currently seeking, or not. */ isSeeking: function () @@ -49755,12 +54161,12 @@ var Video = new Class({ /** * Returns the current progress of the video. Progress is defined as a value between 0 (the start) * and 1 (the end). - * + * * Progress can only be returned if the video has a duration, otherwise it will always return zero. * * @method Phaser.GameObjects.Video#getProgress * @since 3.20.0 - * + * * @return {number} The current progress of playback. If the video has no duration, will always return zero. */ getProgress: function () @@ -49777,20 +54183,20 @@ var Video = new Class({ return now / duration; } } - + return 0; }, /** * A double-precision floating-point value which indicates the duration (total length) of the media in seconds, * on the media's timeline. If no media is present on the element, or the media is not valid, the returned value is NaN. - * + * * If the media has no known end (such as for live streams of unknown duration, web radio, media incoming from WebRTC, * and so forth), this value is +Infinity. - * + * * @method Phaser.GameObjects.Video#getDuration * @since 3.20.0 - * + * * @return {number} A double-precision floating-point value indicating the duration of the media in seconds. */ getDuration: function () @@ -49803,9 +54209,9 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#setMute * @since 3.20.0 - * + * * @param {boolean} [value=true] - The mute value. `true` if the video should be muted, otherwise `false`. - * + * * @return {this} This Video Game Object for method chaining. */ setMute: function (value) @@ -49829,7 +54235,7 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#isMuted * @since 3.20.0 - * + * * @return {boolean} A boolean indicating if this Video is currently muted, or not. */ isMuted: function () @@ -49843,7 +54249,7 @@ var Video = new Class({ * @method Phaser.GameObjects.Video#globalMute * @private * @since 3.20.0 - * + * * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the Sound Manager that emitted the event. * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. */ @@ -49895,17 +54301,17 @@ var Video = new Class({ /** * Sets the paused state of the currently loaded video. - * + * * If the video is playing, calling this method with `true` will pause playback. * If the video is paused, calling this method with `false` will resume playback. - * + * * If no video is loaded, this method does nothing. * * @method Phaser.GameObjects.Video#setPaused * @since 3.20.0 - * + * * @param {boolean} [value=true] - The paused value. `true` if the video should be paused, `false` to resume it. - * + * * @return {this} This Video Game Object for method chaining. */ setPaused: function (value) @@ -49939,27 +54345,27 @@ var Video = new Class({ /** * Returns a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). - * + * * @method Phaser.GameObjects.Video#getVolume * @since 3.20.0 - * + * * @return {number} A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). */ getVolume: function () { return (this.video) ? this.video.volume : 1; }, - + /** * Sets the volume of the currently playing video. - * + * * The value given is a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). - * + * * @method Phaser.GameObjects.Video#setVolume * @since 3.20.0 - * + * * @param {number} [value=1] - A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). - * + * * @return {this} This Video Game Object for method chaining. */ setVolume: function (value) @@ -49976,10 +54382,10 @@ var Video = new Class({ /** * Returns a double that indicates the rate at which the media is being played back. - * + * * @method Phaser.GameObjects.Video#getPlaybackRate * @since 3.20.0 - * + * * @return {number} A double that indicates the rate at which the media is being played back. */ getPlaybackRate: function () @@ -49989,14 +54395,14 @@ var Video = new Class({ /** * Sets the playback rate of the current video. - * + * * The value given is a double that indicates the rate at which the media is being played back. - * + * * @method Phaser.GameObjects.Video#setPlaybackRate * @since 3.20.0 - * + * * @param {number} [rate] - A double that indicates the rate at which the media is being played back. - * + * * @return {this} This Video Game Object for method chaining. */ setPlaybackRate: function (rate) @@ -50011,10 +54417,10 @@ var Video = new Class({ /** * Returns a boolean which indicates whether the media element should start over when it reaches the end. - * + * * @method Phaser.GameObjects.Video#getLoop * @since 3.20.0 - * + * * @return {boolean} A boolean which indicates whether the media element will start over when it reaches the end. */ getLoop: function () @@ -50024,18 +54430,18 @@ var Video = new Class({ /** * Sets the loop state of the current video. - * + * * The value given is a boolean which indicates whether the media element will start over when it reaches the end. - * + * * Not all videos can loop, for example live streams. - * + * * Please note that not all browsers support _seamless_ video looping for all encoding formats. - * + * * @method Phaser.GameObjects.Video#setLoop * @since 3.20.0 - * + * * @param {boolean} [value=true] - A boolean which indicates whether the media element will start over when it reaches the end. - * + * * @return {this} This Video Game Object for method chaining. */ setLoop: function (value) @@ -50052,23 +54458,23 @@ var Video = new Class({ /** * Returns a boolean which indicates whether the video is currently playing. - * + * * @method Phaser.GameObjects.Video#isPlaying * @since 3.20.0 - * + * * @return {boolean} A boolean which indicates whether the video is playing, or not. */ isPlaying: function () { return (this.video) ? !(this.video.paused || this.video.ended) : false; }, - + /** * Returns a boolean which indicates whether the video is currently paused. - * + * * @method Phaser.GameObjects.Video#isPaused * @since 3.20.0 - * + * * @return {boolean} A boolean which indicates whether the video is paused, or not. */ isPaused: function () @@ -50079,26 +54485,26 @@ var Video = new Class({ /** * Stores this Video in the Texture Manager using the given key as a dynamic texture, * which any texture-based Game Object, such as a Sprite, can use as its texture: - * + * * ```javascript * var vid = this.add.video(0, 0, 'intro'); - * + * * vid.play(); - * + * * vid.saveTexture('doodle'); - * + * * this.add.image(400, 300, 'doodle'); * ``` - * + * * The saved texture is automatically updated as the video plays. If you pause this video, * or change its source, then the saved texture updates instantly. - * + * * Calling `saveTexture` again will not save another copy of the same texture, it will just rename the existing one. - * + * * By default it will create a single base texture. You can add frames to the texture * by using the `Texture.add` method. After doing this, you can then allow Game Objects * to use a specific frame. - * + * * If you intend to save the texture so you can use it as the input for a Shader, you may need to set the * `flipY` parameter to `true` if you find the video renders upside down in your shader. * @@ -50135,14 +54541,14 @@ var Video = new Class({ * Stops the video playing and clears all internal event listeners. * * If you only wish to pause playback of the video, and resume it a later time, use the `Video.pause` method instead. - * + * * If the video hasn't finished downloading, calling this method will not abort the download. To do that you need to * call `destroy` instead. * * @method Phaser.GameObjects.Video#stop * @fires Phaser.GameObjects.Events#VIDEO_STOP * @since 3.20.0 - * + * * @return {this} This Video Game Object for method chaining. */ stop: function () @@ -50173,13 +54579,13 @@ var Video = new Class({ /** * Removes the Video element from the DOM by calling parentNode.removeChild on itself. - * + * * Also removes the autoplay and src attributes and nulls the Video reference. - * + * * You should not call this method if you were playing a video from the Video Cache that * you wish to play again in your game, or if another Video object is also using the same * video. - * + * * If you loaded an external video via `Video.loadURL` then you should call this function * to clear up once you are done with the instance. * @@ -50213,9 +54619,9 @@ var Video = new Class({ /** * Handles the pre-destroy step for the Video object. - * + * * This calls `Video.stop` and optionally `Video.removeVideoElement`. - * + * * If any Sprites are using this Video as their texture it is up to you to manage those. * * @method Phaser.GameObjects.Video#preDestroy @@ -50255,7 +54661,7 @@ module.exports = Video; /***/ }), -/* 212 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -50265,16 +54671,16 @@ module.exports = Video; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(213); -var GetPoints = __webpack_require__(437); -var GEOM_CONST = __webpack_require__(49); +var Contains = __webpack_require__(219); +var GetPoints = __webpack_require__(447); +var GEOM_CONST = __webpack_require__(55); /** * @classdesc * A Polygon object * * The polygon is a closed shape consists of a series of connected straight lines defined by list of ordered points. - * Several formats are supported to define the list of points, check the setTo method for details. + * Several formats are supported to define the list of points, check the setTo method for details. * This is a geometry object allowing you to define and inspect the shape. * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. * To render a Polygon you should look at the capabilities of the Graphics class. @@ -50284,7 +54690,7 @@ var GEOM_CONST = __webpack_require__(49); * @constructor * @since 3.0.0 * - * @param {Phaser.Geom.Point[]} [points] - List of points defining the perimeter of this Polygon. Several formats are supported: + * @param {(string|number[]|Phaser.Types.Math.Vector2Like[])} [points] - List of points defining the perimeter of this Polygon. Several formats are supported: * - A string containing paired x y values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` * - An array of objects with public x y properties: `[obj1, obj2, ...]` @@ -50302,7 +54708,7 @@ var Polygon = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Polygon#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -50365,7 +54771,7 @@ var Polygon = new Class({ * @method Phaser.Geom.Polygon#setTo * @since 3.0.0 * - * @param {array} points - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. + * @param {(string|number[]|Phaser.Types.Math.Vector2Like[])} [points] - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. * * @return {this} This Polygon object. */ @@ -50472,7 +54878,7 @@ var Polygon = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the perimeter of the Polygon and dividing it by the stepRate. * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -50489,7 +54895,7 @@ module.exports = Polygon; /***/ }), -/* 213 */ +/* 219 */ /***/ (function(module, exports) { /** @@ -50538,668 +54944,7 @@ module.exports = Contains; /***/ }), -/* 214 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Mesh = __webpack_require__(142); - -/** - * @classdesc - * A Quad Game Object. - * - * A Quad is a Mesh Game Object pre-configured with two triangles arranged into a rectangle, with a single - * texture spread across them. - * - * You can manipulate the corner points of the quad via the getters and setters such as `topLeftX`, and also - * change their alpha and color values. The quad itself can be moved by adjusting the `x` and `y` properties. - * - * @class Quad - * @extends Phaser.GameObjects.Mesh - * @memberof Phaser.GameObjects - * @constructor - * @webglOnly - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene to which this Quad belongs. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - */ -var Quad = new Class({ - - Extends: Mesh, - - initialize: - - function Quad (scene, x, y, texture, frame) - { - // 0----3 - // |\ B| - // | \ | - // | \ | - // | A \| - // | \ - // 1----2 - - var vertices = [ - 0, 0, // tl - 0, 0, // bl - 0, 0, // br - 0, 0, // tl - 0, 0, // br - 0, 0 // tr - ]; - - var uv = [ - 0, 0, // tl - 0, 1, // bl - 1, 1, // br - 0, 0, // tl - 1, 1, // br - 1, 0 // tr - ]; - - var colors = [ - 0xffffff, // tl - 0xffffff, // bl - 0xffffff, // br - 0xffffff, // tl - 0xffffff, // br - 0xffffff // tr - ]; - - var alphas = [ - 1, // tl - 1, // bl - 1, // br - 1, // tl - 1, // br - 1 // tr - ]; - - Mesh.call(this, scene, x, y, vertices, uv, colors, alphas, texture, frame); - - this.resetPosition(); - }, - - /** - * Sets the frame this Game Object will use to render with. - * - * The Frame has to belong to the current Texture being used. - * - * It can be either a string or an index. - * - * Calling `setFrame` will modify the `width` and `height` properties of your Game Object. - * It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer. - * - * @method Phaser.GameObjects.Quad#setFrame - * @since 3.11.0 - * - * @param {(string|integer)} frame - The name or index of the frame within the Texture. - * - * @return {this} This Game Object instance. - */ - setFrame: function (frame) - { - this.frame = this.texture.get(frame); - - if (!this.frame.cutWidth || !this.frame.cutHeight) - { - this.renderFlags &= ~8; - } - else - { - this.renderFlags |= 8; - } - - frame = this.frame; - - // TL - this.uv[0] = frame.u0; - this.uv[1] = frame.v0; - - // BL - this.uv[2] = frame.u0; - this.uv[3] = frame.v1; - - // BR - this.uv[4] = frame.u1; - this.uv[5] = frame.v1; - - // TL - this.uv[6] = frame.u0; - this.uv[7] = frame.v0; - - // BR - this.uv[8] = frame.u1; - this.uv[9] = frame.v1; - - // TR - this.uv[10] = frame.u1; - this.uv[11] = frame.v0; - - return this; - }, - - /** - * The top-left x vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#topLeftX - * @type {number} - * @since 3.0.0 - */ - topLeftX: { - - get: function () - { - return this.x + this.vertices[0]; - }, - - set: function (value) - { - this.vertices[0] = value - this.x; - this.vertices[6] = value - this.x; - } - - }, - - /** - * The top-left y vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#topLeftY - * @type {number} - * @since 3.0.0 - */ - topLeftY: { - - get: function () - { - return this.y + this.vertices[1]; - }, - - set: function (value) - { - this.vertices[1] = value - this.y; - this.vertices[7] = value - this.y; - } - - }, - - /** - * The top-right x vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#topRightX - * @type {number} - * @since 3.0.0 - */ - topRightX: { - - get: function () - { - return this.x + this.vertices[10]; - }, - - set: function (value) - { - this.vertices[10] = value - this.x; - } - - }, - - /** - * The top-right y vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#topRightY - * @type {number} - * @since 3.0.0 - */ - topRightY: { - - get: function () - { - return this.y + this.vertices[11]; - }, - - set: function (value) - { - this.vertices[11] = value - this.y; - } - - }, - - /** - * The bottom-left x vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomLeftX - * @type {number} - * @since 3.0.0 - */ - bottomLeftX: { - - get: function () - { - return this.x + this.vertices[2]; - }, - - set: function (value) - { - this.vertices[2] = value - this.x; - } - - }, - - /** - * The bottom-left y vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomLeftY - * @type {number} - * @since 3.0.0 - */ - bottomLeftY: { - - get: function () - { - return this.y + this.vertices[3]; - }, - - set: function (value) - { - this.vertices[3] = value - this.y; - } - - }, - - /** - * The bottom-right x vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomRightX - * @type {number} - * @since 3.0.0 - */ - bottomRightX: { - - get: function () - { - return this.x + this.vertices[4]; - }, - - set: function (value) - { - this.vertices[4] = value - this.x; - this.vertices[8] = value - this.x; - } - - }, - - /** - * The bottom-right y vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomRightY - * @type {number} - * @since 3.0.0 - */ - bottomRightY: { - - get: function () - { - return this.y + this.vertices[5]; - }, - - set: function (value) - { - this.vertices[5] = value - this.y; - this.vertices[9] = value - this.y; - } - - }, - - /** - * The top-left alpha value of this Quad. - * - * @name Phaser.GameObjects.Quad#topLeftAlpha - * @type {number} - * @since 3.0.0 - */ - topLeftAlpha: { - - get: function () - { - return this.alphas[0]; - }, - - set: function (value) - { - this.alphas[0] = value; - this.alphas[3] = value; - } - - }, - - /** - * The top-right alpha value of this Quad. - * - * @name Phaser.GameObjects.Quad#topRightAlpha - * @type {number} - * @since 3.0.0 - */ - topRightAlpha: { - - get: function () - { - return this.alphas[5]; - }, - - set: function (value) - { - this.alphas[5] = value; - } - - }, - - /** - * The bottom-left alpha value of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomLeftAlpha - * @type {number} - * @since 3.0.0 - */ - bottomLeftAlpha: { - - get: function () - { - return this.alphas[1]; - }, - - set: function (value) - { - this.alphas[1] = value; - } - - }, - - /** - * The bottom-right alpha value of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomRightAlpha - * @type {number} - * @since 3.0.0 - */ - bottomRightAlpha: { - - get: function () - { - return this.alphas[2]; - }, - - set: function (value) - { - this.alphas[2] = value; - this.alphas[4] = value; - } - - }, - - /** - * The top-left color value of this Quad. - * - * @name Phaser.GameObjects.Quad#topLeftColor - * @type {number} - * @since 3.0.0 - */ - topLeftColor: { - - get: function () - { - return this.colors[0]; - }, - - set: function (value) - { - this.colors[0] = value; - this.colors[3] = value; - } - - }, - - /** - * The top-right color value of this Quad. - * - * @name Phaser.GameObjects.Quad#topRightColor - * @type {number} - * @since 3.0.0 - */ - topRightColor: { - - get: function () - { - return this.colors[5]; - }, - - set: function (value) - { - this.colors[5] = value; - } - - }, - - /** - * The bottom-left color value of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomLeftColor - * @type {number} - * @since 3.0.0 - */ - bottomLeftColor: { - - get: function () - { - return this.colors[1]; - }, - - set: function (value) - { - this.colors[1] = value; - } - - }, - - /** - * The bottom-right color value of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomRightColor - * @type {number} - * @since 3.0.0 - */ - bottomRightColor: { - - get: function () - { - return this.colors[2]; - }, - - set: function (value) - { - this.colors[2] = value; - this.colors[4] = value; - } - - }, - - /** - * Sets the top-left vertex position of this Quad. - * - * @method Phaser.GameObjects.Quad#setTopLeft - * @since 3.0.0 - * - * @param {number} x - The horizontal coordinate of the vertex. - * @param {number} y - The vertical coordinate of the vertex. - * - * @return {this} This Game Object. - */ - setTopLeft: function (x, y) - { - this.topLeftX = x; - this.topLeftY = y; - - return this; - }, - - /** - * Sets the top-right vertex position of this Quad. - * - * @method Phaser.GameObjects.Quad#setTopRight - * @since 3.0.0 - * - * @param {number} x - The horizontal coordinate of the vertex. - * @param {number} y - The vertical coordinate of the vertex. - * - * @return {this} This Game Object. - */ - setTopRight: function (x, y) - { - this.topRightX = x; - this.topRightY = y; - - return this; - }, - - /** - * Sets the bottom-left vertex position of this Quad. - * - * @method Phaser.GameObjects.Quad#setBottomLeft - * @since 3.0.0 - * - * @param {number} x - The horizontal coordinate of the vertex. - * @param {number} y - The vertical coordinate of the vertex. - * - * @return {this} This Game Object. - */ - setBottomLeft: function (x, y) - { - this.bottomLeftX = x; - this.bottomLeftY = y; - - return this; - }, - - /** - * Sets the bottom-right vertex position of this Quad. - * - * @method Phaser.GameObjects.Quad#setBottomRight - * @since 3.0.0 - * - * @param {number} x - The horizontal coordinate of the vertex. - * @param {number} y - The vertical coordinate of the vertex. - * - * @return {this} This Game Object. - */ - setBottomRight: function (x, y) - { - this.bottomRightX = x; - this.bottomRightY = y; - - return this; - }, - - /** - * Resets the positions of the four corner vertices of this Quad. - * - * @method Phaser.GameObjects.Quad#resetPosition - * @since 3.0.0 - * - * @return {this} This Game Object. - */ - resetPosition: function () - { - var x = this.x; - var y = this.y; - var halfWidth = Math.floor(this.width / 2); - var halfHeight = Math.floor(this.height / 2); - - this.setTopLeft(x - halfWidth, y - halfHeight); - this.setTopRight(x + halfWidth, y - halfHeight); - this.setBottomLeft(x - halfWidth, y + halfHeight); - this.setBottomRight(x + halfWidth, y + halfHeight); - - return this; - }, - - /** - * Resets the alpha values used by this Quad back to 1. - * - * @method Phaser.GameObjects.Quad#resetAlpha - * @since 3.0.0 - * - * @return {this} This Game Object. - */ - resetAlpha: function () - { - var alphas = this.alphas; - - alphas[0] = 1; - alphas[1] = 1; - alphas[2] = 1; - alphas[3] = 1; - alphas[4] = 1; - alphas[5] = 1; - - return this; - }, - - /** - * Resets the color values used by this Quad back to 0xffffff. - * - * @method Phaser.GameObjects.Quad#resetColors - * @since 3.0.0 - * - * @return {this} This Game Object. - */ - resetColors: function () - { - var colors = this.colors; - - colors[0] = 0xffffff; - colors[1] = 0xffffff; - colors[2] = 0xffffff; - colors[3] = 0xffffff; - colors[4] = 0xffffff; - colors[5] = 0xffffff; - - return this; - }, - - /** - * Resets the position, alpha and color values used by this Quad. - * - * @method Phaser.GameObjects.Quad#reset - * @since 3.0.0 - * - * @return {this} This Game Object. - */ - reset: function () - { - this.resetPosition(); - - this.resetAlpha(); - - return this.resetColors(); - } - -}); - -module.exports = Quad; - - -/***/ }), -/* 215 */ +/* 220 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -51212,10 +54957,10 @@ var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); var GetFastValue = __webpack_require__(2); -var Extend = __webpack_require__(19); -var SetValue = __webpack_require__(445); -var ShaderRender = __webpack_require__(1100); -var TransformMatrix = __webpack_require__(31); +var Extend = __webpack_require__(18); +var SetValue = __webpack_require__(455); +var ShaderRender = __webpack_require__(1159); +var TransformMatrix = __webpack_require__(24); /** * @classdesc @@ -51314,7 +55059,7 @@ var Shader = new Class({ * This Game Object cannot have a blend mode, so skip all checks. * * @name Phaser.GameObjects.Shader#blendMode - * @type {integer} + * @type {number} * @private * @since 3.17.0 */ @@ -51708,9 +55453,9 @@ var Shader = new Class({ var program = renderer.createProgram(this.shader.vertexSrc, this.shader.fragmentSrc); // The default uniforms available within the vertex shader - renderer.setMatrix4(program, 'uViewMatrix', false, this.viewMatrix); - renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); - renderer.setFloat2(program, 'uResolution', this.width, this.height); + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uViewMatrix'), false, this.viewMatrix); + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uProjectionMatrix'), false, this.projectionMatrix); + gl.uniform2f(gl.getUniformLocation(program, 'uResolution'), this.width, this.height); this.program = program; @@ -51806,7 +55551,12 @@ var Shader = new Class({ var program = this.program; - this.renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); + var gl = this.gl; + var renderer = this.renderer; + + renderer.setProgram(program); + + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uProjectionMatrix'), false, this.projectionMatrix); this._rendererWidth = right; this._rendererHeight = bottom; @@ -51872,9 +55622,9 @@ var Shader = new Class({ * * @param {string} uniformKey - The key of the sampler2D uniform to be updated, i.e. `iChannel0`. * @param {WebGLTexture} texture - A WebGLTexture reference. - * @param {integer} width - The width of the texture. - * @param {integer} height - The height of the texture. - * @param {integer} [textureIndex=0] - The texture index. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} [textureIndex=0] - The texture index. * @param {any} [textureData] - Additional texture data. * * @return {this} This Shader instance. @@ -51913,7 +55663,7 @@ var Shader = new Class({ * * @param {string} uniformKey - The key of the sampler2D uniform to be updated, i.e. `iChannel0`. * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. - * @param {integer} [textureIndex=0] - The texture index. + * @param {number} [textureIndex=0] - The texture index. * @param {any} [textureData] - Additional texture data. * * @return {this} This Shader instance. @@ -52420,7 +56170,7 @@ module.exports = Shader; /***/ }), -/* 216 */ +/* 221 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52429,7 +56179,1063 @@ module.exports = Shader; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DistanceBetween = __webpack_require__(55); +var Class = __webpack_require__(0); +var Components = __webpack_require__(11); +var DegToRad = __webpack_require__(34); +var Face = __webpack_require__(111); +var GameObject = __webpack_require__(14); +var GameObjectEvents = __webpack_require__(32); +var GenerateVerts = __webpack_require__(456); +var GenerateObjVerts = __webpack_require__(457); +var GetCalcMatrix = __webpack_require__(21); +var Matrix4 = __webpack_require__(73); +var MeshRender = __webpack_require__(1162); +var StableSort = __webpack_require__(90); +var Vector3 = __webpack_require__(37); +var Vertex = __webpack_require__(113); + +/** + * @classdesc + * A Mesh Game Object. + * + * The Mesh Game Object allows you to render a group of textured vertices and manipulate + * the view of those vertices, such as rotation, translation or scaling. + * + * Support for generating mesh data from grids, model data or Wavefront OBJ Files is included. + * + * Although you can use this to render 3D objects, its primary use is for displaying more complex + * Sprites, or Sprites where you need fine-grained control over the vertice positions in order to + * achieve special effects in your games. Note that rendering still takes place using Phasers + * orthographic camera. As a result, all depth and face tests are done in orthographic space. + * + * The rendering process will iterate through the faces of this Mesh and render out each face + * that is considered as being in view of the camera. No depth buffer is used, and because of this, + * you should be careful not to use model data with too many vertices, or overlapping geometry, + * or you'll probably encounter z-depth fighting. The Mesh was designed to allow for more advanced + * 2D layouts, rather than displaying 3D objects, even though it can do this to a degree. + * + * In short, if you want to remake Crysis, use a 3D engine, not a Mesh. However, if you want + * to easily add some small fun 3D elements into your game, or create some special effects involving + * vertex warping, this is the right object for you. Mesh data becomes part of the WebGL batch, + * just like standard Sprites, so doesn't introduce any additional shader overhead. Because + * the Mesh just generates vertices into the WebGL batch, like any other Sprite, you can use all of + * the common Game Object components on a Mesh too, such as a custom pipeline, mask, blend mode + * or texture. + * + * Note that the Mesh object is WebGL only and does not have a Canvas counterpart. + * + * The Mesh origin is always 0.5 x 0.5 and cannot be changed. + * + * @class Mesh + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @webglOnly + * @since 3.0.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * @extends Phaser.GameObjects.Components.ScrollFactor + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x] - The horizontal position of this Game Object in the world. + * @param {number} [y] - The vertical position of this Game Object in the world. + * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number[]} [vertices] - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} [uvs] - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + */ +var Mesh = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.Mask, + Components.Pipeline, + Components.Size, + Components.Texture, + Components.Transform, + Components.Visible, + Components.ScrollFactor, + MeshRender + ], + + initialize: + + function Mesh (scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (texture === undefined) { texture = '__WHITE'; } + + GameObject.call(this, scene, 'Mesh'); + + /** + * An array containing the Face instances belonging to this Mesh. + * + * A Face consists of 3 Vertex objects. + * + * This array is populated during calls such as `addVertices` or `addOBJ`. + * + * @name Phaser.GameObjects.Mesh#faces + * @type {Phaser.Geom.Mesh.Face[]} + * @since 3.50.0 + */ + this.faces = []; + + /** + * An array containing Vertex instances. One instance per vertex in this Mesh. + * + * This array is populated during calls such as `addVertex` or `addOBJ`. + * + * @name Phaser.GameObjects.Mesh#vertices + * @type {Phaser.Geom.Mesh.Vertex[]} + * @since 3.50.0 + */ + this.vertices = []; + + /** + * The tint fill mode. + * + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertex colors replace the texture, but respects texture alpha. + * + * @name Phaser.GameObjects.Mesh#tintFill + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.tintFill = false; + + /** + * You can optionally choose to render the vertices of this Mesh to a Graphics instance. + * + * Achieve this by setting the `debugCallback` and the `debugGraphic` properties. + * + * You can do this in a single call via the `Mesh.setDebug` method, which will use the + * built-in debug function. You can also set it to your own callback. The callback + * will be invoked _once per render_ and sent the following parameters: + * + * `debugCallback(src, meshLength, verts)` + * + * `src` is the Mesh instance being debugged. + * `meshLength` is the number of mesh vertices in total. + * `verts` is an array of the translated vertex coordinates. + * + * To disable rendering, set this property back to `null`. + * + * Please note that high vertex count Meshes will struggle to debug properly. + * + * @name Phaser.GameObjects.Mesh#debugCallback + * @type {function} + * @since 3.50.0 + */ + this.debugCallback = null; + + /** + * The Graphics instance that the debug vertices will be drawn to, if `setDebug` has + * been called. + * + * @name Phaser.GameObjects.Mesh#debugGraphic + * @type {Phaser.GameObjects.Graphics} + * @since 3.50.0 + */ + this.debugGraphic = null; + + /** + * When rendering, skip any Face that isn't counter clockwise? + * + * Enable this to hide backward-facing Faces during rendering. + * + * Disable it to render all Faces. + * + * @name Phaser.GameObjects.Mesh#hideCCW + * @type {boolean} + * @since 3.50.0 + */ + this.hideCCW = true; + + /** + * A Vector3 containing the 3D position of the vertices in this Mesh. + * + * Modifying the components of this property will allow you to reposition where + * the vertices are rendered within the Mesh. This happens in the `preUpdate` phase, + * where each vertex is transformed using the view and projection matrices. + * + * Changing this property will impact all vertices being rendered by this Mesh. + * + * You can also adjust the 'view' by using the `pan` methods. + * + * @name Phaser.GameObjects.Mesh#modelPosition + * @type {Phaser.Math.Vector3} + * @since 3.50.0 + */ + this.modelPosition = new Vector3(); + + /** + * A Vector3 containing the 3D scale of the vertices in this Mesh. + * + * Modifying the components of this property will allow you to scale + * the vertices within the Mesh. This happens in the `preUpdate` phase, + * where each vertex is transformed using the view and projection matrices. + * + * Changing this property will impact all vertices being rendered by this Mesh. + * + * @name Phaser.GameObjects.Mesh#modelScale + * @type {Phaser.Math.Vector3} + * @since 3.50.0 + */ + this.modelScale = new Vector3(1, 1, 1); + + /** + * A Vector3 containing the 3D rotation of the vertices in this Mesh. + * + * The values should be given in radians, i.e. to rotate the vertices by 90 + * degrees you can use `modelRotation.x = Phaser.Math.DegToRad(90)`. + * + * Modifying the components of this property will allow you to rotate + * the vertices within the Mesh. This happens in the `preUpdate` phase, + * where each vertex is transformed using the view and projection matrices. + * + * Changing this property will impact all vertices being rendered by this Mesh. + * + * @name Phaser.GameObjects.Mesh#modelRotation + * @type {Phaser.Math.Vector3} + * @since 3.50.0 + */ + this.modelRotation = new Vector3(); + + /** + * An internal cache, used to compare position, rotation, scale and face data + * each frame, to avoid math calculations in `preUpdate`. + * + * Cache structure = position xyz | rotation xyz | scale xyz | face count | view | ortho + * + * @name Phaser.GameObjects.Mesh#dirtyCache + * @type {number[]} + * @private + * @since 3.50.0 + */ + this.dirtyCache = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + + /** + * The transformation matrix for this Mesh. + * + * @name Phaser.GameObjects.Mesh#transformMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.transformMatrix = new Matrix4(); + + /** + * The view position for this Mesh. + * + * Use the methods`panX`, `panY` and `panZ` to adjust the view. + * + * @name Phaser.GameObjects.Mesh#viewPosition + * @type {Phaser.Math.Vector3} + * @since 3.50.0 + */ + this.viewPosition = new Vector3(); + + /** + * The view matrix for this Mesh. + * + * @name Phaser.GameObjects.Mesh#viewMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.viewMatrix = new Matrix4(); + + /** + * The projection matrix for this Mesh. + * + * Update it with the `setPerspective` or `setOrtho` methods. + * + * @name Phaser.GameObjects.Mesh#projectionMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.projectionMatrix = new Matrix4(); + + /** + * How many faces were rendered by this Mesh Game Object in the last + * draw? This is reset in the `preUpdate` method and then incremented + * each time a face is drawn. Note that in multi-camera Scenes this + * value may exceed that found in `Mesh.getFaceCount` due to + * cameras drawing the same faces more than once. + * + * @name Phaser.GameObjects.Mesh#totalRendered + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.totalRendered = 0; + + /** + * Internal cache var for the total number of faces rendered this frame. + * + * See `totalRendered` instead for the actual value. + * + * @name Phaser.GameObjects.Mesh#totalFrame + * @type {number} + * @private + * @since 3.50.0 + */ + this.totalFrame = 0; + + /** + * By default, the Mesh will check to see if its model or view transform has + * changed each frame and only recalculate the vertex positions if they have. + * + * This avoids lots of additional math in the `preUpdate` step when not required. + * + * However, if you are performing per-Face or per-Vertex manipulation on this Mesh, + * such as tweening a Face, or moving it without moving the rest of the Mesh, + * then you may need to disable the dirty cache in order for the Mesh to re-render + * correctly. You can toggle this property to do that. Please note that leaving + * this set to `true` will cause the Mesh to recalculate the position of every single + * vertex in it, every single frame. So only really do this if you know you + * need it. + * + * @name Phaser.GameObjects.Mesh#ignoreDirtyCache + * @type {boolean} + * @since 3.50.0 + */ + this.ignoreDirtyCache = false; + + var renderer = scene.sys.renderer; + + this.setPosition(x, y); + this.setTexture(texture, frame); + this.setSize(renderer.width, renderer.height); + this.initPipeline(); + + this.setPerspective(renderer.width, renderer.height, 45, 0.01, 1000); + + if (vertices) + { + this.addVertices(vertices, uvs, indicies, containsZ, normals, colors, alphas); + } + + this.on(GameObjectEvents.ADDED_TO_SCENE, this.addedToScene, this); + this.on(GameObjectEvents.REMOVED_FROM_SCENE, this.removedFromScene, this); + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); + }, + + /** + * Translates the view position of this Mesh on the x axis by the given amount. + * + * @method Phaser.GameObjects.Mesh#panX + * @since 3.50.0 + * + * @param {number} v - The amount to pan by. + */ + panX: function (v) + { + this.viewPosition.addScale(Vector3.LEFT, v); + + this.dirtyCache[10] = 1; + + return this; + }, + + /** + * Translates the view position of this Mesh on the y axis by the given amount. + * + * @method Phaser.GameObjects.Mesh#panY + * @since 3.50.0 + * + * @param {number} v - The amount to pan by. + */ + panY: function (v) + { + this.viewPosition.y += Vector3.DOWN.y * v; + + this.dirtyCache[10] = 1; + + return this; + }, + + /** + * Translates the view position of this Mesh on the z axis by the given amount. + * + * @method Phaser.GameObjects.Mesh#panZ + * @since 3.50.0 + * + * @param {number} v - The amount to pan by. + */ + panZ: function (amount) + { + this.viewPosition.z += amount; + + this.dirtyCache[10] = 1; + + return this; + }, + + /** + * Builds a new perspective projection matrix from the given values. + * + * See also `setOrtho`. + * + * @method Phaser.GameObjects.Mesh#setPerspective + * @since 3.50.0 + * + * @param {number} width - The width of the projection matrix. Typically the same as the Mesh and/or Renderer. + * @param {number} height - The height of the projection matrix. Typically the same as the Mesh and/or Renderer. + * @param {number} [fov=45] - The field of view, in degrees. + * @param {number} [near=0.01] - The near value of the view. + * @param {number} [far=1000] - The far value of the view. + */ + setPerspective: function (width, height, fov, near, far) + { + if (fov === undefined) { fov = 45; } + if (near === undefined) { near = 0.01; } + if (far === undefined) { far = 1000; } + + this.projectionMatrix.perspective(DegToRad(fov), width / height, near, far); + + this.dirtyCache[10] = 1; + this.dirtyCache[11] = 0; + + return this; + }, + + /** + * Builds a new orthographic projection matrix from the given values. + * + * If using this mode you will often need to set `Mesh.hideCCW` to `false` as well. + * + * See also `setPerspective`. + * + * @method Phaser.GameObjects.Mesh#setOrtho + * @since 3.50.0 + * + * @param {number} [scaleX=1] - The default horizontal scale in relation to the Mesh / Renderer dimensions. + * @param {number} [scaleY=1] - The default vertical scale in relation to the Mesh / Renderer dimensions. + * @param {number} [near=-1000] - The near value of the view. + * @param {number} [far=1000] - The far value of the view. + */ + setOrtho: function (scaleX, scaleY, near, far) + { + if (scaleX === undefined) { scaleX = 1; } + if (scaleY === undefined) { scaleY = 1; } + if (near === undefined) { near = -1000; } + if (far === undefined) { far = 1000; } + + this.projectionMatrix.ortho(-scaleX, scaleX, -scaleY, scaleY, near, far); + + this.dirtyCache[10] = 1; + this.dirtyCache[11] = 1; + + return this; + }, + + /** + * Iterates and destroys all current Faces in this Mesh, then resets the + * `faces` and `vertices` arrays. + * + * @method Phaser.GameObjects.Mesh#clear + * @since 3.50.0 + * + * @return {this} This Mesh Game Object. + */ + clear: function () + { + this.faces.forEach(function (face) + { + face.destroy(); + }); + + this.faces = []; + this.vertices = []; + + return this; + }, + + /** + * This method will add the data from a triangulated Wavefront OBJ model file to this Mesh. + * + * The data should have been loaded via the OBJFile: + * + * ```javascript + * this.load.obj(key, url); + * ``` + * + * Then use the same `key` as the first parameter to this method. + * + * Multiple Mesh Game Objects can use the same model data without impacting on each other. + * + * Make sure your 3D package has triangulated the model data prior to exporting it. + * + * You can add multiple models to a single Mesh, although they will act as one when + * moved or rotated. You can scale the model data, should it be too small, or too large, to see. + * You can also offset the vertices of the model via the `x`, `y` and `z` parameters. + * + * @method Phaser.GameObjects.Mesh#addVerticesFromObj + * @since 3.50.0 + * + * @param {string} key - The key of the model data in the OBJ Cache to add to this Mesh. + * @param {number} [scale=1] - An amount to scale the model data by. Use this if the model has exported too small, or large, to see. + * @param {number} [x=0] - Translate the model x position by this amount. + * @param {number} [y=0] - Translate the model y position by this amount. + * @param {number} [z=0] - Translate the model z position by this amount. + * @param {number} [rotateX=0] - Rotate the model on the x axis by this amount, in radians. + * @param {number} [rotateY=0] - Rotate the model on the y axis by this amount, in radians. + * @param {number} [rotateZ=0] - Rotate the model on the z axis by this amount, in radians. + * @param {boolean} [zIsUp=true] - Is the z axis up (true), or is y axis up (false)? + * + * @return {this} This Mesh Game Object. + */ + addVerticesFromObj: function (key, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp) + { + var data = this.scene.sys.cache.obj.get(key); + + if (data) + { + GenerateObjVerts(data, this, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp); + } + + return this; + }, + + /** + * Compare the depth of two Faces. + * + * @method Phaser.GameObjects.Mesh#sortByDepth + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Face} faceA - The first Face. + * @param {Phaser.Geom.Mesh.Face} faceB - The second Face. + * + * @return {number} The difference between the depths of each Face. + */ + sortByDepth: function (faceA, faceB) + { + return faceA.depth - faceB.depth; + }, + + /** + * Runs a depth sort across all Faces in this Mesh, comparing their averaged depth. + * + * This is called automatically if you use any of the `rotate` methods, but you can + * also invoke it to sort the Faces should you manually position them. + * + * @method Phaser.GameObjects.Mesh#depthSort + * @since 3.50.0 + * + * @return {this} This Mesh Game Object. + */ + depthSort: function () + { + StableSort(this.faces, this.sortByDepth); + + return this; + }, + + /** + * Adds a new Vertex into the vertices array of this Mesh. + * + * Just adding a vertex isn't enough to render it. You need to also + * make it part of a Face, with 3 Vertex instances per Face. + * + * @method Phaser.GameObjects.Mesh#addVertex + * @since 3.50.0 + * + * @param {number} x - The x position of the vertex. + * @param {number} y - The y position of the vertex. + * @param {number} z - The z position of the vertex. + * @param {number} u - The UV u coordinate of the vertex. + * @param {number} v - The UV v coordinate of the vertex. + * @param {number} [color=0xffffff] - The color value of the vertex. + * @param {number} [alpha=1] - The alpha value of the vertex. + * + * @return {this} This Mesh Game Object. + */ + addVertex: function (x, y, z, u, v, color, alpha) + { + var vert = new Vertex(x, y, z, u, v, color, alpha); + + this.vertices.push(vert); + + return vert; + }, + + /** + * Adds a new Face into the faces array of this Mesh. + * + * A Face consists of references to 3 Vertex instances, which must be provided. + * + * @method Phaser.GameObjects.Mesh#addFace + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Vertex} vertex1 - The first vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex2 - The second vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex3 - The third vertex of the Face. + * + * @return {this} This Mesh Game Object. + */ + addFace: function (vertex1, vertex2, vertex3) + { + var face = new Face(vertex1, vertex2, vertex3); + + this.faces.push(face); + + this.dirtyCache[9] = -1; + + return face; + }, + + /** + * Adds new vertices to this Mesh by parsing the given data. + * + * This method will take vertex data in one of two formats, based on the `containsZ` parameter. + * + * If your vertex data are `x`, `y` pairs, then `containsZ` should be `false` (this is the default) + * + * If your vertex data is groups of `x`, `y` and `z` values, then the `containsZ` parameter must be true. + * + * The `uvs` parameter is a numeric array consisting of `u` and `v` pairs. + * + * The `normals` parameter is a numeric array consisting of `x`, `y` vertex normal values and, if `containsZ` is true, `z` values as well. + * + * The `indicies` parameter is an optional array that, if given, is an indexed list of vertices to be added. + * + * The `colors` parameter is an optional array, or single value, that if given sets the color of each vertex created. + * + * The `alphas` parameter is an optional array, or single value, that if given sets the alpha of each vertex created. + * + * When providing indexed data it is assumed that _all_ of the arrays are indexed, not just the vertices. + * + * The following example will create a 256 x 256 sized quad using an index array: + * + * ```javascript + * const vertices = [ + * -128, 128, + * 128, 128, + * -128, -128, + * 128, -128 + * ]; + * + * const uvs = [ + * 0, 1, + * 1, 1, + * 0, 0, + * 1, 0 + * ]; + * + * const indices = [ 0, 2, 1, 2, 3, 1 ]; + * + * mesh.addVertices(vertices, uvs, indicies); + * ``` + * + * If the data is not indexed, it's assumed that the arrays all contain sequential data. + * + * @method Phaser.GameObjects.Mesh#addVertices + * @since 3.50.0 + * + * @param {number[]} vertices - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} uvs - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + * + * @return {this} This Mesh Game Object. + */ + addVertices: function (vertices, uvs, indicies, containsZ, normals, colors, alphas) + { + var result = GenerateVerts(vertices, uvs, indicies, containsZ, normals, colors, alphas); + + if (result) + { + this.faces = this.faces.concat(result.faces); + this.vertices = this.vertices.concat(result.vertices); + } + + this.dirtyCache[9] = -1; + + return this; + }, + + /** + * Returns the total number of Faces in this Mesh Game Object. + * + * @method Phaser.GameObjects.Mesh#getFaceCount + * @since 3.50.0 + * + * @return {number} The number of Faces in this Mesh Game Object. + */ + getFaceCount: function () + { + return this.faces.length; + }, + + /** + * Returns the total number of Vertices in this Mesh Game Object. + * + * @method Phaser.GameObjects.Mesh#getVertexCount + * @since 3.50.0 + * + * @return {number} The number of Vertices in this Mesh Game Object. + */ + getVertexCount: function () + { + return this.vertices.length; + }, + + /** + * Returns the Face at the given index in this Mesh Game Object. + * + * @method Phaser.GameObjects.Mesh#getFace + * @since 3.50.0 + * + * @param {number} index - The index of the Face to get. + * + * @return {Phaser.Geom.Mesh.Face} The Face at the given index, or `undefined` if index out of range. + */ + getFace: function (index) + { + return this.faces[index]; + }, + + /** + * Return an array of Face objects from this Mesh that intersect with the given coordinates. + * + * The given position is translated through the matrix of this Mesh and the given Camera, + * before being compared against the vertices. + * + * If more than one Face intersects, they will all be returned in the array, but the array will + * be depth sorted first, so the first element will always be that closest to the camera. + * + * @method Phaser.GameObjects.Mesh#getFaceAt + * @since 3.50.0 + * + * @param {number} x - The x position to check against. + * @param {number} y - The y position to check against. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The camera to pass the coordinates through. If not give, the default Scene Camera is used. + * + * @return {Phaser.Geom.Mesh.Face[]} An array of Face objects that intersect with the given point, ordered by depth. + */ + getFaceAt: function (x, y, camera) + { + if (camera === undefined) { camera = this.scene.sys.cameras.main; } + + var calcMatrix = GetCalcMatrix(this, camera).calc; + + var faces = this.faces; + var results = []; + + for (var i = 0; i < faces.length; i++) + { + var face = faces[i]; + + if (face.contains(x, y, calcMatrix)) + { + results.push(face); + } + } + + return StableSort(results, this.sortByDepth); + }, + + /** + * This method enables rendering of the Mesh vertices to the given Graphics instance. + * + * If you enable this feature, you **must** call `Graphics.clear()` in your Scene `update`, + * otherwise the Graphics instance you provide to debug will fill-up with draw calls, + * eventually crashing the browser. This is not done automatically to allow you to debug + * draw multiple Mesh objects to a single Graphics instance. + * + * The Mesh class has a built-in debug rendering callback `Mesh.renderDebug`, however + * you can also provide your own callback to be used instead. Do this by setting the `callback` parameter. + * + * The callback is invoked _once per render_ and sent the following parameters: + * + * `callback(src, faces)` + * + * `src` is the Mesh instance being debugged. + * `faces` is an array of the Faces that were rendered. + * + * You can get the final drawn vertex position from a Face object like this: + * + * ```javascript + * let face = faces[i]; + * + * let x0 = face.vertex1.tx; + * let y0 = face.vertex1.ty; + * let x1 = face.vertex2.tx; + * let y1 = face.vertex2.ty; + * let x2 = face.vertex3.tx; + * let y2 = face.vertex3.ty; + * + * graphic.strokeTriangle(x0, y0, x1, y1, x2, y2); + * ``` + * + * If using your own callback you do not have to provide a Graphics instance to this method. + * + * To disable debug rendering, to either your own callback or the built-in one, call this method + * with no arguments. + * + * @method Phaser.GameObjects.Mesh#setDebug + * @since 3.50.0 + * + * @param {Phaser.GameObjects.Graphics} [graphic] - The Graphic instance to render to if using the built-in callback. + * @param {function} [callback] - The callback to invoke during debug render. Leave as undefined to use the built-in callback. + * + * @return {this} This Game Object instance. + */ + setDebug: function (graphic, callback) + { + this.debugGraphic = graphic; + + if (!graphic && !callback) + { + this.debugCallback = null; + } + else if (!callback) + { + this.debugCallback = this.renderDebug; + } + else + { + this.debugCallback = callback; + } + + return this; + }, + + /** + * Checks if the transformation data in this mesh is dirty. + * + * This is used internally by the `preUpdate` step to determine if the vertices should + * be recalculated or not. + * + * @method Phaser.GameObjects.Mesh#isDirty + * @since 3.50.0 + * + * @return {boolean} Returns `true` if the data of this mesh is dirty, otherwise `false`. + */ + isDirty: function () + { + var position = this.modelPosition; + var rotation = this.modelRotation; + var scale = this.modelScale; + var dirtyCache = this.dirtyCache; + + var px = position.x; + var py = position.y; + var pz = position.z; + + var rx = rotation.x; + var ry = rotation.y; + var rz = rotation.z; + + var sx = scale.x; + var sy = scale.y; + var sz = scale.z; + + var faces = this.getFaceCount(); + + var pxCached = dirtyCache[0]; + var pyCached = dirtyCache[1]; + var pzCached = dirtyCache[2]; + + var rxCached = dirtyCache[3]; + var ryCached = dirtyCache[4]; + var rzCached = dirtyCache[5]; + + var sxCached = dirtyCache[6]; + var syCached = dirtyCache[7]; + var szCached = dirtyCache[8]; + + var fCached = dirtyCache[9]; + + dirtyCache[0] = px; + dirtyCache[1] = py; + dirtyCache[2] = pz; + + dirtyCache[3] = rx; + dirtyCache[4] = ry; + dirtyCache[5] = rz; + + dirtyCache[6] = sx; + dirtyCache[7] = sy; + dirtyCache[8] = sz; + + dirtyCache[9] = faces; + + return ( + pxCached !== px || pyCached !== py || pzCached !== pz || + rxCached !== rx || ryCached !== ry || rzCached !== rz || + sxCached !== sx || syCached !== sy || szCached !== sz || + fCached !== faces + ); + }, + + /** + * The Mesh update loop. The following takes place in this method: + * + * First, the `totalRendered` and `totalFrame` properties are set. + * + * If the view matrix of this Mesh isn't dirty, and the model position, rotate or scale properties are + * all clean, then the method returns at this point. + * + * Otherwise, if the viewPosition is dirty (i.e. from calling a method like `panZ`), then it will + * refresh the viewMatrix. + * + * After this, a new transformMatrix is built and it then iterates through all Faces in this + * Mesh, calling `transformCoordinatesLocal` on all of them. Internally, this updates every + * vertex, calculating its new transformed position, based on the new transform matrix. + * + * Finally, the faces are depth sorted. + * + * @method Phaser.GameObjects.Mesh#preUpdate + * @protected + * @since 3.50.0 + * + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. + */ + preUpdate: function () + { + this.totalRendered = this.totalFrame; + this.totalFrame = 0; + + var dirty = this.dirtyCache; + + if (!this.ignoreDirtyCache && !dirty[10] && !this.isDirty()) + { + // If neither the view or the mesh is dirty we can bail out and save lots of math + return; + } + + var width = this.width; + var height = this.height; + + var viewMatrix = this.viewMatrix; + var viewPosition = this.viewPosition; + + if (dirty[10]) + { + viewMatrix.identity(); + viewMatrix.translate(viewPosition); + viewMatrix.invert(); + + dirty[10] = 0; + } + + var transformMatrix = this.transformMatrix; + + transformMatrix.setWorldMatrix( + this.modelRotation, + this.modelPosition, + this.modelScale, + this.viewMatrix, + this.projectionMatrix + ); + + var z = viewPosition.z; + + var faces = this.faces; + + for (var i = 0; i < faces.length; i++) + { + faces[i].transformCoordinatesLocal(transformMatrix, width, height, z); + } + + this.depthSort(); + }, + + /** + * The built-in Mesh debug rendering method. + * + * See `Mesh.setDebug` for more details. + * + * @method Phaser.GameObjects.Mesh#renderDebug + * @since 3.50.0 + * + * @param {Phaser.GameObjects.Mesh} src - The Mesh object being rendered. + * @param {Phaser.Geom.Mesh.Face[]} faces - An array of Faces. + */ + renderDebug: function (src, faces) + { + var graphic = src.debugGraphic; + + for (var i = 0; i < faces.length; i++) + { + var face = faces[i]; + + var x0 = face.vertex1.tx; + var y0 = face.vertex1.ty; + var x1 = face.vertex2.tx; + var y1 = face.vertex2.ty; + var x2 = face.vertex3.tx; + var y2 = face.vertex3.ty; + + graphic.strokeTriangle(x0, y0, x1, y1, x2, y2); + } + }, + + /** + * Handles the pre-destroy step for the Mesh, which removes the Animation component and typed arrays. + * + * @method Phaser.GameObjects.Mesh#preDestroy + * @private + * @since 3.50.0 + */ + preDestroy: function () + { + this.clear(); + + this.debugCallback = null; + this.debugGraphic = null; + } + +}); + +module.exports = Mesh; + + +/***/ }), +/* 222 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var DistanceBetween = __webpack_require__(61); /** * Checks if two Circles intersect. @@ -52451,7 +57257,7 @@ module.exports = CircleToCircle; /***/ }), -/* 217 */ +/* 223 */ /***/ (function(module, exports) { /** @@ -52505,7 +57311,7 @@ module.exports = CircleToRectangle; /***/ }), -/* 218 */ +/* 224 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52516,7 +57322,7 @@ module.exports = CircleToRectangle; */ var Point = __webpack_require__(4); -var LineToCircle = __webpack_require__(219); +var LineToCircle = __webpack_require__(225); /** * Checks for intersection between the line segment and circle, @@ -52597,7 +57403,7 @@ module.exports = GetLineToCircle; /***/ }), -/* 219 */ +/* 225 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52606,7 +57412,7 @@ module.exports = GetLineToCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(57); +var Contains = __webpack_require__(62); var Point = __webpack_require__(4); var tmp = new Point(); @@ -52681,7 +57487,7 @@ module.exports = LineToCircle; /***/ }), -/* 220 */ +/* 226 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52692,8 +57498,8 @@ module.exports = LineToCircle; */ var Point = __webpack_require__(4); -var LineToLine = __webpack_require__(86); -var LineToRectangle = __webpack_require__(453); +var LineToLine = __webpack_require__(91); +var LineToRectangle = __webpack_require__(465); /** * Checks for intersection between the Line and a Rectangle shape, @@ -52741,7 +57547,7 @@ module.exports = GetLineToRectangle; /***/ }), -/* 221 */ +/* 227 */ /***/ (function(module, exports) { /** @@ -52828,7 +57634,7 @@ module.exports = ContainsArray; /***/ }), -/* 222 */ +/* 228 */ /***/ (function(module, exports) { /** @@ -52876,7 +57682,7 @@ module.exports = RotateAroundXY; /***/ }), -/* 223 */ +/* 229 */ /***/ (function(module, exports) { /** @@ -52904,7 +57710,7 @@ module.exports = GetAspectRatio; /***/ }), -/* 224 */ +/* 230 */ /***/ (function(module, exports) { /** @@ -52958,7 +57764,7 @@ module.exports = RotateAroundXY; /***/ }), -/* 225 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52973,18 +57779,18 @@ module.exports = RotateAroundXY; module.exports = { - BUTTON_DOWN: __webpack_require__(1226), - BUTTON_UP: __webpack_require__(1227), - CONNECTED: __webpack_require__(1228), - DISCONNECTED: __webpack_require__(1229), - GAMEPAD_BUTTON_DOWN: __webpack_require__(1230), - GAMEPAD_BUTTON_UP: __webpack_require__(1231) + BUTTON_DOWN: __webpack_require__(1290), + BUTTON_UP: __webpack_require__(1291), + CONNECTED: __webpack_require__(1292), + DISCONNECTED: __webpack_require__(1293), + GAMEPAD_BUTTON_DOWN: __webpack_require__(1294), + GAMEPAD_BUTTON_UP: __webpack_require__(1295) }; /***/ }), -/* 226 */ +/* 232 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52993,8 +57799,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(19); -var XHRSettings = __webpack_require__(147); +var Extend = __webpack_require__(18); +var XHRSettings = __webpack_require__(149); /** * Takes two XHRSettings Objects and creates a new XHRSettings object from them. @@ -53032,7 +57838,7 @@ module.exports = MergeXHRSettings; /***/ }), -/* 227 */ +/* 233 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53042,12 +57848,12 @@ module.exports = MergeXHRSettings; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var ParseXML = __webpack_require__(375); +var ParseXML = __webpack_require__(385); /** * @classdesc @@ -53217,7 +58023,186 @@ module.exports = XMLFile; /***/ }), -/* 228 */ +/* 234 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var CONST = __webpack_require__(19); +var File = __webpack_require__(22); +var FileTypesManager = __webpack_require__(8); +var GetFastValue = __webpack_require__(2); +var IsPlainObject = __webpack_require__(7); + +/** + * @classdesc + * A single Text File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#text method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#text. + * + * @class TextFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var TextFile = new Class({ + + Extends: File, + + initialize: + + function TextFile (loader, key, url, xhrSettings) + { + var type = 'text'; + var extension = 'txt'; + var cache = loader.cacheManager.text; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + type = GetFastValue(config, 'type', type); + cache = GetFastValue(config, 'cache', cache); + } + + var fileConfig = { + type: type, + cache: cache, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.TextFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; + + this.data = this.xhrLoader.responseText; + + this.onProcessComplete(); + } + +}); + +/** + * Adds a Text file, or array of Text files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.text('story', 'files/IntroStory.txt'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Text Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Text Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Text Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.text({ + * key: 'story', + * url: 'files/IntroStory.txt' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.TextFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.text('story', 'files/IntroStory.txt'); + * // and later in your game ... + * var data = this.cache.text.get('story'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the text from the Text Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.txt". It will always add `.txt` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Text File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#text + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('text', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new TextFile(this, key[i])); + } + } + else + { + this.addFile(new TextFile(this, key, url, xhrSettings)); + } + + return this; +}); + +module.exports = TextFile; + + +/***/ }), +/* 235 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53232,26 +58217,27 @@ module.exports = XMLFile; module.exports = { - Acceleration: __webpack_require__(1285), - Angular: __webpack_require__(1286), - Bounce: __webpack_require__(1287), - Debug: __webpack_require__(1288), - Drag: __webpack_require__(1289), - Enable: __webpack_require__(1290), - Friction: __webpack_require__(1291), - Gravity: __webpack_require__(1292), - Immovable: __webpack_require__(1293), - Mass: __webpack_require__(1294), - OverlapCirc: __webpack_require__(484), - OverlapRect: __webpack_require__(229), - Size: __webpack_require__(1295), - Velocity: __webpack_require__(1296) + Acceleration: __webpack_require__(1348), + Angular: __webpack_require__(1349), + Bounce: __webpack_require__(1350), + Debug: __webpack_require__(1351), + Drag: __webpack_require__(1352), + Enable: __webpack_require__(1353), + Friction: __webpack_require__(1354), + Gravity: __webpack_require__(1355), + Immovable: __webpack_require__(1356), + Mass: __webpack_require__(1357), + OverlapCirc: __webpack_require__(500), + OverlapRect: __webpack_require__(236), + Pushable: __webpack_require__(1358), + Size: __webpack_require__(1359), + Velocity: __webpack_require__(1360) }; /***/ }), -/* 229 */ +/* 236 */ /***/ (function(module, exports) { /** @@ -53336,7 +58322,7 @@ module.exports = OverlapRect; /***/ }), -/* 230 */ +/* 237 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53351,20 +58337,20 @@ module.exports = OverlapRect; module.exports = { - COLLIDE: __webpack_require__(1297), - OVERLAP: __webpack_require__(1298), - PAUSE: __webpack_require__(1299), - RESUME: __webpack_require__(1300), - TILE_COLLIDE: __webpack_require__(1301), - TILE_OVERLAP: __webpack_require__(1302), - WORLD_BOUNDS: __webpack_require__(1303), - WORLD_STEP: __webpack_require__(1304) + COLLIDE: __webpack_require__(1361), + OVERLAP: __webpack_require__(1362), + PAUSE: __webpack_require__(1363), + RESUME: __webpack_require__(1364), + TILE_COLLIDE: __webpack_require__(1365), + TILE_OVERLAP: __webpack_require__(1366), + WORLD_BOUNDS: __webpack_require__(1367), + WORLD_STEP: __webpack_require__(1368) }; /***/ }), -/* 231 */ +/* 238 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53373,7 +58359,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(52); +var CONST = __webpack_require__(59); /** * Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties @@ -53417,13 +58403,13 @@ var GetOverlapX = function (body1, body2, overlapOnly, bias) body2.touching.none = false; body2.touching.left = true; - if (body2.physicsType === CONST.STATIC_BODY) + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) { body1.blocked.none = false; body1.blocked.right = true; } - if (body1.physicsType === CONST.STATIC_BODY) + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) { body2.blocked.none = false; body2.blocked.left = true; @@ -53447,13 +58433,13 @@ var GetOverlapX = function (body1, body2, overlapOnly, bias) body2.touching.none = false; body2.touching.right = true; - if (body2.physicsType === CONST.STATIC_BODY) + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) { body1.blocked.none = false; body1.blocked.left = true; } - if (body1.physicsType === CONST.STATIC_BODY) + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) { body2.blocked.none = false; body2.blocked.right = true; @@ -53472,7 +58458,7 @@ module.exports = GetOverlapX; /***/ }), -/* 232 */ +/* 239 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53481,7 +58467,7 @@ module.exports = GetOverlapX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(52); +var CONST = __webpack_require__(59); /** * Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties @@ -53525,13 +58511,13 @@ var GetOverlapY = function (body1, body2, overlapOnly, bias) body2.touching.none = false; body2.touching.up = true; - if (body2.physicsType === CONST.STATIC_BODY) + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) { body1.blocked.none = false; body1.blocked.down = true; } - if (body1.physicsType === CONST.STATIC_BODY) + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) { body2.blocked.none = false; body2.blocked.up = true; @@ -53555,13 +58541,13 @@ var GetOverlapY = function (body1, body2, overlapOnly, bias) body2.touching.none = false; body2.touching.down = true; - if (body2.physicsType === CONST.STATIC_BODY) + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) { body1.blocked.none = false; body1.blocked.up = true; } - if (body1.physicsType === CONST.STATIC_BODY) + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) { body2.blocked.none = false; body2.blocked.down = true; @@ -53580,7 +58566,7 @@ module.exports = GetOverlapY; /***/ }), -/* 233 */ +/* 240 */ /***/ (function(module, exports) { /** @@ -53616,8 +58602,8 @@ module.exports = TileIntersectsBody; /***/ }), -/* 234 */, -/* 235 */ +/* 241 */, +/* 242 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53626,7 +58612,143 @@ module.exports = TileIntersectsBody; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTileAt = __webpack_require__(150); +var CONST = __webpack_require__(29); + +/** + * Get the Tilemap orientation from the given string. + * + * @function Phaser.Tilemaps.Orientation.FromOrientationString + * @since 3.50.0 + * + * @param {string} [orientation] - The orientation type as a string. + * + * @return {Phaser.Tilemaps.OrientationType} The Tilemap Orientation type. + */ +var FromOrientationString = function (orientation) +{ + orientation = orientation.toLowerCase(); + + if (orientation === 'isometric') + { + return CONST.ISOMETRIC; + } + else if (orientation === 'staggered') + { + return CONST.STAGGERED; + } + else if (orientation === 'hexagonal') + { + return CONST.HEXAGONAL; + } + else + { + return CONST.ORTHOGONAL; + } +}; + +module.exports = FromOrientationString; + + +/***/ }), +/* 243 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Tilemaps.Components + */ + +module.exports = { + + CalculateFacesAt: __webpack_require__(244), + CalculateFacesWithin: __webpack_require__(60), + CheckIsoBounds: __webpack_require__(520), + Copy: __webpack_require__(1393), + CreateFromTiles: __webpack_require__(1394), + CullBounds: __webpack_require__(522), + CullTiles: __webpack_require__(523), + Fill: __webpack_require__(1395), + FilterTiles: __webpack_require__(1396), + FindByIndex: __webpack_require__(1397), + FindTile: __webpack_require__(1398), + ForEachTile: __webpack_require__(1399), + GetCullTilesFunction: __webpack_require__(1400), + GetTileAt: __webpack_require__(151), + GetTileAtWorldXY: __webpack_require__(1401), + GetTilesWithin: __webpack_require__(26), + GetTilesWithinShape: __webpack_require__(1402), + GetTilesWithinWorldXY: __webpack_require__(506), + GetTileToWorldXFunction: __webpack_require__(1403), + GetTileToWorldXYFunction: __webpack_require__(1404), + GetTileToWorldYFunction: __webpack_require__(1405), + GetWorldToTileXFunction: __webpack_require__(1406), + GetWorldToTileXYFunction: __webpack_require__(1407), + GetWorldToTileYFunction: __webpack_require__(1408), + HasTileAt: __webpack_require__(541), + HasTileAtWorldXY: __webpack_require__(1409), + HexagonalCullBounds: __webpack_require__(525), + HexagonalCullTiles: __webpack_require__(524), + HexagonalTileToWorldXY: __webpack_require__(529), + HexagonalTileToWorldY: __webpack_require__(533), + HexagonalWorldToTileXY: __webpack_require__(535), + HexagonalWorldToTileY: __webpack_require__(539), + IsInLayerBounds: __webpack_require__(116), + IsometricCullTiles: __webpack_require__(526), + IsometricTileToWorldXY: __webpack_require__(530), + IsometricWorldToTileXY: __webpack_require__(536), + PutTileAt: __webpack_require__(249), + PutTileAtWorldXY: __webpack_require__(1410), + PutTilesAt: __webpack_require__(1411), + Randomize: __webpack_require__(1412), + RemoveTileAt: __webpack_require__(542), + RemoveTileAtWorldXY: __webpack_require__(1413), + RenderDebug: __webpack_require__(1414), + ReplaceByIndex: __webpack_require__(521), + RunCull: __webpack_require__(152), + SetCollision: __webpack_require__(1415), + SetCollisionBetween: __webpack_require__(1416), + SetCollisionByExclusion: __webpack_require__(1417), + SetCollisionByProperty: __webpack_require__(1418), + SetCollisionFromCollisionGroup: __webpack_require__(1419), + SetLayerCollisionIndex: __webpack_require__(153), + SetTileCollision: __webpack_require__(69), + SetTileIndexCallback: __webpack_require__(1420), + SetTileLocationCallback: __webpack_require__(1421), + Shuffle: __webpack_require__(1422), + StaggeredCullBounds: __webpack_require__(528), + StaggeredCullTiles: __webpack_require__(527), + StaggeredTileToWorldXY: __webpack_require__(531), + StaggeredTileToWorldY: __webpack_require__(534), + StaggeredWorldToTileXY: __webpack_require__(537), + StaggeredWorldToTileY: __webpack_require__(540), + SwapByIndex: __webpack_require__(1423), + TileToWorldX: __webpack_require__(245), + TileToWorldXY: __webpack_require__(532), + TileToWorldY: __webpack_require__(246), + WeightedRandomize: __webpack_require__(1424), + WorldToTileX: __webpack_require__(247), + WorldToTileXY: __webpack_require__(538), + WorldToTileY: __webpack_require__(248) + +}; + + +/***/ }), +/* 244 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTileAt = __webpack_require__(151); /** * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting @@ -53636,8 +58758,8 @@ var GetTileAt = __webpack_require__(150); * @function Phaser.Tilemaps.Components.CalculateFacesAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. + * @param {number} tileX - The x coordinate. + * @param {number} tileY - The y coordinate. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var CalculateFacesAt = function (tileX, tileY, layer) @@ -53711,7 +58833,191 @@ module.exports = CalculateFacesAt; /***/ }), -/* 236 */ +/* 245 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.TileToWorldX + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} + */ +var TileToWorldX = function (tileX, camera, layer) +{ + var tileWidth = layer.baseTileWidth; + var tilemapLayer = layer.tilemapLayer; + var layerWorldX = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + + tileWidth *= tilemapLayer.scaleX; + } + + return layerWorldX + tileX * tileWidth; +}; + +module.exports = TileToWorldX; + + +/***/ }), +/* 246 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.TileToWorldY + * @since 3.0.0 + * + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in world coordinates. + */ +var TileToWorldY = function (tileY, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + return layerWorldY + tileY * tileHeight; +}; + +module.exports = TileToWorldY; + + +/***/ }), +/* 247 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.WorldToTileX + * @since 3.0.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The X location in tile units. + */ +var WorldToTileX = function (worldX, snapToFloor, camera, layer) +{ + if (snapToFloor === undefined) { snapToFloor = true; } + + var tileWidth = layer.baseTileWidth; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + + tileWidth *= tilemapLayer.scaleX; + } + + return (snapToFloor) ? Math.floor(worldX / tileWidth) : worldX / tileWidth; +}; + +module.exports = WorldToTileX; + + +/***/ }), +/* 248 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.WorldToTileY + * @since 3.0.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in tile units. + */ +var WorldToTileY = function (worldY, snapToFloor, camera, layer) +{ + if (snapToFloor === undefined) { snapToFloor = true; } + + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + return (snapToFloor) ? Math.floor(worldY / tileHeight) : worldY / tileHeight; +}; + +module.exports = WorldToTileY; + + +/***/ }), +/* 249 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53720,10 +59026,10 @@ module.exports = CalculateFacesAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Tile = __webpack_require__(75); -var IsInLayerBounds = __webpack_require__(104); -var CalculateFacesAt = __webpack_require__(235); -var SetTileCollision = __webpack_require__(65); +var Tile = __webpack_require__(81); +var IsInLayerBounds = __webpack_require__(116); +var CalculateFacesAt = __webpack_require__(244); +var SetTileCollision = __webpack_require__(69); /** * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index @@ -53734,19 +59040,23 @@ var SetTileCollision = __webpack_require__(65); * @function Phaser.Tilemaps.Components.PutTileAt * @since 3.0.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. */ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) { - if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } if (recalculateFaces === undefined) { recalculateFaces = true; } + if (!IsInLayerBounds(tileX, tileY, layer)) + { + return null; + } + var oldTile = layer.data[tileY][tileX]; var oldTileCollides = oldTile && oldTile.collides; @@ -53754,7 +59064,7 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) { if (layer.data[tileY][tileX] === null) { - layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height); + layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, layer.tileWidth, layer.tileHeight); } layer.data[tileY][tileX].copy(tile); @@ -53792,7 +59102,7 @@ module.exports = PutTileAt; /***/ }), -/* 237 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53801,10 +59111,10 @@ module.exports = PutTileAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var LayerData = __webpack_require__(105); -var MapData = __webpack_require__(106); -var Tile = __webpack_require__(75); +var Formats = __webpack_require__(38); +var LayerData = __webpack_require__(117); +var MapData = __webpack_require__(118); +var Tile = __webpack_require__(81); /** * Parses a 2D array of tile indexes into a new MapData object with a single layer. @@ -53813,9 +59123,9 @@ var Tile = __webpack_require__(75); * @since 3.0.0 * * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {integer[][]} data - 2D array, CSV string or Tiled JSON object. - * @param {integer} tileWidth - The width of a tile in pixels. - * @param {integer} tileHeight - The height of a tile in pixels. + * @param {number[][]} data - 2D array, CSV string or Tiled JSON object. + * @param {number} tileWidth - The width of a tile in pixels. + * @param {number} tileHeight - The height of a tile in pixels. * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty * location will get a Tile object with an index of -1. If you've a large sparsely populated map and @@ -53831,7 +59141,7 @@ var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull) tileWidth: tileWidth, tileHeight: tileHeight }); - + var mapData = new MapData({ name: name, tileWidth: tileWidth, @@ -53884,7 +59194,87 @@ module.exports = Parse2DArray; /***/ }), -/* 238 */ +/* 251 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Pick = __webpack_require__(550); +var ParseGID = __webpack_require__(252); + +var copyPoints = function (p) { return { x: p.x, y: p.y }; }; + +var commonObjectProps = [ 'id', 'name', 'type', 'rotation', 'properties', 'visible', 'x', 'y', 'width', 'height' ]; + +/** + * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.) + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseObject + * @since 3.0.0 + * + * @param {object} tiledObject - Tiled object to convert to an internal parsed object normalising and copying properties over. + * @param {number} [offsetX=0] - Optional additional offset to apply to the object's x property. Defaults to 0. + * @param {number} [offsetY=0] - Optional additional offset to apply to the object's y property. Defaults to 0. + * + * @return {object} The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets. + */ +var ParseObject = function (tiledObject, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } + + var parsedObject = Pick(tiledObject, commonObjectProps); + + parsedObject.x += offsetX; + parsedObject.y += offsetY; + + if (tiledObject.gid) + { + // Object tiles + var gidInfo = ParseGID(tiledObject.gid); + parsedObject.gid = gidInfo.gid; + parsedObject.flippedHorizontal = gidInfo.flippedHorizontal; + parsedObject.flippedVertical = gidInfo.flippedVertical; + parsedObject.flippedAntiDiagonal = gidInfo.flippedAntiDiagonal; + } + else if (tiledObject.polyline) + { + parsedObject.polyline = tiledObject.polyline.map(copyPoints); + } + else if (tiledObject.polygon) + { + parsedObject.polygon = tiledObject.polygon.map(copyPoints); + } + else if (tiledObject.ellipse) + { + parsedObject.ellipse = tiledObject.ellipse; + } + else if (tiledObject.text) + { + parsedObject.text = tiledObject.text; + } + else if (tiledObject.point) + { + parsedObject.point = true; + } + else + { + // Otherwise, assume it is a rectangle + parsedObject.rectangle = true; + } + + return parsedObject; +}; + +module.exports = ParseObject; + + +/***/ }), +/* 252 */ /***/ (function(module, exports) { /** @@ -53974,7 +59364,7 @@ module.exports = ParseGID; /***/ }), -/* 239 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -53983,90 +59373,10 @@ module.exports = ParseGID; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Pick = __webpack_require__(514); -var ParseGID = __webpack_require__(238); - -var copyPoints = function (p) { return { x: p.x, y: p.y }; }; - -var commonObjectProps = [ 'id', 'name', 'type', 'rotation', 'properties', 'visible', 'x', 'y', 'width', 'height' ]; - -/** - * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.) - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseObject - * @since 3.0.0 - * - * @param {object} tiledObject - Tiled object to convert to an internal parsed object normalising and copying properties over. - * @param {number} [offsetX=0] - Optional additional offset to apply to the object's x property. Defaults to 0. - * @param {number} [offsetY=0] - Optional additional offset to apply to the object's y property. Defaults to 0. - * - * @return {object} The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets. - */ -var ParseObject = function (tiledObject, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - var parsedObject = Pick(tiledObject, commonObjectProps); - - parsedObject.x += offsetX; - parsedObject.y += offsetY; - - if (tiledObject.gid) - { - // Object tiles - var gidInfo = ParseGID(tiledObject.gid); - parsedObject.gid = gidInfo.gid; - parsedObject.flippedHorizontal = gidInfo.flippedHorizontal; - parsedObject.flippedVertical = gidInfo.flippedVertical; - parsedObject.flippedAntiDiagonal = gidInfo.flippedAntiDiagonal; - } - else if (tiledObject.polyline) - { - parsedObject.polyline = tiledObject.polyline.map(copyPoints); - } - else if (tiledObject.polygon) - { - parsedObject.polygon = tiledObject.polygon.map(copyPoints); - } - else if (tiledObject.ellipse) - { - parsedObject.ellipse = tiledObject.ellipse; - } - else if (tiledObject.text) - { - parsedObject.text = tiledObject.text; - } - else if (tiledObject.point) - { - parsedObject.point = true; - } - else - { - // Otherwise, assume it is a rectangle - parsedObject.rectangle = true; - } - - return parsedObject; -}; - -module.exports = ParseObject; - - -/***/ }), -/* 240 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Formats = __webpack_require__(33); -var MapData = __webpack_require__(106); -var Parse = __webpack_require__(506); -var Tilemap = __webpack_require__(522); +var Formats = __webpack_require__(38); +var MapData = __webpack_require__(118); +var Parse = __webpack_require__(543); +var Tilemap = __webpack_require__(559); /** * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When @@ -54076,14 +59386,14 @@ var Tilemap = __webpack_require__(522); * * @function Phaser.Tilemaps.ParseToTilemap * @since 3.0.0 - * + * * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. - * @param {integer} [tileWidth=32] - The width of a tile in pixels. - * @param {integer} [tileHeight=32] - The height of a tile in pixels. - * @param {integer} [width=10] - The width of the map in tiles. - * @param {integer} [height=10] - The height of the map in tiles. - * @param {integer[][]} [data] - Instead of loading from the cache, you can also load directly from + * @param {number} [tileWidth=32] - The width of a tile in pixels. + * @param {number} [tileHeight=32] - The height of a tile in pixels. + * @param {number} [width=10] - The width of the map in tiles. + * @param {number} [height=10] - The height of the map in tiles. + * @param {number[][]} [data] - Instead of loading from the cache, you can also load directly from * a 2D array of tile indexes. * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty @@ -54091,7 +59401,7 @@ var Tilemap = __webpack_require__(522); * the tile data doesn't need to change then setting this value to `true` will help with memory * consumption. However if your map is small or you need to update the tiles dynamically, then leave * the default value set. - * + * * @return {Phaser.Tilemaps.Tilemap} */ var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull) @@ -54140,7 +59450,7 @@ module.exports = ParseToTilemap; /***/ }), -/* 241 */ +/* 254 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54189,7 +59499,7 @@ module.exports = GetTargets; /***/ }), -/* 242 */ +/* 255 */ /***/ (function(module, exports) { /** @@ -54457,7 +59767,7 @@ module.exports = GetValueOp; /***/ }), -/* 243 */ +/* 256 */ /***/ (function(module, exports) { /** @@ -54501,7 +59811,7 @@ module.exports = TWEEN_DEFAULTS; /***/ }), -/* 244 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54511,11 +59821,11 @@ module.exports = TWEEN_DEFAULTS; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(245); -var GameObjectCreator = __webpack_require__(16); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(258); +var GameObjectCreator = __webpack_require__(17); var GameObjectFactory = __webpack_require__(5); -var TWEEN_CONST = __webpack_require__(91); +var TWEEN_CONST = __webpack_require__(96); var MATH_CONST = __webpack_require__(13); /** @@ -54576,7 +59886,7 @@ var Tween = new Class({ * The cached length of the data array. * * @name Phaser.Tweens.Tween#totalData - * @type {integer} + * @type {number} * @since 3.0.0 */ this.totalData = data.length; @@ -54594,7 +59904,7 @@ var Tween = new Class({ * Cached target total (not necessarily the same as the data total) * * @name Phaser.Tweens.Tween#totalTargets - * @type {integer} + * @type {number} * @since 3.0.0 */ this.totalTargets = targets.length; @@ -54729,7 +60039,7 @@ var Tween = new Class({ * The current state of the tween * * @name Phaser.Tweens.Tween#state - * @type {integer} + * @type {number} * @since 3.0.0 */ this.state = TWEEN_CONST.PENDING_ADD; @@ -54738,7 +60048,7 @@ var Tween = new Class({ * The state of the tween when it was paused (used by Resume) * * @name Phaser.Tweens.Tween#_pausedState - * @type {integer} + * @type {number} * @private * @since 3.0.0 */ @@ -54858,7 +60168,7 @@ var Tween = new Class({ * @method Phaser.Tweens.Tween#getValue * @since 3.0.0 * - * @param {integer} [index=0] - The Tween Data to return the value from. + * @param {number} [index=0] - The Tween Data to return the value from. * * @return {number} The value of the requested Tween Data. */ @@ -55790,7 +61100,7 @@ var Tween = new Class({ * @param {Phaser.Types.Tweens.TweenDataConfig} tweenData - The TweenData property to update. * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. * - * @return {integer} The state of this Tween. + * @return {number} The state of this Tween. */ setStateFromEnd: function (tween, tweenData, diff) { @@ -55876,7 +61186,7 @@ var Tween = new Class({ * @param {Phaser.Types.Tweens.TweenDataConfig} tweenData - The TweenData property to update. * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. * - * @return {integer} The state of this Tween. + * @return {number} The state of this Tween. */ setStateFromStart: function (tween, tweenData, diff) { @@ -56144,7 +61454,7 @@ module.exports = Tween; /***/ }), -/* 245 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56159,26 +61469,26 @@ module.exports = Tween; module.exports = { - TIMELINE_COMPLETE: __webpack_require__(1376), - TIMELINE_LOOP: __webpack_require__(1377), - TIMELINE_PAUSE: __webpack_require__(1378), - TIMELINE_RESUME: __webpack_require__(1379), - TIMELINE_START: __webpack_require__(1380), - TIMELINE_UPDATE: __webpack_require__(1381), - TWEEN_ACTIVE: __webpack_require__(1382), - TWEEN_COMPLETE: __webpack_require__(1383), - TWEEN_LOOP: __webpack_require__(1384), - TWEEN_REPEAT: __webpack_require__(1385), - TWEEN_START: __webpack_require__(1386), - TWEEN_STOP: __webpack_require__(1387), - TWEEN_UPDATE: __webpack_require__(1388), - TWEEN_YOYO: __webpack_require__(1389) + TIMELINE_COMPLETE: __webpack_require__(1438), + TIMELINE_LOOP: __webpack_require__(1439), + TIMELINE_PAUSE: __webpack_require__(1440), + TIMELINE_RESUME: __webpack_require__(1441), + TIMELINE_START: __webpack_require__(1442), + TIMELINE_UPDATE: __webpack_require__(1443), + TWEEN_ACTIVE: __webpack_require__(1444), + TWEEN_COMPLETE: __webpack_require__(1445), + TWEEN_LOOP: __webpack_require__(1446), + TWEEN_REPEAT: __webpack_require__(1447), + TWEEN_START: __webpack_require__(1448), + TWEEN_STOP: __webpack_require__(1449), + TWEEN_UPDATE: __webpack_require__(1450), + TWEEN_YOYO: __webpack_require__(1451) }; /***/ }), -/* 246 */ +/* 259 */ /***/ (function(module, exports) { /** @@ -56198,7 +61508,7 @@ module.exports = { * @since 3.0.0 * * @param {any} target - The target to tween. - * @param {integer} index - The target index within the Tween targets array. + * @param {number} index - The target index within the Tween targets array. * @param {string} key - The property of the target to tween. * @param {function} getEnd - What the property will be at the END of the Tween. * @param {function} getStart - What the property will be at the START of the Tween. @@ -56305,7 +61615,7 @@ module.exports = TweenData; /***/ }), -/* 247 */ +/* 260 */ /***/ (function(module, exports) { /** @@ -56327,7 +61637,7 @@ var ScaleModes = { * Default Scale Mode (Linear). * * @name Phaser.ScaleModes.DEFAULT - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -56337,7 +61647,7 @@ var ScaleModes = { * Linear Scale Mode. * * @name Phaser.ScaleModes.LINEAR - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -56347,7 +61657,7 @@ var ScaleModes = { * Nearest Scale Mode. * * @name Phaser.ScaleModes.NEAREST - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -56359,7 +61669,7 @@ module.exports = ScaleModes; /***/ }), -/* 248 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56368,7 +61678,7 @@ module.exports = ScaleModes; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MathWrap = __webpack_require__(59); +var MathWrap = __webpack_require__(64); /** * Wrap an angle. @@ -56391,7 +61701,7 @@ module.exports = Wrap; /***/ }), -/* 249 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56400,7 +61710,7 @@ module.exports = Wrap; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * Wrap an angle in degrees. @@ -56423,9 +61733,1013 @@ module.exports = WrapDegrees; /***/ }), -/* 250 */, -/* 251 */, -/* 252 */ +/* 263 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Events = __webpack_require__(190); + +/** + * @classdesc + * A Render Target encapsulates a WebGL framebuffer and the WebGL Texture that displays it. + * + * Instances of this class are typically created by, and belong to WebGL Pipelines, however + * other Game Objects and classes can take advantage of Render Targets as well. + * + * @class RenderTarget + * @memberof Phaser.Renderer.WebGL + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the WebGLRenderer. + * @param {number} width - The width of this Render Target. + * @param {number} height - The height of this Render Target. + * @param {number} [scale=1] - A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. + * @param {number} [minFilter=0] - The minFilter mode of the texture when created. 0 is `LINEAR`, 1 is `NEAREST`. + * @param {boolean} [autoClear=true] - Automatically clear this framebuffer when bound? + * @param {boolean} [autoResize=false] - Automatically resize this Render Target if the WebGL Renderer resizes? + */ +var RenderTarget = new Class({ + + initialize: + + function RenderTarget (renderer, width, height, scale, minFilter, autoClear, autoResize) + { + if (scale === undefined) { scale = 1; } + if (minFilter === undefined) { minFilter = 0; } + if (autoClear === undefined) { autoClear = true; } + if (autoResize === undefined) { autoResize = false; } + + /** + * A reference to the WebGLRenderer instance. + * + * @name Phaser.Renderer.WebGL.RenderTarget#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.50.0 + */ + this.renderer = renderer; + + /** + * The WebGLFramebuffer of this Render Target. + * + * This is created in the `RenderTarget.resize` method. + * + * @name Phaser.Renderer.WebGL.RenderTarget#framebuffer + * @type {WebGLFramebuffer} + * @since 3.50.0 + */ + this.framebuffer = null; + + /** + * The WebGLTexture of this Render Target. + * + * This is created in the `RenderTarget.resize` method. + * + * @name Phaser.Renderer.WebGL.RenderTarget#texture + * @type {WebGLTexture} + * @since 3.50.0 + */ + this.texture = null; + + /** + * The width of the texture. + * + * @name Phaser.Renderer.WebGL.RenderTarget#width + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.width = 0; + + /** + * The height of the texture. + * + * @name Phaser.Renderer.WebGL.RenderTarget#height + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.height = 0; + + /** + * A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. + * + * A value of 1 matches it. 0.5 makes the Render Target half the size of the renderer, etc. + * + * @name Phaser.Renderer.WebGL.RenderTarget#scale + * @type {number} + * @since 3.50.0 + */ + this.scale = scale; + + /** + * The minFilter mode of the texture. 0 is `LINEAR`, 1 is `NEAREST`. + * + * @name Phaser.Renderer.WebGL.RenderTarget#minFilter + * @type {number} + * @since 3.50.0 + */ + this.minFilter = minFilter; + + /** + * Controls if this Render Target is automatically cleared (via `gl.COLOR_BUFFER_BIT`) + * during the `RenderTarget.bind` method. + * + * If you need more control over how, or if, the target is cleared, you can disable + * this via the config on creation, or even toggle it directly at runtime. + * + * @name Phaser.Renderer.WebGL.RenderTarget#autoClear + * @type {boolean} + * @since 3.50.0 + */ + this.autoClear = autoClear; + + /** + * Does this Render Target automatically resize when the WebGL Renderer does? + * + * Modify this property via the `setAutoResize` method. + * + * @name Phaser.Renderer.WebGL.RenderTarget#autoResize + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.autoResize = false; + + this.resize(width, height); + + if (autoResize) + { + this.setAutoResize(true); + } + }, + + /** + * Sets if this Render Target should automatically resize when the WebGL Renderer + * emits a resize event. + * + * @method Phaser.Renderer.WebGL.RenderTarget#setAutoResize + * @since 3.50.0 + * + * @param {boolean} autoResize - Automatically resize this Render Target when the WebGL Renderer resizes? + * + * @return {this} This RenderTarget instance. + */ + setAutoResize: function (autoResize) + { + if (autoResize && !this.autoResize) + { + this.renderer.on(Events.RESIZE, this.resize, this); + + this.autoResize = true; + } + else if (!autoResize && this.autoResize) + { + this.renderer.off(Events.RESIZE, this.resize, this); + + this.autoResize = false; + } + + return this; + }, + + /** + * Resizes this Render Target. + * + * Deletes both the frame buffer and texture, if they exist and then re-creates + * them using the new sizes. + * + * This method is called automatically by the pipeline during its resize handler. + * + * @method Phaser.Renderer.WebGL.RenderTarget#resize + * @since 3.50.0 + * + * @param {number} width - The new width of this Render Target. + * @param {number} height - The new height of this Render Target. + * + * @return {this} This RenderTarget instance. + */ + resize: function (width, height) + { + var renderer = this.renderer; + + renderer.deleteFramebuffer(this.framebuffer); + + renderer.deleteTexture(this.texture); + + width *= this.scale; + height *= this.scale; + + this.texture = renderer.createTextureFromSource(null, width, height, this.minFilter); + this.framebuffer = renderer.createFramebuffer(width, height, this.texture, false); + + this.width = width; + this.height = height; + + return this; + }, + + /** + * Pushes this Render Target as the current frame buffer of the renderer. + * + * If `autoClear` is set, then clears the texture. + * + * If `adjustViewport` is `true` then it will flush the renderer and then adjust the GL viewport. + * + * @method Phaser.Renderer.WebGL.RenderTarget#bind + * @since 3.50.0 + * + * @param {boolean} [adjustViewport=false] - Adjust the GL viewport by calling `RenderTarget.adjustViewport` ? + */ + bind: function (adjustViewport) + { + if (adjustViewport === undefined) { adjustViewport = false; } + + if (adjustViewport) + { + this.renderer.flush(); + } + + this.renderer.pushFramebuffer(this.framebuffer, false, false, false); + + if (this.autoClear) + { + var gl = this.renderer.gl; + + gl.clearColor(0, 0, 0, 0); + + gl.clear(gl.COLOR_BUFFER_BIT); + } + + if (adjustViewport) + { + this.adjustViewport(); + } + }, + + /** + * Adjusts the GL viewport to match the WebGL Renderer width and height, + * with a y offset of `RenderTarget.height` - `WebGLRenderer.height`. + * + * @method Phaser.Renderer.WebGL.RenderTarget#adjustViewport + * @since 3.50.0 + */ + adjustViewport: function () + { + var renderer = this.renderer; + + var textureWidth = this.width; + var textureHeight = this.height; + + renderer.gl.viewport(0, 0, textureWidth, textureHeight); + renderer.gl.disable(renderer.gl.SCISSOR_TEST); + }, + + /** + * Clears this Render Target. + * + * @method Phaser.Renderer.WebGL.RenderTarget#clear + * @since 3.50.0 + */ + clear: function () + { + this.renderer.pushFramebuffer(this.framebuffer); + + var gl = this.renderer.gl; + + gl.clearColor(0, 0, 0, 0); + + gl.clear(gl.COLOR_BUFFER_BIT); + + this.renderer.popFramebuffer(); + }, + + /** + * Unbinds this Render Target and optionally flushes the WebGL Renderer first. + * + * @name Phaser.Renderer.WebGL.RenderTarget#unbind + * @since 3.50.0 + * + * @param {boolean} [flush=false] - Flush the WebGL Renderer before unbinding? + * + * @return {WebGLFramebuffer} The Framebuffer that was set, or `null` if there aren't any more in the stack. + */ + unbind: function (flush) + { + if (flush === undefined) { flush = false; } + + var renderer = this.renderer; + + if (flush) + { + renderer.flush(); + + renderer.gl.enable(renderer.gl.SCISSOR_TEST); + + var scissor = renderer.currentScissor; + + if (scissor) + { + var x = scissor[0]; + var y = scissor[1]; + var width = scissor[2]; + var height = scissor[3]; + + renderer.gl.scissor(x, (renderer.drawingBufferHeight - y - height), width, height); + } + } + + return renderer.popFramebuffer(); + }, + + /** + * Removes all external references from this class and deletes the + * WebGL framebuffer and texture instances. + * + * Does not remove this Render Target from the parent pipeline. + * + * @name Phaser.Renderer.WebGL.RenderTarget#destroy + * @since 3.50.0 + */ + destroy: function () + { + var renderer = this.renderer; + + renderer.deleteFramebuffer(this.framebuffer); + renderer.deleteTexture(this.texture); + + renderer.off(Events.RESIZE, this.resize, this); + + this.renderer = null; + this.framebuffer = null; + this.texture = null; + } + +}); + +module.exports = RenderTarget; + + +/***/ }), +/* 264 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * The ColorMatrix class creates a 5x4 matrix that can be used in shaders and graphics + * operations. It provides methods required to modify the color values, such as adjusting + * the brightness, setting a sepia tone, hue rotation and more. + * + * Use the method `getData` to return a Float32Array containing the current color values. + * + * @class ColorMatrix + * @memberof Phaser.Display + * @constructor + * @since 3.50.0 + */ +var ColorMatrix = new Class({ + + initialize: + + function ColorMatrix () + { + /** + * Internal ColorMatrix array. + * + * @name Phaser.Display.ColorMatrix#_matrix + * @type {number[]} + * @private + * @since 3.50.0 + */ + this._matrix = [ + 1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0 + ]; + + /** + * The value that determines how much of the original color is used + * when mixing the colors. A value between 0 (all original) and 1 (all final) + * + * @name Phaser.Display.ColorMatrix#alpha + * @type {number} + * @since 3.50.0 + */ + this.alpha = 1; + + /** + * Is the ColorMatrix array dirty? + * + * @name Phaser.Display.ColorMatrix#_dirty + * @type {boolean} + * @private + * @since 3.50.0 + */ + this._dirty = true; + + /** + * The matrix data as a Float32Array. + * + * Returned by the `getData` method. + * + * @name Phaser.Display.ColorMatrix#data + * @type {Float32Array} + * @private + * @since 3.50.0 + */ + this._data; + }, + + /** + * Sets this ColorMatrix from the given array of color values. + * + * @method Phaser.Display.ColorMatrix#set + * @since 3.50.0 + * + * @param {number[]} value - The ColorMatrix values to set. + * + * @return {this} This ColorMatrix instance. + */ + set: function (value) + { + this._matrix = value; + + this._dirty = true; + + return this; + }, + + /** + * Resets the ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#reset + * @since 3.50.0 + * + * @return {this} This ColorMatrix instance. + */ + reset: function () + { + // Long-winded, but saves on gc, which happens a lot in Post FX Shaders + // that reset the ColorMatrix every frame. + + var m = this._matrix; + + m[0] = 1; + m[1] = 0; + m[2] = 0; + m[3] = 0; + m[4] = 0; + + m[5] = 0; + m[6] = 1; + m[7] = 0; + m[8] = 0; + m[9] = 0; + + m[10] = 0; + m[11] = 0; + m[12] = 1; + m[13] = 0; + m[14] = 0; + + m[15] = 0; + m[16] = 0; + m[17] = 0; + m[18] = 1; + m[19] = 0; + + this._dirty = true; + + return this; + }, + + /** + * Gets the ColorMatrix as a Float32Array. + * + * Can be used directly as a 1fv shader uniform value. + * + * @method Phaser.Display.ColorMatrix#getData + * @since 3.50.0 + * + * @return {Float32Array} The ColorMatrix as a Float32Array. + */ + getData: function () + { + if (this._dirty) + { + var f32 = new Float32Array(this._matrix); + + f32[4] /= 255; + f32[9] /= 255; + f32[14] /= 255; + f32[19] /= 255; + + this._data = f32; + + this._dirty = false; + } + + return this._data; + }, + + /** + * Changes the brightness of this ColorMatrix by the given amount. + * + * @method Phaser.Display.ColorMatrix#brightness + * @since 3.50.0 + * + * @param {number} [value=0] - The amount of brightness to apply to this ColorMatrix. Between 0 (black) and 1. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + brightness: function (value, multiply) + { + if (value === undefined) { value = 0; } + if (multiply === undefined) { multiply = false; } + + var b = value; + + return this.multiply([ + b, 0, 0, 0, 0, + 0, b, 0, 0, 0, + 0, 0, b, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Changes the saturation of this ColorMatrix by the given amount. + * + * @method Phaser.Display.ColorMatrix#saturate + * @since 3.50.0 + * + * @param {number} [value=0] - The amount of saturation to apply to this ColorMatrix. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + saturate: function (value, multiply) + { + if (value === undefined) { value = 0; } + if (multiply === undefined) { multiply = false; } + + var x = (value * 2 / 3) + 1; + var y = ((x - 1) * -0.5); + + return this.multiply([ + x, y, y, 0, 0, + y, x, y, 0, 0, + y, y, x, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Desaturates this ColorMatrix (removes color from it). + * + * @method Phaser.Display.ColorMatrix#saturation + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + desaturate: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.saturate(-1, multiply); + }, + + /** + * Rotates the hues of this ColorMatrix by the value given. + * + * @method Phaser.Display.ColorMatrix#hue + * @since 3.50.0 + * + * @param {number} [rotation=0] - The amount of hue rotation to apply to this ColorMatrix, in degrees. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + hue: function (rotation, multiply) + { + if (rotation === undefined) { rotation = 0; } + if (multiply === undefined) { multiply = false; } + + rotation = rotation / 180 * Math.PI; + + var cos = Math.cos(rotation); + var sin = Math.sin(rotation); + var lumR = 0.213; + var lumG = 0.715; + var lumB = 0.072; + + return this.multiply([ + lumR + cos * (1 - lumR) + sin * (-lumR),lumG + cos * (-lumG) + sin * (-lumG),lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0, + lumR + cos * (-lumR) + sin * (0.143),lumG + cos * (1 - lumG) + sin * (0.140),lumB + cos * (-lumB) + sin * (-0.283), 0, 0, + lumR + cos * (-lumR) + sin * (-(1 - lumR)),lumG + cos * (-lumG) + sin * (lumG),lumB + cos * (1 - lumB) + sin * (lumB), 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Sets this ColorMatrix to be grayscale. + * + * @method Phaser.Display.ColorMatrix#grayscale + * @since 3.50.0 + * + * @param {number} [value=1] - The grayscale scale (0 is black). + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + grayscale: function (value, multiply) + { + if (value === undefined) { value = 1; } + if (multiply === undefined) { multiply = false; } + + return this.saturate(-value, multiply); + }, + + /** + * Sets this ColorMatrix to be black and white. + * + * @method Phaser.Display.ColorMatrix#blackWhite + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + blackWhite: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Change the contrast of this ColorMatrix by the amount given. + * + * @method Phaser.Display.ColorMatrix#contrast + * @since 3.50.0 + * + * @param {number} [value=0] - The amount of contrast to apply to this ColorMatrix. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + contrast: function (value, multiply) + { + if (value === undefined) { value = 0; } + if (multiply === undefined) { multiply = false; } + + var v = value + 1; + var o = -0.5 * (v - 1); + + return this.multiply([ + v, 0, 0, 0, o, + 0, v, 0, 0, o, + 0, 0, v, 0, o, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Converts this ColorMatrix to have negative values. + * + * @method Phaser.Display.ColorMatrix#negative + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + negative: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + -1, 0, 0, 1, 0, + 0, -1, 0, 1, 0, + 0, 0, -1, 1, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Apply a desaturated luminance to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#desaturateLuminance + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + desaturateLuminance: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.2764723, 0.9297080, 0.0938197, 0, -37.1, + 0.2764723, 0.9297080, 0.0938197, 0, -37.1, + 0.2764723, 0.9297080, 0.0938197, 0, -37.1, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a sepia tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#sepia + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + sepia: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.393, 0.7689999, 0.18899999, 0, 0, + 0.349, 0.6859999, 0.16799999, 0, 0, + 0.272, 0.5339999, 0.13099999, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a night vision tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#night + * @since 3.50.0 + * + * @param {number} [intensity=0.1] - The intensity of this effect. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + night: function (intensity, multiply) + { + if (intensity === undefined) { intensity = 0.1; } + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + intensity * (-2.0), -intensity, 0, 0, 0, + -intensity, 0, intensity, 0, 0, + 0, intensity, intensity * 2.0, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a trippy color tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#lsd + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + lsd: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 2, -0.4, 0.5, 0, 0, + -0.5, 2, -0.4, 0, 0, + -0.4, -0.5, 3, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a brown tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#brown + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + brown: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, + -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, + 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a vintage pinhole color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#vintagePinhole + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + vintagePinhole: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, + 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, + 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a kodachrome color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#kodachrome + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + kodachrome: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, + -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, + -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a technicolor color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#technicolor + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + technicolor: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, + -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, + -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a polaroid color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#polaroid + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + polaroid: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 1.438, -0.062, -0.062, 0, 0, + -0.122, 1.378, -0.122, 0, 0, + -0.016, -0.016, 1.483, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Shifts the values of this ColorMatrix into BGR order. + * + * @method Phaser.Display.ColorMatrix#shiftToBGR + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + shiftToBGR: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0, 0, 1, 0, 0, + 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Multiplies the two given matrices. + * + * @method Phaser.Display.ColorMatrix#multiply + * @since 3.50.0 + * + * @param {number[]} a - The 5x4 array to multiply with ColorMatrix._matrix. + * + * @return {this} This ColorMatrix instance. + */ + multiply: function (a, multiply) + { + // Duplicate _matrix into c + + if (!multiply) + { + this.reset(); + } + + var m = this._matrix; + var c = []; + + for (var i = 0; i < 20; i++) + { + c[i] = m[i]; + } + + // R + m[0] = (c[0] * a[0]) + (c[1] * a[5]) + (c[2] * a[10]) + (c[3] * a[15]); + m[1] = (c[0] * a[1]) + (c[1] * a[6]) + (c[2] * a[11]) + (c[3] * a[16]); + m[2] = (c[0] * a[2]) + (c[1] * a[7]) + (c[2] * a[12]) + (c[3] * a[17]); + m[3] = (c[0] * a[3]) + (c[1] * a[8]) + (c[2] * a[13]) + (c[3] * a[18]); + m[4] = (c[0] * a[4]) + (c[1] * a[9]) + (c[2] * a[14]) + (c[3] * a[19]) + c[4]; + + // G + m[5] = (c[5] * a[0]) + (c[6] * a[5]) + (c[7] * a[10]) + (c[8] * a[15]); + m[6] = (c[5] * a[1]) + (c[6] * a[6]) + (c[7] * a[11]) + (c[8] * a[16]); + m[7] = (c[5] * a[2]) + (c[6] * a[7]) + (c[7] * a[12]) + (c[8] * a[17]); + m[8] = (c[5] * a[3]) + (c[6] * a[8]) + (c[7] * a[13]) + (c[8] * a[18]); + m[9] = (c[5] * a[4]) + (c[6] * a[9]) + (c[7] * a[14]) + (c[8] * a[19]) + c[9]; + + // B + m[10] = (c[10] * a[0]) + (c[11] * a[5]) + (c[12] * a[10]) + (c[13] * a[15]); + m[11] = (c[10] * a[1]) + (c[11] * a[6]) + (c[12] * a[11]) + (c[13] * a[16]); + m[12] = (c[10] * a[2]) + (c[11] * a[7]) + (c[12] * a[12]) + (c[13] * a[17]); + m[13] = (c[10] * a[3]) + (c[11] * a[8]) + (c[12] * a[13]) + (c[13] * a[18]); + m[14] = (c[10] * a[4]) + (c[11] * a[9]) + (c[12] * a[14]) + (c[13] * a[19]) + c[14]; + + // A + m[15] = (c[15] * a[0]) + (c[16] * a[5]) + (c[17] * a[10]) + (c[18] * a[15]); + m[16] = (c[15] * a[1]) + (c[16] * a[6]) + (c[17] * a[11]) + (c[18] * a[16]); + m[17] = (c[15] * a[2]) + (c[16] * a[7]) + (c[17] * a[12]) + (c[18] * a[17]); + m[18] = (c[15] * a[3]) + (c[16] * a[8]) + (c[17] * a[13]) + (c[18] * a[18]); + m[19] = (c[15] * a[4]) + (c[16] * a[9]) + (c[17] * a[14]) + (c[18] * a[19]) + c[19]; + + this._dirty = true; + + return this; + } + +}); + +module.exports = ColorMatrix; + + +/***/ }), +/* 265 */, +/* 266 */, +/* 267 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56440,65 +62754,65 @@ module.exports = WrapDegrees; module.exports = { - AlignTo: __webpack_require__(556), - Angle: __webpack_require__(557), - Call: __webpack_require__(558), - GetFirst: __webpack_require__(559), - GetLast: __webpack_require__(560), - GridAlign: __webpack_require__(561), - IncAlpha: __webpack_require__(606), - IncX: __webpack_require__(607), - IncXY: __webpack_require__(608), - IncY: __webpack_require__(609), - PlaceOnCircle: __webpack_require__(610), - PlaceOnEllipse: __webpack_require__(611), - PlaceOnLine: __webpack_require__(612), - PlaceOnRectangle: __webpack_require__(613), - PlaceOnTriangle: __webpack_require__(614), - PlayAnimation: __webpack_require__(615), - PropertyValueInc: __webpack_require__(39), - PropertyValueSet: __webpack_require__(25), - RandomCircle: __webpack_require__(616), - RandomEllipse: __webpack_require__(617), - RandomLine: __webpack_require__(618), - RandomRectangle: __webpack_require__(619), - RandomTriangle: __webpack_require__(620), - Rotate: __webpack_require__(621), - RotateAround: __webpack_require__(622), - RotateAroundDistance: __webpack_require__(623), - ScaleX: __webpack_require__(624), - ScaleXY: __webpack_require__(625), - ScaleY: __webpack_require__(626), - SetAlpha: __webpack_require__(627), - SetBlendMode: __webpack_require__(628), - SetDepth: __webpack_require__(629), - SetHitArea: __webpack_require__(630), - SetOrigin: __webpack_require__(631), - SetRotation: __webpack_require__(632), - SetScale: __webpack_require__(633), - SetScaleX: __webpack_require__(634), - SetScaleY: __webpack_require__(635), - SetScrollFactor: __webpack_require__(636), - SetScrollFactorX: __webpack_require__(637), - SetScrollFactorY: __webpack_require__(638), - SetTint: __webpack_require__(639), - SetVisible: __webpack_require__(640), - SetX: __webpack_require__(641), - SetXY: __webpack_require__(642), - SetY: __webpack_require__(643), - ShiftPosition: __webpack_require__(644), - Shuffle: __webpack_require__(645), - SmootherStep: __webpack_require__(646), - SmoothStep: __webpack_require__(647), - Spread: __webpack_require__(648), - ToggleVisible: __webpack_require__(649), - WrapInRectangle: __webpack_require__(650) + AlignTo: __webpack_require__(595), + Angle: __webpack_require__(596), + Call: __webpack_require__(597), + GetFirst: __webpack_require__(598), + GetLast: __webpack_require__(599), + GridAlign: __webpack_require__(600), + IncAlpha: __webpack_require__(646), + IncX: __webpack_require__(647), + IncXY: __webpack_require__(648), + IncY: __webpack_require__(649), + PlaceOnCircle: __webpack_require__(650), + PlaceOnEllipse: __webpack_require__(651), + PlaceOnLine: __webpack_require__(652), + PlaceOnRectangle: __webpack_require__(653), + PlaceOnTriangle: __webpack_require__(654), + PlayAnimation: __webpack_require__(655), + PropertyValueInc: __webpack_require__(44), + PropertyValueSet: __webpack_require__(27), + RandomCircle: __webpack_require__(656), + RandomEllipse: __webpack_require__(657), + RandomLine: __webpack_require__(658), + RandomRectangle: __webpack_require__(659), + RandomTriangle: __webpack_require__(660), + Rotate: __webpack_require__(661), + RotateAround: __webpack_require__(662), + RotateAroundDistance: __webpack_require__(663), + ScaleX: __webpack_require__(664), + ScaleXY: __webpack_require__(665), + ScaleY: __webpack_require__(666), + SetAlpha: __webpack_require__(667), + SetBlendMode: __webpack_require__(668), + SetDepth: __webpack_require__(669), + SetHitArea: __webpack_require__(670), + SetOrigin: __webpack_require__(671), + SetRotation: __webpack_require__(672), + SetScale: __webpack_require__(673), + SetScaleX: __webpack_require__(674), + SetScaleY: __webpack_require__(675), + SetScrollFactor: __webpack_require__(676), + SetScrollFactorX: __webpack_require__(677), + SetScrollFactorY: __webpack_require__(678), + SetTint: __webpack_require__(679), + SetVisible: __webpack_require__(680), + SetX: __webpack_require__(681), + SetXY: __webpack_require__(682), + SetY: __webpack_require__(683), + ShiftPosition: __webpack_require__(684), + Shuffle: __webpack_require__(685), + SmootherStep: __webpack_require__(686), + SmoothStep: __webpack_require__(687), + Spread: __webpack_require__(688), + ToggleVisible: __webpack_require__(689), + WrapInRectangle: __webpack_require__(690) }; /***/ }), -/* 253 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56507,22 +62821,22 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ALIGN_CONST = __webpack_require__(108); +var ALIGN_CONST = __webpack_require__(120); var AlignToMap = []; -AlignToMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(254); -AlignToMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(255); -AlignToMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(256); -AlignToMap[ALIGN_CONST.LEFT_BOTTOM] = __webpack_require__(257); -AlignToMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(258); -AlignToMap[ALIGN_CONST.LEFT_TOP] = __webpack_require__(259); -AlignToMap[ALIGN_CONST.RIGHT_BOTTOM] = __webpack_require__(260); -AlignToMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(261); -AlignToMap[ALIGN_CONST.RIGHT_TOP] = __webpack_require__(262); -AlignToMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(263); -AlignToMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(264); -AlignToMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(265); +AlignToMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(269); +AlignToMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(270); +AlignToMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(271); +AlignToMap[ALIGN_CONST.LEFT_BOTTOM] = __webpack_require__(272); +AlignToMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(273); +AlignToMap[ALIGN_CONST.LEFT_TOP] = __webpack_require__(274); +AlignToMap[ALIGN_CONST.RIGHT_BOTTOM] = __webpack_require__(275); +AlignToMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(276); +AlignToMap[ALIGN_CONST.RIGHT_TOP] = __webpack_require__(277); +AlignToMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(278); +AlignToMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(279); +AlignToMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(280); /** * Takes a Game Object and aligns it next to another, at the given position. @@ -56535,7 +62849,7 @@ AlignToMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(265); * * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {integer} position - The position to align the Game Object with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. + * @param {number} position - The position to align the Game Object with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. * @param {number} [offsetX=0] - Optional horizontal offset from the position. * @param {number} [offsetY=0] - Optional vertical offset from the position. * @@ -56550,7 +62864,7 @@ module.exports = QuickSet; /***/ }), -/* 254 */ +/* 269 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56559,10 +62873,10 @@ module.exports = QuickSet; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetCenterX = __webpack_require__(77); -var SetCenterX = __webpack_require__(78); -var SetTop = __webpack_require__(45); +var GetBottom = __webpack_require__(40); +var GetCenterX = __webpack_require__(83); +var SetCenterX = __webpack_require__(84); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other. @@ -56594,7 +62908,7 @@ module.exports = BottomCenter; /***/ }), -/* 255 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56603,10 +62917,10 @@ module.exports = BottomCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetLeft = __webpack_require__(36); -var SetLeft = __webpack_require__(46); -var SetTop = __webpack_require__(45); +var GetBottom = __webpack_require__(40); +var GetLeft = __webpack_require__(41); +var SetLeft = __webpack_require__(52); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other. @@ -56638,7 +62952,7 @@ module.exports = BottomLeft; /***/ }), -/* 256 */ +/* 271 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56647,10 +62961,10 @@ module.exports = BottomLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetRight = __webpack_require__(37); -var SetRight = __webpack_require__(47); -var SetTop = __webpack_require__(45); +var GetBottom = __webpack_require__(40); +var GetRight = __webpack_require__(42); +var SetRight = __webpack_require__(53); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other. @@ -56682,7 +62996,7 @@ module.exports = BottomRight; /***/ }), -/* 257 */ +/* 272 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56691,10 +63005,10 @@ module.exports = BottomRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetLeft = __webpack_require__(36); -var SetBottom = __webpack_require__(48); -var SetRight = __webpack_require__(47); +var GetBottom = __webpack_require__(40); +var GetLeft = __webpack_require__(41); +var SetBottom = __webpack_require__(54); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other. @@ -56726,7 +63040,7 @@ module.exports = LeftBottom; /***/ }), -/* 258 */ +/* 273 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56735,10 +63049,10 @@ module.exports = LeftBottom; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(79); -var GetLeft = __webpack_require__(36); -var SetCenterY = __webpack_require__(80); -var SetRight = __webpack_require__(47); +var GetCenterY = __webpack_require__(85); +var GetLeft = __webpack_require__(41); +var SetCenterY = __webpack_require__(86); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned next to the left center position of the other. @@ -56770,7 +63084,7 @@ module.exports = LeftCenter; /***/ }), -/* 259 */ +/* 274 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56779,10 +63093,10 @@ module.exports = LeftCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLeft = __webpack_require__(36); -var GetTop = __webpack_require__(38); -var SetRight = __webpack_require__(47); -var SetTop = __webpack_require__(45); +var GetLeft = __webpack_require__(41); +var GetTop = __webpack_require__(43); +var SetRight = __webpack_require__(53); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the left top position of the other. @@ -56814,7 +63128,7 @@ module.exports = LeftTop; /***/ }), -/* 260 */ +/* 275 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56823,10 +63137,10 @@ module.exports = LeftTop; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetRight = __webpack_require__(37); -var SetBottom = __webpack_require__(48); -var SetLeft = __webpack_require__(46); +var GetBottom = __webpack_require__(40); +var GetRight = __webpack_require__(42); +var SetBottom = __webpack_require__(54); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other. @@ -56858,7 +63172,7 @@ module.exports = RightBottom; /***/ }), -/* 261 */ +/* 276 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56867,10 +63181,10 @@ module.exports = RightBottom; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(79); -var GetRight = __webpack_require__(37); -var SetCenterY = __webpack_require__(80); -var SetLeft = __webpack_require__(46); +var GetCenterY = __webpack_require__(85); +var GetRight = __webpack_require__(42); +var SetCenterY = __webpack_require__(86); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned next to the right center position of the other. @@ -56902,7 +63216,7 @@ module.exports = RightCenter; /***/ }), -/* 262 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56911,10 +63225,10 @@ module.exports = RightCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetRight = __webpack_require__(37); -var GetTop = __webpack_require__(38); -var SetLeft = __webpack_require__(46); -var SetTop = __webpack_require__(45); +var GetRight = __webpack_require__(42); +var GetTop = __webpack_require__(43); +var SetLeft = __webpack_require__(52); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the right top position of the other. @@ -56946,7 +63260,7 @@ module.exports = RightTop; /***/ }), -/* 263 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56955,10 +63269,10 @@ module.exports = RightTop; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterX = __webpack_require__(77); -var GetTop = __webpack_require__(38); -var SetBottom = __webpack_require__(48); -var SetCenterX = __webpack_require__(78); +var GetCenterX = __webpack_require__(83); +var GetTop = __webpack_require__(43); +var SetBottom = __webpack_require__(54); +var SetCenterX = __webpack_require__(84); /** * Takes given Game Object and aligns it so that it is positioned next to the top center position of the other. @@ -56990,7 +63304,7 @@ module.exports = TopCenter; /***/ }), -/* 264 */ +/* 279 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56999,10 +63313,10 @@ module.exports = TopCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLeft = __webpack_require__(36); -var GetTop = __webpack_require__(38); -var SetBottom = __webpack_require__(48); -var SetLeft = __webpack_require__(46); +var GetLeft = __webpack_require__(41); +var GetTop = __webpack_require__(43); +var SetBottom = __webpack_require__(54); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned next to the top left position of the other. @@ -57034,7 +63348,7 @@ module.exports = TopLeft; /***/ }), -/* 265 */ +/* 280 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57043,10 +63357,10 @@ module.exports = TopLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetRight = __webpack_require__(37); -var GetTop = __webpack_require__(38); -var SetBottom = __webpack_require__(48); -var SetRight = __webpack_require__(47); +var GetRight = __webpack_require__(42); +var GetTop = __webpack_require__(43); +var SetBottom = __webpack_require__(54); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned next to the top right position of the other. @@ -57078,7 +63392,7 @@ module.exports = TopRight; /***/ }), -/* 266 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57087,19 +63401,19 @@ module.exports = TopRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ALIGN_CONST = __webpack_require__(108); +var ALIGN_CONST = __webpack_require__(120); var AlignInMap = []; -AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(267); -AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(268); -AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(269); -AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(270); -AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(272); -AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(273); -AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(274); -AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(275); -AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(276); +AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(282); +AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(283); +AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(284); +AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(285); +AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(287); +AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(288); +AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(289); +AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(290); +AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(291); AlignInMap[ALIGN_CONST.LEFT_BOTTOM] = AlignInMap[ALIGN_CONST.BOTTOM_LEFT]; AlignInMap[ALIGN_CONST.LEFT_TOP] = AlignInMap[ALIGN_CONST.TOP_LEFT]; AlignInMap[ALIGN_CONST.RIGHT_BOTTOM] = AlignInMap[ALIGN_CONST.BOTTOM_RIGHT]; @@ -57116,7 +63430,7 @@ AlignInMap[ALIGN_CONST.RIGHT_TOP] = AlignInMap[ALIGN_CONST.TOP_RIGHT]; * * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {integer} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. + * @param {number} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. * @param {number} [offsetX=0] - Optional horizontal offset from the position. * @param {number} [offsetY=0] - Optional vertical offset from the position. * @@ -57131,7 +63445,7 @@ module.exports = QuickSet; /***/ }), -/* 267 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57140,10 +63454,10 @@ module.exports = QuickSet; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetCenterX = __webpack_require__(77); -var SetBottom = __webpack_require__(48); -var SetCenterX = __webpack_require__(78); +var GetBottom = __webpack_require__(40); +var GetCenterX = __webpack_require__(83); +var SetBottom = __webpack_require__(54); +var SetCenterX = __webpack_require__(84); /** * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. @@ -57175,7 +63489,7 @@ module.exports = BottomCenter; /***/ }), -/* 268 */ +/* 283 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57184,10 +63498,10 @@ module.exports = BottomCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetLeft = __webpack_require__(36); -var SetBottom = __webpack_require__(48); -var SetLeft = __webpack_require__(46); +var GetBottom = __webpack_require__(40); +var GetLeft = __webpack_require__(41); +var SetBottom = __webpack_require__(54); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. @@ -57219,7 +63533,7 @@ module.exports = BottomLeft; /***/ }), -/* 269 */ +/* 284 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57228,10 +63542,10 @@ module.exports = BottomLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetRight = __webpack_require__(37); -var SetBottom = __webpack_require__(48); -var SetRight = __webpack_require__(47); +var GetBottom = __webpack_require__(40); +var GetRight = __webpack_require__(42); +var SetBottom = __webpack_require__(54); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. @@ -57263,7 +63577,7 @@ module.exports = BottomRight; /***/ }), -/* 270 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57272,9 +63586,9 @@ module.exports = BottomRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CenterOn = __webpack_require__(271); -var GetCenterX = __webpack_require__(77); -var GetCenterY = __webpack_require__(79); +var CenterOn = __webpack_require__(286); +var GetCenterX = __webpack_require__(83); +var GetCenterY = __webpack_require__(85); /** * Takes given Game Object and aligns it so that it is positioned in the center of the other. @@ -57305,7 +63619,7 @@ module.exports = Center; /***/ }), -/* 271 */ +/* 286 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57314,8 +63628,8 @@ module.exports = Center; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetCenterX = __webpack_require__(78); -var SetCenterY = __webpack_require__(80); +var SetCenterX = __webpack_require__(84); +var SetCenterY = __webpack_require__(86); /** * Positions the Game Object so that it is centered on the given coordinates. @@ -57342,7 +63656,7 @@ module.exports = CenterOn; /***/ }), -/* 272 */ +/* 287 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57351,10 +63665,10 @@ module.exports = CenterOn; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(79); -var GetLeft = __webpack_require__(36); -var SetCenterY = __webpack_require__(80); -var SetLeft = __webpack_require__(46); +var GetCenterY = __webpack_require__(85); +var GetLeft = __webpack_require__(41); +var SetCenterY = __webpack_require__(86); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned in the left center of the other. @@ -57386,7 +63700,7 @@ module.exports = LeftCenter; /***/ }), -/* 273 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57395,10 +63709,10 @@ module.exports = LeftCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(79); -var GetRight = __webpack_require__(37); -var SetCenterY = __webpack_require__(80); -var SetRight = __webpack_require__(47); +var GetCenterY = __webpack_require__(85); +var GetRight = __webpack_require__(42); +var SetCenterY = __webpack_require__(86); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned in the right center of the other. @@ -57430,7 +63744,7 @@ module.exports = RightCenter; /***/ }), -/* 274 */ +/* 289 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57439,10 +63753,10 @@ module.exports = RightCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterX = __webpack_require__(77); -var GetTop = __webpack_require__(38); -var SetCenterX = __webpack_require__(78); -var SetTop = __webpack_require__(45); +var GetCenterX = __webpack_require__(83); +var GetTop = __webpack_require__(43); +var SetCenterX = __webpack_require__(84); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned in the top center of the other. @@ -57474,7 +63788,7 @@ module.exports = TopCenter; /***/ }), -/* 275 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57483,10 +63797,10 @@ module.exports = TopCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLeft = __webpack_require__(36); -var GetTop = __webpack_require__(38); -var SetLeft = __webpack_require__(46); -var SetTop = __webpack_require__(45); +var GetLeft = __webpack_require__(41); +var GetTop = __webpack_require__(43); +var SetLeft = __webpack_require__(52); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned in the top left of the other. @@ -57518,7 +63832,7 @@ module.exports = TopLeft; /***/ }), -/* 276 */ +/* 291 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57527,10 +63841,10 @@ module.exports = TopLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetRight = __webpack_require__(37); -var GetTop = __webpack_require__(38); -var SetRight = __webpack_require__(47); -var SetTop = __webpack_require__(45); +var GetRight = __webpack_require__(42); +var GetTop = __webpack_require__(43); +var SetRight = __webpack_require__(53); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned in the top right of the other. @@ -57562,7 +63876,7 @@ module.exports = TopRight; /***/ }), -/* 277 */ +/* 292 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57571,8 +63885,8 @@ module.exports = TopRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CircumferencePoint = __webpack_require__(159); -var FromPercent = __webpack_require__(89); +var CircumferencePoint = __webpack_require__(160); +var FromPercent = __webpack_require__(94); var MATH_CONST = __webpack_require__(13); var Point = __webpack_require__(4); @@ -57605,7 +63919,7 @@ module.exports = GetPoint; /***/ }), -/* 278 */ +/* 293 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57614,9 +63928,9 @@ module.exports = GetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circumference = __webpack_require__(279); -var CircumferencePoint = __webpack_require__(159); -var FromPercent = __webpack_require__(89); +var Circumference = __webpack_require__(294); +var CircumferencePoint = __webpack_require__(160); +var FromPercent = __webpack_require__(94); var MATH_CONST = __webpack_require__(13); /** @@ -57627,7 +63941,7 @@ var MATH_CONST = __webpack_require__(13); * @since 3.0.0 * * @param {Phaser.Geom.Circle} circle - The Circle to get the points from. - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -57657,7 +63971,7 @@ module.exports = GetPoints; /***/ }), -/* 279 */ +/* 294 */ /***/ (function(module, exports) { /** @@ -57685,7 +63999,7 @@ module.exports = Circumference; /***/ }), -/* 280 */ +/* 295 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57694,7 +64008,7 @@ module.exports = Circumference; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); // bitmask flag for GameObject.renderMask var _FLAG = 2; // 0010 @@ -57795,7 +64109,7 @@ module.exports = AlphaSingle; /***/ }), -/* 281 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57804,7 +64118,7 @@ module.exports = AlphaSingle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(54); +var BlendModes = __webpack_require__(48); /** * Provides methods used for setting the blend mode of a Game Object. @@ -57820,7 +64134,7 @@ var BlendMode = { * Private internal value. Holds the current blend mode. * * @name Phaser.GameObjects.Components.BlendMode#_blendMode - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -57917,7 +64231,7 @@ module.exports = BlendMode; /***/ }), -/* 282 */ +/* 297 */ /***/ (function(module, exports) { /** @@ -57929,7 +64243,7 @@ module.exports = BlendMode; /** * Provides methods used for setting the depth of a Game Object. * Should be applied as a mixin and not used directly. - * + * * @namespace Phaser.GameObjects.Components.Depth * @since 3.0.0 */ @@ -57938,9 +64252,9 @@ var Depth = { /** * Private internal value. Holds the depth of the Game Object. - * + * * @name Phaser.GameObjects.Components.Depth#_depth - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -57949,7 +64263,7 @@ var Depth = { /** * The depth of this Game Object within the Scene. - * + * * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order * of Game Objects, without actually moving their position in the display list. * @@ -57957,7 +64271,7 @@ var Depth = { * value will always render in front of one with a lower value. * * Setting the depth will queue a depth sort event within the Scene. - * + * * @name Phaser.GameObjects.Components.Depth#depth * @type {number} * @since 3.0.0 @@ -57971,7 +64285,11 @@ var Depth = { set: function (value) { - this.scene.sys.queueDepthSort(); + if (this.displayList) + { + this.displayList.queueDepthSort(); + } + this._depth = value; } @@ -57979,7 +64297,7 @@ var Depth = { /** * The depth of this Game Object within the Scene. - * + * * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order * of Game Objects, without actually moving their position in the display list. * @@ -57987,12 +64305,12 @@ var Depth = { * value will always render in front of one with a lower value. * * Setting the depth will queue a depth sort event within the Scene. - * + * * @method Phaser.GameObjects.Components.Depth#setDepth * @since 3.0.0 * - * @param {integer} value - The depth of this Game Object. - * + * @param {number} value - The depth of this Game Object. + * * @return {this} This Game Object instance. */ setDepth: function (value) @@ -58010,7 +64328,7 @@ module.exports = Depth; /***/ }), -/* 283 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58019,8 +64337,8 @@ module.exports = Depth; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetPoint = __webpack_require__(161); -var Perimeter = __webpack_require__(118); +var GetPoint = __webpack_require__(162); +var Perimeter = __webpack_require__(126); // Return an array of points from the perimeter of the rectangle // each spaced out based on the quantity or step required @@ -58035,7 +64353,7 @@ var Perimeter = __webpack_require__(118); * * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle object to get the points from. * @param {number} step - Step between points. Used to calculate the number of points to return when quantity is falsey. Ignored if quantity is positive. - * @param {integer} quantity - The number of evenly spaced points from the rectangles perimeter to return. If falsey, step param will be used to calculate the number of points. + * @param {number} quantity - The number of evenly spaced points from the rectangles perimeter to return. If falsey, step param will be used to calculate the number of points. * @param {(array|Phaser.Geom.Point[])} [out] - An optional array to store the points in. * * @return {(array|Phaser.Geom.Point[])} An array of Points from the perimeter of the rectangle. @@ -58064,7 +64382,7 @@ module.exports = GetPoints; /***/ }), -/* 284 */ +/* 299 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58103,7 +64421,7 @@ module.exports = GetPoint; /***/ }), -/* 285 */ +/* 300 */ /***/ (function(module, exports) { /** @@ -58147,7 +64465,7 @@ module.exports = RotateAround; /***/ }), -/* 286 */ +/* 301 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58156,8 +64474,8 @@ module.exports = RotateAround; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapMask = __webpack_require__(287); -var GeometryMask = __webpack_require__(288); +var BitmapMask = __webpack_require__(302); +var GeometryMask = __webpack_require__(303); /** * Provides methods used for getting and setting the mask of a Game Object. @@ -58184,10 +64502,10 @@ var Mask = { * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. * * If a mask is already set on this Game Object it will be immediately replaced. - * + * * Masks are positioned in global space and are not relative to the Game Object to which they * are applied. The reason for this is that multiple Game Objects can all share the same mask. - * + * * Masks have no impact on physics or input detection. They are purely a rendering component * that allows you to limit what is visible during the render pass. * @@ -58233,6 +64551,8 @@ var Mask = { * Creates and returns a Bitmap Mask. This mask can be used by any Game Object, * including this one. * + * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. + * * To create the mask you need to pass in a reference to a renderable Game Object. * A renderable Game Object is one that uses a texture to render with, such as an * Image, Sprite, Render Texture or BitmapText. @@ -58243,7 +64563,7 @@ var Mask = { * * @method Phaser.GameObjects.Components.Mask#createBitmapMask * @since 3.6.2 - * + * * @param {Phaser.GameObjects.GameObject} [renderable] - A renderable Game Object that uses a texture, such as a Sprite. * * @return {Phaser.Display.Masks.BitmapMask} This Bitmap Mask that was created. @@ -58267,12 +64587,12 @@ var Mask = { * * If you do not provide a graphics object, and this Game Object is an instance * of a Graphics object, then it will use itself to create the mask. - * + * * This means you can call this method to create a Geometry Mask from any Graphics Game Object. * * @method Phaser.GameObjects.Components.Mask#createGeometryMask * @since 3.6.2 - * + * * @param {Phaser.GameObjects.Graphics} [graphics] - A Graphics Game Object. The geometry within it will be used as the mask. * * @return {Phaser.Display.Masks.GeometryMask} This Geometry Mask that was created. @@ -58294,7 +64614,7 @@ module.exports = Mask; /***/ }), -/* 287 */ +/* 302 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58304,7 +64624,7 @@ module.exports = Mask; */ var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); /** * @classdesc @@ -58323,6 +64643,9 @@ var GameEvents = __webpack_require__(21); * A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the * corresponding pixel in the mask. * + * Note: You cannot combine Bitmap Masks and Blend Modes on the same Game Object. You can, however, + * combine Geometry Masks and Blend Modes together. + * * The Bitmap Mask's location matches the location of its Game Object, not the location of the * masked objects. Moving or transforming the underlying Game Object will change the mask * (and affect the visibility of any masked objects), whereas moving or transforming a masked object @@ -58347,7 +64670,7 @@ var BitmapMask = new Class({ function BitmapMask (scene, renderable) { - var renderer = scene.sys.game.renderer; + var renderer = scene.sys.renderer; /** * A reference to either the Canvas or WebGL Renderer that this Mask is using. @@ -58415,19 +64738,11 @@ var BitmapMask = new Class({ */ this.maskFramebuffer = null; - /** - * The previous framebuffer set in the renderer before this one was enabled. - * - * @name Phaser.Display.Masks.BitmapMask#prevFramebuffer - * @type {WebGLFramebuffer} - * @since 3.17.0 - */ - this.prevFramebuffer = null; - /** * Whether to invert the masks alpha. * - * If `true`, the alpha of the masking pixel will be inverted before it's multiplied with the masked pixel. Essentially, this means that a masked area will be visible only if the corresponding area in the mask is invisible. + * If `true`, the alpha of the masking pixel will be inverted before it's multiplied with the masked pixel. + * Essentially, this means that a masked area will be visible only if the corresponding area in the mask is invisible. * * @name Phaser.Display.Masks.BitmapMask#invertAlpha * @type {boolean} @@ -58445,36 +64760,73 @@ var BitmapMask = new Class({ */ this.isStencil = false; - if (renderer && renderer.gl) + this.createMask(); + + scene.sys.game.events.on(GameEvents.CONTEXT_RESTORED, this.createMask, this); + }, + + /** + * Creates the WebGL Texture2D objects and Framebuffers required for this + * mask. If this mask has already been created, then `clearMask` is called first. + * + * @method Phaser.Display.Masks.BitmapMask#createMask + * @since 3.50.0 + */ + createMask: function () + { + var renderer = this.renderer; + + if (!renderer.gl) { - var width = renderer.width; - var height = renderer.height; - var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); - var gl = renderer.gl; - var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; - var filter = gl.LINEAR; - - this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, true); - this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, true); - - scene.sys.game.events.on(GameEvents.CONTEXT_RESTORED, function (renderer) - { - var width = renderer.width; - var height = renderer.height; - var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); - var gl = renderer.gl; - var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; - var filter = gl.LINEAR; - - this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, true); - this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, true); - - }, this); + return; } + + if (this.mainTexture) + { + this.clearMask(); + } + + var width = renderer.width; + var height = renderer.height; + var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); + var gl = renderer.gl; + var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; + var filter = gl.LINEAR; + + this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, true); + this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, true); + }, + + /** + * Deletes the `mainTexture` and `maskTexture` WebGL Textures and deletes + * the `mainFramebuffer` and `maskFramebuffer` too, nulling all references. + * + * This is called when this mask is destroyed, or if you try to creat a new + * mask from this object when one is already set. + * + * @method Phaser.Display.Masks.BitmapMask#clearMask + * @since 3.50.0 + */ + clearMask: function () + { + var renderer = this.renderer; + + if (!renderer.gl || !this.mainTexture) + { + return; + } + + renderer.deleteTexture(this.mainTexture); + renderer.deleteTexture(this.maskTexture); + renderer.deleteFramebuffer(this.mainFramebuffer); + renderer.deleteFramebuffer(this.maskFramebuffer); + + this.mainTexture = null; + this.maskTexture = null; + this.mainFramebuffer = null; + this.maskFramebuffer = null; }, /** @@ -58561,22 +64913,9 @@ var BitmapMask = new Class({ */ destroy: function () { + this.clearMask(); + this.bitmapMask = null; - - var renderer = this.renderer; - - if (renderer && renderer.gl) - { - renderer.deleteTexture(this.mainTexture); - renderer.deleteTexture(this.maskTexture); - renderer.deleteFramebuffer(this.mainFramebuffer); - renderer.deleteFramebuffer(this.maskFramebuffer); - } - - this.mainTexture = null; - this.maskTexture = null; - this.mainFramebuffer = null; - this.maskFramebuffer = null; this.prevFramebuffer = null; this.renderer = null; } @@ -58587,7 +64926,7 @@ module.exports = BitmapMask; /***/ }), -/* 288 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58643,6 +64982,8 @@ var GeometryMask = new Class({ * Similar to the BitmapMasks invertAlpha setting this to true will then hide all pixels * drawn to the Geometry Mask. * + * This is a WebGL only feature. + * * @name Phaser.Display.Masks.GeometryMask#invertAlpha * @type {boolean} * @since 3.16.0 @@ -58677,7 +65018,7 @@ var GeometryMask = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphicsGeometry - The Graphics object which will be used for the Geometry Mask. - * + * * @return {this} This Geometry Mask */ setShape: function (graphicsGeometry) @@ -58689,13 +65030,16 @@ var GeometryMask = new Class({ /** * Sets the `invertAlpha` property of this Geometry Mask. + * * Inverting the alpha essentially flips the way the mask works. * + * This is a WebGL only feature. + * * @method Phaser.Display.Masks.GeometryMask#setInvertAlpha * @since 3.17.0 * * @param {boolean} [value=true] - Invert the alpha of this mask? - * + * * @return {this} This Geometry Mask */ setInvertAlpha: function (value) @@ -58774,7 +65118,7 @@ var GeometryMask = new Class({ } // Write stencil buffer - geometryMask.renderWebGL(renderer, geometryMask, 0, camera); + geometryMask.renderWebGL(renderer, geometryMask, camera); renderer.flush(); @@ -58818,32 +65162,32 @@ var GeometryMask = new Class({ renderer.maskCount--; + // Force flush before disabling stencil test + renderer.flush(); + + var current = renderer.currentMask; + if (renderer.maskStack.length === 0) { // If this is the only mask in the stack, flush and disable - renderer.flush(); - - renderer.currentMask.mask = null; + current.mask = null; gl.disable(gl.STENCIL_TEST); } else { - // Force flush before disabling stencil test - renderer.flush(); - var prev = renderer.maskStack[renderer.maskStack.length - 1]; prev.mask.applyStencil(renderer, prev.camera, false); if (renderer.currentCameraMask.mask !== prev.mask) { - renderer.currentMask.mask = prev.mask; - renderer.currentMask.camera = prev.camera; + current.mask = prev.mask; + current.camera = prev.camera; } else { - renderer.currentMask.mask = null; + current.mask = null; } } }, @@ -58864,7 +65208,7 @@ var GeometryMask = new Class({ renderer.currentContext.save(); - geometryMask.renderCanvas(renderer, geometryMask, 0, camera, null, null, true); + geometryMask.renderCanvas(renderer, geometryMask, camera, null, null, true); renderer.currentContext.clip(); }, @@ -58902,7 +65246,7 @@ module.exports = GeometryMask; /***/ }), -/* 289 */ +/* 304 */ /***/ (function(module, exports) { /** @@ -59009,68 +65353,7 @@ module.exports = ScrollFactor; /***/ }), -/* 290 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Build a JSON representation of the given Game Object. - * - * This is typically extended further by Game Object specific implementations. - * - * @method Phaser.GameObjects.Components.ToJSON - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON. - * - * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. - */ -var ToJSON = function (gameObject) -{ - var out = { - name: gameObject.name, - type: gameObject.type, - x: gameObject.x, - y: gameObject.y, - depth: gameObject.depth, - scale: { - x: gameObject.scaleX, - y: gameObject.scaleY - }, - origin: { - x: gameObject.originX, - y: gameObject.originY - }, - flipX: gameObject.flipX, - flipY: gameObject.flipY, - rotation: gameObject.rotation, - alpha: gameObject.alpha, - visible: gameObject.visible, - blendMode: gameObject.blendMode, - textureKey: '', - frameKey: '', - data: {} - }; - - if (gameObject.texture) - { - out.textureKey = gameObject.texture.key; - out.frameKey = gameObject.frame.name; - } - - return out; -}; - -module.exports = ToJSON; - - -/***/ }), -/* 291 */ +/* 305 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59080,10 +65363,10 @@ module.exports = ToJSON; */ var MATH_CONST = __webpack_require__(13); -var TransformMatrix = __webpack_require__(31); -var TransformXY = __webpack_require__(166); -var WrapAngle = __webpack_require__(248); -var WrapAngleDegrees = __webpack_require__(249); +var TransformMatrix = __webpack_require__(24); +var TransformXY = __webpack_require__(169); +var WrapAngle = __webpack_require__(261); +var WrapAngleDegrees = __webpack_require__(262); var Vector2 = __webpack_require__(3); // global bitmask flag for GameObject.renderMask (used by Scale) @@ -59281,7 +65564,7 @@ var Transform = { * If you prefer to work in radians, see the `rotation` property instead. * * @name Phaser.GameObjects.Components.Transform#angle - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -59354,6 +65637,26 @@ var Transform = { return this; }, + /** + * Copies an object's coordinates to this Game Object's position. + * + * @method Phaser.GameObjects.Components.Transform#copyPosition + * @since 3.50.0 + * + * @param {(Phaser.Types.Math.Vector2Like|Phaser.Types.Math.Vector3Like|Phaser.Types.Math.Vector4Like)} source - An object with numeric 'x', 'y', 'z', or 'w' properties. Undefined values are not copied. + * + * @return {this} This Game Object instance. + */ + copyPosition: function (source) + { + if (source.x !== undefined) { this.x = source.x; } + if (source.y !== undefined) { this.y = source.y; } + if (source.z !== undefined) { this.z = source.z; } + if (source.w !== undefined) { this.w = source.w; } + + return this; + }, + /** * Sets the position of this Game Object to be a random position within the confines of * the given area. @@ -59661,7 +65964,7 @@ module.exports = Transform; /***/ }), -/* 292 */ +/* 306 */ /***/ (function(module, exports) { /** @@ -59750,7 +66053,7 @@ module.exports = Visible; /***/ }), -/* 293 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59765,16 +66068,17 @@ module.exports = Visible; module.exports = { - CHANGE_DATA: __webpack_require__(589), - CHANGE_DATA_KEY: __webpack_require__(590), - REMOVE_DATA: __webpack_require__(591), - SET_DATA: __webpack_require__(592) + CHANGE_DATA: __webpack_require__(628), + CHANGE_DATA_KEY: __webpack_require__(629), + DESTROY: __webpack_require__(630), + REMOVE_DATA: __webpack_require__(631), + SET_DATA: __webpack_require__(632) }; /***/ }), -/* 294 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -59783,7 +66087,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Perimeter = __webpack_require__(118); +var Perimeter = __webpack_require__(126); var Point = __webpack_require__(4); @@ -59798,7 +66102,7 @@ var Point = __webpack_require__(4); * * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the perimeter points from. * @param {number} [step] - The distance between each point of the perimeter. Set to `null` if you wish to use the `quantity` parameter instead. - * @param {integer} [quantity] - The total number of points to return. The step is then calculated based on the length of the Rectangle, divided by this value. + * @param {number} [quantity] - The total number of points to return. The step is then calculated based on the length of the Rectangle, divided by this value. * @param {(array|Phaser.Geom.Point[])} [out] - An array in which the perimeter points will be stored. If not given, a new array instance is created. * * @return {(array|Phaser.Geom.Point[])} An array containing the perimeter points from the Rectangle. @@ -59893,87 +66197,7 @@ module.exports = MarchingAnts; /***/ }), -/* 295 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Moves the element at the start of the array to the end, shifting all items in the process. - * The "rotation" happens to the left. - * - * @function Phaser.Utils.Array.RotateLeft - * @since 3.0.0 - * - * @param {array} array - The array to shift to the left. This array is modified in place. - * @param {integer} [total=1] - The number of times to shift the array. - * - * @return {*} The most recently shifted element. - */ -var RotateLeft = function (array, total) -{ - if (total === undefined) { total = 1; } - - var element = null; - - for (var i = 0; i < total; i++) - { - element = array.shift(); - array.push(element); - } - - return element; -}; - -module.exports = RotateLeft; - - -/***/ }), -/* 296 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Moves the element at the end of the array to the start, shifting all items in the process. - * The "rotation" happens to the right. - * - * @function Phaser.Utils.Array.RotateRight - * @since 3.0.0 - * - * @param {array} array - The array to shift to the right. This array is modified in place. - * @param {integer} [total=1] - The number of times to shift the array. - * - * @return {*} The most recently shifted element. - */ -var RotateRight = function (array, total) -{ - if (total === undefined) { total = 1; } - - var element = null; - - for (var i = 0; i < total; i++) - { - element = array.pop(); - array.unshift(element); - } - - return element; -}; - -module.exports = RotateRight; - - -/***/ }), -/* 297 */ +/* 309 */ /***/ (function(module, exports) { /** @@ -59991,7 +66215,7 @@ module.exports = RotateRight; * @since 3.0.0 * * @param {Phaser.Geom.Line} line - The line. - * @param {integer} [stepRate=1] - The optional step rate for the points on the line. + * @param {number} [stepRate=1] - The optional step rate for the points on the line. * @param {Phaser.Types.Math.Vector2Like[]} [results] - An optional array to push the resulting coordinates into. * * @return {Phaser.Types.Math.Vector2Like[]} The array of coordinates on the line. @@ -60047,7 +66271,7 @@ module.exports = BresenhamPoints; /***/ }), -/* 298 */ +/* 310 */ /***/ (function(module, exports) { /** @@ -60131,7 +66355,7 @@ module.exports = FindClosestInSorted; /***/ }), -/* 299 */ +/* 311 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60157,16 +66381,19 @@ var Class = __webpack_require__(0); * @since 3.0.0 * * @param {string} textureKey - The key of the Texture this AnimationFrame uses. - * @param {(string|integer)} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. - * @param {integer} index - The index of this AnimationFrame within the Animation sequence. + * @param {(string|number)} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. + * @param {number} index - The index of this AnimationFrame within the Animation sequence. * @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering. + * @param {boolean} [isKeyFrame=false] - Is this Frame a Keyframe within the Animation? */ var AnimationFrame = new Class({ initialize: - function AnimationFrame (textureKey, textureFrame, index, frame) + function AnimationFrame (textureKey, textureFrame, index, frame, isKeyFrame) { + if (isKeyFrame === undefined) { isKeyFrame = false; } + /** * The key of the Texture this AnimationFrame uses. * @@ -60180,7 +66407,7 @@ var AnimationFrame = new Class({ * The key of the Frame within the Texture that this AnimationFrame uses. * * @name Phaser.Animations.AnimationFrame#textureFrame - * @type {(string|integer)} + * @type {(string|number)} * @since 3.0.0 */ this.textureFrame = textureFrame; @@ -60189,7 +66416,7 @@ var AnimationFrame = new Class({ * The index of this AnimationFrame within the Animation sequence. * * @name Phaser.Animations.AnimationFrame#index - * @type {integer} + * @type {number} * @since 3.0.0 */ this.index = index; @@ -60269,6 +66496,15 @@ var AnimationFrame = new Class({ * @since 3.0.0 */ this.progress = 0; + + /** + * Is this Frame a KeyFrame within the Animation? + * + * @name Phaser.Animations.AnimationFrame#isKeyFrame + * @type {boolean} + * @since 3.50.0 + */ + this.isKeyFrame = isKeyFrame; }, /** @@ -60284,7 +66520,8 @@ var AnimationFrame = new Class({ return { key: this.textureKey, frame: this.textureFrame, - duration: this.duration + duration: this.duration, + keyframe: this.isKeyFrame }; }, @@ -60305,7 +66542,7 @@ module.exports = AnimationFrame; /***/ }), -/* 300 */ +/* 312 */ /***/ (function(module, exports) { /** @@ -60343,7 +66580,7 @@ module.exports = SortByDigits; /***/ }), -/* 301 */ +/* 313 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60352,16 +66589,16 @@ module.exports = SortByDigits; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Animation = __webpack_require__(172); +var Animation = __webpack_require__(177); var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(92); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(122); -var GameEvents = __webpack_require__(21); +var CustomMap = __webpack_require__(98); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(128); +var GameEvents = __webpack_require__(23); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); -var Pad = __webpack_require__(173); -var NumberArray = __webpack_require__(302); +var Pad = __webpack_require__(178); +var NumberArray = __webpack_require__(314); /** * @classdesc @@ -60441,7 +66678,7 @@ var AnimationManager = new Class({ * See the {@link #setMix} method for more details. * * @name Phaser.Animations.AnimationManager#mixes - * @type {Phaser.Structs.Map.} + * @type {Phaser.Structs.Map.} * @since 3.50.0 */ this.mixes = new CustomMap(); @@ -60702,17 +66939,17 @@ var AnimationManager = new Class({ * * This was tested with Aseprite 1.2.25. * - * This will export a png and json file which you can load using the Atlas Loader, i.e.: + * This will export a png and json file which you can load using the Aseprite Loader, i.e.: * * ```javascript * function preload () * { * this.load.path = 'assets/animations/aseprite/'; - * this.load.atlas('paladin', 'paladin.png', 'paladin.json'); + * this.load.aseprite('paladin', 'paladin.png', 'paladin.json'); * } * ``` * - * Once exported, you can call this method from within a Scene with the 'atlas' key: + * Once loaded, you can call this method from within a Scene with the 'atlas' key: * * ```javascript * this.anims.createFromAseprite('paladin'); @@ -61031,6 +67268,36 @@ var AnimationManager = new Class({ * * If you're working with a texture atlas, see the `generateFrameNames` method instead. * + * It's a helper method, designed to make it easier for you to extract frames from sprite sheets. + * If you're working with a texture atlas, see the `generateFrameNames` method instead. + * + * Example: + * + * If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using: + * `this.anims.generateFrameNumbers('explosion', { start: 0, end: 12 })`. + * + * The `end` value tells it to stop after 12 frames. To create an animation using this method, you can do: + * + * ```javascript + * this.anims.create({ + * key: 'boom', + * frames: this.anims.generateFrameNames('explosion', { + * start: 0, + * end: 12 + * }) + * }); + * ``` + * + * Note that `start` is optional and you don't need to include it if the animation starts from frame 0. + * + * To specify an animation in reverse, swap the `start` and `end` values. + * + * If the frames are not sequential, you may pass an array of frame numbers instead, for example: + * + * `this.anims.generateFrameNumbers('explosion', { frames: [ 0, 1, 2, 1, 2, 3, 4, 0, 1, 2 ] })` + * + * Please see the animation examples and `GenerateFrameNumbers` config docs for further details. + * * @method Phaser.Animations.AnimationManager#generateFrameNumbers * @since 3.0.0 * @@ -61322,7 +67589,7 @@ module.exports = AnimationManager; /***/ }), -/* 302 */ +/* 314 */ /***/ (function(module, exports) { /** @@ -61415,7 +67682,7 @@ module.exports = NumberArray; /***/ }), -/* 303 */ +/* 315 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61425,9 +67692,9 @@ module.exports = NumberArray; */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(92); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(304); +var CustomMap = __webpack_require__(98); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(316); /** * @classdesc @@ -61601,7 +67868,7 @@ module.exports = BaseCache; /***/ }), -/* 304 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61616,14 +67883,14 @@ module.exports = BaseCache; module.exports = { - ADD: __webpack_require__(664), - REMOVE: __webpack_require__(665) + ADD: __webpack_require__(704), + REMOVE: __webpack_require__(705) }; /***/ }), -/* 305 */ +/* 317 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61632,9 +67899,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCache = __webpack_require__(303); +var BaseCache = __webpack_require__(315); var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); /** * @classdesc @@ -61857,7 +68124,7 @@ module.exports = CacheManager; /***/ }), -/* 306 */ +/* 318 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61866,14 +68133,14 @@ module.exports = CacheManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCamera = __webpack_require__(93); -var CanvasPool = __webpack_require__(26); -var CenterOn = __webpack_require__(178); -var Clamp = __webpack_require__(17); +var BaseCamera = __webpack_require__(99); +var CenterOn = __webpack_require__(182); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Effects = __webpack_require__(314); -var Linear = __webpack_require__(124); +var Effects = __webpack_require__(325); +var Events = __webpack_require__(35); +var Linear = __webpack_require__(130); var Rectangle = __webpack_require__(9); var Vector2 = __webpack_require__(3); @@ -61908,6 +68175,7 @@ var Vector2 = __webpack_require__(3); * @extends Phaser.Cameras.Scene2D.BaseCamera * @extends Phaser.GameObjects.Components.Flip * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Pipeline * * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas. * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas. @@ -61920,7 +68188,8 @@ var Camera = new Class({ Mixins: [ Components.Flip, - Components.Tint + Components.Tint, + Components.Pipeline ], initialize: @@ -61929,6 +68198,9 @@ var Camera = new Class({ { BaseCamera.call(this, x, y, width, height); + this.postPipelines = []; + this.pipelineData = {}; + /** * Does this Camera allow the Game Objects it renders to receive input events? * @@ -62063,268 +68335,6 @@ var Camera = new Class({ * @since 3.0.0 */ this._follow = null; - - /** - * Is this Camera rendering directly to the canvas or to a texture? - * - * Enable rendering to texture with the method `setRenderToTexture` (just enabling this boolean won't be enough) - * - * Once enabled you can toggle it by switching this property. - * - * To properly remove a render texture you should call the `clearRenderToTexture()` method. - * - * @name Phaser.Cameras.Scene2D.Camera#renderToTexture - * @type {boolean} - * @default false - * @since 3.13.0 - */ - this.renderToTexture = false; - - /** - * If this Camera is rendering to a texture (via `setRenderToTexture`) then you - * have the option to control if it should also render to the Game canvas as well. - * - * By default, a Camera will render both to its texture and to the Game canvas. - * - * However, if you set ths property to `false` it will only render to the texture - * and skip rendering to the Game canvas. - * - * Setting this property if the Camera isn't rendering to a texture has no effect. - * - * @name Phaser.Cameras.Scene2D.Camera#renderToGame - * @type {boolean} - * @default true - * @since 3.23.0 - */ - this.renderToGame = true; - - /** - * If this Camera has been set to render to a texture then this holds a reference - * to the HTML Canvas Element that the Camera is drawing to. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only populated if Phaser is running with the Canvas Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#canvas - * @type {HTMLCanvasElement} - * @since 3.13.0 - */ - this.canvas = null; - - /** - * If this Camera has been set to render to a texture then this holds a reference - * to the Rendering Context belonging to the Canvas element the Camera is drawing to. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only populated if Phaser is running with the Canvas Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#context - * @type {CanvasRenderingContext2D} - * @since 3.13.0 - */ - this.context = null; - - /** - * If this Camera has been set to render to a texture then this holds a reference - * to the GL Texture belonging the Camera is drawing to. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only set if Phaser is running with the WebGL Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#glTexture - * @type {?WebGLTexture} - * @since 3.13.0 - */ - this.glTexture = null; - - /** - * If this Camera has been set to render to a texture then this holds a reference - * to the GL Frame Buffer belonging the Camera is drawing to. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only set if Phaser is running with the WebGL Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#framebuffer - * @type {?WebGLFramebuffer} - * @since 3.13.0 - */ - this.framebuffer = null; - - /** - * If this Camera has been set to render to a texture and to use a custom pipeline, - * then this holds a reference to the pipeline the Camera is drawing with. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only set if Phaser is running with the WebGL Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#pipeline - * @type {?Phaser.Renderer.WebGL.WebGLPipeline} - * @since 3.13.0 - */ - this.pipeline = null; - }, - - /** - * Sets the Camera to render to a texture instead of to the main canvas. - * - * The Camera will redirect all Game Objects it's asked to render to this texture. - * - * During the render sequence, the texture itself will then be rendered to the main canvas. - * - * Doing this gives you the ability to modify the texture before this happens, - * allowing for special effects such as Camera specific shaders, or post-processing - * on the texture. - * - * If running under Canvas the Camera will render to its `canvas` property. - * - * If running under WebGL the Camera will create a frame buffer, which is stored in its `framebuffer` and `glTexture` properties. - * - * If you set a camera to render to a texture then it will emit 2 events during the render loop: - * - * First, it will emit the event `prerender`. This happens right before any Game Object's are drawn to the Camera texture. - * - * Then, it will emit the event `postrender`. This happens after all Game Object's have been drawn, but right before the - * Camera texture is rendered to the main game canvas. It's the final point at which you can manipulate the texture before - * it appears in-game. - * - * You should not enable this unless you plan on actually using the texture it creates - * somehow, otherwise you're just doubling the work required to render your game. - * - * If you only require the Camera to render to a texture, and not also to the Game, - * them set the `renderToGame` parameter to `false`. - * - * To temporarily disable rendering to a texture, toggle the `renderToTexture` boolean. - * - * If you no longer require the Camera to render to a texture, call the `clearRenderToTexture` method, - * which will delete the respective textures and free-up resources. - * - * @method Phaser.Cameras.Scene2D.Camera#setRenderToTexture - * @since 3.13.0 - * - * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} [pipeline] - An optional WebGL Pipeline to render with, can be either a string which is the name of the pipeline, or a pipeline reference. - * @param {boolean} [renderToGame=true] - If you do not need the Camera to still render to the Game, set this parameter to `false`. - * - * @return {this} This Camera instance. - */ - setRenderToTexture: function (pipeline, renderToGame) - { - if (renderToGame === undefined) { renderToGame = true; } - - var renderer = this.scene.sys.game.renderer; - - if (renderer.gl) - { - this.glTexture = renderer.createTextureFromSource(null, this.width, this.height, 0); - this.framebuffer = renderer.createFramebuffer(this.width, this.height, this.glTexture, false); - } - else - { - this.canvas = CanvasPool.create2D(this, this.width, this.height); - this.context = this.canvas.getContext('2d'); - } - - this.renderToTexture = true; - this.renderToGame = renderToGame; - - if (pipeline) - { - this.setPipeline(pipeline); - } - - return this; - }, - - /** - * Sets the WebGL pipeline this Camera is using when rendering to a texture. - * - * You can pass either the string-based name of the pipeline, or a reference to the pipeline itself. - * - * Call this method with no arguments to clear any previously set pipeline. - * - * @method Phaser.Cameras.Scene2D.Camera#setPipeline - * @since 3.13.0 - * - * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} [pipeline] - The WebGL Pipeline to render with, can be either a string which is the name of the pipeline, or a pipeline reference. Or if left empty it will clear the pipeline. - * - * @return {this} This Camera instance. - */ - setPipeline: function (pipeline) - { - if (typeof pipeline === 'string') - { - var renderer = this.scene.sys.game.renderer; - - if (renderer.gl && renderer.pipelines.has(pipeline)) - { - this.pipeline = renderer.pipelines.get(pipeline); - } - } - else - { - this.pipeline = pipeline; - } - - return this; - }, - - /** - * If this Camera was set to render to a texture, this will clear the resources it was using and - * redirect it to render back to the primary Canvas again. - * - * If you only wish to temporarily disable rendering to a texture then you can toggle the - * property `renderToTexture` instead. - * - * @method Phaser.Cameras.Scene2D.Camera#clearRenderToTexture - * @since 3.13.0 - * - * @return {this} This Camera instance. - */ - clearRenderToTexture: function () - { - if (!this.scene) - { - return; - } - - var renderer = this.scene.sys.game.renderer; - - if (!renderer) - { - return; - } - - if (renderer.gl) - { - if (this.framebuffer) - { - renderer.deleteFramebuffer(this.framebuffer); - } - - if (this.glTexture) - { - renderer.deleteTexture(this.glTexture); - } - - this.framebuffer = null; - this.glTexture = null; - this.pipeline = null; - } - else - { - CanvasPool.remove(this); - - this.canvas = null; - this.context = null; - } - - this.renderToTexture = false; - - return this; }, /** @@ -62397,10 +68407,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.3.0 * - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. @@ -62421,10 +68431,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.3.0 * - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. @@ -62444,10 +68454,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.5.0 * - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -62468,10 +68478,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.0.0 * - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -62492,10 +68502,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.0.0 * - * @param {integer} [duration=250] - The duration of the effect in milliseconds. - * @param {integer} [red=255] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=255] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=250] - The duration of the effect in milliseconds. + * @param {number} [red=255] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=255] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -62516,7 +68526,7 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.0.0 * - * @param {integer} [duration=100] - The duration of the effect in milliseconds. + * @param {number} [duration=100] - The duration of the effect in milliseconds. * @param {(number|Phaser.Math.Vector2)} [intensity=0.05] - The intensity of the shake. * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -62541,7 +68551,7 @@ var Camera = new Class({ * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -62565,7 +68575,7 @@ var Camera = new Class({ * * @param {number} radians - The destination angle in radians to rotate the Camera viewport to. If the angle is positive then the rotation is clockwise else anticlockwise * @param {boolean} [shortestPath=false] - If shortest path is set to true the camera will rotate in the quickest direction clockwise or anti-clockwise. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the rotation. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the rotation effect to start immediately, even if already running. * @param {CameraRotateCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -62589,7 +68599,7 @@ var Camera = new Class({ * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -62610,10 +68620,8 @@ var Camera = new Class({ * @method Phaser.Cameras.Scene2D.Camera#preRender * @protected * @since 3.0.0 - * - * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (resolution) + preRender: function () { var width = this.width; var height = this.height; @@ -62621,7 +68629,7 @@ var Camera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * resolution; + var zoom = this.zoom; var matrix = this.matrix; var originX = width * this.originX; @@ -62638,6 +68646,8 @@ var Camera = new Class({ CenterOn(deadzone, this.midPoint.x, this.midPoint.y); } + var emitFollowEvent = false; + if (follow && !this.panEffect.isRunning) { var fx = (follow.x - this.followOffset.x); @@ -62668,6 +68678,8 @@ var Camera = new Class({ sx = Linear(sx, fx - originX, this.lerp.x); sy = Linear(sy, fy - originY, this.lerp.y); } + + emitFollowEvent = true; } if (this.useBounds) @@ -62680,6 +68692,9 @@ var Camera = new Class({ { originX = Math.round(originX); originY = Math.round(originY); + + sx = Math.round(sx); + sy = Math.round(sy); } // Values are in pixels and not impacted by zooming the Camera @@ -62696,17 +68711,26 @@ var Camera = new Class({ var displayWidth = width / zoom; var displayHeight = height / zoom; - this.worldView.setTo( - midX - (displayWidth / 2), - midY - (displayHeight / 2), - displayWidth, - displayHeight - ); + var vwx = midX - (displayWidth / 2); + var vwy = midY - (displayHeight / 2); + + if (this.roundPixels) + { + vwx = Math.round(vwx); + vwy = Math.round(vwy); + } + + this.worldView.setTo(vwx, vwy, displayWidth, displayHeight); matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); matrix.translate(-originX, -originY); this.shakeEffect.preRender(); + + if (emitFollowEvent) + { + this.emit(Events.FOLLOW_UPDATE, this, follow); + } }, /** @@ -62866,7 +68890,7 @@ var Camera = new Class({ * @protected * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -62894,8 +68918,6 @@ var Camera = new Class({ */ destroy: function () { - this.clearRenderToTexture(); - this.resetFX(); BaseCamera.prototype.destroy.call(this); @@ -62911,7 +68933,7 @@ module.exports = Camera; /***/ }), -/* 307 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62920,7 +68942,7 @@ module.exports = Camera; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); +var Color = __webpack_require__(36); /** * Converts a hex string into a Phaser Color object. @@ -62964,7 +68986,7 @@ module.exports = HexStringToColor; /***/ }), -/* 308 */ +/* 320 */ /***/ (function(module, exports) { /** @@ -62979,10 +69001,10 @@ module.exports = HexStringToColor; * @function Phaser.Display.Color.GetColor32 * @since 3.0.0 * - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * @param {integer} alpha - The alpha color value. A number between 0 and 255. + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * @param {number} alpha - The alpha color value. A number between 0 and 255. * * @return {number} The combined color value. */ @@ -62995,7 +69017,7 @@ module.exports = GetColor32; /***/ }), -/* 309 */ +/* 321 */ /***/ (function(module, exports) { /** @@ -63013,9 +69035,9 @@ module.exports = GetColor32; * @function Phaser.Display.Color.RGBToHSV * @since 3.0.0 * - * @param {integer} r - The red color value. A number between 0 and 255. - * @param {integer} g - The green color value. A number between 0 and 255. - * @param {integer} b - The blue color value. A number between 0 and 255. + * @param {number} r - The red color value. A number between 0 and 255. + * @param {number} g - The green color value. A number between 0 and 255. + * @param {number} b - The blue color value. A number between 0 and 255. * @param {(Phaser.Types.Display.HSVColorObject|Phaser.Display.Color)} [out] - An object to store the color values in. If not given an HSV Color Object will be created. * * @return {(Phaser.Types.Display.HSVColorObject|Phaser.Display.Color)} An object with the properties `h`, `s` and `v` set. @@ -63075,7 +69097,7 @@ module.exports = RGBToHSV; /***/ }), -/* 310 */ +/* 322 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63084,8 +69106,8 @@ module.exports = RGBToHSV; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); -var IntegerToRGB = __webpack_require__(311); +var Color = __webpack_require__(36); +var IntegerToRGB = __webpack_require__(181); /** * Converts the given color value into an instance of a Color object. @@ -63093,7 +69115,7 @@ var IntegerToRGB = __webpack_require__(311); * @function Phaser.Display.Color.IntegerToColor * @since 3.0.0 * - * @param {integer} input - The color value to convert into a Color object. + * @param {number} input - The color value to convert into a Color object. * * @return {Phaser.Display.Color} A Color object. */ @@ -63108,55 +69130,7 @@ module.exports = IntegerToColor; /***/ }), -/* 311 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Return the component parts of a color as an Object with the properties alpha, red, green, blue. - * - * Alpha will only be set if it exists in the given color (0xAARRGGBB) - * - * @function Phaser.Display.Color.IntegerToRGB - * @since 3.0.0 - * - * @param {integer} input - The color value to convert into a Color object. - * - * @return {Phaser.Types.Display.ColorObject} An object with the red, green and blue values set in the r, g and b properties. - */ -var IntegerToRGB = function (color) -{ - if (color > 16777215) - { - // The color value has an alpha component - return { - a: color >>> 24, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; - } - else - { - return { - a: 255, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; - } -}; - -module.exports = IntegerToRGB; - - -/***/ }), -/* 312 */ +/* 323 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63165,7 +69139,7 @@ module.exports = IntegerToRGB; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); +var Color = __webpack_require__(36); /** * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. @@ -63186,7 +69160,7 @@ module.exports = ObjectToColor; /***/ }), -/* 313 */ +/* 324 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63195,7 +69169,7 @@ module.exports = ObjectToColor; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); +var Color = __webpack_require__(36); /** * Converts a CSS 'web' string into a Phaser Color object. @@ -63232,7 +69206,7 @@ module.exports = RGBStringToColor; /***/ }), -/* 314 */ +/* 325 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63247,255 +69221,12 @@ module.exports = RGBStringToColor; module.exports = { - Fade: __webpack_require__(688), - Flash: __webpack_require__(689), - Pan: __webpack_require__(690), - Shake: __webpack_require__(723), - RotateTo: __webpack_require__(724), - Zoom: __webpack_require__(725) - -}; - - -/***/ }), -/* 315 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Back - */ - -module.exports = { - - In: __webpack_require__(691), - Out: __webpack_require__(692), - InOut: __webpack_require__(693) - -}; - - -/***/ }), -/* 316 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Bounce - */ - -module.exports = { - - In: __webpack_require__(694), - Out: __webpack_require__(695), - InOut: __webpack_require__(696) - -}; - - -/***/ }), -/* 317 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Circular - */ - -module.exports = { - - In: __webpack_require__(697), - Out: __webpack_require__(698), - InOut: __webpack_require__(699) - -}; - - -/***/ }), -/* 318 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Cubic - */ - -module.exports = { - - In: __webpack_require__(700), - Out: __webpack_require__(701), - InOut: __webpack_require__(702) - -}; - - -/***/ }), -/* 319 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Elastic - */ - -module.exports = { - - In: __webpack_require__(703), - Out: __webpack_require__(704), - InOut: __webpack_require__(705) - -}; - - -/***/ }), -/* 320 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Expo - */ - -module.exports = { - - In: __webpack_require__(706), - Out: __webpack_require__(707), - InOut: __webpack_require__(708) - -}; - - -/***/ }), -/* 321 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -module.exports = __webpack_require__(709); - - -/***/ }), -/* 322 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Quadratic - */ - -module.exports = { - - In: __webpack_require__(710), - Out: __webpack_require__(711), - InOut: __webpack_require__(712) - -}; - - -/***/ }), -/* 323 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Quartic - */ - -module.exports = { - - In: __webpack_require__(713), - Out: __webpack_require__(714), - InOut: __webpack_require__(715) - -}; - - -/***/ }), -/* 324 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Quintic - */ - -module.exports = { - - In: __webpack_require__(716), - Out: __webpack_require__(717), - InOut: __webpack_require__(718) - -}; - - -/***/ }), -/* 325 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Sine - */ - -module.exports = { - - In: __webpack_require__(719), - Out: __webpack_require__(720), - InOut: __webpack_require__(721) + Fade: __webpack_require__(729), + Flash: __webpack_require__(730), + Pan: __webpack_require__(731), + Shake: __webpack_require__(764), + RotateTo: __webpack_require__(765), + Zoom: __webpack_require__(766) }; @@ -63511,16 +69242,259 @@ module.exports = { */ /** - * @namespace Phaser.Math.Easing.Stepped + * @namespace Phaser.Math.Easing.Back */ -module.exports = __webpack_require__(722); +module.exports = { + + In: __webpack_require__(732), + Out: __webpack_require__(733), + InOut: __webpack_require__(734) + +}; /***/ }), /* 327 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Bounce + */ + +module.exports = { + + In: __webpack_require__(735), + Out: __webpack_require__(736), + InOut: __webpack_require__(737) + +}; + + +/***/ }), +/* 328 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Circular + */ + +module.exports = { + + In: __webpack_require__(738), + Out: __webpack_require__(739), + InOut: __webpack_require__(740) + +}; + + +/***/ }), +/* 329 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Cubic + */ + +module.exports = { + + In: __webpack_require__(741), + Out: __webpack_require__(742), + InOut: __webpack_require__(743) + +}; + + +/***/ }), +/* 330 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Elastic + */ + +module.exports = { + + In: __webpack_require__(744), + Out: __webpack_require__(745), + InOut: __webpack_require__(746) + +}; + + +/***/ }), +/* 331 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Expo + */ + +module.exports = { + + In: __webpack_require__(747), + Out: __webpack_require__(748), + InOut: __webpack_require__(749) + +}; + + +/***/ }), +/* 332 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +module.exports = __webpack_require__(750); + + +/***/ }), +/* 333 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Quadratic + */ + +module.exports = { + + In: __webpack_require__(751), + Out: __webpack_require__(752), + InOut: __webpack_require__(753) + +}; + + +/***/ }), +/* 334 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Quartic + */ + +module.exports = { + + In: __webpack_require__(754), + Out: __webpack_require__(755), + InOut: __webpack_require__(756) + +}; + + +/***/ }), +/* 335 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Quintic + */ + +module.exports = { + + In: __webpack_require__(757), + Out: __webpack_require__(758), + InOut: __webpack_require__(759) + +}; + + +/***/ }), +/* 336 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Sine + */ + +module.exports = { + + In: __webpack_require__(760), + Out: __webpack_require__(761), + InOut: __webpack_require__(762) + +}; + + +/***/ }), +/* 337 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Stepped + */ + +module.exports = __webpack_require__(763); + + +/***/ }), +/* 338 */ +/***/ (function(module, exports, __webpack_require__) { + /** * @author Richard Davey * @copyright 2020 Photon Storm Ltd. @@ -63528,15 +69502,15 @@ module.exports = __webpack_require__(722); */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(34); -var Device = __webpack_require__(328); +var CONST = __webpack_require__(39); +var Device = __webpack_require__(339); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); var IsPlainObject = __webpack_require__(7); -var PhaserMath = __webpack_require__(180); +var PhaserMath = __webpack_require__(185); var NOOP = __webpack_require__(1); -var DefaultPlugins = __webpack_require__(184); -var ValueToColor = __webpack_require__(174); +var DefaultPlugins = __webpack_require__(189); +var ValueToColor = __webpack_require__(179); /** * @classdesc @@ -63570,25 +69544,20 @@ var Config = new Class({ var defaultBannerTextColor = '#ffffff'; /** - * @const {(integer|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. + * @const {(number|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. */ this.width = GetValue(config, 'width', 1024); /** - * @const {(integer|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. + * @const {(number|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. */ this.height = GetValue(config, 'height', 768); /** - * @const {(Phaser.Scale.ZoomType|integer)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. + * @const {(Phaser.Scale.ZoomType|number)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. */ this.zoom = GetValue(config, 'zoom', 1); - /** - * @const {number} Phaser.Core.Config#resolution - The canvas device pixel resolution. Currently un-used. - */ - this.resolution = GetValue(config, 'resolution', 1); - /** * @const {?*} Phaser.Core.Config#parent - A parent DOM element into which the canvas created by the renderer will be injected. */ @@ -63605,7 +69574,7 @@ var Config = new Class({ this.expandParent = GetValue(config, 'expandParent', true); /** - * @const {integer} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + * @const {number} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. */ this.autoRound = GetValue(config, 'autoRound', false); @@ -63615,7 +69584,7 @@ var Config = new Class({ this.autoCenter = GetValue(config, 'autoCenter', 0); /** - * @const {integer} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? + * @const {number} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? */ this.resizeInterval = GetValue(config, 'resizeInterval', 500); @@ -63625,22 +69594,22 @@ var Config = new Class({ this.fullscreenTarget = GetValue(config, 'fullscreenTarget', null); /** - * @const {integer} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. + * @const {number} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. */ this.minWidth = GetValue(config, 'minWidth', 0); /** - * @const {integer} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. + * @const {number} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. */ this.maxWidth = GetValue(config, 'maxWidth', 0); /** - * @const {integer} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. + * @const {number} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. */ this.minHeight = GetValue(config, 'minHeight', 0); /** - * @const {integer} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. + * @const {number} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. */ this.maxHeight = GetValue(config, 'maxHeight', 0); @@ -63653,7 +69622,6 @@ var Config = new Class({ this.width = GetValue(scaleConfig, 'width', this.width); this.height = GetValue(scaleConfig, 'height', this.height); this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); - this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); this.parent = GetValue(scaleConfig, 'parent', this.parent); this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); this.expandParent = GetValue(scaleConfig, 'expandParent', this.expandParent); @@ -63749,7 +69717,7 @@ var Config = new Class({ this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); /** - * @const {?integer[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. + * @const {?number[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. */ this.inputKeyboardCapture = GetValue(config, 'input.keyboard.capture', []); @@ -63764,9 +69732,24 @@ var Config = new Class({ this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); /** - * @const {boolean} Phaser.Core.Config#inputMouseCapture - Should mouse events be captured? I.e. have prevent default called on them. + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultDown - Should `mousedown` DOM events have `preventDefault` called on them? */ - this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); + this.inputMousePreventDefaultDown = GetValue(config, 'input.mouse.preventDefaultDown', true); + + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultUp - Should `mouseup` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultUp = GetValue(config, 'input.mouse.preventDefaultUp', true); + + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultMove - Should `mousemove` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultMove = GetValue(config, 'input.mouse.preventDefaultMove', true); + + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultWheel - Should `wheel` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultWheel = GetValue(config, 'input.mouse.preventDefaultWheel', true); /** * @const {boolean} Phaser.Core.Config#inputTouch - Enable the Touch Plugin. This can be disabled in games that don't need touch input. @@ -63784,12 +69767,12 @@ var Config = new Class({ this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); /** - * @const {integer} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. + * @const {number} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. */ this.inputActivePointers = GetValue(config, 'input.activePointers', 1); /** - * @const {integer} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + * @const {number} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. */ this.inputSmoothFactor = GetValue(config, 'input.smoothFactor', 0); @@ -63816,7 +69799,7 @@ var Config = new Class({ /** * @const {Phaser.Types.Core.AudioConfig} Phaser.Core.Config#audio - The Audio Configuration object. */ - this.audio = GetValue(config, 'audio'); + this.audio = GetValue(config, 'audio', {}); // If you do: { banner: false } it won't display any banner at all @@ -63846,7 +69829,7 @@ var Config = new Class({ } /** - * @const {?Phaser.Types.Core.FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. + * @const {Phaser.Types.Core.FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. */ this.fps = GetValue(config, 'fps', null); @@ -63855,6 +69838,11 @@ var Config = new Class({ var renderConfig = GetValue(config, 'render', config); + /** + * @const {Phaser.Types.Core.PipelineConfig} Phaser.Core.Config#pipeline - An object mapping WebGL names to WebGLPipeline classes. These should be class constructors, not instances. + */ + this.pipeline = GetValue(renderConfig, 'pipeline', null); + /** * @const {boolean} Phaser.Core.Config#antialias - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. */ @@ -63888,6 +69876,7 @@ var Config = new Class({ if (this.pixelArt) { this.antialias = false; + this.antialiasGL = false; this.roundPixels = true; } @@ -63917,17 +69906,17 @@ var Config = new Class({ this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); /** - * @const {integer} Phaser.Core.Config#batchSize - The default WebGL Batch size. + * @const {number} Phaser.Core.Config#batchSize - The default WebGL Batch size. Represents the number of _quads_ that can be added to a single batch. */ this.batchSize = GetValue(renderConfig, 'batchSize', 4096); /** - * @const {integer} Phaser.Core.Config#maxTextures - When in WebGL mode, this sets the maximum number of GPU Textures to use. The default, -1, will use all available units. The WebGL1 spec says all browsers should provide a minimum of 8. + * @const {number} Phaser.Core.Config#maxTextures - When in WebGL mode, this sets the maximum number of GPU Textures to use. The default, -1, will use all available units. The WebGL1 spec says all browsers should provide a minimum of 8. */ this.maxTextures = GetValue(renderConfig, 'maxTextures', -1); /** - * @const {integer} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + * @const {number} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. */ this.maxLights = GetValue(renderConfig, 'maxLights', 10); @@ -63938,8 +69927,9 @@ var Config = new Class({ */ this.backgroundColor = ValueToColor(bgc); - if (bgc === 0 && this.transparent) + if (this.transparent) { + this.backgroundColor = ValueToColor(0x000000); this.backgroundColor.alpha = 0; } @@ -63974,9 +69964,11 @@ var Config = new Class({ this.loaderPath = GetValue(config, 'loader.path', ''); /** - * @const {integer} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). + * @const {number} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). */ - this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); + var defaultParallel = (Device.os.android) ? 6 : 32; + + this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', defaultParallel); /** * @const {(string|undefined)} Phaser.Core.Config#loaderCrossOrigin - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. @@ -64004,7 +69996,7 @@ var Config = new Class({ this.loaderPassword = GetValue(config, 'loader.password', ''); /** - * @const {integer} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. + * @const {number} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. */ this.loaderTimeout = GetValue(config, 'loader.timeout', 0); @@ -64085,6 +70077,11 @@ var Config = new Class({ */ this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); + /** + * @const {string} Phaser.Core.Config#whiteImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is white or not loaded. + */ + this.whiteImage = GetValue(config, 'images.white', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABdJREFUeNpi/P//PwMMMDEgAdwcgAADAJZuAwXJYZOzAAAAAElFTkSuQmCC'); + if (window) { if (window.FORCE_WEBGL) @@ -64104,7 +70101,7 @@ module.exports = Config; /***/ }), -/* 328 */ +/* 339 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -64138,20 +70135,20 @@ module.exports = Config; module.exports = { - os: __webpack_require__(125), - browser: __webpack_require__(126), - features: __webpack_require__(179), - input: __webpack_require__(756), - audio: __webpack_require__(757), - video: __webpack_require__(758), - fullscreen: __webpack_require__(759), - canvasFeatures: __webpack_require__(329) + os: __webpack_require__(102), + browser: __webpack_require__(131), + features: __webpack_require__(183), + input: __webpack_require__(797), + audio: __webpack_require__(798), + video: __webpack_require__(799), + fullscreen: __webpack_require__(800), + canvasFeatures: __webpack_require__(340) }; /***/ }), -/* 329 */ +/* 340 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -64160,7 +70157,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); +var CanvasPool = __webpack_require__(31); /** * Determines the canvas features of the browser running this Phaser Game instance. @@ -64265,7 +70262,7 @@ module.exports = init(); /***/ }), -/* 330 */ +/* 341 */ /***/ (function(module, exports) { /** @@ -64296,7 +70293,7 @@ module.exports = Between; /***/ }), -/* 331 */ +/* 342 */ /***/ (function(module, exports) { /** @@ -64327,7 +70324,7 @@ module.exports = BetweenPoints; /***/ }), -/* 332 */ +/* 343 */ /***/ (function(module, exports) { /** @@ -64364,7 +70361,7 @@ module.exports = Normalize; /***/ }), -/* 333 */ +/* 344 */ /***/ (function(module, exports) { /** @@ -64396,7 +70393,7 @@ module.exports = DistanceBetweenPoints; /***/ }), -/* 334 */ +/* 345 */ /***/ (function(module, exports) { /** @@ -64430,7 +70427,7 @@ module.exports = DistanceSquared; /***/ }), -/* 335 */ +/* 346 */ /***/ (function(module, exports) { /** @@ -64464,7 +70461,7 @@ module.exports = GreaterThan; /***/ }), -/* 336 */ +/* 347 */ /***/ (function(module, exports) { /** @@ -64498,7 +70495,7 @@ module.exports = LessThan; /***/ }), -/* 337 */ +/* 348 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -64507,7 +70504,7 @@ module.exports = LessThan; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Factorial = __webpack_require__(338); +var Factorial = __webpack_require__(349); /** * Calculates the Bernstein basis from the three factorial coefficients. @@ -64529,7 +70526,7 @@ module.exports = Bernstein; /***/ }), -/* 338 */ +/* 349 */ /***/ (function(module, exports) { /** @@ -64569,7 +70566,7 @@ module.exports = Factorial; /***/ }), -/* 339 */ +/* 350 */ /***/ (function(module, exports) { /** @@ -64639,7 +70636,7 @@ module.exports = CubicBezierInterpolation; /***/ }), -/* 340 */ +/* 351 */ /***/ (function(module, exports) { /** @@ -64698,7 +70695,7 @@ module.exports = QuadraticBezierInterpolation; /***/ }), -/* 341 */ +/* 352 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -64707,7 +70704,7 @@ module.exports = QuadraticBezierInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SmoothStep = __webpack_require__(171); +var SmoothStep = __webpack_require__(176); /** * A Smooth Step interpolation method. @@ -64731,7 +70728,7 @@ module.exports = SmoothStepInterpolation; /***/ }), -/* 342 */ +/* 353 */ /***/ (function(module, exports) { /** @@ -64748,7 +70745,7 @@ module.exports = SmoothStepInterpolation; * * @param {number} value - The value. * - * @return {integer} The nearest power of 2 to `value`. + * @return {number} The nearest power of 2 to `value`. */ var GetPowerOfTwo = function (value) { @@ -64761,51 +70758,7 @@ module.exports = GetPowerOfTwo; /***/ }), -/* 343 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using ceil. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. - * As will `14` snap to `15`... but `16` will snap to `20`. - * - * @function Phaser.Math.Snap.Ceil - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapCeil = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.ceil(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapCeil; - - -/***/ }), -/* 344 */ +/* 354 */ /***/ (function(module, exports) { /** @@ -64840,7 +70793,7 @@ module.exports = Rotate; /***/ }), -/* 345 */ +/* 355 */ /***/ (function(module, exports) { /** @@ -64869,7 +70822,7 @@ module.exports = RoundAwayFromZero; /***/ }), -/* 346 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -65462,7 +71415,7 @@ module.exports = Matrix3; /***/ }), -/* 347 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -65475,1470 +71428,9 @@ module.exports = Matrix3; // and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl var Class = __webpack_require__(0); - -var EPSILON = 0.000001; - -/** - * @classdesc - * A four-dimensional matrix. - * - * @class Matrix4 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. - */ -var Matrix4 = new Class({ - - initialize: - - function Matrix4 (m) - { - /** - * The matrix values. - * - * @name Phaser.Math.Matrix4#val - * @type {Float32Array} - * @since 3.0.0 - */ - this.val = new Float32Array(16); - - if (m) - { - // Assume Matrix4 with val: - this.copy(m); - } - else - { - // Default to identity - this.identity(); - } - }, - - /** - * Make a clone of this Matrix4. - * - * @method Phaser.Math.Matrix4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} A clone of this Matrix4. - */ - clone: function () - { - return new Matrix4(this); - }, - - // TODO - Should work with basic values - - /** - * This method is an alias for `Matrix4.copy`. - * - * @method Phaser.Math.Matrix4#set - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - set: function (src) - { - return this.copy(src); - }, - - /** - * Copy the values of a given Matrix into this Matrix. - * - * @method Phaser.Math.Matrix4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - copy: function (src) - { - var out = this.val; - var a = src.val; - - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - - return this; - }, - - /** - * Set the values of this Matrix from the given array. - * - * @method Phaser.Math.Matrix4#fromArray - * @since 3.0.0 - * - * @param {array} a - The array to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromArray: function (a) - { - var out = this.val; - - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - - return this; - }, - - /** - * Reset this Matrix. - * - * Sets all values to `0`. - * - * @method Phaser.Math.Matrix4#zero - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - zero: function () - { - var out = this.val; - - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 0; - - return this; - }, - - /** - * Set the `x`, `y` and `z` values of this Matrix. - * - * @method Phaser.Math.Matrix4#xyz - * @since 3.0.0 - * - * @param {number} x - The x value. - * @param {number} y - The y value. - * @param {number} z - The z value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - xyz: function (x, y, z) - { - this.identity(); - - var out = this.val; - - out[12] = x; - out[13] = y; - out[14] = z; - - return this; - }, - - /** - * Set the scaling values of this Matrix. - * - * @method Phaser.Math.Matrix4#scaling - * @since 3.0.0 - * - * @param {number} x - The x scaling value. - * @param {number} y - The y scaling value. - * @param {number} z - The z scaling value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scaling: function (x, y, z) - { - this.zero(); - - var out = this.val; - - out[0] = x; - out[5] = y; - out[10] = z; - out[15] = 1; - - return this; - }, - - /** - * Reset this Matrix to an identity (default) matrix. - * - * @method Phaser.Math.Matrix4#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - identity: function () - { - var out = this.val; - - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - - return this; - }, - - /** - * Transpose this Matrix. - * - * @method Phaser.Math.Matrix4#transpose - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - transpose: function () - { - var a = this.val; - - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a12 = a[6]; - var a13 = a[7]; - var a23 = a[11]; - - a[1] = a[4]; - a[2] = a[8]; - a[3] = a[12]; - a[4] = a01; - a[6] = a[9]; - a[7] = a[13]; - a[8] = a02; - a[9] = a12; - a[11] = a[14]; - a[12] = a03; - a[13] = a13; - a[14] = a23; - - return this; - }, - - /** - * Invert this Matrix. - * - * @method Phaser.Math.Matrix4#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - invert: function () - { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; - - // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - - if (!det) - { - return null; - } - - det = 1 / det; - - a[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - a[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - a[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - a[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; - a[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - a[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - a[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - a[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; - a[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - a[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - a[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - a[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; - a[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; - a[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; - a[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; - a[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; - - return this; - }, - - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix4#adjoint - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - adjoint: function () - { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - a[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); - a[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - a[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); - a[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - a[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - a[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); - a[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - a[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); - a[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); - a[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - a[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); - a[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - a[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - a[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); - a[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - a[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); - - return this; - }, - - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix4#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: function () - { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; - - // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - }, - - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix4#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiply: function (src) - { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b = src.val; - - // Cache only the current line of the second matrix - var b0 = b[0]; - var b1 = b[1]; - var b2 = b[2]; - var b3 = b[3]; - - a[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; - - a[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; - - a[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; - - a[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - return this; - }, - - /** - * Multiply the values of this Matrix4 by those given in the `src` argument. - * - * @method Phaser.Math.Matrix4#multiplyLocal - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The source Matrix4 that this Matrix4 is multiplied by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiplyLocal: function (src) - { - var a = []; - var m1 = this.val; - var m2 = src.val; - - a[0] = m1[0] * m2[0] + m1[1] * m2[4] + m1[2] * m2[8] + m1[3] * m2[12]; - a[1] = m1[0] * m2[1] + m1[1] * m2[5] + m1[2] * m2[9] + m1[3] * m2[13]; - a[2] = m1[0] * m2[2] + m1[1] * m2[6] + m1[2] * m2[10] + m1[3] * m2[14]; - a[3] = m1[0] * m2[3] + m1[1] * m2[7] + m1[2] * m2[11] + m1[3] * m2[15]; - - a[4] = m1[4] * m2[0] + m1[5] * m2[4] + m1[6] * m2[8] + m1[7] * m2[12]; - a[5] = m1[4] * m2[1] + m1[5] * m2[5] + m1[6] * m2[9] + m1[7] * m2[13]; - a[6] = m1[4] * m2[2] + m1[5] * m2[6] + m1[6] * m2[10] + m1[7] * m2[14]; - a[7] = m1[4] * m2[3] + m1[5] * m2[7] + m1[6] * m2[11] + m1[7] * m2[15]; - - a[8] = m1[8] * m2[0] + m1[9] * m2[4] + m1[10] * m2[8] + m1[11] * m2[12]; - a[9] = m1[8] * m2[1] + m1[9] * m2[5] + m1[10] * m2[9] + m1[11] * m2[13]; - a[10] = m1[8] * m2[2] + m1[9] * m2[6] + m1[10] * m2[10] + m1[11] * m2[14]; - a[11] = m1[8] * m2[3] + m1[9] * m2[7] + m1[10] * m2[11] + m1[11] * m2[15]; - - a[12] = m1[12] * m2[0] + m1[13] * m2[4] + m1[14] * m2[8] + m1[15] * m2[12]; - a[13] = m1[12] * m2[1] + m1[13] * m2[5] + m1[14] * m2[9] + m1[15] * m2[13]; - a[14] = m1[12] * m2[2] + m1[13] * m2[6] + m1[14] * m2[10] + m1[15] * m2[14]; - a[15] = m1[12] * m2[3] + m1[13] * m2[7] + m1[14] * m2[11] + m1[15] * m2[15]; - - return this.fromArray(a); - }, - - /** - * Translate this Matrix using the given Vector. - * - * @method Phaser.Math.Matrix4#translate - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - translate: function (v) - { - var x = v.x; - var y = v.y; - var z = v.z; - var a = this.val; - - a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - - return this; - }, - - /** - * Translate this Matrix using the given values. - * - * @method Phaser.Math.Matrix4#translateXYZ - * @since 3.16.0 - * - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - translateXYZ: function (x, y, z) - { - var a = this.val; - - a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - - return this; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. - * - * @method Phaser.Math.Matrix4#scale - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scale: function (v) - { - var x = v.x; - var y = v.y; - var z = v.z; - var a = this.val; - - a[0] = a[0] * x; - a[1] = a[1] * x; - a[2] = a[2] * x; - a[3] = a[3] * x; - - a[4] = a[4] * y; - a[5] = a[5] * y; - a[6] = a[6] * y; - a[7] = a[7] * y; - - a[8] = a[8] * z; - a[9] = a[9] * z; - a[10] = a[10] * z; - a[11] = a[11] * z; - - return this; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * @method Phaser.Math.Matrix4#scaleXYZ - * @since 3.16.0 - * - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scaleXYZ: function (x, y, z) - { - var a = this.val; - - a[0] = a[0] * x; - a[1] = a[1] * x; - a[2] = a[2] * x; - a[3] = a[3] * x; - - a[4] = a[4] * y; - a[5] = a[5] * y; - a[6] = a[6] * y; - a[7] = a[7] * y; - - a[8] = a[8] * z; - a[9] = a[9] * z; - a[10] = a[10] * z; - a[11] = a[11] * z; - - return this; - }, - - /** - * Derive a rotation matrix around the given axis. - * - * @method Phaser.Math.Matrix4#makeRotationAxis - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. - * @param {number} angle - The rotation angle in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - makeRotationAxis: function (axis, angle) - { - // Based on http://www.gamedev.net/reference/articles/article1199.asp - - var c = Math.cos(angle); - var s = Math.sin(angle); - var t = 1 - c; - var x = axis.x; - var y = axis.y; - var z = axis.z; - var tx = t * x; - var ty = t * y; - - this.fromArray([ - tx * x + c, tx * y - s * z, tx * z + s * y, 0, - tx * y + s * z, ty * y + c, ty * z - s * x, 0, - tx * z - s * y, ty * z + s * x, t * z * z + c, 0, - 0, 0, 0, 1 - ]); - - return this; - }, - - /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix4#rotate - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotate: function (rad, axis) - { - var a = this.val; - var x = axis.x; - var y = axis.y; - var z = axis.z; - var len = Math.sqrt(x * x + y * y + z * z); - - if (Math.abs(len) < EPSILON) - { - return null; - } - - len = 1 / len; - x *= len; - y *= len; - z *= len; - - var s = Math.sin(rad); - var c = Math.cos(rad); - var t = 1 - c; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - // Construct the elements of the rotation matrix - var b00 = x * x * t + c; - var b01 = y * x * t + z * s; - var b02 = z * x * t - y * s; - - var b10 = x * y * t - z * s; - var b11 = y * y * t + c; - var b12 = z * y * t + x * s; - - var b20 = x * z * t + y * s; - var b21 = y * z * t - x * s; - var b22 = z * z * t + c; - - // Perform rotation-specific matrix multiplication - a[0] = a00 * b00 + a10 * b01 + a20 * b02; - a[1] = a01 * b00 + a11 * b01 + a21 * b02; - a[2] = a02 * b00 + a12 * b01 + a22 * b02; - a[3] = a03 * b00 + a13 * b01 + a23 * b02; - a[4] = a00 * b10 + a10 * b11 + a20 * b12; - a[5] = a01 * b10 + a11 * b11 + a21 * b12; - a[6] = a02 * b10 + a12 * b11 + a22 * b12; - a[7] = a03 * b10 + a13 * b11 + a23 * b12; - a[8] = a00 * b20 + a10 * b21 + a20 * b22; - a[9] = a01 * b20 + a11 * b21 + a21 * b22; - a[10] = a02 * b20 + a12 * b21 + a22 * b22; - a[11] = a03 * b20 + a13 * b21 + a23 * b22; - - return this; - }, - - /** - * Rotate this matrix on its X axis. - * - * @method Phaser.Math.Matrix4#rotateX - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateX: function (rad) - { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - // Perform axis-specific matrix multiplication - a[4] = a10 * c + a20 * s; - a[5] = a11 * c + a21 * s; - a[6] = a12 * c + a22 * s; - a[7] = a13 * c + a23 * s; - a[8] = a20 * c - a10 * s; - a[9] = a21 * c - a11 * s; - a[10] = a22 * c - a12 * s; - a[11] = a23 * c - a13 * s; - - return this; - }, - - /** - * Rotate this matrix on its Y axis. - * - * @method Phaser.Math.Matrix4#rotateY - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateY: function (rad) - { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - // Perform axis-specific matrix multiplication - a[0] = a00 * c - a20 * s; - a[1] = a01 * c - a21 * s; - a[2] = a02 * c - a22 * s; - a[3] = a03 * c - a23 * s; - a[8] = a00 * s + a20 * c; - a[9] = a01 * s + a21 * c; - a[10] = a02 * s + a22 * c; - a[11] = a03 * s + a23 * c; - - return this; - }, - - /** - * Rotate this matrix on its Z axis. - * - * @method Phaser.Math.Matrix4#rotateZ - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateZ: function (rad) - { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - // Perform axis-specific matrix multiplication - a[0] = a00 * c + a10 * s; - a[1] = a01 * c + a11 * s; - a[2] = a02 * c + a12 * s; - a[3] = a03 * c + a13 * s; - a[4] = a10 * c - a00 * s; - a[5] = a11 * c - a01 * s; - a[6] = a12 * c - a02 * s; - a[7] = a13 * c - a03 * s; - - return this; - }, - - /** - * Set the values of this Matrix from the given rotation Quaternion and translation Vector. - * - * @method Phaser.Math.Matrix4#fromRotationTranslation - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. - * @param {Phaser.Math.Vector3} v - The Vector to set translation from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromRotationTranslation: function (q, v) - { - // Quaternion math - var out = this.val; - - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - - out[12] = v.x; - out[13] = v.y; - out[14] = v.z; - out[15] = 1; - - return this; - }, - - /** - * Set the values of this Matrix from the given Quaternion. - * - * @method Phaser.Math.Matrix4#fromQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromQuat: function (q) - { - var out = this.val; - - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - - return this; - }, - - /** - * Generate a frustum matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#frustum - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - frustum: function (left, right, bottom, top, near, far) - { - var out = this.val; - - var rl = 1 / (right - left); - var tb = 1 / (top - bottom); - var nf = 1 / (near - far); - - out[0] = (near * 2) * rl; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = (near * 2) * tb; - out[6] = 0; - out[7] = 0; - - out[8] = (right + left) * rl; - out[9] = (top + bottom) * tb; - out[10] = (far + near) * nf; - out[11] = -1; - - out[12] = 0; - out[13] = 0; - out[14] = (far * near * 2) * nf; - out[15] = 0; - - return this; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspective - * @since 3.0.0 - * - * @param {number} fovy - Vertical field of view in radians - * @param {number} aspect - Aspect ratio. Typically viewport width /height. - * @param {number} near - Near bound of the frustum. - * @param {number} far - Far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspective: function (fovy, aspect, near, far) - { - var out = this.val; - var f = 1.0 / Math.tan(fovy / 2); - var nf = 1 / (near - far); - - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - - out[8] = 0; - out[9] = 0; - out[10] = (far + near) * nf; - out[11] = -1; - - out[12] = 0; - out[13] = 0; - out[14] = (2 * far * near) * nf; - out[15] = 0; - - return this; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspectiveLH - * @since 3.0.0 - * - * @param {number} width - The width of the frustum. - * @param {number} height - The height of the frustum. - * @param {number} near - Near bound of the frustum. - * @param {number} far - Far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspectiveLH: function (width, height, near, far) - { - var out = this.val; - - out[0] = (2 * near) / width; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = (2 * near) / height; - out[6] = 0; - out[7] = 0; - - out[8] = 0; - out[9] = 0; - out[10] = -far / (near - far); - out[11] = 1; - - out[12] = 0; - out[13] = 0; - out[14] = (near * far) / (near - far); - out[15] = 0; - - return this; - }, - - /** - * Generate an orthogonal projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#ortho - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - ortho: function (left, right, bottom, top, near, far) - { - var out = this.val; - var lr = left - right; - var bt = bottom - top; - var nf = near - far; - - // Avoid division by zero - lr = (lr === 0) ? lr : 1 / lr; - bt = (bt === 0) ? bt : 1 / bt; - nf = (nf === 0) ? nf : 1 / nf; - - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - - out[8] = 0; - out[9] = 0; - out[10] = 2 * nf; - out[11] = 0; - - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = (far + near) * nf; - out[15] = 1; - - return this; - }, - - /** - * Generate a look-at matrix with the given eye position, focal point, and up axis. - * - * @method Phaser.Math.Matrix4#lookAt - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} eye - Position of the viewer - * @param {Phaser.Math.Vector3} center - Point the viewer is looking at - * @param {Phaser.Math.Vector3} up - vec3 pointing up. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - lookAt: function (eye, center, up) - { - var out = this.val; - - var eyex = eye.x; - var eyey = eye.y; - var eyez = eye.z; - - var upx = up.x; - var upy = up.y; - var upz = up.z; - - var centerx = center.x; - var centery = center.y; - var centerz = center.z; - - if (Math.abs(eyex - centerx) < EPSILON && - Math.abs(eyey - centery) < EPSILON && - Math.abs(eyez - centerz) < EPSILON) - { - return this.identity(); - } - - var z0 = eyex - centerx; - var z1 = eyey - centery; - var z2 = eyez - centerz; - - var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); - - z0 *= len; - z1 *= len; - z2 *= len; - - var x0 = upy * z2 - upz * z1; - var x1 = upz * z0 - upx * z2; - var x2 = upx * z1 - upy * z0; - - len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); - - if (!len) - { - x0 = 0; - x1 = 0; - x2 = 0; - } - else - { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - - var y0 = z1 * x2 - z2 * x1; - var y1 = z2 * x0 - z0 * x2; - var y2 = z0 * x1 - z1 * x0; - - len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); - - if (!len) - { - y0 = 0; - y1 = 0; - y2 = 0; - } - else - { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - - out[0] = x0; - out[1] = y0; - out[2] = z0; - out[3] = 0; - - out[4] = x1; - out[5] = y1; - out[6] = z1; - out[7] = 0; - - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; - - return this; - }, - - /** - * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. - * - * @method Phaser.Math.Matrix4#yawPitchRoll - * @since 3.0.0 - * - * @param {number} yaw - The yaw value. - * @param {number} pitch - The pitch value. - * @param {number} roll - The roll value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - yawPitchRoll: function (yaw, pitch, roll) - { - this.zero(); - _tempMat1.zero(); - _tempMat2.zero(); - - var m0 = this.val; - var m1 = _tempMat1.val; - var m2 = _tempMat2.val; - - // Rotate Z - var s = Math.sin(roll); - var c = Math.cos(roll); - - m0[10] = 1; - m0[15] = 1; - m0[0] = c; - m0[1] = s; - m0[4] = -s; - m0[5] = c; - - // Rotate X - s = Math.sin(pitch); - c = Math.cos(pitch); - - m1[0] = 1; - m1[15] = 1; - m1[5] = c; - m1[10] = c; - m1[9] = -s; - m1[6] = s; - - // Rotate Y - s = Math.sin(yaw); - c = Math.cos(yaw); - - m2[5] = 1; - m2[15] = 1; - m2[0] = c; - m2[2] = -s; - m2[8] = s; - m2[10] = c; - - this.multiplyLocal(_tempMat1); - this.multiplyLocal(_tempMat2); - - return this; - }, - - /** - * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. - * - * @method Phaser.Math.Matrix4#setWorldMatrix - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. - * @param {Phaser.Math.Vector3} position - The position of the world matrix. - * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. - * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. - * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) - { - this.yawPitchRoll(rotation.y, rotation.x, rotation.z); - - _tempMat1.scaling(scale.x, scale.y, scale.z); - _tempMat2.xyz(position.x, position.y, position.z); - - this.multiplyLocal(_tempMat1); - this.multiplyLocal(_tempMat2); - - if (viewMatrix !== undefined) - { - this.multiplyLocal(viewMatrix); - } - - if (projectionMatrix !== undefined) - { - this.multiplyLocal(projectionMatrix); - } - - return this; - } - -}); - -var _tempMat1 = new Matrix4(); -var _tempMat2 = new Matrix4(); - -module.exports = Matrix4; - - -/***/ }), -/* 348 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - -var Class = __webpack_require__(0); -var Vector3 = __webpack_require__(81); -var Matrix3 = __webpack_require__(346); +var Matrix3 = __webpack_require__(356); +var NOOP = __webpack_require__(1); +var Vector3 = __webpack_require__(37); var EPSILON = 0.000001; @@ -66961,10 +71453,10 @@ var tmpMat3 = new Matrix3(); * @constructor * @since 3.0.0 * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - * @param {number} [w] - The w component. + * @param {number} [x=0] - The x component. + * @param {number} [y=0] - The y component. + * @param {number} [z=0] - The z component. + * @param {number} [w=1] - The w component. */ var Quaternion = new Class({ @@ -66975,52 +71467,141 @@ var Quaternion = new Class({ /** * The x component of this Quaternion. * - * @name Phaser.Math.Quaternion#x + * @name Phaser.Math.Quaternion#_x * @type {number} * @default 0 - * @since 3.0.0 + * @private + * @since 3.50.0 */ /** * The y component of this Quaternion. * - * @name Phaser.Math.Quaternion#y + * @name Phaser.Math.Quaternion#_y * @type {number} * @default 0 - * @since 3.0.0 + * @private + * @since 3.50.0 */ /** * The z component of this Quaternion. * - * @name Phaser.Math.Quaternion#z + * @name Phaser.Math.Quaternion#_z * @type {number} * @default 0 - * @since 3.0.0 + * @private + * @since 3.50.0 */ /** * The w component of this Quaternion. * - * @name Phaser.Math.Quaternion#w + * @name Phaser.Math.Quaternion#_w * @type {number} * @default 0 - * @since 3.0.0 + * @private + * @since 3.50.0 */ - if (typeof x === 'object') + /** + * This callback is invoked, if set, each time a value in this quaternion is changed. + * The callback is passed one argument, a reference to this quaternion. + * + * @name Phaser.Math.Quaternion#onChangeCallback + * @type {function} + * @since 3.50.0 + */ + this.onChangeCallback = NOOP; + + this.set(x, y, z, w); + }, + + /** + * The x component of this Quaternion. + * + * @name Phaser.Math.Quaternion#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + x: { + get: function () { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; + return this._x; + }, + + set: function (value) + { + this._x = value; + + this.onChangeCallback(this); } - else + }, + + /** + * The y component of this Quaternion. + * + * @name Phaser.Math.Quaternion#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + y: { + get: function () { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; + return this._y; + }, + + set: function (value) + { + this._y = value; + + this.onChangeCallback(this); + } + }, + + /** + * The z component of this Quaternion. + * + * @name Phaser.Math.Quaternion#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + z: { + get: function () + { + return this._z; + }, + + set: function (value) + { + this._z = value; + + this.onChangeCallback(this); + } + }, + + /** + * The w component of this Quaternion. + * + * @name Phaser.Math.Quaternion#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + w: { + get: function () + { + return this._w; + }, + + set: function (value) + { + this._w = value; + + this.onChangeCallback(this); } }, @@ -67036,16 +71617,11 @@ var Quaternion = new Class({ */ copy: function (src) { - this.x = src.x; - this.y = src.y; - this.z = src.z; - this.w = src.w; - - return this; + return this.set(src); }, /** - * Set the components of this Quaternion. + * Set the components of this Quaternion and optionally call the `onChangeCallback`. * * @method Phaser.Math.Quaternion#set * @since 3.0.0 @@ -67054,24 +71630,32 @@ var Quaternion = new Class({ * @param {number} [y=0] - The y component. * @param {number} [z=0] - The z component. * @param {number} [w=0] - The w component. + * @param {boolean} [update=true] - Call the `onChangeCallback`? * * @return {Phaser.Math.Quaternion} This Quaternion. */ - set: function (x, y, z, w) + set: function (x, y, z, w, update) { + if (update === undefined) { update = true; } + if (typeof x === 'object') { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; + this._x = x.x || 0; + this._y = x.y || 0; + this._z = x.z || 0; + this._w = x.w || 0; } else { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; + this._x = x || 0; + this._y = y || 0; + this._z = z || 0; + this._w = w || 0; + } + + if (update) + { + this.onChangeCallback(this); } return this; @@ -67089,10 +71673,12 @@ var Quaternion = new Class({ */ add: function (v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; + this._x += v.x; + this._y += v.y; + this._z += v.z; + this._w += v.w; + + this.onChangeCallback(this); return this; }, @@ -67109,10 +71695,12 @@ var Quaternion = new Class({ */ subtract: function (v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; + this._x -= v.x; + this._y -= v.y; + this._z -= v.z; + this._w -= v.w; + + this.onChangeCallback(this); return this; }, @@ -67129,10 +71717,12 @@ var Quaternion = new Class({ */ scale: function (scale) { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; + this._x *= scale; + this._y *= scale; + this._z *= scale; + this._w *= scale; + + this.onChangeCallback(this); return this; }, @@ -67193,12 +71783,14 @@ var Quaternion = new Class({ { len = 1 / Math.sqrt(len); - this.x = x * len; - this.y = y * len; - this.z = z * len; - this.w = w * len; + this._x = x * len; + this._y = y * len; + this._z = z * len; + this._w = w * len; } + this.onChangeCallback(this); + return this; }, @@ -67237,12 +71829,12 @@ var Quaternion = new Class({ var az = this.z; var aw = this.w; - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - this.w = aw + t * (v.w - aw); - - return this; + return this.set( + ax + t * (v.x - ax), + ay + t * (v.y - ay), + az + t * (v.z - az), + aw + t * (v.w - aw) + ); }, /** @@ -67274,21 +71866,16 @@ var Quaternion = new Class({ } else if (dot > 0.999999) { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - return this; + return this.set(0, 0, 0, 1); } else { tmpvec.copy(a).cross(b); - this.x = tmpvec.x; - this.y = tmpvec.y; - this.z = tmpvec.z; - this.w = 1 + dot; + this._x = tmpvec.x; + this._y = tmpvec.y; + this._z = tmpvec.z; + this._w = 1 + dot; return this.normalize(); } @@ -67335,12 +71922,7 @@ var Quaternion = new Class({ */ identity: function () { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - return this; + return this.set(0, 0, 0, 1); }, /** @@ -67360,12 +71942,12 @@ var Quaternion = new Class({ var s = Math.sin(rad); - this.x = s * axis.x; - this.y = s * axis.y; - this.z = s * axis.z; - this.w = Math.cos(rad); - - return this; + return this.set( + s * axis.x, + s * axis.y, + s * axis.z, + Math.cos(rad) + ); }, /** @@ -67390,12 +71972,12 @@ var Quaternion = new Class({ var bz = b.z; var bw = b.w; - this.x = ax * bw + aw * bx + ay * bz - az * by; - this.y = ay * bw + aw * by + az * bx - ax * bz; - this.z = az * bw + aw * bz + ax * by - ay * bx; - this.w = aw * bw - ax * bx - ay * by - az * bz; - - return this; + return this.set( + ax * bw + aw * bx + ay * bz - az * by, + ay * bw + aw * by + az * bx - ax * bz, + az * bw + aw * bz + ax * by - ay * bx, + aw * bw - ax * bx - ay * by - az * bz + ); }, /** @@ -67453,12 +72035,12 @@ var Quaternion = new Class({ } // calculate final values - this.x = scale0 * ax + scale1 * bx; - this.y = scale0 * ay + scale1 * by; - this.z = scale0 * az + scale1 * bz; - this.w = scale0 * aw + scale1 * bw; - - return this; + return this.set( + scale0 * ax + scale1 * bx, + scale0 * ay + scale1 * by, + scale0 * az + scale1 * bz, + scale0 * aw + scale1 * bw + ); }, /** @@ -67479,14 +72061,12 @@ var Quaternion = new Class({ var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; var invDot = (dot) ? 1 / dot : 0; - // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 - - this.x = -a0 * invDot; - this.y = -a1 * invDot; - this.z = -a2 * invDot; - this.w = a3 * invDot; - - return this; + return this.set( + -a0 * invDot, + -a1 * invDot, + -a2 * invDot, + a3 * invDot + ); }, /** @@ -67501,9 +72081,11 @@ var Quaternion = new Class({ */ conjugate: function () { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; + this._x = -this.x; + this._y = -this.y; + this._z = -this.z; + + this.onChangeCallback(this); return this; }, @@ -67530,12 +72112,12 @@ var Quaternion = new Class({ var bx = Math.sin(rad); var bw = Math.cos(rad); - this.x = ax * bw + aw * bx; - this.y = ay * bw + az * bx; - this.z = az * bw - ay * bx; - this.w = aw * bw - ax * bx; - - return this; + return this.set( + ax * bw + aw * bx, + ay * bw + az * bx, + az * bw - ay * bx, + aw * bw - ax * bx + ); }, /** @@ -67560,12 +72142,12 @@ var Quaternion = new Class({ var by = Math.sin(rad); var bw = Math.cos(rad); - this.x = ax * bw - az * by; - this.y = ay * bw + aw * by; - this.z = az * bw + ax * by; - this.w = aw * bw - ay * by; - - return this; + return this.set( + ax * bw - az * by, + ay * bw + aw * by, + az * bw + ax * by, + aw * bw - ay * by + ); }, /** @@ -67590,12 +72172,12 @@ var Quaternion = new Class({ var bz = Math.sin(rad); var bw = Math.cos(rad); - this.x = ax * bw + ay * bz; - this.y = ay * bw - ax * bz; - this.z = az * bw + aw * bz; - this.w = aw * bw - az * bz; - - return this; + return this.set( + ax * bw + ay * bz, + ay * bw - ax * bz, + az * bw + aw * bz, + aw * bw - az * bz + ); }, /** @@ -67619,6 +72201,190 @@ var Quaternion = new Class({ return this; }, + /** + * Set this Quaternion from the given Euler, based on Euler order. + * + * @method Phaser.Math.Quaternion#setFromEuler + * @since 3.50.0 + * + * @param {Phaser.Math.Euler} euler - The Euler to convert from. + * @param {boolean} [update=true] - Run the `onChangeCallback`? + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setFromEuler: function (euler, update) + { + var x = euler.x / 2; + var y = euler.y / 2; + var z = euler.z / 2; + + var c1 = Math.cos(x); + var c2 = Math.cos(y); + var c3 = Math.cos(z); + + var s1 = Math.sin(x); + var s2 = Math.sin(y); + var s3 = Math.sin(z); + + switch (euler.order) + { + case 'XYZ': + { + this.set( + s1 * c2 * c3 + c1 * s2 * s3, + c1 * s2 * c3 - s1 * c2 * s3, + c1 * c2 * s3 + s1 * s2 * c3, + c1 * c2 * c3 - s1 * s2 * s3, + update + ); + + break; + } + + case 'YXZ': + { + this.set( + s1 * c2 * c3 + c1 * s2 * s3, + c1 * s2 * c3 - s1 * c2 * s3, + c1 * c2 * s3 - s1 * s2 * c3, + c1 * c2 * c3 + s1 * s2 * s3, + update + ); + + break; + } + + case 'ZXY': + { + this.set( + s1 * c2 * c3 - c1 * s2 * s3, + c1 * s2 * c3 + s1 * c2 * s3, + c1 * c2 * s3 + s1 * s2 * c3, + c1 * c2 * c3 - s1 * s2 * s3, + update + ); + + break; + } + + case 'ZYX': + { + this.set( + s1 * c2 * c3 - c1 * s2 * s3, + c1 * s2 * c3 + s1 * c2 * s3, + c1 * c2 * s3 - s1 * s2 * c3, + c1 * c2 * c3 + s1 * s2 * s3, + update + ); + + break; + } + + case 'YZX': + { + this.set( + s1 * c2 * c3 + c1 * s2 * s3, + c1 * s2 * c3 + s1 * c2 * s3, + c1 * c2 * s3 - s1 * s2 * c3, + c1 * c2 * c3 - s1 * s2 * s3, + update + ); + + break; + } + + case 'XZY': + { + this.set( + s1 * c2 * c3 - c1 * s2 * s3, + c1 * s2 * c3 - s1 * c2 * s3, + c1 * c2 * s3 + s1 * s2 * c3, + c1 * c2 * c3 + s1 * s2 * s3, + update + ); + + break; + } + } + + return this; + }, + + /** + * Sets the rotation of this Quaternion from the given Matrix4. + * + * @method Phaser.Math.Quaternion#setFromRotationMatrix + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to set the rotation from. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setFromRotationMatrix: function (mat4) + { + var m = mat4.val; + + var m11 = m[0]; + var m12 = m[4]; + var m13 = m[8]; + var m21 = m[1]; + var m22 = m[5]; + var m23 = m[9]; + var m31 = m[2]; + var m32 = m[6]; + var m33 = m[10]; + + var trace = m11 + m22 + m33; + var s; + + if (trace > 0) + { + s = 0.5 / Math.sqrt(trace + 1.0); + + this.set( + (m32 - m23) * s, + (m13 - m31) * s, + (m21 - m12) * s, + 0.25 / s + ); + } + else if (m11 > m22 && m11 > m33) + { + s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33); + + this.set( + 0.25 * s, + (m12 + m21) / s, + (m13 + m31) / s, + (m32 - m23) / s + ); + } + else if (m22 > m33) + { + s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33); + + this.set( + (m12 + m21) / s, + 0.25 * s, + (m23 + m32) / s, + (m13 - m31) / s + ); + } + else + { + s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22); + + this.set( + (m13 + m31) / s, + (m23 + m32) / s, + 0.25 * s, + (m21 - m12) / s + ); + } + + return this; + }, + /** * Convert the given Matrix into this Quaternion. * @@ -67650,9 +72416,9 @@ var Quaternion = new Class({ fRoot = 0.5 / fRoot; // 1/(4w) - this.x = (m[7] - m[5]) * fRoot; - this.y = (m[2] - m[6]) * fRoot; - this.z = (m[3] - m[1]) * fRoot; + this._x = (m[7] - m[5]) * fRoot; + this._y = (m[2] - m[6]) * fRoot; + this._z = (m[3] - m[1]) * fRoot; } else { @@ -67681,12 +72447,14 @@ var Quaternion = new Class({ tmp[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; tmp[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; - this.x = tmp[0]; - this.y = tmp[1]; - this.z = tmp[2]; - this.w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; + this._x = tmp[0]; + this._y = tmp[1]; + this._z = tmp[2]; + this._w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; } + this.onChangeCallback(this); + return this; } @@ -67696,7 +72464,7 @@ module.exports = Quaternion; /***/ }), -/* 349 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67705,10 +72473,10 @@ module.exports = Quaternion; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasInterpolation = __webpack_require__(350); -var CanvasPool = __webpack_require__(26); -var CONST = __webpack_require__(34); -var Features = __webpack_require__(179); +var CanvasInterpolation = __webpack_require__(359); +var CanvasPool = __webpack_require__(31); +var CONST = __webpack_require__(39); +var Features = __webpack_require__(183); /** * Called automatically by Phaser.Game and responsible for creating the renderer it will use. @@ -67798,8 +72566,8 @@ var CreateRenderer = function (game) if (true) { - CanvasRenderer = __webpack_require__(532); - WebGLRenderer = __webpack_require__(535); + CanvasRenderer = __webpack_require__(568); + WebGLRenderer = __webpack_require__(571); // Let the config pick the renderer type, as both are included if (config.renderType === CONST.WEBGL) @@ -67824,7 +72592,7 @@ module.exports = CreateRenderer; /***/ }), -/* 350 */ +/* 359 */ /***/ (function(module, exports) { /** @@ -67887,7 +72655,7 @@ module.exports = CanvasInterpolation; /***/ }), -/* 351 */ +/* 360 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67896,7 +72664,7 @@ module.exports = CanvasInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(34); +var CONST = __webpack_require__(39); /** * Called automatically by Phaser.Game and responsible for creating the console.log debug header. @@ -67933,11 +72701,11 @@ var DebugHeader = function (game) var audioType; - if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) + if (deviceAudio.webAudio && !audioConfig.disableWebAudio) { audioType = 'Web Audio'; } - else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + else if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) { audioType = 'No Audio'; } @@ -68017,7 +72785,7 @@ module.exports = DebugHeader; /***/ }), -/* 352 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68029,7 +72797,7 @@ module.exports = DebugHeader; var Class = __webpack_require__(0); var GetValue = __webpack_require__(6); var NOOP = __webpack_require__(1); -var RequestAnimationFrame = __webpack_require__(353); +var RequestAnimationFrame = __webpack_require__(362); // http://www.testufo.com/#test=animation-time-graph @@ -68111,7 +72879,7 @@ var TimeStep = new Class({ * The minimum fps rate you want the Time Step to run at. * * @name Phaser.Core.TimeStep#minFps - * @type {integer} + * @type {number} * @default 5 * @since 3.0.0 */ @@ -68125,7 +72893,7 @@ var TimeStep = new Class({ * is spiraling out of control. * * @name Phaser.Core.TimeStep#targetFps - * @type {integer} + * @type {number} * @default 60 * @since 3.0.0 */ @@ -68157,7 +72925,7 @@ var TimeStep = new Class({ * An exponential moving average of the frames per second. * * @name Phaser.Core.TimeStep#actualFps - * @type {integer} + * @type {number} * @readonly * @default 60 * @since 3.0.0 @@ -68169,7 +72937,7 @@ var TimeStep = new Class({ * When an fps update happens, the `framesThisSecond` value is reset. * * @name Phaser.Core.TimeStep#nextFpsUpdate - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.0.0 @@ -68180,7 +72948,7 @@ var TimeStep = new Class({ * The number of frames processed this second. * * @name Phaser.Core.TimeStep#framesThisSecond - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.0.0 @@ -68245,7 +73013,7 @@ var TimeStep = new Class({ * time has passed and is unaffected by delta smoothing. * * @name Phaser.Core.TimeStep#frame - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.0.0 @@ -68279,7 +73047,7 @@ var TimeStep = new Class({ * An internal counter to allow for the browser 'cooling down' after coming back into focus. * * @name Phaser.Core.TimeStep#_coolDown - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -68290,7 +73058,7 @@ var TimeStep = new Class({ * The delta time, in ms, since the last game step. This is a clamped and smoothed average value. * * @name Phaser.Core.TimeStep#delta - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -68300,7 +73068,7 @@ var TimeStep = new Class({ * Internal index of the delta history position. * * @name Phaser.Core.TimeStep#deltaIndex - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -68310,7 +73078,7 @@ var TimeStep = new Class({ * Internal array holding the previous delta values, used for delta smoothing. * * @name Phaser.Core.TimeStep#deltaHistory - * @type {integer[]} + * @type {number[]} * @since 3.0.0 */ this.deltaHistory = []; @@ -68321,7 +73089,7 @@ var TimeStep = new Class({ * This can be changed in the Game Config via the `fps.deltaHistory` property. The default is 10. * * @name Phaser.Core.TimeStep#deltaSmoothingMax - * @type {integer} + * @type {number} * @default 10 * @since 3.0.0 */ @@ -68334,7 +73102,7 @@ var TimeStep = new Class({ * This can be changed in the Game Config via the `fps.panicMax` property. The default is 120. * * @name Phaser.Core.TimeStep#panicMax - * @type {integer} + * @type {number} * @default 120 * @since 3.0.0 */ @@ -68747,7 +73515,7 @@ module.exports = TimeStep; /***/ }), -/* 353 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68961,7 +73729,7 @@ module.exports = RequestAnimationFrame; /***/ }), -/* 354 */ +/* 363 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68970,7 +73738,7 @@ module.exports = RequestAnimationFrame; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Events = __webpack_require__(21); +var Events = __webpack_require__(23); /** * The Visibility Handler is responsible for listening out for document level visibility change events. @@ -69052,7 +73820,7 @@ module.exports = VisibilityHandler; /***/ }), -/* 355 */ +/* 364 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -69061,8 +73829,8 @@ module.exports = VisibilityHandler; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Arne16 = __webpack_require__(356); -var CanvasPool = __webpack_require__(26); +var Arne16 = __webpack_require__(365); +var CanvasPool = __webpack_require__(31); var GetValue = __webpack_require__(6); /** @@ -69174,7 +73942,7 @@ module.exports = GenerateTexture; /***/ }), -/* 356 */ +/* 365 */ /***/ (function(module, exports) { /** @@ -69212,7 +73980,7 @@ module.exports = { /***/ }), -/* 357 */ +/* 366 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -69224,8 +73992,8 @@ module.exports = { // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) var Class = __webpack_require__(0); -var CubicBezier = __webpack_require__(339); -var Curve = __webpack_require__(83); +var CubicBezier = __webpack_require__(350); +var Curve = __webpack_require__(88); var Vector2 = __webpack_require__(3); /** @@ -69366,7 +74134,7 @@ var CubicBezierCurve = new Class({ * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] * * @param {Phaser.GameObjects.Graphics} graphics - The graphics object this curve should be drawn to. - * @param {integer} [pointsTotal=32] - The number of intermediary points that make up this curve. A higher number of points will result in a smoother curve. + * @param {number} [pointsTotal=32] - The number of intermediary points that make up this curve. A higher number of points will result in a smoother curve. * * @return {Phaser.GameObjects.Graphics} The graphics object this curve was drawn to. Useful for method chaining. */ @@ -69439,7 +74207,7 @@ module.exports = CubicBezierCurve; /***/ }), -/* 358 */ +/* 367 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -69451,10 +74219,10 @@ module.exports = CubicBezierCurve; // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) var Class = __webpack_require__(0); -var Curve = __webpack_require__(83); -var DegToRad = __webpack_require__(41); +var Curve = __webpack_require__(88); +var DegToRad = __webpack_require__(34); var GetValue = __webpack_require__(6); -var RadToDeg = __webpack_require__(183); +var RadToDeg = __webpack_require__(188); var Vector2 = __webpack_require__(3); /** @@ -69473,10 +74241,10 @@ var Vector2 = __webpack_require__(3); * @param {number} [y=0] - The y coordinate of the ellipse. * @param {number} [xRadius=0] - The horizontal radius of ellipse. * @param {number} [yRadius=0] - The vertical radius of ellipse. - * @param {integer} [startAngle=0] - The start angle of the ellipse, in degrees. - * @param {integer} [endAngle=360] - The end angle of the ellipse, in degrees. + * @param {number} [startAngle=0] - The start angle of the ellipse, in degrees. + * @param {number} [endAngle=360] - The end angle of the ellipse, in degrees. * @param {boolean} [clockwise=false] - Whether the ellipse angles are given as clockwise (`true`) or counter-clockwise (`false`). - * @param {integer} [rotation=0] - The rotation of the ellipse, in degrees. + * @param {number} [rotation=0] - The rotation of the ellipse, in degrees. */ var EllipseCurve = new Class({ @@ -70063,7 +74831,7 @@ module.exports = EllipseCurve; /***/ }), -/* 359 */ +/* 368 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -70075,8 +74843,8 @@ module.exports = EllipseCurve; // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) var Class = __webpack_require__(0); -var Curve = __webpack_require__(83); -var FromPoints = __webpack_require__(186); +var Curve = __webpack_require__(88); +var FromPoints = __webpack_require__(191); var Rectangle = __webpack_require__(9); var Vector2 = __webpack_require__(3); @@ -70136,7 +74904,7 @@ var LineCurve = new Class({ * The quantity of arc length divisions within the curve. * * @name Phaser.Curves.Line#arcLengthDivisions - * @type {integer} + * @type {number} * @default 1 * @since 3.0.0 */ @@ -70269,8 +75037,8 @@ var LineCurve = new Class({ * @since 3.0.0 * * @param {number} u - A float between 0 and 1. - * @param {integer} distance - The distance, in pixels. - * @param {integer} [divisions] - Optional amount of divisions. + * @param {number} distance - The distance, in pixels. + * @param {number} [divisions] - Optional amount of divisions. * * @return {number} The equidistant value. */ @@ -70366,7 +75134,7 @@ module.exports = LineCurve; /***/ }), -/* 360 */ +/* 369 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -70505,7 +75273,7 @@ module.exports = MoveTo; /***/ }), -/* 361 */ +/* 370 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -70515,8 +75283,8 @@ module.exports = MoveTo; */ var Class = __webpack_require__(0); -var Curve = __webpack_require__(83); -var QuadraticBezierInterpolation = __webpack_require__(340); +var Curve = __webpack_require__(88); +var QuadraticBezierInterpolation = __webpack_require__(351); var Vector2 = __webpack_require__(3); /** @@ -70651,7 +75419,7 @@ var QuadraticBezier = new Class({ * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] * * @param {Phaser.GameObjects.Graphics} graphics - `Graphics` object to draw onto. - * @param {integer} [pointsTotal=32] - Number of points to be used for drawing the curve. Higher numbers result in smoother curve but require more processing. + * @param {number} [pointsTotal=32] - Number of points to be used for drawing the curve. Higher numbers result in smoother curve but require more processing. * * @return {Phaser.GameObjects.Graphics} `Graphics` object that was drawn to. */ @@ -70722,7 +75490,7 @@ module.exports = QuadraticBezier; /***/ }), -/* 362 */ +/* 371 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -70733,9 +75501,9 @@ module.exports = QuadraticBezier; // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) -var CatmullRom = __webpack_require__(181); +var CatmullRom = __webpack_require__(186); var Class = __webpack_require__(0); -var Curve = __webpack_require__(83); +var Curve = __webpack_require__(88); var Vector2 = __webpack_require__(3); /** @@ -70947,7 +75715,7 @@ module.exports = SplineCurve; /***/ }), -/* 363 */ +/* 372 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -71073,7 +75841,7 @@ module.exports = BaseShader; /***/ }), -/* 364 */ +/* 373 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -71082,33 +75850,33 @@ module.exports = BaseShader; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); +var Color = __webpack_require__(36); -Color.ColorToRGBA = __webpack_require__(840); -Color.ComponentToHex = __webpack_require__(365); -Color.GetColor = __webpack_require__(175); -Color.GetColor32 = __webpack_require__(308); -Color.GetColorFromValue = __webpack_require__(119); -Color.HexStringToColor = __webpack_require__(307); -Color.HSLToColor = __webpack_require__(841); -Color.HSVColorWheel = __webpack_require__(842); -Color.HSVToRGB = __webpack_require__(176); -Color.HueToComponent = __webpack_require__(366); -Color.IntegerToColor = __webpack_require__(310); -Color.IntegerToRGB = __webpack_require__(311); -Color.Interpolate = __webpack_require__(843); -Color.ObjectToColor = __webpack_require__(312); -Color.RandomRGB = __webpack_require__(844); -Color.RGBStringToColor = __webpack_require__(313); -Color.RGBToHSV = __webpack_require__(309); -Color.RGBToString = __webpack_require__(845); -Color.ValueToColor = __webpack_require__(174); +Color.ColorSpectrum = __webpack_require__(895); +Color.ColorToRGBA = __webpack_require__(896); +Color.ComponentToHex = __webpack_require__(374); +Color.GetColor = __webpack_require__(100); +Color.GetColor32 = __webpack_require__(320); +Color.HexStringToColor = __webpack_require__(319); +Color.HSLToColor = __webpack_require__(897); +Color.HSVColorWheel = __webpack_require__(898); +Color.HSVToRGB = __webpack_require__(180); +Color.HueToComponent = __webpack_require__(375); +Color.IntegerToColor = __webpack_require__(322); +Color.IntegerToRGB = __webpack_require__(181); +Color.Interpolate = __webpack_require__(899); +Color.ObjectToColor = __webpack_require__(323); +Color.RandomRGB = __webpack_require__(900); +Color.RGBStringToColor = __webpack_require__(324); +Color.RGBToHSV = __webpack_require__(321); +Color.RGBToString = __webpack_require__(901); +Color.ValueToColor = __webpack_require__(179); module.exports = Color; /***/ }), -/* 365 */ +/* 374 */ /***/ (function(module, exports) { /** @@ -71123,7 +75891,7 @@ module.exports = Color; * @function Phaser.Display.Color.ComponentToHex * @since 3.0.0 * - * @param {integer} color - The color channel to get the hex value for, must be a value between 0 and 255. + * @param {number} color - The color channel to get the hex value for, must be a value between 0 and 255. * * @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64. */ @@ -71138,7 +75906,7 @@ module.exports = ComponentToHex; /***/ }), -/* 366 */ +/* 375 */ /***/ (function(module, exports) { /** @@ -71194,7 +75962,7 @@ module.exports = HueToComponent; /***/ }), -/* 367 */ +/* 376 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -71203,7 +75971,227 @@ module.exports = HueToComponent; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var OS = __webpack_require__(125); +var Class = __webpack_require__(0); +var NOOP = __webpack_require__(1); + +/** + * @classdesc + * The RGB class holds a single color value and allows for easy modification and reading of it, + * with optional on-change callback notification and a dirty flag. + * + * @class RGB + * @memberof Phaser.Display + * @constructor + * @since 3.50.0 + * + * @param {number} [red=0] - The red color value. A number between 0 and 1. + * @param {number} [green=0] - The green color value. A number between 0 and 1. + * @param {number} [blue=0] - The blue color value. A number between 0 and 1. + */ +var RGB = new Class({ + + initialize: + + function RGB (red, green, blue) + { + /** + * Cached RGB values. + * + * @name Phaser.Display.RGB#_rgb + * @type {number[]} + * @private + * @since 3.50.0 + */ + this._rgb = [ 0, 0, 0 ]; + + /** + * This callback will be invoked each time one of the RGB color values change. + * + * The callback is sent the new color values as the parameters. + * + * @name Phaser.Display.RGB#onChangeCallback + * @type {function} + * @since 3.50.0 + */ + this.onChangeCallback = NOOP; + + /** + * Is this color dirty? + * + * @name Phaser.Display.RGB#dirty + * @type {boolean} + * @since 3.50.0 + */ + this.dirty = false; + + this.set(red, green, blue); + }, + + /** + * Sets the red, green and blue values of this RGB object, flags it as being + * dirty and then invokes the `onChangeCallback`, if set. + * + * @method Phaser.Display.RGB#set + * @since 3.50.0 + * + * @param {number} [red=0] - The red color value. A number between 0 and 1. + * @param {number} [green=0] - The green color value. A number between 0 and 1. + * @param {number} [blue=0] - The blue color value. A number between 0 and 1. + * + * @return {this} This RGB instance. + */ + set: function (red, green, blue) + { + if (red === undefined) { red = 0; } + if (green === undefined) { green = 0; } + if (blue === undefined) { blue = 0; } + + this._rgb = [ red, green, blue ]; + + this.onChange(); + + return this; + }, + + /** + * Compares the given rgb parameters with those in this object and returns + * a boolean `true` value if they are equal, otherwise it returns `false`. + * + * @method Phaser.Display.RGB#equals + * @since 3.50.0 + * + * @param {number} red - The red value to compare with this object. + * @param {number} green - The green value to compare with this object. + * @param {number} blue - The blue value to compare with this object. + * + * @return {boolean} `true` if the given values match those in this object, otherwise `false`. + */ + equals: function (red, green, blue) + { + var rgb = this._rgb; + + return (rgb.r === red && rgb.g === green && rgb.b === blue); + }, + + /** + * Internal on change handler. Sets this object as being dirty and + * then invokes the `onChangeCallback`, if set, passing in the + * new RGB values. + * + * @method Phaser.Display.RGB#onChange + * @since 3.50.0 + */ + onChange: function () + { + this.dirty = true; + + var rgb = this._rgb; + + this.onChangeCallback.call(this, rgb[0], rgb[1], rgb[2]); + }, + + /** + * The red color value. Between 0 and 1. + * + * Changing this property will flag this RGB object as being dirty + * and invoke the `onChangeCallback` , if set. + * + * @name Phaser.Display.RGB#r + * @type {number} + * @since 3.50.0 + */ + r: { + + get: function () + { + return this._rgb[0]; + }, + + set: function (value) + { + this._rgb[0] = value; + this.onChange(); + } + + }, + + /** + * The green color value. Between 0 and 1. + * + * Changing this property will flag this RGB object as being dirty + * and invoke the `onChangeCallback` , if set. + * + * @name Phaser.Display.RGB#g + * @type {number} + * @since 3.50.0 + */ + g: { + + get: function () + { + return this._rgb[1]; + }, + + set: function (value) + { + this._rgb[1] = value; + this.onChange(); + } + + }, + + /** + * The blue color value. Between 0 and 1. + * + * Changing this property will flag this RGB object as being dirty + * and invoke the `onChangeCallback` , if set. + * + * @name Phaser.Display.RGB#b + * @type {number} + * @since 3.50.0 + */ + b: { + + get: function () + { + return this._rgb[2]; + }, + + set: function (value) + { + this._rgb[2] = value; + this.onChange(); + } + + }, + + /** + * Nulls any external references this object contains. + * + * @method Phaser.Display.RGB#destroy + * @since 3.50.0 + */ + destroy: function () + { + this.onChangeCallback = null; + } + +}); + +module.exports = RGB; + + +/***/ }), +/* 377 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var OS = __webpack_require__(102); /** * @callback ContentLoadedCallback @@ -71257,7 +76245,7 @@ module.exports = DOMContentLoaded; /***/ }), -/* 368 */ +/* 378 */ /***/ (function(module, exports) { /** @@ -71316,7 +76304,7 @@ module.exports = GetInnerHeight; /***/ }), -/* 369 */ +/* 379 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -71325,7 +76313,7 @@ module.exports = GetInnerHeight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(187); +var CONST = __webpack_require__(192); /** * Attempts to determine the screen orientation using the Orientation API. @@ -71354,12 +76342,9 @@ var GetScreenOrientation = function (width, height) return orientation; } - if (screen) - { - return (screen.height > screen.width) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; - } - else if (typeof window.orientation === 'number') + if (typeof window.orientation === 'number') { + // Do this check first, as iOS supports this, but also has an incomplete window.screen implementation // This may change by device based on "natural" orientation. return (window.orientation === 0 || window.orientation === 180) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; } @@ -71374,15 +76359,17 @@ var GetScreenOrientation = function (width, height) return CONST.ORIENTATION.LANDSCAPE; } } - - return (height > width) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; + else + { + return (height > width) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; + } }; module.exports = GetScreenOrientation; /***/ }), -/* 370 */ +/* 380 */ /***/ (function(module, exports) { /** @@ -71416,7 +76403,7 @@ module.exports = { * You can still center it yourself via CSS. * * @name Phaser.Scale.Center.NO_CENTER - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71430,7 +76417,7 @@ module.exports = { * game canvas, and does not factor in any other CSS styles you may have applied. * * @name Phaser.Scale.Center.CENTER_BOTH - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71444,7 +76431,7 @@ module.exports = { * game canvas, and does not factor in any other CSS styles you may have applied. * * @name Phaser.Scale.Center.CENTER_HORIZONTALLY - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71458,7 +76445,7 @@ module.exports = { * game canvas, and does not factor in any other CSS styles you may have applied. * * @name Phaser.Scale.Center.CENTER_VERTICALLY - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71468,7 +76455,7 @@ module.exports = { /***/ }), -/* 371 */ +/* 381 */ /***/ (function(module, exports) { /** @@ -71521,7 +76508,7 @@ module.exports = { /***/ }), -/* 372 */ +/* 382 */ /***/ (function(module, exports) { /** @@ -71556,7 +76543,7 @@ module.exports = { * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working. * * @name Phaser.Scale.ScaleModes.NONE - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71566,7 +76553,7 @@ module.exports = { * The height is automatically adjusted based on the width. * * @name Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71576,7 +76563,7 @@ module.exports = { * The width is automatically adjusted based on the height. * * @name Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71588,7 +76575,7 @@ module.exports = { * inside the area which is not covered. * * @name Phaser.Scale.ScaleModes.FIT - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71599,7 +76586,7 @@ module.exports = { * area while keeping the aspect ratio. This may extend further out than the target size. * * @name Phaser.Scale.ScaleModes.ENVELOP - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71609,7 +76596,7 @@ module.exports = { * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio. * * @name Phaser.Scale.ScaleModes.RESIZE - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71619,7 +76606,7 @@ module.exports = { /***/ }), -/* 373 */ +/* 383 */ /***/ (function(module, exports) { /** @@ -71652,7 +76639,7 @@ module.exports = { * The game canvas will not be zoomed by Phaser. * * @name Phaser.Scale.Zoom.NO_ZOOM - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71662,7 +76649,7 @@ module.exports = { * The game canvas will be 2x zoomed by Phaser. * * @name Phaser.Scale.Zoom.ZOOM_2X - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71672,7 +76659,7 @@ module.exports = { * The game canvas will be 4x zoomed by Phaser. * * @name Phaser.Scale.Zoom.ZOOM_4X - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71683,7 +76670,7 @@ module.exports = { * fit into the parent, or browser window if no parent is set. * * @name Phaser.Scale.Zoom.MAX_ZOOM - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -71693,7 +76680,7 @@ module.exports = { /***/ }), -/* 374 */ +/* 384 */ /***/ (function(module, exports) { /** @@ -71744,7 +76731,7 @@ module.exports = GetTarget; /***/ }), -/* 375 */ +/* 385 */ /***/ (function(module, exports) { /** @@ -71801,7 +76788,7 @@ module.exports = ParseXML; /***/ }), -/* 376 */ +/* 386 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -71811,16 +76798,16 @@ module.exports = ParseXML; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(189); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(56); -var GameEvents = __webpack_require__(21); -var Keyboard = __webpack_require__(377); -var Mouse = __webpack_require__(378); -var Pointer = __webpack_require__(379); -var Touch = __webpack_require__(380); -var TransformMatrix = __webpack_require__(31); -var TransformXY = __webpack_require__(166); +var CONST = __webpack_require__(194); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(49); +var GameEvents = __webpack_require__(23); +var Keyboard = __webpack_require__(387); +var Mouse = __webpack_require__(388); +var Pointer = __webpack_require__(389); +var Touch = __webpack_require__(390); +var TransformMatrix = __webpack_require__(24); +var TransformXY = __webpack_require__(169); /** * @classdesc @@ -71977,7 +76964,7 @@ var InputManager = new Class({ * setting the `input.activePointers` property in the Game Config. * * @name Phaser.Input.InputManager#pointersTotal - * @type {integer} + * @type {number} * @readonly * @since 3.10.0 */ @@ -72197,7 +77184,7 @@ var InputManager = new Class({ /** * Tells the Input system to set a custom cursor. - * + * * This cursor will be the default cursor used when interacting with the game canvas. * * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use. @@ -72207,7 +77194,7 @@ var InputManager = new Class({ * ```javascript * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer'); * ``` - * + * * Please read about the differences between browsers when it comes to the file formats and sizes they support: * * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor @@ -72217,7 +77204,7 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#setDefaultCursor * @since 3.10.0 - * + * * @param {string} cursor - The CSS to be used when setting the default cursor. */ setDefaultCursor: function (cursor) @@ -72232,7 +77219,7 @@ var InputManager = new Class({ /** * Called by the InputPlugin when processing over and out events. - * + * * Tells the Input Manager to set a custom cursor during its postUpdate step. * * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor @@ -72240,7 +77227,7 @@ var InputManager = new Class({ * @method Phaser.Input.InputManager#setCursor * @private * @since 3.10.0 - * + * * @param {Phaser.Types.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. */ setCursor: function (interactiveObject) @@ -72253,13 +77240,13 @@ var InputManager = new Class({ /** * Called by the InputPlugin when processing over and out events. - * + * * Tells the Input Manager to clear the hand cursor, if set, during its postUpdate step. * * @method Phaser.Input.InputManager#resetCursor * @private * @since 3.10.0 - * + * * @param {Phaser.Types.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. */ resetCursor: function (interactiveObject) @@ -72284,7 +77271,7 @@ var InputManager = new Class({ * @method Phaser.Input.InputManager#addPointer * @since 3.10.0 * - * @param {integer} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. + * @param {number} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. * * @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created. */ @@ -72325,7 +77312,7 @@ var InputManager = new Class({ * @method Phaser.Input.InputManager#updateInputPlugins * @since 3.16.0 * - * @param {integer} type - The type of event to process. + * @param {number} type - The type of event to process. * @param {Phaser.Input.Pointer[]} pointers - An array of Pointers on which the event occurred. */ updateInputPlugins: function (type, pointers) @@ -72518,9 +77505,13 @@ var InputManager = new Class({ */ onMouseDown: function (event) { - this.mousePointer.down(event); + var mousePointer = this.mousePointer; - this.mousePointer.updateMotion(); + mousePointer.down(event); + + mousePointer.updateMotion(); + + this.activePointer = mousePointer; this.updateInputPlugins(CONST.MOUSE_DOWN, this.mousePointerContainer); }, @@ -72536,9 +77527,13 @@ var InputManager = new Class({ */ onMouseMove: function (event) { - this.mousePointer.move(event); + var mousePointer = this.mousePointer; - this.mousePointer.updateMotion(); + mousePointer.move(event); + + mousePointer.updateMotion(); + + this.activePointer = mousePointer; this.updateInputPlugins(CONST.MOUSE_MOVE, this.mousePointerContainer); }, @@ -72554,9 +77549,13 @@ var InputManager = new Class({ */ onMouseUp: function (event) { - this.mousePointer.up(event); + var mousePointer = this.mousePointer; - this.mousePointer.updateMotion(); + mousePointer.up(event); + + mousePointer.updateMotion(); + + this.activePointer = mousePointer; this.updateInputPlugins(CONST.MOUSE_UP, this.mousePointerContainer); }, @@ -72572,7 +77571,11 @@ var InputManager = new Class({ */ onMouseWheel: function (event) { - this.mousePointer.wheel(event); + var mousePointer = this.mousePointer; + + mousePointer.wheel(event); + + this.activePointer = mousePointer; this.updateInputPlugins(CONST.MOUSE_WHEEL, this.mousePointerContainer); }, @@ -72675,12 +77678,6 @@ var InputManager = new Class({ var x = pointer.x; var y = pointer.y; - if (camera.resolution !== 1) - { - x += camera._x; - y += camera._y; - } - // Stores the world point inside of tempPoint camera.getWorldPoint(x, y, tempPoint); @@ -72716,7 +77713,7 @@ var InputManager = new Class({ { TransformXY(px, py, gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX, gameObject.scaleY, point); } - + if (this.pointWithinHitArea(gameObject, point.x, point.y)) { output.push(gameObject); @@ -72883,7 +77880,7 @@ module.exports = InputManager; /***/ }), -/* 377 */ +/* 387 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -72892,11 +77889,11 @@ module.exports = InputManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayRemove = __webpack_require__(96); +var ArrayRemove = __webpack_require__(87); var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(21); -var InputEvents = __webpack_require__(56); -var KeyCodes = __webpack_require__(132); +var GameEvents = __webpack_require__(23); +var InputEvents = __webpack_require__(49); +var KeyCodes = __webpack_require__(138); var NOOP = __webpack_require__(1); /** @@ -72980,7 +77977,7 @@ var KeyboardManager = new Class({ * can call the `addCapture` method. See also `removeCapture` and `clearCaptures`. * * @name Phaser.Input.Keyboard.KeyboardManager#captures - * @type {integer[]} + * @type {number[]} * @since 3.16.0 */ this.captures = []; @@ -73189,7 +78186,7 @@ var KeyboardManager = new Class({ * @method Phaser.Input.Keyboard.KeyboardManager#addCapture * @since 3.16.0 * - * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable capture for, preventing them reaching the browser. + * @param {(string|number|number[]|any[])} keycode - The Key Codes to enable capture for, preventing them reaching the browser. */ addCapture: function (keycode) { @@ -73256,7 +78253,7 @@ var KeyboardManager = new Class({ * @method Phaser.Input.Keyboard.KeyboardManager#removeCapture * @since 3.16.0 * - * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable capture for, allowing them reaching the browser again. + * @param {(string|number|number[]|any[])} keycode - The Key Codes to disable capture for, allowing them reaching the browser again. */ removeCapture: function (keycode) { @@ -73327,7 +78324,7 @@ module.exports = KeyboardManager; /***/ }), -/* 378 */ +/* 388 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73337,8 +78334,8 @@ module.exports = KeyboardManager; */ var Class = __webpack_require__(0); -var Features = __webpack_require__(179); -var InputEvents = __webpack_require__(56); +var Features = __webpack_require__(183); +var InputEvents = __webpack_require__(49); var NOOP = __webpack_require__(1); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent @@ -73375,14 +78372,44 @@ var MouseManager = new Class({ this.manager = inputManager; /** - * If true the DOM mouse events will have event.preventDefault applied to them, if false they will propagate fully. + * If `true` the DOM `mousedown` event will have `preventDefault` set. * - * @name Phaser.Input.Mouse.MouseManager#capture + * @name Phaser.Input.Mouse.MouseManager#preventDefaultDown * @type {boolean} * @default true - * @since 3.0.0 + * @since 3.50.0 */ - this.capture = true; + this.preventDefaultDown = true; + + /** + * If `true` the DOM `mouseup` event will have `preventDefault` set. + * + * @name Phaser.Input.Mouse.MouseManager#preventDefaultUp + * @type {boolean} + * @default true + * @since 3.50.0 + */ + this.preventDefaultUp = true; + + /** + * If `true` the DOM `mousemove` event will have `preventDefault` set. + * + * @name Phaser.Input.Mouse.MouseManager#preventDefaultMove + * @type {boolean} + * @default true + * @since 3.50.0 + */ + this.preventDefaultMove = true; + + /** + * If `true` the DOM `wheel` event will have `preventDefault` set. + * + * @name Phaser.Input.Mouse.MouseManager#preventDefaultWheel + * @type {boolean} + * @default true + * @since 3.50.0 + */ + this.preventDefaultWheel = false; /** * A boolean that controls if the Mouse Manager is enabled or not. @@ -73514,6 +78541,20 @@ var MouseManager = new Class({ */ this.pointerLockChange = NOOP; + /** + * Are the event listeners hooked into `window.top` or `window`? + * + * This is set during the `boot` sequence. If the browser does not have access to `window.top`, + * such as in cross-origin iframe environments, this property gets set to `false` and the events + * are hooked into `window` instead. + * + * @name Phaser.Input.Mouse.MouseManager#isTop + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.isTop = true; + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, @@ -73530,7 +78571,12 @@ var MouseManager = new Class({ this.enabled = config.inputMouse; this.target = config.inputMouseEventTarget; - this.capture = config.inputMouseCapture; + this.passive = config.inputMousePassive; + + this.preventDefaultDown = config.inputMousePreventDefaultDown; + this.preventDefaultUp = config.inputMousePreventDefaultUp; + this.preventDefaultMove = config.inputMousePreventDefaultMove; + this.preventDefaultWheel = config.inputMousePreventDefaultWheel; if (!this.target) { @@ -73588,6 +78634,12 @@ var MouseManager = new Class({ * It is important to note that pointer lock can only be enabled after an 'engagement gesture', * see: https://w3c.github.io/pointerlock/#dfn-engagement-gesture. * + * Note for Firefox: There is a bug in certain Firefox releases that cause native DOM events like + * `mousemove` to fire continuously when in pointer lock mode. You can get around this by setting + * `this.preventDefaultMove` to `false` in this class. You may also need to do the same for + * `preventDefaultDown` and/or `preventDefaultUp`. Please test combinations of these if you encounter + * the error. + * * @method Phaser.Input.Mouse.MouseManager#requestPointerLock * @since 3.0.0 */ @@ -73629,17 +78681,25 @@ var MouseManager = new Class({ */ startListeners: function () { + var target = this.target; + + if (!target) + { + return; + } + var _this = this; - var canvas = this.manager.canvas; - var autoFocus = (window && window.focus && this.manager.game.config.autoFocus); + var manager = this.manager; + var canvas = manager.canvas; + var autoFocus = (window && window.focus && manager.game.config.autoFocus); this.onMouseMove = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.onMouseMove(event); + manager.onMouseMove(event); - if (_this.capture) + if (_this.preventDefaultMove) { event.preventDefault(); } @@ -73653,11 +78713,11 @@ var MouseManager = new Class({ window.focus(); } - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.onMouseDown(event); + manager.onMouseDown(event); - if (_this.capture && event.target === canvas) + if (_this.preventDefaultDown && event.target === canvas) { event.preventDefault(); } @@ -73666,20 +78726,20 @@ var MouseManager = new Class({ this.onMouseDownWindow = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled && event.target !== canvas) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) { // Only process the event if the target isn't the canvas - _this.manager.onMouseDown(event); + manager.onMouseDown(event); } }; this.onMouseUp = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.onMouseUp(event); + manager.onMouseUp(event); - if (_this.capture && event.target === canvas) + if (_this.preventDefaultUp && event.target === canvas) { event.preventDefault(); } @@ -73688,58 +78748,73 @@ var MouseManager = new Class({ this.onMouseUpWindow = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled && event.target !== canvas) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) { // Only process the event if the target isn't the canvas - _this.manager.onMouseUp(event); + manager.onMouseUp(event); } }; this.onMouseOver = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.setCanvasOver(event); + manager.setCanvasOver(event); } }; this.onMouseOut = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.setCanvasOut(event); + manager.setCanvasOut(event); } }; this.onMouseWheel = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.onMouseWheel(event); + manager.onMouseWheel(event); + } + + if (_this.preventDefaultWheel && event.target === canvas) + { + event.preventDefault(); } }; - var target = this.target; + var passive = { passive: true }; - if (!target) + target.addEventListener('mousemove', this.onMouseMove); + target.addEventListener('mousedown', this.onMouseDown); + target.addEventListener('mouseup', this.onMouseUp); + target.addEventListener('mouseover', this.onMouseOver, passive); + target.addEventListener('mouseout', this.onMouseOut, passive); + + if (this.preventDefaultWheel) { - return; + target.addEventListener('wheel', this.onMouseWheel, { passive: false }); + } + else + { + target.addEventListener('wheel', this.onMouseWheel, passive); } - var passive = { passive: true }; - var nonPassive = { passive: false }; - - target.addEventListener('mousemove', this.onMouseMove, (this.capture) ? nonPassive : passive); - target.addEventListener('mousedown', this.onMouseDown, (this.capture) ? nonPassive : passive); - target.addEventListener('mouseup', this.onMouseUp, (this.capture) ? nonPassive : passive); - target.addEventListener('mouseover', this.onMouseOver, (this.capture) ? nonPassive : passive); - target.addEventListener('mouseout', this.onMouseOut, (this.capture) ? nonPassive : passive); - target.addEventListener('wheel', this.onMouseWheel, (this.capture) ? nonPassive : passive); - - if (window && this.manager.game.config.inputWindowEvents) + if (window && manager.game.config.inputWindowEvents) { - window.top.addEventListener('mousedown', this.onMouseDownWindow, nonPassive); - window.top.addEventListener('mouseup', this.onMouseUpWindow, nonPassive); + try + { + window.top.addEventListener('mousedown', this.onMouseDownWindow, passive); + window.top.addEventListener('mouseup', this.onMouseUpWindow, passive); + } + catch (exception) + { + window.addEventListener('mousedown', this.onMouseDownWindow, passive); + window.addEventListener('mouseup', this.onMouseUpWindow, passive); + + this.isTop = false; + } } if (Features.pointerLock) @@ -73750,7 +78825,7 @@ var MouseManager = new Class({ _this.locked = (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element) ? true : false; - _this.manager.onPointerLockChange(event); + manager.onPointerLockChange(event); }; document.addEventListener('pointerlockchange', this.pointerLockChange, true); @@ -73780,8 +78855,10 @@ var MouseManager = new Class({ if (window) { - window.top.removeEventListener('mousedown', this.onMouseDownWindow); - window.top.removeEventListener('mouseup', this.onMouseUpWindow); + target = (this.isTop) ? window.top : window; + + target.removeEventListener('mousedown', this.onMouseDownWindow); + target.removeEventListener('mouseup', this.onMouseUpWindow); } if (Features.pointerLock) @@ -73813,7 +78890,7 @@ module.exports = MouseManager; /***/ }), -/* 379 */ +/* 389 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73822,12 +78899,13 @@ module.exports = MouseManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Angle = __webpack_require__(330); +var Angle = __webpack_require__(341); var Class = __webpack_require__(0); -var Distance = __webpack_require__(55); -var FuzzyEqual = __webpack_require__(109); -var SmoothStepInterpolation = __webpack_require__(341); +var Distance = __webpack_require__(61); +var FuzzyEqual = __webpack_require__(121); +var SmoothStepInterpolation = __webpack_require__(352); var Vector2 = __webpack_require__(3); +var OS = __webpack_require__(102); /** * @classdesc @@ -73850,7 +78928,7 @@ var Vector2 = __webpack_require__(3); * @since 3.0.0 * * @param {Phaser.Input.InputManager} manager - A reference to the Input Manager. - * @param {integer} id - The internal ID of this Pointer. + * @param {number} id - The internal ID of this Pointer. */ var Pointer = new Class({ @@ -73871,7 +78949,7 @@ var Pointer = new Class({ * The internal ID of this Pointer. * * @name Phaser.Input.Pointer#id - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -73932,7 +79010,7 @@ var Pointer = new Class({ * however, it should behave as if the left button was clicked in the standard button layout. * * @name Phaser.Input.Pointer#button - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.18.0 @@ -73951,7 +79029,7 @@ var Pointer = new Class({ * In this case, the values are read from right to left. * * @name Phaser.Input.Pointer#buttons - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -74326,17 +79404,8 @@ var Pointer = new Class({ */ updateWorldPoint: function (camera) { - var x = this.x; - var y = this.y; - - if (camera.resolution !== 1) - { - x += camera._x; - y += camera._y; - } - // Stores the world point inside of tempPoint - var temp = camera.getWorldPoint(x, y); + var temp = camera.getWorldPoint(this.x, this.y); this.worldX = temp.x; this.worldY = temp.y; @@ -74486,6 +79555,13 @@ var Pointer = new Class({ this.downY = this.y; } + if (OS.macOS && event.ctrlKey) + { + // Override button settings on macOS + this.buttons = 2; + this.primaryDown = false; + } + if (!this.isDown) { this.isDown = true; @@ -74990,7 +80066,7 @@ var Pointer = new Class({ * @method Phaser.Input.Pointer#getInterpolatedPosition * @since 3.11.0 * - * @param {integer} [steps=10] - The number of interpolation steps to use. + * @param {number} [steps=10] - The number of interpolation steps to use. * @param {array} [out] - An array to store the results in. If not provided a new one will be created. * * @return {array} An array of interpolated values. @@ -75100,7 +80176,7 @@ module.exports = Pointer; /***/ }), -/* 380 */ +/* 390 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75110,7 +80186,7 @@ module.exports = Pointer; */ var Class = __webpack_require__(0); -var InputEvents = __webpack_require__(56); +var InputEvents = __webpack_require__(49); var NOOP = __webpack_require__(1); // https://developer.mozilla.org/en-US/docs/Web/API/Touch_events @@ -75513,7 +80589,7 @@ module.exports = TouchManager; /***/ }), -/* 381 */ +/* 391 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75523,14 +80599,14 @@ module.exports = TouchManager; */ var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(21); -var EventEmitter = __webpack_require__(12); +var GameEvents = __webpack_require__(23); +var EventEmitter = __webpack_require__(10); var FileTypesManager = __webpack_require__(8); -var GameObjectCreator = __webpack_require__(16); +var GameObjectCreator = __webpack_require__(17); var GameObjectFactory = __webpack_require__(5); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(23); -var Remove = __webpack_require__(96); +var PluginCache = __webpack_require__(25); +var Remove = __webpack_require__(87); /** * @classdesc @@ -75991,7 +81067,7 @@ var PluginManager = new Class({ * * @param {string} key - The unique plugin key. * - * @return {integer} The index of the plugin within the plugins array. + * @return {number} The index of the plugin within the plugins array. */ getIndex: function (key) { @@ -76415,7 +81491,7 @@ module.exports = PluginManager; /***/ }), -/* 382 */ +/* 392 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -76424,18 +81500,18 @@ module.exports = PluginManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(187); +var CONST = __webpack_require__(192); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(94); -var GameEvents = __webpack_require__(21); -var GetInnerHeight = __webpack_require__(368); -var GetTarget = __webpack_require__(374); -var GetScreenOrientation = __webpack_require__(369); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(101); +var GameEvents = __webpack_require__(23); +var GetInnerHeight = __webpack_require__(378); +var GetTarget = __webpack_require__(384); +var GetScreenOrientation = __webpack_require__(379); var NOOP = __webpack_require__(1); var Rectangle = __webpack_require__(9); -var Size = __webpack_require__(383); -var SnapFloor = __webpack_require__(95); +var Size = __webpack_require__(393); +var SnapFloor = __webpack_require__(72); var Vector2 = __webpack_require__(3); /** @@ -76624,7 +81700,7 @@ var ScaleManager = new Class({ /** * The Base Size component. * - * The modified game size, which is the gameSize * resolution, used to set the canvas width and height + * The modified game size, which is the auto-rounded gameSize, used to set the canvas width and height * (but not the CSS style) * * @name Phaser.Scale.ScaleManager#baseSize @@ -76653,17 +81729,6 @@ var ScaleManager = new Class({ */ this.scaleMode = CONST.SCALE_MODE.NONE; - /** - * The canvas resolution. - * - * This is hard-coded to a value of 1 in the 3.16 release of Phaser and will be enabled at a later date. - * - * @name Phaser.Scale.ScaleManager#resolution - * @type {number} - * @since 3.16.0 - */ - this.resolution = 1; - /** * The game zoom factor. * @@ -76785,7 +81850,7 @@ var ScaleManager = new Class({ * checked here. * * @name Phaser.Scale.ScaleManager#resizeInterval - * @type {integer} + * @type {number} * @since 3.16.0 */ this.resizeInterval = 500; @@ -76794,7 +81859,7 @@ var ScaleManager = new Class({ * Internal size interval tracker. * * @name Phaser.Scale.ScaleManager#_lastCheck - * @type {integer} + * @type {number} * @private * @since 3.16.0 */ @@ -76841,7 +81906,7 @@ var ScaleManager = new Class({ // Parse the config to get the scaling values we need this.parseConfig(this.game.config); - this.game.events.once('boot', this.boot, this); + this.game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -76884,6 +81949,7 @@ var ScaleManager = new Class({ } game.events.on(GameEvents.PRE_STEP, this.step, this); + game.events.once(GameEvents.READY, this.refresh, this); game.events.once(GameEvents.DESTROY, this.destroy, this); this.startListeners(); @@ -76910,7 +81976,6 @@ var ScaleManager = new Class({ var width = config.width; var height = config.height; var scaleMode = config.scaleMode; - var resolution = config.resolution; var zoom = config.zoom; var autoRound = config.autoRound; @@ -76946,11 +82011,6 @@ var ScaleManager = new Class({ height = Math.floor(parentHeight * parentScaleY); } - // This is fixed at 1 on purpose. - // Changing it will break all user input. - // Wait for another release to solve this issue. - this.resolution = 1; - this.scaleMode = scaleMode; this.autoRound = autoRound; @@ -76980,8 +82040,8 @@ var ScaleManager = new Class({ this._resetZoom = true; } - // The modified game size, which is the w/h * resolution - this.baseSize.setSize(width * resolution, height * resolution); + // The modified game size + this.baseSize.setSize(width, height); if (autoRound) { @@ -77082,9 +82142,8 @@ var ScaleManager = new Class({ DOMRect.height = GetInnerHeight(true); } - var resolution = this.resolution; - var newWidth = DOMRect.width * resolution; - var newHeight = DOMRect.height * resolution; + var newWidth = DOMRect.width; + var newHeight = DOMRect.height; if (parentSize.width !== newWidth || parentSize.height !== newHeight) { @@ -77164,7 +82223,6 @@ var ScaleManager = new Class({ setGameSize: function (width, height) { var autoRound = this.autoRound; - var resolution = this.resolution; if (autoRound) { @@ -77178,8 +82236,8 @@ var ScaleManager = new Class({ // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc this.gameSize.resize(width, height); - // The modified game size, which is the w/h * resolution - this.baseSize.resize(width * resolution, height * resolution); + // The modified game size + this.baseSize.resize(width, height); if (autoRound) { @@ -77229,7 +82287,6 @@ var ScaleManager = new Class({ resize: function (width, height) { var zoom = this.zoom; - var resolution = this.resolution; var autoRound = this.autoRound; if (autoRound) @@ -77244,8 +82301,8 @@ var ScaleManager = new Class({ // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc this.gameSize.resize(width, height); - // The modified game size, which is the w/h * resolution - this.baseSize.resize(width * resolution, height * resolution); + // The modified game size + this.baseSize.resize(width, height); if (autoRound) { @@ -77255,7 +82312,7 @@ var ScaleManager = new Class({ // The size used for the canvas style, factoring in the scale mode and parent and zoom value // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) - this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + this.displaySize.setSize((width * zoom), (height * zoom)); this.canvas.width = this.baseSize.width; this.canvas.height = this.baseSize.height; @@ -77287,7 +82344,7 @@ var ScaleManager = new Class({ * @fires Phaser.Scale.Events#RESIZE * @since 3.16.0 * - * @param {integer} value - The new zoom value of the game. + * @param {number} value - The new zoom value of the game. * * @return {this} The Scale Manager instance. */ @@ -77359,7 +82416,7 @@ var ScaleManager = new Class({ domStyle.marginTop = canvasStyle.marginTop; } - this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution, previousWidth, previousHeight); + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, previousWidth, previousHeight); return this; }, @@ -77408,15 +82465,14 @@ var ScaleManager = new Class({ var zoom = this.zoom; var autoRound = this.autoRound; - var resolution = 1; if (this.scaleMode === CONST.SCALE_MODE.NONE) { // No scale - this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + this.displaySize.setSize((width * zoom), (height * zoom)); - styleWidth = this.displaySize.width / resolution; - styleHeight = this.displaySize.height / resolution; + styleWidth = this.displaySize.width; + styleHeight = this.displaySize.height; if (autoRound) { @@ -77441,10 +82497,10 @@ var ScaleManager = new Class({ this.gameSize.setSize(this.displaySize.width, this.displaySize.height); - this.baseSize.setSize(this.displaySize.width * resolution, this.displaySize.height * resolution); + this.baseSize.setSize(this.displaySize.width, this.displaySize.height); - styleWidth = this.displaySize.width / resolution; - styleHeight = this.displaySize.height / resolution; + styleWidth = this.displaySize.width; + styleHeight = this.displaySize.height; if (autoRound) { @@ -77460,8 +82516,8 @@ var ScaleManager = new Class({ // All other scale modes this.displaySize.setSize(this.parentSize.width, this.parentSize.height); - styleWidth = this.displaySize.width / resolution; - styleHeight = this.displaySize.height / resolution; + styleWidth = this.displaySize.width; + styleHeight = this.displaySize.height; if (autoRound) { @@ -77488,7 +82544,7 @@ var ScaleManager = new Class({ * @method Phaser.Scale.ScaleManager#getMaxZoom * @since 3.16.0 * - * @return {integer} The maximum possible zoom factor. At a minimum this value is always at least 1. + * @return {number} The maximum possible zoom factor. At a minimum this value is always at least 1. */ getMaxZoom: function () { @@ -78126,7 +83182,7 @@ module.exports = ScaleManager; /***/ }), -/* 383 */ +/* 393 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -78135,9 +83191,9 @@ module.exports = ScaleManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var SnapFloor = __webpack_require__(95); +var SnapFloor = __webpack_require__(72); var Vector2 = __webpack_require__(3); /** @@ -78155,7 +83211,7 @@ var Vector2 = __webpack_require__(3); * * @param {number} [width=0] - The width of the Size component. * @param {number} [height=width] - The height of the Size component. If not given, it will use the `width`. - * @param {integer} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. + * @param {number} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. * @param {any} [parent=null] - The parent of this Size component. Can be any object with public `width` and `height` properties. Dimensions are clamped to keep them within the parent bounds where possible. */ var Size = new Class({ @@ -78204,7 +83260,7 @@ var Size = new Class({ * This property is read-only. To change it use the `setAspectMode` method. * * @name Phaser.Structs.Size#aspectMode - * @type {integer} + * @type {number} * @readonly * @since 3.16.0 */ @@ -78302,7 +83358,7 @@ var Size = new Class({ * @method Phaser.Structs.Size#setAspectMode * @since 3.16.0 * - * @param {integer} [value=0] - The aspect mode value. + * @param {number} [value=0] - The aspect mode value. * * @return {this} This Size component instance. */ @@ -78855,7 +83911,7 @@ var Size = new Class({ * * @name Phaser.Structs.Size.NONE * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.NONE = 0; @@ -78865,7 +83921,7 @@ Size.NONE = 0; * * @name Phaser.Structs.Size.WIDTH_CONTROLS_HEIGHT * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.WIDTH_CONTROLS_HEIGHT = 1; @@ -78875,7 +83931,7 @@ Size.WIDTH_CONTROLS_HEIGHT = 1; * * @name Phaser.Structs.Size.HEIGHT_CONTROLS_WIDTH * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.HEIGHT_CONTROLS_WIDTH = 2; @@ -78885,7 +83941,7 @@ Size.HEIGHT_CONTROLS_WIDTH = 2; * * @name Phaser.Structs.Size.FIT * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.FIT = 3; @@ -78895,7 +83951,7 @@ Size.FIT = 3; * * @name Phaser.Structs.Size.ENVELOP * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.ENVELOP = 4; @@ -78904,7 +83960,7 @@ module.exports = Size; /***/ }), -/* 384 */ +/* 394 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -78914,14 +83970,14 @@ module.exports = Size; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(133); +var CONST = __webpack_require__(139); var Events = __webpack_require__(20); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); var GetValue = __webpack_require__(6); -var LoaderEvents = __webpack_require__(84); +var LoaderEvents = __webpack_require__(89); var NOOP = __webpack_require__(1); -var Scene = __webpack_require__(385); -var Systems = __webpack_require__(190); +var Scene = __webpack_require__(395); +var Systems = __webpack_require__(195); /** * @classdesc @@ -78929,7 +83985,7 @@ var Systems = __webpack_require__(190); * * The Scene Manager is a Game level system, responsible for creating, processing and updating all of the * Scenes in a Game instance. - * +ó * * * @class SceneManager * @memberof Phaser.Scenes @@ -80065,33 +85121,39 @@ var SceneManager = new Class({ if (scene) { + var sys = scene.sys; + // If the Scene is already running (perhaps they called start from a launched sub-Scene?) // then we close it down before starting it again. - if (scene.sys.isActive() || scene.sys.isPaused()) + if (sys.isActive() || sys.isPaused()) { - scene.sys.shutdown(); + sys.shutdown(); - scene.sys.start(data); + sys.sceneUpdate = NOOP; + + sys.start(data); } else { - scene.sys.start(data); + sys.sceneUpdate = NOOP; + + sys.start(data); var loader; - if (scene.sys.load) + if (sys.load) { - loader = scene.sys.load; + loader = sys.load; } // Files payload? - if (loader && scene.sys.settings.hasOwnProperty('pack')) + if (loader && sys.settings.hasOwnProperty('pack')) { loader.reset(); - if (loader.addPack({ payload: scene.sys.settings.pack })) + if (loader.addPack({ payload: sys.settings.pack })) { - scene.sys.settings.status = CONST.LOADING; + sys.settings.status = CONST.LOADING; loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this); @@ -80170,7 +85232,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#getAt * @since 3.0.0 * - * @param {integer} index - The index of the Scene to retrieve. + * @param {number} index - The index of the Scene to retrieve. * * @return {(Phaser.Scene|undefined)} The Scene. */ @@ -80187,7 +85249,7 @@ var SceneManager = new Class({ * * @param {(string|Phaser.Scene)} key - The key of the Scene. * - * @return {integer} The index of the Scene. + * @return {number} The index of the Scene. */ getIndex: function (key) { @@ -80542,7 +85604,7 @@ module.exports = SceneManager; /***/ }), -/* 385 */ +/* 395 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80552,7 +85614,7 @@ module.exports = SceneManager; */ var Class = __webpack_require__(0); -var Systems = __webpack_require__(190); +var Systems = __webpack_require__(195); /** * @classdesc @@ -80806,6 +85868,15 @@ var Scene = new Class({ * @since 3.0.0 */ this.plugins; + + /** + * A reference to the renderer instance Phaser is using, either Canvas or WebGL. + * + * @name Phaser.Scene#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.50.0 + */ + this.renderer; }, /** @@ -80828,7 +85899,7 @@ module.exports = Scene; /***/ }), -/* 386 */ +/* 396 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80838,7 +85909,7 @@ module.exports = Scene; */ var GetFastValue = __webpack_require__(2); -var UppercaseFirst = __webpack_require__(191); +var UppercaseFirst = __webpack_require__(196); /** * Builds an array of which physics plugins should be activated for the given Scene. @@ -80890,7 +85961,7 @@ module.exports = GetPhysicsPlugins; /***/ }), -/* 387 */ +/* 397 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80937,7 +86008,7 @@ module.exports = GetScenePlugins; /***/ }), -/* 388 */ +/* 398 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80946,10 +86017,10 @@ module.exports = GetScenePlugins; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(133); +var CONST = __webpack_require__(139); var GetValue = __webpack_require__(6); -var Merge = __webpack_require__(134); -var InjectionMap = __webpack_require__(908); +var Merge = __webpack_require__(140); +var InjectionMap = __webpack_require__(964); /** * @namespace Phaser.Scenes.Settings @@ -81033,7 +86104,7 @@ module.exports = Settings; /***/ }), -/* 389 */ +/* 399 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -81042,18 +86113,18 @@ module.exports = Settings; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); -var CanvasTexture = __webpack_require__(390); +var CanvasPool = __webpack_require__(31); +var CanvasTexture = __webpack_require__(400); var Class = __webpack_require__(0); -var Color = __webpack_require__(32); -var CONST = __webpack_require__(34); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(130); -var GameEvents = __webpack_require__(21); -var GenerateTexture = __webpack_require__(355); +var Color = __webpack_require__(36); +var CONST = __webpack_require__(39); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(136); +var GameEvents = __webpack_require__(23); +var GenerateTexture = __webpack_require__(364); var GetValue = __webpack_require__(6); -var Parser = __webpack_require__(392); -var Texture = __webpack_require__(192); +var Parser = __webpack_require__(402); +var Texture = __webpack_require__(197); /** * @callback EachTextureCallback @@ -81142,7 +86213,7 @@ var TextureManager = new Class({ * An counting value used for emitting 'ready' event after all of managers in game is loaded. * * @name Phaser.Textures.TextureManager#_pending - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -81161,13 +86232,16 @@ var TextureManager = new Class({ */ boot: function () { - this._pending = 2; - this.on(Events.LOAD, this.updatePending, this); this.on(Events.ERROR, this.updatePending, this); - this.addBase64('__DEFAULT', this.game.config.defaultImage); - this.addBase64('__MISSING', this.game.config.missingImage); + var config = this.game.config; + + this.addBase64('__DEFAULT', config.defaultImage); + this.addBase64('__MISSING', config.missingImage); + this.addBase64('__WHITE', config.whiteImage); + + this._pending = 3; this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, @@ -81282,6 +86356,10 @@ var TextureManager = new Class({ /** * Adds a new Texture to the Texture Manager created from the given Base64 encoded data. * + * It works by creating an `Image` DOM object, then setting the `src` attribute to + * the given base64 encoded data. As a result, the process is asynchronous by its nature, + * so be sure to listen for the events this method dispatches before using the texture. + * * @method Phaser.Textures.TextureManager#addBase64 * @fires Phaser.Textures.Events#ADD * @fires Phaser.Textures.Events#ERROR @@ -81290,7 +86368,7 @@ var TextureManager = new Class({ * * @param {string} key - The unique string-based key of the Texture. * @param {*} data - The Base64 encoded data. - * + * * @return {this} This Texture Manager instance. */ addBase64: function (key, data) @@ -81325,9 +86403,9 @@ var TextureManager = new Class({ /** * Gets an existing texture frame and converts it into a base64 encoded image and returns the base64 data. - * + * * You can also provide the image type and encoder options. - * + * * This will only work with bitmap based texture frames, such as those created from Texture Atlases. * It will not work with GL Texture objects, such as Shaders, or Render Textures. For those please * see the WebGL Snapshot function instead. @@ -81336,10 +86414,10 @@ var TextureManager = new Class({ * @since 3.12.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. * @param {string} [type='image/png'] - A DOMString indicating the image format. The default format type is image/png. * @param {number} [encoderOptions=0.92] - A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. If this argument is anything else, the default value for image quality is used. The default value is 0.92. Other arguments are ignored. - * + * * @return {string} The base64 encoded data, or an empty string if the texture frame could not be found. */ getBase64: function (key, frame, type, encoderOptions) @@ -81412,15 +86490,18 @@ var TextureManager = new Class({ this.emit(Events.ADD, key, texture); } - + return texture; }, /** * Takes a WebGL Texture and creates a Phaser Texture from it, which is added to the Texture Manager using the given key. - * + * * This allows you to then use the Texture as a normal texture for texture based Game Objects like Sprites. - * + * + * If the `width` and `height` arguments are omitted, but the WebGL Texture was created by Phaser's WebGL Renderer + * and has `glTexture.width` and `glTexture.height` properties, these values will be used instead. + * * This is a WebGL only feature. * * @method Phaser.Textures.TextureManager#addGLTexture @@ -81429,8 +86510,8 @@ var TextureManager = new Class({ * * @param {string} key - The unique string-based key of the Texture. * @param {WebGLTexture} glTexture - The source Render Texture. - * @param {number} width - The new width of the Texture. - * @param {number} height - The new height of the Texture. + * @param {number} [width] - The new width of the Texture. Read from `glTexture.width` if omitted. + * @param {number} [height] - The new height of the Texture. Read from `glTexture.height` if omitted. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -81440,13 +86521,16 @@ var TextureManager = new Class({ if (this.checkKey(key)) { + if (width === undefined) { width = glTexture.width; } + if (height === undefined) { height = glTexture.height; } + texture = this.create(key, glTexture, width, height); texture.add('__BASE', 0, 0, 0, width, height); this.emit(Events.ADD, key, texture); } - + return texture; }, @@ -81475,17 +86559,17 @@ var TextureManager = new Class({ this.emit(Events.ADD, key, texture); } - + return texture; }, /** * Creates a new Texture using the given config values. - * + * * Generated textures consist of a Canvas element to which the texture data is drawn. - * + * * Generates a texture based on the given Create configuration object. - * + * * The texture is drawn using a fixed-size indexed palette of 16 colors, where the hex value in the * data cells map to a single color. For example, if the texture config looked like this: * @@ -81504,14 +86588,14 @@ var TextureManager = new Class({ * '.27887.78872.', * '.787.....787.' * ]; - * + * * this.textures.generate('star', { data: star, pixelWidth: 4 }); * ``` - * + * * Then it would generate a texture that is 52 x 48 pixels in size, because each cell of the data array * represents 1 pixel multiplied by the `pixelWidth` value. The cell values, such as `8`, maps to color * number 8 in the palette. If a cell contains a period character `.` then it is transparent. - * + * * The default palette is Arne16, but you can specify your own using the `palette` property. * * @method Phaser.Textures.TextureManager#generate @@ -81550,8 +86634,8 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {integer} [width=256] - The width of the Canvas element. - * @param {integer} [height=256] - The height of the Canvas element. + * @param {number} [width=256] - The width of the Canvas element. + * @param {number} [height=256] - The height of the Canvas element. * * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. */ @@ -81755,7 +86839,7 @@ var TextureManager = new Class({ if (this.checkKey(key)) { texture = this.create(key, source); - + Parser.AtlasXML(texture, 0, data); if (dataSource) @@ -81901,8 +86985,8 @@ var TextureManager = new Class({ * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. - * @param {integer} width - The width of the Texture. - * @param {integer} height - The height of the Texture. + * @param {number} width - The width of the Texture. + * @param {number} height - The height of the Texture. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -81937,11 +87021,11 @@ var TextureManager = new Class({ /** * Returns a Texture from the Texture Manager that matches the given key. - * + * * If the key is `undefined` it will return the `__DEFAULT` Texture. - * + * * If the key is an instance of a Texture, it will return the key directly. - * + * * Finally. if the key is given, but not found and not a Texture instance, it will return the `__MISSING` Texture. * * @method Phaser.Textures.TextureManager#get @@ -81976,7 +87060,7 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame to be cloned. + * @param {(string|number)} frame - The string or index of the Frame to be cloned. * * @return {Phaser.Textures.Frame} A Clone of the given Frame. */ @@ -81995,7 +87079,7 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. * * @return {Phaser.Textures.Frame} A Texture Frame object. */ @@ -82039,10 +87123,10 @@ var TextureManager = new Class({ * @method Phaser.Textures.TextureManager#getPixel * @since 3.0.0 * - * @param {integer} x - The x coordinate of the pixel within the Texture. - * @param {integer} y - The y coordinate of the pixel within the Texture. + * @param {number} x - The x coordinate of the pixel within the Texture. + * @param {number} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string or index of the Frame. + * @param {(string|number)} [frame] - The string or index of the Frame. * * @return {?Phaser.Display.Color} A Color object populated with the color values of the requested pixel, * or `null` if the coordinates were out of bounds. @@ -82086,12 +87170,12 @@ var TextureManager = new Class({ * @method Phaser.Textures.TextureManager#getPixelAlpha * @since 3.10.0 * - * @param {integer} x - The x coordinate of the pixel within the Texture. - * @param {integer} y - The y coordinate of the pixel within the Texture. + * @param {number} x - The x coordinate of the pixel within the Texture. + * @param {number} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string or index of the Frame. + * @param {(string|number)} [frame] - The string or index of the Frame. * - * @return {integer} A value between 0 and 255, or `null` if the coordinates were out of bounds. + * @return {number} A value between 0 and 255, or `null` if the coordinates were out of bounds. */ getPixelAlpha: function (x, y, key, frame) { @@ -82114,9 +87198,9 @@ var TextureManager = new Class({ ctx.clearRect(0, 0, 1, 1); ctx.drawImage(textureFrame.source.image, x, y, 1, 1, 0, 0, 1, 1); - + var rgb = ctx.getImageData(0, 0, 1, 1); - + return rgb.data[3]; } } @@ -82133,7 +87217,7 @@ var TextureManager = new Class({ * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the texture would be set on. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string or index of the Frame. + * @param {(string|number)} [frame] - The string or index of the Frame. * * @return {Phaser.GameObjects.GameObject} The Game Object the texture was set on. */ @@ -82150,9 +87234,9 @@ var TextureManager = new Class({ /** * Changes the key being used by a Texture to the new key provided. - * + * * The old key is removed, allowing it to be re-used. - * + * * Game Objects are linked to Textures by a reference to the Texture object, so * all existing references will be retained. * @@ -82235,7 +87319,7 @@ module.exports = TextureManager; /***/ }), -/* 390 */ +/* 400 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -82245,11 +87329,11 @@ module.exports = TextureManager; */ var Class = __webpack_require__(0); -var Clamp = __webpack_require__(17); -var Color = __webpack_require__(32); -var CONST = __webpack_require__(34); -var IsSizePowerOfTwo = __webpack_require__(128); -var Texture = __webpack_require__(192); +var Clamp = __webpack_require__(16); +var Color = __webpack_require__(36); +var CONST = __webpack_require__(39); +var IsSizePowerOfTwo = __webpack_require__(133); +var Texture = __webpack_require__(197); /** * @classdesc @@ -82263,10 +87347,10 @@ var Texture = __webpack_require__(192); * you should call `CanvasTexture.refresh()` once you are finished with your changes to the canvas. Try and keep * this to a minimum, especially on large canvas sizes, or you may inadvertently thrash the GPU by constantly uploading * texture data to it. This restriction does not apply if using the Canvas Renderer. - * + * * It starts with only one frame that covers the whole of the canvas. You can add further frames, that specify * sections of the canvas using the `add` method. - * + * * Should you need to resize the canvas use the `setSize` method so that it accurately updates all of the underlying * texture data as well. Forgetting to do this (i.e. by changing the canvas size directly from your code) could cause * graphical errors. @@ -82280,8 +87364,8 @@ var Texture = __webpack_require__(192); * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. * @param {string} key - The unique string-based key of this Texture. * @param {HTMLCanvasElement} source - The canvas element that is used as the base of this texture. - * @param {integer} width - The width of the canvas. - * @param {integer} height - The height of the canvas. + * @param {number} width - The width of the canvas. + * @param {number} height - The height of the canvas. */ var CanvasTexture = new Class({ @@ -82331,7 +87415,7 @@ var CanvasTexture = new Class({ * * @name Phaser.Textures.CanvasTexture#width * @readonly - * @type {integer} + * @type {number} * @since 3.7.0 */ this.width = width; @@ -82342,7 +87426,7 @@ var CanvasTexture = new Class({ * * @name Phaser.Textures.CanvasTexture#height * @readonly - * @type {integer} + * @type {number} * @since 3.7.0 */ this.height = height; @@ -82456,11 +87540,11 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#draw * @since 3.13.0 - * - * @param {integer} x - The x coordinate to draw the source at. - * @param {integer} y - The y coordinate to draw the source at. + * + * @param {number} x - The x coordinate to draw the source at. + * @param {number} y - The y coordinate to draw the source at. * @param {(HTMLImageElement|HTMLCanvasElement)} source - The element to draw to this canvas. - * + * * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. */ draw: function (x, y, source) @@ -82476,12 +87560,12 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#drawFrame * @since 3.16.0 - * + * * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. - * @param {integer} [x=0] - The x coordinate to draw the source at. - * @param {integer} [y=0] - The y coordinate to draw the source at. - * + * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {number} [x=0] - The x coordinate to draw the source at. + * @param {number} [y=0] - The y coordinate to draw the source at. + * * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. */ drawFrame: function (key, frame, x, y) @@ -82524,14 +87608,14 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#setPixel * @since 3.16.0 - * - * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255. - * + * + * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. + * * @return {this} This CanvasTexture. */ setPixel: function (x, y, red, green, blue, alpha) @@ -82563,15 +87647,15 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#putData * @since 3.16.0 - * + * * @param {ImageData} imageData - The ImageData to put at the given location. - * @param {integer} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. - * @param {integer} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. - * @param {integer} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. - * @param {integer} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. - * + * @param {number} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {number} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {number} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. + * @param {number} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. + * * @return {this} This CanvasTexture. */ putData: function (imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) @@ -82592,12 +87676,12 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#getData * @since 3.16.0 - * - * @param {integer} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. - * @param {integer} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. - * + * + * @param {number} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. + * @param {number} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. + * * @return {ImageData} The ImageData extracted from this CanvasTexture. */ getData: function (x, y, width, height) @@ -82614,17 +87698,17 @@ var CanvasTexture = new Class({ /** * Get the color of a specific pixel from this texture and store it in a Color object. - * + * * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. * * @method Phaser.Textures.CanvasTexture#getPixel * @since 3.13.0 - * - * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * + * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. * @param {Phaser.Display.Color} [out] - A Color object to store the pixel values in. If not provided a new Color object will be created. - * + * * @return {Phaser.Display.Color} An object with the red, green, blue and alpha values set in the r, g, b and a properties. */ getPixel: function (x, y, out) @@ -82656,18 +87740,18 @@ var CanvasTexture = new Class({ * * If the requested region extends outside the bounds of this CanvasTexture, * the region is truncated to fit. - * + * * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. * * @method Phaser.Textures.CanvasTexture#getPixels * @since 3.16.0 - * - * @param {integer} [x=0] - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} [y=0] - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} [width] - The width of the region to get. Must be an integer. Defaults to the canvas width if not given. - * @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. - * + * + * @param {number} [x=0] - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} [y=0] - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} [width] - The width of the region to get. Must be an integer. Defaults to the canvas width if not given. + * @param {number} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. + * * @return {Phaser.Types.Textures.PixelConfig[][]} A 2d array of Pixel objects. */ getPixels: function (x, y, width, height) @@ -82716,11 +87800,11 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#getIndex * @since 3.16.0 - * - * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * - * @return {integer} + * + * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * + * @return {number} */ getIndex: function (x, y) { @@ -82786,11 +87870,11 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#clear * @since 3.7.0 - * - * @param {integer} [x=0] - The x coordinate of the top-left of the region to clear. - * @param {integer} [y=0] - The y coordinate of the top-left of the region to clear. - * @param {integer} [width] - The width of the region. - * @param {integer} [height] - The height of the region. + * + * @param {number} [x=0] - The x coordinate of the top-left of the region to clear. + * @param {number} [y=0] - The y coordinate of the top-left of the region to clear. + * @param {number} [width] - The width of the region. + * @param {number} [height] - The height of the region. * * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. */ @@ -82812,8 +87896,8 @@ var CanvasTexture = new Class({ * @method Phaser.Textures.CanvasTexture#setSize * @since 3.7.0 * - * @param {integer} width - The new width of the Canvas. - * @param {integer} [height] - The new height of the Canvas. If not given it will use the width as the height. + * @param {number} width - The new width of the Canvas. + * @param {number} [height] - The new height of the Canvas. If not given it will use the width as the height. * * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. */ @@ -82870,7 +87954,7 @@ module.exports = CanvasTexture; /***/ }), -/* 391 */ +/* 401 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -82879,10 +87963,10 @@ module.exports = CanvasTexture; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); -var IsSizePowerOfTwo = __webpack_require__(128); -var ScaleModes = __webpack_require__(247); +var IsSizePowerOfTwo = __webpack_require__(133); +var ScaleModes = __webpack_require__(260); /** * @classdesc @@ -82899,8 +87983,8 @@ var ScaleModes = __webpack_require__(247); * * @param {Phaser.Textures.Texture} texture - The Texture this TextureSource belongs to. * @param {(HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|Phaser.GameObjects.RenderTexture|WebGLTexture)} source - The source image data. - * @param {integer} [width] - Optional width of the source image. If not given it's derived from the source itself. - * @param {integer} [height] - Optional height of the source image. If not given it's derived from the source itself. + * @param {number} [width] - Optional width of the source image. If not given it's derived from the source itself. + * @param {number} [height] - Optional height of the source image. If not given it's derived from the source itself. * @param {boolean} [flipY=false] - Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. */ var TextureSource = new Class({ @@ -82957,7 +88041,7 @@ var TextureSource = new Class({ * Currently un-used. * * @name Phaser.Textures.TextureSource#compressionAlgorithm - * @type {integer} + * @type {number} * @default null * @since 3.0.0 */ @@ -82978,7 +88062,7 @@ var TextureSource = new Class({ * the `naturalWidth` and then `width` properties of the source image. * * @name Phaser.Textures.TextureSource#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width = width || source.naturalWidth || source.videoWidth || source.width || 0; @@ -82988,7 +88072,7 @@ var TextureSource = new Class({ * the `naturalHeight` and then `height` properties of the source image. * * @name Phaser.Textures.TextureSource#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height = height || source.naturalHeight || source.videoHeight || source.height || 0; @@ -83214,7 +88298,7 @@ var TextureSource = new Class({ { if (this.glTexture) { - this.renderer.deleteTexture(this.glTexture); + this.renderer.deleteTexture(this.glTexture, false); } if (this.isCanvas) @@ -83235,7 +88319,7 @@ module.exports = TextureSource; /***/ }), -/* 392 */ +/* 402 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83250,20 +88334,20 @@ module.exports = TextureSource; module.exports = { - AtlasXML: __webpack_require__(909), - Canvas: __webpack_require__(910), - Image: __webpack_require__(911), - JSONArray: __webpack_require__(912), - JSONHash: __webpack_require__(913), - SpriteSheet: __webpack_require__(914), - SpriteSheetFromAtlas: __webpack_require__(915), - UnityYAML: __webpack_require__(916) + AtlasXML: __webpack_require__(965), + Canvas: __webpack_require__(966), + Image: __webpack_require__(967), + JSONArray: __webpack_require__(968), + JSONHash: __webpack_require__(969), + SpriteSheet: __webpack_require__(970), + SpriteSheetFromAtlas: __webpack_require__(971), + UnityYAML: __webpack_require__(972) }; /***/ }), -/* 393 */ +/* 403 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83273,9 +88357,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HTML5AudioSoundManager = __webpack_require__(394); -var NoAudioSoundManager = __webpack_require__(397); -var WebAudioSoundManager = __webpack_require__(399); +var HTML5AudioSoundManager = __webpack_require__(404); +var NoAudioSoundManager = __webpack_require__(407); +var WebAudioSoundManager = __webpack_require__(409); /** * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings. @@ -83286,7 +88370,7 @@ var WebAudioSoundManager = __webpack_require__(399); * @since 3.0.0 * * @param {Phaser.Game} game - Reference to the current game instance. - * + * * @return {(Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager|Phaser.Sound.NoAudioSoundManager)} The Sound Manager instance that was created. */ var SoundManagerCreator = { @@ -83296,12 +88380,12 @@ var SoundManagerCreator = { var audioConfig = game.config.audio; var deviceAudio = game.device.audio; - if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) { return new NoAudioSoundManager(game); } - if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) + if (deviceAudio.webAudio && !audioConfig.disableWebAudio) { return new WebAudioSoundManager(game); } @@ -83315,7 +88399,7 @@ module.exports = SoundManagerCreator; /***/ }), -/* 394 */ +/* 404 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83325,10 +88409,10 @@ module.exports = SoundManagerCreator; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSoundManager = __webpack_require__(135); +var BaseSoundManager = __webpack_require__(141); var Class = __webpack_require__(0); -var Events = __webpack_require__(61); -var HTML5AudioSound = __webpack_require__(396); +var Events = __webpack_require__(66); +var HTML5AudioSound = __webpack_require__(406); /** * HTML5 Audio implementation of the Sound Manager. @@ -83784,7 +88868,7 @@ module.exports = HTML5AudioSoundManager; /***/ }), -/* 395 */ +/* 405 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83793,7 +88877,7 @@ module.exports = HTML5AudioSoundManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Returns the first element in the array. @@ -83811,8 +88895,8 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {string} [property] - The property to test on each array element. * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=array.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=array.length] - An optional end index to search up to (but not included) * * @return {object} The first matching element from the array, or `null` if no element could be found in the range given. */ @@ -83843,7 +88927,7 @@ module.exports = GetFirst; /***/ }), -/* 396 */ +/* 406 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83853,10 +88937,10 @@ module.exports = GetFirst; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSound = __webpack_require__(136); +var BaseSound = __webpack_require__(142); var Class = __webpack_require__(0); -var Events = __webpack_require__(61); -var Clamp = __webpack_require__(17); +var Events = __webpack_require__(66); +var Clamp = __webpack_require__(16); /** * @classdesc @@ -84773,7 +89857,7 @@ module.exports = HTML5AudioSound; /***/ }), -/* 397 */ +/* 407 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84783,10 +89867,10 @@ module.exports = HTML5AudioSound; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSoundManager = __webpack_require__(135); +var BaseSoundManager = __webpack_require__(141); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var NoAudioSound = __webpack_require__(398); +var EventEmitter = __webpack_require__(10); +var NoAudioSound = __webpack_require__(408); var NOOP = __webpack_require__(1); /** @@ -84891,7 +89975,7 @@ module.exports = NoAudioSoundManager; /***/ }), -/* 398 */ +/* 408 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -84901,10 +89985,10 @@ module.exports = NoAudioSoundManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSound = __webpack_require__(136); +var BaseSound = __webpack_require__(142); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Extend = __webpack_require__(19); +var EventEmitter = __webpack_require__(10); +var Extend = __webpack_require__(18); var returnFalse = function () { @@ -85082,7 +90166,7 @@ module.exports = NoAudioSound; /***/ }), -/* 399 */ +/* 409 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85092,11 +90176,11 @@ module.exports = NoAudioSound; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Base64ToArrayBuffer = __webpack_require__(400); -var BaseSoundManager = __webpack_require__(135); +var Base64ToArrayBuffer = __webpack_require__(410); +var BaseSoundManager = __webpack_require__(141); var Class = __webpack_require__(0); -var Events = __webpack_require__(61); -var WebAudioSound = __webpack_require__(401); +var Events = __webpack_require__(66); +var WebAudioSound = __webpack_require__(411); /** * @classdesc @@ -85195,7 +90279,7 @@ var WebAudioSoundManager = new Class({ { var audioConfig = game.config.audio; - if (audioConfig && audioConfig.context) + if (audioConfig.context) { audioConfig.context.resume(); @@ -85442,7 +90526,7 @@ var WebAudioSoundManager = new Class({ this.masterMuteNode.disconnect(); this.masterMuteNode = null; - if (this.game.config.audio && this.game.config.audio.context) + if (this.game.config.audio.context) { this.context.suspend(); } @@ -85545,7 +90629,7 @@ module.exports = WebAudioSoundManager; /***/ }), -/* 400 */ +/* 410 */ /***/ (function(module, exports) { /** @@ -85620,7 +90704,7 @@ module.exports = Base64ToArrayBuffer; /***/ }), -/* 401 */ +/* 411 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85630,9 +90714,9 @@ module.exports = Base64ToArrayBuffer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSound = __webpack_require__(136); +var BaseSound = __webpack_require__(142); var Class = __webpack_require__(0); -var Events = __webpack_require__(61); +var Events = __webpack_require__(66); /** * @classdesc @@ -86526,7 +91610,7 @@ module.exports = WebAudioSound; /***/ }), -/* 402 */ +/* 412 */ /***/ (function(module, exports) { /** @@ -86540,12 +91624,26 @@ module.exports = WebAudioSound; * * The transpose of a matrix is a new matrix whose rows are the columns of the original. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.TransposeMatrix * @since 3.0.0 - * + * * @generic T * @genericUse {T[][]} - [array,$return] - * + * * @param {T[][]} [array] - The array matrix to transpose. * * @return {T[][]} A new array matrix which is a transposed version of the given array. @@ -86574,7 +91672,7 @@ module.exports = TransposeMatrix; /***/ }), -/* 403 */ +/* 413 */ /***/ (function(module, exports) { /** @@ -86615,9 +91713,9 @@ function defaultCompare (a, b) * @since 3.0.0 * * @param {array} arr - The array to sort. - * @param {integer} k - The k-th element index. - * @param {integer} [left=0] - The index of the left part of the range. - * @param {integer} [right] - The index of the right part of the range. + * @param {number} k - The k-th element index. + * @param {number} [left=0] - The index of the left part of the range. + * @param {number} [right] - The index of the right part of the range. * @param {function} [compare] - An optional comparison function. Is passed two elements and should return 0, 1 or -1. */ var QuickSelect = function (arr, k, left, right, compare) @@ -86696,7 +91794,7 @@ module.exports = QuickSelect; /***/ }), -/* 404 */ +/* 414 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86706,7 +91804,7 @@ module.exports = QuickSelect; */ var GetValue = __webpack_require__(6); -var Shuffle = __webpack_require__(121); +var Shuffle = __webpack_require__(127); var BuildChunk = function (a, b, qty) { @@ -86834,7 +91932,7 @@ module.exports = Range; /***/ }), -/* 405 */ +/* 415 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86849,14 +91947,14 @@ module.exports = Range; module.exports = { - PROCESS_QUEUE_ADD: __webpack_require__(967), - PROCESS_QUEUE_REMOVE: __webpack_require__(968) + PROCESS_QUEUE_ADD: __webpack_require__(1024), + PROCESS_QUEUE_REMOVE: __webpack_require__(1025) }; /***/ }), -/* 406 */ +/* 416 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86896,7 +91994,7 @@ var BuildGameObjectAnimation = function (sprite, config) { // { anims: { // key: string - // startFrame: [string|integer] + // startFrame: [string|number] // delay: [float] // repeat: [integer] // repeatDelay: [float] @@ -86953,7 +92051,7 @@ module.exports = BuildGameObjectAnimation; /***/ }), -/* 407 */ +/* 417 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86963,7 +92061,7 @@ module.exports = BuildGameObjectAnimation; */ var Class = __webpack_require__(0); -var Frame = __webpack_require__(97); +var Frame = __webpack_require__(104); /** * @classdesc @@ -86989,7 +92087,7 @@ var Frame = __webpack_require__(97); * @param {Phaser.GameObjects.Blitter} blitter - The parent Blitter object is responsible for updating this Bob. * @param {number} x - The horizontal position of this Game Object in the world, relative to the parent Blitter position. * @param {number} y - The vertical position of this Game Object in the world, relative to the parent Blitter position. - * @param {(string|integer)} frame - The Frame this Bob will render with, as defined in the Texture the parent Blitter is using. + * @param {(string|number)} frame - The Frame this Bob will render with, as defined in the Texture the parent Blitter is using. * @param {boolean} visible - Should the Bob render visible or not to start with? */ var Bob = new Class({ @@ -87108,7 +92206,7 @@ var Bob = new Class({ * @method Phaser.GameObjects.Bob#setFrame * @since 3.0.0 * - * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. * * @return {this} This Bob Game Object. */ @@ -87158,7 +92256,7 @@ var Bob = new Class({ * * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. - * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. * * @return {this} This Bob Game Object. */ @@ -87257,7 +92355,7 @@ var Bob = new Class({ /** * Sets the visibility of this Bob. - * + * * An invisible Bob will skip rendering. * * @method Phaser.GameObjects.Bob#setVisible @@ -87277,7 +92375,7 @@ var Bob = new Class({ /** * Set the Alpha level of this Bob. The alpha controls the opacity of the Game Object as it renders. * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. - * + * * A Bob with alpha 0 will skip rendering. * * @method Phaser.GameObjects.Bob#setAlpha @@ -87331,7 +92429,7 @@ var Bob = new Class({ /** * The visible state of the Bob. - * + * * An invisible Bob will skip rendering. * * @name Phaser.GameObjects.Bob#visible @@ -87355,7 +92453,7 @@ var Bob = new Class({ /** * The alpha value of the Bob, between 0 and 1. - * + * * A Bob with alpha 0 will skip rendering. * * @name Phaser.GameObjects.Bob#alpha @@ -87383,7 +92481,7 @@ module.exports = Bob; /***/ }), -/* 408 */ +/* 418 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87425,7 +92523,7 @@ module.exports = Union; /***/ }), -/* 409 */ +/* 419 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87436,13 +92534,13 @@ module.exports = Union; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DOMElementRender = __webpack_require__(981); +var DOMElementRender = __webpack_require__(1038); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); +var GameObjectEvents = __webpack_require__(32); var IsPlainObject = __webpack_require__(7); -var RemoveFromDOM = __webpack_require__(188); +var RemoveFromDOM = __webpack_require__(193); var SCENE_EVENTS = __webpack_require__(20); -var Vector4 = __webpack_require__(129); +var Vector4 = __webpack_require__(135); /** * @classdesc @@ -88421,7 +93519,7 @@ module.exports = DOMElement; /***/ }), -/* 410 */ +/* 420 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -88430,8 +93528,13 @@ module.exports = DOMElement; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CSSBlendModes = __webpack_require__(982); +var CSSBlendModes = __webpack_require__(1039); var GameObject = __webpack_require__(14); +var TransformMatrix = __webpack_require__(24); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -88444,11 +93547,10 @@ var GameObject = __webpack_require__(14); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active renderer. * @param {Phaser.GameObjects.DOMElement} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var DOMElementCSSRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var DOMElementCSSRenderer = function (renderer, src, camera, parentMatrix) { var node = src.node; var style = node.style; @@ -88460,7 +93562,7 @@ var DOMElementCSSRenderer = function (renderer, src, interpolationPercentage, ca { style.display = 'none'; } - + return; } @@ -88472,9 +93574,9 @@ var DOMElementCSSRenderer = function (renderer, src, interpolationPercentage, ca alpha *= parent.alpha; } - var camMatrix = renderer._tempMatrix1; - var srcMatrix = renderer._tempMatrix2; - var calcMatrix = renderer._tempMatrix3; + var camMatrix = tempMatrix1; + var srcMatrix = tempMatrix2; + var calcMatrix = tempMatrix3; var dx = 0; var dy = 0; @@ -88505,9 +93607,9 @@ var DOMElementCSSRenderer = function (renderer, src, interpolationPercentage, ca { dx = (src.width) * src.originX; dy = (src.height) * src.originY; - + srcMatrix.applyITRS(src.x - dx, src.y - dy, src.rotation, src.scaleX, src.scaleY); - + camMatrix.copyFrom(camera.matrix); tx = (100 * src.originX) + '%'; @@ -88543,7 +93645,7 @@ module.exports = DOMElementCSSRenderer; /***/ }), -/* 411 */ +/* 421 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -88555,8 +93657,8 @@ module.exports = DOMElementCSSRenderer; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); -var ExternRender = __webpack_require__(986); +var GameObjectEvents = __webpack_require__(32); +var ExternRender = __webpack_require__(1043); /** * @classdesc @@ -88655,7 +93757,7 @@ module.exports = Extern; /***/ }), -/* 412 */ +/* 422 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -88664,8 +93766,8 @@ module.exports = Extern; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CircumferencePoint = __webpack_require__(204); -var FromPercent = __webpack_require__(89); +var CircumferencePoint = __webpack_require__(209); +var FromPercent = __webpack_require__(94); var MATH_CONST = __webpack_require__(13); var Point = __webpack_require__(4); @@ -88698,7 +93800,7 @@ module.exports = GetPoint; /***/ }), -/* 413 */ +/* 423 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -88707,9 +93809,9 @@ module.exports = GetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circumference = __webpack_require__(414); -var CircumferencePoint = __webpack_require__(204); -var FromPercent = __webpack_require__(89); +var Circumference = __webpack_require__(424); +var CircumferencePoint = __webpack_require__(209); +var FromPercent = __webpack_require__(94); var MATH_CONST = __webpack_require__(13); /** @@ -88722,7 +93824,7 @@ var MATH_CONST = __webpack_require__(13); * @generic {Phaser.Geom.Point[]} O - [out,$return] * * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the points from. - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. * @param {(array|Phaser.Geom.Point[])} [out] - An array to insert the points in to. If not provided a new array will be created. * @@ -88752,7 +93854,7 @@ module.exports = GetPoints; /***/ }), -/* 414 */ +/* 424 */ /***/ (function(module, exports) { /** @@ -88784,7 +93886,7 @@ module.exports = Circumference; /***/ }), -/* 415 */ +/* 425 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -88793,8 +93895,8 @@ module.exports = Circumference; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Commands = __webpack_require__(203); -var SetTransform = __webpack_require__(28); +var Commands = __webpack_require__(208); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -88807,13 +93909,12 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Graphics} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested * @param {CanvasRenderingContext2D} [renderTargetCtx] - The target rendering context. * @param {boolean} allowClip - If `true` then path operations will be used instead of fill operations. */ -var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix, renderTargetCtx, allowClip) +var GraphicsCanvasRenderer = function (renderer, src, camera, parentMatrix, renderTargetCtx, allowClip) { var commandBuffer = src.commandBuffer; var commandBufferLength = commandBuffer.length; @@ -89019,10 +94120,6 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c case Commands.GRADIENT_LINE_STYLE: index += 6; break; - - case Commands.SET_TEXTURE: - index += 2; - break; } } @@ -89034,7 +94131,7 @@ module.exports = GraphicsCanvasRenderer; /***/ }), -/* 416 */ +/* 426 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89044,10 +94141,10 @@ module.exports = GraphicsCanvasRenderer; */ var Class = __webpack_require__(0); -var FloatBetween = __webpack_require__(127); -var GetEaseFunction = __webpack_require__(71); +var FloatBetween = __webpack_require__(132); +var GetEaseFunction = __webpack_require__(78); var GetFastValue = __webpack_require__(2); -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * @classdesc @@ -89273,6 +94370,10 @@ var EmitterOp = new Class({ var t = typeof value; + // Reset them in case they're not changed below + this.onEmit = this.defaultEmit; + this.onUpdate = this.defaultUpdate; + if (t === 'number') { // Explicit static value: @@ -89309,28 +94410,17 @@ var EmitterOp = new Class({ this.onUpdate = value; } } - else if (t === 'object' && (this.has(value, 'random') || this.hasBoth(value, 'start', 'end') || this.hasBoth(value, 'min', 'max'))) + else if (t === 'object' && this.hasBoth(value, 'start', 'end')) { - this.start = this.has(value, 'start') ? value.start : value.min; - this.end = this.has(value, 'end') ? value.end : value.max; + this.start = value.start; + this.end = value.end; - var isRandom = (this.hasBoth(value, 'min', 'max') || !!value.random); + // x: { start: 100, end: 400, random: true } (random optional) = eases between start and end - // A random starting value (using 'min | max' instead of 'start | end' automatically implies a random value) - - // x: { start: 100, end: 400, random: true } OR { min: 100, max: 400 } OR { random: [ 100, 400 ] } + var isRandom = this.has(value, 'random'); if (isRandom) { - var rnd = value.random; - - // x: { random: [ 100, 400 ] } = the same as doing: x: { start: 100, end: 400, random: true } - if (Array.isArray(rnd)) - { - this.start = rnd[0]; - this.end = rnd[1]; - } - this.onEmit = this.randomRangedValueEmit; } @@ -89355,19 +94445,38 @@ var EmitterOp = new Class({ var easeType = this.has(value, 'ease') ? value.ease : 'Linear'; - this.ease = GetEaseFunction(easeType); + this.ease = GetEaseFunction(easeType, value.easeParams); if (!isRandom) { this.onEmit = this.easedValueEmit; } - // BUG: alpha, rotate, scaleX, scaleY, or tint are eased here if {min, max} is given. - // Probably this branch should exclude isRandom entirely. - this.onUpdate = this.easeValueUpdate; } } + else if (t === 'object' && this.hasBoth(value, 'min', 'max')) + { + // { min: 100, max: 400 } = pick a random number between min and max + + this.start = value.min; + this.end = value.max; + this.onEmit = this.randomRangedValueEmit; + } + else if (t === 'object' && this.has(value, 'random')) + { + // { random: [ 100, 400 ] } = pick a random number between the two elements of the array + + var rnd = value.random; + + if (Array.isArray(rnd)) + { + this.start = rnd[0]; + this.end = rnd[1]; + } + + this.onEmit = this.randomRangedValueEmit; + } else if (t === 'object' && this.hasEither(value, 'onEmit', 'onUpdate')) { // Custom onEmit and onUpdate callbacks @@ -89625,7 +94734,7 @@ module.exports = EmitterOp; /***/ }), -/* 417 */ +/* 427 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89844,7 +94953,7 @@ module.exports = GravityWell; /***/ }), -/* 418 */ +/* 428 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89854,8 +94963,8 @@ module.exports = GravityWell; */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(41); -var DistanceBetween = __webpack_require__(55); +var DegToRad = __webpack_require__(34); +var DistanceBetween = __webpack_require__(61); /** * @classdesc @@ -90040,7 +95149,7 @@ var Particle = new Class({ * The tint applied to this Particle. * * @name Phaser.GameObjects.Particles.Particle#tint - * @type {integer} + * @type {number} * @webglOnly * @since 3.0.0 */ @@ -90150,11 +95259,6 @@ var Particle = new Class({ if (x === undefined) { - if (emitter.follow) - { - this.x += emitter.follow.x + emitter.followOffset.x; - } - this.x += emitter.x.onEmit(this, 'x'); } else @@ -90164,11 +95268,6 @@ var Particle = new Class({ if (y === undefined) { - if (emitter.follow) - { - this.y += emitter.follow.y + emitter.followOffset.y; - } - this.y += emitter.y.onEmit(this, 'y'); } else @@ -90413,7 +95512,7 @@ module.exports = Particle; /***/ }), -/* 419 */ +/* 429 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90422,22 +95521,22 @@ module.exports = Particle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(54); +var BlendModes = __webpack_require__(48); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DeathZone = __webpack_require__(420); -var EdgeZone = __webpack_require__(421); -var EmitterOp = __webpack_require__(416); +var DeathZone = __webpack_require__(430); +var EdgeZone = __webpack_require__(431); +var EmitterOp = __webpack_require__(426); var GetFastValue = __webpack_require__(2); -var GetRandom = __webpack_require__(196); -var HasAny = __webpack_require__(422); -var HasValue = __webpack_require__(115); -var Particle = __webpack_require__(418); -var RandomZone = __webpack_require__(423); +var GetRandom = __webpack_require__(201); +var HasAny = __webpack_require__(432); +var HasValue = __webpack_require__(123); +var Particle = __webpack_require__(428); +var RandomZone = __webpack_require__(433); var Rectangle = __webpack_require__(9); -var StableSort = __webpack_require__(139); +var StableSort = __webpack_require__(90); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * @classdesc @@ -90785,14 +95884,14 @@ var ParticleEmitter = new Class({ this.scaleY = new EmitterOp(config, 'scaleY', 1); /** - * Color tint applied to emitted particles. Any alpha component (0xAA000000) is ignored. + * Color tint applied to emitted particles. Value must not include the alpha channel. * * @name Phaser.GameObjects.Particles.ParticleEmitter#tint * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0xffffffff + * @default 0xffffff * @since 3.0.0 */ - this.tint = new EmitterOp(config, 'tint', 0xffffffff); + this.tint = new EmitterOp(config, 'tint', 0xffffff); /** * The alpha (transparency) of emitted particles. @@ -90882,7 +95981,7 @@ var ParticleEmitter = new Class({ * 0 means unlimited. * * @name Phaser.GameObjects.Particles.ParticleEmitter#maxParticles - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -91059,7 +96158,7 @@ var ParticleEmitter = new Class({ * The blend mode of this emitter's particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#blendMode - * @type {integer} + * @type {number} * @since 3.0.0 * @see Phaser.GameObjects.Particles.ParticleEmitter#setBlendMode */ @@ -91103,7 +96202,7 @@ var ParticleEmitter = new Class({ * The current texture frame, as an index of {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#currentFrame - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame @@ -91125,7 +96224,7 @@ var ParticleEmitter = new Class({ * The number of consecutive particles that receive a single texture frame (per frame cycle). * * @name Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity - * @type {integer} + * @type {number} * @default 1 * @since 3.0.0 * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame @@ -91167,7 +96266,7 @@ var ParticleEmitter = new Class({ * Counts up to {@link Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#_frameCounter - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -91281,6 +96380,11 @@ var ParticleEmitter = new Class({ this.setFrame(config.frame); } + if (HasValue(config, 'reserve')) + { + this.reserve(config.reserve); + } + return this; }, @@ -91423,9 +96527,9 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setFrame * @since 3.0.0 * - * @param {(array|string|integer|Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig)} frames - One or more texture frames, or a configuration object. + * @param {(array|string|number|Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig)} frames - One or more texture frames, or a configuration object. * @param {boolean} [pickRandom=true] - Whether frames should be assigned at random from `frames`. - * @param {integer} [quantity=1] - The number of consecutive particles that will receive each frame. + * @param {number} [quantity=1] - The number of consecutive particles that will receive each frame. * * @return {this} This Particle Emitter. */ @@ -91947,7 +97051,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#reserve * @since 3.0.0 * - * @param {integer} particleCount - The number of particles to create. + * @param {number} particleCount - The number of particles to create. * * @return {this} This Particle Emitter. */ @@ -91969,7 +97073,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#getAliveParticleCount * @since 3.0.0 * - * @return {integer} The number of particles with `active=true`. + * @return {number} The number of particles with `active=true`. */ getAliveParticleCount: function () { @@ -91982,7 +97086,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#getDeadParticleCount * @since 3.0.0 * - * @return {integer} The number of particles with `active=false`. + * @return {number} The number of particles with `active=false`. */ getDeadParticleCount: function () { @@ -91995,7 +97099,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#getParticleCount * @since 3.0.0 * - * @return {integer} The number of particles, including both alive and dead. + * @return {number} The number of particles, including both alive and dead. */ getParticleCount: function () { @@ -92277,7 +97381,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#explode * @since 3.0.0 * - * @param {integer} count - The amount of Particles to emit. + * @param {number} count - The amount of Particles to emit. * @param {number} x - The x coordinate to emit the Particles from. * @param {number} y - The y coordinate to emit the Particles from. * @@ -92298,7 +97402,7 @@ var ParticleEmitter = new Class({ * * @param {number} [x=this.x] - The x coordinate to emit the Particles from. * @param {number} [y=this.x] - The y coordinate to emit the Particles from. - * @param {integer} [count=this.quantity] - The number of Particles to emit. + * @param {number} [count=this.quantity] - The number of Particles to emit. * * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. */ @@ -92313,7 +97417,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticle * @since 3.0.0 * - * @param {integer} [count=this.quantity] - The number of Particles to emit. + * @param {number} [count=this.quantity] - The number of Particles to emit. * @param {number} [x=this.x] - The x coordinate to emit the Particles from. * @param {number} [y=this.x] - The y coordinate to emit the Particles from. * @@ -92375,7 +97479,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#preUpdate * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ preUpdate: function (time, delta) @@ -92471,7 +97575,7 @@ var ParticleEmitter = new Class({ * @param {object} a - The first particle. * @param {object} b - The second particle. * - * @return {integer} The difference of a and b's y coordinates. + * @return {number} The difference of a and b's y coordinates. */ depthSortCallback: function (a, b) { @@ -92484,7 +97588,7 @@ module.exports = ParticleEmitter; /***/ }), -/* 420 */ +/* 430 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92562,7 +97666,7 @@ module.exports = DeathZone; /***/ }), -/* 421 */ +/* 431 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92583,7 +97687,7 @@ var Class = __webpack_require__(0); * @since 3.0.0 * * @param {Phaser.Types.GameObjects.Particles.EdgeZoneSource} source - An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. - * @param {integer} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. + * @param {number} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. * @param {number} stepRate - The distance between each particle. When set, `quantity` is implied and should be set to 0. * @param {boolean} [yoyo=false] - Whether particles are placed from start to end and then end to start. * @param {boolean} [seamless=true] - Whether one endpoint will be removed if it's identical to the other. @@ -92620,7 +97724,7 @@ var EdgeZone = new Class({ * The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. * * @name Phaser.GameObjects.Particles.Zones.EdgeZone#quantity - * @type {integer} + * @type {number} * @since 3.0.0 */ this.quantity = quantity; @@ -92806,7 +97910,7 @@ module.exports = EdgeZone; /***/ }), -/* 422 */ +/* 432 */ /***/ (function(module, exports) { /** @@ -92843,7 +97947,7 @@ module.exports = HasAny; /***/ }), -/* 423 */ +/* 433 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92857,7 +97961,7 @@ var Vector2 = __webpack_require__(3); /** * @classdesc - * A zone that places particles randomly within a shape's area. + * A zone that places particles randomly within a shapes area. * * @class RandomZone * @memberof Phaser.GameObjects.Particles.Zones @@ -92916,7 +98020,7 @@ module.exports = RandomZone; /***/ }), -/* 424 */ +/* 434 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92927,7 +98031,7 @@ module.exports = RandomZone; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Sprite = __webpack_require__(76); +var Sprite = __webpack_require__(70); /** * @classdesc @@ -92955,7 +98059,7 @@ var Sprite = __webpack_require__(76); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ var PathFollower = new Class({ @@ -92983,7 +98087,7 @@ var PathFollower = new Class({ * @protected * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ preUpdate: function (time, delta) @@ -92998,7 +98102,7 @@ module.exports = PathFollower; /***/ }), -/* 425 */ +/* 435 */ /***/ (function(module, exports) { /** @@ -93080,7 +98184,7 @@ module.exports = GetTextSize; /***/ }), -/* 426 */ +/* 436 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93092,7 +98196,7 @@ module.exports = GetTextSize; var Class = __webpack_require__(0); var GetAdvancedValue = __webpack_require__(15); var GetValue = __webpack_require__(6); -var MeasureText = __webpack_require__(427); +var MeasureText = __webpack_require__(437); // Key: [ Object Key, Default Value ] @@ -93298,7 +98402,7 @@ var TextStyle = new Class({ * The maximum number of lines to draw. * * @name Phaser.GameObjects.TextStyle#maxLines - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -94115,7 +99219,7 @@ var TextStyle = new Class({ * @method Phaser.GameObjects.TextStyle#setMaxLines * @since 3.0.0 * - * @param {integer} [max=0] - The maximum number of lines to draw. + * @param {number} [max=0] - The maximum number of lines to draw. * * @return {Phaser.GameObjects.Text} The parent Text object. */ @@ -94186,7 +99290,7 @@ module.exports = TextStyle; /***/ }), -/* 427 */ +/* 437 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94195,7 +99299,7 @@ module.exports = TextStyle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); +var CanvasPool = __webpack_require__(31); /** * Calculates the ascent, descent and fontSize of a given font style. @@ -94209,15 +99313,28 @@ var CanvasPool = __webpack_require__(26); */ var MeasureText = function (textStyle) { - // @property {HTMLCanvasElement} canvas - The canvas element that the text is rendered. var canvas = CanvasPool.create(this); - - // @property {HTMLCanvasElement} context - The context of the canvas element that the text is rendered to. var context = canvas.getContext('2d'); textStyle.syncFont(canvas, context); - var width = Math.ceil(context.measureText(textStyle.testString).width * textStyle.baselineX); + var metrics = context.measureText(textStyle.testString); + + if (metrics.hasOwnProperty('actualBoundingBoxAscent')) + { + var ascent = metrics.actualBoundingBoxAscent; + var descent = metrics.actualBoundingBoxDescent; + + CanvasPool.remove(canvas); + + return { + ascent: ascent, + descent: descent, + fontSize: ascent + descent + }; + } + + var width = Math.ceil(metrics.width * textStyle.baselineX); var baseline = width; var height = 2 * baseline; @@ -94321,7 +99438,7 @@ module.exports = MeasureText; /***/ }), -/* 428 */ +/* 438 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94330,13 +99447,13 @@ module.exports = MeasureText; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArcRender = __webpack_require__(1020); +var ArcRender = __webpack_require__(1080); var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(41); -var Earcut = __webpack_require__(60); -var GeomCircle = __webpack_require__(68); +var DegToRad = __webpack_require__(34); +var Earcut = __webpack_require__(65); +var GeomCircle = __webpack_require__(71); var MATH_CONST = __webpack_require__(13); -var Shape = __webpack_require__(30); +var Shape = __webpack_require__(33); /** * @classdesc @@ -94366,8 +99483,8 @@ var Shape = __webpack_require__(30); * @param {number} [x=0] - The horizontal position of this Game Object in the world. * @param {number} [y=0] - The vertical position of this Game Object in the world. * @param {number} [radius=128] - The radius of the arc. - * @param {integer} [startAngle=0] - The start angle of the arc, in degrees. - * @param {integer} [endAngle=360] - The end angle of the arc, in degrees. + * @param {number} [startAngle=0] - The start angle of the arc, in degrees. + * @param {number} [endAngle=360] - The end angle of the arc, in degrees. * @param {boolean} [anticlockwise=false] - The winding order of the start and end angles. * @param {number} [fillColor] - The color the arc will be filled with, i.e. 0xff0000 for red. * @param {number} [fillAlpha] - The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. @@ -94397,7 +99514,7 @@ var Arc = new Class({ * Private internal value. Holds the start angle in degrees. * * @name Phaser.GameObjects.Arc#_startAngle - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -94407,7 +99524,7 @@ var Arc = new Class({ * Private internal value. Holds the end angle in degrees. * * @name Phaser.GameObjects.Arc#_endAngle - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -94504,7 +99621,7 @@ var Arc = new Class({ * The start angle of the arc, in degrees. * * @name Phaser.GameObjects.Arc#startAngle - * @type {integer} + * @type {number} * @since 3.13.0 */ startAngle: { @@ -94527,7 +99644,7 @@ var Arc = new Class({ * The end angle of the arc, in degrees. * * @name Phaser.GameObjects.Arc#endAngle - * @type {integer} + * @type {number} * @since 3.13.0 */ endAngle: { @@ -94616,7 +99733,7 @@ var Arc = new Class({ * @method Phaser.GameObjects.Arc#setStartAngle * @since 3.13.0 * - * @param {integer} value - The value to set the starting angle to. + * @param {number} value - The value to set the starting angle to. * * @return {this} This Game Object instance. */ @@ -94639,7 +99756,7 @@ var Arc = new Class({ * @method Phaser.GameObjects.Arc#setEndAngle * @since 3.13.0 * - * @param {integer} value - The value to set the ending angle to. + * @param {number} value - The value to set the ending angle to. * * @return {this} This Game Object instance. */ @@ -94730,7 +99847,7 @@ module.exports = Arc; /***/ }), -/* 429 */ +/* 439 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94740,10 +99857,10 @@ module.exports = Arc; */ var Class = __webpack_require__(0); -var CurveRender = __webpack_require__(1023); -var Earcut = __webpack_require__(60); +var CurveRender = __webpack_require__(1083); +var Earcut = __webpack_require__(65); var Rectangle = __webpack_require__(9); -var Shape = __webpack_require__(30); +var Shape = __webpack_require__(33); /** * @classdesc @@ -94797,7 +99914,7 @@ var Curve = new Class({ * The number of points used to draw the curve. Higher values create smoother renders at the cost of more triangles being drawn. * * @name Phaser.GameObjects.Curve#_smoothness - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -94831,7 +99948,7 @@ var Curve = new Class({ * Increase this value for smoother curves, at the cost of more polygons being rendered. * * @name Phaser.GameObjects.Curve#smoothness - * @type {integer} + * @type {number} * @default 32 * @since 3.13.0 */ @@ -94859,7 +99976,7 @@ var Curve = new Class({ * @method Phaser.GameObjects.Curve#setSmoothness * @since 3.13.0 * - * @param {integer} value - The value to set the smoothness to. + * @param {number} value - The value to set the smoothness to. * * @return {this} This Game Object instance. */ @@ -94912,7 +100029,7 @@ module.exports = Curve; /***/ }), -/* 430 */ +/* 440 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94922,10 +100039,10 @@ module.exports = Curve; */ var Class = __webpack_require__(0); -var Earcut = __webpack_require__(60); -var EllipseRender = __webpack_require__(1026); -var GeomEllipse = __webpack_require__(98); -var Shape = __webpack_require__(30); +var Earcut = __webpack_require__(65); +var EllipseRender = __webpack_require__(1086); +var GeomEllipse = __webpack_require__(106); +var Shape = __webpack_require__(33); /** * @classdesc @@ -94983,7 +100100,7 @@ var Ellipse = new Class({ * The number of points used to draw the curve. Higher values create smoother renders at the cost of more triangles being drawn. * * @name Phaser.GameObjects.Ellipse#_smoothness - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -95008,7 +100125,7 @@ var Ellipse = new Class({ * Increase this value for a smoother ellipse, at the cost of more polygons being rendered. * * @name Phaser.GameObjects.Ellipse#smoothness - * @type {integer} + * @type {number} * @default 64 * @since 3.13.0 */ @@ -95042,6 +100159,9 @@ var Ellipse = new Class({ */ setSize: function (width, height) { + this.width = width; + this.height = height; + this.geom.setPosition(width / 2, height / 2); this.geom.setSize(width, height); return this.updateData(); @@ -95055,7 +100175,7 @@ var Ellipse = new Class({ * @method Phaser.GameObjects.Ellipse#setSmoothness * @since 3.13.0 * - * @param {integer} value - The value to set the smoothness to. + * @param {number} value - The value to set the smoothness to. * * @return {this} This Game Object instance. */ @@ -95099,7 +100219,7 @@ module.exports = Ellipse; /***/ }), -/* 431 */ +/* 441 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95109,8 +100229,8 @@ module.exports = Ellipse; */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(30); -var GridRender = __webpack_require__(1029); +var Shape = __webpack_require__(33); +var GridRender = __webpack_require__(1089); /** * @classdesc @@ -95256,7 +100376,11 @@ var Grid = new Class({ this.setSize(width, height); this.setFillStyle(fillColor, fillAlpha); - this.setOutlineStyle(outlineFillColor, outlineFillAlpha); + + if (outlineFillColor !== undefined) + { + this.setOutlineStyle(outlineFillColor, outlineFillAlpha); + } this.updateDisplayOrigin(); }, @@ -95374,7 +100498,7 @@ module.exports = Grid; /***/ }), -/* 432 */ +/* 442 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95383,9 +100507,9 @@ module.exports = Grid; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var IsoBoxRender = __webpack_require__(1032); +var IsoBoxRender = __webpack_require__(1092); var Class = __webpack_require__(0); -var Shape = __webpack_require__(30); +var Shape = __webpack_require__(33); /** * @classdesc @@ -95444,7 +100568,7 @@ var IsoBox = new Class({ * The projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. * * @name Phaser.GameObjects.IsoBox#projection - * @type {integer} + * @type {number} * @default 4 * @since 3.13.0 */ @@ -95522,7 +100646,7 @@ var IsoBox = new Class({ * @method Phaser.GameObjects.IsoBox#setProjection * @since 3.13.0 * - * @param {integer} value - The value to set the projection to. + * @param {number} value - The value to set the projection to. * * @return {this} This Game Object instance. */ @@ -95589,7 +100713,7 @@ module.exports = IsoBox; /***/ }), -/* 433 */ +/* 443 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95599,8 +100723,8 @@ module.exports = IsoBox; */ var Class = __webpack_require__(0); -var IsoTriangleRender = __webpack_require__(1035); -var Shape = __webpack_require__(30); +var IsoTriangleRender = __webpack_require__(1095); +var Shape = __webpack_require__(33); /** * @classdesc @@ -95662,7 +100786,7 @@ var IsoTriangle = new Class({ * The projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. * * @name Phaser.GameObjects.IsoTriangle#projection - * @type {integer} + * @type {number} * @default 4 * @since 3.13.0 */ @@ -95750,7 +100874,7 @@ var IsoTriangle = new Class({ * @method Phaser.GameObjects.IsoTriangle#setProjection * @since 3.13.0 * - * @param {integer} value - The value to set the projection to. + * @param {number} value - The value to set the projection to. * * @return {this} This Game Object instance. */ @@ -95835,7 +100959,7 @@ module.exports = IsoTriangle; /***/ }), -/* 434 */ +/* 444 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -95845,9 +100969,9 @@ module.exports = IsoTriangle; */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(30); -var GeomLine = __webpack_require__(40); -var LineRender = __webpack_require__(1038); +var Shape = __webpack_require__(33); +var GeomLine = __webpack_require__(45); +var LineRender = __webpack_require__(1098); /** * @classdesc @@ -95855,13 +100979,13 @@ var LineRender = __webpack_require__(1038); * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling * it for input or physics. It provides a quick and easy way for you to render this shape in your * game without using a texture, while still taking advantage of being fully batched in WebGL. - * + * * This shape supports only stroke colors and cannot be filled. - * + * * A Line Shape allows you to draw a line between two points in your game. You can control the * stroke color and thickness of the line. In WebGL only you can also specify a different * thickness for the start and end of the line, allowing you to render lines that taper-off. - * + * * If you need to draw multiple lines in a sequence you may wish to use the Polygon Shape instead. * * Be aware that as with all Game Objects the default origin is 0.5. If you need to draw a Line @@ -95904,8 +101028,8 @@ var Line = new Class({ Shape.call(this, scene, 'Line', new GeomLine(x1, y1, x2, y2)); - var width = this.geom.right - this.geom.left; - var height = this.geom.bottom - this.geom.top; + var width = Math.max(1, this.geom.right - this.geom.left); + var height = Math.max(1, this.geom.bottom - this.geom.top); /** * The width (or thickness) of the line. @@ -95950,15 +101074,15 @@ var Line = new Class({ /** * Sets the width of the line. - * + * * When using the WebGL renderer you can have different start and end widths. * When using the Canvas renderer only the `startWidth` value is used. The `endWidth` is ignored. - * + * * This call can be chained. * * @method Phaser.GameObjects.Line#setLineWidth * @since 3.13.0 - * + * * @param {number} startWidth - The start width of the line. * @param {number} [endWidth] - The end width of the line. Only used in WebGL. * @@ -96002,7 +101126,7 @@ module.exports = Line; /***/ }), -/* 435 */ +/* 445 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96011,13 +101135,13 @@ module.exports = Line; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PolygonRender = __webpack_require__(1041); +var PolygonRender = __webpack_require__(1101); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(60); -var GetAABB = __webpack_require__(436); -var GeomPolygon = __webpack_require__(212); -var Shape = __webpack_require__(30); -var Smooth = __webpack_require__(439); +var Earcut = __webpack_require__(65); +var GetAABB = __webpack_require__(446); +var GeomPolygon = __webpack_require__(218); +var Shape = __webpack_require__(33); +var Smooth = __webpack_require__(449); /** * @classdesc @@ -96092,7 +101216,7 @@ var Polygon = new Class({ * @method Phaser.GameObjects.Polygon#smooth * @since 3.13.0 * - * @param {integer} [iterations=1] - The number of times to apply the polygon smoothing. + * @param {number} [iterations=1] - The number of times to apply the polygon smoothing. * * @return {this} This Game Object instance. */ @@ -96141,7 +101265,7 @@ module.exports = Polygon; /***/ }), -/* 436 */ +/* 446 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96197,7 +101321,7 @@ module.exports = GetAABB; /***/ }), -/* 437 */ +/* 447 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96206,9 +101330,9 @@ module.exports = GetAABB; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); -var Line = __webpack_require__(40); -var Perimeter = __webpack_require__(438); +var Length = __webpack_require__(63); +var Line = __webpack_require__(45); +var Perimeter = __webpack_require__(448); /** * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, @@ -96218,7 +101342,7 @@ var Perimeter = __webpack_require__(438); * @since 3.12.0 * * @param {Phaser.Geom.Polygon} polygon - The Polygon to get the points from. - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the perimeter of the Polygon and dividing it by the stepRate. * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -96274,7 +101398,7 @@ module.exports = GetPoints; /***/ }), -/* 438 */ +/* 448 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96283,8 +101407,8 @@ module.exports = GetPoints; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); -var Line = __webpack_require__(40); +var Length = __webpack_require__(63); +var Line = __webpack_require__(45); /** * Returns the perimeter of the given Polygon. @@ -96322,7 +101446,7 @@ module.exports = Perimeter; /***/ }), -/* 439 */ +/* 449 */ /***/ (function(module, exports) { /** @@ -96398,7 +101522,7 @@ module.exports = Smooth; /***/ }), -/* 440 */ +/* 450 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96409,8 +101533,8 @@ module.exports = Smooth; var Class = __webpack_require__(0); var GeomRectangle = __webpack_require__(9); -var Shape = __webpack_require__(30); -var RectangleRender = __webpack_require__(1044); +var Shape = __webpack_require__(33); +var RectangleRender = __webpack_require__(1104); /** * @classdesc @@ -96541,7 +101665,7 @@ module.exports = Rectangle; /***/ }), -/* 441 */ +/* 451 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96550,10 +101674,10 @@ module.exports = Rectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var StarRender = __webpack_require__(1047); +var StarRender = __webpack_require__(1107); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(60); -var Shape = __webpack_require__(30); +var Earcut = __webpack_require__(65); +var Shape = __webpack_require__(33); /** * @classdesc @@ -96612,7 +101736,7 @@ var Star = new Class({ * The number of points in the star. * * @name Phaser.GameObjects.Star#_points - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -96659,7 +101783,7 @@ var Star = new Class({ * @method Phaser.GameObjects.Star#setPoints * @since 3.13.0 * - * @param {integer} value - The amount of points the Star will have. + * @param {number} value - The amount of points the Star will have. * * @return {this} This Game Object instance. */ @@ -96710,7 +101834,7 @@ var Star = new Class({ * The number of points that make up the Star shape. * * @name Phaser.GameObjects.Star#points - * @type {integer} + * @type {number} * @default 5 * @since 3.13.0 */ @@ -96829,7 +101953,7 @@ module.exports = Star; /***/ }), -/* 442 */ +/* 452 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96839,9 +101963,9 @@ module.exports = Star; */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(30); -var GeomTriangle = __webpack_require__(73); -var TriangleRender = __webpack_require__(1050); +var Shape = __webpack_require__(33); +var GeomTriangle = __webpack_require__(80); +var TriangleRender = __webpack_require__(1110); /** * @classdesc @@ -96972,7 +102096,7 @@ module.exports = Triangle; /***/ }), -/* 443 */ +/* 453 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -96982,7 +102106,7 @@ module.exports = Triangle; */ var Point = __webpack_require__(4); -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); /** * Returns a Point from around the perimeter of a Triangle. @@ -97059,7 +102183,7 @@ module.exports = GetPoint; /***/ }), -/* 444 */ +/* 454 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97068,7 +102192,7 @@ module.exports = GetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); var Point = __webpack_require__(4); /** @@ -97080,7 +102204,7 @@ var Point = __webpack_require__(4); * @generic {Phaser.Geom.Point} O - [out,$return] * * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the points from. - * @param {integer} quantity - The number of evenly spaced points to return. Set to 0 to return an arbitrary number of points based on the `stepRate`. + * @param {number} quantity - The number of evenly spaced points to return. Set to 0 to return an arbitrary number of points based on the `stepRate`. * @param {number} stepRate - If `quantity` is 0, the distance between each returned point. * @param {(array|Phaser.Geom.Point[])} [out] - An array to which the points should be appended. * @@ -97152,7 +102276,7 @@ module.exports = GetPoints; /***/ }), -/* 445 */ +/* 455 */ /***/ (function(module, exports) { /** @@ -97235,7 +102359,342 @@ module.exports = SetValue; /***/ }), -/* 446 */ +/* 456 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Face = __webpack_require__(111); +var Vertex = __webpack_require__(113); + +/** + * Generates a set of Face and Vertex objects by parsing the given data. + * + * This method will take vertex data in one of two formats, based on the `containsZ` parameter. + * + * If your vertex data are `x`, `y` pairs, then `containsZ` should be `false` (this is the default) + * + * If your vertex data is groups of `x`, `y` and `z` values, then the `containsZ` parameter must be true. + * + * The `uvs` parameter is a numeric array consisting of `u` and `v` pairs. + * + * The `normals` parameter is a numeric array consisting of `x`, `y` vertex normal values and, if `containsZ` is true, `z` values as well. + * + * The `indicies` parameter is an optional array that, if given, is an indexed list of vertices to be added. + * + * The `colors` parameter is an optional array, or single value, that if given sets the color of each vertex created. + * + * The `alphas` parameter is an optional array, or single value, that if given sets the alpha of each vertex created. + * + * When providing indexed data it is assumed that _all_ of the arrays are indexed, not just the vertices. + * + * The following example will create a 256 x 256 sized quad using an index array: + * + * ```javascript + * const vertices = [ + * -128, 128, + * 128, 128, + * -128, -128, + * 128, -128 + * ]; + * + * const uvs = [ + * 0, 1, + * 1, 1, + * 0, 0, + * 1, 0 + * ]; + * + * const indices = [ 0, 2, 1, 2, 3, 1 ]; + * + * GenerateVerts(vertices, uvs, indicies); + * ``` + * + * If the data is not indexed, it's assumed that the arrays all contain sequential data. + * + * @function Phaser.Geom.Mesh.GenerateVerts + * @since 3.50.0 + * + * @param {number[]} vertices - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} uvs - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + * + * @return {Phaser.Types.Geom.Mesh.GenerateVertsResult} The parsed Face and Vertex objects. + */ +var GenerateVerts = function (vertices, uvs, indicies, containsZ, normals, colors, alphas) +{ + if (containsZ === undefined) { containsZ = false; } + if (colors === undefined) { colors = 0xffffff; } + if (alphas === undefined) { alphas = 1; } + + if (vertices.length !== uvs.length) + { + console.warn('GenerateVerts: vertices and uvs count not equal'); + return; + } + + var result = { + faces: [], + verts: [] + }; + + var i; + + var x; + var y; + var z; + + var u; + var v; + + var color; + var alpha; + + var normalX; + var normalY; + var normalZ; + + var iInc = (containsZ) ? 3 : 2; + + var isColorArray = Array.isArray(colors); + var isAlphaArray = Array.isArray(alphas); + + if (Array.isArray(indicies) && indicies.length > 0) + { + for (i = 0; i < indicies.length; i++) + { + var index1 = indicies[i]; + var index2 = indicies[i] * 2; + var index3 = indicies[i] * iInc; + + x = vertices[index3]; + y = vertices[index3 + 1]; + z = (containsZ) ? vertices[index3 + 2] : 0; + + u = uvs[index2]; + v = uvs[index2 + 1]; + + color = (isColorArray) ? colors[index1] : colors; + alpha = (isAlphaArray) ? alphas[index1] : alphas; + + normalX = 0; + normalY = 0; + normalZ = 0; + + if (normals) + { + normalX = normals[index3]; + normalY = normals[index3 + 1]; + normalZ = (containsZ) ? normals[index3 + 2] : 0; + } + + result.verts.push(new Vertex(x, y, z, u, v, color, alpha, normalX, normalY, normalZ)); + } + } + else + { + var uvIndex = 0; + var colorIndex = 0; + + for (i = 0; i < vertices.length; i += iInc) + { + x = vertices[i]; + y = vertices[i + 1]; + z = (containsZ) ? vertices[i + 2] : 0; + + u = uvs[uvIndex]; + v = uvs[uvIndex + 1]; + + color = (isColorArray) ? colors[colorIndex] : colors; + alpha = (isAlphaArray) ? alphas[colorIndex] : alphas; + + normalX = 0; + normalY = 0; + normalZ = 0; + + if (normals) + { + normalX = normals[i]; + normalY = normals[i + 1]; + normalZ = (containsZ) ? normals[i + 2] : 0; + } + + result.verts.push(new Vertex(x, y, z, u, v, color, alpha, normalX, normalY, normalZ)); + + uvIndex += 2; + colorIndex++; + } + } + + for (i = 0; i < result.verts.length; i += 3) + { + var vert1 = result.verts[i]; + var vert2 = result.verts[i + 1]; + var vert3 = result.verts[i + 2]; + + result.faces.push(new Face(vert1, vert2, vert3)); + } + + return result; +}; + +module.exports = GenerateVerts; + + +/***/ }), +/* 457 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Face = __webpack_require__(111); +var Matrix4 = __webpack_require__(73); +var Vector3 = __webpack_require__(37); +var Vertex = __webpack_require__(113); + +var tempPosition = new Vector3(); +var tempRotation = new Vector3(); +var tempMatrix = new Matrix4(); + +/** + * This method will return an object containing Face and Vertex instances, generated + * from the parsed triangulated OBJ Model data given to this function. + * + * The obj data should have been parsed in advance via the ParseObj function: + * + * ```javascript + * var data = Phaser.Geom.Mesh.ParseObj(rawData, flipUV); + * + * var results = GenerateObjVerts(data); + * ``` + * + * Alternatively, you can parse obj files loaded via the OBJFile loader: + * + * ```javascript + * preload () + * { + * this.load.obj('alien', 'assets/3d/alien.obj); + * } + * + * var results = GenerateObjVerts(this.cache.obj.get('alien)); + * ``` + * + * Make sure your 3D package has triangulated the model data prior to exporting it. + * + * You can use the data returned by this function to populate the vertices of a Mesh Game Object. + * + * You may add multiple models to a single Mesh, although they will act as one when + * moved or rotated. You can scale the model data, should it be too small (or large) to visualize. + * You can also offset the model via the `x`, `y` and `z` parameters. + * + * @function Phaser.Geom.Mesh.GenerateObjVerts + * @since 3.50.0 + * + * @param {Phaser.Types.Geom.Mesh.OBJData} data - The parsed OBJ model data. + * @param {Phaser.GameObjects.Mesh} [mesh] - An optional Mesh Game Object. If given, the generated Faces will be automatically added to this Mesh. Set to `null` to skip. + * @param {number} [scale=1] - An amount to scale the model data by. Use this if the model has exported too small, or large, to see. + * @param {number} [x=0] - Translate the model x position by this amount. + * @param {number} [y=0] - Translate the model y position by this amount. + * @param {number} [z=0] - Translate the model z position by this amount. + * @param {number} [rotateX=0] - Rotate the model on the x axis by this amount, in radians. + * @param {number} [rotateY=0] - Rotate the model on the y axis by this amount, in radians. + * @param {number} [rotateZ=0] - Rotate the model on the z axis by this amount, in radians. + * @param {boolean} [zIsUp=true] - Is the z axis up (true), or is y axis up (false)? + * + * @return {Phaser.Types.Geom.Mesh.GenerateVertsResult} The parsed Face and Vertex objects. + */ +var GenerateObjVerts = function (data, mesh, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp) +{ + if (scale === undefined) { scale = 1; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (z === undefined) { z = 0; } + if (rotateX === undefined) { rotateX = 0; } + if (rotateY === undefined) { rotateY = 0; } + if (rotateZ === undefined) { rotateZ = 0; } + if (zIsUp === undefined) { zIsUp = true; } + + var result = { + faces: [], + verts: [] + }; + + var materials = data.materials; + + tempPosition.set(x, y, z); + tempRotation.set(rotateX, rotateY, rotateZ); + tempMatrix.fromRotationXYTranslation(tempRotation, tempPosition, zIsUp); + + for (var m = 0; m < data.models.length; m++) + { + var model = data.models[m]; + + var vertices = model.vertices; + var textureCoords = model.textureCoords; + var faces = model.faces; + + for (var i = 0; i < faces.length; i++) + { + var face = faces[i]; + + var v1 = face.vertices[0]; + var v2 = face.vertices[1]; + var v3 = face.vertices[2]; + + var m1 = vertices[v1.vertexIndex]; + var m2 = vertices[v2.vertexIndex]; + var m3 = vertices[v3.vertexIndex]; + + var t1 = v1.textureCoordsIndex; + var t2 = v2.textureCoordsIndex; + var t3 = v3.textureCoordsIndex; + + var uv1 = (t1 === -1) ? { u: 0, v: 1 } : textureCoords[t1]; + var uv2 = (t2 === -1) ? { u: 0, v: 0 } : textureCoords[t2]; + var uv3 = (t3 === -1) ? { u: 1, v: 1 } : textureCoords[t3]; + + var color = 0xffffff; + + if (face.material !== '' && materials[face.material]) + { + color = materials[face.material]; + } + + var vert1 = new Vertex(m1.x * scale, m1.y * scale, m1.z * scale, uv1.u, uv1.v, color).transformMat4(tempMatrix); + var vert2 = new Vertex(m2.x * scale, m2.y * scale, m2.z * scale, uv2.u, uv2.v, color).transformMat4(tempMatrix); + var vert3 = new Vertex(m3.x * scale, m3.y * scale, m3.z * scale, uv3.u, uv3.v, color).transformMat4(tempMatrix); + + result.verts.push(vert1, vert2, vert3); + result.faces.push(new Face(vert1, vert2, vert3)); + } + } + + if (mesh) + { + mesh.faces = mesh.faces.concat(result.faces); + mesh.vertices = mesh.vertices.concat(result.verts); + } + + return result; +}; + +module.exports = GenerateObjVerts; + + +/***/ }), +/* 458 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97245,7 +102704,7 @@ module.exports = SetValue; */ var Class = __webpack_require__(0); -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * @classdesc @@ -97726,7 +103185,7 @@ module.exports = Light; /***/ }), -/* 447 */ +/* 459 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97736,8 +103195,9 @@ module.exports = Light; */ var Class = __webpack_require__(0); -var Light = __webpack_require__(446); -var Utils = __webpack_require__(10); +var Light = __webpack_require__(458); +var Utils = __webpack_require__(12); +var PointLight = __webpack_require__(1169); /** * @callback LightForEach @@ -97820,13 +103280,18 @@ var LightsManager = new Class({ * Change this via the `maxLights` property in your game config, as it cannot be changed at runtime. * * @name Phaser.GameObjects.LightsManager#maxLights - * @type {integer} + * @type {number} * @readonly * @since 3.15.0 */ this.maxLights = -1; }, + addPointLight: function (x, y, color, radius, intensity) + { + return this.systems.displayList.add(new PointLight(this.scene, x, y, color, radius, intensity)); + }, + /** * Enable the Lights Manager. * @@ -97839,7 +103304,7 @@ var LightsManager = new Class({ { if (this.maxLights === -1) { - this.maxLights = this.scene.sys.game.renderer.config.maxLights; + this.maxLights = this.scene.sys.renderer.config.maxLights; } this.active = true; @@ -97963,7 +103428,7 @@ var LightsManager = new Class({ * @method Phaser.GameObjects.LightsManager#getMaxVisibleLights * @since 3.0.0 * - * @return {integer} The maximum number of Lights allowed to appear at once. + * @return {number} The maximum number of Lights allowed to appear at once. */ getMaxVisibleLights: function () { @@ -97976,7 +103441,7 @@ var LightsManager = new Class({ * @method Phaser.GameObjects.LightsManager#getLightCount * @since 3.0.0 * - * @return {integer} The number of Lights managed by this Lights Manager. + * @return {number} The number of Lights managed by this Lights Manager. */ getLightCount: function () { @@ -98095,7 +103560,7 @@ module.exports = LightsManager; /***/ }), -/* 448 */ +/* 460 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98104,23 +103569,24 @@ module.exports = LightsManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(49); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(55); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Geom */ var Geom = { - - Circle: __webpack_require__(1110), - Ellipse: __webpack_require__(1120), - Intersects: __webpack_require__(449), - Line: __webpack_require__(1140), - Point: __webpack_require__(1162), - Polygon: __webpack_require__(1176), - Rectangle: __webpack_require__(465), - Triangle: __webpack_require__(1209) + + Circle: __webpack_require__(1171), + Ellipse: __webpack_require__(1181), + Intersects: __webpack_require__(461), + Line: __webpack_require__(1201), + Mesh: __webpack_require__(1223), + Point: __webpack_require__(1226), + Polygon: __webpack_require__(1240), + Rectangle: __webpack_require__(479), + Triangle: __webpack_require__(1273) }; @@ -98131,7 +103597,7 @@ module.exports = Geom; /***/ }), -/* 449 */ +/* 461 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98146,39 +103612,39 @@ module.exports = Geom; module.exports = { - CircleToCircle: __webpack_require__(216), - CircleToRectangle: __webpack_require__(217), - GetCircleToCircle: __webpack_require__(1130), - GetCircleToRectangle: __webpack_require__(1131), - GetLineToCircle: __webpack_require__(218), - GetLineToLine: __webpack_require__(450), - GetLineToPoints: __webpack_require__(451), - GetLineToPolygon: __webpack_require__(452), - GetLineToRectangle: __webpack_require__(220), - GetRaysFromPointToPolygon: __webpack_require__(1132), - GetRectangleIntersection: __webpack_require__(1133), - GetRectangleToRectangle: __webpack_require__(1134), - GetRectangleToTriangle: __webpack_require__(1135), - GetTriangleToCircle: __webpack_require__(1136), - GetTriangleToLine: __webpack_require__(457), - GetTriangleToTriangle: __webpack_require__(1137), - LineToCircle: __webpack_require__(219), - LineToLine: __webpack_require__(86), - LineToRectangle: __webpack_require__(453), - PointToLine: __webpack_require__(461), - PointToLineSegment: __webpack_require__(1138), - RectangleToRectangle: __webpack_require__(143), - RectangleToTriangle: __webpack_require__(454), - RectangleToValues: __webpack_require__(1139), - TriangleToCircle: __webpack_require__(456), - TriangleToLine: __webpack_require__(458), - TriangleToTriangle: __webpack_require__(459) + CircleToCircle: __webpack_require__(222), + CircleToRectangle: __webpack_require__(223), + GetCircleToCircle: __webpack_require__(1191), + GetCircleToRectangle: __webpack_require__(1192), + GetLineToCircle: __webpack_require__(224), + GetLineToLine: __webpack_require__(462), + GetLineToPoints: __webpack_require__(463), + GetLineToPolygon: __webpack_require__(464), + GetLineToRectangle: __webpack_require__(226), + GetRaysFromPointToPolygon: __webpack_require__(1193), + GetRectangleIntersection: __webpack_require__(1194), + GetRectangleToRectangle: __webpack_require__(1195), + GetRectangleToTriangle: __webpack_require__(1196), + GetTriangleToCircle: __webpack_require__(1197), + GetTriangleToLine: __webpack_require__(469), + GetTriangleToTriangle: __webpack_require__(1198), + LineToCircle: __webpack_require__(225), + LineToLine: __webpack_require__(91), + LineToRectangle: __webpack_require__(465), + PointToLine: __webpack_require__(473), + PointToLineSegment: __webpack_require__(1199), + RectangleToRectangle: __webpack_require__(112), + RectangleToTriangle: __webpack_require__(466), + RectangleToValues: __webpack_require__(1200), + TriangleToCircle: __webpack_require__(468), + TriangleToLine: __webpack_require__(470), + TriangleToTriangle: __webpack_require__(471) }; /***/ }), -/* 450 */ +/* 462 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98187,7 +103653,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector3 = __webpack_require__(81); +var Vector3 = __webpack_require__(37); /** * Checks for intersection between the two line segments and returns the intersection point as a Vector3, @@ -98207,23 +103673,35 @@ var Vector3 = __webpack_require__(81); */ var GetLineToLine = function (line1, line2, out) { - var dx1 = line1.x2 - line1.x1; - var dy1 = line1.y2 - line1.y1; + var x1 = line1.x1; + var y1 = line1.y1; + var x2 = line1.x2; + var y2 = line1.y2; - var dx2 = line2.x2 - line2.x1; - var dy2 = line2.y2 - line2.y1; + var x3 = line2.x1; + var y3 = line2.y1; + var x4 = line2.x2; + var y4 = line2.y2; - var mag1 = Math.sqrt(dx1 * dx1 + dy1 * dy1); - var mag2 = Math.sqrt(dx2 * dx2 + dy2 * dy2); + var dx1 = x2 - x1; + var dy1 = y2 - y1; - // Parallel? - if (dx1 / mag1 === dx2 / mag2 && dy1 / mag1 === dy2 / mag2) + var dx2 = x4 - x3; + var dy2 = y4 - y3; + + var denom = dy2 * dx1 - dx2 * dy1; + + // Make sure there is not a division by zero - this also indicates that the lines are parallel. + // If numA and numB were both equal to zero the lines would be on top of each other (coincidental). + // This check is not done because it is not necessary for this implementation (the parallel check accounts for this). + + if (dx1 === 0 || denom === 0) { - return null; + return false; } - var T2 = (dx1 * (line2.y1 - line1.y1) + dy1 * (line1.x1 - line2.x1)) / (dx2 * dy1 - dy2 * dx1); - var T1 = (line2.x1 + dx2 * T2 - line1.x1) / dx1; + var T2 = (dx1 * (y3 - y1) + dy1 * (x1 - x3)) / (dx2 * dy1 - dy2 * dx1); + var T1 = (x3 + dx2 * T2 - x1) / dx1; // Intersects? if (T1 < 0 || T2 < 0 || T2 > 1) @@ -98237,8 +103715,8 @@ var GetLineToLine = function (line1, line2, out) } return out.set( - line1.x1 + dx1 * T1, - line1.y1 + dy1 * T1, + x1 + dx1 * T1, + y1 + dy1 * T1, T1 ); }; @@ -98247,7 +103725,7 @@ module.exports = GetLineToLine; /***/ }), -/* 451 */ +/* 463 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98256,9 +103734,9 @@ module.exports = GetLineToLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector3 = __webpack_require__(81); -var GetLineToLine = __webpack_require__(450); -var Line = __webpack_require__(40); +var Vector3 = __webpack_require__(37); +var GetLineToLine = __webpack_require__(462); +var Line = __webpack_require__(45); // Temp calculation segment var segment = new Line(); @@ -98324,7 +103802,7 @@ module.exports = GetLineToPoints; /***/ }), -/* 452 */ +/* 464 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98333,9 +103811,9 @@ module.exports = GetLineToPoints; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector3 = __webpack_require__(81); -var Vector4 = __webpack_require__(129); -var GetLineToPoints = __webpack_require__(451); +var Vector3 = __webpack_require__(37); +var Vector4 = __webpack_require__(135); +var GetLineToPoints = __webpack_require__(463); // Temp vec3 var tempIntersect = new Vector3(); @@ -98395,7 +103873,7 @@ module.exports = GetLineToPolygon; /***/ }), -/* 453 */ +/* 465 */ /***/ (function(module, exports) { /** @@ -98496,7 +103974,7 @@ module.exports = LineToRectangle; /***/ }), -/* 454 */ +/* 466 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98505,10 +103983,10 @@ module.exports = LineToRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LineToLine = __webpack_require__(86); -var Contains = __webpack_require__(50); -var ContainsArray = __webpack_require__(221); -var Decompose = __webpack_require__(455); +var LineToLine = __webpack_require__(91); +var Contains = __webpack_require__(56); +var ContainsArray = __webpack_require__(227); +var Decompose = __webpack_require__(467); /** * Checks for intersection between Rectangle shape and Triangle shape. @@ -98589,7 +104067,7 @@ module.exports = RectangleToTriangle; /***/ }), -/* 455 */ +/* 467 */ /***/ (function(module, exports) { /** @@ -98626,7 +104104,7 @@ module.exports = Decompose; /***/ }), -/* 456 */ +/* 468 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98635,8 +104113,8 @@ module.exports = Decompose; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LineToCircle = __webpack_require__(219); -var Contains = __webpack_require__(85); +var LineToCircle = __webpack_require__(225); +var Contains = __webpack_require__(110); /** * Checks if a Triangle and a Circle intersect. @@ -98691,7 +104169,7 @@ module.exports = TriangleToCircle; /***/ }), -/* 457 */ +/* 469 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98702,8 +104180,8 @@ module.exports = TriangleToCircle; */ var Point = __webpack_require__(4); -var TriangleToLine = __webpack_require__(458); -var LineToLine = __webpack_require__(86); +var TriangleToLine = __webpack_require__(470); +var LineToLine = __webpack_require__(91); /** * Checks if a Triangle and a Line intersect, and returns the intersection points as a Point object array. @@ -98750,7 +104228,7 @@ module.exports = GetTriangleToLine; /***/ }), -/* 458 */ +/* 470 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98759,12 +104237,11 @@ module.exports = GetTriangleToLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(85); -var LineToLine = __webpack_require__(86); +var LineToLine = __webpack_require__(91); /** * Checks if a Triangle and a Line intersect. - * + * * The Line intersects the Triangle if it starts inside of it, ends inside of it, or crosses any of the Triangle's sides. Thus, the Triangle is considered "solid". * * @function Phaser.Geom.Intersects.TriangleToLine @@ -98778,7 +104255,7 @@ var LineToLine = __webpack_require__(86); var TriangleToLine = function (triangle, line) { // If the Triangle contains either the start or end point of the line, it intersects - if (Contains(triangle, line.getPointA()) || Contains(triangle, line.getPointB())) + if (triangle.contains(line.x1, line.y1) || triangle.contains(line.x2, line.y2)) { return true; } @@ -98806,7 +104283,7 @@ module.exports = TriangleToLine; /***/ }), -/* 459 */ +/* 471 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98815,9 +104292,9 @@ module.exports = TriangleToLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ContainsArray = __webpack_require__(221); -var Decompose = __webpack_require__(460); -var LineToLine = __webpack_require__(86); +var ContainsArray = __webpack_require__(227); +var Decompose = __webpack_require__(472); +var LineToLine = __webpack_require__(91); /** * Checks if two Triangles intersect. @@ -98896,7 +104373,7 @@ module.exports = TriangleToTriangle; /***/ }), -/* 460 */ +/* 472 */ /***/ (function(module, exports) { /** @@ -98931,7 +104408,7 @@ module.exports = Decompose; /***/ }), -/* 461 */ +/* 473 */ /***/ (function(module, exports) { /** @@ -99001,7 +104478,7 @@ module.exports = PointToLine; /***/ }), -/* 462 */ +/* 474 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99011,8 +104488,8 @@ module.exports = PointToLine; */ var MATH_CONST = __webpack_require__(13); -var Wrap = __webpack_require__(59); -var Angle = __webpack_require__(87); +var Wrap = __webpack_require__(64); +var Angle = __webpack_require__(92); /** * Get the angle of the normal of the given line in radians. @@ -99035,7 +104512,401 @@ module.exports = NormalAngle; /***/ }), -/* 463 */ +/* 475 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var flip = true; + +var defaultModelName = 'untitled'; +var currentGroup = ''; +var currentMaterial = ''; + +/** + * @ignore + */ +function stripComments (line) +{ + var idx = line.indexOf('#'); + + return (idx > -1) ? line.substring(0, idx) : line; +} + +/** + * @ignore + */ +function currentModel (result) +{ + if (result.models.length === 0) + { + result.models.push({ + faces: [], + name: defaultModelName, + textureCoords: [], + vertexNormals: [], + vertices: [] + }); + } + + currentGroup = ''; + + return result.models[result.models.length - 1]; +} + +/** + * @ignore + */ +function parseObject (lineItems, result) +{ + var modelName = lineItems.length >= 2 ? lineItems[1] : defaultModelName; + + result.models.push({ + faces: [], + name: modelName, + textureCoords: [], + vertexNormals: [], + vertices: [] + }); + + currentGroup = ''; +} + +/** + * @ignore + */ +function parseGroup (lineItems) +{ + if (lineItems.length === 2) + { + currentGroup = lineItems[1]; + } +} + +/** + * @ignore + */ +function parseVertexCoords (lineItems, result) +{ + var len = lineItems.length; + + var x = (len >= 2) ? parseFloat(lineItems[1]) : 0; + var y = (len >= 3) ? parseFloat(lineItems[2]) : 0; + var z = (len >= 4) ? parseFloat(lineItems[3]) : 0; + + currentModel(result).vertices.push({ x: x, y: y, z: z }); +} + +/** + * @ignore + */ +function parseTextureCoords (lineItems, result) +{ + var len = lineItems.length; + + var u = (len >= 2) ? parseFloat(lineItems[1]) : 0; + var v = (len >= 3) ? parseFloat(lineItems[2]) : 0; + var w = (len >= 4) ? parseFloat(lineItems[3]) : 0; + + if (isNaN(u)) + { + u = 0; + } + + if (isNaN(v)) + { + v = 0; + } + + if (isNaN(w)) + { + w = 0; + } + + if (flip) + { + v = 1 - v; + } + + currentModel(result).textureCoords.push({ u: u, v: v, w: w }); +} + +/** + * @ignore + */ +function parseVertexNormal (lineItems, result) +{ + var len = lineItems.length; + + var x = (len >= 2) ? parseFloat(lineItems[1]) : 0; + var y = (len >= 3) ? parseFloat(lineItems[2]) : 0; + var z = (len >= 4) ? parseFloat(lineItems[3]) : 0; + + currentModel(result).vertexNormals.push({ x: x, y: y, z: z }); +} + +/** + * @ignore + */ +function parsePolygon (lineItems, result) +{ + var totalVertices = lineItems.length - 1; + + if (totalVertices < 3) + { + return; + } + + var face = { + group: currentGroup, + material: currentMaterial, + vertices: [] + }; + + for (var i = 0; i < totalVertices; i++) + { + var vertexString = lineItems[i + 1]; + var vertexValues = vertexString.split('/'); + var vvLen = vertexValues.length; + + if (vvLen < 1 || vvLen > 3) + { + continue; + } + + var vertexIndex = 0; + var textureCoordsIndex = 0; + var vertexNormalIndex = 0; + + vertexIndex = parseInt(vertexValues[0], 10); + + if (vvLen > 1 && vertexValues[1] !== '') + { + textureCoordsIndex = parseInt(vertexValues[1], 10); + } + + if (vvLen > 2) + { + vertexNormalIndex = parseInt(vertexValues[2], 10); + } + + if (vertexIndex !== 0) + { + // Negative vertex indices refer to the nth last defined vertex + // convert these to postive indices for simplicity + if (vertexIndex < 0) + { + vertexIndex = currentModel(result).vertices.length + 1 + vertexIndex; + } + + textureCoordsIndex -= 1; + vertexIndex -= 1; + vertexNormalIndex -= 1; + + face.vertices.push({ + textureCoordsIndex: textureCoordsIndex, + vertexIndex: vertexIndex, + vertexNormalIndex: vertexNormalIndex + }); + } + } + + currentModel(result).faces.push(face); +} + +/** + * @ignore + */ +function parseMtlLib (lineItems, result) +{ + if (lineItems.length >= 2) + { + result.materialLibraries.push(lineItems[1]); + } +} + +/** + * @ignore + */ +function parseUseMtl (lineItems) +{ + if (lineItems.length >= 2) + { + currentMaterial = lineItems[1]; + } +} + +/** + * Parses a Wavefront OBJ File, extracting the models from it and returning them in an array. + * + * The model data *must* be triangulated for a Mesh Game Object to be able to render it. + * + * @function Phaser.Geom.Mesh.ParseObj + * @since 3.50.0 + * + * @param {string} data - The OBJ File data as a raw string. + * @param {boolean} [flipUV=true] - Flip the UV coordinates? + * + * @return {Phaser.Types.Geom.Mesh.OBJData} The parsed model and material data. + */ +var ParseObj = function (data, flipUV) +{ + if (flipUV === undefined) { flipUV = true; } + + flip = flipUV; + + // Store results in here + var result = { + materials: {}, + materialLibraries: [], + models: [] + }; + + currentGroup = ''; + currentMaterial = ''; + + var lines = data.split('\n'); + + for (var i = 0; i < lines.length; i++) + { + var line = stripComments(lines[i]); + + var lineItems = line.replace(/\s\s+/g, ' ').trim().split(' '); + + switch (lineItems[0].toLowerCase()) + { + case 'o': + // Start A New Model + parseObject(lineItems, result); + break; + + case 'g': + // Start a new polygon group + parseGroup(lineItems); + break; + + case 'v': + // Define a vertex for the current model + parseVertexCoords(lineItems, result); + break; + + case 'vt': + // Texture Coords + parseTextureCoords(lineItems, result); + break; + + case 'vn': + // Define a vertex normal for the current model + parseVertexNormal(lineItems, result); + break; + + case 'f': + // Define a Face/Polygon + parsePolygon(lineItems, result); + break; + + case 'mtllib': + // Reference to a material library file (.mtl) + parseMtlLib(lineItems, result); + break; + + case 'usemtl': + // Sets the current material to be applied to polygons defined from this point forward + parseUseMtl(lineItems); + break; + } + } + + return result; +}; + +module.exports = ParseObj; + + +/***/ }), +/* 476 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetColor = __webpack_require__(100); + +/** + * Takes a Wavefront Material file and extracts the diffuse reflectivity of the named + * materials, converts them to integer color values and returns them. + * + * This is used internally by the `addOBJ` and `addModel` methods, but is exposed for + * public consumption as well. + * + * Note this only works with diffuse values, specified in the `Kd r g b` format, where + * `g` and `b` are optional, but `r` is required. It does not support spectral rfl files, + * or any other material statement (such as `Ka` or `Ks`) + * + * @method Phaser.Geom.Mesh.ParseObjMaterial + * @since 3.50.0 + * + * @param {string} mtl - The OBJ MTL file as a raw string, i.e. loaded via `this.load.text`. + * + * @return {object} The parsed material colors, where each property of the object matches the material name. + */ +var ParseObjMaterial = function (mtl) +{ + var output = {}; + + var lines = mtl.split('\n'); + + var currentMaterial = ''; + + for (var i = 0; i < lines.length; i++) + { + var line = lines[i].trim(); + + if (line.indexOf('#') === 0 || line === '') + { + continue; + } + + var lineItems = line.replace(/\s\s+/g, ' ').trim().split(' '); + + switch (lineItems[0].toLowerCase()) + { + case 'newmtl': + { + currentMaterial = lineItems[1]; + break; + } + + // The diffuse reflectivity of the current material + // Support r, [g], [b] format, where g and b are optional + case 'kd': + { + var r = Math.floor(lineItems[1] * 255); + var g = (lineItems.length >= 2) ? Math.floor(lineItems[2] * 255) : r; + var b = (lineItems.length >= 3) ? Math.floor(lineItems[3] * 255) : r; + + output[currentMaterial] = GetColor(r, g, b); + + break; + } + } + } + + return output; +}; + +module.exports = ParseObjMaterial; + + +/***/ }), +/* 477 */ /***/ (function(module, exports) { /** @@ -99063,7 +104934,7 @@ module.exports = GetMagnitude; /***/ }), -/* 464 */ +/* 478 */ /***/ (function(module, exports) { /** @@ -99091,7 +104962,7 @@ module.exports = GetMagnitudeSq; /***/ }), -/* 465 */ +/* 479 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99102,50 +104973,50 @@ module.exports = GetMagnitudeSq; var Rectangle = __webpack_require__(9); -Rectangle.Area = __webpack_require__(1183); -Rectangle.Ceil = __webpack_require__(1184); -Rectangle.CeilAll = __webpack_require__(1185); -Rectangle.CenterOn = __webpack_require__(178); -Rectangle.Clone = __webpack_require__(1186); -Rectangle.Contains = __webpack_require__(50); -Rectangle.ContainsPoint = __webpack_require__(1187); -Rectangle.ContainsRect = __webpack_require__(466); -Rectangle.CopyFrom = __webpack_require__(1188); -Rectangle.Decompose = __webpack_require__(455); -Rectangle.Equals = __webpack_require__(1189); -Rectangle.FitInside = __webpack_require__(1190); -Rectangle.FitOutside = __webpack_require__(1191); -Rectangle.Floor = __webpack_require__(1192); -Rectangle.FloorAll = __webpack_require__(1193); -Rectangle.FromPoints = __webpack_require__(186); -Rectangle.FromXY = __webpack_require__(1194); -Rectangle.GetAspectRatio = __webpack_require__(223); -Rectangle.GetCenter = __webpack_require__(1195); -Rectangle.GetPoint = __webpack_require__(161); -Rectangle.GetPoints = __webpack_require__(283); -Rectangle.GetSize = __webpack_require__(1196); -Rectangle.Inflate = __webpack_require__(1197); -Rectangle.Intersection = __webpack_require__(1198); -Rectangle.MarchingAnts = __webpack_require__(294); -Rectangle.MergePoints = __webpack_require__(1199); -Rectangle.MergeRect = __webpack_require__(1200); -Rectangle.MergeXY = __webpack_require__(1201); -Rectangle.Offset = __webpack_require__(1202); -Rectangle.OffsetPoint = __webpack_require__(1203); -Rectangle.Overlaps = __webpack_require__(1204); -Rectangle.Perimeter = __webpack_require__(118); -Rectangle.PerimeterPoint = __webpack_require__(1205); -Rectangle.Random = __webpack_require__(164); -Rectangle.RandomOutside = __webpack_require__(1206); -Rectangle.SameDimensions = __webpack_require__(1207); -Rectangle.Scale = __webpack_require__(1208); -Rectangle.Union = __webpack_require__(408); +Rectangle.Area = __webpack_require__(1247); +Rectangle.Ceil = __webpack_require__(1248); +Rectangle.CeilAll = __webpack_require__(1249); +Rectangle.CenterOn = __webpack_require__(182); +Rectangle.Clone = __webpack_require__(1250); +Rectangle.Contains = __webpack_require__(56); +Rectangle.ContainsPoint = __webpack_require__(1251); +Rectangle.ContainsRect = __webpack_require__(480); +Rectangle.CopyFrom = __webpack_require__(1252); +Rectangle.Decompose = __webpack_require__(467); +Rectangle.Equals = __webpack_require__(1253); +Rectangle.FitInside = __webpack_require__(1254); +Rectangle.FitOutside = __webpack_require__(1255); +Rectangle.Floor = __webpack_require__(1256); +Rectangle.FloorAll = __webpack_require__(1257); +Rectangle.FromPoints = __webpack_require__(191); +Rectangle.FromXY = __webpack_require__(1258); +Rectangle.GetAspectRatio = __webpack_require__(229); +Rectangle.GetCenter = __webpack_require__(1259); +Rectangle.GetPoint = __webpack_require__(162); +Rectangle.GetPoints = __webpack_require__(298); +Rectangle.GetSize = __webpack_require__(1260); +Rectangle.Inflate = __webpack_require__(1261); +Rectangle.Intersection = __webpack_require__(1262); +Rectangle.MarchingAnts = __webpack_require__(308); +Rectangle.MergePoints = __webpack_require__(1263); +Rectangle.MergeRect = __webpack_require__(1264); +Rectangle.MergeXY = __webpack_require__(1265); +Rectangle.Offset = __webpack_require__(1266); +Rectangle.OffsetPoint = __webpack_require__(1267); +Rectangle.Overlaps = __webpack_require__(1268); +Rectangle.Perimeter = __webpack_require__(126); +Rectangle.PerimeterPoint = __webpack_require__(1269); +Rectangle.Random = __webpack_require__(165); +Rectangle.RandomOutside = __webpack_require__(1270); +Rectangle.SameDimensions = __webpack_require__(1271); +Rectangle.Scale = __webpack_require__(1272); +Rectangle.Union = __webpack_require__(418); module.exports = Rectangle; /***/ }), -/* 466 */ +/* 480 */ /***/ (function(module, exports) { /** @@ -99185,7 +105056,7 @@ module.exports = ContainsRect; /***/ }), -/* 467 */ +/* 481 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99229,7 +105100,7 @@ module.exports = Centroid; /***/ }), -/* 468 */ +/* 482 */ /***/ (function(module, exports) { /** @@ -99270,7 +105141,7 @@ module.exports = Offset; /***/ }), -/* 469 */ +/* 483 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99335,7 +105206,7 @@ module.exports = InCenter; /***/ }), -/* 470 */ +/* 484 */ /***/ (function(module, exports) { /** @@ -99353,7 +105224,7 @@ module.exports = InCenter; * @since 3.10.0 * * @param {Phaser.Textures.TextureManager} textureManager - A reference to the Texture Manager. - * @param {integer} alphaTolerance - The alpha level that the pixel should be above to be included as a successful interaction. + * @param {number} alphaTolerance - The alpha level that the pixel should be above to be included as a successful interaction. * * @return {function} The new Pixel Perfect Handler function. */ @@ -99371,7 +105242,7 @@ module.exports = CreatePixelPerfectHandler; /***/ }), -/* 471 */ +/* 485 */ /***/ (function(module, exports) { /** @@ -99442,7 +105313,7 @@ module.exports = CreateInteractiveObject; /***/ }), -/* 472 */ +/* 486 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99464,7 +105335,7 @@ var Class = __webpack_require__(0); * @since 3.0.0 * * @param {Phaser.Input.Gamepad.Gamepad} pad - A reference to the Gamepad that this Axis belongs to. - * @param {integer} index - The index of this Axis. + * @param {number} index - The index of this Axis. */ var Axis = new Class({ @@ -99494,7 +105365,7 @@ var Axis = new Class({ * The index of this Axis. * * @name Phaser.Input.Gamepad.Axis#index - * @type {integer} + * @type {number} * @since 3.0.0 */ this.index = index; @@ -99567,7 +105438,7 @@ module.exports = Axis; /***/ }), -/* 473 */ +/* 487 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99577,7 +105448,7 @@ module.exports = Axis; */ var Class = __webpack_require__(0); -var Events = __webpack_require__(225); +var Events = __webpack_require__(231); /** * @classdesc @@ -99590,7 +105461,7 @@ var Events = __webpack_require__(225); * @since 3.0.0 * * @param {Phaser.Input.Gamepad.Gamepad} pad - A reference to the Gamepad that this Button belongs to. - * @param {integer} index - The index of this Button. + * @param {number} index - The index of this Button. */ var Button = new Class({ @@ -99620,7 +105491,7 @@ var Button = new Class({ * The index of this Button. * * @name Phaser.Input.Gamepad.Button#index - * @type {integer} + * @type {number} * @since 3.0.0 */ this.index = index; @@ -99713,7 +105584,7 @@ module.exports = Button; /***/ }), -/* 474 */ +/* 488 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99722,10 +105593,10 @@ module.exports = Button; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Axis = __webpack_require__(472); -var Button = __webpack_require__(473); +var Axis = __webpack_require__(486); +var Button = __webpack_require__(487); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); +var EventEmitter = __webpack_require__(10); var Vector2 = __webpack_require__(3); /** @@ -100031,6 +105902,16 @@ var Gamepad = new Class({ * @since 3.10.0 */ this.rightStick = new Vector2(); + + /** + * When was this Gamepad created? Used to avoid duplicate event spamming in the update loop. + * + * @name Phaser.Input.Gamepad.Gamepad#_created + * @type {number} + * @private + * @since 3.50.0 + */ + this._created = performance.now(); }, /** @@ -100039,7 +105920,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#getAxisTotal * @since 3.10.0 * - * @return {integer} The total number of axes this Gamepad claims to support. + * @return {number} The total number of axes this Gamepad claims to support. */ getAxisTotal: function () { @@ -100054,7 +105935,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#getAxisValue * @since 3.10.0 * - * @param {integer} index - The index of the axes to get the value for. + * @param {number} index - The index of the axes to get the value for. * * @return {number} The value of the axis, between 0 and 1. */ @@ -100086,7 +105967,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#getButtonTotal * @since 3.10.0 * - * @return {integer} The total number of buttons this Gamepad claims to have. + * @return {number} The total number of buttons this Gamepad claims to have. */ getButtonTotal: function () { @@ -100103,7 +105984,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#getButtonValue * @since 3.10.0 * - * @param {integer} index - The index of the button to get the value for. + * @param {number} index - The index of the button to get the value for. * * @return {number} The value of the button, between 0 and 1. */ @@ -100119,7 +106000,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#isButtonDown * @since 3.10.0 * - * @param {integer} index - The index of the button to get the value for. + * @param {number} index - The index of the button to get the value for. * * @return {boolean} `true` if the button is considered as being pressed down, otherwise `false`. */ @@ -100138,6 +106019,11 @@ var Gamepad = new Class({ */ update: function (pad) { + if (pad.timestamp < this._created) + { + return; + } + var i; // Sync the button values @@ -100471,7 +106357,7 @@ module.exports = Gamepad; /***/ }), -/* 475 */ +/* 489 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100481,8 +106367,8 @@ module.exports = Gamepad; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(145); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(147); /** * @classdesc @@ -100496,7 +106382,7 @@ var Events = __webpack_require__(145); * @since 3.0.0 * * @param {Phaser.Input.Keyboard.KeyboardPlugin} plugin - The Keyboard Plugin instance that owns this Key object. - * @param {integer} keyCode - The keycode of this key. + * @param {number} keyCode - The keycode of this key. */ var Key = new Class({ @@ -100521,7 +106407,7 @@ var Key = new Class({ * The keycode of this key. * * @name Phaser.Input.Keyboard.Key#keyCode - * @type {integer} + * @type {number} * @since 3.0.0 */ this.keyCode = keyCode; @@ -100873,7 +106759,7 @@ module.exports = Key; /***/ }), -/* 476 */ +/* 490 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100883,10 +106769,10 @@ module.exports = Key; */ var Class = __webpack_require__(0); -var Events = __webpack_require__(145); +var Events = __webpack_require__(147); var GetFastValue = __webpack_require__(2); -var ProcessKeyCombo = __webpack_require__(1247); -var ResetKeyCombo = __webpack_require__(1249); +var ProcessKeyCombo = __webpack_require__(491); +var ResetKeyCombo = __webpack_require__(493); /** * @classdesc @@ -100923,7 +106809,7 @@ var ResetKeyCombo = __webpack_require__(1249); * @since 3.0.0 * * @param {Phaser.Input.Keyboard.KeyboardPlugin} keyboardPlugin - A reference to the Keyboard Plugin. - * @param {(string|integer[]|object[])} keys - The keys that comprise this combo. + * @param {(string|number[]|object[])} keys - The keys that comprise this combo. * @param {Phaser.Types.Input.Keyboard.KeyComboConfig} [config] - A Key Combo configuration object. */ var KeyCombo = new Class({ @@ -100993,7 +106879,7 @@ var KeyCombo = new Class({ * The current keyCode the combo is waiting for. * * @name Phaser.Input.Keyboard.KeyCombo#current - * @type {integer} + * @type {number} * @since 3.0.0 */ this.current = this.keyCodes[0]; @@ -101002,7 +106888,7 @@ var KeyCombo = new Class({ * The current index of the key being waited for in the 'keys' string. * * @name Phaser.Input.Keyboard.KeyCombo#index - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -101061,7 +106947,7 @@ var KeyCombo = new Class({ * The max delay in ms between each key press. Above this the combo is reset. 0 means disabled. * * @name Phaser.Input.Keyboard.KeyCombo#maxKeyDelay - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -101166,7 +107052,7 @@ module.exports = KeyCombo; /***/ }), -/* 477 */ +/* 491 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101175,7 +107061,165 @@ module.exports = KeyCombo; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MergeXHRSettings = __webpack_require__(226); +var AdvanceKeyCombo = __webpack_require__(492); + +/** + * Used internally by the KeyCombo class. + * + * @function Phaser.Input.Keyboard.ProcessKeyCombo + * @private + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native Keyboard Event. + * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to be processed. + * + * @return {boolean} `true` if the combo was matched, otherwise `false`. + */ +var ProcessKeyCombo = function (event, combo) +{ + if (combo.matched) + { + return true; + } + + var comboMatched = false; + var keyMatched = false; + + if (event.keyCode === combo.current) + { + // Key was correct + + if (combo.index > 0 && combo.maxKeyDelay > 0) + { + // We have to check to see if the delay between + // the new key and the old one was too long (if enabled) + + var timeLimit = combo.timeLastMatched + combo.maxKeyDelay; + + // Check if they pressed it in time or not + if (event.timeStamp <= timeLimit) + { + keyMatched = true; + comboMatched = AdvanceKeyCombo(event, combo); + } + } + else + { + keyMatched = true; + + // We don't check the time for the first key pressed, so just advance it + comboMatched = AdvanceKeyCombo(event, combo); + } + } + + if (!keyMatched && combo.resetOnWrongKey) + { + // Wrong key was pressed + combo.index = 0; + combo.current = combo.keyCodes[0]; + } + + if (comboMatched) + { + combo.timeLastMatched = event.timeStamp; + combo.matched = true; + combo.timeMatched = event.timeStamp; + } + + return comboMatched; +}; + +module.exports = ProcessKeyCombo; + + +/***/ }), +/* 492 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Used internally by the KeyCombo class. + * Return `true` if it reached the end of the combo, `false` if not. + * + * @function Phaser.Input.Keyboard.AdvanceKeyCombo + * @private + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native Keyboard Event. + * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to advance. + * + * @return {boolean} `true` if it reached the end of the combo, `false` if not. + */ +var AdvanceKeyCombo = function (event, combo) +{ + combo.timeLastMatched = event.timeStamp; + combo.index++; + + if (combo.index === combo.size) + { + return true; + } + else + { + combo.current = combo.keyCodes[combo.index]; + return false; + } +}; + +module.exports = AdvanceKeyCombo; + + +/***/ }), +/* 493 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Used internally by the KeyCombo class. + * + * @function Phaser.Input.Keyboard.ResetKeyCombo + * @private + * @since 3.0.0 + * + * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo to reset. + * + * @return {Phaser.Input.Keyboard.KeyCombo} The KeyCombo. + */ +var ResetKeyCombo = function (combo) +{ + combo.current = combo.keyCodes[0]; + combo.index = 0; + combo.timeLastMatched = 0; + combo.matched = false; + combo.timeMatched = 0; + + return combo; +}; + +module.exports = ResetKeyCombo; + + +/***/ }), +/* 494 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var MergeXHRSettings = __webpack_require__(232); /** * Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings @@ -101247,7 +107291,7 @@ module.exports = XHRLoader; /***/ }), -/* 478 */ +/* 495 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101257,11 +107301,11 @@ module.exports = XHRLoader; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var HTML5AudioFile = __webpack_require__(479); +var HTML5AudioFile = __webpack_require__(496); var IsPlainObject = __webpack_require__(7); /** @@ -101374,7 +107418,7 @@ AudioFile.create = function (loader, key, urls, config, xhrSettings) // https://developers.google.com/web/updates/2012/02/HTML5-audio-and-the-Web-Audio-API-are-BFFs // var stream = GetFastValue(config, 'stream', false); - if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) + if (deviceAudio.webAudio && !audioConfig.disableWebAudio) { return new AudioFile(loader, key, urlConfig, xhrSettings, game.sound.context); } @@ -101483,7 +107527,7 @@ FileTypesManager.register('audio', function (key, urls, config, xhrSettings) var audioConfig = game.config.audio; var deviceAudio = game.device.audio; - if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) { // Sounds are disabled, so skip loading audio return this; @@ -101521,7 +107565,7 @@ module.exports = AudioFile; /***/ }), -/* 479 */ +/* 496 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101531,10 +107575,10 @@ module.exports = AudioFile; */ var Class = __webpack_require__(0); -var Events = __webpack_require__(84); +var Events = __webpack_require__(89); var File = __webpack_require__(22); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(146); +var GetURL = __webpack_require__(148); var IsPlainObject = __webpack_require__(7); /** @@ -101724,7 +107768,7 @@ module.exports = HTML5AudioFile; /***/ }), -/* 480 */ +/* 497 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101734,7 +107778,7 @@ module.exports = HTML5AudioFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -101895,7 +107939,7 @@ module.exports = ScriptFile; /***/ }), -/* 481 */ +/* 498 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101904,187 +107948,12 @@ module.exports = ScriptFile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var ArcadeImage = __webpack_require__(499); +var ArcadeSprite = __webpack_require__(150); var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); -var File = __webpack_require__(22); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); - -/** - * @classdesc - * A single Text File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#text method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#text. - * - * @class TextFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var TextFile = new Class({ - - Extends: File, - - initialize: - - function TextFile (loader, key, url, xhrSettings) - { - var extension = 'txt'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - } - - var fileConfig = { - type: 'text', - cache: loader.cacheManager.text, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; - - File.call(this, loader, fileConfig); - }, - - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.TextFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; - - this.data = this.xhrLoader.responseText; - - this.onProcessComplete(); - } - -}); - -/** - * Adds a Text file, or array of Text files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.text('story', 'files/IntroStory.txt'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Text Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Text Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Text Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.text({ - * key: 'story', - * url: 'files/IntroStory.txt' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.TextFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.text('story', 'files/IntroStory.txt'); - * // and later in your game ... - * var data = this.cache.text.get('story'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and - * this is what you would use to retrieve the text from the Text Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" - * and no URL is given then the Loader will set the URL to be "story.txt". It will always add `.txt` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Text File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#text - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('text', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new TextFile(this, key[i])); - } - } - else - { - this.addFile(new TextFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = TextFile; - - -/***/ }), -/* 482 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var ArcadeImage = __webpack_require__(483); -var ArcadeSprite = __webpack_require__(148); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); -var PhysicsGroup = __webpack_require__(485); -var StaticPhysicsGroup = __webpack_require__(486); +var CONST = __webpack_require__(59); +var PhysicsGroup = __webpack_require__(501); +var StaticPhysicsGroup = __webpack_require__(502); /** * @classdesc @@ -102201,7 +108070,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.Types.Physics.Arcade.ImageWithStaticBody} The Image object that was created. */ @@ -102225,7 +108094,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.Types.Physics.Arcade.ImageWithDynamicBody} The Image object that was created. */ @@ -102249,7 +108118,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.Types.Physics.Arcade.SpriteWithStaticBody} The Sprite object that was created. */ @@ -102274,7 +108143,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.Types.Physics.Arcade.SpriteWithDynamicBody} The Sprite object that was created. */ @@ -102343,7 +108212,7 @@ module.exports = Factory; /***/ }), -/* 483 */ +/* 499 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102353,8 +108222,8 @@ module.exports = Factory; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(228); -var Image = __webpack_require__(114); +var Components = __webpack_require__(235); +var Image = __webpack_require__(122); /** * @classdesc @@ -102379,6 +108248,7 @@ var Image = __webpack_require__(114); * @extends Phaser.Physics.Arcade.Components.Gravity * @extends Phaser.Physics.Arcade.Components.Immovable * @extends Phaser.Physics.Arcade.Components.Mass + * @extends Phaser.Physics.Arcade.Components.Pushable * @extends Phaser.Physics.Arcade.Components.Size * @extends Phaser.Physics.Arcade.Components.Velocity * @extends Phaser.GameObjects.Components.Alpha @@ -102399,7 +108269,7 @@ var Image = __webpack_require__(114); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ var ArcadeImage = new Class({ @@ -102416,6 +108286,7 @@ var ArcadeImage = new Class({ Components.Gravity, Components.Immovable, Components.Mass, + Components.Pushable, Components.Size, Components.Velocity ], @@ -102443,13 +108314,13 @@ module.exports = ArcadeImage; /***/ }), -/* 484 */ +/* 500 */ /***/ (function(module, exports, __webpack_require__) { -var OverlapRect = __webpack_require__(229); -var Circle = __webpack_require__(68); -var CircleToCircle = __webpack_require__(216); -var CircleToRectangle = __webpack_require__(217); +var OverlapRect = __webpack_require__(236); +var Circle = __webpack_require__(71); +var CircleToCircle = __webpack_require__(222); +var CircleToRectangle = __webpack_require__(223); /** * This method will search the given circular area and return an array of all physics bodies that @@ -102511,7 +108382,7 @@ module.exports = OverlapCirc; /***/ }), -/* 485 */ +/* 501 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102520,11 +108391,11 @@ module.exports = OverlapCirc; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArcadeSprite = __webpack_require__(148); +var ArcadeSprite = __webpack_require__(150); var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); +var CONST = __webpack_require__(59); var GetFastValue = __webpack_require__(2); -var Group = __webpack_require__(100); +var Group = __webpack_require__(108); var IsPlainObject = __webpack_require__(7); /** @@ -102629,7 +108500,7 @@ var PhysicsGroup = new Class({ * The physics type of the Group's members. * * @name Phaser.Physics.Arcade.Group#physicsType - * @type {integer} + * @type {number} * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 */ @@ -102661,6 +108532,8 @@ var PhysicsGroup = new Class({ setGravityY: GetFastValue(config, 'gravityY', 0), setFrictionX: GetFastValue(config, 'frictionX', 0), setFrictionY: GetFastValue(config, 'frictionY', 0), + setMaxVelocityX: GetFastValue(config, 'maxVelocityX', 10000), + setMaxVelocityY: GetFastValue(config, 'maxVelocityY', 10000), setVelocityX: GetFastValue(config, 'velocityX', 0), setVelocityY: GetFastValue(config, 'velocityY', 0), setAngularVelocity: GetFastValue(config, 'angularVelocity', 0), @@ -102805,7 +108678,7 @@ module.exports = PhysicsGroup; /***/ }), -/* 486 */ +/* 502 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102814,11 +108687,11 @@ module.exports = PhysicsGroup; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArcadeSprite = __webpack_require__(148); +var ArcadeSprite = __webpack_require__(150); var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); +var CONST = __webpack_require__(59); var GetFastValue = __webpack_require__(2); -var Group = __webpack_require__(100); +var Group = __webpack_require__(108); var IsPlainObject = __webpack_require__(7); /** @@ -102904,7 +108777,7 @@ var StaticPhysicsGroup = new Class({ * The scene this group belongs to. * * @name Phaser.Physics.Arcade.StaticGroup#physicsType - * @type {integer} + * @type {number} * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ @@ -103004,7 +108877,7 @@ module.exports = StaticPhysicsGroup; /***/ }), -/* 487 */ +/* 503 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103013,35 +108886,36 @@ module.exports = StaticPhysicsGroup; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AngleBetweenPoints = __webpack_require__(331); -var Body = __webpack_require__(488); -var Clamp = __webpack_require__(17); +var AngleBetweenPoints = __webpack_require__(342); +var Body = __webpack_require__(504); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Collider = __webpack_require__(489); -var CONST = __webpack_require__(52); -var DistanceBetween = __webpack_require__(55); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(230); -var FuzzyEqual = __webpack_require__(109); -var FuzzyGreaterThan = __webpack_require__(335); -var FuzzyLessThan = __webpack_require__(336); -var GetOverlapX = __webpack_require__(231); -var GetOverlapY = __webpack_require__(232); +var Collider = __webpack_require__(505); +var CONST = __webpack_require__(59); +var DistanceBetween = __webpack_require__(61); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(237); +var FuzzyEqual = __webpack_require__(121); +var FuzzyGreaterThan = __webpack_require__(346); +var FuzzyLessThan = __webpack_require__(347); +var GetOverlapX = __webpack_require__(238); +var GetOverlapY = __webpack_require__(239); +var GetTilesWithinWorldXY = __webpack_require__(506); var GetValue = __webpack_require__(6); var MATH_CONST = __webpack_require__(13); -var ProcessQueue = __webpack_require__(197); -var ProcessTileCallbacks = __webpack_require__(490); +var ProcessQueue = __webpack_require__(202); +var ProcessTileCallbacks = __webpack_require__(507); var Rectangle = __webpack_require__(9); -var RTree = __webpack_require__(491); -var SeparateTile = __webpack_require__(492); -var SeparateX = __webpack_require__(497); -var SeparateY = __webpack_require__(498); -var Set = __webpack_require__(141); -var StaticBody = __webpack_require__(499); -var TileIntersectsBody = __webpack_require__(233); -var TransformMatrix = __webpack_require__(31); +var RTree = __webpack_require__(508); +var SeparateTile = __webpack_require__(509); +var SeparateX = __webpack_require__(514); +var SeparateY = __webpack_require__(515); +var Set = __webpack_require__(145); +var StaticBody = __webpack_require__(516); +var TileIntersectsBody = __webpack_require__(240); +var TransformMatrix = __webpack_require__(24); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * @classdesc @@ -103330,7 +109204,7 @@ var World = new Class({ * to allow more items per node and less node division. * * @name Phaser.Physics.Arcade.World#maxEntries - * @type {integer} + * @type {number} * @default 16 * @since 3.0.0 */ @@ -103440,7 +109314,7 @@ var World = new Class({ * @since 3.0.0 * * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object - The object, or objects, on which to create the bodies. - * @param {integer} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. + * @param {number} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. */ enable: function (object, bodyType) { @@ -103507,7 +109381,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.GameObject} object - The Game Object on which to create the body. - * @param {integer} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. + * @param {number} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. * * @return {Phaser.GameObjects.GameObject} The Game Object on which the body was created. */ @@ -103903,7 +109777,7 @@ var World = new Class({ * @method Phaser.Physics.Arcade.World#setFPS * @since 3.10.0 * - * @param {integer} framerate - The frame rate to advance the simulation at. + * @param {number} framerate - The frame rate to advance the simulation at. * * @return {this} This World object. */ @@ -103991,7 +109865,7 @@ var World = new Class({ } } - this.emit(Events.WORLD_STEP); + this.emit(Events.WORLD_STEP, fixedDelta); } // Process any additional steps this frame @@ -104050,7 +109924,7 @@ var World = new Class({ } } - this.emit(Events.WORLD_STEP); + this.emit(Events.WORLD_STEP, delta); this.stepsLastFrame++; }, @@ -104256,6 +110130,7 @@ var World = new Class({ if (useDamping) { // Damping based deceleration + dragX = Math.pow(dragX, delta); velocityX *= dragX; @@ -104295,6 +110170,8 @@ var World = new Class({ if (useDamping) { // Damping based deceleration + dragY = Math.pow(dragY, delta); + velocityY *= dragY; speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY); @@ -104475,9 +110352,6 @@ var World = new Class({ */ separateCircle: function (body1, body2, overlapOnly, bias) { - body1.updateCenter(); - body2.updateCenter(); - // Set the bounding box overlap values into the bodies themselves (hence we don't use the return values here) GetOverlapX(body1, body2, false, bias); GetOverlapY(body1, body2, false, bias); @@ -104529,6 +110403,9 @@ var World = new Class({ overlap = (body1.halfWidth + body2.halfWidth) - DistanceBetween(body1.center.x, body1.center.y, body2.center.x, body2.center.y); } + body1.overlapR = overlap; + body2.overlapR = overlap; + // Can't separate two immovable bodies, or a body with its own custom separation logic if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateX || body2.customSeparateX) { @@ -105056,10 +110933,10 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Group} group - The first object to check for collision. - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. + * @param {ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} callbackContext - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. @@ -105174,7 +111051,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {any} [callbackContext] - The context in which to run the callbacks. @@ -105196,9 +111073,6 @@ var World = new Class({ var w = body.width; var h = body.height; - // TODO: this logic should be encapsulated within the Tilemap API at some point. - // If the maps base tile size differs from the layer's tile size, we need to adjust the - // selection area by the difference between the two. var layerData = tilemapLayer.layer; if (layerData.tileWidth > layerData.baseTileWidth) @@ -105216,7 +111090,7 @@ var World = new Class({ h += yDiff; } - var mapData = tilemapLayer.getTilesWithinWorldXY(x, y, w, h); + var mapData = GetTilesWithinWorldXY(x, y, w, h, null, tilemapLayer.scene.cameras.main, tilemapLayer.layer); if (mapData.length === 0) { @@ -105239,7 +111113,7 @@ var World = new Class({ * @since 3.17.0 * * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {any} [callbackContext] - The context in which to run the callbacks. @@ -105263,11 +111137,13 @@ var World = new Class({ tilemapLayer = tile.tilemapLayer; - tileWorldRect.left = tilemapLayer.tileToWorldX(tile.x); - tileWorldRect.top = tilemapLayer.tileToWorldY(tile.y); + var point = tilemapLayer.tileToWorldXY(tile.x, tile.y); - // If the map's base tile size differs from the layer's tile size, only the top of the rect - // needs to be adjusted since its origin is (0, 1). + tileWorldRect.left = point.x; + tileWorldRect.top = point.y; + + // If the maps base tile size differs from the layer tile size, only the top of the rect + // needs to be adjusted since its origin is (0, 1). if (tile.baseHeight !== tile.height) { tileWorldRect.top -= (tile.height - tile.baseHeight) * tilemapLayer.scaleY; @@ -105344,7 +111220,7 @@ var World = new Class({ * @method Phaser.Physics.Arcade.World#wrap * @since 3.3.0 * - * @param {*} object - A Game Object, a Group, an object with `x` and `y` coordinates, or an array of such objects. + * @param {any} object - A Game Object, a Group, an object with `x` and `y` coordinates, or an array of such objects. * @param {number} [padding=0] - An amount added to each boundary edge during the operation. */ wrap: function (object, padding) @@ -105437,7 +111313,7 @@ module.exports = World; /***/ }), -/* 488 */ +/* 504 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105448,11 +111324,11 @@ module.exports = World; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); -var Events = __webpack_require__(230); -var RadToDeg = __webpack_require__(183); +var CONST = __webpack_require__(59); +var Events = __webpack_require__(237); +var RadToDeg = __webpack_require__(188); var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(50); +var RectangleContains = __webpack_require__(56); var Vector2 = __webpack_require__(3); /** @@ -105535,7 +111411,7 @@ var Body = new Class({ * The color of this Body on the debug display. * * @name Phaser.Physics.Arcade.Body#debugBodyColor - * @type {integer} + * @type {number} * @since 3.0.0 */ this.debugBodyColor = world.defaults.bodyDebugColor; @@ -105777,10 +111653,11 @@ var Body = new Class({ /** * When `useDamping` is false (the default), this is absolute loss of velocity due to movement, in pixels per second squared. * - * When `useDamping` is true, this is 1 minus the damping factor. + * When `useDamping` is true, this is a damping multiplier between 0 and 1. + * A value of 0 means the Body stops instantly. + * A value of 0.01 mean the Body loses 99% of its velocity per second. + * A value of 0.1 means the Body loses 90% of its velocity per second. * A value of 1 means the Body loses no velocity. - * A value of 0.95 means the Body loses 5% of its velocity per step. - * A value of 0.5 means the Body loses 50% of its velocity per step. * * The x and y components are applied separately. * @@ -105928,8 +111805,8 @@ var Body = new Class({ * by using damping, avoiding the axis-drift that is prone with linear deceleration. * * If you enable this property then you should use far smaller `drag` values than with linear, as - * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow - * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. + * they are used as a multiplier on the velocity. Values such as 0.05 will give a nice slow + * deceleration. * * @name Phaser.Physics.Arcade.Body#useDamping * @type {boolean} @@ -106017,7 +111894,7 @@ var Body = new Class({ * If the Body is moving on both axes, this describes motion on the vertical axis only. * * @name Phaser.Physics.Arcade.Body#facing - * @type {integer} + * @type {number} * @since 3.0.0 * * @see Phaser.Physics.Arcade.FACING_UP @@ -106037,6 +111914,25 @@ var Body = new Class({ */ this.immovable = false; + /** + * Sets if this Body can be pushed by another Body. + * + * A body that cannot be pushed will reflect back all of the velocity it is given to the + * colliding body. If that body is also not pushable, then the separation will be split + * between them evenly. + * + * If you want your body to never move or seperate at all, see the `setImmovable` method. + * + * By default, Dynamic Bodies are always pushable. + * + * @name Phaser.Physics.Arcade.Body#pushable + * @type {boolean} + * @default true + * @since 3.50.0 + * @see Phaser.GameObjects.Components.Pushable#setPushable + */ + this.pushable = true; + /** * Whether the Body's position and rotation are affected by its velocity, acceleration, drag, and gravity. * @@ -106181,7 +112077,7 @@ var Body = new Class({ * The Body's physics type (dynamic or static). * * @name Phaser.Physics.Arcade.Body#physicsType - * @type {integer} + * @type {number} * @readonly * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 @@ -106654,6 +112550,7 @@ var Body = new Class({ if (wasSet) { this.blocked.none = false; + this.updateCenter(); } return wasSet; @@ -106661,6 +112558,7 @@ var Body = new Class({ /** * Sets the offset of the Body's position from its Game Object's position. + * The Body's `position` isn't changed until the next `preUpdate`. * * @method Phaser.Physics.Arcade.Body#setOffset * @since 3.0.0 @@ -106675,7 +112573,6 @@ var Body = new Class({ if (y === undefined) { y = x; } this.offset.set(x, y); - this.updateCenter(); return this; }, @@ -106688,8 +112585,8 @@ var Body = new Class({ * @method Phaser.Physics.Arcade.Body#setSize * @since 3.0.0 * - * @param {integer} [width] - The width of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. - * @param {integer} [height] - The height of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. + * @param {number} [width] - The width of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. + * @param {number} [height] - The height of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. * @param {boolean} [center=true] - Modify the Body's `offset`, placing the Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method. * * @return {Phaser.Physics.Arcade.Body} This Body object. @@ -106779,14 +112676,14 @@ var Body = new Class({ }, /** - * Resets this Body to the given coordinates. Also positions its parent Game Object to the same coordinates. + * Sets this Body's parent Game Object to the given coordinates and resets this Body at the new coordinates. * If the Body had any velocity or acceleration it is lost as a result of calling this. * * @method Phaser.Physics.Arcade.Body#reset * @since 3.0.0 * - * @param {number} x - The horizontal position to place the Game Object and Body. - * @param {number} y - The vertical position to place the Game Object and Body. + * @param {number} x - The horizontal position to place the Game Object. + * @param {number} y - The vertical position to place the Game Object. */ reset: function (x, y) { @@ -107129,18 +113026,19 @@ var Body = new Class({ /** * Sets whether this Body collides with the world boundary. * - * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first. + * Optionally also sets the World Bounce and `onWorldBounds` values. * * @method Phaser.Physics.Arcade.Body#setCollideWorldBounds * @since 3.0.0 * - * @param {boolean} [value=true] - `true` if this body should collide with the world bounds, otherwise `false`. - * @param {number} [bounceX] - If given this will be replace the `worldBounce.x` value. - * @param {number} [bounceY] - If given this will be replace the `worldBounce.y` value. + * @param {boolean} [value=true] - `true` if the Body should collide with the world bounds, otherwise `false`. + * @param {number} [bounceX] - If given this replaces the Body's `worldBounce.x` value. + * @param {number} [bounceY] - If given this replaces the Body's `worldBounce.y` value. + * @param {boolean} [onWorldBounds] - If given this replaces the Body's `onWorldBounds` value. * * @return {Phaser.Physics.Arcade.Body} This Body object. */ - setCollideWorldBounds: function (value, bounceX, bounceY) + setCollideWorldBounds: function (value, bounceX, bounceY, onWorldBounds) { if (value === undefined) { value = true; } @@ -107167,6 +113065,11 @@ var Body = new Class({ } } + if (onWorldBounds !== undefined) + { + this.onWorldBounds = onWorldBounds; + } + return this; }, @@ -107255,6 +113158,40 @@ var Body = new Class({ return this; }, + /** + * Sets the Body's maximum horizontal velocity. + * + * @method Phaser.Physics.Arcade.Body#setMaxVelocityX + * @since 3.50.0 + * + * @param {number} value - The maximum horizontal velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxVelocityX: function (value) + { + this.maxVelocity.x = value; + + return this; + }, + + /** + * Sets the Body's maximum vertical velocity. + * + * @method Phaser.Physics.Arcade.Body#setMaxVelocityY + * @since 3.50.0 + * + * @param {number} value - The maximum vertical velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxVelocityY: function (value) + { + this.maxVelocity.y = value; + + return this; + }, + /** * Sets the maximum speed the Body can move. * @@ -107454,6 +113391,31 @@ var Body = new Class({ return this; }, + /** + * If this Body is using `drag` for deceleration this property controls how the drag is applied. + * If set to `true` drag will use a damping effect rather than a linear approach. If you are + * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in + * the game Asteroids) then you will get a far smoother and more visually correct deceleration + * by using damping, avoiding the axis-drift that is prone with linear deceleration. + * + * If you enable this property then you should use far smaller `drag` values than with linear, as + * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow + * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. + * + * @method Phaser.Physics.Arcade.Body#setDamping + * @since 3.50.0 + * + * @param {boolean} value - `true` to use damping, or `false` to use drag. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setDamping: function (value) + { + this.useDamping = value; + + return this; + }, + /** * Sets the Body's horizontal drag. * @@ -107699,7 +113661,79 @@ var Body = new Class({ }, /** - * The Body's horizontal position (left edge). + * This is an internal handler, called by the `ProcessX` function as part + * of the collision step. You should almost never call this directly. + * + * @method Phaser.Physics.Arcade.Body#processX + * @since 3.50.0 + * + * @param {number} x - The amount to add to the Body position. + * @param {number} [vx] - The amount to add to the Body velocity. + * @param {boolean} [left] - Set the blocked.left value? + * @param {boolean} [right] - Set the blocked.right value? + */ + processX: function (x, vx, left, right) + { + this.x += x; + + this.updateCenter(); + + if (vx !== null) + { + this.velocity.x = vx; + } + + var blocked = this.blocked; + + if (left) + { + blocked.left = true; + } + + if (right) + { + blocked.right = true; + } + }, + + /** + * This is an internal handler, called by the `ProcessY` function as part + * of the collision step. You should almost never call this directly. + * + * @method Phaser.Physics.Arcade.Body#processY + * @since 3.50.0 + * + * @param {number} y - The amount to add to the Body position. + * @param {number} [vy] - The amount to add to the Body velocity. + * @param {boolean} [up] - Set the blocked.up value? + * @param {boolean} [down] - Set the blocked.down value? + */ + processY: function (y, vy, up, down) + { + this.y += y; + + this.updateCenter(); + + if (vy !== null) + { + this.velocity.y = vy; + } + + var blocked = this.blocked; + + if (up) + { + blocked.up = true; + } + + if (down) + { + blocked.down = true; + } + }, + + /** + * The Bodys horizontal position (left edge). * * @name Phaser.Physics.Arcade.Body#x * @type {number} @@ -107720,7 +113754,7 @@ var Body = new Class({ }, /** - * The Body's vertical position (top edge). + * The Bodys vertical position (top edge). * * @name Phaser.Physics.Arcade.Body#y * @type {number} @@ -107814,7 +113848,7 @@ module.exports = Body; /***/ }), -/* 489 */ +/* 505 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107934,7 +113968,7 @@ var Collider = new Class({ /** * A name for the Collider. - * + * * Phaser does not use this value, it's for your own reference. * * @method Phaser.Physics.Arcade.Collider#setName @@ -107997,7 +114031,61 @@ module.exports = Collider; /***/ }), -/* 490 */ +/* 506 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTilesWithin = __webpack_require__(26); +var Vector2 = __webpack_require__(3); + +var pointStart = new Vector2(); +var pointEnd = new Vector2(); + +/** + * Gets the tiles in the given rectangular area (in world coordinates) of the layer. + * + * @function Phaser.Tilemaps.Components.GetTilesWithinWorldXY + * @since 3.0.0 + * + * @param {number} worldX - The world x coordinate for the top-left of the area. + * @param {number} worldY - The world y coordinate for the top-left of the area. + * @param {number} width - The width of the area. + * @param {number} height - The height of the area. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + */ +var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer) +{ + var worldToTileXY = layer.tilemapLayer.tilemap._convert.WorldToTileXY; + + // Top left corner of the rect, rounded down to include partial tiles + worldToTileXY(worldX, worldY, true, pointStart, camera, layer); + + var xStart = pointStart.x; + var yStart = pointStart.y; + + // Bottom right corner of the rect, rounded up to include partial tiles + worldToTileXY(worldX + width, worldY + height, false, pointEnd, camera, layer); + + var xEnd = Math.ceil(pointEnd.x); + var yEnd = Math.ceil(pointEnd.y); + + return GetTilesWithin(xStart, yStart, xEnd - xStart, yEnd - yStart, filteringOptions, layer); +}; + +module.exports = GetTilesWithinWorldXY; + + +/***/ }), +/* 507 */ /***/ (function(module, exports) { /** @@ -108038,7 +114126,7 @@ module.exports = ProcessTileCallbacks; /***/ }), -/* 491 */ +/* 508 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108048,7 +114136,7 @@ module.exports = ProcessTileCallbacks; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var quickselect = __webpack_require__(403); +var quickselect = __webpack_require__(413); /** * @classdesc @@ -108649,7 +114737,7 @@ function multiSelect (arr, left, right, n, compare) module.exports = rbush; /***/ }), -/* 492 */ +/* 509 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108658,9 +114746,9 @@ module.exports = rbush; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileCheckX = __webpack_require__(493); -var TileCheckY = __webpack_require__(495); -var TileIntersectsBody = __webpack_require__(233); +var TileCheckX = __webpack_require__(510); +var TileCheckY = __webpack_require__(512); +var TileIntersectsBody = __webpack_require__(240); /** * The core separation function to separate a physics body and a tile. @@ -108672,7 +114760,7 @@ var TileIntersectsBody = __webpack_require__(233); * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to collide against. * @param {Phaser.Geom.Rectangle} tileWorldRect - A rectangle-like object defining the dimensions of the tile. - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemapLayer to collide against. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The tilemapLayer to collide against. * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? * @@ -108769,7 +114857,7 @@ module.exports = SeparateTile; /***/ }), -/* 493 */ +/* 510 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108778,7 +114866,7 @@ module.exports = SeparateTile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ProcessTileSeparationX = __webpack_require__(494); +var ProcessTileSeparationX = __webpack_require__(511); /** * Check the body against the given tile on the X axis. @@ -108859,7 +114947,7 @@ module.exports = TileCheckX; /***/ }), -/* 494 */ +/* 511 */ /***/ (function(module, exports) { /** @@ -108906,7 +114994,7 @@ module.exports = ProcessTileSeparationX; /***/ }), -/* 495 */ +/* 512 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -108915,7 +115003,7 @@ module.exports = ProcessTileSeparationX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ProcessTileSeparationY = __webpack_require__(496); +var ProcessTileSeparationY = __webpack_require__(513); /** * Check the body against the given tile on the Y axis. @@ -108996,7 +115084,7 @@ module.exports = TileCheckY; /***/ }), -/* 496 */ +/* 513 */ /***/ (function(module, exports) { /** @@ -109043,7 +115131,7 @@ module.exports = ProcessTileSeparationY; /***/ }), -/* 497 */ +/* 514 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109052,7 +115140,8 @@ module.exports = ProcessTileSeparationY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetOverlapX = __webpack_require__(231); +var GetOverlapX = __webpack_require__(238); +var ProcessX = __webpack_require__(1369); /** * Separates two overlapping bodies on the X-axis (horizontally). @@ -109069,63 +115158,40 @@ var GetOverlapX = __webpack_require__(231); * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. * - * @return {boolean} `true` if the two bodies overlap horizontally, otherwise `false`. + * @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`. */ var SeparateX = function (body1, body2, overlapOnly, bias) { var overlap = GetOverlapX(body1, body2, overlapOnly, bias); + var body1Immovable = body1.immovable; + var body2Immovable = body2.immovable; + // Can't separate two immovable bodies, or a body with its own custom separation logic - if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateX || body2.customSeparateX) + if (overlapOnly || overlap === 0 || (body1Immovable && body2Immovable) || body1.customSeparateX || body2.customSeparateX) { // return true if there was some overlap, otherwise false return (overlap !== 0) || (body1.embedded && body2.embedded); } - // Adjust their positions and velocities accordingly (if there was any overlap) - var v1 = body1.velocity.x; - var v2 = body2.velocity.x; + var blockedState = ProcessX.Set(body1, body2, overlap); - if (!body1.immovable && !body2.immovable) + if (!body1Immovable && !body2Immovable) { - overlap *= 0.5; - - body1.x -= overlap; - body2.x += overlap; - - var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); - var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); - var avg = (nv1 + nv2) * 0.5; - - nv1 -= avg; - nv2 -= avg; - - body1.velocity.x = avg + nv1 * body1.bounce.x; - body2.velocity.x = avg + nv2 * body2.bounce.x; - } - else if (!body1.immovable) - { - body1.x -= overlap; - body1.velocity.x = v2 - v1 * body1.bounce.x; - - // This is special case code that handles things like vertically moving platforms you can ride - if (body2.moves) + if (blockedState > 0) { - body1.y += (body2.y - body2.prev.y) * body2.friction.y; - body1._dy = body1.y - body1.prev.y; + return true; } - } - else - { - body2.x += overlap; - body2.velocity.x = v1 - v2 * body2.bounce.x; - // This is special case code that handles things like vertically moving platforms you can ride - if (body1.moves) - { - body2.y += (body1.y - body1.prev.y) * body1.friction.y; - body2._dy = body2.y - body2.prev.y; - } + return ProcessX.Check(); + } + else if (body1Immovable) + { + ProcessX.RunImmovableBody1(blockedState); + } + else if (body2Immovable) + { + ProcessX.RunImmovableBody2(blockedState); } // If we got this far then there WAS overlap, and separation is complete, so return true @@ -109136,7 +115202,7 @@ module.exports = SeparateX; /***/ }), -/* 498 */ +/* 515 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109145,7 +115211,8 @@ module.exports = SeparateX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetOverlapY = __webpack_require__(232); +var GetOverlapY = __webpack_require__(239); +var ProcessY = __webpack_require__(1370); /** * Separates two overlapping bodies on the Y-axis (vertically). @@ -109168,57 +115235,34 @@ var SeparateY = function (body1, body2, overlapOnly, bias) { var overlap = GetOverlapY(body1, body2, overlapOnly, bias); + var body1Immovable = body1.immovable; + var body2Immovable = body2.immovable; + // Can't separate two immovable bodies, or a body with its own custom separation logic - if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateY || body2.customSeparateY) + if (overlapOnly || overlap === 0 || (body1Immovable && body2Immovable) || body1.customSeparateY || body2.customSeparateY) { // return true if there was some overlap, otherwise false return (overlap !== 0) || (body1.embedded && body2.embedded); } - // Adjust their positions and velocities accordingly (if there was any overlap) - var v1 = body1.velocity.y; - var v2 = body2.velocity.y; + var blockedState = ProcessY.Set(body1, body2, overlap); - if (!body1.immovable && !body2.immovable) + if (!body1Immovable && !body2Immovable) { - overlap *= 0.5; - - body1.y -= overlap; - body2.y += overlap; - - var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); - var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); - var avg = (nv1 + nv2) * 0.5; - - nv1 -= avg; - nv2 -= avg; - - body1.velocity.y = avg + nv1 * body1.bounce.y; - body2.velocity.y = avg + nv2 * body2.bounce.y; - } - else if (!body1.immovable) - { - body1.y -= overlap; - body1.velocity.y = v2 - v1 * body1.bounce.y; - - // This is special case code that handles things like horizontal moving platforms you can ride - if (body2.moves) + if (blockedState > 0) { - body1.x += (body2.x - body2.prev.x) * body2.friction.x; - body1._dx = body1.x - body1.prev.x; + return true; } - } - else - { - body2.y += overlap; - body2.velocity.y = v1 - v2 * body2.bounce.y; - // This is special case code that handles things like horizontal moving platforms you can ride - if (body1.moves) - { - body2.x += (body1.x - body1.prev.x) * body1.friction.x; - body2._dx = body2.x - body2.prev.x; - } + return ProcessY.Check(); + } + else if (body1Immovable) + { + ProcessY.RunImmovableBody1(blockedState); + } + else if (body2Immovable) + { + ProcessY.RunImmovableBody2(blockedState); } // If we got this far then there WAS overlap, and separation is complete, so return true @@ -109229,7 +115273,7 @@ module.exports = SeparateY; /***/ }), -/* 499 */ +/* 516 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109238,10 +115282,10 @@ module.exports = SeparateY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CircleContains = __webpack_require__(57); +var CircleContains = __webpack_require__(62); var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); -var RectangleContains = __webpack_require__(50); +var CONST = __webpack_require__(59); +var RectangleContains = __webpack_require__(56); var Vector2 = __webpack_require__(3); /** @@ -109303,7 +115347,7 @@ var StaticBody = new Class({ * The color of this Static Body on the debug display. * * @name Phaser.Physics.Arcade.StaticBody#debugBodyColor - * @type {integer} + * @type {number} * @since 3.0.0 */ this.debugBodyColor = world.defaults.staticBodyDebugColor; @@ -109505,6 +115549,25 @@ var StaticBody = new Class({ */ this.immovable = true; + /** + * Sets if this Body can be pushed by another Body. + * + * A body that cannot be pushed will reflect back all of the velocity it is given to the + * colliding body. If that body is also not pushable, then the separation will be split + * between them evenly. + * + * If you want your body to never move or seperate at all, see the `setImmovable` method. + * + * By default, Static Bodies are not pushable. + * + * @name Phaser.Physics.Arcade.StaticBody#pushable + * @type {boolean} + * @default false + * @since 3.50.0 + * @see Phaser.GameObjects.Components.Pushable#setPushable + */ + this.pushable = false; + /** * A flag disabling the default horizontal separation of colliding bodies. Pass your own `collideHandler` to the collider. * @@ -109587,7 +115650,8 @@ var StaticBody = new Class({ this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; /** - * Whether this StaticBody has ever collided with another body and in which direction. + * This property is kept for compatibility with Dynamic Bodies. + * Avoid using it. * * @name Phaser.Physics.Arcade.StaticBody#touching * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} @@ -109596,7 +115660,9 @@ var StaticBody = new Class({ this.touching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody was colliding with another body during the last step or any previous step, and in which direction. + * This property is kept for compatibility with Dynamic Bodies. + * Avoid using it. + * The values are always false for a Static Body. * * @name Phaser.Physics.Arcade.StaticBody#wasTouching * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} @@ -109605,7 +115671,8 @@ var StaticBody = new Class({ this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody has ever collided with a tile or the world boundary. + * This property is kept for compatibility with Dynamic Bodies. + * Avoid using it. * * @name Phaser.Physics.Arcade.StaticBody#blocked * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} @@ -109617,7 +115684,7 @@ var StaticBody = new Class({ * The StaticBody's physics type (static by default). * * @name Phaser.Physics.Arcade.StaticBody#physicsType - * @type {integer} + * @type {number} * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ @@ -109753,8 +115820,8 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#setSize * @since 3.0.0 * - * @param {integer} [width] - The width of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. - * @param {integer} [height] - The height of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. + * @param {number} [width] - The width of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. + * @param {number} [height] - The height of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. * @param {boolean} [center=true] - Place the Static Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method. * * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. @@ -110218,9 +116285,9 @@ module.exports = StaticBody; /***/ }), -/* 500 */, -/* 501 */, -/* 502 */ +/* 517 */, +/* 518 */, +/* 519 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110350,7 +116417,7 @@ module.exports = BasePlugin; /***/ }), -/* 503 */ +/* 520 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110359,7 +116426,53 @@ module.exports = BasePlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); + +/** + * Checks if the given tile coordinate is within the isometric layer bounds, or not. + * + * @function Phaser.Tilemaps.Components.CheckIsoBounds + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to check against. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. + * + * @return {boolean} Returns `true` if the coordinates are within the iso bounds. + */ +var CheckIsoBounds = function (tileX, tileY, layer, camera) +{ + var tilemapLayer = layer.tilemapLayer; + + var cullPaddingX = tilemapLayer.cullPaddingX; + var cullPaddingY = tilemapLayer.cullPaddingY; + + var pos = tilemapLayer.tilemap.tileToWorldXY(tileX, tileY, point, camera, tilemapLayer); + + // we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles. + return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (-cullPaddingX - 0.5) + && pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullPaddingX - 0.5) + && pos.y > camera.worldView.y + tilemapLayer.scaleY * layer.tileHeight * (-cullPaddingY - 1.0) + && pos.y < camera.worldView.bottom + tilemapLayer.scaleY * layer.tileHeight * (cullPaddingY - 0.5); +}; + +module.exports = CheckIsoBounds; + + +/***/ }), +/* 521 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTilesWithin = __webpack_require__(26); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -110369,12 +116482,12 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.ReplaceByIndex * @since 3.0.0 * - * @param {integer} findIndex - The index of the tile to search for. - * @param {integer} newIndex - The index of the tile to replace it with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} findIndex - The index of the tile to search for. + * @param {number} newIndex - The index of the tile to replace it with. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var ReplaceByIndex = function (findIndex, newIndex, tileX, tileY, width, height, layer) @@ -110394,7 +116507,7 @@ module.exports = ReplaceByIndex; /***/ }), -/* 504 */ +/* 522 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110403,7 +116516,1143 @@ module.exports = ReplaceByIndex; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var IsInLayerBounds = __webpack_require__(104); +var Rectangle = __webpack_require__(9); +var SnapCeil = __webpack_require__(134); +var SnapFloor = __webpack_require__(72); + +var bounds = new Rectangle(); + +/** + * Returns the bounds in the given orthogonal layer that are within the cameras viewport. + * This is used internally by the cull tiles function. + * + * @function Phaser.Tilemaps.Components.CullBounds + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * + * @return {Phaser.Geom.Rectangle} A rectangle containing the culled bounds. If you wish to retain this object, clone it, as it's recycled internally. + */ +var CullBounds = function (layer, camera) +{ + var tilemap = layer.tilemapLayer.tilemap; + var tilemapLayer = layer.tilemapLayer; + + // We need to use the tile sizes defined for the map as a whole, not the layer, + // in order to calculate the bounds correctly. As different sized tiles may be + // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. + var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); + var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); + + var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; + var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; + + var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH, 0, true) - tilemapLayer.cullPaddingY; + var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH, 0, true) + tilemapLayer.cullPaddingY; + + return bounds.setTo( + boundsLeft, + boundsTop, + (boundsRight - boundsLeft), + (boundsBottom - boundsTop) + ); +}; + +module.exports = CullBounds; + + +/***/ }), +/* 523 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CullBounds = __webpack_require__(522); +var RunCull = __webpack_require__(152); + +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.CullTiles + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var CullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } + + outputArray.length = 0; + + var tilemapLayer = layer.tilemapLayer; + + // Camera world view bounds, snapped for scaled tile size + // Cull Padding values are given in tiles, not pixels + var bounds = CullBounds(layer, camera); + + if (tilemapLayer.skipCull || tilemapLayer.scrollFactorX !== 1 || tilemapLayer.scrollFactorY !== 1) + { + bounds.left = 0; + bounds.right = layer.width; + bounds.top = 0; + bounds.bottom = layer.height; + } + + RunCull(layer, bounds, renderOrder, outputArray); + + return outputArray; +}; + +module.exports = CullTiles; + + +/***/ }), +/* 524 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CullBounds = __webpack_require__(525); +var RunCull = __webpack_require__(152); + +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.HexagonalCullTiles + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var HexagonalCullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } + + outputArray.length = 0; + + var tilemapLayer = layer.tilemapLayer; + + if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) + { + // Camera world view bounds, snapped for scaled tile size + // Cull Padding values are given in tiles, not pixels + + var bounds = CullBounds(layer, camera); + + RunCull(layer, bounds, renderOrder, outputArray); + } + + return outputArray; +}; + +module.exports = HexagonalCullTiles; + + +/***/ }), +/* 525 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var SnapCeil = __webpack_require__(134); +var SnapFloor = __webpack_require__(72); + +/** + * Returns the bounds in the given layer that are within the camera's viewport. + * This is used internally by the cull tiles function. + * + * @function Phaser.Tilemaps.Components.HexagonalCullBounds + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * + * @return {object} An object containing the `left`, `right`, `top` and `bottom` bounds. + */ +var HexagonalCullBounds = function (layer, camera) +{ + var tilemap = layer.tilemapLayer.tilemap; + var tilemapLayer = layer.tilemapLayer; + + // We need to use the tile sizes defined for the map as a whole, not the layer, + // in order to calculate the bounds correctly. As different sized tiles may be + // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. + var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); + var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); + + var len = layer.hexSideLength; + var rowH = ((tileH - len) / 2 + len); + + var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; + var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; + + var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, rowH, 0, true) - tilemapLayer.cullPaddingY; + var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, rowH, 0, true) + tilemapLayer.cullPaddingY; + + return { + left: boundsLeft, + right: boundsRight, + top: boundsTop, + bottom: boundsBottom + }; +}; + +module.exports = HexagonalCullBounds; + + +/***/ }), +/* 526 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CheckIsoBounds = __webpack_require__(520); + +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.IsometricCullTiles + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var IsometricCullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } + + outputArray.length = 0; + + var tilemapLayer = layer.tilemapLayer; + + var mapData = layer.data; + var mapWidth = layer.width; + var mapHeight = layer.height; + + var drawLeft = 0; + var drawRight = mapWidth; + var drawTop = 0; + var drawBottom = mapHeight; + + if (!tilemapLayer.skipCull) + { + var x; + var y; + var tile; + + if (renderOrder === 0) + { + // right-down + + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + if (CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + else if (renderOrder === 1) + { + // left-down + + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + if (CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + else if (renderOrder === 2) + { + // right-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + if (CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + else if (renderOrder === 3) + { + // left-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + if (CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + } + + tilemapLayer.tilesDrawn = outputArray.length; + tilemapLayer.tilesTotal = mapWidth * mapHeight; + + return outputArray; +}; + +module.exports = IsometricCullTiles; + + +/***/ }), +/* 527 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CullBounds = __webpack_require__(528); +var RunCull = __webpack_require__(152); + +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.StaggeredCullTiles + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var StaggeredCullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } + + outputArray.length = 0; + + var tilemapLayer = layer.tilemapLayer; + + if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) + { + // Camera world view bounds, snapped for scaled tile size + // Cull Padding values are given in tiles, not pixels + + var bounds = CullBounds(layer, camera); + + RunCull(layer, bounds, renderOrder, outputArray); + } + + return outputArray; +}; + +module.exports = StaggeredCullTiles; + + +/***/ }), +/* 528 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var SnapCeil = __webpack_require__(134); +var SnapFloor = __webpack_require__(72); + +/** + * Returns the bounds in the given layer that are within the camera's viewport. + * This is used internally by the cull tiles function. + * + * @function Phaser.Tilemaps.Components.StaggeredCullBounds + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * + * @return {object} An object containing the `left`, `right`, `top` and `bottom` bounds. + */ +var StaggeredCullBounds = function (layer, camera) +{ + var tilemap = layer.tilemapLayer.tilemap; + var tilemapLayer = layer.tilemapLayer; + + // We need to use the tile sizes defined for the map as a whole, not the layer, + // in order to calculate the bounds correctly. As different sized tiles may be + // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. + var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); + var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); + + var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; + var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; + + var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH / 2, 0, true) - tilemapLayer.cullPaddingY; + var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH / 2, 0, true) + tilemapLayer.cullPaddingY; + + return { + left: boundsLeft, + right: boundsRight, + top: boundsTop, + bottom: boundsBottom + }; +}; + +module.exports = StaggeredCullBounds; + + +/***/ }), +/* 529 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from hexagonal tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.HexagonalTileToWorldXY + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + var layerWorldX = 0; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + + tileWidth *= tilemapLayer.scaleX; + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var len = layer.hexSideLength; + var rowHeight = ((tileHeight - len) / 2 + len); + + // similar to staggered, because Tiled uses the oddr representation. + var x = layerWorldX + tileX * tileWidth + tileY % 2 * (tileWidth / 2); + var y = layerWorldY + tileY * rowHeight; + + return point.set(x, y); +}; + +module.exports = HexagonalTileToWorldXY; + + +/***/ }), +/* 530 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from isometric tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.IsometricTileToWorldXY + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var IsometricTileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + var layerWorldX = 0; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + + tileWidth *= tilemapLayer.scaleX; + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var x = layerWorldX + (tileX - tileY) * (tileWidth / 2); + var y = layerWorldY + (tileX + tileY) * (tileHeight / 2); + + return point.set(x, y); +}; + +module.exports = IsometricTileToWorldXY; + + +/***/ }), +/* 531 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from staggered tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.StaggeredTileToWorldXY + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var StaggeredTileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + var layerWorldX = 0; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + + tileWidth *= tilemapLayer.scaleX; + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var x = layerWorldX + tileX * tileWidth + tileY % 2 * (tileWidth / 2); + var y = layerWorldY + tileY * (tileHeight / 2); + + return point.set(x, y); +}; + +module.exports = StaggeredTileToWorldXY; + + +/***/ }), +/* 532 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var TileToWorldX = __webpack_require__(245); +var TileToWorldY = __webpack_require__(246); +var Vector2 = __webpack_require__(3); + +/** + * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.TileToWorldXY + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var TileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(0, 0); } + + point.x = TileToWorldX(tileX, camera, layer); + point.y = TileToWorldY(tileY, camera, layer); + + return point; +}; + +module.exports = TileToWorldXY; + + +/***/ }), +/* 533 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from hexagonal tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.HexagonalTileToWorldY + * @since 3.50.0 + * + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in world coordinates. + */ +var HexagonalTileToWorldY = function (tileY, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var len = tilemapLayer.tilemap.hexSideLength; + + var rowHeight = ((tileHeight - len) / 2 + len); + + return layerWorldY + tileY * rowHeight; +}; + +module.exports = HexagonalTileToWorldY; + + +/***/ }), +/* 534 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from staggered tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layers position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.StaggeredTileToWorldY + * @since 3.50.0 + * + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in world coordinates. + */ +var StaggeredTileToWorldY = function (tileY, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + return layerWorldY + tileY * (tileHeight / 2); +}; + +module.exports = StaggeredTileToWorldY; + + +/***/ }), +/* 535 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from world XY coordinates (pixels) to hexagonal tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.HexagonalWorldToTileXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinates down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. + */ +var HexagonalWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + + tileWidth *= tilemapLayer.scaleX; + } + + var len = layer.hexSideLength; + var rowHeight = ((tileHeight - len) / 2 + len); + + // similar to staggered, because Tiled uses the oddr representation. + var y = (snapToFloor) ? Math.floor((worldY / rowHeight)) : (worldY / rowHeight); + var x = (snapToFloor) ? Math.floor((worldX - (y % 2) * 0.5 * tileWidth) / tileWidth) : (worldX - (y % 2) * 0.5 * tileWidth) / tileWidth; + + return point.set(x, y); +}; + +module.exports = HexagonalWorldToTileXY; + + +/***/ }), +/* 536 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from world XY coordinates (pixels) to isometric tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.IsometricWorldToTileXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. + */ +var IsometricWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + + tileWidth *= tilemapLayer.scaleX; + } + + worldX -= tileWidth / 2; + + var x = (snapToFloor) ? Math.floor((worldX / (tileWidth / 2) + worldY / (tileHeight / 2)) / 2) : ((worldX / (tileWidth / 2) + worldY / (tileHeight / 2)) / 2); + var y = (snapToFloor) ? Math.floor((worldY / (tileHeight / 2) - worldX / (tileWidth / 2)) / 2) : ((worldY / (tileHeight / 2) - worldX / (tileWidth / 2)) / 2); + + return point.set(x, y); +}; + +module.exports = IsometricWorldToTileXY; + + +/***/ }), +/* 537 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from world XY coordinates (pixels) to staggered tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.StaggeredWorldToTileXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. + */ +var StaggeredWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + + tileWidth *= tilemapLayer.scaleX; + } + + var y = (snapToFloor) ? Math.floor((worldY / (tileHeight / 2))) : (worldY / (tileHeight / 2)); + var x = (snapToFloor) ? Math.floor((worldX + (y % 2) * 0.5 * tileWidth) / tileWidth) : (worldX + (y % 2) * 0.5 * tileWidth) / tileWidth; + + return point.set(x, y); +}; + +module.exports = StaggeredWorldToTileXY; + + +/***/ }), +/* 538 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var WorldToTileX = __webpack_require__(247); +var WorldToTileY = __webpack_require__(248); +var Vector2 = __webpack_require__(3); + +/** + * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.WorldToTileXY + * @since 3.0.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. + */ +var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (snapToFloor === undefined) { snapToFloor = true; } + if (!point) { point = new Vector2(0, 0); } + + point.x = WorldToTileX(worldX, snapToFloor, camera, layer); + point.y = WorldToTileY(worldY, snapToFloor, camera, layer); + + return point; +}; + +module.exports = WorldToTileXY; + + +/***/ }), +/* 539 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from world Y coordinates (pixels) to hexagonal tile Y coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.HexagonalWorldToTileY + * @since 3.50.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in tile units. + */ +var HexagonalWorldToTileY = function (worldY, snapToFloor, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var len = layer.hexSideLength; + + var rowHeight = ((tileHeight - len) / 2 + len); + + return (snapToFloor) ? Math.floor(worldY / rowHeight) : worldY / rowHeight; +}; + +module.exports = HexagonalWorldToTileY; + + +/***/ }), +/* 540 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from world Y coordinates (pixels) to staggered tile Y coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.StaggeredWorldToTileY + * @since 3.50.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in tile units. + */ +var StaggeredWorldToTileY = function (worldY, snapToFloor, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + return (snapToFloor) ? Math.floor(worldY / (tileHeight / 2)) : worldY / (tileHeight / 2); +}; + +module.exports = StaggeredWorldToTileY; + + +/***/ }), +/* 541 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var IsInLayerBounds = __webpack_require__(116); /** * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns @@ -110412,8 +117661,8 @@ var IsInLayerBounds = __webpack_require__(104); * @function Phaser.Tilemaps.Components.HasTileAt * @since 3.0.0 * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. @@ -110436,7 +117685,7 @@ module.exports = HasTileAt; /***/ }), -/* 505 */ +/* 542 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110445,9 +117694,9 @@ module.exports = HasTileAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Tile = __webpack_require__(75); -var IsInLayerBounds = __webpack_require__(104); -var CalculateFacesAt = __webpack_require__(235); +var Tile = __webpack_require__(81); +var IsInLayerBounds = __webpack_require__(116); +var CalculateFacesAt = __webpack_require__(244); /** * Removes the tile at the given tile coordinates in the specified layer and updates the layer's @@ -110456,17 +117705,17 @@ var CalculateFacesAt = __webpack_require__(235); * @function Phaser.Tilemaps.Components.RemoveTileAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {number} tileX - The x coordinate. + * @param {number} tileY - The y coordinate. + * @param {boolean} replaceWithNull - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile} The Tile object that was removed. */ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, layer) { - if (replaceWithNull === undefined) { replaceWithNull = false; } + if (replaceWithNull === undefined) { replaceWithNull = true; } if (recalculateFaces === undefined) { recalculateFaces = true; } if (!IsInLayerBounds(tileX, tileY, layer)) @@ -110482,7 +117731,7 @@ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, la } else { - layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, tile.width, tile.height); + layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, layer.tileWidth, layer.tileHeight); } // Recalculate faces only if the removed tile was a colliding tile @@ -110498,7 +117747,7 @@ module.exports = RemoveTileAt; /***/ }), -/* 506 */ +/* 543 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110507,11 +117756,11 @@ module.exports = RemoveTileAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var Parse2DArray = __webpack_require__(237); -var ParseCSV = __webpack_require__(507); -var ParseJSONTiled = __webpack_require__(508); -var ParseWeltmeister = __webpack_require__(519); +var Formats = __webpack_require__(38); +var Parse2DArray = __webpack_require__(250); +var ParseCSV = __webpack_require__(544); +var ParseJSONTiled = __webpack_require__(545); +var ParseWeltmeister = __webpack_require__(556); /** * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format @@ -110523,11 +117772,11 @@ var ParseWeltmeister = __webpack_require__(519); * @since 3.0.0 * * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {integer} mapFormat - See ../Formats.js. - * @param {(integer[][]|string|object)} data - 2D array, CSV string or Tiled JSON object. - * @param {integer} tileWidth - The width of a tile in pixels. Required for 2D array and CSV, but + * @param {number} mapFormat - See ../Formats.js. + * @param {(number[][]|string|object)} data - 2D array, CSV string or Tiled JSON object. + * @param {number} tileWidth - The width of a tile in pixels. Required for 2D array and CSV, but * ignored for Tiled JSON. - * @param {integer} tileHeight - The height of a tile in pixels. Required for 2D array and CSV, but + * @param {number} tileHeight - The height of a tile in pixels. Required for 2D array and CSV, but * ignored for Tiled JSON. * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty @@ -110568,7 +117817,7 @@ module.exports = Parse; /***/ }), -/* 507 */ +/* 544 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110577,8 +117826,8 @@ module.exports = Parse; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var Parse2DArray = __webpack_require__(237); +var Formats = __webpack_require__(38); +var Parse2DArray = __webpack_require__(250); /** * Parses a CSV string of tile indexes into a new MapData object with a single layer. @@ -110588,8 +117837,8 @@ var Parse2DArray = __webpack_require__(237); * * @param {string} name - The name of the tilemap, used to set the name on the MapData. * @param {string} data - CSV string of tile indexes. - * @param {integer} tileWidth - The width of a tile in pixels. - * @param {integer} tileHeight - The height of a tile in pixels. + * @param {number} tileWidth - The width of a tile in pixels. + * @param {number} tileHeight - The height of a tile in pixels. * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty * location will get a Tile object with an index of -1. If you've a large sparsely populated map and @@ -110616,7 +117865,7 @@ module.exports = ParseCSV; /***/ }), -/* 508 */ +/* 545 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110625,14 +117874,16 @@ module.exports = ParseCSV; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var MapData = __webpack_require__(106); -var ParseTileLayers = __webpack_require__(509); -var ParseImageLayers = __webpack_require__(511); -var ParseTilesets = __webpack_require__(512); -var ParseObjectLayers = __webpack_require__(515); -var BuildTilesetIndex = __webpack_require__(517); -var AssignTileProperties = __webpack_require__(518); +var AssignTileProperties = __webpack_require__(546); +var BuildTilesetIndex = __webpack_require__(547); +var CONST = __webpack_require__(29); +var Formats = __webpack_require__(38); +var FromOrientationString = __webpack_require__(242); +var MapData = __webpack_require__(118); +var ParseImageLayers = __webpack_require__(548); +var ParseObjectLayers = __webpack_require__(549); +var ParseTileLayers = __webpack_require__(552); +var ParseTilesets = __webpack_require__(554); /** * Parses a Tiled JSON object into a new MapData object. @@ -110653,12 +117904,6 @@ var AssignTileProperties = __webpack_require__(518); */ var ParseJSONTiled = function (name, json, insertNull) { - if (json.orientation !== 'orthogonal') - { - console.warn('Only orthogonal map types are supported in this version of Phaser'); - return null; - } - // Map data will consist of: layers, objects, images, tilesets, sizes var mapData = new MapData({ width: json.width, @@ -110666,7 +117911,7 @@ var ParseJSONTiled = function (name, json, insertNull) name: name, tileWidth: json.tilewidth, tileHeight: json.tileheight, - orientation: json.orientation, + orientation: FromOrientationString(json.orientation), format: Formats.TILED_JSON, version: json.version, properties: json.properties, @@ -110674,10 +117919,16 @@ var ParseJSONTiled = function (name, json, insertNull) infinite: json.infinite }); + if (mapData.orientation === CONST.HEXAGONAL) + { + mapData.hexSideLength = json.hexsidelength; + } + mapData.layers = ParseTileLayers(json, insertNull); mapData.images = ParseImageLayers(json); var sets = ParseTilesets(json); + mapData.tilesets = sets.tilesets; mapData.imageCollections = sets.imageCollections; @@ -110694,7 +117945,7 @@ module.exports = ParseJSONTiled; /***/ }), -/* 509 */ +/* 546 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -110703,257 +117954,72 @@ module.exports = ParseJSONTiled; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Base64Decode = __webpack_require__(510); -var GetFastValue = __webpack_require__(2); -var LayerData = __webpack_require__(105); -var ParseGID = __webpack_require__(238); -var Tile = __webpack_require__(75); -var CreateGroupLayer = __webpack_require__(154); +var Extend = __webpack_require__(18); /** - * Parses all tilemap layers in a Tiled JSON object into new LayerData objects. + * Copy properties from tileset to tiles. * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseTileLayers + * @function Phaser.Tilemaps.Parsers.Tiled.AssignTileProperties * @since 3.0.0 * - * @param {object} json - The Tiled JSON object. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}). - * - * @return {Phaser.Tilemaps.LayerData[]} - An array of LayerData objects, one for each entry in - * json.layers with the type 'tilelayer'. + * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. */ -var ParseTileLayers = function (json, insertNull) +var AssignTileProperties = function (mapData) { - var infiniteMap = GetFastValue(json, 'infinite', false); - var tileLayers = []; + var layerData; + var tile; + var sid; + var set; + var row; - // State inherited from a parent group - var groupStack = []; - var curGroupState = CreateGroupLayer(json); - - while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) + // go through each of the map data layers + for (var i = 0; i < mapData.layers.length; i++) { - if (curGroupState.i >= curGroupState.layers.length) + layerData = mapData.layers[i]; + + set = null; + + // rows of tiles + for (var j = 0; j < layerData.data.length; j++) { - // Ensure recursion stack is not empty first - if (groupStack.length < 1) + row = layerData.data[j]; + + // individual tiles + for (var k = 0; k < row.length; k++) { - console.warn( - 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' - ); - break; - } + tile = row[k]; - // Return to previous recursive state - curGroupState = groupStack.pop(); - continue; - } - - var curl = curGroupState.layers[curGroupState.i]; - curGroupState.i++; - - if (curl.type !== 'tilelayer') - { - if (curl.type === 'group') - { - // Compute next state inherited from group - var nextGroupState = CreateGroupLayer(json, curl, curGroupState); - - // Preserve current state before recursing - groupStack.push(curGroupState); - curGroupState = nextGroupState; - } - - // Skip this layer OR 'recurse' (iterative style) into the group - continue; - } - - // Base64 decode data if necessary. NOTE: uncompressed base64 only. - if (curl.compression) - { - console.warn( - 'TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer \'' - + curl.name + '\'' - ); - continue; - } - else if (curl.encoding && curl.encoding === 'base64') - { - // Chunks for an infinite map - if (curl.chunks) - { - for (var i = 0; i < curl.chunks.length; i++) + if (tile === null || tile.index < 0) { - curl.chunks[i].data = Base64Decode(curl.chunks[i].data); + continue; } - } - // Non-infinite map data - if (curl.data) - { - curl.data = Base64Decode(curl.data); - } + // find the relevant tileset + sid = mapData.tiles[tile.index][2]; + set = mapData.tilesets[sid]; - delete curl.encoding; // Allow the same map to be parsed multiple times - } + // Ensure that a tile's size matches its tileset + tile.width = set.tileWidth; + tile.height = set.tileHeight; - // This is an array containing the tile indexes, one after the other. -1 = no tile, - // everything else = the tile index (starting at 1 for Tiled, 0 for CSV) If the map - // contains multiple tilesets then the indexes are relative to that which the set starts - // from. Need to set which tileset in the cache = which tileset in the JSON, if you do this - // manually it means you can use the same map data but a new tileset. - - var layerData; - var gidInfo; - var tile; - var blankTile; - - var output = []; - var x = 0; - - if (infiniteMap) - { - var layerOffsetX = (GetFastValue(curl, 'startx', 0) + curl.x); - var layerOffsetY = (GetFastValue(curl, 'starty', 0) + curl.y); - layerData = new LayerData({ - name: (curGroupState.name + curl.name), - x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth), - y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight), - width: curl.width, - height: curl.height, - tileWidth: json.tilewidth, - tileHeight: json.tileheight, - alpha: (curGroupState.opacity * curl.opacity), - visible: (curGroupState.visible && curl.visible), - properties: GetFastValue(curl, 'properties', []) - }); - - for (var c = 0; c < curl.height; c++) - { - output.push([ null ]); - - for (var j = 0; j < curl.width; j++) + // if that tile type has any properties, add them to the tile object + if (set.tileProperties && set.tileProperties[tile.index - set.firstgid]) { - output[c][j] = null; - } - } - - for (c = 0, len = curl.chunks.length; c < len; c++) - { - var chunk = curl.chunks[c]; - - var offsetX = (chunk.x - layerOffsetX); - var offsetY = (chunk.y - layerOffsetY); - - var y = 0; - - for (var t = 0, len2 = chunk.data.length; t < len2; t++) - { - var newOffsetX = x + offsetX; - var newOffsetY = y + offsetY; - - gidInfo = ParseGID(chunk.data[t]); - - // index, x, y, width, height - if (gidInfo.gid > 0) - { - tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth, - json.tileheight); - - // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal - // propeties into flipX, flipY and rotation - tile.rotation = gidInfo.rotation; - tile.flipX = gidInfo.flipped; - - output[newOffsetY][newOffsetX] = tile; - } - else - { - blankTile = insertNull - ? null - : new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); - - output[newOffsetY][newOffsetX] = blankTile; - } - - x++; - - if (x === chunk.width) - { - y++; - x = 0; - } + tile.properties = Extend( + tile.properties, set.tileProperties[tile.index - set.firstgid] + ); } } } - else - { - layerData = new LayerData({ - name: (curGroupState.name + curl.name), - x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x), - y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y), - width: curl.width, - height: curl.height, - tileWidth: json.tilewidth, - tileHeight: json.tileheight, - alpha: (curGroupState.opacity * curl.opacity), - visible: (curGroupState.visible && curl.visible), - properties: GetFastValue(curl, 'properties', []) - }); - - var row = []; - - // Loop through the data field in the JSON. - for (var k = 0, len = curl.data.length; k < len; k++) - { - gidInfo = ParseGID(curl.data[k]); - - // index, x, y, width, height - if (gidInfo.gid > 0) - { - tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth, - json.tileheight); - - // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal - // propeties into flipX, flipY and rotation - tile.rotation = gidInfo.rotation; - tile.flipX = gidInfo.flipped; - - row.push(tile); - } - else - { - blankTile = insertNull - ? null - : new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight); - row.push(blankTile); - } - - x++; - - if (x === curl.width) - { - output.push(row); - x = 0; - row = []; - } - } - } - - layerData.data = output; - tileLayers.push(layerData); } - - return tileLayers; }; -module.exports = ParseTileLayers; +module.exports = AssignTileProperties; /***/ }), -/* 510 */ -/***/ (function(module, exports) { +/* 547 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -110961,41 +118027,92 @@ module.exports = ParseTileLayers; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Tileset = __webpack_require__(119); + /** - * Decode base-64 encoded data, for example as exported by Tiled. + * Master list of tiles -> x, y, index in tileset. * - * @function Phaser.Tilemaps.Parsers.Tiled.Base64Decode + * @function Phaser.Tilemaps.Parsers.Tiled.BuildTilesetIndex * @since 3.0.0 * - * @param {object} data - Base-64 encoded data to decode. + * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. * - * @return {array} Array containing the decoded bytes. + * @return {array} An array of Tileset objects. */ -var Base64Decode = function (data) +var BuildTilesetIndex = function (mapData) { - var binaryString = window.atob(data); - var len = binaryString.length; - var bytes = new Array(len / 4); + var i; + var set; + var tiles = []; - // Interpret binaryString as an array of bytes representing little-endian encoded uint32 values. - for (var i = 0; i < len; i += 4) + for (i = 0; i < mapData.imageCollections.length; i++) { - bytes[i / 4] = ( - binaryString.charCodeAt(i) | - binaryString.charCodeAt(i + 1) << 8 | - binaryString.charCodeAt(i + 2) << 16 | - binaryString.charCodeAt(i + 3) << 24 - ) >>> 0; + var collection = mapData.imageCollections[i]; + var images = collection.images; + + for (var j = 0; j < images.length; j++) + { + var image = images[j]; + + set = new Tileset(image.image, image.gid, collection.imageWidth, collection.imageHeight, 0, 0); + + set.updateTileData(collection.imageWidth, collection.imageHeight); + + mapData.tilesets.push(set); + } } - return bytes; + for (i = 0; i < mapData.tilesets.length; i++) + { + set = mapData.tilesets[i]; + + var x = set.tileMargin; + var y = set.tileMargin; + + var count = 0; + var countX = 0; + var countY = 0; + + for (var t = set.firstgid; t < set.firstgid + set.total; t++) + { + // Can add extra properties here as needed + tiles[t] = [ x, y, i ]; + + x += set.tileWidth + set.tileSpacing; + + count++; + + if (count === set.total) + { + break; + } + + countX++; + + if (countX === set.columns) + { + x = set.tileMargin; + y += set.tileHeight + set.tileSpacing; + + countX = 0; + countY++; + + if (countY === set.rows) + { + break; + } + } + } + } + + return tiles; }; -module.exports = Base64Decode; +module.exports = BuildTilesetIndex; /***/ }), -/* 511 */ +/* 548 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111083,392 +118200,7 @@ module.exports = ParseImageLayers; /***/ }), -/* 512 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Tileset = __webpack_require__(107); -var ImageCollection = __webpack_require__(513); -var ParseObject = __webpack_require__(239); - -/** - * Tilesets and Image Collections - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseTilesets - * @since 3.0.0 - * - * @param {object} json - The Tiled JSON data. - * - * @return {object} An object containing the tileset and image collection data. - */ -var ParseTilesets = function (json) -{ - var tilesets = []; - var imageCollections = []; - var lastSet = null; - var stringID; - - for (var i = 0; i < json.tilesets.length; i++) - { - // name, firstgid, width, height, margin, spacing, properties - var set = json.tilesets[i]; - - if (set.source) - { - console.warn('Phaser can\'t load external tilesets. Use the Embed Tileset button and then export the map again.'); - } - else if (set.image) - { - var newSet = new Tileset(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing); - - if (json.version > 1) - { - // Tiled 1.2+ - - if (Array.isArray(set.tiles)) - { - var tiles = {}; - var props = {}; - - for (var t = 0; t < set.tiles.length; t++) - { - var tile = set.tiles[t]; - - // Convert tileproperties - if (tile.properties) - { - var newPropData = {}; - - tile.properties.forEach(function (propData) - { - newPropData[propData['name']] = propData['value']; - }); - - props[tile.id] = newPropData; - } - - // Convert objectgroup - if (tile.objectgroup) - { - tiles[tile.id] = { objectgroup: tile.objectgroup }; - - if (tile.objectgroup.objects) - { - var parsedObjects2 = tile.objectgroup.objects.map( - function (obj) { return ParseObject(obj); } - ); - - tiles[tile.id].objectgroup.objects = parsedObjects2; - } - } - - // Copy animation data - if (tile.animation) - { - if (tiles.hasOwnProperty(tile.id)) - { - tiles[tile.id].animation = tile.animation; - } - else - { - tiles[tile.id] = { animation: tile.animation }; - } - } - } - - newSet.tileData = tiles; - newSet.tileProperties = props; - } - } - else - { - // Tiled 1 - - // Properties stored per-tile in object with string indexes starting at "0" - if (set.tileproperties) - { - newSet.tileProperties = set.tileproperties; - } - - // Object & terrain shapes stored per-tile in object with string indexes starting at "0" - if (set.tiles) - { - newSet.tileData = set.tiles; - - // Parse the objects into Phaser format to match handling of other Tiled objects - for (stringID in newSet.tileData) - { - var objectGroup = newSet.tileData[stringID].objectgroup; - if (objectGroup && objectGroup.objects) - { - var parsedObjects1 = objectGroup.objects.map( - function (obj) { return ParseObject(obj); } - ); - newSet.tileData[stringID].objectgroup.objects = parsedObjects1; - } - } - } - } - - // For a normal sliced tileset the row/count/size information is computed when updated. - // This is done (again) after the image is set. - newSet.updateTileData(set.imagewidth, set.imageheight); - - tilesets.push(newSet); - } - else - { - var newCollection = new ImageCollection(set.name, set.firstgid, set.tilewidth, - set.tileheight, set.margin, set.spacing, set.properties); - - for (stringID in set.tiles) - { - var image = set.tiles[stringID].image; - var gid = set.firstgid + parseInt(stringID, 10); - newCollection.addImage(gid, image); - } - - imageCollections.push(newCollection); - } - - // We've got a new Tileset, so set the lastgid into the previous one - if (lastSet) - { - lastSet.lastgid = set.firstgid - 1; - } - - lastSet = set; - } - - return { tilesets: tilesets, imageCollections: imageCollections }; -}; - -module.exports = ParseTilesets; - - -/***/ }), -/* 513 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); - -/** - * @classdesc - * An Image Collection is a special Tile Set containing multiple images, with no slicing into each image. - * - * Image Collections are normally created automatically when Tiled data is loaded. - * - * @class ImageCollection - * @memberof Phaser.Tilemaps - * @constructor - * @since 3.0.0 - * - * @param {string} name - The name of the image collection in the map data. - * @param {integer} firstgid - The first image index this image collection contains. - * @param {integer} [width=32] - Width of widest image (in pixels). - * @param {integer} [height=32] - Height of tallest image (in pixels). - * @param {integer} [margin=0] - The margin around all images in the collection (in pixels). - * @param {integer} [spacing=0] - The spacing between each image in the collection (in pixels). - * @param {object} [properties={}] - Custom Image Collection properties. - */ -var ImageCollection = new Class({ - - initialize: - - function ImageCollection (name, firstgid, width, height, margin, spacing, properties) - { - if (width === undefined || width <= 0) { width = 32; } - if (height === undefined || height <= 0) { height = 32; } - if (margin === undefined) { margin = 0; } - if (spacing === undefined) { spacing = 0; } - - /** - * The name of the Image Collection. - * - * @name Phaser.Tilemaps.ImageCollection#name - * @type {string} - * @since 3.0.0 - */ - this.name = name; - - /** - * The Tiled firstgid value. - * This is the starting index of the first image index this Image Collection contains. - * - * @name Phaser.Tilemaps.ImageCollection#firstgid - * @type {integer} - * @since 3.0.0 - */ - this.firstgid = firstgid | 0; - - /** - * The width of the widest image (in pixels). - * - * @name Phaser.Tilemaps.ImageCollection#imageWidth - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.imageWidth = width | 0; - - /** - * The height of the tallest image (in pixels). - * - * @name Phaser.Tilemaps.ImageCollection#imageHeight - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.imageHeight = height | 0; - - /** - * The margin around the images in the collection (in pixels). - * Use `setSpacing` to change. - * - * @name Phaser.Tilemaps.ImageCollection#imageMarge - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.imageMargin = margin | 0; - - /** - * The spacing between each image in the collection (in pixels). - * Use `setSpacing` to change. - * - * @name Phaser.Tilemaps.ImageCollection#imageSpacing - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.imageSpacing = spacing | 0; - - /** - * Image Collection-specific properties that are typically defined in the Tiled editor. - * - * @name Phaser.Tilemaps.ImageCollection#properties - * @type {object} - * @since 3.0.0 - */ - this.properties = properties || {}; - - /** - * The cached images that are a part of this collection. - * - * @name Phaser.Tilemaps.ImageCollection#images - * @type {array} - * @readonly - * @since 3.0.0 - */ - this.images = []; - - /** - * The total number of images in the image collection. - * - * @name Phaser.Tilemaps.ImageCollection#total - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.total = 0; - }, - - /** - * Returns true if and only if this image collection contains the given image index. - * - * @method Phaser.Tilemaps.ImageCollection#containsImageIndex - * @since 3.0.0 - * - * @param {integer} imageIndex - The image index to search for. - * - * @return {boolean} True if this Image Collection contains the given index. - */ - containsImageIndex: function (imageIndex) - { - return (imageIndex >= this.firstgid && imageIndex < (this.firstgid + this.total)); - }, - - /** - * Add an image to this Image Collection. - * - * @method Phaser.Tilemaps.ImageCollection#addImage - * @since 3.0.0 - * - * @param {integer} gid - The gid of the image in the Image Collection. - * @param {string} image - The the key of the image in the Image Collection and in the cache. - * - * @return {Phaser.Tilemaps.ImageCollection} This ImageCollection object. - */ - addImage: function (gid, image) - { - this.images.push({ gid: gid, image: image }); - this.total++; - - return this; - } - -}); - -module.exports = ImageCollection; - - -/***/ }), -/* 514 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var HasValue = __webpack_require__(115); - -/** - * Returns a new object that only contains the `keys` that were found on the object provided. - * If no `keys` are found, an empty object is returned. - * - * @function Phaser.Utils.Objects.Pick - * @since 3.18.0 - * - * @param {object} object - The object to pick the provided keys from. - * @param {array} keys - An array of properties to retrieve from the provided object. - * - * @return {object} A new object that only contains the `keys` that were found on the provided object. If no `keys` were found, an empty object will be returned. - */ -var Pick = function (object, keys) -{ - var obj = {}; - - for (var i = 0; i < keys.length; i++) - { - var key = keys[i]; - - if (HasValue(object, key)) - { - obj[key] = object[key]; - } - } - - return obj; -}; - -module.exports = Pick; - - -/***/ }), -/* 515 */ +/* 549 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111478,8 +118210,8 @@ module.exports = Pick; */ var GetFastValue = __webpack_require__(2); -var ParseObject = __webpack_require__(239); -var ObjectLayer = __webpack_require__(516); +var ParseObject = __webpack_require__(251); +var ObjectLayer = __webpack_require__(551); var CreateGroupLayer = __webpack_require__(154); /** @@ -111567,7 +118299,51 @@ module.exports = ParseObjectLayers; /***/ }), -/* 516 */ +/* 550 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var HasValue = __webpack_require__(123); + +/** + * Returns a new object that only contains the `keys` that were found on the object provided. + * If no `keys` are found, an empty object is returned. + * + * @function Phaser.Utils.Objects.Pick + * @since 3.18.0 + * + * @param {object} object - The object to pick the provided keys from. + * @param {array} keys - An array of properties to retrieve from the provided object. + * + * @return {object} A new object that only contains the `keys` that were found on the provided object. If no `keys` were found, an empty object will be returned. + */ +var Pick = function (object, keys) +{ + var obj = {}; + + for (var i = 0; i < keys.length; i++) + { + var key = keys[i]; + + if (HasValue(object, key)) + { + obj[key] = object[key]; + } + } + + return obj; +}; + +module.exports = Pick; + + +/***/ }), +/* 551 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111689,7 +118465,7 @@ module.exports = ObjectLayer; /***/ }), -/* 517 */ +/* 552 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111698,93 +118474,269 @@ module.exports = ObjectLayer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Tileset = __webpack_require__(107); +var Base64Decode = __webpack_require__(553); +var CONST = __webpack_require__(29); +var CreateGroupLayer = __webpack_require__(154); +var FromOrientationString = __webpack_require__(242); +var GetFastValue = __webpack_require__(2); +var LayerData = __webpack_require__(117); +var ParseGID = __webpack_require__(252); +var Tile = __webpack_require__(81); /** - * Master list of tiles -> x, y, index in tileset. + * Parses all tilemap layers in a Tiled JSON object into new LayerData objects. * - * @function Phaser.Tilemaps.Parsers.Tiled.BuildTilesetIndex + * @function Phaser.Tilemaps.Parsers.Tiled.ParseTileLayers * @since 3.0.0 * - * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. + * @param {object} json - The Tiled JSON object. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}). * - * @return {array} An array of Tileset objects. + * @return {Phaser.Tilemaps.LayerData[]} - An array of LayerData objects, one for each entry in + * json.layers with the type 'tilelayer'. */ -var BuildTilesetIndex = function (mapData) +var ParseTileLayers = function (json, insertNull) { - var i; - var set; - var tiles = []; + var infiniteMap = GetFastValue(json, 'infinite', false); + var tileLayers = []; - for (i = 0; i < mapData.imageCollections.length; i++) + // State inherited from a parent group + var groupStack = []; + var curGroupState = CreateGroupLayer(json); + + while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) { - var collection = mapData.imageCollections[i]; - var images = collection.images; - - for (var j = 0; j < images.length; j++) + if (curGroupState.i >= curGroupState.layers.length) { - var image = images[j]; - - set = new Tileset(image.image, image.gid, collection.imageWidth, collection.imageHeight, 0, 0); - - set.updateTileData(collection.imageWidth, collection.imageHeight); - - mapData.tilesets.push(set); - } - } - - for (i = 0; i < mapData.tilesets.length; i++) - { - set = mapData.tilesets[i]; - - var x = set.tileMargin; - var y = set.tileMargin; - - var count = 0; - var countX = 0; - var countY = 0; - - for (var t = set.firstgid; t < set.firstgid + set.total; t++) - { - // Can add extra properties here as needed - tiles[t] = [ x, y, i ]; - - x += set.tileWidth + set.tileSpacing; - - count++; - - if (count === set.total) + // Ensure recursion stack is not empty first + if (groupStack.length < 1) { + console.warn( + 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' + ); break; } - countX++; + // Return to previous recursive state + curGroupState = groupStack.pop(); + continue; + } - if (countX === set.columns) + var curl = curGroupState.layers[curGroupState.i]; + curGroupState.i++; + + if (curl.type !== 'tilelayer') + { + if (curl.type === 'group') { - x = set.tileMargin; - y += set.tileHeight + set.tileSpacing; + // Compute next state inherited from group + var nextGroupState = CreateGroupLayer(json, curl, curGroupState); - countX = 0; - countY++; + // Preserve current state before recursing + groupStack.push(curGroupState); + curGroupState = nextGroupState; + } - if (countY === set.rows) + // Skip this layer OR 'recurse' (iterative style) into the group + continue; + } + + // Base64 decode data if necessary. NOTE: uncompressed base64 only. + if (curl.compression) + { + console.warn( + 'TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer \'' + + curl.name + '\'' + ); + continue; + } + else if (curl.encoding && curl.encoding === 'base64') + { + // Chunks for an infinite map + if (curl.chunks) + { + for (var i = 0; i < curl.chunks.length; i++) { - break; + curl.chunks[i].data = Base64Decode(curl.chunks[i].data); + } + } + + // Non-infinite map data + if (curl.data) + { + curl.data = Base64Decode(curl.data); + } + + delete curl.encoding; // Allow the same map to be parsed multiple times + } + + // This is an array containing the tile indexes, one after the other. -1 = no tile, + // everything else = the tile index (starting at 1 for Tiled, 0 for CSV) If the map + // contains multiple tilesets then the indexes are relative to that which the set starts + // from. Need to set which tileset in the cache = which tileset in the JSON, if you do this + // manually it means you can use the same map data but a new tileset. + + var layerData; + var gidInfo; + var tile; + var blankTile; + + var output = []; + var x = 0; + + if (infiniteMap) + { + var layerOffsetX = (GetFastValue(curl, 'startx', 0) + curl.x); + var layerOffsetY = (GetFastValue(curl, 'starty', 0) + curl.y); + + layerData = new LayerData({ + name: (curGroupState.name + curl.name), + x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth), + y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight), + width: curl.width, + height: curl.height, + tileWidth: json.tilewidth, + tileHeight: json.tileheight, + alpha: (curGroupState.opacity * curl.opacity), + visible: (curGroupState.visible && curl.visible), + properties: GetFastValue(curl, 'properties', []), + orientation: FromOrientationString(json.orientation) + }); + + if (layerData.orientation === CONST.HEXAGONAL) + { + layerData.hexSideLength = json.hexsidelength; + } + + for (var c = 0; c < curl.height; c++) + { + output.push([ null ]); + + for (var j = 0; j < curl.width; j++) + { + output[c][j] = null; + } + } + + for (c = 0, len = curl.chunks.length; c < len; c++) + { + var chunk = curl.chunks[c]; + + var offsetX = (chunk.x - layerOffsetX); + var offsetY = (chunk.y - layerOffsetY); + + var y = 0; + + for (var t = 0, len2 = chunk.data.length; t < len2; t++) + { + var newOffsetX = x + offsetX; + var newOffsetY = y + offsetY; + + gidInfo = ParseGID(chunk.data[t]); + + // index, x, y, width, height + if (gidInfo.gid > 0) + { + tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); + + // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal + // propeties into flipX, flipY and rotation + tile.rotation = gidInfo.rotation; + tile.flipX = gidInfo.flipped; + + output[newOffsetY][newOffsetX] = tile; + } + else + { + blankTile = insertNull + ? null + : new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); + + output[newOffsetY][newOffsetX] = blankTile; + } + + x++; + + if (x === chunk.width) + { + y++; + x = 0; + } } } } + else + { + layerData = new LayerData({ + name: (curGroupState.name + curl.name), + x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x), + y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y), + width: curl.width, + height: curl.height, + tileWidth: json.tilewidth, + tileHeight: json.tileheight, + alpha: (curGroupState.opacity * curl.opacity), + visible: (curGroupState.visible && curl.visible), + properties: GetFastValue(curl, 'properties', []), + orientation: FromOrientationString(json.orientation) + }); + + if (layerData.orientation === CONST.HEXAGONAL) + { + layerData.hexSideLength = json.hexsidelength; + } + var row = []; + + // Loop through the data field in the JSON. + for (var k = 0, len = curl.data.length; k < len; k++) + { + gidInfo = ParseGID(curl.data[k]); + + // index, x, y, width, height + if (gidInfo.gid > 0) + { + tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth, json.tileheight); + + // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal + // propeties into flipX, flipY and rotation + tile.rotation = gidInfo.rotation; + tile.flipX = gidInfo.flipped; + + row.push(tile); + } + else + { + blankTile = insertNull + ? null + : new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight); + row.push(blankTile); + } + + x++; + + if (x === curl.width) + { + output.push(row); + x = 0; + row = []; + } + } + } + + layerData.data = output; + tileLayers.push(layerData); } - return tiles; + return tileLayers; }; -module.exports = BuildTilesetIndex; +module.exports = ParseTileLayers; /***/ }), -/* 518 */ -/***/ (function(module, exports, __webpack_require__) { +/* 553 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -111792,71 +118744,41 @@ module.exports = BuildTilesetIndex; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(19); - /** - * Copy properties from tileset to tiles. + * Decode base-64 encoded data, for example as exported by Tiled. * - * @function Phaser.Tilemaps.Parsers.Tiled.AssignTileProperties + * @function Phaser.Tilemaps.Parsers.Tiled.Base64Decode * @since 3.0.0 * - * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. + * @param {object} data - Base-64 encoded data to decode. + * + * @return {array} Array containing the decoded bytes. */ -var AssignTileProperties = function (mapData) +var Base64Decode = function (data) { - var layerData; - var tile; - var sid; - var set; - var row; + var binaryString = window.atob(data); + var len = binaryString.length; + var bytes = new Array(len / 4); - // go through each of the map data layers - for (var i = 0; i < mapData.layers.length; i++) + // Interpret binaryString as an array of bytes representing little-endian encoded uint32 values. + for (var i = 0; i < len; i += 4) { - layerData = mapData.layers[i]; - - set = null; - - // rows of tiles - for (var j = 0; j < layerData.data.length; j++) - { - row = layerData.data[j]; - - // individual tiles - for (var k = 0; k < row.length; k++) - { - tile = row[k]; - - if (tile === null || tile.index < 0) - { - continue; - } - - // find the relevant tileset - sid = mapData.tiles[tile.index][2]; - set = mapData.tilesets[sid]; - - // Ensure that a tile's size matches its tileset - tile.width = set.tileWidth; - tile.height = set.tileHeight; - - // if that tile type has any properties, add them to the tile object - if (set.tileProperties && set.tileProperties[tile.index - set.firstgid]) - { - tile.properties = Extend( - tile.properties, set.tileProperties[tile.index - set.firstgid] - ); - } - } - } + bytes[i / 4] = ( + binaryString.charCodeAt(i) | + binaryString.charCodeAt(i + 1) << 8 | + binaryString.charCodeAt(i + 2) << 16 | + binaryString.charCodeAt(i + 3) << 24 + ) >>> 0; } + + return bytes; }; -module.exports = AssignTileProperties; +module.exports = Base64Decode; /***/ }), -/* 519 */ +/* 554 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111865,10 +118787,363 @@ module.exports = AssignTileProperties; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var MapData = __webpack_require__(106); -var ParseTileLayers = __webpack_require__(520); -var ParseTilesets = __webpack_require__(521); +var Tileset = __webpack_require__(119); +var ImageCollection = __webpack_require__(555); +var ParseObject = __webpack_require__(251); + +/** + * Tilesets and Image Collections + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseTilesets + * @since 3.0.0 + * + * @param {object} json - The Tiled JSON data. + * + * @return {object} An object containing the tileset and image collection data. + */ +var ParseTilesets = function (json) +{ + var tilesets = []; + var imageCollections = []; + var lastSet = null; + var stringID; + + for (var i = 0; i < json.tilesets.length; i++) + { + // name, firstgid, width, height, margin, spacing, properties + var set = json.tilesets[i]; + + if (set.source) + { + console.warn('External tilesets unsupported. Use Embed Tileset and re-export'); + } + else if (set.image) + { + var newSet = new Tileset(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing); + + if (json.version > 1) + { + // Tiled 1.2+ + + if (Array.isArray(set.tiles)) + { + var tiles = {}; + var props = {}; + + for (var t = 0; t < set.tiles.length; t++) + { + var tile = set.tiles[t]; + + // Convert tileproperties + if (tile.properties) + { + var newPropData = {}; + + tile.properties.forEach(function (propData) + { + newPropData[propData['name']] = propData['value']; + }); + + props[tile.id] = newPropData; + } + + // Convert objectgroup + if (tile.objectgroup) + { + tiles[tile.id] = { objectgroup: tile.objectgroup }; + + if (tile.objectgroup.objects) + { + var parsedObjects2 = tile.objectgroup.objects.map(function (obj) + { + return ParseObject(obj); + }); + + tiles[tile.id].objectgroup.objects = parsedObjects2; + } + } + + // Copy animation data + if (tile.animation) + { + if (tiles.hasOwnProperty(tile.id)) + { + tiles[tile.id].animation = tile.animation; + } + else + { + tiles[tile.id] = { animation: tile.animation }; + } + } + } + + newSet.tileData = tiles; + newSet.tileProperties = props; + } + } + else + { + // Tiled 1 + + // Properties stored per-tile in object with string indexes starting at "0" + if (set.tileproperties) + { + newSet.tileProperties = set.tileproperties; + } + + // Object & terrain shapes stored per-tile in object with string indexes starting at "0" + if (set.tiles) + { + newSet.tileData = set.tiles; + + // Parse the objects into Phaser format to match handling of other Tiled objects + for (stringID in newSet.tileData) + { + var objectGroup = newSet.tileData[stringID].objectgroup; + + if (objectGroup && objectGroup.objects) + { + var parsedObjects1 = objectGroup.objects.map(function (obj) + { + return ParseObject(obj); + }); + + newSet.tileData[stringID].objectgroup.objects = parsedObjects1; + } + } + } + } + + // For a normal sliced tileset the row/count/size information is computed when updated. + // This is done (again) after the image is set. + newSet.updateTileData(set.imagewidth, set.imageheight); + + tilesets.push(newSet); + } + else + { + var newCollection = new ImageCollection(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing, set.properties); + + var maxId = 0; + + for (t = 0; t < set.tiles.length; t++) + { + tile = set.tiles[t]; + + var image = tile.image; + var tileId = parseInt(tile.id, 10); + var gid = set.firstgid + tileId; + newCollection.addImage(gid, image); + + maxId = Math.max(tileId, maxId); + } + + newCollection.maxId = maxId; + + imageCollections.push(newCollection); + } + + // We've got a new Tileset, so set the lastgid into the previous one + if (lastSet) + { + lastSet.lastgid = set.firstgid - 1; + } + + lastSet = set; + } + + return { tilesets: tilesets, imageCollections: imageCollections }; +}; + +module.exports = ParseTilesets; + + +/***/ }), +/* 555 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * An Image Collection is a special Tile Set containing multiple images, with no slicing into each image. + * + * Image Collections are normally created automatically when Tiled data is loaded. + * + * @class ImageCollection + * @memberof Phaser.Tilemaps + * @constructor + * @since 3.0.0 + * + * @param {string} name - The name of the image collection in the map data. + * @param {number} firstgid - The first image index this image collection contains. + * @param {number} [width=32] - Width of widest image (in pixels). + * @param {number} [height=32] - Height of tallest image (in pixels). + * @param {number} [margin=0] - The margin around all images in the collection (in pixels). + * @param {number} [spacing=0] - The spacing between each image in the collection (in pixels). + * @param {object} [properties={}] - Custom Image Collection properties. + */ +var ImageCollection = new Class({ + + initialize: + + function ImageCollection (name, firstgid, width, height, margin, spacing, properties) + { + if (width === undefined || width <= 0) { width = 32; } + if (height === undefined || height <= 0) { height = 32; } + if (margin === undefined) { margin = 0; } + if (spacing === undefined) { spacing = 0; } + + /** + * The name of the Image Collection. + * + * @name Phaser.Tilemaps.ImageCollection#name + * @type {string} + * @since 3.0.0 + */ + this.name = name; + + /** + * The Tiled firstgid value. + * This is the starting index of the first image index this Image Collection contains. + * + * @name Phaser.Tilemaps.ImageCollection#firstgid + * @type {number} + * @since 3.0.0 + */ + this.firstgid = firstgid | 0; + + /** + * The width of the widest image (in pixels). + * + * @name Phaser.Tilemaps.ImageCollection#imageWidth + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageWidth = width | 0; + + /** + * The height of the tallest image (in pixels). + * + * @name Phaser.Tilemaps.ImageCollection#imageHeight + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageHeight = height | 0; + + /** + * The margin around the images in the collection (in pixels). + * Use `setSpacing` to change. + * + * @name Phaser.Tilemaps.ImageCollection#imageMarge + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageMargin = margin | 0; + + /** + * The spacing between each image in the collection (in pixels). + * Use `setSpacing` to change. + * + * @name Phaser.Tilemaps.ImageCollection#imageSpacing + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageSpacing = spacing | 0; + + /** + * Image Collection-specific properties that are typically defined in the Tiled editor. + * + * @name Phaser.Tilemaps.ImageCollection#properties + * @type {object} + * @since 3.0.0 + */ + this.properties = properties || {}; + + /** + * The cached images that are a part of this collection. + * + * @name Phaser.Tilemaps.ImageCollection#images + * @type {array} + * @readonly + * @since 3.0.0 + */ + this.images = []; + + /** + * The total number of images in the image collection. + * + * @name Phaser.Tilemaps.ImageCollection#total + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.total = 0; + }, + + /** + * Returns true if and only if this image collection contains the given image index. + * + * @method Phaser.Tilemaps.ImageCollection#containsImageIndex + * @since 3.0.0 + * + * @param {number} imageIndex - The image index to search for. + * + * @return {boolean} True if this Image Collection contains the given index. + */ + containsImageIndex: function (imageIndex) + { + return (imageIndex >= this.firstgid && imageIndex < (this.firstgid + this.total)); + }, + + /** + * Add an image to this Image Collection. + * + * @method Phaser.Tilemaps.ImageCollection#addImage + * @since 3.0.0 + * + * @param {number} gid - The gid of the image in the Image Collection. + * @param {string} image - The the key of the image in the Image Collection and in the cache. + * + * @return {Phaser.Tilemaps.ImageCollection} This ImageCollection object. + */ + addImage: function (gid, image) + { + this.images.push({ gid: gid, image: image }); + this.total++; + + return this; + } + +}); + +module.exports = ImageCollection; + + +/***/ }), +/* 556 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Formats = __webpack_require__(38); +var MapData = __webpack_require__(118); +var ParseTileLayers = __webpack_require__(557); +var ParseTilesets = __webpack_require__(558); /** * Parses a Weltmeister JSON object into a new MapData object. @@ -111923,7 +119198,7 @@ module.exports = ParseWeltmeister; /***/ }), -/* 520 */ +/* 557 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -111932,8 +119207,8 @@ module.exports = ParseWeltmeister; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LayerData = __webpack_require__(105); -var Tile = __webpack_require__(75); +var LayerData = __webpack_require__(117); +var Tile = __webpack_require__(81); /** * Parses all tilemap layers in an Impact JSON object into new LayerData objects. @@ -112009,7 +119284,7 @@ module.exports = ParseTileLayers; /***/ }), -/* 521 */ +/* 558 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112018,7 +119293,7 @@ module.exports = ParseTileLayers; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Tileset = __webpack_require__(107); +var Tileset = __webpack_require__(119); /** * Tilesets and Image Collections @@ -112060,7 +119335,7 @@ module.exports = ParseTilesets; /***/ }), -/* 522 */ +/* 559 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112070,17 +119345,17 @@ module.exports = ParseTilesets; */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(41); -var DynamicTilemapLayer = __webpack_require__(523); -var Extend = __webpack_require__(19); -var Formats = __webpack_require__(33); -var LayerData = __webpack_require__(105); -var Rotate = __webpack_require__(344); -var SpliceOne = __webpack_require__(82); -var StaticTilemapLayer = __webpack_require__(524); -var Tile = __webpack_require__(75); -var TilemapComponents = __webpack_require__(149); -var Tileset = __webpack_require__(107); +var DegToRad = __webpack_require__(34); +var Formats = __webpack_require__(38); +var GetFastValue = __webpack_require__(2); +var LayerData = __webpack_require__(117); +var Rotate = __webpack_require__(354); +var SpliceOne = __webpack_require__(103); +var Sprite = __webpack_require__(70); +var Tile = __webpack_require__(81); +var TilemapComponents = __webpack_require__(243); +var TilemapLayer = __webpack_require__(560); +var Tileset = __webpack_require__(119); /** * @callback TilemapFilterCallback @@ -112106,25 +119381,39 @@ var Tileset = __webpack_require__(107); * @classdesc * A Tilemap is a container for Tilemap data. This isn't a display object, rather, it holds data * about the map and allows you to add tilesets and tilemap layers to it. A map can have one or - * more tilemap layers (StaticTilemapLayer or DynamicTilemapLayer), which are the display - * objects that actually render tiles. + * more tilemap layers, which are the display objects that actually render the tiles. * - * The Tilemap data be parsed from a Tiled JSON file, a CSV file or a 2D array. Tiled is a free + * The Tilemap data can be parsed from a Tiled JSON file, a CSV file or a 2D array. Tiled is a free * software package specifically for creating tile maps, and is available from: * http://www.mapeditor.org * - * A Tilemap has handy methods for getting & manipulating the tiles within a layer. You can only - * use the methods that change tiles (e.g. removeTileAt) on a DynamicTilemapLayer. + * As of Phaser 3.50.0 the Tilemap API now supports the following types of map: + * + * 1) Orthogonal + * 2) Isometric + * 3) Hexagonal + * 4) Staggered + * + * Prior to this release, only orthogonal maps were supported. + * + * Another large change in 3.50 was the consolidation of Tilemap Layers. Previously, you created + * either a Static or Dynamic Tilemap Layer. However, as of 3.50 the features of both have been + * merged and the API simplified, so now there is just the single `TilemapLayer` class. + * + * A Tilemap has handy methods for getting and manipulating the tiles within a layer, allowing + * you to build or modify the tilemap data at runtime. * * Note that all Tilemaps use a base tile size to calculate dimensions from, but that a - * StaticTilemapLayer or DynamicTilemapLayer may have its own unique tile size that overrides - * it. + * TilemapLayer may have its own unique tile size that overrides this. * * As of Phaser 3.21.0, if your tilemap includes layer groups (a feature of Tiled 1.2.0+) these - * will be traversed and the following properties will affect children: - * - opacity (blended with parent) and visibility (parent overrides child) + * will be traversed and the following properties will impact children: + * + * - Opacity (blended with parent) and visibility (parent overrides child) * - Vertical and horizontal offset + * * The grouping hierarchy is not preserved and all layers will be flattened into a single array. + * * Group layers are parsed during Tilemap construction but are discarded after parsing so dynamic * layers will NOT continue to be affected by a parent. * @@ -112159,7 +119448,7 @@ var Tilemap = new Class({ * width. * * @name Phaser.Tilemaps.Tilemap#tileWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.tileWidth = mapData.tileWidth; @@ -112169,7 +119458,7 @@ var Tilemap = new Class({ * tile height. * * @name Phaser.Tilemaps.Tilemap#tileHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.tileHeight = mapData.tileHeight; @@ -112265,6 +119554,7 @@ var Tilemap = new Class({ this.heightInPixels = mapData.heightInPixels; /** + * A collection of Images, as parsed from Tiled map data. * * @name Phaser.Tilemaps.Tilemap#imageCollections * @type {Phaser.Tilemaps.ImageCollection[]} @@ -112312,10 +119602,70 @@ var Tilemap = new Class({ * The index of the currently selected LayerData object. * * @name Phaser.Tilemaps.Tilemap#currentLayerIndex - * @type {integer} + * @type {number} * @since 3.0.0 */ this.currentLayerIndex = 0; + + /** + * The length of the horizontal sides of the hexagon. + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.Tilemap#hexSideLength + * @type {number} + * @since 3.50.0 + */ + this.hexSideLength = mapData.hexSideLength; + + var orientation = this.orientation; + + /** + * Functions used to handle world to tile, and tile to world, conversion. + * Cached here for internal use by public methods such as `worldToTileXY`, etc. + * + * @name Phaser.Tilemaps.Tilemap#_convert + * @private + * @type {object} + * @since 3.50.0 + */ + this._convert = { + WorldToTileXY: TilemapComponents.GetWorldToTileXYFunction(orientation), + WorldToTileX: TilemapComponents.GetWorldToTileXFunction(orientation), + WorldToTileY: TilemapComponents.GetWorldToTileYFunction(orientation), + TileToWorldXY: TilemapComponents.GetTileToWorldXYFunction(orientation), + TileToWorldX: TilemapComponents.GetTileToWorldXFunction(orientation), + TileToWorldY: TilemapComponents.GetTileToWorldYFunction(orientation) + }; + }, + + /** + * @ignore + */ + createBlankDynamicLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) + { + console.warn('createBlankDynamicLayer is deprecated. Use createBlankLayer'); + + return this.createBlankLayer(name, tileset, x, y, width, height, tileWidth, tileHeight); + }, + + /** + * @ignore + */ + createDynamicLayer: function (layerID, tileset, x, y) + { + console.warn('createDynamicLayer is deprecated. Use createLayer'); + + return this.createLayer(layerID, tileset, x, y); + }, + + /** + * @ignore + */ + createStaticLayer: function (layerID, tileset, x, y) + { + console.warn('createStaticLayer is deprecated. Use createLayer'); + + return this.createLayer(layerID, tileset, x, y); }, /** @@ -112336,14 +119686,14 @@ var Tilemap = new Class({ * * You can provide either an integer (0 to 3), or the string version of the order. * - * Calling this method _after_ creating Static or Dynamic Tilemap Layers will **not** automatically + * Calling this method _after_ creating Tilemap Layers will **not** automatically * update them to use the new render order. If you call this method after creating layers, use their * own `setRenderOrder` methods to change them as needed. * * @method Phaser.Tilemaps.Tilemap#setRenderOrder * @since 3.12.0 * - * @param {(integer|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. + * @param {(number|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. * * @return {this} This Tilemap object. */ @@ -112375,17 +119725,17 @@ var Tilemap = new Class({ * @param {string} tilesetName - The name of the tileset as specified in the map data. * @param {string} [key] - The key of the Phaser.Cache image used for this tileset. If * `undefined` or `null` it will look for an image with a key matching the tilesetName parameter. - * @param {integer} [tileWidth] - The width of the tile (in pixels) in the Tileset Image. If not + * @param {number} [tileWidth] - The width of the tile (in pixels) in the Tileset Image. If not * given it will default to the map's tileWidth value, or the tileWidth specified in the Tiled * JSON file. - * @param {integer} [tileHeight] - The height of the tiles (in pixels) in the Tileset Image. If + * @param {number} [tileHeight] - The height of the tiles (in pixels) in the Tileset Image. If * not given it will default to the map's tileHeight value, or the tileHeight specified in the * Tiled JSON file. - * @param {integer} [tileMargin] - The margin around the tiles in the sheet (in pixels). If not + * @param {number} [tileMargin] - The margin around the tiles in the sheet (in pixels). If not * specified, it will default to 0 or the value specified in the Tiled JSON file. - * @param {integer} [tileSpacing] - The spacing between each the tile in the sheet (in pixels). + * @param {number} [tileSpacing] - The spacing between each the tile in the sheet (in pixels). * If not specified, it will default to 0 or the value specified in the Tiled JSON file. - * @param {integer} [gid=0] - If adding multiple tilesets to a blank map, specify the starting + * @param {number} [gid=0] - If adding multiple tilesets to a blank map, specify the starting * GID this set will use here. * * @return {?Phaser.Tilemaps.Tileset} Returns the Tileset object that was created or updated, or null if it @@ -112438,51 +119788,6 @@ var Tilemap = new Class({ return tileset; }, - /** - * Turns the DynamicTilemapLayer associated with the given layer into a StaticTilemapLayer. If - * no layer specified, the map's current layer is used. This is useful if you want to manipulate - * a map at the start of a scene, but then make it non-manipulable and optimize it for speed. - * Note: the DynamicTilemapLayer passed in is destroyed, so make sure to store the value - * returned from this method if you want to manipulate the new StaticTilemapLayer. - * - * @method Phaser.Tilemaps.Tilemap#convertLayerToStatic - * @since 3.0.0 - * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer)} [layer] - The name of the layer from Tiled, the - * index of the layer in the map, or a DynamicTilemapLayer. - * - * @return {?Phaser.Tilemaps.StaticTilemapLayer} Returns the new layer that was created, or null if it - * failed. - */ - convertLayerToStatic: function (layer) - { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - var dynamicLayer = layer.tilemapLayer; - - if (!dynamicLayer || !(dynamicLayer instanceof DynamicTilemapLayer)) - { - return null; - } - - var staticLayer = new StaticTilemapLayer( - dynamicLayer.scene, - dynamicLayer.tilemap, - dynamicLayer.layerIndex, - dynamicLayer.tileset, - dynamicLayer.x, - dynamicLayer.y - ); - - this.scene.sys.displayList.add(staticLayer); - - dynamicLayer.destroy(); - - return staticLayer; - }, - /** * Copies the tiles in the source rectangular area to a new destination (all specified in tile * coordinates) within the layer. This copies all tile properties & recalculates collision @@ -112493,14 +119798,14 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#copy * @since 3.0.0 * - * @param {integer} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} width - The width of the area to copy, in tiles, not pixels. - * @param {integer} height - The height of the area to copy, in tiles, not pixels. - * @param {integer} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. - * @param {integer} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. + * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. + * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. + * @param {number} width - The width of the area to copy, in tiles, not pixels. + * @param {number} height - The height of the area to copy, in tiles, not pixels. + * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. + * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -112508,8 +119813,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'copy')) { return this; } - if (layer !== null) { TilemapComponents.Copy( @@ -112528,23 +119831,25 @@ var Tilemap = new Class({ }, /** - * Creates a new and empty DynamicTilemapLayer. The currently selected layer in the map is set to this new layer. + * Creates a new and empty Tilemap Layer. The currently selected layer in the map is set to this new layer. * - * @method Phaser.Tilemaps.Tilemap#createBlankDynamicLayer + * Prior to v3.50.0 this method was called `createBlankDynamicLayer`. + * + * @method Phaser.Tilemaps.Tilemap#createBlankLayer * @since 3.0.0 * * @param {string} name - The name of this layer. Must be unique within the map. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. * @param {number} [x=0] - The world x position where the top left of this layer will be placed. * @param {number} [y=0] - The world y position where the top left of this layer will be placed. - * @param {integer} [width] - The width of the layer in tiles. If not specified, it will default to the map's width. - * @param {integer} [height] - The height of the layer in tiles. If not specified, it will default to the map's height. - * @param {integer} [tileWidth] - The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth. - * @param {integer} [tileHeight] - The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight. + * @param {number} [width] - The width of the layer in tiles. If not specified, it will default to the map's width. + * @param {number} [height] - The height of the layer in tiles. If not specified, it will default to the map's height. + * @param {number} [tileWidth] - The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth. + * @param {number} [tileHeight] - The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight. * - * @return {?Phaser.Tilemaps.DynamicTilemapLayer} Returns the new layer that was created, or `null` if it failed. + * @return {?Phaser.Tilemaps.TilemapLayer} Returns the new layer that was created, or `null` if it failed. */ - createBlankDynamicLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) + createBlankLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) { if (x === undefined) { x = 0; } if (y === undefined) { y = 0; } @@ -112566,7 +119871,8 @@ var Tilemap = new Class({ tileWidth: tileWidth, tileHeight: tileHeight, width: width, - height: height + height: height, + orientation: this.orientation }); var row; @@ -112587,37 +119893,36 @@ var Tilemap = new Class({ this.currentLayerIndex = this.layers.length - 1; - var dynamicLayer = new DynamicTilemapLayer(this.scene, this, this.currentLayerIndex, tileset, x, y); + var layer = new TilemapLayer(this.scene, this, this.currentLayerIndex, tileset, x, y); - dynamicLayer.setRenderOrder(this.renderOrder); + layer.setRenderOrder(this.renderOrder); - this.scene.sys.displayList.add(dynamicLayer); + this.scene.sys.displayList.add(layer); - return dynamicLayer; + return layer; }, /** - * Creates a new DynamicTilemapLayer that renders the LayerData associated with the given + * Creates a new Tilemap Layer that renders the LayerData associated with the given * `layerID`. The currently selected layer in the map is set to this new layer. * * The `layerID` is important. If you've created your map in Tiled then you can get this by * looking in Tiled and looking at the layer name. Or you can open the JSON file it exports and * look at the layers[].name value. Either way it must match. * - * Unlike a static layer, a dynamic layer can be modified. See DynamicTilemapLayer for more - * information. + * Prior to v3.50.0 this method was called `createDynamicLayer`. * - * @method Phaser.Tilemaps.Tilemap#createDynamicLayer + * @method Phaser.Tilemaps.Tilemap#createLayer * @since 3.0.0 * - * @param {(integer|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. + * @param {(number|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. * - * @return {?Phaser.Tilemaps.DynamicTilemapLayer} Returns the new layer was created, or null if it failed. + * @return {?Phaser.Tilemaps.TilemapLayer} Returns the new layer was created, or null if it failed. */ - createDynamicLayer: function (layerID, tileset, x, y) + createLayer: function (layerID, tileset, x, y) { var index = this.getLayerIndex(layerID); @@ -112656,7 +119961,7 @@ var Tilemap = new Class({ y = layerData.y; } - var layer = new DynamicTilemapLayer(this.scene, this, index, tileset, x, y); + var layer = new TilemapLayer(this.scene, this, index, tileset, x, y); layer.setRenderOrder(this.renderOrder); @@ -112666,87 +119971,188 @@ var Tilemap = new Class({ }, /** - * Creates a Sprite for every object matching the given gid in the map data. All properties from - * the map data objectgroup are copied into the `spriteConfig`, so you can use this as an easy - * way to configure Sprite properties from within the map editor. For example giving an object a - * property of alpha: 0.5 in the map editor will duplicate that when the Sprite is created. + * This method will iterate through all of the objects defined in a Tiled Object Layer and then + * convert the matching results into Phaser Game Objects (by default, Sprites) * - * Custom object properties not sharing names with the Sprite's own properties are copied to the - * Sprite's {@link Phaser.GameObjects.Sprite#data data store}. + * Objects are matched on one of 3 criteria: The Object ID, the Object GID or the Object Name. + * + * Within Tiled, Object IDs are unique per Object. Object GIDs, however, are shared by all objects + * using the same image. Finally, Object Names are strings and the same name can be used on multiple + * Objects in Tiled, they do not have to be unique. + * + * You set the configuration parameter accordingly, based on which type of criteria you wish + * to match against. For example, to convert all items on an Object Layer with a `gid` of 26: + * + * ```javascript + * createFromObjects(layerName, { + * gid: 26 + * }); + * ``` + * + * Or, to convert objects with the name 'bonus': + * + * ```javascript + * createFromObjects(layerName, { + * name: 'bonus' + * }); + * ``` + * + * Or, to convert an object with a specific id: + * + * ```javascript + * createFromObjects(layerName, { + * id: 9 + * }); + * ``` + * + * You should only specify either `id`, `gid`, `name`, or none of them. Do not add more than + * one criteria to your config. If you do not specify any criteria, then _all_ objects in the + * Object Layer will be converted. + * + * By default this method will convert objects into `Sprite` instances, but you can override + * this by providing your own class type: + * + * ```javascript + * createFromObjects(layerName, { + * gid: 26, + * classType: Coin + * }); + * ``` + * + * This will convert all Objects with a gid of 26 into your custom `Coin` class. You can pass + * any class type here, but it _must_ extend `Phaser.GameObjects.GameObject` as its base class. + * Your class will always be passed 1 parameter: `scene`, which is a reference to either the Scene + * specified in the config object or, if not given, the Scene to which this Tilemap belongs. + * + * All properties from object are copied into the Game Object, so you can use this as an easy + * way to configure properties from within the map editor. For example giving an object a + * property of `alpha: 0.5` in Tiled will be reflected in the Game Object that is created. + * + * Custom object properties that do not exist as a Game Object property are set in the + * Game Objects {@link Phaser.GameObjects.GameObject#data data store}. + * + * You can use set a `container` property in the config. If given, the class will be added to + * the Container instance instead of the Scene. + * + * Finally, you can provide an array of config objects, to convert multiple types of object in + * a single call: + * + * ```javascript + * createFromObjects(layerName, [ + * { + * gid: 26, + * classType: Coin + * }, + * { + * id: 9, + * classType: BossMonster + * }, + * { + * name: 'lava', + * classType: LavaTile + * } + * ]); + * ``` + * + * The signature of this method changed significantly in v3.50.0. Prior to this, it did not take config objects. * * @method Phaser.Tilemaps.Tilemap#createFromObjects * @since 3.0.0 * - * @param {string} name - The name of the object layer (from Tiled) to create Sprites from. - * @param {(integer|string)} id - Either the id (object), gid (tile object) or name (object or - * tile object) from Tiled. Ids are unique in Tiled, but a gid is shared by all tile objects - * with the same graphic. The same name can be used on multiple objects. - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. - * scene.make.sprite). - * @param {Phaser.Scene} [scene=the scene the map is within] - The Scene to create the Sprites within. + * @param {string} objectLayerName - The name of the Tiled object layer to create the Game Objects from. + * @param {Phaser.Types.Tilemaps.CreateFromObjectLayerConfig|Phaser.Types.Tilemaps.CreateFromObjectLayerConfig[]} config - A CreateFromObjects configuration object, or an array of them. * - * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. + * @return {Phaser.GameObjects.GameObject[]} An array containing the Game Objects that were created. Empty if invalid object layer, or no matching id/gid/name was found. */ - createFromObjects: function (name, id, spriteConfig, scene) + createFromObjects: function (objectLayerName, config) { - if (spriteConfig === undefined) { spriteConfig = {}; } - if (scene === undefined) { scene = this.scene; } + var results = []; - var objectLayer = this.getObjectLayer(name); + var objectLayer = this.getObjectLayer(objectLayerName); if (!objectLayer) { - console.warn('Cannot create from object. Invalid objectgroup name given: ' + name); + console.warn('createFromObjects: Invalid objectLayerName given: ' + objectLayerName); - if (typeof layerID === 'string') - { - console.warn('Valid objectgroup names:\n\t' + this.getObjectLayerNames().join(',\n\t')); - } + return results; + } - return null; + if (!Array.isArray(config)) + { + config = [ config ]; } var objects = objectLayer.objects; - var sprites = []; - for (var i = 0; i < objects.length; i++) + for (var c = 0; c < config.length; c++) { - var found = false; - var obj = objects[i]; + var singleConfig = config[c]; - if (obj.gid !== undefined && typeof id === 'number' && obj.gid === id || - obj.id !== undefined && typeof id === 'number' && obj.id === id || - obj.name !== undefined && typeof id === 'string' && obj.name === id) + var id = GetFastValue(singleConfig, 'id', null); + var gid = GetFastValue(singleConfig, 'gid', null); + var name = GetFastValue(singleConfig, 'name', null); + + var obj; + var toConvert = []; + + // Sweep to get all the objects we want to convert in this pass + for (var s = 0; s < objects.length; s++) { - found = true; + obj = objects[s]; + + if ( + (id === null && gid === null && name === null) || + (id !== null && obj.id === id) || + (gid !== null && obj.gid === gid) || + (name !== null && obj.name === name) + ) + { + toConvert.push(obj); + } } - if (found) + // Now let's convert them ... + + var classType = GetFastValue(singleConfig, 'classType', Sprite); + var scene = GetFastValue(singleConfig, 'scene', this.scene); + var container = GetFastValue(singleConfig, 'container', null); + var texture = GetFastValue(singleConfig, 'key', null); + var frame = GetFastValue(singleConfig, 'frame', null); + + for (var i = 0; i < toConvert.length; i++) { - var config = Extend({}, spriteConfig, obj.properties); + obj = toConvert[i]; - config.x = obj.x; - config.y = obj.y; + var sprite = new classType(scene); - var sprite = scene.make.sprite(config); + sprite.setName(obj.name); + sprite.setPosition(obj.x, obj.y); + sprite.setTexture(texture, frame); - sprite.name = obj.name; + if (obj.width) + { + sprite.displayWidth = obj.width; + } - if (obj.width) { sprite.displayWidth = obj.width; } - if (obj.height) { sprite.displayHeight = obj.height; } + if (obj.height) + { + sprite.displayHeight = obj.height; + } - // Origin is (0, 1) in Tiled, so find the offset that matches the Sprite's origin. - // Do not offset objects with zero dimensions (e.g. points). + // Origin is (0, 1) in Tiled, so find the offset that matches the Sprites origin. + // Do not offset objects with zero dimensions (e.g. points). var offset = { x: sprite.originX * obj.width, y: (sprite.originY - 1) * obj.height }; - // If the object is rotated, then the origin offset also needs to be rotated. + // If the object is rotated, then the origin offset also needs to be rotated. if (obj.rotation) { var angle = DegToRad(obj.rotation); + Rotate(offset, angle); + sprite.rotation = angle; } @@ -112758,23 +120164,38 @@ var Tilemap = new Class({ sprite.setFlip(obj.flippedHorizontal, obj.flippedVertical); } - if (!obj.visible) { sprite.visible = false; } - - for (var key in obj.properties) + if (!obj.visible) { - if (sprite.hasOwnProperty(key)) - { - continue; - } - - sprite.setData(key, obj.properties[key]); + sprite.visible = false; } - sprites.push(sprite); + // Set properties the class may have, or setData those it doesn't + for (var key in obj.properties) + { + if (sprite[key] !== undefined) + { + sprite[key] = obj.properties[key]; + } + else + { + sprite.setData(key, obj.properties[key]); + } + } + + if (container) + { + container.add(sprite); + } + else + { + scene.add.existing(sprite); + } + + results.push(sprite); } } - return sprites; + return results; }, /** @@ -112786,14 +120207,14 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#createFromTiles * @since 3.0.0 * - * @param {(integer|array)} indexes - The tile index, or array of indexes, to create Sprites from. - * @param {(integer|array)} replacements - The tile index, or array of indexes, to change a converted + * @param {(number|array)} indexes - The tile index, or array of indexes, to create Sprites from. + * @param {(number|array)} replacements - The tile index, or array of indexes, to change a converted * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a * one-to-one mapping with the indexes array. * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). - * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Scene} [scene] - The Scene to create the Sprites within. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.GameObjects.Sprite[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -112806,80 +120227,6 @@ var Tilemap = new Class({ return TilemapComponents.CreateFromTiles(indexes, replacements, spriteConfig, scene, camera, layer); }, - /** - * Creates a new StaticTilemapLayer that renders the LayerData associated with the given - * `layerID`. The currently selected layer in the map is set to this new layer. - * - * The `layerID` is important. If you've created your map in Tiled then you can get this by - * looking in Tiled and looking at the layer name. Or you can open the JSON file it exports and - * look at the layers[].name value. Either way it must match. - * - * It's important to remember that a static layer cannot be modified. See StaticTilemapLayer for - * more information. - * - * @method Phaser.Tilemaps.Tilemap#createStaticLayer - * @since 3.0.0 - * - * @param {(integer|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. - * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. - * - * @return {?Phaser.Tilemaps.StaticTilemapLayer} Returns the new layer was created, or null if it failed. - */ - createStaticLayer: function (layerID, tileset, x, y) - { - var index = this.getLayerIndex(layerID); - - if (index === null) - { - console.warn('Invalid Tilemap Layer ID: ' + layerID); - if (typeof layerID === 'string') - { - console.warn('Valid tilelayer names:\n\t' + this.getTileLayerNames().join(',\n\t')); - } - return null; - } - - var layerData = this.layers[index]; - - // Check for an associated static or dynamic tilemap layer - if (layerData.tilemapLayer) - { - console.warn('Tilemap Layer ID already exists:' + layerID); - return null; - } - - this.currentLayerIndex = index; - - // Default the x/y position to match Tiled layer offset, if it exists. - if (x === undefined && this.layers[index].x) { x = this.layers[index].x; } - if (y === undefined && this.layers[index].y) { y = this.layers[index].y; } - - var layer = new StaticTilemapLayer(this.scene, this, index, tileset, x, y); - - layer.setRenderOrder(this.renderOrder); - - this.scene.sys.displayList.add(layer); - - return layer; - }, - - /** - * Removes all layer data from this Tilemap and nulls the scene reference. This will destroy any - * StaticTilemapLayers or DynamicTilemapLayers that have been linked to LayerData. - * - * @method Phaser.Tilemaps.Tilemap#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.removeAllLayers(); - this.tilesets.length = 0; - this.objects.length = 0; - this.scene = undefined; - }, - /** * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the * specified index. Tiles will be set to collide if the given index is a colliding index. @@ -112891,24 +120238,24 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#fill * @since 3.0.0 * - * @param {integer} index - The tile index to fill the area with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} index - The tile index to fill the area with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ fill: function (index, tileX, tileY, width, height, recalculateFaces, layer) { + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } - if (this._isStaticCall(layer, 'fill')) { return this; } - TilemapComponents.Fill(index, tileX, tileY, width, height, recalculateFaces, layer); return this; @@ -112926,7 +120273,7 @@ var Tilemap = new Class({ * @param {TilemapFilterCallback} callback - The callback. Each object in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. * - * @return {?Phaser.GameObjects.GameObject[]} An array of object that match the search, or null if the objectLayer given was invalid. + * @return {?Phaser.Types.Tilemaps.TiledObject[]} An array of object that match the search, or null if the objectLayer given was invalid. */ filterObjects: function (objectLayer, callback, context) { @@ -112959,12 +120306,12 @@ var Tilemap = new Class({ * callback as the first and only parameter. The callback should return true for tiles that pass the * filter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -112988,10 +120335,10 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#findByIndex * @since 3.0.0 * - * @param {integer} index - The tile index value to search for. - * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. + * @param {number} index - The tile index value to search for. + * @param {number} [skip=0] - The number of times to skip a matching tile before returning. * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -113016,7 +120363,7 @@ var Tilemap = new Class({ * @param {TilemapFindCallback} callback - The callback. Each object in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. * - * @return {?Phaser.GameObjects.GameObject} An object that matches the search, or null if no object found. + * @return {?Phaser.Types.Tilemaps.TiledObject} An object that matches the search, or null if no object found. */ findObject: function (objectLayer, callback, context) { @@ -113047,12 +120394,12 @@ var Tilemap = new Class({ * * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -113076,12 +120423,12 @@ var Tilemap = new Class({ * * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -113104,7 +120451,7 @@ var Tilemap = new Class({ * * @param {string} name - The name of the image to get. * - * @return {integer} The index of the image in this tilemap, or null if not found. + * @return {number} The index of the image in this tilemap, or null if not found. */ getImageIndex: function (name) { @@ -113158,15 +120505,12 @@ var Tilemap = new Class({ }, /** - * Gets the LayerData from this.layers that is associated with `layer`, or null if an invalid - * `layer` is given. + * Gets the LayerData from `this.layers` that is associated with the given `layer`, or null if the layer is invalid. * * @method Phaser.Tilemaps.Tilemap#getLayer * @since 3.0.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The name of the - * layer from Tiled, the index of the layer in the map, a DynamicTilemapLayer or a - * StaticTilemapLayer. If not given will default to the maps current layer index. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or Tilemap Layer. If not given will default to the maps current layer index. * * @return {Phaser.Tilemaps.LayerData} The corresponding LayerData within this.layers. */ @@ -113178,15 +120522,14 @@ var Tilemap = new Class({ }, /** - * Gets the ObjectLayer from this.objects that has the given `name`, or null if no ObjectLayer - * is found with that name. + * Gets the ObjectLayer from `this.objects` that has the given `name`, or null if no ObjectLayer is found with that name. * * @method Phaser.Tilemaps.Tilemap#getObjectLayer * @since 3.0.0 * * @param {string} [name] - The name of the object layer from Tiled. * - * @return {?Phaser.Tilemaps.ObjectLayer} The corresponding ObjectLayer within this.objects or null. + * @return {?Phaser.Tilemaps.ObjectLayer} The corresponding `ObjectLayer` within `this.objects`, or null. */ getObjectLayer: function (name) { @@ -113223,11 +120566,9 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#getLayerIndex * @since 3.0.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The name of the - * layer from Tiled, the index of the layer in the map, a DynamicTilemapLayer or a - * StaticTilemapLayer. If not given will default to the map's current layer index. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a Tilemap Layer. If not given will default to the map's current layer index. * - * @return {integer} The LayerData index within this.layers. + * @return {number} The LayerData index within this.layers. */ getLayerIndex: function (layer) { @@ -113243,7 +120584,7 @@ var Tilemap = new Class({ { return layer; } - else if (layer instanceof StaticTilemapLayer || layer instanceof DynamicTilemapLayer) + else if (layer instanceof TilemapLayer) { return layer.layerIndex; } @@ -113262,7 +120603,7 @@ var Tilemap = new Class({ * * @param {string} name - The name of the layer to get. * - * @return {integer} The LayerData index within this.layers. + * @return {number} The LayerData index within this.layers. */ getLayerIndexByName: function (name) { @@ -113271,15 +120612,16 @@ var Tilemap = new Class({ /** * Gets a tile at the given tile coordinates from the given layer. - * If no layer specified, the map's current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTileAt * @since 3.0.0 * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {boolean} [nonNull] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -113294,16 +120636,17 @@ var Tilemap = new Class({ /** * Gets a tile at the given world coordinates from the given layer. - * If no layer specified, the map's current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTileAtWorldXY * @since 3.0.0 * * @param {number} worldX - X position to get the tile from (given in pixels) * @param {number} worldY - Y position to get the tile from (given in pixels) - * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [nonNull] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -113339,17 +120682,18 @@ var Tilemap = new Class({ /** * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * If no layer specified, the maps current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTilesWithin * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -113365,15 +120709,16 @@ var Tilemap = new Class({ /** * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, * Line, Rectangle or Triangle. The shape should be in world coordinates. - * If no layer specified, the maps current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTilesWithinShape * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -113388,7 +120733,8 @@ var Tilemap = new Class({ /** * Gets the tiles in the given rectangular area (in world coordinates) of the layer. - * If no layer specified, the maps current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTilesWithinWorldXY * @since 3.0.0 @@ -113398,8 +120744,8 @@ var Tilemap = new Class({ * @param {number} width - The width of the area. * @param {number} height - The height of the area. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -113438,7 +120784,7 @@ var Tilemap = new Class({ * * @param {string} name - The name of the Tileset to get. * - * @return {integer} The Tileset index within this.tilesets. + * @return {number} The Tileset index within this.tilesets. */ getTilesetIndex: function (name) { @@ -113449,14 +120795,14 @@ var Tilemap = new Class({ * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns * false if there is no tile or if the tile at that location has an index of -1. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#hasTileAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -113473,15 +120819,15 @@ var Tilemap = new Class({ * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns * false if there is no tile or if the tile at that location has an index of -1. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#hasTileAtWorldXY * @since 3.0.0 * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -113520,26 +120866,24 @@ var Tilemap = new Class({ * location. If you pass in an index, only the index at the specified location will be changed. * Collision information will be recalculated at the specified location. * - * If no layer specified, the maps current layer is used. - * - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#putTileAt * @since 3.0.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid or the coordinates were out of bounds. */ putTileAt: function (tile, tileX, tileY, recalculateFaces, layer) { - layer = this.getLayer(layer); + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'putTileAt')) { return null; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -113552,26 +120896,25 @@ var Tilemap = new Class({ * specified location. If you pass in an index, only the index at the specified location will be * changed. Collision information will be recalculated at the specified location. * - * If no layer specified, the maps current layer is used. This - * cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#putTileAtWorldXY * @since 3.0.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera, layer) { - layer = this.getLayer(layer); + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'putTileAtWorldXY')) { return null; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -113585,25 +120928,24 @@ var Tilemap = new Class({ * index at the specified location will be changed. Collision information will be recalculated * within the region tiles were changed. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#putTilesAt * @since 3.0.0 * - * @param {(integer[]|integer[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces, layer) { - layer = this.getLayer(layer); + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'putTilesAt')) { return this; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -113619,18 +120961,17 @@ var Tilemap = new Class({ * indexes found within the region (excluding -1) will be used for randomly assigning new tile * indexes. This method only modifies tile indexes and does not change collision information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#randomize * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {number[]} [indexes] - An array of indexes to randomly draw from during randomization. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -113638,8 +120979,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'randomize')) { return this; } - if (layer === null) { return null; } TilemapComponents.Randomize(tileX, tileY, width, height, indexes, layer); @@ -113652,14 +120991,14 @@ var Tilemap = new Class({ * faces are used internally for optimizing collisions against tiles. This method is mostly used * internally to optimize recalculating faces when only one tile has been changed. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#calculateFacesAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -113679,16 +121018,16 @@ var Tilemap = new Class({ * layer. Interesting faces are used internally for optimizing collisions against tiles. This method * is mostly used internally. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#calculateFacesWithin * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -113706,12 +121045,12 @@ var Tilemap = new Class({ /** * Removes the given TilemapLayer from this Tilemap without destroying it. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#removeLayer * @since 3.17.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to be removed. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to be removed. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -113722,6 +121061,7 @@ var Tilemap = new Class({ if (index !== null) { SpliceOne(this.layers, index); + for (var i = index; i < this.layers.length; i++) { if (this.layers[i].tilemapLayer) @@ -113746,12 +121086,12 @@ var Tilemap = new Class({ /** * Destroys the given TilemapLayer and removes it from this Tilemap. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#destroyLayer * @since 3.17.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to be destroyed. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to be destroyed. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -113781,19 +121121,17 @@ var Tilemap = new Class({ }, /** - * Removes all layers from this Tilemap and destroys any associated StaticTilemapLayers or - * DynamicTilemapLayers. + * Removes all Tilemap Layers from this Tilemap and calls `destroy` on each of them. * * @method Phaser.Tilemaps.Tilemap#removeAllLayers * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tilemap} This Tilemap object. + * @return {this} This Tilemap object. */ removeAllLayers: function () { var layers = this.layers; - // Destroy any StaticTilemapLayers or DynamicTilemapLayers that are stored in LayerData for (var i = 0; i < layers.length; i++) { if (layers[i].tilemapLayer) @@ -113813,13 +121151,11 @@ var Tilemap = new Class({ * Removes the given Tile, or an array of Tiles, from the layer to which they belong, * and optionally recalculates the collision information. * - * This cannot be applied to Tiles that belong to Static Tilemap Layers. - * * @method Phaser.Tilemaps.Tilemap#removeTile * @since 3.17.0 * * @param {(Phaser.Tilemaps.Tile|Phaser.Tilemaps.Tile[])} tiles - The Tile to remove, or an array of Tiles. - * @param {integer} [replaceIndex=-1] - After removing the Tile, insert a brand new Tile into its location with the given index. Leave as -1 to just remove the tile. + * @param {number} [replaceIndex=-1] - After removing the Tile, insert a brand new Tile into its location with the given index. Leave as -1 to just remove the tile. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * * @return {Phaser.Tilemaps.Tile[]} Returns an array of Tiles that were removed. @@ -113852,28 +121188,27 @@ var Tilemap = new Class({ }, /** - * Removes the tile at the given tile coordinates in the specified layer and updates the layer's - * collision information. + * Removes the tile at the given tile coordinates in the specified layer and updates the layers collision information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#removeTileAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [replaceWithNull] - If `true` (the default), this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} [recalculateFaces] - If `true` (the default), the faces data will be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns the Tile that was removed, or null if the layer given was invalid. */ removeTileAt: function (tileX, tileY, replaceWithNull, recalculateFaces, layer) { - layer = this.getLayer(layer); + if (replaceWithNull === undefined) { replaceWithNull = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'removeTileAt')) { return null; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -113881,29 +121216,28 @@ var Tilemap = new Class({ }, /** - * Removes the tile at the given world coordinates in the specified layer and updates the layer's - * collision information. + * Removes the tile at the given world coordinates in the specified layer and updates the layers collision information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#removeTileAtWorldXY * @since 3.0.0 * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [replaceWithNull] - If `true` (the default), this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} [recalculateFaces] - If `true` (the default), the faces data will be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer) { - layer = this.getLayer(layer); + if (replaceWithNull === undefined) { replaceWithNull = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'removeTileAtWorldXY')) { return null; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -113911,19 +121245,19 @@ var Tilemap = new Class({ }, /** - * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to + * Draws a debug representation of the layer to the given Graphics object. This is helpful when you want to * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation * wherever you want on the screen. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#renderDebug * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -113949,15 +121283,14 @@ var Tilemap = new Class({ * @since 3.17.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. + * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {this} This Tilemap instance. */ renderDebugFull: function (graphics, styleConfig) { var layers = this.layers; - // Destroy any StaticTilemapLayers or DynamicTilemapLayers that are stored in LayerData for (var i = 0; i < layers.length; i++) { TilemapComponents.RenderDebug(graphics, styleConfig, layers[i]); @@ -113971,19 +121304,18 @@ var Tilemap = new Class({ * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does * not change collision information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#replaceByIndex * @since 3.0.0 * - * @param {integer} findIndex - The index of the tile to search for. - * @param {integer} newIndex - The index of the tile to replace it with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} findIndex - The index of the tile to search for. + * @param {number} newIndex - The index of the tile to replace it with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -113991,8 +121323,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'replaceByIndex')) { return this; } - if (layer === null) { return null; } TilemapComponents.ReplaceByIndex(findIndex, newIndex, tileX, tileY, width, height, layer); @@ -114005,21 +121335,25 @@ var Tilemap = new Class({ * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if * collision will be enabled (true) or disabled (false). * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollision * @since 3.0.0 * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollision: function (indexes, collides, recalculateFaces, layer, updateLayer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + if (updateLayer === undefined) { updateLayer = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -114035,21 +121369,24 @@ var Tilemap = new Class({ * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be * enabled (true) or disabled (false). * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollisionBetween * @since 3.0.0 * - * @param {integer} start - The first index of the tile to be set for collision. - * @param {integer} stop - The last index of the tile to be set for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} start - The first index of the tile to be set for collision. + * @param {number} stop - The last index of the tile to be set for collision. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollisionBetween: function (start, stop, collides, recalculateFaces, layer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -114068,20 +121405,23 @@ var Tilemap = new Class({ * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a * "types" property that matches any of those values, its collision flag will be updated. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollisionByProperty * @since 3.0.0 * * @param {object} properties - An object with tile properties and corresponding values that should be checked. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollisionByProperty: function (properties, collides, recalculateFaces, layer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -114096,20 +121436,23 @@ var Tilemap = new Class({ * the given array. The `collides` parameter controls if collision will be enabled (true) or * disabled (false). Tile indexes not currently in the layer are not affected. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollisionByExclusion * @since 3.0.0 * - * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollisionByExclusion: function (indexes, collides, recalculateFaces, layer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -114120,24 +121463,27 @@ var Tilemap = new Class({ }, /** - * Sets collision on the tiles within a layer by checking each tile's collision group data + * Sets collision on the tiles within a layer by checking each tiles collision group data * (typically defined in Tiled within the tileset collision editor). If any objects are found within - * a tile's collision group, the tile's colliding information will be set. The `collides` parameter + * a tiles collision group, the tiles colliding information will be set. The `collides` parameter * controls if collision will be enabled (true) or disabled (false). * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollisionFromCollisionGroup * @since 3.0.0 * - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollisionFromCollisionGroup: function (collides, recalculateFaces, layer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -114151,17 +121497,17 @@ var Tilemap = new Class({ * Sets a global collision callback for the given tile index within the layer. This will affect all * tiles on this layer that have the same index. If a callback is already set for the tile index it * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile - * at a specific location on the map then see setTileLocationCallback. + * at a specific location on the map then see `setTileLocationCallback`. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setTileIndexCallback * @since 3.0.0 * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. + * @param {(number|number[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. All values should be integers. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -114181,18 +121527,18 @@ var Tilemap = new Class({ * If a callback is already set for the tile index it will be replaced. Set the callback to null to * remove it. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setTileLocationCallback * @since 3.0.0 * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} [callbackContext] - The context under which the callback is called. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -114213,11 +121559,9 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#setLayer * @since 3.0.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The name of the - * layer from Tiled, the index of the layer in the map, a DynamicTilemapLayer or a - * StaticTilemapLayer. If not given will default to the map's current layer index. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a TilemapLayer. If not given will default to the maps current layer index. * - * @return {Phaser.Tilemaps.Tilemap} This Tilemap object. + * @return {this} This Tilemap object. */ setLayer: function (layer) { @@ -114238,10 +121582,10 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#setBaseTileSize * @since 3.0.0 * - * @param {integer} tileWidth - The width of the tiles the map uses for calculations. - * @param {integer} tileHeight - The height of the tiles the map uses for calculations. + * @param {number} tileWidth - The width of the tiles the map uses for calculations. + * @param {number} tileHeight - The height of the tiles the map uses for calculations. * - * @return {Phaser.Tilemaps.Tilemap} This Tilemap object. + * @return {this} This Tilemap object. */ setBaseTileSize: function (tileWidth, tileHeight) { @@ -114250,7 +121594,7 @@ var Tilemap = new Class({ this.widthInPixels = this.width * tileWidth; this.heightInPixels = this.height * tileHeight; - // Update the base tile size on all layers & tiles + // Update the base tile size on all layers & tiles for (var i = 0; i < this.layers.length; i++) { this.layers[i].baseTileWidth = tileWidth; @@ -114278,20 +121622,18 @@ var Tilemap = new Class({ }, /** - * Sets the tile size for a specific `layer`. Note: this does not necessarily match the map's + * Sets the tile size for a specific `layer`. Note: this does not necessarily match the maps * tileWidth and tileHeight for all layers. This will set the tile size for the layer and any * tiles the layer has. * * @method Phaser.Tilemaps.Tilemap#setLayerTileSize * @since 3.0.0 * - * @param {integer} tileWidth - The width of the tiles (in pixels) in the layer. - * @param {integer} tileHeight - The height of the tiles (in pixels) in the layer. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The name of the - * layer from Tiled, the index of the layer in the map, a DynamicTilemapLayer or a - * StaticTilemapLayer. If not given will default to the map's current layer index. + * @param {number} tileWidth - The width of the tiles (in pixels) in the layer. + * @param {number} tileHeight - The height of the tiles (in pixels) in the layer. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a TilemapLayer. If not given will default to the maps current layer index. * - * @return {Phaser.Tilemaps.Tilemap} This Tilemap object. + * @return {this} This Tilemap object. */ setLayerTileSize: function (tileWidth, tileHeight, layer) { @@ -114328,17 +121670,16 @@ var Tilemap = new Class({ * appear to have changed! This method only modifies tile indexes and does not change collision * information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#shuffle * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -114346,8 +121687,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'shuffle')) { return this; } - if (layer === null) { return null; } TilemapComponents.Shuffle(tileX, tileY, width, height, layer); @@ -114360,19 +121699,18 @@ var Tilemap = new Class({ * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision * information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#swapByIndex * @since 3.0.0 * - * @param {integer} tileA - First tile index. - * @param {integer} tileB - Second tile index. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileA - First tile index. + * @param {number} tileB - Second tile index. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -114380,8 +121718,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'swapByIndex')) { return this; } - if (layer === null) { return null; } TilemapComponents.SwapByIndex(indexA, indexB, tileX, tileY, width, height, layer); @@ -114393,14 +121729,14 @@ var Tilemap = new Class({ * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the * layers position, scale and scroll. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#tileToWorldX * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -114410,22 +121746,21 @@ var Tilemap = new Class({ if (layer === null) { return null; } - return TilemapComponents.TileToWorldX(tileX, camera, layer); + return this._convert.TileToWorldX(tileX, camera, layer); }, /** * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the * layers position, scale and scroll. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#tileToWorldY * @since 3.0.0 * - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer - * to use. If not given the current layer is used. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -114435,7 +121770,7 @@ var Tilemap = new Class({ if (layer === null) { return null; } - return TilemapComponents.TileToWorldY(tileX, camera, layer); + return this._convert.TileToWorldY(tileX, camera, layer); }, /** @@ -114443,26 +121778,26 @@ var Tilemap = new Class({ * layers position, scale and scroll. This will return a new Vector2 object or update the given * `point` object. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#tileToWorldXY * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} [vec2] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * - * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. + * @return {?Phaser.Math.Vector2} Returns a Vector2, or null if the layer given was invalid. */ - tileToWorldXY: function (tileX, tileY, point, camera, layer) + tileToWorldXY: function (tileX, tileY, vec2, camera, layer) { layer = this.getLayer(layer); if (layer === null) { return null; } - return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, layer); + return this._convert.TileToWorldXY(tileX, tileY, vec2, camera, layer); }, /** @@ -114477,32 +121812,27 @@ var Tilemap = new Class({ * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8 * ] * - * The probability of any index being choose is (the index's weight) / (sum of all weights). This + * The probability of any index being picked is (the indexs weight) / (sum of all weights). This * method only modifies tile indexes and does not change collision information. * - * If no layer specified, the map's current layer is used. This - * cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#weightedRandomize * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during - * randomization. They should be in the form: { index: 0, weight: 4 } or - * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {object[]} weightedIndexes - An array of objects to randomly draw from during randomization. They should be in the form: { index: 0, weight: 4 } or { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ - weightedRandomize: function (tileX, tileY, width, height, weightedIndexes, layer) + weightedRandomize: function (weightedIndexes, tileX, tileY, width, height, layer) { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'weightedRandomize')) { return this; } - if (layer === null) { return null; } TilemapComponents.WeightedRandomize(tileX, tileY, width, height, weightedIndexes, layer); @@ -114514,16 +121844,15 @@ var Tilemap = new Class({ * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the * layers position, scale and scroll. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#worldToTileX * @since 3.0.0 * * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer - * to use. If not given the current layer is used. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -114533,22 +121862,22 @@ var Tilemap = new Class({ if (layer === null) { return null; } - return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, layer); + return this._convert.WorldToTileX(worldX, snapToFloor, camera, layer); }, /** * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the * layers position, scale and scroll. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#worldToTileY * @since 3.0.0 * * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -114558,7 +121887,7 @@ var Tilemap = new Class({ if (layer === null) { return null; } - return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, layer); + return this._convert.WorldToTileY(worldY, snapToFloor, camera, layer); }, /** @@ -114566,49 +121895,44 @@ var Tilemap = new Class({ * layers position, scale and scroll. This will return a new Vector2 object or update the given * `point` object. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#worldToTileXY * @since 3.0.0 * * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} [vec2] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * - * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. + * @return {?Phaser.Math.Vector2} Returns a vec2, or null if the layer given was invalid. */ - worldToTileXY: function (worldX, worldY, snapToFloor, point, camera, layer) + worldToTileXY: function (worldX, worldY, snapToFloor, vec2, camera, layer) { layer = this.getLayer(layer); if (layer === null) { return null; } - return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, layer); + return this._convert.WorldToTileXY(worldX, worldY, snapToFloor, vec2, camera, layer); }, /** - * Used internally to check if a layer is static and prints out a warning. + * Removes all layer data from this Tilemap and nulls the scene reference. This will destroy any + * TilemapLayers that have been created. * - * @method Phaser.Tilemaps.Tilemap#_isStaticCall - * @private + * @method Phaser.Tilemaps.Tilemap#destroy * @since 3.0.0 - * - * @return {boolean} */ - _isStaticCall: function (layer, functionName) + destroy: function () { - if (layer.tilemapLayer instanceof StaticTilemapLayer) - { - console.warn(functionName + ': You cannot change the tiles in a static tilemap layer'); - return true; - } - else - { - return false; - } + this.removeAllLayers(); + + this.tilesets.length = 0; + this.objects.length = 0; + + this.scene = null; } }); @@ -114617,7 +121941,7 @@ module.exports = Tilemap; /***/ }), -/* 523 */ +/* 560 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114628,26 +121952,20 @@ module.exports = Tilemap; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DynamicTilemapLayerRender = __webpack_require__(1358); var GameObject = __webpack_require__(14); -var TilemapComponents = __webpack_require__(149); +var TilemapComponents = __webpack_require__(243); +var TilemapLayerRender = __webpack_require__(1428); /** * @classdesc - * A Dynamic Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination + * A Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination * with one, or more, Tilesets. * - * A Dynamic Tilemap Layer trades some speed for being able to apply powerful effects. Unlike a - * Static Tilemap Layer, you can apply per-tile effects like tint or alpha, and you can change the - * tiles in a DynamicTilemapLayer. - * - * Use this over a Static Tilemap Layer when you need those features. - * - * @class DynamicTilemapLayer + * @class TilemapLayer * @extends Phaser.GameObjects.GameObject * @memberof Phaser.Tilemaps * @constructor - * @since 3.0.0 + * @since 3.50.0 * * @extends Phaser.GameObjects.Components.Alpha * @extends Phaser.GameObjects.Components.BlendMode @@ -114663,12 +121981,12 @@ var TilemapComponents = __webpack_require__(149); * * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. * @param {Phaser.Tilemaps.Tilemap} tilemap - The Tilemap this layer is a part of. - * @param {integer} layerIndex - The index of the LayerData associated with this layer. + * @param {number} layerIndex - The index of the LayerData associated with this layer. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. * @param {number} [x=0] - The world x position where the top left of this layer will be placed. * @param {number} [y=0] - The world y position where the top left of this layer will be placed. */ -var DynamicTilemapLayer = new Class({ +var TilemapLayer = new Class({ Extends: GameObject, @@ -114684,40 +122002,40 @@ var DynamicTilemapLayer = new Class({ Components.Transform, Components.Visible, Components.ScrollFactor, - DynamicTilemapLayerRender + TilemapLayerRender ], initialize: - function DynamicTilemapLayer (scene, tilemap, layerIndex, tileset, x, y) + function TilemapLayer (scene, tilemap, layerIndex, tileset, x, y) { - GameObject.call(this, scene, 'DynamicTilemapLayer'); + GameObject.call(this, scene, 'TilemapLayer'); /** * Used internally by physics system to perform fast type checks. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#isTilemap + * @name Phaser.Tilemaps.TilemapLayer#isTilemap * @type {boolean} * @readonly - * @since 3.0.0 + * @since 3.50.0 */ this.isTilemap = true; /** * The Tilemap that this layer is a part of. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#tilemap + * @name Phaser.Tilemaps.TilemapLayer#tilemap * @type {Phaser.Tilemaps.Tilemap} - * @since 3.0.0 + * @since 3.50.0 */ this.tilemap = tilemap; /** * The index of the LayerData associated with this layer. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#layerIndex - * @type {integer} - * @since 3.0.0 + * @name Phaser.Tilemaps.TilemapLayer#layerIndex + * @type {number} + * @since 3.50.0 */ this.layerIndex = layerIndex; @@ -114725,9 +122043,9 @@ var DynamicTilemapLayer = new Class({ * The LayerData associated with this layer. LayerData can only be associated with one * tilemap layer. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#layer + * @name Phaser.Tilemaps.TilemapLayer#layer * @type {Phaser.Tilemaps.LayerData} - * @since 3.0.0 + * @since 3.50.0 */ this.layer = tilemap.layers[layerIndex]; @@ -114735,68 +122053,66 @@ var DynamicTilemapLayer = new Class({ this.layer.tilemapLayer = this; /** - * The Tileset/s associated with this layer. + * An array of `Tileset` objects associated with this layer. * - * As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference. - * - * @name Phaser.Tilemaps.DynamicTilemapLayer#tileset + * @name Phaser.Tilemaps.TilemapLayer#tileset * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.0.0 + * @since 3.50.0 */ this.tileset = []; - /** - * Used internally with the canvas render. This holds the tiles that are visible within the - * camera. - * - * @name Phaser.Tilemaps.DynamicTilemapLayer#culledTiles - * @type {array} - * @since 3.0.0 - */ - this.culledTiles = []; - - /** - * You can control if the Cameras should cull tiles before rendering them or not. - * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. - * - * However, there are some instances when you may wish to disable this, and toggling this flag allows - * you to do so. Also see `setSkipCull` for a chainable method that does the same thing. - * - * @name Phaser.Tilemaps.DynamicTilemapLayer#skipCull - * @type {boolean} - * @since 3.11.0 - */ - this.skipCull = false; - /** * The total number of tiles drawn by the renderer in the last frame. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#tilesDrawn - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#tilesDrawn + * @type {number} * @readonly - * @since 3.11.0 + * @since 3.50.0 */ this.tilesDrawn = 0; /** * The total number of tiles in this layer. Updated every frame. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#tilesTotal - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#tilesTotal + * @type {number} * @readonly - * @since 3.11.0 + * @since 3.50.0 */ this.tilesTotal = this.layer.width * this.layer.height; + /** + * Used internally during rendering. This holds the tiles that are visible within the Camera. + * + * @name Phaser.Tilemaps.TilemapLayer#culledTiles + * @type {Phaser.Tilemaps.Tile[]} + * @since 3.50.0 + */ + this.culledTiles = []; + + /** + * You can control if the camera should cull tiles on this layer before rendering them or not. + * + * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. + * + * However, there are some instances when you may wish to disable this, and toggling this flag allows + * you to do so. Also see `setSkipCull` for a chainable method that does the same thing. + * + * @name Phaser.Tilemaps.TilemapLayer#skipCull + * @type {boolean} + * @since 3.50.0 + */ + this.skipCull = false; + /** * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size. * * See the method `setCullPadding` for more details. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#cullPaddingX - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#cullPaddingX + * @type {number} * @default 1 - * @since 3.11.0 + * @since 3.50.0 */ this.cullPaddingX = 1; @@ -114805,31 +122121,39 @@ var DynamicTilemapLayer = new Class({ * * See the method `setCullPadding` for more details. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#cullPaddingY - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#cullPaddingY + * @type {number} * @default 1 - * @since 3.11.0 + * @since 3.50.0 */ this.cullPaddingY = 1; /** * The callback that is invoked when the tiles are culled. * - * By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like. + * It will call a different function based on the map orientation: * - * It will be sent 3 arguments: + * Orthogonal (the default) is `TilemapComponents.CullTiles` + * Isometric is `TilemapComponents.IsometricCullTiles` + * Hexagonal is `TilemapComponents.HexagonalCullTiles` + * Staggered is `TilemapComponents.StaggeredCullTiles` + * + * However, you can override this to call any function you like. + * + * It will be sent 4 arguments: * * 1. The Phaser.Tilemaps.LayerData object for this Layer * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 4. The Render Order constant. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#cullCallback + * @name Phaser.Tilemaps.TilemapLayer#cullCallback * @type {function} - * @since 3.11.0 + * @since 3.50.0 */ - this.cullCallback = TilemapComponents.CullTiles; + this.cullCallback = TilemapComponents.GetCullTilesFunction(this.layer.orientation); /** * The rendering (draw) order of the tiles in this layer. @@ -114846,20 +122170,20 @@ var DynamicTilemapLayer = new Class({ * * This can be changed via the `setRenderOrder` method. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#_renderOrder - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#_renderOrder + * @type {number} * @default 0 * @private - * @since 3.12.0 + * @since 3.50.0 */ this._renderOrder = 0; /** * An array holding the mapping between the tile indexes and the tileset they belong to. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#gidMap + * @name Phaser.Tilemaps.TilemapLayer#gidMap * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.14.0 + * @since 3.50.0 */ this.gidMap = []; @@ -114875,9 +122199,9 @@ var DynamicTilemapLayer = new Class({ /** * Populates the internal `tileset` array with the Tileset references this Layer requires for rendering. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setTilesets + * @method Phaser.Tilemaps.TilemapLayer#setTilesets * @private - * @since 3.14.0 + * @since 3.50.0 * * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. */ @@ -114936,10 +122260,10 @@ var DynamicTilemapLayer = new Class({ * * You can provide either an integer (0 to 3), or the string version of the order. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setRenderOrder - * @since 3.12.0 + * @method Phaser.Tilemaps.TilemapLayer#setRenderOrder + * @since 3.50.0 * - * @param {(integer|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. + * @param {(number|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. * * @return {this} This Tilemap Layer object. */ @@ -114965,13 +122289,13 @@ var DynamicTilemapLayer = new Class({ * faces are used internally for optimizing collisions against tiles. This method is mostly used * internally to optimize recalculating faces when only one tile has been changed. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#calculateFacesAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#calculateFacesAt + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. + * @param {number} tileX - The x coordinate. + * @param {number} tileY - The y coordinate. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ calculateFacesAt: function (tileX, tileY) { @@ -114985,15 +122309,15 @@ var DynamicTilemapLayer = new Class({ * layer. Interesting faces are used internally for optimizing collisions against tiles. This method * is mostly used internally. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#calculateFacesWithin - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#calculateFacesWithin + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ calculateFacesWithin: function (tileX, tileY, width, height) { @@ -115008,17 +122332,17 @@ var DynamicTilemapLayer = new Class({ * created. This is useful if you want to lay down special tiles in a level that are converted to * Sprites, but want to replace the tile itself with a floor tile or similar once converted. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#createFromTiles - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#createFromTiles + * @since 3.50.0 * - * @param {(integer|array)} indexes - The tile index, or array of indexes, to create Sprites from. - * @param {(integer|array)} replacements - The tile index, or array of indexes, to change a converted + * @param {(number|array)} indexes - The tile index, or array of indexes, to create Sprites from. + * @param {(number|array)} replacements - The tile index, or array of indexes, to change a converted * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a * one-to-one mapping with the indexes array. - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} [spriteConfig] - The config object to pass into the Sprite creator (i.e. * scene.make.sprite). - * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when determining the world XY + * @param {Phaser.Scene} [scene] - The Scene to create the Sprites within. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when determining the world XY * * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. */ @@ -115029,14 +122353,14 @@ var DynamicTilemapLayer = new Class({ /** * Returns the tiles in the given layer that are within the cameras viewport. - * This is used internally. + * This is used internally during rendering. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#cull - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#cull + * @since 3.50.0 * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects to render. */ cull: function (camera) { @@ -115048,18 +122372,18 @@ var DynamicTilemapLayer = new Class({ * coordinates) within the layer. This copies all tile properties & recalculates collision * information in the destination region. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#copy - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#copy + * @since 3.50.0 * - * @param {integer} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} width - The width of the area to copy, in tiles, not pixels. - * @param {integer} height - The height of the area to copy, in tiles, not pixels. - * @param {integer} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. - * @param {integer} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. + * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. + * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. + * @param {number} width - The width of the area to copy, in tiles, not pixels. + * @param {number} height - The height of the area to copy, in tiles, not pixels. + * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. + * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ copy: function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces) { @@ -115068,62 +122392,22 @@ var DynamicTilemapLayer = new Class({ return this; }, - /** - * Destroys this DynamicTilemapLayer and removes its link to the associated LayerData. - * - * @method Phaser.Tilemaps.DynamicTilemapLayer#destroy - * @since 3.0.0 - * - * @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap? - */ - destroy: function (removeFromTilemap) - { - if (removeFromTilemap === undefined) { removeFromTilemap = true; } - - if (!this.tilemap) - { - // Abort, we've already been destroyed - return; - } - - // Uninstall this layer only if it is still installed on the LayerData object - if (this.layer.tilemapLayer === this) - { - this.layer.tilemapLayer = undefined; - } - - if (removeFromTilemap) - { - this.tilemap.removeLayer(this); - } - - this.tilemap = undefined; - this.layer = undefined; - this.culledTiles.length = 0; - this.cullCallback = null; - - this.gidMap = []; - this.tileset = []; - - GameObject.prototype.destroy.call(this); - }, - /** * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the * specified index. Tiles will be set to collide if the given index is a colliding index. * Collision information in the region will be recalculated. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#fill - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#fill + * @since 3.50.0 * - * @param {integer} index - The tile index to fill the area with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} index - The tile index to fill the area with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ fill: function (index, tileX, tileY, width, height, recalculateFaces) { @@ -115137,17 +122421,17 @@ var DynamicTilemapLayer = new Class({ * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#filterTiles - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#filterTiles + * @since 3.50.0 * * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. The callback should return true for tiles that pass the * filter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -115164,15 +122448,14 @@ var DynamicTilemapLayer = new Class({ * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to * the top-left. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#findByIndex - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#findByIndex + * @since 3.50.0 * - * @param {integer} index - The tile index value to search for. - * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. - * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the - * bottom-right. Otherwise it scans from the top-left. + * @param {number} index - The tile index value to search for. + * @param {number} [skip=0] - The number of times to skip a matching tile before returning. + * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. * - * @return {Phaser.Tilemaps.Tile} A Tile object. + * @return {Phaser.Tilemaps.Tile} The first matching Tile object. */ findByIndex: function (findIndex, skip, reverse) { @@ -115184,18 +122467,18 @@ var DynamicTilemapLayer = new Class({ * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns * true. Similar to Array.prototype.find in vanilla JS. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#findTile - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#findTile + * @since 3.50.0 * * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * - * @return {?Phaser.Tilemaps.Tile} + * @return {?Phaser.Tilemaps.Tile} The first Tile found at the given location. */ findTile: function (callback, context, tileX, tileY, width, height, filteringOptions) { @@ -115206,18 +122489,18 @@ var DynamicTilemapLayer = new Class({ * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given * callback. Similar to Array.prototype.forEach in vanilla JS. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#forEachTile - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#forEachTile + * @since 3.50.0 * * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {object} [context] - The context, or scope, under which the callback should be run. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions) { @@ -115229,14 +122512,14 @@ var DynamicTilemapLayer = new Class({ /** * Gets a tile at the given tile coordinates from the given layer. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTileAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTileAt + * @since 3.50.0 * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. + * @return {Phaser.Tilemaps.Tile} The Tile at the given coordinates or null if no tile was found or the coordinates were invalid. */ getTileAt: function (tileX, tileY, nonNull) { @@ -115246,16 +122529,15 @@ var DynamicTilemapLayer = new Class({ /** * Gets a tile at the given world coordinates from the given layer. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTileAtWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTileAtWorldXY + * @since 3.50.0 * * @param {number} worldX - X position to get the tile from (given in pixels) * @param {number} worldY - Y position to get the tile from (given in pixels) * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates - * were invalid. + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. */ getTileAtWorldXY: function (worldX, worldY, nonNull, camera) { @@ -115265,16 +122547,16 @@ var DynamicTilemapLayer = new Class({ /** * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTilesWithin - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTilesWithin + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the area. */ getTilesWithin: function (tileX, tileY, width, height, filteringOptions) { @@ -115285,14 +122567,14 @@ var DynamicTilemapLayer = new Class({ * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, * Line, Rectangle or Triangle. The shape should be in world coordinates. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTilesWithinShape - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTilesWithinShape + * @since 3.50.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the shape. */ getTilesWithinShape: function (shape, filteringOptions, camera) { @@ -115302,17 +122584,17 @@ var DynamicTilemapLayer = new Class({ /** * Gets the tiles in the given rectangular area (in world coordinates) of the layer. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTilesWithinWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTilesWithinWorldXY + * @since 3.50.0 * * @param {number} worldX - The world x coordinate for the top-left of the area. * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the area. */ getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera) { @@ -115323,11 +122605,11 @@ var DynamicTilemapLayer = new Class({ * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns * false if there is no tile or if the tile at that location has an index of -1. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#hasTileAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#hasTileAt + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * * @return {boolean} `true` if a tile was found at the given location, otherwise `false`. */ @@ -115340,12 +122622,12 @@ var DynamicTilemapLayer = new Class({ * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns * false if there is no tile or if the tile at that location has an index of -1. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#hasTileAtWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#hasTileAtWorldXY + * @since 3.50.0 * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. * * @return {boolean} `true` if a tile was found at the given location, otherwise `false`. */ @@ -115360,15 +122642,15 @@ var DynamicTilemapLayer = new Class({ * location. If you pass in an index, only the index at the specified location will be changed. * Collision information will be recalculated at the specified location. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#putTileAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#putTileAt + * @since 3.50.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * - * @return {Phaser.Tilemaps.Tile} A Tile object. + * @return {Phaser.Tilemaps.Tile} The Tile object that was inserted at the given coordinates. */ putTileAt: function (tile, tileX, tileY, recalculateFaces) { @@ -115381,16 +122663,16 @@ var DynamicTilemapLayer = new Class({ * specified location. If you pass in an index, only the index at the specified location will be * changed. Collision information will be recalculated at the specified location. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#putTileAtWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#putTileAtWorldXY + * @since 3.50.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Tilemaps.Tile} A Tile object. + * @return {Phaser.Tilemaps.Tile} The Tile object that was inserted at the given coordinates. */ putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera) { @@ -115404,15 +122686,15 @@ var DynamicTilemapLayer = new Class({ * index at the specified location will be changed. Collision information will be recalculated * within the region tiles were changed. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#putTilesAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#putTilesAt + * @since 3.50.0 * - * @param {(integer[]|integer[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces) { @@ -115428,16 +122710,16 @@ var DynamicTilemapLayer = new Class({ * indexes found within the region (excluding -1) will be used for randomly assigning new tile * indexes. This method only modifies tile indexes and does not change collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#randomize - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#randomize + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {number[]} [indexes] - An array of indexes to randomly draw from during randomization. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ randomize: function (tileX, tileY, width, height, indexes) { @@ -115447,14 +122729,14 @@ var DynamicTilemapLayer = new Class({ }, /** - * Removes the tile at the given tile coordinates in the specified layer and updates the layer's + * Removes the tile at the given tile coordinates in the specified layer and updates the layers * collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#removeTileAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#removeTileAt + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * @@ -115466,19 +122748,19 @@ var DynamicTilemapLayer = new Class({ }, /** - * Removes the tile at the given world coordinates in the specified layer and updates the layer's + * Removes the tile at the given world coordinates in the specified layer and updates the layers * collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#removeTileAtWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#removeTileAtWorldXY + * @since 3.50.0 * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Tilemaps.Tile} A Tile object. + * @return {Phaser.Tilemaps.Tile} The Tile object that was removed from the given location. */ removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera) { @@ -115491,13 +122773,13 @@ var DynamicTilemapLayer = new Class({ * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation * wherever you want on the screen. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#renderDebug - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#renderDebug + * @since 3.50.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. + * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ renderDebug: function (graphics, styleConfig) { @@ -115511,17 +122793,17 @@ var DynamicTilemapLayer = new Class({ * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does * not change collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#replaceByIndex - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#replaceByIndex + * @since 3.50.0 * - * @param {integer} findIndex - The index of the tile to search for. - * @param {integer} newIndex - The index of the tile to replace it with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} findIndex - The index of the tile to search for. + * @param {number} newIndex - The index of the tile to replace it with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height) { @@ -115532,12 +122814,13 @@ var DynamicTilemapLayer = new Class({ /** * You can control if the Cameras should cull tiles before rendering them or not. + * * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. * * However, there are some instances when you may wish to disable this. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setSkipCull - * @since 3.11.0 + * @method Phaser.Tilemaps.TilemapLayer#setSkipCull + * @since 3.50.0 * * @param {boolean} [value=true] - Set to `true` to stop culling tiles. Set to `false` to enable culling again. * @@ -115559,11 +122842,11 @@ var DynamicTilemapLayer = new Class({ * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale) * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCullPadding - * @since 3.11.0 + * @method Phaser.Tilemaps.TilemapLayer#setCullPadding + * @since 3.50.0 * - * @param {integer} [paddingX=1] - The amount of extra horizontal tiles to add to the cull check padding. - * @param {integer} [paddingY=1] - The amount of extra vertical tiles to add to the cull check padding. + * @param {number} [paddingX=1] - The amount of extra horizontal tiles to add to the cull check padding. + * @param {number} [paddingY=1] - The amount of extra vertical tiles to add to the cull check padding. * * @return {this} This Tilemap Layer object. */ @@ -115583,18 +122866,15 @@ var DynamicTilemapLayer = new Class({ * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if * collision will be enabled (true) or disabled (false). * - * If no layer specified, the map's current layer is used. + * @method Phaser.Tilemaps.TilemapLayer#setCollision + * @since 3.50.0 * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollision - * @since 3.0.0 - * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to - * false if no tiles have been placed for significant performance boost. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {this} This Tilemap Layer object. */ setCollision: function (indexes, collides, recalculateFaces, updateLayer) { @@ -115609,15 +122889,15 @@ var DynamicTilemapLayer = new Class({ * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be * enabled (true) or disabled (false). * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionBetween - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setCollisionBetween + * @since 3.50.0 * - * @param {integer} start - The first index of the tile to be set for collision. - * @param {integer} stop - The last index of the tile to be set for collision. + * @param {number} start - The first index of the tile to be set for collision. + * @param {number} stop - The last index of the tile to be set for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setCollisionBetween: function (start, stop, collides, recalculateFaces) { @@ -115635,14 +122915,14 @@ var DynamicTilemapLayer = new Class({ * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a * "types" property that matches any of those values, its collision flag will be updated. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionByProperty - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setCollisionByProperty + * @since 3.50.0 * * @param {object} properties - An object with tile properties and corresponding values that should be checked. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setCollisionByProperty: function (properties, collides, recalculateFaces) { @@ -115656,14 +122936,14 @@ var DynamicTilemapLayer = new Class({ * the given array. The `collides` parameter controls if collision will be enabled (true) or * disabled (false). Tile indexes not currently in the layer are not affected. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionByExclusion - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setCollisionByExclusion + * @since 3.50.0 * - * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setCollisionByExclusion: function (indexes, collides, recalculateFaces) { @@ -115678,13 +122958,13 @@ var DynamicTilemapLayer = new Class({ * a tiles collision group, the tile's colliding information will be set. The `collides` parameter * controls if collision will be enabled (true) or disabled (false). * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionFromCollisionGroup - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setCollisionFromCollisionGroup + * @since 3.50.0 * * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setCollisionFromCollisionGroup: function (collides, recalculateFaces) { @@ -115699,14 +122979,14 @@ var DynamicTilemapLayer = new Class({ * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile * at a specific location on the map then see setTileLocationCallback. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setTileIndexCallback - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setTileIndexCallback + * @since 3.50.0 * - * @param {(integer|integer[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. + * @param {(number|number[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setTileIndexCallback: function (indexes, callback, callbackContext) { @@ -115720,17 +123000,17 @@ var DynamicTilemapLayer = new Class({ * If a callback is already set for the tile index it will be replaced. Set the callback to null to * remove it. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setTileLocationCallback - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setTileLocationCallback + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {function} [callback] - The callback that will be invoked when the tile is collided with. - * @param {object} [callbackContext] - The context under which the callback is called. + * @param {object} [callbackContext] - The context, or scope, under which the callback is invoked. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext) { @@ -115745,15 +123025,15 @@ var DynamicTilemapLayer = new Class({ * appear to have changed! This method only modifies tile indexes and does not change collision * information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#shuffle - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#shuffle + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ shuffle: function (tileX, tileY, width, height) { @@ -115767,17 +123047,17 @@ var DynamicTilemapLayer = new Class({ * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision * information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#swapByIndex - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#swapByIndex + * @since 3.50.0 * - * @param {integer} tileA - First tile index. - * @param {integer} tileB - Second tile index. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileA - First tile index. + * @param {number} tileB - Second tile index. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ swapByIndex: function (indexA, indexB, tileX, tileY, width, height) { @@ -115790,34 +123070,34 @@ var DynamicTilemapLayer = new Class({ * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the * layers position, scale and scroll. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldX - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#tileToWorldX + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {number} + * @return {number} The Tile X coordinate converted to pixels. */ tileToWorldX: function (tileX, camera) { - return TilemapComponents.TileToWorldX(tileX, camera, this.layer); + return this.tilemap.tileToWorldX(tileX, camera, this); }, /** * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the * layers position, scale and scroll. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#tileToWorldY + * @since 3.50.0 * - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {number} + * @return {number} The Tile Y coordinate converted to pixels. */ tileToWorldY: function (tileY, camera) { - return TilemapComponents.TileToWorldY(tileY, camera, this.layer); + return this.tilemap.tileToWorldY(tileY, camera, this); }, /** @@ -115825,19 +123105,19 @@ var DynamicTilemapLayer = new Class({ * layers position, scale and scroll. This will return a new Vector2 object or update the given * `point` object. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#tileToWorldXY + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Math.Vector2} + * @return {Phaser.Math.Vector2} A Vector2 containing the world coordinates of the Tile. */ tileToWorldXY: function (tileX, tileY, point, camera) { - return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer); + return this.tilemap.tileToWorldXY(tileX, tileY, point, camera, this); }, /** @@ -115855,18 +123135,16 @@ var DynamicTilemapLayer = new Class({ * The probability of any index being choose is (the index's weight) / (sum of all weights). This * method only modifies tile indexes and does not change collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#weightedRandomize - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#weightedRandomize + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during - * randomization. They should be in the form: { index: 0, weight: 4 } or - * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. + * @param {object[]} weightedIndexes - An array of objects to randomly draw from during randomization. They should be in the form: { index: 0, weight: 4 } or { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ weightedRandomize: function (tileX, tileY, width, height, weightedIndexes) { @@ -115879,36 +123157,36 @@ var DynamicTilemapLayer = new Class({ * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the * layers position, scale and scroll. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileX - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#worldToTileX + * @since 3.50.0 * * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {number} + * @return {number} The tile X coordinate based on the world value. */ worldToTileX: function (worldX, snapToFloor, camera) { - return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer); + return this.tilemap.worldToTileX(worldX, snapToFloor, camera, this); }, /** * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the * layers position, scale and scroll. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#worldToTileY + * @since 3.50.0 * * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {number} + * @return {number} The tile Y coordinate based on the world value. */ worldToTileY: function (worldY, snapToFloor, camera) { - return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer); + return this.tilemap.worldToTileY(worldY, snapToFloor, camera, this); }, /** @@ -115916,1497 +123194,27 @@ var DynamicTilemapLayer = new Class({ * layers position, scale and scroll. This will return a new Vector2 object or update the given * `point` object. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#worldToTileXY + * @since 3.50.0 * * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Math.Vector2} + * @return {Phaser.Math.Vector2} A Vector2 containing the tile coordinates of the world values. */ worldToTileXY: function (worldX, worldY, snapToFloor, point, camera) { - return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer); - } - -}); - -module.exports = DynamicTilemapLayer; - - -/***/ }), -/* 524 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameEvents = __webpack_require__(21); -var GameObject = __webpack_require__(14); -var ModelViewProjection = __webpack_require__(113); -var StaticTilemapLayerRender = __webpack_require__(1361); -var TilemapComponents = __webpack_require__(149); -var TransformMatrix = __webpack_require__(31); -var Utils = __webpack_require__(10); - -/** - * @classdesc - * A Static Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination - * with one, or more, Tilesets. - * - * A Static Tilemap Layer is optimized for rendering speed over flexibility. You cannot apply per-tile - * effects like tint or alpha, or change the tiles or tilesets the layer uses. - * - * Use a Static Tilemap Layer instead of a Dynamic Tilemap Layer when you don't need tile manipulation features. - * - * @class StaticTilemapLayer - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.Tilemaps - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.ComputedSize - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.Renderer.WebGL.Pipelines.ModelViewProjection - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. - * @param {Phaser.Tilemaps.Tilemap} tilemap - The Tilemap this layer is a part of. - * @param {integer} layerIndex - The index of the LayerData associated with this layer. - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} [x=0] - The world x position where the top left of this layer will be placed. - * @param {number} [y=0] - The world y position where the top left of this layer will be placed. - */ -var StaticTilemapLayer = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.ComputedSize, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Origin, - Components.Pipeline, - Components.Transform, - Components.Visible, - Components.ScrollFactor, - StaticTilemapLayerRender, - ModelViewProjection - ], - - initialize: - - function StaticTilemapLayer (scene, tilemap, layerIndex, tileset, x, y) - { - GameObject.call(this, scene, 'StaticTilemapLayer'); - - /** - * Used internally by physics system to perform fast type checks. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#isTilemap - * @type {boolean} - * @readonly - * @since 3.0.0 - */ - this.isTilemap = true; - - /** - * The Tilemap that this layer is a part of. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#tilemap - * @type {Phaser.Tilemaps.Tilemap} - * @since 3.0.0 - */ - this.tilemap = tilemap; - - /** - * The index of the LayerData associated with this layer. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#layerIndex - * @type {integer} - * @since 3.0.0 - */ - this.layerIndex = layerIndex; - - /** - * The LayerData associated with this layer. LayerData can only be associated with one - * tilemap layer. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#layer - * @type {Phaser.Tilemaps.LayerData} - * @since 3.0.0 - */ - this.layer = tilemap.layers[layerIndex]; - - // Link the LayerData with this static tilemap layer - this.layer.tilemapLayer = this; - - /** - * The Tileset/s associated with this layer. - * - * As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#tileset - * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.0.0 - */ - this.tileset = []; - - /** - * Used internally by the Canvas renderer. - * This holds the tiles that are visible within the camera in the last frame. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#culledTiles - * @type {array} - * @since 3.0.0 - */ - this.culledTiles = []; - - /** - * Canvas only. - * - * You can control if the Cameras should cull tiles before rendering them or not. - * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. - * - * However, there are some instances when you may wish to disable this, and toggling this flag allows - * you to do so. Also see `setSkipCull` for a chainable method that does the same thing. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#skipCull - * @type {boolean} - * @since 3.12.0 - */ - this.skipCull = false; - - /** - * Canvas only. - * - * The total number of tiles drawn by the renderer in the last frame. - * - * This only works when rending with Canvas. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#tilesDrawn - * @type {integer} - * @readonly - * @since 3.12.0 - */ - this.tilesDrawn = 0; - - /** - * Canvas only. - * - * The total number of tiles in this layer. Updated every frame. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#tilesTotal - * @type {integer} - * @readonly - * @since 3.12.0 - */ - this.tilesTotal = this.layer.width * this.layer.height; - - /** - * Canvas only. - * - * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size. - * - * See the method `setCullPadding` for more details. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#cullPaddingX - * @type {integer} - * @default 1 - * @since 3.12.0 - */ - this.cullPaddingX = 1; - - /** - * Canvas only. - * - * The amount of extra tiles to add into the cull rectangle when calculating its vertical size. - * - * See the method `setCullPadding` for more details. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#cullPaddingY - * @type {integer} - * @default 1 - * @since 3.12.0 - */ - this.cullPaddingY = 1; - - /** - * Canvas only. - * - * The callback that is invoked when the tiles are culled. - * - * By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like. - * - * It will be sent 3 arguments: - * - * 1. The Phaser.Tilemaps.LayerData object for this Layer - * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. - * - * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#cullCallback - * @type {function} - * @since 3.12.0 - */ - this.cullCallback = TilemapComponents.CullTiles; - - /** - * A reference to the renderer. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @private - * @since 3.0.0 - */ - this.renderer = scene.sys.game.renderer; - - /** - * An array of vertex buffer objects, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single instance. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#vertexBuffer - * @type {WebGLBuffer[]} - * @private - * @since 3.0.0 - */ - this.vertexBuffer = []; - - /** - * An array of ArrayBuffer objects, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single instance. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#bufferData - * @type {ArrayBuffer[]} - * @private - * @since 3.0.0 - */ - this.bufferData = []; - - /** - * An array of Float32 Array objects, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single instance. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#vertexViewF32 - * @type {Float32Array[]} - * @private - * @since 3.0.0 - */ - this.vertexViewF32 = []; - - /** - * An array of Uint32 Array objects, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single instance. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#vertexViewU32 - * @type {Uint32Array[]} - * @private - * @since 3.0.0 - */ - this.vertexViewU32 = []; - - /** - * An array of booleans, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single boolean. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#dirty - * @type {boolean[]} - * @private - * @since 3.0.0 - */ - this.dirty = []; - - /** - * An array of integers, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single integer. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#vertexCount - * @type {integer[]} - * @private - * @since 3.0.0 - */ - this.vertexCount = []; - - /** - * The rendering (draw) order of the tiles in this layer. - * - * The default is 0 which is 'right-down', meaning it will draw the tiles starting from the top-left, - * drawing to the right and then moving down to the next row. - * - * The draw orders are: - * - * 0 = right-down - * 1 = left-down - * 2 = right-up - * 3 = left-up - * - * This can be changed via the `setRenderOrder` method. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#_renderOrder - * @type {integer} - * @default 0 - * @private - * @since 3.12.0 - */ - this._renderOrder = 0; - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#_tempMatrix - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.14.0 - */ - this._tempMatrix = new TransformMatrix(); - - /** - * An array holding the mapping between the tile indexes and the tileset they belong to. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#gidMap - * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.14.0 - */ - this.gidMap = []; - - this.setTilesets(tileset); - this.setAlpha(this.layer.alpha); - this.setPosition(x, y); - this.setOrigin(); - this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); - - this.updateVBOData(); - - this.initPipeline(); - - this.mvpInit(); - - scene.sys.game.events.on(GameEvents.CONTEXT_RESTORED, function () - { - this.updateVBOData(); - }, this); + return this.tilemap.worldToTileXY(worldX, worldY, snapToFloor, point, camera, this); }, /** - * Populates the internal `tileset` array with the Tileset references this Layer requires for rendering. + * Destroys this TilemapLayer and removes its link to the associated LayerData. * - * @method Phaser.Tilemaps.StaticTilemapLayer#setTilesets - * @private - * @since 3.14.0 - * - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - */ - setTilesets: function (tilesets) - { - var gidMap = []; - var setList = []; - var map = this.tilemap; - - if (!Array.isArray(tilesets)) - { - tilesets = [ tilesets ]; - } - - for (var i = 0; i < tilesets.length; i++) - { - var tileset = tilesets[i]; - - if (typeof tileset === 'string') - { - tileset = map.getTileset(tileset); - } - - if (tileset) - { - setList.push(tileset); - - var s = tileset.firstgid; - - for (var t = 0; t < tileset.total; t++) - { - gidMap[s + t] = tileset; - } - } - } - - this.gidMap = gidMap; - this.tileset = setList; - }, - - /** - * Prepares the VBO data arrays for population by the `upload` method. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#updateVBOData - * @private - * @since 3.14.0 - * - * @return {this} This Tilemap Layer object. - */ - updateVBOData: function () - { - for (var i = 0; i < this.tileset.length; i++) - { - this.dirty[i] = true; - this.vertexCount[i] = 0; - this.vertexBuffer[i] = null; - this.bufferData[i] = null; - this.vertexViewF32[i] = null; - this.vertexViewU32[i] = null; - } - - return this; - }, - - /** - * If the given tileset is dirty, or hasn't been rendered before, this will create a new - * ArrayBuffer object and iterate through all of the tiles, generating batch data for - * each one, storing the final results into a STATIC vertex buffer. - * - * If the tileset isn't dirty, this method simply returns after setting the vertex buffer - * and buffering the data. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#upload - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to render to. - * @param {integer} tilesetIndex - The tileset index. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - upload: function (camera, tilesetIndex) - { - var pipeline = this.pipeline; - - var renderer = this.renderer; - - var gl = renderer.gl; - - var vertexBuffer = this.vertexBuffer[tilesetIndex]; - var bufferData = this.bufferData[tilesetIndex]; - - if (!this.dirty[tilesetIndex] && vertexBuffer) - { - renderer.setVertexBuffer(vertexBuffer); - - pipeline.setAttribPointers(); - - gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData); - - return this; - } - - var layer = this.layer; - var tileset = this.tileset[tilesetIndex]; - var mapWidth = layer.width; - var mapHeight = layer.height; - var width = tileset.image.source[0].width; - var height = tileset.image.source[0].height; - var mapData = layer.data; - var tile; - var row; - var col; - var renderOrder = this._renderOrder; - var minTileIndex = tileset.firstgid; - var maxTileIndex = tileset.firstgid + tileset.total; - var vOffset = -1; - var bufferSize = (mapWidth * mapHeight) * pipeline.vertexSize * 6; - - this.vertexCount[tilesetIndex] = 0; - - if (bufferData === null) - { - bufferData = new ArrayBuffer(bufferSize); - - this.bufferData[tilesetIndex] = bufferData; - - this.vertexViewF32[tilesetIndex] = new Float32Array(bufferData); - this.vertexViewU32[tilesetIndex] = new Uint32Array(bufferData); - } - - if (renderOrder === 0) - { - // right-down - - for (row = 0; row < mapHeight; row++) - { - for (col = 0; col < mapWidth; col++) - { - tile = mapData[row][col]; - - if (!tile || tile.index < minTileIndex || tile.index > maxTileIndex || !tile.visible) - { - continue; - } - - vOffset = this.batchTile(vOffset, tile, tileset, width, height, camera, tilesetIndex); - } - } - } - else if (renderOrder === 1) - { - // left-down - - for (row = 0; row < mapHeight; row++) - { - for (col = mapWidth - 1; col >= 0; col--) - { - tile = mapData[row][col]; - - if (!tile || tile.index < minTileIndex || tile.index > maxTileIndex || !tile.visible) - { - continue; - } - - vOffset = this.batchTile(vOffset, tile, tileset, width, height, camera, tilesetIndex); - } - } - } - else if (renderOrder === 2) - { - // right-up - - for (row = mapHeight - 1; row >= 0; row--) - { - for (col = 0; col < mapWidth; col++) - { - tile = mapData[row][col]; - - if (!tile || tile.index < minTileIndex || tile.index > maxTileIndex || !tile.visible) - { - continue; - } - - vOffset = this.batchTile(vOffset, tile, tileset, width, height, camera, tilesetIndex); - } - } - } - else if (renderOrder === 3) - { - // left-up - - for (row = mapHeight - 1; row >= 0; row--) - { - for (col = mapWidth - 1; col >= 0; col--) - { - tile = mapData[row][col]; - - if (!tile || tile.index < minTileIndex || tile.index > maxTileIndex || !tile.visible) - { - continue; - } - - vOffset = this.batchTile(vOffset, tile, tileset, width, height, camera, tilesetIndex); - } - } - } - - this.dirty[tilesetIndex] = false; - - if (vertexBuffer === null) - { - vertexBuffer = renderer.createVertexBuffer(bufferData, gl.STATIC_DRAW); - - this.vertexBuffer[tilesetIndex] = vertexBuffer; - } - - renderer.setVertexBuffer(vertexBuffer); - - pipeline.setAttribPointers(); - - gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData); - - return this; - }, - - /** - * Add a single tile into the batch. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#batchTile - * @private - * @since 3.12.0 - * - * @param {integer} vOffset - The vertex offset. - * @param {any} tile - The tile being rendered. - * @param {any} tileset - The tileset being used for rendering. - * @param {integer} width - The width of the tileset image in pixels. - * @param {integer} height - The height of the tileset image in pixels. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the layer is being rendered with. - * @param {integer} tilesetIndex - The tileset index. - * - * @return {integer} The new vOffset value. - */ - batchTile: function (vOffset, tile, tileset, width, height, camera, tilesetIndex) - { - var texCoords = tileset.getTileTextureCoordinates(tile.index); - - if (!texCoords) - { - return vOffset; - } - - var tileWidth = tileset.tileWidth; - var tileHeight = tileset.tileHeight; - - var halfTileWidth = tileWidth / 2; - var halfTileHeight = tileHeight / 2; - - var u0 = texCoords.x / width; - var v0 = texCoords.y / height; - var u1 = (texCoords.x + tileWidth) / width; - var v1 = (texCoords.y + tileHeight) / height; - - var matrix = this._tempMatrix; - - var x = -halfTileWidth; - var y = -halfTileHeight; - - if (tile.flipX) - { - tileWidth *= -1; - x += tileset.tileWidth; - } - - if (tile.flipY) - { - tileHeight *= -1; - y += tileset.tileHeight; - } - - var xw = x + tileWidth; - var yh = y + tileHeight; - - matrix.applyITRS(halfTileWidth + tile.pixelX, halfTileHeight + tile.pixelY, tile.rotation, 1, 1); - - var tint = Utils.getTintAppendFloatAlpha(0xffffff, camera.alpha * this.alpha * tile.alpha); - - var tx0 = matrix.getX(x, y); - var ty0 = matrix.getY(x, y); - - var tx1 = matrix.getX(x, yh); - var ty1 = matrix.getY(x, yh); - - var tx2 = matrix.getX(xw, yh); - var ty2 = matrix.getY(xw, yh); - - var tx3 = matrix.getX(xw, y); - var ty3 = matrix.getY(xw, y); - - if (camera.roundPixels) - { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); - - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); - - tx2 = Math.round(tx2); - ty2 = Math.round(ty2); - - tx3 = Math.round(tx3); - ty3 = Math.round(ty3); - } - - var vertexViewF32 = this.vertexViewF32[tilesetIndex]; - var vertexViewU32 = this.vertexViewU32[tilesetIndex]; - - vertexViewF32[++vOffset] = tx0; - vertexViewF32[++vOffset] = ty0; - vertexViewF32[++vOffset] = u0; - vertexViewF32[++vOffset] = v0; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx1; - vertexViewF32[++vOffset] = ty1; - vertexViewF32[++vOffset] = u0; - vertexViewF32[++vOffset] = v1; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx2; - vertexViewF32[++vOffset] = ty2; - vertexViewF32[++vOffset] = u1; - vertexViewF32[++vOffset] = v1; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx0; - vertexViewF32[++vOffset] = ty0; - vertexViewF32[++vOffset] = u0; - vertexViewF32[++vOffset] = v0; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx2; - vertexViewF32[++vOffset] = ty2; - vertexViewF32[++vOffset] = u1; - vertexViewF32[++vOffset] = v1; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx3; - vertexViewF32[++vOffset] = ty3; - vertexViewF32[++vOffset] = u1; - vertexViewF32[++vOffset] = v0; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - this.vertexCount[tilesetIndex] += 6; - - return vOffset; - }, - - /** - * Sets the rendering (draw) order of the tiles in this layer. - * - * The default is 'right-down', meaning it will order the tiles starting from the top-left, - * drawing to the right and then moving down to the next row. - * - * The draw orders are: - * - * 0 = right-down - * 1 = left-down - * 2 = right-up - * 3 = left-up - * - * Setting the render order does not change the tiles or how they are stored in the layer, - * it purely impacts the order in which they are rendered. - * - * You can provide either an integer (0 to 3), or the string version of the order. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setRenderOrder - * @since 3.12.0 - * - * @param {(integer|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. - * - * @return {this} This Tilemap Layer object. - */ - setRenderOrder: function (renderOrder) - { - var orders = [ 'right-down', 'left-down', 'right-up', 'left-up' ]; - - if (typeof renderOrder === 'string') - { - renderOrder = orders.indexOf(renderOrder); - } - - if (renderOrder >= 0 && renderOrder < 4) - { - this._renderOrder = renderOrder; - - for (var i = 0; i < this.tileset.length; i++) - { - this.dirty[i] = true; - } - } - - return this; - }, - - /** - * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting - * faces are used internally for optimizing collisions against tiles. This method is mostly used - * internally to optimize recalculating faces when only one tile has been changed. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#calculateFacesAt - * @since 3.0.0 - * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - calculateFacesAt: function (tileX, tileY) - { - TilemapComponents.CalculateFacesAt(tileX, tileY, this.layer); - - return this; - }, - - /** - * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the - * layer. Interesting faces are used internally for optimizing collisions against tiles. This method - * is mostly used internally. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#calculateFacesWithin - * @since 3.0.0 - * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - calculateFacesWithin: function (tileX, tileY, width, height) - { - TilemapComponents.CalculateFacesWithin(tileX, tileY, width, height, this.layer); - - return this; - }, - - /** - * Creates a Sprite for every object matching the given tile indexes in the layer. You can - * optionally specify if each tile will be replaced with a new tile after the Sprite has been - * created. This is useful if you want to lay down special tiles in a level that are converted to - * Sprites, but want to replace the tile itself with a floor tile or similar once converted. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#createFromTiles - * @since 3.0.0 - * - * @param {(integer|array)} indexes - The tile index, or array of indexes, to create Sprites from. - * @param {(integer|array)} replacements - The tile index, or array of indexes, to change a converted - * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a - * one-to-one mapping with the indexes array. - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. - * scene.make.sprite). - * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when determining the world XY - * - * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. - */ - createFromTiles: function (indexes, replacements, spriteConfig, scene, camera) - { - return TilemapComponents.CreateFromTiles(indexes, replacements, spriteConfig, scene, camera, this.layer); - }, - - /** - * Returns the tiles in the given layer that are within the cameras viewport. - * This is used internally. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#cull - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - cull: function (camera) - { - return this.cullCallback(this.layer, camera, this.culledTiles); - }, - - /** - * Canvas only. - * - * You can control if the Cameras should cull tiles before rendering them or not. - * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. - * - * However, there are some instances when you may wish to disable this. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setSkipCull - * @since 3.12.0 - * - * @param {boolean} [value=true] - Set to `true` to stop culling tiles. Set to `false` to enable culling again. - * - * @return {this} This Tilemap Layer object. - */ - setSkipCull: function (value) - { - if (value === undefined) { value = true; } - - this.skipCull = value; - - return this; - }, - - /** - * Canvas only. - * - * When a Camera culls the tiles in this layer it does so using its view into the world, building up a - * rectangle inside which the tiles must exist or they will be culled. Sometimes you may need to expand the size - * of this 'cull rectangle', especially if you plan on rotating the Camera viewing the layer. Do so - * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px - * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale) - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCullPadding - * @since 3.12.0 - * - * @param {integer} [paddingX=1] - The amount of extra horizontal tiles to add to the cull check padding. - * @param {integer} [paddingY=1] - The amount of extra vertical tiles to add to the cull check padding. - * - * @return {this} This Tilemap Layer object. - */ - setCullPadding: function (paddingX, paddingY) - { - if (paddingX === undefined) { paddingX = 1; } - if (paddingY === undefined) { paddingY = 1; } - - this.cullPaddingX = paddingX; - this.cullPaddingY = paddingY; - - return this; - }, - - /** - * Searches the entire map layer for the first tile matching the given index, then returns that Tile - * object. If no match is found, it returns null. The search starts from the top-left tile and - * continues horizontally until it hits the end of the row, then it drops down to the next column. - * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to - * the top-left. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#findByIndex - * @since 3.0.0 - * - * @param {integer} index - The tile index value to search for. - * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. - * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the - * bottom-right. Otherwise it scans from the top-left. - * - * @return {Phaser.Tilemaps.Tile} A Tile object. - */ - findByIndex: function (findIndex, skip, reverse) - { - return TilemapComponents.FindByIndex(findIndex, skip, reverse, this.layer); - }, - - /** - * Find the first tile in the given rectangular area (in tile coordinates) of the layer that - * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns - * true. Similar to Array.prototype.find in vanilla JS. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#findTile - * @since 3.0.0 - * - * @param {function} callback - The callback. Each tile in the given area will be passed to this - * callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * - * @return {?Phaser.Tilemaps.Tile} - */ - findTile: function (callback, context, tileX, tileY, width, height, filteringOptions) - { - return TilemapComponents.FindTile(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); - }, - - /** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns - * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#filterTiles - * @since 3.0.0 - * - * @param {function} callback - The callback. Each tile in the given area will be passed to this - * callback as the first and only parameter. The callback should return true for tiles that pass the - * filter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - filterTiles: function (callback, context, tileX, tileY, width, height, filteringOptions) - { - return TilemapComponents.FilterTiles(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); - }, - - /** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * callback. Similar to Array.prototype.forEach in vanilla JS. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#forEachTile - * @since 3.0.0 - * - * @param {function} callback - The callback. Each tile in the given area will be passed to this - * callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions) - { - TilemapComponents.ForEachTile(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); - - return this; - }, - - /** - * Gets a tile at the given tile coordinates from the given layer. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTileAt - * @since 3.0.0 - * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile - * object with an index of -1. - * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. - */ - getTileAt: function (tileX, tileY, nonNull) - { - return TilemapComponents.GetTileAt(tileX, tileY, nonNull, this.layer); - }, - - /** - * Gets a tile at the given world coordinates from the given layer. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTileAtWorldXY - * @since 3.0.0 - * - * @param {number} worldX - X position to get the tile from (given in pixels) - * @param {number} worldY - Y position to get the tile from (given in pixels) - * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile - * object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates - * were invalid. - */ - getTileAtWorldXY: function (worldX, worldY, nonNull, camera) - { - return TilemapComponents.GetTileAtWorldXY(worldX, worldY, nonNull, camera, this.layer); - }, - - /** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithin - * @since 3.0.0 - * - * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - getTilesWithin: function (tileX, tileY, width, height, filteringOptions) - { - return TilemapComponents.GetTilesWithin(tileX, tileY, width, height, filteringOptions, this.layer); - }, - - /** - * Gets the tiles in the given rectangular area (in world coordinates) of the layer. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithinWorldXY - * @since 3.0.0 - * - * @param {number} worldX - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} worldY - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles high from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera) - { - return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer); - }, - - /** - * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, - * Line, Rectangle or Triangle. The shape should be in world coordinates. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithinShape - * @since 3.0.0 - * - * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - getTilesWithinShape: function (shape, filteringOptions, camera) - { - return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer); - }, - - /** - * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAt - * @since 3.0.0 - * - * @param {integer} tileX - X position to get the tile from in tile coordinates. - * @param {integer} tileY - Y position to get the tile from in tile coordinates. - * - * @return {boolean} - */ - hasTileAt: function (tileX, tileY) - { - return TilemapComponents.HasTileAt(tileX, tileY, this.layer); - }, - - /** - * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAtWorldXY - * @since 3.0.0 - * - * @param {number} worldX - The X coordinate of the world position. - * @param {number} worldY - The Y coordinate of the world position. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {boolean} - */ - hasTileAtWorldXY: function (worldX, worldY, camera) - { - return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, this.layer); - }, - - /** - * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to - * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles - * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation - * wherever you want on the screen. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#renderDebug - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - renderDebug: function (graphics, styleConfig) - { - TilemapComponents.RenderDebug(graphics, styleConfig, this.layer); - - return this; - }, - - /** - * Sets collision on the given tile or tiles within a layer by index. You can pass in either a - * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if - * collision will be enabled (true) or disabled (false). - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollision - * @since 3.0.0 - * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to - * false if no tiles have been placed for significant performance boost. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollision: function (indexes, collides, recalculateFaces, updateLayer) - { - TilemapComponents.SetCollision(indexes, collides, recalculateFaces, this.layer, updateLayer); - - return this; - }, - - /** - * Sets collision on a range of tiles in a layer whose index is between the specified `start` and - * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set - * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be - * enabled (true) or disabled (false). - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionBetween - * @since 3.0.0 - * - * @param {integer} start - The first index of the tile to be set for collision. - * @param {integer} stop - The last index of the tile to be set for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionBetween: function (start, stop, collides, recalculateFaces) - { - TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property - * that matches the given properties object, its collision flag will be set. The `collides` - * parameter controls if collision will be enabled (true) or disabled (false). Passing in - * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that - * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can - * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a - * "types" property that matches any of those values, its collision flag will be updated. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionByProperty - * @since 3.0.0 - * - * @param {object} properties - An object with tile properties and corresponding values that should - * be checked. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionByProperty: function (properties, collides, recalculateFaces) - { - TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets collision on all tiles in the given layer, except for tiles that have an index specified in - * the given array. The `collides` parameter controls if collision will be enabled (true) or - * disabled (false). Tile indexes not currently in the layer are not affected. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionByExclusion - * @since 3.0.0 - * - * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionByExclusion: function (indexes, collides, recalculateFaces) - { - TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets a global collision callback for the given tile index within the layer. This will affect all - * tiles on this layer that have the same index. If a callback is already set for the tile index it - * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile - * at a specific location on the map then see setTileLocationCallback. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setTileIndexCallback - * @since 3.0.0 - * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes to have a - * collision callback set for. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} callbackContext - The context under which the callback is called. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setTileIndexCallback: function (indexes, callback, callbackContext) - { - TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, this.layer); - - return this; - }, - - /** - * Sets collision on the tiles within a layer by checking each tiles collision group data - * (typically defined in Tiled within the tileset collision editor). If any objects are found within - * a tiles collision group, the tile's colliding information will be set. The `collides` parameter - * controls if collision will be enabled (true) or disabled (false). - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionFromCollisionGroup - * @since 3.0.0 - * - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionFromCollisionGroup: function (collides, recalculateFaces) - { - TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. - * If a callback is already set for the tile index it will be replaced. Set the callback to null to - * remove it. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setTileLocationCallback - * @since 3.0.0 - * - * @param {integer} tileX - The leftmost tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The topmost tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} [callbackContext] - The context under which the callback is called. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext) - { - TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, this.layer); - - return this; - }, - - /** - * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldX - * @since 3.0.0 - * - * @param {integer} tileX - The X coordinate, in tile coordinates. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. - * - * @return {number} - */ - tileToWorldX: function (tileX, camera) - { - return TilemapComponents.TileToWorldX(tileX, camera, this.layer); - }, - - /** - * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldY - * @since 3.0.0 - * - * @param {integer} tileY - The Y coordinate, in tile coordinates. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. - * - * @return {number} - */ - tileToWorldY: function (tileY, camera) - { - return TilemapComponents.TileToWorldY(tileY, camera, this.layer); - }, - - /** - * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldXY - * @since 3.0.0 - * - * @param {integer} tileX - The X coordinate, in tile coordinates. - * @param {integer} tileY - The Y coordinate, in tile coordinates. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. - * - * @return {Phaser.Math.Vector2} - */ - tileToWorldXY: function (tileX, tileY, point, camera) - { - return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer); - }, - - /** - * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileX - * @since 3.0.0 - * - * @param {number} worldX - The X coordinate, in world pixels. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the - * nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.] - * - * @return {number} - */ - worldToTileX: function (worldX, snapToFloor, camera) - { - return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer); - }, - - /** - * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileY - * @since 3.0.0 - * - * @param {number} worldY - The Y coordinate, in world pixels. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the - * nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {number} - */ - worldToTileY: function (worldY, snapToFloor, camera) - { - return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer); - }, - - /** - * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileXY - * @since 3.0.0 - * - * @param {number} worldX - The X coordinate, in world pixels. - * @param {number} worldY - The Y coordinate, in world pixels. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the - * nearest integer. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {Phaser.Math.Vector2} - */ - worldToTileXY: function (worldX, worldY, snapToFloor, point, camera) - { - return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer); - }, - - /** - * Destroys this StaticTilemapLayer and removes its link to the associated LayerData. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#destroy - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#destroy + * @since 3.50.0 * * @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap? */ @@ -117436,16 +123244,6 @@ var StaticTilemapLayer = new Class({ this.culledTiles.length = 0; this.cullCallback = null; - for (var i = 0; i < this.tileset.length; i++) - { - this.dirty[i] = true; - this.vertexCount[i] = 0; - this.vertexBuffer[i] = null; - this.bufferData[i] = null; - this.vertexViewF32[i] = null; - this.vertexViewU32[i] = null; - } - this.gidMap = []; this.tileset = []; @@ -117454,11 +123252,11 @@ var StaticTilemapLayer = new Class({ }); -module.exports = StaticTilemapLayer; +module.exports = TilemapLayer; /***/ }), -/* 525 */ +/* 561 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117731,6 +123529,58 @@ var TimerEvent = new Class({ return this.elapsed * 0.001; }, + /** + * Returns the time interval until the next iteration of the Timer Event. + * + * @method Phaser.Time.TimerEvent#getRemaining + * @since 3.50.0 + * + * @return {number} The time interval in milliseconds. + */ + getRemaining: function () + { + return this.delay - this.elapsed; + }, + + /** + * Returns the time interval until the next iteration of the Timer Event in seconds. + * + * @method Phaser.Time.TimerEvent#getRemainingSeconds + * @since 3.50.0 + * + * @return {number} The time interval in seconds. + */ + getRemainingSeconds: function () + { + return this.getRemaining() * 0.001; + }, + + /** + * Returns the time interval until the last iteration of the Timer Event. + * + * @method Phaser.Time.TimerEvent#getOverallRemaining + * @since 3.50.0 + * + * @return {number} The time interval in milliseconds. + */ + getOverallRemaining: function () + { + return this.delay * (1 + this.repeatCount) - this.elapsed; + }, + + /** + * Returns the time interval until the last iteration of the Timer Event in seconds. + * + * @method Phaser.Time.TimerEvent#getOverallRemainingSeconds + * @since 3.50.0 + * + * @return {number} The time interval in seconds. + */ + getOverallRemainingSeconds: function () + { + return this.getOverallRemaining() * 0.001; + }, + /** * Forces the Timer Event to immediately expire, thus scheduling its removal in the next frame. * @@ -117771,7 +123621,7 @@ module.exports = TimerEvent; /***/ }), -/* 526 */ +/* 562 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117780,7 +123630,7 @@ module.exports = TimerEvent; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RESERVED = __webpack_require__(1375); +var RESERVED = __webpack_require__(1437); /** * Internal function used by the Tween Builder to return an array of properties @@ -117832,7 +123682,7 @@ module.exports = GetProps; /***/ }), -/* 527 */ +/* 563 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117880,7 +123730,7 @@ module.exports = GetTweens; /***/ }), -/* 528 */ +/* 564 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -117889,15 +123739,15 @@ module.exports = GetTweens; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Defaults = __webpack_require__(243); +var Defaults = __webpack_require__(256); var GetAdvancedValue = __webpack_require__(15); -var GetBoolean = __webpack_require__(90); -var GetEaseFunction = __webpack_require__(71); +var GetBoolean = __webpack_require__(95); +var GetEaseFunction = __webpack_require__(78); var GetNewValue = __webpack_require__(155); var GetValue = __webpack_require__(6); -var GetValueOp = __webpack_require__(242); -var Tween = __webpack_require__(244); -var TweenData = __webpack_require__(246); +var GetValueOp = __webpack_require__(255); +var Tween = __webpack_require__(257); +var TweenData = __webpack_require__(259); /** * Creates a new Number Tween. @@ -118010,7 +123860,7 @@ module.exports = NumberTweenBuilder; /***/ }), -/* 529 */ +/* 565 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118019,7 +123869,7 @@ module.exports = NumberTweenBuilder; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetEaseFunction = __webpack_require__(71); +var GetEaseFunction = __webpack_require__(78); var GetValue = __webpack_require__(6); var MATH_CONST = __webpack_require__(13); @@ -118256,7 +124106,7 @@ module.exports = StaggerBuilder; /***/ }), -/* 530 */ +/* 566 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118265,16 +124115,16 @@ module.exports = StaggerBuilder; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); -var Defaults = __webpack_require__(243); +var Clone = __webpack_require__(76); +var Defaults = __webpack_require__(256); var GetAdvancedValue = __webpack_require__(15); -var GetBoolean = __webpack_require__(90); -var GetEaseFunction = __webpack_require__(71); +var GetBoolean = __webpack_require__(95); +var GetEaseFunction = __webpack_require__(78); var GetNewValue = __webpack_require__(155); -var GetTargets = __webpack_require__(241); -var GetTweens = __webpack_require__(527); +var GetTargets = __webpack_require__(254); +var GetTweens = __webpack_require__(563); var GetValue = __webpack_require__(6); -var Timeline = __webpack_require__(531); +var Timeline = __webpack_require__(567); var TweenBuilder = __webpack_require__(156); /** @@ -118410,7 +124260,7 @@ module.exports = TimelineBuilder; /***/ }), -/* 531 */ +/* 567 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -118420,10 +124270,10 @@ module.exports = TimelineBuilder; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(245); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(258); var TweenBuilder = __webpack_require__(156); -var TWEEN_CONST = __webpack_require__(91); +var TWEEN_CONST = __webpack_require__(96); /** * @classdesc @@ -118565,7 +124415,7 @@ var Timeline = new Class({ * The current state of the Timeline. * * @name Phaser.Tweens.Timeline#state - * @type {integer} + * @type {number} * @since 3.0.0 */ this.state = TWEEN_CONST.PENDING_ADD; @@ -118574,7 +124424,7 @@ var Timeline = new Class({ * The state of the Timeline when it was paused (used by Resume) * * @name Phaser.Tweens.Timeline#_pausedState - * @type {integer} + * @type {number} * @private * @since 3.0.0 */ @@ -119315,7 +125165,7 @@ module.exports = Timeline; /***/ }), -/* 532 */ +/* 568 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119325,13 +125175,13 @@ module.exports = Timeline; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasSnapshot = __webpack_require__(533); -var CameraEvents = __webpack_require__(42); +var CameraEvents = __webpack_require__(35); +var CanvasSnapshot = __webpack_require__(569); var Class = __webpack_require__(0); -var CONST = __webpack_require__(34); -var GetBlendModes = __webpack_require__(534); -var ScaleEvents = __webpack_require__(94); -var TransformMatrix = __webpack_require__(31); +var CONST = __webpack_require__(39); +var GetBlendModes = __webpack_require__(570); +var ScaleEvents = __webpack_require__(101); +var TransformMatrix = __webpack_require__(24); /** * @classdesc @@ -119363,7 +125213,7 @@ var CanvasRenderer = new Class({ * A constant which allows the renderer to be easily identified as a Canvas Renderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#type - * @type {integer} + * @type {number} * @since 3.0.0 */ this.type = CONST.CANVAS; @@ -119382,7 +125232,7 @@ var CanvasRenderer = new Class({ * The width of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width = 0; @@ -119391,7 +125241,7 @@ var CanvasRenderer = new Class({ * The height of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height = 0; @@ -119406,7 +125256,6 @@ var CanvasRenderer = new Class({ this.config = { clearBeforeRender: game.config.clearBeforeRender, backgroundColor: game.config.backgroundColor, - resolution: game.config.resolution, antialias: game.config.antialias, roundPixels: game.config.roundPixels }; @@ -119489,7 +125338,7 @@ var CanvasRenderer = new Class({ * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix1 * @private * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 + * @since 3.11.0 */ this._tempMatrix1 = new TransformMatrix(); @@ -119499,7 +125348,7 @@ var CanvasRenderer = new Class({ * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix2 * @private * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 + * @since 3.11.0 */ this._tempMatrix2 = new TransformMatrix(); @@ -119509,20 +125358,10 @@ var CanvasRenderer = new Class({ * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix3 * @private * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 + * @since 3.11.0 */ this._tempMatrix3 = new TransformMatrix(); - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix4 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix4 = new TransformMatrix(); - this.init(); }, @@ -119549,8 +125388,6 @@ var CanvasRenderer = new Class({ * * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. - * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. - * @param {number} [resolution] - The Scale Manager resolution setting. */ onResize: function (gameSize, baseSize) { @@ -119673,25 +125510,30 @@ var CanvasRenderer = new Class({ }, /** - * Renders the Scene to the given Camera. + * The core render step for a Scene Camera. + * + * Iterates through the given array of Game Objects and renders them with the given Camera. + * + * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked + * by the Scene Systems.render method. + * + * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. * * @method Phaser.Renderer.Canvas.CanvasRenderer#render * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to render. - * @param {Phaser.GameObjects.DisplayList} children - The Game Objects within the Scene to be rendered. - * @param {number} interpolationPercentage - The interpolation percentage to apply. Currently unused. + * @param {Phaser.GameObjects.GameObject[]} children - An array of filtered Game Objects that can be rendered by the given Camera. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. */ - render: function (scene, children, interpolationPercentage, camera) + render: function (scene, children, camera) { - var list = children.list; - var childCount = list.length; + var childCount = children.length; - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; + var cx = camera.x; + var cy = camera.y; + var cw = camera.width; + var ch = camera.height; var ctx = (camera.renderToTexture) ? camera.context : scene.sys.context; @@ -119724,7 +125566,7 @@ var CanvasRenderer = new Class({ ctx.globalCompositeOperation = 'source-over'; - this.drawCount += list.length; + this.drawCount += childCount; if (camera.renderToTexture) { @@ -119735,19 +125577,14 @@ var CanvasRenderer = new Class({ for (var i = 0; i < childCount; i++) { - var child = list[i]; - - if (!child.willRender(camera)) - { - continue; - } + var child = children[i]; if (child.mask) { child.mask.preRenderCanvas(this, child, camera); } - child.renderCanvas(this, child, interpolationPercentage, camera); + child.renderCanvas(this, child, camera); if (child.mask) { @@ -119821,10 +125658,10 @@ var CanvasRenderer = new Class({ * @param {HTMLCanvasElement} canvas - The canvas to grab from. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {boolean} [getPixel=false] - Grab a single pixel as a Color object, or an area as an Image object? - * @param {integer} [x=0] - The x coordinate to grab from. - * @param {integer} [y=0] - The y coordinate to grab from. - * @param {integer} [width=canvas.width] - The width of the area to grab. - * @param {integer} [height=canvas.height] - The height of the area to grab. + * @param {number} [x=0] - The x coordinate to grab from. + * @param {number} [y=0] - The y coordinate to grab from. + * @param {number} [width=canvas.width] - The width of the area to grab. + * @param {number} [height=canvas.height] - The height of the area to grab. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. * @@ -119886,10 +125723,10 @@ var CanvasRenderer = new Class({ * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotArea * @since 3.16.0 * - * @param {integer} x - The x coordinate to grab from. - * @param {integer} y - The y coordinate to grab from. - * @param {integer} width - The width of the area to grab. - * @param {integer} height - The height of the area to grab. + * @param {number} x - The x coordinate to grab from. + * @param {number} y - The y coordinate to grab from. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. @@ -119927,8 +125764,8 @@ var CanvasRenderer = new Class({ * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotPixel * @since 3.16.0 * - * @param {integer} x - The x coordinate of the pixel to get. - * @param {integer} y - The y coordinate of the pixel to get. + * @param {number} x - The x coordinate of the pixel to get. + * @param {number} y - The y coordinate of the pixel to get. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. * * @return {this} This WebGL Renderer. @@ -120122,7 +125959,7 @@ module.exports = CanvasRenderer; /***/ }), -/* 533 */ +/* 569 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120131,8 +125968,8 @@ module.exports = CanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); -var Color = __webpack_require__(32); +var CanvasPool = __webpack_require__(31); +var Color = __webpack_require__(36); var GetFastValue = __webpack_require__(2); /** @@ -120215,7 +126052,7 @@ module.exports = CanvasSnapshot; /***/ }), -/* 534 */ +/* 570 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120224,8 +126061,8 @@ module.exports = CanvasSnapshot; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var modes = __webpack_require__(54); -var CanvasFeatures = __webpack_require__(329); +var modes = __webpack_require__(48); +var CanvasFeatures = __webpack_require__(340); /** * Returns an array which maps the default blend modes to supported Canvas blend modes. @@ -120279,7 +126116,7 @@ module.exports = GetBlendModes; /***/ }), -/* 535 */ +/* 571 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -120289,22 +126126,21 @@ module.exports = GetBlendModes; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCamera = __webpack_require__(93); -var CameraEvents = __webpack_require__(42); +var ArrayRemove = __webpack_require__(87); +var BaseCamera = __webpack_require__(99); +var CameraEvents = __webpack_require__(35); var Class = __webpack_require__(0); -var CONST = __webpack_require__(34); -var GameEvents = __webpack_require__(21); -var IsSizePowerOfTwo = __webpack_require__(128); +var CONST = __webpack_require__(39); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(190); +var GameEvents = __webpack_require__(23); +var IsSizePowerOfTwo = __webpack_require__(133); var NOOP = __webpack_require__(1); -var PIPELINE_CONST = __webpack_require__(110); -var PipelineManager = __webpack_require__(536); -var ProjectOrtho = __webpack_require__(185); -var ScaleEvents = __webpack_require__(94); -var SpliceOne = __webpack_require__(82); -var TextureEvents = __webpack_require__(130); -var TransformMatrix = __webpack_require__(31); -var Utils = __webpack_require__(10); -var WebGLSnapshot = __webpack_require__(541); +var PipelineManager = __webpack_require__(572); +var ScaleEvents = __webpack_require__(101); +var TextureEvents = __webpack_require__(136); +var Utils = __webpack_require__(12); +var WebGLSnapshot = __webpack_require__(580); /** * @callback WebGLContextCallback @@ -120324,6 +126160,7 @@ var WebGLSnapshot = __webpack_require__(541); * * @class WebGLRenderer * @memberof Phaser.Renderer.WebGL + * @extends Phaser.Events.EventEmitter * @constructor * @since 3.0.0 * @@ -120331,10 +126168,14 @@ var WebGLSnapshot = __webpack_require__(541); */ var WebGLRenderer = new Class({ + Extends: EventEmitter, + initialize: function WebGLRenderer (game) { + EventEmitter.call(this); + var gameConfig = game.config; var contextCreationConfig = { @@ -120360,7 +126201,6 @@ var WebGLRenderer = new Class({ antialias: gameConfig.antialias, backgroundColor: gameConfig.backgroundColor, contextCreation: contextCreationConfig, - resolution: gameConfig.resolution, roundPixels: gameConfig.roundPixels, maxTextures: gameConfig.maxTextures, maxTextureSize: gameConfig.maxTextureSize, @@ -120382,7 +126222,7 @@ var WebGLRenderer = new Class({ * A constant which allows the renderer to be easily identified as a WebGL Renderer. * * @name Phaser.Renderer.WebGL.WebGLRenderer#type - * @type {integer} + * @type {number} * @since 3.0.0 */ this.type = CONST.WEBGL; @@ -120409,7 +126249,7 @@ var WebGLRenderer = new Class({ * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width = 0; @@ -120419,7 +126259,7 @@ var WebGLRenderer = new Class({ * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height = 0; @@ -120445,16 +126285,6 @@ var WebGLRenderer = new Class({ */ this.blendModes = []; - /** - * Keeps track of any WebGLTexture created with the current WebGLRenderingContext. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#nativeTextures - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.nativeTextures = []; - /** * This property is set to `true` if the WebGL context of the renderer is lost. * @@ -120488,13 +126318,11 @@ var WebGLRenderer = new Class({ bufferHeight: 0 }; - // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) - /** * Cached value for the last texture unit that was used. * * @name Phaser.Renderer.WebGL.WebGLRenderer#currentActiveTexture - * @type {integer} + * @type {number} * @since 3.1.0 */ this.currentActiveTexture = 0; @@ -120504,7 +126332,7 @@ var WebGLRenderer = new Class({ * This value is constantly updated and should be treated as read-only by your code. * * @name Phaser.Renderer.WebGL.WebGLRenderer#startActiveTexture - * @type {integer} + * @type {number} * @since 3.50.0 */ this.startActiveTexture = 0; @@ -120514,7 +126342,7 @@ var WebGLRenderer = new Class({ * This is set via the Game Config `maxTextures` property and should never be changed after boot. * * @name Phaser.Renderer.WebGL.WebGLRenderer#maxTextures - * @type {integer} + * @type {number} * @since 3.50.0 */ this.maxTextures = 0; @@ -120560,7 +126388,7 @@ var WebGLRenderer = new Class({ this.normalTexture; /** - * Current framebuffer in use. + * The currently bound framebuffer in use. * * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer * @type {WebGLFramebuffer} @@ -120569,6 +126397,15 @@ var WebGLRenderer = new Class({ */ this.currentFramebuffer = null; + /** + * A stack into which the frame buffer objects are pushed and popped. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#fboStack + * @type {WebGLFramebuffer[]} + * @since 3.50.0 + */ + this.fboStack = []; + /** * Current WebGLProgram in use. * @@ -120603,7 +126440,7 @@ var WebGLRenderer = new Class({ * Current blend mode in use * * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode - * @type {integer} + * @type {number} * @since 3.0.0 */ this.currentBlendMode = Infinity; @@ -120667,17 +126504,40 @@ var WebGLRenderer = new Class({ this.gl = null; /** - * Array of strings that indicate which WebGL extensions are supported by the browser + * Array of strings that indicate which WebGL extensions are supported by the browser. + * This is populated in the `boot` method. * * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions - * @type {object} + * @type {string[]} * @default null * @since 3.0.0 */ this.supportedExtensions = null; /** - * Extensions loaded into the current context + * If the browser supports the `ANGLE_instanced_arrays` extension, this property will hold + * a reference to the glExtension for it. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#instancedArraysExtension + * @type {ANGLE_instanced_arrays} + * @default null + * @since 3.50.0 + */ + this.instancedArraysExtension = null; + + /** + * If the browser supports the `OES_vertex_array_object` extension, this property will hold + * a reference to the glExtension for it. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#vaoExtension + * @type {OES_vertex_array_object} + * @default null + * @since 3.50.0 + */ + this.vaoExtension = null; + + /** + * The WebGL Extensions loaded into the current context. * * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions * @type {object} @@ -120687,7 +126547,7 @@ var WebGLRenderer = new Class({ this.extensions = {}; /** - * Stores the current WebGL component formats for further use + * Stores the current WebGL component formats for further use. * * @name Phaser.Renderer.WebGL.WebGLRenderer#glFormats * @type {array} @@ -120700,7 +126560,7 @@ var WebGLRenderer = new Class({ * Stores the supported WebGL texture compression formats. * * @name Phaser.Renderer.WebGL.WebGLRenderer#compression - * @type {array} + * @type {object} * @since 3.8.0 */ this.compression = { @@ -120730,6 +126590,17 @@ var WebGLRenderer = new Class({ */ this.blankTexture = null; + /** + * A pure white 4x4 texture, as used by the Graphics system where needed. + * This is set in the `boot` method. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#whiteTexture + * @type {WebGLTexture} + * @readonly + * @since 3.50.0 + */ + this.whiteTexture = null; + /** * A default Camera used in calls when no other camera has been provided. * @@ -120739,51 +126610,11 @@ var WebGLRenderer = new Class({ */ this.defaultCamera = new BaseCamera(0, 0, 0, 0); - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix1 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix2 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix3 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix4 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix4 = new TransformMatrix(); - /** * The total number of masks currently stacked. * * @name Phaser.Renderer.WebGL.WebGLRenderer#maskCount - * @type {integer} + * @type {number} * @since 3.17.0 */ this.maskCount = 0; @@ -120899,6 +126730,25 @@ var WebGLRenderer = new Class({ */ this.textureFlush = 0; + /** + * The default scissor, set during `preRender` and modified during `resize`. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#defaultScissor + * @type {number[]} + * @private + * @since 3.50.0 + */ + this.defaultScissor = [ 0, 0, 0, 0 ]; + + /** + * Has this renderer fully booted yet? + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#isBooted + * @type {boolean} + * @since 3.50.0 + */ + this.isBooted = false; + this.init(this.config); }, @@ -121016,7 +126866,7 @@ var WebGLRenderer = new Class({ }; - // Load supported extensions + // Load supported extensions var exts = gl.getSupportedExtensions(); if (!config.maxTextures || config.maxTextures === -1) @@ -121024,6 +126874,11 @@ var WebGLRenderer = new Class({ config.maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); } + if (!config.maxTextureSize) + { + config.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); + } + var extString = 'WEBGL_compressed_texture_'; var wkExtString = 'WEBKIT_' + extString; @@ -121033,6 +126888,14 @@ var WebGLRenderer = new Class({ this.supportedExtensions = exts; + var angleString = 'ANGLE_instanced_arrays'; + + this.instancedArraysExtension = (exts.indexOf(angleString) > -1) ? gl.getExtension(angleString) : null; + + var vaoString = 'OES_vertex_array_object'; + + this.vaoExtension = (exts.indexOf(vaoString) > -1) ? gl.getExtension(vaoString) : null; + // Setup initial WebGL state gl.disable(gl.DEPTH_TEST); gl.disable(gl.CULL_FACE); @@ -121073,7 +126936,7 @@ var WebGLRenderer = new Class({ gl.bindTexture(gl.TEXTURE_2D, tempTexture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 255, 255, 255, 255 ])); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 0, 0, 255, 255 ])); tempTextures[index] = tempTexture; @@ -121106,16 +126969,23 @@ var WebGLRenderer = new Class({ boot: function () { var game = this.game; + var pipelineManager = this.pipelines; - this.pipelines.boot(); + var baseSize = game.scale.baseSize; - var multi = this.pipelines.get(PIPELINE_CONST.MULTI_PIPELINE); + this.width = baseSize.width; + this.height = baseSize.height; - var blank = game.textures.getFrame('__DEFAULT'); + this.isBooted = true; - multi.currentFrame = blank; + // Set-up pipelines - this.blankTexture = blank; + pipelineManager.boot(game.config.pipeline); + + // Set-up default textures, fbo and scissor + + this.blankTexture = game.textures.getFrame('__DEFAULT'); + this.whiteTexture = game.textures.getFrame('__WHITE'); var gl = this.gl; @@ -121125,9 +126995,7 @@ var WebGLRenderer = new Class({ game.scale.on(ScaleEvents.RESIZE, this.onResize, this); - var baseSize = game.scale.baseSize; - - this.resize(baseSize.width, baseSize.height, game.scale.resolution); + this.resize(baseSize.width, baseSize.height); }, /** @@ -121137,16 +127005,14 @@ var WebGLRenderer = new Class({ * @since 3.16.0 * * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. - * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. - * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. - * @param {number} [resolution] - The Scale Manager resolution setting. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions. The canvas width / height values match this. */ - onResize: function (gameSize, baseSize, displaySize, resolution) + onResize: function (gameSize, baseSize) { // Has the underlying canvas size changed? - if (baseSize.width !== this.width || baseSize.height !== this.height || resolution !== this.resolution) + if (baseSize.width !== this.width || baseSize.height !== this.height) { - this.resize(baseSize.width, baseSize.height, resolution); + this.resize(baseSize.width, baseSize.height); } }, @@ -121154,32 +127020,34 @@ var WebGLRenderer = new Class({ * Resizes the drawing buffer to match that required by the Scale Manager. * * @method Phaser.Renderer.WebGL.WebGLRenderer#resize + * @fires Phaser.Renderer.WebGL.Events#RESIZE * @since 3.0.0 * * @param {number} [width] - The new width of the renderer. * @param {number} [height] - The new height of the renderer. - * @param {number} [resolution] - The new resolution of the renderer. * * @return {this} This WebGLRenderer instance. */ - resize: function (width, height, resolution) + resize: function (width, height) { var gl = this.gl; this.width = width; this.height = height; - this.resolution = resolution; gl.viewport(0, 0, width, height); - this.pipelines.resize(width, height, resolution); - this.drawingBufferHeight = gl.drawingBufferHeight; gl.scissor(0, (gl.drawingBufferHeight - height), width, height); this.defaultCamera.setSize(width, height); + this.defaultScissor[2] = width; + this.defaultScissor[3] = height; + + this.emit(Events.RESIZE, width, height); + return this; }, @@ -121237,13 +127105,13 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor * @since 3.0.0 * - * @param {integer} x - The x position of the scissor. - * @param {integer} y - The y position of the scissor. - * @param {integer} width - The width of the scissor. - * @param {integer} height - The height of the scissor. - * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. + * @param {number} x - The x position of the scissor. + * @param {number} y - The y position of the scissor. + * @param {number} width - The width of the scissor. + * @param {number} height - The height of the scissor. + * @param {number} [drawingBufferHeight] - Optional drawingBufferHeight override value. * - * @return {integer[]} An array containing the scissor values. + * @return {number[]} An array containing the scissor values. */ pushScissor: function (x, y, width, height, drawingBufferHeight) { @@ -121268,11 +127136,11 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor * @since 3.0.0 * - * @param {integer} x - The x position of the scissor. - * @param {integer} y - The y position of the scissor. - * @param {integer} width - The width of the scissor. - * @param {integer} height - The height of the scissor. - * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. + * @param {number} x - The x position of the scissor. + * @param {number} y - The y position of the scissor. + * @param {number} width - The width of the scissor. + * @param {number} height - The height of the scissor. + * @param {number} [drawingBufferHeight] - Optional drawingBufferHeight override value. */ setScissor: function (x, y, width, height, drawingBufferHeight) { @@ -121352,7 +127220,7 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode * @since 3.0.0 * - * @param {integer} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. + * @param {number} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. * @param {boolean} [force=false] - Force the blend mode to be set, regardless of the currently set blend mode. * * @return {boolean} `true` if the blend mode was changed as a result of this call, forcing a flush, otherwise `false`. @@ -121399,7 +127267,7 @@ var WebGLRenderer = new Class({ * @param {GLenum[]} func - An array containing the WebGL functions to use for the source and the destination blending factors, respectively. See the possible constants for {@link WebGLRenderingContext#blendFunc()}. * @param {GLenum} equation - The equation to use for combining the RGB and alpha components of a new pixel with a rendered one. See the possible constants for {@link WebGLRenderingContext#blendEquation()}. * - * @return {integer} The index of the new blend mode, used for referencing it in the future. + * @return {number} The index of the new blend mode, used for referencing it in the future. */ addBlendMode: function (func, equation) { @@ -121414,7 +127282,7 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#updateBlendMode * @since 3.0.0 * - * @param {integer} index - The index of the custom blend mode. + * @param {number} index - The index of the custom blend mode. * @param {function} func - The function to use for the blend mode. * @param {function} equation - The equation to use for the blend mode. * @@ -121442,7 +127310,7 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#removeBlendMode * @since 3.0.0 * - * @param {integer} index - The index of the custom blend mode to be removed. + * @param {number} index - The index of the custom blend mode to be removed. * * @return {this} This WebGLRenderer instance. */ @@ -121482,7 +127350,7 @@ var WebGLRenderer = new Class({ */ setTextureSource: function (textureSource) { - if (this.pipelines.current.forceZero) + if (this.pipelines.forceZero()) { this.setTextureZero(textureSource.glTexture, true); @@ -121675,16 +127543,22 @@ var WebGLRenderer = new Class({ var gl = this.gl; var temp = this.tempTextures; - var total = (all) ? temp.length : 2; - - for (var i = 0; i < total; i++) - { - gl.activeTexture(gl.TEXTURE0 + i); - gl.bindTexture(gl.TEXTURE_2D, temp[i]); - } - if (all) { + for (var i = 0; i < temp.length; i++) + { + gl.activeTexture(gl.TEXTURE0 + i); + gl.bindTexture(gl.TEXTURE_2D, temp[i]); + } + + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_2D, temp[1]); + } + else + { + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, temp[0]); + gl.activeTexture(gl.TEXTURE1); gl.bindTexture(gl.TEXTURE_2D, temp[1]); } @@ -121712,7 +127586,7 @@ var WebGLRenderer = new Class({ */ setTexture2D: function (texture) { - if (this.pipelines.current.forceZero) + if (this.pipelines.forceZero()) { this.setTextureZero(texture, true); @@ -121759,117 +127633,228 @@ var WebGLRenderer = new Class({ }, /** - * Binds a framebuffer. If there was another framebuffer already bound it will force a pipeline flush. + * Pushes a new framebuffer onto the FBO stack and makes it the currently bound framebuffer. + * + * If there was another framebuffer already bound it will force a pipeline flush. + * + * Call `popFramebuffer` to remove it again. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#pushFramebuffer + * @since 3.50.0 + * + * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. + * @param {boolean} [updateScissor=false] - Set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [resetTextures=false] - Should the WebGL Textures be reset after the new framebuffer is bound? + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? + * + * @return {this} This WebGLRenderer instance. + */ + pushFramebuffer: function (framebuffer, updateScissor, resetTextures, setViewport) + { + if (framebuffer === this.currentFramebuffer) + { + return this; + } + + this.fboStack.push(framebuffer); + + return this.setFramebuffer(framebuffer, updateScissor, resetTextures, setViewport); + }, + + /** + * Sets the given framebuffer as the active and currently bound framebuffer. + * + * If there was another framebuffer already bound it will force a pipeline flush. + * + * Typically, you should call `pushFramebuffer` instead of this method. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer * @since 3.0.0 * * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [resetTextures=false] - Should the WebGL Textures be reset after the new framebuffer is bound? + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? * * @return {this} This WebGLRenderer instance. */ - setFramebuffer: function (framebuffer, updateScissor) + setFramebuffer: function (framebuffer, updateScissor, resetTextures, setViewport) { if (updateScissor === undefined) { updateScissor = false; } + if (resetTextures === undefined) { resetTextures = false; } + if (setViewport === undefined) { setViewport = true; } + + if (framebuffer === this.currentFramebuffer) + { + return this; + } var gl = this.gl; var width = this.width; var height = this.height; - if (framebuffer !== this.currentFramebuffer) + if (framebuffer && framebuffer.renderTexture && setViewport) { - if (framebuffer && framebuffer.renderTexture) + width = framebuffer.renderTexture.width; + height = framebuffer.renderTexture.height; + } + else + { + this.flush(); + } + + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + + if (setViewport) + { + gl.viewport(0, 0, width, height); + } + + if (updateScissor) + { + if (framebuffer) { - width = framebuffer.renderTexture.width; - height = framebuffer.renderTexture.height; + this.drawingBufferHeight = height; + + this.pushScissor(0, 0, width, height); } else { - this.flush(); + this.drawingBufferHeight = this.height; + + this.popScissor(); } + } - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + this.currentFramebuffer = framebuffer; - gl.viewport(0, 0, width, height); - - if (updateScissor) - { - if (framebuffer) - { - this.drawingBufferHeight = height; - - this.pushScissor(0, 0, width, height); - } - else - { - this.drawingBufferHeight = this.height; - - this.popScissor(); - } - } - - this.currentFramebuffer = framebuffer; + if (resetTextures) + { + this.resetTextures(); } return this; }, /** - * Binds a program. If there was another program already bound it will force a pipeline flush. + * Pops the previous framebuffer from the fbo stack and sets it. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#popFramebuffer + * @since 3.50.0 + * + * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [resetTextures=false] - Should the WebGL Textures be reset after the new framebuffer is bound? + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? + * + * @return {WebGLFramebuffer} The Framebuffer that was set, or `null` if there aren't any more in the stack. + */ + popFramebuffer: function (updateScissor, resetTextures, setViewport) + { + if (updateScissor === undefined) { updateScissor = false; } + if (resetTextures === undefined) { resetTextures = false; } + if (setViewport === undefined) { setViewport = true; } + + var fboStack = this.fboStack; + + // Remove the current fbo + fboStack.pop(); + + // Reset the previous framebuffer + var framebuffer = fboStack[fboStack.length - 1]; + + if (!framebuffer) + { + framebuffer = null; + } + + this.setFramebuffer(framebuffer, updateScissor, resetTextures, setViewport); + + return framebuffer; + }, + + /** + * Binds a shader program. + * + * If there was a different program already bound it will force a pipeline flush first. + * + * If the same program given to this method is already set as the current program, no change + * will take place and this method will return `false`. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram * @since 3.0.0 * * @param {WebGLProgram} program - The program that needs to be bound. * - * @return {this} This WebGLRenderer instance. + * @return {boolean} `true` if the given program was bound, otherwise `false`. */ setProgram: function (program) { - var gl = this.gl; - if (program !== this.currentProgram) { this.flush(); - gl.useProgram(program); + this.gl.useProgram(program); this.currentProgram = program; + + return true; } + return false; + }, + + /** + * Rebinds whatever program `WebGLRenderer.currentProgram` is set as, without + * changing anything, or flushing. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#resetProgram + * @since 3.50.0 + * + * @return {this} This WebGLRenderer instance. + */ + resetProgram: function () + { + this.gl.useProgram(this.currentProgram); + return this; }, /** - * Bounds a vertex buffer. If there is a vertex buffer already bound it'll force a pipeline flush. + * Binds a vertex buffer. + * + * If there was a different vertex buffer already bound it will force a pipeline flush first. + * + * If the same buffer given to this method is already set as the current buffer, no change + * will take place and this method will return `false`. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setVertexBuffer * @since 3.0.0 * * @param {WebGLBuffer} vertexBuffer - The buffer that needs to be bound. * - * @return {this} This WebGLRenderer instance. + * @return {boolean} `true` if the given buffer was bound, otherwise `false`. */ setVertexBuffer: function (vertexBuffer) { - var gl = this.gl; - - if (vertexBuffer !== this.currentVertexBuffer) + if (vertexBuffer && vertexBuffer !== this.currentVertexBuffer) { + var gl = this.gl; + this.flush(); gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); this.currentVertexBuffer = vertexBuffer; + + return true; } - return this; + return false; }, /** - * Bounds a index buffer. If there is a index buffer already bound it'll force a pipeline flush. + * Binds an index buffer. If there is an index buffer already bound it'll force a pipeline flush. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setIndexBuffer * @since 3.0.0 @@ -121882,7 +127867,7 @@ var WebGLRenderer = new Class({ { var gl = this.gl; - if (indexBuffer !== this.currentIndexBuffer) + if (indexBuffer && indexBuffer !== this.currentIndexBuffer) { this.flush(); @@ -121901,9 +127886,9 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {object} source - The source of the texture. - * @param {integer} width - The width of the texture. - * @param {integer} height - The height of the texture. - * @param {integer} scaleMode - The scale mode to be used by the texture. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} scaleMode - The scale mode to be used by the texture. * * @return {?WebGLTexture} The WebGL Texture that was created, or `null` if it couldn't be created. */ @@ -121949,15 +127934,15 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D * @since 3.0.0 * - * @param {integer} mipLevel - Mip level of the texture. - * @param {integer} minFilter - Filtering of the texture. - * @param {integer} magFilter - Filtering of the texture. - * @param {integer} wrapT - Wrapping mode of the texture. - * @param {integer} wrapS - Wrapping mode of the texture. - * @param {integer} format - Which format does the texture use. + * @param {number} mipLevel - Mip level of the texture. + * @param {number} minFilter - Filtering of the texture. + * @param {number} magFilter - Filtering of the texture. + * @param {number} wrapT - Wrapping mode of the texture. + * @param {number} wrapS - Wrapping mode of the texture. + * @param {number} format - Which format does the texture use. * @param {?object} pixels - pixel data. - * @param {integer} width - Width of the texture in pixels. - * @param {integer} height - Height of the texture in pixels. + * @param {number} width - Width of the texture in pixels. + * @param {number} height - Height of the texture in pixels. * @param {boolean} [pma=true] - Does the texture have premultiplied alpha? * @param {boolean} [forceSize=false] - If `true` it will use the width and height passed to this method, regardless of the pixels dimension. * @param {boolean} [flipY=false] - Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. @@ -122019,21 +128004,19 @@ var WebGLRenderer = new Class({ texture.glIndex = 0; texture.glIndexCounter = -1; - this.nativeTextures.push(texture); - return texture; }, /** - * Wrapper for creating WebGLFramebuffer. + * Creates a WebGL Framebuffer object and optionally binds a depth stencil render buffer. * * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer * @since 3.0.0 * - * @param {integer} width - Width in pixels of the framebuffer - * @param {integer} height - Height in pixels of the framebuffer - * @param {WebGLTexture} renderTexture - The color texture to where the color pixels are written - * @param {boolean} addDepthStencilBuffer - Indicates if the current framebuffer support depth and stencil buffers + * @param {number} width - If `addDepthStencilBuffer` is true, this controls the width of the depth stencil. + * @param {number} height - If `addDepthStencilBuffer` is true, this controls the height of the depth stencil. + * @param {WebGLTexture} renderTexture - The color texture where the color pixels are written. + * @param {boolean} [addDepthStencilBuffer=false] - Create a Renderbuffer for the depth stencil? * * @return {WebGLFramebuffer} Raw WebGLFramebuffer */ @@ -122048,6 +128031,7 @@ var WebGLRenderer = new Class({ if (addDepthStencilBuffer) { var depthStencilBuffer = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer); gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer); @@ -122069,28 +128053,30 @@ var WebGLRenderer = new Class({ 36061: 'Framebuffer Unsupported' }; - throw new Error('Framebuffer incomplete. Framebuffer status: ' + errors[complete]); + throw new Error('Framebuffer status: ' + errors[complete]); } framebuffer.renderTexture = renderTexture; this.setFramebuffer(null); - this.resetTextures(true); + this.resetTextures(); return framebuffer; }, /** - * Wrapper for creating a WebGLProgram + * Creates a WebGLProgram instance based on the given vertex and fragment shader source. + * + * Then compiles, attaches and links the program before returning it. * * @method Phaser.Renderer.WebGL.WebGLRenderer#createProgram * @since 3.0.0 * - * @param {string} vertexShader - Source to the vertex shader - * @param {string} fragmentShader - Source to the fragment shader + * @param {string} vertexShader - The vertex shader source code as a single string. + * @param {string} fragmentShader - The fragment shader source code as a single string. * - * @return {WebGLProgram} Raw WebGLProgram + * @return {WebGLProgram} The linked WebGLProgram created from the given shader source. */ createProgram: function (vertexShader, fragmentShader) { @@ -122106,11 +128092,12 @@ var WebGLRenderer = new Class({ if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) { - throw new Error('Failed to compile Vertex Shader:\n' + gl.getShaderInfoLog(vs)); + throw new Error('Vertex Shader failed:\n' + gl.getShaderInfoLog(vs)); } + if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) { - throw new Error('Failed to compile Fragment Shader:\n' + gl.getShaderInfoLog(fs)); + throw new Error('Fragment Shader failed:\n' + gl.getShaderInfoLog(fs)); } gl.attachShader(program, vs); @@ -122119,9 +128106,11 @@ var WebGLRenderer = new Class({ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { - throw new Error('Failed to link program:\n' + gl.getProgramInfoLog(program)); + throw new Error('Link Program failed:\n' + gl.getProgramInfoLog(program)); } + gl.useProgram(program); + return program; }, @@ -122132,7 +128121,7 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {ArrayBuffer} initialDataOrSize - It's either ArrayBuffer or an integer indicating the size of the vbo - * @param {integer} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW + * @param {number} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW * * @return {WebGLBuffer} Raw vertex buffer */ @@ -122141,11 +128130,9 @@ var WebGLRenderer = new Class({ var gl = this.gl; var vertexBuffer = gl.createBuffer(); - this.setVertexBuffer(vertexBuffer); - + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); - - this.setVertexBuffer(null); + gl.bindBuffer(gl.ARRAY_BUFFER, null); return vertexBuffer; }, @@ -122157,7 +128144,7 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {ArrayBuffer} initialDataOrSize - Either ArrayBuffer or an integer indicating the size of the vbo. - * @param {integer} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW. + * @param {number} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW. * * @return {WebGLBuffer} Raw index buffer */ @@ -122166,37 +128153,36 @@ var WebGLRenderer = new Class({ var gl = this.gl; var indexBuffer = gl.createBuffer(); - this.setIndexBuffer(indexBuffer); - + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, initialDataOrSize, bufferUsage); - - this.setIndexBuffer(null); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); return indexBuffer; }, /** - * Removes the given texture from the nativeTextures array and then deletes it from the GPU. + * Calls `GL.deleteTexture` on the given WebGLTexture and also optionally + * resets the currently defined textures. * * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture * @since 3.0.0 * * @param {WebGLTexture} texture - The WebGL Texture to be deleted. + * @param {boolean} [reset=false] - Call the `resetTextures` method after deleting this texture? * * @return {this} This WebGLRenderer instance. */ - deleteTexture: function (texture) + deleteTexture: function (texture, reset) { - var index = this.nativeTextures.indexOf(texture); - - if (index !== -1) + if (texture) { - SpliceOne(this.nativeTextures, index); + this.gl.deleteTexture(texture); } - this.gl.deleteTexture(texture); - - this.resetTextures(); + if (reset) + { + this.resetTextures(); + } return this; }, @@ -122213,7 +128199,17 @@ var WebGLRenderer = new Class({ */ deleteFramebuffer: function (framebuffer) { - this.gl.deleteFramebuffer(framebuffer); + if (framebuffer) + { + this.gl.deleteFramebuffer(framebuffer); + + ArrayRemove(this.fboStack, framebuffer); + + if (this.currentFramebuffer === framebuffer) + { + this.currentFramebuffer = null; + } + } return this; }, @@ -122230,7 +128226,10 @@ var WebGLRenderer = new Class({ */ deleteProgram: function (program) { - this.gl.deleteProgram(program); + if (program) + { + this.gl.deleteProgram(program); + } return this; }, @@ -122263,70 +128262,36 @@ var WebGLRenderer = new Class({ */ preRenderCamera: function (camera) { - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; + var cx = camera.x; + var cy = camera.y; + var cw = camera.width; + var ch = camera.height; var color = camera.backgroundColor; - var MultiPipeline = this.pipelines.MULTI_PIPELINE; + camera.emit(CameraEvents.PRE_RENDER, camera); - if (camera.renderToTexture) + this.pipelines.preBatchCamera(camera); + + this.pushScissor(cx, cy, cw, ch); + + if (camera.mask) { - this.flush(); + this.currentCameraMask.mask = camera.mask; + this.currentCameraMask.camera = camera._maskCamera; - this.pushScissor(cx, cy, cw, -ch); - - this.setFramebuffer(camera.framebuffer); - - var gl = this.gl; - - gl.clearColor(0, 0, 0, 0); - - gl.clear(gl.COLOR_BUFFER_BIT); - - ProjectOrtho(MultiPipeline, cx, cw + cx, cy, ch + cy, -1000, 1000); - - if (camera.mask) - { - this.currentCameraMask.mask = camera.mask; - this.currentCameraMask.camera = camera._maskCamera; - - camera.mask.preRenderWebGL(this, camera, camera._maskCamera); - } - - if (color.alphaGL > 0) - { - MultiPipeline.drawFillRect( - cx, cy, cw + cx, ch + cy, - Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1), - color.alphaGL - ); - } - - camera.emit(CameraEvents.PRE_RENDER, camera); + camera.mask.preRenderWebGL(this, camera, camera._maskCamera); } - else + + if (color.alphaGL > 0) { - this.pushScissor(cx, cy, cw, ch); + var pipeline = this.pipelines.setMulti(); - if (camera.mask) - { - this.currentCameraMask.mask = camera.mask; - this.currentCameraMask.camera = camera._maskCamera; - - camera.mask.preRenderWebGL(this, camera, camera._maskCamera); - } - - if (color.alphaGL > 0) - { - MultiPipeline.drawFillRect( - cx, cy, cw , ch, - Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1), - color.alphaGL - ); - } + pipeline.drawFillRect( + cx, cy, cw, ch, + Utils.getTintFromFloats(color.blueGL, color.greenGL, color.redGL, 1), + color.alphaGL + ); } }, @@ -122357,7 +128322,8 @@ var WebGLRenderer = new Class({ /** * Controls the post-render operations for the given camera. - * Renders the foreground camera effects like flash and fading. It resets the current scissor state. + * + * Renders the foreground camera effects like flash and fading, then resets the current scissor state. * * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera * @since 3.0.0 @@ -122366,70 +128332,35 @@ var WebGLRenderer = new Class({ */ postRenderCamera: function (camera) { - var multiPipeline = this.pipelines.setMulti(); + if (camera.flashEffect.isRunning || camera.fadeEffect.isRunning) + { + var pipeline = this.pipelines.setMulti(); - camera.flashEffect.postRenderWebGL(multiPipeline, Utils.getTintFromFloats); - camera.fadeEffect.postRenderWebGL(multiPipeline, Utils.getTintFromFloats); + camera.flashEffect.postRenderWebGL(pipeline, Utils.getTintFromFloats); + camera.fadeEffect.postRenderWebGL(pipeline, Utils.getTintFromFloats); + } camera.dirty = false; this.popScissor(); - if (camera.renderToTexture) - { - multiPipeline.flush(); - - this.setFramebuffer(null); - - camera.emit(CameraEvents.POST_RENDER, camera); - - if (camera.renderToGame) - { - ProjectOrtho(multiPipeline, 0, multiPipeline.width, multiPipeline.height, 0, -1000.0, 1000.0); - - var getTint = Utils.getTintAppendFloatAlpha; - - var pipeline = (camera.pipeline) ? camera.pipeline : multiPipeline; - - pipeline.batchTexture( - camera, - camera.glTexture, - camera.width, camera.height, - camera.x, camera.y, - camera.width, camera.height, - 1, 1, - 0, - camera.flipX, !camera.flipY, - 1, 1, - 0, 0, - 0, 0, camera.width, camera.height, - getTint(camera._tintTL, camera._alphaTL), - getTint(camera._tintTR, camera._alphaTR), - getTint(camera._tintBL, camera._alphaBL), - getTint(camera._tintBR, camera._alphaBR), - (camera._isTinted && camera.tintFill), - 0, 0, - this.defaultCamera, - null - ); - } - - // Force clear the current texture so that items next in the batch (like Graphics) don't try and use it - this.setBlankTexture(true); - } - if (camera.mask) { this.currentCameraMask.mask = null; camera.mask.postRenderWebGL(this, camera._maskCamera); } + + this.pipelines.postBatchCamera(camera); + + camera.emit(CameraEvents.POST_RENDER, camera); }, /** * Clears the current vertex buffer and updates pipelines. * * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender + * @fires Phaser.Renderer.WebGL.Events#PRE_RENDER * @since 3.0.0 */ preRender: function () @@ -122452,13 +128383,10 @@ var WebGLRenderer = new Class({ gl.enable(gl.SCISSOR_TEST); - this.pipelines.preRender(); + this.currentScissor = this.defaultScissor; - // TODO - Find a way to stop needing to create these arrays every frame - // and equally not need a huge array buffer created to hold them - - this.currentScissor = [ 0, 0, this.width, this.height ]; - this.scissorStack = [ this.currentScissor ]; + this.scissorStack.length = 0; + this.scissorStack.push(this.currentScissor); if (this.game.scene.customViewports) { @@ -122471,13 +128399,13 @@ var WebGLRenderer = new Class({ this.textureFlush = 0; - this.pipelines.setMulti(); + this.emit(Events.PRE_RENDER); }, /** * The core render step for a Scene Camera. * - * Iterates through the given Game Object's array and renders them with the given Camera. + * Iterates through the given array of Game Objects and renders them with the given Camera. * * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked * by the Scene Systems.render method. @@ -122485,21 +128413,20 @@ var WebGLRenderer = new Class({ * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. * * @method Phaser.Renderer.WebGL.WebGLRenderer#render + * @fires Phaser.Renderer.WebGL.Events#RENDER * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to render. - * @param {Phaser.GameObjects.GameObject} children - The Game Object's within the Scene to be rendered. - * @param {number} interpolationPercentage - The interpolation percentage to apply. Currently un-used. + * @param {Phaser.GameObjects.GameObject[]} children - An array of filtered Game Objects that can be rendered by the given Camera. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. */ - render: function (scene, children, interpolationPercentage, camera) + render: function (scene, children, camera) { if (this.contextLost) { return; } - var list = children.list; - var childCount = list.length; + var childCount = children.length; - this.pipelines.render(scene, camera); + this.emit(Events.RENDER, scene, camera); // Apply scissor for cam region + render background color, if not transparent this.preRenderCamera(camera); @@ -122524,17 +128451,7 @@ var WebGLRenderer = new Class({ { this.finalType = (i === childCount - 1); - var child = list[i]; - - if (!child.willRender(camera)) - { - continue; - } - - if (child.blendMode !== this.currentBlendMode) - { - this.setBlendMode(child.blendMode); - } + var child = children[i]; var mask = child.mask; @@ -122551,6 +128468,11 @@ var WebGLRenderer = new Class({ mask.preRenderWebGL(this, child, camera); } + if (child.blendMode !== this.currentBlendMode) + { + this.setBlendMode(child.blendMode); + } + var type = child.type; if (type !== this.currentType) @@ -122559,9 +128481,16 @@ var WebGLRenderer = new Class({ this.currentType = type; } - this.nextTypeMatch = (i < childCount - 1) ? (list[i + 1].type === this.currentType) : false; + if (!this.finalType) + { + this.nextTypeMatch = (children[i + 1].type === this.currentType); + } + else + { + this.nextTypeMatch = false; + } - child.renderWebGL(this, child, interpolationPercentage, camera); + child.renderWebGL(this, child, camera); this.newType = false; } @@ -122584,6 +128513,7 @@ var WebGLRenderer = new Class({ * The post-render step happens after all Cameras in all Scenes have been rendered. * * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender + * @fires Phaser.Renderer.WebGL.Events#POST_RENDER * @since 3.0.0 */ postRender: function () @@ -122592,7 +128522,7 @@ var WebGLRenderer = new Class({ this.flush(); - // Unbind custom framebuffer here + this.emit(Events.POST_RENDER); var state = this.snapshotState; @@ -122603,8 +128533,6 @@ var WebGLRenderer = new Class({ state.callback = null; } - this.pipelines.postRender(); - if (this.textureFlush > 0) { this.startActiveTexture++; @@ -122655,10 +128583,10 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotArea * @since 3.16.0 * - * @param {integer} x - The x coordinate to grab from. - * @param {integer} y - The y coordinate to grab from. - * @param {integer} width - The width of the area to grab. - * @param {integer} height - The height of the area to grab. + * @param {number} x - The x coordinate to grab from. + * @param {number} y - The y coordinate to grab from. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. @@ -122696,8 +128624,8 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotPixel * @since 3.16.0 * - * @param {integer} x - The x coordinate of the pixel to get. - * @param {integer} y - The y coordinate of the pixel to get. + * @param {number} x - The x coordinate of the pixel to get. + * @param {number} y - The y coordinate of the pixel to get. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. * * @return {this} This WebGL Renderer. @@ -122725,14 +128653,14 @@ var WebGLRenderer = new Class({ * @since 3.19.0 * * @param {WebGLFramebuffer} framebuffer - The framebuffer to grab from. - * @param {integer} bufferWidth - The width of the framebuffer. - * @param {integer} bufferHeight - The height of the framebuffer. + * @param {number} bufferWidth - The width of the framebuffer. + * @param {number} bufferHeight - The height of the framebuffer. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {boolean} [getPixel=false] - Grab a single pixel as a Color object, or an area as an Image object? - * @param {integer} [x=0] - The x coordinate to grab from. - * @param {integer} [y=0] - The y coordinate to grab from. - * @param {integer} [width=bufferWidth] - The width of the area to grab. - * @param {integer} [height=bufferHeight] - The height of the area to grab. + * @param {number} [x=0] - The x coordinate to grab from. + * @param {number} [y=0] - The y coordinate to grab from. + * @param {number} [width=bufferWidth] - The width of the area to grab. + * @param {number} [height=bufferHeight] - The height of the area to grab. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. * @@ -122977,8 +128905,8 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter * @since 3.0.0 * - * @param {integer} texture - The texture to set the filter for. - * @param {integer} filter - The filter to set. 0 for linear filtering, 1 for nearest neighbor (blocky) filtering. + * @param {number} texture - The texture to set the filter for. + * @param {number} filter - The filter to set. 0 for linear filtering, 1 for nearest neighbor (blocky) filtering. * * @return {this} This WebGL Renderer instance. */ @@ -123004,403 +128932,6 @@ var WebGLRenderer = new Class({ return this; }, - /** - * Sets a 1f uniform value on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The 1f value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat1: function (program, name, x) - { - this.setProgram(program); - - this.gl.uniform1f(this.gl.getUniformLocation(program, name), x); - - return this; - }, - - /** - * Sets the 2f uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The 2f x value to set on the named uniform. - * @param {number} y - The 2f y value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat2: function (program, name, x, y) - { - this.setProgram(program); - - this.gl.uniform2f(this.gl.getUniformLocation(program, name), x, y); - - return this; - }, - - /** - * Sets the 3f uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The 3f x value to set on the named uniform. - * @param {number} y - The 3f y value to set on the named uniform. - * @param {number} z - The 3f z value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat3: function (program, name, x, y, z) - { - this.setProgram(program); - - this.gl.uniform3f(this.gl.getUniformLocation(program, name), x, y, z); - - return this; - }, - - /** - * Sets the 4f uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The 4f x value to set on the named uniform. - * @param {number} y - The 4f y value to set on the named uniform. - * @param {number} z - The 4f z value to set on the named uniform. - * @param {number} w - The 4f w value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat4: function (program, name, x, y, z, w) - { - this.setProgram(program); - - this.gl.uniform4f(this.gl.getUniformLocation(program, name), x, y, z, w); - - return this; - }, - - /** - * Sets the value of a 1fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat1v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform1fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a 2fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat2v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform2fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a 3fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat3v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform3fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a 4fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - - setFloat4v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform4fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets a 1iv uniform value on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1iv - * @since 3.50.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Int32List} arr - The 1iv value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt1iv: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform1iv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets a 1i uniform value on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The 1i value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt1: function (program, name, x) - { - this.setProgram(program); - - this.gl.uniform1i(this.gl.getUniformLocation(program, name), x); - - return this; - }, - - /** - * Sets the 2i uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The 2i x value to set on the named uniform. - * @param {integer} y - The 2i y value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt2: function (program, name, x, y) - { - this.setProgram(program); - - this.gl.uniform2i(this.gl.getUniformLocation(program, name), x, y); - - return this; - }, - - /** - * Sets the 3i uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The 3i x value to set on the named uniform. - * @param {integer} y - The 3i y value to set on the named uniform. - * @param {integer} z - The 3i z value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt3: function (program, name, x, y, z) - { - this.setProgram(program); - - this.gl.uniform3i(this.gl.getUniformLocation(program, name), x, y, z); - - return this; - }, - - /** - * Sets the 4i uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt4 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The 4i x value to set on the named uniform. - * @param {integer} y - The 4i y value to set on the named uniform. - * @param {integer} z - The 4i z value to set on the named uniform. - * @param {integer} w - The 4i w value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt4: function (program, name, x, y, z, w) - { - this.setProgram(program); - - this.gl.uniform4i(this.gl.getUniformLocation(program, name), x, y, z, w); - - return this; - }, - - /** - * Sets the value of a matrix 2fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - The value indicating whether to transpose the matrix. Must be false. - * @param {Float32Array} matrix - A Float32Array or sequence of 4 float values. - * - * @return {this} This WebGL Renderer instance. - */ - setMatrix2: function (program, name, transpose, matrix) - { - this.setProgram(program); - - this.gl.uniformMatrix2fv(this.gl.getUniformLocation(program, name), transpose, matrix); - - return this; - }, - - /** - * Sets the value of a matrix 3fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - The value indicating whether to transpose the matrix. Must be false. - * @param {Float32Array} matrix - A Float32Array or sequence of 9 float values. - * - * @return {this} This WebGL Renderer instance. - */ - setMatrix3: function (program, name, transpose, matrix) - { - this.setProgram(program); - - this.gl.uniformMatrix3fv(this.gl.getUniformLocation(program, name), transpose, matrix); - - return this; - }, - - /** - * Sets the value of a matrix 4fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix4 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - The value indicating whether to transpose the matrix. Must be false. - * @param {Float32Array} matrix - A Float32Array or sequence of 16 float values. - * - * @return {this} This WebGL Renderer instance. - */ - setMatrix4: function (program, name, transpose, matrix) - { - this.setProgram(program); - - this.gl.uniformMatrix4fv(this.gl.getUniformLocation(program, name), transpose, matrix); - - return this; - }, - - /** - * Returns the maximum number of texture units that can be used in a fragment shader. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextures - * @since 3.8.0 - * - * @return {integer} The maximum number of textures WebGL supports. - */ - getMaxTextures: function () - { - return this.config.maxTextures; - }, - /** * Returns the largest texture size (either width or height) that can be created. * Note that VRAM may not allow a texture of any given size, it just expresses @@ -123409,7 +128940,7 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextureSize * @since 3.8.0 * - * @return {integer} The maximum supported texture size. + * @return {number} The maximum supported texture size. */ getMaxTextureSize: function () { @@ -123424,46 +128955,34 @@ var WebGLRenderer = new Class({ */ destroy: function () { - // Clear-up anything that should be cleared :) + this.canvas.removeEventListener('webglcontextlost', this.contextLostHandler, false); + this.canvas.removeEventListener('webglcontextrestored', this.contextRestoredHandler, false); - var i; var gl = this.gl; var temp = this.tempTextures; - var native = this.nativeTextures; - for (i = 0; i < temp.length; i++) + for (var i = 0; i < temp.length; i++) { gl.deleteTexture(temp[i]); } - for (i = 0; i < native.length; i++) - { - gl.deleteTexture(native[i]); - } - - this.textureIndexes = []; - this.nativeTextures = []; - this.pipelines.destroy(); - this.defaultCamera.destroy(); + this.removeAllListeners(); + + this.fboStack = []; + this.maskStack = []; + this.extensions = {}; + this.textureIndexes = []; + + this.gl = null; + this.game = null; + this.canvas = null; + this.contextLost = true; this.currentMask = null; this.currentCameraMask = null; - - this.canvas.removeEventListener('webglcontextlost', this.contextLostHandler, false); - this.canvas.removeEventListener('webglcontextrestored', this.contextRestoredHandler, false); - - this.game = null; - this.gl = null; - this.canvas = null; - - this.maskStack = []; - - this.contextLost = true; - - this.extensions = {}; } }); @@ -123472,7 +128991,7 @@ module.exports = WebGLRenderer; /***/ }), -/* 536 */ +/* 572 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -123482,19 +129001,36 @@ module.exports = WebGLRenderer; */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(92); -var CONST = __webpack_require__(110); +var CONST = __webpack_require__(82); +var CustomMap = __webpack_require__(98); // Default Phaser 3 Pipelines -var BitmapMaskPipeline = __webpack_require__(537); -var LightPipeline = __webpack_require__(538); -var MultiPipeline = __webpack_require__(112); -var RopePipeline = __webpack_require__(539); -var SinglePipeline = __webpack_require__(540); +var BitmapMaskPipeline = __webpack_require__(573); +var GraphicsPipeline = __webpack_require__(575); +var LightPipeline = __webpack_require__(576); +var MultiPipeline = __webpack_require__(158); +var RopePipeline = __webpack_require__(577); +var SinglePipeline = __webpack_require__(578); +var UtilityPipeline = __webpack_require__(864); /** * @classdesc + * The Pipeline Manager is responsible for the creation, activation, running and destruction + * of WebGL Pipelines in Phaser 3. * + * The `WebGLRenderer` owns a single instance of the Pipeline Manager, which you can access + * via the `WebGLRenderer.pipelines` property. + * + * By default, there are 5 pipelines installed into the Pipeline Manager when Phaser boots: + * + * 1. The Multi Pipeline. Responsible for all multi-texture rendering, i.e. Sprites, Shapes. + * 2. The Single Pipeline. Responsible for rendering Game Objects that explicitly require one bound texture. + * 3. The Rope Pipeline. Responsible for rendering the Rope Game Object. + * 4. The Light Pipeline. Responsible for rendering the Light Game Object. + * 5. The Bitmap Mask Pipeline. Responsible for Bitmap Mask rendering. + * + * You can add your own custom pipeline via the `PipelineManager.add` method. Pipelines are + * identified by unique string-based keys. * * @class PipelineManager * @memberof Phaser.Renderer.WebGL @@ -123527,12 +129063,31 @@ var PipelineManager = new Class({ */ this.renderer = renderer; + /** + * This map stores all pipeline classes available in this manager. + * + * The Utility Class must always come first. + * + * @name Phaser.Renderer.WebGL.PipelineManager#classes + * @type {Phaser.Structs.Map.} + * @since 3.50.0 + */ + this.classes = new CustomMap([ + [ CONST.UTILITY_PIPELINE, UtilityPipeline ], + [ CONST.MULTI_PIPELINE, MultiPipeline ], + [ CONST.BITMAPMASK_PIPELINE, BitmapMaskPipeline ], + [ CONST.SINGLE_PIPELINE, SinglePipeline ], + [ CONST.ROPE_PIPELINE, RopePipeline ], + [ CONST.LIGHT_PIPELINE, LightPipeline ], + [ CONST.GRAPHICS_PIPELINE, GraphicsPipeline ] + ]); + /** * This map stores all pipeline instances in this manager. * * This is populated with the default pipelines in the `boot` method. * - * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines + * @name Phaser.Renderer.WebGL.PipelineManager#pipelines * @type {Phaser.Structs.Map.} * @since 3.50.0 */ @@ -123585,6 +129140,80 @@ var PipelineManager = new Class({ * @since 3.50.0 */ this.BITMAPMASK_PIPELINE = null; + + /** + * A constant-style reference to the Utility Pipeline Instance. + * + * @name Phaser.Renderer.WebGL.PipelineManager#UTILITY_PIPELINE + * @type {Phaser.Renderer.WebGL.Pipelines.UtilityPipeline} + * @default null + * @since 3.50.0 + */ + this.UTILITY_PIPELINE = null; + + /** + * A reference to the Full Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#fullFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.fullFrame1; + + /** + * A reference to the Full Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#fullFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.fullFrame2; + + /** + * A reference to the Half Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#halfFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.halfFrame1; + + /** + * A reference to the Half Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#halfFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.halfFrame2; }, /** @@ -123597,19 +129226,57 @@ var PipelineManager = new Class({ * * @method Phaser.Renderer.WebGL.PipelineManager#boot * @since 3.50.0 + * + * @param {Phaser.Types.Core.PipelineConfig} [pipelineConfig] - The pipeline configuration object as set in the Game Config. */ - boot: function () + boot: function (pipelineConfig) { + // Install each of the default pipelines + + var instance; + var _this = this; var game = this.game; - this.MULTI_PIPELINE = this.add(CONST.MULTI_PIPELINE, new MultiPipeline({ game: game })); - this.BITMAPMASK_PIPELINE = this.add(CONST.BITMAPMASK_PIPELINE, new BitmapMaskPipeline({ game: game })); + this.classes.each(function (name, pipeline) + { + instance = _this.add(name, new pipeline({ game: game })); - this.add(CONST.SINGLE_PIPELINE, new SinglePipeline({ game: game })); - this.add(CONST.ROPE_PIPELINE, new RopePipeline({ game: game })); - this.add(CONST.LIGHT_PIPELINE, new LightPipeline({ game: game })); + if (name === CONST.UTILITY_PIPELINE) + { + _this.UTILITY_PIPELINE = instance; - this.set(this.MULTI_PIPELINE); + // FBO references + _this.fullFrame1 = instance.fullFrame1; + _this.fullFrame2 = instance.fullFrame2; + _this.halfFrame1 = instance.halfFrame1; + _this.halfFrame2 = instance.halfFrame2; + } + }); + + // Our const-like references + this.MULTI_PIPELINE = this.get(CONST.MULTI_PIPELINE); + this.BITMAPMASK_PIPELINE = this.get(CONST.BITMAPMASK_PIPELINE); + + // And now the ones in the config, if any + if (pipelineConfig) + { + for (var pipelineName in pipelineConfig) + { + var pipelineClass = pipelineConfig[pipelineName]; + + if (!this.has(pipelineName)) + { + this.classes.set(pipelineName, pipelineClass); + + instance = new pipelineClass(game); + + if (!instance.isPostFX) + { + this.add(pipelineName, instance); + } + } + } + } }, /** @@ -123617,13 +129284,23 @@ var PipelineManager = new Class({ * * The name of the instance must be unique within this manager. * - * Make sure to pass an instance to this method, not a base class. For example: + * Make sure to pass an instance to this method, not a base class. + * + * For example, you should pass it like this: * * ```javascript - * this.add('yourName', new MultiPipeline());` + * this.add('yourName', new CustomPipeline());` * ``` * - * @method Phaser.Renderer.WebGL.PipelineManager#addPipeline + * and **not** like this: + * + * ```javascript + * this.add('yourName', CustomPipeline);` + * ``` + * + * To add a **Post Pipeline**, see `addPostPipeline` instead. + * + * @method Phaser.Renderer.WebGL.PipelineManager#add * @since 3.50.0 * * @param {string} name - A unique string-based key for the pipeline within the manager. @@ -123633,11 +129310,21 @@ var PipelineManager = new Class({ */ add: function (name, pipeline) { + if (pipeline.isPostFX) + { + console.warn(name + ' is a Post Pipeline. Use `addPostPipeline` instead'); + + return; + } + var pipelines = this.pipelines; var renderer = this.renderer; if (!pipelines.has(name)) { + pipeline.name = name; + pipeline.manager = this; + pipelines.set(name, pipeline); } else @@ -123645,95 +129332,52 @@ var PipelineManager = new Class({ console.warn('Pipeline exists: ' + name); } - pipeline.name = name; - if (!pipeline.hasBooted) { pipeline.boot(); } - pipeline.resize(renderer.width, renderer.height, renderer.config.resolution); + if (renderer.width !== 0 && renderer.height !== 0) + { + pipeline.resize(renderer.width, renderer.height); + } return pipeline; }, /** - * Resizes handler. + * Adds a Post Pipeline to this Pipeline Manager. * - * This is called automatically by the `WebGLRenderer` when the game resizes. + * Make sure to pass a base class to this method, not an instance. * - * @method Phaser.Renderer.WebGL.PipelineManager#resize + * For example, you should pass it like this: + * + * ```javascript + * this.addPostPipeline('yourName', CustomPipeline);` + * ``` + * + * and **not** like this: + * + * ```javascript + * this.addPostPipeline('yourName', new CustomPipeline());` + * ``` + * + * To add a regular pipeline, see the `add` method instead. + * + * @method Phaser.Renderer.WebGL.PipelineManager#addPostPipeline * @since 3.50.0 * - * @param {number} [width] - The new width of the renderer. - * @param {number} [height] - The new height of the renderer. - * @param {number} [resolution] - The new resolution of the renderer. + * @param {string} name - A unique string-based key for the pipeline within the manager. + * @param {function} pipeline - A pipeline class which must extend `PostFXPipeline`. + * + * @return {this} This Pipeline Manager. */ - resize: function (width, height, resolution) + addPostPipeline: function (name, pipeline) { - var pipelines = this.pipelines; - - pipelines.each(function (pipelineName, pipelineInstance) + if (!this.classes.has(name)) { - pipelineInstance.resize(width, height, resolution); - }); - }, - - /** - * Calls the `onPreRender` method on each pipeline in this manager. - * - * This is called automatically by the `WebGLRenderer.preRender` method. - * - * @method Phaser.Renderer.WebGL.PipelineManager#preRender - * @since 3.50.0 - */ - preRender: function () - { - var pipelines = this.pipelines; - - pipelines.each(function (pipelineName, pipelineInstance) - { - pipelineInstance.onPreRender(); - }); - }, - - /** - * Calls the `onRender` method on each pipeline in this manager. - * - * This is called automatically by the `WebGLRenderer.render` method. - * - * @method Phaser.Renderer.WebGL.PipelineManager#render - * @since 3.50.0 - * - * @param {Phaser.Scene} scene - The Scene to render. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. - */ - render: function (scene, camera) - { - var pipelines = this.pipelines; - - pipelines.each(function (pipelineName, pipelineInstance) - { - pipelineInstance.onRender(scene, camera); - }); - }, - - /** - * Calls the `onPostRender` method on each pipeline in this manager. - * - * This is called automatically by the `WebGLRenderer.postRender` method. - * - * @method Phaser.Renderer.WebGL.PipelineManager#postRender - * @since 3.50.0 - */ - postRender: function () - { - var pipelines = this.pipelines; - - pipelines.each(function (pipelineName, pipelineInstance) - { - pipelineInstance.onPostRender(); - }); + this.classes.set(name, pipeline); + } }, /** @@ -123751,39 +129395,109 @@ var PipelineManager = new Class({ }, /** - * Checks if a pipeline is present in the Pipeline Manager. + * Checks if a pipeline is present in this Pipeline Manager. * * @method Phaser.Renderer.WebGL.PipelineManager#has * @since 3.50.0 * - * @param {string} name - The name of the pipeline to check for. + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance to look-up. * * @return {boolean} `true` if the given pipeline is loaded, otherwise `false`. */ - has: function (name) + has: function (pipeline) { - return this.pipelines.has(name); + var pipelines = this.pipelines; + + if (typeof pipeline === 'string') + { + return pipelines.has(pipeline); + } + else if (pipelines.contains(pipeline)) + { + return true; + } + + return false; }, /** - * Returns the pipeline instance based on the given name. + * Returns the pipeline instance based on the given name, or instance. * - * If no instance exists in this manager, it returns `undefined` instead. + * If no instance, or matching name, exists in this manager, it returns `undefined`. * * @method Phaser.Renderer.WebGL.PipelineManager#get * @since 3.50.0 * - * @param {string} name - The name of the pipeline to get. + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance to look-up. * * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance, or `undefined` if not found. */ - get: function (name) + get: function (pipeline) { - return this.pipelines.get(name); + var pipelines = this.pipelines; + + if (typeof pipeline === 'string') + { + return pipelines.get(pipeline); + } + else if (pipelines.contains(pipeline)) + { + return pipeline; + } }, /** - * Removes a pipeline based on the given name. + * Returns a _new instance_ of the post pipeline based on the given name, or class. + * + * If no instance, or matching name, exists in this manager, it returns `undefined`. + * + * @method Phaser.Renderer.WebGL.PipelineManager#getPostPipeline + * @since 3.50.0 + * + * @param {(string|function|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance, or class to look-up. + * @param {Phaser.GameObjects.GameObject} [gameObject] - If this post pipeline is being installed into a Game Object or Camera, this is a reference to it. + * + * @return {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} The pipeline instance, or `undefined` if not found. + */ + getPostPipeline: function (pipeline, gameObject) + { + var pipelineClasses = this.classes; + + var instance; + + if (typeof pipeline === 'string') + { + instance = pipelineClasses.get(pipeline); + } + else if (typeof pipeline === 'function') + { + // A class + if (pipelineClasses.contains(pipeline)) + { + instance = pipeline; + } + } + else if (typeof pipeline === 'object') + { + // Instance + instance = pipelineClasses.get(pipeline.name); + } + + if (instance) + { + var newPipeline = new instance(this.game); + + if (gameObject) + { + newPipeline.gameObject = gameObject; + } + + return newPipeline; + } + }, + + /** + * Removes a pipeline instance based on the given name. * * If no pipeline matches the name, this method does nothing. * @@ -123794,10 +129508,18 @@ var PipelineManager = new Class({ * @since 3.50.0 * * @param {string} name - The name of the pipeline to be removed. + * @param {boolean} [removeClass=true] - Remove the class as well as the instance? */ - remove: function (name) + remove: function (name, removeClass) { + if (removeClass === undefined) { removeClass = true; } + this.pipelines.delete(name); + + if (removeClass) + { + this.classes.delete(name); + } }, /** @@ -123805,33 +129527,39 @@ var PipelineManager = new Class({ * * This method accepts a pipeline instance as its parameter, not the name. * - * If the pipeline isn't already the current one, it will also call `resetTextures` on - * the `WebGLRenderer`. After this, `WebGLPipeline.bind` and then `onBind` are called. + * If the pipeline isn't already the current one it will call `WebGLPipeline.bind` and then `onBind`. + * + * You cannot set Post FX Pipelines using this method. To use a Post FX Pipeline, you should + * apply it to either a Camera, Container or other supporting Game Object. * * @method Phaser.Renderer.WebGL.PipelineManager#set * @since 3.50.0 * * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline instance to be set as current. * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline that was set. + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline that was set, or undefined if it couldn't be set. */ - set: function (pipeline, gameObject) + set: function (pipeline, gameObject, currentShader) { - var renderer = this.renderer; - var current = this.current; - - if ( - current !== pipeline || - current.vertexBuffer !== renderer.currentVertexBuffer || - current.program !== renderer.currentProgram - ) + if (pipeline.isPostFX) { - renderer.resetTextures(); + return; + } + + if (!this.isCurrent(pipeline, currentShader)) + { + this.flush(); + + if (this.current) + { + this.current.unbind(); + } this.current = pipeline; - pipeline.bind(); + pipeline.bind(currentShader); } pipeline.onBind(gameObject); @@ -123839,6 +129567,307 @@ var PipelineManager = new Class({ return pipeline; }, + /** + * This method is called by the `WebGLPipeline.batchQuad` method, right before a quad + * belonging to a Game Object is about to be added to the batch. It causes a batch + * flush, then calls the `preBatch` method on the post-fx pipelines belonging to the + * Game Object. + * + * @method Phaser.Renderer.WebGL.PipelineManager#preBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object about to be batched. + */ + preBatch: function (gameObject) + { + if (gameObject.hasPostPipeline) + { + this.flush(); + + var pipelines = gameObject.postPipelines; + + // Iterate in reverse because we need them stacked in the order they're in the array + for (var i = pipelines.length - 1; i >= 0; i--) + { + pipelines[i].preBatch(gameObject); + } + } + }, + + /** + * This method is called by the `WebGLPipeline.batchQuad` method, right after a quad + * belonging to a Game Object has been added to the batch. It causes a batch + * flush, then calls the `postBatch` method on the post-fx pipelines belonging to the + * Game Object. + * + * @method Phaser.Renderer.WebGL.PipelineManager#postBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just added to the batch. + */ + postBatch: function (gameObject) + { + if (gameObject.hasPostPipeline) + { + this.flush(); + + var pipelines = gameObject.postPipelines; + + for (var i = 0; i < pipelines.length; i++) + { + pipelines[i].postBatch(gameObject); + } + } + }, + + /** + * Called at the start of the `WebGLRenderer.preRenderCamera` method. + * + * If the Camera has post pipelines set, it will flush the batch and then call the + * `preBatch` method on the post-fx pipelines belonging to the Camera. + * + * @method Phaser.Renderer.WebGL.PipelineManager#preBatchCamera + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera about to be rendered. + */ + preBatchCamera: function (camera) + { + if (camera.hasPostPipeline) + { + this.flush(); + + var pipelines = camera.postPipelines; + + // Iterate in reverse because we need them stacked in the order they're in the array + for (var i = pipelines.length - 1; i >= 0; i--) + { + pipelines[i].preBatch(camera); + } + } + }, + + /** + * Called at the end of the `WebGLRenderer.postRenderCamera` method. + * + * If the Camera has post pipelines set, it will flush the batch and then call the + * `postBatch` method on the post-fx pipelines belonging to the Camera. + * + * @method Phaser.Renderer.WebGL.PipelineManager#postBatchCamera + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that was just rendered. + */ + postBatchCamera: function (camera) + { + if (camera.hasPostPipeline) + { + this.flush(); + + var pipelines = camera.postPipelines; + + for (var i = 0; i < pipelines.length; i++) + { + pipelines[i].postBatch(camera); + } + } + }, + + /** + * Checks to see if the given pipeline is already the active pipeline, both within this + * Pipeline Manager, and also has the same vertex buffer and shader set within the Renderer. + * + * @method Phaser.Renderer.WebGL.PipelineManager#isCurrent + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline instance to be checked. + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * + * @return {boolean} `true` if the given pipeline is already the current pipeline, otherwise `false`. + */ + isCurrent: function (pipeline, currentShader) + { + var renderer = this.renderer; + var current = this.current; + + if (current && !currentShader) + { + currentShader = current.currentShader; + } + + return !( + current !== pipeline || + current.vertexBuffer !== renderer.currentVertexBuffer || + currentShader.program !== renderer.currentProgram + ); + }, + + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * You can optionally set the brightness factor of the copy. + * + * The difference between this method and `drawFrame` is that this method + * uses a faster copy shader, where only the brightness can be modified. + * If you need color level manipulation, see `drawFrame` instead. + * + * The copy itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#copyFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. + */ + copyFrame: function (source, target, brightness, clear, clearAlpha) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.copyShader); + + pipeline.copyFrame(source, target, brightness, clear, clearAlpha); + + return this; + }, + + /** + * Pops the framebuffer from the renderers FBO stack and sets that as the active target, + * then draws the `source` Render Target to it. It then resets the renderer textures. + * + * This should be done when you need to draw the _final_ results of a pipeline to the game + * canvas, or the next framebuffer in line on the FBO stack. You should only call this once + * in the `onDraw` handler and it should be the final thing called. Be careful not to call + * this if you need to actually use the pipeline shader, instead of the copy shader. In + * those cases, use the `bindAndDraw` method. + * + * @method Phaser.Renderer.WebGL.PipelineManager#copyToGame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + */ + copyToGame: function (source) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.copyShader); + + pipeline.copyToGame(source); + + return this; + }, + + /** + * Copy the `source` Render Target to the `target` Render Target, using the + * given Color Matrix. + * + * The difference between this method and `copyFrame` is that this method + * uses a color matrix shader, where you have full control over the luminance + * values used during the copy. If you don't need this, you can use the faster + * `copyFrame` method instead. + * + * The copy itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#drawFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Display.ColorMatrix} [colorMatrix] - The Color Matrix to use when performing the draw. + * + * @return {this} This Pipeline Manager instance. + */ + drawFrame: function (source, target, clearAlpha, colorMatrix) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.colorMatrixShader); + + pipeline.drawFrame(source, target, clearAlpha, colorMatrix); + + return this; + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using a linear blend effect, which is controlled by the `strength` parameter. + * + * The draw itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#blendFrames + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. + */ + blendFrames: function (source1, source2, target, strength, clearAlpha) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.linearShader); + + pipeline.blendFrames(source1, source2, target, strength, clearAlpha); + + return this; + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using an additive blend effect, which is controlled by the `strength` parameter. + * + * The draw itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#blendFramesAdditive + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. + */ + blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.addShader); + + pipeline.blendFrames(source1, source2, target, strength, clearAlpha); + + return this; + }, + + /** + * Clears the given Render Target. + * + * @method Phaser.Renderer.WebGL.PipelineManager#clearFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + clearFrame: function (target, clearAlpha) + { + this.UTILITY_PIPELINE.clearFrame(target, clearAlpha); + + return this; + }, + + /** + * Returns `true` if the current pipeline is forced to use texture unit zero. + * + * @method Phaser.Renderer.WebGL.PipelineManager#forceZero + * @since 3.50.0 + * + * @return {boolean} `true` if the current pipeline is forced to use texture unit zero. + */ + forceZero: function () + { + return (this.current && this.current.forceZero); + }, + /** * Sets the Multi Pipeline to be the currently bound pipeline. * @@ -123854,6 +129883,21 @@ var PipelineManager = new Class({ return this.set(this.MULTI_PIPELINE); }, + /** + * Sets the Utility Pipeline to be the currently bound pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#setUtility + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * + * @return {Phaser.Renderer.WebGL.Pipelines.UtilityPipeline} The Utility Pipeline instance. + */ + setUtility: function (currentShader) + { + return this.UTILITY_PIPELINE.bind(currentShader); + }, + /** * Use this to reset the gl context to the state that Phaser requires to continue rendering. * @@ -123911,12 +129955,9 @@ var PipelineManager = new Class({ renderer.setBlendMode(0, true); - renderer.resetTextures(); - this.current = pipeline; - pipeline.bind(true); - pipeline.onBind(); + pipeline.rebind(); }, /** @@ -123957,10 +129998,12 @@ var PipelineManager = new Class({ { this.flush(); + this.classes.clear(); this.pipelines.clear(); this.renderer = null; this.game = null; + this.classes = null; this.pipelines = null; this.current = null; this.previous = null; @@ -123972,7 +130015,7 @@ module.exports = PipelineManager; /***/ }), -/* 537 */ +/* 573 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -123984,9 +130027,10 @@ module.exports = PipelineManager; var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var ShaderSourceFS = __webpack_require__(807); -var ShaderSourceVS = __webpack_require__(808); -var WebGLPipeline = __webpack_require__(111); +var ShaderSourceFS = __webpack_require__(853); +var ShaderSourceVS = __webpack_require__(854); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); /** * @classdesc @@ -124027,50 +130071,38 @@ var BitmapMaskPipeline = new Class({ { config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS), config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS), - config.vertexSize = GetFastValue(config, 'vertexSize', 8), - config.vertexCapacity = GetFastValue(config, 'vertexCapacity', 3), + config.batchSize = GetFastValue(config, 'batchSize', 1), config.vertices = GetFastValue(config, 'vertices', new Float32Array([ -1, 1, -1, -7, 7, 1 ]).buffer), config.attributes = GetFastValue(config, 'attributes', [ { name: 'inPosition', size: 2, - type: config.game.renderer.gl.FLOAT, - normalized: false, - offset: 0, - enabled: false, - location: -1 + type: WEBGL_CONST.FLOAT } ]); + config.uniforms = GetFastValue(config, 'uniforms', [ + 'uResolution', + 'uMainSampler', + 'uMaskSampler', + 'uInvertMaskAlpha' + ]); WebGLPipeline.call(this, config); }, - /** - * Called every time the pipeline is bound by the renderer. - * Sets the shader program, vertex buffer and other resources. - * Should only be called when changing pipeline. - * - * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#bind - * @since 3.50.0 - * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? - * - * @return {this} This WebGLPipeline instance. - */ - bind: function (reset) + boot: function () { - if (reset === undefined) { reset = false; } + WebGLPipeline.prototype.boot.call(this); - WebGLPipeline.prototype.bind.call(this, reset); + this.set1i('uMainSampler', 0); + this.set1i('uMaskSampler', 1); + }, - var renderer = this.renderer; - var program = this.program; + resize: function (width, height) + { + WebGLPipeline.prototype.resize.call(this, width, height); - renderer.setFloat2(program, 'uResolution', this.width, this.height); - renderer.setInt1(program, 'uMainSampler', 0); - renderer.setInt1(program, 'uMaskSampler', 1); - - return this; + this.set2f('uResolution', width, height); }, /** @@ -124086,24 +130118,19 @@ var BitmapMaskPipeline = new Class({ */ beginMask: function (mask, maskedObject, camera) { - var renderer = this.renderer; var gl = this.gl; // The renderable Game Object that is being used for the bitmap mask - var bitmapMask = mask.bitmapMask; - - if (bitmapMask && gl) + if (mask.bitmapMask && gl) { + var renderer = this.renderer; + renderer.flush(); - mask.prevFramebuffer = renderer.currentFramebuffer; - - renderer.setFramebuffer(mask.mainFramebuffer); + renderer.pushFramebuffer(mask.mainFramebuffer); gl.disable(gl.STENCIL_TEST); - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); if (renderer.currentCameraMask.mask !== mask) @@ -124135,21 +130162,25 @@ var BitmapMaskPipeline = new Class({ if (bitmapMask && gl) { + // mask.mainFramebuffer should now contain all the Game Objects we want masked renderer.flush(); - // First we draw the mask to the mask fb - renderer.setFramebuffer(mask.maskFramebuffer); + // Swap to the mask framebuffer (push, in case the bitmapMask GO has a post-pipeline) + renderer.pushFramebuffer(mask.maskFramebuffer); + // Clear it and draw the Game Object that is acting as a mask to it gl.clearColor(0, 0, 0, 0); gl.clear(gl.COLOR_BUFFER_BIT); renderer.setBlendMode(0, true); - bitmapMask.renderWebGL(renderer, bitmapMask, 0, camera); + bitmapMask.renderWebGL(renderer, bitmapMask, camera); renderer.flush(); - renderer.setFramebuffer(mask.prevFramebuffer); + // Clear the mask framebuffer + main framebuffer + renderer.popFramebuffer(); + renderer.popFramebuffer(); // Is there a stencil further up the stack? var prev = renderer.getCurrentStencilMask(); @@ -124165,7 +130196,7 @@ var BitmapMaskPipeline = new Class({ renderer.currentMask.mask = null; } - // Bind bitmap mask pipeline and draw + // Bind this pipeline and draw renderer.pipelines.set(this); gl.activeTexture(gl.TEXTURE1); @@ -124174,10 +130205,12 @@ var BitmapMaskPipeline = new Class({ gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, mask.mainTexture); - gl.uniform1i(gl.getUniformLocation(this.program, 'uInvertMaskAlpha'), mask.invertAlpha); + this.set1i('uInvertMaskAlpha', mask.invertAlpha); // Finally, draw a triangle filling the whole screen gl.drawArrays(this.topology, 0, 3); + + renderer.resetTextures(); } } @@ -124187,7 +130220,1720 @@ module.exports = BitmapMaskPipeline; /***/ }), -/* 538 */ +/* 574 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var GetFastValue = __webpack_require__(2); +var WEBGL_CONST = __webpack_require__(74); + +/** + * @classdesc + * TODO + * + * @class WebGLShader + * @memberof Phaser.Renderer.WebGL + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGLPipeline to which this Shader belongs. + * @param {string} name - The name of this Shader. + * @param {string} vertexShader - The vertex shader source code as a single string. + * @param {string} fragmentShader - The fragment shader source code as a single string. + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributesConfig[]} attributes - An array of attributes. + * @param {string[]} [uniforms] - An array of shader uniform names that will be looked-up to get the locations for. + */ +var WebGLShader = new Class({ + + initialize: + + function WebGLShader (pipeline, name, vertexShader, fragmentShader, attributes, uniforms) + { + /** + * A reference to the WebGLPipeline that owns this Shader. + * + * A Shader class can only belong to a single pipeline. + * + * @name Phaser.Renderer.WebGL.WebGLShader#pipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @since 3.50.0 + */ + this.pipeline = pipeline; + + /** + * The name of this shader. + * + * @name Phaser.Renderer.WebGL.WebGLShader#name + * @type {string} + * @since 3.50.0 + */ + this.name = name; + + /** + * A reference to the WebGLRenderer instance. + * + * @name Phaser.Renderer.WebGL.WebGLShader#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.50.0 + */ + this.renderer = pipeline.renderer; + + /** + * A reference to the WebGL Rendering Context the WebGL Renderer is using. + * + * @name Phaser.Renderer.WebGL.WebGLShader#gl + * @type {WebGLRenderingContext} + * @since 3.50.0 + */ + this.gl = this.renderer.gl; + + /** + * The WebGLProgram created from the vertex and fragment shaders. + * + * @name Phaser.Renderer.WebGL.WebGLShader#program + * @type {WebGLProgram} + * @since 3.50.0 + */ + this.program = this.renderer.createProgram(vertexShader, fragmentShader); + + /** + * Array of objects that describe the vertex attributes. + * + * @name Phaser.Renderer.WebGL.WebGLShader#attributes + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineAttribute[]} + * @since 3.50.0 + */ + this.attributes; + + /** + * The amount of vertex attribute components of 32 bit length. + * + * @name Phaser.Renderer.WebGL.WebGLShader#vertexComponentCount + * @type {number} + * @since 3.50.0 + */ + this.vertexComponentCount = 0; + + /** + * The size, in bytes, of a single vertex. + * + * This is derived by adding together all of the vertex attributes. + * + * For example, the Multi Pipeline has the following attributes: + * + * inPosition - (size 2 x gl.FLOAT) = 8 + * inTexCoord - (size 2 x gl.FLOAT) = 8 + * inTexId - (size 1 x gl.FLOAT) = 4 + * inTintEffect - (size 1 x gl.FLOAT) = 4 + * inTint - (size 4 x gl.UNSIGNED_BYTE) = 4 + * + * The total, in this case, is 8 + 8 + 4 + 4 + 4 = 28. + * + * This is calculated automatically during the `createAttributes` method. + * + * @name Phaser.Renderer.WebGL.WebGLShader#vertexSize + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.vertexSize = 0; + + /** + * The uniforms that this shader requires, as set via the configuration object. + * + * This is an object that maps the uniform names to their WebGL location. + * + * It is populated with their locations via the `setUniformLocations` method. + * + * @name Phaser.Renderer.WebGL.WebGLShader#uniforms + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineUniformsConfig} + * @since 3.50.0 + */ + this.uniforms = {}; + + this.createAttributes(attributes); + + if (uniforms) + { + this.setUniformLocations(uniforms); + } + }, + + /** + * Takes the vertex attributes config and parses it, creating the resulting array that is stored + * in this shaders `attributes` property, calculating the offset, normalization and location + * in the process. + * + * Calling this method resets `WebGLShader.attributes`, `WebGLShader.vertexSize` and + * `WebGLShader.vertexComponentCount`. + * + * It is called automatically when this class is created, but can be called manually if required. + * + * @method Phaser.Renderer.WebGL.WebGLShader#createAttributes + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributesConfig[]} attributes - An array of attributes configs. + */ + createAttributes: function (attributes) + { + var count = 0; + var offset = 0; + var result = []; + + this.vertexComponentCount = 0; + + for (var i = 0; i < attributes.length; i++) + { + var element = attributes[i]; + + var name = element.name; + var size = element.size; // i.e. 1 for a float, 2 for a vec2, 4 for a vec4, etc + var glType = GetFastValue(element, 'type', WEBGL_CONST.FLOAT); + var type = glType.enum; // The GLenum + var typeSize = glType.size; // The size in bytes of the type + + var normalized = (element.normalized) ? true : false; + + result.push({ + name: name, + size: size, + type: type, + normalized: normalized, + offset: offset, + enabled: false, + location: -1 + }); + + if (typeSize === 4) + { + count += size; + } + else + { + count++; + } + + offset += size * typeSize; + } + + this.vertexSize = offset; + this.vertexComponentCount = count; + this.attributes = result; + }, + + /** + * Sets the program this shader uses as being the active shader in the WebGL Renderer. + * + * This method is called every time the parent pipeline is made the current active pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLShader#bind + * @since 3.50.0 + * + * @param {boolean} [setAttributes=false] - Should the vertex attribute pointers be set? + * @param {boolean} [flush=false] - Flush the pipeline before binding this shader? + * + * @return {this} This WebGLShader instance. + */ + bind: function (setAttributes, flush) + { + if (setAttributes === undefined) { setAttributes = false; } + if (flush === undefined) { flush = false; } + + if (flush) + { + this.pipeline.flush(); + } + + this.renderer.setProgram(this.program); + + if (setAttributes) + { + this.setAttribPointers(); + } + + return this; + }, + + /** + * Sets the program this shader uses as being the active shader in the WebGL Renderer. + * + * Then resets all of the attribute pointers. + * + * @method Phaser.Renderer.WebGL.WebGLShader#rebind + * @since 3.50.0 + * + * @return {this} This WebGLShader instance. + */ + rebind: function () + { + this.renderer.setProgram(this.program); + + this.setAttribPointers(true); + + return this; + }, + + /** + * Sets the vertex attribute pointers. + * + * This should only be called after the vertex buffer has been bound. + * + * It is called automatically during the `bind` method. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setAttribPointers + * @since 3.50.0 + * + * @param {boolean} [reset=false] - Reset the vertex attribute locations? + * + * @return {this} This WebGLShader instance. + */ + setAttribPointers: function (reset) + { + if (reset === undefined) { reset = false; } + + var gl = this.gl; + var vertexSize = this.vertexSize; + var attributes = this.attributes; + var program = this.program; + + for (var i = 0; i < attributes.length; i++) + { + var element = attributes[i]; + + var size = element.size; + var type = element.type; + var offset = element.offset; + var enabled = element.enabled; + var location = element.location; + var normalized = (element.normalized) ? true : false; + + if (reset) + { + var attribLocation = gl.getAttribLocation(program, element.name); + + if (attribLocation >= 0) + { + gl.enableVertexAttribArray(attribLocation); + + gl.vertexAttribPointer(attribLocation, size, type, normalized, vertexSize, offset); + + element.enabled = true; + element.location = attribLocation; + } + else if (attribLocation !== -1) + { + gl.disableVertexAttribArray(attribLocation); + } + } + else if (enabled) + { + gl.vertexAttribPointer(location, size, type, normalized, vertexSize, offset); + } + else if (!enabled && location > -1) + { + gl.disableVertexAttribArray(location); + + element.location = -1; + } + } + + return this; + }, + + /** + * Sets up the `WebGLShader.uniforms` object, populating it with the names + * and locations of the shader uniforms this shader requires. + * + * This method is called automatically when this class is created. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniformLocations + * @since 3.50.0 + * + * @param {string[]} uniformNames - An array of the uniform names to get the locations for. + * + * @return {this} This WebGLShader instance. + */ + setUniformLocations: function (uniformNames) + { + var gl = this.gl; + var program = this.program; + var uniforms = this.uniforms; + + for (var i = 0; i < uniformNames.length; i++) + { + var name = uniformNames[i]; + + var location = gl.getUniformLocation(program, name); + + if (location !== null) + { + uniforms[name] = + { + name: name, + location: location, + value1: null, + value2: null, + value3: null, + value4: null + }; + } + } + + return this; + }, + + /** + * Checks to see if the given uniform name exists and is active in this shader. + * + * @method Phaser.Renderer.WebGL.WebGLShader#hasUniform + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to check for. + * + * @return {boolean} `true` if the uniform exists, otherwise `false`. + */ + hasUniform: function (name) + { + return this.uniforms.hasOwnProperty(name); + }, + + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform1 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * + * @return {this} This WebGLShader instance. + */ + setUniform1: function (setter, name, value1) + { + var uniform = this.uniforms[name]; + + if (!uniform) + { + return this; + } + + if (uniform.value1 !== value1) + { + uniform.value1 = value1; + + this.renderer.setProgram(this.program); + + setter.call(this.gl, uniform.location, value1); + + this.pipeline.currentShader = this; + } + + return this; + }, + + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform2 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. + * + * @return {this} This WebGLShader instance. + */ + setUniform2: function (setter, name, value1, value2) + { + var uniform = this.uniforms[name]; + + if (!uniform) + { + return this; + } + + if (uniform.value1 !== value1 || uniform.value2 !== value2) + { + uniform.value1 = value1; + uniform.value2 = value2; + + this.renderer.setProgram(this.program); + + setter.call(this.gl, uniform.location, value1, value2); + + this.pipeline.currentShader = this; + } + + return this; + }, + + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform3 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value3 - The new value of the uniform. + * + * @return {this} This WebGLShader instance. + */ + setUniform3: function (setter, name, value1, value2, value3) + { + var uniform = this.uniforms[name]; + + if (!uniform) + { + return this; + } + + if (uniform.value1 !== value1 || uniform.value2 !== value2 || uniform.value3 !== value3) + { + uniform.value1 = value1; + uniform.value2 = value2; + uniform.value3 = value3; + + this.renderer.setProgram(this.program); + + setter.call(this.gl, uniform.location, value1, value2, value3); + + this.pipeline.currentShader = this; + } + + return this; + }, + + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform4 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value3 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value4 - The new value of the uniform. + * + * @return {this} This WebGLShader instance. + */ + setUniform4: function (setter, name, value1, value2, value3, value4) + { + var uniform = this.uniforms[name]; + + if (!uniform) + { + return this; + } + + if (uniform.value1 !== value1 || uniform.value2 !== value2 || uniform.value3 !== value3 || uniform.value4 !== value4) + { + uniform.value1 = value1; + uniform.value2 = value2; + uniform.value3 = value3; + uniform.value4 = value4; + + this.renderer.setProgram(this.program); + + setter.call(this.gl, uniform.location, value1, value2, value3, value4); + + this.pipeline.currentShader = this; + } + + return this; + }, + + /** + * Sets a 1f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `float` uniform. + * + * @return {this} This WebGLShader instance. + */ + set1f: function (name, x) + { + return this.setUniform1(this.gl.uniform1f, name, x); + }, + + /** + * Sets a 2f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec2` uniform. + * @param {number} y - The new Y component of the `vec2` uniform. + * + * @return {this} This WebGLShader instance. + */ + set2f: function (name, x, y) + { + return this.setUniform2(this.gl.uniform2f, name, x, y); + }, + + /** + * Sets a 3f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec3` uniform. + * @param {number} y - The new Y component of the `vec3` uniform. + * @param {number} z - The new Z component of the `vec3` uniform. + * + * @return {this} This WebGLShader instance. + */ + set3f: function (name, x, y, z) + { + return this.setUniform3(this.gl.uniform3f, name, x, y, z); + }, + + /** + * Sets a 4f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform + * @param {number} y - Y component of the uniform + * @param {number} z - Z component of the uniform + * @param {number} w - W component of the uniform + * + * @return {this} This WebGLShader instance. + */ + set4f: function (name, x, y, z, w) + { + return this.setUniform4(this.gl.uniform4f, name, x, y, z, w); + }, + + /** + * Sets a 1fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set1fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform1fv, name, arr); + }, + + /** + * Sets a 2fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set2fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform2fv, name, arr); + }, + + /** + * Sets a 3fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set3fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform3fv, name, arr); + }, + + /** + * Sets a 4fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set4fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform4fv, name, arr); + }, + + /** + * Sets a 1iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set1iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform1iv, name, arr); + }, + + /** + * Sets a 2iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set2iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform2iv, name, arr); + }, + + /** + * Sets a 3iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set3iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform3iv, name, arr); + }, + + /** + * Sets a 4iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set4iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform4iv, name, arr); + }, + + /** + * Sets a 1i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `int` uniform. + * + * @return {this} This WebGLShader instance. + */ + set1i: function (name, x) + { + return this.setUniform1(this.gl.uniform1i, name, x); + }, + + /** + * Sets a 2i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec2` uniform. + * @param {number} y - The new Y component of the `ivec2` uniform. + * + * @return {this} This WebGLShader instance. + */ + set2i: function (name, x, y) + { + return this.setUniform2(this.gl.uniform2i, name, x, y); + }, + + /** + * Sets a 3i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec3` uniform. + * @param {number} y - The new Y component of the `ivec3` uniform. + * @param {number} z - The new Z component of the `ivec3` uniform. + * + * @return {this} This WebGLShader instance. + */ + set3i: function (name, x, y, z) + { + return this.setUniform3(this.gl.uniform3i, name, x, y, z); + }, + + /** + * Sets a 4i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform + * @param {number} y - Y component of the uniform + * @param {number} z - Z component of the uniform + * @param {number} w - W component of the uniform + * + * @return {this} This WebGLShader instance. + */ + set4i: function (name, x, y, z, w) + { + return this.setUniform4(this.gl.uniform4i, name, x, y, z, w); + }, + + /** + * Sets a matrix 2fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {number[]|Float32Array} matrix - The new values for the `mat2` uniform. + * + * @return {this} This WebGLShader instance. + */ + setMatrix2fv: function (name, transpose, matrix) + { + return this.setUniform2(this.gl.uniformMatrix2fv, name, transpose, matrix); + }, + + /** + * Sets a matrix 3fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat3` uniform. + * + * @return {this} This WebGLShader instance. + */ + setMatrix3fv: function (name, transpose, matrix) + { + return this.setUniform2(this.gl.uniformMatrix3fv, name, transpose, matrix); + }, + + /** + * Sets a matrix 4fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Should the matrix be transpose + * @param {Float32Array} matrix - Matrix data + * + * @return {this} This WebGLShader instance. + */ + setMatrix4fv: function (name, transpose, matrix) + { + return this.setUniform2(this.gl.uniformMatrix4fv, name, transpose, matrix); + }, + + /** + * Removes all external references from this class and deletes the WebGL program from the WebGL context. + * + * Does not remove this shader from the parent pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLShader#destroy + * @since 3.50.0 + */ + destroy: function () + { + this.gl.deleteProgram(this.program); + + this.pipeline = null; + this.renderer = null; + this.gl = null; + this.program = null; + this.attributes = null; + this.uniforms = null; + } + +}); + +module.exports = WebGLShader; + + +/***/ }), +/* 575 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Earcut = __webpack_require__(65); +var GetFastValue = __webpack_require__(2); +var ShaderSourceFS = __webpack_require__(855); +var ShaderSourceVS = __webpack_require__(856); +var TransformMatrix = __webpack_require__(24); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); + +/** + * @classdesc + * The Graphics Pipeline is the rendering pipeline used by Phaser in WebGL when drawing + * primitive geometry objects, such as the Graphics Game Object, or the Shape Game Objects + * such as Arc, Line, Rectangle and Star. It handles the preperation and batching of related vertices. + * + * Prior to Phaser v3.50 the functions of this pipeline were merged with the `TextureTintPipeline`. + * + * The fragment shader it uses can be found in `shaders/src/Graphics.frag`. + * The vertex shader it uses can be found in `shaders/src/Graphics.vert`. + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2) + * `inColor` (vec4, normalized) + * + * The default shader uniforms for this pipeline are: + * + * `uProjectionMatrix` (mat4) + * + * @class GraphicsPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + */ +var GraphicsPipeline = new Class({ + + Extends: WebGLPipeline, + + initialize: + + function GraphicsPipeline (config) + { + config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS); + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inColor', + size: 4, + type: WEBGL_CONST.UNSIGNED_BYTE, + normalized: true + } + ]); + config.uniforms = GetFastValue(config, 'uniforms', [ + 'uProjectionMatrix' + ]); + + WebGLPipeline.call(this, config); + + /** + * A temporary Transform Matrix, re-used internally during batching by the + * Shape Game Objects. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#calcMatrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.50.0 + */ + this.calcMatrix = new TransformMatrix(); + + /** + * Used internally to draw stroked triangles. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#tempTriangle + * @type {array} + * @private + * @since 3.50.0 + */ + this.tempTriangle = [ + { x: 0, y: 0, width: 0 }, + { x: 0, y: 0, width: 0 }, + { x: 0, y: 0, width: 0 }, + { x: 0, y: 0, width: 0 } + ]; + + /** + * Cached stroke tint. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#strokeTint + * @type {object} + * @private + * @since 3.50.0 + */ + this.strokeTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; + + /** + * Cached fill tint. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#fillTint + * @type {object} + * @private + * @since 3.50.0 + */ + this.fillTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; + + /** + * Internal texture frame reference. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#currentFrame + * @type {Phaser.Textures.Frame} + * @private + * @since 3.50.0 + */ + this.currentFrame = { u0: 0, v0: 0, u1: 1, v1: 1 }; + + /** + * Internal path quad cache. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#firstQuad + * @type {number[]} + * @private + * @since 3.50.0 + */ + this.firstQuad = [ 0, 0, 0, 0, 0 ]; + + /** + * Internal path quad cache. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#prevQuad + * @type {number[]} + * @private + * @since 3.50.0 + */ + this.prevQuad = [ 0, 0, 0, 0, 0 ]; + + /** + * Used internally for triangulating a polygon. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#polygonCache + * @type {array} + * @private + * @since 3.50.0 + */ + this.polygonCache = []; + }, + + /** + * Pushes a filled rectangle into the vertex batch. + * + * Rectangle factors in the given transform matrices before adding to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchFillRect + * @since 3.50.0 + * + * @param {number} x - Horizontal top left coordinate of the rectangle. + * @param {number} y - Vertical top left coordinate of the rectangle. + * @param {number} width - Width of the rectangle. + * @param {number} height - Height of the rectangle. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchFillRect: function (x, y, width, height, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + var calcMatrix = this.calcMatrix; + + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } + + var xw = x + width; + var yh = y + height; + + var x0 = calcMatrix.getX(x, y); + var y0 = calcMatrix.getY(x, y); + + var x1 = calcMatrix.getX(x, yh); + var y1 = calcMatrix.getY(x, yh); + + var x2 = calcMatrix.getX(xw, yh); + var y2 = calcMatrix.getY(xw, yh); + + var x3 = calcMatrix.getX(xw, y); + var y3 = calcMatrix.getY(xw, y); + + var tint = this.fillTint; + + this.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint.TL, tint.TR, tint.BL, tint.BR); + }, + + /** + * Pushes a filled triangle into the vertex batch. + * + * Triangle factors in the given transform matrices before adding to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchFillTriangle + * @since 3.50.0 + * + * @param {number} x0 - Point 0 x coordinate. + * @param {number} y0 - Point 0 y coordinate. + * @param {number} x1 - Point 1 x coordinate. + * @param {number} y1 - Point 1 y coordinate. + * @param {number} x2 - Point 2 x coordinate. + * @param {number} y2 - Point 2 y coordinate. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchFillTriangle: function (x0, y0, x1, y1, x2, y2, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + var calcMatrix = this.calcMatrix; + + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } + + var tx0 = calcMatrix.getX(x0, y0); + var ty0 = calcMatrix.getY(x0, y0); + + var tx1 = calcMatrix.getX(x1, y1); + var ty1 = calcMatrix.getY(x1, y1); + + var tx2 = calcMatrix.getX(x2, y2); + var ty2 = calcMatrix.getY(x2, y2); + + var tint = this.fillTint; + + this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, tint.TL, tint.TR, tint.BL); + }, + + /** + * Pushes a stroked triangle into the vertex batch. + * + * Triangle factors in the given transform matrices before adding to the batch. + * + * The triangle is created from 3 lines and drawn using the `batchStrokePath` method. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchStrokeTriangle + * @since 3.50.0 + * + * @param {number} x0 - Point 0 x coordinate. + * @param {number} y0 - Point 0 y coordinate. + * @param {number} x1 - Point 1 x coordinate. + * @param {number} y1 - Point 1 y coordinate. + * @param {number} x2 - Point 2 x coordinate. + * @param {number} y2 - Point 2 y coordinate. + * @param {number} lineWidth - The width of the line in pixels. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchStrokeTriangle: function (x0, y0, x1, y1, x2, y2, lineWidth, currentMatrix, parentMatrix) + { + var tempTriangle = this.tempTriangle; + + tempTriangle[0].x = x0; + tempTriangle[0].y = y0; + tempTriangle[0].width = lineWidth; + + tempTriangle[1].x = x1; + tempTriangle[1].y = y1; + tempTriangle[1].width = lineWidth; + + tempTriangle[2].x = x2; + tempTriangle[2].y = y2; + tempTriangle[2].width = lineWidth; + + tempTriangle[3].x = x0; + tempTriangle[3].y = y0; + tempTriangle[3].width = lineWidth; + + this.batchStrokePath(tempTriangle, lineWidth, false, currentMatrix, parentMatrix); + }, + + /** + * Adds the given path to the vertex batch for rendering. + * + * It works by taking the array of path data and then passing it through Earcut, which + * creates a list of polygons. Each polygon is then added to the batch. + * + * The path is always automatically closed because it's filled. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchFillPath + * @since 3.50.0 + * + * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchFillPath: function (path, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + var calcMatrix = this.calcMatrix; + + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } + + var length = path.length; + var polygonCache = this.polygonCache; + var polygonIndexArray; + var point; + + var tintTL = this.fillTint.TL; + var tintTR = this.fillTint.TR; + var tintBL = this.fillTint.BL; + + for (var pathIndex = 0; pathIndex < length; ++pathIndex) + { + point = path[pathIndex]; + polygonCache.push(point.x, point.y); + } + + polygonIndexArray = Earcut(polygonCache); + length = polygonIndexArray.length; + + for (var index = 0; index < length; index += 3) + { + var p0 = polygonIndexArray[index + 0] * 2; + var p1 = polygonIndexArray[index + 1] * 2; + var p2 = polygonIndexArray[index + 2] * 2; + + var x0 = polygonCache[p0 + 0]; + var y0 = polygonCache[p0 + 1]; + var x1 = polygonCache[p1 + 0]; + var y1 = polygonCache[p1 + 1]; + var x2 = polygonCache[p2 + 0]; + var y2 = polygonCache[p2 + 1]; + + var tx0 = calcMatrix.getX(x0, y0); + var ty0 = calcMatrix.getY(x0, y0); + + var tx1 = calcMatrix.getX(x1, y1); + var ty1 = calcMatrix.getY(x1, y1); + + var tx2 = calcMatrix.getX(x2, y2); + var ty2 = calcMatrix.getY(x2, y2); + + this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, tintTL, tintTR, tintBL); + } + + polygonCache.length = 0; + }, + + /** + * Adds the given path to the vertex batch for rendering. + * + * It works by taking the array of path data and calling `batchLine` for each section + * of the path. + * + * The path is optionally closed at the end. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchStrokePath + * @since 3.50.0 + * + * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. + * @param {number} lineWidth - The width of the line segments in pixels. + * @param {boolean} pathOpen - Indicates if the path should be closed or left open. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchStrokePath: function (path, lineWidth, pathOpen, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + // Reset the closePath booleans + this.prevQuad[4] = 0; + this.firstQuad[4] = 0; + + var pathLength = path.length - 1; + + for (var pathIndex = 0; pathIndex < pathLength; pathIndex++) + { + var point0 = path[pathIndex]; + var point1 = path[pathIndex + 1]; + + this.batchLine( + point0.x, + point0.y, + point1.x, + point1.y, + point0.width / 2, + point1.width / 2, + lineWidth, + pathIndex, + !pathOpen && (pathIndex === pathLength - 1), + currentMatrix, + parentMatrix + ); + } + }, + + /** + * Creates a line out of 4 quads and adds it to the vertex batch based on the given line values. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchLine + * @since 3.50.0 + * + * @param {number} ax - x coordinate of the start of the line. + * @param {number} ay - y coordinate of the start of the line. + * @param {number} bx - x coordinate of the end of the line. + * @param {number} by - y coordinate of the end of the line. + * @param {number} aLineWidth - Width of the start of the line. + * @param {number} bLineWidth - Width of the end of the line. + * @param {number} index - If this line is part of a multi-line draw, the index of the line in the draw. + * @param {boolean} closePath - Does this line close a multi-line path? + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchLine: function (ax, ay, bx, by, aLineWidth, bLineWidth, lineWidth, index, closePath, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + var calcMatrix = this.calcMatrix; + + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } + + var dx = bx - ax; + var dy = by - ay; + + var len = Math.sqrt(dx * dx + dy * dy); + var al0 = aLineWidth * (by - ay) / len; + var al1 = aLineWidth * (ax - bx) / len; + var bl0 = bLineWidth * (by - ay) / len; + var bl1 = bLineWidth * (ax - bx) / len; + + var lx0 = bx - bl0; + var ly0 = by - bl1; + var lx1 = ax - al0; + var ly1 = ay - al1; + var lx2 = bx + bl0; + var ly2 = by + bl1; + var lx3 = ax + al0; + var ly3 = ay + al1; + + // tx0 = bottom right + var brX = calcMatrix.getX(lx0, ly0); + var brY = calcMatrix.getY(lx0, ly0); + + // tx1 = bottom left + var blX = calcMatrix.getX(lx1, ly1); + var blY = calcMatrix.getY(lx1, ly1); + + // tx2 = top right + var trX = calcMatrix.getX(lx2, ly2); + var trY = calcMatrix.getY(lx2, ly2); + + // tx3 = top left + var tlX = calcMatrix.getX(lx3, ly3); + var tlY = calcMatrix.getY(lx3, ly3); + + var tint = this.strokeTint; + + var tintTL = tint.TL; + var tintTR = tint.TR; + var tintBL = tint.BL; + var tintBR = tint.BR; + + // TL, BL, BR, TR + this.batchQuad(tlX, tlY, blX, blY, brX, brY, trX, trY, tintTL, tintTR, tintBL, tintBR); + + if (lineWidth <= 2) + { + // No point doing a linejoin if the line isn't thick enough + return; + } + + var prev = this.prevQuad; + var first = this.firstQuad; + + if (index > 0 && prev[4]) + { + this.batchQuad(tlX, tlY, blX, blY, prev[0], prev[1], prev[2], prev[3], tintTL, tintTR, tintBL, tintBR); + } + else + { + first[0] = tlX; + first[1] = tlY; + first[2] = blX; + first[3] = blY; + first[4] = 1; + } + + if (closePath && first[4]) + { + // Add a join for the final path segment + this.batchQuad(brX, brY, trX, trY, first[0], first[1], first[2], first[3], tintTL, tintTR, tintBL, tintBR); + } + else + { + // Store it + + prev[0] = brX; + prev[1] = brY; + prev[2] = trX; + prev[3] = trY; + prev[4] = 1; + } + }, + + /** + * Adds a single vertex to the current vertex buffer and increments the + * `vertexCount` property by 1. + * + * This method is called directly by `batchTri` and `batchQuad`. + * + * It does not perform any batch limit checking itself, so if you need to call + * this method directly, do so in the same way that `batchQuad` does, for example. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchVert + * @since 3.50.0 + * + * @param {number} x - The vertex x position. + * @param {number} y - The vertex y position. + * @param {number} tint - The tint color value. + */ + batchVert: function (x, y, tint) + { + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; + + vertexViewF32[++vertexOffset] = x; + vertexViewF32[++vertexOffset] = y; + vertexViewU32[++vertexOffset] = tint; + + this.vertexCount++; + }, + + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 6 vertices in the following arrangement: + * + * ``` + * 0----3 + * |\ B| + * | \ | + * | \ | + * | A \| + * | \ + * 1----2 + * ``` + * + * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchQuad + * @override + * @since 3.50.0 + * + * @param {number} x0 - The top-left x position. + * @param {number} y0 - The top-left y position. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * @param {number} tintBR - The bottom-right tint color value. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, tintTL, tintTR, tintBL, tintBR) + { + var hasFlushed = false; + + if (this.shouldFlush(6)) + { + this.flush(); + + hasFlushed = true; + } + + this.batchVert(x0, y0, tintTL); + this.batchVert(x1, y1, tintBL); + this.batchVert(x2, y2, tintBR); + this.batchVert(x0, y0, tintTL); + this.batchVert(x2, y2, tintBR); + this.batchVert(x3, y3, tintTR); + + return hasFlushed; + }, + + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 3 vertices in the following arrangement: + * + * ``` + * 0 + * |\ + * | \ + * | \ + * | \ + * | \ + * 1-----2 + * ``` + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchTri + * @override + * @since 3.50.0 + * + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchTri: function (x0, y0, x1, y1, x2, y2, tintTL, tintTR, tintBL) + { + var hasFlushed = false; + + if (this.shouldFlush(3)) + { + this.flush(); + + hasFlushed = true; + } + + this.batchVert(x0, y0, tintTL); + this.batchVert(x1, y1, tintTR); + this.batchVert(x2, y2, tintBL); + + return hasFlushed; + }, + + /** + * Destroys all shader instances, removes all object references and nulls all external references. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#destroy + * @since 3.50.0 + * + * @return {this} This WebGLPipeline instance. + */ + destroy: function () + { + WebGLPipeline.prototype.destroy.call(this); + + this.polygonCache = null; + + return this; + } + +}); + +module.exports = GraphicsPipeline; + + +/***/ }), +/* 576 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -124199,9 +131945,12 @@ module.exports = BitmapMaskPipeline; var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var ShaderSourceFS = __webpack_require__(809); -var MultiPipeline = __webpack_require__(112); -var WebGLPipeline = __webpack_require__(111); +var LightShaderSourceFS = __webpack_require__(857); +var PointLightShaderSourceFS = __webpack_require__(858); +var PointLightShaderSourceVS = __webpack_require__(859); +var TransformMatrix = __webpack_require__(24); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); var LIGHT_COUNT = 10; @@ -124255,7 +132004,7 @@ var LIGHT_COUNT = 10; */ var LightPipeline = new Class({ - Extends: MultiPipeline, + Extends: WebGLPipeline, initialize: @@ -124263,11 +132012,73 @@ var LightPipeline = new Class({ { LIGHT_COUNT = config.game.renderer.config.maxLights; - var fragmentShaderSource = GetFastValue(config, 'fragShader', ShaderSourceFS); + config.shaders = GetFastValue(config, 'shaders', [ + { + name: 'PointLight', + fragShader: PointLightShaderSourceFS, + vertShader: PointLightShaderSourceVS, + uniforms: [ + 'uProjectionMatrix', + 'uResolution' + ] + }, + { + name: 'Light', + fragShader: LightShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString()) + } + ]); - config.fragShader = fragmentShaderSource.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString()); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inLightPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inLightRadius', + size: 1, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inLightColor', + size: 4, + type: WEBGL_CONST.FLOAT + } + ]); - MultiPipeline.call(this, config); + WebGLPipeline.call(this, config); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempMatrix1 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this.tempMatrix1 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempMatrix2 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this.tempMatrix2 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempMatrix3 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this.tempMatrix3 = new TransformMatrix(); /** * Inverse rotation matrix for normal map rotations. @@ -124303,6 +132114,9 @@ var LightPipeline = new Class({ this.lightCount = 0; this.forceZero = true; + + this.pointLightShader; + this.lightShader; }, /** @@ -124311,7 +132125,7 @@ var LightPipeline = new Class({ * By this stage all Game level systems are now in place and you can perform any final * tasks that the pipeline may need that relied on game systems such as the Texture Manager. * - * @method Phaser.Renderer.WebGL.LightPipeline#boot + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#boot * @since 3.11.0 */ boot: function () @@ -124330,48 +132144,101 @@ var LightPipeline = new Class({ this.defaultNormalMap = { glTexture: tempTexture }; - return this; + this.pointLightShader = this.shaders[0]; + this.lightShader = this.shaders[1]; }, /** - * Called every time the pipeline is bound by the renderer. - * Sets the shader program, vertex buffer and other resources. - * Should only be called when changing pipeline. + * Adds a single vertex to the current vertex buffer and increments the + * `vertexCount` property by 1. * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#bind + * This method is called directly by `batchTri` and `batchQuad`. + * + * It does not perform any batch limit checking itself, so if you need to call + * this method directly, do so in the same way that `batchQuad` does, for example. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#batchVert * @since 3.50.0 * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? + * @param {number} x - The vertex x position. + * @param {number} y - The vertex y position. + * @param {number} u - UV u value. + * @param {number} v - UV v value. + * @param {number} unit - Texture unit to which the texture needs to be bound. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {number} tint - The tint color value. + */ + batchVert: function (x, y, lightX, lightY, radius, r, g, b, a) + { + var vertexViewF32 = this.vertexViewF32; + + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; + + vertexViewF32[++vertexOffset] = x; + vertexViewF32[++vertexOffset] = y; + vertexViewF32[++vertexOffset] = lightX; + vertexViewF32[++vertexOffset] = lightY; + vertexViewF32[++vertexOffset] = radius; + vertexViewF32[++vertexOffset] = r; + vertexViewF32[++vertexOffset] = g; + vertexViewF32[++vertexOffset] = b; + vertexViewF32[++vertexOffset] = a; + + this.vertexCount++; + }, + + batchLight: function (light, camera, x0, y0, x1, y1, x2, y2, x3, y3, lightX, lightY) + { + var color = light.color; + var intensity = light.intensity; + var radius = light.radius; + + var r = color.r * intensity; + var g = color.g * intensity; + var b = color.b * intensity; + var a = camera.alpha * light.alpha; + + if (this.shouldFlush(6)) + { + this.flush(); + } + + this.batchVert(x0, y0, lightX, lightY, radius, r, g, b, a); + this.batchVert(x1, y1, lightX, lightY, radius, r, g, b, a); + this.batchVert(x2, y2, lightX, lightY, radius, r, g, b, a); + this.batchVert(x0, y0, lightX, lightY, radius, r, g, b, a); + this.batchVert(x2, y2, lightX, lightY, radius, r, g, b, a); + this.batchVert(x3, y3, lightX, lightY, radius, r, g, b, a); + }, + + /** + * Called every time a Game Object needs to use this pipeline. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#onBind + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. * * @return {this} This WebGLPipeline instance. */ - bind: function (reset) + onBind: function () { - if (reset === undefined) { reset = false; } - - WebGLPipeline.prototype.bind.call(this, reset); - - var renderer = this.renderer; - var program = this.program; - - renderer.setInt1(program, 'uMainSampler', 0); - renderer.setInt1(program, 'uNormSampler', 1); - renderer.setFloat2(program, 'uResolution', this.width, this.height); - - return this; + this.set1i('uMainSampler', 0); + this.set1i('uNormSampler', 1); + this.set2f('uResolution', this.width / 2, this.height / 2); }, /** * This function sets all the needed resources for each camera pass. * * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#onRender + * @ignore * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene being rendered. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. * * @return {this} This WebGLPipeline instance. - */ onRender: function (scene, camera) { this.active = false; @@ -124443,6 +132310,7 @@ var LightPipeline = new Class({ return this; }, + */ /** * Rotates the normal map vectors inversely by the given angle. @@ -124490,11 +132358,11 @@ var LightPipeline = new Class({ * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object. * * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setTexture2D + * @ignore * @since 3.50.0 * * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object being rendered or added to the batch. - */ setTexture2D: function (texture, gameObject) { var renderer = this.renderer; @@ -124519,19 +132387,20 @@ var LightPipeline = new Class({ return 0; }, + */ /** * Custom pipelines can use this method in order to perform any required pre-batch tasks * for the given Game Object. It must return the texture unit the Game Object was assigned. * * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setGameObject + * @ignore * @since 3.50.0 * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. * * @return {number} The texture unit the Game Object has been assigned. - */ setGameObject: function (gameObject, frame) { if (frame === undefined) { frame = gameObject.frame; } @@ -124554,6 +132423,7 @@ var LightPipeline = new Class({ return 0; }, + */ /** * Returns the normal map WebGLTexture from the given Game Object. @@ -124610,7 +132480,7 @@ module.exports = LightPipeline; /***/ }), -/* 539 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -124620,8 +132490,8 @@ module.exports = LightPipeline; */ var Class = __webpack_require__(0); -var ModelViewProjection = __webpack_require__(113); -var MultiPipeline = __webpack_require__(112); +var GetFastValue = __webpack_require__(2); +var MultiPipeline = __webpack_require__(158); /** * @classdesc @@ -124664,15 +132534,13 @@ var RopePipeline = new Class({ Extends: MultiPipeline, - Mixins: [ - ModelViewProjection - ], - initialize: function RopePipeline (config) { - config.topology = config.game.renderer.gl.TRIANGLE_STRIP; + // GLenum 5 = TRIANGLE_STRIP + config.topology = 5; + config.batchSize = GetFastValue(config, 'batchSize', 256); MultiPipeline.call(this, config); } @@ -124682,7 +132550,7 @@ module.exports = RopePipeline; /***/ }), -/* 540 */ +/* 578 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -124693,17 +132561,15 @@ module.exports = RopePipeline; var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var ModelViewProjection = __webpack_require__(113); -var MultiPipeline = __webpack_require__(112); -var ShaderSourceFS = __webpack_require__(812); -var ShaderSourceVS = __webpack_require__(813); -var WebGLPipeline = __webpack_require__(111); +var MultiPipeline = __webpack_require__(158); +var ShaderSourceFS = __webpack_require__(862); +var ShaderSourceVS = __webpack_require__(863); +var WebGLPipeline = __webpack_require__(75); /** * @classdesc - * * The Single Pipeline is a special version of the Multi Pipeline that only ever - * uses one single texture, bound to texture unit zero. Although not as efficient as the + * uses one texture, bound to texture unit zero. Although not as efficient as the * Multi Pipeline, it provides an easier way to create custom pipelines that only require * a single bound texture. * @@ -124716,14 +132582,13 @@ var WebGLPipeline = __webpack_require__(111); * * `inPosition` (vec2, offset 0) * `inTexCoord` (vec2, offset 8) - * `inTintEffect` (float, offset 16) - * `inTint` (vec4, offset 20, normalized) + * `inTexId` (float, offset 16) - this value is always zero in the Single Pipeline + * `inTintEffect` (float, offset 20) + * `inTint` (vec4, offset 24, normalized) * * The default shader uniforms for this pipeline are: * * `uProjectionMatrix` (mat4) - * `uViewMatrix` (mat4) - * `uModelMatrix` (mat4) * `uMainSampler` (sampler2D) * * @class SinglePipeline @@ -124738,274 +132603,22 @@ var SinglePipeline = new Class({ Extends: MultiPipeline, - Mixins: [ - ModelViewProjection - ], - initialize: function SinglePipeline (config) { - var gl = config.game.renderer.gl; - config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS), config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS), - config.vertexSize = GetFastValue(config, 'vertexSize', 24), - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0, - enabled: false, - location: -1 - }, - { - name: 'inTexCoord', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 8, - enabled: false, - location: -1 - }, - { - name: 'inTintEffect', - size: 1, - type: gl.FLOAT, - normalized: false, - offset: 16, - enabled: false, - location: -1 - }, - { - name: 'inTint', - size: 4, - type: gl.UNSIGNED_BYTE, - normalized: true, - offset: 20, - enabled: false, - location: -1 - } - ]); + config.forceZero = true; MultiPipeline.call(this, config); - - this.forceZero = true; }, - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 6 vertices in the following arrangement: - * - * ``` - * 0----3 - * |\ B| - * | \ | - * | \ | - * | A \| - * | \ - * 1----2 - * ``` - * - * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 - * - * @method Phaser.Renderer.WebGL.Pipelines.SinglePipeline#batchQuad - * @since 3.50.0 - * - * @param {number} x0 - The top-left x position. - * @param {number} y0 - The top-left y position. - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {number} tintBR - The bottom-right tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {integer} [unit=0] - This parameter isn't used by this pipeline, but is retained for TTP support. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) + boot: function () { - if (unit === undefined) { unit = this.currentUnit; } + WebGLPipeline.prototype.boot.call(this); - var hasFlushed = false; - - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - - hasFlushed = true; - - unit = this.setTexture2D(texture); - } - - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - - var vertexOffset = (this.vertexCount * this.vertexComponentCount) - 1; - - vertexViewF32[++vertexOffset] = x0; - vertexViewF32[++vertexOffset] = y0; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x1; - vertexViewF32[++vertexOffset] = y1; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBR; - - vertexViewF32[++vertexOffset] = x0; - vertexViewF32[++vertexOffset] = y0; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBR; - - vertexViewF32[++vertexOffset] = x3; - vertexViewF32[++vertexOffset] = y3; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTR; - - this.vertexCount += 6; - - return hasFlushed; - }, - - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 3 vertices in the following arrangement: - * - * ``` - * 0 - * |\ - * | \ - * | \ - * | \ - * | \ - * 1-----2 - * ``` - * - * @method Phaser.Renderer.WebGL.Pipelines.SinglePipeline#batchTri - * @since 3.50.0 - * - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {integer} [unit=0] - This parameter isn't used by this pipeline, but is retained for TTP support. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) - { - if (unit === undefined) { unit = this.currentUnit; } - - var hasFlushed = false; - - if (this.vertexCount + 3 > this.vertexCapacity) - { - this.flush(); - - hasFlushed = true; - - unit = this.setTexture2D(texture); - } - - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - - var vertexOffset = (this.vertexCount * this.vertexComponentCount) - 1; - - vertexViewF32[++vertexOffset] = x1; - vertexViewF32[++vertexOffset] = y1; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTR; - - vertexViewF32[++vertexOffset] = x3; - vertexViewF32[++vertexOffset] = y3; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBL; - - this.vertexCount += 3; - - return hasFlushed; - }, - - /** - * Called every time the pipeline is bound by the renderer. - * Sets the shader program, vertex buffer and other resources. - * Should only be called when changing pipeline. - * - * @method Phaser.Renderer.WebGL.Pipelines.SinglePipeline#bind - * @since 3.50.0 - * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? - * - * @return {this} This WebGLPipeline instance. - */ - bind: function (reset) - { - if (reset === undefined) { reset = false; } - - WebGLPipeline.prototype.bind.call(this, reset); - - return this; + this.set1i('uMainSampler', 0); } }); @@ -125014,7 +132627,33 @@ module.exports = SinglePipeline; /***/ }), -/* 541 */ +/* 579 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_QUAD_VS', + '', + 'precision mediump float;', + '', + 'attribute vec2 inPosition;', + 'attribute vec2 inTexCoord;', + '', + 'varying vec2 outFragCoord;', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' outFragCoord = inPosition.xy * 0.5 + 0.5;', + ' outTexCoord = inTexCoord;', + '', + ' gl_Position = vec4(inPosition, 0, 1);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 580 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -125023,13 +132662,13 @@ module.exports = SinglePipeline; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); -var Color = __webpack_require__(32); +var CanvasPool = __webpack_require__(31); +var Color = __webpack_require__(36); var GetFastValue = __webpack_require__(2); /** * Takes a snapshot of an area from the current frame displayed by a WebGL canvas. - * + * * This is then copied to an Image object. When this loads, the results are sent * to the callback provided in the Snapshot Configuration object. * @@ -125076,19 +132715,19 @@ var WebGLSnapshot = function (sourceCanvas, config) var pixels = new Uint8Array(total); gl.readPixels(x, bufferHeight - y - height, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels); - + var canvas = CanvasPool.createWebGL(this, width, height); var ctx = canvas.getContext('2d'); var imageData = ctx.getImageData(0, 0, width, height); - + var data = imageData.data; for (var py = 0; py < height; py++) { for (var px = 0; px < width; px++) { - var sourceIndex = ((height - py) * width + px) * 4; + var sourceIndex = ((height - py - 1) * width + px) * 4; var destIndex = (isFramebuffer) ? total - ((py * width + (width - px)) * 4) : (py * width + px) * 4; data[destIndex + 0] = pixels[sourceIndex + 0]; @@ -125099,7 +132738,7 @@ var WebGLSnapshot = function (sourceCanvas, config) } ctx.putImageData(imageData, 0, 0); - + var image = new Image(); image.onerror = function () @@ -125124,11 +132763,11 @@ module.exports = WebGLSnapshot; /***/ }), -/* 542 */, -/* 543 */, -/* 544 */, -/* 545 */, -/* 546 */ +/* 581 */, +/* 582 */, +/* 583 */, +/* 584 */, +/* 585 */ /***/ (function(module, exports) { var g; @@ -125154,21 +132793,21 @@ module.exports = g; /***/ }), -/* 547 */ +/* 586 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(548); -__webpack_require__(549); -__webpack_require__(550); -__webpack_require__(551); -__webpack_require__(552); -__webpack_require__(553); -__webpack_require__(554); -__webpack_require__(555); +__webpack_require__(587); +__webpack_require__(588); +__webpack_require__(589); +__webpack_require__(590); +__webpack_require__(591); +__webpack_require__(592); +__webpack_require__(593); +__webpack_require__(594); /***/ }), -/* 548 */ +/* 587 */ /***/ (function(module, exports) { /** @@ -125208,7 +132847,7 @@ if (!Array.prototype.forEach) /***/ }), -/* 549 */ +/* 588 */ /***/ (function(module, exports) { /** @@ -125224,7 +132863,7 @@ if (!Array.isArray) /***/ }), -/* 550 */ +/* 589 */ /***/ (function(module, exports) { /* Copyright 2013 Chris Wilson @@ -125411,7 +133050,7 @@ BiquadFilterNode.type and OscillatorNode.type. /***/ }), -/* 551 */ +/* 590 */ /***/ (function(module, exports) { /** @@ -125426,7 +133065,7 @@ if (!window.console) /***/ }), -/* 552 */ +/* 591 */ /***/ (function(module, exports) { // ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc @@ -125438,7 +133077,7 @@ if (!Math.trunc) { /***/ }), -/* 553 */ +/* 592 */ /***/ (function(module, exports) { /** @@ -125475,7 +133114,7 @@ if (!Math.trunc) { /***/ }), -/* 554 */ +/* 593 */ /***/ (function(module, exports) { // References: @@ -125532,7 +133171,7 @@ if (!window.cancelAnimationFrame) /***/ }), -/* 555 */ +/* 594 */ /***/ (function(module, exports) { /** @@ -125585,7 +133224,7 @@ if (typeof window.Uint32Array !== 'function' && typeof window.Uint32Array !== 'o /***/ }), -/* 556 */ +/* 595 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -125594,7 +133233,7 @@ if (typeof window.Uint32Array !== 'function' && typeof window.Uint32Array !== 'o * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var QuickSet = __webpack_require__(253); +var QuickSet = __webpack_require__(268); /** * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, and aligns them next to each other. @@ -125607,7 +133246,7 @@ var QuickSet = __webpack_require__(253); * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {integer} position - The position to align the items with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. + * @param {number} position - The position to align the items with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. * @param {number} [offsetX=0] - Optional horizontal offset from the position. * @param {number} [offsetY=0] - Optional vertical offset from the position. * @@ -125633,7 +133272,7 @@ module.exports = AlignTo; /***/ }), -/* 557 */ +/* 596 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -125642,7 +133281,7 @@ module.exports = AlignTo; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `angle` property, @@ -125660,8 +133299,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `angle` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -125674,7 +133313,7 @@ module.exports = Angle; /***/ }), -/* 558 */ +/* 597 */ /***/ (function(module, exports) { /** @@ -125713,7 +133352,7 @@ module.exports = Call; /***/ }), -/* 559 */ +/* 598 */ /***/ (function(module, exports) { /** @@ -125736,7 +133375,7 @@ module.exports = Call; * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be searched by this action. * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [index=0] - An optional offset to start searching from within the items array. * * @return {?(object|Phaser.GameObjects.GameObject)} The first object in the array that matches the comparison object, or `null` if no match was found. */ @@ -125771,7 +133410,7 @@ module.exports = GetFirst; /***/ }), -/* 560 */ +/* 599 */ /***/ (function(module, exports) { /** @@ -125794,7 +133433,7 @@ module.exports = GetFirst; * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be searched by this action. * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [index=0] - An optional offset to start searching from within the items array. * * @return {?(object|Phaser.GameObjects.GameObject)} The last object in the array that matches the comparison object, or `null` if no match was found. */ @@ -125829,7 +133468,7 @@ module.exports = GetLast; /***/ }), -/* 561 */ +/* 600 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -125838,11 +133477,11 @@ module.exports = GetLast; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AlignIn = __webpack_require__(266); -var CONST = __webpack_require__(108); +var AlignIn = __webpack_require__(281); +var CONST = __webpack_require__(120); var GetFastValue = __webpack_require__(2); var NOOP = __webpack_require__(1); -var Zone = __webpack_require__(117); +var Zone = __webpack_require__(125); var tempZone = new Zone({ sys: { queueDepthSort: NOOP, events: { once: NOOP } } }, 0, 0, 1, 1); @@ -125948,7 +133587,7 @@ module.exports = GridAlign; /***/ }), -/* 562 */ +/* 601 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -125957,7 +133596,7 @@ module.exports = GridAlign; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); // bitmask flag for GameObject.renderMask var _FLAG = 2; // 0010 @@ -126243,7 +133882,7 @@ module.exports = Alpha; /***/ }), -/* 563 */ +/* 602 */ /***/ (function(module, exports) { /** @@ -126392,7 +134031,7 @@ module.exports = ComputedSize; /***/ }), -/* 564 */ +/* 603 */ /***/ (function(module, exports) { /** @@ -126517,7 +134156,7 @@ module.exports = Crop; /***/ }), -/* 565 */ +/* 604 */ /***/ (function(module, exports) { /** @@ -126681,7 +134320,7 @@ module.exports = Flip; /***/ }), -/* 566 */ +/* 605 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -126691,7 +134330,7 @@ module.exports = Flip; */ var Rectangle = __webpack_require__(9); -var RotateAround = __webpack_require__(285); +var RotateAround = __webpack_require__(300); var Vector2 = __webpack_require__(3); /** @@ -127040,7 +134679,7 @@ module.exports = GetBounds; /***/ }), -/* 567 */ +/* 606 */ /***/ (function(module, exports) { /** @@ -127063,7 +134702,7 @@ module.exports = 'blur'; /***/ }), -/* 568 */ +/* 607 */ /***/ (function(module, exports) { /** @@ -127085,7 +134724,7 @@ module.exports = 'boot'; /***/ }), -/* 569 */ +/* 608 */ /***/ (function(module, exports) { /** @@ -127108,7 +134747,7 @@ module.exports = 'contextlost'; /***/ }), -/* 570 */ +/* 609 */ /***/ (function(module, exports) { /** @@ -127131,7 +134770,7 @@ module.exports = 'contextrestored'; /***/ }), -/* 571 */ +/* 610 */ /***/ (function(module, exports) { /** @@ -127154,7 +134793,7 @@ module.exports = 'destroy'; /***/ }), -/* 572 */ +/* 611 */ /***/ (function(module, exports) { /** @@ -127176,7 +134815,7 @@ module.exports = 'focus'; /***/ }), -/* 573 */ +/* 612 */ /***/ (function(module, exports) { /** @@ -127202,7 +134841,7 @@ module.exports = 'hidden'; /***/ }), -/* 574 */ +/* 613 */ /***/ (function(module, exports) { /** @@ -127223,7 +134862,7 @@ module.exports = 'pause'; /***/ }), -/* 575 */ +/* 614 */ /***/ (function(module, exports) { /** @@ -127249,7 +134888,7 @@ module.exports = 'postrender'; /***/ }), -/* 576 */ +/* 615 */ /***/ (function(module, exports) { /** @@ -127274,7 +134913,7 @@ module.exports = 'poststep'; /***/ }), -/* 577 */ +/* 616 */ /***/ (function(module, exports) { /** @@ -127299,7 +134938,7 @@ module.exports = 'prerender'; /***/ }), -/* 578 */ +/* 617 */ /***/ (function(module, exports) { /** @@ -127324,7 +134963,7 @@ module.exports = 'prestep'; /***/ }), -/* 579 */ +/* 618 */ /***/ (function(module, exports) { /** @@ -127346,7 +134985,7 @@ module.exports = 'ready'; /***/ }), -/* 580 */ +/* 619 */ /***/ (function(module, exports) { /** @@ -127367,7 +135006,7 @@ module.exports = 'resume'; /***/ }), -/* 581 */ +/* 620 */ /***/ (function(module, exports) { /** @@ -127392,7 +135031,7 @@ module.exports = 'step'; /***/ }), -/* 582 */ +/* 621 */ /***/ (function(module, exports) { /** @@ -127416,7 +135055,7 @@ module.exports = 'visible'; /***/ }), -/* 583 */ +/* 622 */ /***/ (function(module, exports) { /** @@ -127619,7 +135258,7 @@ module.exports = Origin; /***/ }), -/* 584 */ +/* 623 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -127628,10 +135267,10 @@ module.exports = Origin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DegToRad = __webpack_require__(41); -var GetBoolean = __webpack_require__(90); +var DegToRad = __webpack_require__(34); +var GetBoolean = __webpack_require__(95); var GetValue = __webpack_require__(6); -var TWEEN_CONST = __webpack_require__(91); +var TWEEN_CONST = __webpack_require__(96); var Vector2 = __webpack_require__(3); /** @@ -127726,7 +135365,7 @@ var PathFollower = { * Records the direction of the follower so it can change direction. * * @name Phaser.GameObjects.PathFollower#_prevDirection - * @type {integer} + * @type {number} * @private * @since 3.0.0 */ @@ -128046,7 +135685,7 @@ module.exports = PathFollower; /***/ }), -/* 585 */ +/* 624 */ /***/ (function(module, exports) { /** @@ -128233,7 +135872,7 @@ module.exports = Size; /***/ }), -/* 586 */ +/* 625 */ /***/ (function(module, exports) { /** @@ -128291,7 +135930,7 @@ var Texture = { * @since 3.0.0 * * @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Game Object instance. */ @@ -128315,7 +135954,7 @@ var Texture = { * @method Phaser.GameObjects.Components.Texture#setFrame * @since 3.0.0 * - * @param {(string|integer)} frame - The name or index of the frame within the Texture. + * @param {(string|number)} frame - The name or index of the frame within the Texture. * @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object? * @param {boolean} [updateOrigin=true] - Should this call adjust the origin of the Game Object? * @@ -128363,7 +136002,7 @@ module.exports = Texture; /***/ }), -/* 587 */ +/* 626 */ /***/ (function(module, exports) { /** @@ -128415,24 +136054,24 @@ var TextureCrop = { /** * Applies a crop to a texture based Game Object, such as a Sprite or Image. - * + * * The crop is a rectangle that limits the area of the texture frame that is visible during rendering. - * + * * Cropping a Game Object does not change its size, dimensions, physics body or hit area, it just * changes what is shown when rendered. - * + * * The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left. - * + * * Therefore, if you had a Game Object that had an 800x600 sized texture, and you wanted to show only the left * half of it, you could call `setCrop(0, 0, 400, 600)`. - * + * * It is also scaled to match the Game Object scale automatically. Therefore a crop rect of 100x50 would crop * an area of 200x100 when applied to a Game Object that had a scale factor of 2. - * + * * You can either pass in numeric values directly, or you can provide a single Rectangle object as the first argument. - * + * * Call this method with no arguments at all to reset the crop, or toggle the property `isCropped` to `false`. - * + * * You should do this if the crop rectangle becomes the same size as the frame itself, as it will allow * the renderer to skip several internal calculations. * @@ -128480,7 +136119,7 @@ var TextureCrop = { * @since 3.0.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Game Object instance. */ @@ -128504,7 +136143,7 @@ var TextureCrop = { * @method Phaser.GameObjects.Components.TextureCrop#setFrame * @since 3.0.0 * - * @param {(string|integer)} frame - The name or index of the frame within the Texture. + * @param {(string|number)} frame - The name or index of the frame within the Texture. * @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object? * @param {boolean} [updateOrigin=true] - Should this call adjust the origin of the Game Object? * @@ -128557,7 +136196,7 @@ var TextureCrop = { * @method Phaser.GameObjects.Components.TextureCrop#resetCropObject * @private * @since 3.12.0 - * + * * @return {object} The crop object. */ resetCropObject: function () @@ -128571,8 +136210,8 @@ module.exports = TextureCrop; /***/ }), -/* 588 */ -/***/ (function(module, exports, __webpack_require__) { +/* 627 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -128580,8 +136219,6 @@ module.exports = TextureCrop; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetColorFromValue = __webpack_require__(119); - /** * Provides methods used for setting the tint of a Game Object. * Should be applied as a mixin and not used directly. @@ -128594,62 +136231,58 @@ var GetColorFromValue = __webpack_require__(119); var Tint = { /** - * Private internal value. Holds the top-left tint value. + * The tint value being applied to the top-left vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @name Phaser.GameObjects.Components.Tint#_tintTL + * @name Phaser.GameObjects.Components.Tint#tintTopLeft * @type {number} - * @private - * @default 16777215 + * @default 0xffffff * @since 3.0.0 */ - _tintTL: 16777215, + tintTopLeft: 0xffffff, /** - * Private internal value. Holds the top-right tint value. + * The tint value being applied to the top-right vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @name Phaser.GameObjects.Components.Tint#_tintTR + * @name Phaser.GameObjects.Components.Tint#tintTopRight * @type {number} - * @private - * @default 16777215 + * @default 0xffffff * @since 3.0.0 */ - _tintTR: 16777215, + tintTopRight: 0xffffff, /** - * Private internal value. Holds the bottom-left tint value. + * The tint value being applied to the bottom-left vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @name Phaser.GameObjects.Components.Tint#_tintBL + * @name Phaser.GameObjects.Components.Tint#tintBottomLeft * @type {number} - * @private - * @default 16777215 + * @default 0xffffff * @since 3.0.0 */ - _tintBL: 16777215, + tintBottomLeft: 0xffffff, /** - * Private internal value. Holds the bottom-right tint value. + * The tint value being applied to the bottom-right vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @name Phaser.GameObjects.Components.Tint#_tintBR + * @name Phaser.GameObjects.Components.Tint#tintBottomRight * @type {number} - * @private - * @default 16777215 + * @default 0xffffff * @since 3.0.0 */ - _tintBR: 16777215, + tintBottomRight: 0xffffff, /** - * Private internal value. Holds if the Game Object is tinted or not. + * The tint fill mode. * - * @name Phaser.GameObjects.Components.Tint#_isTinted - * @type {boolean} - * @private - * @default false - * @since 3.11.0 - */ - _isTinted: false, - - /** - * Fill or additive? + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. * * @name Phaser.GameObjects.Components.Tint#tintFill * @type {boolean} @@ -128674,8 +136307,6 @@ var Tint = { { this.setTint(0xffffff); - this._isTinted = false; - return this; }, @@ -128699,10 +136330,10 @@ var Tint = { * @webglOnly * @since 3.0.0 * - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If no other values are given this value is applied evenly, tinting the whole Game Object. - * @param {integer} [topRight] - The tint being applied to the top-right of the Game Object. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the Game Object. + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If no other values are given this value is applied evenly, tinting the whole Game Object. + * @param {number} [topRight] - The tint being applied to the top-right of the Game Object. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the Game Object. * * @return {this} This Game Object instance. */ @@ -128717,12 +136348,10 @@ var Tint = { bottomRight = topLeft; } - this._tintTL = GetColorFromValue(topLeft); - this._tintTR = GetColorFromValue(topRight); - this._tintBL = GetColorFromValue(bottomLeft); - this._tintBR = GetColorFromValue(bottomRight); - - this._isTinted = true; + this.tintTopLeft = topLeft; + this.tintTopRight = topRight; + this.tintBottomLeft = bottomLeft; + this.tintBottomRight = bottomRight; this.tintFill = false; @@ -128750,10 +136379,10 @@ var Tint = { * @webglOnly * @since 3.11.0 * - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. - * @param {integer} [topRight] - The tint being applied to the top-right of the Game Object. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the Game Object. + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. + * @param {number} [topRight] - The tint being applied to the top-right of the Game Object. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the Game Object. * * @return {this} This Game Object instance. */ @@ -128766,108 +136395,12 @@ var Tint = { return this; }, - /** - * The tint value being applied to the top-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintTopLeft - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tintTopLeft: { - - get: function () - { - return this._tintTL; - }, - - set: function (value) - { - this._tintTL = GetColorFromValue(value); - this._isTinted = true; - } - - }, - - /** - * The tint value being applied to the top-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintTopRight - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tintTopRight: { - - get: function () - { - return this._tintTR; - }, - - set: function (value) - { - this._tintTR = GetColorFromValue(value); - this._isTinted = true; - } - - }, - - /** - * The tint value being applied to the bottom-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintBottomLeft - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tintBottomLeft: { - - get: function () - { - return this._tintBL; - }, - - set: function (value) - { - this._tintBL = GetColorFromValue(value); - this._isTinted = true; - } - - }, - - /** - * The tint value being applied to the bottom-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintBottomRight - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tintBottomRight: { - - get: function () - { - return this._tintBR; - }, - - set: function (value) - { - this._tintBR = GetColorFromValue(value); - this._isTinted = true; - } - - }, - /** * The tint value being applied to the whole of the Game Object. * This property is a setter-only. Use the properties `tintTopLeft` etc to read the current tint value. * * @name Phaser.GameObjects.Components.Tint#tint - * @type {integer} + * @type {number} * @webglOnly * @since 3.0.0 */ @@ -128880,7 +136413,10 @@ var Tint = { }, /** - * Does this Game Object have a tint applied to it or not? + * Does this Game Object have a tint applied? + * + * It checks to see if the 4 tint properties are set to the value 0xffffff + * and that the `tintFill` property is `false`. This indicates that a Game Object isn't tinted. * * @name Phaser.GameObjects.Components.Tint#isTinted * @type {boolean} @@ -128892,7 +136428,15 @@ var Tint = { get: function () { - return this._isTinted; + var white = 0xffffff; + + return ( + this.tintFill || + this.tintTopLeft !== white || + this.tintTopRight !== white || + this.tintBottomLeft !== white || + this.tintBottomRight !== white + ); } } @@ -128903,7 +136447,7 @@ module.exports = Tint; /***/ }), -/* 589 */ +/* 628 */ /***/ (function(module, exports) { /** @@ -128935,7 +136479,7 @@ module.exports = 'changedata'; /***/ }), -/* 590 */ +/* 629 */ /***/ (function(module, exports) { /** @@ -128965,7 +136509,28 @@ module.exports = 'changedata-'; /***/ }), -/* 591 */ +/* 630 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Data Manager Destroy Event. + * + * The Data Manager will listen for the destroy event from its parent, and then close itself down. + * + * @event Phaser.Data.Events#DESTROY + * @since 3.50.0 + */ +module.exports = 'destroy'; + + +/***/ }), +/* 631 */ /***/ (function(module, exports) { /** @@ -128993,7 +136558,7 @@ module.exports = 'removedata'; /***/ }), -/* 592 */ +/* 632 */ /***/ (function(module, exports) { /** @@ -129021,7 +136586,7 @@ module.exports = 'setdata'; /***/ }), -/* 593 */ +/* 633 */ /***/ (function(module, exports) { /** @@ -129047,7 +136612,7 @@ module.exports = 'addedtoscene'; /***/ }), -/* 594 */ +/* 634 */ /***/ (function(module, exports) { /** @@ -129072,7 +136637,7 @@ module.exports = 'destroy'; /***/ }), -/* 595 */ +/* 635 */ /***/ (function(module, exports) { /** @@ -129098,7 +136663,7 @@ module.exports = 'removedfromscene'; /***/ }), -/* 596 */ +/* 636 */ /***/ (function(module, exports) { /** @@ -129130,7 +136695,7 @@ module.exports = 'complete'; /***/ }), -/* 597 */ +/* 637 */ /***/ (function(module, exports) { /** @@ -129152,14 +136717,14 @@ module.exports = 'complete'; * @since 3.20.0 * * @param {Phaser.GameObjects.Video} video - The Video Game Object which raised the event. - * @param {integer} width - The width of the video. - * @param {integer} height - The height of the video. + * @param {number} width - The width of the video. + * @param {number} height - The height of the video. */ module.exports = 'created'; /***/ }), -/* 598 */ +/* 638 */ /***/ (function(module, exports) { /** @@ -129185,7 +136750,7 @@ module.exports = 'error'; /***/ }), -/* 599 */ +/* 639 */ /***/ (function(module, exports) { /** @@ -129217,7 +136782,7 @@ module.exports = 'loop'; /***/ }), -/* 600 */ +/* 640 */ /***/ (function(module, exports) { /** @@ -129245,7 +136810,7 @@ module.exports = 'play'; /***/ }), -/* 601 */ +/* 641 */ /***/ (function(module, exports) { /** @@ -129270,7 +136835,7 @@ module.exports = 'seeked'; /***/ }), -/* 602 */ +/* 642 */ /***/ (function(module, exports) { /** @@ -129296,7 +136861,7 @@ module.exports = 'seeking'; /***/ }), -/* 603 */ +/* 643 */ /***/ (function(module, exports) { /** @@ -129322,7 +136887,7 @@ module.exports = 'stop'; /***/ }), -/* 604 */ +/* 644 */ /***/ (function(module, exports) { /** @@ -129348,7 +136913,7 @@ module.exports = 'timeout'; /***/ }), -/* 605 */ +/* 645 */ /***/ (function(module, exports) { /** @@ -129374,7 +136939,7 @@ module.exports = 'unlocked'; /***/ }), -/* 606 */ +/* 646 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129383,7 +136948,7 @@ module.exports = 'unlocked'; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `alpha` property, @@ -129401,8 +136966,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `alpha` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -129415,7 +136980,7 @@ module.exports = IncAlpha; /***/ }), -/* 607 */ +/* 647 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129424,7 +136989,7 @@ module.exports = IncAlpha; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `x` property, @@ -129442,8 +137007,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `x` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -129456,7 +137021,7 @@ module.exports = IncX; /***/ }), -/* 608 */ +/* 648 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129465,7 +137030,7 @@ module.exports = IncX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, @@ -129485,8 +137050,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {number} [y=x] - The amount to be added to the `y` property. If `undefined` or `null` it uses the `x` value. * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -129503,7 +137068,7 @@ module.exports = IncXY; /***/ }), -/* 609 */ +/* 649 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129512,7 +137077,7 @@ module.exports = IncXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `y` property, @@ -129530,8 +137095,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `y` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -129544,7 +137109,7 @@ module.exports = IncY; /***/ }), -/* 610 */ +/* 650 */ /***/ (function(module, exports) { /** @@ -129593,7 +137158,7 @@ module.exports = PlaceOnCircle; /***/ }), -/* 611 */ +/* 651 */ /***/ (function(module, exports) { /** @@ -129645,7 +137210,7 @@ module.exports = PlaceOnEllipse; /***/ }), -/* 612 */ +/* 652 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129654,7 +137219,7 @@ module.exports = PlaceOnEllipse; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetPoints = __webpack_require__(162); +var GetPoints = __webpack_require__(163); /** * Positions an array of Game Objects on evenly spaced points of a Line. @@ -129689,7 +137254,7 @@ module.exports = PlaceOnLine; /***/ }), -/* 613 */ +/* 653 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129698,9 +137263,9 @@ module.exports = PlaceOnLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MarchingAnts = __webpack_require__(294); -var RotateLeft = __webpack_require__(295); -var RotateRight = __webpack_require__(296); +var MarchingAnts = __webpack_require__(308); +var RotateLeft = __webpack_require__(170); +var RotateRight = __webpack_require__(171); /** * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Rectangle. @@ -129715,7 +137280,7 @@ var RotateRight = __webpack_require__(296); * * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. * @param {Phaser.Geom.Rectangle} rect - The Rectangle to position the Game Objects on. - * @param {integer} [shift=1] - An optional positional offset. + * @param {number} [shift=1] - An optional positional offset. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ @@ -129747,7 +137312,7 @@ module.exports = PlaceOnRectangle; /***/ }), -/* 614 */ +/* 654 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129756,7 +137321,7 @@ module.exports = PlaceOnRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BresenhamPoints = __webpack_require__(297); +var BresenhamPoints = __webpack_require__(309); /** * Takes an array of Game Objects and positions them on evenly spaced points around the edges of a Triangle. @@ -129808,7 +137373,7 @@ module.exports = PlaceOnTriangle; /***/ }), -/* 615 */ +/* 655 */ /***/ (function(module, exports) { /** @@ -129827,7 +137392,7 @@ module.exports = PlaceOnTriangle; * * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. * @param {string} key - The name of the animation to play. - * @param {(string|integer)} [startFrame] - The starting frame of the animation with the given key. + * @param {(string|number)} [startFrame] - The starting frame of the animation with the given key. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ @@ -129845,7 +137410,7 @@ module.exports = PlayAnimation; /***/ }), -/* 616 */ +/* 656 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129854,7 +137419,7 @@ module.exports = PlayAnimation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(160); +var Random = __webpack_require__(161); /** * Takes an array of Game Objects and positions them at random locations within the Circle. @@ -129885,7 +137450,7 @@ module.exports = RandomCircle; /***/ }), -/* 617 */ +/* 657 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129894,7 +137459,7 @@ module.exports = RandomCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(167); +var Random = __webpack_require__(172); /** * Takes an array of Game Objects and positions them at random locations within the Ellipse. @@ -129925,7 +137490,7 @@ module.exports = RandomEllipse; /***/ }), -/* 618 */ +/* 658 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129934,7 +137499,7 @@ module.exports = RandomEllipse; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(163); +var Random = __webpack_require__(164); /** * Takes an array of Game Objects and positions them at random locations on the Line. @@ -129965,7 +137530,7 @@ module.exports = RandomLine; /***/ }), -/* 619 */ +/* 659 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129974,7 +137539,7 @@ module.exports = RandomLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(164); +var Random = __webpack_require__(165); /** * Takes an array of Game Objects and positions them at random locations within the Rectangle. @@ -130003,7 +137568,7 @@ module.exports = RandomRectangle; /***/ }), -/* 620 */ +/* 660 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130012,7 +137577,7 @@ module.exports = RandomRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(168); +var Random = __webpack_require__(173); /** * Takes an array of Game Objects and positions them at random locations within the Triangle. @@ -130043,7 +137608,7 @@ module.exports = RandomTriangle; /***/ }), -/* 621 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130052,7 +137617,7 @@ module.exports = RandomTriangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `rotation` property, @@ -130070,8 +137635,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `rotation` property (in radians). * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130084,7 +137649,7 @@ module.exports = Rotate; /***/ }), -/* 622 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130093,8 +137658,8 @@ module.exports = Rotate; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundDistance = __webpack_require__(169); -var DistanceBetween = __webpack_require__(55); +var RotateAroundDistance = __webpack_require__(174); +var DistanceBetween = __webpack_require__(61); /** * Rotates each item around the given point by the given angle. @@ -130130,7 +137695,7 @@ module.exports = RotateAround; /***/ }), -/* 623 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130139,7 +137704,7 @@ module.exports = RotateAround; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MathRotateAroundDistance = __webpack_require__(169); +var MathRotateAroundDistance = __webpack_require__(174); /** * Rotates an array of Game Objects around a point by the given angle and distance. @@ -130179,7 +137744,7 @@ module.exports = RotateAroundDistance; /***/ }), -/* 624 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130188,7 +137753,7 @@ module.exports = RotateAroundDistance; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `scaleX` property, @@ -130206,8 +137771,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `scaleX` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130220,7 +137785,7 @@ module.exports = ScaleX; /***/ }), -/* 625 */ +/* 665 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130229,7 +137794,7 @@ module.exports = ScaleX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have public `scaleX` and `scaleY` properties, @@ -130249,8 +137814,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {number} [scaleY] - The amount to be added to the `scaleY` property. If `undefined` or `null` it uses the `scaleX` value. * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130267,7 +137832,7 @@ module.exports = ScaleXY; /***/ }), -/* 626 */ +/* 666 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130276,7 +137841,7 @@ module.exports = ScaleXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `scaleY` property, @@ -130294,8 +137859,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `scaleY` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130308,7 +137873,7 @@ module.exports = ScaleY; /***/ }), -/* 627 */ +/* 667 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130317,7 +137882,7 @@ module.exports = ScaleY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `alpha` @@ -130335,8 +137900,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130349,7 +137914,7 @@ module.exports = SetAlpha; /***/ }), -/* 628 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130358,7 +137923,7 @@ module.exports = SetAlpha; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `blendMode` @@ -130375,8 +137940,8 @@ var PropertyValueSet = __webpack_require__(25); * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130389,7 +137954,7 @@ module.exports = SetBlendMode; /***/ }), -/* 629 */ +/* 669 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130398,7 +137963,7 @@ module.exports = SetBlendMode; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `depth` @@ -130416,8 +137981,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130430,7 +137995,7 @@ module.exports = SetDepth; /***/ }), -/* 630 */ +/* 670 */ /***/ (function(module, exports) { /** @@ -130469,7 +138034,7 @@ module.exports = SetHitArea; /***/ }), -/* 631 */ +/* 671 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130478,7 +138043,7 @@ module.exports = SetHitArea; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `originX` and `originY` @@ -130498,8 +138063,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {number} [originY] - The amount to set the `originY` property to. If `undefined` or `null` it uses the `originX` value. * @param {number} [stepX=0] - This is added to the `originX` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `originY` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130522,7 +138087,7 @@ module.exports = SetOrigin; /***/ }), -/* 632 */ +/* 672 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130531,7 +138096,7 @@ module.exports = SetOrigin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `rotation` @@ -130549,8 +138114,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130563,7 +138128,7 @@ module.exports = SetRotation; /***/ }), -/* 633 */ +/* 673 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130572,7 +138137,7 @@ module.exports = SetRotation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `scaleX` and `scaleY` @@ -130592,8 +138157,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {number} [scaleY] - The amount to set the `scaleY` property to. If `undefined` or `null` it uses the `scaleX` value. * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130610,7 +138175,7 @@ module.exports = SetScale; /***/ }), -/* 634 */ +/* 674 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130619,7 +138184,7 @@ module.exports = SetScale; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scaleX` @@ -130637,8 +138202,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130651,7 +138216,7 @@ module.exports = SetScaleX; /***/ }), -/* 635 */ +/* 675 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130660,7 +138225,7 @@ module.exports = SetScaleX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scaleY` @@ -130678,8 +138243,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130692,7 +138257,7 @@ module.exports = SetScaleY; /***/ }), -/* 636 */ +/* 676 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130701,7 +138266,7 @@ module.exports = SetScaleY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `scrollFactorX` and `scrollFactorY` @@ -130721,8 +138286,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {number} [scrollFactorY] - The amount to set the `scrollFactorY` property to. If `undefined` or `null` it uses the `scrollFactorX` value. * @param {number} [stepX=0] - This is added to the `scrollFactorX` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `scrollFactorY` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130739,7 +138304,7 @@ module.exports = SetScrollFactor; /***/ }), -/* 637 */ +/* 677 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130748,7 +138313,7 @@ module.exports = SetScrollFactor; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scrollFactorX` @@ -130766,8 +138331,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130780,7 +138345,7 @@ module.exports = SetScrollFactorX; /***/ }), -/* 638 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130789,7 +138354,7 @@ module.exports = SetScrollFactorX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scrollFactorY` @@ -130807,8 +138372,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130821,7 +138386,7 @@ module.exports = SetScrollFactorY; /***/ }), -/* 639 */ +/* 679 */ /***/ (function(module, exports) { /** @@ -130860,7 +138425,7 @@ module.exports = SetTint; /***/ }), -/* 640 */ +/* 680 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130869,7 +138434,7 @@ module.exports = SetTint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `visible` @@ -130884,8 +138449,8 @@ var PropertyValueSet = __webpack_require__(25); * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {boolean} value - The value to set the property to. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130898,7 +138463,7 @@ module.exports = SetVisible; /***/ }), -/* 641 */ +/* 681 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130907,7 +138472,7 @@ module.exports = SetVisible; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `x` @@ -130925,8 +138490,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130939,7 +138504,7 @@ module.exports = SetX; /***/ }), -/* 642 */ +/* 682 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130948,7 +138513,7 @@ module.exports = SetX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `x` and `y` @@ -130968,8 +138533,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {number} [y=x] - The amount to set the `y` property to. If `undefined` or `null` it uses the `x` value. * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130986,7 +138551,7 @@ module.exports = SetXY; /***/ }), -/* 643 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130995,7 +138560,7 @@ module.exports = SetXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `y` @@ -131013,8 +138578,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -131027,7 +138592,7 @@ module.exports = SetY; /***/ }), -/* 644 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131055,7 +138620,7 @@ var Vector2 = __webpack_require__(3); * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. * @param {number} x - The x coordinate to place the first item in the array at. * @param {number} y - The y coordinate to place the first item in the array at. - * @param {integer} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. + * @param {number} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. * @param {(Phaser.Math.Vector2|object)} [output] - An optional objec to store the final objects position in. * * @return {Phaser.Math.Vector2} The output vector. @@ -131157,7 +138722,7 @@ module.exports = ShiftPosition; /***/ }), -/* 645 */ +/* 685 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131166,7 +138731,7 @@ module.exports = ShiftPosition; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayShuffle = __webpack_require__(121); +var ArrayShuffle = __webpack_require__(127); /** * Shuffles the array in place. The shuffled array is both modified and returned. @@ -131190,7 +138755,7 @@ module.exports = Shuffle; /***/ }), -/* 646 */ +/* 686 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131199,7 +138764,7 @@ module.exports = Shuffle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MathSmootherStep = __webpack_require__(170); +var MathSmootherStep = __webpack_require__(175); /** * Smootherstep is a sigmoid-like interpolation and clamping function. @@ -131248,7 +138813,7 @@ module.exports = SmootherStep; /***/ }), -/* 647 */ +/* 687 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131257,7 +138822,7 @@ module.exports = SmootherStep; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MathSmoothStep = __webpack_require__(171); +var MathSmoothStep = __webpack_require__(176); /** * Smoothstep is a sigmoid-like interpolation and clamping function. @@ -131306,7 +138871,7 @@ module.exports = SmoothStep; /***/ }), -/* 648 */ +/* 688 */ /***/ (function(module, exports) { /** @@ -131369,7 +138934,7 @@ module.exports = Spread; /***/ }), -/* 649 */ +/* 689 */ /***/ (function(module, exports) { /** @@ -131405,7 +138970,7 @@ module.exports = ToggleVisible; /***/ }), -/* 650 */ +/* 690 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131415,7 +138980,7 @@ module.exports = ToggleVisible; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * Wrap each item's coordinates within a rectangle's area. @@ -131454,7 +139019,7 @@ module.exports = WrapInRectangle; /***/ }), -/* 651 */ +/* 691 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131469,17 +139034,17 @@ module.exports = WrapInRectangle; module.exports = { - Animation: __webpack_require__(172), - AnimationFrame: __webpack_require__(299), - AnimationManager: __webpack_require__(301), + Animation: __webpack_require__(177), + AnimationFrame: __webpack_require__(311), + AnimationManager: __webpack_require__(313), AnimationState: __webpack_require__(157), - Events: __webpack_require__(122) + Events: __webpack_require__(128) }; /***/ }), -/* 652 */ +/* 692 */ /***/ (function(module, exports) { /** @@ -131506,7 +139071,7 @@ module.exports = 'add'; /***/ }), -/* 653 */ +/* 693 */ /***/ (function(module, exports) { /** @@ -131552,7 +139117,7 @@ module.exports = 'animationcomplete'; /***/ }), -/* 654 */ +/* 694 */ /***/ (function(module, exports) { /** @@ -131602,7 +139167,7 @@ module.exports = 'animationcomplete-'; /***/ }), -/* 655 */ +/* 695 */ /***/ (function(module, exports) { /** @@ -131645,7 +139210,7 @@ module.exports = 'animationrepeat'; /***/ }), -/* 656 */ +/* 696 */ /***/ (function(module, exports) { /** @@ -131686,7 +139251,7 @@ module.exports = 'animationrestart'; /***/ }), -/* 657 */ +/* 697 */ /***/ (function(module, exports) { /** @@ -131728,7 +139293,7 @@ module.exports = 'animationstart'; /***/ }), -/* 658 */ +/* 698 */ /***/ (function(module, exports) { /** @@ -131770,7 +139335,7 @@ module.exports = 'animationstop'; /***/ }), -/* 659 */ +/* 699 */ /***/ (function(module, exports) { /** @@ -131816,7 +139381,7 @@ module.exports = 'animationupdate'; /***/ }), -/* 660 */ +/* 700 */ /***/ (function(module, exports) { /** @@ -131840,7 +139405,7 @@ module.exports = 'pauseall'; /***/ }), -/* 661 */ +/* 701 */ /***/ (function(module, exports) { /** @@ -131864,7 +139429,7 @@ module.exports = 'remove'; /***/ }), -/* 662 */ +/* 702 */ /***/ (function(module, exports) { /** @@ -131887,7 +139452,7 @@ module.exports = 'resumeall'; /***/ }), -/* 663 */ +/* 703 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131902,15 +139467,15 @@ module.exports = 'resumeall'; module.exports = { - BaseCache: __webpack_require__(303), - CacheManager: __webpack_require__(305), - Events: __webpack_require__(304) + BaseCache: __webpack_require__(315), + CacheManager: __webpack_require__(317), + Events: __webpack_require__(316) }; /***/ }), -/* 664 */ +/* 704 */ /***/ (function(module, exports) { /** @@ -131935,7 +139500,7 @@ module.exports = 'add'; /***/ }), -/* 665 */ +/* 705 */ /***/ (function(module, exports) { /** @@ -131960,7 +139525,7 @@ module.exports = 'remove'; /***/ }), -/* 666 */ +/* 706 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131979,14 +139544,14 @@ module.exports = 'remove'; module.exports = { - Controls: __webpack_require__(667), - Scene2D: __webpack_require__(670) + Controls: __webpack_require__(707), + Scene2D: __webpack_require__(710) }; /***/ }), -/* 667 */ +/* 707 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -132001,14 +139566,14 @@ module.exports = { module.exports = { - FixedKeyControl: __webpack_require__(668), - SmoothedKeyControl: __webpack_require__(669) + FixedKeyControl: __webpack_require__(708), + SmoothedKeyControl: __webpack_require__(709) }; /***/ }), -/* 668 */ +/* 708 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -132314,7 +139879,7 @@ module.exports = FixedKeyControl; /***/ }), -/* 669 */ +/* 709 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -132797,7 +140362,7 @@ module.exports = SmoothedKeyControl; /***/ }), -/* 670 */ +/* 710 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -132812,17 +140377,17 @@ module.exports = SmoothedKeyControl; module.exports = { - Camera: __webpack_require__(306), - BaseCamera: __webpack_require__(93), - CameraManager: __webpack_require__(726), - Effects: __webpack_require__(314), - Events: __webpack_require__(42) + Camera: __webpack_require__(318), + BaseCamera: __webpack_require__(99), + CameraManager: __webpack_require__(767), + Effects: __webpack_require__(325), + Events: __webpack_require__(35) }; /***/ }), -/* 671 */ +/* 711 */ /***/ (function(module, exports) { /** @@ -132845,7 +140410,7 @@ module.exports = 'cameradestroy'; /***/ }), -/* 672 */ +/* 712 */ /***/ (function(module, exports) { /** @@ -132871,7 +140436,7 @@ module.exports = 'camerafadeincomplete'; /***/ }), -/* 673 */ +/* 713 */ /***/ (function(module, exports) { /** @@ -132892,16 +140457,16 @@ module.exports = 'camerafadeincomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. + * @param {number} duration - The duration of the effect. + * @param {number} red - The red color channel value. + * @param {number} green - The green color channel value. + * @param {number} blue - The blue color channel value. */ module.exports = 'camerafadeinstart'; /***/ }), -/* 674 */ +/* 714 */ /***/ (function(module, exports) { /** @@ -132927,7 +140492,7 @@ module.exports = 'camerafadeoutcomplete'; /***/ }), -/* 675 */ +/* 715 */ /***/ (function(module, exports) { /** @@ -132948,16 +140513,16 @@ module.exports = 'camerafadeoutcomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. + * @param {number} duration - The duration of the effect. + * @param {number} red - The red color channel value. + * @param {number} green - The green color channel value. + * @param {number} blue - The blue color channel value. */ module.exports = 'camerafadeoutstart'; /***/ }), -/* 676 */ +/* 716 */ /***/ (function(module, exports) { /** @@ -132981,7 +140546,7 @@ module.exports = 'cameraflashcomplete'; /***/ }), -/* 677 */ +/* 717 */ /***/ (function(module, exports) { /** @@ -133000,16 +140565,44 @@ module.exports = 'cameraflashcomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. + * @param {number} duration - The duration of the effect. + * @param {number} red - The red color channel value. + * @param {number} green - The green color channel value. + * @param {number} blue - The blue color channel value. */ module.exports = 'cameraflashstart'; /***/ }), -/* 678 */ +/* 718 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Camera Follower Update Event. + * + * This event is dispatched by a Camera instance when it is following a + * Game Object and the Camera position has been updated as a result of + * that following. + * + * Listen to it from a Camera instance using: `camera.on('followupdate', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FOLLOW_UPDATE + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that emitted the event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the camera is following. + */ +module.exports = 'followupdate'; + + +/***/ }), +/* 719 */ /***/ (function(module, exports) { /** @@ -133033,7 +140626,7 @@ module.exports = 'camerapancomplete'; /***/ }), -/* 679 */ +/* 720 */ /***/ (function(module, exports) { /** @@ -133052,7 +140645,7 @@ module.exports = 'camerapancomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. + * @param {number} duration - The duration of the effect. * @param {number} x - The destination scroll x coordinate. * @param {number} y - The destination scroll y coordinate. */ @@ -133060,7 +140653,7 @@ module.exports = 'camerapanstart'; /***/ }), -/* 680 */ +/* 721 */ /***/ (function(module, exports) { /** @@ -133086,7 +140679,7 @@ module.exports = 'postrender'; /***/ }), -/* 681 */ +/* 722 */ /***/ (function(module, exports) { /** @@ -133112,7 +140705,7 @@ module.exports = 'prerender'; /***/ }), -/* 682 */ +/* 723 */ /***/ (function(module, exports) { /** @@ -133136,7 +140729,7 @@ module.exports = 'camerarotatecomplete'; /***/ }), -/* 683 */ +/* 724 */ /***/ (function(module, exports) { /** @@ -133155,14 +140748,14 @@ module.exports = 'camerarotatecomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.RotateTo} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. + * @param {number} duration - The duration of the effect. * @param {number} destination - The destination value. */ module.exports = 'camerarotatestart'; /***/ }), -/* 684 */ +/* 725 */ /***/ (function(module, exports) { /** @@ -133186,7 +140779,7 @@ module.exports = 'camerashakecomplete'; /***/ }), -/* 685 */ +/* 726 */ /***/ (function(module, exports) { /** @@ -133205,14 +140798,14 @@ module.exports = 'camerashakecomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. + * @param {number} duration - The duration of the effect. * @param {number} intensity - The intensity of the effect. */ module.exports = 'camerashakestart'; /***/ }), -/* 686 */ +/* 727 */ /***/ (function(module, exports) { /** @@ -133236,7 +140829,7 @@ module.exports = 'camerazoomcomplete'; /***/ }), -/* 687 */ +/* 728 */ /***/ (function(module, exports) { /** @@ -133255,14 +140848,14 @@ module.exports = 'camerazoomcomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. + * @param {number} duration - The duration of the effect. * @param {number} zoom - The destination zoom value. */ module.exports = 'camerazoomstart'; /***/ }), -/* 688 */ +/* 729 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -133271,9 +140864,9 @@ module.exports = 'camerazoomstart'; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(42); +var Events = __webpack_require__(35); /** * @classdesc @@ -133350,7 +140943,7 @@ var Fade = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Fade#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.5.0 @@ -133362,7 +140955,7 @@ var Fade = new Class({ * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Fade#red - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -133373,7 +140966,7 @@ var Fade = new Class({ * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Fade#green - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -133384,7 +140977,7 @@ var Fade = new Class({ * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Fade#blue - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -133451,10 +141044,10 @@ var Fade = new Class({ * @since 3.5.0 * * @param {boolean} [direction=true] - The direction of the fade. `true` = fade out (transparent to color), `false` = fade in (color to transparent) - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraFadeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -133507,7 +141100,7 @@ var Fade = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Fade#update * @since 3.5.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -133557,7 +141150,7 @@ var Fade = new Class({ var camera = this.camera; ctx.fillStyle = 'rgba(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')'; - ctx.fillRect(camera._cx, camera._cy, camera._cw, camera._ch); + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); return true; }, @@ -133582,12 +141175,12 @@ var Fade = new Class({ var camera = this.camera; var red = this.red / 255; - var blue = this.blue / 255; var green = this.green / 255; + var blue = this.blue / 255; pipeline.drawFillRect( - camera._cx, camera._cy, camera._cw, camera._ch, - getTintFunction(red, green, blue, 1), + camera.x, camera.y, camera.width, camera.height, + getTintFunction(blue, green, red, 1), this.alpha ); @@ -133650,7 +141243,7 @@ module.exports = Fade; /***/ }), -/* 689 */ +/* 730 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -133659,9 +141252,9 @@ module.exports = Fade; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(42); +var Events = __webpack_require__(35); /** * @classdesc @@ -133713,7 +141306,7 @@ var Flash = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Flash#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.5.0 @@ -133721,40 +141314,40 @@ var Flash = new Class({ this.duration = 0; /** - * The value of the red color channel the camera will use for the fade effect. + * The value of the red color channel the camera will use for the flash effect. * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Flash#red - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ this.red = 0; /** - * The value of the green color channel the camera will use for the fade effect. + * The value of the green color channel the camera will use for the flash effect. * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Flash#green - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ this.green = 0; /** - * The value of the blue color channel the camera will use for the fade effect. + * The value of the blue color channel the camera will use for the flash effect. * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Flash#blue - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ this.blue = 0; /** - * The value of the alpha channel used during the fade effect. + * The value of the alpha channel used during the flash effect. * A value between 0 and 1. * * @name Phaser.Cameras.Scene2D.Effects.Flash#alpha @@ -133813,10 +141406,10 @@ var Flash = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 * - * @param {integer} [duration=250] - The duration of the effect in milliseconds. - * @param {integer} [red=255] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=255] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=250] - The duration of the effect in milliseconds. + * @param {number} [red=255] - The amount to flash the red channel towards. A value between 0 and 255. + * @param {number} [green=255] - The amount to flash the green channel towards. A value between 0 and 255. + * @param {number} [blue=255] - The amount to flash the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraFlashCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -133864,7 +141457,7 @@ var Flash = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Flash#update * @since 3.5.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -133913,7 +141506,7 @@ var Flash = new Class({ var camera = this.camera; ctx.fillStyle = 'rgba(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')'; - ctx.fillRect(camera._cx, camera._cy, camera._cw, camera._ch); + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); return true; }, @@ -133938,12 +141531,12 @@ var Flash = new Class({ var camera = this.camera; var red = this.red / 255; - var blue = this.blue / 255; var green = this.green / 255; + var blue = this.blue / 255; pipeline.drawFillRect( - camera._cx, camera._cy, camera._cw, camera._ch, - getTintFunction(red, green, blue, 1), + camera.x, camera.y, camera.width, camera.height, + getTintFunction(blue, green, red, 1), this.alpha ); @@ -134001,7 +141594,7 @@ module.exports = Flash; /***/ }), -/* 690 */ +/* 731 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -134010,10 +141603,10 @@ module.exports = Flash; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var EaseMap = __webpack_require__(123); -var Events = __webpack_require__(42); +var EaseMap = __webpack_require__(129); +var Events = __webpack_require__(35); var Vector2 = __webpack_require__(3); /** @@ -134067,7 +141660,7 @@ var Pan = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Pan#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.11.0 @@ -134162,7 +141755,7 @@ var Pan = new Class({ * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -134226,7 +141819,7 @@ var Pan = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Pan#update * @since 3.11.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -134326,7 +141919,7 @@ module.exports = Pan; /***/ }), -/* 691 */ +/* 732 */ /***/ (function(module, exports) { /** @@ -134357,7 +141950,7 @@ module.exports = In; /***/ }), -/* 692 */ +/* 733 */ /***/ (function(module, exports) { /** @@ -134388,7 +141981,7 @@ module.exports = Out; /***/ }), -/* 693 */ +/* 734 */ /***/ (function(module, exports) { /** @@ -134428,7 +142021,7 @@ module.exports = InOut; /***/ }), -/* 694 */ +/* 735 */ /***/ (function(module, exports) { /** @@ -134473,7 +142066,7 @@ module.exports = In; /***/ }), -/* 695 */ +/* 736 */ /***/ (function(module, exports) { /** @@ -134516,7 +142109,7 @@ module.exports = Out; /***/ }), -/* 696 */ +/* 737 */ /***/ (function(module, exports) { /** @@ -134580,7 +142173,7 @@ module.exports = InOut; /***/ }), -/* 697 */ +/* 738 */ /***/ (function(module, exports) { /** @@ -134608,7 +142201,7 @@ module.exports = In; /***/ }), -/* 698 */ +/* 739 */ /***/ (function(module, exports) { /** @@ -134636,7 +142229,7 @@ module.exports = Out; /***/ }), -/* 699 */ +/* 740 */ /***/ (function(module, exports) { /** @@ -134671,7 +142264,7 @@ module.exports = InOut; /***/ }), -/* 700 */ +/* 741 */ /***/ (function(module, exports) { /** @@ -134699,7 +142292,7 @@ module.exports = In; /***/ }), -/* 701 */ +/* 742 */ /***/ (function(module, exports) { /** @@ -134727,7 +142320,7 @@ module.exports = Out; /***/ }), -/* 702 */ +/* 743 */ /***/ (function(module, exports) { /** @@ -134762,7 +142355,7 @@ module.exports = InOut; /***/ }), -/* 703 */ +/* 744 */ /***/ (function(module, exports) { /** @@ -134817,7 +142410,7 @@ module.exports = In; /***/ }), -/* 704 */ +/* 745 */ /***/ (function(module, exports) { /** @@ -134872,7 +142465,7 @@ module.exports = Out; /***/ }), -/* 705 */ +/* 746 */ /***/ (function(module, exports) { /** @@ -134934,7 +142527,7 @@ module.exports = InOut; /***/ }), -/* 706 */ +/* 747 */ /***/ (function(module, exports) { /** @@ -134962,7 +142555,7 @@ module.exports = In; /***/ }), -/* 707 */ +/* 748 */ /***/ (function(module, exports) { /** @@ -134990,7 +142583,7 @@ module.exports = Out; /***/ }), -/* 708 */ +/* 749 */ /***/ (function(module, exports) { /** @@ -135025,7 +142618,7 @@ module.exports = InOut; /***/ }), -/* 709 */ +/* 750 */ /***/ (function(module, exports) { /** @@ -135053,7 +142646,7 @@ module.exports = Linear; /***/ }), -/* 710 */ +/* 751 */ /***/ (function(module, exports) { /** @@ -135081,7 +142674,7 @@ module.exports = In; /***/ }), -/* 711 */ +/* 752 */ /***/ (function(module, exports) { /** @@ -135109,7 +142702,7 @@ module.exports = Out; /***/ }), -/* 712 */ +/* 753 */ /***/ (function(module, exports) { /** @@ -135144,7 +142737,7 @@ module.exports = InOut; /***/ }), -/* 713 */ +/* 754 */ /***/ (function(module, exports) { /** @@ -135172,7 +142765,7 @@ module.exports = In; /***/ }), -/* 714 */ +/* 755 */ /***/ (function(module, exports) { /** @@ -135200,7 +142793,7 @@ module.exports = Out; /***/ }), -/* 715 */ +/* 756 */ /***/ (function(module, exports) { /** @@ -135235,7 +142828,7 @@ module.exports = InOut; /***/ }), -/* 716 */ +/* 757 */ /***/ (function(module, exports) { /** @@ -135263,7 +142856,7 @@ module.exports = In; /***/ }), -/* 717 */ +/* 758 */ /***/ (function(module, exports) { /** @@ -135291,7 +142884,7 @@ module.exports = Out; /***/ }), -/* 718 */ +/* 759 */ /***/ (function(module, exports) { /** @@ -135326,7 +142919,7 @@ module.exports = InOut; /***/ }), -/* 719 */ +/* 760 */ /***/ (function(module, exports) { /** @@ -135365,7 +142958,7 @@ module.exports = In; /***/ }), -/* 720 */ +/* 761 */ /***/ (function(module, exports) { /** @@ -135404,7 +142997,7 @@ module.exports = Out; /***/ }), -/* 721 */ +/* 762 */ /***/ (function(module, exports) { /** @@ -135443,7 +143036,7 @@ module.exports = InOut; /***/ }), -/* 722 */ +/* 763 */ /***/ (function(module, exports) { /** @@ -135485,7 +143078,7 @@ module.exports = Stepped; /***/ }), -/* 723 */ +/* 764 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135494,9 +143087,9 @@ module.exports = Stepped; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(42); +var Events = __webpack_require__(35); var Vector2 = __webpack_require__(3); /** @@ -135549,7 +143142,7 @@ var Shake = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Shake#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.5.0 @@ -135638,7 +143231,7 @@ var Shake = new Class({ * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 * - * @param {integer} [duration=100] - The duration of the effect in milliseconds. + * @param {number} [duration=100] - The duration of the effect in milliseconds. * @param {(number|Phaser.Math.Vector2)} [intensity=0.05] - The intensity of the shake. * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraShakeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -135705,7 +143298,7 @@ var Shake = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Shake#update * @since 3.5.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -135727,8 +143320,8 @@ var Shake = new Class({ if (this._elapsed < this.duration) { var intensity = this.intensity; - var width = this.camera._cw; - var height = this.camera._ch; + var width = this.camera.width; + var height = this.camera.height; var zoom = this.camera.zoom; this._offsetX = (Math.random() * intensity.x * width * 2 - intensity.x * width) * zoom; @@ -135804,7 +143397,7 @@ module.exports = Shake; /***/ }), -/* 724 */ +/* 765 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135813,10 +143406,10 @@ module.exports = Shake; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(42); -var EaseMap = __webpack_require__(123); +var Events = __webpack_require__(35); +var EaseMap = __webpack_require__(129); /** * @classdesc @@ -135875,7 +143468,7 @@ var RotateTo = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.RotateTo#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.23.0 @@ -135996,7 +143589,7 @@ var RotateTo = new Class({ * * @param {number} radians - The destination angle in radians to rotate the Camera viewport to. If the angle is positive then the rotation is clockwise else anticlockwise * @param {boolean} [shortestPath=false] - If shortest path is set to true the camera will rotate in the quickest direction clockwise or anti-clockwise. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the Rotate. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the rotation effect to start immediately, even if already running. * @param {CameraRotateCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -136111,7 +143704,7 @@ var RotateTo = new Class({ * @method Phaser.Cameras.Scene2D.Effects.RotateTo#update * @since 3.23.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -136237,7 +143830,7 @@ module.exports = RotateTo; /***/ }), -/* 725 */ +/* 766 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136246,10 +143839,10 @@ module.exports = RotateTo; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var EaseMap = __webpack_require__(123); -var Events = __webpack_require__(42); +var EaseMap = __webpack_require__(129); +var Events = __webpack_require__(35); /** * @classdesc @@ -136298,7 +143891,7 @@ var Zoom = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Zoom#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.11.0 @@ -136382,7 +143975,7 @@ var Zoom = new Class({ * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the zoom effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -136443,7 +144036,7 @@ var Zoom = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Zoom#update * @since 3.11.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -136530,7 +144123,7 @@ module.exports = Zoom; /***/ }), -/* 726 */ +/* 767 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136539,24 +144132,24 @@ module.exports = Zoom; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Camera = __webpack_require__(306); +var Camera = __webpack_require__(318); var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(23); -var RectangleContains = __webpack_require__(50); -var ScaleEvents = __webpack_require__(94); +var PluginCache = __webpack_require__(25); +var RectangleContains = __webpack_require__(56); +var ScaleEvents = __webpack_require__(101); var SceneEvents = __webpack_require__(20); /** * @classdesc * The Camera Manager is a plugin that belongs to a Scene and is responsible for managing all of the Scene Cameras. - * + * * By default you can access the Camera Manager from within a Scene using `this.cameras`, although this can be changed * in your game config. - * + * * Create new Cameras using the `add` method. Or extend the Camera class with your own addition code and then add * the new Camera in using the `addExisting` method. - * + * * Cameras provide a view into your game world, and can be positioned, rotated, zoomed and scrolled accordingly. * * A Camera consists of two elements: The viewport and the scroll values. @@ -136571,7 +144164,7 @@ var SceneEvents = __webpack_require__(20); * viewport, and changing the viewport has no impact on the scrolling. * * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, - * allowing you to filter Game Objects out on a per-Camera basis. The Camera Manager can manage up to 31 unique + * allowing you to filter Game Objects out on a per-Camera basis. The Camera Manager can manage up to 31 unique * 'Game Object ignore capable' Cameras. Any Cameras beyond 31 that you create will all be given a Camera ID of * zero, meaning that they cannot be used for Game Object exclusion. This means if you need your Camera to ignore * Game Objects, make sure it's one of the first 31 created. @@ -136637,11 +144230,11 @@ var CameraManager = new Class({ * A handy reference to the 'main' camera. By default this is the first Camera the * Camera Manager creates. You can also set it directly, or use the `makeMain` argument * in the `add` and `addExisting` methods. It allows you to access it from your game: - * + * * ```javascript * var cam = this.cameras.main; * ``` - * + * * Also see the properties `camera1`, `camera2` and so on. * * @name Phaser.Cameras.Scene2D.CameraManager#main @@ -136727,7 +144320,7 @@ var CameraManager = new Class({ // Make one this.add(); } - + this.main = this.cameras[0]; } @@ -136739,28 +144332,28 @@ var CameraManager = new Class({ /** * Adds a new Camera into the Camera Manager. The Camera Manager can support up to 31 different Cameras. - * + * * Each Camera has its own viewport, which controls the size of the Camera and its position within the canvas. - * + * * Use the `Camera.scrollX` and `Camera.scrollY` properties to change where the Camera is looking, or the * Camera methods such as `centerOn`. Cameras also have built in special effects, such as fade, flash, shake, * pan and zoom. - * + * * By default Cameras are transparent and will render anything that they can see based on their `scrollX` * and `scrollY` values. Game Objects can be set to be ignored by a Camera by using the `Camera.ignore` method. - * + * * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after creation if required. - * + * * See the Camera class documentation for more details. * * @method Phaser.Cameras.Scene2D.CameraManager#add * @since 3.0.0 * - * @param {integer} [x=0] - The horizontal position of the Camera viewport. - * @param {integer} [y=0] - The vertical position of the Camera viewport. - * @param {integer} [width] - The width of the Camera viewport. If not given it'll be the game config size. - * @param {integer} [height] - The height of the Camera viewport. If not given it'll be the game config size. + * @param {number} [x=0] - The horizontal position of the Camera viewport. + * @param {number} [y=0] - The vertical position of the Camera viewport. + * @param {number} [width] - The width of the Camera viewport. If not given it'll be the game config size. + * @param {number} [height] - The height of the Camera viewport. If not given it'll be the game config size. * @param {boolean} [makeMain=false] - Set this Camera as being the 'main' camera. This just makes the property `main` a reference to it. * @param {string} [name=''] - The name of the Camera. * @@ -136795,15 +144388,15 @@ var CameraManager = new Class({ /** * Adds an existing Camera into the Camera Manager. - * + * * The Camera should either be a `Phaser.Cameras.Scene2D.Camera` instance, or a class that extends from it. - * + * * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after addition if required. - * + * * The Camera will be assigned an ID, which is used for Game Object exclusion and then added to the * manager. As long as it doesn't already exist in the manager it will be added then returned. - * + * * If this method returns `null` then the Camera already exists in this Camera Manager. * * @method Phaser.Cameras.Scene2D.CameraManager#addExisting @@ -136832,7 +144425,7 @@ var CameraManager = new Class({ { this.main = camera; } - + return camera; } @@ -136841,7 +144434,7 @@ var CameraManager = new Class({ /** * Gets the next available Camera ID number. - * + * * The Camera Manager supports up to 31 unique cameras, after which the ID returned will always be zero. * You can create additional cameras beyond 31, but they cannot be used for Game Object exclusion. * @@ -136889,15 +144482,15 @@ var CameraManager = new Class({ /** * Gets the total number of Cameras in this Camera Manager. - * + * * If the optional `isVisible` argument is set it will only count Cameras that are currently visible. * * @method Phaser.Cameras.Scene2D.CameraManager#getTotal * @since 3.11.0 - * + * * @param {boolean} [isVisible=false] - Set the `true` to only include visible Cameras in the total. * - * @return {integer} The total number of Cameras in this Camera Manager. + * @return {number} The total number of Cameras in this Camera Manager. */ getTotal: function (isVisible) { @@ -136922,7 +144515,7 @@ var CameraManager = new Class({ /** * Populates this Camera Manager based on the given configuration object, or an array of config objects. - * + * * See the `Phaser.Types.Cameras.Scene2D.CameraConfig` documentation for details of the object structure. * * @method Phaser.Cameras.Scene2D.CameraManager#fromJSON @@ -136991,7 +144584,7 @@ var CameraManager = new Class({ /** * Gets a Camera based on its name. - * + * * Camera names are optional and don't have to be set, so this method is only of any use if you * have given your Cameras unique names. * @@ -137019,7 +144612,7 @@ var CameraManager = new Class({ /** * Returns an array of all cameras below the given Pointer. - * + * * The first camera in the array is the top-most camera in the camera list. * * @method Phaser.Cameras.Scene2D.CameraManager#getCamerasBelowPointer @@ -137054,10 +144647,10 @@ var CameraManager = new Class({ /** * Removes the given Camera, or an array of Cameras, from this Camera Manager. - * + * * If found in the Camera Manager it will be immediately removed from the local cameras array. * If also currently the 'main' camera, 'main' will be reset to be camera 0. - * + * * The removed Cameras are automatically destroyed if the `runDestroy` argument is `true`, which is the default. * If you wish to re-use the cameras then set this to `false`, but know that they will retain their references * and internal data until destroyed or re-added to a Camera Manager. @@ -137067,8 +144660,8 @@ var CameraManager = new Class({ * * @param {(Phaser.Cameras.Scene2D.Camera|Phaser.Cameras.Scene2D.Camera[])} camera - The Camera, or an array of Cameras, to be removed from this Camera Manager. * @param {boolean} [runDestroy=true] - Automatically call `Camera.destroy` on each Camera removed from this Camera Manager. - * - * @return {integer} The total number of Cameras removed. + * + * @return {number} The total number of Cameras removed. */ remove: function (camera, runDestroy) { @@ -137109,7 +144702,7 @@ var CameraManager = new Class({ /** * The internal render method. This is called automatically by the Scene and should not be invoked directly. - * + * * It will iterate through all local cameras and render them in turn, as long as they're visible and have * an alpha level > 0. * @@ -137118,10 +144711,9 @@ var CameraManager = new Class({ * @since 3.0.0 * * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Renderer that will render the children to this camera. - * @param {Phaser.GameObjects.GameObject[]} children - An array of renderable Game Objects. - * @param {number} interpolation - Interpolation value. Reserved for future use. + * @param {Phaser.GameObjects.DisplayList} children - The Display List for the Scene. */ - render: function (renderer, children, interpolation) + render: function (renderer, children) { var scene = this.scene; var cameras = this.cameras; @@ -137132,17 +144724,48 @@ var CameraManager = new Class({ if (camera.visible && camera.alpha > 0) { - // Hard-coded to 1 for now - camera.preRender(1); + camera.preRender(); - renderer.render(scene, children, interpolation, camera); + var visibleChildren = this.getVisibleChildren(children.getChildren(), camera); + + renderer.render(scene, visibleChildren, camera); } } }, + /** + * Takes an array of Game Objects and a Camera and returns a new array + * containing only those Game Objects that pass the `willRender` test + * against the given Camera. + * + * @method Phaser.Cameras.Scene2D.CameraManager#getVisibleChildren + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject[]} children - An array of Game Objects to be checked against the camera. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to filte the Game Objects against. + * + * @return {Phaser.GameObjects.GameObject[]} A filtered list of only Game Objects within the Scene that will render against the given Camera. + */ + getVisibleChildren: function (children, camera) + { + var visible = []; + + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + + if (child.willRender(camera)) + { + visible.push(child); + } + } + + return visible; + }, + /** * Resets this Camera Manager. - * + * * This will iterate through all current Cameras, destroying them all, then it will reset the * cameras array, reset the ID counter and create 1 new single camera using the default values. * @@ -137172,7 +144795,7 @@ var CameraManager = new Class({ * @protected * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -137190,9 +144813,9 @@ var CameraManager = new Class({ * @since 3.18.0 * * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. - * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions. The canvas width / height values match this. */ - onResize: function (gameSize, baseSize, displaySize, resolution, previousWidth, previousHeight) + onResize: function (gameSize, baseSize, displaySize, previousWidth, previousHeight) { for (var i = 0; i < this.cameras.length; i++) { @@ -137278,7 +144901,7 @@ module.exports = CameraManager; /***/ }), -/* 727 */ +/* 768 */ /***/ (function(module, exports) { /** @@ -137297,7 +144920,7 @@ module.exports = 'enterfullscreen'; /***/ }), -/* 728 */ +/* 769 */ /***/ (function(module, exports) { /** @@ -137316,7 +144939,7 @@ module.exports = 'fullscreenfailed'; /***/ }), -/* 729 */ +/* 770 */ /***/ (function(module, exports) { /** @@ -137335,7 +144958,7 @@ module.exports = 'fullscreenunsupported'; /***/ }), -/* 730 */ +/* 771 */ /***/ (function(module, exports) { /** @@ -137355,7 +144978,7 @@ module.exports = 'leavefullscreen'; /***/ }), -/* 731 */ +/* 772 */ /***/ (function(module, exports) { /** @@ -137367,16 +144990,18 @@ module.exports = 'leavefullscreen'; /** * The Scale Manager Orientation Change Event. * + * This event is dispatched whenever the Scale Manager detects an orientation change event from the browser. + * * @event Phaser.Scale.Events#ORIENTATION_CHANGE * @since 3.16.1 - * - * @param {string} orientation - + * + * @param {string} orientation - The new orientation value. Either `Phaser.Scale.Orientation.LANDSCAPE` or `Phaser.Scale.Orientation.PORTRAIT`. */ module.exports = 'orientationchange'; /***/ }), -/* 732 */ +/* 773 */ /***/ (function(module, exports) { /** @@ -137387,7 +145012,7 @@ module.exports = 'orientationchange'; /** * The Scale Manager Resize Event. - * + * * This event is dispatched whenever the Scale Manager detects a resize event from the browser. * It sends three parameters to the callback, each of them being Size components. You can read * the `width`, `height`, `aspectRatio` and other properties of these components to help with @@ -137395,11 +145020,10 @@ module.exports = 'orientationchange'; * * @event Phaser.Scale.Events#RESIZE * @since 3.16.1 - * + * * @param {Phaser.Structs.Size} gameSize - A reference to the Game Size component. This is the un-scaled size of your game canvas. - * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size multiplied by resolution. + * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size. * @param {Phaser.Structs.Size} displaySize - A reference to the Display Size component. This is the scaled canvas size, after applying zoom and scale mode. - * @param {number} resolution - The current resolution. Defaults to 1 at the moment. * @param {number} previousWidth - If the `gameSize` has changed, this value contains its previous width, otherwise it contains the current width. * @param {number} previousHeight - If the `gameSize` has changed, this value contains its previous height, otherwise it contains the current height. */ @@ -137407,7 +145031,7 @@ module.exports = 'resize'; /***/ }), -/* 733 */ +/* 774 */ /***/ (function(module, exports) { /** @@ -137433,7 +145057,7 @@ module.exports = 'addedtoscene'; /***/ }), -/* 734 */ +/* 775 */ /***/ (function(module, exports) { /** @@ -137458,7 +145082,7 @@ module.exports = 'boot'; /***/ }), -/* 735 */ +/* 776 */ /***/ (function(module, exports) { /** @@ -137487,7 +145111,7 @@ module.exports = 'create'; /***/ }), -/* 736 */ +/* 777 */ /***/ (function(module, exports) { /** @@ -137514,7 +145138,7 @@ module.exports = 'destroy'; /***/ }), -/* 737 */ +/* 778 */ /***/ (function(module, exports) { /** @@ -137541,7 +145165,7 @@ module.exports = 'pause'; /***/ }), -/* 738 */ +/* 779 */ /***/ (function(module, exports) { /** @@ -137578,7 +145202,7 @@ module.exports = 'postupdate'; /***/ }), -/* 739 */ +/* 780 */ /***/ (function(module, exports) { /** @@ -137615,7 +145239,7 @@ module.exports = 'preupdate'; /***/ }), -/* 740 */ +/* 781 */ /***/ (function(module, exports) { /** @@ -137643,7 +145267,7 @@ module.exports = 'ready'; /***/ }), -/* 741 */ +/* 782 */ /***/ (function(module, exports) { /** @@ -137669,7 +145293,7 @@ module.exports = 'removedfromscene'; /***/ }), -/* 742 */ +/* 783 */ /***/ (function(module, exports) { /** @@ -137705,7 +145329,7 @@ module.exports = 'render'; /***/ }), -/* 743 */ +/* 784 */ /***/ (function(module, exports) { /** @@ -137732,7 +145356,7 @@ module.exports = 'resume'; /***/ }), -/* 744 */ +/* 785 */ /***/ (function(module, exports) { /** @@ -137762,7 +145386,7 @@ module.exports = 'shutdown'; /***/ }), -/* 745 */ +/* 786 */ /***/ (function(module, exports) { /** @@ -137789,7 +145413,7 @@ module.exports = 'sleep'; /***/ }), -/* 746 */ +/* 787 */ /***/ (function(module, exports) { /** @@ -137814,7 +145438,7 @@ module.exports = 'start'; /***/ }), -/* 747 */ +/* 788 */ /***/ (function(module, exports) { /** @@ -137850,7 +145474,7 @@ module.exports = 'transitioncomplete'; /***/ }), -/* 748 */ +/* 789 */ /***/ (function(module, exports) { /** @@ -137887,7 +145511,7 @@ module.exports = 'transitioninit'; /***/ }), -/* 749 */ +/* 790 */ /***/ (function(module, exports) { /** @@ -137921,7 +145545,7 @@ module.exports = 'transitionout'; /***/ }), -/* 750 */ +/* 791 */ /***/ (function(module, exports) { /** @@ -137961,7 +145585,7 @@ module.exports = 'transitionstart'; /***/ }), -/* 751 */ +/* 792 */ /***/ (function(module, exports) { /** @@ -137996,7 +145620,7 @@ module.exports = 'transitionwake'; /***/ }), -/* 752 */ +/* 793 */ /***/ (function(module, exports) { /** @@ -138033,7 +145657,7 @@ module.exports = 'update'; /***/ }), -/* 753 */ +/* 794 */ /***/ (function(module, exports) { /** @@ -138060,7 +145684,7 @@ module.exports = 'wake'; /***/ }), -/* 754 */ +/* 795 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138075,18 +145699,18 @@ module.exports = 'wake'; module.exports = { - Config: __webpack_require__(327), - CreateRenderer: __webpack_require__(349), - DebugHeader: __webpack_require__(351), - Events: __webpack_require__(21), - TimeStep: __webpack_require__(352), - VisibilityHandler: __webpack_require__(354) + Config: __webpack_require__(338), + CreateRenderer: __webpack_require__(358), + DebugHeader: __webpack_require__(360), + Events: __webpack_require__(23), + TimeStep: __webpack_require__(361), + VisibilityHandler: __webpack_require__(363) }; /***/ }), -/* 755 */ +/* 796 */ /***/ (function(module, exports) { // shim for using process in browser @@ -138276,7 +145900,7 @@ process.umask = function() { return 0; }; /***/ }), -/* 756 */ +/* 797 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138285,7 +145909,7 @@ process.umask = function() { return 0; }; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Browser = __webpack_require__(126); +var Browser = __webpack_require__(131); /** * Determines the input support of the browser running this Phaser Game instance. @@ -138351,7 +145975,7 @@ module.exports = init(); /***/ }), -/* 757 */ +/* 798 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138360,17 +145984,17 @@ module.exports = init(); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Browser = __webpack_require__(126); +var Browser = __webpack_require__(131); /** * Determines the audio playback capabilities of the device running this Phaser Game instance. * These values are read-only and populated during the boot sequence of the game. * They are then referenced by internal game systems and are available for you to access * via `this.sys.game.device.audio` from within any Scene. - * + * * @typedef {object} Phaser.Device.Audio * @since 3.0.0 - * + * * @property {boolean} audioData - Can this device play HTML Audio tags? * @property {boolean} dolby - Can this device play EC-3 Dolby Digital Plus files? * @property {boolean} m4a - Can this device can play m4a files. @@ -138426,8 +146050,7 @@ function init () // Mimetypes accepted: // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements - // bit.ly/iphoneoscodecs - if (audioElement.canPlayType('audio/wav; codecs="1"').replace(/^no$/, '')) + if (audioElement.canPlayType('audio/wav').replace(/^no$/, '')) { Audio.wav = true; } @@ -138476,7 +146099,7 @@ module.exports = init(); /***/ }), -/* 758 */ +/* 799 */ /***/ (function(module, exports) { /** @@ -138563,7 +146186,7 @@ module.exports = init(); /***/ }), -/* 759 */ +/* 800 */ /***/ (function(module, exports) { /** @@ -138667,7 +146290,7 @@ module.exports = init(); /***/ }), -/* 760 */ +/* 801 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138682,25 +146305,25 @@ module.exports = init(); module.exports = { - Between: __webpack_require__(330), - BetweenPoints: __webpack_require__(331), - BetweenPointsY: __webpack_require__(761), - BetweenY: __webpack_require__(762), - CounterClockwise: __webpack_require__(763), - Normalize: __webpack_require__(332), - Random: __webpack_require__(764), - RandomDegrees: __webpack_require__(765), - Reverse: __webpack_require__(766), - RotateTo: __webpack_require__(767), - ShortestBetween: __webpack_require__(768), - Wrap: __webpack_require__(248), - WrapDegrees: __webpack_require__(249) + Between: __webpack_require__(341), + BetweenPoints: __webpack_require__(342), + BetweenPointsY: __webpack_require__(802), + BetweenY: __webpack_require__(803), + CounterClockwise: __webpack_require__(804), + Normalize: __webpack_require__(343), + Random: __webpack_require__(805), + RandomDegrees: __webpack_require__(806), + Reverse: __webpack_require__(807), + RotateTo: __webpack_require__(808), + ShortestBetween: __webpack_require__(809), + Wrap: __webpack_require__(261), + WrapDegrees: __webpack_require__(262) }; /***/ }), -/* 761 */ +/* 802 */ /***/ (function(module, exports) { /** @@ -138732,7 +146355,7 @@ module.exports = BetweenPointsY; /***/ }), -/* 762 */ +/* 803 */ /***/ (function(module, exports) { /** @@ -138766,7 +146389,7 @@ module.exports = BetweenY; /***/ }), -/* 763 */ +/* 804 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138811,7 +146434,7 @@ module.exports = CounterClockwise; /***/ }), -/* 764 */ +/* 805 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138821,7 +146444,7 @@ module.exports = CounterClockwise; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FloatBetween = __webpack_require__(127); +var FloatBetween = __webpack_require__(132); /** * Returns a random angle in the range [-pi, pi]. @@ -138840,7 +146463,7 @@ module.exports = Random; /***/ }), -/* 765 */ +/* 806 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138850,7 +146473,7 @@ module.exports = Random; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FloatBetween = __webpack_require__(127); +var FloatBetween = __webpack_require__(132); /** * Returns a random angle in the range [-180, 180]. @@ -138869,7 +146492,7 @@ module.exports = RandomDegrees; /***/ }), -/* 766 */ +/* 807 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138878,7 +146501,7 @@ module.exports = RandomDegrees; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Normalize = __webpack_require__(332); +var Normalize = __webpack_require__(343); /** * Reverse the given angle. @@ -138899,7 +146522,7 @@ module.exports = Reverse; /***/ }), -/* 767 */ +/* 808 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138966,7 +146589,7 @@ module.exports = RotateTo; /***/ }), -/* 768 */ +/* 809 */ /***/ (function(module, exports) { /** @@ -139015,7 +146638,7 @@ module.exports = ShortestBetween; /***/ }), -/* 769 */ +/* 810 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139030,19 +146653,19 @@ module.exports = ShortestBetween; module.exports = { - Between: __webpack_require__(55), - BetweenPoints: __webpack_require__(333), - BetweenPointsSquared: __webpack_require__(770), - Chebyshev: __webpack_require__(771), - Power: __webpack_require__(772), - Snake: __webpack_require__(773), - Squared: __webpack_require__(334) + Between: __webpack_require__(61), + BetweenPoints: __webpack_require__(344), + BetweenPointsSquared: __webpack_require__(811), + Chebyshev: __webpack_require__(812), + Power: __webpack_require__(813), + Snake: __webpack_require__(814), + Squared: __webpack_require__(345) }; /***/ }), -/* 770 */ +/* 811 */ /***/ (function(module, exports) { /** @@ -139074,7 +146697,7 @@ module.exports = DistanceBetweenPointsSquared; /***/ }), -/* 771 */ +/* 812 */ /***/ (function(module, exports) { /** @@ -139108,7 +146731,7 @@ module.exports = ChebyshevDistance; /***/ }), -/* 772 */ +/* 813 */ /***/ (function(module, exports) { /** @@ -139142,7 +146765,7 @@ module.exports = DistancePower; /***/ }), -/* 773 */ +/* 814 */ /***/ (function(module, exports) { /** @@ -139176,7 +146799,7 @@ module.exports = SnakeDistance; /***/ }), -/* 774 */ +/* 815 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139191,24 +146814,24 @@ module.exports = SnakeDistance; module.exports = { - Back: __webpack_require__(315), - Bounce: __webpack_require__(316), - Circular: __webpack_require__(317), - Cubic: __webpack_require__(318), - Elastic: __webpack_require__(319), - Expo: __webpack_require__(320), - Linear: __webpack_require__(321), - Quadratic: __webpack_require__(322), - Quartic: __webpack_require__(323), - Quintic: __webpack_require__(324), - Sine: __webpack_require__(325), - Stepped: __webpack_require__(326) + Back: __webpack_require__(326), + Bounce: __webpack_require__(327), + Circular: __webpack_require__(328), + Cubic: __webpack_require__(329), + Elastic: __webpack_require__(330), + Expo: __webpack_require__(331), + Linear: __webpack_require__(332), + Quadratic: __webpack_require__(333), + Quartic: __webpack_require__(334), + Quintic: __webpack_require__(335), + Sine: __webpack_require__(336), + Stepped: __webpack_require__(337) }; /***/ }), -/* 775 */ +/* 816 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139223,17 +146846,17 @@ module.exports = { module.exports = { - Ceil: __webpack_require__(776), - Equal: __webpack_require__(109), - Floor: __webpack_require__(777), - GreaterThan: __webpack_require__(335), - LessThan: __webpack_require__(336) + Ceil: __webpack_require__(817), + Equal: __webpack_require__(121), + Floor: __webpack_require__(818), + GreaterThan: __webpack_require__(346), + LessThan: __webpack_require__(347) }; /***/ }), -/* 776 */ +/* 817 */ /***/ (function(module, exports) { /** @@ -139264,7 +146887,7 @@ module.exports = Ceil; /***/ }), -/* 777 */ +/* 818 */ /***/ (function(module, exports) { /** @@ -139295,7 +146918,7 @@ module.exports = Floor; /***/ }), -/* 778 */ +/* 819 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139310,19 +146933,19 @@ module.exports = Floor; module.exports = { - Bezier: __webpack_require__(779), - CatmullRom: __webpack_require__(780), - CubicBezier: __webpack_require__(339), - Linear: __webpack_require__(781), - QuadraticBezier: __webpack_require__(340), - SmoothStep: __webpack_require__(341), - SmootherStep: __webpack_require__(782) + Bezier: __webpack_require__(820), + CatmullRom: __webpack_require__(821), + CubicBezier: __webpack_require__(350), + Linear: __webpack_require__(822), + QuadraticBezier: __webpack_require__(351), + SmoothStep: __webpack_require__(352), + SmootherStep: __webpack_require__(823) }; /***/ }), -/* 779 */ +/* 820 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139331,7 +146954,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bernstein = __webpack_require__(337); +var Bernstein = __webpack_require__(348); /** * A bezier interpolation method. @@ -139361,7 +146984,7 @@ module.exports = BezierInterpolation; /***/ }), -/* 780 */ +/* 821 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139370,7 +146993,7 @@ module.exports = BezierInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CatmullRom = __webpack_require__(181); +var CatmullRom = __webpack_require__(186); /** * A Catmull-Rom interpolation method. @@ -139418,7 +147041,7 @@ module.exports = CatmullRomInterpolation; /***/ }), -/* 781 */ +/* 822 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139427,7 +147050,7 @@ module.exports = CatmullRomInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Linear = __webpack_require__(124); +var Linear = __webpack_require__(130); /** * A linear interpolation method. @@ -139465,7 +147088,7 @@ module.exports = LinearInterpolation; /***/ }), -/* 782 */ +/* 823 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139474,7 +147097,7 @@ module.exports = LinearInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SmootherStep = __webpack_require__(170); +var SmootherStep = __webpack_require__(175); /** * A Smoother Step interpolation method. @@ -139498,7 +147121,7 @@ module.exports = SmootherStepInterpolation; /***/ }), -/* 783 */ +/* 824 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139513,15 +147136,15 @@ module.exports = SmootherStepInterpolation; module.exports = { - GetNext: __webpack_require__(342), - IsSize: __webpack_require__(128), - IsValue: __webpack_require__(784) + GetNext: __webpack_require__(353), + IsSize: __webpack_require__(133), + IsValue: __webpack_require__(825) }; /***/ }), -/* 784 */ +/* 825 */ /***/ (function(module, exports) { /** @@ -139549,7 +147172,7 @@ module.exports = IsValuePowerOfTwo; /***/ }), -/* 785 */ +/* 826 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139564,15 +147187,15 @@ module.exports = IsValuePowerOfTwo; module.exports = { - Ceil: __webpack_require__(343), - Floor: __webpack_require__(95), - To: __webpack_require__(786) + Ceil: __webpack_require__(134), + Floor: __webpack_require__(72), + To: __webpack_require__(827) }; /***/ }), -/* 786 */ +/* 827 */ /***/ (function(module, exports) { /** @@ -139615,7 +147238,7 @@ module.exports = SnapTo; /***/ }), -/* 787 */ +/* 828 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -140125,7 +147748,7 @@ module.exports = RandomDataGenerator; /***/ }), -/* 788 */ +/* 829 */ /***/ (function(module, exports) { /** @@ -140160,7 +147783,7 @@ module.exports = Average; /***/ }), -/* 789 */ +/* 830 */ /***/ (function(module, exports) { /** @@ -140179,7 +147802,7 @@ module.exports = Average; * * @param {number} value - The value to round. * @param {number} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * @param {number} [base=10] - The base to round in. Default is 10 for decimal. * * @return {number} The rounded value. */ @@ -140197,7 +147820,7 @@ module.exports = CeilTo; /***/ }), -/* 790 */ +/* 831 */ /***/ (function(module, exports) { /** @@ -140226,7 +147849,290 @@ module.exports = Difference; /***/ }), -/* 791 */ +/* 832 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Clamp = __webpack_require__(16); +var Class = __webpack_require__(0); +var Matrix4 = __webpack_require__(73); +var NOOP = __webpack_require__(1); + +var tempMatrix = new Matrix4(); + +/** + * @classdesc + * + * @class Euler + * @memberof Phaser.Math + * @constructor + * @since 3.50.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + */ +var Euler = new Class({ + + initialize: + + function Euler (x, y, z, order) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (z === undefined) { z = 0; } + if (order === undefined) { order = Euler.DefaultOrder; } + + this._x = x; + this._y = y; + this._z = z; + this._order = order; + + this.onChangeCallback = NOOP; + }, + + x: { + get: function () + { + return this._x; + }, + + set: function (value) + { + this._x = value; + + this.onChangeCallback(this); + } + }, + + y: { + get: function () + { + return this._y; + }, + + set: function (value) + { + this._y = value; + + this.onChangeCallback(this); + } + }, + + z: { + get: function () + { + return this._z; + }, + + set: function (value) + { + this._z = value; + + this.onChangeCallback(this); + } + }, + + order: { + get: function () + { + return this._order; + }, + + set: function (value) + { + this._order = value; + + this.onChangeCallback(this); + } + }, + + set: function (x, y, z, order) + { + if (order === undefined) { order = this._order; } + + this._x = x; + this._y = y; + this._z = z; + this._order = order; + + this.onChangeCallback(this); + + return this; + }, + + copy: function (euler) + { + return this.set(euler.x, euler.y, euler.z, euler.order); + }, + + setFromQuaternion: function (quaternion, order, update) + { + if (order === undefined) { order = this._order; } + if (update === undefined) { update = false; } + + tempMatrix.fromQuat(quaternion); + + return this.setFromRotationMatrix(tempMatrix, order, update); + }, + + setFromRotationMatrix: function (matrix, order, update) + { + if (order === undefined) { order = this._order; } + if (update === undefined) { update = false; } + + var elements = matrix.val; + + // Upper 3x3 of matrix is un-scaled rotation matrix + var m11 = elements[0]; + var m12 = elements[4]; + var m13 = elements[8]; + var m21 = elements[1]; + var m22 = elements[5]; + var m23 = elements[9]; + var m31 = elements[2]; + var m32 = elements[6]; + var m33 = elements[10]; + + var x = 0; + var y = 0; + var z = 0; + var epsilon = 0.99999; + + switch (order) + { + case 'XYZ': + { + y = Math.asin(Clamp(m13, -1, 1)); + + if (Math.abs(m13) < epsilon) + { + x = Math.atan2(-m23, m33); + z = Math.atan2(-m12, m11); + } + else + { + x = Math.atan2(m32, m22); + } + + break; + } + + case 'YXZ': + { + x = Math.asin(-Clamp(m23, -1, 1)); + + if (Math.abs(m23) < epsilon) + { + y = Math.atan2(m13, m33); + z = Math.atan2(m21, m22); + } + else + { + y = Math.atan2(-m31, m11); + } + + break; + } + + case 'ZXY': + { + x = Math.asin(Clamp(m32, -1, 1)); + + if (Math.abs(m32) < epsilon) + { + y = Math.atan2(-m31, m33); + z = Math.atan2(-m12, m22); + } + else + { + z = Math.atan2(m21, m11); + } + + break; + } + + case 'ZYX': + { + y = Math.asin(-Clamp(m31, -1, 1)); + + if (Math.abs(m31) < epsilon) + { + x = Math.atan2(m32, m33); + z = Math.atan2(m21, m11); + } + else + { + z = Math.atan2(-m12, m22); + } + + break; + } + + case 'YZX': + { + z = Math.asin(Clamp(m21, -1, 1)); + + if (Math.abs(m21) < epsilon) + { + x = Math.atan2(-m23, m22); + y = Math.atan2(-m31, m11); + } + else + { + y = Math.atan2(m13, m33); + } + + break; + } + + case 'XZY': + { + z = Math.asin(-Clamp(m12, -1, 1)); + + if (Math.abs(m12) < epsilon) + { + x = Math.atan2(m32, m22); + y = Math.atan2(m13, m11); + } + else + { + x = Math.atan2(-m23, m33); + } + + break; + } + } + + this._x = x; + this._y = y; + this._z = z; + this._order = order; + + if (update) + { + this.onChangeCallback(this); + } + + return this; + } + +}); + +Euler.RotationOrders = [ 'XYZ', 'YXZ', 'ZXY', 'ZYX', 'YZX', 'XZY' ]; + +Euler.DefaultOrder = 'XYZ'; + +module.exports = Euler; + + +/***/ }), +/* 833 */ /***/ (function(module, exports) { /** @@ -140244,8 +148150,8 @@ module.exports = Difference; * @since 3.0.0 * * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * @param {number} [place=0] - The place to round to. + * @param {number} [base=10] - The base to round in. Default is 10 for decimal. * * @return {number} The rounded value. */ @@ -140263,7 +148169,7 @@ module.exports = FloorTo; /***/ }), -/* 792 */ +/* 834 */ /***/ (function(module, exports) { /** @@ -140279,7 +148185,7 @@ module.exports = FloorTo; * @since 3.0.0 * * @param {number} distance - The distance. - * @param {integer} time - The time, in seconds. + * @param {number} time - The time, in seconds. * * @return {number} The speed, in distance per ms. * @@ -140296,7 +148202,7 @@ module.exports = GetSpeed; /***/ }), -/* 793 */ +/* 835 */ /***/ (function(module, exports) { /** @@ -140327,7 +148233,7 @@ module.exports = IsEven; /***/ }), -/* 794 */ +/* 836 */ /***/ (function(module, exports) { /** @@ -140356,7 +148262,7 @@ module.exports = IsEvenStrict; /***/ }), -/* 795 */ +/* 837 */ /***/ (function(module, exports) { /** @@ -140386,7 +148292,7 @@ module.exports = MaxAdd; /***/ }), -/* 796 */ +/* 838 */ /***/ (function(module, exports) { /** @@ -140416,7 +148322,7 @@ module.exports = MinSub; /***/ }), -/* 797 */ +/* 839 */ /***/ (function(module, exports) { /** @@ -140475,7 +148381,7 @@ module.exports = Percent; /***/ }), -/* 798 */ +/* 840 */ /***/ (function(module, exports) { /** @@ -140515,7 +148421,7 @@ module.exports = RandomXY; /***/ }), -/* 799 */ +/* 841 */ /***/ (function(module, exports) { /** @@ -140554,7 +148460,7 @@ module.exports = RandomXYZ; /***/ }), -/* 800 */ +/* 842 */ /***/ (function(module, exports) { /** @@ -140591,7 +148497,7 @@ module.exports = RandomXYZW; /***/ }), -/* 801 */ +/* 843 */ /***/ (function(module, exports) { /** @@ -140628,7 +148534,7 @@ module.exports = RotateTo; /***/ }), -/* 802 */ +/* 844 */ /***/ (function(module, exports) { /** @@ -140661,8 +148567,8 @@ module.exports = RotateTo; * @since 3.0.0 * * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. Positive to round the units, negative to round the decimal. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * @param {number} [place=0] - The place to round to. Positive to round the units, negative to round the decimal. + * @param {number} [base=10] - The base to round in. Default is 10 for decimal. * * @return {number} The rounded value. */ @@ -140680,7 +148586,7 @@ module.exports = RoundTo; /***/ }), -/* 803 */ +/* 845 */ /***/ (function(module, exports) { /** @@ -140733,7 +148639,7 @@ module.exports = SinCosTableGenerator; /***/ }), -/* 804 */ +/* 846 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -140754,9 +148660,9 @@ var Vector2 = __webpack_require__(3); * @function Phaser.Math.ToXY * @since 3.19.0 * - * @param {integer} index - The position within the grid to get the x/y value for. - * @param {integer} width - The width of the grid. - * @param {integer} height - The height of the grid. + * @param {number} index - The position within the grid to get the x/y value for. + * @param {number} width - The width of the grid. + * @param {number} height - The height of the grid. * @param {Phaser.Math.Vector2} [out] - An optional Vector2 to store the result in. If not given, a new Vector2 instance will be created. * * @return {Phaser.Math.Vector2} A Vector2 where the x and y properties contain the given grid index. @@ -140791,7 +148697,7 @@ module.exports = ToXY; /***/ }), -/* 805 */ +/* 847 */ /***/ (function(module, exports) { /** @@ -140821,7 +148727,7 @@ module.exports = Within; /***/ }), -/* 806 */ +/* 848 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -140830,9 +148736,9 @@ module.exports = Within; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector3 = __webpack_require__(81); -var Matrix4 = __webpack_require__(347); -var Quaternion = __webpack_require__(348); +var Vector3 = __webpack_require__(37); +var Matrix4 = __webpack_require__(73); +var Quaternion = __webpack_require__(357); var tmpMat4 = new Matrix4(); var tmpQuat = new Quaternion(); @@ -140869,7 +148775,103 @@ module.exports = RotateVec3; /***/ }), -/* 807 */ +/* 849 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Post-Render Event. + * + * This event is dispatched by the WebGL Renderer when all rendering, for all cameras in all Scenes, + * has completed. + * + * @event Phaser.Renderer.WebGL.Events#POST_RENDER + * @since 3.50.0 + */ +module.exports = 'postrender'; + + +/***/ }), +/* 850 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Pre-Render Event. + * + * This event is dispatched by the WebGL Renderer. This happens right at the start of the render + * process, after the context has been cleared, the scissors enabled and everything has been + * reset ready for the render. + * + * @event Phaser.Renderer.WebGL.Events#PRE_RENDER + * @since 3.50.0 + */ +module.exports = 'prerender'; + + +/***/ }), +/* 851 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Render Event. + * + * This event is dispatched by the WebGL Renderer for every camera in every Scene. + * + * It is dispatched before any of the children in the Scene have been rendered. + * + * @event Phaser.Renderer.WebGL.Events#RENDER + * @since 3.50.0 + * + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered. + */ +module.exports = 'render'; + + +/***/ }), +/* 852 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Renderer Resize Event. + * + * This event is dispatched by the WebGL Renderer when it is resized, usually as a result + * of the Scale Manager resizing. + * + * @event Phaser.Renderer.WebGL.Events#RESIZE + * @since 3.50.0 + * + * @param {number} width - The new width of the renderer. + * @param {number} height - The new height of the renderer. + */ +module.exports = 'resize'; + + +/***/ }), +/* 853 */ /***/ (function(module, exports) { module.exports = [ @@ -140882,7 +148884,7 @@ module.exports = [ 'uniform sampler2D uMaskSampler;', 'uniform bool uInvertMaskAlpha;', '', - 'void main()', + 'void main ()', '{', ' vec2 uv = gl_FragCoord.xy / uResolution;', ' vec4 mainColor = texture2D(uMainSampler, uv);', @@ -140905,7 +148907,7 @@ module.exports = [ /***/ }), -/* 808 */ +/* 854 */ /***/ (function(module, exports) { module.exports = [ @@ -140915,7 +148917,7 @@ module.exports = [ '', 'attribute vec2 inPosition;', '', - 'void main()', + 'void main ()', '{', ' gl_Position = vec4(inPosition, 0.0, 1.0);', '}', @@ -140924,7 +148926,52 @@ module.exports = [ /***/ }), -/* 809 */ +/* 855 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_GRAPHICS_FS', + '', + 'precision mediump float;', + '', + 'varying vec4 outColor;', + '', + 'void main ()', + '{', + ' gl_FragColor = vec4(outColor.bgr * outColor.a, outColor.a);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 856 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_GRAPHICS_VS', + '', + 'precision mediump float;', + '', + 'uniform mat4 uProjectionMatrix;', + '', + 'attribute vec2 inPosition;', + 'attribute vec4 inColor;', + '', + 'varying vec4 outColor;', + '', + 'void main ()', + '{', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', + '', + ' outColor = inColor;', + '}', + '' +].join('\n'); + + +/***/ }), +/* 857 */ /***/ (function(module, exports) { module.exports = [ @@ -140956,7 +149003,7 @@ module.exports = [ 'void main()', '{', ' vec3 finalColor = vec3(0.0, 0.0, 0.0);', - ' vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);', + ' vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.bgr * outTint.a, outTint.a);', ' vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;', ' vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));', ' vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;', @@ -140983,7 +149030,73 @@ module.exports = [ /***/ }), -/* 810 */ +/* 858 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_POINTLIGHT_FS', + '', + 'precision mediump float;', + '', + 'uniform vec2 uResolution;', + '', + 'varying vec4 lightPosition;', + 'varying vec4 lightColor;', + 'varying float lightRadius;', + '', + 'void main ()', + '{', + ' vec2 center = vec2((lightPosition.x + 1.0) * uResolution.x, (lightPosition.y + 1.0) * uResolution.y);', + '', + ' float distance = length(center - gl_FragCoord.xy);', + '', + ' float attenuation = 1.0 / (0.01 * distance * distance);', + ' float radius = 1.0 - min(distance, lightRadius) / lightRadius;', + ' float intensity = smoothstep(0.0, 1.0, min(attenuation, radius));', + '', + ' vec4 color = vec4(intensity, intensity, intensity, 0.0) * lightColor;', + '', + ' gl_FragColor = vec4(color.rgb * lightColor.a, color.a);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 859 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_POINTLIGHT_VS', + '', + 'precision mediump float;', + '', + 'uniform mat4 uProjectionMatrix;', + '', + 'attribute vec2 inPosition;', + 'attribute vec2 inLightPosition;', + 'attribute vec4 inLightColor;', + 'attribute float inLightRadius;', + 'attribute float inLightIntensity;', + '', + 'varying vec4 lightPosition;', + 'varying vec4 lightColor;', + 'varying float lightRadius;', + '', + 'void main ()', + '{', + ' lightColor = inLightColor;', + ' lightRadius = inLightRadius;', + ' lightPosition = uProjectionMatrix * vec4(inLightPosition, 1.0, 1.0);', + '', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 860 */ /***/ (function(module, exports) { module.exports = [ @@ -140998,25 +149111,21 @@ module.exports = [ 'varying float outTintEffect;', 'varying vec4 outTint;', '', - 'void main()', + 'void main ()', '{', ' vec4 texture;', '', ' %forloop%', '', - ' vec4 texel = vec4(outTint.rgb * outTint.a, outTint.a);', - ' vec4 color = texture;', + ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', '', - ' if (outTintEffect == 0.0)', - ' {', - ' // Multiply texture tint', - ' color = texture * texel;', - ' }', - ' else if (outTintEffect == 1.0)', + ' // Multiply texture tint', + ' vec4 color = texture * texel;', + '', + ' if (outTintEffect == 1.0)', ' {', ' // Solid color + texture alpha', - ' color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);', - ' color.a = texture.a * texel.a;', + ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', ' }', ' else if (outTintEffect == 2.0)', ' {', @@ -141031,7 +149140,7 @@ module.exports = [ /***/ }), -/* 811 */ +/* 861 */ /***/ (function(module, exports) { module.exports = [ @@ -141040,8 +149149,6 @@ module.exports = [ 'precision mediump float;', '', 'uniform mat4 uProjectionMatrix;', - 'uniform mat4 uViewMatrix;', - 'uniform mat4 uModelMatrix;', '', 'attribute vec2 inPosition;', 'attribute vec2 inTexCoord;', @@ -141056,20 +149163,19 @@ module.exports = [ '', 'void main ()', '{', - ' gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', '', ' outTexCoord = inTexCoord;', ' outTexId = inTexId;', ' outTint = inTint;', ' outTintEffect = inTintEffect;', '}', - '', '' ].join('\n'); /***/ }), -/* 812 */ +/* 862 */ /***/ (function(module, exports) { module.exports = [ @@ -141083,22 +149189,18 @@ module.exports = [ 'varying float outTintEffect;', 'varying vec4 outTint;', '', - 'void main()', + 'void main ()', '{', ' vec4 texture = texture2D(uMainSampler, outTexCoord);', - ' vec4 texel = vec4(outTint.rgb * outTint.a, outTint.a);', - ' vec4 color = texture;', + ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', '', - ' if (outTintEffect == 0.0)', - ' {', - ' // Multiply texture tint', - ' color = texture * texel;', - ' }', - ' else if (outTintEffect == 1.0)', + ' // Multiply texture tint', + ' vec4 color = texture * texel;', + '', + ' if (outTintEffect == 1.0)', ' {', ' // Solid color + texture alpha', - ' color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);', - ' color.a = texture.a * texel.a;', + ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', ' }', ' else if (outTintEffect == 2.0)', ' {', @@ -141113,7 +149215,7 @@ module.exports = [ /***/ }), -/* 813 */ +/* 863 */ /***/ (function(module, exports) { module.exports = [ @@ -141122,11 +149224,10 @@ module.exports = [ 'precision mediump float;', '', 'uniform mat4 uProjectionMatrix;', - 'uniform mat4 uViewMatrix;', - 'uniform mat4 uModelMatrix;', '', 'attribute vec2 inPosition;', 'attribute vec2 inTexCoord;', + 'attribute float inTexId;', 'attribute float inTintEffect;', 'attribute vec4 inTint;', '', @@ -141136,7 +149237,7 @@ module.exports = [ '', 'void main ()', '{', - ' gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', '', ' outTexCoord = inTexCoord;', ' outTint = inTint;', @@ -141147,7 +149248,688 @@ module.exports = [ /***/ }), -/* 814 */ +/* 864 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var AddBlendFS = __webpack_require__(865); +var Class = __webpack_require__(0); +var ColorMatrix = __webpack_require__(264); +var ColorMatrixFS = __webpack_require__(866); +var CopyFS = __webpack_require__(867); +var GetFastValue = __webpack_require__(2); +var LinearBlendFS = __webpack_require__(868); +var QuadVS = __webpack_require__(579); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); + +/** + * @classdesc + * The Utility Pipeline is a special-use pipeline that belongs to the Pipeline Manager. + * + * It provides 4 shaders and handy associated methods: + * + * 1) Copy Shader. A fast texture to texture copy shader with optional brightness setting. + * 2) Additive Blend Mode Shader. Blends two textures using an additive blend mode. + * 3) Linear Blend Mode Shader. Blends two textures using a linear blend mode. + * 4) Color Matrix Copy Shader. Draws a texture to a target using a Color Matrix. + * + * You typically do not extend or access this pipeline directly, but instead go + * via the following methods in the Pipeline Manager: + * + * `copyFrame` + * `drawFrame` + * `blendFrames` + * `blendFramesAdditive` + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * + * This pipeline has a hard-coded batch size of 1 and a hard coded set of vertices. + * + * @class UtilityPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + */ +var UtilityPipeline = new Class({ + + Extends: WebGLPipeline, + + initialize: + + function UtilityPipeline (config) + { + config.renderTarget = GetFastValue(config, 'renderTarget', [ + { + scale: 1 + }, + { + scale: 1 + }, + { + scale: 0.5 + }, + { + scale: 0.5 + } + ]); + + config.vertShader = GetFastValue(config, 'vertShader', QuadVS); + + config.shaders = GetFastValue(config, 'shaders', [ + { + name: 'Copy', + fragShader: CopyFS, + uniforms: [ + 'uMainSampler', + 'uBrightness' + ] + }, + { + name: 'AddBlend', + fragShader: AddBlendFS, + uniforms: [ + 'uMainSampler1', + 'uMainSampler2', + 'uStrength' + ] + }, + { + name: 'LinearBlend', + fragShader: LinearBlendFS, + uniforms: [ + 'uMainSampler1', + 'uMainSampler2', + 'uStrength' + ] + }, + { + name: 'ColorMatrix', + fragShader: ColorMatrixFS, + uniforms: [ + 'uMainSampler', + 'uColorMatrix', + 'uAlpha' + ] + } + ]); + + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTexCoord', + size: 2, + type: WEBGL_CONST.FLOAT + } + ]); + + // x, y, u, v (x/y in NDC) + config.vertices = new Float32Array([ + -1, -1, 0, 0, + -1, 1, 0, 1, + 1, 1, 1, 1, + -1, -1, 0, 0, + 1, 1, 1, 1, + 1, -1, 1, 0 + ]); + + config.batchSize = 1; + + WebGLPipeline.call(this, config); + + /** + * A default Color Matrix, used by the Color Matrix Shader when one + * isn't provided. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#colorMatrix + * @type {Phaser.Display.ColorMatrix} + * @since 3.50.0 + */ + this.colorMatrix = new ColorMatrix(); + + /** + * A reference to the Copy Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @default null + * @since 3.50.0 + */ + this.copyShader; + + /** + * A reference to the Additive Blend Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#addShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.addShader; + + /** + * A reference to the Linear Blend Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#linearShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.linearShader; + + /** + * A reference to the Color Matrix Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#colorMatrixShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.colorMatrixShader; + + /** + * A reference to the Full Frame 1 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#fullFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.fullFrame1; + + /** + * A reference to the Full Frame 2 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#fullFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.fullFrame2; + + /** + * A reference to the Half Frame 1 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#halfFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.halfFrame1; + + /** + * A reference to the Half Frame 2 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#halfFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.halfFrame2; + }, + + boot: function () + { + WebGLPipeline.prototype.boot.call(this); + + var shaders = this.shaders; + var targets = this.renderTargets; + + this.copyShader = shaders[0]; + this.addShader = shaders[1]; + this.linearShader = shaders[2]; + this.colorMatrixShader = shaders[3]; + + this.fullFrame1 = targets[0]; + this.fullFrame2 = targets[1]; + this.halfFrame1 = targets[2]; + this.halfFrame2 = targets[3]; + }, + + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * You can optionally set the brightness factor of the copy. + * + * The difference between this method and `drawFrame` is that this method + * uses a faster copy shader, where only the brightness can be modified. + * If you need color level manipulation, see `drawFrame` instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + copyFrame: function (source, target, brightness, clear, clearAlpha) + { + if (brightness === undefined) { brightness = 1; } + if (clear === undefined) { clear = true; } + if (clearAlpha === undefined) { clearAlpha = true; } + + var gl = this.gl; + + this.set1i('uMainSampler', 0, this.copyShader); + this.set1f('uBrightness', brightness, this.copyShader); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); + + if (target) + { + gl.viewport(0, 0, target.width, target.height); + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + } + else + { + gl.viewport(0, 0, source.width, source.height); + } + + if (clear) + { + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + } + + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, + + /** + * Pops the framebuffer from the renderers FBO stack and sets that as the active target, + * then draws the `source` Render Target to it. It then resets the renderer textures. + * + * This should be done when you need to draw the _final_ results of a pipeline to the game + * canvas, or the next framebuffer in line on the FBO stack. You should only call this once + * in the `onDraw` handler and it should be the final thing called. Be careful not to call + * this if you need to actually use the pipeline shader, instead of the copy shader. In + * those cases, use the `bindAndDraw` method. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyToGame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + */ + copyToGame: function (source) + { + var gl = this.gl; + + this.set1i('uMainSampler', 0, this.copyShader); + this.set1f('uBrightness', 1, this.copyShader); + + this.renderer.popFramebuffer(); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); + + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + this.renderer.resetTextures(); + }, + + /** + * Copy the `source` Render Target to the `target` Render Target, using the + * given Color Matrix. + * + * The difference between this method and `copyFrame` is that this method + * uses a color matrix shader, where you have full control over the luminance + * values used during the copy. If you don't need this, you can use the faster + * `copyFrame` method instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#drawFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Display.ColorMatrix} [colorMatrix] - The Color Matrix to use when performing the draw. + */ + drawFrame: function (source, target, clearAlpha, colorMatrix) + { + if (clearAlpha === undefined) { clearAlpha = true; } + if (colorMatrix === undefined) { colorMatrix = this.colorMatrix; } + + var gl = this.gl; + + this.set1i('uMainSampler', 0, this.colorMatrixShader); + this.set1fv('uColorMatrix', colorMatrix.getData(), this.colorMatrixShader); + this.set1f('uAlpha', colorMatrix.alpha, this.colorMatrixShader); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); + + if (target) + { + gl.viewport(0, 0, target.width, target.height); + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + } + else + { + gl.viewport(0, 0, source.width, source.height); + } + + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using a linear blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blendFrames + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Renderer.WebGL.WebGLShader} [blendShader] - The shader to use during the blend copy. + */ + blendFrames: function (source1, source2, target, strength, clearAlpha, blendShader) + { + if (strength === undefined) { strength = 1; } + if (clearAlpha === undefined) { clearAlpha = true; } + if (blendShader === undefined) { blendShader = this.linearShader; } + + var gl = this.gl; + + this.set1i('uMainSampler1', 0, blendShader); + this.set1i('uMainSampler2', 1, blendShader); + this.set1f('uStrength', strength, blendShader); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source1.texture); + + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_2D, source2.texture); + + if (target) + { + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + gl.viewport(0, 0, target.width, target.height); + } + else + { + gl.viewport(0, 0, source1.width, source1.height); + } + + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using an additive blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blendFramesAdditive + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) + { + this.blendFrames(source1, source2, target, strength, clearAlpha, this.addShader); + }, + + /** + * Clears the given Render Target. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#clearFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + clearFrame: function (target, clearAlpha) + { + if (clearAlpha === undefined) { clearAlpha = true; } + + var gl = this.gl; + + gl.viewport(0, 0, target.width, target.height); + + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + + var fbo = this.renderer.currentFramebuffer; + + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + } + +}); + +module.exports = UtilityPipeline; + + +/***/ }), +/* 865 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_ADD_BLEND_FS', + '', + 'precision mediump float;', + '', + 'uniform sampler2D uMainSampler1;', + 'uniform sampler2D uMainSampler2;', + 'uniform float uStrength;', + '', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' vec4 frame1 = texture2D(uMainSampler1, outTexCoord);', + ' vec4 frame2 = texture2D(uMainSampler2, outTexCoord);', + '', + ' gl_FragColor = frame1 + frame2 * uStrength;', + '}', + '' +].join('\n'); + + +/***/ }), +/* 866 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_COLORMATRIX_FS', + '', + 'precision mediump float;', + '', + 'uniform sampler2D uMainSampler;', + 'uniform float uColorMatrix[20];', + 'uniform float uAlpha;', + '', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' vec4 c = texture2D(uMainSampler, outTexCoord);', + '', + ' if (uAlpha == 0.0)', + ' {', + ' gl_FragColor = c;', + '', + ' return;', + ' }', + '', + ' if (c.a > 0.0)', + ' {', + ' c.rgb /= c.a;', + ' }', + '', + ' vec4 result;', + '', + ' result.r = (uColorMatrix[0] * c.r) + (uColorMatrix[1] * c.g) + (uColorMatrix[2] * c.b) + (uColorMatrix[3] * c.a) + uColorMatrix[4];', + ' result.g = (uColorMatrix[5] * c.r) + (uColorMatrix[6] * c.g) + (uColorMatrix[7] * c.b) + (uColorMatrix[8] * c.a) + uColorMatrix[9];', + ' result.b = (uColorMatrix[10] * c.r) + (uColorMatrix[11] * c.g) + (uColorMatrix[12] * c.b) + (uColorMatrix[13] * c.a) + uColorMatrix[14];', + ' result.a = (uColorMatrix[15] * c.r) + (uColorMatrix[16] * c.g) + (uColorMatrix[17] * c.b) + (uColorMatrix[18] * c.a) + uColorMatrix[19];', + '', + ' vec3 rgb = mix(c.rgb, result.rgb, uAlpha);', + '', + ' rgb *= result.a;', + '', + ' gl_FragColor = vec4(rgb, result.a);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 867 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_COPY_FS', + '', + 'precision mediump float;', + '', + 'uniform sampler2D uMainSampler;', + 'uniform float uBrightness;', + '', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' gl_FragColor = texture2D(uMainSampler, outTexCoord) * uBrightness;', + '}', + '' +].join('\n'); + + +/***/ }), +/* 868 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_LINEAR_BLEND_FS', + '', + 'precision mediump float;', + '', + 'uniform sampler2D uMainSampler1;', + 'uniform sampler2D uMainSampler2;', + 'uniform float uStrength;', + '', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' vec4 frame1 = texture2D(uMainSampler1, outTexCoord);', + ' vec4 frame2 = texture2D(uMainSampler2, outTexCoord);', + '', + ' gl_FragColor = mix(frame1, frame2 * uStrength, 0.5);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 869 */ /***/ (function(module, exports) { /** @@ -141173,7 +149955,7 @@ module.exports = 'addtexture'; /***/ }), -/* 815 */ +/* 870 */ /***/ (function(module, exports) { /** @@ -141199,7 +149981,7 @@ module.exports = 'onerror'; /***/ }), -/* 816 */ +/* 871 */ /***/ (function(module, exports) { /** @@ -141228,7 +150010,7 @@ module.exports = 'onload'; /***/ }), -/* 817 */ +/* 872 */ /***/ (function(module, exports) { /** @@ -141251,7 +150033,7 @@ module.exports = 'ready'; /***/ }), -/* 818 */ +/* 873 */ /***/ (function(module, exports) { /** @@ -141279,7 +150061,7 @@ module.exports = 'removetexture'; /***/ }), -/* 819 */ +/* 874 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -141294,14 +150076,14 @@ module.exports = 'removetexture'; module.exports = { - GenerateTexture: __webpack_require__(355), - Palettes: __webpack_require__(820) + GenerateTexture: __webpack_require__(364), + Palettes: __webpack_require__(875) }; /***/ }), -/* 820 */ +/* 875 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -141316,17 +150098,17 @@ module.exports = { module.exports = { - ARNE16: __webpack_require__(356), - C64: __webpack_require__(821), - CGA: __webpack_require__(822), - JMP: __webpack_require__(823), - MSX: __webpack_require__(824) + ARNE16: __webpack_require__(365), + C64: __webpack_require__(876), + CGA: __webpack_require__(877), + JMP: __webpack_require__(878), + MSX: __webpack_require__(879) }; /***/ }), -/* 821 */ +/* 876 */ /***/ (function(module, exports) { /** @@ -141364,7 +150146,7 @@ module.exports = { /***/ }), -/* 822 */ +/* 877 */ /***/ (function(module, exports) { /** @@ -141402,7 +150184,7 @@ module.exports = { /***/ }), -/* 823 */ +/* 878 */ /***/ (function(module, exports) { /** @@ -141440,7 +150222,7 @@ module.exports = { /***/ }), -/* 824 */ +/* 879 */ /***/ (function(module, exports) { /** @@ -141478,7 +150260,7 @@ module.exports = { /***/ }), -/* 825 */ +/* 880 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -141492,20 +150274,20 @@ module.exports = { */ module.exports = { - Path: __webpack_require__(826), - MoveTo: __webpack_require__(360), + Path: __webpack_require__(881), + MoveTo: __webpack_require__(369), - CubicBezier: __webpack_require__(357), - Curve: __webpack_require__(83), - Ellipse: __webpack_require__(358), - Line: __webpack_require__(359), - QuadraticBezier: __webpack_require__(361), - Spline: __webpack_require__(362) + CubicBezier: __webpack_require__(366), + Curve: __webpack_require__(88), + Ellipse: __webpack_require__(367), + Line: __webpack_require__(368), + QuadraticBezier: __webpack_require__(370), + Spline: __webpack_require__(371) }; /***/ }), -/* 826 */ +/* 881 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -141517,14 +150299,14 @@ module.exports = { // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) var Class = __webpack_require__(0); -var CubicBezierCurve = __webpack_require__(357); -var EllipseCurve = __webpack_require__(358); +var CubicBezierCurve = __webpack_require__(366); +var EllipseCurve = __webpack_require__(367); var GameObjectFactory = __webpack_require__(5); -var LineCurve = __webpack_require__(359); -var MovePathTo = __webpack_require__(360); -var QuadraticBezierCurve = __webpack_require__(361); +var LineCurve = __webpack_require__(368); +var MovePathTo = __webpack_require__(369); +var QuadraticBezierCurve = __webpack_require__(370); var Rectangle = __webpack_require__(9); -var SplineCurve = __webpack_require__(362); +var SplineCurve = __webpack_require__(371); var Vector2 = __webpack_require__(3); var MATH_CONST = __webpack_require__(13); @@ -141786,7 +150568,7 @@ var Path = new Class({ * @generic {Phaser.GameObjects.Graphics} G - [out,$return] * * @param {Phaser.GameObjects.Graphics} graphics - The Graphics Game Object to draw to. - * @param {integer} [pointsTotal=32] - The number of points to draw for each Curve. Higher numbers result in a smoother curve but require more processing. + * @param {number} [pointsTotal=32] - The number of points to draw for each Curve. Higher numbers result in a smoother curve but require more processing. * * @return {Phaser.GameObjects.Graphics} The Graphics object which was drawn to. */ @@ -141815,8 +150597,8 @@ var Path = new Class({ * * @param {number} [xRadius=0] - The horizontal radius of ellipse. * @param {number} [yRadius=0] - The vertical radius of ellipse. - * @param {integer} [startAngle=0] - The start angle of the ellipse, in degrees. - * @param {integer} [endAngle=360] - The end angle of the ellipse, in degrees. + * @param {number} [startAngle=0] - The start angle of the ellipse, in degrees. + * @param {number} [endAngle=360] - The end angle of the ellipse, in degrees. * @param {boolean} [clockwise=false] - Whether the ellipse angles are given as clockwise (`true`) or counter-clockwise (`false`). * @param {number} [rotation=0] - The rotation of the ellipse, in degrees. * @@ -141902,7 +150684,7 @@ var Path = new Class({ * @generic {Phaser.Math.Vector2} O - [out,$return] * * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. - * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. Higher values are more accurate at the cost of calculation speed. + * @param {number} [accuracy=16] - The accuracy of the bounds calculations. Higher values are more accurate at the cost of calculation speed. * * @return {Phaser.Geom.Rectangle} The modified `out` Rectangle, or a new Rectangle if none was provided. */ @@ -142084,7 +150866,7 @@ var Path = new Class({ * @method Phaser.Curves.Path#getPoints * @since 3.0.0 * - * @param {integer} [divisions=12] - The number of divisions per resolution per curve. + * @param {number} [divisions=12] - The number of divisions per resolution per curve. * * @return {Phaser.Math.Vector2[]} An array of Vector2 objects that containing the points along the Path. */ @@ -142161,7 +150943,7 @@ var Path = new Class({ * @method Phaser.Curves.Path#getSpacedPoints * @since 3.0.0 * - * @param {integer} [divisions=40] - The amount of points to divide this Path into. + * @param {number} [divisions=40] - The amount of points to divide this Path into. * * @return {Phaser.Math.Vector2[]} A list of the points this path was subdivided into. */ @@ -142394,7 +151176,7 @@ module.exports = Path; /***/ }), -/* 827 */ +/* 882 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142409,15 +151191,15 @@ module.exports = Path; module.exports = { - DataManager: __webpack_require__(120), - DataManagerPlugin: __webpack_require__(828), - Events: __webpack_require__(293) + DataManager: __webpack_require__(97), + DataManagerPlugin: __webpack_require__(883), + Events: __webpack_require__(307) }; /***/ }), -/* 828 */ +/* 883 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142427,8 +151209,8 @@ module.exports = { */ var Class = __webpack_require__(0); -var DataManager = __webpack_require__(120); -var PluginCache = __webpack_require__(23); +var DataManager = __webpack_require__(97); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); /** @@ -142544,7 +151326,7 @@ module.exports = DataManagerPlugin; /***/ }), -/* 829 */ +/* 884 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142559,18 +151341,20 @@ module.exports = DataManagerPlugin; module.exports = { - Align: __webpack_require__(830), - BaseShader: __webpack_require__(363), - Bounds: __webpack_require__(833), - Canvas: __webpack_require__(837), - Color: __webpack_require__(364), - Masks: __webpack_require__(846) + Align: __webpack_require__(885), + BaseShader: __webpack_require__(372), + Bounds: __webpack_require__(888), + Canvas: __webpack_require__(892), + Color: __webpack_require__(373), + ColorMatrix: __webpack_require__(264), + Masks: __webpack_require__(902), + RGB: __webpack_require__(376) }; /***/ }), -/* 830 */ +/* 885 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142579,8 +151363,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(108); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(120); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Display.Align @@ -142588,8 +151372,8 @@ var Extend = __webpack_require__(19); var Align = { - In: __webpack_require__(831), - To: __webpack_require__(832) + In: __webpack_require__(886), + To: __webpack_require__(887) }; @@ -142600,7 +151384,7 @@ module.exports = Align; /***/ }), -/* 831 */ +/* 886 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142615,22 +151399,22 @@ module.exports = Align; module.exports = { - BottomCenter: __webpack_require__(267), - BottomLeft: __webpack_require__(268), - BottomRight: __webpack_require__(269), - Center: __webpack_require__(270), - LeftCenter: __webpack_require__(272), - QuickSet: __webpack_require__(266), - RightCenter: __webpack_require__(273), - TopCenter: __webpack_require__(274), - TopLeft: __webpack_require__(275), - TopRight: __webpack_require__(276) + BottomCenter: __webpack_require__(282), + BottomLeft: __webpack_require__(283), + BottomRight: __webpack_require__(284), + Center: __webpack_require__(285), + LeftCenter: __webpack_require__(287), + QuickSet: __webpack_require__(281), + RightCenter: __webpack_require__(288), + TopCenter: __webpack_require__(289), + TopLeft: __webpack_require__(290), + TopRight: __webpack_require__(291) }; /***/ }), -/* 832 */ +/* 887 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142645,25 +151429,25 @@ module.exports = { module.exports = { - BottomCenter: __webpack_require__(254), - BottomLeft: __webpack_require__(255), - BottomRight: __webpack_require__(256), - LeftBottom: __webpack_require__(257), - LeftCenter: __webpack_require__(258), - LeftTop: __webpack_require__(259), - QuickSet: __webpack_require__(253), - RightBottom: __webpack_require__(260), - RightCenter: __webpack_require__(261), - RightTop: __webpack_require__(262), - TopCenter: __webpack_require__(263), - TopLeft: __webpack_require__(264), - TopRight: __webpack_require__(265) + BottomCenter: __webpack_require__(269), + BottomLeft: __webpack_require__(270), + BottomRight: __webpack_require__(271), + LeftBottom: __webpack_require__(272), + LeftCenter: __webpack_require__(273), + LeftTop: __webpack_require__(274), + QuickSet: __webpack_require__(268), + RightBottom: __webpack_require__(275), + RightCenter: __webpack_require__(276), + RightTop: __webpack_require__(277), + TopCenter: __webpack_require__(278), + TopLeft: __webpack_require__(279), + TopRight: __webpack_require__(280) }; /***/ }), -/* 833 */ +/* 888 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142678,28 +151462,28 @@ module.exports = { module.exports = { - CenterOn: __webpack_require__(271), - GetBottom: __webpack_require__(35), - GetBounds: __webpack_require__(834), - GetCenterX: __webpack_require__(77), - GetCenterY: __webpack_require__(79), - GetLeft: __webpack_require__(36), - GetOffsetX: __webpack_require__(835), - GetOffsetY: __webpack_require__(836), - GetRight: __webpack_require__(37), - GetTop: __webpack_require__(38), - SetBottom: __webpack_require__(48), - SetCenterX: __webpack_require__(78), - SetCenterY: __webpack_require__(80), - SetLeft: __webpack_require__(46), - SetRight: __webpack_require__(47), - SetTop: __webpack_require__(45) + CenterOn: __webpack_require__(286), + GetBottom: __webpack_require__(40), + GetBounds: __webpack_require__(889), + GetCenterX: __webpack_require__(83), + GetCenterY: __webpack_require__(85), + GetLeft: __webpack_require__(41), + GetOffsetX: __webpack_require__(890), + GetOffsetY: __webpack_require__(891), + GetRight: __webpack_require__(42), + GetTop: __webpack_require__(43), + SetBottom: __webpack_require__(54), + SetCenterX: __webpack_require__(84), + SetCenterY: __webpack_require__(86), + SetLeft: __webpack_require__(52), + SetRight: __webpack_require__(53), + SetTop: __webpack_require__(51) }; /***/ }), -/* 834 */ +/* 889 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142708,10 +151492,10 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetLeft = __webpack_require__(36); -var GetRight = __webpack_require__(37); -var GetTop = __webpack_require__(38); +var GetBottom = __webpack_require__(40); +var GetLeft = __webpack_require__(41); +var GetRight = __webpack_require__(42); +var GetTop = __webpack_require__(43); /** * Returns the unrotated bounds of the Game Object as a rectangle. @@ -142743,7 +151527,7 @@ module.exports = GetBounds; /***/ }), -/* 835 */ +/* 890 */ /***/ (function(module, exports) { /** @@ -142773,7 +151557,7 @@ module.exports = GetOffsetX; /***/ }), -/* 836 */ +/* 891 */ /***/ (function(module, exports) { /** @@ -142803,7 +151587,7 @@ module.exports = GetOffsetY; /***/ }), -/* 837 */ +/* 892 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142818,17 +151602,17 @@ module.exports = GetOffsetY; module.exports = { - CanvasInterpolation: __webpack_require__(350), - CanvasPool: __webpack_require__(26), - Smoothing: __webpack_require__(177), - TouchAction: __webpack_require__(838), - UserSelect: __webpack_require__(839) + CanvasInterpolation: __webpack_require__(359), + CanvasPool: __webpack_require__(31), + Smoothing: __webpack_require__(184), + TouchAction: __webpack_require__(893), + UserSelect: __webpack_require__(894) }; /***/ }), -/* 838 */ +/* 893 */ /***/ (function(module, exports) { /** @@ -142863,7 +151647,7 @@ module.exports = TouchAction; /***/ }), -/* 839 */ +/* 894 */ /***/ (function(module, exports) { /** @@ -142910,7 +151694,75 @@ module.exports = UserSelect; /***/ }), -/* 840 */ +/* 895 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetColor = __webpack_require__(100); + +/** + * Return an array of Colors in a Color Spectrum. + * + * @function Phaser.Display.Color.ColorSpectrum + * @since 3.50.0 + * + * @return {Phaser.Types.Display.ColorObject[]} An array containing 1024 elements, where each contains a Color Object. + */ +var ColorSpectrum = function () +{ + var colors = []; + + var range = 255; + + var i; + var r = 255; + var g = 0; + var b = 0; + + // Red to Yellow + for (i = 0; i <= range; i++) + { + colors.push({ r: r, g: i, b: b, color: GetColor(r, i, b) }); + } + + g = 255; + + // Yellow to Green + for (i = range; i >= 0; i--) + { + colors.push({ r: i, g: g, b: b, color: GetColor(i, g, b) }); + } + + r = 0; + + // Green to Blue + for (i = 0; i <= range; i++, g--) + { + colors.push({ r: r, g: g, b: i, color: GetColor(r, g, i) }); + } + + g = 0; + b = 255; + + // Blue to Red + for (i = 0; i <= range; i++, b--, r++) + { + colors.push({ r: r, g: g, b: b, color: GetColor(r, g, b) }); + } + + return colors; +}; + +module.exports = ColorSpectrum; + + +/***/ }), +/* 896 */ /***/ (function(module, exports) { /** @@ -142950,7 +151802,7 @@ module.exports = ColorToRGBA; /***/ }), -/* 841 */ +/* 897 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -142959,8 +151811,8 @@ module.exports = ColorToRGBA; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); -var HueToComponent = __webpack_require__(366); +var Color = __webpack_require__(36); +var HueToComponent = __webpack_require__(375); /** * Converts HSL (hue, saturation and lightness) values to a Phaser Color object. @@ -143000,7 +151852,7 @@ module.exports = HSLToColor; /***/ }), -/* 842 */ +/* 898 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143009,7 +151861,7 @@ module.exports = HSLToColor; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HSVToRGB = __webpack_require__(176); +var HSVToRGB = __webpack_require__(180); /** * Get HSV color wheel values in an array which will be 360 elements in size. @@ -143041,7 +151893,7 @@ module.exports = HSVColorWheel; /***/ }), -/* 843 */ +/* 899 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143050,7 +151902,7 @@ module.exports = HSVColorWheel; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Linear = __webpack_require__(124); +var Linear = __webpack_require__(130); /** * @namespace Phaser.Display.Color.Interpolate @@ -143149,7 +152001,7 @@ module.exports = { /***/ }), -/* 844 */ +/* 900 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143158,8 +152010,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Between = __webpack_require__(182); -var Color = __webpack_require__(32); +var Between = __webpack_require__(187); +var Color = __webpack_require__(36); /** * Creates a new Color object where the r, g, and b values have been set to random values @@ -143168,8 +152020,8 @@ var Color = __webpack_require__(32); * @function Phaser.Display.Color.RandomRGB * @since 3.0.0 * - * @param {integer} [min=0] - The minimum value to set the random range from (between 0 and 255) - * @param {integer} [max=255] - The maximum value to set the random range from (between 0 and 255) + * @param {number} [min=0] - The minimum value to set the random range from (between 0 and 255) + * @param {number} [max=255] - The maximum value to set the random range from (between 0 and 255) * * @return {Phaser.Display.Color} A Color object. */ @@ -143185,7 +152037,7 @@ module.exports = RandomRGB; /***/ }), -/* 845 */ +/* 901 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143194,7 +152046,7 @@ module.exports = RandomRGB; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ComponentToHex = __webpack_require__(365); +var ComponentToHex = __webpack_require__(374); /** * Converts the color values into an HTML compatible color string, prefixed with either `#` or `0x`. @@ -143202,10 +152054,10 @@ var ComponentToHex = __webpack_require__(365); * @function Phaser.Display.Color.RGBToString * @since 3.0.0 * - * @param {integer} r - The red color value. A number between 0 and 255. - * @param {integer} g - The green color value. A number between 0 and 255. - * @param {integer} b - The blue color value. A number between 0 and 255. - * @param {integer} [a=255] - The alpha value. A number between 0 and 255. + * @param {number} r - The red color value. A number between 0 and 255. + * @param {number} g - The green color value. A number between 0 and 255. + * @param {number} b - The blue color value. A number between 0 and 255. + * @param {number} [a=255] - The alpha value. A number between 0 and 255. * @param {string} [prefix=#] - The prefix of the string. Either `#` or `0x`. * * @return {string} A string-based representation of the color values. @@ -143229,7 +152081,7 @@ module.exports = RGBToString; /***/ }), -/* 846 */ +/* 902 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143244,14 +152096,14 @@ module.exports = RGBToString; module.exports = { - BitmapMask: __webpack_require__(287), - GeometryMask: __webpack_require__(288) + BitmapMask: __webpack_require__(302), + GeometryMask: __webpack_require__(303) }; /***/ }), -/* 847 */ +/* 903 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143266,14 +152118,14 @@ module.exports = { var Dom = { - AddToDOM: __webpack_require__(131), - DOMContentLoaded: __webpack_require__(367), - GetInnerHeight: __webpack_require__(368), - GetScreenOrientation: __webpack_require__(369), - GetTarget: __webpack_require__(374), - ParseXML: __webpack_require__(375), - RemoveFromDOM: __webpack_require__(188), - RequestAnimationFrame: __webpack_require__(353) + AddToDOM: __webpack_require__(137), + DOMContentLoaded: __webpack_require__(377), + GetInnerHeight: __webpack_require__(378), + GetScreenOrientation: __webpack_require__(379), + GetTarget: __webpack_require__(384), + ParseXML: __webpack_require__(385), + RemoveFromDOM: __webpack_require__(193), + RequestAnimationFrame: __webpack_require__(362) }; @@ -143281,7 +152133,7 @@ module.exports = Dom; /***/ }), -/* 848 */ +/* 904 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143294,11 +152146,11 @@ module.exports = Dom; * @namespace Phaser.Events */ -module.exports = { EventEmitter: __webpack_require__(849) }; +module.exports = { EventEmitter: __webpack_require__(905) }; /***/ }), -/* 849 */ +/* 905 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143308,8 +152160,8 @@ module.exports = { EventEmitter: __webpack_require__(849) }; */ var Class = __webpack_require__(0); -var EE = __webpack_require__(12); -var PluginCache = __webpack_require__(23); +var EE = __webpack_require__(10); +var PluginCache = __webpack_require__(25); /** * @classdesc @@ -143482,7 +152334,7 @@ module.exports = EventEmitter; /***/ }), -/* 850 */ +/* 906 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143491,33 +152343,33 @@ module.exports = EventEmitter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AddToDOM = __webpack_require__(131); -var AnimationManager = __webpack_require__(301); -var CacheManager = __webpack_require__(305); -var CanvasPool = __webpack_require__(26); +var AddToDOM = __webpack_require__(137); +var AnimationManager = __webpack_require__(313); +var CacheManager = __webpack_require__(317); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); -var Config = __webpack_require__(327); -var CreateDOMContainer = __webpack_require__(851); -var CreateRenderer = __webpack_require__(349); -var DataManager = __webpack_require__(120); -var DebugHeader = __webpack_require__(351); -var Device = __webpack_require__(328); -var DOMContentLoaded = __webpack_require__(367); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(21); -var InputManager = __webpack_require__(376); -var PluginCache = __webpack_require__(23); -var PluginManager = __webpack_require__(381); -var ScaleManager = __webpack_require__(382); -var SceneManager = __webpack_require__(384); -var TextureEvents = __webpack_require__(130); -var TextureManager = __webpack_require__(389); -var TimeStep = __webpack_require__(352); -var VisibilityHandler = __webpack_require__(354); +var Config = __webpack_require__(338); +var CreateDOMContainer = __webpack_require__(907); +var CreateRenderer = __webpack_require__(358); +var DataManager = __webpack_require__(97); +var DebugHeader = __webpack_require__(360); +var Device = __webpack_require__(339); +var DOMContentLoaded = __webpack_require__(377); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(23); +var InputManager = __webpack_require__(386); +var PluginCache = __webpack_require__(25); +var PluginManager = __webpack_require__(391); +var ScaleManager = __webpack_require__(392); +var SceneManager = __webpack_require__(394); +var TextureEvents = __webpack_require__(136); +var TextureManager = __webpack_require__(399); +var TimeStep = __webpack_require__(361); +var VisibilityHandler = __webpack_require__(363); if (true) { - var SoundManagerCreator = __webpack_require__(393); + var SoundManagerCreator = __webpack_require__(403); } if (false) @@ -144185,7 +153037,7 @@ module.exports = Game; /***/ }), -/* 851 */ +/* 907 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144194,7 +153046,7 @@ module.exports = Game; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AddToDOM = __webpack_require__(131); +var AddToDOM = __webpack_require__(137); var CreateDOMContainer = function (game) { @@ -144229,7 +153081,7 @@ module.exports = CreateDOMContainer; /***/ }), -/* 852 */ +/* 908 */ /***/ (function(module, exports) { /** @@ -144250,7 +153102,7 @@ module.exports = 'boot'; /***/ }), -/* 853 */ +/* 909 */ /***/ (function(module, exports) { /** @@ -144271,7 +153123,7 @@ module.exports = 'destroy'; /***/ }), -/* 854 */ +/* 910 */ /***/ (function(module, exports) { /** @@ -144299,7 +153151,7 @@ module.exports = 'dragend'; /***/ }), -/* 855 */ +/* 911 */ /***/ (function(module, exports) { /** @@ -144330,7 +153182,7 @@ module.exports = 'dragenter'; /***/ }), -/* 856 */ +/* 912 */ /***/ (function(module, exports) { /** @@ -144362,7 +153214,7 @@ module.exports = 'drag'; /***/ }), -/* 857 */ +/* 913 */ /***/ (function(module, exports) { /** @@ -144393,7 +153245,7 @@ module.exports = 'dragleave'; /***/ }), -/* 858 */ +/* 914 */ /***/ (function(module, exports) { /** @@ -144427,7 +153279,7 @@ module.exports = 'dragover'; /***/ }), -/* 859 */ +/* 915 */ /***/ (function(module, exports) { /** @@ -144457,7 +153309,7 @@ module.exports = 'dragstart'; /***/ }), -/* 860 */ +/* 916 */ /***/ (function(module, exports) { /** @@ -144486,7 +153338,7 @@ module.exports = 'drop'; /***/ }), -/* 861 */ +/* 917 */ /***/ (function(module, exports) { /** @@ -144513,7 +153365,7 @@ module.exports = 'gameout'; /***/ }), -/* 862 */ +/* 918 */ /***/ (function(module, exports) { /** @@ -144540,7 +153392,7 @@ module.exports = 'gameover'; /***/ }), -/* 863 */ +/* 919 */ /***/ (function(module, exports) { /** @@ -144581,7 +153433,7 @@ module.exports = 'gameobjectdown'; /***/ }), -/* 864 */ +/* 920 */ /***/ (function(module, exports) { /** @@ -144612,7 +153464,7 @@ module.exports = 'dragend'; /***/ }), -/* 865 */ +/* 921 */ /***/ (function(module, exports) { /** @@ -144642,7 +153494,7 @@ module.exports = 'dragenter'; /***/ }), -/* 866 */ +/* 922 */ /***/ (function(module, exports) { /** @@ -144673,7 +153525,7 @@ module.exports = 'drag'; /***/ }), -/* 867 */ +/* 923 */ /***/ (function(module, exports) { /** @@ -144703,7 +153555,7 @@ module.exports = 'dragleave'; /***/ }), -/* 868 */ +/* 924 */ /***/ (function(module, exports) { /** @@ -144736,7 +153588,7 @@ module.exports = 'dragover'; /***/ }), -/* 869 */ +/* 925 */ /***/ (function(module, exports) { /** @@ -144770,7 +153622,7 @@ module.exports = 'dragstart'; /***/ }), -/* 870 */ +/* 926 */ /***/ (function(module, exports) { /** @@ -144800,7 +153652,7 @@ module.exports = 'drop'; /***/ }), -/* 871 */ +/* 927 */ /***/ (function(module, exports) { /** @@ -144841,7 +153693,7 @@ module.exports = 'gameobjectmove'; /***/ }), -/* 872 */ +/* 928 */ /***/ (function(module, exports) { /** @@ -144882,7 +153734,7 @@ module.exports = 'gameobjectout'; /***/ }), -/* 873 */ +/* 929 */ /***/ (function(module, exports) { /** @@ -144923,7 +153775,7 @@ module.exports = 'gameobjectover'; /***/ }), -/* 874 */ +/* 930 */ /***/ (function(module, exports) { /** @@ -144964,7 +153816,7 @@ module.exports = 'pointerdown'; /***/ }), -/* 875 */ +/* 931 */ /***/ (function(module, exports) { /** @@ -145005,7 +153857,7 @@ module.exports = 'pointermove'; /***/ }), -/* 876 */ +/* 932 */ /***/ (function(module, exports) { /** @@ -145044,7 +153896,7 @@ module.exports = 'pointerout'; /***/ }), -/* 877 */ +/* 933 */ /***/ (function(module, exports) { /** @@ -145085,7 +153937,7 @@ module.exports = 'pointerover'; /***/ }), -/* 878 */ +/* 934 */ /***/ (function(module, exports) { /** @@ -145126,7 +153978,7 @@ module.exports = 'pointerup'; /***/ }), -/* 879 */ +/* 935 */ /***/ (function(module, exports) { /** @@ -145168,7 +154020,7 @@ module.exports = 'wheel'; /***/ }), -/* 880 */ +/* 936 */ /***/ (function(module, exports) { /** @@ -145209,7 +154061,7 @@ module.exports = 'gameobjectup'; /***/ }), -/* 881 */ +/* 937 */ /***/ (function(module, exports) { /** @@ -145253,7 +154105,7 @@ module.exports = 'gameobjectwheel'; /***/ }), -/* 882 */ +/* 938 */ /***/ (function(module, exports) { /** @@ -145274,7 +154126,7 @@ module.exports = 'boot'; /***/ }), -/* 883 */ +/* 939 */ /***/ (function(module, exports) { /** @@ -145299,7 +154151,7 @@ module.exports = 'process'; /***/ }), -/* 884 */ +/* 940 */ /***/ (function(module, exports) { /** @@ -145320,7 +154172,7 @@ module.exports = 'update'; /***/ }), -/* 885 */ +/* 941 */ /***/ (function(module, exports) { /** @@ -145355,7 +154207,7 @@ module.exports = 'pointerdown'; /***/ }), -/* 886 */ +/* 942 */ /***/ (function(module, exports) { /** @@ -145389,7 +154241,7 @@ module.exports = 'pointerdownoutside'; /***/ }), -/* 887 */ +/* 943 */ /***/ (function(module, exports) { /** @@ -145424,7 +154276,7 @@ module.exports = 'pointermove'; /***/ }), -/* 888 */ +/* 944 */ /***/ (function(module, exports) { /** @@ -145459,7 +154311,7 @@ module.exports = 'pointerout'; /***/ }), -/* 889 */ +/* 945 */ /***/ (function(module, exports) { /** @@ -145494,7 +154346,7 @@ module.exports = 'pointerover'; /***/ }), -/* 890 */ +/* 946 */ /***/ (function(module, exports) { /** @@ -145529,7 +154381,7 @@ module.exports = 'pointerup'; /***/ }), -/* 891 */ +/* 947 */ /***/ (function(module, exports) { /** @@ -145563,7 +154415,7 @@ module.exports = 'pointerupoutside'; /***/ }), -/* 892 */ +/* 948 */ /***/ (function(module, exports) { /** @@ -145601,7 +154453,7 @@ module.exports = 'wheel'; /***/ }), -/* 893 */ +/* 949 */ /***/ (function(module, exports) { /** @@ -145625,7 +154477,7 @@ module.exports = 'pointerlockchange'; /***/ }), -/* 894 */ +/* 950 */ /***/ (function(module, exports) { /** @@ -145647,7 +154499,7 @@ module.exports = 'preupdate'; /***/ }), -/* 895 */ +/* 951 */ /***/ (function(module, exports) { /** @@ -145668,7 +154520,7 @@ module.exports = 'shutdown'; /***/ }), -/* 896 */ +/* 952 */ /***/ (function(module, exports) { /** @@ -145690,7 +154542,7 @@ module.exports = 'start'; /***/ }), -/* 897 */ +/* 953 */ /***/ (function(module, exports) { /** @@ -145715,7 +154567,7 @@ module.exports = 'update'; /***/ }), -/* 898 */ +/* 954 */ /***/ (function(module, exports) { /** @@ -145745,7 +154597,7 @@ module.exports = 'addfile'; /***/ }), -/* 899 */ +/* 955 */ /***/ (function(module, exports) { /** @@ -145766,14 +154618,14 @@ module.exports = 'addfile'; * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. - * @param {integer} totalComplete - The total number of files that successfully loaded. - * @param {integer} totalFailed - The total number of files that failed to load. + * @param {number} totalComplete - The total number of files that successfully loaded. + * @param {number} totalFailed - The total number of files that failed to load. */ module.exports = 'complete'; /***/ }), -/* 900 */ +/* 956 */ /***/ (function(module, exports) { /** @@ -145802,7 +154654,7 @@ module.exports = 'filecomplete'; /***/ }), -/* 901 */ +/* 957 */ /***/ (function(module, exports) { /** @@ -145856,7 +154708,7 @@ module.exports = 'filecomplete-'; /***/ }), -/* 902 */ +/* 958 */ /***/ (function(module, exports) { /** @@ -145881,7 +154733,7 @@ module.exports = 'loaderror'; /***/ }), -/* 903 */ +/* 959 */ /***/ (function(module, exports) { /** @@ -145907,7 +154759,7 @@ module.exports = 'load'; /***/ }), -/* 904 */ +/* 960 */ /***/ (function(module, exports) { /** @@ -145934,7 +154786,7 @@ module.exports = 'fileprogress'; /***/ }), -/* 905 */ +/* 961 */ /***/ (function(module, exports) { /** @@ -145963,7 +154815,7 @@ module.exports = 'postprocess'; /***/ }), -/* 906 */ +/* 962 */ /***/ (function(module, exports) { /** @@ -145988,7 +154840,7 @@ module.exports = 'progress'; /***/ }), -/* 907 */ +/* 963 */ /***/ (function(module, exports) { /** @@ -146015,7 +154867,7 @@ module.exports = 'start'; /***/ }), -/* 908 */ +/* 964 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146077,7 +154929,7 @@ module.exports = InjectionMap; /***/ }), -/* 909 */ +/* 965 */ /***/ (function(module, exports) { /** @@ -146095,7 +154947,7 @@ module.exports = InjectionMap; * @since 3.7.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * @param {*} xml - The XML data. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. @@ -146158,7 +155010,7 @@ module.exports = AtlasXML; /***/ }), -/* 910 */ +/* 966 */ /***/ (function(module, exports) { /** @@ -146176,7 +155028,7 @@ module.exports = AtlasXML; * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. */ @@ -146193,7 +155045,7 @@ module.exports = Canvas; /***/ }), -/* 911 */ +/* 967 */ /***/ (function(module, exports) { /** @@ -146211,7 +155063,7 @@ module.exports = Canvas; * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. */ @@ -146228,7 +155080,7 @@ module.exports = Image; /***/ }), -/* 912 */ +/* 968 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146237,7 +155089,7 @@ module.exports = Image; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Parses a Texture Atlas JSON Array and adds the Frames to the Texture. @@ -146249,7 +155101,7 @@ var Clone = __webpack_require__(69); * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * @param {object} json - The JSON data. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. @@ -146337,7 +155189,7 @@ module.exports = JSONArray; /***/ }), -/* 913 */ +/* 969 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146346,7 +155198,7 @@ module.exports = JSONArray; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Parses a Texture Atlas JSON Hash and adds the Frames to the Texture. @@ -146358,7 +155210,7 @@ var Clone = __webpack_require__(69); * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * @param {object} json - The JSON data. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. @@ -146450,7 +155302,7 @@ module.exports = JSONHash; /***/ }), -/* 914 */ +/* 970 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146473,11 +155325,11 @@ var GetFastValue = __webpack_require__(2); * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. - * @param {integer} x - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. - * @param {integer} y - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. - * @param {integer} width - The width of the source image. - * @param {integer} height - The height of the source image. + * @param {number} sourceIndex - The index of the TextureSource. + * @param {number} x - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. + * @param {number} y - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. + * @param {number} width - The width of the source image. + * @param {number} height - The height of the source image. * @param {object} config - An object describing how to parse the Sprite Sheet. * @param {number} config.frameWidth - Width in pixels of a single frame in the sprite sheet. * @param {number} [config.frameHeight] - Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided. @@ -146575,7 +155427,7 @@ module.exports = SpriteSheet; /***/ }), -/* 915 */ +/* 971 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146766,7 +155618,7 @@ module.exports = SpriteSheetFromAtlas; /***/ }), -/* 916 */ +/* 972 */ /***/ (function(module, exports) { /** @@ -146816,7 +155668,7 @@ var addFrame = function (texture, sourceIndex, name, frame) * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * @param {object} yaml - The YAML data. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. @@ -146936,7 +155788,7 @@ TextureImporter: /***/ }), -/* 917 */ +/* 973 */ /***/ (function(module, exports) { /** @@ -146967,7 +155819,7 @@ module.exports = 'complete'; /***/ }), -/* 918 */ +/* 974 */ /***/ (function(module, exports) { /** @@ -146997,7 +155849,7 @@ module.exports = 'decoded'; /***/ }), -/* 919 */ +/* 975 */ /***/ (function(module, exports) { /** @@ -147029,7 +155881,7 @@ module.exports = 'decodedall'; /***/ }), -/* 920 */ +/* 976 */ /***/ (function(module, exports) { /** @@ -147061,7 +155913,7 @@ module.exports = 'destroy'; /***/ }), -/* 921 */ +/* 977 */ /***/ (function(module, exports) { /** @@ -147094,7 +155946,7 @@ module.exports = 'detune'; /***/ }), -/* 922 */ +/* 978 */ /***/ (function(module, exports) { /** @@ -147122,7 +155974,7 @@ module.exports = 'detune'; /***/ }), -/* 923 */ +/* 979 */ /***/ (function(module, exports) { /** @@ -147149,7 +156001,7 @@ module.exports = 'mute'; /***/ }), -/* 924 */ +/* 980 */ /***/ (function(module, exports) { /** @@ -147177,7 +156029,7 @@ module.exports = 'rate'; /***/ }), -/* 925 */ +/* 981 */ /***/ (function(module, exports) { /** @@ -147204,7 +156056,7 @@ module.exports = 'volume'; /***/ }), -/* 926 */ +/* 982 */ /***/ (function(module, exports) { /** @@ -147238,7 +156090,7 @@ module.exports = 'loop'; /***/ }), -/* 927 */ +/* 983 */ /***/ (function(module, exports) { /** @@ -147272,7 +156124,7 @@ module.exports = 'looped'; /***/ }), -/* 928 */ +/* 984 */ /***/ (function(module, exports) { /** @@ -147305,7 +156157,7 @@ module.exports = 'mute'; /***/ }), -/* 929 */ +/* 985 */ /***/ (function(module, exports) { /** @@ -147332,7 +156184,7 @@ module.exports = 'pauseall'; /***/ }), -/* 930 */ +/* 986 */ /***/ (function(module, exports) { /** @@ -147364,7 +156216,7 @@ module.exports = 'pause'; /***/ }), -/* 931 */ +/* 987 */ /***/ (function(module, exports) { /** @@ -147395,7 +156247,7 @@ module.exports = 'play'; /***/ }), -/* 932 */ +/* 988 */ /***/ (function(module, exports) { /** @@ -147428,7 +156280,7 @@ module.exports = 'rate'; /***/ }), -/* 933 */ +/* 989 */ /***/ (function(module, exports) { /** @@ -147455,7 +156307,7 @@ module.exports = 'resumeall'; /***/ }), -/* 934 */ +/* 990 */ /***/ (function(module, exports) { /** @@ -147488,7 +156340,7 @@ module.exports = 'resume'; /***/ }), -/* 935 */ +/* 991 */ /***/ (function(module, exports) { /** @@ -147521,7 +156373,7 @@ module.exports = 'seek'; /***/ }), -/* 936 */ +/* 992 */ /***/ (function(module, exports) { /** @@ -147548,7 +156400,7 @@ module.exports = 'stopall'; /***/ }), -/* 937 */ +/* 993 */ /***/ (function(module, exports) { /** @@ -147580,7 +156432,7 @@ module.exports = 'stop'; /***/ }), -/* 938 */ +/* 994 */ /***/ (function(module, exports) { /** @@ -147607,7 +156459,7 @@ module.exports = 'unlocked'; /***/ }), -/* 939 */ +/* 995 */ /***/ (function(module, exports) { /** @@ -147640,7 +156492,7 @@ module.exports = 'volume'; /***/ }), -/* 940 */ +/* 996 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147655,111 +156507,114 @@ module.exports = 'volume'; var GameObjects = { - Events: __webpack_require__(29), + Events: __webpack_require__(32), - DisplayList: __webpack_require__(941), - GameObjectCreator: __webpack_require__(16), + DisplayList: __webpack_require__(997), + GameObjectCreator: __webpack_require__(17), GameObjectFactory: __webpack_require__(5), - UpdateList: __webpack_require__(966), + UpdateList: __webpack_require__(1023), Components: __webpack_require__(11), - BuildGameObject: __webpack_require__(27), - BuildGameObjectAnimation: __webpack_require__(406), + BuildGameObject: __webpack_require__(28), + BuildGameObjectAnimation: __webpack_require__(416), GameObject: __webpack_require__(14), - BitmapText: __webpack_require__(140), - Blitter: __webpack_require__(199), - Bob: __webpack_require__(407), - Container: __webpack_require__(200), - DOMElement: __webpack_require__(409), - DynamicBitmapText: __webpack_require__(201), - Extern: __webpack_require__(411), - Graphics: __webpack_require__(202), - Group: __webpack_require__(100), - Image: __webpack_require__(114), - Particles: __webpack_require__(997), - PathFollower: __webpack_require__(424), - RenderTexture: __webpack_require__(206), - RetroFont: __webpack_require__(1005), - Rope: __webpack_require__(208), - Sprite: __webpack_require__(76), + BitmapText: __webpack_require__(144), + Blitter: __webpack_require__(204), + Bob: __webpack_require__(417), + Container: __webpack_require__(205), + DOMElement: __webpack_require__(419), + DynamicBitmapText: __webpack_require__(206), + Extern: __webpack_require__(421), + Graphics: __webpack_require__(207), + Group: __webpack_require__(108), + Image: __webpack_require__(122), + Layer: __webpack_require__(210), + Particles: __webpack_require__(1057), + PathFollower: __webpack_require__(434), + RenderTexture: __webpack_require__(212), + RetroFont: __webpack_require__(1065), + Rope: __webpack_require__(214), + Sprite: __webpack_require__(70), - Text: __webpack_require__(209), - GetTextSize: __webpack_require__(425), - MeasureText: __webpack_require__(427), - TextStyle: __webpack_require__(426), + Text: __webpack_require__(215), + GetTextSize: __webpack_require__(435), + MeasureText: __webpack_require__(437), + TextStyle: __webpack_require__(436), - TileSprite: __webpack_require__(210), - Zone: __webpack_require__(117), - Video: __webpack_require__(211), + TileSprite: __webpack_require__(216), + Zone: __webpack_require__(125), + Video: __webpack_require__(217), // Shapes - Shape: __webpack_require__(30), - Arc: __webpack_require__(428), - Curve: __webpack_require__(429), - Ellipse: __webpack_require__(430), - Grid: __webpack_require__(431), - IsoBox: __webpack_require__(432), - IsoTriangle: __webpack_require__(433), - Line: __webpack_require__(434), - Polygon: __webpack_require__(435), - Rectangle: __webpack_require__(440), - Star: __webpack_require__(441), - Triangle: __webpack_require__(442), + Shape: __webpack_require__(33), + Arc: __webpack_require__(438), + Curve: __webpack_require__(439), + Ellipse: __webpack_require__(440), + Grid: __webpack_require__(441), + IsoBox: __webpack_require__(442), + IsoTriangle: __webpack_require__(443), + Line: __webpack_require__(444), + Polygon: __webpack_require__(445), + Rectangle: __webpack_require__(450), + Star: __webpack_require__(451), + Triangle: __webpack_require__(452), // Game Object Factories Factories: { - Blitter: __webpack_require__(1053), - Container: __webpack_require__(1054), - DOMElement: __webpack_require__(1055), - DynamicBitmapText: __webpack_require__(1056), - Extern: __webpack_require__(1057), - Graphics: __webpack_require__(1058), - Group: __webpack_require__(1059), - Image: __webpack_require__(1060), - Particles: __webpack_require__(1061), - PathFollower: __webpack_require__(1062), - RenderTexture: __webpack_require__(1063), - Rope: __webpack_require__(1064), - Sprite: __webpack_require__(1065), - StaticBitmapText: __webpack_require__(1066), - Text: __webpack_require__(1067), - TileSprite: __webpack_require__(1068), - Zone: __webpack_require__(1069), - Video: __webpack_require__(1070), + Blitter: __webpack_require__(1113), + Container: __webpack_require__(1114), + DOMElement: __webpack_require__(1115), + DynamicBitmapText: __webpack_require__(1116), + Extern: __webpack_require__(1117), + Graphics: __webpack_require__(1118), + Group: __webpack_require__(1119), + Image: __webpack_require__(1120), + Layer: __webpack_require__(1121), + Particles: __webpack_require__(1122), + PathFollower: __webpack_require__(1123), + RenderTexture: __webpack_require__(1124), + Rope: __webpack_require__(1125), + Sprite: __webpack_require__(1126), + StaticBitmapText: __webpack_require__(1127), + Text: __webpack_require__(1128), + TileSprite: __webpack_require__(1129), + Zone: __webpack_require__(1130), + Video: __webpack_require__(1131), // Shapes - Arc: __webpack_require__(1071), - Curve: __webpack_require__(1072), - Ellipse: __webpack_require__(1073), - Grid: __webpack_require__(1074), - IsoBox: __webpack_require__(1075), - IsoTriangle: __webpack_require__(1076), - Line: __webpack_require__(1077), - Polygon: __webpack_require__(1078), - Rectangle: __webpack_require__(1079), - Star: __webpack_require__(1080), - Triangle: __webpack_require__(1081) + Arc: __webpack_require__(1132), + Curve: __webpack_require__(1133), + Ellipse: __webpack_require__(1134), + Grid: __webpack_require__(1135), + IsoBox: __webpack_require__(1136), + IsoTriangle: __webpack_require__(1137), + Line: __webpack_require__(1138), + Polygon: __webpack_require__(1139), + Rectangle: __webpack_require__(1140), + Star: __webpack_require__(1141), + Triangle: __webpack_require__(1142) }, Creators: { - Blitter: __webpack_require__(1082), - Container: __webpack_require__(1083), - DynamicBitmapText: __webpack_require__(1084), - Graphics: __webpack_require__(1085), - Group: __webpack_require__(1086), - Image: __webpack_require__(1087), - Particles: __webpack_require__(1088), - RenderTexture: __webpack_require__(1089), - Rope: __webpack_require__(1090), - Sprite: __webpack_require__(1091), - StaticBitmapText: __webpack_require__(1092), - Text: __webpack_require__(1093), - TileSprite: __webpack_require__(1094), - Zone: __webpack_require__(1095), - Video: __webpack_require__(1096) + Blitter: __webpack_require__(1143), + Container: __webpack_require__(1144), + DynamicBitmapText: __webpack_require__(1145), + Graphics: __webpack_require__(1146), + Group: __webpack_require__(1147), + Image: __webpack_require__(1148), + Layer: __webpack_require__(1149), + Particles: __webpack_require__(1150), + RenderTexture: __webpack_require__(1151), + Rope: __webpack_require__(1152), + Sprite: __webpack_require__(1153), + StaticBitmapText: __webpack_require__(1154), + Text: __webpack_require__(1155), + TileSprite: __webpack_require__(1156), + Zone: __webpack_require__(1157), + Video: __webpack_require__(1158) } }; @@ -147767,28 +156622,25 @@ var GameObjects = { if (true) { // WebGL only Game Objects - GameObjects.Mesh = __webpack_require__(142); - GameObjects.Quad = __webpack_require__(214); - GameObjects.Shader = __webpack_require__(215); + GameObjects.Shader = __webpack_require__(220); + GameObjects.Mesh = __webpack_require__(221); - GameObjects.Factories.Mesh = __webpack_require__(1103); - GameObjects.Factories.Quad = __webpack_require__(1104); - GameObjects.Factories.Shader = __webpack_require__(1105); + GameObjects.Factories.Shader = __webpack_require__(1165); + GameObjects.Factories.Mesh = __webpack_require__(1166); - GameObjects.Creators.Mesh = __webpack_require__(1106); - GameObjects.Creators.Quad = __webpack_require__(1107); - GameObjects.Creators.Shader = __webpack_require__(1108); + GameObjects.Creators.Shader = __webpack_require__(1167); + GameObjects.Creators.Mesh = __webpack_require__(1168); - GameObjects.Light = __webpack_require__(446); - GameObjects.LightsManager = __webpack_require__(447); - GameObjects.LightsPlugin = __webpack_require__(1109); + GameObjects.Light = __webpack_require__(458); + GameObjects.LightsManager = __webpack_require__(459); + GameObjects.LightsPlugin = __webpack_require__(1170); } module.exports = GameObjects; /***/ }), -/* 941 */ +/* 997 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147798,11 +156650,11 @@ module.exports = GameObjects; */ var Class = __webpack_require__(0); -var List = __webpack_require__(137); -var PluginCache = __webpack_require__(23); -var GameObjectEvents = __webpack_require__(29); +var List = __webpack_require__(105); +var PluginCache = __webpack_require__(25); +var GameObjectEvents = __webpack_require__(32); var SceneEvents = __webpack_require__(20); -var StableSort = __webpack_require__(139); +var StableSort = __webpack_require__(90); /** * @classdesc @@ -147903,6 +156755,15 @@ var DisplayList = new Class({ { gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); + if (gameObject.displayList) + { + gameObject.displayList.remove(gameObject); + } + + gameObject.displayList = this; + + this.queueDepthSort(); + this.events.emit(SceneEvents.ADDED_TO_SCENE, gameObject, this.scene); }, @@ -147921,6 +156782,10 @@ var DisplayList = new Class({ { gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + gameObject.displayList = null; + + this.queueDepthSort(); + this.events.emit(SceneEvents.REMOVED_FROM_SCENE, gameObject, this.scene); }, @@ -147974,7 +156839,7 @@ var DisplayList = new Class({ * @param {Phaser.GameObjects.GameObject} childA - The first Game Object. * @param {Phaser.GameObjects.GameObject} childB - The second Game Object. * - * @return {integer} The difference between the depths of each Game Object. + * @return {number} The difference between the depths of each Game Object. */ sortByDepth: function (childA, childB) { @@ -148046,7 +156911,7 @@ module.exports = DisplayList; /***/ }), -/* 942 */ +/* 998 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148061,21 +156926,22 @@ module.exports = DisplayList; module.exports = { - CheckMatrix: __webpack_require__(195), - MatrixToString: __webpack_require__(943), - ReverseColumns: __webpack_require__(944), - ReverseRows: __webpack_require__(945), - Rotate180: __webpack_require__(946), - RotateLeft: __webpack_require__(947), - RotateMatrix: __webpack_require__(138), - RotateRight: __webpack_require__(948), - TransposeMatrix: __webpack_require__(402) + CheckMatrix: __webpack_require__(200), + MatrixToString: __webpack_require__(999), + ReverseColumns: __webpack_require__(1000), + ReverseRows: __webpack_require__(1001), + Rotate180: __webpack_require__(1002), + RotateLeft: __webpack_require__(1003), + RotateMatrix: __webpack_require__(143), + RotateRight: __webpack_require__(1004), + Translate: __webpack_require__(1005), + TransposeMatrix: __webpack_require__(412) }; /***/ }), -/* 943 */ +/* 999 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148084,12 +156950,26 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Pad = __webpack_require__(173); -var CheckMatrix = __webpack_require__(195); +var Pad = __webpack_require__(178); +var CheckMatrix = __webpack_require__(200); /** * Generates a string (which you can pass to console.log) from the given Array Matrix. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.MatrixToString * @since 3.0.0 * @@ -148156,7 +157036,7 @@ module.exports = MatrixToString; /***/ }), -/* 944 */ +/* 1000 */ /***/ (function(module, exports) { /** @@ -148168,6 +157048,20 @@ module.exports = MatrixToString; /** * Reverses the columns in the given Array Matrix. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.ReverseColumns * @since 3.0.0 * @@ -148187,7 +157081,7 @@ module.exports = ReverseColumns; /***/ }), -/* 945 */ +/* 1001 */ /***/ (function(module, exports) { /** @@ -148199,6 +157093,20 @@ module.exports = ReverseColumns; /** * Reverses the rows in the given Array Matrix. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.ReverseRows * @since 3.0.0 * @@ -148223,7 +157131,7 @@ module.exports = ReverseRows; /***/ }), -/* 946 */ +/* 1002 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148232,11 +157140,25 @@ module.exports = ReverseRows; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateMatrix = __webpack_require__(138); +var RotateMatrix = __webpack_require__(143); /** * Rotates the array matrix 180 degrees. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.Rotate180 * @since 3.0.0 * @@ -148256,7 +157178,7 @@ module.exports = Rotate180; /***/ }), -/* 947 */ +/* 1003 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148265,11 +157187,25 @@ module.exports = Rotate180; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateMatrix = __webpack_require__(138); +var RotateMatrix = __webpack_require__(143); /** * Rotates the array matrix to the left (or 90 degrees) * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.RotateLeft * @since 3.0.0 * @@ -148289,7 +157225,7 @@ module.exports = RotateLeft; /***/ }), -/* 948 */ +/* 1004 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148298,11 +157234,25 @@ module.exports = RotateLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateMatrix = __webpack_require__(138); +var RotateMatrix = __webpack_require__(143); /** * Rotates the array matrix to the left (or -90 degrees) * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.RotateRight * @since 3.0.0 * @@ -148322,7 +157272,96 @@ module.exports = RotateRight; /***/ }), -/* 949 */ +/* 1005 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var RotateLeft = __webpack_require__(170); +var RotateRight = __webpack_require__(171); + +/** + * Translates the given Array Matrix by shifting each column and row the + * amount specified. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.Translate + * @since 3.50.0 + * + * @generic T + * @genericUse {T[][]} - [matrix,$return] + * + * @param {T[][]} [matrix] - The array matrix to translate. + * @param {number} [x=0] - The amount to horizontally translate the matrix by. + * @param {number} [y=0] - The amount to vertically translate the matrix by. + * + * @return {T[][]} The translated matrix. + */ +var TranslateMatrix = function (matrix, x, y) +{ + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + // Vertical translation + + if (y !== 0) + { + if (y < 0) + { + // Shift Up + RotateLeft(matrix, Math.abs(y)); + } + else + { + // Shift Down + RotateRight(matrix, y); + } + } + + // Horizontal translation + + if (x !== 0) + { + for (var i = 0; i < matrix.length; i++) + { + var row = matrix[i]; + + if (x < 0) + { + RotateLeft(row, Math.abs(x)); + } + else + { + RotateRight(row, x); + } + } + } + + return matrix; +}; + +module.exports = TranslateMatrix; + + +/***/ }), +/* 1006 */ /***/ (function(module, exports) { /** @@ -148348,7 +157387,7 @@ module.exports = RotateRight; * * @param {array} array - The array to be added to. * @param {any|any[]} item - The item, or array of items, to add to the array. Each item must be unique within the array. - * @param {integer} [limit] - Optional limit which caps the size of the array. + * @param {number} [limit] - Optional limit which caps the size of the array. * @param {function} [callback] - A callback to be invoked for each item successfully added to the array. * @param {object} [context] - The context in which the callback is invoked. * @@ -148439,7 +157478,7 @@ module.exports = Add; /***/ }), -/* 950 */ +/* 1007 */ /***/ (function(module, exports) { /** @@ -148467,8 +157506,8 @@ module.exports = Add; * * @param {array} array - The array to be added to. * @param {any|any[]} item - The item, or array of items, to add to the array. - * @param {integer} [index=0] - The index in the array where the item will be inserted. - * @param {integer} [limit] - Optional limit which caps the size of the array. + * @param {number} [index=0] - The index in the array where the item will be inserted. + * @param {number} [limit] - Optional limit which caps the size of the array. * @param {function} [callback] - A callback to be invoked for each item successfully added to the array. * @param {object} [context] - The context in which the callback is invoked. * @@ -148561,7 +157600,7 @@ module.exports = AddAt; /***/ }), -/* 951 */ +/* 1008 */ /***/ (function(module, exports) { /** @@ -148599,7 +157638,7 @@ module.exports = BringToTop; /***/ }), -/* 952 */ +/* 1009 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148608,7 +157647,7 @@ module.exports = BringToTop; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Returns the total number of elements in the array which have a property matching the given value. @@ -148619,10 +157658,10 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {string} property - The property to test on each array element. * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex] - An optional start index to search from. - * @param {integer} [endIndex] - An optional end index to search to. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * - * @return {integer} The total number of elements with properties matching the given value. + * @return {number} The total number of elements with properties matching the given value. */ var CountAllMatching = function (array, property, value, startIndex, endIndex) { @@ -148651,7 +157690,7 @@ module.exports = CountAllMatching; /***/ }), -/* 953 */ +/* 1010 */ /***/ (function(module, exports) { /** @@ -148697,7 +157736,7 @@ module.exports = Each; /***/ }), -/* 954 */ +/* 1011 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148706,7 +157745,7 @@ module.exports = Each; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Passes each element in the array, between the start and end indexes, to the given callback. @@ -148717,8 +157756,8 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {function} callback - A callback to be invoked for each item in the array. * @param {object} context - The context in which the callback is invoked. - * @param {integer} startIndex - The start index to search from. - * @param {integer} endIndex - The end index to search to. + * @param {number} startIndex - The start index to search from. + * @param {number} endIndex - The end index to search to. * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. * * @return {array} The input array. @@ -148753,7 +157792,7 @@ module.exports = EachInRange; /***/ }), -/* 955 */ +/* 1012 */ /***/ (function(module, exports) { /** @@ -148795,7 +157834,7 @@ module.exports = MoveDown; /***/ }), -/* 956 */ +/* 1013 */ /***/ (function(module, exports) { /** @@ -148813,7 +157852,7 @@ module.exports = MoveDown; * * @param {array} array - The array. * @param {*} item - The element to move. - * @param {integer} index - The new index that the element will be moved to. + * @param {number} index - The new index that the element will be moved to. * * @return {*} The element that was moved. */ @@ -148842,7 +157881,7 @@ module.exports = MoveTo; /***/ }), -/* 957 */ +/* 1014 */ /***/ (function(module, exports) { /** @@ -148884,7 +157923,7 @@ module.exports = MoveUp; /***/ }), -/* 958 */ +/* 1015 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148893,7 +157932,7 @@ module.exports = MoveUp; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RoundAwayFromZero = __webpack_require__(345); +var RoundAwayFromZero = __webpack_require__(355); /** * Create an array of numbers (positive and/or negative) progressing from `start` @@ -148961,7 +158000,7 @@ module.exports = NumberArrayStep; /***/ }), -/* 959 */ +/* 1016 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148970,7 +158009,7 @@ module.exports = NumberArrayStep; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SpliceOne = __webpack_require__(82); +var SpliceOne = __webpack_require__(103); /** * Removes the item from the given position in the array. @@ -148983,7 +158022,7 @@ var SpliceOne = __webpack_require__(82); * @since 3.4.0 * * @param {array} array - The array to be modified. - * @param {integer} index - The array index to remove the item from. The index must be in bounds or it will throw an error. + * @param {number} index - The array index to remove the item from. The index must be in bounds or it will throw an error. * @param {function} [callback] - A callback to be invoked for the item removed from the array. * @param {object} [context] - The context in which the callback is invoked. * @@ -149012,7 +158051,7 @@ module.exports = RemoveAt; /***/ }), -/* 960 */ +/* 1017 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -149021,7 +158060,7 @@ module.exports = RemoveAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Removes the item within the given range in the array. @@ -149034,8 +158073,8 @@ var SafeRange = __webpack_require__(70); * @since 3.4.0 * * @param {array} array - The array to be modified. - * @param {integer} startIndex - The start index to remove from. - * @param {integer} endIndex - The end index to remove to. + * @param {number} startIndex - The start index to remove from. + * @param {number} endIndex - The end index to remove to. * @param {function} [callback] - A callback to be invoked for the item removed from the array. * @param {object} [context] - The context in which the callback is invoked. * @@ -149075,7 +158114,7 @@ module.exports = RemoveBetween; /***/ }), -/* 961 */ +/* 1018 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -149084,7 +158123,7 @@ module.exports = RemoveBetween; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SpliceOne = __webpack_require__(82); +var SpliceOne = __webpack_require__(103); /** * Removes a random object from the given array and returns it. @@ -149094,8 +158133,8 @@ var SpliceOne = __webpack_require__(82); * @since 3.0.0 * * @param {array} array - The array to removed a random element from. - * @param {integer} [start=0] - The array index to start the search from. - * @param {integer} [length=array.length] - Optional restriction on the number of elements to randomly select from. + * @param {number} [start=0] - The array index to start the search from. + * @param {number} [length=array.length] - Optional restriction on the number of elements to randomly select from. * * @return {object} The random element that was removed, or `null` if there were no array elements that fell within the given range. */ @@ -149113,7 +158152,7 @@ module.exports = RemoveRandomElement; /***/ }), -/* 962 */ +/* 1019 */ /***/ (function(module, exports) { /** @@ -149157,7 +158196,7 @@ module.exports = Replace; /***/ }), -/* 963 */ +/* 1020 */ /***/ (function(module, exports) { /** @@ -149195,7 +158234,7 @@ module.exports = SendToBack; /***/ }), -/* 964 */ +/* 1021 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -149204,7 +158243,7 @@ module.exports = SendToBack; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Scans the array for elements with the given property. If found, the property is set to the `value`. @@ -149220,8 +158259,8 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {string} property - The property to test for on each array element. * @param {*} value - The value to set the property to. - * @param {integer} [startIndex] - An optional start index to search from. - * @param {integer} [endIndex] - An optional end index to search to. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * * @return {array} The input array. */ @@ -149250,7 +158289,7 @@ module.exports = SetAll; /***/ }), -/* 965 */ +/* 1022 */ /***/ (function(module, exports) { /** @@ -149298,7 +158337,7 @@ module.exports = Swap; /***/ }), -/* 966 */ +/* 1023 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -149308,8 +158347,8 @@ module.exports = Swap; */ var Class = __webpack_require__(0); -var ProcessQueue = __webpack_require__(197); -var PluginCache = __webpack_require__(23); +var ProcessQueue = __webpack_require__(202); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); /** @@ -149393,7 +158432,7 @@ var UpdateList = new Class({ * The total number of items awaiting processing. * * @name Phaser.GameObjects.UpdateList#_toProcess - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -149590,7 +158629,7 @@ var UpdateList = new Class({ * The number of entries in the active list. * * @name Phaser.GameObjects.UpdateList#length - * @type {integer} + * @type {number} * @readonly * @since 3.20.0 */ @@ -149602,7 +158641,7 @@ module.exports = UpdateList; /***/ }), -/* 967 */ +/* 1024 */ /***/ (function(module, exports) { /** @@ -149629,7 +158668,7 @@ module.exports = 'add'; /***/ }), -/* 968 */ +/* 1025 */ /***/ (function(module, exports) { /** @@ -149656,7 +158695,7 @@ module.exports = 'remove'; /***/ }), -/* 969 */ +/* 1026 */ /***/ (function(module, exports) { /** @@ -150178,7 +159217,7 @@ module.exports = GetBitmapTextSize; /***/ }), -/* 970 */ +/* 1027 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -150187,7 +159226,7 @@ module.exports = GetBitmapTextSize; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ParseXMLBitmapFont = __webpack_require__(198); +var ParseXMLBitmapFont = __webpack_require__(203); /** * Parse an XML Bitmap Font from an Atlas. @@ -150203,8 +159242,8 @@ var ParseXMLBitmapFont = __webpack_require__(198); * @param {string} textureKey - The key of the BitmapFont's texture. * @param {string} frameKey - The key of the BitmapFont texture's frame. * @param {string} xmlKey - The key of the XML data of the font to parse. - * @param {integer} [xSpacing] - The x-axis spacing to add between each letter. - * @param {integer} [ySpacing] - The y-axis spacing to add to the line height. + * @param {number} [xSpacing] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing] - The y-axis spacing to add to the line height. * * @return {boolean} Whether the parsing was successful or not. */ @@ -150232,7 +159271,7 @@ module.exports = ParseFromAtlas; /***/ }), -/* 971 */ +/* 1028 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -150246,12 +159285,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(972); + renderWebGL = __webpack_require__(1029); } if (true) { - renderCanvas = __webpack_require__(974); + renderCanvas = __webpack_require__(1031); } module.exports = { @@ -150263,7 +159302,7 @@ module.exports = { /***/ }), -/* 972 */ +/* 1029 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -150272,8 +159311,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BatchChar = __webpack_require__(973); -var Utils = __webpack_require__(10); +var BatchChar = __webpack_require__(1030); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -150286,11 +159326,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix) { var text = src._text; var textLength = text.length; @@ -150300,36 +159339,9 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, return; } - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); - var camMatrix = pipeline._tempMatrix1; - var spriteMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; - - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; var roundPixels = camera.roundPixels; @@ -150337,12 +159349,12 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, var charColors = src.charColors; - var tintEffect = (src._isTinted && src.tintFill); + var tintEffect = src.tintFill; - var tintTL = Utils.getTintAppendFloatAlpha(src._tintTL, cameraAlpha * src._alphaTL); - var tintTR = Utils.getTintAppendFloatAlpha(src._tintTR, cameraAlpha * src._alphaTR); - var tintBL = Utils.getTintAppendFloatAlpha(src._tintBL, cameraAlpha * src._alphaBL); - var tintBR = Utils.getTintAppendFloatAlpha(src._tintBR, cameraAlpha * src._alphaBR); + var tintTL = Utils.getTintAppendFloatAlpha(src.tintTopLeft, cameraAlpha * src._alphaTL); + var tintTR = Utils.getTintAppendFloatAlpha(src.tintTopRight, cameraAlpha * src._alphaTR); + var tintBL = Utils.getTintAppendFloatAlpha(src.tintBottomLeft, cameraAlpha * src._alphaBL); + var tintBR = Utils.getTintAppendFloatAlpha(src.tintBottomRight, cameraAlpha * src._alphaBR); var texture = src.frame.glTexture; var textureUnit = pipeline.setGameObject(src); @@ -150361,6 +159373,8 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, var dropShadow = (dropShadowX !== 0 || dropShadowY !== 0); + renderer.pipelines.preBatch(src); + if (dropShadow) { var srcShadowColor = src._dropShadowColorGL; @@ -150415,13 +159429,15 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, // Debug test if the characters are in the correct place when rendered: // pipeline.drawFillRect(tx0, ty0, tx2 - tx0, ty2 - ty0, 0x00ff00, 0.5); } + + renderer.pipelines.postBatch(src); }; module.exports = BitmapTextWebGLRenderer; /***/ }), -/* 973 */ +/* 1030 */ /***/ (function(module, exports) { /** @@ -150473,14 +159489,14 @@ var BatchChar = function (pipeline, src, char, glyph, offsetX, offsetY, calcMatr var tx3 = calcMatrix.getXRound(xw, y, roundPixels); var ty3 = calcMatrix.getYRound(xw, y, roundPixels); - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, glyph.u0, glyph.v0, glyph.u1, glyph.v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); + pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, glyph.u0, glyph.v0, glyph.u1, glyph.v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); }; module.exports = BatchChar; /***/ }), -/* 974 */ +/* 1031 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -150489,7 +159505,7 @@ module.exports = BatchChar; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTransform = __webpack_require__(28); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -150502,11 +159518,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var BitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix) { var text = src._text; var textLength = text.length; @@ -150517,7 +159532,7 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, { return; } - + var textureFrame = src.frame; var chars = src.fontData.chars; @@ -150662,7 +159677,7 @@ module.exports = BitmapTextCanvasRenderer; /***/ }), -/* 975 */ +/* 1032 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -150676,12 +159691,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(976); + renderWebGL = __webpack_require__(1033); } if (true) { - renderCanvas = __webpack_require__(977); + renderCanvas = __webpack_require__(1034); } module.exports = { @@ -150693,7 +159708,7 @@ module.exports = { /***/ }), -/* 976 */ +/* 1033 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -150702,7 +159717,10 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); + +var tempMatrix = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -150715,11 +159733,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Blitter} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var BlitterWebGLRenderer = function (renderer, src, camera, parentMatrix) { var list = src.getRenderList(); @@ -150733,9 +159750,7 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam var cameraScrollX = camera.scrollX * src.scrollFactorX; var cameraScrollY = camera.scrollY * src.scrollFactorY; - var calcMatrix = pipeline._tempMatrix1; - - calcMatrix.copyFrom(camera.matrix); + var calcMatrix = tempMatrix.copyFrom(camera.matrix); if (parentMatrix) { @@ -150752,6 +159767,8 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam var alpha = camera.alpha * src.alpha; var roundPixels = camera.roundPixels; + renderer.pipelines.preBatch(src); + for (var index = 0; index < list.length; index++) { var bob = list[index]; @@ -150810,18 +159827,20 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam } // TL x/y, BL x/y, BR x/y, TR x/y - if (pipeline.batchQuad(tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, frame.glTexture, textureUnit)) + if (pipeline.batchQuad(src, tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, frame.glTexture, textureUnit)) { prevTextureSourceIndex = -1; } } + + renderer.pipelines.postBatch(src); }; module.exports = BlitterWebGLRenderer; /***/ }), -/* 977 */ +/* 1034 */ /***/ (function(module, exports) { /** @@ -150841,11 +159860,10 @@ module.exports = BlitterWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Blitter} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var BlitterCanvasRenderer = function (renderer, src, camera, parentMatrix) { var list = src.getRenderList(); @@ -150901,7 +159919,7 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca } ctx.globalAlpha = bobAlpha; - + if (!flip) { if (roundPixels) @@ -150943,7 +159961,7 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca ctx.restore(); } } - + ctx.restore(); }; @@ -150951,7 +159969,7 @@ module.exports = BlitterCanvasRenderer; /***/ }), -/* 978 */ +/* 1035 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -150966,12 +159984,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(979); + renderWebGL = __webpack_require__(1036); } if (true) { - renderCanvas = __webpack_require__(980); + renderCanvas = __webpack_require__(1037); } module.exports = { @@ -150983,7 +160001,7 @@ module.exports = { /***/ }), -/* 979 */ +/* 1036 */ /***/ (function(module, exports) { /** @@ -151004,21 +160022,21 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Container} container - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ContainerWebGLRenderer = function (renderer, container, interpolationPercentage, camera, parentMatrix) +var ContainerWebGLRenderer = function (renderer, container, camera, parentMatrix) { var children = container.list; + var childCount = children.length; - if (children.length === 0) + if (childCount === 0) { return; } var transformMatrix = container.localTransform; - + if (parentMatrix) { transformMatrix.loadIdentity(); @@ -151032,6 +160050,8 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY); } + renderer.pipelines.preBatch(container); + var containerHasBlendMode = (container.blendMode !== -1); if (!containerHasBlendMode) @@ -151045,9 +160065,6 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent var scrollFactorX = container.scrollFactorX; var scrollFactorY = container.scrollFactorY; - var list = children; - var childCount = children.length; - for (var i = 0; i < childCount; i++) { var child = children[i]; @@ -151103,7 +160120,7 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent renderer.currentType = type; } - renderer.nextTypeMatch = (i < childCount - 1) ? (list[i + 1].type === renderer.currentType) : false; + renderer.nextTypeMatch = (i < childCount - 1) ? (children[i + 1].type === renderer.currentType) : false; // Set parent values child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY); @@ -151111,7 +160128,7 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha); // Render - child.renderWebGL(renderer, child, interpolationPercentage, camera, transformMatrix); + child.renderWebGL(renderer, child, camera, transformMatrix); // Restore original values @@ -151126,13 +160143,15 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent renderer.newType = false; } + + renderer.pipelines.postBatch(container); }; module.exports = ContainerWebGLRenderer; /***/ }), -/* 980 */ +/* 1037 */ /***/ (function(module, exports) { /** @@ -151153,11 +160172,10 @@ module.exports = ContainerWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Container} container - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ContainerCanvasRenderer = function (renderer, container, interpolationPercentage, camera, parentMatrix) +var ContainerCanvasRenderer = function (renderer, container, camera, parentMatrix) { var children = container.list; @@ -151222,7 +160240,7 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen child.setAlpha(childAlpha * alpha); // Render - child.renderCanvas(renderer, child, interpolationPercentage, camera, transformMatrix); + child.renderCanvas(renderer, child, camera, transformMatrix); // Restore original values child.setAlpha(childAlpha); @@ -151239,7 +160257,7 @@ module.exports = ContainerCanvasRenderer; /***/ }), -/* 981 */ +/* 1038 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151253,12 +160271,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(410); + renderWebGL = __webpack_require__(420); } if (true) { - renderCanvas = __webpack_require__(410); + renderCanvas = __webpack_require__(420); } module.exports = { @@ -151270,7 +160288,7 @@ module.exports = { /***/ }), -/* 982 */ +/* 1039 */ /***/ (function(module, exports) { /** @@ -151312,7 +160330,7 @@ module.exports = [ /***/ }), -/* 983 */ +/* 1040 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151326,12 +160344,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(984); + renderWebGL = __webpack_require__(1041); } if (true) { - renderCanvas = __webpack_require__(985); + renderCanvas = __webpack_require__(1042); } module.exports = { @@ -151343,7 +160361,7 @@ module.exports = { /***/ }), -/* 984 */ +/* 1041 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151352,8 +160370,11 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); -var GetColorFromValue = __webpack_require__(119); +var GetCalcMatrix = __webpack_require__(21); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); + +var tempMatrix = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -151366,11 +160387,10 @@ var GetColorFromValue = __webpack_require__(119); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.DynamicBitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix) { var text = src.text; var textLength = text.length; @@ -151380,37 +160400,14 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce return; } - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); - var camMatrix = pipeline._tempMatrix1; - var spriteMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; - var fontMatrix = pipeline._tempMatrix4; + var result = GetCalcMatrix(src, camera, parentMatrix); - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + var spriteMatrix = result.sprite; + var calcMatrix = result.calc; - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } + var fontMatrix = tempMatrix; var crop = (src.cropWidth > 0 || src.cropHeight > 0); @@ -151428,16 +160425,12 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce var frame = src.frame; var texture = frame.glTexture; - var textureX = frame.cutX; - var textureY = frame.cutY; - var textureWidth = texture.width; - var textureHeight = texture.height; - var tintEffect = (src._isTinted && src.tintFill); - var tintTL = Utils.getTintAppendFloatAlpha(src._tintTL, camera.alpha * src._alphaTL); - var tintTR = Utils.getTintAppendFloatAlpha(src._tintTR, camera.alpha * src._alphaTR); - var tintBL = Utils.getTintAppendFloatAlpha(src._tintBL, camera.alpha * src._alphaBL); - var tintBR = Utils.getTintAppendFloatAlpha(src._tintBR, camera.alpha * src._alphaBR); + var tintEffect = src.tintFill; + var tintTL = Utils.getTintAppendFloatAlpha(src.tintTopLeft, camera.alpha * src._alphaTL); + var tintTR = Utils.getTintAppendFloatAlpha(src.tintTopRight, camera.alpha * src._alphaTR); + var tintBL = Utils.getTintAppendFloatAlpha(src.tintBottomLeft, camera.alpha * src._alphaBL); + var tintBR = Utils.getTintAppendFloatAlpha(src.tintBottomRight, camera.alpha * src._alphaBR); var textureUnit = pipeline.setGameObject(src); @@ -151447,8 +160440,6 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce var lastCharCode = 0; var letterSpacing = src.letterSpacing; var glyph; - var glyphX = 0; - var glyphY = 0; var glyphW = 0; var glyphH = 0; var lastGlyph; @@ -151466,7 +160457,14 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce var lineOffsetX = 0; // Update the bounds - skipped internally if not dirty - src.getTextBounds(false); + var bounds = src.getTextBounds(false); + + // In case the method above changed it (word wrapping) + if (src.maxWidth > 0) + { + text = bounds.wrappedText; + textLength = text.length; + } var lineData = src._bounds.lines; @@ -151483,6 +160481,8 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce var displayCallback = src.displayCallback; var callbackData = src.callbackData; + renderer.pipelines.preBatch(src); + for (var i = 0; i < textLength; i++) { charCode = text.charCodeAt(i); @@ -151515,9 +160515,6 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce continue; } - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; - glyphW = glyph.width; glyphH = glyph.height; @@ -151580,10 +160577,10 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce tintBR = output.tint.bottomRight; } - tintTL = Utils.getTintAppendFloatAlpha(GetColorFromValue(tintTL), camera.alpha * src._alphaTL); - tintTR = Utils.getTintAppendFloatAlpha(GetColorFromValue(tintTR), camera.alpha * src._alphaTR); - tintBL = Utils.getTintAppendFloatAlpha(GetColorFromValue(tintBL), camera.alpha * src._alphaBL); - tintBR = Utils.getTintAppendFloatAlpha(GetColorFromValue(tintBR), camera.alpha * src._alphaBR); + tintTL = Utils.getTintAppendFloatAlpha(tintTL, camera.alpha * src._alphaTL); + tintTR = Utils.getTintAppendFloatAlpha(tintTR, camera.alpha * src._alphaTR); + tintBL = Utils.getTintAppendFloatAlpha(tintBL, camera.alpha * src._alphaBL); + tintBR = Utils.getTintAppendFloatAlpha(tintBR, camera.alpha * src._alphaBR); } x *= scale; @@ -151598,10 +160595,10 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce calcMatrix.multiply(fontMatrix, spriteMatrix); - var u0 = glyphX / textureWidth; - var v0 = glyphY / textureHeight; - var u1 = (glyphX + glyphW) / textureWidth; - var v1 = (glyphY + glyphH) / textureHeight; + var u0 = glyph.u0; + var v0 = glyph.v0; + var u1 = glyph.u1; + var v1 = glyph.v1; var xw = glyphW; var yh = glyphH; @@ -151633,7 +160630,7 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce ty3 = Math.round(ty3); } - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); + pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); } if (crop) @@ -151642,13 +160639,15 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce renderer.popScissor(); } + + renderer.pipelines.postBatch(src); }; module.exports = DynamicBitmapTextWebGLRenderer; /***/ }), -/* 985 */ +/* 1042 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151657,7 +160656,7 @@ module.exports = DynamicBitmapTextWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTransform = __webpack_require__(28); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -151670,11 +160669,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.DynamicBitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var DynamicBitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix) { var text = src._text; var textLength = text.length; @@ -151685,7 +160683,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc { return; } - + var textureFrame = src.frame; var displayCallback = src.displayCallback; @@ -151859,7 +160857,7 @@ module.exports = DynamicBitmapTextCanvasRenderer; /***/ }), -/* 986 */ +/* 1043 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151873,12 +160871,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(987); + renderWebGL = __webpack_require__(1044); } if (true) { - renderCanvas = __webpack_require__(988); + renderCanvas = __webpack_require__(1045); } module.exports = { @@ -151890,8 +160888,8 @@ module.exports = { /***/ }), -/* 987 */ -/***/ (function(module, exports) { +/* 1044 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -151899,6 +160897,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetCalcMatrix = __webpack_require__(21); + /** * Renders this Game Object with the WebGL Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. @@ -151910,44 +160910,15 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Extern} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ExternWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ExternWebGLRenderer = function (renderer, src, camera, parentMatrix) { renderer.pipelines.clear(); - var camMatrix = renderer._tempMatrix1; - var spriteMatrix = renderer._tempMatrix2; - var calcMatrix = renderer._tempMatrix3; + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - // Callback src.render.call(src, renderer, camera, calcMatrix); renderer.pipelines.rebind(); @@ -151957,13 +160928,13 @@ module.exports = ExternWebGLRenderer; /***/ }), -/* 988 */ +/* 1045 */ /***/ (function(module, exports) { /***/ }), -/* 989 */ +/* 1046 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151977,15 +160948,15 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(990); + renderWebGL = __webpack_require__(1047); // Needed for Graphics.generateTexture - renderCanvas = __webpack_require__(415); + renderCanvas = __webpack_require__(425); } if (true) { - renderCanvas = __webpack_require__(415); + renderCanvas = __webpack_require__(425); } module.exports = { @@ -151997,7 +160968,7 @@ module.exports = { /***/ }), -/* 990 */ +/* 1047 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152006,10 +160977,11 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Commands = __webpack_require__(203); -var Utils = __webpack_require__(10); +var Commands = __webpack_require__(208); +var GetCalcMatrix = __webpack_require__(21); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); -// TODO: Remove the use of this var Point = function (x, y, width) { this.x = x; @@ -152017,7 +160989,6 @@ var Point = function (x, y, width) this.width = width; }; -// TODO: Remove the use of this var Path = function (x, y, width) { this.points = []; @@ -152026,6 +160997,7 @@ var Path = function (x, y, width) }; var matrixStack = []; +var tempMatrix = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -152038,49 +161010,23 @@ var matrixStack = []; * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Graphics} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var GraphicsWebGLRenderer = function (renderer, src, camera, parentMatrix) { if (src.commandBuffer.length === 0) { return; } - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); - var camMatrix = src._tempMatrix1; - var graphicsMatrix = src._tempMatrix2; - var currentMatrix = src._tempMatrix3; + renderer.pipelines.preBatch(src); - currentMatrix.loadIdentity(); + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; - graphicsMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - graphicsMatrix.e = src.x; - graphicsMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(graphicsMatrix); - } - else - { - graphicsMatrix.e -= camera.scrollX * src.scrollFactorX; - graphicsMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(graphicsMatrix); - } + var currentMatrix = tempMatrix.loadIdentity(); var commands = src.commandBuffer; var alpha = camera.alpha * src.alpha; @@ -152099,13 +161045,10 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca var path = []; var pathIndex = 0; - var pathOpen = false; + var pathOpen = true; var lastPath = null; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; - - // Set to a white texture, not a blank one, so Lights2D works too! - var currentTexture = renderer.tempTextures[0]; + var getTint = Utils.getTintAppendFloatAlpha; for (var cmdIndex = 0; cmdIndex < commands.length; cmdIndex++) { @@ -152114,14 +161057,15 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca switch (cmd) { case Commands.BEGIN_PATH: - + { path.length = 0; lastPath = null; pathOpen = true; break; + } case Commands.CLOSE_PATH: - + { pathOpen = false; if (lastPath && lastPath.points.length) @@ -152129,36 +161073,38 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca lastPath.points.push(lastPath.points[0]); } break; + } case Commands.FILL_PATH: + { for (pathIndex = 0; pathIndex < path.length; pathIndex++) { - pipeline.setTexture2D(currentTexture, src); - pipeline.batchFillPath( path[pathIndex].points, currentMatrix, - camMatrix + calcMatrix ); } break; + } case Commands.STROKE_PATH: + { for (pathIndex = 0; pathIndex < path.length; pathIndex++) { - pipeline.setTexture2D(currentTexture, src); - pipeline.batchStrokePath( path[pathIndex].points, lineWidth, pathOpen, currentMatrix, - camMatrix + calcMatrix ); } break; + } case Commands.LINE_STYLE: + { lineWidth = commands[++cmdIndex]; var strokeColor = commands[++cmdIndex]; var strokeAlpha = commands[++cmdIndex] * alpha; @@ -152168,8 +161114,10 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca strokeTint.BL = strokeTintColor; strokeTint.BR = strokeTintColor; break; + } case Commands.FILL_STYLE: + { var fillColor = commands[++cmdIndex]; var fillAlpha = commands[++cmdIndex] * alpha; var fillTintColor = getTint(fillColor, fillAlpha); @@ -152178,16 +161126,24 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca fillTint.BL = fillTintColor; fillTint.BR = fillTintColor; break; + } case Commands.GRADIENT_FILL_STYLE: - var gradientFillAlpha = commands[++cmdIndex] * alpha; - fillTint.TL = getTint(commands[++cmdIndex], gradientFillAlpha); - fillTint.TR = getTint(commands[++cmdIndex], gradientFillAlpha); - fillTint.BL = getTint(commands[++cmdIndex], gradientFillAlpha); - fillTint.BR = getTint(commands[++cmdIndex], gradientFillAlpha); + { + var alphaTL = commands[++cmdIndex] * alpha; + var alphaTR = commands[++cmdIndex] * alpha; + var alphaBL = commands[++cmdIndex] * alpha; + var alphaBR = commands[++cmdIndex] * alpha; + + fillTint.TL = getTint(commands[++cmdIndex], alphaTL); + fillTint.TR = getTint(commands[++cmdIndex], alphaTR); + fillTint.BL = getTint(commands[++cmdIndex], alphaBL); + fillTint.BR = getTint(commands[++cmdIndex], alphaBR); break; + } case Commands.GRADIENT_LINE_STYLE: + { lineWidth = commands[++cmdIndex]; var gradientLineAlpha = commands[++cmdIndex] * alpha; strokeTint.TL = getTint(commands[++cmdIndex], gradientLineAlpha); @@ -152195,8 +161151,10 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca strokeTint.BL = getTint(commands[++cmdIndex], gradientLineAlpha); strokeTint.BR = getTint(commands[++cmdIndex], gradientLineAlpha); break; + } case Commands.ARC: + { var iteration = 0; var x = commands[++cmdIndex]; var y = commands[++cmdIndex]; @@ -152253,21 +161211,23 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca lastPath.points.push(new Point(tx, ty, lineWidth)); break; + } case Commands.FILL_RECT: - pipeline.setTexture2D(currentTexture, src); + { pipeline.batchFillRect( commands[++cmdIndex], commands[++cmdIndex], commands[++cmdIndex], commands[++cmdIndex], currentMatrix, - camMatrix + calcMatrix ); break; + } case Commands.FILL_TRIANGLE: - pipeline.setTexture2D(currentTexture, src); + { pipeline.batchFillTriangle( commands[++cmdIndex], commands[++cmdIndex], @@ -152276,12 +161236,13 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca commands[++cmdIndex], commands[++cmdIndex], currentMatrix, - camMatrix + calcMatrix ); break; + } case Commands.STROKE_TRIANGLE: - pipeline.setTexture2D(currentTexture, src); + { pipeline.batchStrokeTriangle( commands[++cmdIndex], commands[++cmdIndex], @@ -152291,11 +161252,13 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca commands[++cmdIndex], lineWidth, currentMatrix, - camMatrix + calcMatrix ); break; + } case Commands.LINE_TO: + { if (lastPath !== null) { lastPath.points.push(new Point(commands[++cmdIndex], commands[++cmdIndex], lineWidth)); @@ -152306,62 +161269,59 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca path.push(lastPath); } break; + } case Commands.MOVE_TO: + { lastPath = new Path(commands[++cmdIndex], commands[++cmdIndex], lineWidth); path.push(lastPath); break; + } case Commands.SAVE: + { matrixStack.push(currentMatrix.copyToArray()); break; + } case Commands.RESTORE: + { currentMatrix.copyFromArray(matrixStack.pop()); break; + } case Commands.TRANSLATE: + { x = commands[++cmdIndex]; y = commands[++cmdIndex]; currentMatrix.translate(x, y); break; + } case Commands.SCALE: + { x = commands[++cmdIndex]; y = commands[++cmdIndex]; currentMatrix.scale(x, y); break; + } case Commands.ROTATE: + { currentMatrix.rotate(commands[++cmdIndex]); break; - - case Commands.SET_TEXTURE: - var frame = commands[++cmdIndex]; - var mode = commands[++cmdIndex]; - - pipeline.currentFrame = frame; - pipeline.setTexture2D(frame.glTexture, src); - pipeline.tintEffect = mode; - - currentTexture = frame.glTexture; - - break; - - case Commands.CLEAR_TEXTURE: - pipeline.currentFrame = renderer.blankTexture; - pipeline.tintEffect = 2; - currentTexture = renderer.tempTextures[0]; - break; + } } } + + renderer.pipelines.postBatch(src); }; module.exports = GraphicsWebGLRenderer; /***/ }), -/* 991 */ +/* 1048 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152375,12 +161335,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(992); + renderWebGL = __webpack_require__(1049); } if (true) { - renderCanvas = __webpack_require__(993); + renderCanvas = __webpack_require__(1050); } module.exports = { @@ -152392,7 +161352,7 @@ module.exports = { /***/ }), -/* 992 */ +/* 1049 */ /***/ (function(module, exports) { /** @@ -152412,11 +161372,10 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var SpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var SpriteWebGLRenderer = function (renderer, src, camera, parentMatrix) { this.pipeline.batchSprite(src, camera, parentMatrix); }; @@ -152425,7 +161384,7 @@ module.exports = SpriteWebGLRenderer; /***/ }), -/* 993 */ +/* 1050 */ /***/ (function(module, exports) { /** @@ -152445,11 +161404,10 @@ module.exports = SpriteWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var SpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var SpriteCanvasRenderer = function (renderer, src, camera, parentMatrix) { renderer.batchSprite(src, src.frame, camera, parentMatrix); }; @@ -152458,7 +161416,7 @@ module.exports = SpriteCanvasRenderer; /***/ }), -/* 994 */ +/* 1051 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152472,12 +161430,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(995); + renderWebGL = __webpack_require__(1052); } if (true) { - renderCanvas = __webpack_require__(996); + renderCanvas = __webpack_require__(1053); } module.exports = { @@ -152489,7 +161447,7 @@ module.exports = { /***/ }), -/* 995 */ +/* 1052 */ /***/ (function(module, exports) { /** @@ -152509,11 +161467,10 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ImageWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ImageWebGLRenderer = function (renderer, src, camera, parentMatrix) { this.pipeline.batchSprite(src, camera, parentMatrix); }; @@ -152522,7 +161479,7 @@ module.exports = ImageWebGLRenderer; /***/ }), -/* 996 */ +/* 1053 */ /***/ (function(module, exports) { /** @@ -152542,11 +161499,10 @@ module.exports = ImageWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ImageCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ImageCanvasRenderer = function (renderer, src, camera, parentMatrix) { renderer.batchSprite(src, src.frame, camera, parentMatrix); }; @@ -152555,7 +161511,247 @@ module.exports = ImageCanvasRenderer; /***/ }), -/* 997 */ +/* 1054 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var renderWebGL = __webpack_require__(1); +var renderCanvas = __webpack_require__(1); + +if (true) +{ + renderWebGL = __webpack_require__(1055); +} + +if (true) +{ + renderCanvas = __webpack_require__(1056); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), +/* 1055 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Layer#renderWebGL + * @since 3.50.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Layer} layer - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var LayerWebGLRenderer = function (renderer, layer, camera) +{ + var children = layer.list; + var childCount = children.length; + + if (childCount === 0) + { + return; + } + + layer.depthSort(); + + renderer.pipelines.preBatch(layer); + + var layerHasBlendMode = (layer.blendMode !== -1); + + if (!layerHasBlendMode) + { + // If Layer is SKIP_TEST then set blend mode to be Normal + renderer.setBlendMode(0); + } + + var alpha = layer.alpha; + + for (var i = 0; i < childCount; i++) + { + var child = children[i]; + + if (!child.willRender(camera)) + { + continue; + } + + var childAlphaTopLeft; + var childAlphaTopRight; + var childAlphaBottomLeft; + var childAlphaBottomRight; + + if (child.alphaTopLeft !== undefined) + { + childAlphaTopLeft = child.alphaTopLeft; + childAlphaTopRight = child.alphaTopRight; + childAlphaBottomLeft = child.alphaBottomLeft; + childAlphaBottomRight = child.alphaBottomRight; + } + else + { + var childAlpha = child.alpha; + + childAlphaTopLeft = childAlpha; + childAlphaTopRight = childAlpha; + childAlphaBottomLeft = childAlpha; + childAlphaBottomRight = childAlpha; + } + + if (!layerHasBlendMode && child.blendMode !== renderer.currentBlendMode) + { + // If Layer doesn't have its own blend mode, then a child can have one + renderer.setBlendMode(child.blendMode); + } + + var mask = child.mask; + + if (mask) + { + mask.preRenderWebGL(renderer, child, camera); + } + + var type = child.type; + + if (type !== renderer.currentType) + { + renderer.newType = true; + renderer.currentType = type; + } + + renderer.nextTypeMatch = (i < childCount - 1) ? (children[i + 1].type === renderer.currentType) : false; + + child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha); + + // Render + child.renderWebGL(renderer, child, camera); + + // Restore original values + child.setAlpha(childAlphaTopLeft, childAlphaTopRight, childAlphaBottomLeft, childAlphaBottomRight); + + if (mask) + { + mask.postRenderWebGL(renderer, camera); + } + + renderer.newType = false; + } + + renderer.pipelines.postBatch(layer); +}; + +module.exports = LayerWebGLRenderer; + + +/***/ }), +/* 1056 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Layer#renderCanvas + * @since 3.50.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Layer} layer - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var LayerCanvasRenderer = function (renderer, layer, camera) +{ + var children = layer.list; + + if (children.length === 0) + { + return; + } + + layer.depthSort(); + + var layerHasBlendMode = (layer.blendMode !== -1); + + if (!layerHasBlendMode) + { + // If Layer is SKIP_TEST then set blend mode to be Normal + renderer.setBlendMode(0); + } + + var alpha = layer._alpha; + + if (layer.mask) + { + layer.mask.preRenderCanvas(renderer, null, camera); + } + + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + + if (!child.willRender(camera)) + { + continue; + } + + var childAlpha = child.alpha; + + if (!layerHasBlendMode && child.blendMode !== renderer.currentBlendMode) + { + // If Layer doesn't have its own blend mode, then a child can have one + renderer.setBlendMode(child.blendMode); + } + + // Set parent values + child.setAlpha(childAlpha * alpha); + + // Render + child.renderCanvas(renderer, child, camera); + + // Restore original values + child.setAlpha(childAlpha); + } + + if (layer.mask) + { + layer.mask.postRenderCanvas(renderer); + } +}; + +module.exports = LayerCanvasRenderer; + + +/***/ }), +/* 1057 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152570,18 +161766,18 @@ module.exports = ImageCanvasRenderer; module.exports = { - EmitterOp: __webpack_require__(416), - GravityWell: __webpack_require__(417), - Particle: __webpack_require__(418), - ParticleEmitter: __webpack_require__(419), - ParticleEmitterManager: __webpack_require__(205), - Zones: __webpack_require__(1001) + EmitterOp: __webpack_require__(426), + GravityWell: __webpack_require__(427), + Particle: __webpack_require__(428), + ParticleEmitter: __webpack_require__(429), + ParticleEmitterManager: __webpack_require__(211), + Zones: __webpack_require__(1061) }; /***/ }), -/* 998 */ +/* 1058 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152595,12 +161791,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(999); + renderWebGL = __webpack_require__(1059); } if (true) { - renderCanvas = __webpack_require__(1000); + renderCanvas = __webpack_require__(1060); } module.exports = { @@ -152612,7 +161808,7 @@ module.exports = { /***/ }), -/* 999 */ +/* 1059 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152621,7 +161817,13 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); +var tempMatrix4 = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -152634,11 +161836,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpolationPercentage, camera, parentMatrix) +var ParticleManagerWebGLRenderer = function (renderer, emitterManager, camera, parentMatrix) { var emitters = emitterManager.emitters.list; var emittersLength = emitters.length; @@ -152648,21 +161849,34 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola return; } - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(emitterManager.pipeline); - var camMatrix = pipeline._tempMatrix1.copyFrom(camera.matrix); - var calcMatrix = pipeline._tempMatrix2; - var particleMatrix = pipeline._tempMatrix3; - var managerMatrix = pipeline._tempMatrix4.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + var camMatrix = tempMatrix1; + var calcMatrix = tempMatrix2; + var particleMatrix = tempMatrix3; + var managerMatrix = tempMatrix4; - camMatrix.multiply(managerMatrix); + if (parentMatrix) + { + managerMatrix.loadIdentity(); + managerMatrix.multiply(parentMatrix); + managerMatrix.translate(emitterManager.x, emitterManager.y); + managerMatrix.rotate(emitterManager.rotation); + managerMatrix.scale(emitterManager.scaleX, emitterManager.scaleY); + } + else + { + managerMatrix.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + } var roundPixels = camera.roundPixels; var texture = emitterManager.defaultFrame.glTexture; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; + var getTint = Utils.getTintAppendFloatAlpha; var textureUnit = pipeline.setGameObject(emitterManager, emitterManager.defaultFrame); + renderer.pipelines.preBatch(emitterManager); + for (var e = 0; e < emittersLength; e++) { var emitter = emitters[e]; @@ -152674,29 +161888,19 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola continue; } - var scrollX = camera.scrollX * emitter.scrollFactorX; - var scrollY = camera.scrollY * emitter.scrollFactorY; + var followX = (emitter.follow) ? emitter.follow.x + emitter.followOffset.x : 0; + var followY = (emitter.follow) ? emitter.follow.y + emitter.followOffset.y : 0; - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -scrollX, -scrollY); + var scrollFactorX = emitter.scrollFactorX; + var scrollFactorY = emitter.scrollFactorY; - scrollX = 0; - scrollY = 0; - } - - if (renderer.setBlendMode(emitter.blendMode)) - { - // Rebind the texture if we've flushed - // pipeline.setTexture2D(texture, 0); - } + renderer.setBlendMode(emitter.blendMode); if (emitter.mask) { emitter.mask.preRenderWebGL(renderer, emitter, camera); - // pipeline.setTexture2D(texture, 0); + renderer.pipelines.set(emitterManager.pipeline); } var tintEffect = 0; @@ -152712,67 +161916,58 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola continue; } + particleMatrix.applyITRS(particle.x, particle.y, particle.rotation, particle.scaleX, particle.scaleY); + + camMatrix.copyFrom(camera.matrix); + + camMatrix.multiplyWithOffset(managerMatrix, followX + -camera.scrollX * scrollFactorX, followY + -camera.scrollY * scrollFactorY); + + // Undo the camera scroll + particleMatrix.e = particle.x; + particleMatrix.f = particle.y; + + // Multiply by the particle matrix, store result in calcMatrix + camMatrix.multiply(particleMatrix, calcMatrix); + var frame = particle.frame; - var x = -(frame.halfWidth); - var y = -(frame.halfHeight); + var x = -frame.halfWidth; + var y = -frame.halfHeight; var xw = x + frame.width; var yh = y + frame.height; - particleMatrix.applyITRS(0, 0, particle.rotation, particle.scaleX, particle.scaleY); + var tx0 = calcMatrix.getXRound(x, y, roundPixels); + var ty0 = calcMatrix.getYRound(x, y, roundPixels); - particleMatrix.e = particle.x - scrollX; - particleMatrix.f = particle.y - scrollY; + var tx1 = calcMatrix.getXRound(x, yh, roundPixels); + var ty1 = calcMatrix.getYRound(x, yh, roundPixels); - camMatrix.multiply(particleMatrix, calcMatrix); + var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); + var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); - - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); - - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); - - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); - - if (roundPixels) - { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); - - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); - - tx2 = Math.round(tx2); - ty2 = Math.round(ty2); - - tx3 = Math.round(tx3); - ty3 = Math.round(ty3); - } + var tx3 = calcMatrix.getXRound(xw, y, roundPixels); + var ty3 = calcMatrix.getYRound(xw, y, roundPixels); var tint = getTint(particle.tint, alpha); - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, texture, textureUnit); + pipeline.batchQuad(emitter, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, texture, textureUnit); } if (emitter.mask) { emitter.mask.postRenderWebGL(renderer, camera); - - // pipeline.setTexture2D(texture, 0); } } + + renderer.pipelines.postBatch(emitterManager); }; module.exports = ParticleManagerWebGLRenderer; /***/ }), -/* 1000 */ -/***/ (function(module, exports) { +/* 1060 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -152780,6 +161975,13 @@ module.exports = ParticleManagerWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var TransformMatrix = __webpack_require__(24); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); +var tempMatrix4 = new TransformMatrix(); + /** * Renders this Game Object with the Canvas Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. @@ -152791,11 +161993,10 @@ module.exports = ParticleManagerWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpolationPercentage, camera, parentMatrix) +var ParticleManagerCanvasRenderer = function (renderer, emitterManager, camera, parentMatrix) { var emitters = emitterManager.emitters.list; var emittersLength = emitters.length; @@ -152805,18 +162006,26 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol return; } - var camMatrix = renderer._tempMatrix1.copyFrom(camera.matrix); - var calcMatrix = renderer._tempMatrix2; - var particleMatrix = renderer._tempMatrix3; - var managerMatrix = renderer._tempMatrix4.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + var camMatrix = tempMatrix1.copyFrom(camera.matrix); + var calcMatrix = tempMatrix2; + var particleMatrix = tempMatrix3; + var managerMatrix = tempMatrix4; - camMatrix.multiply(managerMatrix); - - var roundPixels = camera.roundPixels; + if (parentMatrix) + { + managerMatrix.loadIdentity(); + managerMatrix.multiply(parentMatrix); + managerMatrix.translate(emitterManager.x, emitterManager.y); + managerMatrix.rotate(emitterManager.rotation); + managerMatrix.scale(emitterManager.scaleX, emitterManager.scaleY); + } + else + { + managerMatrix.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + } var ctx = renderer.currentContext; - - ctx.save(); + var roundPixels = camera.roundPixels; for (var e = 0; e < emittersLength; e++) { @@ -152829,17 +162038,13 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol continue; } - var scrollX = camera.scrollX * emitter.scrollFactorX; - var scrollY = camera.scrollY * emitter.scrollFactorY; + var followX = (emitter.follow) ? emitter.follow.x + emitter.followOffset.x : 0; + var followY = (emitter.follow) ? emitter.follow.y + emitter.followOffset.y : 0; - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -scrollX, -scrollY); + var scrollFactorX = emitter.scrollFactorX; + var scrollFactorY = emitter.scrollFactorY; - scrollX = 0; - scrollY = 0; - } + ctx.save(); ctx.globalCompositeOperation = renderer.blendModes[emitter.blendMode]; @@ -152854,24 +162059,30 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol continue; } + particleMatrix.applyITRS(particle.x, particle.y, particle.rotation, particle.scaleX, particle.scaleY); + + camMatrix.copyFrom(camera.matrix); + + camMatrix.multiplyWithOffset(managerMatrix, followX + -camera.scrollX * scrollFactorX, followY + -camera.scrollY * scrollFactorY); + + // Undo the camera scroll + particleMatrix.e = particle.x; + particleMatrix.f = particle.y; + + // Multiply by the particle matrix, store result in calcMatrix + camMatrix.multiply(particleMatrix, calcMatrix); + var frame = particle.frame; var cd = frame.canvasData; var x = -(frame.halfWidth); var y = -(frame.halfHeight); - particleMatrix.applyITRS(0, 0, particle.rotation, particle.scaleX, particle.scaleY); - - particleMatrix.e = particle.x - scrollX; - particleMatrix.f = particle.y - scrollY; - - camMatrix.multiply(particleMatrix, calcMatrix); - ctx.globalAlpha = alpha; - + ctx.save(); - calcMatrix.copyToContext(ctx); + calcMatrix.setToContext(ctx); if (roundPixels) { @@ -152885,16 +162096,16 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol ctx.restore(); } - } - ctx.restore(); + ctx.restore(); + } }; module.exports = ParticleManagerCanvasRenderer; /***/ }), -/* 1001 */ +/* 1061 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152909,15 +162120,15 @@ module.exports = ParticleManagerCanvasRenderer; module.exports = { - DeathZone: __webpack_require__(420), - EdgeZone: __webpack_require__(421), - RandomZone: __webpack_require__(423) + DeathZone: __webpack_require__(430), + EdgeZone: __webpack_require__(431), + RandomZone: __webpack_require__(433) }; /***/ }), -/* 1002 */ +/* 1062 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152931,12 +162142,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1003); + renderWebGL = __webpack_require__(1063); } if (true) { - renderCanvas = __webpack_require__(1004); + renderCanvas = __webpack_require__(1064); } module.exports = { @@ -152948,7 +162159,7 @@ module.exports = { /***/ }), -/* 1003 */ +/* 1063 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152957,7 +162168,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -152970,23 +162181,28 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.RenderTexture} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RenderTextureWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RenderTextureWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var frame = src.frame; - var width = frame.width; - var height = frame.height; - var getTint = Utils.getTintAppendFloatAlpha; - var pipeline = renderer.pipelines.set(src.pipeline, src); + var cameraAlpha = camera.alpha; - var textureUnit = pipeline.setTexture2D(frame.glTexture, src); + var renderTarget = src.renderTarget; + var width = renderTarget.width; + var height = renderTarget.height; + + var getTint = Utils.getTintAppendFloatAlpha; + + var pipeline = renderer.pipelines.set(src.pipeline); + + var textureUnit = pipeline.setTexture2D(renderTarget.texture); + + renderer.pipelines.preBatch(src); pipeline.batchTexture( src, - frame.glTexture, + renderTarget.texture, width, height, src.x, src.y, width, height, @@ -152996,24 +162212,28 @@ var RenderTextureWebGLRenderer = function (renderer, src, interpolationPercentag src.scrollFactorX, src.scrollFactorY, src.displayOriginX, src.displayOriginY, 0, 0, width, height, - getTint(src._tintTL, camera.alpha * src._alphaTL), - getTint(src._tintTR, camera.alpha * src._alphaTR), - getTint(src._tintBL, camera.alpha * src._alphaBL), - getTint(src._tintBR, camera.alpha * src._alphaBR), - (src._isTinted && src.tintFill), + getTint(src.tintTopLeft, cameraAlpha * src._alphaTL), + getTint(src.tintTopRight, cameraAlpha * src._alphaTR), + getTint(src.tintBottomLeft, cameraAlpha * src._alphaBL), + getTint(src.tintBottomRight, cameraAlpha * src._alphaBR), + src.tintFill, 0, 0, camera, parentMatrix, - false, + true, textureUnit ); + + renderer.resetTextures(); + + renderer.pipelines.postBatch(src); }; module.exports = RenderTextureWebGLRenderer; /***/ }), -/* 1004 */ +/* 1064 */ /***/ (function(module, exports) { /** @@ -153033,11 +162253,10 @@ module.exports = RenderTextureWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.RenderTexture} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RenderTextureCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RenderTextureCanvasRenderer = function (renderer, src, camera, parentMatrix) { renderer.batchSprite(src, src.frame, camera, parentMatrix); }; @@ -153046,7 +162265,7 @@ module.exports = RenderTextureCanvasRenderer; /***/ }), -/* 1005 */ +/* 1065 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153055,15 +162274,15 @@ module.exports = RenderTextureCanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RETRO_FONT_CONST = __webpack_require__(1006); -var Extend = __webpack_require__(19); +var RETRO_FONT_CONST = __webpack_require__(1066); +var Extend = __webpack_require__(18); /** * @namespace Phaser.GameObjects.RetroFont * @since 3.6.0 */ -var RetroFont = { Parse: __webpack_require__(1007) }; +var RetroFont = { Parse: __webpack_require__(1067) }; // Merge in the consts RetroFont = Extend(false, RetroFont, RETRO_FONT_CONST); @@ -153072,7 +162291,7 @@ module.exports = RetroFont; /***/ }), -/* 1006 */ +/* 1066 */ /***/ (function(module, exports) { /** @@ -153188,7 +162407,7 @@ module.exports = RETRO_FONT_CONST; /***/ }), -/* 1007 */ +/* 1067 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153215,8 +162434,10 @@ var ParseRetroFont = function (scene, config) { var w = config.width; var h = config.height; + var cx = Math.floor(w / 2); var cy = Math.floor(h / 2); + var letters = GetValue(config, 'chars', ''); if (letters === '') @@ -153225,6 +162446,13 @@ var ParseRetroFont = function (scene, config) } var key = GetValue(config, 'image', ''); + + var frame = scene.sys.textures.getFrame(key); + var textureX = frame.cutX; + var textureY = frame.cutY; + var textureWidth = frame.source.width; + var textureHeight = frame.source.height; + var offsetX = GetValue(config, 'offset.x', 0); var offsetY = GetValue(config, 'offset.y', 0); var spacingX = GetValue(config, 'spacing.x', 0); @@ -153235,7 +162463,7 @@ var ParseRetroFont = function (scene, config) if (charsPerRow === null) { - charsPerRow = scene.sys.textures.getFrame(key).width / w; + charsPerRow = textureWidth / w; if (charsPerRow > letters.length) { @@ -153258,10 +162486,13 @@ var ParseRetroFont = function (scene, config) for (var i = 0; i < letters.length; i++) { - // var node = letters[i]; - var charCode = letters.charCodeAt(i); + var u0 = (textureX + x) / textureWidth; + var v0 = (textureY + y) / textureHeight; + var u1 = (textureX + x + w) / textureWidth; + var v1 = (textureY + y + h) / textureHeight; + data.chars[charCode] = { x: x, @@ -153274,7 +162505,11 @@ var ParseRetroFont = function (scene, config) yOffset: 0, xAdvance: w, data: {}, - kerning: {} + kerning: {}, + u0: u0, + v0: v0, + u1: u1, + v1: v1 }; r++; @@ -153304,7 +162539,7 @@ module.exports = ParseRetroFont; /***/ }), -/* 1008 */ +/* 1068 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153318,12 +162553,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1009); + renderWebGL = __webpack_require__(1069); } if (true) { - renderCanvas = __webpack_require__(1010); + renderCanvas = __webpack_require__(1070); } module.exports = { @@ -153335,7 +162570,7 @@ module.exports = { /***/ }), -/* 1009 */ +/* 1069 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153344,7 +162579,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -153357,49 +162593,21 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Rope} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RopeWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RopeWebGLRenderer = function (renderer, src, camera, parentMatrix) { var pipeline = renderer.pipelines.set(src.pipeline, src); - var camMatrix = pipeline._tempMatrix1; - var spriteMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; - - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; var vertices = src.vertices; var uvs = src.uv; var colors = src.colors; var alphas = src.alphas; var alpha = src.alpha; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; + var getTint = Utils.getTintAppendFloatAlpha; var roundPixels = camera.roundPixels; var meshVerticesLength = vertices.length; @@ -153408,12 +162616,14 @@ var RopeWebGLRenderer = function (renderer, src, interpolationPercentage, camera // Because it's a triangle strip and we don't want lots of degenerate triangles joining things up pipeline.flush(); + renderer.pipelines.preBatch(src); + var textureUnit = pipeline.setGameObject(src); var vertexViewF32 = pipeline.vertexViewF32; var vertexViewU32 = pipeline.vertexViewU32; - var vertexOffset = (pipeline.vertexCount * pipeline.vertexComponentCount) - 1; + var vertexOffset = (pipeline.vertexCount * pipeline.currentShader.vertexComponentCount) - 1; var colorIndex = 0; @@ -153464,13 +162674,15 @@ var RopeWebGLRenderer = function (renderer, src, interpolationPercentage, camera } pipeline.vertexCount += vertexCount; + + renderer.pipelines.postBatch(src); }; module.exports = RopeWebGLRenderer; /***/ }), -/* 1010 */ +/* 1070 */ /***/ (function(module, exports) { /** @@ -153488,7 +162700,6 @@ module.exports = RopeWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Rope} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ var RopeCanvasRenderer = function () @@ -153499,7 +162710,7 @@ module.exports = RopeCanvasRenderer; /***/ }), -/* 1011 */ +/* 1071 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153513,12 +162724,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1012); + renderWebGL = __webpack_require__(1072); } if (true) { - renderCanvas = __webpack_require__(1013); + renderCanvas = __webpack_require__(1073); } module.exports = { @@ -153530,7 +162741,7 @@ module.exports = { /***/ }), -/* 1012 */ +/* 1072 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153539,7 +162750,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -153552,11 +162763,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Text} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TextWebGLRenderer = function (renderer, src, camera, parentMatrix) { if (src.width === 0 || src.height === 0) { @@ -153567,10 +162777,12 @@ var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera var width = frame.width; var height = frame.height; var getTint = Utils.getTintAppendFloatAlpha; - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); var textureUnit = pipeline.setTexture2D(frame.glTexture, src); + renderer.pipelines.preBatch(src); + pipeline.batchTexture( src, frame.glTexture, @@ -153583,24 +162795,26 @@ var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera src.scrollFactorX, src.scrollFactorY, src.displayOriginX, src.displayOriginY, 0, 0, width, height, - getTint(src._tintTL, camera.alpha * src._alphaTL), - getTint(src._tintTR, camera.alpha * src._alphaTR), - getTint(src._tintBL, camera.alpha * src._alphaBL), - getTint(src._tintBR, camera.alpha * src._alphaBR), - (src._isTinted && src.tintFill), + getTint(src.tintTopLeft, camera.alpha * src._alphaTL), + getTint(src.tintTopRight, camera.alpha * src._alphaTR), + getTint(src.tintBottomLeft, camera.alpha * src._alphaBL), + getTint(src.tintBottomRight, camera.alpha * src._alphaBR), + src.tintFill, 0, 0, camera, parentMatrix, false, textureUnit ); + + renderer.pipelines.postBatch(src); }; module.exports = TextWebGLRenderer; /***/ }), -/* 1013 */ +/* 1073 */ /***/ (function(module, exports) { /** @@ -153620,13 +162834,12 @@ module.exports = TextWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Text} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TextCanvasRenderer = function (renderer, src, camera, parentMatrix) { - if ((src.width === 0) || (src.height === 0)) + if (src.width === 0 || src.height === 0) { return; } @@ -153638,7 +162851,7 @@ module.exports = TextCanvasRenderer; /***/ }), -/* 1014 */ +/* 1074 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153652,12 +162865,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1015); + renderWebGL = __webpack_require__(1075); } if (true) { - renderCanvas = __webpack_require__(1016); + renderCanvas = __webpack_require__(1076); } module.exports = { @@ -153669,7 +162882,7 @@ module.exports = { /***/ }), -/* 1015 */ +/* 1075 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153678,7 +162891,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -153691,11 +162904,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.TileSprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TileSpriteWebGLRenderer = function (renderer, src, camera, parentMatrix) { src.updateCanvas(); @@ -153706,9 +162918,11 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, return; } + renderer.pipelines.preBatch(src); + var getTint = Utils.getTintAppendFloatAlpha; - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); var textureUnit = pipeline.setTexture2D(src.fillPattern, src); @@ -153724,11 +162938,11 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, src.scrollFactorX, src.scrollFactorY, src.originX * width, src.originY * height, 0, 0, width, height, - getTint(src._tintTL, camera.alpha * src._alphaTL), - getTint(src._tintTR, camera.alpha * src._alphaTR), - getTint(src._tintBL, camera.alpha * src._alphaBL), - getTint(src._tintBR, camera.alpha * src._alphaBR), - (src._isTinted && src.tintFill), + getTint(src.tintTopLeft, camera.alpha * src._alphaTL), + getTint(src.tintTopRight, camera.alpha * src._alphaTR), + getTint(src.tintBottomLeft, camera.alpha * src._alphaBL), + getTint(src.tintBottomRight, camera.alpha * src._alphaBR), + src.tintFill, (src.tilePositionX % src.displayFrame.width) / src.displayFrame.width, (src.tilePositionY % src.displayFrame.height) / src.displayFrame.height, camera, @@ -153736,13 +162950,15 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, false, textureUnit ); + + renderer.pipelines.postBatch(src); }; module.exports = TileSpriteWebGLRenderer; /***/ }), -/* 1016 */ +/* 1076 */ /***/ (function(module, exports) { /** @@ -153762,11 +162978,10 @@ module.exports = TileSpriteWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.TileSprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TileSpriteCanvasRenderer = function (renderer, src, camera, parentMatrix) { src.updateCanvas(); @@ -153777,7 +162992,7 @@ module.exports = TileSpriteCanvasRenderer; /***/ }), -/* 1017 */ +/* 1077 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153791,12 +163006,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1018); + renderWebGL = __webpack_require__(1078); } if (true) { - renderCanvas = __webpack_require__(1019); + renderCanvas = __webpack_require__(1079); } module.exports = { @@ -153808,7 +163023,7 @@ module.exports = { /***/ }), -/* 1018 */ +/* 1078 */ /***/ (function(module, exports) { /** @@ -153828,15 +163043,14 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Video} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var VideoWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var VideoWebGLRenderer = function (renderer, src, camera, parentMatrix) { if (src.videoTexture) { - this.pipeline.batchSprite(src, camera, parentMatrix); + src.pipeline.batchSprite(src, camera, parentMatrix); } }; @@ -153844,7 +163058,7 @@ module.exports = VideoWebGLRenderer; /***/ }), -/* 1019 */ +/* 1079 */ /***/ (function(module, exports) { /** @@ -153864,11 +163078,10 @@ module.exports = VideoWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Video} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var VideoCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var VideoCanvasRenderer = function (renderer, src, camera, parentMatrix) { if (src.videoTexture) { @@ -153880,7 +163093,7 @@ module.exports = VideoCanvasRenderer; /***/ }), -/* 1020 */ +/* 1080 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153894,12 +163107,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1021); + renderWebGL = __webpack_require__(1081); } if (true) { - renderCanvas = __webpack_require__(1022); + renderCanvas = __webpack_require__(1082); } module.exports = { @@ -153911,7 +163124,7 @@ module.exports = { /***/ }), -/* 1021 */ +/* 1081 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153920,8 +163133,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var GetCalcMatrix = __webpack_require__(21); +var FillPathWebGL = __webpack_require__(109); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -153934,44 +163148,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Arc} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ArcWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ArcWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -153981,13 +163175,15 @@ var ArcWebGLRenderer = function (renderer, src, interpolationPercentage, camera, { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = ArcWebGLRenderer; /***/ }), -/* 1022 */ +/* 1082 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153996,10 +163192,10 @@ module.exports = ArcWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DegToRad = __webpack_require__(41); -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var DegToRad = __webpack_require__(34); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -154012,11 +163208,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Arc} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ArcCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ArcCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -154063,7 +163258,7 @@ module.exports = ArcCanvasRenderer; /***/ }), -/* 1023 */ +/* 1083 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154077,12 +163272,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1024); + renderWebGL = __webpack_require__(1084); } if (true) { - renderCanvas = __webpack_require__(1025); + renderCanvas = __webpack_require__(1085); } module.exports = { @@ -154094,7 +163289,7 @@ module.exports = { /***/ }), -/* 1024 */ +/* 1084 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154103,8 +163298,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var FillPathWebGL = __webpack_require__(109); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -154117,44 +163313,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Curve} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var CurveWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var CurveWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX + src._curveBounds.x; var dy = src._displayOriginY + src._curveBounds.y; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -154164,13 +163340,15 @@ var CurveWebGLRenderer = function (renderer, src, interpolationPercentage, camer { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = CurveWebGLRenderer; /***/ }), -/* 1025 */ +/* 1085 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154179,9 +163357,9 @@ module.exports = CurveWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -154194,11 +163372,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Curve} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var CurveCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var CurveCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -154206,27 +163383,27 @@ var CurveCanvasRenderer = function (renderer, src, interpolationPercentage, came { var dx = src._displayOriginX + src._curveBounds.x; var dy = src._displayOriginY + src._curveBounds.y; - + var path = src.pathData; var pathLength = path.length - 1; - + var px1 = path[0] - dx; var py1 = path[1] - dy; ctx.beginPath(); ctx.moveTo(px1, py1); - + if (!src.closePath) { pathLength -= 2; } - + for (var i = 2; i < pathLength; i += 2) { var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - + ctx.lineTo(px2, py2); } @@ -154258,7 +163435,7 @@ module.exports = CurveCanvasRenderer; /***/ }), -/* 1026 */ +/* 1086 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154272,12 +163449,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1027); + renderWebGL = __webpack_require__(1087); } if (true) { - renderCanvas = __webpack_require__(1028); + renderCanvas = __webpack_require__(1088); } module.exports = { @@ -154289,7 +163466,7 @@ module.exports = { /***/ }), -/* 1027 */ +/* 1087 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154298,8 +163475,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var FillPathWebGL = __webpack_require__(109); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -154312,44 +163490,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Ellipse} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var EllipseWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var EllipseWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -154359,13 +163517,15 @@ var EllipseWebGLRenderer = function (renderer, src, interpolationPercentage, cam { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = EllipseWebGLRenderer; /***/ }), -/* 1028 */ +/* 1088 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154374,9 +163534,9 @@ module.exports = EllipseWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -154389,11 +163549,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Ellipse} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var EllipseCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var EllipseCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -154404,24 +163563,24 @@ var EllipseCanvasRenderer = function (renderer, src, interpolationPercentage, ca var path = src.pathData; var pathLength = path.length - 1; - + var px1 = path[0] - dx; var py1 = path[1] - dy; ctx.beginPath(); ctx.moveTo(px1, py1); - + if (!src.closePath) { pathLength -= 2; } - + for (var i = 2; i < pathLength; i += 2) { var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - + ctx.lineTo(px2, py2); } @@ -154450,7 +163609,7 @@ module.exports = EllipseCanvasRenderer; /***/ }), -/* 1029 */ +/* 1089 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154464,12 +163623,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1030); + renderWebGL = __webpack_require__(1090); } if (true) { - renderCanvas = __webpack_require__(1031); + renderCanvas = __webpack_require__(1091); } module.exports = { @@ -154481,7 +163640,7 @@ module.exports = { /***/ }), -/* 1030 */ +/* 1090 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154490,7 +163649,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -154503,38 +163663,16 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Grid} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var GridWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); calcMatrix.translate(-src._displayOriginX, -src._displayOriginY); @@ -154570,8 +163708,6 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera var cw = 0; var ch = 0; - pipeline.setTexture2D(); - if (showOutline) { // To make room for the grid lines (in case alpha < 1) @@ -154589,10 +163725,12 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera } } + renderer.pipelines.preBatch(src); + if (showCells && src.fillAlpha > 0) { fillTint = pipeline.fillTint; - fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha); + fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); fillTint.TL = fillTintColor; fillTint.TR = fillTintColor; @@ -154632,7 +163770,7 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera if (showAltCells && src.altFillAlpha > 0) { fillTint = pipeline.fillTint; - fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.altFillColor, src.altFillAlpha * alpha); + fillTintColor = Utils.getTintAppendFloatAlpha(src.altFillColor, src.altFillAlpha * alpha); fillTint.TL = fillTintColor; fillTint.TR = fillTintColor; @@ -154672,7 +163810,7 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera if (showOutline && src.outlineFillAlpha > 0) { var strokeTint = pipeline.strokeTint; - var color = Utils.getTintAppendFloatAlphaAndSwap(src.outlineFillColor, src.outlineFillAlpha * alpha); + var color = Utils.getTintAppendFloatAlpha(src.outlineFillColor, src.outlineFillAlpha * alpha); strokeTint.TL = color; strokeTint.TR = color; @@ -154693,13 +163831,15 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera pipeline.batchLine(0, y1, width, y1, 1, 1, 1, 0, false); } } + + renderer.pipelines.postBatch(src); }; module.exports = GridWebGLRenderer; /***/ }), -/* 1031 */ +/* 1091 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154708,9 +163848,9 @@ module.exports = GridWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -154723,11 +163863,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Grid} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var GridCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var GridCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -154888,7 +164027,7 @@ module.exports = GridCanvasRenderer; /***/ }), -/* 1032 */ +/* 1092 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154902,12 +164041,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1033); + renderWebGL = __webpack_require__(1093); } if (true) { - renderCanvas = __webpack_require__(1034); + renderCanvas = __webpack_require__(1094); } module.exports = { @@ -154919,7 +164058,7 @@ module.exports = { /***/ }), -/* 1033 */ +/* 1093 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154928,7 +164067,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -154941,38 +164081,16 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.IsoBox} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var IsoBoxWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var size = src.width; var height = src.height; @@ -155001,13 +164119,14 @@ var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, came var x3; var y3; - pipeline.setTexture2D(); + + renderer.pipelines.preBatch(src); // Top Face if (src.showTop) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillTop, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillTop, alpha); x0 = calcMatrix.getX(-sizeA, -height); y0 = calcMatrix.getY(-sizeA, -height); @@ -155021,14 +164140,14 @@ var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, came x3 = calcMatrix.getX(0, sizeB - height); y3 = calcMatrix.getY(0, sizeB - height); - pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint, tint, tint, tint); } // Left Face if (src.showLeft) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillLeft, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillLeft, alpha); x0 = calcMatrix.getX(-sizeA, 0); y0 = calcMatrix.getY(-sizeA, 0); @@ -155042,14 +164161,14 @@ var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, came x3 = calcMatrix.getX(-sizeA, -height); y3 = calcMatrix.getY(-sizeA, -height); - pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint, tint, tint, tint); } // Right Face if (src.showRight) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillRight, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillRight, alpha); x0 = calcMatrix.getX(sizeA, 0); y0 = calcMatrix.getY(sizeA, 0); @@ -155063,15 +164182,17 @@ var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, came x3 = calcMatrix.getX(sizeA, -height); y3 = calcMatrix.getY(sizeA, -height); - pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint, tint, tint, tint); } + + renderer.pipelines.postBatch(src); }; module.exports = IsoBoxWebGLRenderer; /***/ }), -/* 1034 */ +/* 1094 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155080,8 +164201,8 @@ module.exports = IsoBoxWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -155094,11 +164215,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.IsoBox} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var IsoBoxCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var IsoBoxCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -155106,7 +164226,7 @@ var IsoBoxCanvasRenderer = function (renderer, src, interpolationPercentage, cam { var size = src.width; var height = src.height; - + var sizeA = size / 2; var sizeB = size / src.projection; @@ -155136,7 +164256,7 @@ var IsoBoxCanvasRenderer = function (renderer, src, interpolationPercentage, cam FillStyleCanvas(ctx, src, src.fillLeft); ctx.beginPath(); - + ctx.moveTo(-sizeA, 0); ctx.lineTo(0, sizeB); ctx.lineTo(0, sizeB - height); @@ -155172,7 +164292,7 @@ module.exports = IsoBoxCanvasRenderer; /***/ }), -/* 1035 */ +/* 1095 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155186,12 +164306,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1036); + renderWebGL = __webpack_require__(1096); } if (true) { - renderCanvas = __webpack_require__(1037); + renderCanvas = __webpack_require__(1097); } module.exports = { @@ -155203,7 +164323,7 @@ module.exports = { /***/ }), -/* 1036 */ +/* 1096 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155212,7 +164332,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -155225,38 +164346,16 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.IsoTriangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var IsoTriangleWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var size = src.width; var height = src.height; @@ -155273,6 +164372,8 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, return; } + renderer.pipelines.preBatch(src); + var tint; var x0; @@ -155284,13 +164385,11 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, var x2; var y2; - pipeline.setTexture2D(); - // Top Face if (src.showTop && reversed) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillTop, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillTop, alpha); x0 = calcMatrix.getX(-sizeA, -height); y0 = calcMatrix.getY(-sizeA, -height); @@ -155304,14 +164403,14 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, var x3 = calcMatrix.getX(0, sizeB - height); var y3 = calcMatrix.getY(0, sizeB - height); - pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint, tint, tint, tint); } // Left Face if (src.showLeft) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillLeft, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillLeft, alpha); if (reversed) { @@ -155336,14 +164435,14 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, y2 = calcMatrix.getY(0, sizeB - height); } - pipeline.batchTri(x0, y0, x1, y1, x2, y2, 0, 0, 1, 1, tint, tint, tint, 2); + pipeline.batchTri(x0, y0, x1, y1, x2, y2, tint, tint, tint); } // Right Face if (src.showRight) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillRight, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillRight, alpha); if (reversed) { @@ -155368,15 +164467,17 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, y2 = calcMatrix.getY(0, sizeB - height); } - pipeline.batchTri(x0, y0, x1, y1, x2, y2, 0, 0, 1, 1, tint, tint, tint, 2); + pipeline.batchTri(x0, y0, x1, y1, x2, y2, tint, tint, tint); } + + renderer.pipelines.postBatch(src); }; module.exports = IsoTriangleWebGLRenderer; /***/ }), -/* 1037 */ +/* 1097 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155385,8 +164486,8 @@ module.exports = IsoTriangleWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -155399,11 +164500,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.IsoTriangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var IsoTriangleCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var IsoTriangleCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -155411,7 +164511,7 @@ var IsoTriangleCanvasRenderer = function (renderer, src, interpolationPercentage { var size = src.width; var height = src.height; - + var sizeA = size / 2; var sizeB = size / src.projection; @@ -155490,7 +164590,7 @@ module.exports = IsoTriangleCanvasRenderer; /***/ }), -/* 1038 */ +/* 1098 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155504,12 +164604,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1039); + renderWebGL = __webpack_require__(1099); } if (true) { - renderCanvas = __webpack_require__(1040); + renderCanvas = __webpack_require__(1100); } module.exports = { @@ -155521,7 +164621,7 @@ module.exports = { /***/ }), -/* 1039 */ +/* 1099 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155530,7 +164630,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -155543,44 +164644,27 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Line} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var LineWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var LineWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } + pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isStroked) { var strokeTint = pipeline.strokeTint; - var color = Utils.getTintAppendFloatAlphaAndSwap(src.strokeColor, src.strokeAlpha * alpha); + var color = Utils.getTintAppendFloatAlpha(src.strokeColor, src.strokeAlpha * alpha); strokeTint.TL = color; strokeTint.TR = color; @@ -155590,8 +164674,6 @@ var LineWebGLRenderer = function (renderer, src, interpolationPercentage, camera var startWidth = src._startWidth; var endWidth = src._endWidth; - pipeline.setTexture2D(); - pipeline.batchLine( src.geom.x1 - dx, src.geom.y1 - dy, @@ -155602,17 +164684,19 @@ var LineWebGLRenderer = function (renderer, src, interpolationPercentage, camera 1, 0, false, - shapeMatrix, - camMatrix + result.sprite, + result.camera ); } + + renderer.pipelines.postBatch(src); }; module.exports = LineWebGLRenderer; /***/ }), -/* 1040 */ +/* 1100 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155621,8 +164705,8 @@ module.exports = LineWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -155635,11 +164719,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Line} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var LineCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var LineCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -155656,7 +164739,7 @@ var LineCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.moveTo(src.geom.x1 - dx, src.geom.y1 - dy); ctx.lineTo(src.geom.x2 - dx, src.geom.y2 - dy); - + ctx.stroke(); } @@ -155669,7 +164752,7 @@ module.exports = LineCanvasRenderer; /***/ }), -/* 1041 */ +/* 1101 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155683,12 +164766,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1042); + renderWebGL = __webpack_require__(1102); } if (true) { - renderCanvas = __webpack_require__(1043); + renderCanvas = __webpack_require__(1103); } module.exports = { @@ -155700,7 +164783,7 @@ module.exports = { /***/ }), -/* 1042 */ +/* 1102 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155709,8 +164792,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var FillPathWebGL = __webpack_require__(109); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -155723,44 +164807,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Polygon} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var PolygonWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var PolygonWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -155770,13 +164834,15 @@ var PolygonWebGLRenderer = function (renderer, src, interpolationPercentage, cam { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = PolygonWebGLRenderer; /***/ }), -/* 1043 */ +/* 1103 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155785,9 +164851,9 @@ module.exports = PolygonWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -155800,11 +164866,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Polygon} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var PolygonCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var PolygonCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -155815,24 +164880,24 @@ var PolygonCanvasRenderer = function (renderer, src, interpolationPercentage, ca var path = src.pathData; var pathLength = path.length - 1; - + var px1 = path[0] - dx; var py1 = path[1] - dy; ctx.beginPath(); ctx.moveTo(px1, py1); - + if (!src.closePath) { pathLength -= 2; } - + for (var i = 2; i < pathLength; i += 2) { var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - + ctx.lineTo(px2, py2); } @@ -155861,7 +164926,7 @@ module.exports = PolygonCanvasRenderer; /***/ }), -/* 1044 */ +/* 1104 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155875,12 +164940,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1045); + renderWebGL = __webpack_require__(1105); } if (true) { - renderCanvas = __webpack_require__(1046); + renderCanvas = __webpack_require__(1106); } module.exports = { @@ -155892,7 +164957,7 @@ module.exports = { /***/ }), -/* 1045 */ +/* 1105 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155901,8 +164966,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var StrokePathWebGL = __webpack_require__(72); -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -155915,55 +164981,33 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Rectangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RectangleWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RectangleWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { var fillTint = pipeline.fillTint; - var fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha); + var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); fillTint.TL = fillTintColor; fillTint.TR = fillTintColor; fillTint.BL = fillTintColor; fillTint.BR = fillTintColor; - pipeline.setTexture2D(); - pipeline.batchFillRect( -dx, -dy, @@ -155976,13 +165020,15 @@ var RectangleWebGLRenderer = function (renderer, src, interpolationPercentage, c { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = RectangleWebGLRenderer; /***/ }), -/* 1046 */ +/* 1106 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155991,9 +165037,9 @@ module.exports = RectangleWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -156006,11 +165052,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Rectangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RectangleCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -156022,7 +165067,7 @@ var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, if (src.isFilled) { FillStyleCanvas(ctx, src); - + ctx.fillRect( -dx, -dy, @@ -156056,7 +165101,7 @@ module.exports = RectangleCanvasRenderer; /***/ }), -/* 1047 */ +/* 1107 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156070,12 +165115,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1048); + renderWebGL = __webpack_require__(1108); } if (true) { - renderCanvas = __webpack_require__(1049); + renderCanvas = __webpack_require__(1109); } module.exports = { @@ -156087,7 +165132,7 @@ module.exports = { /***/ }), -/* 1048 */ +/* 1108 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156096,8 +165141,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var FillPathWebGL = __webpack_require__(109); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -156110,44 +165156,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Star} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var StarWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var StarWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -156157,13 +165183,15 @@ var StarWebGLRenderer = function (renderer, src, interpolationPercentage, camera { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = StarWebGLRenderer; /***/ }), -/* 1049 */ +/* 1109 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156172,9 +165200,9 @@ module.exports = StarWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -156187,11 +165215,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Star} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var StarCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var StarCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -156202,24 +165229,24 @@ var StarCanvasRenderer = function (renderer, src, interpolationPercentage, camer var path = src.pathData; var pathLength = path.length - 1; - + var px1 = path[0] - dx; var py1 = path[1] - dy; ctx.beginPath(); ctx.moveTo(px1, py1); - + if (!src.closePath) { pathLength -= 2; } - + for (var i = 2; i < pathLength; i += 2) { var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - + ctx.lineTo(px2, py2); } @@ -156248,7 +165275,7 @@ module.exports = StarCanvasRenderer; /***/ }), -/* 1050 */ +/* 1110 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156262,12 +165289,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1051); + renderWebGL = __webpack_require__(1111); } if (true) { - renderCanvas = __webpack_require__(1052); + renderCanvas = __webpack_require__(1112); } module.exports = { @@ -156279,7 +165306,7 @@ module.exports = { /***/ }), -/* 1051 */ +/* 1111 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156288,8 +165315,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var StrokePathWebGL = __webpack_require__(72); -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -156302,47 +165330,27 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Triangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TriangleWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TriangleWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { var fillTint = pipeline.fillTint; - var fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha); + var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); fillTint.TL = fillTintColor; fillTint.TR = fillTintColor; @@ -156356,8 +165364,6 @@ var TriangleWebGLRenderer = function (renderer, src, interpolationPercentage, ca var x3 = src.geom.x3 - dx; var y3 = src.geom.y3 - dy; - pipeline.setTexture2D(); - pipeline.batchFillTriangle( x1, y1, @@ -156365,8 +165371,8 @@ var TriangleWebGLRenderer = function (renderer, src, interpolationPercentage, ca y2, x3, y3, - shapeMatrix, - camMatrix + result.sprite, + result.camera ); } @@ -156374,13 +165380,15 @@ var TriangleWebGLRenderer = function (renderer, src, interpolationPercentage, ca { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = TriangleWebGLRenderer; /***/ }), -/* 1052 */ +/* 1112 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156389,9 +165397,9 @@ module.exports = TriangleWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -156404,11 +165412,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Triangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TriangleCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TriangleCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -156455,7 +165462,7 @@ module.exports = TriangleCanvasRenderer; /***/ }), -/* 1053 */ +/* 1113 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156464,7 +165471,7 @@ module.exports = TriangleCanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Blitter = __webpack_require__(199); +var Blitter = __webpack_require__(204); var GameObjectFactory = __webpack_require__(5); /** @@ -156478,8 +165485,8 @@ var GameObjectFactory = __webpack_require__(5); * @param {number} x - The x position of the Game Object. * @param {number} y - The y position of the Game Object. * @param {string} key - The key of the Texture the Blitter object will use. - * @param {(string|integer)} [frame] - The default Frame children of the Blitter will use. - * + * @param {(string|number)} [frame] - The default Frame children of the Blitter will use. + * * @return {Phaser.GameObjects.Blitter} The Game Object that was created. */ GameObjectFactory.register('blitter', function (x, y, key, frame) @@ -156488,16 +165495,16 @@ GameObjectFactory.register('blitter', function (x, y, key, frame) }); // When registering a factory function 'this' refers to the GameObjectFactory context. -// +// // There are several properties available to use: -// +// // this.scene - a reference to the Scene that owns the GameObjectFactory // this.displayList - a reference to the Display List the Scene owns // this.updateList - a reference to the Update List the Scene owns /***/ }), -/* 1054 */ +/* 1114 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156507,7 +165514,7 @@ GameObjectFactory.register('blitter', function (x, y, key, frame) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Container = __webpack_require__(200); +var Container = __webpack_require__(205); var GameObjectFactory = __webpack_require__(5); /** @@ -156531,7 +165538,7 @@ GameObjectFactory.register('container', function (x, y, children) /***/ }), -/* 1055 */ +/* 1115 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156540,7 +165547,7 @@ GameObjectFactory.register('container', function (x, y, children) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DOMElement = __webpack_require__(409); +var DOMElement = __webpack_require__(419); var GameObjectFactory = __webpack_require__(5); /** @@ -156620,7 +165627,7 @@ GameObjectFactory.register('dom', function (x, y, element, style, innerText) /***/ }), -/* 1056 */ +/* 1116 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156629,7 +165636,7 @@ GameObjectFactory.register('dom', function (x, y, element, style, innerText) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DynamicBitmapText = __webpack_require__(201); +var DynamicBitmapText = __webpack_require__(206); var GameObjectFactory = __webpack_require__(5); /** @@ -156689,7 +165696,7 @@ GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size /***/ }), -/* 1057 */ +/* 1117 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156698,7 +165705,7 @@ GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extern = __webpack_require__(411); +var Extern = __webpack_require__(421); var GameObjectFactory = __webpack_require__(5); /** @@ -156730,7 +165737,7 @@ GameObjectFactory.register('extern', function () /***/ }), -/* 1058 */ +/* 1118 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156739,7 +165746,7 @@ GameObjectFactory.register('extern', function () * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Graphics = __webpack_require__(202); +var Graphics = __webpack_require__(207); var GameObjectFactory = __webpack_require__(5); /** @@ -156769,7 +165776,7 @@ GameObjectFactory.register('graphics', function (config) /***/ }), -/* 1059 */ +/* 1119 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156778,7 +165785,7 @@ GameObjectFactory.register('graphics', function (config) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Group = __webpack_require__(100); +var Group = __webpack_require__(108); var GameObjectFactory = __webpack_require__(5); /** @@ -156801,7 +165808,7 @@ GameObjectFactory.register('group', function (children, config) /***/ }), -/* 1060 */ +/* 1120 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156810,7 +165817,7 @@ GameObjectFactory.register('group', function (children, config) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Image = __webpack_require__(114); +var Image = __webpack_require__(122); var GameObjectFactory = __webpack_require__(5); /** @@ -156824,7 +165831,7 @@ var GameObjectFactory = __webpack_require__(5); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.GameObjects.Image} The Game Object that was created. */ @@ -156843,7 +165850,38 @@ GameObjectFactory.register('image', function (x, y, key, frame) /***/ }), -/* 1061 */ +/* 1121 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Layer = __webpack_require__(210); +var GameObjectFactory = __webpack_require__(5); + +/** + * Creates a new Layer Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Layer Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#layer + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Layer. + * + * @return {Phaser.GameObjects.Layer} The Game Object that was created. + */ +GameObjectFactory.register('layer', function (children) +{ + return this.displayList.add(new Layer(this.scene, children)); +}); + + +/***/ }), +/* 1122 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156853,7 +165891,7 @@ GameObjectFactory.register('image', function (x, y, key, frame) */ var GameObjectFactory = __webpack_require__(5); -var ParticleEmitterManager = __webpack_require__(205); +var ParticleEmitterManager = __webpack_require__(211); /** * Creates a new Particle Emitter Manager Game Object and adds it to the Scene. @@ -156864,7 +165902,7 @@ var ParticleEmitterManager = __webpack_require__(205); * @since 3.0.0 * * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer|object)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number|object)} [frame] - An optional frame from the Texture this Game Object is rendering with. * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig|Phaser.Types.GameObjects.Particles.ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. * * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} The Game Object that was created. @@ -156874,17 +165912,9 @@ GameObjectFactory.register('particles', function (key, frame, emitters) return this.displayList.add(new ParticleEmitterManager(this.scene, key, frame, emitters)); }); -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns - /***/ }), -/* 1062 */ +/* 1123 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156894,7 +165924,7 @@ GameObjectFactory.register('particles', function (key, frame, emitters) */ var GameObjectFactory = __webpack_require__(5); -var PathFollower = __webpack_require__(424); +var PathFollower = __webpack_require__(434); /** * Creates a new PathFollower Game Object and adds it to the Scene. @@ -156908,7 +165938,7 @@ var PathFollower = __webpack_require__(424); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.GameObjects.PathFollower} The Game Object that was created. */ @@ -156932,7 +165962,7 @@ GameObjectFactory.register('follower', function (path, x, y, key, frame) /***/ }), -/* 1063 */ +/* 1124 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156942,7 +165972,7 @@ GameObjectFactory.register('follower', function (path, x, y, key, frame) */ var GameObjectFactory = __webpack_require__(5); -var RenderTexture = __webpack_require__(206); +var RenderTexture = __webpack_require__(212); /** * Creates a new Render Texture Game Object and adds it to the Scene. @@ -156958,8 +165988,8 @@ var RenderTexture = __webpack_require__(206); * * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. - * @param {integer} [width=32] - The width of the Render Texture. - * @param {integer} [height=32] - The height of the Render Texture. + * @param {number} [width=32] - The width of the Render Texture. + * @param {number} [height=32] - The height of the Render Texture. * @property {string} [key] - The texture key to make the RenderTexture from. * @property {string} [frame] - the frame to make the RenderTexture from. * @@ -156972,7 +166002,7 @@ GameObjectFactory.register('renderTexture', function (x, y, width, height, key, /***/ }), -/* 1064 */ +/* 1125 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156981,7 +166011,7 @@ GameObjectFactory.register('renderTexture', function (x, y, width, height, key, * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Rope = __webpack_require__(208); +var Rope = __webpack_require__(214); var GameObjectFactory = __webpack_require__(5); /** @@ -156996,7 +166026,7 @@ var GameObjectFactory = __webpack_require__(5); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * @param {Phaser.Types.Math.Vector2Like[]} [points] - An array containing the vertices data for this Rope. If none is provided a simple quad is created. See `setPoints` to set this post-creation. * @param {boolean} [horizontal=true] - Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? * @param {number[]} [colors] - An optional array containing the color data for this Rope. You should provide one color value per pair of vertices. @@ -157012,17 +166042,9 @@ if (true) }); } -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns - /***/ }), -/* 1065 */ +/* 1126 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157032,7 +166054,7 @@ if (true) */ var GameObjectFactory = __webpack_require__(5); -var Sprite = __webpack_require__(76); +var Sprite = __webpack_require__(70); /** * Creates a new Sprite Game Object and adds it to the Scene. @@ -157045,7 +166067,7 @@ var Sprite = __webpack_require__(76); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.GameObjects.Sprite} The Game Object that was created. */ @@ -157068,7 +166090,7 @@ GameObjectFactory.register('sprite', function (x, y, key, frame) /***/ }), -/* 1066 */ +/* 1127 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157077,7 +166099,7 @@ GameObjectFactory.register('sprite', function (x, y, key, frame) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(140); +var BitmapText = __webpack_require__(144); var GameObjectFactory = __webpack_require__(5); /** @@ -157113,7 +166135,7 @@ var GameObjectFactory = __webpack_require__(5); * @param {string} font - The key of the font to use from the BitmapFont cache. * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. * @param {number} [size] - The font size to set. - * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. * * @return {Phaser.GameObjects.BitmapText} The Game Object that was created. */ @@ -157132,7 +166154,7 @@ GameObjectFactory.register('bitmapText', function (x, y, font, text, size, align /***/ }), -/* 1067 */ +/* 1128 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157141,18 +166163,18 @@ GameObjectFactory.register('bitmapText', function (x, y, font, text, size, align * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Text = __webpack_require__(209); +var Text = __webpack_require__(215); var GameObjectFactory = __webpack_require__(5); /** * Creates a new Text Game Object and adds it to the Scene. - * + * * A Text Game Object. - * + * * Text objects work by creating their own internal hidden Canvas and then renders text to it using * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered * to your game during the render pass. - * + * * Because it uses the Canvas API you can take advantage of all the features this offers, such as * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts * loaded externally, such as Google or TypeKit Web fonts. @@ -157163,7 +166185,7 @@ var GameObjectFactory = __webpack_require__(5); * * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts * across mobile browsers. - * + * * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of @@ -157197,7 +166219,7 @@ GameObjectFactory.register('text', function (x, y, text, style) /***/ }), -/* 1068 */ +/* 1129 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157206,7 +166228,7 @@ GameObjectFactory.register('text', function (x, y, text, style) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileSprite = __webpack_require__(210); +var TileSprite = __webpack_require__(216); var GameObjectFactory = __webpack_require__(5); /** @@ -157219,10 +166241,10 @@ var GameObjectFactory = __webpack_require__(5); * * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. - * @param {integer} width - The width of the Game Object. If zero it will use the size of the texture frame. - * @param {integer} height - The height of the Game Object. If zero it will use the size of the texture frame. + * @param {number} width - The width of the Game Object. If zero it will use the size of the texture frame. + * @param {number} height - The height of the Game Object. If zero it will use the size of the texture frame. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.GameObjects.TileSprite} The Game Object that was created. */ @@ -157241,7 +166263,7 @@ GameObjectFactory.register('tileSprite', function (x, y, width, height, key, fra /***/ }), -/* 1069 */ +/* 1130 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157250,7 +166272,7 @@ GameObjectFactory.register('tileSprite', function (x, y, width, height, key, fra * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Zone = __webpack_require__(117); +var Zone = __webpack_require__(125); var GameObjectFactory = __webpack_require__(5); /** @@ -157283,7 +166305,7 @@ GameObjectFactory.register('zone', function (x, y, width, height) /***/ }), -/* 1070 */ +/* 1131 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157292,7 +166314,7 @@ GameObjectFactory.register('zone', function (x, y, width, height) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Video = __webpack_require__(211); +var Video = __webpack_require__(217); var GameObjectFactory = __webpack_require__(5); /** @@ -157311,25 +166333,12 @@ var GameObjectFactory = __webpack_require__(5); */ GameObjectFactory.register('video', function (x, y, key) { - var video = new Video(this.scene, x, y, key); - - this.displayList.add(video); - this.updateList.add(video); - - return video; + return this.displayList.add(new Video(this.scene, x, y, key)); }); -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns - /***/ }), -/* 1071 */ +/* 1132 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157338,7 +166347,7 @@ GameObjectFactory.register('video', function (x, y, key) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Arc = __webpack_require__(428); +var Arc = __webpack_require__(438); var GameObjectFactory = __webpack_require__(5); /** @@ -157364,8 +166373,8 @@ var GameObjectFactory = __webpack_require__(5); * @param {number} [x=0] - The horizontal position of this Game Object in the world. * @param {number} [y=0] - The vertical position of this Game Object in the world. * @param {number} [radius=128] - The radius of the arc. - * @param {integer} [startAngle=0] - The start angle of the arc, in degrees. - * @param {integer} [endAngle=360] - The end angle of the arc, in degrees. + * @param {number} [startAngle=0] - The start angle of the arc, in degrees. + * @param {number} [endAngle=360] - The end angle of the arc, in degrees. * @param {boolean} [anticlockwise=false] - The winding order of the start and end angles. * @param {number} [fillColor] - The color the arc will be filled with, i.e. 0xff0000 for red. * @param {number} [fillAlpha] - The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. @@ -157402,7 +166411,7 @@ GameObjectFactory.register('circle', function (x, y, radius, fillColor, fillAlph /***/ }), -/* 1072 */ +/* 1133 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157412,7 +166421,7 @@ GameObjectFactory.register('circle', function (x, y, radius, fillColor, fillAlph */ var GameObjectFactory = __webpack_require__(5); -var Curve = __webpack_require__(429); +var Curve = __webpack_require__(439); /** * Creates a new Curve Shape Game Object and adds it to the Scene. @@ -157452,7 +166461,7 @@ GameObjectFactory.register('curve', function (x, y, curve, fillColor, fillAlpha) /***/ }), -/* 1073 */ +/* 1134 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157461,7 +166470,7 @@ GameObjectFactory.register('curve', function (x, y, curve, fillColor, fillAlpha) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Ellipse = __webpack_require__(430); +var Ellipse = __webpack_require__(440); var GameObjectFactory = __webpack_require__(5); /** @@ -157504,7 +166513,7 @@ GameObjectFactory.register('ellipse', function (x, y, width, height, fillColor, /***/ }), -/* 1074 */ +/* 1135 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157514,7 +166523,7 @@ GameObjectFactory.register('ellipse', function (x, y, width, height, fillColor, */ var GameObjectFactory = __webpack_require__(5); -var Grid = __webpack_require__(431); +var Grid = __webpack_require__(441); /** * Creates a new Grid Shape Game Object and adds it to the Scene. @@ -157559,7 +166568,7 @@ GameObjectFactory.register('grid', function (x, y, width, height, cellWidth, cel /***/ }), -/* 1075 */ +/* 1136 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157569,7 +166578,7 @@ GameObjectFactory.register('grid', function (x, y, width, height, cellWidth, cel */ var GameObjectFactory = __webpack_require__(5); -var IsoBox = __webpack_require__(432); +var IsoBox = __webpack_require__(442); /** * Creates a new IsoBox Shape Game Object and adds it to the Scene. @@ -157610,7 +166619,7 @@ GameObjectFactory.register('isobox', function (x, y, size, height, fillTop, fill /***/ }), -/* 1076 */ +/* 1137 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157620,7 +166629,7 @@ GameObjectFactory.register('isobox', function (x, y, size, height, fillTop, fill */ var GameObjectFactory = __webpack_require__(5); -var IsoTriangle = __webpack_require__(433); +var IsoTriangle = __webpack_require__(443); /** * Creates a new IsoTriangle Shape Game Object and adds it to the Scene. @@ -157663,7 +166672,7 @@ GameObjectFactory.register('isotriangle', function (x, y, size, height, reversed /***/ }), -/* 1077 */ +/* 1138 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157673,7 +166682,7 @@ GameObjectFactory.register('isotriangle', function (x, y, size, height, reversed */ var GameObjectFactory = __webpack_require__(5); -var Line = __webpack_require__(434); +var Line = __webpack_require__(444); /** * Creates a new Line Shape Game Object and adds it to the Scene. @@ -157714,7 +166723,7 @@ GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, /***/ }), -/* 1078 */ +/* 1139 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157724,7 +166733,7 @@ GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, */ var GameObjectFactory = __webpack_require__(5); -var Polygon = __webpack_require__(435); +var Polygon = __webpack_require__(445); /** * Creates a new Polygon Shape Game Object and adds it to the Scene. @@ -157767,7 +166776,7 @@ GameObjectFactory.register('polygon', function (x, y, points, fillColor, fillAlp /***/ }), -/* 1079 */ +/* 1140 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157777,7 +166786,7 @@ GameObjectFactory.register('polygon', function (x, y, points, fillColor, fillAlp */ var GameObjectFactory = __webpack_require__(5); -var Rectangle = __webpack_require__(440); +var Rectangle = __webpack_require__(450); /** * Creates a new Rectangle Shape Game Object and adds it to the Scene. @@ -157812,7 +166821,7 @@ GameObjectFactory.register('rectangle', function (x, y, width, height, fillColor /***/ }), -/* 1080 */ +/* 1141 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157821,7 +166830,7 @@ GameObjectFactory.register('rectangle', function (x, y, width, height, fillColor * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Star = __webpack_require__(441); +var Star = __webpack_require__(451); var GameObjectFactory = __webpack_require__(5); /** @@ -157864,7 +166873,7 @@ GameObjectFactory.register('star', function (x, y, points, innerRadius, outerRad /***/ }), -/* 1081 */ +/* 1142 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157874,7 +166883,7 @@ GameObjectFactory.register('star', function (x, y, points, innerRadius, outerRad */ var GameObjectFactory = __webpack_require__(5); -var Triangle = __webpack_require__(442); +var Triangle = __webpack_require__(452); /** * Creates a new Triangle Shape Game Object and adds it to the Scene. @@ -157915,7 +166924,7 @@ GameObjectFactory.register('triangle', function (x, y, x1, y1, x2, y2, x3, y3, f /***/ }), -/* 1082 */ +/* 1143 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157924,9 +166933,9 @@ GameObjectFactory.register('triangle', function (x, y, x1, y1, x2, y2, x3, y3, f * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Blitter = __webpack_require__(199); -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var Blitter = __webpack_require__(204); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); /** @@ -157965,7 +166974,7 @@ GameObjectCreator.register('blitter', function (config, addToScene) /***/ }), -/* 1083 */ +/* 1144 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157975,9 +166984,9 @@ GameObjectCreator.register('blitter', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var Container = __webpack_require__(200); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var Container = __webpack_require__(205); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); /** @@ -158015,7 +167024,7 @@ GameObjectCreator.register('container', function (config, addToScene) /***/ }), -/* 1084 */ +/* 1145 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158024,9 +167033,9 @@ GameObjectCreator.register('container', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(201); -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BitmapText = __webpack_require__(206); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); /** @@ -158066,7 +167075,7 @@ GameObjectCreator.register('dynamicBitmapText', function (config, addToScene) /***/ }), -/* 1085 */ +/* 1146 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158075,8 +167084,8 @@ GameObjectCreator.register('dynamicBitmapText', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var Graphics = __webpack_require__(202); +var GameObjectCreator = __webpack_require__(17); +var Graphics = __webpack_require__(207); /** * Creates a new Graphics Game Object and returns it. @@ -158114,7 +167123,7 @@ GameObjectCreator.register('graphics', function (config, addToScene) /***/ }), -/* 1086 */ +/* 1147 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158123,8 +167132,8 @@ GameObjectCreator.register('graphics', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var Group = __webpack_require__(100); +var GameObjectCreator = __webpack_require__(17); +var Group = __webpack_require__(108); /** * Creates a new Group Game Object and returns it. @@ -158147,7 +167156,7 @@ GameObjectCreator.register('group', function (config) /***/ }), -/* 1087 */ +/* 1148 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158156,10 +167165,10 @@ GameObjectCreator.register('group', function (config) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Image = __webpack_require__(114); +var Image = __webpack_require__(122); /** * Creates a new Image Game Object and returns it. @@ -158197,7 +167206,55 @@ GameObjectCreator.register('image', function (config, addToScene) /***/ }), -/* 1088 */ +/* 1149 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BuildGameObject = __webpack_require__(28); +var Layer = __webpack_require__(210); +var GameObjectCreator = __webpack_require__(17); +var GetAdvancedValue = __webpack_require__(15); + +/** + * Creates a new Layer Game Object and returns it. + * + * Note: This method will only be available if the Layer Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#layer + * @since 3.50.0 + * + * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Layer} The Game Object that was created. + */ +GameObjectCreator.register('layer', function (config, addToScene) +{ + if (config === undefined) { config = {}; } + + var children = GetAdvancedValue(config, 'children', null); + + var layer = new Layer(this.scene, children); + + if (addToScene !== undefined) + { + config.add = addToScene; + } + + BuildGameObject(this.scene, layer, config); + + return layer; +}); + + +/***/ }), +/* 1150 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158206,10 +167263,10 @@ GameObjectCreator.register('image', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); var GetFastValue = __webpack_require__(2); -var ParticleEmitterManager = __webpack_require__(205); +var ParticleEmitterManager = __webpack_require__(211); /** * Creates a new Particle Emitter Manager Game Object and returns it. @@ -158246,13 +167303,17 @@ GameObjectCreator.register('particles', function (config, addToScene) { this.displayList.add(manager); } + else + { + this.updateList.add(manager); + } return manager; }); /***/ }), -/* 1089 */ +/* 1151 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158261,10 +167322,10 @@ GameObjectCreator.register('particles', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var RenderTexture = __webpack_require__(206); +var RenderTexture = __webpack_require__(212); /** * Creates a new Render Texture Game Object and returns it. @@ -158304,7 +167365,7 @@ GameObjectCreator.register('renderTexture', function (config, addToScene) /***/ }), -/* 1090 */ +/* 1152 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158313,11 +167374,11 @@ GameObjectCreator.register('renderTexture', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); var GetValue = __webpack_require__(6); -var Rope = __webpack_require__(208); +var Rope = __webpack_require__(214); /** * Creates a new Rope Game Object and returns it. @@ -158352,6 +167413,11 @@ GameObjectCreator.register('rope', function (config, addToScene) BuildGameObject(this.scene, rope, config); + if (!config.add) + { + this.updateList.add(rope); + } + return rope; }); @@ -158359,7 +167425,7 @@ GameObjectCreator.register('rope', function (config, addToScene) /***/ }), -/* 1091 */ +/* 1153 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158368,11 +167434,11 @@ GameObjectCreator.register('rope', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var BuildGameObjectAnimation = __webpack_require__(406); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var BuildGameObjectAnimation = __webpack_require__(416); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Sprite = __webpack_require__(76); +var Sprite = __webpack_require__(70); /** * Creates a new Sprite Game Object and returns it. @@ -158412,7 +167478,7 @@ GameObjectCreator.register('sprite', function (config, addToScene) /***/ }), -/* 1092 */ +/* 1154 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158421,9 +167487,9 @@ GameObjectCreator.register('sprite', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(140); -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BitmapText = __webpack_require__(144); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); var GetValue = __webpack_require__(6); @@ -158465,7 +167531,7 @@ GameObjectCreator.register('bitmapText', function (config, addToScene) /***/ }), -/* 1093 */ +/* 1155 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158474,10 +167540,10 @@ GameObjectCreator.register('bitmapText', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Text = __webpack_require__(209); +var Text = __webpack_require__(215); /** * Creates a new Text Game Object and returns it. @@ -158552,7 +167618,7 @@ GameObjectCreator.register('text', function (config, addToScene) /***/ }), -/* 1094 */ +/* 1156 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158561,10 +167627,10 @@ GameObjectCreator.register('text', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var TileSprite = __webpack_require__(210); +var TileSprite = __webpack_require__(216); /** * Creates a new TileSprite Game Object and returns it. @@ -158604,7 +167670,7 @@ GameObjectCreator.register('tileSprite', function (config, addToScene) /***/ }), -/* 1095 */ +/* 1157 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158613,9 +167679,9 @@ GameObjectCreator.register('tileSprite', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Zone = __webpack_require__(117); +var Zone = __webpack_require__(125); /** * Creates a new Zone Game Object and returns it. @@ -158643,7 +167709,7 @@ GameObjectCreator.register('zone', function (config) /***/ }), -/* 1096 */ +/* 1158 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158652,10 +167718,10 @@ GameObjectCreator.register('zone', function (config) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Video = __webpack_require__(211); +var Video = __webpack_require__(217); /** * Creates a new Video Game Object and returns it. @@ -158685,6 +167751,11 @@ GameObjectCreator.register('video', function (config, addToScene) BuildGameObject(this.scene, video, config); + if (!config.add) + { + this.updateList.add(video); + } + return video; }); @@ -158692,7 +167763,7 @@ GameObjectCreator.register('video', function (config, addToScene) /***/ }), -/* 1097 */ +/* 1159 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158706,12 +167777,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1098); + renderWebGL = __webpack_require__(1160); } if (true) { - renderCanvas = __webpack_require__(1099); + renderCanvas = __webpack_require__(1161); } module.exports = { @@ -158723,7 +167794,7 @@ module.exports = { /***/ }), -/* 1098 */ +/* 1160 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158732,179 +167803,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); - -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Mesh#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) -{ - var pipeline = renderer.pipelines.set(this.pipeline, src); - - var camMatrix = pipeline._tempMatrix1; - var spriteMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; - - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - var vertices = src.vertices; - var uvs = src.uv; - var colors = src.colors; - var alphas = src.alphas; - - var meshVerticesLength = vertices.length; - var vertexCount = Math.floor(meshVerticesLength * 0.5); - - if (pipeline.vertexCount + vertexCount > pipeline.vertexCapacity) - { - pipeline.flush(); - } - - var textureUnit = pipeline.setGameObject(src); - - var vertexViewF32 = pipeline.vertexViewF32; - var vertexViewU32 = pipeline.vertexViewU32; - - var vertexOffset = (pipeline.vertexCount * pipeline.vertexComponentCount) - 1; - - var colorIndex = 0; - var tintEffect = src.tintFill; - - for (var i = 0; i < meshVerticesLength; i += 2) - { - var x = vertices[i + 0]; - var y = vertices[i + 1]; - - var tx = x * calcMatrix.a + y * calcMatrix.c + calcMatrix.e; - var ty = x * calcMatrix.b + y * calcMatrix.d + calcMatrix.f; - - if (camera.roundPixels) - { - tx = Math.round(tx); - ty = Math.round(ty); - } - - vertexViewF32[++vertexOffset] = tx; - vertexViewF32[++vertexOffset] = ty; - vertexViewF32[++vertexOffset] = uvs[i + 0]; - vertexViewF32[++vertexOffset] = uvs[i + 1]; - vertexViewF32[++vertexOffset] = textureUnit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = Utils.getTintAppendFloatAlpha(colors[colorIndex], camera.alpha * alphas[colorIndex]); - - colorIndex++; - } - - pipeline.vertexCount += vertexCount; -}; - -module.exports = MeshWebGLRenderer; - - -/***/ }), -/* 1099 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * This is a stub function for Mesh.Render. There is no Canvas renderer for Mesh objects. - * - * @method Phaser.GameObjects.Mesh#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var MeshCanvasRenderer = function () -{ -}; - -module.exports = MeshCanvasRenderer; - - -/***/ }), -/* 1100 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); - -if (true) -{ - renderWebGL = __webpack_require__(1101); -} - -if (true) -{ - renderCanvas = __webpack_require__(1102); -} - -module.exports = { - - renderWebGL: renderWebGL, - renderCanvas: renderCanvas - -}; - - -/***/ }), -/* 1101 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var GetCalcMatrix = __webpack_require__(21); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -158917,11 +167816,10 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Shader} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ShaderWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ShaderWebGLRenderer = function (renderer, src, camera, parentMatrix) { if (!src.shader) { @@ -158937,30 +167835,7 @@ var ShaderWebGLRenderer = function (renderer, src, interpolationPercentage, came } else { - var camMatrix = src._tempMatrix1; - var shapeMatrix = src._tempMatrix2; - var calcMatrix = src._tempMatrix3; - - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; // Renderer size changed? if (renderer.width !== src._rendererWidth || renderer.height !== src._rendererHeight) @@ -158979,7 +167854,7 @@ module.exports = ShaderWebGLRenderer; /***/ }), -/* 1102 */ +/* 1161 */ /***/ (function(module, exports) { /** @@ -158997,7 +167872,6 @@ module.exports = ShaderWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Shader} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ var ShaderCanvasRenderer = function () @@ -159008,7 +167882,7 @@ module.exports = ShaderCanvasRenderer; /***/ }), -/* 1103 */ +/* 1162 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159017,48 +167891,29 @@ module.exports = ShaderCanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Mesh = __webpack_require__(142); -var GameObjectFactory = __webpack_require__(5); +var renderWebGL = __webpack_require__(1); +var renderCanvas = __webpack_require__(1); -/** - * Creates a new Mesh Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#mesh - * @webglOnly - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number[]} vertices - An array containing the vertices data for this Mesh. - * @param {number[]} uv - An array containing the uv data for this Mesh. - * @param {number[]} colors - An array containing the color data for this Mesh. - * @param {number[]} alphas - An array containing the alpha data for this Mesh. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.GameObjects.Mesh} The Game Object that was created. - */ if (true) { - GameObjectFactory.register('mesh', function (x, y, vertices, uv, colors, alphas, texture, frame) - { - return this.displayList.add(new Mesh(this.scene, x, y, vertices, uv, colors, alphas, texture, frame)); - }); + renderWebGL = __webpack_require__(1163); } -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns +if (true) +{ + renderCanvas = __webpack_require__(1164); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; /***/ }), -/* 1104 */ +/* 1163 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159067,44 +167922,136 @@ if (true) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Quad = __webpack_require__(214); -var GameObjectFactory = __webpack_require__(5); +var GetCalcMatrix = __webpack_require__(21); /** - * Creates a new Quad Game Object and adds it to the Scene. + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * Note: This method will only be available if the Quad Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#quad - * @webglOnly + * @method Phaser.GameObjects.Mesh#renderWebGL * @since 3.0.0 + * @private * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.GameObjects.Quad} The Game Object that was created. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -if (true) +var MeshWebGLRenderer = function (renderer, src, camera, parentMatrix) { - GameObjectFactory.register('quad', function (x, y, key, frame) - { - return this.displayList.add(new Quad(this.scene, x, y, key, frame)); - }); -} + var faces = src.faces; + var totalFaces = faces.length; -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + if (totalFaces === 0) + { + return; + } + + var pipeline = renderer.pipelines.set(src.pipeline, src); + + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + var textureUnit = pipeline.setGameObject(src); + + var F32 = pipeline.vertexViewF32; + var U32 = pipeline.vertexViewU32; + + var vertexOffset = (pipeline.vertexCount * pipeline.currentShader.vertexComponentCount) - 1; + + var tintEffect = src.tintFill; + + var debugFaces = []; + var debugCallback = src.debugCallback; + + var a = calcMatrix.a; + var b = calcMatrix.b; + var c = calcMatrix.c; + var d = calcMatrix.d; + var e = calcMatrix.e; + var f = calcMatrix.f; + + var z = src.viewPosition.z; + + var hideCCW = src.hideCCW; + var roundPixels = camera.roundPixels; + var alpha = camera.alpha * src.alpha; + + var totalFacesRendered = 0; + + renderer.pipelines.preBatch(src); + + for (var i = 0; i < totalFaces; i++) + { + var face = faces[i]; + + // If face has alpha <= 0, or hideCCW + clockwise, or isn't in camera view, then don't draw it + if (!face.isInView(camera, hideCCW, z, alpha, a, b, c, d, e, f, roundPixels)) + { + continue; + } + + if (pipeline.shouldFlush(3)) + { + pipeline.flush(); + + vertexOffset = 0; + } + + vertexOffset = face.load(F32, U32, vertexOffset, textureUnit, tintEffect); + + totalFacesRendered++; + pipeline.vertexCount += 3; + + if (debugCallback) + { + debugFaces.push(face); + } + } + + src.totalFrame += totalFacesRendered; + + if (debugCallback) + { + debugCallback.call(src, src, debugFaces); + } + + renderer.pipelines.postBatch(src); +}; + +module.exports = MeshWebGLRenderer; /***/ }), -/* 1105 */ +/* 1164 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * This is a stub function for Mesh.Render. There is no Canvas renderer for Mesh objects. + * + * @method Phaser.GameObjects.Mesh#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var MeshCanvasRenderer = function () +{ +}; + +module.exports = MeshCanvasRenderer; + + +/***/ }), +/* 1165 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159113,7 +168060,7 @@ if (true) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Shader = __webpack_require__(215); +var Shader = __webpack_require__(220); var GameObjectFactory = __webpack_require__(5); /** @@ -159145,7 +168092,7 @@ if (true) /***/ }), -/* 1106 */ +/* 1166 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159154,53 +168101,43 @@ if (true) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(15); -var GetValue = __webpack_require__(6); -var Mesh = __webpack_require__(142); +var Mesh = __webpack_require__(221); +var GameObjectFactory = __webpack_require__(5); /** - * Creates a new Mesh Game Object and returns it. + * Creates a new Mesh Game Object and adds it to the Scene. * * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. * - * @method Phaser.GameObjects.GameObjectCreator#mesh + * @method Phaser.GameObjects.GameObjectFactory#mesh + * @webglOnly * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * @param {number} [x] - The horizontal position of this Game Object in the world. + * @param {number} [y] - The vertical position of this Game Object in the world. + * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number[]} [vertices] - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} [uvs] - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. * * @return {Phaser.GameObjects.Mesh} The Game Object that was created. */ -GameObjectCreator.register('mesh', function (config, addToScene) +if (true) { - if (config === undefined) { config = {}; } - - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - var vertices = GetValue(config, 'vertices', []); - var colors = GetValue(config, 'colors', []); - var alphas = GetValue(config, 'alphas', []); - var uv = GetValue(config, 'uv', []); - - var mesh = new Mesh(this.scene, 0, 0, vertices, uv, colors, alphas, key, frame); - - if (addToScene !== undefined) + GameObjectFactory.register('mesh', function (x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) { - config.add = addToScene; - } - - BuildGameObject(this.scene, mesh, config); - - return mesh; -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. + return this.displayList.add(new Mesh(this.scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas)); + }); +} /***/ }), -/* 1107 */ +/* 1167 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159209,60 +168146,10 @@ GameObjectCreator.register('mesh', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Quad = __webpack_require__(214); - -/** - * Creates a new Quad Game Object and returns it. - * - * Note: This method will only be available if the Quad Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#quad - * @since 3.0.0 - * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. - * - * @return {Phaser.GameObjects.Quad} The Game Object that was created. - */ -GameObjectCreator.register('quad', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var x = GetAdvancedValue(config, 'x', 0); - var y = GetAdvancedValue(config, 'y', 0); - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - - var quad = new Quad(this.scene, x, y, key, frame); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, quad, config); - - return quad; -}); - - -/***/ }), -/* 1108 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(15); -var Shader = __webpack_require__(215); +var Shader = __webpack_require__(220); /** * Creates a new Shader Game Object and returns it. @@ -159303,7 +168190,63 @@ GameObjectCreator.register('shader', function (config, addToScene) /***/ }), -/* 1109 */ +/* 1168 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); +var GetAdvancedValue = __webpack_require__(15); +var GetValue = __webpack_require__(6); +var Mesh = __webpack_require__(221); + +/** + * Creates a new Mesh Game Object and returns it. + * + * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#mesh + * @since 3.0.0 + * + * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Mesh} The Game Object that was created. + */ +GameObjectCreator.register('mesh', function (config, addToScene) +{ + if (config === undefined) { config = {}; } + + var key = GetAdvancedValue(config, 'key', null); + var frame = GetAdvancedValue(config, 'frame', null); + var vertices = GetValue(config, 'vertices', []); + var uvs = GetValue(config, 'uvs', []); + var indicies = GetValue(config, 'indicies', []); + var containsZ = GetValue(config, 'containsZ', false); + var normals = GetValue(config, 'normals', []); + var colors = GetValue(config, 'colors', 0xffffff); + var alphas = GetValue(config, 'alphas', 1); + + var mesh = new Mesh(this.scene, 0, 0, key, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas); + + if (addToScene !== undefined) + { + config.add = addToScene; + } + + BuildGameObject(this.scene, mesh, config); + + return mesh; +}); + + +/***/ }), +/* 1169 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159313,8 +168256,251 @@ GameObjectCreator.register('shader', function (config, addToScene) */ var Class = __webpack_require__(0); -var LightsManager = __webpack_require__(447); -var PluginCache = __webpack_require__(23); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(14); +var IntegerToRGB = __webpack_require__(181); +var RGB = __webpack_require__(376); + +/** + * @classdesc + * An Image Game Object. + * + * An Image is a light-weight Game Object useful for the display of static images in your game, + * such as logos, backgrounds, scenery or other non-animated elements. Images can have input + * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an + * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. + * + * @class PointLight + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.50.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + */ +var PointLight = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.GetBounds, + Components.Mask, + Components.Pipeline, + Components.ScrollFactor, + Components.Transform, + Components.Visible + ], + + initialize: + + function PointLight (scene, x, y, color, radius, intensity) + { + if (color === undefined) { color = 0xffffff; } + if (radius === undefined) { radius = 128; } + if (intensity === undefined) { intensity = 10; } + + GameObject.call(this, scene, 'PointLight'); + + this.initPipeline('Light2D'); + + this.setPosition(x, y); + + var rgb = IntegerToRGB(color); + + this.color = new RGB( + rgb.r / 255, + rgb.g / 255, + rgb.b / 255 + ); + + this.intensity = intensity; + + // read only: + this.width = radius * 2; + this.height = radius * 2; + + // private + this._radius = radius; + }, + + radius: { + + get: function () + { + return this._radius; + }, + + set: function (value) + { + this._radius = value; + this.width = value * 2; + this.height = value * 2; + } + + }, + + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#originX + * @type {number} + * @readonly + * @since 3.4.0 + */ + originX: { + + get: function () + { + return 0.5; + } + + }, + + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#originY + * @type {number} + * @readonly + * @since 3.4.0 + */ + originY: { + + get: function () + { + return 0.5; + } + + }, + + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#displayOriginX + * @type {number} + * @readonly + * @since 3.4.0 + */ + displayOriginX: { + + get: function () + { + return this._radius; + } + + }, + + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#displayOriginY + * @type {number} + * @readonly + * @since 3.4.0 + */ + displayOriginY: { + + get: function () + { + return this._radius; + } + + }, + + renderWebGL: function (renderer, src, camera, parentTransformMatrix) + { + var pipeline = renderer.pipelines.set(src.pipeline); + + var camMatrix = pipeline.tempMatrix1; + var lightMatrix = pipeline.tempMatrix2; + var calcMatrix = pipeline.tempMatrix3; + + var width = src.width; + var height = src.height; + + var x = -src.radius; + var y = -src.radius; + + var xw = x + width; + var yh = y + height; + + lightMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + + // Undo the camera scroll + lightMatrix.e = src.x; + lightMatrix.f = src.y; + } + else + { + lightMatrix.e -= camera.scrollX * src.scrollFactorX; + lightMatrix.f -= camera.scrollY * src.scrollFactorY; + } + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(lightMatrix, calcMatrix); + + var lightX = calcMatrix.getX(0, 0); + var lightY = calcMatrix.getY(0, 0); + + var tx0 = calcMatrix.getX(x, y); + var ty0 = calcMatrix.getY(x, y); + + var tx1 = calcMatrix.getX(x, yh); + var ty1 = calcMatrix.getY(x, yh); + + var tx2 = calcMatrix.getX(xw, yh); + var ty2 = calcMatrix.getY(xw, yh); + + var tx3 = calcMatrix.getX(xw, y); + var ty3 = calcMatrix.getY(xw, y); + + pipeline.batchLight(src, camera, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, lightX, lightY); + } + +}); + +module.exports = PointLight; + + +/***/ }), +/* 1170 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var LightsManager = __webpack_require__(459); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); /** @@ -159419,7 +168605,7 @@ module.exports = LightsPlugin; /***/ }), -/* 1110 */ +/* 1171 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159428,29 +168614,29 @@ module.exports = LightsPlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(68); +var Circle = __webpack_require__(71); -Circle.Area = __webpack_require__(1111); -Circle.Circumference = __webpack_require__(279); -Circle.CircumferencePoint = __webpack_require__(159); -Circle.Clone = __webpack_require__(1112); -Circle.Contains = __webpack_require__(57); -Circle.ContainsPoint = __webpack_require__(1113); -Circle.ContainsRect = __webpack_require__(1114); -Circle.CopyFrom = __webpack_require__(1115); -Circle.Equals = __webpack_require__(1116); -Circle.GetBounds = __webpack_require__(1117); -Circle.GetPoint = __webpack_require__(277); -Circle.GetPoints = __webpack_require__(278); -Circle.Offset = __webpack_require__(1118); -Circle.OffsetPoint = __webpack_require__(1119); -Circle.Random = __webpack_require__(160); +Circle.Area = __webpack_require__(1172); +Circle.Circumference = __webpack_require__(294); +Circle.CircumferencePoint = __webpack_require__(160); +Circle.Clone = __webpack_require__(1173); +Circle.Contains = __webpack_require__(62); +Circle.ContainsPoint = __webpack_require__(1174); +Circle.ContainsRect = __webpack_require__(1175); +Circle.CopyFrom = __webpack_require__(1176); +Circle.Equals = __webpack_require__(1177); +Circle.GetBounds = __webpack_require__(1178); +Circle.GetPoint = __webpack_require__(292); +Circle.GetPoints = __webpack_require__(293); +Circle.Offset = __webpack_require__(1179); +Circle.OffsetPoint = __webpack_require__(1180); +Circle.Random = __webpack_require__(161); module.exports = Circle; /***/ }), -/* 1111 */ +/* 1172 */ /***/ (function(module, exports) { /** @@ -159478,7 +168664,7 @@ module.exports = Area; /***/ }), -/* 1112 */ +/* 1173 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159487,7 +168673,7 @@ module.exports = Area; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(68); +var Circle = __webpack_require__(71); /** * Creates a new Circle instance based on the values contained in the given source. @@ -159508,7 +168694,7 @@ module.exports = Clone; /***/ }), -/* 1113 */ +/* 1174 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159517,7 +168703,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(57); +var Contains = __webpack_require__(62); /** * Check to see if the Circle contains the given Point object. @@ -159539,7 +168725,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1114 */ +/* 1175 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159548,7 +168734,7 @@ module.exports = ContainsPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(57); +var Contains = __webpack_require__(62); /** * Check to see if the Circle contains all four points of the given Rectangle object. @@ -159575,7 +168761,7 @@ module.exports = ContainsRect; /***/ }), -/* 1115 */ +/* 1176 */ /***/ (function(module, exports) { /** @@ -159607,7 +168793,7 @@ module.exports = CopyFrom; /***/ }), -/* 1116 */ +/* 1177 */ /***/ (function(module, exports) { /** @@ -159641,7 +168827,7 @@ module.exports = Equals; /***/ }), -/* 1117 */ +/* 1178 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159681,7 +168867,7 @@ module.exports = GetBounds; /***/ }), -/* 1118 */ +/* 1179 */ /***/ (function(module, exports) { /** @@ -159716,7 +168902,7 @@ module.exports = Offset; /***/ }), -/* 1119 */ +/* 1180 */ /***/ (function(module, exports) { /** @@ -159750,7 +168936,7 @@ module.exports = OffsetPoint; /***/ }), -/* 1120 */ +/* 1181 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159759,29 +168945,29 @@ module.exports = OffsetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Ellipse = __webpack_require__(98); +var Ellipse = __webpack_require__(106); -Ellipse.Area = __webpack_require__(1121); -Ellipse.Circumference = __webpack_require__(414); -Ellipse.CircumferencePoint = __webpack_require__(204); -Ellipse.Clone = __webpack_require__(1122); -Ellipse.Contains = __webpack_require__(99); -Ellipse.ContainsPoint = __webpack_require__(1123); -Ellipse.ContainsRect = __webpack_require__(1124); -Ellipse.CopyFrom = __webpack_require__(1125); -Ellipse.Equals = __webpack_require__(1126); -Ellipse.GetBounds = __webpack_require__(1127); -Ellipse.GetPoint = __webpack_require__(412); -Ellipse.GetPoints = __webpack_require__(413); -Ellipse.Offset = __webpack_require__(1128); -Ellipse.OffsetPoint = __webpack_require__(1129); -Ellipse.Random = __webpack_require__(167); +Ellipse.Area = __webpack_require__(1182); +Ellipse.Circumference = __webpack_require__(424); +Ellipse.CircumferencePoint = __webpack_require__(209); +Ellipse.Clone = __webpack_require__(1183); +Ellipse.Contains = __webpack_require__(107); +Ellipse.ContainsPoint = __webpack_require__(1184); +Ellipse.ContainsRect = __webpack_require__(1185); +Ellipse.CopyFrom = __webpack_require__(1186); +Ellipse.Equals = __webpack_require__(1187); +Ellipse.GetBounds = __webpack_require__(1188); +Ellipse.GetPoint = __webpack_require__(422); +Ellipse.GetPoints = __webpack_require__(423); +Ellipse.Offset = __webpack_require__(1189); +Ellipse.OffsetPoint = __webpack_require__(1190); +Ellipse.Random = __webpack_require__(172); module.exports = Ellipse; /***/ }), -/* 1121 */ +/* 1182 */ /***/ (function(module, exports) { /** @@ -159815,7 +169001,7 @@ module.exports = Area; /***/ }), -/* 1122 */ +/* 1183 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159824,7 +169010,7 @@ module.exports = Area; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Ellipse = __webpack_require__(98); +var Ellipse = __webpack_require__(106); /** * Creates a new Ellipse instance based on the values contained in the given source. @@ -159845,7 +169031,7 @@ module.exports = Clone; /***/ }), -/* 1123 */ +/* 1184 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159854,7 +169040,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(99); +var Contains = __webpack_require__(107); /** * Check to see if the Ellipse contains the given Point object. @@ -159876,7 +169062,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1124 */ +/* 1185 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159885,7 +169071,7 @@ module.exports = ContainsPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(99); +var Contains = __webpack_require__(107); /** * Check to see if the Ellipse contains all four points of the given Rectangle object. @@ -159912,7 +169098,7 @@ module.exports = ContainsRect; /***/ }), -/* 1125 */ +/* 1186 */ /***/ (function(module, exports) { /** @@ -159944,7 +169130,7 @@ module.exports = CopyFrom; /***/ }), -/* 1126 */ +/* 1187 */ /***/ (function(module, exports) { /** @@ -159979,7 +169165,7 @@ module.exports = Equals; /***/ }), -/* 1127 */ +/* 1188 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160019,7 +169205,7 @@ module.exports = GetBounds; /***/ }), -/* 1128 */ +/* 1189 */ /***/ (function(module, exports) { /** @@ -160054,7 +169240,7 @@ module.exports = Offset; /***/ }), -/* 1129 */ +/* 1190 */ /***/ (function(module, exports) { /** @@ -160088,7 +169274,7 @@ module.exports = OffsetPoint; /***/ }), -/* 1130 */ +/* 1191 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160099,7 +169285,7 @@ module.exports = OffsetPoint; */ var Point = __webpack_require__(4); -var CircleToCircle = __webpack_require__(216); +var CircleToCircle = __webpack_require__(222); /** * Checks if two Circles intersect and returns the intersection points as a Point object array. @@ -160182,7 +169368,7 @@ module.exports = GetCircleToCircle; /***/ }), -/* 1131 */ +/* 1192 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160192,8 +169378,8 @@ module.exports = GetCircleToCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLineToCircle = __webpack_require__(218); -var CircleToRectangle = __webpack_require__(217); +var GetLineToCircle = __webpack_require__(224); +var CircleToRectangle = __webpack_require__(223); /** * Checks for intersection between a circle and a rectangle, @@ -160232,7 +169418,7 @@ module.exports = GetCircleToRectangle; /***/ }), -/* 1132 */ +/* 1193 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160241,9 +169427,9 @@ module.exports = GetCircleToRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector4 = __webpack_require__(129); -var GetLineToPolygon = __webpack_require__(452); -var Line = __webpack_require__(40); +var Vector4 = __webpack_require__(135); +var GetLineToPolygon = __webpack_require__(464); +var Line = __webpack_require__(45); // Temp calculation segment var segment = new Line(); @@ -160334,7 +169520,7 @@ module.exports = GetRaysFromPointToPolygon; /***/ }), -/* 1133 */ +/* 1194 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160344,7 +169530,7 @@ module.exports = GetRaysFromPointToPolygon; */ var Rectangle = __webpack_require__(9); -var RectangleToRectangle = __webpack_require__(143); +var RectangleToRectangle = __webpack_require__(112); /** * Checks if two Rectangle shapes intersect and returns the area of this intersection as Rectangle object. @@ -160383,7 +169569,7 @@ module.exports = GetRectangleIntersection; /***/ }), -/* 1134 */ +/* 1195 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160393,8 +169579,8 @@ module.exports = GetRectangleIntersection; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLineToRectangle = __webpack_require__(220); -var RectangleToRectangle = __webpack_require__(143); +var GetLineToRectangle = __webpack_require__(226); +var RectangleToRectangle = __webpack_require__(112); /** * Checks if two Rectangles intersect and returns the intersection points as a Point object array. @@ -160434,7 +169620,7 @@ module.exports = GetRectangleToRectangle; /***/ }), -/* 1135 */ +/* 1196 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160444,8 +169630,8 @@ module.exports = GetRectangleToRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RectangleToTriangle = __webpack_require__(454); -var GetLineToRectangle = __webpack_require__(220); +var RectangleToTriangle = __webpack_require__(466); +var GetLineToRectangle = __webpack_require__(226); /** * Checks for intersection between Rectangle shape and Triangle shape, @@ -160482,7 +169668,7 @@ module.exports = GetRectangleToTriangle; /***/ }), -/* 1136 */ +/* 1197 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160492,8 +169678,8 @@ module.exports = GetRectangleToTriangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLineToCircle = __webpack_require__(218); -var TriangleToCircle = __webpack_require__(456); +var GetLineToCircle = __webpack_require__(224); +var TriangleToCircle = __webpack_require__(468); /** * Checks if a Triangle and a Circle intersect, and returns the intersection points as a Point object array. @@ -160531,7 +169717,7 @@ module.exports = GetTriangleToCircle; /***/ }), -/* 1137 */ +/* 1198 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160541,8 +169727,8 @@ module.exports = GetTriangleToCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TriangleToTriangle = __webpack_require__(459); -var GetTriangleToLine = __webpack_require__(457); +var TriangleToTriangle = __webpack_require__(471); +var GetTriangleToLine = __webpack_require__(469); /** * Checks if two Triangles intersect, and returns the intersection points as a Point object array. @@ -160580,7 +169766,7 @@ module.exports = GetTriangleToTriangle; /***/ }), -/* 1138 */ +/* 1199 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160589,7 +169775,7 @@ module.exports = GetTriangleToTriangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PointToLine = __webpack_require__(461); +var PointToLine = __webpack_require__(473); /** * Checks if a Point is located on the given line segment. @@ -160621,7 +169807,7 @@ module.exports = PointToLineSegment; /***/ }), -/* 1139 */ +/* 1200 */ /***/ (function(module, exports) { /** @@ -160661,7 +169847,7 @@ module.exports = RectangleToValues; /***/ }), -/* 1140 */ +/* 1201 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160670,43 +169856,43 @@ module.exports = RectangleToValues; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Line = __webpack_require__(40); +var Line = __webpack_require__(45); -Line.Angle = __webpack_require__(87); -Line.BresenhamPoints = __webpack_require__(297); -Line.CenterOn = __webpack_require__(1141); -Line.Clone = __webpack_require__(1142); -Line.CopyFrom = __webpack_require__(1143); -Line.Equals = __webpack_require__(1144); -Line.Extend = __webpack_require__(1145); -Line.GetEasedPoints = __webpack_require__(1146); -Line.GetMidPoint = __webpack_require__(1147); -Line.GetNearestPoint = __webpack_require__(1148); -Line.GetNormal = __webpack_require__(1149); -Line.GetPoint = __webpack_require__(284); -Line.GetPoints = __webpack_require__(162); -Line.GetShortestDistance = __webpack_require__(1150); -Line.Height = __webpack_require__(1151); -Line.Length = __webpack_require__(58); -Line.NormalAngle = __webpack_require__(462); -Line.NormalX = __webpack_require__(1152); -Line.NormalY = __webpack_require__(1153); -Line.Offset = __webpack_require__(1154); -Line.PerpSlope = __webpack_require__(1155); -Line.Random = __webpack_require__(163); -Line.ReflectAngle = __webpack_require__(1156); -Line.Rotate = __webpack_require__(1157); -Line.RotateAroundPoint = __webpack_require__(1158); -Line.RotateAroundXY = __webpack_require__(222); -Line.SetToAngle = __webpack_require__(1159); -Line.Slope = __webpack_require__(1160); -Line.Width = __webpack_require__(1161); +Line.Angle = __webpack_require__(92); +Line.BresenhamPoints = __webpack_require__(309); +Line.CenterOn = __webpack_require__(1202); +Line.Clone = __webpack_require__(1203); +Line.CopyFrom = __webpack_require__(1204); +Line.Equals = __webpack_require__(1205); +Line.Extend = __webpack_require__(1206); +Line.GetEasedPoints = __webpack_require__(1207); +Line.GetMidPoint = __webpack_require__(1208); +Line.GetNearestPoint = __webpack_require__(1209); +Line.GetNormal = __webpack_require__(1210); +Line.GetPoint = __webpack_require__(299); +Line.GetPoints = __webpack_require__(163); +Line.GetShortestDistance = __webpack_require__(1211); +Line.Height = __webpack_require__(1212); +Line.Length = __webpack_require__(63); +Line.NormalAngle = __webpack_require__(474); +Line.NormalX = __webpack_require__(1213); +Line.NormalY = __webpack_require__(1214); +Line.Offset = __webpack_require__(1215); +Line.PerpSlope = __webpack_require__(1216); +Line.Random = __webpack_require__(164); +Line.ReflectAngle = __webpack_require__(1217); +Line.Rotate = __webpack_require__(1218); +Line.RotateAroundPoint = __webpack_require__(1219); +Line.RotateAroundXY = __webpack_require__(228); +Line.SetToAngle = __webpack_require__(1220); +Line.Slope = __webpack_require__(1221); +Line.Width = __webpack_require__(1222); module.exports = Line; /***/ }), -/* 1141 */ +/* 1202 */ /***/ (function(module, exports) { /** @@ -160746,7 +169932,7 @@ module.exports = CenterOn; /***/ }), -/* 1142 */ +/* 1203 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160755,7 +169941,7 @@ module.exports = CenterOn; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Line = __webpack_require__(40); +var Line = __webpack_require__(45); /** * Clone the given line. @@ -160776,7 +169962,7 @@ module.exports = Clone; /***/ }), -/* 1143 */ +/* 1204 */ /***/ (function(module, exports) { /** @@ -160807,7 +169993,7 @@ module.exports = CopyFrom; /***/ }), -/* 1144 */ +/* 1205 */ /***/ (function(module, exports) { /** @@ -160841,7 +170027,7 @@ module.exports = Equals; /***/ }), -/* 1145 */ +/* 1206 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160850,7 +170036,7 @@ module.exports = Equals; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); /** * Extends the start and end points of a Line by the given amounts. @@ -160899,7 +170085,7 @@ module.exports = Extend; /***/ }), -/* 1146 */ +/* 1207 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160908,8 +170094,8 @@ module.exports = Extend; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DistanceBetweenPoints = __webpack_require__(333); -var GetEaseFunction = __webpack_require__(71); +var DistanceBetweenPoints = __webpack_require__(344); +var GetEaseFunction = __webpack_require__(78); var Point = __webpack_require__(4); /** @@ -160941,7 +170127,7 @@ var Point = __webpack_require__(4); * * @param {Phaser.Geom.Line} line - The Line object. * @param {(string|function)} ease - The ease to use. This can be either a string from the EaseMap, or a custom function. - * @param {integer} quantity - The number of points to return. Note that if you provide a `collinearThreshold`, the resulting array may not always contain this number of points. + * @param {number} quantity - The number of points to return. Note that if you provide a `collinearThreshold`, the resulting array may not always contain this number of points. * @param {number} [collinearThreshold=0] - An optional threshold. The final array is reduced so that each point is spaced out at least this distance apart. This helps reduce clustering in noisey eases. * @param {number[]} [easeParams] - An optional array of ease parameters to go with the ease. * @@ -161019,7 +170205,7 @@ module.exports = GetEasedPoints; /***/ }), -/* 1147 */ +/* 1208 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161057,7 +170243,7 @@ module.exports = GetMidPoint; /***/ }), -/* 1148 */ +/* 1209 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161112,7 +170298,7 @@ module.exports = GetNearestPoint; /***/ }), -/* 1149 */ +/* 1210 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161122,7 +170308,7 @@ module.exports = GetNearestPoint; */ var MATH_CONST = __webpack_require__(13); -var Angle = __webpack_require__(87); +var Angle = __webpack_require__(92); var Point = __webpack_require__(4); /** @@ -161156,7 +170342,7 @@ module.exports = GetNormal; /***/ }), -/* 1150 */ +/* 1211 */ /***/ (function(module, exports) { /** @@ -161203,7 +170389,7 @@ module.exports = GetShortestDistance; /***/ }), -/* 1151 */ +/* 1212 */ /***/ (function(module, exports) { /** @@ -161231,7 +170417,7 @@ module.exports = Height; /***/ }), -/* 1152 */ +/* 1213 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161241,7 +170427,7 @@ module.exports = Height; */ var MATH_CONST = __webpack_require__(13); -var Angle = __webpack_require__(87); +var Angle = __webpack_require__(92); /** * Returns the x component of the normal vector of the given line. @@ -161262,7 +170448,7 @@ module.exports = NormalX; /***/ }), -/* 1153 */ +/* 1214 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161272,7 +170458,7 @@ module.exports = NormalX; */ var MATH_CONST = __webpack_require__(13); -var Angle = __webpack_require__(87); +var Angle = __webpack_require__(92); /** * The Y value of the normal of the given line. @@ -161294,7 +170480,7 @@ module.exports = NormalY; /***/ }), -/* 1154 */ +/* 1215 */ /***/ (function(module, exports) { /** @@ -161332,7 +170518,7 @@ module.exports = Offset; /***/ }), -/* 1155 */ +/* 1216 */ /***/ (function(module, exports) { /** @@ -161360,7 +170546,7 @@ module.exports = PerpSlope; /***/ }), -/* 1156 */ +/* 1217 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161369,8 +170555,8 @@ module.exports = PerpSlope; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Angle = __webpack_require__(87); -var NormalAngle = __webpack_require__(462); +var Angle = __webpack_require__(92); +var NormalAngle = __webpack_require__(474); /** * Calculate the reflected angle between two lines. @@ -161394,7 +170580,7 @@ module.exports = ReflectAngle; /***/ }), -/* 1157 */ +/* 1218 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161403,7 +170589,7 @@ module.exports = ReflectAngle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundXY = __webpack_require__(222); +var RotateAroundXY = __webpack_require__(228); /** * Rotate a line around its midpoint by the given angle in radians. @@ -161430,7 +170616,7 @@ module.exports = Rotate; /***/ }), -/* 1158 */ +/* 1219 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161439,7 +170625,7 @@ module.exports = Rotate; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundXY = __webpack_require__(222); +var RotateAroundXY = __webpack_require__(228); /** * Rotate a line around a point by the given angle in radians. @@ -161464,7 +170650,7 @@ module.exports = RotateAroundPoint; /***/ }), -/* 1159 */ +/* 1220 */ /***/ (function(module, exports) { /** @@ -161504,7 +170690,7 @@ module.exports = SetToAngle; /***/ }), -/* 1160 */ +/* 1221 */ /***/ (function(module, exports) { /** @@ -161532,7 +170718,7 @@ module.exports = Slope; /***/ }), -/* 1161 */ +/* 1222 */ /***/ (function(module, exports) { /** @@ -161560,7 +170746,334 @@ module.exports = Width; /***/ }), -/* 1162 */ +/* 1223 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Geom.Mesh + */ + +var Mesh = { + + Face: __webpack_require__(111), + GenerateGridVerts: __webpack_require__(1224), + GenerateObjVerts: __webpack_require__(457), + GenerateVerts: __webpack_require__(456), + ParseObj: __webpack_require__(475), + ParseObjMaterial: __webpack_require__(476), + RotateFace: __webpack_require__(1225), + Vertex: __webpack_require__(113) + +}; + +module.exports = Mesh; + + +/***/ }), +/* 1224 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Face = __webpack_require__(111); +var GetFastValue = __webpack_require__(2); +var Matrix4 = __webpack_require__(73); +var Vector3 = __webpack_require__(37); +var Vertex = __webpack_require__(113); + +var tempPosition = new Vector3(); +var tempRotation = new Vector3(); +var tempMatrix = new Matrix4(); + +/** + * Creates a grid of vertices based on the given configuration object and optionally adds it to a Mesh. + * + * The size of the grid is given in pixels. An example configuration may be: + * + * `{ width: 256, height: 256, widthSegments: 2, heightSegments: 2, tile: true }` + * + * This will create a grid 256 x 256 pixels in size, split into 2 x 2 segments, with + * the texture tiling across the cells. + * + * You can split the grid into segments both vertically and horizontally. This will + * generate two faces per grid segment as a result. + * + * The `tile` parameter allows you to control if the tile will repeat across the grid + * segments, or be displayed in full. + * + * If adding this grid to a Mesh you can offset the grid via the `x` and `y` properties. + * + * UV coordinates are generated based on the given texture and frame in the config. For + * example, no frame is given, the UVs will be in the range 0 to 1. If a frame is given, + * such as from a texture atlas, the UVs will be generated within the range of that frame. + * + * @function Phaser.Geom.Mesh.GeneraterGridVerts + * @since 3.50.0 + * + * @param {Phaser.Types.Geom.Mesh.GenerateGridConfig} config - A Grid configuration object. + * + * @return {Phaser.Types.Geom.Mesh.GenerateGridVertsResult} A Grid Result object, containing the generated vertices and indicies. + */ +var GenerateGridVerts = function (config) +{ + var mesh = GetFastValue(config, 'mesh'); + var texture = GetFastValue(config, 'texture', null); + var frame = GetFastValue(config, 'frame'); + var width = GetFastValue(config, 'width', 1); + var height = GetFastValue(config, 'height', width); + var widthSegments = GetFastValue(config, 'widthSegments', 1); + var heightSegments = GetFastValue(config, 'heightSegments', widthSegments); + var posX = GetFastValue(config, 'x', 0); + var posY = GetFastValue(config, 'y', 0); + var posZ = GetFastValue(config, 'z', 0); + var rotateX = GetFastValue(config, 'rotateX', 0); + var rotateY = GetFastValue(config, 'rotateY', 0); + var rotateZ = GetFastValue(config, 'rotateZ', 0); + var zIsUp = GetFastValue(config, 'zIsUp', true); + var isOrtho = GetFastValue(config, 'isOrtho', (mesh) ? mesh.dirtyCache[11] : false); + var colors = GetFastValue(config, 'colors', [ 0xffffff ]); + var alphas = GetFastValue(config, 'alphas', [ 1 ]); + var tile = GetFastValue(config, 'tile', false); + + var widthSet = GetFastValue(config, 'width', null); + + var result = { + faces: [], + verts: [] + }; + + tempPosition.set(posX, posY, posZ); + tempRotation.set(rotateX, rotateY, rotateZ); + tempMatrix.fromRotationXYTranslation(tempRotation, tempPosition, zIsUp); + + if (!texture && mesh) + { + texture = mesh.texture; + } + else if (mesh && typeof(texture) === 'string') + { + texture = mesh.scene.sys.textures.get(texture); + } + else + { + // There's nothing more we can do without a texture + return result; + } + + var textureFrame = texture.get(frame); + + // If the Mesh is ortho and no width / height is given, we'll default to texture sizes (if set!) + if (!widthSet && isOrtho && texture && mesh) + { + width = textureFrame.width / mesh.height; + height = textureFrame.height / mesh.height; + } + + var halfWidth = width / 2; + var halfHeight = height / 2; + + var gridX = Math.floor(widthSegments); + var gridY = Math.floor(heightSegments); + + var gridX1 = gridX + 1; + var gridY1 = gridY + 1; + + var segmentWidth = width / gridX; + var segmentHeight = height / gridY; + + var uvs = []; + var vertices = []; + + var ix; + var iy; + + var frameU0 = 0; + var frameU1 = 1; + var frameV0 = 0; + var frameV1 = 1; + + if (textureFrame) + { + frameU0 = textureFrame.u0; + frameU1 = textureFrame.u1; + frameV0 = textureFrame.v0; + frameV1 = textureFrame.v1; + } + + var frameU = frameU1 - frameU0; + var frameV = frameV1 - frameV0; + + for (iy = 0; iy < gridY1; iy++) + { + var y = iy * segmentHeight - halfHeight; + + for (ix = 0; ix < gridX1; ix++) + { + var x = ix * segmentWidth - halfWidth; + + vertices.push(x, -y); + + var tu = frameU0 + frameU * (ix / gridX); + var tv = frameV0 + frameV * (iy / gridY); + + uvs.push(tu, tv); + } + } + + if (!Array.isArray(colors)) + { + colors = [ colors ]; + } + + if (!Array.isArray(alphas)) + { + alphas = [ alphas ]; + } + + var alphaIndex = 0; + var colorIndex = 0; + + for (iy = 0; iy < gridY; iy++) + { + for (ix = 0; ix < gridX; ix++) + { + var a = (ix + gridX1 * iy) * 2; + var b = (ix + gridX1 * (iy + 1)) * 2; + var c = ((ix + 1) + gridX1 * (iy + 1)) * 2; + var d = ((ix + 1) + gridX1 * iy) * 2; + + var color = colors[colorIndex]; + var alpha = alphas[alphaIndex]; + + var vert1 = new Vertex(vertices[a], vertices[a + 1], 0, uvs[a], uvs[a + 1], color, alpha).transformMat4(tempMatrix); + var vert2 = new Vertex(vertices[b], vertices[b + 1], 0, uvs[b], uvs[b + 1], color, alpha).transformMat4(tempMatrix); + var vert3 = new Vertex(vertices[d], vertices[d + 1], 0, uvs[d], uvs[d + 1], color, alpha).transformMat4(tempMatrix); + var vert4 = new Vertex(vertices[b], vertices[b + 1], 0, uvs[b], uvs[b + 1], color, alpha).transformMat4(tempMatrix); + var vert5 = new Vertex(vertices[c], vertices[c + 1], 0, uvs[c], uvs[c + 1], color, alpha).transformMat4(tempMatrix); + var vert6 = new Vertex(vertices[d], vertices[d + 1], 0, uvs[d], uvs[d + 1], color, alpha).transformMat4(tempMatrix); + + if (tile) + { + vert1.setUVs(frameU0, frameV1); + vert2.setUVs(frameU0, frameV0); + vert3.setUVs(frameU1, frameV1); + vert4.setUVs(frameU0, frameV0); + vert5.setUVs(frameU1, frameV0); + vert6.setUVs(frameU1, frameV1); + } + + colorIndex++; + + if (colorIndex === colors.length) + { + colorIndex = 0; + } + + alphaIndex++; + + if (alphaIndex === alphas.length) + { + alphaIndex = 0; + } + + result.verts.push(vert1, vert2, vert3, vert4, vert5, vert6); + + result.faces.push( + new Face(vert1, vert2, vert3), + new Face(vert4, vert5, vert6) + ); + } + } + + if (mesh) + { + mesh.faces = mesh.faces.concat(result.faces); + mesh.vertices = mesh.vertices.concat(result.verts); + } + + return result; +}; + +module.exports = GenerateGridVerts; + + +/***/ }), +/* 1225 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Rotates the vertices of a Face to the given angle. + * + * The actual vertex positions are adjusted, not their transformed positions. + * + * Therefore, this updates the vertex data directly. + * + * @function Phaser.Geom.Mesh.RotateFace + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Face} face - The Face to rotate. + * @param {number} angle - The angle to rotate to, in radians. + * @param {number} [cx] - An optional center of rotation. If not given, the Face in-center is used. + * @param {number} [cy] - An optional center of rotation. If not given, the Face in-center is used. + */ +var RotateFace = function (face, angle, cx, cy) +{ + var x; + var y; + + // No point of rotation? Use the inCenter instead, then. + if (cx === undefined && cy === undefined) + { + var inCenter = face.getInCenter(); + + x = inCenter.x; + y = inCenter.y; + } + + var c = Math.cos(angle); + var s = Math.sin(angle); + + var v1 = face.vertex1; + var v2 = face.vertex2; + var v3 = face.vertex3; + + var tx = v1.x - x; + var ty = v1.y - y; + + v1.set(tx * c - ty * s + x, tx * s + ty * c + y); + + tx = v2.x - x; + ty = v2.y - y; + + v2.set(tx * c - ty * s + x, tx * s + ty * c + y); + + tx = v3.x - x; + ty = v3.y - y; + + v3.set(tx * c - ty * s + x, tx * s + ty * c + y); +}; + +module.exports = RotateFace; + + +/***/ }), +/* 1226 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161571,27 +171084,27 @@ module.exports = Width; var Point = __webpack_require__(4); -Point.Ceil = __webpack_require__(1163); -Point.Clone = __webpack_require__(1164); -Point.CopyFrom = __webpack_require__(1165); -Point.Equals = __webpack_require__(1166); -Point.Floor = __webpack_require__(1167); -Point.GetCentroid = __webpack_require__(1168); -Point.GetMagnitude = __webpack_require__(463); -Point.GetMagnitudeSq = __webpack_require__(464); -Point.GetRectangleFromPoints = __webpack_require__(1169); -Point.Interpolate = __webpack_require__(1170); -Point.Invert = __webpack_require__(1171); -Point.Negative = __webpack_require__(1172); -Point.Project = __webpack_require__(1173); -Point.ProjectUnit = __webpack_require__(1174); -Point.SetMagnitude = __webpack_require__(1175); +Point.Ceil = __webpack_require__(1227); +Point.Clone = __webpack_require__(1228); +Point.CopyFrom = __webpack_require__(1229); +Point.Equals = __webpack_require__(1230); +Point.Floor = __webpack_require__(1231); +Point.GetCentroid = __webpack_require__(1232); +Point.GetMagnitude = __webpack_require__(477); +Point.GetMagnitudeSq = __webpack_require__(478); +Point.GetRectangleFromPoints = __webpack_require__(1233); +Point.Interpolate = __webpack_require__(1234); +Point.Invert = __webpack_require__(1235); +Point.Negative = __webpack_require__(1236); +Point.Project = __webpack_require__(1237); +Point.ProjectUnit = __webpack_require__(1238); +Point.SetMagnitude = __webpack_require__(1239); module.exports = Point; /***/ }), -/* 1163 */ +/* 1227 */ /***/ (function(module, exports) { /** @@ -161621,7 +171134,7 @@ module.exports = Ceil; /***/ }), -/* 1164 */ +/* 1228 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161651,7 +171164,7 @@ module.exports = Clone; /***/ }), -/* 1165 */ +/* 1229 */ /***/ (function(module, exports) { /** @@ -161682,7 +171195,7 @@ module.exports = CopyFrom; /***/ }), -/* 1166 */ +/* 1230 */ /***/ (function(module, exports) { /** @@ -161711,7 +171224,7 @@ module.exports = Equals; /***/ }), -/* 1167 */ +/* 1231 */ /***/ (function(module, exports) { /** @@ -161741,7 +171254,7 @@ module.exports = Floor; /***/ }), -/* 1168 */ +/* 1232 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161805,7 +171318,7 @@ module.exports = GetCentroid; /***/ }), -/* 1169 */ +/* 1233 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161875,7 +171388,7 @@ module.exports = GetRectangleFromPoints; /***/ }), -/* 1170 */ +/* 1234 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161916,7 +171429,7 @@ module.exports = Interpolate; /***/ }), -/* 1171 */ +/* 1235 */ /***/ (function(module, exports) { /** @@ -161946,7 +171459,7 @@ module.exports = Invert; /***/ }), -/* 1172 */ +/* 1236 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161981,7 +171494,7 @@ module.exports = Negative; /***/ }), -/* 1173 */ +/* 1237 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161991,7 +171504,7 @@ module.exports = Negative; */ var Point = __webpack_require__(4); -var GetMagnitudeSq = __webpack_require__(464); +var GetMagnitudeSq = __webpack_require__(478); /** * Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the @@ -162028,7 +171541,7 @@ module.exports = Project; /***/ }), -/* 1174 */ +/* 1238 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162073,7 +171586,7 @@ module.exports = ProjectUnit; /***/ }), -/* 1175 */ +/* 1239 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162082,7 +171595,7 @@ module.exports = ProjectUnit; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetMagnitude = __webpack_require__(463); +var GetMagnitude = __webpack_require__(477); /** * Changes the magnitude (length) of a two-dimensional vector without changing its direction. @@ -162117,7 +171630,7 @@ module.exports = SetMagnitude; /***/ }), -/* 1176 */ +/* 1240 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162126,26 +171639,26 @@ module.exports = SetMagnitude; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Polygon = __webpack_require__(212); +var Polygon = __webpack_require__(218); -Polygon.Clone = __webpack_require__(1177); -Polygon.Contains = __webpack_require__(213); -Polygon.ContainsPoint = __webpack_require__(1178); -Polygon.Earcut = __webpack_require__(60); -Polygon.GetAABB = __webpack_require__(436); -Polygon.GetNumberArray = __webpack_require__(1179); -Polygon.GetPoints = __webpack_require__(437); -Polygon.Perimeter = __webpack_require__(438); -Polygon.Reverse = __webpack_require__(1180); -Polygon.Simplify = __webpack_require__(1181); -Polygon.Smooth = __webpack_require__(439); -Polygon.Translate = __webpack_require__(1182); +Polygon.Clone = __webpack_require__(1241); +Polygon.Contains = __webpack_require__(219); +Polygon.ContainsPoint = __webpack_require__(1242); +Polygon.Earcut = __webpack_require__(65); +Polygon.GetAABB = __webpack_require__(446); +Polygon.GetNumberArray = __webpack_require__(1243); +Polygon.GetPoints = __webpack_require__(447); +Polygon.Perimeter = __webpack_require__(448); +Polygon.Reverse = __webpack_require__(1244); +Polygon.Simplify = __webpack_require__(1245); +Polygon.Smooth = __webpack_require__(449); +Polygon.Translate = __webpack_require__(1246); module.exports = Polygon; /***/ }), -/* 1177 */ +/* 1241 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162154,7 +171667,7 @@ module.exports = Polygon; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Polygon = __webpack_require__(212); +var Polygon = __webpack_require__(218); /** * Create a new polygon which is a copy of the specified polygon @@ -162175,7 +171688,7 @@ module.exports = Clone; /***/ }), -/* 1178 */ +/* 1242 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162184,7 +171697,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(213); +var Contains = __webpack_require__(219); /** * Checks the given Point again the Polygon to see if the Point lays within its vertices. @@ -162206,7 +171719,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1179 */ +/* 1243 */ /***/ (function(module, exports) { /** @@ -162249,7 +171762,7 @@ module.exports = GetNumberArray; /***/ }), -/* 1180 */ +/* 1244 */ /***/ (function(module, exports) { /** @@ -162281,10 +171794,9 @@ module.exports = Reverse; /***/ }), -/* 1181 */ -/***/ (function(module, exports, __webpack_require__) { +/* 1245 */ +/***/ (function(module, exports) { -"use strict"; /** * @author Richard Davey * @author Vladimir Agafonkin @@ -162316,8 +171828,6 @@ module.exports = Reverse; * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - /** * @ignore */ @@ -162491,7 +172001,7 @@ module.exports = Simplify; /***/ }), -/* 1182 */ +/* 1246 */ /***/ (function(module, exports) { /** @@ -162531,7 +172041,7 @@ module.exports = Translate; /***/ }), -/* 1183 */ +/* 1247 */ /***/ (function(module, exports) { /** @@ -162559,7 +172069,7 @@ module.exports = Area; /***/ }), -/* 1184 */ +/* 1248 */ /***/ (function(module, exports) { /** @@ -162592,7 +172102,7 @@ module.exports = Ceil; /***/ }), -/* 1185 */ +/* 1249 */ /***/ (function(module, exports) { /** @@ -162627,7 +172137,7 @@ module.exports = CeilAll; /***/ }), -/* 1186 */ +/* 1250 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162657,7 +172167,7 @@ module.exports = Clone; /***/ }), -/* 1187 */ +/* 1251 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162666,7 +172176,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(50); +var Contains = __webpack_require__(56); /** * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. @@ -162688,7 +172198,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1188 */ +/* 1252 */ /***/ (function(module, exports) { /** @@ -162719,7 +172229,7 @@ module.exports = CopyFrom; /***/ }), -/* 1189 */ +/* 1253 */ /***/ (function(module, exports) { /** @@ -162753,7 +172263,7 @@ module.exports = Equals; /***/ }), -/* 1190 */ +/* 1254 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162762,7 +172272,7 @@ module.exports = Equals; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetAspectRatio = __webpack_require__(223); +var GetAspectRatio = __webpack_require__(229); /** * Adjusts the target rectangle, changing its width, height and position, @@ -162806,7 +172316,7 @@ module.exports = FitInside; /***/ }), -/* 1191 */ +/* 1255 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162815,7 +172325,7 @@ module.exports = FitInside; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetAspectRatio = __webpack_require__(223); +var GetAspectRatio = __webpack_require__(229); /** * Adjusts the target rectangle, changing its width, height and position, @@ -162859,7 +172369,7 @@ module.exports = FitOutside; /***/ }), -/* 1192 */ +/* 1256 */ /***/ (function(module, exports) { /** @@ -162892,7 +172402,7 @@ module.exports = Floor; /***/ }), -/* 1193 */ +/* 1257 */ /***/ (function(module, exports) { /** @@ -162927,7 +172437,7 @@ module.exports = FloorAll; /***/ }), -/* 1194 */ +/* 1258 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162970,7 +172480,7 @@ module.exports = FromXY; /***/ }), -/* 1195 */ +/* 1259 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163008,7 +172518,7 @@ module.exports = GetCenter; /***/ }), -/* 1196 */ +/* 1260 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163048,7 +172558,7 @@ module.exports = GetSize; /***/ }), -/* 1197 */ +/* 1261 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163057,7 +172567,7 @@ module.exports = GetSize; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CenterOn = __webpack_require__(178); +var CenterOn = __webpack_require__(182); /** @@ -163090,7 +172600,7 @@ module.exports = Inflate; /***/ }), -/* 1198 */ +/* 1262 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163100,7 +172610,7 @@ module.exports = Inflate; */ var Rectangle = __webpack_require__(9); -var Intersects = __webpack_require__(143); +var Intersects = __webpack_require__(112); /** * Takes two Rectangles and first checks to see if they intersect. @@ -163141,7 +172651,7 @@ module.exports = Intersection; /***/ }), -/* 1199 */ +/* 1263 */ /***/ (function(module, exports) { /** @@ -163190,7 +172700,7 @@ module.exports = MergePoints; /***/ }), -/* 1200 */ +/* 1264 */ /***/ (function(module, exports) { /** @@ -163237,7 +172747,7 @@ module.exports = MergeRect; /***/ }), -/* 1201 */ +/* 1265 */ /***/ (function(module, exports) { /** @@ -163281,7 +172791,7 @@ module.exports = MergeXY; /***/ }), -/* 1202 */ +/* 1266 */ /***/ (function(module, exports) { /** @@ -163316,7 +172826,7 @@ module.exports = Offset; /***/ }), -/* 1203 */ +/* 1267 */ /***/ (function(module, exports) { /** @@ -163350,7 +172860,7 @@ module.exports = OffsetPoint; /***/ }), -/* 1204 */ +/* 1268 */ /***/ (function(module, exports) { /** @@ -163384,7 +172894,7 @@ module.exports = Overlaps; /***/ }), -/* 1205 */ +/* 1269 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163394,7 +172904,7 @@ module.exports = Overlaps; */ var Point = __webpack_require__(4); -var DegToRad = __webpack_require__(41); +var DegToRad = __webpack_require__(34); /** * Returns a Point from the perimeter of a Rectangle based on the given angle. @@ -163405,7 +172915,7 @@ var DegToRad = __webpack_require__(41); * @generic {Phaser.Geom.Point} O - [out,$return] * * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle to get the perimeter point from. - * @param {integer} angle - The angle of the point, in degrees. + * @param {number} angle - The angle of the point, in degrees. * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. * * @return {Phaser.Geom.Point} A Point object holding the coordinates of the Rectangle perimeter. @@ -163441,7 +172951,7 @@ module.exports = PerimeterPoint; /***/ }), -/* 1206 */ +/* 1270 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163450,8 +172960,8 @@ module.exports = PerimeterPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Between = __webpack_require__(182); -var ContainsRect = __webpack_require__(466); +var Between = __webpack_require__(187); +var ContainsRect = __webpack_require__(480); var Point = __webpack_require__(4); /** @@ -163512,7 +173022,7 @@ module.exports = RandomOutside; /***/ }), -/* 1207 */ +/* 1271 */ /***/ (function(module, exports) { /** @@ -163541,7 +173051,7 @@ module.exports = SameDimensions; /***/ }), -/* 1208 */ +/* 1272 */ /***/ (function(module, exports) { /** @@ -163580,7 +173090,7 @@ module.exports = Scale; /***/ }), -/* 1209 */ +/* 1273 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163589,38 +173099,38 @@ module.exports = Scale; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Triangle = __webpack_require__(73); +var Triangle = __webpack_require__(80); -Triangle.Area = __webpack_require__(1210); -Triangle.BuildEquilateral = __webpack_require__(1211); -Triangle.BuildFromPolygon = __webpack_require__(1212); -Triangle.BuildRight = __webpack_require__(1213); -Triangle.CenterOn = __webpack_require__(1214); -Triangle.Centroid = __webpack_require__(467); -Triangle.CircumCenter = __webpack_require__(1215); -Triangle.CircumCircle = __webpack_require__(1216); -Triangle.Clone = __webpack_require__(1217); -Triangle.Contains = __webpack_require__(85); -Triangle.ContainsArray = __webpack_require__(221); -Triangle.ContainsPoint = __webpack_require__(1218); -Triangle.CopyFrom = __webpack_require__(1219); -Triangle.Decompose = __webpack_require__(460); -Triangle.Equals = __webpack_require__(1220); -Triangle.GetPoint = __webpack_require__(443); -Triangle.GetPoints = __webpack_require__(444); -Triangle.InCenter = __webpack_require__(469); -Triangle.Perimeter = __webpack_require__(1221); -Triangle.Offset = __webpack_require__(468); -Triangle.Random = __webpack_require__(168); -Triangle.Rotate = __webpack_require__(1222); -Triangle.RotateAroundPoint = __webpack_require__(1223); -Triangle.RotateAroundXY = __webpack_require__(224); +Triangle.Area = __webpack_require__(1274); +Triangle.BuildEquilateral = __webpack_require__(1275); +Triangle.BuildFromPolygon = __webpack_require__(1276); +Triangle.BuildRight = __webpack_require__(1277); +Triangle.CenterOn = __webpack_require__(1278); +Triangle.Centroid = __webpack_require__(481); +Triangle.CircumCenter = __webpack_require__(1279); +Triangle.CircumCircle = __webpack_require__(1280); +Triangle.Clone = __webpack_require__(1281); +Triangle.Contains = __webpack_require__(110); +Triangle.ContainsArray = __webpack_require__(227); +Triangle.ContainsPoint = __webpack_require__(1282); +Triangle.CopyFrom = __webpack_require__(1283); +Triangle.Decompose = __webpack_require__(472); +Triangle.Equals = __webpack_require__(1284); +Triangle.GetPoint = __webpack_require__(453); +Triangle.GetPoints = __webpack_require__(454); +Triangle.InCenter = __webpack_require__(483); +Triangle.Perimeter = __webpack_require__(1285); +Triangle.Offset = __webpack_require__(482); +Triangle.Random = __webpack_require__(173); +Triangle.Rotate = __webpack_require__(1286); +Triangle.RotateAroundPoint = __webpack_require__(1287); +Triangle.RotateAroundXY = __webpack_require__(230); module.exports = Triangle; /***/ }), -/* 1210 */ +/* 1274 */ /***/ (function(module, exports) { /** @@ -163659,7 +173169,7 @@ module.exports = Area; /***/ }), -/* 1211 */ +/* 1275 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163668,7 +173178,7 @@ module.exports = Area; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Triangle = __webpack_require__(73); +var Triangle = __webpack_require__(80); /** * Builds an equilateral triangle. In the equilateral triangle, all the sides are the same length (congruent) and all the angles are the same size (congruent). @@ -163703,7 +173213,7 @@ module.exports = BuildEquilateral; /***/ }), -/* 1212 */ +/* 1276 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163712,8 +173222,8 @@ module.exports = BuildEquilateral; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var EarCut = __webpack_require__(60); -var Triangle = __webpack_require__(73); +var EarCut = __webpack_require__(65); +var Triangle = __webpack_require__(80); /** * Takes an array of vertex coordinates, and optionally an array of hole indices, then returns an array @@ -163779,7 +173289,7 @@ module.exports = BuildFromPolygon; /***/ }), -/* 1213 */ +/* 1277 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163788,7 +173298,7 @@ module.exports = BuildFromPolygon; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Triangle = __webpack_require__(73); +var Triangle = __webpack_require__(80); // Builds a right triangle, with one 90 degree angle and two acute angles // The x/y is the coordinate of the 90 degree angle (and will map to x1/y1 in the resulting Triangle) @@ -163828,7 +173338,7 @@ module.exports = BuildRight; /***/ }), -/* 1214 */ +/* 1278 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163837,8 +173347,8 @@ module.exports = BuildRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Centroid = __webpack_require__(467); -var Offset = __webpack_require__(468); +var Centroid = __webpack_require__(481); +var Offset = __webpack_require__(482); /** * @callback CenterFunction @@ -163881,7 +173391,7 @@ module.exports = CenterOn; /***/ }), -/* 1215 */ +/* 1279 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163957,7 +173467,7 @@ module.exports = CircumCenter; /***/ }), -/* 1216 */ +/* 1280 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163966,7 +173476,7 @@ module.exports = CircumCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(68); +var Circle = __webpack_require__(71); // Adapted from https://gist.github.com/mutoo/5617691 @@ -164040,7 +173550,7 @@ module.exports = CircumCircle; /***/ }), -/* 1217 */ +/* 1281 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164049,7 +173559,7 @@ module.exports = CircumCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Triangle = __webpack_require__(73); +var Triangle = __webpack_require__(80); /** * Clones a Triangle object. @@ -164070,7 +173580,7 @@ module.exports = Clone; /***/ }), -/* 1218 */ +/* 1282 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164079,7 +173589,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(85); +var Contains = __webpack_require__(110); /** * Tests if a triangle contains a point. @@ -164101,7 +173611,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1219 */ +/* 1283 */ /***/ (function(module, exports) { /** @@ -164132,7 +173642,7 @@ module.exports = CopyFrom; /***/ }), -/* 1220 */ +/* 1284 */ /***/ (function(module, exports) { /** @@ -164168,7 +173678,7 @@ module.exports = Equals; /***/ }), -/* 1221 */ +/* 1285 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164177,7 +173687,7 @@ module.exports = Equals; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); /** * Gets the length of the perimeter of the given triangle. @@ -164203,7 +173713,7 @@ module.exports = Perimeter; /***/ }), -/* 1222 */ +/* 1286 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164212,8 +173722,8 @@ module.exports = Perimeter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundXY = __webpack_require__(224); -var InCenter = __webpack_require__(469); +var RotateAroundXY = __webpack_require__(230); +var InCenter = __webpack_require__(483); /** * Rotates a Triangle about its incenter, which is the point at which its three angle bisectors meet. @@ -164239,7 +173749,7 @@ module.exports = Rotate; /***/ }), -/* 1223 */ +/* 1287 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164248,7 +173758,7 @@ module.exports = Rotate; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundXY = __webpack_require__(224); +var RotateAroundXY = __webpack_require__(230); /** * Rotates a Triangle at a certain angle about a given Point or object with public `x` and `y` properties. @@ -164273,7 +173783,7 @@ module.exports = RotateAroundPoint; /***/ }), -/* 1224 */ +/* 1288 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164282,8 +173792,8 @@ module.exports = RotateAroundPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(189); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(194); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Input @@ -164291,17 +173801,17 @@ var Extend = __webpack_require__(19); var Input = { - CreatePixelPerfectHandler: __webpack_require__(470), - CreateInteractiveObject: __webpack_require__(471), - Events: __webpack_require__(56), - Gamepad: __webpack_require__(1225), - InputManager: __webpack_require__(376), - InputPlugin: __webpack_require__(1237), - InputPluginCache: __webpack_require__(144), - Keyboard: __webpack_require__(1238), - Mouse: __webpack_require__(1255), - Pointer: __webpack_require__(379), - Touch: __webpack_require__(1256) + CreatePixelPerfectHandler: __webpack_require__(484), + CreateInteractiveObject: __webpack_require__(485), + Events: __webpack_require__(49), + Gamepad: __webpack_require__(1289), + InputManager: __webpack_require__(386), + InputPlugin: __webpack_require__(1301), + InputPluginCache: __webpack_require__(146), + Keyboard: __webpack_require__(1302), + Mouse: __webpack_require__(1316), + Pointer: __webpack_require__(389), + Touch: __webpack_require__(1317) }; @@ -164312,7 +173822,7 @@ module.exports = Input; /***/ }), -/* 1225 */ +/* 1289 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164327,18 +173837,18 @@ module.exports = Input; module.exports = { - Axis: __webpack_require__(472), - Button: __webpack_require__(473), - Events: __webpack_require__(225), - Gamepad: __webpack_require__(474), - GamepadPlugin: __webpack_require__(1232), + Axis: __webpack_require__(486), + Button: __webpack_require__(487), + Events: __webpack_require__(231), + Gamepad: __webpack_require__(488), + GamepadPlugin: __webpack_require__(1296), - Configs: __webpack_require__(1233) + Configs: __webpack_require__(1297) }; /***/ }), -/* 1226 */ +/* 1290 */ /***/ (function(module, exports) { /** @@ -164367,7 +173877,7 @@ module.exports = 'down'; /***/ }), -/* 1227 */ +/* 1291 */ /***/ (function(module, exports) { /** @@ -164396,7 +173906,7 @@ module.exports = 'up'; /***/ }), -/* 1228 */ +/* 1292 */ /***/ (function(module, exports) { /** @@ -164427,7 +173937,7 @@ module.exports = 'connected'; /***/ }), -/* 1229 */ +/* 1293 */ /***/ (function(module, exports) { /** @@ -164453,7 +173963,7 @@ module.exports = 'disconnected'; /***/ }), -/* 1230 */ +/* 1294 */ /***/ (function(module, exports) { /** @@ -164477,7 +173987,7 @@ module.exports = 'disconnected'; * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN * @since 3.10.0 * - * @param {integer} index - The index of the button that was pressed. + * @param {number} index - The index of the button that was pressed. * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. */ @@ -164485,7 +173995,7 @@ module.exports = 'down'; /***/ }), -/* 1231 */ +/* 1295 */ /***/ (function(module, exports) { /** @@ -164509,7 +174019,7 @@ module.exports = 'down'; * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP * @since 3.10.0 * - * @param {integer} index - The index of the button that was released. + * @param {number} index - The index of the button that was released. * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. */ @@ -164517,7 +174027,7 @@ module.exports = 'up'; /***/ }), -/* 1232 */ +/* 1296 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164527,12 +174037,12 @@ module.exports = 'up'; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(225); -var Gamepad = __webpack_require__(474); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(231); +var Gamepad = __webpack_require__(488); var GetValue = __webpack_require__(6); -var InputPluginCache = __webpack_require__(144); -var InputEvents = __webpack_require__(56); +var InputPluginCache = __webpack_require__(146); +var InputEvents = __webpack_require__(49); /** * @classdesc @@ -164562,6 +174072,9 @@ var InputEvents = __webpack_require__(56); * to the gamepads you can poll its buttons and axis sticks. See the properties and methods available on * the `Gamepad` class for more details. * + * As of September 2020 Chrome, and likely other browsers, will soon start to require that games requesting + * access to the Gamepad API are running under SSL. They will actively block API access if they are not. + * * For more information about Gamepad support in browsers see the following resources: * * https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API @@ -164743,6 +174256,8 @@ var GamepadPlugin = new Class({ if (this.enabled) { this.startListeners(); + + this.refreshPads(); } this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); @@ -164814,6 +174329,11 @@ var GamepadPlugin = new Class({ this.target.removeEventListener('gamepaddisconnected', this.onGamepadHandler); this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update); + + for (var i = 0; i < this.gamepads.length; i++) + { + this.gamepads[i].removeAllListeners(); + } }, /** @@ -164826,7 +174346,7 @@ var GamepadPlugin = new Class({ { for (var i = 0; i < this.gamepads.length; i++) { - this.gamepads.connected = false; + this.gamepads[i].pad.connected = false; } }, @@ -165011,8 +174531,6 @@ var GamepadPlugin = new Class({ { this.stopListeners(); - this.disconnectAll(); - this.removeAllListeners(); }, @@ -165047,7 +174565,7 @@ var GamepadPlugin = new Class({ * The total number of connected game pads. * * @name Phaser.Input.Gamepad.GamepadPlugin#total - * @type {integer} + * @type {number} * @since 3.10.0 */ total: { @@ -165155,7 +174673,7 @@ module.exports = GamepadPlugin; /***/ }), -/* 1233 */ +/* 1297 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165170,15 +174688,15 @@ module.exports = GamepadPlugin; module.exports = { - DUALSHOCK_4: __webpack_require__(1234), - SNES_USB: __webpack_require__(1235), - XBOX_360: __webpack_require__(1236) + DUALSHOCK_4: __webpack_require__(1298), + SNES_USB: __webpack_require__(1299), + XBOX_360: __webpack_require__(1300) }; /***/ }), -/* 1234 */ +/* 1298 */ /***/ (function(module, exports) { /** @@ -165228,7 +174746,7 @@ module.exports = { /***/ }), -/* 1235 */ +/* 1299 */ /***/ (function(module, exports) { /** @@ -165267,7 +174785,7 @@ module.exports = { /***/ }), -/* 1236 */ +/* 1300 */ /***/ (function(module, exports) { /** @@ -165318,7 +174836,7 @@ module.exports = { /***/ }), -/* 1237 */ +/* 1301 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165327,27 +174845,27 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(68); -var CircleContains = __webpack_require__(57); +var Circle = __webpack_require__(71); +var CircleContains = __webpack_require__(62); var Class = __webpack_require__(0); -var CONST = __webpack_require__(189); -var CreateInteractiveObject = __webpack_require__(471); -var CreatePixelPerfectHandler = __webpack_require__(470); -var DistanceBetween = __webpack_require__(55); -var Ellipse = __webpack_require__(98); -var EllipseContains = __webpack_require__(99); -var Events = __webpack_require__(56); -var EventEmitter = __webpack_require__(12); +var CONST = __webpack_require__(194); +var CreateInteractiveObject = __webpack_require__(485); +var CreatePixelPerfectHandler = __webpack_require__(484); +var DistanceBetween = __webpack_require__(61); +var Ellipse = __webpack_require__(106); +var EllipseContains = __webpack_require__(107); +var Events = __webpack_require__(49); +var EventEmitter = __webpack_require__(10); var GetFastValue = __webpack_require__(2); -var GEOM_CONST = __webpack_require__(49); -var InputPluginCache = __webpack_require__(144); +var GEOM_CONST = __webpack_require__(55); +var InputPluginCache = __webpack_require__(146); var IsPlainObject = __webpack_require__(7); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(50); +var RectangleContains = __webpack_require__(56); var SceneEvents = __webpack_require__(20); -var Triangle = __webpack_require__(73); -var TriangleContains = __webpack_require__(85); +var Triangle = __webpack_require__(80); +var TriangleContains = __webpack_require__(110); /** * @classdesc @@ -165523,7 +175041,7 @@ var InputPlugin = new Class({ * Set to 0 to poll constantly. Set to -1 to only poll on user movement. * * @name Phaser.Input.InputPlugin#pollRate - * @type {integer} + * @type {number} * @default -1 * @since 3.0.0 */ @@ -165673,7 +175191,7 @@ var InputPlugin = new Class({ * A array containing the dragStates, for this Scene, index by the Pointer ID. * * @name Phaser.Input.InputPlugin#_dragState - * @type {integer[]} + * @type {number[]} * @private * @since 3.16.0 */ @@ -165990,7 +175508,7 @@ var InputPlugin = new Class({ * @fires Phaser.Input.Events#UPDATE * @since 3.0.0 * - * @param {integer} type - The type of event to process. + * @param {number} type - The type of event to process. * @param {Phaser.Input.Pointer[]} pointers - An array of Pointers on which the event occurred. * * @return {boolean} `true` if this Scene has captured the input events from all other Scenes, otherwise `false`. @@ -166119,8 +175637,6 @@ var InputPlugin = new Class({ input.hitAreaCallback = undefined; input.callbackContext = undefined; - this.manager.resetCursor(input); - gameObject.input = null; // Clear from _draggable, _drag and _over @@ -166143,6 +175659,8 @@ var InputPlugin = new Class({ if (index > -1) { this._over[0].splice(index, 1); + + this.manager.resetCursor(input); } return gameObject; @@ -166280,7 +175798,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer being tested. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processDownEvents: function (pointer) { @@ -166356,7 +175874,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to get the drag state for. * - * @return {integer} The drag state of the given Pointer. + * @return {number} The drag state of the given Pointer. */ getDragState: function (pointer) { @@ -166379,7 +175897,7 @@ var InputPlugin = new Class({ * @since 3.16.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer to set the drag state for. - * @param {integer} state - The drag state value. An integer between 0 and 5. + * @param {number} state - The drag state value. An integer between 0 and 5. */ setDragState: function (pointer, state) { @@ -166433,7 +175951,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {integer} The number of items that DRAG_START was called on. + * @return {number} The number of items that DRAG_START was called on. */ processDragStartList: function (pointer) { @@ -166482,7 +176000,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {integer} The number of items that were collected on the drag list. + * @return {number} The number of items that were collected on the drag list. */ processDragDownEvent: function (pointer) { @@ -166562,7 +176080,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {integer} The number of items that were updated by this drag event. + * @return {number} The number of items that were updated by this drag event. */ processDragMoveEvent: function (pointer) { @@ -166702,7 +176220,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {integer} The number of items that were updated by this drag event. + * @return {number} The number of items that were updated by this drag event. */ processDragUpEvent: function (pointer) { @@ -166767,7 +176285,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processMoveEvents: function (pointer) { @@ -166835,7 +176353,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processWheelEvent: function (pointer) { @@ -166903,7 +176421,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processOverEvents: function (pointer) { @@ -166983,7 +176501,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processOutEvents: function (pointer) { @@ -167011,34 +176529,31 @@ var InputPlugin = new Class({ var gameObject = previouslyOver[i]; // Call onOut for everything in the previouslyOver array - for (i = 0; i < total; i++) + gameObject = previouslyOver[i]; + + if (!gameObject.input) { - gameObject = previouslyOver[i]; + continue; + } - if (!gameObject.input) - { - continue; - } + manager.resetCursor(gameObject.input); - manager.resetCursor(gameObject.input); + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); - gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); + totalInteracted++; - totalInteracted++; + if (_eventData.cancelled || !gameObject.input) + { + aborted = true; + break; + } - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } + this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); - this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); - - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } + if (_eventData.cancelled || !gameObject.input) + { + aborted = true; + break; } if (!aborted) @@ -167068,7 +176583,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processOverOutEvents: function (pointer) { @@ -167244,7 +176759,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processUpEvents: function (pointer) { @@ -167413,7 +176928,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#makePixelPerfect * @since 3.10.0 * - * @param {integer} [alphaTolerance=1] - The alpha level that the pixel should be above to be included as a successful interaction. + * @param {number} [alphaTolerance=1] - The alpha level that the pixel should be above to be included as a successful interaction. * * @return {function} A Pixel Perfect Handler for use as a hitArea shape callback. */ @@ -167983,7 +177498,7 @@ var InputPlugin = new Class({ * @param {Phaser.GameObjects.GameObject} childA - The first Game Object to compare. * @param {Phaser.GameObjects.GameObject} childB - The second Game Object to compare. * - * @return {integer} Returns either a negative or positive integer, or zero if they match. + * @return {number} Returns either a negative or positive integer, or zero if they match. */ sortHandlerGO: function (childA, childB) { @@ -168071,7 +177586,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#addPointer * @since 3.10.0 * - * @param {integer} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. + * @param {number} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. * * @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created. */ @@ -168182,6 +177697,10 @@ var InputPlugin = new Class({ this.removeAllListeners(); + var manager = this.manager; + + manager.canvas.style.cursor = manager.defaultCursor; + var eventEmitter = this.systems.events; eventEmitter.off(SceneEvents.TRANSITION_START, this.transitionIn, this); @@ -168189,8 +177708,8 @@ var InputPlugin = new Class({ eventEmitter.off(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); - this.manager.events.off(Events.GAME_OUT, this.onGameOut, this); - this.manager.events.off(Events.GAME_OVER, this.onGameOver, this); + manager.events.off(Events.GAME_OUT, this.onGameOut, this); + manager.events.off(Events.GAME_OVER, this.onGameOver, this); eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, @@ -168499,7 +178018,7 @@ module.exports = InputPlugin; /***/ }), -/* 1238 */ +/* 1302 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168514,26 +178033,30 @@ module.exports = InputPlugin; module.exports = { - Events: __webpack_require__(145), + Events: __webpack_require__(147), - KeyboardManager: __webpack_require__(377), - KeyboardPlugin: __webpack_require__(1246), + KeyboardManager: __webpack_require__(387), + KeyboardPlugin: __webpack_require__(1310), - Key: __webpack_require__(475), - KeyCodes: __webpack_require__(132), + Key: __webpack_require__(489), + KeyCodes: __webpack_require__(138), - KeyCombo: __webpack_require__(476), + KeyCombo: __webpack_require__(490), + + AdvanceKeyCombo: __webpack_require__(492), + ProcessKeyCombo: __webpack_require__(491), + ResetKeyCombo: __webpack_require__(493), + + JustDown: __webpack_require__(1312), + JustUp: __webpack_require__(1313), + DownDuration: __webpack_require__(1314), + UpDuration: __webpack_require__(1315) - JustDown: __webpack_require__(1251), - JustUp: __webpack_require__(1252), - DownDuration: __webpack_require__(1253), - UpDuration: __webpack_require__(1254) - }; /***/ }), -/* 1239 */ +/* 1303 */ /***/ (function(module, exports) { /** @@ -168569,7 +178092,7 @@ module.exports = 'keydown'; /***/ }), -/* 1240 */ +/* 1304 */ /***/ (function(module, exports) { /** @@ -168598,7 +178121,7 @@ module.exports = 'keyup'; /***/ }), -/* 1241 */ +/* 1305 */ /***/ (function(module, exports) { /** @@ -168632,7 +178155,7 @@ module.exports = 'keycombomatch'; /***/ }), -/* 1242 */ +/* 1306 */ /***/ (function(module, exports) { /** @@ -168666,7 +178189,7 @@ module.exports = 'down'; /***/ }), -/* 1243 */ +/* 1307 */ /***/ (function(module, exports) { /** @@ -168705,7 +178228,7 @@ module.exports = 'keydown-'; /***/ }), -/* 1244 */ +/* 1308 */ /***/ (function(module, exports) { /** @@ -168737,7 +178260,7 @@ module.exports = 'keyup-'; /***/ }), -/* 1245 */ +/* 1309 */ /***/ (function(module, exports) { /** @@ -168771,7 +178294,7 @@ module.exports = 'up'; /***/ }), -/* 1246 */ +/* 1310 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168781,18 +178304,18 @@ module.exports = 'up'; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(145); -var GameEvents = __webpack_require__(21); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(147); +var GameEvents = __webpack_require__(23); var GetValue = __webpack_require__(6); -var InputEvents = __webpack_require__(56); -var InputPluginCache = __webpack_require__(144); -var Key = __webpack_require__(475); -var KeyCodes = __webpack_require__(132); -var KeyCombo = __webpack_require__(476); -var KeyMap = __webpack_require__(1250); +var InputEvents = __webpack_require__(49); +var InputPluginCache = __webpack_require__(146); +var Key = __webpack_require__(489); +var KeyCodes = __webpack_require__(138); +var KeyCombo = __webpack_require__(490); +var KeyMap = __webpack_require__(1311); var SceneEvents = __webpack_require__(20); -var SnapFloor = __webpack_require__(95); +var SnapFloor = __webpack_require__(72); /** * @classdesc @@ -169040,7 +178563,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#addCapture * @since 3.16.0 * - * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable event capture for. + * @param {(string|number|number[]|any[])} keycode - The Key Codes to enable event capture for. * * @return {this} This KeyboardPlugin object. */ @@ -169082,7 +178605,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#removeCapture * @since 3.16.0 * - * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable event capture for. + * @param {(string|number|number[]|any[])} keycode - The Key Codes to disable event capture for. * * @return {this} This KeyboardPlugin object. */ @@ -169099,7 +178622,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#getCaptures * @since 3.16.0 * - * @return {integer[]} An array of all the currently capturing key codes. + * @return {number[]} An array of all the currently capturing key codes. */ getCaptures: function () { @@ -169247,7 +178770,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#addKey * @since 3.10.0 * - * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * @param {(Phaser.Input.Keyboard.Key|string|number)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). * @@ -169311,7 +178834,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#removeKey * @since 3.10.0 * - * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * @param {(Phaser.Input.Keyboard.Key|string|number)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. * @param {boolean} [destroy=false] - Call `Key.destroy` on the removed Key object? * * @return {this} This KeyboardPlugin object. @@ -169423,7 +178946,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#createCombo * @since 3.10.0 * - * @param {(string|integer[]|object[])} keys - The keys that comprise this combo. + * @param {(string|number[]|object[])} keys - The keys that comprise this combo. * @param {Phaser.Types.Input.Keyboard.KeyComboConfig} [config] - A Key Combo configuration object. * * @return {Phaser.Input.Keyboard.KeyCombo} The new KeyCombo object. @@ -169706,7 +179229,7 @@ module.exports = KeyboardPlugin; /***/ }), -/* 1247 */ +/* 1311 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169715,165 +179238,7 @@ module.exports = KeyboardPlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AdvanceKeyCombo = __webpack_require__(1248); - -/** - * Used internally by the KeyCombo class. - * - * @function Phaser.Input.Keyboard.KeyCombo.ProcessKeyCombo - * @private - * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native Keyboard Event. - * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to be processed. - * - * @return {boolean} `true` if the combo was matched, otherwise `false`. - */ -var ProcessKeyCombo = function (event, combo) -{ - if (combo.matched) - { - return true; - } - - var comboMatched = false; - var keyMatched = false; - - if (event.keyCode === combo.current) - { - // Key was correct - - if (combo.index > 0 && combo.maxKeyDelay > 0) - { - // We have to check to see if the delay between - // the new key and the old one was too long (if enabled) - - var timeLimit = combo.timeLastMatched + combo.maxKeyDelay; - - // Check if they pressed it in time or not - if (event.timeStamp <= timeLimit) - { - keyMatched = true; - comboMatched = AdvanceKeyCombo(event, combo); - } - } - else - { - keyMatched = true; - - // We don't check the time for the first key pressed, so just advance it - comboMatched = AdvanceKeyCombo(event, combo); - } - } - - if (!keyMatched && combo.resetOnWrongKey) - { - // Wrong key was pressed - combo.index = 0; - combo.current = combo.keyCodes[0]; - } - - if (comboMatched) - { - combo.timeLastMatched = event.timeStamp; - combo.matched = true; - combo.timeMatched = event.timeStamp; - } - - return comboMatched; -}; - -module.exports = ProcessKeyCombo; - - -/***/ }), -/* 1248 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Used internally by the KeyCombo class. - * Return `true` if it reached the end of the combo, `false` if not. - * - * @function Phaser.Input.Keyboard.KeyCombo.AdvanceKeyCombo - * @private - * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native Keyboard Event. - * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to advance. - * - * @return {boolean} `true` if it reached the end of the combo, `false` if not. - */ -var AdvanceKeyCombo = function (event, combo) -{ - combo.timeLastMatched = event.timeStamp; - combo.index++; - - if (combo.index === combo.size) - { - return true; - } - else - { - combo.current = combo.keyCodes[combo.index]; - return false; - } -}; - -module.exports = AdvanceKeyCombo; - - -/***/ }), -/* 1249 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Used internally by the KeyCombo class. - * - * @function Phaser.Input.Keyboard.KeyCombo.ResetKeyCombo - * @private - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo to reset. - * - * @return {Phaser.Input.Keyboard.KeyCombo} The KeyCombo. - */ -var ResetKeyCombo = function (combo) -{ - combo.current = combo.keyCodes[0]; - combo.index = 0; - combo.timeLastMatched = 0; - combo.matched = false; - combo.timeMatched = 0; - - return combo; -}; - -module.exports = ResetKeyCombo; - - -/***/ }), -/* 1250 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var KeyCodes = __webpack_require__(132); +var KeyCodes = __webpack_require__(138); var KeyMap = {}; @@ -169886,7 +179251,7 @@ module.exports = KeyMap; /***/ }), -/* 1251 */ +/* 1312 */ /***/ (function(module, exports) { /** @@ -169928,7 +179293,7 @@ module.exports = JustDown; /***/ }), -/* 1252 */ +/* 1313 */ /***/ (function(module, exports) { /** @@ -169970,7 +179335,7 @@ module.exports = JustUp; /***/ }), -/* 1253 */ +/* 1314 */ /***/ (function(module, exports) { /** @@ -169987,7 +179352,7 @@ module.exports = JustUp; * @since 3.0.0 * * @param {Phaser.Input.Keyboard.Key} key - The Key object to test. - * @param {integer} [duration=50] - The duration, in ms, within which the key must have been pressed down. + * @param {number} [duration=50] - The duration, in ms, within which the key must have been pressed down. * * @return {boolean} `true` if the Key was pressed down within `duration` ms ago, otherwise `false`. */ @@ -170004,7 +179369,7 @@ module.exports = DownDuration; /***/ }), -/* 1254 */ +/* 1315 */ /***/ (function(module, exports) { /** @@ -170021,7 +179386,7 @@ module.exports = DownDuration; * @since 3.0.0 * * @param {Phaser.Input.Keyboard.Key} key - The Key object to test. - * @param {integer} [duration=50] - The duration, in ms, within which the key must have been released. + * @param {number} [duration=50] - The duration, in ms, within which the key must have been released. * * @return {boolean} `true` if the Key was released within `duration` ms ago, otherwise `false`. */ @@ -170038,7 +179403,7 @@ module.exports = UpDuration; /***/ }), -/* 1255 */ +/* 1316 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170054,14 +179419,14 @@ module.exports = UpDuration; /* eslint-disable */ module.exports = { - MouseManager: __webpack_require__(378) + MouseManager: __webpack_require__(388) }; /* eslint-enable */ /***/ }), -/* 1256 */ +/* 1317 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170077,14 +179442,14 @@ module.exports = { /* eslint-disable */ module.exports = { - TouchManager: __webpack_require__(380) + TouchManager: __webpack_require__(390) }; /* eslint-enable */ /***/ }), -/* 1257 */ +/* 1318 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170093,8 +179458,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(18); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(19); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Loader @@ -170102,18 +179467,18 @@ var Extend = __webpack_require__(19); var Loader = { - Events: __webpack_require__(84), + Events: __webpack_require__(89), - FileTypes: __webpack_require__(1258), + FileTypes: __webpack_require__(1319), File: __webpack_require__(22), FileTypesManager: __webpack_require__(8), - GetURL: __webpack_require__(146), - LoaderPlugin: __webpack_require__(1282), - MergeXHRSettings: __webpack_require__(226), - MultiFile: __webpack_require__(63), - XHRLoader: __webpack_require__(477), - XHRSettings: __webpack_require__(147) + GetURL: __webpack_require__(148), + LoaderPlugin: __webpack_require__(1345), + MergeXHRSettings: __webpack_require__(232), + MultiFile: __webpack_require__(47), + XHRLoader: __webpack_require__(494), + XHRSettings: __webpack_require__(149) }; @@ -170124,7 +179489,7 @@ module.exports = Loader; /***/ }), -/* 1258 */ +/* 1319 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170139,42 +179504,44 @@ module.exports = Loader; module.exports = { - AnimationJSONFile: __webpack_require__(1259), - AtlasJSONFile: __webpack_require__(1260), - AtlasXMLFile: __webpack_require__(1261), - AudioFile: __webpack_require__(478), - AudioSpriteFile: __webpack_require__(1262), - BinaryFile: __webpack_require__(1263), - BitmapFontFile: __webpack_require__(1264), - CSSFile: __webpack_require__(1265), - GLSLFile: __webpack_require__(1266), - HTML5AudioFile: __webpack_require__(479), - HTMLFile: __webpack_require__(1267), - HTMLTextureFile: __webpack_require__(1268), - ImageFile: __webpack_require__(74), - JSONFile: __webpack_require__(62), - MultiAtlasFile: __webpack_require__(1269), - MultiScriptFile: __webpack_require__(1270), - PackFile: __webpack_require__(1271), - PluginFile: __webpack_require__(1272), - SceneFile: __webpack_require__(1273), - ScenePluginFile: __webpack_require__(1274), - ScriptFile: __webpack_require__(480), - SpriteSheetFile: __webpack_require__(1275), - SVGFile: __webpack_require__(1276), - TextFile: __webpack_require__(481), - TilemapCSVFile: __webpack_require__(1277), - TilemapImpactFile: __webpack_require__(1278), - TilemapJSONFile: __webpack_require__(1279), - UnityAtlasFile: __webpack_require__(1280), - VideoFile: __webpack_require__(1281), - XMLFile: __webpack_require__(227) + AnimationJSONFile: __webpack_require__(1320), + AsepriteFile: __webpack_require__(1321), + AtlasJSONFile: __webpack_require__(1322), + AtlasXMLFile: __webpack_require__(1323), + AudioFile: __webpack_require__(495), + AudioSpriteFile: __webpack_require__(1324), + BinaryFile: __webpack_require__(1325), + BitmapFontFile: __webpack_require__(1326), + CSSFile: __webpack_require__(1327), + GLSLFile: __webpack_require__(1328), + HTML5AudioFile: __webpack_require__(496), + HTMLFile: __webpack_require__(1329), + HTMLTextureFile: __webpack_require__(1330), + ImageFile: __webpack_require__(67), + JSONFile: __webpack_require__(58), + MultiAtlasFile: __webpack_require__(1331), + MultiScriptFile: __webpack_require__(1332), + OBJFile: __webpack_require__(1333), + PackFile: __webpack_require__(1334), + PluginFile: __webpack_require__(1335), + SceneFile: __webpack_require__(1336), + ScenePluginFile: __webpack_require__(1337), + ScriptFile: __webpack_require__(497), + SpriteSheetFile: __webpack_require__(1338), + SVGFile: __webpack_require__(1339), + TextFile: __webpack_require__(234), + TilemapCSVFile: __webpack_require__(1340), + TilemapImpactFile: __webpack_require__(1341), + TilemapJSONFile: __webpack_require__(1342), + UnityAtlasFile: __webpack_require__(1343), + VideoFile: __webpack_require__(1344), + XMLFile: __webpack_require__(233) }; /***/ }), -/* 1259 */ +/* 1320 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170185,8 +179552,8 @@ module.exports = { var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(62); -var LoaderEvents = __webpack_require__(84); +var JSONFile = __webpack_require__(58); +var LoaderEvents = __webpack_require__(89); /** * @classdesc @@ -170375,7 +179742,7 @@ module.exports = AnimationJSONFile; /***/ }), -/* 1260 */ +/* 1321 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170387,10 +179754,280 @@ module.exports = AnimationJSONFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(62); -var MultiFile = __webpack_require__(63); +var JSONFile = __webpack_require__(58); +var MultiFile = __webpack_require__(47); + +/** + * @classdesc + * A single JSON based Texture Atlas File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#atlas method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlas. + * + * https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?source=photonstorm + * + * @class AsepriteFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.AsepriteFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + */ +var AsepriteFile = new Class({ + + Extends: MultiFile, + + initialize: + + function AsepriteFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) + { + var image; + var data; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + + image = new ImageFile(loader, { + key: key, + url: GetFastValue(config, 'textureURL'), + extension: GetFastValue(config, 'textureExtension', 'png'), + normalMap: GetFastValue(config, 'normalMap'), + xhrSettings: GetFastValue(config, 'textureXhrSettings') + }); + + data = new JSONFile(loader, { + key: key, + url: GetFastValue(config, 'atlasURL'), + extension: GetFastValue(config, 'atlasExtension', 'json'), + xhrSettings: GetFastValue(config, 'atlasXhrSettings') + }); + } + else + { + image = new ImageFile(loader, key, textureURL, textureXhrSettings); + data = new JSONFile(loader, key, atlasURL, atlasXhrSettings); + } + + if (image.linkFile) + { + // Image has a normal map + MultiFile.call(this, loader, 'atlasjson', key, [ image, data, image.linkFile ]); + } + else + { + MultiFile.call(this, loader, 'atlasjson', key, [ image, data ]); + } + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.AsepriteFile#addToCache + * @since 3.7.0 + */ + addToCache: function () + { + if (this.isReadyToProcess()) + { + var image = this.files[0]; + var json = this.files[1]; + var normalMap = (this.files[2]) ? this.files[2].data : null; + + this.loader.textureManager.addAtlas(image.key, image.data, json.data, normalMap); + + json.addToCache(); + + this.complete = true; + } + } + +}); + +/** + * Aseprite is a powerful animated sprite editor and pixel art tool. + * + * You can find more details at https://www.aseprite.org/ + * + * Adds a JSON based Aseprite Animation, or array of animations, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.aseprite('gladiator', 'images/Gladiator.png', 'images/Gladiator.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * To export a compatible JSON file in Aseprite, please do the following: + * + * 1. Go to "File - Export Sprite Sheet" + * + * 2. On the **Layout** tab: + * 2a. Set the "Sheet type" to "Packed" + * 2b. Set the "Constraints" to "None" + * 2c. Check the "Merge Duplicates" checkbox + * + * 3. On the **Sprite** tab: + * 3a. Set "Layers" to "Visible layers" + * 3b. Set "Frames" to "All frames", unless you only wish to export a sub-set of tags + * + * 4. On the **Borders** tab: + * 4a. Check the "Trim Sprite" and "Trim Cells" options + * 4b. Ensure "Border Padding", "Spacing" and "Inner Padding" are all > 0 (1 is usually enough) + * + * 5. On the **Output** tab: + * 5a. Check "Output File", give your image a name and make sure you choose "png files" as the file type + * 5b. Check "JSON Data" and give your json file a name + * 5c. The JSON Data type can be either a Hash or Array, Phaser doesn't mind. + * 5d. Make sure "Tags" is checked in the Meta options + * 5e. In the "Item Filename" input box, make sure it says just "{frame}" and nothing more. + * + * 6. Click export + * + * This was tested with Aseprite 1.2.25. + * + * This will export a png and json file which you can load using the Aseprite Loader, i.e.: + * + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.aseprite({ + * key: 'gladiator', + * textureURL: 'images/Gladiator.png', + * atlasURL: 'images/Gladiator.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.AsepriteFileConfig` for more details. + * + * Instead of passing a URL for the JSON data you can also pass in a well formed JSON object instead. + * + * Once loaded, you can call this method from within a Scene with the 'atlas' key: + * + * ```javascript + * this.anims.createFromAseprite('paladin'); + * ``` + * + * Any animations defined in the JSON will now be available to use in Phaser and you play them + * via their Tag name. For example, if you have an animation called 'War Cry' on your Aseprite timeline, + * you can play it in Phaser using that Tag name: + * + * ```javascript + * this.add.sprite(400, 300).play('War Cry'); + * ``` + * + * When calling this method you can optionally provide an array of tag names, and only those animations + * will be created. For example: + * + * ```javascript + * this.anims.createFromAseprite('paladin', [ 'step', 'War Cry', 'Magnum Break' ]); + * ``` + * + * This will only create the 3 animations defined. Note that the tag names are case-sensitive. + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Aseprite File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#aseprite + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.50.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.AsepriteFileConfig|Phaser.Types.Loader.FileTypes.AsepriteFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('aseprite', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) +{ + var multifile; + + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + multifile = new AsepriteFile(this, key[i]); + + this.addFile(multifile.files); + } + } + else + { + multifile = new AsepriteFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); + + this.addFile(multifile.files); + } + + return this; +}); + +module.exports = AsepriteFile; + + +/***/ }), +/* 1322 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var FileTypesManager = __webpack_require__(8); +var GetFastValue = __webpack_require__(2); +var ImageFile = __webpack_require__(67); +var IsPlainObject = __webpack_require__(7); +var JSONFile = __webpack_require__(58); +var MultiFile = __webpack_require__(47); /** * @classdesc @@ -170480,8 +180117,6 @@ var AtlasJSONFile = new Class({ this.loader.textureManager.addAtlas(image.key, image.data, json.data, normalMap); - json.addToCache(); - this.complete = true; } } @@ -170624,7 +180259,7 @@ module.exports = AtlasJSONFile; /***/ }), -/* 1261 */ +/* 1323 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170636,10 +180271,10 @@ module.exports = AtlasJSONFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(63); -var XMLFile = __webpack_require__(227); +var MultiFile = __webpack_require__(47); +var XMLFile = __webpack_require__(233); /** * @classdesc @@ -170727,8 +180362,6 @@ var AtlasXMLFile = new Class({ this.loader.textureManager.addAtlasXML(image.key, image.data, xml.data, normalMap); - xml.addToCache(); - this.complete = true; } } @@ -170867,7 +180500,7 @@ module.exports = AtlasXMLFile; /***/ }), -/* 1262 */ +/* 1324 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170876,13 +180509,13 @@ module.exports = AtlasXMLFile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AudioFile = __webpack_require__(478); +var AudioFile = __webpack_require__(495); var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(62); -var MultiFile = __webpack_require__(63); +var JSONFile = __webpack_require__(58); +var MultiFile = __webpack_require__(47); /** * @classdesc @@ -171157,7 +180790,7 @@ FileTypesManager.register('audioSprite', function (key, jsonURL, audioURL, audio /***/ }), -/* 1263 */ +/* 1325 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -171167,7 +180800,7 @@ FileTypesManager.register('audioSprite', function (key, jsonURL, audioURL, audio */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -171339,7 +180972,7 @@ module.exports = BinaryFile; /***/ }), -/* 1264 */ +/* 1326 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -171351,11 +180984,11 @@ module.exports = BinaryFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(63); -var ParseXMLBitmapFont = __webpack_require__(198); -var XMLFile = __webpack_require__(227); +var MultiFile = __webpack_require__(47); +var ParseXMLBitmapFont = __webpack_require__(203); +var XMLFile = __webpack_require__(233); /** * @classdesc @@ -171441,7 +181074,6 @@ var BitmapFontFile = new Class({ var xml = this.files[1]; image.addToCache(); - xml.addToCache(); var texture = image.cache.get(image.key); @@ -171586,7 +181218,7 @@ module.exports = BitmapFontFile; /***/ }), -/* 1265 */ +/* 1327 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -171596,7 +181228,7 @@ module.exports = BitmapFontFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -171754,7 +181386,7 @@ module.exports = CSSFile; /***/ }), -/* 1266 */ +/* 1328 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -171764,12 +181396,12 @@ module.exports = CSSFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var Shader = __webpack_require__(363); +var Shader = __webpack_require__(372); /** * @classdesc @@ -172012,7 +181644,7 @@ var GLSLFile = new Class({ * @since 3.17.0 * * @param {string[]} data - The array of shader data to process. - * @param {integer} offset - The offset to start processing from. + * @param {number} offset - The offset to start processing from. * * @return {any} The processed shader block, or null. */ @@ -172165,7 +181797,7 @@ module.exports = GLSLFile; /***/ }), -/* 1267 */ +/* 1329 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -172175,7 +181807,7 @@ module.exports = GLSLFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -172197,7 +181829,7 @@ var IsPlainObject = __webpack_require__(7); * * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Types.Loader.FileTypes.HTMLFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.html". + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var HTMLFile = new Class({ @@ -172340,7 +181972,7 @@ module.exports = HTMLFile; /***/ }), -/* 1268 */ +/* 1330 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -172350,7 +181982,7 @@ module.exports = HTMLFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -172373,8 +182005,8 @@ var IsPlainObject = __webpack_require__(7); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {integer} [width] - The width of the texture the HTML will be rendered to. - * @param {integer} [height] - The height of the texture the HTML will be rendered to. + * @param {number} [width] - The width of the texture the HTML will be rendered to. + * @param {number} [height] - The height of the texture the HTML will be rendered to. * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var HTMLTextureFile = new Class({ @@ -172570,8 +182202,8 @@ var HTMLTextureFile = new Class({ * * @param {(string|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". - * @param {integer} [width=512] - The width of the texture the HTML will be rendered to. - * @param {integer} [height=512] - The height of the texture the HTML will be rendered to. + * @param {number} [width=512] - The width of the texture the HTML will be rendered to. + * @param {number} [height=512] - The height of the texture the HTML will be rendered to. * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {this} The Loader instance. @@ -172598,7 +182230,7 @@ module.exports = HTMLTextureFile; /***/ }), -/* 1269 */ +/* 1331 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -172610,10 +182242,10 @@ module.exports = HTMLTextureFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(62); -var MultiFile = __webpack_require__(63); +var JSONFile = __webpack_require__(58); +var MultiFile = __webpack_require__(47); /** * @classdesc @@ -172931,7 +182563,7 @@ module.exports = MultiAtlasFile; /***/ }), -/* 1270 */ +/* 1332 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -172944,8 +182576,8 @@ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(63); -var ScriptFile = __webpack_require__(480); +var MultiFile = __webpack_require__(47); +var ScriptFile = __webpack_require__(497); /** * @classdesc @@ -173148,7 +182780,7 @@ module.exports = MultiScriptFile; /***/ }), -/* 1271 */ +/* 1333 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -173158,9 +182790,263 @@ module.exports = MultiScriptFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(62); +var GetFastValue = __webpack_require__(2); +var IsPlainObject = __webpack_require__(7); +var MultiFile = __webpack_require__(47); +var ParseObj = __webpack_require__(475); +var ParseObjMaterial = __webpack_require__(476); +var TextFile = __webpack_require__(234); + +/** + * @classdesc + * A single Wavefront OBJ File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#obj method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#obj. + * + * @class OBJFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.OBJFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [objURL] - The absolute or relative URL to load the obj file from. If undefined or `null` it will be set to `.obj`, i.e. if `key` was "alien" then the URL will be "alien.obj". + * @param {string} [matURL] - The absolute or relative URL to load the material file from. If undefined or `null` it will be set to `.mat`, i.e. if `key` was "alien" then the URL will be "alien.mat". + * @param {boolean} [flipUV] - Flip the UV coordinates stored in the model data? + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for these files. + */ +var OBJFile = new Class({ + + Extends: MultiFile, + + initialize: + + function OBJFile (loader, key, objURL, matURL, flipUV, xhrSettings) + { + var obj; + var mat; + + var cache = loader.cacheManager.obj; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + + obj = new TextFile(loader, { + key: key, + type: 'obj', + cache: cache, + url: GetFastValue(config, 'url'), + extension: GetFastValue(config, 'extension', 'obj'), + xhrSettings: GetFastValue(config, 'xhrSettings'), + config: { + flipUV: GetFastValue(config, 'flipUV', flipUV) + } + }); + + matURL = GetFastValue(config, 'matURL'); + + if (matURL) + { + mat = new TextFile(loader, { + key: key, + type: 'mat', + cache: cache, + url: matURL, + extension: GetFastValue(config, 'matExtension', 'mat'), + xhrSettings: GetFastValue(config, 'xhrSettings') + }); + } + } + else + { + obj = new TextFile(loader, { + key: key, + url: objURL, + type: 'obj', + cache: cache, + extension: 'obj', + xhrSettings: xhrSettings, + config: { + flipUV: flipUV + } + }); + + if (matURL) + { + mat = new TextFile(loader, { + key: key, + url: matURL, + type: 'mat', + cache: cache, + extension: 'mat', + xhrSettings: xhrSettings + }); + } + } + + MultiFile.call(this, loader, 'obj', key, [ obj, mat ]); + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.OBJFile#addToCache + * @since 3.50.0 + */ + addToCache: function () + { + if (this.isReadyToProcess()) + { + var obj = this.files[0]; + var mat = this.files[1]; + + var objData = ParseObj(obj.data, obj.config.flipUV); + + if (mat) + { + objData.materials = ParseObjMaterial(mat.data); + } + + obj.cache.add(obj.key, objData); + + this.complete = true; + } + } + +}); + +/** + * Adds a Wavefront OBJ file, or array of OBJ files, to the current load queue. + * + * Note: You should ensure your 3D package has triangulated the OBJ file prior to export. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.obj('ufo', 'files/spaceship.obj'); + * } + * ``` + * + * You can optionally also load a Wavefront Material file as well, by providing the 3rd parameter: + * + * ```javascript + * function preload () + * { + * this.load.obj('ufo', 'files/spaceship.obj', 'files/spaceship.mtl'); + * } + * ``` + * + * If given, the material will be parsed and stored along with the obj data in the cache. + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global OBJ Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the OBJ Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the OBJ Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.obj({ + * key: 'ufo', + * url: 'files/spaceship.obj', + * matURL: 'files/spaceship.mtl', + * flipUV: true + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.OBJFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.obj('ufo', 'files/spaceship.obj'); + * // and later in your game ... + * var data = this.cache.obj.get('ufo'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the obj from the OBJ Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.obj". It will always add `.obj` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the OBJ File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#obj + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.50.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.OBJFileConfig|Phaser.Types.Loader.FileTypes.OBJFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [objURL] - The absolute or relative URL to load the obj file from. If undefined or `null` it will be set to `.obj`, i.e. if `key` was "alien" then the URL will be "alien.obj". + * @param {string} [matURL] - Optional absolute or relative URL to load the obj material file from. + * @param {boolean} [flipUV] - Flip the UV coordinates stored in the model data? + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('obj', function (key, objURL, matURL, flipUVs, xhrSettings) +{ + var multifile; + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + multifile = new OBJFile(this, key[i]); + + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(multifile.files); + } + } + else + { + multifile = new OBJFile(this, key, objURL, matURL, flipUVs, xhrSettings); + + this.addFile(multifile.files); + } + + return this; +}); + +module.exports = OBJFile; + + +/***/ }), +/* 1334 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var CONST = __webpack_require__(19); +var FileTypesManager = __webpack_require__(8); +var JSONFile = __webpack_require__(58); /** * @classdesc @@ -173366,7 +183252,7 @@ module.exports = PackFile; /***/ }), -/* 1272 */ +/* 1335 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -173376,7 +183262,7 @@ module.exports = PackFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -173578,7 +183464,7 @@ module.exports = PluginFile; /***/ }), -/* 1273 */ +/* 1336 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -173588,7 +183474,7 @@ module.exports = PluginFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -173635,7 +183521,6 @@ var SceneFile = new Class({ var fileConfig = { type: 'text', - cache: loader.cacheManager.text, extension: extension, responseType: 'text', key: key, @@ -173799,7 +183684,7 @@ module.exports = SceneFile; /***/ }), -/* 1274 */ +/* 1337 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -173809,7 +183694,7 @@ module.exports = SceneFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -174005,7 +183890,7 @@ module.exports = ScenePluginFile; /***/ }), -/* 1275 */ +/* 1338 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -174016,7 +183901,7 @@ module.exports = ScenePluginFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); /** * @classdesc @@ -174196,7 +184081,7 @@ module.exports = SpriteSheetFile; /***/ }), -/* 1276 */ +/* 1339 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -174206,7 +184091,7 @@ module.exports = SpriteSheetFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -174535,7 +184420,7 @@ module.exports = SVGFile; /***/ }), -/* 1277 */ +/* 1340 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -174545,12 +184430,12 @@ module.exports = SVGFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var TILEMAP_FORMATS = __webpack_require__(33); +var TILEMAP_FORMATS = __webpack_require__(38); /** * @classdesc @@ -174730,7 +184615,7 @@ module.exports = TilemapCSVFile; /***/ }), -/* 1278 */ +/* 1341 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -174741,8 +184626,8 @@ module.exports = TilemapCSVFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(62); -var TILEMAP_FORMATS = __webpack_require__(33); +var JSONFile = __webpack_require__(58); +var TILEMAP_FORMATS = __webpack_require__(38); /** * @classdesc @@ -174886,7 +184771,7 @@ module.exports = TilemapImpactFile; /***/ }), -/* 1279 */ +/* 1342 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -174897,8 +184782,8 @@ module.exports = TilemapImpactFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(62); -var TILEMAP_FORMATS = __webpack_require__(33); +var JSONFile = __webpack_require__(58); +var TILEMAP_FORMATS = __webpack_require__(38); /** * @classdesc @@ -175042,7 +184927,7 @@ module.exports = TilemapJSONFile; /***/ }), -/* 1280 */ +/* 1343 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175054,10 +184939,10 @@ module.exports = TilemapJSONFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(63); -var TextFile = __webpack_require__(481); +var MultiFile = __webpack_require__(47); +var TextFile = __webpack_require__(234); /** * @classdesc @@ -175145,8 +185030,6 @@ var UnityAtlasFile = new Class({ this.loader.textureManager.addUnityAtlas(image.key, image.data, text.data, normalMap); - text.addToCache(); - this.complete = true; } } @@ -175284,7 +185167,7 @@ module.exports = UnityAtlasFile; /***/ }), -/* 1281 */ +/* 1344 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175294,10 +185177,10 @@ module.exports = UnityAtlasFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); -var GetURL = __webpack_require__(146); +var GetURL = __webpack_require__(148); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); @@ -175678,7 +185561,7 @@ module.exports = VideoFile; /***/ }), -/* 1282 */ +/* 1345 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175688,15 +185571,15 @@ module.exports = VideoFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); -var CustomSet = __webpack_require__(141); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(84); +var CONST = __webpack_require__(19); +var CustomSet = __webpack_require__(145); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(89); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); -var XHRSettings = __webpack_require__(147); +var XHRSettings = __webpack_require__(149); /** * @classdesc @@ -175860,7 +185743,7 @@ var LoaderPlugin = new Class({ * The default is 32 but you can change this in your Game Config, or by changing this property before the Loader starts. * * @name Phaser.Loader.LoaderPlugin#maxParallelDownloads - * @type {integer} + * @type {number} * @since 3.0.0 */ this.maxParallelDownloads = GetFastValue(sceneConfig, 'maxParallelDownloads', gameConfig.loaderMaxParallelDownloads); @@ -175895,7 +185778,7 @@ var LoaderPlugin = new Class({ * of loading, especially if you load a Pack File. Therefore this value can change, but in most cases remains static. * * @name Phaser.Loader.LoaderPlugin#totalToLoad - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -175970,7 +185853,7 @@ var LoaderPlugin = new Class({ * This value is reset when you call `Loader.start`. * * @name Phaser.Loader.LoaderPlugin#totalFailed - * @type {integer} + * @type {number} * @default 0 * @since 3.7.0 */ @@ -175981,7 +185864,7 @@ var LoaderPlugin = new Class({ * This value is reset when you call `Loader.start`. * * @name Phaser.Loader.LoaderPlugin#totalComplete - * @type {integer} + * @type {number} * @default 0 * @since 3.7.0 */ @@ -175991,7 +185874,7 @@ var LoaderPlugin = new Class({ * The current state of the Loader. * * @name Phaser.Loader.LoaderPlugin#state - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -176001,7 +185884,7 @@ var LoaderPlugin = new Class({ * The current index being used by multi-file loaders to avoid key clashes. * * @name Phaser.Loader.LoaderPlugin#multiKeyIndex - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -176761,7 +186644,7 @@ module.exports = LoaderPlugin; /***/ }), -/* 1283 */ +/* 1346 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -176770,8 +186653,8 @@ module.exports = LoaderPlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(52); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(59); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Physics.Arcade @@ -176779,23 +186662,23 @@ var Extend = __webpack_require__(19); var Arcade = { - ArcadePhysics: __webpack_require__(1284), - Body: __webpack_require__(488), - Collider: __webpack_require__(489), - Components: __webpack_require__(228), - Events: __webpack_require__(230), - Factory: __webpack_require__(482), - GetOverlapX: __webpack_require__(231), - GetOverlapY: __webpack_require__(232), - SeparateX: __webpack_require__(497), - SeparateY: __webpack_require__(498), - Group: __webpack_require__(485), - Image: __webpack_require__(483), - Sprite: __webpack_require__(148), - StaticBody: __webpack_require__(499), - StaticGroup: __webpack_require__(486), - Tilemap: __webpack_require__(1305), - World: __webpack_require__(487) + ArcadePhysics: __webpack_require__(1347), + Body: __webpack_require__(504), + Collider: __webpack_require__(505), + Components: __webpack_require__(235), + Events: __webpack_require__(237), + Factory: __webpack_require__(498), + GetOverlapX: __webpack_require__(238), + GetOverlapY: __webpack_require__(239), + SeparateX: __webpack_require__(514), + SeparateY: __webpack_require__(515), + Group: __webpack_require__(501), + Image: __webpack_require__(499), + Sprite: __webpack_require__(150), + StaticBody: __webpack_require__(516), + StaticGroup: __webpack_require__(502), + Tilemap: __webpack_require__(1371), + World: __webpack_require__(503) }; @@ -176806,7 +186689,7 @@ module.exports = Arcade; /***/ }), -/* 1284 */ +/* 1347 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -176816,18 +186699,18 @@ module.exports = Arcade; */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(41); -var DistanceBetween = __webpack_require__(55); -var DistanceSquared = __webpack_require__(334); -var Factory = __webpack_require__(482); +var DegToRad = __webpack_require__(34); +var DistanceBetween = __webpack_require__(61); +var DistanceSquared = __webpack_require__(345); +var Factory = __webpack_require__(498); var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(134); -var OverlapCirc = __webpack_require__(484); -var OverlapRect = __webpack_require__(229); -var PluginCache = __webpack_require__(23); +var Merge = __webpack_require__(140); +var OverlapCirc = __webpack_require__(500); +var OverlapRect = __webpack_require__(236); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); var Vector2 = __webpack_require__(3); -var World = __webpack_require__(487); +var World = __webpack_require__(503); /** * @classdesc @@ -177531,7 +187414,7 @@ module.exports = ArcadePhysics; /***/ }), -/* 1285 */ +/* 1348 */ /***/ (function(module, exports) { /** @@ -177606,7 +187489,7 @@ module.exports = Acceleration; /***/ }), -/* 1286 */ +/* 1349 */ /***/ (function(module, exports) { /** @@ -177688,7 +187571,7 @@ module.exports = Angular; /***/ }), -/* 1287 */ +/* 1350 */ /***/ (function(module, exports) { /** @@ -177787,7 +187670,7 @@ module.exports = Bounce; /***/ }), -/* 1288 */ +/* 1351 */ /***/ (function(module, exports) { /** @@ -177914,7 +187797,7 @@ module.exports = Debug; /***/ }), -/* 1289 */ +/* 1352 */ /***/ (function(module, exports) { /** @@ -178047,7 +187930,7 @@ module.exports = Drag; /***/ }), -/* 1290 */ +/* 1353 */ /***/ (function(module, exports) { /** @@ -178171,7 +188054,7 @@ module.exports = Enable; /***/ }), -/* 1291 */ +/* 1354 */ /***/ (function(module, exports) { /** @@ -178259,7 +188142,7 @@ module.exports = Friction; /***/ }), -/* 1292 */ +/* 1355 */ /***/ (function(module, exports) { /** @@ -178337,7 +188220,7 @@ module.exports = Gravity; /***/ }), -/* 1293 */ +/* 1356 */ /***/ (function(module, exports) { /** @@ -178355,12 +188238,16 @@ module.exports = Gravity; var Immovable = { /** - * Sets Whether this Body can be moved by collisions with another Body. + * Sets if this Body can be separated during collisions with other bodies. + * + * When a body is immovable it means it won't move at all, not even to separate it from collision + * overlap. If you just wish to prevent a body from being knocked around by other bodies, see + * the `setPushable` method instead. * * @method Phaser.Physics.Arcade.Components.Immovable#setImmovable * @since 3.0.0 * - * @param {boolean} [value=true] - Sets if this body can be moved by collisions with another Body. + * @param {boolean} [value=true] - Sets if this body will be separated during collisions with other bodies. * * @return {this} This Game Object. */ @@ -178379,7 +188266,7 @@ module.exports = Immovable; /***/ }), -/* 1294 */ +/* 1357 */ /***/ (function(module, exports) { /** @@ -178419,7 +188306,55 @@ module.exports = Mass; /***/ }), -/* 1295 */ +/* 1358 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the pushable property of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Pushable + * @since 3.50.0 + */ +var Pushable = { + + /** + * Sets if this Body can be pushed by another Body. + * + * A body that cannot be pushed will reflect back all of the velocity it is given to the + * colliding body. If that body is also not pushable, then the separation will be split + * between them evenly. + * + * If you want your body to never move or seperate at all, see the `setImmovable` method. + * + * @method Phaser.Physics.Arcade.Components.Pushable#setPushable + * @since 3.50.0 + * + * @param {boolean} [value=true] - Sets if this body can be pushed by collisions with another Body. + * + * @return {this} This Game Object. + */ + setPushable: function (value) + { + if (value === undefined) { value = true; } + + this.body.pushable = value; + + return this; + } + +}; + +module.exports = Pushable; + + +/***/ }), +/* 1359 */ /***/ (function(module, exports) { /** @@ -178522,7 +188457,7 @@ module.exports = Size; /***/ }), -/* 1296 */ +/* 1360 */ /***/ (function(module, exports) { /** @@ -178621,7 +188556,7 @@ module.exports = Velocity; /***/ }), -/* 1297 */ +/* 1361 */ /***/ (function(module, exports) { /** @@ -178654,7 +188589,7 @@ module.exports = 'collide'; /***/ }), -/* 1298 */ +/* 1362 */ /***/ (function(module, exports) { /** @@ -178687,7 +188622,7 @@ module.exports = 'overlap'; /***/ }), -/* 1299 */ +/* 1363 */ /***/ (function(module, exports) { /** @@ -178710,7 +188645,7 @@ module.exports = 'pause'; /***/ }), -/* 1300 */ +/* 1364 */ /***/ (function(module, exports) { /** @@ -178733,7 +188668,7 @@ module.exports = 'resume'; /***/ }), -/* 1301 */ +/* 1365 */ /***/ (function(module, exports) { /** @@ -178765,7 +188700,7 @@ module.exports = 'tilecollide'; /***/ }), -/* 1302 */ +/* 1366 */ /***/ (function(module, exports) { /** @@ -178797,7 +188732,7 @@ module.exports = 'tileoverlap'; /***/ }), -/* 1303 */ +/* 1367 */ /***/ (function(module, exports) { /** @@ -178829,7 +188764,7 @@ module.exports = 'worldbounds'; /***/ }), -/* 1304 */ +/* 1368 */ /***/ (function(module, exports) { /** @@ -178840,22 +188775,858 @@ module.exports = 'worldbounds'; /** * The Arcade Physics World Step Event. - * + * * This event is dispatched by an Arcade Physics World instance whenever a physics step is run. * It is emitted _after_ the bodies and colliders have been updated. - * + * * In high framerate settings this can be multiple times per game frame. - * + * * Listen to it from a Scene using: `this.physics.world.on('worldstep', listener)`. * * @event Phaser.Physics.Arcade.Events#WORLD_STEP * @since 3.18.0 + * + * @param {number} delta - The delta time amount of this step, in seconds. */ module.exports = 'worldstep'; /***/ }), -/* 1305 */ +/* 1369 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var body1; +var body2; +var body1Pushable; +var body2Pushable; +var body1MassImpact; +var body2MassImpact; +var body1FullImpact; +var body2FullImpact; +var body1MovingLeft; +var body1MovingRight; +var body1Stationary; +var body2MovingLeft; +var body2MovingRight; +var body2Stationary; +var body1OnLeft; +var body2OnLeft; +var overlap; + +/** + * Sets all of the local processing values and calculates the velocity exchanges. + * + * Then runs `BlockCheck` and returns the value from it. + * + * This method is called by `Phaser.Physics.Arcade.SeparateX` and should not be + * called directly. + * + * @function Phaser.Physics.Arcade.ProcessX.Set + * @ignore + * @since 3.50.0 + * + * @param {Phaser.Physics.Arcade.Body} b1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} b2 - The second Body to separate. + * @param {number} ov - The overlap value. + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var Set = function (b1, b2, ov) +{ + body1 = b1; + body2 = b2; + + var v1 = body1.velocity.x; + var v2 = body2.velocity.x; + + body1Pushable = body1.pushable; + body1MovingLeft = body1._dx < 0; + body1MovingRight = body1._dx > 0; + body1Stationary = body1._dx === 0; + body1OnLeft = Math.abs(body1.right - body2.x) <= Math.abs(body2.right - body1.x); + body1FullImpact = v2 - v1 * body1.bounce.x; + + body2Pushable = body2.pushable; + body2MovingLeft = body2._dx < 0; + body2MovingRight = body2._dx > 0; + body2Stationary = body2._dx === 0; + body2OnLeft = !body1OnLeft; + body2FullImpact = v1 - v2 * body2.bounce.x; + + // negative delta = up, positive delta = down (inc. gravity) + overlap = Math.abs(ov); + + return BlockCheck(); +}; + +/** + * Blocked Direction checks, because it doesn't matter if an object can be pushed + * or not, blocked is blocked. + * + * @function Phaser.Physics.Arcade.ProcessX.BlockCheck + * @ignore + * @since 3.50.0 + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var BlockCheck = function () +{ + // Body1 is moving right and Body2 is blocked from going right any further + if (body1MovingRight && body1OnLeft && body2.blocked.right) + { + body1.processX(-overlap, body1FullImpact, false, true); + + return 1; + } + + // Body1 is moving up and Body2 is blocked from going up any further + if (body1MovingLeft && body2OnLeft && body2.blocked.left) + { + body1.processX(overlap, body1FullImpact, true); + + return 1; + } + + // Body2 is moving right and Body1 is blocked from going right any further + if (body2MovingRight && body2OnLeft && body1.blocked.right) + { + body2.processX(-overlap, body2FullImpact, false, true); + + return 2; + } + + // Body2 is moving up and Body1 is blocked from going up any further + if (body2MovingLeft && body1OnLeft && body1.blocked.left) + { + body2.processX(overlap, body2FullImpact, true); + + return 2; + } + + return 0; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessX.Check + * @ignore + * @since 3.50.0 + * + * @return {boolean} `true` if a check passed, otherwise `false`. + */ +var Check = function () +{ + var v1 = body1.velocity.x; + var v2 = body2.velocity.x; + + var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); + var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); + var avg = (nv1 + nv2) * 0.5; + + nv1 -= avg; + nv2 -= avg; + + body1MassImpact = avg + nv1 * body1.bounce.x; + body2MassImpact = avg + nv2 * body2.bounce.x; + + // Body1 hits Body2 on the right hand side + if (body1MovingLeft && body2OnLeft) + { + return Run(0); + } + + // Body2 hits Body1 on the right hand side + if (body2MovingLeft && body1OnLeft) + { + return Run(1); + } + + // Body1 hits Body2 on the left hand side + if (body1MovingRight && body1OnLeft) + { + return Run(2); + } + + // Body2 hits Body1 on the left hand side + if (body2MovingRight && body2OnLeft) + { + return Run(3); + } + + return false; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessX.Run + * @ignore + * @since 3.50.0 + * + * @param {number} side - The side to test. As passed in by the `Check` function. + * + * @return {boolean} Always returns `true`. + */ +var Run = function (side) +{ + if (body1Pushable && body2Pushable) + { + // Both pushable, or both moving at the same time, so equal rebound + overlap *= 0.5; + + if (side === 0 || side === 3) + { + // body1MovingLeft && body2OnLeft + // body2MovingRight && body2OnLeft + body1.processX(overlap, body1MassImpact); + body2.processX(-overlap, body2MassImpact); + } + else + { + // body2MovingLeft && body1OnLeft + // body1MovingRight && body1OnLeft + body1.processX(-overlap, body1MassImpact); + body2.processX(overlap, body2MassImpact); + } + } + else if (body1Pushable && !body2Pushable) + { + // Body1 pushable, Body2 not + + if (side === 0 || side === 3) + { + // body1MovingLeft && body2OnLeft + // body2MovingRight && body2OnLeft + body1.processX(overlap, body1FullImpact, true); + } + else + { + // body2MovingLeft && body1OnLeft + // body1MovingRight && body1OnLeft + body1.processX(-overlap, body1FullImpact, false, true); + } + } + else if (!body1Pushable && body2Pushable) + { + // Body2 pushable, Body1 not + + if (side === 0 || side === 3) + { + // body1MovingLeft && body2OnLeft + // body2MovingRight && body2OnLeft + body2.processX(-overlap, body2FullImpact, false, true); + } + else + { + // body2MovingLeft && body1OnLeft + // body1MovingRight && body1OnLeft + body2.processX(overlap, body2FullImpact, true); + } + } + else + { + // Neither body is pushable, so base it on movement + + var halfOverlap = overlap * 0.5; + + if (side === 0) + { + // body1MovingLeft && body2OnLeft + + if (body2Stationary) + { + body1.processX(overlap, 0, true); + body2.processX(0, null, false, true); + } + else if (body2MovingRight) + { + body1.processX(halfOverlap, 0, true); + body2.processX(-halfOverlap, 0, false, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processX(halfOverlap, body2.velocity.x, true); + body2.processX(-halfOverlap, null, false, true); + } + } + else if (side === 1) + { + // body2MovingLeft && body1OnLeft + + if (body1Stationary) + { + body1.processX(0, null, false, true); + body2.processX(overlap, 0, true); + } + else if (body1MovingRight) + { + body1.processX(-halfOverlap, 0, false, true); + body2.processX(halfOverlap, 0, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processX(-halfOverlap, null, false, true); + body2.processX(halfOverlap, body1.velocity.x, true); + } + } + else if (side === 2) + { + // body1MovingRight && body1OnLeft + + if (body2Stationary) + { + body1.processX(-overlap, 0, false, true); + body2.processX(0, null, true); + } + else if (body2MovingLeft) + { + body1.processX(-halfOverlap, 0, false, true); + body2.processX(halfOverlap, 0, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processX(-halfOverlap, body2.velocity.x, false, true); + body2.processX(halfOverlap, null, true); + } + } + else if (side === 3) + { + // body2MovingRight && body2OnLeft + + if (body1Stationary) + { + body1.processX(0, null, true); + body2.processX(-overlap, 0, false, true); + } + else if (body1MovingLeft) + { + body1.processX(halfOverlap, 0, true); + body2.processX(-halfOverlap, 0, false, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processX(halfOverlap, body2.velocity.y, true); + body2.processX(-halfOverlap, null, false, true); + } + } + } + + return true; +}; + +/** + * This function is run when Body1 is Immovable and Body2 is not. + * + * @function Phaser.Physics.Arcade.ProcessX.RunImmovableBody1 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody1 = function (blockedState) +{ + if (blockedState === 1) + { + // But Body2 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body2.velocity.x = 0; + } + else if (body1OnLeft) + { + body2.processX(overlap, body2FullImpact, true); + } + else + { + body2.processX(-overlap, body2FullImpact, false, true); + } + + // This is special case code that handles things like vertically moving platforms you can ride + if (body1.moves) + { + body2.y += (body1.y - body1.prev.y) * body1.friction.y; + body2._dy = body2.y - body2.prev.y; + } +}; + +/** + * This function is run when Body2 is Immovable and Body1 is not. + * + * @function Phaser.Physics.Arcade.ProcessX.RunImmovableBody2 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody2 = function (blockedState) +{ + if (blockedState === 2) + { + // But Body1 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body1.velocity.x = 0; + } + if (body2OnLeft) + { + body1.processX(overlap, body1FullImpact, true); + } + else + { + body1.processX(-overlap, body1FullImpact, false, true); + } + + // This is special case code that handles things like vertically moving platforms you can ride + if (body2.moves) + { + body1.y += (body2.y - body2.prev.y) * body2.friction.y; + body1._dy = body1.y - body1.prev.y; + } +}; + +/** + * @namespace Phaser.Physics.Arcade.ProcessX + * @ignore + */ + +module.exports = { + BlockCheck: BlockCheck, + Check: Check, + Set: Set, + Run: Run, + RunImmovableBody1: RunImmovableBody1, + RunImmovableBody2: RunImmovableBody2 +}; + + +/***/ }), +/* 1370 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var body1; +var body2; +var body1Pushable; +var body2Pushable; +var body1MassImpact; +var body2MassImpact; +var body1FullImpact; +var body2FullImpact; +var body1MovingUp; +var body1MovingDown; +var body1Stationary; +var body2MovingUp; +var body2MovingDown; +var body2Stationary; +var body1OnTop; +var body2OnTop; +var overlap; + +/** + * Sets all of the local processing values and calculates the velocity exchanges. + * + * Then runs `BlockCheck` and returns the value from it. + * + * This method is called by `Phaser.Physics.Arcade.SeparateY` and should not be + * called directly. + * + * @function Phaser.Physics.Arcade.ProcessY.Set + * @ignore + * @since 3.50.0 + * + * @param {Phaser.Physics.Arcade.Body} b1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} b2 - The second Body to separate. + * @param {number} ov - The overlap value. + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var Set = function (b1, b2, ov) +{ + body1 = b1; + body2 = b2; + + var v1 = body1.velocity.y; + var v2 = body2.velocity.y; + + body1Pushable = body1.pushable; + body1MovingUp = body1._dy < 0; + body1MovingDown = body1._dy > 0; + body1Stationary = body1._dy === 0; + body1OnTop = Math.abs(body1.bottom - body2.y) <= Math.abs(body2.bottom - body1.y); + body1FullImpact = v2 - v1 * body1.bounce.y; + + body2Pushable = body2.pushable; + body2MovingUp = body2._dy < 0; + body2MovingDown = body2._dy > 0; + body2Stationary = body2._dy === 0; + body2OnTop = !body1OnTop; + body2FullImpact = v1 - v2 * body2.bounce.y; + + // negative delta = up, positive delta = down (inc. gravity) + overlap = Math.abs(ov); + + return BlockCheck(); +}; + +/** + * Blocked Direction checks, because it doesn't matter if an object can be pushed + * or not, blocked is blocked. + * + * @function Phaser.Physics.Arcade.ProcessY.BlockCheck + * @ignore + * @since 3.50.0 + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var BlockCheck = function () +{ + // Body1 is moving down and Body2 is blocked from going down any further + if (body1MovingDown && body1OnTop && body2.blocked.down) + { + body1.processY(-overlap, body1FullImpact, false, true); + + return 1; + } + + // Body1 is moving up and Body2 is blocked from going up any further + if (body1MovingUp && body2OnTop && body2.blocked.up) + { + body1.processY(overlap, body1FullImpact, true); + + return 1; + } + + // Body2 is moving down and Body1 is blocked from going down any further + if (body2MovingDown && body2OnTop && body1.blocked.down) + { + body2.processY(-overlap, body2FullImpact, false, true); + + return 2; + } + + // Body2 is moving up and Body1 is blocked from going up any further + if (body2MovingUp && body1OnTop && body1.blocked.up) + { + body2.processY(overlap, body2FullImpact, true); + + return 2; + } + + return 0; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessY.Check + * @ignore + * @since 3.50.0 + * + * @return {boolean} `true` if a check passed, otherwise `false`. + */ +var Check = function () +{ + var v1 = body1.velocity.y; + var v2 = body2.velocity.y; + + var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); + var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); + var avg = (nv1 + nv2) * 0.5; + + nv1 -= avg; + nv2 -= avg; + + body1MassImpact = avg + nv1 * body1.bounce.y; + body2MassImpact = avg + nv2 * body2.bounce.y; + + // Body1 hits Body2 on the bottom side + if (body1MovingUp && body2OnTop) + { + return Run(0); + } + + // Body2 hits Body1 on the bottom side + if (body2MovingUp && body1OnTop) + { + return Run(1); + } + + // Body1 hits Body2 on the top side + if (body1MovingDown && body1OnTop) + { + return Run(2); + } + + // Body2 hits Body1 on the top side + if (body2MovingDown && body2OnTop) + { + return Run(3); + } + + return false; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessY.Run + * @ignore + * @since 3.50.0 + * + * @param {number} side - The side to test. As passed in by the `Check` function. + * + * @return {boolean} Always returns `true`. + */ +var Run = function (side) +{ + if (body1Pushable && body2Pushable) + { + // Both pushable, or both moving at the same time, so equal rebound + overlap *= 0.5; + + if (side === 0 || side === 3) + { + // body1MovingUp && body2OnTop + // body2MovingDown && body2OnTop + body1.processY(overlap, body1MassImpact); + body2.processY(-overlap, body2MassImpact); + } + else + { + // body2MovingUp && body1OnTop + // body1MovingDown && body1OnTop + body1.processY(-overlap, body1MassImpact); + body2.processY(overlap, body2MassImpact); + } + } + else if (body1Pushable && !body2Pushable) + { + // Body1 pushable, Body2 not + + if (side === 0 || side === 3) + { + // body1MovingUp && body2OnTop + // body2MovingDown && body2OnTop + body1.processY(overlap, body1FullImpact, true); + } + else + { + // body2MovingUp && body1OnTop + // body1MovingDown && body1OnTop + body1.processY(-overlap, body1FullImpact, false, true); + } + } + else if (!body1Pushable && body2Pushable) + { + // Body2 pushable, Body1 not + + if (side === 0 || side === 3) + { + // body1MovingUp && body2OnTop + // body2MovingDown && body2OnTop + body2.processY(-overlap, body2FullImpact, false, true); + } + else + { + // body2MovingUp && body1OnTop + // body1MovingDown && body1OnTop + body2.processY(overlap, body2FullImpact, true); + } + } + else + { + // Neither body is pushable, so base it on movement + + var halfOverlap = overlap * 0.5; + + if (side === 0) + { + // body1MovingUp && body2OnTop + + if (body2Stationary) + { + body1.processY(overlap, 0, true); + body2.processY(0, null, false, true); + } + else if (body2MovingDown) + { + body1.processY(halfOverlap, 0, true); + body2.processY(-halfOverlap, 0, false, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processY(halfOverlap, body2.velocity.y, true); + body2.processY(-halfOverlap, null, false, true); + } + } + else if (side === 1) + { + // body2MovingUp && body1OnTop + + if (body1Stationary) + { + body1.processY(0, null, false, true); + body2.processY(overlap, 0, true); + } + else if (body1MovingDown) + { + body1.processY(-halfOverlap, 0, false, true); + body2.processY(halfOverlap, 0, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processY(-halfOverlap, null, false, true); + body2.processY(halfOverlap, body1.velocity.y, true); + } + } + else if (side === 2) + { + // body1MovingDown && body1OnTop + + if (body2Stationary) + { + body1.processY(-overlap, 0, false, true); + body2.processY(0, null, true); + } + else if (body2MovingUp) + { + body1.processY(-halfOverlap, 0, false, true); + body2.processY(halfOverlap, 0, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processY(-halfOverlap, body2.velocity.y, false, true); + body2.processY(halfOverlap, null, true); + } + } + else if (side === 3) + { + // body2MovingDown && body2OnTop + + if (body1Stationary) + { + body1.processY(0, null, true); + body2.processY(-overlap, 0, false, true); + } + else if (body1MovingUp) + { + body1.processY(halfOverlap, 0, true); + body2.processY(-halfOverlap, 0, false, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processY(halfOverlap, body2.velocity.y, true); + body2.processY(-halfOverlap, null, false, true); + } + } + } + + return true; +}; + +/** + * This function is run when Body1 is Immovable and Body2 is not. + * + * @function Phaser.Physics.Arcade.ProcessY.RunImmovableBody1 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody1 = function (blockedState) +{ + if (blockedState === 1) + { + // But Body2 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body2.velocity.y = 0; + } + else if (body1OnTop) + { + body2.processY(overlap, body2FullImpact, true); + } + else + { + body2.processY(-overlap, body2FullImpact, false, true); + } + + // This is special case code that handles things like horizontally moving platforms you can ride + if (body1.moves) + { + body2.x += (body1.x - body1.prev.x) * body1.friction.x; + body2._dx = body2.x - body2.prev.x; + } +}; + +/** + * This function is run when Body2 is Immovable and Body1 is not. + * + * @function Phaser.Physics.Arcade.ProcessY.RunImmovableBody2 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody2 = function (blockedState) +{ + if (blockedState === 2) + { + // But Body1 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body1.velocity.y = 0; + } + else if (body2OnTop) + { + body1.processY(overlap, body1FullImpact, true); + } + else + { + body1.processY(-overlap, body1FullImpact, false, true); + } + + // This is special case code that handles things like horizontally moving platforms you can ride + if (body2.moves) + { + body1.x += (body2.x - body2.prev.x) * body2.friction.x; + body1._dx = body1.x - body1.prev.x; + } +}; + +/** + * @namespace Phaser.Physics.Arcade.ProcessY + * @ignore + */ + +module.exports = { + BlockCheck: BlockCheck, + Check: Check, + Set: Set, + Run: Run, + RunImmovableBody1: RunImmovableBody1, + RunImmovableBody2: RunImmovableBody2 +}; + + +/***/ }), +/* 1371 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -178870,13 +189641,13 @@ module.exports = 'worldstep'; var Tilemap = { - ProcessTileCallbacks: __webpack_require__(490), - ProcessTileSeparationX: __webpack_require__(494), - ProcessTileSeparationY: __webpack_require__(496), - SeparateTile: __webpack_require__(492), - TileCheckX: __webpack_require__(493), - TileCheckY: __webpack_require__(495), - TileIntersectsBody: __webpack_require__(233) + ProcessTileCallbacks: __webpack_require__(507), + ProcessTileSeparationX: __webpack_require__(511), + ProcessTileSeparationY: __webpack_require__(513), + SeparateTile: __webpack_require__(509), + TileCheckX: __webpack_require__(510), + TileCheckY: __webpack_require__(512), + TileIntersectsBody: __webpack_require__(240) }; @@ -178884,18 +189655,18 @@ module.exports = Tilemap; /***/ }), -/* 1306 */, -/* 1307 */, -/* 1308 */, -/* 1309 */, -/* 1310 */, -/* 1311 */, -/* 1312 */, -/* 1313 */, -/* 1314 */, -/* 1315 */, -/* 1316 */, -/* 1317 */ +/* 1372 */, +/* 1373 */, +/* 1374 */, +/* 1375 */, +/* 1376 */, +/* 1377 */, +/* 1378 */, +/* 1379 */, +/* 1380 */, +/* 1381 */, +/* 1382 */, +/* 1383 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -178910,17 +189681,17 @@ module.exports = Tilemap; module.exports = { - BasePlugin: __webpack_require__(502), - DefaultPlugins: __webpack_require__(184), - PluginCache: __webpack_require__(23), - PluginManager: __webpack_require__(381), - ScenePlugin: __webpack_require__(1318) + BasePlugin: __webpack_require__(519), + DefaultPlugins: __webpack_require__(189), + PluginCache: __webpack_require__(25), + PluginManager: __webpack_require__(391), + ScenePlugin: __webpack_require__(1384) }; /***/ }), -/* 1318 */ +/* 1384 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -178929,7 +189700,7 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ -var BasePlugin = __webpack_require__(502); +var BasePlugin = __webpack_require__(519); var Class = __webpack_require__(0); var SceneEvents = __webpack_require__(20); @@ -179048,7 +189819,7 @@ module.exports = ScenePlugin; /***/ }), -/* 1319 */ +/* 1385 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -179057,8 +189828,8 @@ module.exports = ScenePlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(19); -var CONST = __webpack_require__(187); +var Extend = __webpack_require__(18); +var CONST = __webpack_require__(192); /** * @namespace Phaser.Scale @@ -179086,12 +189857,12 @@ var CONST = __webpack_require__(187); var Scale = { - Center: __webpack_require__(370), - Events: __webpack_require__(94), - Orientation: __webpack_require__(371), - ScaleManager: __webpack_require__(382), - ScaleModes: __webpack_require__(372), - Zoom: __webpack_require__(373) + Center: __webpack_require__(380), + Events: __webpack_require__(101), + Orientation: __webpack_require__(381), + ScaleManager: __webpack_require__(392), + ScaleModes: __webpack_require__(382), + Zoom: __webpack_require__(383) }; @@ -179104,7 +189875,7 @@ module.exports = Scale; /***/ }), -/* 1320 */ +/* 1386 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -179113,8 +189884,8 @@ module.exports = Scale; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(133); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(139); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Scenes @@ -179123,12 +189894,12 @@ var Extend = __webpack_require__(19); var Scene = { Events: __webpack_require__(20), - GetPhysicsPlugins: __webpack_require__(386), - GetScenePlugins: __webpack_require__(387), - SceneManager: __webpack_require__(384), - ScenePlugin: __webpack_require__(1321), - Settings: __webpack_require__(388), - Systems: __webpack_require__(190) + GetPhysicsPlugins: __webpack_require__(396), + GetScenePlugins: __webpack_require__(397), + SceneManager: __webpack_require__(394), + ScenePlugin: __webpack_require__(1387), + Settings: __webpack_require__(398), + Systems: __webpack_require__(195) }; @@ -179139,7 +189910,7 @@ module.exports = Scene; /***/ }), -/* 1321 */ +/* 1387 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -179148,11 +189919,11 @@ module.exports = Scene; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); var Events = __webpack_require__(20); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); /** * @classdesc @@ -179230,7 +190001,7 @@ var ScenePlugin = new Class({ * Transition elapsed timer. * * @name Phaser.Scenes.ScenePlugin#_elapsed - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -179250,7 +190021,7 @@ var ScenePlugin = new Class({ * Transition duration. * * @name Phaser.Scenes.ScenePlugin#_duration - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -180095,7 +190866,7 @@ var ScenePlugin = new Class({ * * @param {(string|Phaser.Scene)} [key] - The Scene to get the index of. * - * @return {integer} The index of the Scene. + * @return {number} The index of the Scene. */ getIndex: function (key) { @@ -180149,7 +190920,7 @@ module.exports = ScenePlugin; /***/ }), -/* 1322 */ +/* 1388 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180164,19 +190935,19 @@ module.exports = ScenePlugin; module.exports = { - Events: __webpack_require__(405), - List: __webpack_require__(137), - Map: __webpack_require__(92), - ProcessQueue: __webpack_require__(197), - RTree: __webpack_require__(491), - Set: __webpack_require__(141), - Size: __webpack_require__(383) + Events: __webpack_require__(415), + List: __webpack_require__(105), + Map: __webpack_require__(98), + ProcessQueue: __webpack_require__(202), + RTree: __webpack_require__(508), + Set: __webpack_require__(145), + Size: __webpack_require__(393) }; /***/ }), -/* 1323 */ +/* 1389 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180185,8 +190956,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(19); -var FilterMode = __webpack_require__(1324); +var Extend = __webpack_require__(18); +var FilterMode = __webpack_require__(1390); /** * @namespace Phaser.Textures @@ -180196,7 +190967,7 @@ var FilterMode = __webpack_require__(1324); * Linear filter type. * * @name Phaser.Textures.LINEAR - * @type {integer} + * @type {number} * @const * @since 3.0.0 */ @@ -180205,21 +190976,21 @@ var FilterMode = __webpack_require__(1324); * Nearest Neighbor filter type. * * @name Phaser.Textures.NEAREST - * @type {integer} + * @type {number} * @const * @since 3.0.0 */ var Textures = { - CanvasTexture: __webpack_require__(390), - Events: __webpack_require__(130), + CanvasTexture: __webpack_require__(400), + Events: __webpack_require__(136), FilterMode: FilterMode, - Frame: __webpack_require__(97), - Parsers: __webpack_require__(392), - Texture: __webpack_require__(192), - TextureManager: __webpack_require__(389), - TextureSource: __webpack_require__(391) + Frame: __webpack_require__(104), + Parsers: __webpack_require__(402), + Texture: __webpack_require__(197), + TextureManager: __webpack_require__(399), + TextureSource: __webpack_require__(401) }; @@ -180229,7 +191000,7 @@ module.exports = Textures; /***/ }), -/* 1324 */ +/* 1390 */ /***/ (function(module, exports) { /** @@ -180251,7 +191022,7 @@ var CONST = { * Linear filter type. * * @name Phaser.Textures.FilterMode.LINEAR - * @type {integer} + * @type {number} * @const * @since 3.0.0 */ @@ -180261,7 +191032,7 @@ var CONST = { * Nearest neighbor filter type. * * @name Phaser.Textures.FilterMode.NEAREST - * @type {integer} + * @type {number} * @const * @since 3.0.0 */ @@ -180273,7 +191044,7 @@ module.exports = CONST; /***/ }), -/* 1325 */ +/* 1391 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180282,36 +191053,47 @@ module.exports = CONST; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Extend = __webpack_require__(18); +var CONST = __webpack_require__(1392); + /** * @namespace Phaser.Tilemaps + * + * @borrows Phaser.Tilemaps.Orientation.ORTHOGONAL as ORTHOGONAL + * @borrows Phaser.Tilemaps.Orientation.ISOMETRIC as ISOMETRIC + * @borrows Phaser.Tilemaps.Orientation.STAGGERED as STAGGERED + * @borrows Phaser.Tilemaps.Orientation.HEXAGONAL as HEXAGONAL */ -module.exports = { +var Tilemaps = { - Components: __webpack_require__(149), - Parsers: __webpack_require__(1355), + Components: __webpack_require__(243), + Parsers: __webpack_require__(1425), - Formats: __webpack_require__(33), - ImageCollection: __webpack_require__(513), - ParseToTilemap: __webpack_require__(240), - Tile: __webpack_require__(75), - Tilemap: __webpack_require__(522), - TilemapCreator: __webpack_require__(1369), - TilemapFactory: __webpack_require__(1370), - Tileset: __webpack_require__(107), + Formats: __webpack_require__(38), + ImageCollection: __webpack_require__(555), + ParseToTilemap: __webpack_require__(253), + Tile: __webpack_require__(81), + Tilemap: __webpack_require__(559), + TilemapCreator: __webpack_require__(1431), + TilemapFactory: __webpack_require__(1432), + Tileset: __webpack_require__(119), + TilemapLayer: __webpack_require__(560), + Orientation: __webpack_require__(29), - LayerData: __webpack_require__(105), - MapData: __webpack_require__(106), - ObjectLayer: __webpack_require__(516), - - DynamicTilemapLayer: __webpack_require__(523), - StaticTilemapLayer: __webpack_require__(524) + LayerData: __webpack_require__(117), + MapData: __webpack_require__(118), + ObjectLayer: __webpack_require__(551) }; +Tilemaps = Extend(false, Tilemaps, CONST.ORIENTATION); + +module.exports = Tilemaps; + /***/ }), -/* 1326 */ +/* 1392 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180320,8 +191102,28 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var CalculateFacesWithin = __webpack_require__(53); +var CONST = { + + FromOrientationString: __webpack_require__(242), + ORIENTATION: __webpack_require__(29) + +}; + +module.exports = CONST; + + +/***/ }), +/* 1393 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTilesWithin = __webpack_require__(26); +var CalculateFacesWithin = __webpack_require__(60); /** * Copies the tiles in the source rectangular area to a new destination (all specified in tile @@ -180331,20 +191133,21 @@ var CalculateFacesWithin = __webpack_require__(53); * @function Phaser.Tilemaps.Components.Copy * @since 3.0.0 * - * @param {integer} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} width - The width of the area to copy, in tiles, not pixels. - * @param {integer} height - The height of the area to copy, in tiles, not pixels. - * @param {integer} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. - * @param {integer} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. + * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. + * @param {number} width - The width of the area to copy, in tiles, not pixels. + * @param {number} height - The height of the area to copy, in tiles, not pixels. + * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. + * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var Copy = function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer) { + if (recalculateFaces === undefined) { recalculateFaces = true; } + if (srcTileX < 0) { srcTileX = 0; } if (srcTileY < 0) { srcTileY = 0; } - if (recalculateFaces === undefined) { recalculateFaces = true; } var srcTiles = GetTilesWithin(srcTileX, srcTileY, width, height, null, layer); @@ -180376,7 +191179,7 @@ module.exports = Copy; /***/ }), -/* 1327 */ +/* 1394 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180385,10 +191188,8 @@ module.exports = Copy; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileToWorldX = __webpack_require__(151); -var TileToWorldY = __webpack_require__(152); -var GetTilesWithin = __webpack_require__(24); -var ReplaceByIndex = __webpack_require__(503); +var GetTilesWithin = __webpack_require__(26); +var ReplaceByIndex = __webpack_require__(521); /** * Creates a Sprite for every object matching the given tile indexes in the layer. You can @@ -180402,15 +191203,15 @@ var ReplaceByIndex = __webpack_require__(503); * @param {(number|number[])} indexes - The tile index, or array of indexes, to create Sprites from. * @param {(number|number[])} replacements - The tile index, or array of indexes, to change a converted tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a one-to-one mapping with the indexes array. * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). - * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when determining the world XY + * @param {Phaser.Scene} scene - The Scene to create the Sprites within. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when determining the world XY * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. */ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, camera, layer) { - if (spriteConfig === undefined) { spriteConfig = {}; } + if (!spriteConfig) { spriteConfig = {}; } if (!Array.isArray(indexes)) { @@ -180419,8 +191220,8 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came var tilemapLayer = layer.tilemapLayer; - if (scene === undefined) { scene = tilemapLayer.scene; } - if (camera === undefined) { camera = scene.cameras.main; } + if (!scene) { scene = tilemapLayer.scene; } + if (!camera) { camera = scene.cameras.main; } var tiles = GetTilesWithin(0, 0, layer.width, layer.height, null, layer); var sprites = []; @@ -180432,8 +191233,10 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came if (indexes.indexOf(tile.index) !== -1) { - spriteConfig.x = TileToWorldX(tile.x, camera, layer); - spriteConfig.y = TileToWorldY(tile.y, camera, layer); + var point = tilemapLayer.tileToWorldXY(tile.x, tile.y, undefined, camera,layer); + + spriteConfig.x = point.x; + spriteConfig.y = point.y; sprites.push(scene.make.sprite(spriteConfig)); } @@ -180463,7 +191266,7 @@ module.exports = CreateFromTiles; /***/ }), -/* 1328 */ +/* 1395 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180472,165 +191275,9 @@ module.exports = CreateFromTiles; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SnapFloor = __webpack_require__(95); -var SnapCeil = __webpack_require__(343); - -/** - * Returns the tiles in the given layer that are within the camera's viewport. This is used internally. - * - * @function Phaser.Tilemaps.Components.CullTiles - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. - * @param {array} [outputArray] - An optional array to store the Tile objects within. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ -var CullTiles = function (layer, camera, outputArray, renderOrder) -{ - if (outputArray === undefined) { outputArray = []; } - if (renderOrder === undefined) { renderOrder = 0; } - - outputArray.length = 0; - - var tilemap = layer.tilemapLayer.tilemap; - var tilemapLayer = layer.tilemapLayer; - - var mapData = layer.data; - var mapWidth = layer.width; - var mapHeight = layer.height; - - // We need to use the tile sizes defined for the map as a whole, not the layer, - // in order to calculate the bounds correctly. As different sized tiles may be - // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. - var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); - var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); - - var drawLeft = 0; - var drawRight = mapWidth; - var drawTop = 0; - var drawBottom = mapHeight; - - if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) - { - // Camera world view bounds, snapped for scaled tile size - // Cull Padding values are given in tiles, not pixels - - var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; - var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; - var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH, 0, true) - tilemapLayer.cullPaddingY; - var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH, 0, true) + tilemapLayer.cullPaddingY; - - drawLeft = Math.max(0, boundsLeft); - drawRight = Math.min(mapWidth, boundsRight); - drawTop = Math.max(0, boundsTop); - drawBottom = Math.min(mapHeight, boundsBottom); - } - - var x; - var y; - var tile; - - if (renderOrder === 0) - { - // right-down - - for (y = drawTop; y < drawBottom; y++) - { - for (x = drawLeft; mapData[y] && x < drawRight; x++) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - else if (renderOrder === 1) - { - // left-down - - for (y = drawTop; y < drawBottom; y++) - { - for (x = drawRight; mapData[y] && x >= drawLeft; x--) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - else if (renderOrder === 2) - { - // right-up - - for (y = drawBottom; y >= drawTop; y--) - { - for (x = drawLeft; mapData[y] && x < drawRight; x++) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - else if (renderOrder === 3) - { - // left-up - - for (y = drawBottom; y >= drawTop; y--) - { - for (x = drawRight; mapData[y] && x >= drawLeft; x--) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - - tilemapLayer.tilesDrawn = outputArray.length; - tilemapLayer.tilesTotal = mapWidth * mapHeight; - - return outputArray; -}; - -module.exports = CullTiles; - - -/***/ }), -/* 1329 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var GetTilesWithin = __webpack_require__(24); -var CalculateFacesWithin = __webpack_require__(53); -var SetTileCollision = __webpack_require__(65); +var GetTilesWithin = __webpack_require__(26); +var CalculateFacesWithin = __webpack_require__(60); +var SetTileCollision = __webpack_require__(69); /** * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the @@ -180640,11 +191287,11 @@ var SetTileCollision = __webpack_require__(65); * @function Phaser.Tilemaps.Components.Fill * @since 3.0.0 * - * @param {integer} index - The tile index to fill the area with. - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {number} index - The tile index to fill the area with. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The tile layer to use. If not given the current layer is used. */ @@ -180672,7 +191319,7 @@ module.exports = Fill; /***/ }), -/* 1330 */ +/* 1396 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180681,7 +191328,7 @@ module.exports = Fill; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given @@ -180694,15 +191341,12 @@ var GetTilesWithin = __webpack_require__(24); * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. The callback should return true for tiles that pass the * filter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} context - The context under which the callback should be run. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile[]} The filtered array of Tiles. @@ -180718,7 +191362,7 @@ module.exports = FilterTiles; /***/ }), -/* 1331 */ +/* 1397 */ /***/ (function(module, exports) { /** @@ -180737,10 +191381,9 @@ module.exports = FilterTiles; * @function Phaser.Tilemaps.Components.FindByIndex * @since 3.0.0 * - * @param {integer} index - The tile index value to search for. - * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. - * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the - * bottom-right. Otherwise it scans from the top-left. + * @param {number} index - The tile index value to search for. + * @param {number} skip - The number of times to skip a matching tile before returning. + * @param {boolean} reverse - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {?Phaser.Tilemaps.Tile} The first (or n skipped) tile with the matching index. @@ -180805,7 +191448,7 @@ module.exports = FindByIndex; /***/ }), -/* 1332 */ +/* 1398 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180814,13 +191457,13 @@ module.exports = FindByIndex; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * @callback FindTileCallback * * @param {Phaser.Tilemaps.Tile} value - The Tile. - * @param {integer} index - The index of the tile. + * @param {number} index - The index of the tile. * @param {Phaser.Tilemaps.Tile[]} array - An array of Tile objects. * * @return {boolean} Return `true` if the callback should run, otherwise `false`. @@ -180835,15 +191478,12 @@ var GetTilesWithin = __webpack_require__(24); * @since 3.0.0 * * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} context - The context under which the callback should be run. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {?Phaser.Tilemaps.Tile} A Tile that matches the search, or null if no Tile found @@ -180851,6 +191491,7 @@ var GetTilesWithin = __webpack_require__(24); var FindTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) { var tiles = GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); + return tiles.find(callback, context) || null; }; @@ -180858,7 +191499,7 @@ module.exports = FindTile; /***/ }), -/* 1333 */ +/* 1399 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180867,13 +191508,13 @@ module.exports = FindTile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * @callback EachTileCallback * * @param {Phaser.Tilemaps.Tile} value - The Tile. - * @param {integer} index - The index of the tile. + * @param {number} index - The index of the tile. * @param {Phaser.Tilemaps.Tile[]} array - An array of Tile objects. */ @@ -180885,15 +191526,12 @@ var GetTilesWithin = __webpack_require__(24); * @since 3.0.0 * * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} context - The context under which the callback should be run. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var ForEachTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) @@ -180907,7 +191545,7 @@ module.exports = ForEachTile; /***/ }), -/* 1334 */ +/* 1400 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180916,9 +191554,64 @@ module.exports = ForEachTile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTileAt = __webpack_require__(150); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var CONST = __webpack_require__(29); +var CullTiles = __webpack_require__(523); +var HexagonalCullTiles = __webpack_require__(524); +var IsometricCullTiles = __webpack_require__(526); +var NOOP = __webpack_require__(1); +var StaggeredCullTiles = __webpack_require__(527); + +/** + * Gets the correct function to use to cull tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetCullTilesFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to cull tiles for the given map type. + */ +var GetCullTilesFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return CullTiles; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalCullTiles; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredCullTiles; + } + else if (orientation === CONST.ISOMETRIC) + { + return IsometricCullTiles; + } + else + { + return NOOP; + } +}; + +module.exports = GetCullTilesFunction; + + +/***/ }), +/* 1401 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTileAt = __webpack_require__(151); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); /** * Gets a tile at the given world coordinates from the given layer. @@ -180928,26 +191621,24 @@ var WorldToTileY = __webpack_require__(67); * * @param {number} worldX - X position to get the tile from (given in pixels) * @param {number} worldY - Y position to get the tile from (given in pixels) - * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} nonNull - If true, function won't return null for empty tiles, but a Tile object with an index of -1. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates - * were invalid. + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. */ var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer) { - var tileX = WorldToTileX(worldX, true, camera, layer); - var tileY = WorldToTileY(worldY, true, camera, layer); + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera); - return GetTileAt(tileX, tileY, nonNull, layer); + return GetTileAt(point.x, point.y, nonNull, layer); }; module.exports = GetTileAtWorldXY; /***/ }), -/* 1335 */ +/* 1402 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180956,22 +191647,20 @@ module.exports = GetTileAtWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Geom = __webpack_require__(448); -var GetTilesWithin = __webpack_require__(24); -var Intersects = __webpack_require__(449); +var Geom = __webpack_require__(460); +var GetTilesWithin = __webpack_require__(26); +var Intersects = __webpack_require__(461); var NOOP = __webpack_require__(1); -var TileToWorldX = __webpack_require__(151); -var TileToWorldY = __webpack_require__(152); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var Vector2 = __webpack_require__(3); var TriangleToRectangle = function (triangle, rect) { return Intersects.RectangleToTriangle(rect, triangle); }; -// Note: Could possibly be optimized by copying the shape and shifting it into tilemapLayer -// coordinates instead of shifting the tiles. +var point = new Vector2(); +var pointStart = new Vector2(); +var pointEnd = new Vector2(); /** * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, @@ -180981,11 +191670,8 @@ var TriangleToRectangle = function (triangle, rect) * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. @@ -180997,45 +191683,40 @@ var GetTilesWithinShape = function (shape, filteringOptions, camera, layer) // intersectTest is a function with parameters: shape, rect var intersectTest = NOOP; - switch (typeof(shape)) + if (shape instanceof Geom.Circle) { - case Geom.Circle: - { - intersectTest = Intersects.CircleToRectangle; - break; - } - - case Geom.Rectangle: - { - intersectTest = Intersects.RectangleToRectangle; - break; - } - - case Geom.Triangle: - { - intersectTest = TriangleToRectangle; - break; - } - - case Geom.Line: - { - intersectTest = Intersects.LineToRectangle; - break; - } + intersectTest = Intersects.CircleToRectangle; + } + else if (shape instanceof Geom.Rectangle) + { + intersectTest = Intersects.RectangleToRectangle; + } + else if (shape instanceof Geom.Triangle) + { + intersectTest = TriangleToRectangle; + } + else if (shape instanceof Geom.Line) + { + intersectTest = Intersects.LineToRectangle; } // Top left corner of the shapes's bounding box, rounded down to include partial tiles - var xStart = WorldToTileX(shape.left, true, camera, layer); - var yStart = WorldToTileY(shape.top, true, camera, layer); + layer.tilemapLayer.worldToTileXY(shape.left, shape.top, true, pointStart, camera); + + var xStart = pointStart.x; + var yStart = pointStart.y; // Bottom right corner of the shapes's bounding box, rounded up to include partial tiles - var xEnd = Math.ceil(WorldToTileX(shape.right, false, camera, layer)); - var yEnd = Math.ceil(WorldToTileY(shape.bottom, false, camera, layer)); + layer.tilemapLayer.worldToTileXY(shape.right, shape.bottom, true, pointEnd, camera); + + var xEnd = Math.ceil(pointEnd.x); + var yEnd = Math.ceil(pointEnd.y); // Tiles within bounding rectangle of shape. Bounds are forced to be at least 1 x 1 tile in size // to grab tiles for shapes that don't have a height or width (e.g. a horizontal line). var width = Math.max(xEnd - xStart, 1); var height = Math.max(yEnd - yStart, 1); + var tiles = GetTilesWithin(xStart, yStart, width, height, filteringOptions, layer); var tileWidth = layer.tileWidth; @@ -181054,8 +191735,10 @@ var GetTilesWithinShape = function (shape, filteringOptions, camera, layer) { var tile = tiles[i]; - tileRect.x = TileToWorldX(tile.x, camera, layer); - tileRect.y = TileToWorldY(tile.y, camera, layer); + layer.tilemapLayer.tileToWorldXY(tile.x, tile.y, point, camera); + + tileRect.x = point.x; + tileRect.y = point.y; if (intersectTest(shape, tileRect)) { @@ -181070,7 +191753,7 @@ module.exports = GetTilesWithinShape; /***/ }), -/* 1336 */ +/* 1403 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181079,47 +191762,37 @@ module.exports = GetTilesWithinShape; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var CONST = __webpack_require__(29); +var NOOP = __webpack_require__(1); +var TileToWorldX = __webpack_require__(245); /** - * Gets the tiles in the given rectangular area (in world coordinates) of the layer. + * Gets the correct function to use to translate tiles, based on the map orientation. * - * @function Phaser.Tilemaps.Components.GetTilesWithinWorldXY - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.GetTileToWorldXFunction + * @since 3.50.0 * - * @param {number} worldX - The world x coordinate for the top-left of the area. - * @param {number} worldY - The world y coordinate for the top-left of the area. - * @param {number} width - The width of the area. - * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {number} orientation - The Tilemap orientation constant. * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + * @return {function} The function to use to translate tiles for the given map type. */ -var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer) +var GetTileToWorldXFunction = function (orientation) { - // Top left corner of the rect, rounded down to include partial tiles - var xStart = WorldToTileX(worldX, true, camera, layer); - var yStart = WorldToTileY(worldY, true, camera, layer); - - // Bottom right corner of the rect, rounded up to include partial tiles - var xEnd = Math.ceil(WorldToTileX(worldX + width, false, camera, layer)); - var yEnd = Math.ceil(WorldToTileY(worldY + height, false, camera, layer)); - - return GetTilesWithin(xStart, yStart, xEnd - xStart, yEnd - yStart, filteringOptions, layer); + if (orientation === CONST.ORTHOGONAL) + { + return TileToWorldX; + } + else + { + return NOOP; + } }; -module.exports = GetTilesWithinWorldXY; +module.exports = GetTileToWorldXFunction; /***/ }), -/* 1337 */ +/* 1404 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181128,9 +191801,255 @@ module.exports = GetTilesWithinWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HasTileAt = __webpack_require__(504); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var CONST = __webpack_require__(29); +var HexagonalTileToWorldXY = __webpack_require__(529); +var IsometricTileToWorldXY = __webpack_require__(530); +var NOOP = __webpack_require__(1); +var StaggeredTileToWorldXY = __webpack_require__(531); +var TileToWorldXY = __webpack_require__(532); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetTileToWorldXYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetTileToWorldXYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return TileToWorldXY; + } + else if (orientation === CONST.ISOMETRIC) + { + return IsometricTileToWorldXY; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalTileToWorldXY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredTileToWorldXY; + } + else + { + return NOOP; + } +}; + +module.exports = GetTileToWorldXYFunction; + + +/***/ }), +/* 1405 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(29); +var HexagonalTileToWorldY = __webpack_require__(533); +var NOOP = __webpack_require__(1); +var StaggeredTileToWorldY = __webpack_require__(534); +var TileToWorldY = __webpack_require__(246); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetTileToWorldYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetTileToWorldYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return TileToWorldY; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalTileToWorldY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredTileToWorldY; + } + else + { + return NOOP; + } +}; + +module.exports = GetTileToWorldYFunction; + + +/***/ }), +/* 1406 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(29); +var NOOP = __webpack_require__(1); +var WorldToTileX = __webpack_require__(247); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetWorldToTileXFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetWorldToTileXFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return WorldToTileX; + } + else + { + return NOOP; + } +}; + +module.exports = GetWorldToTileXFunction; + + +/***/ }), +/* 1407 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(29); +var HexagonalWorldToTileXY = __webpack_require__(535); +var IsometricWorldToTileXY = __webpack_require__(536); +var NOOP = __webpack_require__(1); +var StaggeredWorldToTileXY = __webpack_require__(537); +var WorldToTileXY = __webpack_require__(538); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetWorldToTileXYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetWorldToTileXYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return WorldToTileXY; + } + else if (orientation === CONST.ISOMETRIC) + { + return IsometricWorldToTileXY; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalWorldToTileXY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredWorldToTileXY; + } + else + { + return NOOP; + } +}; + +module.exports = GetWorldToTileXYFunction; + + +/***/ }), +/* 1408 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(29); +var HexagonalWorldToTileY = __webpack_require__(539); +var NOOP = __webpack_require__(1); +var StaggeredWorldToTileY = __webpack_require__(540); +var WorldToTileY = __webpack_require__(248); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetWorldToTileYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetWorldToTileYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return WorldToTileY; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalWorldToTileY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredWorldToTileY; + } + else + { + return NOOP; + } +}; + +module.exports = GetWorldToTileYFunction; + + +/***/ }), +/* 1409 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var HasTileAt = __webpack_require__(541); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); /** * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns @@ -181141,15 +192060,17 @@ var WorldToTileY = __webpack_require__(67); * * @param {number} worldX - The X coordinate of the world position. * @param {number} worldY - The Y coordinate of the world position. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when factoring in which tiles to return. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ var HasTileAtWorldXY = function (worldX, worldY, camera, layer) { - var tileX = WorldToTileX(worldX, true, camera, layer); - var tileY = WorldToTileY(worldY, true, camera, layer); + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera); + + var tileX = point.x; + var tileY = point.y; return HasTileAt(tileX, tileY, layer); }; @@ -181158,7 +192079,7 @@ module.exports = HasTileAtWorldXY; /***/ }), -/* 1338 */ +/* 1410 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181167,9 +192088,10 @@ module.exports = HasTileAtWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PutTileAt = __webpack_require__(236); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var PutTileAt = __webpack_require__(249); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); /** * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either @@ -181180,28 +192102,27 @@ var WorldToTileY = __webpack_require__(67); * @function Phaser.Tilemaps.Components.PutTileAtWorldXY * @since 3.0.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. */ var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer) { - var tileX = WorldToTileX(worldX, true, camera, layer); - var tileY = WorldToTileY(worldY, true, camera, layer); + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera, layer); - return PutTileAt(tile, tileX, tileY, recalculateFaces, layer); + return PutTileAt(tile, point.x, point.y, recalculateFaces, layer); }; module.exports = PutTileAtWorldXY; /***/ }), -/* 1339 */ +/* 1411 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181210,8 +192131,8 @@ module.exports = PutTileAtWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CalculateFacesWithin = __webpack_require__(53); -var PutTileAt = __webpack_require__(236); +var CalculateFacesWithin = __webpack_require__(60); +var PutTileAt = __webpack_require__(249); /** * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified @@ -181223,17 +192144,21 @@ var PutTileAt = __webpack_require__(236); * @function Phaser.Tilemaps.Components.PutTilesAt * @since 3.0.0 * - * @param {(integer[]|integer[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer) { - if (!Array.isArray(tilesArray)) { return null; } if (recalculateFaces === undefined) { recalculateFaces = true; } + if (!Array.isArray(tilesArray)) + { + return null; + } + // Force the input array to be a 2D array if (!Array.isArray(tilesArray[0])) { @@ -181264,7 +192189,7 @@ module.exports = PutTilesAt; /***/ }), -/* 1340 */ +/* 1412 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181273,8 +192198,8 @@ module.exports = PutTilesAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var GetRandom = __webpack_require__(196); +var GetTilesWithin = __webpack_require__(26); +var GetRandom = __webpack_require__(201); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -181286,20 +192211,20 @@ var GetRandom = __webpack_require__(196); * @function Phaser.Tilemaps.Components.Randomize * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {number[]} indexes - An array of indexes to randomly draw from during randomization. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var Randomize = function (tileX, tileY, width, height, indexes, layer) { var i; - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + var tiles = GetTilesWithin(tileX, tileY, width, height, {}, layer); // If no indices are given, then find all the unique indexes within the specified region - if (indexes === undefined) + if (!indexes) { indexes = []; @@ -181322,7 +192247,7 @@ module.exports = Randomize; /***/ }), -/* 1341 */ +/* 1413 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181331,9 +192256,10 @@ module.exports = Randomize; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RemoveTileAt = __webpack_require__(505); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var RemoveTileAt = __webpack_require__(542); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); /** * Removes the tile at the given world coordinates in the specified layer and updates the layer's @@ -181344,26 +192270,25 @@ var WorldToTileY = __webpack_require__(67); * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} replaceWithNull - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile} The Tile object that was removed. */ var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer) { - var tileX = WorldToTileX(worldX, true, camera, layer); - var tileY = WorldToTileY(worldY, true, camera, layer); + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera, layer); - return RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer); + return RemoveTileAt(point.x, point.y, replaceWithNull, recalculateFaces, layer); }; module.exports = RemoveTileAtWorldXY; /***/ }), -/* 1342 */ +/* 1414 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181372,8 +192297,8 @@ module.exports = RemoveTileAtWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var Color = __webpack_require__(364); +var GetTilesWithin = __webpack_require__(26); +var Color = __webpack_require__(373); var defaultTileColor = new Color(105, 210, 231, 150); var defaultCollidingTileColor = new Color(243, 134, 48, 200); @@ -181389,13 +192314,7 @@ var defaultFaceColor = new Color(40, 39, 37, 150); * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Phaser.Display.Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Phaser.Display.Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Phaser.Display.Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {Phaser.Types.Tilemaps.DebugStyleOptions} styleConfig - An object specifying the colors to use for the debug drawing. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var RenderDebug = function (graphics, styleConfig, layer) @@ -181451,7 +192370,7 @@ module.exports = RenderDebug; /***/ }), -/* 1343 */ +/* 1415 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181460,8 +192379,8 @@ module.exports = RenderDebug; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); var SetLayerCollisionIndex = __webpack_require__(153); /** @@ -181472,20 +192391,23 @@ var SetLayerCollisionIndex = __webpack_require__(153); * @function Phaser.Tilemaps.Components.SetCollision * @since 3.0.0 * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {boolean} updateLayer - If true, updates the current tiles on the layer. Set to - * false if no tiles have been placed for significant performance boost. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. */ var SetCollision = function (indexes, collides, recalculateFaces, layer, updateLayer) { if (collides === undefined) { collides = true; } if (recalculateFaces === undefined) { recalculateFaces = true; } - if (!Array.isArray(indexes)) { indexes = [ indexes ]; } if (updateLayer === undefined) { updateLayer = true; } + if (!Array.isArray(indexes)) + { + indexes = [ indexes ]; + } + // Update the array of colliding indexes for (var i = 0; i < indexes.length; i++) { @@ -181519,7 +192441,7 @@ module.exports = SetCollision; /***/ }), -/* 1344 */ +/* 1416 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181528,8 +192450,8 @@ module.exports = SetCollision; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); var SetLayerCollisionIndex = __webpack_require__(153); /** @@ -181541,13 +192463,12 @@ var SetLayerCollisionIndex = __webpack_require__(153); * @function Phaser.Tilemaps.Components.SetCollisionBetween * @since 3.0.0 * - * @param {integer} start - The first index of the tile to be set for collision. - * @param {integer} stop - The last index of the tile to be set for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {number} start - The first index of the tile to be set for collision. + * @param {number} stop - The last index of the tile to be set for collision. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to - * false if no tiles have been placed for significant performance boost. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. */ var SetCollisionBetween = function (start, stop, collides, recalculateFaces, layer, updateLayer) { @@ -181555,15 +192476,18 @@ var SetCollisionBetween = function (start, stop, collides, recalculateFaces, lay if (recalculateFaces === undefined) { recalculateFaces = true; } if (updateLayer === undefined) { updateLayer = true; } - if (start > stop) { return; } + if (start > stop) + { + return; + } - // Update the array of colliding indexes + // Update the array of colliding indexes for (var index = start; index <= stop; index++) { SetLayerCollisionIndex(index, collides, layer); } - // Update the tiles + // Update the tiles if (updateLayer) { for (var ty = 0; ty < layer.height; ty++) @@ -181593,7 +192517,7 @@ module.exports = SetCollisionBetween; /***/ }), -/* 1345 */ +/* 1417 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181602,8 +192526,8 @@ module.exports = SetCollisionBetween; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); var SetLayerCollisionIndex = __webpack_require__(153); /** @@ -181614,16 +192538,20 @@ var SetLayerCollisionIndex = __webpack_require__(153); * @function Phaser.Tilemaps.Components.SetCollisionByExclusion * @since 3.0.0 * - * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SetCollisionByExclusion = function (indexes, collides, recalculateFaces, layer) { if (collides === undefined) { collides = true; } if (recalculateFaces === undefined) { recalculateFaces = true; } - if (!Array.isArray(indexes)) { indexes = [ indexes ]; } + + if (!Array.isArray(indexes)) + { + indexes = [ indexes ]; + } // Note: this only updates layer.collideIndexes for tile indexes found currently in the layer for (var ty = 0; ty < layer.height; ty++) @@ -181631,6 +192559,7 @@ var SetCollisionByExclusion = function (indexes, collides, recalculateFaces, lay for (var tx = 0; tx < layer.width; tx++) { var tile = layer.data[ty][tx]; + if (tile && indexes.indexOf(tile.index) === -1) { SetTileCollision(tile, collides); @@ -181649,7 +192578,7 @@ module.exports = SetCollisionByExclusion; /***/ }), -/* 1346 */ +/* 1418 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181658,9 +192587,9 @@ module.exports = SetCollisionByExclusion; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); -var HasValue = __webpack_require__(115); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); +var HasValue = __webpack_require__(123); /** * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property @@ -181675,8 +192604,8 @@ var HasValue = __webpack_require__(115); * @since 3.0.0 * * @param {object} properties - An object with tile properties and corresponding values that should be checked. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SetCollisionByProperty = function (properties, collides, recalculateFaces, layer) @@ -181697,6 +192626,7 @@ var SetCollisionByProperty = function (properties, collides, recalculateFaces, l if (!HasValue(tile.properties, property)) { continue; } var values = properties[property]; + if (!Array.isArray(values)) { values = [ values ]; @@ -181723,7 +192653,7 @@ module.exports = SetCollisionByProperty; /***/ }), -/* 1347 */ +/* 1419 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181732,8 +192662,8 @@ module.exports = SetCollisionByProperty; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); /** * Sets collision on the tiles within a layer by checking each tile's collision group data @@ -181744,8 +192674,8 @@ var CalculateFacesWithin = __webpack_require__(53); * @function Phaser.Tilemaps.Components.SetCollisionFromCollisionGroup * @since 3.0.0 * - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SetCollisionFromCollisionGroup = function (collides, recalculateFaces, layer) @@ -181782,7 +192712,7 @@ module.exports = SetCollisionFromCollisionGroup; /***/ }), -/* 1348 */ +/* 1420 */ /***/ (function(module, exports) { /** @@ -181800,7 +192730,7 @@ module.exports = SetCollisionFromCollisionGroup; * @function Phaser.Tilemaps.Components.SetTileIndexCallback * @since 3.0.0 * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. @@ -181828,7 +192758,7 @@ module.exports = SetTileIndexCallback; /***/ }), -/* 1349 */ +/* 1421 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181837,7 +192767,7 @@ module.exports = SetTileIndexCallback; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. @@ -181847,10 +192777,10 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.SetTileLocationCallback * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. @@ -181869,7 +192799,7 @@ module.exports = SetTileLocationCallback; /***/ }), -/* 1350 */ +/* 1422 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181878,8 +192808,8 @@ module.exports = SetTileLocationCallback; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var ShuffleArray = __webpack_require__(121); +var GetTilesWithin = __webpack_require__(26); +var ShuffleArray = __webpack_require__(127); /** * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given @@ -181890,10 +192820,10 @@ var ShuffleArray = __webpack_require__(121); * @function Phaser.Tilemaps.Components.Shuffle * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var Shuffle = function (tileX, tileY, width, height, layer) @@ -181914,7 +192844,7 @@ module.exports = Shuffle; /***/ }), -/* 1351 */ +/* 1423 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181923,7 +192853,7 @@ module.exports = Shuffle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -181933,12 +192863,12 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.SwapByIndex * @since 3.0.0 * - * @param {integer} tileA - First tile index. - * @param {integer} tileB - Second tile index. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileA - First tile index. + * @param {number} tileB - Second tile index. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SwapByIndex = function (indexA, indexB, tileX, tileY, width, height, layer) @@ -181965,7 +192895,7 @@ module.exports = SwapByIndex; /***/ }), -/* 1352 */ +/* 1424 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181974,50 +192904,7 @@ module.exports = SwapByIndex; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileToWorldX = __webpack_require__(151); -var TileToWorldY = __webpack_require__(152); -var Vector2 = __webpack_require__(3); - -/** - * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @function Phaser.Tilemaps.Components.TileToWorldXY - * @since 3.0.0 - * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Math.Vector2} The XY location in world coordinates. - */ -var TileToWorldXY = function (tileX, tileY, point, camera, layer) -{ - if (point === undefined) { point = new Vector2(0, 0); } - - point.x = TileToWorldX(tileX, camera, layer); - point.y = TileToWorldY(tileY, camera, layer); - - return point; -}; - -module.exports = TileToWorldXY; - - -/***/ }), -/* 1353 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -182037,23 +192924,24 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.WeightedRandomize * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {object[]} weightedIndexes - An array of objects to randomly draw from during * randomization. They should be in the form: { index: 0, weight: 4 } or * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var WeightedRandomize = function (tileX, tileY, width, height, weightedIndexes, layer) { - if (weightedIndexes === undefined) { return; } + if (!weightedIndexes) { return; } var i; var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); var weightTotal = 0; + for (i = 0; i < weightedIndexes.length; i++) { weightTotal += weightedIndexes[i].weight; @@ -182090,51 +192978,7 @@ module.exports = WeightedRandomize; /***/ }), -/* 1354 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); -var Vector2 = __webpack_require__(3); - -/** - * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @function Phaser.Tilemaps.Components.WorldToTileXY - * @since 3.0.0 - * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Math.Vector2} The XY location in tile units. - */ -var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) -{ - if (point === undefined) { point = new Vector2(0, 0); } - - point.x = WorldToTileX(worldX, snapToFloor, camera, layer); - point.y = WorldToTileY(worldY, snapToFloor, camera, layer); - - return point; -}; - -module.exports = WorldToTileXY; - - -/***/ }), -/* 1355 */ +/* 1425 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -182149,18 +192993,18 @@ module.exports = WorldToTileXY; module.exports = { - Parse: __webpack_require__(506), - Parse2DArray: __webpack_require__(237), - ParseCSV: __webpack_require__(507), + Parse: __webpack_require__(543), + Parse2DArray: __webpack_require__(250), + ParseCSV: __webpack_require__(544), - Impact: __webpack_require__(1356), - Tiled: __webpack_require__(1357) + Impact: __webpack_require__(1426), + Tiled: __webpack_require__(1427) }; /***/ }), -/* 1356 */ +/* 1426 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -182175,15 +193019,15 @@ module.exports = { module.exports = { - ParseTileLayers: __webpack_require__(520), - ParseTilesets: __webpack_require__(521), - ParseWeltmeister: __webpack_require__(519) + ParseTileLayers: __webpack_require__(557), + ParseTilesets: __webpack_require__(558), + ParseWeltmeister: __webpack_require__(556) }; /***/ }), -/* 1357 */ +/* 1427 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -182198,23 +193042,23 @@ module.exports = { module.exports = { - AssignTileProperties: __webpack_require__(518), - Base64Decode: __webpack_require__(510), - BuildTilesetIndex: __webpack_require__(517), + AssignTileProperties: __webpack_require__(546), + Base64Decode: __webpack_require__(553), + BuildTilesetIndex: __webpack_require__(547), CreateGroupLayer: __webpack_require__(154), - ParseGID: __webpack_require__(238), - ParseImageLayers: __webpack_require__(511), - ParseJSONTiled: __webpack_require__(508), - ParseObject: __webpack_require__(239), - ParseObjectLayers: __webpack_require__(515), - ParseTileLayers: __webpack_require__(509), - ParseTilesets: __webpack_require__(512) + ParseGID: __webpack_require__(252), + ParseImageLayers: __webpack_require__(548), + ParseJSONTiled: __webpack_require__(545), + ParseObject: __webpack_require__(251), + ParseObjectLayers: __webpack_require__(549), + ParseTileLayers: __webpack_require__(552), + ParseTilesets: __webpack_require__(554) }; /***/ }), -/* 1358 */ +/* 1428 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -182228,12 +193072,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1359); + renderWebGL = __webpack_require__(1429); } if (true) { - renderCanvas = __webpack_require__(1360); + renderCanvas = __webpack_require__(1430); } module.exports = { @@ -182245,7 +193089,7 @@ module.exports = { /***/ }), -/* 1359 */ +/* 1429 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -182254,27 +193098,25 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. * This method should not be called directly. It is a utility function of the Render module. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#renderWebGL + * @method Phaser.Tilemaps.TilemapLayer#renderWebGL * @since 3.0.0 * @private * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.Tilemaps.DynamicTilemapLayer} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Tilemaps.TilemapLayer} src - The Game Object being rendered in this call. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ -var DynamicTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera) +var TilemapLayerWebGLRenderer = function (renderer, src, camera) { - src.cull(camera); + var renderTiles = src.cull(camera); - var renderTiles = src.culledTiles; var tileCount = renderTiles.length; var alpha = camera.alpha * src.alpha; @@ -182284,9 +193126,9 @@ var DynamicTilemapLayerWebGLRenderer = function (renderer, src, interpolationPer } var gidMap = src.gidMap; - var pipeline = renderer.pipelines.set(src.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline, src); - var getTint = Utils.getTintAppendFloatAlphaAndSwap; + var getTint = Utils.getTintAppendFloatAlpha; var scrollFactorX = src.scrollFactorX; var scrollFactorY = src.scrollFactorY; @@ -182297,75 +193139,66 @@ var DynamicTilemapLayerWebGLRenderer = function (renderer, src, interpolationPer var sx = src.scaleX; var sy = src.scaleY; - var tilesets = src.tileset; + renderer.pipelines.preBatch(src); - // Loop through each tileset in this layer, drawing just the tiles that are in that set each time - // Doing it this way around allows us to batch tiles using the same tileset - for (var c = 0; c < tilesets.length; c++) + for (var i = 0; i < tileCount; i++) { - var currentSet = tilesets[c]; - var texture = currentSet.glTexture; + var tile = renderTiles[i]; + + var tileset = gidMap[tile.index]; + + var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); + + if (tileTexCoords === null) + { + continue; + } + + var texture = tileset.glTexture; + var textureUnit = pipeline.setTexture2D(texture, src); - for (var i = 0; i < tileCount; i++) - { - var tile = renderTiles[i]; + var frameWidth = tileset.tileWidth; + var frameHeight = tileset.tileHeight; - var tileset = gidMap[tile.index]; + var frameX = tileTexCoords.x; + var frameY = tileTexCoords.y; - if (tileset !== currentSet) - { - // Skip tiles that aren't in this set - continue; - } + var tw = tileset.tileWidth * 0.5; + var th = tileset.tileHeight * 0.5; - var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); + var tint = getTint(tile.tint, alpha * tile.alpha); - if (tileTexCoords === null) - { - continue; - } - - var frameWidth = tile.width; - var frameHeight = tile.height; - - var frameX = tileTexCoords.x; - var frameY = tileTexCoords.y; - - var tw = tile.width * 0.5; - var th = tile.height * 0.5; - - var tint = getTint(tile.tint, alpha * tile.alpha); - - pipeline.batchTexture( - src, - texture, - texture.width, texture.height, - x + ((tw + tile.pixelX) * sx), y + ((th + tile.pixelY) * sy), - tile.width, tile.height, - sx, sy, - tile.rotation, - tile.flipX, tile.flipY, - scrollFactorX, scrollFactorY, - tw, th, - frameX, frameY, frameWidth, frameHeight, - tint, tint, tint, tint, false, - 0, 0, - camera, - null, - true, - textureUnit - ); - } + pipeline.batchTexture( + src, + texture, + texture.width, texture.height, + x + ((tw + tile.pixelX) * sx), y + ((th + tile.pixelY) * sy), + tile.width, tile.height, + sx, sy, + tile.rotation, + tile.flipX, tile.flipY, + scrollFactorX, scrollFactorY, + tw, th, + frameX, frameY, frameWidth, frameHeight, + tint, tint, tint, tint, false, + 0, 0, + camera, + null, + true, + textureUnit + ); } + + renderer.pipelines.postBatch(src); }; -module.exports = DynamicTilemapLayerWebGLRenderer; +module.exports = TilemapLayerWebGLRenderer; /***/ }), -/* 1360 */ -/***/ (function(module, exports) { +/* 1430 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -182373,36 +193206,41 @@ module.exports = DynamicTilemapLayerWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var TransformMatrix = __webpack_require__(24); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); + /** * Renders this Game Object with the Canvas Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. * This method should not be called directly. It is a utility function of the Render module. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#renderCanvas - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#renderCanvas + * @since 3.50.0 * @private * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.Tilemaps.DynamicTilemapLayer} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Tilemaps.TilemapLayer} src - The Game Object being rendered in this call. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var DynamicTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TilemapLayerCanvasRenderer = function (renderer, src, camera, parentMatrix) { - src.cull(camera); + var renderTiles = src.cull(camera); - var renderTiles = src.culledTiles; var tileCount = renderTiles.length; + var alpha = camera.alpha * src.alpha; - if (tileCount === 0) + if (tileCount === 0 || alpha <= 0) { return; } - var camMatrix = renderer._tempMatrix1; - var layerMatrix = renderer._tempMatrix2; - var calcMatrix = renderer._tempMatrix3; + var camMatrix = tempMatrix1; + var layerMatrix = tempMatrix2; + var calcMatrix = tempMatrix3; layerMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); @@ -182435,8 +193273,6 @@ var DynamicTilemapLayerCanvasRenderer = function (renderer, src, interpolationPe layerMatrix.copyToContext(ctx); } - var alpha = camera.alpha * src.alpha; - if (!renderer.antialias || src.scaleX > 1 || src.scaleY > 1) { ctx.imageSmoothingEnabled = false; @@ -182458,482 +193294,9 @@ var DynamicTilemapLayerCanvasRenderer = function (renderer, src, interpolationPe if (tileTexCoords) { - var halfWidth = tile.width / 2; - var halfHeight = tile.height / 2; - - ctx.save(); + var halfWidth = tileset.tileWidth / 2; + var halfHeight = tileset.tileHeight / 2; - ctx.translate(tile.pixelX + halfWidth, tile.pixelY + halfHeight); - - if (tile.rotation !== 0) - { - ctx.rotate(tile.rotation); - } - - if (tile.flipX || tile.flipY) - { - ctx.scale((tile.flipX) ? -1 : 1, (tile.flipY) ? -1 : 1); - } - - ctx.globalAlpha = alpha * tile.alpha; - - ctx.drawImage( - image, - tileTexCoords.x, tileTexCoords.y, - tile.width, tile.height, - -halfWidth, -halfHeight, - tile.width, tile.height - ); - - ctx.restore(); - } - } - - ctx.restore(); -}; - -module.exports = DynamicTilemapLayerCanvasRenderer; - - -/***/ }), -/* 1361 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); - -if (true) -{ - renderWebGL = __webpack_require__(1362); -} - -if (true) -{ - renderCanvas = __webpack_require__(1368); -} - -module.exports = { - - renderWebGL: renderWebGL, - renderCanvas: renderCanvas - -}; - - -/***/ }), -/* 1362 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Identity = __webpack_require__(1363); -var Scale = __webpack_require__(1365); -var Translate = __webpack_require__(1366); -var ViewLoad2D = __webpack_require__(1367); - -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * A Static Tilemap Layer renders immediately and does not use any batching. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.Tilemaps.StaticTilemapLayer} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera) -{ - var gl = renderer.gl; - var pipeline = src.pipeline; - - renderer.flush(); - - // Restore when we're done - var pipelineVertexBuffer = pipeline.vertexBuffer; - - Identity(src); - Translate(src, src.x - (camera.scrollX * src.scrollFactorX), src.y - (camera.scrollY * src.scrollFactorY), 0); - Scale(src, src.scaleX, src.scaleY, 1); - ViewLoad2D(src, camera.matrix.matrix); - - renderer.pipelines.set(pipeline); - - // The above alters the uniforms, so make sure we call it _after_ setting the MVP stuff above - renderer.setMatrix4(pipeline.program, 'uModelMatrix', false, src.modelMatrix); - renderer.setMatrix4(pipeline.program, 'uViewMatrix', false, src.viewMatrix); - renderer.setMatrix4(pipeline.program, 'uProjectionMatrix', false, pipeline.projectionMatrix); - - for (var i = 0; i < src.tileset.length; i++) - { - var tileset = src.tileset[i]; - var vertexCount = src.vertexCount[i]; - - src.upload(camera, i); - - if (vertexCount > 0) - { - if (pipeline.forceZero) - { - // Light Pipeline, or similar - pipeline.setGameObject(src, tileset); - } - else - { - renderer.setTextureZero(tileset.glTexture); - } - - gl.drawArrays(gl.TRIANGLES, 0, vertexCount); - } - } - - renderer.resetTextures(); - - // Restore the pipeline buffer - pipeline.vertexBuffer = pipelineVertexBuffer; - - renderer.currentVertexBuffer = pipelineVertexBuffer; - - pipeline.setAttribPointers(); - - // Reset the uniforms - renderer.setMatrix4(pipeline.program, 'uModelMatrix', false, pipeline.modelMatrix); - renderer.setMatrix4(pipeline.program, 'uViewMatrix', false, pipeline.viewMatrix); - renderer.setMatrix4(pipeline.program, 'uProjectionMatrix', false, pipeline.projectionMatrix); -}; - -module.exports = StaticTilemapLayerWebGLRenderer; - - -/***/ }), -/* 1363 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var SetIdentity = __webpack_require__(1364); - -/** - * Loads an identity matrix into the model matrix. - * - * @method Phaser.Renderer.WebGL.MVP.Identity - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. - */ -var Identity = function (model) -{ - SetIdentity(model.modelMatrix); - - model.modelMatrixDirty = true; - - return model; -}; - -module.exports = Identity; - - -/***/ }), -/* 1364 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Loads an identity matrix into the model matrix. - * - * @method Phaser.Renderer.WebGL.MVP.SetIdentity - * @since 3.50.0 - * - * @param {Float32Array} array - The array to set to be an identity matrix. - */ -var SetIdentity = function (array) -{ - array[0] = 1; - array[1] = 0; - array[2] = 0; - array[3] = 0; - array[4] = 0; - array[5] = 1; - array[6] = 0; - array[7] = 0; - array[8] = 0; - array[9] = 0; - array[10] = 1; - array[11] = 0; - array[12] = 0; - array[13] = 0; - array[14] = 0; - array[15] = 1; -}; - -module.exports = SetIdentity; - - -/***/ }), -/* 1365 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Scales the model matrix by the given values. - * - * @method Phaser.Renderer.WebGL.MVP.Scale - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. - */ -var Scale = function (model, x, y, z) -{ - var modelMatrix = model.modelMatrix; - - modelMatrix[0] = modelMatrix[0] * x; - modelMatrix[1] = modelMatrix[1] * x; - modelMatrix[2] = modelMatrix[2] * x; - modelMatrix[3] = modelMatrix[3] * x; - modelMatrix[4] = modelMatrix[4] * y; - modelMatrix[5] = modelMatrix[5] * y; - modelMatrix[6] = modelMatrix[6] * y; - modelMatrix[7] = modelMatrix[7] * y; - modelMatrix[8] = modelMatrix[8] * z; - modelMatrix[9] = modelMatrix[9] * z; - modelMatrix[10] = modelMatrix[10] * z; - modelMatrix[11] = modelMatrix[11] * z; - - model.modelMatrixDirty = true; - - return model; -}; - -module.exports = Scale; - - -/***/ }), -/* 1366 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Translates the model matrix by the given values. - * - * @method Phaser.Renderer.WebGL.MVP.Translate - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. - */ -var Translate = function (model, x, y, z) -{ - var modelMatrix = model.modelMatrix; - - modelMatrix[12] = modelMatrix[0] * x + modelMatrix[4] * y + modelMatrix[8] * z + modelMatrix[12]; - modelMatrix[13] = modelMatrix[1] * x + modelMatrix[5] * y + modelMatrix[9] * z + modelMatrix[13]; - modelMatrix[14] = modelMatrix[2] * x + modelMatrix[6] * y + modelMatrix[10] * z + modelMatrix[14]; - modelMatrix[15] = modelMatrix[3] * x + modelMatrix[7] * y + modelMatrix[11] * z + modelMatrix[15]; - - model.modelMatrixDirty = true; - - return model; -}; - -module.exports = Translate; - - -/***/ }), -/* 1367 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Loads a 2D view matrix (3x2 matrix) into a 4x4 view matrix. - * - * @method Phaser.Renderer.WebGL.MVP.ViewLoad2D - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * @param {Float32Array} matrix2D - The Matrix2D. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. - */ -var ViewLoad2D = function (model, matrix2D) -{ - var vm = model.viewMatrix; - - vm[0] = matrix2D[0]; - vm[1] = matrix2D[1]; - vm[2] = 0; - vm[3] = 0; - vm[4] = matrix2D[2]; - vm[5] = matrix2D[3]; - vm[6] = 0; - vm[7] = 0; - vm[8] = matrix2D[4]; - vm[9] = matrix2D[5]; - vm[10] = 1; - vm[11] = 0; - vm[12] = 0; - vm[13] = 0; - vm[14] = 0; - vm[15] = 1; - - model.viewMatrixDirty = true; - - return model; -}; - -module.exports = ViewLoad2D; - - -/***/ }), -/* 1368 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.Tilemaps.StaticTilemapLayer} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) -{ - src.cull(camera); - - var renderTiles = src.culledTiles; - var tileCount = renderTiles.length; - - if (tileCount === 0) - { - return; - } - - var camMatrix = renderer._tempMatrix1; - var layerMatrix = renderer._tempMatrix2; - var calcMatrix = renderer._tempMatrix3; - - layerMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - var ctx = renderer.currentContext; - var gidMap = src.gidMap; - - ctx.save(); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - layerMatrix.e = src.x; - layerMatrix.f = src.y; - - camMatrix.multiply(layerMatrix, calcMatrix); - - calcMatrix.copyToContext(ctx); - } - else - { - // Undo the camera scroll - layerMatrix.e -= camera.scrollX * src.scrollFactorX; - layerMatrix.f -= camera.scrollY * src.scrollFactorY; - - layerMatrix.copyToContext(ctx); - } - - var alpha = camera.alpha * src.alpha; - - if (!renderer.antialias || src.scaleX > 1 || src.scaleY > 1) - { - ctx.imageSmoothingEnabled = false; - } - - for (var i = 0; i < tileCount; i++) - { - var tile = renderTiles[i]; - - var tileset = gidMap[tile.index]; - - if (!tileset) - { - continue; - } - - var image = tileset.image.getSourceImage(); - var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); - - if (tileTexCoords) - { - var tileWidth = tileset.tileWidth; - var tileHeight = tileset.tileHeight; - var halfWidth = tileWidth / 2; - var halfHeight = tileHeight / 2; - ctx.save(); ctx.translate(tile.pixelX + halfWidth, tile.pixelY + halfHeight); @@ -182942,22 +193305,22 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer { ctx.rotate(tile.rotation); } - + if (tile.flipX || tile.flipY) { ctx.scale((tile.flipX) ? -1 : 1, (tile.flipY) ? -1 : 1); } ctx.globalAlpha = alpha * tile.alpha; - + ctx.drawImage( image, tileTexCoords.x, tileTexCoords.y, - tileWidth, tileHeight, + tileset.tileWidth , tileset.Height, -halfWidth, -halfHeight, - tileWidth, tileHeight + tileset.tileWidth , tileset.tileHeight ); - + ctx.restore(); } } @@ -182965,11 +193328,11 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer ctx.restore(); }; -module.exports = StaticTilemapLayerCanvasRenderer; +module.exports = TilemapLayerCanvasRenderer; /***/ }), -/* 1369 */ +/* 1431 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -182978,8 +193341,8 @@ module.exports = StaticTilemapLayerCanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var ParseToTilemap = __webpack_require__(240); +var GameObjectCreator = __webpack_require__(17); +var ParseToTilemap = __webpack_require__(253); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -183013,7 +193376,7 @@ GameObjectCreator.register('tilemap', function (config) /***/ }), -/* 1370 */ +/* 1432 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -183023,7 +193386,7 @@ GameObjectCreator.register('tilemap', function (config) */ var GameObjectFactory = __webpack_require__(5); -var ParseToTilemap = __webpack_require__(240); +var ParseToTilemap = __webpack_require__(253); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -183035,15 +193398,15 @@ var ParseToTilemap = __webpack_require__(240); * @since 3.0.0 * * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. - * @param {integer} [tileWidth=32] - The width of a tile in pixels. Pass in `null` to leave as the + * @param {number} [tileWidth=32] - The width of a tile in pixels. Pass in `null` to leave as the * default. - * @param {integer} [tileHeight=32] - The height of a tile in pixels. Pass in `null` to leave as the + * @param {number} [tileHeight=32] - The height of a tile in pixels. Pass in `null` to leave as the * default. - * @param {integer} [width=10] - The width of the map in tiles. Pass in `null` to leave as the + * @param {number} [width=10] - The width of the map in tiles. Pass in `null` to leave as the * default. - * @param {integer} [height=10] - The height of the map in tiles. Pass in `null` to leave as the + * @param {number} [height=10] - The height of the map in tiles. Pass in `null` to leave as the * default. - * @param {integer[][]} [data] - Instead of loading from the cache, you can also load directly from + * @param {number[][]} [data] - Instead of loading from the cache, you can also load directly from * a 2D array of tile indexes. Pass in `null` for no data. * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty @@ -183079,7 +193442,7 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt /***/ }), -/* 1371 */ +/* 1433 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -183094,14 +193457,14 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt module.exports = { - Clock: __webpack_require__(1372), - TimerEvent: __webpack_require__(525) + Clock: __webpack_require__(1434), + TimerEvent: __webpack_require__(561) }; /***/ }), -/* 1372 */ +/* 1434 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -183111,10 +193474,10 @@ module.exports = { */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); -var TimerEvent = __webpack_require__(525); -var Remove = __webpack_require__(96); +var TimerEvent = __webpack_require__(561); +var Remove = __webpack_require__(87); /** * @classdesc @@ -183276,7 +193639,7 @@ var Clock = new Class({ { var event; - if (config instanceof Phaser.Time.TimerEvent) + if (config instanceof TimerEvent) { event = config; @@ -183557,7 +193920,7 @@ module.exports = Clock; /***/ }), -/* 1373 */ +/* 1435 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -183566,8 +193929,8 @@ module.exports = Clock; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(91); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(96); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Tweens @@ -183575,13 +193938,13 @@ var Extend = __webpack_require__(19); var Tweens = { - Builders: __webpack_require__(1374), - Events: __webpack_require__(245), + Builders: __webpack_require__(1436), + Events: __webpack_require__(258), - TweenManager: __webpack_require__(1390), - Tween: __webpack_require__(244), - TweenData: __webpack_require__(246), - Timeline: __webpack_require__(531) + TweenManager: __webpack_require__(1452), + Tween: __webpack_require__(257), + TweenData: __webpack_require__(259), + Timeline: __webpack_require__(567) }; @@ -183592,7 +193955,7 @@ module.exports = Tweens; /***/ }), -/* 1374 */ +/* 1436 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -183607,23 +193970,23 @@ module.exports = Tweens; module.exports = { - GetBoolean: __webpack_require__(90), - GetEaseFunction: __webpack_require__(71), + GetBoolean: __webpack_require__(95), + GetEaseFunction: __webpack_require__(78), GetNewValue: __webpack_require__(155), - GetProps: __webpack_require__(526), - GetTargets: __webpack_require__(241), - GetTweens: __webpack_require__(527), - GetValueOp: __webpack_require__(242), - NumberTweenBuilder: __webpack_require__(528), - StaggerBuilder: __webpack_require__(529), - TimelineBuilder: __webpack_require__(530), + GetProps: __webpack_require__(562), + GetTargets: __webpack_require__(254), + GetTweens: __webpack_require__(563), + GetValueOp: __webpack_require__(255), + NumberTweenBuilder: __webpack_require__(564), + StaggerBuilder: __webpack_require__(565), + TimelineBuilder: __webpack_require__(566), TweenBuilder: __webpack_require__(156) }; /***/ }), -/* 1375 */ +/* 1437 */ /***/ (function(module, exports) { /** @@ -183701,7 +194064,7 @@ module.exports = [ /***/ }), -/* 1376 */ +/* 1438 */ /***/ (function(module, exports) { /** @@ -183737,7 +194100,7 @@ module.exports = 'complete'; /***/ }), -/* 1377 */ +/* 1439 */ /***/ (function(module, exports) { /** @@ -183774,7 +194137,7 @@ module.exports = 'loop'; /***/ }), -/* 1378 */ +/* 1440 */ /***/ (function(module, exports) { /** @@ -183811,7 +194174,7 @@ module.exports = 'pause'; /***/ }), -/* 1379 */ +/* 1441 */ /***/ (function(module, exports) { /** @@ -183848,7 +194211,7 @@ module.exports = 'resume'; /***/ }), -/* 1380 */ +/* 1442 */ /***/ (function(module, exports) { /** @@ -183884,7 +194247,7 @@ module.exports = 'start'; /***/ }), -/* 1381 */ +/* 1443 */ /***/ (function(module, exports) { /** @@ -183921,7 +194284,7 @@ module.exports = 'update'; /***/ }), -/* 1382 */ +/* 1444 */ /***/ (function(module, exports) { /** @@ -183961,7 +194324,7 @@ module.exports = 'active'; /***/ }), -/* 1383 */ +/* 1445 */ /***/ (function(module, exports) { /** @@ -184002,7 +194365,7 @@ module.exports = 'complete'; /***/ }), -/* 1384 */ +/* 1446 */ /***/ (function(module, exports) { /** @@ -184046,7 +194409,7 @@ module.exports = 'loop'; /***/ }), -/* 1385 */ +/* 1447 */ /***/ (function(module, exports) { /** @@ -184091,7 +194454,7 @@ module.exports = 'repeat'; /***/ }), -/* 1386 */ +/* 1448 */ /***/ (function(module, exports) { /** @@ -184131,7 +194494,7 @@ module.exports = 'start'; /***/ }), -/* 1387 */ +/* 1449 */ /***/ (function(module, exports) { /** @@ -184167,7 +194530,7 @@ module.exports = 'stop'; /***/ }), -/* 1388 */ +/* 1450 */ /***/ (function(module, exports) { /** @@ -184210,7 +194573,7 @@ module.exports = 'update'; /***/ }), -/* 1389 */ +/* 1451 */ /***/ (function(module, exports) { /** @@ -184256,7 +194619,7 @@ module.exports = 'yoyo'; /***/ }), -/* 1390 */ +/* 1452 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -184265,14 +194628,14 @@ module.exports = 'yoyo'; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayRemove = __webpack_require__(96); +var ArrayRemove = __webpack_require__(87); var Class = __webpack_require__(0); -var NumberTweenBuilder = __webpack_require__(528); -var PluginCache = __webpack_require__(23); +var NumberTweenBuilder = __webpack_require__(564); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); -var StaggerBuilder = __webpack_require__(529); -var TimelineBuilder = __webpack_require__(530); -var TWEEN_CONST = __webpack_require__(91); +var StaggerBuilder = __webpack_require__(565); +var TimelineBuilder = __webpack_require__(566); +var TWEEN_CONST = __webpack_require__(96); var TweenBuilder = __webpack_require__(156); /** @@ -184366,7 +194729,7 @@ var TweenManager = new Class({ * The number of Tweens and Timelines which need to be processed by the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_toProcess - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -185045,7 +195408,7 @@ module.exports = TweenManager; /***/ }), -/* 1391 */ +/* 1453 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185060,17 +195423,17 @@ module.exports = TweenManager; module.exports = { - Array: __webpack_require__(194), - Base64: __webpack_require__(1392), - Objects: __webpack_require__(1394), - String: __webpack_require__(1398), + Array: __webpack_require__(199), + Base64: __webpack_require__(1454), + Objects: __webpack_require__(1456), + String: __webpack_require__(1460), NOOP: __webpack_require__(1) }; /***/ }), -/* 1392 */ +/* 1454 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185085,14 +195448,14 @@ module.exports = { module.exports = { - ArrayBufferToBase64: __webpack_require__(1393), - Base64ToArrayBuffer: __webpack_require__(400) + ArrayBufferToBase64: __webpack_require__(1455), + Base64ToArrayBuffer: __webpack_require__(410) }; /***/ }), -/* 1393 */ +/* 1455 */ /***/ (function(module, exports) { /** @@ -185150,7 +195513,7 @@ module.exports = ArrayBufferToBase64; /***/ }), -/* 1394 */ +/* 1456 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185165,26 +195528,27 @@ module.exports = ArrayBufferToBase64; module.exports = { - Clone: __webpack_require__(69), - Extend: __webpack_require__(19), + Clone: __webpack_require__(76), + DeepCopy: __webpack_require__(167), + Extend: __webpack_require__(18), GetAdvancedValue: __webpack_require__(15), GetFastValue: __webpack_require__(2), - GetMinMaxValue: __webpack_require__(1395), + GetMinMaxValue: __webpack_require__(1457), GetValue: __webpack_require__(6), - HasAll: __webpack_require__(1396), - HasAny: __webpack_require__(422), - HasValue: __webpack_require__(115), + HasAll: __webpack_require__(1458), + HasAny: __webpack_require__(432), + HasValue: __webpack_require__(123), IsPlainObject: __webpack_require__(7), - Merge: __webpack_require__(134), - MergeRight: __webpack_require__(1397), - Pick: __webpack_require__(514), - SetValue: __webpack_require__(445) + Merge: __webpack_require__(140), + MergeRight: __webpack_require__(1459), + Pick: __webpack_require__(550), + SetValue: __webpack_require__(455) }; /***/ }), -/* 1395 */ +/* 1457 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185194,7 +195558,7 @@ module.exports = { */ var GetValue = __webpack_require__(6); -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); /** * Retrieves and clamps a numerical value from an object. @@ -185223,7 +195587,7 @@ module.exports = GetMinMaxValue; /***/ }), -/* 1396 */ +/* 1458 */ /***/ (function(module, exports) { /** @@ -185260,7 +195624,7 @@ module.exports = HasAll; /***/ }), -/* 1397 */ +/* 1459 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185269,7 +195633,7 @@ module.exports = HasAll; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Creates a new Object using all values from obj1. @@ -185303,7 +195667,7 @@ module.exports = MergeRight; /***/ }), -/* 1398 */ +/* 1460 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185318,18 +195682,18 @@ module.exports = MergeRight; module.exports = { - Format: __webpack_require__(1399), - Pad: __webpack_require__(173), - RemoveAt: __webpack_require__(1400), - Reverse: __webpack_require__(1401), - UppercaseFirst: __webpack_require__(191), - UUID: __webpack_require__(207) + Format: __webpack_require__(1461), + Pad: __webpack_require__(178), + RemoveAt: __webpack_require__(1462), + Reverse: __webpack_require__(1463), + UppercaseFirst: __webpack_require__(196), + UUID: __webpack_require__(213) }; /***/ }), -/* 1399 */ +/* 1461 */ /***/ (function(module, exports) { /** @@ -185364,7 +195728,7 @@ module.exports = Format; /***/ }), -/* 1400 */ +/* 1462 */ /***/ (function(module, exports) { /** @@ -185400,7 +195764,7 @@ module.exports = RemoveAt; /***/ }), -/* 1401 */ +/* 1463 */ /***/ (function(module, exports) { /** @@ -185429,7 +195793,7 @@ module.exports = Reverse; /***/ }), -/* 1402 */ +/* 1464 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185445,79 +195809,81 @@ module.exports = Reverse; module.exports = { - SoundManagerCreator: __webpack_require__(393), + SoundManagerCreator: __webpack_require__(403), - Events: __webpack_require__(61), + Events: __webpack_require__(66), - BaseSound: __webpack_require__(136), - BaseSoundManager: __webpack_require__(135), + BaseSound: __webpack_require__(142), + BaseSoundManager: __webpack_require__(141), - WebAudioSound: __webpack_require__(401), - WebAudioSoundManager: __webpack_require__(399), + WebAudioSound: __webpack_require__(411), + WebAudioSoundManager: __webpack_require__(409), - HTML5AudioSound: __webpack_require__(396), - HTML5AudioSoundManager: __webpack_require__(394), + HTML5AudioSound: __webpack_require__(406), + HTML5AudioSoundManager: __webpack_require__(404), - NoAudioSound: __webpack_require__(398), - NoAudioSoundManager: __webpack_require__(397) + NoAudioSound: __webpack_require__(408), + NoAudioSoundManager: __webpack_require__(407) }; /***/ }), -/* 1403 */, -/* 1404 */, -/* 1405 */, -/* 1406 */, -/* 1407 */, -/* 1408 */, -/* 1409 */, -/* 1410 */, -/* 1411 */, -/* 1412 */, -/* 1413 */, -/* 1414 */, -/* 1415 */, -/* 1416 */, -/* 1417 */, -/* 1418 */, -/* 1419 */, -/* 1420 */, -/* 1421 */, -/* 1422 */, -/* 1423 */, -/* 1424 */, -/* 1425 */, -/* 1426 */, -/* 1427 */, -/* 1428 */, -/* 1429 */, -/* 1430 */, -/* 1431 */, -/* 1432 */, -/* 1433 */, -/* 1434 */, -/* 1435 */, -/* 1436 */, -/* 1437 */, -/* 1438 */, -/* 1439 */, -/* 1440 */, -/* 1441 */, -/* 1442 */, -/* 1443 */, -/* 1444 */, -/* 1445 */, -/* 1446 */, -/* 1447 */, -/* 1448 */, -/* 1449 */, -/* 1450 */, -/* 1451 */, -/* 1452 */, -/* 1453 */, -/* 1454 */, -/* 1455 */ +/* 1465 */, +/* 1466 */, +/* 1467 */, +/* 1468 */, +/* 1469 */, +/* 1470 */, +/* 1471 */, +/* 1472 */, +/* 1473 */, +/* 1474 */, +/* 1475 */, +/* 1476 */, +/* 1477 */, +/* 1478 */, +/* 1479 */, +/* 1480 */, +/* 1481 */, +/* 1482 */, +/* 1483 */, +/* 1484 */, +/* 1485 */, +/* 1486 */, +/* 1487 */, +/* 1488 */, +/* 1489 */, +/* 1490 */, +/* 1491 */, +/* 1492 */, +/* 1493 */, +/* 1494 */, +/* 1495 */, +/* 1496 */, +/* 1497 */, +/* 1498 */, +/* 1499 */, +/* 1500 */, +/* 1501 */, +/* 1502 */, +/* 1503 */, +/* 1504 */, +/* 1505 */, +/* 1506 */, +/* 1507 */, +/* 1508 */, +/* 1509 */, +/* 1510 */, +/* 1511 */, +/* 1512 */, +/* 1513 */, +/* 1514 */, +/* 1515 */, +/* 1516 */, +/* 1517 */, +/* 1518 */, +/* 1519 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** @@ -185526,10 +195892,10 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -__webpack_require__(547); +__webpack_require__(586); -var CONST = __webpack_require__(34); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(39); +var Extend = __webpack_require__(18); /** * @namespace Phaser @@ -185544,37 +195910,37 @@ var Extend = __webpack_require__(19); var Phaser = { - Actions: __webpack_require__(252), - Animations: __webpack_require__(651), - Cache: __webpack_require__(663), - Cameras: __webpack_require__(666), - Core: __webpack_require__(754), + Actions: __webpack_require__(267), + Animations: __webpack_require__(691), + Cache: __webpack_require__(703), + Cameras: __webpack_require__(706), + Core: __webpack_require__(795), Class: __webpack_require__(0), - Create: __webpack_require__(819), - Curves: __webpack_require__(825), - Data: __webpack_require__(827), - Display: __webpack_require__(829), - DOM: __webpack_require__(847), - Events: __webpack_require__(848), - Game: __webpack_require__(850), - GameObjects: __webpack_require__(940), - Geom: __webpack_require__(448), - Input: __webpack_require__(1224), - Loader: __webpack_require__(1257), - Math: __webpack_require__(180), + Create: __webpack_require__(874), + Curves: __webpack_require__(880), + Data: __webpack_require__(882), + Display: __webpack_require__(884), + DOM: __webpack_require__(903), + Events: __webpack_require__(904), + Game: __webpack_require__(906), + GameObjects: __webpack_require__(996), + Geom: __webpack_require__(460), + Input: __webpack_require__(1288), + Loader: __webpack_require__(1318), + Math: __webpack_require__(185), Physics: { - Arcade: __webpack_require__(1283) + Arcade: __webpack_require__(1346) }, - Plugins: __webpack_require__(1317), - Scale: __webpack_require__(1319), - Scene: __webpack_require__(385), - Scenes: __webpack_require__(1320), - Structs: __webpack_require__(1322), - Textures: __webpack_require__(1323), - Tilemaps: __webpack_require__(1325), - Time: __webpack_require__(1371), - Tweens: __webpack_require__(1373), - Utils: __webpack_require__(1391) + Plugins: __webpack_require__(1383), + Scale: __webpack_require__(1385), + Scene: __webpack_require__(395), + Scenes: __webpack_require__(1386), + Structs: __webpack_require__(1388), + Textures: __webpack_require__(1389), + Tilemaps: __webpack_require__(1391), + Time: __webpack_require__(1433), + Tweens: __webpack_require__(1435), + Utils: __webpack_require__(1453) }; @@ -185584,7 +195950,7 @@ Phaser = Extend(false, Phaser, CONST); if (true) { - Phaser.Sound = __webpack_require__(1402); + Phaser.Sound = __webpack_require__(1464); } // Export it @@ -185599,7 +195965,7 @@ global.Phaser = Phaser; * -- Dick Brandon */ -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(546))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(585))) /***/ }) /******/ ]); diff --git a/dist/phaser-arcade-physics.min.js b/dist/phaser-arcade-physics.min.js index d24227804..60e304209 100644 --- a/dist/phaser-arcade-physics.min.js +++ b/dist/phaser-arcade-physics.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Phaser",[],e):"object"==typeof exports?exports.Phaser=e():t.Phaser=e()}(window,function(){return n={},s.m=i=[function(t,e){function r(t,e,i,n){for(var s in e)if(e.hasOwnProperty(s)){var r=(u=e,l=s,f=d=void 0,f=(c=i)?u[l]:Object.getOwnPropertyDescriptor(u,l),!c&&f.value&&"object"==typeof f.value&&(f=f.value),!(!f||!((d=f).get&&"function"==typeof d.get||d.set&&"function"==typeof d.set))&&(void 0===f.enumerable&&(f.enumerable=!0),void 0===f.configurable&&(f.configurable=!0),f));if(!1!==r){if(o=(n||t).prototype,a=s,h=void 0,(h=Object.getOwnPropertyDescriptor(o,a))&&(h.value&&"object"==typeof h.value&&(h=h.value),!1===h.configurable)){if(p.ignoreFinals)continue;throw new Error("cannot override final property '"+s+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,s,r)}else t.prototype[s]=e[s]}var o,a,h,u,l,c,d,f}function o(t,e){if(e){Array.isArray(e)||(e=[e]);for(var i=0;i=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=l},function(t,e){t.exports={getTintFromFloats:function(t,e,i,n){return((255&(255*n|0))<<24|(255&(255*t|0))<<16|(255&(255*e|0))<<8|255&(255*i|0))>>>0},getTintAppendFloatAlpha:function(t,e){return((255&(255*e|0))<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255&(255*e|0))<<24|(255&(0|t))<<16|(255&(t>>8|0))<<8|255&(t>>16|0))>>>0},getFloatsFromUintRGB:function(t){return[(255&(t>>16|0))/255,(255&(t>>8|0))/255,(255&(0|t))/255]},getComponentCount:function(t,e){for(var i=0,n=0;nr.width&&(i=Math.max(r.width-t,0)),e+n>r.height&&(n=Math.max(r.height-e,0));for(var u=[],l=e;lthis.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=u},function(t,e,i){var n=i(13);t.exports=function(t){return t*n.DEG_TO_RAD}},function(t,e,i){t.exports={DESTROY:i(671),FADE_IN_COMPLETE:i(672),FADE_IN_START:i(673),FADE_OUT_COMPLETE:i(674),FADE_OUT_START:i(675),FLASH_COMPLETE:i(676),FLASH_START:i(677),PAN_COMPLETE:i(678),PAN_START:i(679),POST_RENDER:i(680),PRE_RENDER:i(681),ROTATE_COMPLETE:i(682),ROTATE_START:i(683),SHAKE_COMPLETE:i(684),SHAKE_START:i(685),ZOOM_COMPLETE:i(686),ZOOM_START:i(687)}},function(t,e){t.exports=function(t,e,i,n){var s=i||e.fillColor,r=n||e.fillAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.fillStyle="rgba("+o+","+a+","+h+","+r+")"}},,function(t,e){t.exports=function(t,e){return t.y=e+t.height*t.originY,t}},function(t,e){t.exports=function(t,e){return t.x=e+t.width*t.originX,t}},function(t,e){t.exports=function(t,e){return t.x=e-t.width+t.width*t.originX,t}},function(t,e){t.exports=function(t,e){return t.y=e-t.height+t.height*t.originY,t}},function(t,e){t.exports={CIRCLE:0,ELLIPSE:1,LINE:2,POINT:3,POLYGON:4,RECTANGLE:5,TRIANGLE:6}},function(t,e){t.exports=function(t,e,i){return!(t.width<=0||t.height<=0)&&(t.x<=e&&t.x+t.width>=e&&t.y<=i&&t.y+t.height>=i)}},function(t,e){t.exports=function(t,e,i,n){var s=i||e.strokeColor,r=n||e.strokeAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth}},function(t,e){t.exports={DYNAMIC_BODY:0,STATIC_BODY:1,GROUP:2,TILEMAPLAYER:3,FACING_NONE:10,FACING_UP:11,FACING_DOWN:12,FACING_LEFT:13,FACING_RIGHT:14}},function(t,e,i){var d=i(150),f=i(24);t.exports=function(t,e,i,n,s){for(var r,o,a,h,u=f(t,e,i,n,null,s),l=0;l=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},function(t,e){t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},function(t,e){t.exports=function(t,e,i){var n=i-e;return e+((t-e)%n+n)%n}},function(t,e,i){"use strict";function n(t,e,i){i=i||2;var n,s,r,o,a,h,u,l=e&&e.length,c=l?e[0]*i:t.length,d=g(t,0,c,i,!0),f=[];if(!d||d.next===d.prev)return f;if(l&&(d=function(t,e,i,n){var s,r,o,a,h,u=[];for(s=0,r=e.length;s=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&o=n.x&&n.x>=l&&s!==n.x&&T(ri.x||n.x===i.x&&function(t,e){return w(t.prev,t,e.prev)<0&&w(e.next,t,t.next)<0}(i,n)))&&(i=n,d=h)),n=n.next,n!==u;);return i}(t,e))&&(i=_(e,t),v(e,e.next),v(i,i.next))}}(u[s],i),i=v(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=r=t[0],s=o=t[1];for(var p=i;pr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,l=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=x(a,h,e,i,n),d=x(u,l,e,i,n),f=t.prevZ,p=t.nextZ;for(;f&&f.z>=c&&p&&p.z<=d;){if(f!==t.prev&&f!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=w(f.prev,f,f.next))return!1;if(f=f.prevZ,p!==t.prev&&p!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&0<=w(p.prev,p,p.next))return!1;p=p.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=w(f.prev,f,f.next))return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&0<=w(p.prev,p,p.next))return!1;p=p.nextZ}return!0}(t,n,s,r):function(t){var e=t.prev,i=t,n=t.next;if(0<=w(e,i,n))return!1;var s=t.next.next;for(;s!==t.prev;){if(T(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&0<=w(s.prev,s,s.next))return!1;s=s.next}return!0}(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),d(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?m(t=function(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!l(s,r)&&c(s,n,n.next,r)&&E(s,r)&&E(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),d(n),d(n.next),n=t=r),n=n.next}while(n!==t);return v(n)}(v(t),e,i),e,i,n,s,r,2):2===o&&function(t,e,i,n,s,r){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&c(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(E(t,e)&&E(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;for(;i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next,i!==t;);return n}(t,e)&&(w(t.prev,t,e.prev)||w(t,e.prev,e))||l(t,e)&&0=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function u(t){return 0=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t;this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e=0,e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t;this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e=0,e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t;this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=l},function(t,e,i){var n=i(0),s=i(18),c=i(22),r=i(8),d=i(2),f=i(7),o=new n({Extends:c,initialize:function t(e,i,n,s,r){var o,a,h="png";f(i)&&(i=d(a=i,"key"),n=d(a,"url"),o=d(a,"normalMap"),s=d(a,"xhrSettings"),h=d(a,"extension",h),r=d(a,"frameConfig")),Array.isArray(n)&&(o=n[1],n=n[0]);var u,l={type:"image",cache:e.textureManager,extension:h,responseType:"blob",key:i,url:n,xhrSettings:s,config:r};c.call(this,e,l),o&&((u=new t(e,this.key,o,s,r)).type="normalMap",this.setLink(u),e.addFile(u))},onProcess:function(){this.state=s.FILE_PROCESSING,this.data=new Image,this.data.crossOrigin=this.crossOrigin;var t=this;this.data.onload=function(){c.revokeObjectURL(t.data),t.onProcessComplete()},this.data.onerror=function(){c.revokeObjectURL(t.data),t.onProcessError()},c.createObjectURL(this.data,this.xhrLoader.response,"image/png")},addToCache:function(){var t,e=this.linkFile;e&&e.state===s.FILE_COMPLETE?(t="image"===this.type?this.cache.addImage(this.key,this.data,e.data):this.cache.addImage(e.key,e.data,this.data),this.pendingDestroy(t),e.pendingDestroy(t)):e||(t=this.cache.addImage(this.key,this.data),this.pendingDestroy(t))}});r.register("image",function(t,e,i){if(Array.isArray(t))for(var n=0;nthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*e.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new r),e.x=this.getLeft(),e.y=this.getTop(),e.width=this.getRight()-e.x,e.height=this.getBottom()-e.y,e},getCenterX:function(t){return(this.getLeft(t)+this.getRight(t))/2},getCenterY:function(t){return(this.getTop(t)+this.getBottom(t))/2},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},intersects:function(t,e,i,n){return!(i<=this.pixelX||n<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){return void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,n,s){return void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=t),void 0===s&&(s=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n,s&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,n){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==n&&(this.baseHeight=n),this.updatePixelXY(),this},updatePixelXY:function(){return this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight,this},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=o},function(t,e,i){var r=i(157),n=i(0),s=i(11),o=i(14),a=i(29),h=i(991),u=new n({Extends:o,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScrollFactor,s.Size,s.TextureCrop,s.Tint,s.Transform,s.Visible,h],initialize:function(t,e,i,n,s){o.call(this,t,"Sprite"),this._crop=this.resetCropObject(),this.anims=new r(this),this.setTexture(n,s),this.setPosition(e,i),this.setSizeToFrame(),this.setOriginFromFrame(),this.initPipeline(),this.on(a.ADDED_TO_SCENE,this.addedToScene,this),this.on(a.REMOVED_FROM_SCENE,this.removedFromScene,this)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},preUpdate:function(t,e){this.anims.update(t,e)},play:function(t,e){return this.anims.play(t,e)},playReverse:function(t,e){return this.anims.playReverse(t,e)},playAfterDelay:function(t,e){return this.anims.playAfterDelay(t,e)},playAfterRepeat:function(t,e){return this.anims.playAfterRepeat(t,e)},chain:function(t){return this.anims.chain(t)},stop:function(){return this.anims.stop()},stopAfterDelay:function(t){return this.anims.stopAfterDelay(t)},stopAfterRepeat:function(t){return this.anims.stopAfterRepeat(t)},stopOnFrame:function(t){return this.anims.stopOnFrame(t)},toJSON:function(){return s.ToJSON(this)},preDestroy:function(){this.anims.destroy(),this.anims=void 0}});t.exports=u},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e){t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},function(t,e){t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i){this.x=0,this.y=0,this.z=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0)},up:function(){return this.x=0,this.y=1,this.z=0,this},clone:function(){return new n(this.x,this.y,this.z)},crossVectors:function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=n*a-s*o,this.y=s*r-i*a,this.z=i*o-n*r,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},set:function(t,e,i){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return Math.sqrt(e*e+i*i+n*n)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return e*e+i*i+n*n},length:function(){var t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)},lengthSq:function(){var t=this.x,e=this.y,i=this.z;return t*t+e*e+i*i},normalize:function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return 0=t.length)){for(var i=t.length-1,n=t[e],s=e;sh||a.y>u)?(l=Math.max(a.x,e),c=Math.max(a.y,i),E=d=Math.min(a.r,h)-l,_=f=Math.min(a.b,u)-c,T=r?p+(v-(l-a.x)-d):p+(l-a.x),w=o?g+(m-(c-a.y)-f):g+(c-a.y),e=l,i=c,n=d,s=f):_=E=w=T=0):(r&&(T=p+(v-e-n)),o&&(w=g+(m-i-s)));var S=this.source.width,A=this.source.height;return t.u0=Math.max(0,T/S),t.v0=Math.max(0,w/A),t.u1=Math.min(1,(T+E)/S),t.v1=Math.min(1,(w+_)/A),t.x=e,t.y=i,t.cx=T,t.cy=w,t.cw=E,t.ch=_,t.width=n,t.height=s,t.flipX=r,t.flipY=o,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},setUVs:function(t,e,i,n,s,r){var o=this.data.drawImage;return o.width=t,o.height=e,this.u0=i,this.v0=n,this.u1=s,this.v1=r,this},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new r(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=s(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.source=null,this.texture=null,this.glTexture=null,this.customData=null,this.data=null},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=r},function(t,e,i){var n=i(0),s=i(99),r=i(412),o=i(413),a=i(49),h=i(167),u=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.type=a.ELLIPSE,this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return h(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.width=0,this.height=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getMinorRadius:function(){return Math.min(this.width,this.height)/2},getMajorRadius:function(){return Math.max(this.width,this.height)/2},left:{get:function(){return this.x-this.width/2},set:function(t){this.x=t+this.width/2}},right:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},top:{get:function(){return this.y-this.height/2},set:function(t){this.y=t+this.height/2}},bottom:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=u},function(t,e){t.exports=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var n=(e-t.x)/t.width,s=(i-t.y)/t.height;return(n*=n)+(s*=s)<.25}},function(t,e,i){var U=i(252),n=i(0),r=i(29),s=i(193),z=i(2),G=i(6),o=i(7),W=i(404),a=i(141),h=i(76),u=new n({initialize:function(t,e,i){i?e&&!Array.isArray(e)&&(e=[e]):Array.isArray(e)?o(e[0])&&(i=e,e=null):o(e)&&(i=e,e=null),this.scene=t,this.children=new a,this.isParent=!0,this.type="Group",this.classType=z(i,"classType",h),this.name=z(i,"name",""),this.active=z(i,"active",!0),this.maxSize=z(i,"maxSize",-1),this.defaultKey=z(i,"defaultKey",null),this.defaultFrame=z(i,"defaultFrame",null),this.runChildUpdate=z(i,"runChildUpdate",!1),this.createCallback=z(i,"createCallback",null),this.removeCallback=z(i,"removeCallback",null),this.createMultipleCallback=z(i,"createMultipleCallback",null),this.internalCreateCallback=z(i,"internalCreateCallback",null),this.internalRemoveCallback=z(i,"internalRemoveCallback",null),e&&this.addMultiple(e),i&&this.createMultiple(i)},create:function(t,e,i,n,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.defaultKey),void 0===n&&(n=this.defaultFrame),void 0===s&&(s=!0),void 0===r&&(r=!0),this.isFull())return null;var o=new this.classType(this.scene,t,e,i,n);return this.scene.sys.displayList.add(o),o.preUpdate&&this.scene.sys.updateList.add(o),o.visible=s,o.setActive(r),this.add(o),o},createMultiple:function(t){if(this.isFull())return[];Array.isArray(t)||(t=[t]);var e=[];if(t[0].key)for(var i=0;i=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;i=this.firstgid&&t=this.vertexCapacity},resize:function(t,e,i){return this.width=t*i,this.height=e*i,this.resolution=i,this},bind:function(t){void 0===t&&(t=!1);var e=this.vertexBuffer,i=this.program,n=this.renderer;return n.setProgram(i),n.setVertexBuffer(e),this.setAttribPointers(t),this},setAttribPointers:function(t){void 0===t&&(t=!1);for(var e=this.gl,i=this.attributes,n=this.vertexSize,s=this.program,r=0;rthis.vertexCapacity&&this.flush();var N=this.setGameObject(t),Y=t._isTinted&&t.tintFill;this.batchQuad(A,C,M,O,R,P,L,D,u,l,c,d,F,k,I,B,Y,h,N)},batchQuad:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g,v,m,y){void 0===y&&(y=this.currentUnit);var x=!1;this.vertexCount+6>this.vertexCapacity&&(this.flush(),x=!0,y=this.setTexture2D(m));var T=this.vertexViewF32,w=this.vertexViewU32,E=this.vertexCount*this.vertexComponentCount-1;return T[++E]=t,T[++E]=e,T[++E]=h,T[++E]=u,T[++E]=y,T[++E]=v,w[++E]=d,T[++E]=i,T[++E]=n,T[++E]=h,T[++E]=c,T[++E]=y,T[++E]=v,w[++E]=p,T[++E]=s,T[++E]=r,T[++E]=l,T[++E]=c,T[++E]=y,T[++E]=v,w[++E]=g,T[++E]=t,T[++E]=e,T[++E]=h,T[++E]=u,T[++E]=y,T[++E]=v,w[++E]=d,T[++E]=s,T[++E]=r,T[++E]=l,T[++E]=c,T[++E]=y,T[++E]=v,w[++E]=g,T[++E]=o,T[++E]=a,T[++E]=l,T[++E]=u,T[++E]=y,T[++E]=v,w[++E]=f,this.vertexCount+=6,x},batchTri:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g){void 0===g&&(g=this.currentUnit);var v=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),v=!0,g=this.setTexture2D(p));var m=this.vertexViewF32,y=this.vertexViewU32,x=this.vertexCount*this.vertexComponentCount-1;return m[++x]=t,m[++x]=e,m[++x]=o,m[++x]=a,m[++x]=g,m[++x]=f,y[++x]=l,m[++x]=i,m[++x]=n,m[++x]=o,m[++x]=u,m[++x]=g,m[++x]=f,y[++x]=c,m[++x]=s,m[++x]=r,m[++x]=h,m[++x]=u,m[++x]=g,m[++x]=f,y[++x]=d,this.vertexCount+=3,v},batchTexture:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g,v,m,y,x,T,w,E,_,b,S,A,C,M,O,R,P){this.renderer.pipelines.set(this,t);var L,D,F,k=this._tempMatrix1,I=this._tempMatrix2,B=this._tempMatrix3,N=m/i+A,Y=y/n+C,X=(m+x)/i+A,U=(y+T)/n+C,z=o,G=a,W=-g,V=-v;t.isCropped&&(z=(L=t._crop).width,G=L.height,o=L.width,a=L.height,D=m=L.x,F=y=L.y,c&&(D=x-L.x-L.width),d&&!e.isRenderTexture&&(F=T-L.y-L.height),N=D/i+A,Y=F/n+C,X=(D+L.width)/i+A,U=(F+L.height)/n+C,W=-g+m,V=-v+y),c&&(z*=-1,W+=o),(d^=!R&&e.isRenderTexture?1:0)&&(G*=-1,V+=a);var H=W+z,j=V+G;I.applyITRS(s,r,l,h,u),k.copyFrom(M.matrix),O?(k.multiplyWithOffset(O,-M.scrollX*f,-M.scrollY*p),I.e=s,I.f=r):(I.e-=M.scrollX*f,I.f-=M.scrollY*p),k.multiply(I,B);var K=B.getX(W,V),q=B.getY(W,V),Z=B.getX(W,j),J=B.getY(W,j),Q=B.getX(H,j),$=B.getY(H,j),tt=B.getX(H,V),et=B.getY(H,V);M.roundPixels&&(K=Math.round(K),q=Math.round(q),Z=Math.round(Z),J=Math.round(J),Q=Math.round(Q),$=Math.round($),tt=Math.round(tt),et=Math.round(et)),void 0===P&&(P=this.renderer.setTexture2D(e)),this.batchQuad(K,q,Z,J,Q,$,tt,et,N,Y,X,U,w,E,_,b,S,e,P)},batchTextureFrame:function(t,e,i,n,s,r,o){this.renderer.pipelines.set(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,u=e+t.width,l=i+t.height;o?a.multiply(o,h):h=a;var c=h.getX(e,i),d=h.getY(e,i),f=h.getX(e,l),p=h.getY(e,l),g=h.getX(u,l),v=h.getY(u,l),m=h.getX(u,i),y=h.getY(u,i),x=this.renderer.setTextureSource(t.source);n=X.getTintAppendFloatAlpha(n,s),this.batchQuad(c,d,f,p,g,v,m,y,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0,t.glTexture,x)},drawFillRect:function(t,e,i,n,s,r){t=Math.floor(t),e=Math.floor(e);var o=Math.floor(t+i),a=Math.floor(e+n),h=this.renderer.blankTexture.glTexture,u=this.renderer.setTexture2D(h),l=X.getTintAppendFloatAlphaAndSwap(s,r);this.batchQuad(t,e,t,a,o,a,o,e,0,0,1,1,l,l,l,l,2,h,u)},batchFillRect:function(t,e,i,n,s,r){this.renderer.pipelines.set(this);var o=this._tempMatrix3;r&&r.multiply(s,o);var a=t+i,h=e+n,u=o.getX(t,e),l=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),f=o.getX(a,h),p=o.getY(a,h),g=o.getX(a,e),v=o.getY(a,e),m=this.currentFrame,y=m.u0,x=m.v0,T=m.u1,w=m.v1,E=this.fillTint;this.batchQuad(u,l,c,d,f,p,g,v,y,x,T,w,E.TL,E.TR,E.BL,E.BR,this.tintEffect)},batchFillTriangle:function(t,e,i,n,s,r,o,a){this.renderer.pipelines.set(this);var h=this._tempMatrix3;a&&a.multiply(o,h);var u=h.getX(t,e),l=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),f=h.getX(s,r),p=h.getY(s,r),g=this.currentFrame,v=g.u0,m=g.v0,y=g.u1,x=g.v1;this.batchTri(u,l,c,d,f,p,v,m,y,x,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.tintEffect)},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h){var u=this.tempTriangle;u[0].x=t,u[0].y=e,u[0].width=o,u[1].x=i,u[1].y=n,u[1].width=o,u[2].x=s,u[2].y=r,u[2].width=o,u[3].x=t,u[3].y=e,u[3].width=o,this.batchStrokePath(u,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.pipelines.set(this);var n=this._tempMatrix3;i&&i.multiply(e,n);for(var s,r,o=t.length,a=this.polygonCache,h=this.fillTint.TL,u=this.fillTint.TR,l=this.fillTint.BL,c=this.tintEffect,d=0;d>16)+(65280&t)+((255&t)<<16)}},function(t,e,i){var n=i(0),a=i(293),s=new n({initialize:function(t,e){this.parent=t,(this.events=e)||(this.events=t.events?t.events:t),this.list={},this.values={},this._frozen=!1,!t.hasOwnProperty("sys")&&this.events&&this.events.once("destroy",this.destroy,this)},get:function(t){var e=this.list;if(Array.isArray(t)){for(var i=[],n=0;ne.right||t.y>e.bottom)}},function(t,e,i){var u=i(6),l={},n={register:function(t,e,i,n,s){l[t]={plugin:e,mapping:i,settingsKey:n,configKey:s}},getPlugin:function(t){return l[t]},install:function(t){var e=t.scene.sys,i=e.settings.input,n=e.game.config;for(var s in l){var r=l[s].plugin,o=l[s].mapping,a=l[s].settingsKey,h=l[s].configKey;u(i,a,n[h])&&(t[o]=new r(t))}},remove:function(t){l.hasOwnProperty(t)&&delete l[t]}};t.exports=n},function(t,e,i){t.exports={ANY_KEY_DOWN:i(1239),ANY_KEY_UP:i(1240),COMBO_MATCH:i(1241),DOWN:i(1242),KEY_DOWN:i(1243),KEY_UP:i(1244),UP:i(1245)}},function(t,e){t.exports=function(t,e){return!!t.url&&(t.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)?t.url:e+t.url)}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===t&&(t=""),void 0===e&&(e=!0),void 0===i&&(i=""),void 0===n&&(n=""),void 0===s&&(s=0),void 0===r&&(r=!1),{responseType:t,async:e,user:i,password:n,timeout:s,headers:void 0,header:void 0,headerValue:void 0,requestedWith:!1,overrideMimeType:void 0,withCredentials:r}}},function(t,e,i){var n=i(0),s=i(228),r=i(76),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s),this.body=null}});t.exports=o},function(t,e,i){t.exports={CalculateFacesAt:i(235),CalculateFacesWithin:i(53),Copy:i(1326),CreateFromTiles:i(1327),CullTiles:i(1328),Fill:i(1329),FilterTiles:i(1330),FindByIndex:i(1331),FindTile:i(1332),ForEachTile:i(1333),GetTileAt:i(150),GetTileAtWorldXY:i(1334),GetTilesWithin:i(24),GetTilesWithinShape:i(1335),GetTilesWithinWorldXY:i(1336),HasTileAt:i(504),HasTileAtWorldXY:i(1337),IsInLayerBounds:i(104),PutTileAt:i(236),PutTileAtWorldXY:i(1338),PutTilesAt:i(1339),Randomize:i(1340),RemoveTileAt:i(505),RemoveTileAtWorldXY:i(1341),RenderDebug:i(1342),ReplaceByIndex:i(503),SetCollision:i(1343),SetCollisionBetween:i(1344),SetCollisionByExclusion:i(1345),SetCollisionByProperty:i(1346),SetCollisionFromCollisionGroup:i(1347),SetLayerCollisionIndex:i(153),SetTileCollision:i(65),SetTileIndexCallback:i(1348),SetTileLocationCallback:i(1349),Shuffle:i(1350),SwapByIndex:i(1351),TileToWorldX:i(151),TileToWorldXY:i(1352),TileToWorldY:i(152),WeightedRandomize:i(1353),WorldToTileX:i(66),WorldToTileXY:i(1354),WorldToTileY:i(67)}},function(t,e,i){var r=i(104);t.exports=function(t,e,i,n){if(void 0===i&&(i=!1),r(t,e,n)){var s=n.data[e][t]||null;return null!==s&&(-1!==s.index||i)?s:null}return null}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileWidth,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.x+e.scrollX*(1-s.scrollFactorX),n*=s.scaleX),r+t*n}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileHeight,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.y+e.scrollY*(1-s.scrollFactorY),n*=s.scaleY),r+t*n}},function(t,e){t.exports=function(t,e,i){var n=i.collideIndexes.indexOf(t);e&&-1===n?i.collideIndexes.push(t):e||-1===n||i.collideIndexes.splice(n,1)}},function(t,e,i){var r=i(2);t.exports=function(t,e,i){if(!e)return{i:0,layers:t.layers,name:"",opacity:1,visible:!0,x:0,y:0};var n=e.x+r(e,"startx",0)*t.tilewidth+r(e,"offsetx",0),s=e.y+r(e,"starty",0)*t.tileheight+r(e,"offsety",0);return{i:0,layers:e.layers,name:i.name+e.name+"/",opacity:i.opacity*e.opacity,visible:i.visible&&e.visible,x:i.x+n,y:i.y+s}}},function(t,e){t.exports=function(o,a,t){return o.hasOwnProperty(a)?"function"==typeof o[a]?function(t,e,i,n,s,r){return o[a](t,e,i,n,s,r)}:function(){return o[a]}:"function"==typeof t?t:function(){return t}}},function(t,e,i){var P=i(243),L=i(15),D=i(90),F=i(71),k=i(155),I=i(526),B=i(241),N=i(6),Y=i(242),X=i(244),U=i(246);t.exports=function(t,e,i){void 0===i&&(i=P);for(var n=i.targets?i.targets:B(e),s=I(e),r=k(e,"delay",i.delay),o=k(e,"duration",i.duration),a=N(e,"easeParams",i.easeParams),h=F(N(e,"ease",i.ease),a),u=k(e,"hold",i.hold),l=k(e,"repeat",i.repeat),c=k(e,"repeatDelay",i.repeatDelay),d=D(e,"yoyo",i.yoyo),f=D(e,"flipX",i.flipX),p=D(e,"flipY",i.flipY),g=[],v=0;vh.getTotalFrames()&&(s=0),r=h.frames[s],0!==s||this.forward||(r=h.getLastFrame()),this.currentFrame=r):console.warn("Missing animation: "+a),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.setCurrentFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.setCurrentFrame(t),this.parent},playAfterDelay:function(t,e){var i,n;return this.isPlaying?(i=this.nextAnim,n=this.nextAnimsQueue,i&&n.unshift(i),this.nextAnim=t,this._pendingStop=1,this._pendingStopValue=e):(this.delayCounter=e,this.play(t,!0)),this.parent},playAfterRepeat:function(t,e){var i,n;return void 0===e&&(e=1),this.isPlaying?(i=this.nextAnim,n=this.nextAnimsQueue,i&&n.unshift(i),-1!==this.repeatCounter&&e>this.repeatCounter&&(e=this.repeatCounter),this.nextAnim=t,this._pendingStop=2,this._pendingStopValue=e):this.play(t),this.parent},play:function(t,e){void 0===e&&(e=!1);var i=this.currentAnim,n=this.parent,s="string"==typeof t?t:t.key;if(e&&this.isPlaying&&i.key===s)return n;if(i&&this.isPlaying){var r=this.animationManager.getMix(i.key,t);if(0this.repeatCounter&&(t=this.repeatCounter),this._pendingStop=2,this._pendingStopValue=t,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},getTotalFrames:function(){return this.currentAnim?this.currentAnim.getTotalFrames():0},update:function(t,e){var i=this.currentAnim;if(this.isPlaying&&i&&!i.paused){if(this.accumulator+=e*this.timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.stop();if(this.hasStarted){if(this.accumulator>=this.nextTick&&(this.forward?i.nextFrame(this):i.previousFrame(this),this.isPlaying&&0===this._pendingStop&&this.skipMissedFrames&&this.accumulator>this.nextTick))for(var n=0;this.forward?i.nextFrame(this):i.previousFrame(this),n++,this.accumulator>this.nextTick&&n<60;);}else this.accumulator>=this.delayCounter&&(this.accumulator-=this.delayCounter,this.handleStart())}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),t.setAlpha&&(e.alpha=t.alpha),e.setSizeToFrame(),e._originComponent&&(t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin()),this.isPlaying&&this.hasStarted&&(this.emitEvents(r.ANIMATION_UPDATE),3===this._pendingStop&&this._pendingStopValue===t&&this.stop()),e},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},get:function(t){return this.anims&&this.anims.get(t)},exists:function(t){return this.anims&&this.anims.has(t)},create:function(t){var e=t.key,i=!1;return e&&((i=this.get(e))||(i=new o(this,e,t),this.anims||(this.anims=new s),this.anims.set(e,i))),i},remove:function(t){var e=this.get(t);return e&&(this.currentAnim===e&&this.stop(),this.anims.delete(t)),e},destroy:function(){this.animationManager.off(r.REMOVE_ANIMATION,this.globalRemove,this),this.anims&&this.anims.clear(),this.animationManager=null,this.parent=null,this.nextAnim=null,this.nextAnimsQueue.length=0,this.currentAnim=null,this.currentFrame=null},isPaused:{get:function(){return this._paused}}});t.exports=a},,function(t,e,i){var n=i(4);t.exports=function(t,e,i){return void 0===i&&(i=new n),i.x=t.x+t.radius*Math.cos(e),i.y=t.y+t.radius*Math.sin(e),i}},function(t,e,i){var a=i(4);t.exports=function(t,e){void 0===e&&(e=new a);var i=2*Math.PI*Math.random(),n=Math.random()+Math.random(),s=1=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(1+(s-r)).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},function(t,e,i){var n=i(307),s=i(310),r=i(312),o=i(313);t.exports=function(t){switch(typeof t){case"string":return("rgb"===t.substr(0,3).toLowerCase()?o:n)(t);case"number":return s(t);case"object":return r(t)}}},function(t,e){t.exports=function(t,e,i){return t<<16|e<<8|i}},function(t,e,i){var a=i(175);function h(t,e,i,n){var s=(t+6*e)%6,r=Math.min(s,4-s,1);return Math.round(255*(n-n*i*Math.max(0,r)))}t.exports=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1);var s=h(5,t,e,i),r=h(3,t,e,i),o=h(1,t,e,i);return n?n.setTo?n.setTo(s,r,o,n.alpha,!1):(n.r=s,n.g=r,n.b=o,n.color=a(s,r,o),n):{r:s,g:r,b:o,color:a(s,r,o)}}},function(t,e){var i="";function n(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;is.width&&(t=s.width-r.cutX),r.cutY+e>s.height&&(e=s.height-r.cutY),r.setSize(t,e,r.cutX,r.cutY)),this.updateDisplayOrigin();var a=this.input;return a&&!a.customHitArea&&(a.hitArea.width=t,a.hitArea.height=e),this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e,i,n,s,r){var o=this.gl,a=this.frame,h=this.texture,u=this.camera,l=this.renderer;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=a.cutWidth),void 0===r&&(r=a.cutHeight);var c,d,f,p,g,v,m,y,x,T,w=255&(t>>16|0),E=255&(t>>8|0),_=255&(0|t);return u.preRender(1,1),o?(c=u._cx,d=u._cy,f=u._cw,p=u._ch,l.resetTextures(!0),l.pushScissor(c,d,f,-p),l.setFramebuffer(this.framebuffer,!1),g=this.pipeline,v=h.width,m=h.height,y=g.width/v,x=g.height/m,g.drawFillRect(i*y,(m-r-n)*x,s*y,r*x,b.getTintFromFloats(w/255,E/255,_/255,1),e),g.flush(),l.setFramebuffer(null,!1),l.popScissor()):(T=this.context,l.setContext(T),T.fillStyle="rgba("+w+","+E+","+_+","+e+")",T.fillRect(i+a.cutX,n+a.cutY,s,r),l.setContext()),this.dirty=!0,this},clear:function(){var t,e,i;return this.dirty&&((t=this.gl)?((e=this.renderer).setFramebuffer(this.framebuffer,!0),this.frame.cutWidth===this.canvas.width&&this.frame.cutHeight===this.canvas.height||t.scissor(this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),e.setFramebuffer(null,!0)):((i=this.context).save(),i.setTransform(1,0,0,1,0,0),i.clearRect(this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight),i.restore()),this.dirty=!1),this},erase:function(t,e,i){this._eraseMode=!0;var n=this.renderer.currentBlendMode;return this.renderer.setBlendMode(o.ERASE),this.draw(t,e,i,1,16777215),this.renderer.setBlendMode(n),this._eraseMode=!1,this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r,o,a,h,u,l=this.gl,c=this.camera,d=this.renderer;return c.preRender(1,1),l?(r=c._cx,o=c._cy,a=c._cw,h=c._ch,d.resetTextures(!0),d.setFramebuffer(this.framebuffer,!1),d.pushScissor(r,o,a,h,h),u=this.pipeline,g(u,0,this.texture.width,0,this.texture.height,-1e3,1e3),this.batchList(t,e,i,n,s),d.setFramebuffer(null,!0),d.resetTextures(!0),g(u,0,u.width,u.height,0,-1e3,1e3)):(d.setContext(this.context),this.batchList(t,e,i,n,s),d.setContext()),this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o,a,h,u,l,c=this.gl,d=this.camera,f=this.renderer,p=this.textureManager.getFrame(t,e);return p&&(d.preRender(1,1),c?(o=d._cx,a=d._cy,h=d._cw,u=d._ch,f.resetTextures(!0),f.setFramebuffer(this.framebuffer,!1),f.pushScissor(o,a,h,u,u),l=this.pipeline,g(l,0,this.texture.width,0,this.texture.height,-1e3,1e3),l.batchTextureFrame(p,i+this.frame.cutX,n+this.frame.cutY,r,s,d.matrix,null),l.flush(),f.setFramebuffer(null,!1),f.popScissor(),g(l,0,l.width,l.height,0,-1e3,1e3)):this.batchTextureFrame(p,i+this.frame.cutX,n+this.frame.cutY,s,r),this.dirty=!0),this},batchList:function(t,e,i,n,s){for(var r=0;rs&&(r=t[s]),n[s]=r,t.length>s+1&&(r=t[s+1]),n[s+1]=r;return this},setColors:function(t){var e=this.points.length;if(e<1)return this;var i=this.colors;void 0===t?t=[16777215]:Array.isArray(t)||(t=[t]);var n=0;if(t.length===e)for(r=0;rn&&(s=t[n]),i[n]=s,t.length>n+1&&(s=t[n+1]),i[n+1]=s;return this},setPoints:function(t,e,i){if(void 0===t&&(t=2),"number"==typeof t){var n,s,r,o=t;if(o<2&&(o=2),t=[],this.horizontal)for(r=-this.frame.halfWidth,s=this.frame.width/(o-1),n=0;n=this._markerOut&&(e.loop?(e.currentTime=this._markerIn,this.updateTexture(),this._lastUpdate=t,this.emit(o.VIDEO_LOOP,this)):(this.emit(o.VIDEO_COMPLETE,this),this.stop())))},checkVideoProgress:function(){2<=this.video.readyState?this.updateTexture():(this.retry--,0e._dx?r<(s=t.right-e.x)&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType===o.STATIC_BODY&&(t.blocked.none=!1,t.blocked.right=!0),t.physicsType===o.STATIC_BODY&&(e.blocked.none=!1,e.blocked.left=!0)):t._dxe._dy?r<(s=t.bottom-e.y)&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType===o.STATIC_BODY&&(t.blocked.none=!1,t.blocked.down=!0),t.physicsType===o.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0)):t._dy=t.right||e.position.y>=t.bottom)}},,function(t,e,i){var u=i(150);t.exports=function(t,e,i){var n=u(t,e,!0,i),s=u(t,e-1,!0,i),r=u(t,e+1,!0,i),o=u(t-1,e,!0,i),a=u(t+1,e,!0,i),h=n&&n.collides;return h&&(n.faceTop=!0,n.faceBottom=!0,n.faceLeft=!0,n.faceRight=!0),s&&s.collides&&(h&&(n.faceTop=!1),s.faceBottom=!h),r&&r.collides&&(h&&(n.faceBottom=!1),r.faceTop=!h),o&&o.collides&&(h&&(n.faceLeft=!1),o.faceRight=!h),a&&a.collides&&(h&&(n.faceRight=!1),a.faceLeft=!h),n&&!n.collides&&n.resetFaces(),n}},function(t,e,i){var l=i(75),c=i(104),d=i(235),f=i(65);t.exports=function(t,e,i,n,s){if(!c(e,i,s))return null;void 0===n&&(n=!0);var r,o=s.data[i][e],a=o&&o.collides;t instanceof l?(null===s.data[i][e]&&(s.data[i][e]=new l(s,t.index,e,i,t.width,t.height)),s.data[i][e].copy(t)):(r=t,null===s.data[i][e]?s.data[i][e]=new l(s,r,e,i,s.tileWidth,s.tileHeight):s.data[i][e].index=r);var h=s.data[i][e],u=-1!==s.collideIndexes.indexOf(h.index);return f(h,u),n&&a!==h.collides&&d(e,i,s),h}},function(t,e,i){var p=i(33),g=i(105),v=i(106),m=i(75);t.exports=function(t,e,i,n,s){for(var r=new g({tileWidth:i,tileHeight:n}),o=new v({name:t,tileWidth:i,tileHeight:n,format:p.ARRAY_2D,layers:[r]}),a=[],h=e.length,u=0,l=0;lt&&(t=s.totalDuration),s.delay=t.right&&(o=1,r+=s-t.right,s=t.right);break;case 1:(r+=e)>=t.bottom&&(o=2,s-=r-t.bottom,r=t.bottom);break;case 2:(s-=e)<=t.left&&(o=3,r-=t.left-s,s=t.left);break;case 3:(r-=e)<=t.top&&(o=0,r=t.top)}return n}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,n=0;ne.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=n,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration}},destroy:function(){this.frame=void 0}});t.exports=n},function(t,e){t.exports=function(t){var i=/\D/g;return t.sort(function(t,e){return parseInt(t.replace(i,""),10)-parseInt(e.replace(i,""),10)}),t}},function(t,e,i){var n=i(172),s=i(0),r=i(92),o=i(12),a=i(122),h=i(21),T=i(2),d=i(6),f=i(173),p=i(302),u=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.mixes=new r,this.paused=!1,this.name="AnimationManager",t.events.once(h.BOOT,this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once(h.DESTROY,this.destroy,this)},addMix:function(t,e,i){var n,s=this.anims,r=this.mixes,o="string"==typeof t?t:t.key,a="string"==typeof e?e:e.key;return s.has(o)&&s.has(a)&&((n=(n=r.get(o))||{})[a]=i,r.set(o,n)),this},removeMix:function(t,e){var i,n=this.mixes,s="string"==typeof t?t:t.key,r=n.get(s);return r&&(e?(i="string"==typeof e?e:e.key,r.hasOwnProperty(i)&&delete r[i]):e||n.delete(s)),this},getMix:function(t,e){var i=this.mixes,n="string"==typeof t?t:t.key,s="string"==typeof e?e:e.key,r=i.get(n);return r&&r.hasOwnProperty(s)?r[s]:0},add:function(t,e){return this.anims.has(t)?console.warn("Animation key exists: "+t):(e.key=t,this.anims.set(t,e),this.emit(a.ADD_ANIMATION,t,e)),this},exists:function(t){return this.anims.has(t)},createFromAseprite:function(g,v){var m=[],t=this.game.cache.json.get(g);if(!t)return m;var y=this,e=d(t,"meta",null),x=d(t,"frames",null);return e&&x&&d(e,"frameTags",[]).forEach(function(t){var e=[],i=T(t,"name",null),n=T(t,"from",0),s=T(t,"to",0),r=T(t,"direction","forward");if(i&&(!v||v&&-1d.right&&(f=T(f,f+(e-d.right),this.lerp.x)),id.bottom&&(p=T(p,p+(i-d.bottom),this.lerp.y))):(f=T(f,e-u,this.lerp.x),p=T(p,i-l,this.lerp.y))),this.useBounds&&(f=this.clampX(f),p=this.clampY(p)),this.roundPixels&&(u=Math.round(u),l=Math.round(l));var g=(this.scrollX=f)+r,v=(this.scrollY=p)+o;this.midPoint.set(g,v);var m=n/a,y=s/a;this.worldView.setTo(g-m/2,v-y/2,m,y),h.applyITRS(this.x+u,this.y+l,this.rotation,a,a),h.translate(-u,-l),this.shakeEffect.preRender()},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=l(i,0,1),n=l(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var o=this.width/2,a=this.height/2,h=t.x-s,u=t.y-r;return this.midPoint.set(h,u),this.scrollX=h-o,this.scrollY=u-a,this.useBounds&&(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.rotateToEffect.reset(),this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.rotateToEffect.update(t,e),this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.clearRenderToTexture(),this.resetFX(),s.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=c},function(t,e,i){var o=i(32);t.exports=function(t){var e=new o;t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,e,i,n){return e+e+i+i+n+n});var i,n,s,r=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return r&&(i=parseInt(r[1],16),n=parseInt(r[2],16),s=parseInt(r[3],16),e.setTo(i,n,s)),e}},function(t,e){t.exports=function(t,e,i,n){return n<<24|t<<16|e<<8|i}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,u=r;return r!==s&&(r===t?a=(e-i)/o+(e>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},function(t,e,i){var n=i(32);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e,i){var a=i(32);t.exports=function(t){var e,i,n,s,r=new a,o=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase());return o&&(e=parseInt(o[1],10),i=parseInt(o[2],10),n=parseInt(o[3],10),s=void 0!==o[4]?parseFloat(o[4]):1,r.setTo(e,i,n,255*s)),r}},function(t,e,i){t.exports={Fade:i(688),Flash:i(689),Pan:i(690),Shake:i(723),RotateTo:i(724),Zoom:i(725)}},function(t,e,i){t.exports={In:i(691),Out:i(692),InOut:i(693)}},function(t,e,i){t.exports={In:i(694),Out:i(695),InOut:i(696)}},function(t,e,i){t.exports={In:i(697),Out:i(698),InOut:i(699)}},function(t,e,i){t.exports={In:i(700),Out:i(701),InOut:i(702)}},function(t,e,i){t.exports={In:i(703),Out:i(704),InOut:i(705)}},function(t,e,i){t.exports={In:i(706),Out:i(707),InOut:i(708)}},function(t,e,i){t.exports=i(709)},function(t,e,i){t.exports={In:i(710),Out:i(711),InOut:i(712)}},function(t,e,i){t.exports={In:i(713),Out:i(714),InOut:i(715)}},function(t,e,i){t.exports={In:i(716),Out:i(717),InOut:i(718)}},function(t,e,i){t.exports={In:i(719),Out:i(720),InOut:i(721)}},function(t,e,i){t.exports=i(722)},function(t,e,i){var n=i(0),a=i(34),h=i(328),u=i(2),l=i(6),c=i(7),d=i(180),f=i(1),p=i(184),g=i(174),s=new n({initialize:function(t){void 0===t&&(t={});this.width=l(t,"width",1024),this.height=l(t,"height",768),this.zoom=l(t,"zoom",1),this.resolution=l(t,"resolution",1),this.parent=l(t,"parent",void 0),this.scaleMode=l(t,"scaleMode",0),this.expandParent=l(t,"expandParent",!0),this.autoRound=l(t,"autoRound",!1),this.autoCenter=l(t,"autoCenter",0),this.resizeInterval=l(t,"resizeInterval",500),this.fullscreenTarget=l(t,"fullscreenTarget",null),this.minWidth=l(t,"minWidth",0),this.maxWidth=l(t,"maxWidth",0),this.minHeight=l(t,"minHeight",0),this.maxHeight=l(t,"maxHeight",0);var e=l(t,"scale",null);e&&(this.width=l(e,"width",this.width),this.height=l(e,"height",this.height),this.zoom=l(e,"zoom",this.zoom),this.resolution=l(e,"resolution",this.resolution),this.parent=l(e,"parent",this.parent),this.scaleMode=l(e,"mode",this.scaleMode),this.expandParent=l(e,"expandParent",this.expandParent),this.autoRound=l(e,"autoRound",this.autoRound),this.autoCenter=l(e,"autoCenter",this.autoCenter),this.resizeInterval=l(e,"resizeInterval",this.resizeInterval),this.fullscreenTarget=l(e,"fullscreenTarget",this.fullscreenTarget),this.minWidth=l(e,"min.width",this.minWidth),this.maxWidth=l(e,"max.width",this.maxWidth),this.minHeight=l(e,"min.height",this.minHeight),this.maxHeight=l(e,"max.height",this.maxHeight)),this.renderType=l(t,"type",a.AUTO),this.canvas=l(t,"canvas",null),this.context=l(t,"context",null),this.canvasStyle=l(t,"canvasStyle",null),this.customEnvironment=l(t,"customEnvironment",!1),this.sceneConfig=l(t,"scene",null),this.seed=l(t,"seed",[(Date.now()*Math.random()).toString()]),d.RND=new d.RandomDataGenerator(this.seed),this.gameTitle=l(t,"title",""),this.gameURL=l(t,"url","https://phaser.io"),this.gameVersion=l(t,"version",""),this.autoFocus=l(t,"autoFocus",!0),this.domCreateContainer=l(t,"dom.createContainer",!1),this.domBehindCanvas=l(t,"dom.behindCanvas",!1),this.inputKeyboard=l(t,"input.keyboard",!0),this.inputKeyboardEventTarget=l(t,"input.keyboard.target",window),this.inputKeyboardCapture=l(t,"input.keyboard.capture",[]),this.inputMouse=l(t,"input.mouse",!0),this.inputMouseEventTarget=l(t,"input.mouse.target",null),this.inputMouseCapture=l(t,"input.mouse.capture",!0),this.inputTouch=l(t,"input.touch",h.input.touch),this.inputTouchEventTarget=l(t,"input.touch.target",null),this.inputTouchCapture=l(t,"input.touch.capture",!0),this.inputActivePointers=l(t,"input.activePointers",1),this.inputSmoothFactor=l(t,"input.smoothFactor",0),this.inputWindowEvents=l(t,"input.windowEvents",!0),this.inputGamepad=l(t,"input.gamepad",!1),this.inputGamepadEventTarget=l(t,"input.gamepad.target",window),this.disableContextMenu=l(t,"disableContextMenu",!1),this.audio=l(t,"audio"),this.hideBanner=!1===l(t,"banner",null),this.hidePhaser=l(t,"banner.hidePhaser",!1),this.bannerTextColor=l(t,"banner.text","#ffffff"),this.bannerBackgroundColor=l(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=l(t,"fps",null);var i=l(t,"render",t);this.antialias=l(i,"antialias",!0),this.antialiasGL=l(i,"antialiasGL",!0),this.mipmapFilter=l(i,"mipmapFilter","LINEAR"),this.desynchronized=l(i,"desynchronized",!1),this.roundPixels=l(i,"roundPixels",!1),this.pixelArt=l(i,"pixelArt",1!==this.zoom),this.pixelArt&&(this.antialias=!1,this.roundPixels=!0),this.transparent=l(i,"transparent",!1),this.clearBeforeRender=l(i,"clearBeforeRender",!0),this.premultipliedAlpha=l(i,"premultipliedAlpha",!0),this.failIfMajorPerformanceCaveat=l(i,"failIfMajorPerformanceCaveat",!1),this.powerPreference=l(i,"powerPreference","default"),this.batchSize=l(i,"batchSize",4096),this.maxTextures=l(i,"maxTextures",-1),this.maxLights=l(i,"maxLights",10);var n=l(t,"backgroundColor",0);this.backgroundColor=g(n),0===n&&this.transparent&&(this.backgroundColor.alpha=0),this.preBoot=l(t,"callbacks.preBoot",f),this.postBoot=l(t,"callbacks.postBoot",f),this.physics=l(t,"physics",{}),this.defaultPhysicsSystem=l(this.physics,"default",!1),this.loaderBaseURL=l(t,"loader.baseURL",""),this.loaderPath=l(t,"loader.path",""),this.loaderMaxParallelDownloads=l(t,"loader.maxParallelDownloads",32),this.loaderCrossOrigin=l(t,"loader.crossOrigin",void 0),this.loaderResponseType=l(t,"loader.responseType",""),this.loaderAsync=l(t,"loader.async",!0),this.loaderUser=l(t,"loader.user",""),this.loaderPassword=l(t,"loader.password",""),this.loaderTimeout=l(t,"loader.timeout",0),this.loaderWithCredentials=l(t,"loader.withCredentials",!1),this.installGlobalPlugins=[],this.installScenePlugins=[];var s=l(t,"plugins",null),r=p.DefaultScene;s&&(Array.isArray(s)?this.defaultPlugins=s:c(s)&&(this.installGlobalPlugins=u(s,"global",[]),this.installScenePlugins=u(s,"scene",[]),Array.isArray(s.default)?r=s.default:Array.isArray(s.defaultMerge)&&(r=r.concat(s.defaultMerge)))),this.defaultPlugins=r;var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=l(t,"images.default",o+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=l(t,"images.missing",o+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),window&&(window.FORCE_WEBGL?this.renderType=a.WEBGL:window.FORCE_CANVAS&&(this.renderType=a.CANVAS))}});t.exports=s},function(t,e,i){t.exports={os:i(125),browser:i(126),features:i(179),input:i(756),audio:i(757),video:i(758),fullscreen:i(759),canvasFeatures:i(329)}},function(t,e,i){var n,s,r,o=i(26),a={supportInverseAlpha:!1,supportNewBlendModes:!1};t.exports=(void 0!==document&&(a.supportNewBlendModes=(n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",s="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",(r=new Image).onload=function(){var i=new Image;i.onload=function(){var t=o.create(i,6,1).getContext("2d");if(t.globalCompositeOperation="multiply",t.drawImage(r,0,0),t.drawImage(i,2,0),!t.getImageData(2,0,1,1))return!1;var e=t.getImageData(2,0,1,1).data;o.remove(i),a.supportNewBlendModes=255===e[0]&&0===e[1]&&0===e[2]},i.src=n+"/wCKxvRF"+s},r.src=n+"AP804Oa6"+s,!1),a.supportInverseAlpha=function(){var t=o.create(this,2,1).getContext("2d");t.fillStyle="rgba(10, 20, 30, 0.5)",t.fillRect(0,0,1,1);var e=t.getImageData(0,0,1,1);if(null===e)return!1;t.putImageData(e,1,0);var i=t.getImageData(1,0,1,1);return i.data[0]===e.data[0]&&i.data[1]===e.data[1]&&i.data[2]===e.data[2]&&i.data[3]===e.data[3]}()),a)},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}},function(t,e){t.exports=function(t){return 0<=(t%=2*Math.PI)?t:t+2*Math.PI}},function(t,e){t.exports=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}},function(t,e){t.exports=function(t,e,i,n){var s=t-i,r=e-n;return s*s+r*r}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),e-ir[0]&&(e=1),r[8]>r[3*e+e]&&(e=2),i=a[e],n=a[i],s=Math.sqrt(r[3*e+e]-r[3*i+i]-r[3*n+n]+1),h[e]=.5*s,s=.5/s,h[i]=(r[3*i+e]+r[3*e+i])*s,h[n]=(r[3*n+e]+r[3*e+n])*s,this.x=h[0],this.y=h[1],this.z=h[2],this.w=(r[3*n+i]-r[3*i+n])*s),this}});t.exports=d},function(t,e,a){var h=a(350),u=a(26),l=a(34),c=a(179);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===l.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==l.HEADLESS)if(e.renderType===l.CANVAS||e.renderType!==l.CANVAS&&!c.webGL){if(!c.canvas)throw new Error("Cannot create Canvas or WebGL context, aborting.");e.renderType=l.CANVAS}else e.renderType=l.WEBGL;e.antialias||u.disableSmoothing();var i,n,s=t.scale.baseSize,r=s.width,o=s.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=r,t.canvas.height=o):t.canvas=u.create(t,r,o,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||h.setCrisp(t.canvas),e.renderType!==l.HEADLESS&&(i=a(532),n=a(535),e.renderType===l.WEBGL?t.renderer=new n(t):(t.renderer=new i(t),t.context=t.renderer.gameContext))}},function(t,e){t.exports={setCrisp:function(e){return["optimizeSpeed","-moz-crisp-edges","-o-crisp-edges","-webkit-optimize-contrast","optimize-contrast","crisp-edges","pixelated"].forEach(function(t){e.style["image-rendering"]=t}),e.style.msInterpolationMode="nearest-neighbor",e},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var u=i(34);t.exports=function(t){var e,i,n,s,r,o,a,h=t.config;h.hideBanner||(e="WebGL",h.renderType===u.CANVAS?e="Canvas":h.renderType===u.HEADLESS&&(e="Headless"),i=h.audio,a=!(n=t.device.audio).webAudio||i&&i.disableWebAudio?i&&i.noAudio||!n.webAudio&&!n.audioData?"No Audio":"HTML5 Audio":"Web Audio",t.device.browser.ie?window.console&&console.log("Phaser v"+u.VERSION+" / https://phaser.io"):(r=[s=""],Array.isArray(h.bannerBackgroundColor)?(h.bannerBackgroundColor.forEach(function(t){s=s.concat("%c "),r.push("background: "+t),o=t}),r[r.length-1]="color: "+h.bannerTextColor+"; background: "+o):(s=s.concat("%c "),r.push("color: "+h.bannerTextColor+"; background: "+h.bannerBackgroundColor)),r.push("background: #fff"),h.gameTitle&&(s=s.concat(h.gameTitle),h.gameVersion&&(s=s.concat(" v"+h.gameVersion)),h.hidePhaser||(s=s.concat(" / "))),h.hidePhaser||(s=s.concat("Phaser v"+u.VERSION+" ("+e+" | "+a+")")),s=s.concat(" %c "+h.gameURL),r[0]=s,console.log.apply(console,r)))}},function(t,e,i){var n=i(0),s=i(6),r=i(1),o=i(353),a=new n({initialize:function(t,e){this.game=t,this.raf=new o,this.started=!1,this.running=!1,this.minFps=s(e,"min",5),this.targetFps=s(e,"target",60),this._min=1e3/this.minFps,this._target=1e3/this.targetFps,this.actualFps=this.targetFps,this.nextFpsUpdate=0,this.framesThisSecond=0,this.callback=r,this.forceSetTimeOut=s(e,"forceSetTimeOut",!1),this.time=0,this.startTime=0,this.lastTime=0,this.frame=0,this.inFocus=!0,this._pauseTime=0,this._coolDown=0,this.delta=0,this.deltaIndex=0,this.deltaHistory=[],this.deltaSmoothingMax=s(e,"deltaHistory",10),this.panicMax=s(e,"panicMax",120),this.rawDelta=0,this.now=0,this.smoothStep=s(e,"smoothStep",!0)},blur:function(){this.inFocus=!1},focus:function(){this.inFocus=!0,this.resetDelta()},pause:function(){this._pauseTime=window.performance.now()},resume:function(){this.resetDelta(),this.startTime+=this.time-this._pauseTime},resetDelta:function(){var t=window.performance.now();this.time=t,this.lastTime=t,this.nextFpsUpdate=t+1e3;for(var e=this.framesThisSecond=0;ethis._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var a=o=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),this.lastTime=t,this.frame++},tick:function(){this.step()},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){this.running||(t&&(this.startTime+=-this.lastTime+(this.lastTime+window.performance.now())),this.raf.start(this.step.bind(this),this.useRAF),this.running=!0,this.step())},getDuration:function(){return Math.round(this.lastTime-this.startTime)/1e3},getDurationMS:function(){return Math.round(this.lastTime-this.startTime)},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.callback=r,this.raf=null,this.game=null}});t.exports=a},function(t,e,i){var n=i(0),s=i(1),r=new n({initialize:function(){this.isRunning=!1,this.callback=s,this.tick=0,this.isSetTimeOut=!1,this.timeOutID=null,this.lastTime=0,this.target=0;var n=this;this.step=function t(){var e=window.performance.now();n.lastTime=n.tick,n.tick=e,n.callback(e),n.timeOutID=window.requestAnimationFrame(t)},this.stepTimeout=function t(){var e=Date.now(),i=Math.min(Math.max(2*n.target+n.tick-e,0),n.target);n.lastTime=n.tick,n.tick=e,n.callback(e),n.timeOutID=window.setTimeout(t,i)}},start:function(t,e,i){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.target=i,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=s}});t.exports=r},function(t,e,i){var n=i(21);t.exports=function(t){var e,i=t.events;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach(function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")});e&&document.addEventListener(e,function(t){document.hidden||"pause"===t.type?i.emit(n.HIDDEN):i.emit(n.VISIBLE)},!1),window.onblur=function(){i.emit(n.BLUR)},window.onfocus=function(){i.emit(n.FOCUS)},window.focus&&t.config.autoFocus&&window.focus()}},function(t,e,i){var m=i(356),y=i(26),x=i(6);t.exports=function(t){var e=x(t,"data",[]),i=x(t,"canvas",null),n=x(t,"palette",m),s=x(t,"pixelWidth",1),r=x(t,"pixelHeight",s),o=x(t,"resizeCanvas",!0),a=x(t,"clearCanvas",!0),h=x(t,"preRender",null),u=x(t,"postRender",null),l=Math.floor(Math.abs(e[0].length*s)),c=Math.floor(Math.abs(e.length*r));i||(i=y.create2D(this,l,c),a=o=!1),o&&(i.width=l,i.height=c);var d=i.getContext("2d");a&&d.clearRect(0,0,l,c),h&&h(i,d);for(var f=0;fi.length-2?i.length-1:s+1],u=i[s>i.length-3?i.length-1:s+2];return e.set(l(r,o.x,a.x,h.x,u.x),l(r,o.y,a.y,h.y,u.y))},toJSON:function(){for(var t=[],e=0;ei.width?s.ORIENTATION.PORTRAIT:s.ORIENTATION.LANDSCAPE;if("number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?s.ORIENTATION.PORTRAIT:s.ORIENTATION.LANDSCAPE;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return s.ORIENTATION.PORTRAIT;if(window.matchMedia("(orientation: landscape)").matches)return s.ORIENTATION.LANDSCAPE}return tthis.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var e=this.listeners;window.removeEventListener("orientationchange",e.orientationChange,!1),window.removeEventListener("resize",e.windowResize,!1);["webkit","moz",""].forEach(function(t){document.removeEventListener(t+"fullscreenchange",e.fullScreenChange,!1),document.removeEventListener(t+"fullscreenerror",e.fullScreenError,!1)}),document.removeEventListener("MSFullscreenChange",e.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",e.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.fullscreenTarget=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy()},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===c.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===c.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=v},function(t,e,i){var n=i(17),s=i(0),r=i(95),o=i(3),a=new s({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===n&&(n=null),this._width=t,this._height=e,this._parent=n,this.aspectMode=i,this.aspectRatio=0===e?1:t/e,this.minWidth=0,this.minHeight=0,this.maxWidth=Number.MAX_VALUE,this.maxHeight=Number.MAX_VALUE,this.snapTo=new o},setAspectMode:function(t){return void 0===t&&(t=0),this.aspectMode=t,this.setSize(this._width,this._height)},setSnap:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.snapTo.set(t,e),this.setSize(this._width,this._height)},setParent:function(t){return this._parent=t,this.setSize(this._width,this._height)},setMin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.minWidth=n(t,0,this.maxWidth),this.minHeight=n(e,0,this.maxHeight),this.setSize(this._width,this._height)},setMax:function(t,e){return void 0===t&&(t=Number.MAX_VALUE),void 0===e&&(e=t),this.maxWidth=n(t,this.minWidth,Number.MAX_VALUE),this.maxHeight=n(e,this.minHeight,Number.MAX_VALUE),this.setSize(this._width,this._height)},setSize:function(t,e){switch(void 0===t&&(t=0),void 0===e&&(e=t),this.aspectMode){case a.NONE:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height;break;case a.WIDTH_CONTROLS_HEIGHT:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(this._width*(1/this.aspectRatio),!1);break;case a.HEIGHT_CONTROLS_WIDTH:this._height=this.getNewHeight(r(e,this.snapTo.y)),this._width=this.getNewWidth(this._height*this.aspectRatio,!1);break;case a.FIT:this.constrain(t,e,!0);break;case a.ENVELOP:this.constrain(t,e,!1)}return this},setAspectRatio:function(t){return this.aspectRatio=t,this.setSize(this._width,this._height)},resize:function(t,e){return this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height,this},getNewWidth:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minWidth,this.maxWidth),e&&this._parent&&t>this._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var n=this.snapTo,s=0===e?1:t/e;return i&&this.aspectRatio>s||!i&&this.aspectRatios)&&(t=(e=r(e,n.y))*this.aspectRatio,0r.START&&n.settings.status<=r.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e=r.LOADING&&i.settings.status=r.x&&t=r.y&&e=r.x&&t=r.y&&e=n-this.manager.loopEndOffset?(this.audio.currentTime=i+Math.max(0,s-n),s=this.audio.currentTime):s>4,u[a++]=(15&i)<<4|n>>2,u[a++]=(3&n)<<6|63&s;return h}},function(t,e,i){var n=i(136),s=i(0),r=i(61),o=new s({Extends:n,initialize:function(t,e,i){if(void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),!this.audioBuffer)throw new Error('There is no audio asset with key "'+e+'" in the audio cache');this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,n.call(this,t,e,i)},play:function(t,e){return!!n.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit(r.PLAY,this),!0)},pause:function(){return!(this.manager.context.currentTime>>16,v=(65280&d)>>>8,m=255&d,u.strokeStyle="rgba("+g+","+v+","+m+","+l+")",u.lineWidth=p,y+=3;break;case x.FILL_STYLE:f=a[y+1],c=a[y+2],g=(16711680&f)>>>16,v=(65280&f)>>>8,m=255&f,u.fillStyle="rgba("+g+","+v+","+m+","+c+")",y+=2;break;case x.BEGIN_PATH:u.beginPath();break;case x.CLOSE_PATH:u.closePath();break;case x.FILL_PATH:o||u.fill();break;case x.STROKE_PATH:o||u.stroke();break;case x.FILL_RECT:o?u.rect(a[y+1],a[y+2],a[y+3],a[y+4]):u.fillRect(a[y+1],a[y+2],a[y+3],a[y+4]),y+=4;break;case x.FILL_TRIANGLE:u.beginPath(),u.moveTo(a[y+1],a[y+2]),u.lineTo(a[y+3],a[y+4]),u.lineTo(a[y+5],a[y+6]),u.closePath(),o||u.fill(),y+=6;break;case x.STROKE_TRIANGLE:u.beginPath(),u.moveTo(a[y+1],a[y+2]),u.lineTo(a[y+3],a[y+4]),u.lineTo(a[y+5],a[y+6]),u.closePath(),o||u.stroke(),y+=6;break;case x.LINE_TO:u.lineTo(a[y+1],a[y+2]),y+=2;break;case x.MOVE_TO:u.moveTo(a[y+1],a[y+2]),y+=2;break;case x.LINE_FX_TO:u.lineTo(a[y+1],a[y+2]),y+=5;break;case x.MOVE_FX_TO:u.moveTo(a[y+1],a[y+2]),y+=5;break;case x.SAVE:u.save();break;case x.RESTORE:u.restore();break;case x.TRANSLATE:u.translate(a[y+1],a[y+2]),y+=2;break;case x.SCALE:u.scale(a[y+1],a[y+2]),y+=2;break;case x.ROTATE:u.rotate(a[y+1]),y+=1;break;case x.GRADIENT_FILL_STYLE:y+=5;break;case x.GRADIENT_LINE_STYLE:y+=6;break;case x.SET_TEXTURE:y+=2}}u.restore()}}},function(t,e,i){var n=i(0),s=i(127),r=i(71),o=i(2),a=i(59),h=new n({initialize:function(t,e,i,n){void 0===n&&(n=!1),this.propertyKey=e,this.propertyValue=i,this.defaultValue=i,this.steps=0,this.counter=0,this.start=0,this.end=0,this.ease,this.emitOnly=n,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.loadConfig(t)},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=o(t,this.propertyKey,this.defaultValue),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return this.propertyValue},onChange:function(t){return this.propertyValue=t,this.setMethods()},setMethods:function(){var t,e,i,n=this.propertyValue,s=typeof n;return"number"==s?(this.onEmit=this.staticValueEmit,this.onUpdate=this.staticValueUpdate):Array.isArray(n)?this.onEmit=this.randomStaticValueEmit:"function"==s?this.emitOnly?this.onEmit=n:this.onUpdate=n:"object"==s&&(this.has(n,"random")||this.hasBoth(n,"start","end")||this.hasBoth(n,"min","max"))?(this.start=this.has(n,"start")?n.start:n.min,this.end=this.has(n,"end")?n.end:n.max,(t=this.hasBoth(n,"min","max")||!!n.random)&&(e=n.random,Array.isArray(e)&&(this.start=e[0],this.end=e[1]),this.onEmit=this.randomRangedValueEmit),this.has(n,"steps")?(this.steps=n.steps,this.counter=this.start,this.onEmit=this.steppedEmit):(i=this.has(n,"ease")?n.ease:"Linear",this.ease=r(i),t||(this.onEmit=this.easedValueEmit),this.onUpdate=this.easeValueUpdate)):"object"==s&&this.hasEither(n,"onEmit","onUpdate")&&(this.has(n,"onEmit")&&(this.onEmit=n.onEmit),this.has(n,"onUpdate")&&(this.onUpdate=n.onUpdate)),this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,n){return n},staticValueEmit:function(){return this.propertyValue},staticValueUpdate:function(){return this.propertyValue},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.propertyValue[t]},randomRangedValueEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i),i},steppedEmit:function(){var t=this.counter,e=this.counter+(this.end-this.start)/this.steps;return this.counter=a(e,this.start,this.end),t},easedValueEmit:function(t,e){var i;return t&&t.data[e]&&((i=t.data[e]).min=this.start,i.max=this.end),this.start},easeValueUpdate:function(t,e,i){var n=t.data[e];return(n.max-n.min)*this.ease(i)+n.min}});t.exports=h},function(t,e,i){var n=i(0),o=i(2),s=new n({initialize:function(t,e,i,n,s){var r;"object"==typeof t?(t=o(r=t,"x",0),e=o(r,"y",0),i=o(r,"power",0),n=o(r,"epsilon",100),s=o(r,"gravity",50)):(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===s&&(s=50)),this.x=t,this.y=e,this.active=!0,this._gravity=s,this._power=0,this._epsilon=0,this.power=i,this.epsilon=n},update:function(t,e){var i,n,s=this.x-t.x,r=this.y-t.y,o=s*s+r*r;0!==o&&(i=Math.sqrt(o),oe.right&&t.collideRight&&(this.x=e.right,this.velocityX*=i),this.ye.bottom&&t.collideBottom&&(this.y=e.bottom,this.velocityY*=i)},update:function(t,e,i){if(0this._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=n},function(t,e){t.exports=function(t,e){for(var i=0;id.PI2?s=d.PI2:s<0&&(s=d.PI2+s%d.PI2);for(var a,h=[r+Math.cos(n)*i,o+Math.sin(n)*i];e<1;)a=s*e+n,h.push(r+Math.cos(a)*i,o+Math.sin(a)*i),e+=t;return a=s+n,h.push(r+Math.cos(a)*i,o+Math.sin(a)*i),h.push(r+Math.cos(n)*i,o+Math.sin(n)*i),this.pathIndexes=l(h),this.pathData=h,this}});t.exports=r},function(t,e,i){var n=i(0),s=i(1023),r=i(60),o=i(9),a=i(30),h=new n({Extends:a,Mixins:[s],initialize:function(t,e,i,n,s,r){void 0===e&&(e=0),void 0===i&&(i=0),a.call(this,t,"Curve",n),this._smoothness=32,this._curveBounds=new o,this.closePath=!1,this.setPosition(e,i),void 0!==s&&this.setFillStyle(s,r),this.updateData()},smoothness:{get:function(){return this._smoothness},set:function(t){this._smoothness=t,this.updateData()}},setSmoothness:function(t){return this._smoothness=t,this.updateData()},updateData:function(){var t=this._curveBounds,e=this._smoothness;this.geom.getBounds(t,e),this.setSize(t.width,t.height),this.updateDisplayOrigin();for(var i=[],n=this.geom.getPoints(e),s=0;st.right||e.rightt.bottom||e.bottome.right||t.righte.bottom||t.bottome.right||t.righte.bottom||t.bottomt.width*t.height)&&(e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(s.BUTTON_DOWN,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(s.BUTTON_UP,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=r},function(t,e,i){var a=i(472),h=i(473),n=i(0),u=i(12),l=i(3),s=new n({Extends:u,initialize:function(t,e){u.call(this),this.manager=t,this.pad=e,this.id=e.id,this.index=e.index;for(var i=[],n=0;n=s;for(this.fixedStep||(n=.001*e,o=!0,this._elapsed=0),h=0;h=s;)this._elapsed-=s,this.step(n)}},step:function(t){for(var e,i=this.bodies.entries,n=i.length,s=0;sc)&&(d.xl))return this.separateCircle(t,e,s)}var f=!1,p=!1;s?(f=A(t,e,s,this.OVERLAP_BIAS),p=C(t,e,s,this.OVERLAP_BIAS)):this.forceX||Math.abs(this.gravity.y+t.gravity.y)=e.right||t.position.y>=e.bottom))},circleBodyIntersects:function(t,e){var i=p(t.center.x,e.left,e.right),n=p(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!0)},collide:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!1)},collideObjects:function(t,e,i,n,s,r){var o;t.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);var a=Array.isArray(t),h=Array.isArray(e);if(this._total=0,a||h)if(!a&&h)for(o=0;od.baseTileWidth&&(h-=a=(d.tileWidth-d.baseTileWidth)*e.scaleX,l+=a),d.tileHeight>d.baseTileHeight&&(c+=(d.tileHeight-d.baseTileHeight)*e.scaleY);var f=e.getTilesWithinWorldXY(h,u,l,c);return 0!==f.length&&this.collideSpriteVsTilesHandler(t,f,i,n,s,r,!0)},collideSpriteVsTilesHandler:function(t,e,i,n,s,r,o){for(var a,h,u=t.body,l={left:0,right:0,top:0,bottom:0},c=!1,d=0;de.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,r=this.blocked.right=!0),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,r=this.blocked.down=!0),r&&(this.blocked.none=!1),r},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this.updateCenter(),this},setSize:function(t,e,i){void 0===i&&(i=!0);var n,s,r=this.gameObject;return!t&&r.frame&&(t=r.frame.realWidth),!e&&r.frame&&(e=r.frame.realHeight),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&r.getCenter&&(n=(r.width-t)/2,s=(r.height-e)/2,this.offset.set(n,s)),this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),0=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-e)*(this.center.y-e)<=this.radius*this.radius:h(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return 0=t.minX&&e.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,i,n,s){for(var r,o=[e,i];o.length;)(i=o.pop())-(e=o.pop())<=n||(r=e+Math.ceil((i-e)/n/2)*n,a(t,r,e,i,s),o.push(e,r,r,i))}n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!u(t,e))return i;for(var s,r,o,a,h=[];e;){for(s=0,r=e.children.length;sthis._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)},_split:function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var r=this._chooseSplitIndex(i,s,n),o=p(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,f(i,this.toBBox),f(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)},_splitRoot:function(t,e){this.data=p([t,e]),this.data.height=t.height+1,this.data.leaf=!1,f(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){for(var n,s,r,o,a,h,u,l,c,d,f,p,g=a=1/0,v=e;v<=i-e;v++)n=m(t,0,v,this.toBBox),s=m(t,v,i,this.toBBox),u=n,l=s,p=f=d=c=void 0,c=Math.max(u.minX,l.minX),d=Math.max(u.minY,l.minY),f=Math.min(u.maxX,l.maxX),p=Math.min(u.maxY,l.maxY),r=Math.max(0,f-c)*Math.max(0,p-d),o=y(n)+y(s),re.deltaAbsY()?g=-1:e.deltaAbsX()i&&s<(o=t.right-i)&&(o=0),0!==o&&(t.customSeparateX?t.overlapX=o:c(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.left=!0):0i&&s<(o=t.bottom-i)&&(o=0),0!==o&&(t.customSeparateY?t.overlapY=o:c(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):0=r.layers.length){if(s.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}r=s.pop()}else{var o,a=r.layers[r.i];if(r.i++,"tilelayer"===a.type)if(a.compression)console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+a.name+"'");else{if(a.encoding&&"base64"===a.encoding){if(a.chunks)for(var h=0;h>>0;return n}},function(t,e,i){var h=i(2),u=i(154);t.exports=function(t){for(var e=[],i=[],n=u(t);n.i=n.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}n=i.pop()}else{var s,r,o,a=n.layers[n.i];n.i++,"imagelayer"===a.type?(s=h(a,"offsetx",0)+h(a,"startx",0),r=h(a,"offsety",0)+h(a,"starty",0),e.push({name:n.name+a.name,image:a.image,x:n.x+s+a.x,y:n.y+r+a.y,alpha:n.opacity*a.opacity,visible:n.visible&&a.visible,properties:h(a,"properties",{})})):"group"===a.type&&(o=u(t,a,n),i.push(n),n=o)}return e}},function(t,e,i){var x=i(107),T=i(513),w=i(239);t.exports=function(t){for(var e,i=[],n=[],s=null,r=0;r=this.firstgid&&t=n.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}n=i.pop()}else{var s,r=n.layers[n.i];if(n.i++,r.opacity*=n.opacity,r.visible=n.visible&&r.visible,"objectgroup"===r.type){r.name=n.name+r.name;for(var o=n.x+d(r,"startx",0)+d(r,"offsetx",0),a=n.y+d(r,"starty",0)+d(r,"offsety",0),h=[],u=0;un&&(n=e.layer[r].width),e.layer[r].height>s&&(s=e.layer[r].height);var o=new h({width:n,height:s,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:a.WELTMEISTER});return o.layers=u(e,i),o.tilesets=l(e),o}},function(t,e,i){var d=i(105),f=i(75);t.exports=function(t,e){for(var i=[],n=0;nx||!a.visible||(T=this.batchTile(T,a,c,p,g,t,e));else if(1===m)for(h=0;hx||!a.visible||(T=this.batchTile(T,a,c,p,g,t,e));else if(2===m)for(h=f-1;0<=h;h--)for(u=0;ux||!a.visible||(T=this.batchTile(T,a,c,p,g,t,e));else if(3===m)for(h=f-1;0<=h;h--)for(u=d-1;0<=u;u--)!(a=v[h][u])||a.indexx||!a.visible||(T=this.batchTile(T,a,c,p,g,t,e));return this.dirty[e]=!1,null===r&&(r=n.createVertexBuffer(o,s.STATIC_DRAW),this.vertexBuffer[e]=r),n.setVertexBuffer(r),i.setAttribPointers(),s.bufferSubData(s.ARRAY_BUFFER,0,o),this},batchTile:function(t,e,i,n,s,r,o){var a=i.getTileTextureCoordinates(e.index);if(!a)return t;var h=i.tileWidth,u=i.tileHeight,l=h/2,c=u/2,d=a.x/n,f=a.y/s,p=(a.x+h)/n,g=(a.y+u)/s,v=this._tempMatrix,m=-l,y=-c;e.flipX&&(h*=-1,m+=i.tileWidth),e.flipY&&(u*=-1,y+=i.tileHeight);var x=m+h,T=y+u;v.applyITRS(l+e.pixelX,c+e.pixelY,e.rotation,1,1);var w=L.getTintAppendFloatAlpha(16777215,r.alpha*this.alpha*e.alpha),E=v.getX(m,y),_=v.getY(m,y),b=v.getX(m,T),S=v.getY(m,T),A=v.getX(x,T),C=v.getY(x,T),M=v.getX(x,y),O=v.getY(x,y);r.roundPixels&&(E=Math.round(E),_=Math.round(_),b=Math.round(b),S=Math.round(S),A=Math.round(A),C=Math.round(C),M=Math.round(M),O=Math.round(O));var R=this.vertexViewF32[o],P=this.vertexViewU32[o];return R[++t]=E,R[++t]=_,R[++t]=d,R[++t]=f,R[++t]=0,R[++t]=0,P[++t]=w,R[++t]=b,R[++t]=S,R[++t]=d,R[++t]=g,R[++t]=0,R[++t]=0,P[++t]=w,R[++t]=A,R[++t]=C,R[++t]=p,R[++t]=g,R[++t]=0,R[++t]=0,P[++t]=w,R[++t]=E,R[++t]=_,R[++t]=d,R[++t]=f,R[++t]=0,R[++t]=0,P[++t]=w,R[++t]=A,R[++t]=C,R[++t]=p,R[++t]=g,R[++t]=0,R[++t]=0,P[++t]=w,R[++t]=M,R[++t]=O,R[++t]=p,R[++t]=f,R[++t]=0,R[++t]=0,P[++t]=w,this.vertexCount[o]+=6,t},setRenderOrder:function(t){if("string"==typeof t&&(t=["right-down","left-down","right-up","left-up"].indexOf(t)),0<=t&&t<4){this._renderOrder=t;for(var e=0;ethis.vertexCapacity&&(this.flush(),x=!0,y=this.setTexture2D(m));var T=this.vertexViewF32,w=this.vertexViewU32,E=this.vertexCount*this.vertexComponentCount-1;return T[++E]=t,T[++E]=e,T[++E]=h,T[++E]=u,T[++E]=v,w[++E]=d,T[++E]=i,T[++E]=n,T[++E]=h,T[++E]=c,T[++E]=v,w[++E]=p,T[++E]=s,T[++E]=r,T[++E]=l,T[++E]=c,T[++E]=v,w[++E]=g,T[++E]=t,T[++E]=e,T[++E]=h,T[++E]=u,T[++E]=v,w[++E]=d,T[++E]=s,T[++E]=r,T[++E]=l,T[++E]=c,T[++E]=v,w[++E]=g,T[++E]=o,T[++E]=a,T[++E]=l,T[++E]=u,T[++E]=v,w[++E]=f,this.vertexCount+=6,x},batchTri:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g){void 0===g&&(g=this.currentUnit);var v=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),v=!0,g=this.setTexture2D(p));var m=this.vertexViewF32,y=this.vertexViewU32,x=this.vertexCount*this.vertexComponentCount-1;return m[++x]=t,m[++x]=e,m[++x]=o,m[++x]=a,m[++x]=f,y[++x]=l,m[++x]=i,m[++x]=n,m[++x]=o,m[++x]=u,m[++x]=f,y[++x]=c,m[++x]=s,m[++x]=r,m[++x]=h,m[++x]=u,m[++x]=f,y[++x]=d,this.vertexCount+=3,v},bind:function(t){return void 0===t&&(t=!1),u.prototype.bind.call(this,t),this}});t.exports=l},function(t,e,i){var C=i(26),M=i(32),O=i(2);t.exports=function(t,e){var i=t.getContext("experimental-webgl"),n=O(e,"callback"),s=O(e,"type","image/png"),r=O(e,"encoder",.92),o=O(e,"x",0),a=O(e,"y",0),h=O(e,"getPixel",!1),u=O(e,"isFramebuffer",!1),l=u?O(e,"bufferWidth",1):i.drawingBufferWidth,c=u?O(e,"bufferHeight",1):i.drawingBufferHeight;if(h){var d=new Uint8Array(4),f=u?a:c-a;i.readPixels(o,f,1,1,i.RGBA,i.UNSIGNED_BYTE,d),n.call(null,new M(d[0],d[1],d[2],d[3]/255))}else{var p=O(e,"width",l),g=O(e,"height",c),v=p*g*4,m=new Uint8Array(v);i.readPixels(o,c-a-g,p,g,i.RGBA,i.UNSIGNED_BYTE,m);for(var y=C.createWebGL(this,p,g),x=y.getContext("2d"),T=x.getImageData(0,0,p,g),w=T.data,E=0;E>>0;if("function"!=typeof t)throw new TypeError;for(var n=2<=arguments.length?arguments[1]:void 0,s=0;sthis.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoom<.001&&(e.zoom=.001)))},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},function(t,e,i){t.exports={Camera:i(306),BaseCamera:i(93),CameraManager:i(726),Effects:i(314),Events:i(42)}},function(t,e){t.exports="cameradestroy"},function(t,e){t.exports="camerafadeincomplete"},function(t,e){t.exports="camerafadeinstart"},function(t,e){t.exports="camerafadeoutcomplete"},function(t,e){t.exports="camerafadeoutstart"},function(t,e){t.exports="cameraflashcomplete"},function(t,e){t.exports="cameraflashstart"},function(t,e){t.exports="camerapancomplete"},function(t,e){t.exports="camerapanstart"},function(t,e){t.exports="postrender"},function(t,e){t.exports="prerender"},function(t,e){t.exports="camerarotatecomplete"},function(t,e){t.exports="camerarotatestart"},function(t,e){t.exports="camerashakecomplete"},function(t,e){t.exports="camerashakestart"},function(t,e){t.exports="camerazoomcomplete"},function(t,e){t.exports="camerazoomstart"},function(t,e,i){var n=i(17),s=i(0),u=i(42),r=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.isComplete=!1,this.direction=!0,this.duration=0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,r,o,a){if(void 0===t&&(t=!0),void 0===e&&(e=1e3),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(o=null),void 0===a&&(a=this.camera.scene),!r&&this.isRunning)return this.camera;this.isRunning=!0,this.isComplete=!1,this.duration=e,this.direction=t,this.progress=0,this.red=i,this.green=n,this.blue=s,this.alpha=t?Number.MIN_VALUE:1,this._elapsed=0,this._onUpdate=o,this._onUpdateScope=a;var h=t?u.FADE_OUT_START:u.FADE_IN_START;return this.camera.emit(h,this.camera,this,e,i,n,s),this.camera},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=n(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsedthis.source?Math.abs(this.destination-this.source):Math.abs(this.destination+h)-this.source)<(l=this.source>this.destination?Math.abs(this.source-this.destination):Math.abs(this.source+h)-this.destination)?this.clockwise=!0:lMath.PI&&(t-=n.PI2),Math.abs(((t+n.TAU)%n.PI2-n.PI2)%n.PI2)}},function(t,e,i){var n=i(127);t.exports=function(){return n(-Math.PI,Math.PI)}},function(t,e,i){var n=i(127);t.exports=function(){return n(-180,180)}},function(t,e,i){var n=i(332);t.exports=function(t){return n(t+Math.PI)}},function(t,e,i){var n=i(13);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e||(Math.abs(e-t)<=i||Math.abs(e-t)>=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(e>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return 2.3283064365386963e-10*((this.n=i)>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.n=4022871197,this.s0=this.hash(" "),this.s1=this.hash(" "),this.s2=this.hash(" "),this.c=1,t)for(var e=0;e=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}s++}return null},getPoints:function(t){void 0===t&&(t=12);for(var e,i=[],n=0;n=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getTangentAt(h,e)}s++}return null},lineTo:function(t,e){t instanceof d?this._tmpVec2B.copy(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new r([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new c(t))},moveTo:function(t,e){return t instanceof d?this.add(new o(t.x,t.y)):this.add(new o(t,e))},toJSON:function(){for(var t=[],e=0;e>16&255,g:t>>8&255,b:255&t,a:255};return 16777215>>24),e}},function(t,e,i){var h=i(32),u=i(366);t.exports=function(t,e,i){var n,s,r=i,o=i,a=i;return 0!==e&&(r=u(s=2*i-(n=i<.5?i*(1+e):i+e-i*e),n,t+1/3),o=u(s,n,t),a=u(s,n,t-1/3)),(new h).setGLTo(r,o,a,1)}},function(t,e,i){var s=i(176);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],n=0;n<=359;n++)i.push(s(n/359,t,e));return i}},function(t,e,i){function o(t,e,i,n,s,r,o,a){void 0===o&&(o=100),void 0===a&&(a=0);var h=a/o;return{r:u(t,n,h),g:u(e,s,h),b:u(i,r,h)}}var u=i(124);t.exports={RGBWithRGB:o,ColorWithRGB:function(t,e,i,n,s,r){return void 0===s&&(s=100),void 0===r&&(r=0),o(t.r,t.g,t.b,e,i,n,s,r)},ColorWithColor:function(t,e,i,n){return void 0===i&&(i=100),void 0===n&&(n=0),o(t.r,t.g,t.b,e.r,e.g,e.b,i,n)}}},function(t,e,i){var n=i(182),s=i(32);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new s(n(t,e),n(t,e),n(t,e))}},function(t,e,i){var r=i(365);t.exports=function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s="#"),"#"===s?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1):"0x"+r(n)+r(t)+r(e)+r(i)}},function(t,e,i){t.exports={BitmapMask:i(287),GeometryMask:i(288)}},function(t,e,i){var n={AddToDOM:i(131),DOMContentLoaded:i(367),GetInnerHeight:i(368),GetScreenOrientation:i(369),GetTarget:i(374),ParseXML:i(375),RemoveFromDOM:i(188),RequestAnimationFrame:i(353)};t.exports=n},function(t,e,i){t.exports={EventEmitter:i(849)}},function(t,e,i){var n=i(0),s=i(12),r=i(23),o=new n({Extends:s,initialize:function(){s.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});r.register("EventEmitter",o,"events"),t.exports=o},function(t,e,i){var n=i(131),s=i(301),r=i(305),o=i(26),a=i(0),h=i(327),u=i(851),l=i(349),c=i(120),d=i(351),f=i(328),p=i(367),g=i(12),v=i(21),m=i(376),y=i(23),x=i(381),T=i(382),w=i(384),E=i(130),_=i(389),b=i(352),S=i(354),A=i(393),C=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.domContainer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new g,this.anims=new s(this),this.textures=new _(this),this.cache=new r(this),this.registry=new c(this),this.input=new m(this,this.config),this.scene=new w(this,this.config.sceneConfig),this.device=f,this.scale=new T(this,this.config),this.sound=null,this.sound=A.create(this),this.loop=new b(this,this.config.fps),this.plugins=new x(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,p(this.boot.bind(this))},boot:function(){y.hasCore("EventEmitter")?(this.isBooted=!0,this.config.preBoot(this),this.scale.preBoot(),l(this),u(this),d(this),n(this.canvas,this.config.parent),this.textures.once(E.READY,this.texturesReady,this),this.events.emit(v.BOOT)):console.warn("Aborting. Core Plugins missing.")},texturesReady:function(){this.events.emit(v.READY),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),S(this);var t=this.events;t.on(v.HIDDEN,this.onHidden,this),t.on(v.VISIBLE,this.onVisible,this),t.on(v.BLUR,this.onBlur,this),t.on(v.FOCUS,this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(v.PRE_STEP,t,e),i.emit(v.STEP,t,e),this.scene.update(t,e),i.emit(v.POST_STEP,t,e);var n=this.renderer;n.preRender(),i.emit(v.PRE_RENDER,n,t,e),this.scene.render(n),n.postRender(),i.emit(v.POST_RENDER,n,t,e)},headlessStep:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(v.PRE_STEP,t,e),i.emit(v.STEP,t,e),this.scene.update(t,e),i.emit(v.POST_STEP,t,e),i.emit(v.PRE_RENDER),i.emit(v.POST_RENDER)},onHidden:function(){this.loop.pause(),this.events.emit(v.PAUSE)},onVisible:function(){this.loop.resume(),this.events.emit(v.RESUME)},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},getFrame:function(){return this.loop.frame},getTime:function(){return this.loop.now},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.scene.destroy(),this.events.emit(v.DESTROY),this.events.removeAllListeners(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.domContainer&&this.domContainer.parentNode.removeChild(this.domContainer),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=C},function(t,e,i){var n=i(131);t.exports=function(t){var e,i=t.config;i.parent&&i.domCreateContainer&&((e=document.createElement("div")).style.cssText=["display: block;","width: "+t.scale.width+"px;","height: "+t.scale.height+"px;","padding: 0; margin: 0;","position: absolute;","overflow: hidden;","pointer-events: none;","transform: scale(1);","transform-origin: left top;"].join(" "),t.domContainer=e,n(e,i.parent))}},function(t,e){t.exports="boot"},function(t,e){t.exports="destroy"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameout"},function(t,e){t.exports="gameover"},function(t,e){t.exports="gameobjectdown"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameobjectmove"},function(t,e){t.exports="gameobjectout"},function(t,e){t.exports="gameobjectover"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="wheel"},function(t,e){t.exports="gameobjectup"},function(t,e){t.exports="gameobjectwheel"},function(t,e){t.exports="boot"},function(t,e){t.exports="process"},function(t,e){t.exports="update"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointerdownoutside"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="pointerupoutside"},function(t,e){t.exports="wheel"},function(t,e){t.exports="pointerlockchange"},function(t,e){t.exports="preupdate"},function(t,e){t.exports="shutdown"},function(t,e){t.exports="start"},function(t,e){t.exports="update"},function(t,e){t.exports="addfile"},function(t,e){t.exports="complete"},function(t,e){t.exports="filecomplete"},function(t,e){t.exports="filecomplete-"},function(t,e){t.exports="loaderror"},function(t,e){t.exports="load"},function(t,e){t.exports="fileprogress"},function(t,e){t.exports="postprocess"},function(t,e){t.exports="progress"},function(t,e){t.exports="start"},function(t,e,i){t.exports={game:"game",renderer:"renderer",anims:"anims",cache:"cache",plugins:"plugins",registry:"registry",scale:"scale",sound:"sound",textures:"textures",events:"events",cameras:"cameras",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},function(t,e){t.exports=function(t,e,i){if(i.getElementsByTagName("TextureAtlas")){var n=t.source[e];t.add("__BASE",e,0,0,n.width,n.height);for(var s=i.getElementsByTagName("SubTexture"),r=0;r=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i,n,s=t.indexOf(e);return-1!==s&&st.length-1)throw new Error("Index out of bounds");var s=r(t,e);return i&&i.call(n,s),s}},function(t,e,i){var u=i(70);t.exports=function(t,e,i,n,s){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===s&&(s=t),u(t,e,i)){var r=i-e,o=t.splice(e,r);if(n)for(var a=0;a?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var T=i(6);t.exports=function(t,e){var i=e.width,n=e.height,s=Math.floor(i/2),r=Math.floor(n/2),o=T(e,"chars","");if(""!==o){var a=T(e,"image",""),h=T(e,"offset.x",0),u=T(e,"offset.y",0),l=T(e,"spacing.x",0),c=T(e,"spacing.y",0),d=T(e,"lineSpacing",0),f=T(e,"charsPerRow",null);null===f&&(f=t.sys.textures.getFrame(a).width/i)>o.length&&(f=o.length);for(var p=h,g=u,v={retroFont:!0,font:a,size:i,lineHeight:n+d,chars:{}},m=0,y=0;yr.vertexCapacity&&r.flush();for(var g=r.setGameObject(e),v=r.vertexViewF32,m=r.vertexViewU32,y=r.vertexCount*r.vertexComponentCount-1,x=0,T=e.tintFill,w=0;w=i&&t.x<=n&&t.y>=s&&t.y<=r}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||s=n&&(p.push(v),f=v)}var m=o[o.length-1];return y(f,m)i&&(i=a.x),a.xs&&(s=a.y),a.yn(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},function(t,e,i){var r=i(9);t.exports=function(t,e,i,n,s){return void 0===s&&(s=new r),s.setTo(Math.min(t,i),Math.min(e,n),Math.abs(t-i),Math.abs(e-n))}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.centerX,e.y=t.centerY,e}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.width,e.y=t.height,e}},function(t,e,i){var r=i(178);t.exports=function(t,e,i){var n=t.centerX,s=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),r(t,n,s)}},function(t,e,i){var n=i(9),s=i(143);t.exports=function(t,e,i){return void 0===i&&(i=new n),s(t,e)?(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y):i.setEmpty(),i}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;oe.x&&t.ye.y}},function(t,e,i){var a=i(4),h=i(41);t.exports=function(t,e,i){void 0===i&&(i=new a),e=h(e);var n=Math.sin(e),s=Math.cos(e),r=0=s||0=t.downTime+n)&&(i=!0),i)return this.setDragState(t,3),this.processDragStartList(t)},processDragStartList:function(t){if(3!==this.getDragState(t))return 0;for(var e=this._drag[t.id],i=0;it._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,n=0;n'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],s=this;try{var r=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return s.state=o.FILE_ERRORED,void s.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){u.revokeObjectURL(s.data),s.onProcessComplete()},this.data.onerror=function(){u.revokeObjectURL(s.data),s.onProcessError()},u.createObjectURL(this.data,r,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});s.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off(a.UPDATE,this.step,this),t.events.emit(a.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,n){return this.manager.add(t,e,i,n)},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t,e),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(t),this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isPaused:function(t){return void 0===t&&(t=this.key),this.manager.isPaused(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.swapPosition(t,e),this},moveAbove:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveAbove(t,e),this},moveBelow:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveBelow(t,e),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(a.SHUTDOWN,this.shutdown,this),t.off(a.POST_UPDATE,this.step,this),t.off(a.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(a.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});r.register("ScenePlugin",o,"scenePlugin"),t.exports=o},function(t,e,i){t.exports={Events:i(405),List:i(137),Map:i(92),ProcessQueue:i(197),RTree:i(491),Set:i(141),Size:i(383)}},function(t,e,i){var n=i(19),s=i(1324),r=n(!1,r={CanvasTexture:i(390),Events:i(130),FilterMode:s,Frame:i(97),Parsers:i(392),Texture:i(192),TextureManager:i(389),TextureSource:i(391)},s);t.exports=r},function(t,e){t.exports={LINEAR:0,NEAREST:1}},function(t,e,i){t.exports={Components:i(149),Parsers:i(1355),Formats:i(33),ImageCollection:i(513),ParseToTilemap:i(240),Tile:i(75),Tilemap:i(522),TilemapCreator:i(1369),TilemapFactory:i(1370),Tileset:i(107),LayerData:i(105),MapData:i(106),ObjectLayer:i(516),DynamicTilemapLayer:i(523),StaticTilemapLayer:i(524)}},function(t,e,i){var p=i(24),g=i(53);t.exports=function(t,e,i,n,s,r,o,a){t<0&&(t=0),e<0&&(e=0),void 0===o&&(o=!0);for(var h=p(t,e,i,n,null,a),u=s-t,l=r-e,c=0;c=t&&u.index<=e&&l(u,i)}n&&c(0,0,s.width,s.height,s)}}},function(t,e,i){var a=i(65),h=i(53),u=i(153);t.exports=function(t,e,i,n){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var s=0;s=s.delay&&(n=s.elapsed-s.delay,s.elapsed=s.delay,!s.hasDispatched&&s.callback&&(s.hasDispatched=!0,s.callback.apply(s.callbackScope,s.args)),0>2],s+=o[(3&i[r])<<4|i[r+1]>>4],s+=o[(15&i[r+1])<<2|i[r+2]>>6],s+=o[63&i[r+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s}},function(t,e,i){t.exports={Clone:i(69),Extend:i(19),GetAdvancedValue:i(15),GetFastValue:i(2),GetMinMaxValue:i(1395),GetValue:i(6),HasAll:i(1396),HasAny:i(422),HasValue:i(115),IsPlainObject:i(7),Merge:i(134),MergeRight:i(1397),Pick:i(514),SetValue:i(445)}},function(t,e,i){var o=i(6),a=i(17);t.exports=function(t,e,i,n,s){void 0===s&&(s=i);var r=o(t,e,s);return a(r,i,n)}},function(t,e){t.exports=function(t,e){for(var i=0;i=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=l},function(t,e,i){"use strict";var n=Object.prototype.hasOwnProperty,f="~";function s(){}function a(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,i,n,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var r=new a(i,n||t,s),o=f?f+e:e;return t._events[o]?t._events[o].fn?t._events[o]=[t._events[o],r]:t._events[o].push(r):(t._events[o]=r,t._eventsCount++),t}function u(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(f=!1)),o.prototype.eventNames=function(){var t,e,i=[];if(0===this._eventsCount)return i;for(e in t=this._events)n.call(t,e)&&i.push(f?e.slice(1):e);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},o.prototype.listeners=function(t){var e=f?f+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,r=new Array(s);n>>0},getTintAppendFloatAlpha:function(t,e){return((255&(255*e|0))<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255&(255*e|0))<<24|(255&(0|t))<<16|(255&(t>>8|0))<<8|255&(t>>16|0))>>>0},getFloatsFromUintRGB:function(t){return[(255&(t>>16|0))/255,(255&(t>>8|0))/255,(255&(0|t))/255]},checkShaderMax:function(t,e){e&&-1!==e||(e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS));for(var i=t.createShader(t.FRAGMENT_SHADER),n=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");;){var s=n.replace(/%forloop%/gi,function(t){for(var e="",i=0;ir.width&&(i=Math.max(r.width-t,0)),e+n>r.height&&(n=Math.max(r.height-e,0));for(var u=[],l=e;lthis.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=u},function(t,e){t.exports=function(t,e,i,n){var s=i||e.fillColor,r=n||e.fillAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.fillStyle="rgba("+o+","+a+","+h+","+r+")"}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){var s=[];n.forEach(function(t){t&&s.push(t)}),this.loader=t,this.type=e,this.key=i,this.multiKeyIndex=t.multiKeyIndex++,this.files=s,this.complete=!1,this.pending=s.length,this.failed=0,this.config={},this.baseURL=t.baseURL,this.path=t.path,this.prefix=t.prefix;for(var r=0;r=e&&t.y<=i&&t.y+t.height>=i)}},function(t,e){t.exports=function(t,e,i,n){var s=i||e.strokeColor,r=n||e.strokeAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth}},function(t,e,i){var n=i(0),h=i(19),u=i(22),s=i(8),l=i(2),c=i(6),d=i(7),r=new n({Extends:u,initialize:function(t,e,i,n,s){var r,o="json";d(e)&&(e=l(r=e,"key"),i=l(r,"url"),n=l(r,"xhrSettings"),o=l(r,"extension",o),s=l(r,"dataKey",s));var a={type:"json",cache:t.cacheManager.json,extension:o,responseType:"text",key:e,url:i,xhrSettings:n,config:s};u.call(this,t,a),d(i)&&(this.data=s?c(i,s):i,this.state=h.FILE_POPULATED)},onProcess:function(){var t,e;this.state!==h.FILE_POPULATED&&(this.state=h.FILE_PROCESSING,t=JSON.parse(this.xhrLoader.responseText),e=this.config,this.data="string"==typeof e?c(t,e,t):t),this.onProcessComplete()}});s.register("json",function(t,e,i,n){if(Array.isArray(t))for(var s=0;s=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},function(t,e){t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},function(t,e){t.exports=function(t,e,i){var n=i-e;return e+((t-e)%n+n)%n}},function(t,e,i){"use strict";function n(t,e,i){i=i||2;var n,s,r,o,a,h,u,l=e&&e.length,c=l?e[0]*i:t.length,d=g(t,0,c,i,!0),f=[];if(!d||d.next===d.prev)return f;if(l&&(d=function(t,e,i,n){var s,r,o,a,h,u=[];for(s=0,r=e.length;s=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&o=n.x&&n.x>=l&&s!==n.x&&T(ri.x||n.x===i.x&&function(t,e){return w(t.prev,t,e.prev)<0&&w(e.next,t,t.next)<0}(i,n)))&&(i=n,d=h)),n=n.next,n!==u;);return i}(t,e))&&(i=b(e,t),v(e,e.next),v(i,i.next))}}(u[s],i),i=v(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=r=t[0],s=o=t[1];for(var p=i;pr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,l=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=x(a,h,e,i,n),d=x(u,l,e,i,n),f=t.prevZ,p=t.nextZ;for(;f&&f.z>=c&&p&&p.z<=d;){if(f!==t.prev&&f!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=w(f.prev,f,f.next))return!1;if(f=f.prevZ,p!==t.prev&&p!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&0<=w(p.prev,p,p.next))return!1;p=p.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=w(f.prev,f,f.next))return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&0<=w(p.prev,p,p.next))return!1;p=p.nextZ}return!0}(t,n,s,r):function(t){var e=t.prev,i=t,n=t.next;if(0<=w(e,i,n))return!1;var s=t.next.next;for(;s!==t.prev;){if(T(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&0<=w(s.prev,s,s.next))return!1;s=s.next}return!0}(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),d(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?m(t=function(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!l(s,r)&&c(s,n,n.next,r)&&E(s,r)&&E(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),d(n),d(n.next),n=t=r),n=n.next}while(n!==t);return v(n)}(v(t),e,i),e,i,n,s,r,2):2===o&&function(t,e,i,n,s,r){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&c(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(E(t,e)&&E(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;for(;i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next,i!==t;);return n}(t,e)&&(w(t.prev,t,e.prev)||w(t,e.prev,e))||l(t,e)&&0=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function u(t){return 0c&&(c=l[d].vertexSize);var f=E(e,"batchSize",i.config.batchSize);this.vertexCapacity=6*f;var p=E(e,"vertices",new ArrayBuffer(this.vertexCapacity*c));for(this.vertexData=p,E(e,"vertices",null)?this.vertexBuffer=i.createVertexBuffer(p,t.STATIC_DRAW):this.vertexBuffer=i.createVertexBuffer(p.byteLength,t.DYNAMIC_DRAW),this.bytes=new Uint8Array(p),this.vertexViewF32=new Float32Array(p),this.vertexViewU32=new Uint32Array(p),this.renderer.setVertexBuffer(this.vertexBuffer),d=0;dthis.vertexCapacity},resize:function(t,e){t===this.width&&e===this.height||this.flush(),this.width=t,this.height=e;var i=this.projectionMatrix;i&&i.ortho(0,t,e,0,-1e3,1e3);for(var n=this.renderTargets,s=0;s=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t;this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e=0,e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t;this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e=0,e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t;this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=l},function(t,e,i){var n=i(29),s=i(0),r=i(11),o=i(479),a=new s({Mixins:[r.Alpha,r.Flip,r.Visible],initialize:function(t,e,i,n,s,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=n,this.width=s,this.height=r,this.right,this.bottom,this.baseWidth=void 0!==o?o:s,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=void 0,(this.collisionCallbackContext=this).tint=16777215,this.physics={}},containsPoint:function(t,e){return!(tthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*e.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new o),e.x=this.getLeft(),e.y=this.getTop(),e.width=this.getRight()-e.x,e.height=this.getBottom()-e.y,e},getCenterX:function(t){return(this.getLeft(t)+this.getRight(t))/2},getCenterY:function(t){return(this.getTop(t)+this.getBottom(t))/2},intersects:function(t,e,i,n){return!(i<=this.pixelX||n<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){return void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,n,s){return void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=t),void 0===s&&(s=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n,s&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,n){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==n&&(this.baseHeight=n),this.updatePixelXY(),this},updatePixelXY:function(){var t,e,i=this.layer.orientation;return i===n.ORTHOGONAL?(this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight):i===n.ISOMETRIC?(this.pixelX=(this.x-this.y)*this.baseWidth*.5,this.pixelY=(this.x+this.y)*this.baseHeight*.5):i===n.STAGGERED?(this.pixelX=this.x*this.baseWidth+this.y%2*(this.baseWidth/2),this.pixelY=this.y*(this.baseHeight/2)):i===n.HEXAGONAL&&(t=this.layer.hexSideLength,e=(this.baseHeight-t)/2+t,this.pixelX=this.x*this.baseWidth+this.y%2*(this.baseWidth/2),this.pixelY=this.y*e),this.right=this.pixelX+this.baseWidth,this.bottom=this.pixelY+this.baseHeight,this},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||void 0!==this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=a},function(t,e){t.exports={BITMAPMASK_PIPELINE:"BitmapMaskPipeline",LIGHT_PIPELINE:"Light2D",SINGLE_PIPELINE:"SinglePipeline",MULTI_PIPELINE:"MultiPipeline",ROPE_PIPELINE:"RopePipeline",GRAPHICS_PIPELINE:"GraphicsPipeline",POSTFX_PIPELINE:"PostFXPipeline",UTILITY_PIPELINE:"UtilityPipeline"}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e){t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},function(t,e){t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},function(t,e,i){var h=i(103);t.exports=function(t,e,i,n){if(void 0===n&&(n=t),!Array.isArray(e))return-1!==(o=t.indexOf(e))?(h(t,o),i&&i.call(n,e),e):null;for(var s=e.length-1,r=[];0<=s;){var o,a=e[s];-1!==(o=t.indexOf(a))&&(h(t,o),r.push(a),i&&i.call(n,a)),s--}return r}},function(t,e,i){var n=i(0),s=i(191),r=i(9),o=i(3),a=new n({initialize:function(t){this.type=t,this.defaultDivisions=5,this.arcLengthDivisions=100,this.cacheArcLengths=[],this.needsUpdate=!0,this.active=!0,this._tmpVec2A=new o,this._tmpVec2B=new o},draw:function(t,e){return void 0===e&&(e=32),t.strokePoints(this.getPoints(e))},getBounds:function(t,e){t=t||new r,void 0===e&&(e=16);var i=this.getLength();i=t.length)){for(var i=t.length-1,n=t[e],s=e;sh||a.y>u)?(l=Math.max(a.x,e),c=Math.max(a.y,i),E=d=Math.min(a.r,h)-l,b=f=Math.min(a.b,u)-c,T=r?p+(v-(l-a.x)-d):p+(l-a.x),w=o?g+(m-(c-a.y)-f):g+(c-a.y),e=l,i=c,n=d,s=f):b=E=w=T=0):(r&&(T=p+(v-e-n)),o&&(w=g+(m-i-s)));var A=this.source.width,_=this.source.height;return t.u0=Math.max(0,T/A),t.v0=Math.max(0,w/_),t.u1=Math.min(1,(T+E)/A),t.v1=Math.min(1,(w+b)/_),t.x=e,t.y=i,t.cx=T,t.cy=w,t.cw=E,t.ch=b,t.width=n,t.height=s,t.flipX=r,t.flipY=o,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},setUVs:function(t,e,i,n,s,r){var o=this.data.drawImage;return o.width=t,o.height=e,this.u0=i,this.v0=n,this.u1=s,this.v1=r,this},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new r(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=s(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.source=null,this.texture=null,this.glTexture=null,this.customData=null,this.data=null},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=r},function(t,e,i){var s=i(199),n=i(0),r=i(1),o=i(90),a=new n({initialize:function(t){this.parent=t,this.list=[],this.position=0,this.addCallback=r,this.removeCallback=r,this._sortKey=""},add:function(t,e){return e?s.Add(this.list,t):s.Add(this.list,t,0,this.addCallback,this)},addAt:function(t,e,i){return i?s.AddAt(this.list,t,e):s.AddAt(this.list,t,e,0,this.addCallback,this)},getAt:function(t){return this.list[t]},getIndex:function(t){return this.list.indexOf(t)},sort:function(i,t){return i&&(void 0===t&&(t=function(t,e){return t[i]-e[i]}),o(this.list,t)),this},getByName:function(t){return s.GetFirst(this.list,"name",t)},getRandom:function(t,e){return s.GetRandom(this.list,t,e)},getFirst:function(t,e,i,n){return s.GetFirst(this.list,t,e,i,n)},getAll:function(t,e,i,n){return s.GetAll(this.list,t,e,i,n)},count:function(t,e){return s.CountAllMatching(this.list,t,e)},swap:function(t,e){s.Swap(this.list,t,e)},moveTo:function(t,e){return s.MoveTo(this.list,t,e)},remove:function(t,e){return e?s.Remove(this.list,t):s.Remove(this.list,t,this.removeCallback,this)},removeAt:function(t,e){return e?s.RemoveAt(this.list,t):s.RemoveAt(this.list,t,this.removeCallback,this)},removeBetween:function(t,e,i){return i?s.RemoveBetween(this.list,t,e):s.RemoveBetween(this.list,t,e,this.removeCallback,this)},removeAll:function(t){for(var e=this.list.length;e--;)this.remove(this.list[e],t);return this},bringToTop:function(t){return s.BringToTop(this.list,t)},sendToBack:function(t){return s.SendToBack(this.list,t)},moveUp:function(t){return s.MoveUp(this.list,t),t},moveDown:function(t){return s.MoveDown(this.list,t),t},reverse:function(){return this.list.reverse(),this},shuffle:function(){return s.Shuffle(this.list),this},replace:function(t,e){return s.Replace(this.list,t,e)},exists:function(t){return-1=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;ie.right||t.y>e.bottom)}},function(t,e,i){var n=i(0),r=i(12),l=i(37),s=new n({Extends:l,initialize:function(t,e,i,n,s,r,o,a,h,u){void 0===r&&(r=16777215),void 0===o&&(o=1),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0),l.call(this,t,e,i),this.vx=0,this.vy=0,this.vz=0,this.nx=a,this.ny=h,this.nz=u,this.u=n,this.v=s,this.color=r,this.alpha=o,this.tx=0,this.ty=0,this.ta=0},setUVs:function(t,e){return this.u=t,this.v=e,this},transformCoordinatesLocal:function(t,e,i,n){var s=this.x,r=this.y,o=this.z,a=t.val,h=s*a[0]+r*a[4]+o*a[8]+a[12],u=s*a[1]+r*a[5]+o*a[9]+a[13],l=s*a[2]+r*a[6]+o*a[10]+a[14],c=s*a[3]+r*a[7]+o*a[11]+a[15];this.vx=h/c*e,this.vy=-u/c*i,this.vz=n<=0?l/c:-l/c},update:function(t,e,i,n,s,r,o,a){var h=this.vx*t+this.vy*i+s,u=this.vx*e+this.vy*n+r;return o&&(h=Math.round(h),u=Math.round(u)),this.tx=h,this.ty=u,this.ta=this.alpha*a,this},load:function(t,e,i,n,s){return t[++i]=this.tx,t[++i]=this.ty,t[++i]=this.u,t[++i]=this.v,t[++i]=n,t[++i]=s,e[++i]=r.getTintAppendFloatAlpha(this.color,this.ta),i}});t.exports=s},,,function(t,e){t.exports=function(t,e,i){return 0<=t&&t=this.firstgid&&th.getTotalFrames()&&(s=0),r=h.frames[s],0!==s||this.forward||(r=h.getLastFrame()),this.currentFrame=r):console.warn("Missing animation: "+a),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.setCurrentFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.setCurrentFrame(t),this.parent},playAfterDelay:function(t,e){var i,n;return this.isPlaying?(i=this.nextAnim,n=this.nextAnimsQueue,i&&n.unshift(i),this.nextAnim=t,this._pendingStop=1,this._pendingStopValue=e):(this.delayCounter=e,this.play(t,!0)),this.parent},playAfterRepeat:function(t,e){var i,n;return void 0===e&&(e=1),this.isPlaying?(i=this.nextAnim,n=this.nextAnimsQueue,i&&n.unshift(i),-1!==this.repeatCounter&&e>this.repeatCounter&&(e=this.repeatCounter),this.nextAnim=t,this._pendingStop=2,this._pendingStopValue=e):this.play(t),this.parent},play:function(t,e){void 0===e&&(e=!1);var i=this.currentAnim,n=this.parent,s="string"==typeof t?t:t.key;if(e&&this.isPlaying&&i.key===s)return n;if(i&&this.isPlaying){var r=this.animationManager.getMix(i.key,t);if(0this.repeatCounter&&(t=this.repeatCounter),this._pendingStop=2,this._pendingStopValue=t,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},getTotalFrames:function(){return this.currentAnim?this.currentAnim.getTotalFrames():0},update:function(t,e){var i=this.currentAnim;if(this.isPlaying&&i&&!i.paused){if(this.accumulator+=e*this.timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.stop();if(this.hasStarted){if(this.accumulator>=this.nextTick&&(this.forward?i.nextFrame(this):i.previousFrame(this),this.isPlaying&&0===this._pendingStop&&this.skipMissedFrames&&this.accumulator>this.nextTick))for(var n=0;this.forward?i.nextFrame(this):i.previousFrame(this),n++,this.accumulator>this.nextTick&&n<60;);}else this.accumulator>=this.delayCounter&&(this.accumulator-=this.delayCounter,this.handleStart())}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),t.setAlpha&&(e.alpha=t.alpha),e.setSizeToFrame(),e._originComponent&&(t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin()),this.isPlaying&&this.hasStarted&&(this.emitEvents(r.ANIMATION_UPDATE),3===this._pendingStop&&this._pendingStopValue===t&&this.stop()),e},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},get:function(t){return this.anims?this.anims.get(t):null},exists:function(t){return!!this.anims&&this.anims.has(t)},create:function(t){var e=t.key,i=!1;return e&&((i=this.get(e))||(i=new o(this,e,t),this.anims||(this.anims=new s),this.anims.set(e,i))),i},generateFrameNames:function(t,e){return this.animationManager.generateFrameNames(t,e)},generateFrameNumbers:function(t,e){return this.animationManager.generateFrameNumbers(t,e)},remove:function(t){var e=this.get(t);return e&&(this.currentAnim===e&&this.stop(),this.anims.delete(t)),e},destroy:function(){this.animationManager.off(r.REMOVE_ANIMATION,this.globalRemove,this),this.anims&&this.anims.clear(),this.animationManager=null,this.parent=null,this.nextAnim=null,this.nextAnimsQueue.length=0,this.currentAnim=null,this.currentFrame=null},isPaused:{get:function(){return this._paused}}});t.exports=a},function(t,e,i){var n=i(0),s=i(2),r=i(860),o=i(861),a=i(24),z=i(12),h=i(74),u=i(75),l=new n({Extends:u,initialize:function(t){var e=t.game.renderer,i=s(t,"fragShader",r);t.fragShader=z.parseFragmentShaderMaxTextures(i,e.maxTextures),t.vertShader=s(t,"vertShader",o),t.attributes=s(t,"attributes",[{name:"inPosition",size:2,type:h.FLOAT},{name:"inTexCoord",size:2,type:h.FLOAT},{name:"inTexId",size:1,type:h.FLOAT},{name:"inTintEffect",size:1,type:h.FLOAT},{name:"inTint",size:4,type:h.UNSIGNED_BYTE,normalized:!0}]),t.uniforms=s(t,"uniforms",["uProjectionMatrix","uMainSampler"]),u.call(this,t),this._tempMatrix1=new a,this._tempMatrix2=new a,this._tempMatrix3=new a},boot:function(){u.prototype.boot.call(this),this.currentShader.set1iv("uMainSampler",this.renderer.textureIndexes)},batchSprite:function(t,e,i){this.manager.set(this,t);var n,s=this._tempMatrix1,r=this._tempMatrix2,o=this._tempMatrix3,a=t.frame,h=a.glTexture,u=a.u0,l=a.v0,c=a.u1,d=a.v1,f=a.x,p=a.y,g=a.cutWidth,v=a.cutHeight,m=a.customPivot,y=t.displayOriginX,x=t.displayOriginY,T=-y+f,w=-x+p;t.isCropped&&((n=t._crop).flipX===t.flipX&&n.flipY===t.flipY||a.updateCropUVs(n,t.flipX,t.flipY),u=n.u0,l=n.v0,c=n.u1,d=n.v1,g=n.width,v=n.height,T=-y+n.x,w=-x+n.y);var E=1,b=1;t.flipX&&(m||(T+=-a.realWidth+2*y),E=-1),(t.flipY||a.source.isGLTexture&&!h.flipY)&&(m||(w+=-a.realHeight+2*x),b=-1),r.applyITRS(t.x,t.y,t.rotation,t.scaleX*E,t.scaleY*b),s.copyFrom(e.matrix),i?(s.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),r.e=t.x,r.f=t.y):(r.e-=e.scrollX*t.scrollFactorX,r.f-=e.scrollY*t.scrollFactorY),s.multiply(r,o);var S=T+g,A=w+v,_=e.roundPixels,C=o.getXRound(T,w,_),M=o.getYRound(T,w,_),R=o.getXRound(T,A,_),O=o.getYRound(T,A,_),P=o.getXRound(S,A,_),L=o.getYRound(S,A,_),D=o.getXRound(S,w,_),F=o.getYRound(S,w,_),k=z.getTintAppendFloatAlpha,I=e.alpha,B=k(t.tintTopLeft,I*t._alphaTL),N=k(t.tintTopRight,I*t._alphaTR),Y=k(t.tintBottomLeft,I*t._alphaBL),X=k(t.tintBottomRight,I*t._alphaBR);this.shouldFlush(6)&&this.flush();var U=this.setGameObject(t,a);this.manager.preBatch(t),this.batchQuad(t,C,M,R,O,P,L,D,F,u,l,c,d,B,N,Y,X,t.tintEffect,h,U),this.manager.postBatch(t)},batchTexture:function(t,e,i,n,s,r,o,a,h,u,l,c,d,f,p,g,v,m,y,x,T,w,E,b,S,A,_,C,M,R,O,P){this.manager.set(this,t);var L,D,F,k,I,B=this._tempMatrix1,N=this._tempMatrix2,Y=this._tempMatrix3,X=m/i+_,U=y/n+C,z=(m+x)/i+_,G=(y+T)/n+C,W=o,V=a,H=-g,j=-v;t.isCropped&&(o=W=D=(L=t._crop).width,a=V=F=L.height,k=m=L.x,I=y=L.y,c&&(k=x-L.x-D),d&&(I=T-L.y-F),X=k/i+_,U=I/n+C,z=(k+D)/i+_,G=(I+F)/n+C,H=-g+m,j=-v+y),c&&(W*=-1,H+=o),(d^=!O&&e.isRenderTexture?1:0)&&(V*=-1,j+=a);var K=H+W,q=j+V;N.applyITRS(s,r,l,h,u),B.copyFrom(M.matrix),R?(B.multiplyWithOffset(R,-M.scrollX*f,-M.scrollY*p),N.e=s,N.f=r):(N.e-=M.scrollX*f,N.f-=M.scrollY*p),B.multiply(N,Y);var Z=M.roundPixels,J=Y.getXRound(H,j,Z),Q=Y.getYRound(H,j,Z),$=Y.getXRound(H,q,Z),tt=Y.getYRound(H,q,Z),et=Y.getXRound(K,q,Z),it=Y.getYRound(K,q,Z),nt=Y.getXRound(K,j,Z),st=Y.getYRound(K,j,Z);void 0===P&&(P=this.renderer.setTexture2D(e)),t&&this.manager.preBatch(t),this.batchQuad(t,J,Q,$,tt,et,it,nt,st,X,U,z,G,w,E,b,S,A,e,P),t&&this.manager.postBatch(t)},batchTextureFrame:function(t,e,i,n,s,r,o){this.manager.set(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,u=e+t.width,l=i+t.height;o?a.multiply(o,h):h=a;var c=h.getX(e,i),d=h.getY(e,i),f=h.getX(e,l),p=h.getY(e,l),g=h.getX(u,l),v=h.getY(u,l),m=h.getX(u,i),y=h.getY(u,i),x=this.renderer.setTextureSource(t.source);n=z.getTintAppendFloatAlpha(n,s),this.batchQuad(null,c,d,f,p,g,v,m,y,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0,t.glTexture,x)}});t.exports=l},,function(t,e,i){var n=i(4);t.exports=function(t,e,i){return void 0===i&&(i=new n),i.x=t.x+t.radius*Math.cos(e),i.y=t.y+t.radius*Math.sin(e),i}},function(t,e,i){var a=i(4);t.exports=function(t,e){void 0===e&&(e=new a);var i=2*Math.PI*Math.random(),n=Math.random()+Math.random(),s=1=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(1+(s-r)).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},function(t,e,i){var n=i(319),s=i(322),r=i(323),o=i(324);t.exports=function(t){switch(typeof t){case"string":return("rgb"===t.substr(0,3).toLowerCase()?o:n)(t);case"number":return s(t);case"object":return r(t)}}},function(t,e,i){var a=i(100);function h(t,e,i,n){var s=(t+6*e)%6,r=Math.min(s,4-s,1);return Math.round(255*(n-n*i*Math.max(0,r)))}t.exports=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1);var s=h(5,t,e,i),r=h(3,t,e,i),o=h(1,t,e,i);return n?n.setTo?n.setTo(s,r,o,n.alpha,!1):(n.r=s,n.g=r,n.b=o,n.color=a(s,r,o),n):{r:s,g:r,b:o,color:a(s,r,o)}}},function(t,e){t.exports=function(t){return 16777215>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},function(t,e){t.exports=function(t,e,i){return t.x=e-t.width/2,t.y=i-t.height/2,t}},function(t,e,i){var n=i(102),r=i(131),o=i(31),a={canvas:!1,canvasBitBltShift:null,file:!1,fileSystem:!1,getUserMedia:!0,littleEndian:!1,localStorage:!1,pointerLock:!1,support32bit:!1,vibration:!1,webGL:!1,worker:!1};t.exports=function(){a.canvas=!!window.CanvasRenderingContext2D;try{a.localStorage=!!localStorage.getItem}catch(t){a.localStorage=!1}a.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),a.fileSystem=!!window.requestFileSystem;var t,e,i,s=!1;return a.webGL=function(){if(window.WebGLRenderingContext)try{var t=o.createWebGL(this),e=t.getContext("webgl")||t.getContext("experimental-webgl"),i=o.create2D(this),n=i.getContext("2d").createImageData(1,1);return s=n.data instanceof Uint8ClampedArray,o.remove(t),o.remove(i),!!e}catch(t){return!1}return!1}(),a.worker=!!window.Worker,a.pointerLock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,a.getUserMedia=a.getUserMedia&&!!navigator.getUserMedia&&!!window.URL,r.firefox&&r.firefoxVersion<21&&(a.getUserMedia=!1),!n.iOS&&(r.ie||r.firefox||r.chrome)&&(a.canvasBitBltShift=!0),(r.safari||r.mobileSafari)&&(a.canvasBitBltShift=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(a.vibration=!0),"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint32Array&&(a.littleEndian=(t=new ArrayBuffer(4),e=new Uint8Array(t),i=new Uint32Array(t),e[0]=161,e[1]=178,e[2]=195,e[3]=212,3569595041===i[0]||2712847316!==i[0]&&null)),a.support32bit="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof Int32Array&&null!==a.littleEndian&&s,a}()},function(t,e){var i="";function n(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;ic.width&&(t=c.width-d.cutX),d.cutY+e>c.height&&(e=c.height-d.cutY),d.setSize(t,e,d.cutX,d.cutY)),this.updateDisplayOrigin();var f=this.input;return f&&!f.customHitArea&&(f.hitArea.width=t,f.hitArea.height=e),this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e,i,n,s,r){var o=this.frame,a=this.camera,h=this.renderer;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=o.cutWidth),void 0===r&&(r=o.cutHeight);var u,l,c,d,f,p,g=(t>>16&255)/255,v=(t>>8&255)/255,m=(255&t)/255,y=this.renderTarget;return a.preRender(),y?(y.bind(!0),(u=this.pipeline).manager.set(u),l=y.width,c=y.height,d=h.width/l,f=h.height/c,u.drawFillRect(i*d,n*f,s*d,r*f,x.getTintFromFloats(m,v,g,1),e),y.unbind(!0)):(p=this.context,h.setContext(p),p.fillStyle="rgba("+g+","+v+","+m+","+e+")",p.fillRect(i+o.cutX,n+o.cutY,s,r),h.setContext()),this.dirty=!0,this},clear:function(){var t,e;return this.dirty&&((t=this.renderTarget)?t.clear():((e=this.context).save(),e.setTransform(1,0,0,1,0,0),e.clearRect(this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight),e.restore()),this.dirty=!1),this},erase:function(t,e,i){this._eraseMode=!0;var n=this.renderer.currentBlendMode;return this.renderer.setBlendMode(o.ERASE),this.draw(t,e,i,1,16777215),this.renderer.setBlendMode(n),this._eraseMode=!1,this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r=this.camera,o=this.renderer,a=this.renderTarget;return r.preRender(),a?(a.bind(!0),o.resetTextures(!0),this.batchList(t,e,i,n,s),a.unbind(!0)):(o.setContext(this.context),this.batchList(t,e,i,n,s),o.setContext()),this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o=this.camera,a=this.renderTarget,h=this.textureManager.getFrame(t,e);return h&&(o.preRender(),a?(a.bind(!0),this.pipeline.batchTextureFrame(h,i,n,r,s,o.matrix,null),a.unbind(!0)):this.batchTextureFrame(h,i+this.frame.cutX,n+this.frame.cutY,s,r),this.dirty=!0),this},batchList:function(t,e,i,n,s){for(var r=0;rs&&(r=t[s]),n[s]=r,t.length>s+1&&(r=t[s+1]),n[s+1]=r;return this},setColors:function(t){var e=this.points.length;if(e<1)return this;var i=this.colors;void 0===t?t=[16777215]:Array.isArray(t)||(t=[t]);var n=0;if(t.length===e)for(r=0;rn&&(s=t[n]),i[n]=s,t.length>n+1&&(s=t[n+1]),i[n+1]=s;return this},setPoints:function(t,e,i){if(void 0===t&&(t=2),"number"==typeof t){var n,s,r,o=t;if(o<2&&(o=2),t=[],this.horizontal)for(r=-this.frame.halfWidth,s=this.frame.width/(o-1),n=0;n=this._markerOut&&(e.loop?(e.currentTime=this._markerIn,this.updateTexture(),this._lastUpdate=t,this.emit(o.VIDEO_LOOP,this)):(this.emit(o.VIDEO_COMPLETE,this),this.stop())))},checkVideoProgress:function(){2<=this.video.readyState?this.updateTexture():(this.retry--,0e._dx?r<(s=t.right-e.x)&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType!==o.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.right=!0),t.physicsType!==o.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.left=!0)):t._dxe._dy?r<(s=t.bottom-e.y)&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType!==o.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.down=!0),t.physicsType!==o.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.up=!0)):t._dy=t.right||e.position.y>=t.bottom)}},,function(t,e,i){var n=i(29);t.exports=function(t){return"isometric"===(t=t.toLowerCase())?n.ISOMETRIC:"staggered"===t?n.STAGGERED:"hexagonal"===t?n.HEXAGONAL:n.ORTHOGONAL}},function(t,e,i){t.exports={CalculateFacesAt:i(244),CalculateFacesWithin:i(60),CheckIsoBounds:i(520),Copy:i(1393),CreateFromTiles:i(1394),CullBounds:i(522),CullTiles:i(523),Fill:i(1395),FilterTiles:i(1396),FindByIndex:i(1397),FindTile:i(1398),ForEachTile:i(1399),GetCullTilesFunction:i(1400),GetTileAt:i(151),GetTileAtWorldXY:i(1401),GetTilesWithin:i(26),GetTilesWithinShape:i(1402),GetTilesWithinWorldXY:i(506),GetTileToWorldXFunction:i(1403),GetTileToWorldXYFunction:i(1404),GetTileToWorldYFunction:i(1405),GetWorldToTileXFunction:i(1406),GetWorldToTileXYFunction:i(1407),GetWorldToTileYFunction:i(1408),HasTileAt:i(541),HasTileAtWorldXY:i(1409),HexagonalCullBounds:i(525),HexagonalCullTiles:i(524),HexagonalTileToWorldXY:i(529),HexagonalTileToWorldY:i(533),HexagonalWorldToTileXY:i(535),HexagonalWorldToTileY:i(539),IsInLayerBounds:i(116),IsometricCullTiles:i(526),IsometricTileToWorldXY:i(530),IsometricWorldToTileXY:i(536),PutTileAt:i(249),PutTileAtWorldXY:i(1410),PutTilesAt:i(1411),Randomize:i(1412),RemoveTileAt:i(542),RemoveTileAtWorldXY:i(1413),RenderDebug:i(1414),ReplaceByIndex:i(521),RunCull:i(152),SetCollision:i(1415),SetCollisionBetween:i(1416),SetCollisionByExclusion:i(1417),SetCollisionByProperty:i(1418),SetCollisionFromCollisionGroup:i(1419),SetLayerCollisionIndex:i(153),SetTileCollision:i(69),SetTileIndexCallback:i(1420),SetTileLocationCallback:i(1421),Shuffle:i(1422),StaggeredCullBounds:i(528),StaggeredCullTiles:i(527),StaggeredTileToWorldXY:i(531),StaggeredTileToWorldY:i(534),StaggeredWorldToTileXY:i(537),StaggeredWorldToTileY:i(540),SwapByIndex:i(1423),TileToWorldX:i(245),TileToWorldXY:i(532),TileToWorldY:i(246),WeightedRandomize:i(1424),WorldToTileX:i(247),WorldToTileXY:i(538),WorldToTileY:i(248)}},function(t,e,i){var u=i(151);t.exports=function(t,e,i){var n=u(t,e,!0,i),s=u(t,e-1,!0,i),r=u(t,e+1,!0,i),o=u(t-1,e,!0,i),a=u(t+1,e,!0,i),h=n&&n.collides;return h&&(n.faceTop=!0,n.faceBottom=!0,n.faceLeft=!0,n.faceRight=!0),s&&s.collides&&(h&&(n.faceTop=!1),s.faceBottom=!h),r&&r.collides&&(h&&(n.faceBottom=!1),r.faceTop=!h),o&&o.collides&&(h&&(n.faceLeft=!1),o.faceRight=!h),a&&a.collides&&(h&&(n.faceRight=!1),a.faceLeft=!h),n&&!n.collides&&n.resetFaces(),n}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileWidth,s=i.tilemapLayer,r=0;return s&&(e=e||s.scene.cameras.main,r=s.x+e.scrollX*(1-s.scrollFactorX),n*=s.scaleX),r+t*n}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileHeight,s=i.tilemapLayer,r=0;return s&&(e=e||s.scene.cameras.main,r=s.y+e.scrollY*(1-s.scrollFactorY),n*=s.scaleY),r+t*n}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileWidth,r=n.tilemapLayer;return r&&(i=i||r.scene.cameras.main,t-=r.x+i.scrollX*(1-r.scrollFactorX),s*=r.scaleX),e?Math.floor(t/s):t/s}},function(t,e){t.exports=function(t,e,i,n){void 0===e&&(e=!0);var s=n.baseTileHeight,r=n.tilemapLayer;return r&&(i=i||r.scene.cameras.main,t-=r.y+i.scrollY*(1-r.scrollFactorY),s*=r.scaleY),e?Math.floor(t/s):t/s}},function(t,e,i){var l=i(81),c=i(116),d=i(244),f=i(69);t.exports=function(t,e,i,n,s){if(void 0===n&&(n=!0),!c(e,i,s))return null;var r,o=s.data[i][e],a=o&&o.collides;t instanceof l?(null===s.data[i][e]&&(s.data[i][e]=new l(s,t.index,e,i,s.tileWidth,s.tileHeight)),s.data[i][e].copy(t)):(r=t,null===s.data[i][e]?s.data[i][e]=new l(s,r,e,i,s.tileWidth,s.tileHeight):s.data[i][e].index=r);var h=s.data[i][e],u=-1!==s.collideIndexes.indexOf(h.index);return f(h,u),n&&a!==h.collides&&d(e,i,s),h}},function(t,e,i){var p=i(38),g=i(117),v=i(118),m=i(81);t.exports=function(t,e,i,n,s){for(var r=new g({tileWidth:i,tileHeight:n}),o=new v({name:t,tileWidth:i,tileHeight:n,format:p.ARRAY_2D,layers:[r]}),a=[],h=e.length,u=0,l=0;lt&&(t=s.totalDuration),s.delay=t.right&&(o=1,r+=s-t.right,s=t.right);break;case 1:(r+=e)>=t.bottom&&(o=2,s-=r-t.bottom,r=t.bottom);break;case 2:(s-=e)<=t.left&&(o=3,r-=t.left-s,s=t.left);break;case 3:(r-=e)<=t.top&&(o=0,r=t.top)}return n}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=[]);var n=Math.round(t.x1),s=Math.round(t.y1),r=Math.round(t.x2),o=Math.round(t.y2),a=Math.abs(r-n),h=Math.abs(o-s),u=ne.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s){void 0===s&&(s=!1),this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=n,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0,this.isKeyFrame=s},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration,keyframe:this.isKeyFrame}},destroy:function(){this.frame=void 0}});t.exports=n},function(t,e){t.exports=function(t){var i=/\D/g;return t.sort(function(t,e){return parseInt(t.replace(i,""),10)-parseInt(e.replace(i,""),10)}),t}},function(t,e,i){var n=i(177),s=i(0),r=i(98),o=i(10),a=i(128),h=i(23),T=i(2),d=i(6),f=i(178),p=i(314),u=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.mixes=new r,this.paused=!1,this.name="AnimationManager",t.events.once(h.BOOT,this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once(h.DESTROY,this.destroy,this)},addMix:function(t,e,i){var n,s=this.anims,r=this.mixes,o="string"==typeof t?t:t.key,a="string"==typeof e?e:e.key;return s.has(o)&&s.has(a)&&((n=(n=r.get(o))||{})[a]=i,r.set(o,n)),this},removeMix:function(t,e){var i,n=this.mixes,s="string"==typeof t?t:t.key,r=n.get(s);return r&&(e?(i="string"==typeof e?e:e.key,r.hasOwnProperty(i)&&delete r[i]):e||n.delete(s)),this},getMix:function(t,e){var i=this.mixes,n="string"==typeof t?t:t.key,s="string"==typeof e?e:e.key,r=i.get(n);return r&&r.hasOwnProperty(s)?r[s]:0},add:function(t,e){return this.anims.has(t)?console.warn("Animation key exists: "+t):(e.key=t,this.anims.set(t,e),this.emit(a.ADD_ANIMATION,t,e)),this},exists:function(t){return this.anims.has(t)},createFromAseprite:function(g,v){var m=[],t=this.game.cache.json.get(g);if(!t)return m;var y=this,e=d(t,"meta",null),x=d(t,"frames",null);return e&&x&&d(e,"frameTags",[]).forEach(function(t){var e=[],i=T(t,"name",null),n=T(t,"from",0),s=T(t,"to",0),r=T(t,"direction","forward");if(i&&(!v||v&&-1u.right&&(l=b(l,l+(d-u.right),this.lerp.x)),fu.bottom&&(c=b(c,c+(f-u.bottom),this.lerp.y))):(l=b(l,d-o,this.lerp.x),c=b(c,f-a,this.lerp.y)),p=!0),this.useBounds&&(l=this.clampX(l),c=this.clampY(c)),this.roundPixels&&(o=Math.round(o),a=Math.round(a),l=Math.round(l),c=Math.round(c));var g=(this.scrollX=l)+i,v=(this.scrollY=c)+n;this.midPoint.set(g,v);var m=t/s,y=e/s,x=g-m/2,T=v-y/2;this.roundPixels&&(x=Math.round(x),T=Math.round(T)),this.worldView.setTo(x,T,m,y),r.applyITRS(this.x+o,this.y+a,this.rotation,s,s),r.translate(-o,-a),this.shakeEffect.preRender(),p&&this.emit(E.FOLLOW_UPDATE,this,h)},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=l(i,0,1),n=l(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var o=this.width/2,a=this.height/2,h=t.x-s,u=t.y-r;return this.midPoint.set(h,u),this.scrollX=h-o,this.scrollY=u-a,this.useBounds&&(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.rotateToEffect.reset(),this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.rotateToEffect.update(t,e),this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.resetFX(),s.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=u},function(t,e,i){var o=i(36);t.exports=function(t){var e=new o;t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,e,i,n){return e+e+i+i+n+n});var i,n,s,r=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return r&&(i=parseInt(r[1],16),n=parseInt(r[2],16),s=parseInt(r[3],16),e.setTo(i,n,s)),e}},function(t,e){t.exports=function(t,e,i,n){return n<<24|t<<16|e<<8|i}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,u=r;return r!==s&&(r===t?a=(e-i)/o+(er[0]&&(e=1),r[8]>r[3*e+e]&&(e=2),i=a[e],n=a[i],s=Math.sqrt(r[3*e+e]-r[3*i+i]-r[3*n+n]+1),h[e]=.5*s,s=.5/s,h[i]=(r[3*i+e]+r[3*e+i])*s,h[n]=(r[3*n+e]+r[3*e+n])*s,this._x=h[0],this._y=h[1],this._z=h[2],this._w=(r[3*n+i]-r[3*i+n])*s),this.onChangeCallback(this),this}});t.exports=f},function(t,e,a){var h=a(359),u=a(31),l=a(39),c=a(183);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===l.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==l.HEADLESS)if(e.renderType===l.CANVAS||e.renderType!==l.CANVAS&&!c.webGL){if(!c.canvas)throw new Error("Cannot create Canvas or WebGL context, aborting.");e.renderType=l.CANVAS}else e.renderType=l.WEBGL;e.antialias||u.disableSmoothing();var i,n,s=t.scale.baseSize,r=s.width,o=s.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=r,t.canvas.height=o):t.canvas=u.create(t,r,o,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||h.setCrisp(t.canvas),e.renderType!==l.HEADLESS&&(i=a(568),n=a(571),e.renderType===l.WEBGL?t.renderer=new n(t):(t.renderer=new i(t),t.context=t.renderer.gameContext))}},function(t,e){t.exports={setCrisp:function(e){return["optimizeSpeed","-moz-crisp-edges","-o-crisp-edges","-webkit-optimize-contrast","optimize-contrast","crisp-edges","pixelated"].forEach(function(t){e.style["image-rendering"]=t}),e.style.msInterpolationMode="nearest-neighbor",e},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var u=i(39);t.exports=function(t){var e,i,n,s,r,o,a,h=t.config;h.hideBanner||(e="WebGL",h.renderType===u.CANVAS?e="Canvas":h.renderType===u.HEADLESS&&(e="Headless"),i=h.audio,a=(n=t.device.audio).webAudio&&!i.disableWebAudio?"Web Audio":i.noAudio||!n.webAudio&&!n.audioData?"No Audio":"HTML5 Audio",t.device.browser.ie?window.console&&console.log("Phaser v"+u.VERSION+" / https://phaser.io"):(r=[s=""],Array.isArray(h.bannerBackgroundColor)?(h.bannerBackgroundColor.forEach(function(t){s=s.concat("%c "),r.push("background: "+t),o=t}),r[r.length-1]="color: "+h.bannerTextColor+"; background: "+o):(s=s.concat("%c "),r.push("color: "+h.bannerTextColor+"; background: "+h.bannerBackgroundColor)),r.push("background: #fff"),h.gameTitle&&(s=s.concat(h.gameTitle),h.gameVersion&&(s=s.concat(" v"+h.gameVersion)),h.hidePhaser||(s=s.concat(" / "))),h.hidePhaser||(s=s.concat("Phaser v"+u.VERSION+" ("+e+" | "+a+")")),s=s.concat(" %c "+h.gameURL),r[0]=s,console.log.apply(console,r)))}},function(t,e,i){var n=i(0),s=i(6),r=i(1),o=i(362),a=new n({initialize:function(t,e){this.game=t,this.raf=new o,this.started=!1,this.running=!1,this.minFps=s(e,"min",5),this.targetFps=s(e,"target",60),this._min=1e3/this.minFps,this._target=1e3/this.targetFps,this.actualFps=this.targetFps,this.nextFpsUpdate=0,this.framesThisSecond=0,this.callback=r,this.forceSetTimeOut=s(e,"forceSetTimeOut",!1),this.time=0,this.startTime=0,this.lastTime=0,this.frame=0,this.inFocus=!0,this._pauseTime=0,this._coolDown=0,this.delta=0,this.deltaIndex=0,this.deltaHistory=[],this.deltaSmoothingMax=s(e,"deltaHistory",10),this.panicMax=s(e,"panicMax",120),this.rawDelta=0,this.now=0,this.smoothStep=s(e,"smoothStep",!0)},blur:function(){this.inFocus=!1},focus:function(){this.inFocus=!0,this.resetDelta()},pause:function(){this._pauseTime=window.performance.now()},resume:function(){this.resetDelta(),this.startTime+=this.time-this._pauseTime},resetDelta:function(){var t=window.performance.now();this.time=t,this.lastTime=t,this.nextFpsUpdate=t+1e3;for(var e=this.framesThisSecond=0;ethis._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var a=o=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),this.lastTime=t,this.frame++},tick:function(){this.step()},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){this.running||(t&&(this.startTime+=-this.lastTime+(this.lastTime+window.performance.now())),this.raf.start(this.step.bind(this),this.useRAF),this.running=!0,this.step())},getDuration:function(){return Math.round(this.lastTime-this.startTime)/1e3},getDurationMS:function(){return Math.round(this.lastTime-this.startTime)},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.callback=r,this.raf=null,this.game=null}});t.exports=a},function(t,e,i){var n=i(0),s=i(1),r=new n({initialize:function(){this.isRunning=!1,this.callback=s,this.tick=0,this.isSetTimeOut=!1,this.timeOutID=null,this.lastTime=0,this.target=0;var n=this;this.step=function t(){var e=window.performance.now();n.lastTime=n.tick,n.tick=e,n.callback(e),n.timeOutID=window.requestAnimationFrame(t)},this.stepTimeout=function t(){var e=Date.now(),i=Math.min(Math.max(2*n.target+n.tick-e,0),n.target);n.lastTime=n.tick,n.tick=e,n.callback(e),n.timeOutID=window.setTimeout(t,i)}},start:function(t,e,i){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.target=i,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=s}});t.exports=r},function(t,e,i){var n=i(23);t.exports=function(t){var e,i=t.events;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach(function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")});e&&document.addEventListener(e,function(t){document.hidden||"pause"===t.type?i.emit(n.HIDDEN):i.emit(n.VISIBLE)},!1),window.onblur=function(){i.emit(n.BLUR)},window.onfocus=function(){i.emit(n.FOCUS)},window.focus&&t.config.autoFocus&&window.focus()}},function(t,e,i){var m=i(365),y=i(31),x=i(6);t.exports=function(t){var e=x(t,"data",[]),i=x(t,"canvas",null),n=x(t,"palette",m),s=x(t,"pixelWidth",1),r=x(t,"pixelHeight",s),o=x(t,"resizeCanvas",!0),a=x(t,"clearCanvas",!0),h=x(t,"preRender",null),u=x(t,"postRender",null),l=Math.floor(Math.abs(e[0].length*s)),c=Math.floor(Math.abs(e.length*r));i||(i=y.create2D(this,l,c),a=o=!1),o&&(i.width=l,i.height=c);var d=i.getContext("2d");a&&d.clearRect(0,0,l,c),h&&h(i,d);for(var f=0;fi.length-2?i.length-1:s+1],u=i[s>i.length-3?i.length-1:s+2];return e.set(l(r,o.x,a.x,h.x,u.x),l(r,o.y,a.y,h.y,u.y))},toJSON:function(){for(var t=[],e=0;ethis.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var e=this.listeners;window.removeEventListener("orientationchange",e.orientationChange,!1),window.removeEventListener("resize",e.windowResize,!1);["webkit","moz",""].forEach(function(t){document.removeEventListener(t+"fullscreenchange",e.fullScreenChange,!1),document.removeEventListener(t+"fullscreenerror",e.fullScreenError,!1)}),document.removeEventListener("MSFullscreenChange",e.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",e.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.fullscreenTarget=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy()},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===l.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===l.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=v},function(t,e,i){var n=i(16),s=i(0),r=i(72),o=i(3),a=new s({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===n&&(n=null),this._width=t,this._height=e,this._parent=n,this.aspectMode=i,this.aspectRatio=0===e?1:t/e,this.minWidth=0,this.minHeight=0,this.maxWidth=Number.MAX_VALUE,this.maxHeight=Number.MAX_VALUE,this.snapTo=new o},setAspectMode:function(t){return void 0===t&&(t=0),this.aspectMode=t,this.setSize(this._width,this._height)},setSnap:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.snapTo.set(t,e),this.setSize(this._width,this._height)},setParent:function(t){return this._parent=t,this.setSize(this._width,this._height)},setMin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.minWidth=n(t,0,this.maxWidth),this.minHeight=n(e,0,this.maxHeight),this.setSize(this._width,this._height)},setMax:function(t,e){return void 0===t&&(t=Number.MAX_VALUE),void 0===e&&(e=t),this.maxWidth=n(t,this.minWidth,Number.MAX_VALUE),this.maxHeight=n(e,this.minHeight,Number.MAX_VALUE),this.setSize(this._width,this._height)},setSize:function(t,e){switch(void 0===t&&(t=0),void 0===e&&(e=t),this.aspectMode){case a.NONE:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height;break;case a.WIDTH_CONTROLS_HEIGHT:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(this._width*(1/this.aspectRatio),!1);break;case a.HEIGHT_CONTROLS_WIDTH:this._height=this.getNewHeight(r(e,this.snapTo.y)),this._width=this.getNewWidth(this._height*this.aspectRatio,!1);break;case a.FIT:this.constrain(t,e,!0);break;case a.ENVELOP:this.constrain(t,e,!1)}return this},setAspectRatio:function(t){return this.aspectRatio=t,this.setSize(this._width,this._height)},resize:function(t,e){return this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height,this},getNewWidth:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minWidth,this.maxWidth),e&&this._parent&&t>this._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var n=this.snapTo,s=0===e?1:t/e;return i&&this.aspectRatio>s||!i&&this.aspectRatios)&&(t=(e=r(e,n.y))*this.aspectRatio,0r.START&&n.settings.status<=r.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e=r.LOADING&&i.settings.status=r.x&&t=r.y&&e=r.x&&t=r.y&&e=n-this.manager.loopEndOffset?(this.audio.currentTime=i+Math.max(0,s-n),s=this.audio.currentTime):s>4,u[a++]=(15&i)<<4|n>>2,u[a++]=(3&n)<<6|63&s;return h}},function(t,e,i){var n=i(142),s=i(0),r=i(66),o=new s({Extends:n,initialize:function(t,e,i){if(void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),!this.audioBuffer)throw new Error('There is no audio asset with key "'+e+'" in the audio cache');this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,n.call(this,t,e,i)},play:function(t,e){return!!n.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit(r.PLAY,this),!0)},pause:function(){return!(this.manager.context.currentTime>>16,g=(65280&c)>>>8,v=255&c,h.strokeStyle="rgba("+p+","+g+","+v+","+u+")",h.lineWidth=f,m+=3;break;case y.FILL_STYLE:d=o[m+1],l=o[m+2],p=(16711680&d)>>>16,g=(65280&d)>>>8,v=255&d,h.fillStyle="rgba("+p+","+g+","+v+","+l+")",m+=2;break;case y.BEGIN_PATH:h.beginPath();break;case y.CLOSE_PATH:h.closePath();break;case y.FILL_PATH:r||h.fill();break;case y.STROKE_PATH:r||h.stroke();break;case y.FILL_RECT:r?h.rect(o[m+1],o[m+2],o[m+3],o[m+4]):h.fillRect(o[m+1],o[m+2],o[m+3],o[m+4]),m+=4;break;case y.FILL_TRIANGLE:h.beginPath(),h.moveTo(o[m+1],o[m+2]),h.lineTo(o[m+3],o[m+4]),h.lineTo(o[m+5],o[m+6]),h.closePath(),r||h.fill(),m+=6;break;case y.STROKE_TRIANGLE:h.beginPath(),h.moveTo(o[m+1],o[m+2]),h.lineTo(o[m+3],o[m+4]),h.lineTo(o[m+5],o[m+6]),h.closePath(),r||h.stroke(),m+=6;break;case y.LINE_TO:h.lineTo(o[m+1],o[m+2]),m+=2;break;case y.MOVE_TO:h.moveTo(o[m+1],o[m+2]),m+=2;break;case y.LINE_FX_TO:h.lineTo(o[m+1],o[m+2]),m+=5;break;case y.MOVE_FX_TO:h.moveTo(o[m+1],o[m+2]),m+=5;break;case y.SAVE:h.save();break;case y.RESTORE:h.restore();break;case y.TRANSLATE:h.translate(o[m+1],o[m+2]),m+=2;break;case y.SCALE:h.scale(o[m+1],o[m+2]),m+=2;break;case y.ROTATE:h.rotate(o[m+1]),m+=1;break;case y.GRADIENT_FILL_STYLE:m+=5;break;case y.GRADIENT_LINE_STYLE:m+=6}}h.restore()}}},function(t,e,i){var n=i(0),s=i(132),r=i(78),o=i(2),a=i(64),h=new n({initialize:function(t,e,i,n){void 0===n&&(n=!1),this.propertyKey=e,this.propertyValue=i,this.defaultValue=i,this.steps=0,this.counter=0,this.start=0,this.end=0,this.ease,this.emitOnly=n,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.loadConfig(t)},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=o(t,this.propertyKey,this.defaultValue),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return this.propertyValue},onChange:function(t){return this.propertyValue=t,this.setMethods()},setMethods:function(){var t,e,i,n=this.propertyValue,s=typeof n;return this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,"number"==s?(this.onEmit=this.staticValueEmit,this.onUpdate=this.staticValueUpdate):Array.isArray(n)?this.onEmit=this.randomStaticValueEmit:"function"==s?this.emitOnly?this.onEmit=n:this.onUpdate=n:"object"==s&&this.hasBoth(n,"start","end")?(this.start=n.start,this.end=n.end,(t=this.has(n,"random"))&&(this.onEmit=this.randomRangedValueEmit),this.has(n,"steps")?(this.steps=n.steps,this.counter=this.start,this.onEmit=this.steppedEmit):(e=this.has(n,"ease")?n.ease:"Linear",this.ease=r(e,n.easeParams),t||(this.onEmit=this.easedValueEmit),this.onUpdate=this.easeValueUpdate)):"object"==s&&this.hasBoth(n,"min","max")?(this.start=n.min,this.end=n.max,this.onEmit=this.randomRangedValueEmit):"object"==s&&this.has(n,"random")?(i=n.random,Array.isArray(i)&&(this.start=i[0],this.end=i[1]),this.onEmit=this.randomRangedValueEmit):"object"==s&&this.hasEither(n,"onEmit","onUpdate")&&(this.has(n,"onEmit")&&(this.onEmit=n.onEmit),this.has(n,"onUpdate")&&(this.onUpdate=n.onUpdate)),this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,n){return n},staticValueEmit:function(){return this.propertyValue},staticValueUpdate:function(){return this.propertyValue},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.propertyValue[t]},randomRangedValueEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i),i},steppedEmit:function(){var t=this.counter,e=this.counter+(this.end-this.start)/this.steps;return this.counter=a(e,this.start,this.end),t},easedValueEmit:function(t,e){var i;return t&&t.data[e]&&((i=t.data[e]).min=this.start,i.max=this.end),this.start},easeValueUpdate:function(t,e,i){var n=t.data[e];return(n.max-n.min)*this.ease(i)+n.min}});t.exports=h},function(t,e,i){var n=i(0),o=i(2),s=new n({initialize:function(t,e,i,n,s){var r;"object"==typeof t?(t=o(r=t,"x",0),e=o(r,"y",0),i=o(r,"power",0),n=o(r,"epsilon",100),s=o(r,"gravity",50)):(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===s&&(s=50)),this.x=t,this.y=e,this.active=!0,this._gravity=s,this._power=0,this._epsilon=0,this.power=i,this.epsilon=n},update:function(t,e){var i,n,s=this.x-t.x,r=this.y-t.y,o=s*s+r*r;0!==o&&(i=Math.sqrt(o),oe.right&&t.collideRight&&(this.x=e.right,this.velocityX*=i),this.ye.bottom&&t.collideBottom&&(this.y=e.bottom,this.velocityY*=i)},update:function(t,e,i){if(0this._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=n},function(t,e){t.exports=function(t,e){for(var i=0;id.PI2?s=d.PI2:s<0&&(s=d.PI2+s%d.PI2);for(var a,h=[r+Math.cos(n)*i,o+Math.sin(n)*i];e<1;)a=s*e+n,h.push(r+Math.cos(a)*i,o+Math.sin(a)*i),e+=t;return a=s+n,h.push(r+Math.cos(a)*i,o+Math.sin(a)*i),h.push(r+Math.cos(n)*i,o+Math.sin(n)*i),this.pathIndexes=l(h),this.pathData=h,this}});t.exports=r},function(t,e,i){var n=i(0),s=i(1083),r=i(65),o=i(9),a=i(33),h=new n({Extends:a,Mixins:[s],initialize:function(t,e,i,n,s,r){void 0===e&&(e=0),void 0===i&&(i=0),a.call(this,t,"Curve",n),this._smoothness=32,this._curveBounds=new o,this.closePath=!1,this.setPosition(e,i),void 0!==s&&this.setFillStyle(s,r),this.updateData()},smoothness:{get:function(){return this._smoothness},set:function(t){this._smoothness=t,this.updateData()}},setSmoothness:function(t){return this._smoothness=t,this.updateData()},updateData:function(){var t=this._curveBounds,e=this._smoothness;this.geom.getBounds(t,e),this.setSize(t.width,t.height),this.updateDisplayOrigin();for(var i=[],n=this.geom.getPoints(e),s=0;st.right||e.rightt.bottom||e.bottome.right||t.righte.bottom||t.bottome.right||t.righte.bottom||t.bottomt.width*t.height)&&(e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(s.BUTTON_DOWN,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(s.BUTTON_UP,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=r},function(t,e,i){var a=i(486),h=i(487),n=i(0),u=i(10),l=i(3),s=new n({Extends:u,initialize:function(t,e){u.call(this),this.manager=t,this.pad=e,this.id=e.id,this.index=e.index;for(var i=[],n=0;n=s;for(this.fixedStep||(n=.001*e,o=!0,this._elapsed=0),h=0;h=s;)this._elapsed-=s,this.step(n)}},step:function(t){for(var e,i=this.bodies.entries,n=i.length,s=0;sc)&&(d.xl))return this.separateCircle(t,e,s)}var f=!1,p=!1;s?(f=M(t,e,s,this.OVERLAP_BIAS),p=R(t,e,s,this.OVERLAP_BIAS)):this.forceX||Math.abs(this.gravity.y+t.gravity.y)=e.right||t.position.y>=e.bottom))},circleBodyIntersects:function(t,e){var i=p(t.center.x,e.left,e.right),n=p(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!0)},collide:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!1)},collideObjects:function(t,e,i,n,s,r){var o;t.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);var a=Array.isArray(t),h=Array.isArray(e);if(this._total=0,a||h)if(!a&&h)for(o=0;od.baseTileWidth&&(h-=a=(d.tileWidth-d.baseTileWidth)*e.scaleX,l+=a),d.tileHeight>d.baseTileHeight&&(c+=(d.tileHeight-d.baseTileHeight)*e.scaleY);var f=S(h,u,l,c,null,e.scene.cameras.main,e.layer);return 0!==f.length&&this.collideSpriteVsTilesHandler(t,f,i,n,s,r,!0)},collideSpriteVsTilesHandler:function(t,e,i,n,s,r,o){for(var a,h,u=t.body,l={left:0,right:0,top:0,bottom:0},c=!1,d=0;de.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,r=this.blocked.right=!0),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,r=this.blocked.down=!0),r&&(this.blocked.none=!1,this.updateCenter()),r},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this},setSize:function(t,e,i){void 0===i&&(i=!0);var n,s,r=this.gameObject;return!t&&r.frame&&(t=r.frame.realWidth),!e&&r.frame&&(e=r.frame.realHeight),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&r.getCenter&&(n=(r.width-t)/2,s=(r.height-e)/2,this.offset.set(n,s)),this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),0=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-e)*(this.center.y-e)<=this.radius*this.radius:h(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return 0=t.minX&&e.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,i,n,s){for(var r,o=[e,i];o.length;)(i=o.pop())-(e=o.pop())<=n||(r=e+Math.ceil((i-e)/n/2)*n,a(t,r,e,i,s),o.push(e,r,r,i))}n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!u(t,e))return i;for(var s,r,o,a,h=[];e;){for(s=0,r=e.children.length;sthis._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)},_split:function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var r=this._chooseSplitIndex(i,s,n),o=p(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,f(i,this.toBBox),f(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)},_splitRoot:function(t,e){this.data=p([t,e]),this.data.height=t.height+1,this.data.leaf=!1,f(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){for(var n,s,r,o,a,h,u,l,c,d,f,p,g=a=1/0,v=e;v<=i-e;v++)n=m(t,0,v,this.toBBox),s=m(t,v,i,this.toBBox),u=n,l=s,p=f=d=c=void 0,c=Math.max(u.minX,l.minX),d=Math.max(u.minY,l.minY),f=Math.min(u.maxX,l.maxX),p=Math.min(u.maxY,l.maxY),r=Math.max(0,f-c)*Math.max(0,p-d),o=y(n)+y(s),re.deltaAbsY()?g=-1:e.deltaAbsX()i&&s<(o=t.right-i)&&(o=0),0!==o&&(t.customSeparateX?t.overlapX=o:c(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.left=!0):0i&&s<(o=t.bottom-i)&&(o=0),0!==o&&(t.customSeparateY?t.overlapY=o:c(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):0n.worldView.x+s.scaleX*i.tileWidth*(-r-.5)&&a.xn.worldView.y+s.scaleY*i.tileHeight*(-o-1)&&a.y=n.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}n=i.pop()}else{var s,r,o,a=n.layers[n.i];n.i++,"imagelayer"===a.type?(s=h(a,"offsetx",0)+h(a,"startx",0),r=h(a,"offsety",0)+h(a,"starty",0),e.push({name:n.name+a.name,image:a.image,x:n.x+s+a.x,y:n.y+r+a.y,alpha:n.opacity*a.opacity,visible:n.visible&&a.visible,properties:h(a,"properties",{})})):"group"===a.type&&(o=u(t,a,n),i.push(n),n=o)}return e}},function(t,e,i){var d=i(2),f=i(251),p=i(551),g=i(154);t.exports=function(t){for(var e=[],i=[],n=g(t);n.i=n.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}n=i.pop()}else{var s,r=n.layers[n.i];if(n.i++,r.opacity*=n.opacity,r.visible=n.visible&&r.visible,"objectgroup"===r.type){r.name=n.name+r.name;for(var o=n.x+d(r,"startx",0)+d(r,"offsetx",0),a=n.y+d(r,"starty",0)+d(r,"offsety",0),h=[],u=0;u=r.layers.length){if(s.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}r=s.pop()}else{var o,a=r.layers[r.i];if(r.i++,"tilelayer"===a.type)if(a.compression)console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+a.name+"'");else{if(a.encoding&&"base64"===a.encoding){if(a.chunks)for(var h=0;h>>0;return n}},function(t,e,i){var w=i(119),E=i(555),b=i(251);t.exports=function(t){for(var e,i=[],n=[],s=null,r=0;r=this.firstgid&&tn&&(n=e.layer[r].width),e.layer[r].height>s&&(s=e.layer[r].height);var o=new h({width:n,height:s,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:a.WELTMEISTER});return o.layers=u(e,i),o.tilesets=l(e),o}},function(t,e,i){var d=i(117),f=i(81);t.exports=function(t,e){for(var i=[],n=0;n>>0;if("function"!=typeof t)throw new TypeError;for(var n=2<=arguments.length?arguments[1]:void 0,s=0;sthis.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoom<.001&&(e.zoom=.001)))},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},function(t,e,i){t.exports={Camera:i(318),BaseCamera:i(99),CameraManager:i(767),Effects:i(325),Events:i(35)}},function(t,e){t.exports="cameradestroy"},function(t,e){t.exports="camerafadeincomplete"},function(t,e){t.exports="camerafadeinstart"},function(t,e){t.exports="camerafadeoutcomplete"},function(t,e){t.exports="camerafadeoutstart"},function(t,e){t.exports="cameraflashcomplete"},function(t,e){t.exports="cameraflashstart"},function(t,e){t.exports="followupdate"},function(t,e){t.exports="camerapancomplete"},function(t,e){t.exports="camerapanstart"},function(t,e){t.exports="postrender"},function(t,e){t.exports="prerender"},function(t,e){t.exports="camerarotatecomplete"},function(t,e){t.exports="camerarotatestart"},function(t,e){t.exports="camerashakecomplete"},function(t,e){t.exports="camerashakestart"},function(t,e){t.exports="camerazoomcomplete"},function(t,e){t.exports="camerazoomstart"},function(t,e,i){var n=i(16),s=i(0),u=i(35),r=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.isComplete=!1,this.direction=!0,this.duration=0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,r,o,a){if(void 0===t&&(t=!0),void 0===e&&(e=1e3),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(o=null),void 0===a&&(a=this.camera.scene),!r&&this.isRunning)return this.camera;this.isRunning=!0,this.isComplete=!1,this.duration=e,this.direction=t,this.progress=0,this.red=i,this.green=n,this.blue=s,this.alpha=t?Number.MIN_VALUE:1,this._elapsed=0,this._onUpdate=o,this._onUpdateScope=a;var h=t?u.FADE_OUT_START:u.FADE_IN_START;return this.camera.emit(h,this.camera,this,e,i,n,s),this.camera},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=n(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsedthis.source?Math.abs(this.destination-this.source):Math.abs(this.destination+h)-this.source)<(l=this.source>this.destination?Math.abs(this.source-this.destination):Math.abs(this.source+h)-this.destination)?this.clockwise=!0:lMath.PI&&(t-=n.PI2),Math.abs(((t+n.TAU)%n.PI2-n.PI2)%n.PI2)}},function(t,e,i){var n=i(132);t.exports=function(){return n(-Math.PI,Math.PI)}},function(t,e,i){var n=i(132);t.exports=function(){return n(-180,180)}},function(t,e,i){var n=i(343);t.exports=function(t){return n(t+Math.PI)}},function(t,e,i){var n=i(13);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e||(Math.abs(e-t)<=i||Math.abs(e-t)>=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(e>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return 2.3283064365386963e-10*((this.n=i)>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.n=4022871197,this.s0=this.hash(" "),this.s1=this.hash(" "),this.s2=this.hash(" "),this.c=1,t)for(var e=0;e 0.0)"," {"," c.rgb /= c.a;"," }",""," vec4 result;",""," result.r = (uColorMatrix[0] * c.r) + (uColorMatrix[1] * c.g) + (uColorMatrix[2] * c.b) + (uColorMatrix[3] * c.a) + uColorMatrix[4];"," result.g = (uColorMatrix[5] * c.r) + (uColorMatrix[6] * c.g) + (uColorMatrix[7] * c.b) + (uColorMatrix[8] * c.a) + uColorMatrix[9];"," result.b = (uColorMatrix[10] * c.r) + (uColorMatrix[11] * c.g) + (uColorMatrix[12] * c.b) + (uColorMatrix[13] * c.a) + uColorMatrix[14];"," result.a = (uColorMatrix[15] * c.r) + (uColorMatrix[16] * c.g) + (uColorMatrix[17] * c.b) + (uColorMatrix[18] * c.a) + uColorMatrix[19];",""," vec3 rgb = mix(c.rgb, result.rgb, uAlpha);",""," rgb *= result.a;",""," gl_FragColor = vec4(rgb, result.a);","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_COPY_FS","","precision mediump float;","","uniform sampler2D uMainSampler;","uniform float uBrightness;","","varying vec2 outTexCoord;","","void main ()","{"," gl_FragColor = texture2D(uMainSampler, outTexCoord) * uBrightness;","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_LINEAR_BLEND_FS","","precision mediump float;","","uniform sampler2D uMainSampler1;","uniform sampler2D uMainSampler2;","uniform float uStrength;","","varying vec2 outTexCoord;","","void main ()","{"," vec4 frame1 = texture2D(uMainSampler1, outTexCoord);"," vec4 frame2 = texture2D(uMainSampler2, outTexCoord);",""," gl_FragColor = mix(frame1, frame2 * uStrength, 0.5);","}",""].join("\n")},function(t,e){t.exports="addtexture"},function(t,e){t.exports="onerror"},function(t,e){t.exports="onload"},function(t,e){t.exports="ready"},function(t,e){t.exports="removetexture"},function(t,e,i){t.exports={GenerateTexture:i(364),Palettes:i(875)}},function(t,e,i){t.exports={ARNE16:i(365),C64:i(876),CGA:i(877),JMP:i(878),MSX:i(879)}},function(t,e){t.exports={0:"#000",1:"#fff",2:"#8b4131",3:"#7bbdc5",4:"#8b41ac",5:"#6aac41",6:"#3931a4",7:"#d5de73",8:"#945a20",9:"#5a4100",A:"#bd736a",B:"#525252",C:"#838383",D:"#acee8b",E:"#7b73de",F:"#acacac"}},function(t,e){t.exports={0:"#000",1:"#2234d1",2:"#0c7e45",3:"#44aacc",4:"#8a3622",5:"#5c2e78",6:"#aa5c3d",7:"#b5b5b5",8:"#5e606e",9:"#4c81fb",A:"#6cd947",B:"#7be2f9",C:"#eb8a60",D:"#e23d69",E:"#ffd93f",F:"#fff"}},function(t,e){t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#f5f4eb"}},function(t,e){t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#fff"}},function(t,e,i){t.exports={Path:i(881),MoveTo:i(369),CubicBezier:i(366),Curve:i(88),Ellipse:i(367),Line:i(368),QuadraticBezier:i(370),Spline:i(371)}},function(t,e,i){var n=i(0),l=i(366),u=i(367),s=i(5),r=i(368),o=i(369),a=i(370),h=i(9),c=i(371),d=i(3),f=i(13),p=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new r(e,t)),this},cubicBezierTo:function(t,e,i,n,s,r){var o,a,h=this.getEndPoint(),u=t instanceof d?(o=t,a=e,i):(o=new d(i,n),a=new d(s,r),new d(t,e));return this.add(new l(h,o,a,u))},quadraticBezierTo:function(t,e,i,n){var s,r=this.getEndPoint(),o=t instanceof d?(s=t,e):(s=new d(i,n),new d(t,e));return this.add(new a(r,s,o))},draw:function(t,e){for(var i=0;i=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}s++}return null},getPoints:function(t){void 0===t&&(t=12);for(var e,i=[],n=0;n=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getTangentAt(h,e)}s++}return null},lineTo:function(t,e){t instanceof d?this._tmpVec2B.copy(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new r([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new c(t))},moveTo:function(t,e){return t instanceof d?this.add(new o(t.x,t.y)):this.add(new o(t,e))},toJSON:function(){for(var t=[],e=0;e>16&255,g:t>>8&255,b:255&t,a:255};return 16777215>>24),e}},function(t,e,i){var h=i(36),u=i(375);t.exports=function(t,e,i){var n,s,r=i,o=i,a=i;return 0!==e&&(r=u(s=2*i-(n=i<.5?i*(1+e):i+e-i*e),n,t+1/3),o=u(s,n,t),a=u(s,n,t-1/3)),(new h).setGLTo(r,o,a,1)}},function(t,e,i){var s=i(180);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],n=0;n<=359;n++)i.push(s(n/359,t,e));return i}},function(t,e,i){function o(t,e,i,n,s,r,o,a){void 0===o&&(o=100),void 0===a&&(a=0);var h=a/o;return{r:u(t,n,h),g:u(e,s,h),b:u(i,r,h)}}var u=i(130);t.exports={RGBWithRGB:o,ColorWithRGB:function(t,e,i,n,s,r){return void 0===s&&(s=100),void 0===r&&(r=0),o(t.r,t.g,t.b,e,i,n,s,r)},ColorWithColor:function(t,e,i,n){return void 0===i&&(i=100),void 0===n&&(n=0),o(t.r,t.g,t.b,e.r,e.g,e.b,i,n)}}},function(t,e,i){var n=i(187),s=i(36);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new s(n(t,e),n(t,e),n(t,e))}},function(t,e,i){var r=i(374);t.exports=function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s="#"),"#"===s?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1):"0x"+r(n)+r(t)+r(e)+r(i)}},function(t,e,i){t.exports={BitmapMask:i(302),GeometryMask:i(303)}},function(t,e,i){var n={AddToDOM:i(137),DOMContentLoaded:i(377),GetInnerHeight:i(378),GetScreenOrientation:i(379),GetTarget:i(384),ParseXML:i(385),RemoveFromDOM:i(193),RequestAnimationFrame:i(362)};t.exports=n},function(t,e,i){t.exports={EventEmitter:i(905)}},function(t,e,i){var n=i(0),s=i(10),r=i(25),o=new n({Extends:s,initialize:function(){s.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});r.register("EventEmitter",o,"events"),t.exports=o},function(t,e,i){var n=i(137),s=i(313),r=i(317),o=i(31),a=i(0),h=i(338),u=i(907),l=i(358),c=i(97),d=i(360),f=i(339),p=i(377),g=i(10),v=i(23),m=i(386),y=i(25),x=i(391),T=i(392),w=i(394),E=i(136),b=i(399),S=i(361),A=i(363),_=i(403),C=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.domContainer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new g,this.anims=new s(this),this.textures=new b(this),this.cache=new r(this),this.registry=new c(this),this.input=new m(this,this.config),this.scene=new w(this,this.config.sceneConfig),this.device=f,this.scale=new T(this,this.config),this.sound=null,this.sound=_.create(this),this.loop=new S(this,this.config.fps),this.plugins=new x(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,p(this.boot.bind(this))},boot:function(){y.hasCore("EventEmitter")?(this.isBooted=!0,this.config.preBoot(this),this.scale.preBoot(),l(this),u(this),d(this),n(this.canvas,this.config.parent),this.textures.once(E.READY,this.texturesReady,this),this.events.emit(v.BOOT)):console.warn("Aborting. Core Plugins missing.")},texturesReady:function(){this.events.emit(v.READY),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),A(this);var t=this.events;t.on(v.HIDDEN,this.onHidden,this),t.on(v.VISIBLE,this.onVisible,this),t.on(v.BLUR,this.onBlur,this),t.on(v.FOCUS,this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(v.PRE_STEP,t,e),i.emit(v.STEP,t,e),this.scene.update(t,e),i.emit(v.POST_STEP,t,e);var n=this.renderer;n.preRender(),i.emit(v.PRE_RENDER,n,t,e),this.scene.render(n),n.postRender(),i.emit(v.POST_RENDER,n,t,e)},headlessStep:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(v.PRE_STEP,t,e),i.emit(v.STEP,t,e),this.scene.update(t,e),i.emit(v.POST_STEP,t,e),i.emit(v.PRE_RENDER),i.emit(v.POST_RENDER)},onHidden:function(){this.loop.pause(),this.events.emit(v.PAUSE)},onVisible:function(){this.loop.resume(),this.events.emit(v.RESUME)},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},getFrame:function(){return this.loop.frame},getTime:function(){return this.loop.now},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.scene.destroy(),this.events.emit(v.DESTROY),this.events.removeAllListeners(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.domContainer&&this.domContainer.parentNode.removeChild(this.domContainer),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=C},function(t,e,i){var n=i(137);t.exports=function(t){var e,i=t.config;i.parent&&i.domCreateContainer&&((e=document.createElement("div")).style.cssText=["display: block;","width: "+t.scale.width+"px;","height: "+t.scale.height+"px;","padding: 0; margin: 0;","position: absolute;","overflow: hidden;","pointer-events: none;","transform: scale(1);","transform-origin: left top;"].join(" "),t.domContainer=e,n(e,i.parent))}},function(t,e){t.exports="boot"},function(t,e){t.exports="destroy"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameout"},function(t,e){t.exports="gameover"},function(t,e){t.exports="gameobjectdown"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameobjectmove"},function(t,e){t.exports="gameobjectout"},function(t,e){t.exports="gameobjectover"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="wheel"},function(t,e){t.exports="gameobjectup"},function(t,e){t.exports="gameobjectwheel"},function(t,e){t.exports="boot"},function(t,e){t.exports="process"},function(t,e){t.exports="update"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointerdownoutside"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="pointerupoutside"},function(t,e){t.exports="wheel"},function(t,e){t.exports="pointerlockchange"},function(t,e){t.exports="preupdate"},function(t,e){t.exports="shutdown"},function(t,e){t.exports="start"},function(t,e){t.exports="update"},function(t,e){t.exports="addfile"},function(t,e){t.exports="complete"},function(t,e){t.exports="filecomplete"},function(t,e){t.exports="filecomplete-"},function(t,e){t.exports="loaderror"},function(t,e){t.exports="load"},function(t,e){t.exports="fileprogress"},function(t,e){t.exports="postprocess"},function(t,e){t.exports="progress"},function(t,e){t.exports="start"},function(t,e,i){t.exports={game:"game",renderer:"renderer",anims:"anims",cache:"cache",plugins:"plugins",registry:"registry",scale:"scale",sound:"sound",textures:"textures",events:"events",cameras:"cameras",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},function(t,e){t.exports=function(t,e,i){if(i.getElementsByTagName("TextureAtlas")){var n=t.source[e];t.add("__BASE",e,0,0,n.width,n.height);for(var s=i.getElementsByTagName("SubTexture"),r=0;r=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i,n,s=t.indexOf(e);return-1!==s&&st.length-1)throw new Error("Index out of bounds");var s=r(t,e);return i&&i.call(n,s),s}},function(t,e,i){var u=i(77);t.exports=function(t,e,i,n,s){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===s&&(s=t),u(t,e,i)){var r=i-e,o=t.splice(e,r);if(n)for(var a=0;a?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var R=i(6);t.exports=function(t,e){var i=e.width,n=e.height,s=Math.floor(i/2),r=Math.floor(n/2),o=R(e,"chars","");if(""!==o){var a=R(e,"image",""),h=t.sys.textures.getFrame(a),u=h.cutX,l=h.cutY,c=h.source.width,d=h.source.height,f=R(e,"offset.x",0),p=R(e,"offset.y",0),g=R(e,"spacing.x",0),v=R(e,"spacing.y",0),m=R(e,"lineSpacing",0),y=R(e,"charsPerRow",null);null===y&&(y=c/i)>o.length&&(y=o.length);for(var x=f,T=p,w={retroFont:!0,font:a,size:i,lineHeight:n+m,chars:{}},E=0,b=0;b=i&&t.x<=n&&t.y>=s&&t.y<=r}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||s=n&&(p.push(v),f=v)}var m=o[o.length-1];return y(f,m)i&&(i=a.x),a.xs&&(s=a.y),a.yn(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},function(t,e,i){var r=i(9);t.exports=function(t,e,i,n,s){return void 0===s&&(s=new r),s.setTo(Math.min(t,i),Math.min(e,n),Math.abs(t-i),Math.abs(e-n))}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.centerX,e.y=t.centerY,e}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.width,e.y=t.height,e}},function(t,e,i){var r=i(182);t.exports=function(t,e,i){var n=t.centerX,s=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),r(t,n,s)}},function(t,e,i){var n=i(9),s=i(112);t.exports=function(t,e,i){return void 0===i&&(i=new n),s(t,e)?(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y):i.setEmpty(),i}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;oe.x&&t.ye.y}},function(t,e,i){var a=i(4),h=i(34);t.exports=function(t,e,i){void 0===i&&(i=new a),e=h(e);var n=Math.sin(e),s=Math.cos(e),r=0=s||0=t.downTime+n)&&(i=!0),i)return this.setDragState(t,3),this.processDragStartList(t)},processDragStartList:function(t){if(3!==this.getDragState(t))return 0;for(var e=this._drag[t.id],i=0;it._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,n=0;n'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],s=this;try{var r=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return s.state=o.FILE_ERRORED,void s.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){u.revokeObjectURL(s.data),s.onProcessComplete()},this.data.onerror=function(){u.revokeObjectURL(s.data),s.onProcessError()},u.createObjectURL(this.data,r,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});s.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off(a.UPDATE,this.step,this),t.events.emit(a.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,n){return this.manager.add(t,e,i,n)},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t,e),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(t),this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isPaused:function(t){return void 0===t&&(t=this.key),this.manager.isPaused(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.swapPosition(t,e),this},moveAbove:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveAbove(t,e),this},moveBelow:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveBelow(t,e),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(a.SHUTDOWN,this.shutdown,this),t.off(a.POST_UPDATE,this.step,this),t.off(a.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(a.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});r.register("ScenePlugin",o,"scenePlugin"),t.exports=o},function(t,e,i){t.exports={Events:i(415),List:i(105),Map:i(98),ProcessQueue:i(202),RTree:i(508),Set:i(145),Size:i(393)}},function(t,e,i){var n=i(18),s=i(1390),r=n(!1,r={CanvasTexture:i(400),Events:i(136),FilterMode:s,Frame:i(104),Parsers:i(402),Texture:i(197),TextureManager:i(399),TextureSource:i(401)},s);t.exports=r},function(t,e){t.exports={LINEAR:0,NEAREST:1}},function(t,e,i){var n=i(18),s=i(1392),r=n(!1,r={Components:i(243),Parsers:i(1425),Formats:i(38),ImageCollection:i(555),ParseToTilemap:i(253),Tile:i(81),Tilemap:i(559),TilemapCreator:i(1431),TilemapFactory:i(1432),Tileset:i(119),TilemapLayer:i(560),Orientation:i(29),LayerData:i(117),MapData:i(118),ObjectLayer:i(551)},s.ORIENTATION);t.exports=r},function(t,e,i){var n={FromOrientationString:i(242),ORIENTATION:i(29)};t.exports=n},function(t,e,i){var p=i(26),g=i(60);t.exports=function(t,e,i,n,s,r,o,a){void 0===o&&(o=!0),t<0&&(t=0),e<0&&(e=0);for(var h=p(t,e,i,n,null,a),u=s-t,l=r-e,c=0;c=t&&u.index<=e&&l(u,i)}n&&c(0,0,s.width,s.height,s)}}},function(t,e,i){var a=i(69),h=i(60),u=i(153);t.exports=function(t,e,i,n){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var s=0;s=s.delay&&(n=s.elapsed-s.delay,s.elapsed=s.delay,!s.hasDispatched&&s.callback&&(s.hasDispatched=!0,s.callback.apply(s.callbackScope,s.args)),0>2],s+=o[(3&i[r])<<4|i[r+1]>>4],s+=o[(15&i[r+1])<<2|i[r+2]>>6],s+=o[63&i[r+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s}},function(t,e,i){t.exports={Clone:i(76),DeepCopy:i(167),Extend:i(18),GetAdvancedValue:i(15),GetFastValue:i(2),GetMinMaxValue:i(1457),GetValue:i(6),HasAll:i(1458),HasAny:i(432),HasValue:i(123),IsPlainObject:i(7),Merge:i(140),MergeRight:i(1459),Pick:i(550),SetValue:i(455)}},function(t,e,i){var o=i(6),a=i(16);t.exports=function(t,e,i,n,s){void 0===s&&(s=i);var r=o(t,e,s);return a(r,i,n)}},function(t,e){t.exports=function(t,e){for(var i=0;i - * @author Felipe Alfonso <@bitnenfer> - * @author Matthew Groves <@doormat> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Generate shader source to test maximum ifs. - * - * @private - * @param {number} maxIfs - The number of if statements to generate - */ -function GenerateSrc (maxIfs) -{ - var src = ''; - - for (var i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += 'if(test == ' + i + '.0){}'; - } - } - - return src; -} - -/** - * @namespace Phaser.Renderer.WebGL.Utils - * @since 3.0.0 - */ -module.exports = { - - /** - * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats - * @since 3.0.0 - * - * @param {number} r - Red component in a range from 0.0 to 1.0 - * @param {number} g - Green component in a range from 0.0 to 1.0 - * @param {number} b - Blue component in a range from 0.0 to 1.0 - * @param {number} a - Alpha component in a range from 0.0 to 1.0 - * - * @return {number} The packed RGBA values as a Uint32. - */ - getTintFromFloats: function (r, g, b, a) - { - var ur = ((r * 255.0)|0) & 0xFF; - var ug = ((g * 255.0)|0) & 0xFF; - var ub = ((b * 255.0)|0) & 0xFF; - var ua = ((a * 255.0)|0) & 0xFF; - - return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; - }, - - /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha - * @since 3.0.0 - * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component - * - * @return {number} Packed RGBA as Uint32 - */ - getTintAppendFloatAlpha: function (rgb, a) - { - var ua = ((a * 255.0)|0) & 0xFF; - return ((ua << 24) | rgb) >>> 0; - }, - - /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a - * swizzled Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap - * @since 3.0.0 - * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component - * - * @return {number} Packed RGBA as Uint32 - */ - getTintAppendFloatAlphaAndSwap: function (rgb, a) - { - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; - var ua = ((a * 255.0)|0) & 0xFF; - - return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; - }, - - /** - * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 - * - * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB - * @since 3.0.0 - * - * @param {number} rgb - RGB packed as a Uint24 - * - * @return {array} Array of floats representing each component as a float - */ - getFloatsFromUintRGB: function (rgb) - { - var ur = ((rgb >> 16)|0) & 0xff; - var ug = ((rgb >> 8)|0) & 0xff; - var ub = (rgb|0) & 0xff; - - return [ ur / 255.0, ug / 255.0, ub / 255.0 ]; - }, - - /** - * Counts how many attributes of 32 bits a vertex has - * - * @function Phaser.Renderer.WebGL.Utils.getComponentCount - * @since 3.0.0 - * - * @param {array} attributes - Array of attributes - * @param {WebGLRenderingContext} glContext - WebGLContext used for check types - * - * @return {number} Count of 32 bit attributes in vertex - */ - getComponentCount: function (attributes, glContext) - { - var count = 0; - - for (var index = 0; index < attributes.length; ++index) - { - var element = attributes[index]; - - if (element.type === glContext.FLOAT) - { - count += element.size; - } - else - { - count += 1; // We'll force any other type to be 32 bit. for now - } - } - - return count; - }, - - /** - * Check to see how many texture units the GPU supports, based on the given config value. - * Then tests this against the maximum number of iterations GLSL can support. - * - * @function Phaser.Renderer.WebGL.Utils.checkShaderMax - * @since 3.50.0 - * - * @param {WebGLRenderingContext} gl - The WebGLContext used to create the shaders. - * @param {number} maxTextures - The Game Config maxTextures value. - * - * @return {number} The number of texture units that is supported by this browser and GPU. - */ - checkShaderMax: function (gl, maxTextures) - { - if (!maxTextures || maxTextures === -1) - { - maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); - } - - var shader = gl.createShader(gl.FRAGMENT_SHADER); - - var fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}' - ].join('\n'); - - // eslint-disable-next-line no-constant-condition - while (true) - { - var fragmentSrc = fragTemplate.replace(/%forloop%/gi, GenerateSrc(maxTextures)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxTextures = (maxTextures / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxTextures; - }, - - /** - * Checks the given Fragment Shader Source for `%count%` and `%forloop%` declarations and - * replaces those with GLSL code for setting `texture = texture2D(uMainSampler[i], outTexCoord)`. - * - * @function Phaser.Renderer.WebGL.Utils.parseFragmentShaderMaxTextures - * @since 3.50.0 - * - * @param {string} fragmentShaderSource - The Fragment Shader source code to operate on. - * @param {number} maxTextures - The number of maxTextures value. - * - * @return {string} The modified Fragment Shader source. - */ - parseFragmentShaderMaxTextures: function (fragmentShaderSource, maxTextures) - { - var src = ''; - - for (var i = 0; i < maxTextures; i++) - { - if (i > 0) - { - src += '\n\telse '; - } - - if (i < maxTextures - 1) - { - src += 'if (outTexId < ' + i + '.5)'; - } - - src += '\n\t{'; - src += '\n\t\ttexture = texture2D(uMainSampler[' + i + '], outTexCoord);'; - src += '\n\t}'; - } - - fragmentShaderSource = fragmentShaderSource.replace(/%count%/gi, maxTextures.toString()); - - return fragmentShaderSource.replace(/%forloop%/gi, src); - } -}; - - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.GameObjects.Components - */ - -module.exports = { - - Alpha: __webpack_require__(562), - AlphaSingle: __webpack_require__(280), - BlendMode: __webpack_require__(281), - ComputedSize: __webpack_require__(563), - Crop: __webpack_require__(564), - Depth: __webpack_require__(282), - Flip: __webpack_require__(565), - GetBounds: __webpack_require__(566), - Mask: __webpack_require__(286), - Origin: __webpack_require__(583), - PathFollower: __webpack_require__(584), - Pipeline: __webpack_require__(165), - ScrollFactor: __webpack_require__(289), - Size: __webpack_require__(585), - Texture: __webpack_require__(586), - TextureCrop: __webpack_require__(587), - Tint: __webpack_require__(588), - ToJSON: __webpack_require__(290), - Transform: __webpack_require__(291), - TransformMatrix: __webpack_require__(31), - Visible: __webpack_require__(292) - -}; - - -/***/ }), -/* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2860,6 +2570,273 @@ if (true) { } +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Components + */ + +module.exports = { + + Alpha: __webpack_require__(601), + AlphaSingle: __webpack_require__(295), + BlendMode: __webpack_require__(296), + ComputedSize: __webpack_require__(602), + Crop: __webpack_require__(603), + Depth: __webpack_require__(297), + Flip: __webpack_require__(604), + GetBounds: __webpack_require__(605), + Mask: __webpack_require__(301), + Origin: __webpack_require__(622), + PathFollower: __webpack_require__(623), + Pipeline: __webpack_require__(166), + ScrollFactor: __webpack_require__(304), + Size: __webpack_require__(624), + Texture: __webpack_require__(625), + TextureCrop: __webpack_require__(626), + Tint: __webpack_require__(627), + ToJSON: __webpack_require__(168), + Transform: __webpack_require__(305), + TransformMatrix: __webpack_require__(24), + Visible: __webpack_require__(306) + +}; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @author Matthew Groves <@doormat> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Generate shader source to test maximum ifs. + * + * @private + * @ignore + * @param {number} maxIfs - The number of if statements to generate + */ +function GenerateSrc (maxIfs) +{ + var src = ''; + + for (var i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += 'if(test == ' + i + '.0){}'; + } + } + + return src; +} + +/** + * @namespace Phaser.Renderer.WebGL.Utils + * @since 3.0.0 + */ +module.exports = { + + /** + * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats + * @since 3.0.0 + * + * @param {number} r - Red component in a range from 0.0 to 1.0 + * @param {number} g - Green component in a range from 0.0 to 1.0 + * @param {number} b - Blue component in a range from 0.0 to 1.0 + * @param {number} a - Alpha component in a range from 0.0 to 1.0 + * + * @return {number} The packed RGBA values as a Uint32. + */ + getTintFromFloats: function (r, g, b, a) + { + var ur = ((r * 255) | 0) & 0xff; + var ug = ((g * 255) | 0) & 0xff; + var ub = ((b * 255) | 0) & 0xff; + var ua = ((a * 255) | 0) & 0xff; + + return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; + }, + + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlpha: function (rgb, a) + { + var ua = ((a * 255) | 0) & 0xff; + + return ((ua << 24) | rgb) >>> 0; + }, + + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a + * swizzled Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlphaAndSwap: function (rgb, a) + { + var ur = ((rgb >> 16) | 0) & 0xff; + var ug = ((rgb >> 8) | 0) & 0xff; + var ub = (rgb | 0) & 0xff; + var ua = ((a * 255) | 0) & 0xff; + + return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; + }, + + /** + * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 + * + * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB + * @since 3.0.0 + * + * @param {number} rgb - RGB packed as a Uint24 + * + * @return {array} Array of floats representing each component as a float + */ + getFloatsFromUintRGB: function (rgb) + { + var ur = ((rgb >> 16) | 0) & 0xff; + var ug = ((rgb >> 8) | 0) & 0xff; + var ub = (rgb | 0) & 0xff; + + return [ ur / 255, ug / 255, ub / 255 ]; + }, + + /** + * Check to see how many texture units the GPU supports, based on the given config value. + * Then tests this against the maximum number of iterations GLSL can support. + * + * @function Phaser.Renderer.WebGL.Utils.checkShaderMax + * @since 3.50.0 + * + * @param {WebGLRenderingContext} gl - The WebGLContext used to create the shaders. + * @param {number} maxTextures - The Game Config maxTextures value. + * + * @return {number} The number of texture units that is supported by this browser and GPU. + */ + checkShaderMax: function (gl, maxTextures) + { + if (!maxTextures || maxTextures === -1) + { + maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + } + + var shader = gl.createShader(gl.FRAGMENT_SHADER); + + var fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}' + ].join('\n'); + + // eslint-disable-next-line no-constant-condition + while (true) + { + var fragmentSrc = fragTemplate.replace(/%forloop%/gi, GenerateSrc(maxTextures)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxTextures = (maxTextures / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxTextures; + }, + + /** + * Checks the given Fragment Shader Source for `%count%` and `%forloop%` declarations and + * replaces those with GLSL code for setting `texture = texture2D(uMainSampler[i], outTexCoord)`. + * + * @function Phaser.Renderer.WebGL.Utils.parseFragmentShaderMaxTextures + * @since 3.50.0 + * + * @param {string} fragmentShaderSource - The Fragment Shader source code to operate on. + * @param {number} maxTextures - The number of maxTextures value. + * + * @return {string} The modified Fragment Shader source. + */ + parseFragmentShaderMaxTextures: function (fragmentShaderSource, maxTextures) + { + if (!fragmentShaderSource) + { + return ''; + } + + var src = ''; + + for (var i = 0; i < maxTextures; i++) + { + if (i > 0) + { + src += '\n\telse '; + } + + if (i < maxTextures - 1) + { + src += 'if (outTexId < ' + i + '.5)'; + } + + src += '\n\t{'; + src += '\n\t\ttexture = texture2D(uMainSampler[' + i + '], outTexCoord);'; + src += '\n\t}'; + } + + fragmentShaderSource = fragmentShaderSource.replace(/%count%/gi, maxTextures.toString()); + + return fragmentShaderSource.replace(/%forloop%/gi, src); + } +}; + + /***/ }), /* 13 */ /***/ (function(module, exports) { @@ -2963,10 +2940,10 @@ module.exports = MATH_CONST; */ var Class = __webpack_require__(0); -var ComponentsToJSON = __webpack_require__(290); -var DataManager = __webpack_require__(120); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(29); +var ComponentsToJSON = __webpack_require__(168); +var DataManager = __webpack_require__(97); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(32); /** * @classdesc @@ -2994,16 +2971,33 @@ var GameObject = new Class({ EventEmitter.call(this); /** - * The Scene to which this Game Object belongs. + * A reference to the Scene to which this Game Object belongs. + * * Game Objects can only belong to one Scene. * + * You should consider this property as being read-only. You cannot move a + * Game Object to another Scene by simply changing it. + * * @name Phaser.GameObjects.GameObject#scene * @type {Phaser.Scene} - * @protected * @since 3.0.0 */ this.scene = scene; + /** + * Holds a reference to the Display List that contains this Game Object. + * + * This is set automatically when this Game Object is added to a Scene or Layer. + * + * You should treat this property as being read-only. + * + * @name Phaser.GameObjects.GameObject#displayList + * @type {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} + * @default null + * @since 3.50.0 + */ + this.displayList = null; + /** * A textual representation of this Game Object, i.e. `sprite`. * Used internally by Phaser but is available for your own custom classes to populate. @@ -3025,7 +3019,7 @@ var GameObject = new Class({ * If you need to store complex data about your Game Object, look at using the Data Component instead. * * @name Phaser.GameObjects.GameObject#state - * @type {(integer|string)} + * @type {(number|string)} * @since 3.16.0 */ this.state = 0; @@ -3067,7 +3061,7 @@ var GameObject = new Class({ * Reserved for future use by plugins and the Input Manager. * * @name Phaser.GameObjects.GameObject#tabIndex - * @type {integer} + * @type {number} * @default -1 * @since 3.0.0 */ @@ -3091,7 +3085,7 @@ var GameObject = new Class({ * If those components are not used by your custom class then you can use this bitmask as you wish. * * @name Phaser.GameObjects.GameObject#renderFlags - * @type {integer} + * @type {number} * @default 15 * @since 3.0.0 */ @@ -3199,7 +3193,7 @@ var GameObject = new Class({ * @method Phaser.GameObjects.GameObject#setState * @since 3.16.0 * - * @param {(integer|string)} value - The state of the Game Object. + * @param {(number|string)} value - The state of the Game Object. * * @return {this} This GameObject. */ @@ -3565,7 +3559,7 @@ var GameObject = new Class({ * @method Phaser.GameObjects.GameObject#getIndexList * @since 3.4.0 * - * @return {integer[]} An array of display list position indexes. + * @return {number[]} An array of display list position indexes. */ getIndexList: function () { @@ -3634,16 +3628,15 @@ var GameObject = new Class({ this.emit(Events.DESTROY, this); - var sys = this.scene.sys; - if (!fromScene) { - sys.displayList.remove(this); + this.displayList.remove(this); } if (this.input) { - sys.input.clear(this); + this.scene.sys.input.clear(this); + this.input = undefined; } @@ -3657,20 +3650,23 @@ var GameObject = new Class({ if (this.body) { this.body.destroy(); + this.body = undefined; } + this.resetPostPipeline(true); + // Tell the Scene to re-sort the children if (!fromScene) { - sys.queueDepthSort(); + this.displayList.queueDepthSort(); } this.active = false; this.visible = false; this.scene = undefined; - + this.displayList = undefined; this.parentContainer = undefined; this.removeAllListeners(); @@ -3681,7 +3677,7 @@ var GameObject = new Class({ /** * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not. * - * @constant {integer} RENDER_MASK + * @constant {number} RENDER_MASK * @memberof Phaser.GameObjects.GameObject * @default */ @@ -3700,7 +3696,7 @@ module.exports = GameObject; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MATH = __webpack_require__(180); +var MATH = __webpack_require__(185); var GetValue = __webpack_require__(6); /** @@ -3779,6 +3775,36 @@ module.exports = GetAdvancedValue; /***/ }), /* 16 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Force a value within the boundaries by clamping it to the range `min`, `max`. + * + * @function Phaser.Math.Clamp + * @since 3.0.0 + * + * @param {number} value - The value to be clamped. + * @param {number} min - The minimum bounds. + * @param {number} max - The maximum bounds. + * + * @return {number} The clamped value. + */ +var Clamp = function (value, min, max) +{ + return Math.max(min, Math.min(max, value)); +}; + +module.exports = Clamp; + + +/***/ }), +/* 17 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -3788,7 +3814,7 @@ module.exports = GetAdvancedValue; */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); /** @@ -3957,190 +3983,8 @@ PluginCache.register('GameObjectCreator', GameObjectCreator, 'make'); module.exports = GameObjectCreator; -/***/ }), -/* 17 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Force a value within the boundaries by clamping it to the range `min`, `max`. - * - * @function Phaser.Math.Clamp - * @since 3.0.0 - * - * @param {number} value - The value to be clamped. - * @param {number} min - The minimum bounds. - * @param {number} max - The maximum bounds. - * - * @return {number} The clamped value. - */ -var Clamp = function (value, min, max) -{ - return Math.max(min, Math.min(max, value)); -}; - -module.exports = Clamp; - - /***/ }), /* 18 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var FILE_CONST = { - - /** - * The Loader is idle. - * - * @name Phaser.Loader.LOADER_IDLE - * @type {integer} - * @since 3.0.0 - */ - LOADER_IDLE: 0, - - /** - * The Loader is actively loading. - * - * @name Phaser.Loader.LOADER_LOADING - * @type {integer} - * @since 3.0.0 - */ - LOADER_LOADING: 1, - - /** - * The Loader is processing files is has loaded. - * - * @name Phaser.Loader.LOADER_PROCESSING - * @type {integer} - * @since 3.0.0 - */ - LOADER_PROCESSING: 2, - - /** - * The Loader has completed loading and processing. - * - * @name Phaser.Loader.LOADER_COMPLETE - * @type {integer} - * @since 3.0.0 - */ - LOADER_COMPLETE: 3, - - /** - * The Loader is shutting down. - * - * @name Phaser.Loader.LOADER_SHUTDOWN - * @type {integer} - * @since 3.0.0 - */ - LOADER_SHUTDOWN: 4, - - /** - * The Loader has been destroyed. - * - * @name Phaser.Loader.LOADER_DESTROYED - * @type {integer} - * @since 3.0.0 - */ - LOADER_DESTROYED: 5, - - /** - * File is in the load queue but not yet started - * - * @name Phaser.Loader.FILE_PENDING - * @type {integer} - * @since 3.0.0 - */ - FILE_PENDING: 10, - - /** - * File has been started to load by the loader (onLoad called) - * - * @name Phaser.Loader.FILE_LOADING - * @type {integer} - * @since 3.0.0 - */ - FILE_LOADING: 11, - - /** - * File has loaded successfully, awaiting processing - * - * @name Phaser.Loader.FILE_LOADED - * @type {integer} - * @since 3.0.0 - */ - FILE_LOADED: 12, - - /** - * File failed to load - * - * @name Phaser.Loader.FILE_FAILED - * @type {integer} - * @since 3.0.0 - */ - FILE_FAILED: 13, - - /** - * File is being processed (onProcess callback) - * - * @name Phaser.Loader.FILE_PROCESSING - * @type {integer} - * @since 3.0.0 - */ - FILE_PROCESSING: 14, - - /** - * The File has errored somehow during processing. - * - * @name Phaser.Loader.FILE_ERRORED - * @type {integer} - * @since 3.0.0 - */ - FILE_ERRORED: 16, - - /** - * File has finished processing. - * - * @name Phaser.Loader.FILE_COMPLETE - * @type {integer} - * @since 3.0.0 - */ - FILE_COMPLETE: 17, - - /** - * File has been destroyed - * - * @name Phaser.Loader.FILE_DESTROYED - * @type {integer} - * @since 3.0.0 - */ - FILE_DESTROYED: 18, - - /** - * File was populated from local data and doesn't need an HTTP request - * - * @name Phaser.Loader.FILE_POPULATED - * @type {integer} - * @since 3.0.0 - */ - FILE_POPULATED: 19 - -}; - -module.exports = FILE_CONST; - - -/***/ }), -/* 19 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -4240,6 +4084,158 @@ var Extend = function () module.exports = Extend; +/***/ }), +/* 19 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var FILE_CONST = { + + /** + * The Loader is idle. + * + * @name Phaser.Loader.LOADER_IDLE + * @type {number} + * @since 3.0.0 + */ + LOADER_IDLE: 0, + + /** + * The Loader is actively loading. + * + * @name Phaser.Loader.LOADER_LOADING + * @type {number} + * @since 3.0.0 + */ + LOADER_LOADING: 1, + + /** + * The Loader is processing files is has loaded. + * + * @name Phaser.Loader.LOADER_PROCESSING + * @type {number} + * @since 3.0.0 + */ + LOADER_PROCESSING: 2, + + /** + * The Loader has completed loading and processing. + * + * @name Phaser.Loader.LOADER_COMPLETE + * @type {number} + * @since 3.0.0 + */ + LOADER_COMPLETE: 3, + + /** + * The Loader is shutting down. + * + * @name Phaser.Loader.LOADER_SHUTDOWN + * @type {number} + * @since 3.0.0 + */ + LOADER_SHUTDOWN: 4, + + /** + * The Loader has been destroyed. + * + * @name Phaser.Loader.LOADER_DESTROYED + * @type {number} + * @since 3.0.0 + */ + LOADER_DESTROYED: 5, + + /** + * File is in the load queue but not yet started + * + * @name Phaser.Loader.FILE_PENDING + * @type {number} + * @since 3.0.0 + */ + FILE_PENDING: 10, + + /** + * File has been started to load by the loader (onLoad called) + * + * @name Phaser.Loader.FILE_LOADING + * @type {number} + * @since 3.0.0 + */ + FILE_LOADING: 11, + + /** + * File has loaded successfully, awaiting processing + * + * @name Phaser.Loader.FILE_LOADED + * @type {number} + * @since 3.0.0 + */ + FILE_LOADED: 12, + + /** + * File failed to load + * + * @name Phaser.Loader.FILE_FAILED + * @type {number} + * @since 3.0.0 + */ + FILE_FAILED: 13, + + /** + * File is being processed (onProcess callback) + * + * @name Phaser.Loader.FILE_PROCESSING + * @type {number} + * @since 3.0.0 + */ + FILE_PROCESSING: 14, + + /** + * The File has errored somehow during processing. + * + * @name Phaser.Loader.FILE_ERRORED + * @type {number} + * @since 3.0.0 + */ + FILE_ERRORED: 16, + + /** + * File has finished processing. + * + * @name Phaser.Loader.FILE_COMPLETE + * @type {number} + * @since 3.0.0 + */ + FILE_COMPLETE: 17, + + /** + * File has been destroyed + * + * @name Phaser.Loader.FILE_DESTROYED + * @type {number} + * @since 3.0.0 + */ + FILE_DESTROYED: 18, + + /** + * File was populated from local data and doesn't need an HTTP request + * + * @name Phaser.Loader.FILE_POPULATED + * @type {number} + * @since 3.0.0 + */ + FILE_POPULATED: 19 + +}; + +module.exports = FILE_CONST; + + /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { @@ -4256,27 +4252,27 @@ module.exports = Extend; module.exports = { - ADDED_TO_SCENE: __webpack_require__(733), - BOOT: __webpack_require__(734), - CREATE: __webpack_require__(735), - DESTROY: __webpack_require__(736), - PAUSE: __webpack_require__(737), - POST_UPDATE: __webpack_require__(738), - PRE_UPDATE: __webpack_require__(739), - READY: __webpack_require__(740), - REMOVED_FROM_SCENE: __webpack_require__(741), - RENDER: __webpack_require__(742), - RESUME: __webpack_require__(743), - SHUTDOWN: __webpack_require__(744), - SLEEP: __webpack_require__(745), - START: __webpack_require__(746), - TRANSITION_COMPLETE: __webpack_require__(747), - TRANSITION_INIT: __webpack_require__(748), - TRANSITION_OUT: __webpack_require__(749), - TRANSITION_START: __webpack_require__(750), - TRANSITION_WAKE: __webpack_require__(751), - UPDATE: __webpack_require__(752), - WAKE: __webpack_require__(753) + ADDED_TO_SCENE: __webpack_require__(774), + BOOT: __webpack_require__(775), + CREATE: __webpack_require__(776), + DESTROY: __webpack_require__(777), + PAUSE: __webpack_require__(778), + POST_UPDATE: __webpack_require__(779), + PRE_UPDATE: __webpack_require__(780), + READY: __webpack_require__(781), + REMOVED_FROM_SCENE: __webpack_require__(782), + RENDER: __webpack_require__(783), + RESUME: __webpack_require__(784), + SHUTDOWN: __webpack_require__(785), + SLEEP: __webpack_require__(786), + START: __webpack_require__(787), + TRANSITION_COMPLETE: __webpack_require__(788), + TRANSITION_INIT: __webpack_require__(789), + TRANSITION_OUT: __webpack_require__(790), + TRANSITION_START: __webpack_require__(791), + TRANSITION_WAKE: __webpack_require__(792), + UPDATE: __webpack_require__(793), + WAKE: __webpack_require__(794) }; @@ -4291,31 +4287,66 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var TransformMatrix = __webpack_require__(24); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); + +var result = { camera: tempMatrix1, sprite: tempMatrix2, calc: tempMatrix3 }; + /** - * @namespace Phaser.Core.Events + * Calculates the Transform Matrix of the given Game Object and Camera, factoring in + * the parent matrix if provided. + * + * Note that the object this results contains _references_ to the Transform Matrices, + * not new instances of them. Therefore, you should use their values immediately, or + * copy them to your own matrix, as they will be replaced as soon as another Game + * Object is rendered. + * + * @function Phaser.GameObjects.GetCalcMatrix + * @memberof Phaser.GameObjects + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} src - The Game Object to calculate the transform matrix for. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera being used to render the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - The transform matrix of the parent container, if any. + * + * @return {Phaser.Types.GameObjects.GetCalcMatrixResults} The results object containing the updated transform matrices. */ +var GetCalcMatrix = function (src, camera, parentMatrix) +{ + var camMatrix = tempMatrix1; + var spriteMatrix = tempMatrix2; + var calcMatrix = tempMatrix3; -module.exports = { + spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - BLUR: __webpack_require__(567), - BOOT: __webpack_require__(568), - CONTEXT_LOST: __webpack_require__(569), - CONTEXT_RESTORED: __webpack_require__(570), - DESTROY: __webpack_require__(571), - FOCUS: __webpack_require__(572), - HIDDEN: __webpack_require__(573), - PAUSE: __webpack_require__(574), - POST_RENDER: __webpack_require__(575), - POST_STEP: __webpack_require__(576), - PRE_RENDER: __webpack_require__(577), - PRE_STEP: __webpack_require__(578), - READY: __webpack_require__(579), - RESUME: __webpack_require__(580), - STEP: __webpack_require__(581), - VISIBLE: __webpack_require__(582) + camMatrix.copyFrom(camera.matrix); + if (parentMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = src.x; + spriteMatrix.f = src.y; + } + else + { + spriteMatrix.e -= camera.scrollX * src.scrollFactorX; + spriteMatrix.f -= camera.scrollY * src.scrollFactorY; + } + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + + return result; }; +module.exports = GetCalcMatrix; + /***/ }), /* 22 */ @@ -4328,13 +4359,13 @@ module.exports = { */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); -var Events = __webpack_require__(84); +var CONST = __webpack_require__(19); +var Events = __webpack_require__(89); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(146); -var MergeXHRSettings = __webpack_require__(226); -var XHRLoader = __webpack_require__(477); -var XHRSettings = __webpack_require__(147); +var GetURL = __webpack_require__(148); +var MergeXHRSettings = __webpack_require__(232); +var XHRLoader = __webpack_require__(494); +var XHRSettings = __webpack_require__(149); /** * @classdesc @@ -4400,7 +4431,18 @@ var File = new Class({ if (!this.type || !this.key) { - throw new Error('Error calling \'Loader.' + this.type + '\' invalid key provided.'); + throw new Error('Invalid Loader.' + this.type + ' key'); + } + + var url = GetFastValue(fileConfig, 'url'); + + if (url === undefined) + { + url = loader.path + loadKey + '.' + GetFastValue(fileConfig, 'extension', ''); + } + else if (typeof url === 'string' && !url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)) + { + url = loader.path + url; } /** @@ -4414,16 +4456,7 @@ var File = new Class({ * @type {object|string} * @since 3.0.0 */ - this.url = GetFastValue(fileConfig, 'url'); - - if (this.url === undefined) - { - this.url = loader.path + loadKey + '.' + GetFastValue(fileConfig, 'extension', ''); - } - else if (typeof this.url === 'string' && this.url.indexOf('blob:') !== 0 && this.url.indexOf('data:') !== 0) - { - this.url = loader.path + this.url; - } + this.url = url; /** * The final URL this file will load from, including baseURL and path. @@ -4462,7 +4495,7 @@ var File = new Class({ * The current state of the file. One of the FILE_CONST values. * * @name Phaser.Loader.File#state - * @type {integer} + * @type {number} * @since 3.0.0 */ this.state = (typeof(this.url) === 'function') ? CONST.FILE_POPULATED : CONST.FILE_PENDING; @@ -4867,857 +4900,6 @@ module.exports = File; /***/ }), /* 23 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -// Contains the plugins that Phaser uses globally and locally. -// These are the source objects, not instantiated. -var corePlugins = {}; - -// Contains the plugins that the dev has loaded into their game -// These are the source objects, not instantiated. -var customPlugins = {}; - -var PluginCache = {}; - -/** - * @namespace Phaser.Plugins.PluginCache - */ - -/** - * Static method called directly by the Core internal Plugins. - * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) - * Plugin is the object to instantiate to create the plugin - * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) - * - * @method Phaser.Plugins.PluginCache.register - * @since 3.8.0 - * - * @param {string} key - A reference used to get this plugin from the plugin cache. - * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. - * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. - * @param {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin? - */ -PluginCache.register = function (key, plugin, mapping, custom) -{ - if (custom === undefined) { custom = false; } - - corePlugins[key] = { plugin: plugin, mapping: mapping, custom: custom }; -}; - -/** - * Stores a custom plugin in the global plugin cache. - * The key must be unique, within the scope of the cache. - * - * @method Phaser.Plugins.PluginCache.registerCustom - * @since 3.8.0 - * - * @param {string} key - A reference used to get this plugin from the plugin cache. - * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. - * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. - * @param {?any} data - A value to be passed to the plugin's `init` method. - */ -PluginCache.registerCustom = function (key, plugin, mapping, data) -{ - customPlugins[key] = { plugin: plugin, mapping: mapping, data: data }; -}; - -/** - * Checks if the given key is already being used in the core plugin cache. - * - * @method Phaser.Plugins.PluginCache.hasCore - * @since 3.8.0 - * - * @param {string} key - The key to check for. - * - * @return {boolean} `true` if the key is already in use in the core cache, otherwise `false`. - */ -PluginCache.hasCore = function (key) -{ - return corePlugins.hasOwnProperty(key); -}; - -/** - * Checks if the given key is already being used in the custom plugin cache. - * - * @method Phaser.Plugins.PluginCache.hasCustom - * @since 3.8.0 - * - * @param {string} key - The key to check for. - * - * @return {boolean} `true` if the key is already in use in the custom cache, otherwise `false`. - */ -PluginCache.hasCustom = function (key) -{ - return customPlugins.hasOwnProperty(key); -}; - -/** - * Returns the core plugin object from the cache based on the given key. - * - * @method Phaser.Plugins.PluginCache.getCore - * @since 3.8.0 - * - * @param {string} key - The key of the core plugin to get. - * - * @return {Phaser.Types.Plugins.CorePluginContainer} The core plugin object. - */ -PluginCache.getCore = function (key) -{ - return corePlugins[key]; -}; - -/** - * Returns the custom plugin object from the cache based on the given key. - * - * @method Phaser.Plugins.PluginCache.getCustom - * @since 3.8.0 - * - * @param {string} key - The key of the custom plugin to get. - * - * @return {Phaser.Types.Plugins.CustomPluginContainer} The custom plugin object. - */ -PluginCache.getCustom = function (key) -{ - return customPlugins[key]; -}; - -/** - * Returns an object from the custom cache based on the given key that can be instantiated. - * - * @method Phaser.Plugins.PluginCache.getCustomClass - * @since 3.8.0 - * - * @param {string} key - The key of the custom plugin to get. - * - * @return {function} The custom plugin object. - */ -PluginCache.getCustomClass = function (key) -{ - return (customPlugins.hasOwnProperty(key)) ? customPlugins[key].plugin : null; -}; - -/** - * Removes a core plugin based on the given key. - * - * @method Phaser.Plugins.PluginCache.remove - * @since 3.8.0 - * - * @param {string} key - The key of the core plugin to remove. - */ -PluginCache.remove = function (key) -{ - if (corePlugins.hasOwnProperty(key)) - { - delete corePlugins[key]; - } -}; - -/** - * Removes a custom plugin based on the given key. - * - * @method Phaser.Plugins.PluginCache.removeCustom - * @since 3.8.0 - * - * @param {string} key - The key of the custom plugin to remove. - */ -PluginCache.removeCustom = function (key) -{ - if (customPlugins.hasOwnProperty(key)) - { - delete customPlugins[key]; - } -}; - -/** - * Removes all Core Plugins. - * - * This includes all of the internal system plugins that Phaser needs, like the Input Plugin and Loader Plugin. - * So be sure you only call this if you do not wish to run Phaser again. - * - * @method Phaser.Plugins.PluginCache.destroyCorePlugins - * @since 3.12.0 - */ -PluginCache.destroyCorePlugins = function () -{ - for (var key in corePlugins) - { - if (corePlugins.hasOwnProperty(key)) - { - delete corePlugins[key]; - } - } -}; - -/** - * Removes all Custom Plugins. - * - * @method Phaser.Plugins.PluginCache.destroyCustomPlugins - * @since 3.12.0 - */ -PluginCache.destroyCustomPlugins = function () -{ - for (var key in customPlugins) - { - if (customPlugins.hasOwnProperty(key)) - { - delete customPlugins[key]; - } - } -}; - -module.exports = PluginCache; - - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var GetFastValue = __webpack_require__(2); - -/** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * - * @function Phaser.Tilemaps.Components.GetTilesWithin - * @since 3.0.0 - * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.GetTilesWithinFilteringOptions} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. - */ -var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) -{ - if (tileX === undefined) { tileX = 0; } - if (tileY === undefined) { tileY = 0; } - if (width === undefined) { width = layer.width; } - if (height === undefined) { height = layer.height; } - - var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); - var isColliding = GetFastValue(filteringOptions, 'isColliding', false); - var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); - - // Clip x, y to top left of map, while shrinking width/height to match. - if (tileX < 0) - { - width += tileX; - tileX = 0; - } - - if (tileY < 0) - { - height += tileY; - tileY = 0; - } - - // Clip width and height to bottom right of map. - if (tileX + width > layer.width) - { - width = Math.max(layer.width - tileX, 0); - } - - if (tileY + height > layer.height) - { - height = Math.max(layer.height - tileY, 0); - } - - var results = []; - - for (var ty = tileY; ty < tileY + height; ty++) - { - for (var tx = tileX; tx < tileX + width; tx++) - { - var tile = layer.data[ty][tx]; - - if (tile !== null) - { - if (isNotEmpty && tile.index === -1) - { - continue; - } - - if (isColliding && !tile.collides) - { - continue; - } - - if (hasInterestingFace && !tile.hasInterestingFace) - { - continue; - } - - results.push(tile); - } - } - } - - return results; -}; - -module.exports = GetTilesWithin; - - -/***/ }), -/* 25 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `PropertyValueSet(group.getChildren(), key, value, step)` - * - * @function Phaser.Actions.PropertyValueSet - * @since 3.3.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {string} key - The property to be updated. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var PropertyValueSet = function (items, key, value, step, index, direction) -{ - if (step === undefined) { step = 0; } - if (index === undefined) { index = 0; } - if (direction === undefined) { direction = 1; } - - var i; - var t = 0; - var end = items.length; - - if (direction === 1) - { - // Start to End - for (i = index; i < end; i++) - { - items[i][key] = value + (t * step); - t++; - } - } - else - { - // End to Start - for (i = index; i >= 0; i--) - { - items[i][key] = value + (t * step); - t++; - } - } - - return items; -}; - -module.exports = PropertyValueSet; - - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(34); -var Smoothing = __webpack_require__(177); - -// The pool into which the canvas elements are placed. -var pool = []; - -// Automatically apply smoothing(false) to created Canvas elements -var _disableContextSmoothing = false; - -/** - * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. - * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, - * which is useless for some of the Phaser pipelines / renderer. - * - * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. - * Which means all instances of Phaser Games on the same page can share the one single pool. - * - * @namespace Phaser.Display.Canvas.CanvasPool - * @since 3.0.0 - */ -var CanvasPool = function () -{ - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? - * - * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool - */ - var create = function (parent, width, height, canvasType, selfParent) - { - if (width === undefined) { width = 1; } - if (height === undefined) { height = 1; } - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - if (selfParent === undefined) { selfParent = false; } - - var canvas; - var container = first(canvasType); - - if (container === null) - { - container = { - parent: parent, - canvas: document.createElement('canvas'), - type: canvasType - }; - - if (canvasType === CONST.CANVAS) - { - pool.push(container); - } - - canvas = container.canvas; - } - else - { - container.parent = parent; - - canvas = container.canvas; - } - - if (selfParent) - { - container.parent = canvas; - } - - canvas.width = width; - canvas.height = height; - - if (_disableContextSmoothing && canvasType === CONST.CANVAS) - { - Smoothing.disable(canvas.getContext('2d')); - } - - return canvas; - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create2D - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} The created canvas. - */ - var create2D = function (parent, width, height) - { - return create(parent, width, height, CONST.CANVAS); - }; - - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.createWebGL - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {integer} [width=1] - The width of the Canvas. - * @param {integer} [height=1] - The height of the Canvas. - * - * @return {HTMLCanvasElement} The created WebGL canvas. - */ - var createWebGL = function (parent, width, height) - { - return create(parent, width, height, CONST.WEBGL); - }; - - /** - * Gets the first free canvas index from the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.first - * @since 3.0.0 - * - * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * - * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases. - */ - var first = function (canvasType) - { - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - - if (canvasType === CONST.WEBGL) - { - return null; - } - - for (var i = 0; i < pool.length; i++) - { - var container = pool[i]; - - if (!container.parent && container.type === canvasType) - { - return container; - } - } - - return null; - }; - - /** - * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. - * The canvas has its width and height set to 1, and its parent attribute nulled. - * - * @function Phaser.Display.Canvas.CanvasPool.remove - * @since 3.0.0 - * - * @param {*} parent - The canvas or the parent of the canvas to free. - */ - var remove = function (parent) - { - // Check to see if the parent is a canvas object - var isCanvas = parent instanceof HTMLCanvasElement; - - pool.forEach(function (container) - { - if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) - { - container.parent = null; - container.canvas.width = 1; - container.canvas.height = 1; - } - }); - }; - - /** - * Gets the total number of used canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.total - * @since 3.0.0 - * - * @return {integer} The number of used canvases. - */ - var total = function () - { - var c = 0; - - pool.forEach(function (container) - { - if (container.parent) - { - c++; - } - }); - - return c; - }; - - /** - * Gets the total number of free canvas elements in the pool. - * - * @function Phaser.Display.Canvas.CanvasPool.free - * @since 3.0.0 - * - * @return {integer} The number of free canvases. - */ - var free = function () - { - return pool.length - total(); - }; - - /** - * Disable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing - * @since 3.0.0 - */ - var disableSmoothing = function () - { - _disableContextSmoothing = true; - }; - - /** - * Enable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing - * @since 3.0.0 - */ - var enableSmoothing = function () - { - _disableContextSmoothing = false; - }; - - return { - create2D: create2D, - create: create, - createWebGL: createWebGL, - disableSmoothing: disableSmoothing, - enableSmoothing: enableSmoothing, - first: first, - free: free, - pool: pool, - remove: remove, - total: total - }; -}; - -// If we export the called function here, it'll only be invoked once (not every time it's required). -module.exports = CanvasPool(); - - -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var BlendModes = __webpack_require__(54); -var GetAdvancedValue = __webpack_require__(15); - -/** - * Builds a Game Object using the provided configuration object. - * - * @function Phaser.GameObjects.BuildGameObject - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - A reference to the Scene. - * @param {Phaser.GameObjects.GameObject} gameObject - The initial GameObject. - * @param {Phaser.Types.GameObjects.GameObjectConfig} config - The config to build the GameObject with. - * - * @return {Phaser.GameObjects.GameObject} The built Game Object. - */ -var BuildGameObject = function (scene, gameObject, config) -{ - // Position - - gameObject.x = GetAdvancedValue(config, 'x', 0); - gameObject.y = GetAdvancedValue(config, 'y', 0); - gameObject.depth = GetAdvancedValue(config, 'depth', 0); - - // Flip - - gameObject.flipX = GetAdvancedValue(config, 'flipX', false); - gameObject.flipY = GetAdvancedValue(config, 'flipY', false); - - // Scale - // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} - - var scale = GetAdvancedValue(config, 'scale', null); - - if (typeof scale === 'number') - { - gameObject.setScale(scale); - } - else if (scale !== null) - { - gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); - gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); - } - - // ScrollFactor - // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} - - var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); - - if (typeof scrollFactor === 'number') - { - gameObject.setScrollFactor(scrollFactor); - } - else if (scrollFactor !== null) - { - gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); - gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); - } - - // Rotation - - gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); - - var angle = GetAdvancedValue(config, 'angle', null); - - if (angle !== null) - { - gameObject.angle = angle; - } - - // Alpha - - gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); - - // Origin - // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} - - var origin = GetAdvancedValue(config, 'origin', null); - - if (typeof origin === 'number') - { - gameObject.setOrigin(origin); - } - else if (origin !== null) - { - var ox = GetAdvancedValue(origin, 'x', 0.5); - var oy = GetAdvancedValue(origin, 'y', 0.5); - - gameObject.setOrigin(ox, oy); - } - - // BlendMode - - gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); - - // Visible - - gameObject.visible = GetAdvancedValue(config, 'visible', true); - - // Add to Scene - - var add = GetAdvancedValue(config, 'add', true); - - if (add) - { - scene.sys.displayList.add(gameObject); - } - - if (gameObject.preUpdate) - { - scene.sys.updateList.add(gameObject); - } - - return gameObject; -}; - -module.exports = BuildGameObject; - - -/***/ }), -/* 28 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix - * and then performs the following steps: - * - * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. - * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. - * 3. Sets the blend mode of the context to be that used by the Game Object. - * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. - * 5. Saves the context state. - * 6. Sets the final matrix values into the context via setTransform. - * 7. If Renderer.antialias, or the frame.source.scaleMode is set, then imageSmoothingEnabled is set. - * - * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. - * - * @function Phaser.Renderer.Canvas.SetTransform - * @since 3.12.0 - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {CanvasRenderingContext2D} ctx - The canvas context to set the transform on. - * @param {Phaser.GameObjects.GameObject} src - The Game Object being rendered. Can be any type that extends the base class. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A parent transform matrix to apply to the Game Object before rendering. - * - * @return {boolean} `true` if the Game Object context was set, otherwise `false`. - */ -var SetTransform = function (renderer, ctx, src, camera, parentMatrix) -{ - var alpha = camera.alpha * src.alpha; - - if (alpha <= 0) - { - // Nothing to see, so don't waste time calculating stuff - return false; - } - - var camMatrix = renderer._tempMatrix1.copyFromArray(camera.matrix.matrix); - var gameObjectMatrix = renderer._tempMatrix2.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - var calcMatrix = renderer._tempMatrix3; - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - gameObjectMatrix.e = src.x; - gameObjectMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(gameObjectMatrix, calcMatrix); - } - else - { - gameObjectMatrix.e -= camera.scrollX * src.scrollFactorX; - gameObjectMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(gameObjectMatrix, calcMatrix); - } - - // Blend Mode - ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; - - // Alpha - ctx.globalAlpha = alpha; - - ctx.save(); - - calcMatrix.setToContext(ctx); - - ctx.imageSmoothingEnabled = !(!renderer.antialias || (src.frame && src.frame.source.scaleMode)); - - return true; -}; - -module.exports = SetTransform; - - -/***/ }), -/* 29 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -5727,330 +4909,33 @@ module.exports = SetTransform; */ /** - * @namespace Phaser.GameObjects.Events + * @namespace Phaser.Core.Events */ module.exports = { - ADDED_TO_SCENE: __webpack_require__(593), - DESTROY: __webpack_require__(594), - REMOVED_FROM_SCENE: __webpack_require__(595), - VIDEO_COMPLETE: __webpack_require__(596), - VIDEO_CREATED: __webpack_require__(597), - VIDEO_ERROR: __webpack_require__(598), - VIDEO_LOOP: __webpack_require__(599), - VIDEO_PLAY: __webpack_require__(600), - VIDEO_SEEKED: __webpack_require__(601), - VIDEO_SEEKING: __webpack_require__(602), - VIDEO_STOP: __webpack_require__(603), - VIDEO_TIMEOUT: __webpack_require__(604), - VIDEO_UNLOCKED: __webpack_require__(605) + BLUR: __webpack_require__(606), + BOOT: __webpack_require__(607), + CONTEXT_LOST: __webpack_require__(608), + CONTEXT_RESTORED: __webpack_require__(609), + DESTROY: __webpack_require__(610), + FOCUS: __webpack_require__(611), + HIDDEN: __webpack_require__(612), + PAUSE: __webpack_require__(613), + POST_RENDER: __webpack_require__(614), + POST_STEP: __webpack_require__(615), + PRE_RENDER: __webpack_require__(616), + PRE_STEP: __webpack_require__(617), + READY: __webpack_require__(618), + RESUME: __webpack_require__(619), + STEP: __webpack_require__(620), + VISIBLE: __webpack_require__(621) }; /***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(14); -var Line = __webpack_require__(40); - -/** - * @classdesc - * The Shape Game Object is a base class for the various different shapes, such as the Arc, Star or Polygon. - * You cannot add a Shape directly to your Scene, it is meant as a base for your own custom Shape classes. - * - * @class Shape - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 - * - * @extends Phaser.GameObjects.Components.AlphaSingle - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.ComputedSize - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {string} [type] - The internal type of the Shape. - * @param {any} [data] - The data of the source shape geometry, if any. - */ -var Shape = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.AlphaSingle, - Components.BlendMode, - Components.ComputedSize, - Components.Depth, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.Pipeline, - Components.ScrollFactor, - Components.Transform, - Components.Visible - ], - - initialize: - - function Shape (scene, type, data) - { - if (type === undefined) { type = 'Shape'; } - - GameObject.call(this, scene, type); - - /** - * The source Shape data. Typically a geometry object. - * You should not manipulate this directly. - * - * @name Phaser.GameObjects.Shape#geom - * @type {any} - * @readonly - * @since 3.13.0 - */ - this.geom = data; - - /** - * Holds the polygon path data for filled rendering. - * - * @name Phaser.GameObjects.Shape#pathData - * @type {number[]} - * @readonly - * @since 3.13.0 - */ - this.pathData = []; - - /** - * Holds the earcut polygon path index data for filled rendering. - * - * @name Phaser.GameObjects.Shape#pathIndexes - * @type {integer[]} - * @readonly - * @since 3.13.0 - */ - this.pathIndexes = []; - - /** - * The fill color used by this Shape. - * - * @name Phaser.GameObjects.Shape#fillColor - * @type {number} - * @since 3.13.0 - */ - this.fillColor = 0xffffff; - - /** - * The fill alpha value used by this Shape. - * - * @name Phaser.GameObjects.Shape#fillAlpha - * @type {number} - * @since 3.13.0 - */ - this.fillAlpha = 1; - - /** - * The stroke color used by this Shape. - * - * @name Phaser.GameObjects.Shape#strokeColor - * @type {number} - * @since 3.13.0 - */ - this.strokeColor = 0xffffff; - - /** - * The stroke alpha value used by this Shape. - * - * @name Phaser.GameObjects.Shape#strokeAlpha - * @type {number} - * @since 3.13.0 - */ - this.strokeAlpha = 1; - - /** - * The stroke line width used by this Shape. - * - * @name Phaser.GameObjects.Shape#lineWidth - * @type {number} - * @since 3.13.0 - */ - this.lineWidth = 1; - - /** - * Controls if this Shape is filled or not. - * Note that some Shapes do not support being filled (such as Line shapes) - * - * @name Phaser.GameObjects.Shape#isFilled - * @type {boolean} - * @since 3.13.0 - */ - this.isFilled = false; - - /** - * Controls if this Shape is stroked or not. - * Note that some Shapes do not support being stroked (such as Iso Box shapes) - * - * @name Phaser.GameObjects.Shape#isStroked - * @type {boolean} - * @since 3.13.0 - */ - this.isStroked = false; - - /** - * Controls if this Shape path is closed during rendering when stroked. - * Note that some Shapes are always closed when stroked (such as Ellipse shapes) - * - * @name Phaser.GameObjects.Shape#closePath - * @type {boolean} - * @since 3.13.0 - */ - this.closePath = true; - - /** - * Private internal value. - * A Line used when parsing internal path data to avoid constant object re-creation. - * - * @name Phaser.GameObjects.Curve#_tempLine - * @type {Phaser.Geom.Line} - * @private - * @since 3.13.0 - */ - this._tempLine = new Line(); - - this.initPipeline(); - }, - - /** - * Sets the fill color and alpha for this Shape. - * - * If you wish for the Shape to not be filled then call this method with no arguments, or just set `isFilled` to `false`. - * - * Note that some Shapes do not support fill colors, such as the Line shape. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Shape#setFillStyle - * @since 3.13.0 - * - * @param {number} [color] - The color used to fill this shape. If not provided the Shape will not be filled. - * @param {number} [alpha=1] - The alpha value used when filling this shape, if a fill color is given. - * - * @return {this} This Game Object instance. - */ - setFillStyle: function (color, alpha) - { - if (alpha === undefined) { alpha = 1; } - - if (color === undefined) - { - this.isFilled = false; - } - else - { - this.fillColor = color; - this.fillAlpha = alpha; - this.isFilled = true; - } - - return this; - }, - - /** - * Sets the stroke color and alpha for this Shape. - * - * If you wish for the Shape to not be stroked then call this method with no arguments, or just set `isStroked` to `false`. - * - * Note that some Shapes do not support being stroked, such as the Iso Box shape. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Shape#setStrokeStyle - * @since 3.13.0 - * - * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked. - * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked. - * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given. - * - * @return {this} This Game Object instance. - */ - setStrokeStyle: function (lineWidth, color, alpha) - { - if (alpha === undefined) { alpha = 1; } - - if (lineWidth === undefined) - { - this.isStroked = false; - } - else - { - this.lineWidth = lineWidth; - this.strokeColor = color; - this.strokeAlpha = alpha; - this.isStroked = true; - } - - return this; - }, - - /** - * Sets if this Shape path is closed during rendering when stroked. - * Note that some Shapes are always closed when stroked (such as Ellipse shapes) - * - * This call can be chained. - * - * @method Phaser.GameObjects.Shape#setClosePath - * @since 3.13.0 - * - * @param {boolean} value - Set to `true` if the Shape should be closed when stroked, otherwise `false`. - * - * @return {this} This Game Object instance. - */ - setClosePath: function (value) - { - this.closePath = value; - - return this; - }, - - /** - * Internal destroy handler, called as part of the destroy process. - * - * @method Phaser.GameObjects.Shape#preDestroy - * @protected - * @since 3.13.0 - */ - preDestroy: function () - { - this.geom = null; - this._tempLine = null; - this.pathData = []; - this.pathIndexes = []; - } - -}); - -module.exports = Shape; - - -/***/ }), -/* 31 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -7069,10 +5954,947 @@ var TransformMatrix = new Class({ module.exports = TransformMatrix; +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Contains the plugins that Phaser uses globally and locally. +// These are the source objects, not instantiated. +var corePlugins = {}; + +// Contains the plugins that the dev has loaded into their game +// These are the source objects, not instantiated. +var customPlugins = {}; + +var PluginCache = {}; + +/** + * @namespace Phaser.Plugins.PluginCache + */ + +/** + * Static method called directly by the Core internal Plugins. + * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) + * Plugin is the object to instantiate to create the plugin + * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) + * + * @method Phaser.Plugins.PluginCache.register + * @since 3.8.0 + * + * @param {string} key - A reference used to get this plugin from the plugin cache. + * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. + * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @param {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin? + */ +PluginCache.register = function (key, plugin, mapping, custom) +{ + if (custom === undefined) { custom = false; } + + corePlugins[key] = { plugin: plugin, mapping: mapping, custom: custom }; +}; + +/** + * Stores a custom plugin in the global plugin cache. + * The key must be unique, within the scope of the cache. + * + * @method Phaser.Plugins.PluginCache.registerCustom + * @since 3.8.0 + * + * @param {string} key - A reference used to get this plugin from the plugin cache. + * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. + * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @param {?any} data - A value to be passed to the plugin's `init` method. + */ +PluginCache.registerCustom = function (key, plugin, mapping, data) +{ + customPlugins[key] = { plugin: plugin, mapping: mapping, data: data }; +}; + +/** + * Checks if the given key is already being used in the core plugin cache. + * + * @method Phaser.Plugins.PluginCache.hasCore + * @since 3.8.0 + * + * @param {string} key - The key to check for. + * + * @return {boolean} `true` if the key is already in use in the core cache, otherwise `false`. + */ +PluginCache.hasCore = function (key) +{ + return corePlugins.hasOwnProperty(key); +}; + +/** + * Checks if the given key is already being used in the custom plugin cache. + * + * @method Phaser.Plugins.PluginCache.hasCustom + * @since 3.8.0 + * + * @param {string} key - The key to check for. + * + * @return {boolean} `true` if the key is already in use in the custom cache, otherwise `false`. + */ +PluginCache.hasCustom = function (key) +{ + return customPlugins.hasOwnProperty(key); +}; + +/** + * Returns the core plugin object from the cache based on the given key. + * + * @method Phaser.Plugins.PluginCache.getCore + * @since 3.8.0 + * + * @param {string} key - The key of the core plugin to get. + * + * @return {Phaser.Types.Plugins.CorePluginContainer} The core plugin object. + */ +PluginCache.getCore = function (key) +{ + return corePlugins[key]; +}; + +/** + * Returns the custom plugin object from the cache based on the given key. + * + * @method Phaser.Plugins.PluginCache.getCustom + * @since 3.8.0 + * + * @param {string} key - The key of the custom plugin to get. + * + * @return {Phaser.Types.Plugins.CustomPluginContainer} The custom plugin object. + */ +PluginCache.getCustom = function (key) +{ + return customPlugins[key]; +}; + +/** + * Returns an object from the custom cache based on the given key that can be instantiated. + * + * @method Phaser.Plugins.PluginCache.getCustomClass + * @since 3.8.0 + * + * @param {string} key - The key of the custom plugin to get. + * + * @return {function} The custom plugin object. + */ +PluginCache.getCustomClass = function (key) +{ + return (customPlugins.hasOwnProperty(key)) ? customPlugins[key].plugin : null; +}; + +/** + * Removes a core plugin based on the given key. + * + * @method Phaser.Plugins.PluginCache.remove + * @since 3.8.0 + * + * @param {string} key - The key of the core plugin to remove. + */ +PluginCache.remove = function (key) +{ + if (corePlugins.hasOwnProperty(key)) + { + delete corePlugins[key]; + } +}; + +/** + * Removes a custom plugin based on the given key. + * + * @method Phaser.Plugins.PluginCache.removeCustom + * @since 3.8.0 + * + * @param {string} key - The key of the custom plugin to remove. + */ +PluginCache.removeCustom = function (key) +{ + if (customPlugins.hasOwnProperty(key)) + { + delete customPlugins[key]; + } +}; + +/** + * Removes all Core Plugins. + * + * This includes all of the internal system plugins that Phaser needs, like the Input Plugin and Loader Plugin. + * So be sure you only call this if you do not wish to run Phaser again. + * + * @method Phaser.Plugins.PluginCache.destroyCorePlugins + * @since 3.12.0 + */ +PluginCache.destroyCorePlugins = function () +{ + for (var key in corePlugins) + { + if (corePlugins.hasOwnProperty(key)) + { + delete corePlugins[key]; + } + } +}; + +/** + * Removes all Custom Plugins. + * + * @method Phaser.Plugins.PluginCache.destroyCustomPlugins + * @since 3.12.0 + */ +PluginCache.destroyCustomPlugins = function () +{ + for (var key in customPlugins) + { + if (customPlugins.hasOwnProperty(key)) + { + delete customPlugins[key]; + } + } +}; + +module.exports = PluginCache; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetFastValue = __webpack_require__(2); + +/** + * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. + * + * @function Phaser.Tilemaps.Components.GetTilesWithin + * @since 3.0.0 + * + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + */ +var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) +{ + if (tileX === undefined) { tileX = 0; } + if (tileY === undefined) { tileY = 0; } + if (width === undefined) { width = layer.width; } + if (height === undefined) { height = layer.height; } + if (!filteringOptions) { filteringOptions = {}; } + + var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); + var isColliding = GetFastValue(filteringOptions, 'isColliding', false); + var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); + + // Clip x, y to top left of map, while shrinking width/height to match. + if (tileX < 0) + { + width += tileX; + tileX = 0; + } + + if (tileY < 0) + { + height += tileY; + tileY = 0; + } + + // Clip width and height to bottom right of map. + if (tileX + width > layer.width) + { + width = Math.max(layer.width - tileX, 0); + } + + if (tileY + height > layer.height) + { + height = Math.max(layer.height - tileY, 0); + } + + var results = []; + + for (var ty = tileY; ty < tileY + height; ty++) + { + for (var tx = tileX; tx < tileX + width; tx++) + { + var tile = layer.data[ty][tx]; + + if (tile !== null) + { + if (isNotEmpty && tile.index === -1) + { + continue; + } + + if (isColliding && !tile.collides) + { + continue; + } + + if (hasInterestingFace && !tile.hasInterestingFace) + { + continue; + } + + results.push(tile); + } + } + } + + return results; +}; + +module.exports = GetTilesWithin; + + +/***/ }), +/* 27 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `PropertyValueSet(group.getChildren(), key, value, step)` + * + * @function Phaser.Actions.PropertyValueSet + * @since 3.3.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {string} key - The property to be updated. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var PropertyValueSet = function (items, key, value, step, index, direction) +{ + if (step === undefined) { step = 0; } + if (index === undefined) { index = 0; } + if (direction === undefined) { direction = 1; } + + var i; + var t = 0; + var end = items.length; + + if (direction === 1) + { + // Start to End + for (i = index; i < end; i++) + { + items[i][key] = value + (t * step); + t++; + } + } + else + { + // End to Start + for (i = index; i >= 0; i--) + { + items[i][key] = value + (t * step); + t++; + } + } + + return items; +}; + +module.exports = PropertyValueSet; + + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BlendModes = __webpack_require__(48); +var GetAdvancedValue = __webpack_require__(15); + +/** + * Builds a Game Object using the provided configuration object. + * + * @function Phaser.GameObjects.BuildGameObject + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - A reference to the Scene. + * @param {Phaser.GameObjects.GameObject} gameObject - The initial GameObject. + * @param {Phaser.Types.GameObjects.GameObjectConfig} config - The config to build the GameObject with. + * + * @return {Phaser.GameObjects.GameObject} The built Game Object. + */ +var BuildGameObject = function (scene, gameObject, config) +{ + // Position + + gameObject.x = GetAdvancedValue(config, 'x', 0); + gameObject.y = GetAdvancedValue(config, 'y', 0); + gameObject.depth = GetAdvancedValue(config, 'depth', 0); + + // Flip + + gameObject.flipX = GetAdvancedValue(config, 'flipX', false); + gameObject.flipY = GetAdvancedValue(config, 'flipY', false); + + // Scale + // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} + + var scale = GetAdvancedValue(config, 'scale', null); + + if (typeof scale === 'number') + { + gameObject.setScale(scale); + } + else if (scale !== null) + { + gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); + gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); + } + + // ScrollFactor + // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} + + var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); + + if (typeof scrollFactor === 'number') + { + gameObject.setScrollFactor(scrollFactor); + } + else if (scrollFactor !== null) + { + gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); + gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); + } + + // Rotation + + gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); + + var angle = GetAdvancedValue(config, 'angle', null); + + if (angle !== null) + { + gameObject.angle = angle; + } + + // Alpha + + gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); + + // Origin + // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} + + var origin = GetAdvancedValue(config, 'origin', null); + + if (typeof origin === 'number') + { + gameObject.setOrigin(origin); + } + else if (origin !== null) + { + var ox = GetAdvancedValue(origin, 'x', 0.5); + var oy = GetAdvancedValue(origin, 'y', 0.5); + + gameObject.setOrigin(ox, oy); + } + + // BlendMode + + gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); + + // Visible + + gameObject.visible = GetAdvancedValue(config, 'visible', true); + + // Add to Scene + + var add = GetAdvancedValue(config, 'add', true); + + if (add) + { + scene.sys.displayList.add(gameObject); + } + + if (gameObject.preUpdate) + { + scene.sys.updateList.add(gameObject); + } + + return gameObject; +}; + +module.exports = BuildGameObject; + + +/***/ }), +/* 29 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Phaser Tilemap constants for orientation. + * + * @namespace Phaser.Tilemaps.Orientation + * @memberof Phaser.Tilemaps + * @since 3.50.0 + */ + +/** + * Phaser Tilemap constants for orientation. + * + * To find out what each mode does please see [Phaser.Tilemaps.Orientation]{@link Phaser.Tilemaps.Orientation}. + * + * @typedef {Phaser.Tilemaps.Orientation} Phaser.Tilemaps.OrientationType + * @memberof Phaser.Tilemaps + * @since 3.50.0 + */ + +module.exports = { + + /** + * Orthogonal Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.ORTHOGONAL + * @type {number} + * @const + * @since 3.50.0 + */ + ORTHOGONAL: 0, + + /** + * Isometric Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.ISOMETRIC + * @type {number} + * @const + * @since 3.50.0 + */ + ISOMETRIC: 1, + + /** + * Staggered Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.STAGGERED + * @type {number} + * @const + * @since 3.50.0 + */ + STAGGERED: 2, + + /** + * Hexagonal Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.HEXAGONAL + * @type {number} + * @const + * @since 3.50.0 + */ + HEXAGONAL: 3 + +}; + + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetCalcMatrix = __webpack_require__(21); + +/** + * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix + * and then performs the following steps: + * + * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. + * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. + * 3. Sets the blend mode of the context to be that used by the Game Object. + * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. + * 5. Saves the context state. + * 6. Sets the final matrix values into the context via setTransform. + * 7. If Renderer.antialias, or the frame.source.scaleMode is set, then imageSmoothingEnabled is set. + * + * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. + * + * @function Phaser.Renderer.Canvas.SetTransform + * @since 3.12.0 + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {CanvasRenderingContext2D} ctx - The canvas context to set the transform on. + * @param {Phaser.GameObjects.GameObject} src - The Game Object being rendered. Can be any type that extends the base class. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A parent transform matrix to apply to the Game Object before rendering. + * + * @return {boolean} `true` if the Game Object context was set, otherwise `false`. + */ +var SetTransform = function (renderer, ctx, src, camera, parentMatrix) +{ + var alpha = camera.alpha * src.alpha; + + if (alpha <= 0) + { + // Nothing to see, so don't waste time calculating stuff + return false; + } + + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + // Blend Mode + ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; + + // Alpha + ctx.globalAlpha = alpha; + + ctx.save(); + + calcMatrix.setToContext(ctx); + + ctx.imageSmoothingEnabled = !(!renderer.antialias || (src.frame && src.frame.source.scaleMode)); + + return true; +}; + +module.exports = SetTransform; + + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(39); +var Smoothing = __webpack_require__(184); + +// The pool into which the canvas elements are placed. +var pool = []; + +// Automatically apply smoothing(false) to created Canvas elements +var _disableContextSmoothing = false; + +/** + * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. + * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, + * which is useless for some of the Phaser pipelines / renderer. + * + * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. + * Which means all instances of Phaser Games on the same page can share the one single pool. + * + * @namespace Phaser.Display.Canvas.CanvasPool + * @since 3.0.0 + */ +var CanvasPool = function () +{ + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {number} [width=1] - The width of the Canvas. + * @param {number} [height=1] - The height of the Canvas. + * @param {number} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? + * + * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool + */ + var create = function (parent, width, height, canvasType, selfParent) + { + if (width === undefined) { width = 1; } + if (height === undefined) { height = 1; } + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + if (selfParent === undefined) { selfParent = false; } + + var canvas; + var container = first(canvasType); + + if (container === null) + { + container = { + parent: parent, + canvas: document.createElement('canvas'), + type: canvasType + }; + + if (canvasType === CONST.CANVAS) + { + pool.push(container); + } + + canvas = container.canvas; + } + else + { + container.parent = parent; + + canvas = container.canvas; + } + + if (selfParent) + { + container.parent = canvas; + } + + canvas.width = width; + canvas.height = height; + + if (_disableContextSmoothing && canvasType === CONST.CANVAS) + { + Smoothing.disable(canvas.getContext('2d')); + } + + return canvas; + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.create2D + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {number} [width=1] - The width of the Canvas. + * @param {number} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created canvas. + */ + var create2D = function (parent, width, height) + { + return create(parent, width, height, CONST.CANVAS); + }; + + /** + * Creates a new Canvas DOM element, or pulls one from the pool if free. + * + * @function Phaser.Display.Canvas.CanvasPool.createWebGL + * @since 3.0.0 + * + * @param {*} parent - The parent of the Canvas object. + * @param {number} [width=1] - The width of the Canvas. + * @param {number} [height=1] - The height of the Canvas. + * + * @return {HTMLCanvasElement} The created WebGL canvas. + */ + var createWebGL = function (parent, width, height) + { + return create(parent, width, height, CONST.WEBGL); + }; + + /** + * Gets the first free canvas index from the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.first + * @since 3.0.0 + * + * @param {number} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * + * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases. + */ + var first = function (canvasType) + { + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + + if (canvasType === CONST.WEBGL) + { + return null; + } + + for (var i = 0; i < pool.length; i++) + { + var container = pool[i]; + + if (!container.parent && container.type === canvasType) + { + return container; + } + } + + return null; + }; + + /** + * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. + * The canvas has its width and height set to 1, and its parent attribute nulled. + * + * @function Phaser.Display.Canvas.CanvasPool.remove + * @since 3.0.0 + * + * @param {*} parent - The canvas or the parent of the canvas to free. + */ + var remove = function (parent) + { + // Check to see if the parent is a canvas object + var isCanvas = parent instanceof HTMLCanvasElement; + + pool.forEach(function (container) + { + if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) + { + container.parent = null; + container.canvas.width = 1; + container.canvas.height = 1; + } + }); + }; + + /** + * Gets the total number of used canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.total + * @since 3.0.0 + * + * @return {number} The number of used canvases. + */ + var total = function () + { + var c = 0; + + pool.forEach(function (container) + { + if (container.parent) + { + c++; + } + }); + + return c; + }; + + /** + * Gets the total number of free canvas elements in the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.free + * @since 3.0.0 + * + * @return {number} The number of free canvases. + */ + var free = function () + { + return pool.length - total(); + }; + + /** + * Disable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing + * @since 3.0.0 + */ + var disableSmoothing = function () + { + _disableContextSmoothing = true; + }; + + /** + * Enable context smoothing on any new Canvas element created. + * + * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing + * @since 3.0.0 + */ + var enableSmoothing = function () + { + _disableContextSmoothing = false; + }; + + return { + create2D: create2D, + create: create, + createWebGL: createWebGL, + disableSmoothing: disableSmoothing, + enableSmoothing: enableSmoothing, + first: first, + free: free, + pool: pool, + remove: remove, + total: total + }; +}; + +// If we export the called function here, it'll only be invoked once (not every time it's required). +module.exports = CanvasPool(); + + /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Events + */ + +module.exports = { + + ADDED_TO_SCENE: __webpack_require__(633), + DESTROY: __webpack_require__(634), + REMOVED_FROM_SCENE: __webpack_require__(635), + VIDEO_COMPLETE: __webpack_require__(636), + VIDEO_CREATED: __webpack_require__(637), + VIDEO_ERROR: __webpack_require__(638), + VIDEO_LOOP: __webpack_require__(639), + VIDEO_PLAY: __webpack_require__(640), + VIDEO_SEEKED: __webpack_require__(641), + VIDEO_SEEKING: __webpack_require__(642), + VIDEO_STOP: __webpack_require__(643), + VIDEO_TIMEOUT: __webpack_require__(644), + VIDEO_UNLOCKED: __webpack_require__(645) + +}; + + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + /** * @author Richard Davey * @copyright 2020 Photon Storm Ltd. @@ -7080,10 +6902,481 @@ module.exports = TransformMatrix; */ var Class = __webpack_require__(0); -var GetColor = __webpack_require__(175); -var GetColor32 = __webpack_require__(308); -var HSVToRGB = __webpack_require__(176); -var RGBToHSV = __webpack_require__(309); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(14); +var Line = __webpack_require__(45); +var PIPELINES_CONST = __webpack_require__(82); + +/** + * @classdesc + * The Shape Game Object is a base class for the various different shapes, such as the Arc, Star or Polygon. + * You cannot add a Shape directly to your Scene, it is meant as a base for your own custom Shape classes. + * + * @class Shape + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {string} [type] - The internal type of the Shape. + * @param {any} [data] - The data of the source shape geometry, if any. + */ +var Shape = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.ScrollFactor, + Components.Transform, + Components.Visible + ], + + initialize: + + function Shape (scene, type, data) + { + if (type === undefined) { type = 'Shape'; } + + GameObject.call(this, scene, type); + + /** + * The source Shape data. Typically a geometry object. + * You should not manipulate this directly. + * + * @name Phaser.GameObjects.Shape#geom + * @type {any} + * @readonly + * @since 3.13.0 + */ + this.geom = data; + + /** + * Holds the polygon path data for filled rendering. + * + * @name Phaser.GameObjects.Shape#pathData + * @type {number[]} + * @readonly + * @since 3.13.0 + */ + this.pathData = []; + + /** + * Holds the earcut polygon path index data for filled rendering. + * + * @name Phaser.GameObjects.Shape#pathIndexes + * @type {number[]} + * @readonly + * @since 3.13.0 + */ + this.pathIndexes = []; + + /** + * The fill color used by this Shape. + * + * @name Phaser.GameObjects.Shape#fillColor + * @type {number} + * @since 3.13.0 + */ + this.fillColor = 0xffffff; + + /** + * The fill alpha value used by this Shape. + * + * @name Phaser.GameObjects.Shape#fillAlpha + * @type {number} + * @since 3.13.0 + */ + this.fillAlpha = 1; + + /** + * The stroke color used by this Shape. + * + * @name Phaser.GameObjects.Shape#strokeColor + * @type {number} + * @since 3.13.0 + */ + this.strokeColor = 0xffffff; + + /** + * The stroke alpha value used by this Shape. + * + * @name Phaser.GameObjects.Shape#strokeAlpha + * @type {number} + * @since 3.13.0 + */ + this.strokeAlpha = 1; + + /** + * The stroke line width used by this Shape. + * + * @name Phaser.GameObjects.Shape#lineWidth + * @type {number} + * @since 3.13.0 + */ + this.lineWidth = 1; + + /** + * Controls if this Shape is filled or not. + * Note that some Shapes do not support being filled (such as Line shapes) + * + * @name Phaser.GameObjects.Shape#isFilled + * @type {boolean} + * @since 3.13.0 + */ + this.isFilled = false; + + /** + * Controls if this Shape is stroked or not. + * Note that some Shapes do not support being stroked (such as Iso Box shapes) + * + * @name Phaser.GameObjects.Shape#isStroked + * @type {boolean} + * @since 3.13.0 + */ + this.isStroked = false; + + /** + * Controls if this Shape path is closed during rendering when stroked. + * Note that some Shapes are always closed when stroked (such as Ellipse shapes) + * + * @name Phaser.GameObjects.Shape#closePath + * @type {boolean} + * @since 3.13.0 + */ + this.closePath = true; + + /** + * Private internal value. + * A Line used when parsing internal path data to avoid constant object re-creation. + * + * @name Phaser.GameObjects.Shape#_tempLine + * @type {Phaser.Geom.Line} + * @private + * @since 3.13.0 + */ + this._tempLine = new Line(); + + /** + * The native (un-scaled) width of this Game Object. + * + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayWidth` property. + * + * @name Phaser.GameObjects.Shape#width + * @type {number} + * @since 3.13.0 + */ + this.width = 0; + + /** + * The native (un-scaled) height of this Game Object. + * + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayHeight` property. + * + * @name Phaser.GameObjects.Shape#height + * @type {number} + * @since 3.0.0 + */ + this.height = 0; + + this.initPipeline(PIPELINES_CONST.GRAPHICS_PIPELINE); + }, + + /** + * Sets the fill color and alpha for this Shape. + * + * If you wish for the Shape to not be filled then call this method with no arguments, or just set `isFilled` to `false`. + * + * Note that some Shapes do not support fill colors, such as the Line shape. + * + * This call can be chained. + * + * @method Phaser.GameObjects.Shape#setFillStyle + * @since 3.13.0 + * + * @param {number} [color] - The color used to fill this shape. If not provided the Shape will not be filled. + * @param {number} [alpha=1] - The alpha value used when filling this shape, if a fill color is given. + * + * @return {this} This Game Object instance. + */ + setFillStyle: function (color, alpha) + { + if (alpha === undefined) { alpha = 1; } + + if (color === undefined) + { + this.isFilled = false; + } + else + { + this.fillColor = color; + this.fillAlpha = alpha; + this.isFilled = true; + } + + return this; + }, + + /** + * Sets the stroke color and alpha for this Shape. + * + * If you wish for the Shape to not be stroked then call this method with no arguments, or just set `isStroked` to `false`. + * + * Note that some Shapes do not support being stroked, such as the Iso Box shape. + * + * This call can be chained. + * + * @method Phaser.GameObjects.Shape#setStrokeStyle + * @since 3.13.0 + * + * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked. + * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked. + * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given. + * + * @return {this} This Game Object instance. + */ + setStrokeStyle: function (lineWidth, color, alpha) + { + if (alpha === undefined) { alpha = 1; } + + if (lineWidth === undefined) + { + this.isStroked = false; + } + else + { + this.lineWidth = lineWidth; + this.strokeColor = color; + this.strokeAlpha = alpha; + this.isStroked = true; + } + + return this; + }, + + /** + * Sets if this Shape path is closed during rendering when stroked. + * Note that some Shapes are always closed when stroked (such as Ellipse shapes) + * + * This call can be chained. + * + * @method Phaser.GameObjects.Shape#setClosePath + * @since 3.13.0 + * + * @param {boolean} value - Set to `true` if the Shape should be closed when stroked, otherwise `false`. + * + * @return {this} This Game Object instance. + */ + setClosePath: function (value) + { + this.closePath = value; + + return this; + }, + + /** + * Sets the internal size of this Game Object, as used for frame or physics body creation. + * + * This will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or call the + * `setDisplaySize` method, which is the same thing as changing the scale but allows you + * to do so by giving pixel values. + * + * If you have enabled this Game Object for input, changing the size will _not_ change the + * size of the hit area. To do this you should adjust the `input.hitArea` object directly. + * + * @method Phaser.GameObjects.Shape#setSize + * @private + * @since 3.13.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {this} This Game Object instance. + */ + setSize: function (width, height) + { + this.width = width; + this.height = height; + + return this; + }, + + /** + * Internal destroy handler, called as part of the destroy process. + * + * @method Phaser.GameObjects.Shape#preDestroy + * @protected + * @since 3.13.0 + */ + preDestroy: function () + { + this.geom = null; + this._tempLine = null; + this.pathData = []; + this.pathIndexes = []; + }, + + /** + * The displayed width of this Game Object. + * + * This value takes into account the scale factor. + * + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.Shape#displayWidth + * @type {number} + * @since 3.13.0 + */ + displayWidth: { + + get: function () + { + return this.scaleX * this.width; + }, + + set: function (value) + { + this.scaleX = value / this.width; + } + + }, + + /** + * The displayed height of this Game Object. + * + * This value takes into account the scale factor. + * + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.Shape#displayHeight + * @type {number} + * @since 3.13.0 + */ + displayHeight: { + + get: function () + { + return this.scaleY * this.height; + }, + + set: function (value) + { + this.scaleY = value / this.height; + } + + } + +}); + +module.exports = Shape; + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(13); + +/** + * Convert the given angle from degrees, to the equivalent angle in radians. + * + * @function Phaser.Math.DegToRad + * @since 3.0.0 + * + * @param {number} degrees - The angle (in degrees) to convert to radians. + * + * @return {number} The given angle converted to radians. + */ +var DegToRad = function (degrees) +{ + return degrees * CONST.DEG_TO_RAD; +}; + +module.exports = DegToRad; + + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Cameras.Scene2D.Events + */ + +module.exports = { + + DESTROY: __webpack_require__(711), + FADE_IN_COMPLETE: __webpack_require__(712), + FADE_IN_START: __webpack_require__(713), + FADE_OUT_COMPLETE: __webpack_require__(714), + FADE_OUT_START: __webpack_require__(715), + FLASH_COMPLETE: __webpack_require__(716), + FLASH_START: __webpack_require__(717), + FOLLOW_UPDATE: __webpack_require__(718), + PAN_COMPLETE: __webpack_require__(719), + PAN_START: __webpack_require__(720), + POST_RENDER: __webpack_require__(721), + PRE_RENDER: __webpack_require__(722), + ROTATE_COMPLETE: __webpack_require__(723), + ROTATE_START: __webpack_require__(724), + SHAKE_COMPLETE: __webpack_require__(725), + SHAKE_START: __webpack_require__(726), + ZOOM_COMPLETE: __webpack_require__(727), + ZOOM_START: __webpack_require__(728) + +}; + + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var GetColor = __webpack_require__(100); +var GetColor32 = __webpack_require__(320); +var HSVToRGB = __webpack_require__(180); +var RGBToHSV = __webpack_require__(321); /** * @namespace Phaser.Display.Color @@ -7098,10 +7391,10 @@ var RGBToHSV = __webpack_require__(309); * @constructor * @since 3.0.0 * - * @param {integer} [red=0] - The red color value. A number between 0 and 255. - * @param {integer} [green=0] - The green color value. A number between 0 and 255. - * @param {integer} [blue=0] - The blue color value. A number between 0 and 255. - * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255. + * @param {number} [red=0] - The red color value. A number between 0 and 255. + * @param {number} [green=0] - The green color value. A number between 0 and 255. + * @param {number} [blue=0] - The blue color value. A number between 0 and 255. + * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. */ var Color = new Class({ @@ -7277,10 +7570,10 @@ var Color = new Class({ * @method Phaser.Display.Color#setTo * @since 3.0.0 * - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255. + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. * @param {boolean} [updateHSV=true] - Update the HSV values after setting the RGB values? * * @return {Phaser.Display.Color} This Color object. @@ -7450,7 +7743,7 @@ var Color = new Class({ * @method Phaser.Display.Color#gray * @since 3.13.0 * - * @param {integer} shade - A value between 0 and 255. + * @param {number} shade - A value between 0 and 255. * * @return {Phaser.Display.Color} This Color object. */ @@ -7465,8 +7758,8 @@ var Color = new Class({ * @method Phaser.Display.Color#random * @since 3.13.0 * - * @param {integer} [min=0] - The minimum random color value. Between 0 and 255. - * @param {integer} [max=255] - The maximum random color value. Between 0 and 255. + * @param {number} [min=0] - The minimum random color value. Between 0 and 255. + * @param {number} [max=255] - The maximum random color value. Between 0 and 255. * * @return {Phaser.Display.Color} This Color object. */ @@ -7488,8 +7781,8 @@ var Color = new Class({ * @method Phaser.Display.Color#randomGray * @since 3.13.0 * - * @param {integer} [min=0] - The minimum random color value. Between 0 and 255. - * @param {integer} [max=255] - The maximum random color value. Between 0 and 255. + * @param {number} [min=0] - The minimum random color value. Between 0 and 255. + * @param {number} [max=255] - The maximum random color value. Between 0 and 255. * * @return {Phaser.Display.Color} This Color object. */ @@ -7510,7 +7803,7 @@ var Color = new Class({ * @method Phaser.Display.Color#saturate * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7528,7 +7821,7 @@ var Color = new Class({ * @method Phaser.Display.Color#desaturate * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7545,7 +7838,7 @@ var Color = new Class({ * @method Phaser.Display.Color#lighten * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7562,7 +7855,7 @@ var Color = new Class({ * @method Phaser.Display.Color#darken * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7579,7 +7872,7 @@ var Color = new Class({ * @method Phaser.Display.Color#brighten * @since 3.13.0 * - * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * * @return {Phaser.Display.Color} This Color object. */ @@ -7933,7 +8226,1053 @@ module.exports = Color; /***/ }), -/* 33 */ +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + +var Class = __webpack_require__(0); + +/** + * @classdesc + * A representation of a vector in 3D space. + * + * A three-component vector. + * + * @class Vector3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + */ +var Vector3 = new Class({ + + initialize: + + function Vector3 (x, y, z) + { + /** + * The x component of this Vector. + * + * @name Phaser.Math.Vector3#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector3#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector3#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + }, + + /** + * Set this Vector to point up. + * + * Sets the y component of the vector to 1, and the others to 0. + * + * @method Phaser.Math.Vector3#up + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + up: function () + { + this.x = 0; + this.y = 1; + this.z = 0; + + return this; + }, + + /** + * Sets the components of this Vector to be the `Math.min` result from the given vector. + * + * @method Phaser.Math.Vector3#min + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to check the minimum values against. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + min: function (v) + { + this.x = Math.min(this.x, v.x); + this.y = Math.min(this.y, v.y); + this.z = Math.min(this.z, v.z); + + return this; + }, + + /** + * Sets the components of this Vector to be the `Math.max` result from the given vector. + * + * @method Phaser.Math.Vector3#max + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to check the maximum values against. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + max: function (v) + { + this.x = Math.max(this.x, v.x); + this.y = Math.max(this.y, v.y); + this.z = Math.max(this.z, v.z); + + return this; + }, + + /** + * Make a clone of this Vector3. + * + * @method Phaser.Math.Vector3#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. + */ + clone: function () + { + return new Vector3(this.x, this.y, this.z); + }, + + /** + * Adds the two given Vector3s and sets the results into this Vector3. + * + * @method Phaser.Math.Vector3#addVectors + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} a - The first Vector to add. + * @param {Phaser.Math.Vector3} b - The second Vector to add. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + addVectors: function (a, b) + { + this.x = a.x + b.x; + this.y = a.y + b.y; + this.z = a.z + b.z; + + return this; + }, + + /** + * Calculate the cross (vector) product of two given Vectors. + * + * @method Phaser.Math.Vector3#crossVectors + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} a - The first Vector to multiply. + * @param {Phaser.Math.Vector3} b - The second Vector to multiply. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + crossVectors: function (a, b) + { + var ax = a.x; + var ay = a.y; + var az = a.z; + var bx = b.x; + var by = b.y; + var bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Check whether this Vector is equal to a given Vector. + * + * Performs a strict equality check against each Vector's components. + * + * @method Phaser.Math.Vector3#equals + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. + * + * @return {boolean} True if the two vectors strictly match, otherwise false. + */ + equals: function (v) + { + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); + }, + + /** + * Copy the components of a given Vector into this Vector. + * + * @method Phaser.Math.Vector3#copy + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + copy: function (src) + { + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + + return this; + }, + + /** + * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. + * + * @method Phaser.Math.Vector3#set + * @since 3.0.0 + * + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. + * @param {number} [y] - The y value to set for this Vector. + * @param {number} [z] - The z value to set for this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + set: function (x, y, z) + { + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } + + return this; + }, + + /** + * Sets the components of this Vector3 from the position of the given Matrix4. + * + * @method Phaser.Math.Vector3#setFromMatrixPosition + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to get the position from. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + setFromMatrixPosition: function (m) + { + return this.fromArray(m.val, 12); + }, + + /** + * Sets the components of this Vector3 from the Matrix4 column specified. + * + * @method Phaser.Math.Vector3#setFromMatrixColumn + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to get the column from. + * @param {number} index - The column index. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + setFromMatrixColumn: function (mat4, index) + { + return this.fromArray(mat4.val, index * 4); + }, + + /** + * Sets the components of this Vector3 from the given array, based on the offset. + * + * Vector3.x = array[offset] + * Vector3.y = array[offset + 1] + * Vector3.z = array[offset + 2] + * + * @method Phaser.Math.Vector3#fromArray + * @since 3.50.0 + * + * @param {number[]} array - The array of values to get this Vector from. + * @param {number} [offset=0] - The offset index into the array. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + fromArray: function (array, offset) + { + if (offset === undefined) { offset = 0; } + + this.x = array[offset]; + this.y = array[offset + 1]; + this.z = array[offset + 2]; + + return this; + }, + + /** + * Add a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector3#add + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + add: function (v) + { + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + + return this; + }, + + /** + * Add the given value to each component of this Vector. + * + * @method Phaser.Math.Vector3#addScalar + * @since 3.50.0 + * + * @param {number} s - The amount to add to this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + addScalar: function (s) + { + this.x += s; + this.y += s; + this.z += s; + + return this; + }, + + /** + * Add and scale a given Vector to this Vector. Addition is component-wise. + * + * @method Phaser.Math.Vector3#addScale + * @since 3.50.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. + * @param {number} scale - The amount to scale `v` by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + addScale: function (v, scale) + { + this.x += v.x * scale; + this.y += v.y * scale; + this.z += v.z * scale || 0; + + return this; + }, + + /** + * Subtract the given Vector from this Vector. Subtraction is component-wise. + * + * @method Phaser.Math.Vector3#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + subtract: function (v) + { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + + return this; + }, + + /** + * Perform a component-wise multiplication between this Vector and the given Vector. + * + * Multiplies this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#multiply + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + multiply: function (v) + { + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + + return this; + }, + + /** + * Scale this Vector by the given value. + * + * @method Phaser.Math.Vector3#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + scale: function (scale) + { + if (isFinite(scale)) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + } + else + { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + /** + * Perform a component-wise division between this Vector and the given Vector. + * + * Divides this Vector by the given Vector. + * + * @method Phaser.Math.Vector3#divide + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + divide: function (v) + { + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + + return this; + }, + + /** + * Negate the `x`, `y` and `z` components of this Vector. + * + * @method Phaser.Math.Vector3#negate + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + negate: function () + { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + + return this; + }, + + /** + * Calculate the distance between this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#distance + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector. + */ + distance: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return Math.sqrt(dx * dx + dy * dy + dz * dz); + }, + + /** + * Calculate the distance between this Vector and the given Vector, squared. + * + * @method Phaser.Math.Vector3#distanceSq + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. + * + * @return {number} The distance from this Vector to the given Vector, squared. + */ + distanceSq: function (v) + { + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return dx * dx + dy * dy + dz * dz; + }, + + /** + * Calculate the length (or magnitude) of this Vector. + * + * @method Phaser.Math.Vector3#length + * @since 3.0.0 + * + * @return {number} The length of this Vector. + */ + length: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return Math.sqrt(x * x + y * y + z * z); + }, + + /** + * Calculate the length of this Vector squared. + * + * @method Phaser.Math.Vector3#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Vector, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + + return x * x + y * y + z * z; + }, + + /** + * Normalize this Vector. + * + * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * + * @method Phaser.Math.Vector3#normalize + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + normalize: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var len = x * x + y * y + z * z; + + if (len > 0) + { + len = 1 / Math.sqrt(len); + + this.x = x * len; + this.y = y * len; + this.z = z * len; + } + + return this; + }, + + /** + * Calculate the dot product of this Vector and the given Vector. + * + * @method Phaser.Math.Vector3#dot + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. + * + * @return {number} The dot product of this Vector and `v`. + */ + dot: function (v) + { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + /** + * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. + * + * @method Phaser.Math.Vector3#cross + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector to cross product with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + cross: function (v) + { + var ax = this.x; + var ay = this.y; + var az = this.z; + var bx = v.x; + var by = v.y; + var bz = v.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + + /** + * Linearly interpolate between this Vector and the given Vector. + * + * Interpolates this Vector towards the given Vector. + * + * @method Phaser.Math.Vector3#lerp + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + lerp: function (v, t) + { + if (t === undefined) { t = 0; } + + var ax = this.x; + var ay = this.y; + var az = this.z; + + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + + return this; + }, + + /** + * Takes a Matrix3 and applies it to this Vector3. + * + * @method Phaser.Math.Vector3#applyMatrix3 + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix3} mat3 - The Matrix3 to apply to this Vector3. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + applyMatrix3: function (mat3) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat3.val; + + this.x = m[0] * x + m[3] * y + m[6] * z; + this.y = m[1] * x + m[4] * y + m[7] * z; + this.z = m[2] * x + m[5] * y + m[8] * z; + + return this; + }, + + /** + * Takes a Matrix4 and applies it to this Vector3. + * + * @method Phaser.Math.Vector3#applyMatrix4 + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to apply to this Vector3. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + applyMatrix4: function (mat4) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat4.val; + + var w = 1 / (m[3] * x + m[7] * y + m[11] * z + m[15]); + + this.x = (m[0] * x + m[4] * y + m[8] * z + m[12]) * w; + this.y = (m[1] * x + m[5] * y + m[9] * z + m[13]) * w; + this.z = (m[2] * x + m[6] * y + m[10] * z + m[14]) * w; + + return this; + }, + + /** + * Transform this Vector with the given Matrix. + * + * @method Phaser.Math.Vector3#transformMat3 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat3: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = x * m[0] + y * m[3] + z * m[6]; + this.y = x * m[1] + y * m[4] + z * m[7]; + this.z = x * m[2] + y * m[5] + z * m[8]; + + return this; + }, + + /** + * Transform this Vector with the given Matrix4. + * + * @method Phaser.Math.Vector3#transformMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformMat4: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; + this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; + this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; + + return this; + }, + + /** + * Transforms the coordinates of this Vector3 with the given Matrix4. + * + * @method Phaser.Math.Vector3#transformCoordinates + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformCoordinates: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; + var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; + var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; + var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + + this.x = tx / tw; + this.y = ty / tw; + this.z = tz / tw; + + return this; + }, + + /** + * Transform this Vector with the given Quaternion. + * + * @method Phaser.Math.Vector3#transformQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + transformQuat: function (q) + { + // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations + var x = this.x; + var y = this.y; + var z = this.z; + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + + // calculate quat * vec + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = -qx * x - qy * y - qz * z; + + // calculate result * inverse quat + this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; + this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; + this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; + + return this; + }, + + /** + * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, + * e.g. unprojecting a 2D point into 3D space. + * + * @method Phaser.Math.Vector3#project + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + project: function (mat) + { + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var a00 = m[0]; + var a01 = m[1]; + var a02 = m[2]; + var a03 = m[3]; + var a10 = m[4]; + var a11 = m[5]; + var a12 = m[6]; + var a13 = m[7]; + var a20 = m[8]; + var a21 = m[9]; + var a22 = m[10]; + var a23 = m[11]; + var a30 = m[12]; + var a31 = m[13]; + var a32 = m[14]; + var a33 = m[15]; + + var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); + + this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; + this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; + this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; + + return this; + }, + + /** + * Multiplies this Vector3 by the given view and projection matrices. + * + * @method Phaser.Math.Vector3#projectViewMatrix + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} viewMatrix - A View Matrix. + * @param {Phaser.Math.Matrix4} projectionMatrix - A Projection Matrix. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + projectViewMatrix: function (viewMatrix, projectionMatrix) + { + return this.applyMatrix4(viewMatrix).applyMatrix4(projectionMatrix); + }, + + /** + * Multiplies this Vector3 by the given inversed projection matrix and world matrix. + * + * @method Phaser.Math.Vector3#unprojectViewMatrix + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} projectionMatrix - An inversed Projection Matrix. + * @param {Phaser.Math.Matrix4} worldMatrix - A World View Matrix. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + unprojectViewMatrix: function (projectionMatrix, worldMatrix) + { + return this.applyMatrix4(projectionMatrix).applyMatrix4(worldMatrix); + }, + + /** + * Unproject this point from 2D space to 3D space. + * The point should have its x and y properties set to + * 2D screen space, and the z either at 0 (near plane) + * or 1 (far plane). The provided matrix is assumed to already + * be combined, i.e. projection * view * model. + * + * After this operation, this vector's (x, y, z) components will + * represent the unprojected 3D coordinate. + * + * @method Phaser.Math.Vector3#unproject + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. + * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + unproject: function (viewport, invProjectionView) + { + var viewX = viewport.x; + var viewY = viewport.y; + var viewWidth = viewport.z; + var viewHeight = viewport.w; + + var x = this.x - viewX; + var y = (viewHeight - this.y - 1) - viewY; + var z = this.z; + + this.x = (2 * x) / viewWidth - 1; + this.y = (2 * y) / viewHeight - 1; + this.z = 2 * z - 1; + + return this.project(invProjectionView); + }, + + /** + * Make this Vector the zero vector (0, 0, 0). + * + * @method Phaser.Math.Vector3#reset + * @since 3.0.0 + * + * @return {Phaser.Math.Vector3} This Vector3. + */ + reset: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + + return this; + } + +}); + +/** + * A static zero Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ZERO + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ZERO = new Vector3(); + +/** + * A static right Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.RIGHT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.RIGHT = new Vector3(1, 0, 0); + +/** + * A static left Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.LEFT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.LEFT = new Vector3(-1, 0, 0); + +/** + * A static up Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.UP + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.UP = new Vector3(0, -1, 0); + +/** + * A static down Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.DOWN + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.DOWN = new Vector3(0, 1, 0); + +/** + * A static forward Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.FORWARD + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.FORWARD = new Vector3(0, 0, 1); + +/** + * A static back Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.BACK + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.BACK = new Vector3(0, 0, -1); + +/** + * A static one Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ONE + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ONE = new Vector3(1, 1, 1); + +module.exports = Vector3; + + +/***/ }), +/* 38 */ /***/ (function(module, exports) { /** @@ -7988,7 +9327,7 @@ module.exports = { /***/ }), -/* 34 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -8013,48 +9352,54 @@ var CONST = { * @type {string} * @since 3.0.0 */ - VERSION: '3.50.0-beta.5', + VERSION: '3.50.0-beta.11', - BlendModes: __webpack_require__(54), + BlendModes: __webpack_require__(48), - ScaleModes: __webpack_require__(247), + ScaleModes: __webpack_require__(260), /** - * AUTO Detect Renderer. + * This setting will auto-detect if the browser is capable of suppporting WebGL. + * If it is, it will use the WebGL Renderer. If not, it will fall back to the Canvas Renderer. * * @name Phaser.AUTO * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ AUTO: 0, /** - * Canvas Renderer. + * Forces Phaser to only use the Canvas Renderer, regardless if the browser supports + * WebGL or not. * * @name Phaser.CANVAS * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ CANVAS: 1, /** - * WebGL Renderer. + * Forces Phaser to use the WebGL Renderer. If the browser does not support it, there is + * no fallback to Canvas with this setting, so you should trap it and display a suitable + * message to the user. * * @name Phaser.WEBGL * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ WEBGL: 2, /** - * Headless Renderer. + * A Headless Renderer doesn't create either a Canvas or WebGL Renderer. However, it still + * absolutely relies on the DOM being present and available. This mode is meant for unit testing, + * not for running Phaser on the server, which is something you really shouldn't do. * * @name Phaser.HEADLESS * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ HEADLESS: 3, @@ -8065,7 +9410,7 @@ var CONST = { * * @name Phaser.FOREVER * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ FOREVER: -1, @@ -8075,7 +9420,7 @@ var CONST = { * * @name Phaser.NONE * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ NONE: 4, @@ -8085,7 +9430,7 @@ var CONST = { * * @name Phaser.UP * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ UP: 5, @@ -8095,7 +9440,7 @@ var CONST = { * * @name Phaser.DOWN * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ DOWN: 6, @@ -8105,7 +9450,7 @@ var CONST = { * * @name Phaser.LEFT * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ LEFT: 7, @@ -8115,7 +9460,7 @@ var CONST = { * * @name Phaser.RIGHT * @const - * @type {integer} + * @type {number} * @since 3.0.0 */ RIGHT: 8 @@ -8126,7 +9471,7 @@ module.exports = CONST; /***/ }), -/* 35 */ +/* 40 */ /***/ (function(module, exports) { /** @@ -8154,7 +9499,7 @@ module.exports = GetBottom; /***/ }), -/* 36 */ +/* 41 */ /***/ (function(module, exports) { /** @@ -8182,7 +9527,7 @@ module.exports = GetLeft; /***/ }), -/* 37 */ +/* 42 */ /***/ (function(module, exports) { /** @@ -8210,7 +9555,7 @@ module.exports = GetRight; /***/ }), -/* 38 */ +/* 43 */ /***/ (function(module, exports) { /** @@ -8238,7 +9583,7 @@ module.exports = GetTop; /***/ }), -/* 39 */ +/* 44 */ /***/ (function(module, exports) { /** @@ -8264,8 +9609,8 @@ module.exports = GetTop; * @param {string} key - The property to be updated. * @param {number} value - The amount to be added to the property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -8305,7 +9650,7 @@ module.exports = PropertyValueInc; /***/ }), -/* 40 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -8315,10 +9660,10 @@ module.exports = PropertyValueInc; */ var Class = __webpack_require__(0); -var GetPoint = __webpack_require__(284); -var GetPoints = __webpack_require__(162); -var GEOM_CONST = __webpack_require__(49); -var Random = __webpack_require__(163); +var GetPoint = __webpack_require__(299); +var GetPoints = __webpack_require__(163); +var GEOM_CONST = __webpack_require__(55); +var Random = __webpack_require__(164); var Vector2 = __webpack_require__(3); /** @@ -8351,7 +9696,7 @@ var Line = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Line#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -8425,8 +9770,8 @@ var Line = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. - * @param {integer} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. + * @param {number} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. + * @param {number} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. * @param {(array|Phaser.Geom.Point[])} [output] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line. * * @return {(array|Phaser.Geom.Point[])} An array of Points, or point-like objects, containing the coordinates of the points on the line. @@ -8642,74 +9987,7 @@ module.exports = Line; /***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(13); - -/** - * Convert the given angle from degrees, to the equivalent angle in radians. - * - * @function Phaser.Math.DegToRad - * @since 3.0.0 - * - * @param {integer} degrees - The angle (in degrees) to convert to radians. - * - * @return {number} The given angle converted to radians. - */ -var DegToRad = function (degrees) -{ - return degrees * CONST.DEG_TO_RAD; -}; - -module.exports = DegToRad; - - -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Cameras.Scene2D.Events - */ - -module.exports = { - - DESTROY: __webpack_require__(671), - FADE_IN_COMPLETE: __webpack_require__(672), - FADE_IN_START: __webpack_require__(673), - FADE_OUT_COMPLETE: __webpack_require__(674), - FADE_OUT_START: __webpack_require__(675), - FLASH_COMPLETE: __webpack_require__(676), - FLASH_START: __webpack_require__(677), - PAN_COMPLETE: __webpack_require__(678), - PAN_START: __webpack_require__(679), - POST_RENDER: __webpack_require__(680), - PRE_RENDER: __webpack_require__(681), - ROTATE_COMPLETE: __webpack_require__(682), - ROTATE_START: __webpack_require__(683), - SHAKE_COMPLETE: __webpack_require__(684), - SHAKE_START: __webpack_require__(685), - ZOOM_COMPLETE: __webpack_require__(686), - ZOOM_START: __webpack_require__(687) - -}; - - -/***/ }), -/* 43 */ +/* 46 */ /***/ (function(module, exports) { /** @@ -8746,7 +10024,657 @@ module.exports = FillStyleCanvas; /***/ }), -/* 44 */ +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * A MultiFile is a special kind of parent that contains two, or more, Files as children and looks after + * the loading and processing of them all. It is commonly extended and used as a base class for file types such as AtlasJSON or BitmapFont. + * + * You shouldn't create an instance of a MultiFile directly, but should extend it with your own class, setting a custom type and processing methods. + * + * @class MultiFile + * @memberof Phaser.Loader + * @constructor + * @since 3.7.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File. + * @param {string} type - The file type string for sorting within the Loader. + * @param {string} key - The key of the file within the loader. + * @param {Phaser.Loader.File[]} files - An array of Files that make-up this MultiFile. + */ +var MultiFile = new Class({ + + initialize: + + function MultiFile (loader, type, key, files) + { + var finalFiles = []; + + // Clean out any potential 'null' or 'undefined' file entries + files.forEach(function (file) + { + if (file) + { + finalFiles.push(file); + } + }); + + /** + * A reference to the Loader that is going to load this file. + * + * @name Phaser.Loader.MultiFile#loader + * @type {Phaser.Loader.LoaderPlugin} + * @since 3.7.0 + */ + this.loader = loader; + + /** + * The file type string for sorting within the Loader. + * + * @name Phaser.Loader.MultiFile#type + * @type {string} + * @since 3.7.0 + */ + this.type = type; + + /** + * Unique cache key (unique within its file type) + * + * @name Phaser.Loader.MultiFile#key + * @type {string} + * @since 3.7.0 + */ + this.key = key; + + /** + * The current index being used by multi-file loaders to avoid key clashes. + * + * @name Phaser.Loader.MultiFile#multiKeyIndex + * @type {number} + * @private + * @since 3.20.0 + */ + this.multiKeyIndex = loader.multiKeyIndex++; + + /** + * Array of files that make up this MultiFile. + * + * @name Phaser.Loader.MultiFile#files + * @type {Phaser.Loader.File[]} + * @since 3.7.0 + */ + this.files = finalFiles; + + /** + * The completion status of this MultiFile. + * + * @name Phaser.Loader.MultiFile#complete + * @type {boolean} + * @default false + * @since 3.7.0 + */ + this.complete = false; + + /** + * The number of files to load. + * + * @name Phaser.Loader.MultiFile#pending + * @type {number} + * @since 3.7.0 + */ + + this.pending = finalFiles.length; + + /** + * The number of files that failed to load. + * + * @name Phaser.Loader.MultiFile#failed + * @type {number} + * @default 0 + * @since 3.7.0 + */ + this.failed = 0; + + /** + * A storage container for transient data that the loading files need. + * + * @name Phaser.Loader.MultiFile#config + * @type {any} + * @since 3.7.0 + */ + this.config = {}; + + /** + * A reference to the Loaders baseURL at the time this MultiFile was created. + * Used to populate child-files. + * + * @name Phaser.Loader.MultiFile#baseURL + * @type {string} + * @since 3.20.0 + */ + this.baseURL = loader.baseURL; + + /** + * A reference to the Loaders path at the time this MultiFile was created. + * Used to populate child-files. + * + * @name Phaser.Loader.MultiFile#path + * @type {string} + * @since 3.20.0 + */ + this.path = loader.path; + + /** + * A reference to the Loaders prefix at the time this MultiFile was created. + * Used to populate child-files. + * + * @name Phaser.Loader.MultiFile#prefix + * @type {string} + * @since 3.20.0 + */ + this.prefix = loader.prefix; + + // Link the files + for (var i = 0; i < finalFiles.length; i++) + { + finalFiles[i].multiFile = this; + } + }, + + /** + * Checks if this MultiFile is ready to process its children or not. + * + * @method Phaser.Loader.MultiFile#isReadyToProcess + * @since 3.7.0 + * + * @return {boolean} `true` if all children of this MultiFile have loaded, otherwise `false`. + */ + isReadyToProcess: function () + { + return (this.pending === 0 && this.failed === 0 && !this.complete); + }, + + /** + * Adds another child to this MultiFile, increases the pending count and resets the completion status. + * + * @method Phaser.Loader.MultiFile#addToMultiFile + * @since 3.7.0 + * + * @param {Phaser.Loader.File} files - The File to add to this MultiFile. + * + * @return {Phaser.Loader.MultiFile} This MultiFile instance. + */ + addToMultiFile: function (file) + { + this.files.push(file); + + file.multiFile = this; + + this.pending++; + + this.complete = false; + + return this; + }, + + /** + * Called by each File when it finishes loading. + * + * @method Phaser.Loader.MultiFile#onFileComplete + * @since 3.7.0 + * + * @param {Phaser.Loader.File} file - The File that has completed processing. + */ + onFileComplete: function (file) + { + var index = this.files.indexOf(file); + + if (index !== -1) + { + this.pending--; + } + }, + + /** + * Called by each File that fails to load. + * + * @method Phaser.Loader.MultiFile#onFileFailed + * @since 3.7.0 + * + * @param {Phaser.Loader.File} file - The File that has failed to load. + */ + onFileFailed: function (file) + { + var index = this.files.indexOf(file); + + if (index !== -1) + { + this.failed++; + } + } + +}); + +module.exports = MultiFile; + + +/***/ }), +/* 48 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Phaser Blend Modes. + * + * @namespace Phaser.BlendModes + * @since 3.0.0 + */ + +module.exports = { + + /** + * Skips the Blend Mode check in the renderer. + * + * @name Phaser.BlendModes.SKIP_CHECK + * @type {number} + * @const + * @since 3.0.0 + */ + SKIP_CHECK: -1, + + /** + * Normal blend mode. For Canvas and WebGL. + * This is the default setting and draws new shapes on top of the existing canvas content. + * + * @name Phaser.BlendModes.NORMAL + * @type {number} + * @const + * @since 3.0.0 + */ + NORMAL: 0, + + /** + * Add blend mode. For Canvas and WebGL. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.ADD + * @type {number} + * @const + * @since 3.0.0 + */ + ADD: 1, + + /** + * Multiply blend mode. For Canvas and WebGL. + * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. + * + * @name Phaser.BlendModes.MULTIPLY + * @type {number} + * @const + * @since 3.0.0 + */ + MULTIPLY: 2, + + /** + * Screen blend mode. For Canvas and WebGL. + * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) + * + * @name Phaser.BlendModes.SCREEN + * @type {number} + * @const + * @since 3.0.0 + */ + SCREEN: 3, + + /** + * Overlay blend mode. For Canvas only. + * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. + * + * @name Phaser.BlendModes.OVERLAY + * @type {number} + * @const + * @since 3.0.0 + */ + OVERLAY: 4, + + /** + * Darken blend mode. For Canvas only. + * Retains the darkest pixels of both layers. + * + * @name Phaser.BlendModes.DARKEN + * @type {number} + * @const + * @since 3.0.0 + */ + DARKEN: 5, + + /** + * Lighten blend mode. For Canvas only. + * Retains the lightest pixels of both layers. + * + * @name Phaser.BlendModes.LIGHTEN + * @type {number} + * @const + * @since 3.0.0 + */ + LIGHTEN: 6, + + /** + * Color Dodge blend mode. For Canvas only. + * Divides the bottom layer by the inverted top layer. + * + * @name Phaser.BlendModes.COLOR_DODGE + * @type {number} + * @const + * @since 3.0.0 + */ + COLOR_DODGE: 7, + + /** + * Color Burn blend mode. For Canvas only. + * Divides the inverted bottom layer by the top layer, and then inverts the result. + * + * @name Phaser.BlendModes.COLOR_BURN + * @type {number} + * @const + * @since 3.0.0 + */ + COLOR_BURN: 8, + + /** + * Hard Light blend mode. For Canvas only. + * A combination of multiply and screen like overlay, but with top and bottom layer swapped. + * + * @name Phaser.BlendModes.HARD_LIGHT + * @type {number} + * @const + * @since 3.0.0 + */ + HARD_LIGHT: 9, + + /** + * Soft Light blend mode. For Canvas only. + * A softer version of hard-light. Pure black or white does not result in pure black or white. + * + * @name Phaser.BlendModes.SOFT_LIGHT + * @type {number} + * @const + * @since 3.0.0 + */ + SOFT_LIGHT: 10, + + /** + * Difference blend mode. For Canvas only. + * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. + * + * @name Phaser.BlendModes.DIFFERENCE + * @type {number} + * @const + * @since 3.0.0 + */ + DIFFERENCE: 11, + + /** + * Exclusion blend mode. For Canvas only. + * Like difference, but with lower contrast. + * + * @name Phaser.BlendModes.EXCLUSION + * @type {number} + * @const + * @since 3.0.0 + */ + EXCLUSION: 12, + + /** + * Hue blend mode. For Canvas only. + * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. + * + * @name Phaser.BlendModes.HUE + * @type {number} + * @const + * @since 3.0.0 + */ + HUE: 13, + + /** + * Saturation blend mode. For Canvas only. + * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. + * + * @name Phaser.BlendModes.SATURATION + * @type {number} + * @const + * @since 3.0.0 + */ + SATURATION: 14, + + /** + * Color blend mode. For Canvas only. + * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. + * + * @name Phaser.BlendModes.COLOR + * @type {number} + * @const + * @since 3.0.0 + */ + COLOR: 15, + + /** + * Luminosity blend mode. For Canvas only. + * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. + * + * @name Phaser.BlendModes.LUMINOSITY + * @type {number} + * @const + * @since 3.0.0 + */ + LUMINOSITY: 16, + + /** + * Alpha erase blend mode. For Canvas and WebGL. + * + * @name Phaser.BlendModes.ERASE + * @type {number} + * @const + * @since 3.0.0 + */ + ERASE: 17, + + /** + * Source-in blend mode. For Canvas only. + * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.SOURCE_IN + * @type {number} + * @const + * @since 3.0.0 + */ + SOURCE_IN: 18, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is drawn where it doesn't overlap the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_OUT + * @type {number} + * @const + * @since 3.0.0 + */ + SOURCE_OUT: 19, + + /** + * Source-out blend mode. For Canvas only. + * The new shape is only drawn where it overlaps the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_ATOP + * @type {number} + * @const + * @since 3.0.0 + */ + SOURCE_ATOP: 20, + + /** + * Destination-over blend mode. For Canvas only. + * New shapes are drawn behind the existing canvas content. + * + * @name Phaser.BlendModes.DESTINATION_OVER + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_OVER: 21, + + /** + * Destination-in blend mode. For Canvas only. + * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.DESTINATION_IN + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_IN: 22, + + /** + * Destination-out blend mode. For Canvas only. + * The existing content is kept where it doesn't overlap the new shape. + * + * @name Phaser.BlendModes.DESTINATION_OUT + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_OUT: 23, + + /** + * Destination-out blend mode. For Canvas only. + * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. + * + * @name Phaser.BlendModes.DESTINATION_ATOP + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_ATOP: 24, + + /** + * Lighten blend mode. For Canvas only. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.LIGHTER + * @type {number} + * @const + * @since 3.0.0 + */ + LIGHTER: 25, + + /** + * Copy blend mode. For Canvas only. + * Only the new shape is shown. + * + * @name Phaser.BlendModes.COPY + * @type {number} + * @const + * @since 3.0.0 + */ + COPY: 26, + + /** + * Xor blend mode. For Canvas only. + * Shapes are made transparent where both overlap and drawn normal everywhere else. + * + * @name Phaser.BlendModes.XOR + * @type {number} + * @const + * @since 3.0.0 + */ + XOR: 27 + +}; + + +/***/ }), +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Input.Events + */ + +module.exports = { + + BOOT: __webpack_require__(908), + DESTROY: __webpack_require__(909), + DRAG_END: __webpack_require__(910), + DRAG_ENTER: __webpack_require__(911), + DRAG: __webpack_require__(912), + DRAG_LEAVE: __webpack_require__(913), + DRAG_OVER: __webpack_require__(914), + DRAG_START: __webpack_require__(915), + DROP: __webpack_require__(916), + GAME_OUT: __webpack_require__(917), + GAME_OVER: __webpack_require__(918), + GAMEOBJECT_DOWN: __webpack_require__(919), + GAMEOBJECT_DRAG_END: __webpack_require__(920), + GAMEOBJECT_DRAG_ENTER: __webpack_require__(921), + GAMEOBJECT_DRAG: __webpack_require__(922), + GAMEOBJECT_DRAG_LEAVE: __webpack_require__(923), + GAMEOBJECT_DRAG_OVER: __webpack_require__(924), + GAMEOBJECT_DRAG_START: __webpack_require__(925), + GAMEOBJECT_DROP: __webpack_require__(926), + GAMEOBJECT_MOVE: __webpack_require__(927), + GAMEOBJECT_OUT: __webpack_require__(928), + GAMEOBJECT_OVER: __webpack_require__(929), + GAMEOBJECT_POINTER_DOWN: __webpack_require__(930), + GAMEOBJECT_POINTER_MOVE: __webpack_require__(931), + GAMEOBJECT_POINTER_OUT: __webpack_require__(932), + GAMEOBJECT_POINTER_OVER: __webpack_require__(933), + GAMEOBJECT_POINTER_UP: __webpack_require__(934), + GAMEOBJECT_POINTER_WHEEL: __webpack_require__(935), + GAMEOBJECT_UP: __webpack_require__(936), + GAMEOBJECT_WHEEL: __webpack_require__(937), + MANAGER_BOOT: __webpack_require__(938), + MANAGER_PROCESS: __webpack_require__(939), + MANAGER_UPDATE: __webpack_require__(940), + POINTER_DOWN: __webpack_require__(941), + POINTER_DOWN_OUTSIDE: __webpack_require__(942), + POINTER_MOVE: __webpack_require__(943), + POINTER_OUT: __webpack_require__(944), + POINTER_OVER: __webpack_require__(945), + POINTER_UP: __webpack_require__(946), + POINTER_UP_OUTSIDE: __webpack_require__(947), + POINTER_WHEEL: __webpack_require__(948), + POINTERLOCK_CHANGE: __webpack_require__(949), + PRE_UPDATE: __webpack_require__(950), + SHUTDOWN: __webpack_require__(951), + START: __webpack_require__(952), + UPDATE: __webpack_require__(953) + +}; + + +/***/ }), +/* 50 */ /***/ (function(module, exports) { /** @@ -9290,7 +11218,7 @@ module.exports = Common; /***/ }), -/* 45 */ +/* 51 */ /***/ (function(module, exports) { /** @@ -9323,7 +11251,7 @@ module.exports = SetTop; /***/ }), -/* 46 */ +/* 52 */ /***/ (function(module, exports) { /** @@ -9356,7 +11284,7 @@ module.exports = SetLeft; /***/ }), -/* 47 */ +/* 53 */ /***/ (function(module, exports) { /** @@ -9389,7 +11317,7 @@ module.exports = SetRight; /***/ }), -/* 48 */ +/* 54 */ /***/ (function(module, exports) { /** @@ -9422,7 +11350,7 @@ module.exports = SetBottom; /***/ }), -/* 49 */ +/* 55 */ /***/ (function(module, exports) { /** @@ -9437,7 +11365,7 @@ var GEOM_CONST = { * A Circle Geometry object type. * * @name Phaser.Geom.CIRCLE - * @type {integer} + * @type {number} * @since 3.19.0 */ CIRCLE: 0, @@ -9446,7 +11374,7 @@ var GEOM_CONST = { * An Ellipse Geometry object type. * * @name Phaser.Geom.ELLIPSE - * @type {integer} + * @type {number} * @since 3.19.0 */ ELLIPSE: 1, @@ -9455,7 +11383,7 @@ var GEOM_CONST = { * A Line Geometry object type. * * @name Phaser.Geom.LINE - * @type {integer} + * @type {number} * @since 3.19.0 */ LINE: 2, @@ -9464,7 +11392,7 @@ var GEOM_CONST = { * A Point Geometry object type. * * @name Phaser.Geom.POINT - * @type {integer} + * @type {number} * @since 3.19.0 */ POINT: 3, @@ -9473,7 +11401,7 @@ var GEOM_CONST = { * A Polygon Geometry object type. * * @name Phaser.Geom.POLYGON - * @type {integer} + * @type {number} * @since 3.19.0 */ POLYGON: 4, @@ -9482,7 +11410,7 @@ var GEOM_CONST = { * A Rectangle Geometry object type. * * @name Phaser.Geom.RECTANGLE - * @type {integer} + * @type {number} * @since 3.19.0 */ RECTANGLE: 5, @@ -9491,7 +11419,7 @@ var GEOM_CONST = { * A Triangle Geometry object type. * * @name Phaser.Geom.TRIANGLE - * @type {integer} + * @type {number} * @since 3.19.0 */ TRIANGLE: 6 @@ -9502,7 +11430,7 @@ module.exports = GEOM_CONST; /***/ }), -/* 50 */ +/* 56 */ /***/ (function(module, exports) { /** @@ -9537,7 +11465,7 @@ module.exports = Contains; /***/ }), -/* 51 */ +/* 57 */ /***/ (function(module, exports) { /** @@ -9575,7 +11503,237 @@ module.exports = LineStyleCanvas; /***/ }), -/* 52 */ +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var CONST = __webpack_require__(19); +var File = __webpack_require__(22); +var FileTypesManager = __webpack_require__(8); +var GetFastValue = __webpack_require__(2); +var GetValue = __webpack_require__(6); +var IsPlainObject = __webpack_require__(7); + +/** + * @classdesc + * A single JSON File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#json method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#json. + * + * @class JSONFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + */ +var JSONFile = new Class({ + + Extends: File, + + initialize: + + // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object + // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing + + function JSONFile (loader, key, url, xhrSettings, dataKey) + { + var extension = 'json'; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + dataKey = GetFastValue(config, 'dataKey', dataKey); + } + + var fileConfig = { + type: 'json', + cache: loader.cacheManager.json, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings, + config: dataKey + }; + + File.call(this, loader, fileConfig); + + if (IsPlainObject(url)) + { + // Object provided instead of a URL, so no need to actually load it (populate data with value) + if (dataKey) + { + this.data = GetValue(url, dataKey); + } + else + { + this.data = url; + } + + this.state = CONST.FILE_POPULATED; + } + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.JSONFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + if (this.state !== CONST.FILE_POPULATED) + { + this.state = CONST.FILE_PROCESSING; + + var json = JSON.parse(this.xhrLoader.responseText); + + var key = this.config; + + if (typeof key === 'string') + { + this.data = GetValue(json, key, json); + } + else + { + this.data = json; + } + } + + this.onProcessComplete(); + } + +}); + +/** + * Adds a JSON file, or array of JSON files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.json('wavedata', 'files/AlienWaveData.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the JSON Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.json({ + * key: 'wavedata', + * url: 'files/AlienWaveData.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.JSONFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.json('wavedata', 'files/AlienWaveData.json'); + * // and later in your game ... + * var data = this.cache.json.get('wavedata'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and + * this is what you would use to retrieve the text from the JSON Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" + * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, + * rather than the whole file. For example, if your JSON data had a structure like this: + * + * ```json + * { + * "level1": { + * "baddies": { + * "aliens": {}, + * "boss": {} + * } + * }, + * "level2": {}, + * "level3": {} + * } + * ``` + * + * And you only wanted to store the `boss` data in the Cache, then you could pass `level1.baddies.boss`as the `dataKey`. + * + * Note: The ability to load this type of file will only be available if the JSON File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#json + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. + * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('json', function (key, url, dataKey, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new JSONFile(this, key[i])); + } + } + else + { + this.addFile(new JSONFile(this, key, url, xhrSettings, dataKey)); + } + + return this; +}); + +module.exports = JSONFile; + + +/***/ }), +/* 59 */ /***/ (function(module, exports) { /** @@ -9704,7 +11862,7 @@ module.exports = CONST; /***/ }), -/* 53 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -9713,8 +11871,8 @@ module.exports = CONST; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTileAt = __webpack_require__(150); -var GetTilesWithin = __webpack_require__(24); +var GetTileAt = __webpack_require__(151); +var GetTilesWithin = __webpack_require__(26); /** * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the @@ -9724,10 +11882,10 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.CalculateFacesWithin * @since 3.0.0 * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var CalculateFacesWithin = function (tileX, tileY, width, height, layer) @@ -9769,346 +11927,7 @@ module.exports = CalculateFacesWithin; /***/ }), -/* 54 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Phaser Blend Modes. - * - * @namespace Phaser.BlendModes - * @since 3.0.0 - */ - -module.exports = { - - /** - * Skips the Blend Mode check in the renderer. - * - * @name Phaser.BlendModes.SKIP_CHECK - * @type {integer} - * @const - * @since 3.0.0 - */ - SKIP_CHECK: -1, - - /** - * Normal blend mode. For Canvas and WebGL. - * This is the default setting and draws new shapes on top of the existing canvas content. - * - * @name Phaser.BlendModes.NORMAL - * @type {integer} - * @const - * @since 3.0.0 - */ - NORMAL: 0, - - /** - * Add blend mode. For Canvas and WebGL. - * Where both shapes overlap the color is determined by adding color values. - * - * @name Phaser.BlendModes.ADD - * @type {integer} - * @const - * @since 3.0.0 - */ - ADD: 1, - - /** - * Multiply blend mode. For Canvas and WebGL. - * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. - * - * @name Phaser.BlendModes.MULTIPLY - * @type {integer} - * @const - * @since 3.0.0 - */ - MULTIPLY: 2, - - /** - * Screen blend mode. For Canvas and WebGL. - * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) - * - * @name Phaser.BlendModes.SCREEN - * @type {integer} - * @const - * @since 3.0.0 - */ - SCREEN: 3, - - /** - * Overlay blend mode. For Canvas only. - * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. - * - * @name Phaser.BlendModes.OVERLAY - * @type {integer} - * @const - * @since 3.0.0 - */ - OVERLAY: 4, - - /** - * Darken blend mode. For Canvas only. - * Retains the darkest pixels of both layers. - * - * @name Phaser.BlendModes.DARKEN - * @type {integer} - * @const - * @since 3.0.0 - */ - DARKEN: 5, - - /** - * Lighten blend mode. For Canvas only. - * Retains the lightest pixels of both layers. - * - * @name Phaser.BlendModes.LIGHTEN - * @type {integer} - * @const - * @since 3.0.0 - */ - LIGHTEN: 6, - - /** - * Color Dodge blend mode. For Canvas only. - * Divides the bottom layer by the inverted top layer. - * - * @name Phaser.BlendModes.COLOR_DODGE - * @type {integer} - * @const - * @since 3.0.0 - */ - COLOR_DODGE: 7, - - /** - * Color Burn blend mode. For Canvas only. - * Divides the inverted bottom layer by the top layer, and then inverts the result. - * - * @name Phaser.BlendModes.COLOR_BURN - * @type {integer} - * @const - * @since 3.0.0 - */ - COLOR_BURN: 8, - - /** - * Hard Light blend mode. For Canvas only. - * A combination of multiply and screen like overlay, but with top and bottom layer swapped. - * - * @name Phaser.BlendModes.HARD_LIGHT - * @type {integer} - * @const - * @since 3.0.0 - */ - HARD_LIGHT: 9, - - /** - * Soft Light blend mode. For Canvas only. - * A softer version of hard-light. Pure black or white does not result in pure black or white. - * - * @name Phaser.BlendModes.SOFT_LIGHT - * @type {integer} - * @const - * @since 3.0.0 - */ - SOFT_LIGHT: 10, - - /** - * Difference blend mode. For Canvas only. - * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. - * - * @name Phaser.BlendModes.DIFFERENCE - * @type {integer} - * @const - * @since 3.0.0 - */ - DIFFERENCE: 11, - - /** - * Exclusion blend mode. For Canvas only. - * Like difference, but with lower contrast. - * - * @name Phaser.BlendModes.EXCLUSION - * @type {integer} - * @const - * @since 3.0.0 - */ - EXCLUSION: 12, - - /** - * Hue blend mode. For Canvas only. - * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. - * - * @name Phaser.BlendModes.HUE - * @type {integer} - * @const - * @since 3.0.0 - */ - HUE: 13, - - /** - * Saturation blend mode. For Canvas only. - * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. - * - * @name Phaser.BlendModes.SATURATION - * @type {integer} - * @const - * @since 3.0.0 - */ - SATURATION: 14, - - /** - * Color blend mode. For Canvas only. - * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. - * - * @name Phaser.BlendModes.COLOR - * @type {integer} - * @const - * @since 3.0.0 - */ - COLOR: 15, - - /** - * Luminosity blend mode. For Canvas only. - * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. - * - * @name Phaser.BlendModes.LUMINOSITY - * @type {integer} - * @const - * @since 3.0.0 - */ - LUMINOSITY: 16, - - /** - * Alpha erase blend mode. For Canvas and WebGL. - * - * @name Phaser.BlendModes.ERASE - * @type {integer} - * @const - * @since 3.0.0 - */ - ERASE: 17, - - /** - * Source-in blend mode. For Canvas only. - * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. - * - * @name Phaser.BlendModes.SOURCE_IN - * @type {integer} - * @const - * @since 3.0.0 - */ - SOURCE_IN: 18, - - /** - * Source-out blend mode. For Canvas only. - * The new shape is drawn where it doesn't overlap the existing canvas content. - * - * @name Phaser.BlendModes.SOURCE_OUT - * @type {integer} - * @const - * @since 3.0.0 - */ - SOURCE_OUT: 19, - - /** - * Source-out blend mode. For Canvas only. - * The new shape is only drawn where it overlaps the existing canvas content. - * - * @name Phaser.BlendModes.SOURCE_ATOP - * @type {integer} - * @const - * @since 3.0.0 - */ - SOURCE_ATOP: 20, - - /** - * Destination-over blend mode. For Canvas only. - * New shapes are drawn behind the existing canvas content. - * - * @name Phaser.BlendModes.DESTINATION_OVER - * @type {integer} - * @const - * @since 3.0.0 - */ - DESTINATION_OVER: 21, - - /** - * Destination-in blend mode. For Canvas only. - * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. - * - * @name Phaser.BlendModes.DESTINATION_IN - * @type {integer} - * @const - * @since 3.0.0 - */ - DESTINATION_IN: 22, - - /** - * Destination-out blend mode. For Canvas only. - * The existing content is kept where it doesn't overlap the new shape. - * - * @name Phaser.BlendModes.DESTINATION_OUT - * @type {integer} - * @const - * @since 3.0.0 - */ - DESTINATION_OUT: 23, - - /** - * Destination-out blend mode. For Canvas only. - * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. - * - * @name Phaser.BlendModes.DESTINATION_ATOP - * @type {integer} - * @const - * @since 3.0.0 - */ - DESTINATION_ATOP: 24, - - /** - * Lighten blend mode. For Canvas only. - * Where both shapes overlap the color is determined by adding color values. - * - * @name Phaser.BlendModes.LIGHTER - * @type {integer} - * @const - * @since 3.0.0 - */ - LIGHTER: 25, - - /** - * Copy blend mode. For Canvas only. - * Only the new shape is shown. - * - * @name Phaser.BlendModes.COPY - * @type {integer} - * @const - * @since 3.0.0 - */ - COPY: 26, - - /** - * Xor blend mode. For Canvas only. - * Shapes are made transparent where both overlap and drawn normal everywhere else. - * - * @name Phaser.BlendModes.XOR - * @type {integer} - * @const - * @since 3.0.0 - */ - XOR: 27 - -}; - - -/***/ }), -/* 55 */ +/* 61 */ /***/ (function(module, exports) { /** @@ -10142,73 +11961,7 @@ module.exports = DistanceBetween; /***/ }), -/* 56 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Input.Events - */ - -module.exports = { - - BOOT: __webpack_require__(852), - DESTROY: __webpack_require__(853), - DRAG_END: __webpack_require__(854), - DRAG_ENTER: __webpack_require__(855), - DRAG: __webpack_require__(856), - DRAG_LEAVE: __webpack_require__(857), - DRAG_OVER: __webpack_require__(858), - DRAG_START: __webpack_require__(859), - DROP: __webpack_require__(860), - GAME_OUT: __webpack_require__(861), - GAME_OVER: __webpack_require__(862), - GAMEOBJECT_DOWN: __webpack_require__(863), - GAMEOBJECT_DRAG_END: __webpack_require__(864), - GAMEOBJECT_DRAG_ENTER: __webpack_require__(865), - GAMEOBJECT_DRAG: __webpack_require__(866), - GAMEOBJECT_DRAG_LEAVE: __webpack_require__(867), - GAMEOBJECT_DRAG_OVER: __webpack_require__(868), - GAMEOBJECT_DRAG_START: __webpack_require__(869), - GAMEOBJECT_DROP: __webpack_require__(870), - GAMEOBJECT_MOVE: __webpack_require__(871), - GAMEOBJECT_OUT: __webpack_require__(872), - GAMEOBJECT_OVER: __webpack_require__(873), - GAMEOBJECT_POINTER_DOWN: __webpack_require__(874), - GAMEOBJECT_POINTER_MOVE: __webpack_require__(875), - GAMEOBJECT_POINTER_OUT: __webpack_require__(876), - GAMEOBJECT_POINTER_OVER: __webpack_require__(877), - GAMEOBJECT_POINTER_UP: __webpack_require__(878), - GAMEOBJECT_POINTER_WHEEL: __webpack_require__(879), - GAMEOBJECT_UP: __webpack_require__(880), - GAMEOBJECT_WHEEL: __webpack_require__(881), - MANAGER_BOOT: __webpack_require__(882), - MANAGER_PROCESS: __webpack_require__(883), - MANAGER_UPDATE: __webpack_require__(884), - POINTER_DOWN: __webpack_require__(885), - POINTER_DOWN_OUTSIDE: __webpack_require__(886), - POINTER_MOVE: __webpack_require__(887), - POINTER_OUT: __webpack_require__(888), - POINTER_OVER: __webpack_require__(889), - POINTER_UP: __webpack_require__(890), - POINTER_UP_OUTSIDE: __webpack_require__(891), - POINTER_WHEEL: __webpack_require__(892), - POINTERLOCK_CHANGE: __webpack_require__(893), - PRE_UPDATE: __webpack_require__(894), - SHUTDOWN: __webpack_require__(895), - START: __webpack_require__(896), - UPDATE: __webpack_require__(897) - -}; - - -/***/ }), -/* 57 */ +/* 62 */ /***/ (function(module, exports) { /** @@ -10249,7 +12002,7 @@ module.exports = Contains; /***/ }), -/* 58 */ +/* 63 */ /***/ (function(module, exports) { /** @@ -10277,7 +12030,7 @@ module.exports = Length; /***/ }), -/* 59 */ +/* 64 */ /***/ (function(module, exports) { /** @@ -10309,7 +12062,7 @@ module.exports = Wrap; /***/ }), -/* 60 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11073,7 +12826,7 @@ module.exports = earcut; /***/ }), -/* 61 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11088,35 +12841,35 @@ module.exports = earcut; module.exports = { - COMPLETE: __webpack_require__(917), - DECODED: __webpack_require__(918), - DECODED_ALL: __webpack_require__(919), - DESTROY: __webpack_require__(920), - DETUNE: __webpack_require__(921), - GLOBAL_DETUNE: __webpack_require__(922), - GLOBAL_MUTE: __webpack_require__(923), - GLOBAL_RATE: __webpack_require__(924), - GLOBAL_VOLUME: __webpack_require__(925), - LOOP: __webpack_require__(926), - LOOPED: __webpack_require__(927), - MUTE: __webpack_require__(928), - PAUSE_ALL: __webpack_require__(929), - PAUSE: __webpack_require__(930), - PLAY: __webpack_require__(931), - RATE: __webpack_require__(932), - RESUME_ALL: __webpack_require__(933), - RESUME: __webpack_require__(934), - SEEK: __webpack_require__(935), - STOP_ALL: __webpack_require__(936), - STOP: __webpack_require__(937), - UNLOCKED: __webpack_require__(938), - VOLUME: __webpack_require__(939) + COMPLETE: __webpack_require__(973), + DECODED: __webpack_require__(974), + DECODED_ALL: __webpack_require__(975), + DESTROY: __webpack_require__(976), + DETUNE: __webpack_require__(977), + GLOBAL_DETUNE: __webpack_require__(978), + GLOBAL_MUTE: __webpack_require__(979), + GLOBAL_RATE: __webpack_require__(980), + GLOBAL_VOLUME: __webpack_require__(981), + LOOP: __webpack_require__(982), + LOOPED: __webpack_require__(983), + MUTE: __webpack_require__(984), + PAUSE_ALL: __webpack_require__(985), + PAUSE: __webpack_require__(986), + PLAY: __webpack_require__(987), + RATE: __webpack_require__(988), + RESUME_ALL: __webpack_require__(989), + RESUME: __webpack_require__(990), + SEEK: __webpack_require__(991), + STOP_ALL: __webpack_require__(992), + STOP: __webpack_require__(993), + UNLOCKED: __webpack_require__(994), + VOLUME: __webpack_require__(995) }; /***/ }), -/* 62 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11126,45 +12879,42 @@ module.exports = { */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(6); var IsPlainObject = __webpack_require__(7); /** * @classdesc - * A single JSON File suitable for loading by the Loader. + * A single Image File suitable for loading by the Loader. * - * These are created when you use the Phaser.Loader.LoaderPlugin#json method and are not typically created directly. + * These are created when you use the Phaser.Loader.LoaderPlugin#image method and are not typically created directly. * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#json. + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#image. * - * @class JSONFile + * @class ImageFile * @extends Phaser.Loader.File * @memberof Phaser.Loader.FileTypes * @constructor * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. + * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets. */ -var JSONFile = new Class({ +var ImageFile = new Class({ Extends: File, initialize: - // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object - // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing - - function JSONFile (loader, key, url, xhrSettings, dataKey) + function ImageFile (loader, key, url, xhrSettings, frameConfig) { - var extension = 'json'; + var extension = 'png'; + var normalMapURL; if (IsPlainObject(key)) { @@ -11172,37 +12922,41 @@ var JSONFile = new Class({ key = GetFastValue(config, 'key'); url = GetFastValue(config, 'url'); + normalMapURL = GetFastValue(config, 'normalMap'); xhrSettings = GetFastValue(config, 'xhrSettings'); extension = GetFastValue(config, 'extension', extension); - dataKey = GetFastValue(config, 'dataKey', dataKey); + frameConfig = GetFastValue(config, 'frameConfig'); + } + + if (Array.isArray(url)) + { + normalMapURL = url[1]; + url = url[0]; } var fileConfig = { - type: 'json', - cache: loader.cacheManager.json, + type: 'image', + cache: loader.textureManager, extension: extension, - responseType: 'text', + responseType: 'blob', key: key, url: url, xhrSettings: xhrSettings, - config: dataKey + config: frameConfig }; File.call(this, loader, fileConfig); - if (IsPlainObject(url)) + // Do we have a normal map to load as well? + if (normalMapURL) { - // Object provided instead of a URL, so no need to actually load it (populate data with value) - if (dataKey) - { - this.data = GetValue(url, dataKey); - } - else - { - this.data = url; - } + var normalMap = new ImageFile(loader, this.key, normalMapURL, xhrSettings, frameConfig); - this.state = CONST.FILE_POPULATED; + normalMap.type = 'normalMap'; + + this.setLink(normalMap); + + loader.addFile(normalMap); } }, @@ -11210,43 +12964,81 @@ var JSONFile = new Class({ * Called automatically by Loader.nextFile. * This method controls what extra work this File does with its loaded data. * - * @method Phaser.Loader.FileTypes.JSONFile#onProcess + * @method Phaser.Loader.FileTypes.ImageFile#onProcess * @since 3.7.0 */ onProcess: function () { - if (this.state !== CONST.FILE_POPULATED) + this.state = CONST.FILE_PROCESSING; + + this.data = new Image(); + + this.data.crossOrigin = this.crossOrigin; + + var _this = this; + + this.data.onload = function () { - this.state = CONST.FILE_PROCESSING; + File.revokeObjectURL(_this.data); - var json = JSON.parse(this.xhrLoader.responseText); + _this.onProcessComplete(); + }; - var key = this.config; + this.data.onerror = function () + { + File.revokeObjectURL(_this.data); - if (typeof key === 'string') + _this.onProcessError(); + }; + + File.createObjectURL(this.data, this.xhrLoader.response, 'image/png'); + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.ImageFile#addToCache + * @since 3.7.0 + */ + addToCache: function () + { + var texture; + var linkFile = this.linkFile; + + if (linkFile && linkFile.state === CONST.FILE_COMPLETE) + { + if (this.type === 'image') { - this.data = GetValue(json, key, json); + texture = this.cache.addImage(this.key, this.data, linkFile.data); } else { - this.data = json; + texture = this.cache.addImage(linkFile.key, linkFile.data, this.data); } - } - this.onProcessComplete(); + this.pendingDestroy(texture); + + linkFile.pendingDestroy(texture); + } + else if (!linkFile) + { + texture = this.cache.addImage(this.key, this.data); + + this.pendingDestroy(texture); + } } }); /** - * Adds a JSON file, or array of JSON files, to the current load queue. + * Adds an Image, or array of Images, to the current load queue. * * You can call this method from within your Scene's `preload`, along with any other files you wish to load: * * ```javascript * function preload () * { - * this.load.json('wavedata', 'files/AlienWaveData.json'); + * this.load.image('logo', 'images/phaserLogo.png'); * } * ``` * @@ -11258,329 +13050,100 @@ var JSONFile = new Class({ * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been * loaded. * - * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback + * of animated gifs to Canvas elements. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the JSON Cache first, before loading a new one. + * then remove it from the Texture Manager first, before loading a new one. * * Instead of passing arguments you can pass a configuration object, such as: * * ```javascript - * this.load.json({ - * key: 'wavedata', - * url: 'files/AlienWaveData.json' + * this.load.image({ + * key: 'logo', + * url: 'images/AtariLogo.png' * }); * ``` * - * See the documentation for `Phaser.Types.Loader.FileTypes.JSONFileConfig` for more details. + * See the documentation for `Phaser.Types.Loader.FileTypes.ImageFileConfig` for more details. * - * Once the file has finished loading you can access it from its Cache using its key: + * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: * * ```javascript - * this.load.json('wavedata', 'files/AlienWaveData.json'); + * this.load.image('logo', 'images/AtariLogo.png'); * // and later in your game ... - * var data = this.cache.json.get('wavedata'); + * this.add.image(x, y, 'logo'); * ``` * * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and - * this is what you would use to retrieve the text from the JSON Cache. + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. * * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" - * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. * - * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, - * rather than the whole file. For example, if your JSON data had a structure like this: + * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, + * then you can specify it by providing an array as the `url` where the second element is the normal map: * - * ```json - * { - * "level1": { - * "baddies": { - * "aliens": {}, - * "boss": {} - * } - * }, - * "level2": {}, - * "level3": {} - * } + * ```javascript + * this.load.image('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ]); * ``` * - * And you only wanted to store the `boss` data in the Cache, then you could pass `level1.baddies.boss`as the `dataKey`. + * Or, if you are using a config object use the `normalMap` property: * - * Note: The ability to load this type of file will only be available if the JSON File type has been built into Phaser. + * ```javascript + * this.load.image({ + * key: 'logo', + * url: 'images/AtariLogo.png', + * normalMap: 'images/AtariLogo-n.png' + * }); + * ``` + * + * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. + * Normal maps are a WebGL only feature. + * + * Note: The ability to load this type of file will only be available if the Image File type has been built into Phaser. * It is available in the default build but can be excluded from custom builds. * - * @method Phaser.Loader.LoaderPlugin#json + * @method Phaser.Loader.LoaderPlugin#image * @fires Phaser.Loader.LoaderPlugin#ADD * @since 3.0.0 * - * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. - * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {this} The Loader instance. */ -FileTypesManager.register('json', function (key, url, dataKey, xhrSettings) +FileTypesManager.register('image', function (key, url, xhrSettings) { if (Array.isArray(key)) { for (var i = 0; i < key.length; i++) { // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new JSONFile(this, key[i])); + this.addFile(new ImageFile(this, key[i])); } } else { - this.addFile(new JSONFile(this, key, url, xhrSettings, dataKey)); + this.addFile(new ImageFile(this, key, url, xhrSettings)); } return this; }); -module.exports = JSONFile; +module.exports = ImageFile; /***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); - -/** - * @classdesc - * A MultiFile is a special kind of parent that contains two, or more, Files as children and looks after - * the loading and processing of them all. It is commonly extended and used as a base class for file types such as AtlasJSON or BitmapFont. - * - * You shouldn't create an instance of a MultiFile directly, but should extend it with your own class, setting a custom type and processing methods. - * - * @class MultiFile - * @memberof Phaser.Loader - * @constructor - * @since 3.7.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File. - * @param {string} type - The file type string for sorting within the Loader. - * @param {string} key - The key of the file within the loader. - * @param {Phaser.Loader.File[]} files - An array of Files that make-up this MultiFile. - */ -var MultiFile = new Class({ - - initialize: - - function MultiFile (loader, type, key, files) - { - /** - * A reference to the Loader that is going to load this file. - * - * @name Phaser.Loader.MultiFile#loader - * @type {Phaser.Loader.LoaderPlugin} - * @since 3.7.0 - */ - this.loader = loader; - - /** - * The file type string for sorting within the Loader. - * - * @name Phaser.Loader.MultiFile#type - * @type {string} - * @since 3.7.0 - */ - this.type = type; - - /** - * Unique cache key (unique within its file type) - * - * @name Phaser.Loader.MultiFile#key - * @type {string} - * @since 3.7.0 - */ - this.key = key; - - /** - * The current index being used by multi-file loaders to avoid key clashes. - * - * @name Phaser.Loader.MultiFile#multiKeyIndex - * @type {integer} - * @private - * @since 3.20.0 - */ - this.multiKeyIndex = loader.multiKeyIndex++; - - /** - * Array of files that make up this MultiFile. - * - * @name Phaser.Loader.MultiFile#files - * @type {Phaser.Loader.File[]} - * @since 3.7.0 - */ - this.files = files; - - /** - * The completion status of this MultiFile. - * - * @name Phaser.Loader.MultiFile#complete - * @type {boolean} - * @default false - * @since 3.7.0 - */ - this.complete = false; - - /** - * The number of files to load. - * - * @name Phaser.Loader.MultiFile#pending - * @type {integer} - * @since 3.7.0 - */ - - this.pending = files.length; - - /** - * The number of files that failed to load. - * - * @name Phaser.Loader.MultiFile#failed - * @type {integer} - * @default 0 - * @since 3.7.0 - */ - this.failed = 0; - - /** - * A storage container for transient data that the loading files need. - * - * @name Phaser.Loader.MultiFile#config - * @type {any} - * @since 3.7.0 - */ - this.config = {}; - - /** - * A reference to the Loaders baseURL at the time this MultiFile was created. - * Used to populate child-files. - * - * @name Phaser.Loader.MultiFile#baseURL - * @type {string} - * @since 3.20.0 - */ - this.baseURL = loader.baseURL; - - /** - * A reference to the Loaders path at the time this MultiFile was created. - * Used to populate child-files. - * - * @name Phaser.Loader.MultiFile#path - * @type {string} - * @since 3.20.0 - */ - this.path = loader.path; - - /** - * A reference to the Loaders prefix at the time this MultiFile was created. - * Used to populate child-files. - * - * @name Phaser.Loader.MultiFile#prefix - * @type {string} - * @since 3.20.0 - */ - this.prefix = loader.prefix; - - // Link the files - for (var i = 0; i < files.length; i++) - { - files[i].multiFile = this; - } - }, - - /** - * Checks if this MultiFile is ready to process its children or not. - * - * @method Phaser.Loader.MultiFile#isReadyToProcess - * @since 3.7.0 - * - * @return {boolean} `true` if all children of this MultiFile have loaded, otherwise `false`. - */ - isReadyToProcess: function () - { - return (this.pending === 0 && this.failed === 0 && !this.complete); - }, - - /** - * Adds another child to this MultiFile, increases the pending count and resets the completion status. - * - * @method Phaser.Loader.MultiFile#addToMultiFile - * @since 3.7.0 - * - * @param {Phaser.Loader.File} files - The File to add to this MultiFile. - * - * @return {Phaser.Loader.MultiFile} This MultiFile instance. - */ - addToMultiFile: function (file) - { - this.files.push(file); - - file.multiFile = this; - - this.pending++; - - this.complete = false; - - return this; - }, - - /** - * Called by each File when it finishes loading. - * - * @method Phaser.Loader.MultiFile#onFileComplete - * @since 3.7.0 - * - * @param {Phaser.Loader.File} file - The File that has completed processing. - */ - onFileComplete: function (file) - { - var index = this.files.indexOf(file); - - if (index !== -1) - { - this.pending--; - } - }, - - /** - * Called by each File that fails to load. - * - * @method Phaser.Loader.MultiFile#onFileFailed - * @since 3.7.0 - * - * @param {Phaser.Loader.File} file - The File that has failed to load. - */ - onFileFailed: function (file) - { - var index = this.files.indexOf(file); - - if (index !== -1) - { - this.failed++; - } - } - -}); - -module.exports = MultiFile; - - -/***/ }), -/* 64 */ +/* 68 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -11596,12 +13159,12 @@ var Body = {}; module.exports = Body; -var Vertices = __webpack_require__(88); -var Vector = __webpack_require__(102); -var Sleeping = __webpack_require__(250); -var Common = __webpack_require__(44); -var Bounds = __webpack_require__(103); -var Axes = __webpack_require__(542); +var Vertices = __webpack_require__(93); +var Vector = __webpack_require__(114); +var Sleeping = __webpack_require__(265); +var Common = __webpack_require__(50); +var Bounds = __webpack_require__(115); +var Axes = __webpack_require__(581); (function() { @@ -12962,7 +14525,7 @@ var Axes = __webpack_require__(542); /***/ }), -/* 65 */ +/* 69 */ /***/ (function(module, exports) { /** @@ -12997,8 +14560,8 @@ module.exports = SetTileCollision; /***/ }), -/* 66 */ -/***/ (function(module, exports) { +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -13006,98 +14569,481 @@ module.exports = SetTileCollision; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var AnimationState = __webpack_require__(157); +var Class = __webpack_require__(0); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(14); +var GameObjectEvents = __webpack_require__(32); +var SpriteRender = __webpack_require__(1048); + /** - * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the - * layer's position, scale and scroll. + * @classdesc + * A Sprite Game Object. * - * @function Phaser.Tilemaps.Components.WorldToTileX + * A Sprite Game Object is used for the display of both static and animated images in your game. + * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled + * and animated. + * + * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. + * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation + * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. + * + * @class Sprite + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor * @since 3.0.0 * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.TextureCrop + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible * - * @return {number} The X location in tile units. + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ -var WorldToTileX = function (worldX, snapToFloor, camera, layer) -{ - if (snapToFloor === undefined) { snapToFloor = true; } +var Sprite = new Class({ - var tileWidth = layer.baseTileWidth; - var tilemapLayer = layer.tilemapLayer; + Extends: GameObject, - if (tilemapLayer) + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.ScrollFactor, + Components.Size, + Components.TextureCrop, + Components.Tint, + Components.Transform, + Components.Visible, + SpriteRender + ], + + initialize: + + function Sprite (scene, x, y, texture, frame) { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } + GameObject.call(this, scene, 'Sprite'); - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's horizontal scroll - worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + /** + * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. + * + * @name Phaser.GameObjects.Sprite#_crop + * @type {object} + * @private + * @since 3.11.0 + */ + this._crop = this.resetCropObject(); - tileWidth *= tilemapLayer.scaleX; + /** + * The Animation State component of this Sprite. + * + * This component provides features to apply animations to this Sprite. + * It is responsible for playing, loading, queuing animations for later playback, + * mixing between animations and setting the current animation frame to this Sprite. + * + * @name Phaser.GameObjects.Sprite#anims + * @type {Phaser.Animations.AnimationState} + * @since 3.0.0 + */ + this.anims = new AnimationState(this); + + this.setTexture(texture, frame); + this.setPosition(x, y); + this.setSizeToFrame(); + this.setOriginFromFrame(); + this.initPipeline(); + + this.on(GameObjectEvents.ADDED_TO_SCENE, this.addedToScene, this); + this.on(GameObjectEvents.REMOVED_FROM_SCENE, this.removedFromScene, this); + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); + }, + + /** + * Update this Sprite's animations. + * + * @method Phaser.GameObjects.Sprite#preUpdate + * @protected + * @since 3.0.0 + * + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. + */ + preUpdate: function (time, delta) + { + this.anims.update(time, delta); + }, + + /** + * Start playing the given animation on this Sprite. + * + * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. + * + * The benefit of a global animation is that multiple Sprites can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any Sprite. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Sprite. + * + * With the animation created, either globally or locally, you can now play it on this Sprite: + * + * ```javascript + * this.add.sprite(x, y).play('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config + * object instead: + * + * ```javascript + * this.add.sprite(x, y).play({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Sprite to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.GameObjects.Sprite#play + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.0.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * + * @return {this} This Game Object. + */ + play: function (key, ignoreIfPlaying) + { + return this.anims.play(key, ignoreIfPlaying); + }, + + /** + * Start playing the given animation on this Sprite, in reverse. + * + * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. + * + * The benefit of a global animation is that multiple Sprites can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any Sprite. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Sprite. + * + * With the animation created, either globally or locally, you can now play it on this Sprite: + * + * ```javascript + * this.add.sprite(x, y).playReverse('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config + * object instead: + * + * ```javascript + * this.add.sprite(x, y).playReverse({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Sprite to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.GameObjects.Sprite#playReverse + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * + * @return {this} This Game Object. + */ + playReverse: function (key, ignoreIfPlaying) + { + return this.anims.playReverse(key, ignoreIfPlaying); + }, + + /** + * Waits for the specified delay, in milliseconds, then starts playback of the given animation. + * + * If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here. + * + * If an animation is already running and a new animation is given to this method, it will wait for + * the given delay before starting the new animation. + * + * If no animation is currently running, the given one begins after the delay. + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * Prior to Phaser 3.50 this method was called 'delayedPlay'. + * + * @method Phaser.GameObjects.Sprite#playAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} delay - The delay, in milliseconds, to wait before starting the animation playing. + * + * @return {this} This Game Object. + */ + playAfterDelay: function (key, delay) + { + return this.anims.playAfterDelay(key, delay); + }, + + /** + * Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback + * of the given animation. + * + * You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an + * idle animation to a walking animation, by making them blend smoothly into each other. + * + * If no animation is currently running, the given one will start immediately. + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * @method Phaser.GameObjects.Sprite#playAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} [repeatCount=1] - How many times should the animation repeat before the next one starts? + * + * @return {this} This Game Object. + */ + playAfterRepeat: function (key, repeatCount) + { + return this.anims.playAfterRepeat(key, repeatCount); + }, + + /** + * Sets an animation, or an array of animations, to be played immediately after the current one completes or stops. + * + * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, + * or have the `stop` method called directly on it. + * + * An animation set to repeat forever will never enter a completed state. + * + * You can chain a new animation at any point, including before the current one starts playing, during it, + * or when it ends (via its `animationcomplete` event). + * + * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained + * animations without impacting the animation they're playing. + * + * Call this method with no arguments to reset all currently chained animations. + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * @method Phaser.GameObjects.Sprite#chain + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig|string[]|Phaser.Animations.Animation[]|Phaser.Types.Animations.PlayAnimationConfig[])} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object, or an array of them. + * + * @return {this} This Game Object. + */ + chain: function (key) + { + return this.anims.chain(key); + }, + + /** + * Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` events. + * + * If no animation is playing, no event will be dispatched. + * + * If there is another animation queued (via the `chain` method) then it will start playing immediately. + * + * @method Phaser.GameObjects.Sprite#stop + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 + * + * @return {this} This Game Object. + */ + stop: function () + { + return this.anims.stop(); + }, + + /** + * Stops the current animation from playing after the specified time delay, given in milliseconds. + * + * It then dispatches the `ANIMATION_STOP` event. + * + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Sprite#stopAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 + * + * @param {number} delay - The number of milliseconds to wait before stopping this animation. + * + * @return {this} This Game Object. + */ + stopAfterDelay: function (delay) + { + return this.anims.stopAfterDelay(delay); + }, + + /** + * Stops the current animation from playing after the given number of repeats. + * + * It then dispatches the `ANIMATION_STOP` event. + * + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Sprite#stopAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 + * + * @param {number} [repeatCount=1] - How many times should the animation repeat before stopping? + * + * @return {this} This Game Object. + */ + stopAfterRepeat: function (repeatCount) + { + return this.anims.stopAfterRepeat(repeatCount); + }, + + /** + * Stops the current animation from playing when it next sets the given frame. + * If this frame doesn't exist within the animation it will not stop it from playing. + * + * It then dispatches the `ANIMATION_STOP` event. + * + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Sprite#stopOnFrame + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 + * + * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. + * + * @return {this} This Game Object. + */ + stopOnFrame: function (frame) + { + return this.anims.stopOnFrame(frame); + }, + + /** + * Build a JSON representation of this Sprite. + * + * @method Phaser.GameObjects.Sprite#toJSON + * @since 3.0.0 + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. + */ + toJSON: function () + { + return Components.ToJSON(this); + }, + + /** + * Handles the pre-destroy step for the Sprite, which removes the Animation component. + * + * @method Phaser.GameObjects.Sprite#preDestroy + * @private + * @since 3.14.0 + */ + preDestroy: function () + { + this.anims.destroy(); + + this.anims = undefined; } - return snapToFloor - ? Math.floor(worldX / tileWidth) - : worldX / tileWidth; -}; +}); -module.exports = WorldToTileX; +module.exports = Sprite; /***/ }), -/* 67 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the - * layer's position, scale and scroll. - * - * @function Phaser.Tilemaps.Components.WorldToTileY - * @since 3.0.0 - * - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} The Y location in tile units. - */ -var WorldToTileY = function (worldY, snapToFloor, camera, layer) -{ - if (snapToFloor === undefined) { snapToFloor = true; } - - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - - if (tilemapLayer) - { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's vertical scroll - worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - - tileHeight *= tilemapLayer.scaleY; - } - - return snapToFloor - ? Math.floor(worldY / tileHeight) - : worldY / tileHeight; -}; - -module.exports = WorldToTileY; - - -/***/ }), -/* 68 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -13107,11 +15053,11 @@ module.exports = WorldToTileY; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(57); -var GetPoint = __webpack_require__(277); -var GetPoints = __webpack_require__(278); -var GEOM_CONST = __webpack_require__(49); -var Random = __webpack_require__(160); +var Contains = __webpack_require__(62); +var GetPoint = __webpack_require__(292); +var GetPoints = __webpack_require__(293); +var GEOM_CONST = __webpack_require__(55); +var Random = __webpack_require__(161); /** * @classdesc @@ -13145,7 +15091,7 @@ var Circle = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Circle#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -13237,7 +15183,7 @@ var Circle = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -13472,7 +15418,3876 @@ module.exports = Circle; /***/ }), -/* 69 */ +/* 72 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using floor. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. + * As will `14` snap to `10`... but `16` will snap to `15`. + * + * @function Phaser.Math.Snap.Floor + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapFloor = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.floor(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapFloor; + + +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Vector3 = __webpack_require__(37); + +/** + * @ignore + */ +var EPSILON = 0.000001; + +/** + * @classdesc + * A four-dimensional matrix. + * + * Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji + * and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + * + * @class Matrix4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. + */ +var Matrix4 = new Class({ + + initialize: + + function Matrix4 (m) + { + /** + * The matrix values. + * + * @name Phaser.Math.Matrix4#val + * @type {Float32Array} + * @since 3.0.0 + */ + this.val = new Float32Array(16); + + if (m) + { + // Assume Matrix4 with val: + this.copy(m); + } + else + { + // Default to identity + this.identity(); + } + }, + + /** + * Make a clone of this Matrix4. + * + * @method Phaser.Math.Matrix4#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} A clone of this Matrix4. + */ + clone: function () + { + return new Matrix4(this); + }, + + /** + * This method is an alias for `Matrix4.copy`. + * + * @method Phaser.Math.Matrix4#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. + * + * @return {this} This Matrix4. + */ + set: function (src) + { + return this.copy(src); + }, + + /** + * Sets all values of this Matrix4. + * + * @method Phaser.Math.Matrix4#setValues + * @since 3.50.0 + * + * @param {number} m00 - The m00 value. + * @param {number} m01 - The m01 value. + * @param {number} m02 - The m02 value. + * @param {number} m03 - The m03 value. + * @param {number} m10 - The m10 value. + * @param {number} m11 - The m11 value. + * @param {number} m12 - The m12 value. + * @param {number} m13 - The m13 value. + * @param {number} m20 - The m20 value. + * @param {number} m21 - The m21 value. + * @param {number} m22 - The m22 value. + * @param {number} m23 - The m23 value. + * @param {number} m30 - The m30 value. + * @param {number} m31 - The m31 value. + * @param {number} m32 - The m32 value. + * @param {number} m33 - The m33 value. + * + * @return {this} This Matrix4 instance. + */ + setValues: function (m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) + { + var out = this.val; + + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m03; + out[4] = m10; + out[5] = m11; + out[6] = m12; + out[7] = m13; + out[8] = m20; + out[9] = m21; + out[10] = m22; + out[11] = m23; + out[12] = m30; + out[13] = m31; + out[14] = m32; + out[15] = m33; + + return this; + }, + + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix4#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. + * + * @return {this} This Matrix4. + */ + copy: function (src) + { + var a = src.val; + + return this.setValues(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); + }, + + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix4#fromArray + * @since 3.0.0 + * + * @param {number[]} a - The array to copy the values from. Must have at least 16 elements. + * + * @return {this} This Matrix4. + */ + fromArray: function (a) + { + return this.setValues(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); + }, + + /** + * Reset this Matrix. + * + * Sets all values to `0`. + * + * @method Phaser.Math.Matrix4#zero + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + zero: function () + { + return this.setValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + }, + + /** + * Generates a transform matrix based on the given position, scale and rotation. + * + * @method Phaser.Math.Matrix4#transform + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} position - The position vector. + * @param {Phaser.Math.Vector3} scale - The scale vector. + * @param {Phaser.Math.Quaternion} rotation - The rotation quaternion. + * + * @return {this} This Matrix4. + */ + transform: function (position, scale, rotation) + { + var rotMatrix = _tempMat1.fromQuat(rotation); + + var rm = rotMatrix.val; + + var sx = scale.x; + var sy = scale.y; + var sz = scale.z; + + return this.setValues( + rm[0] * sx, + rm[1] * sx, + rm[2] * sx, + 0, + + rm[4] * sy, + rm[5] * sy, + rm[6] * sy, + 0, + + rm[8] * sz, + rm[9] * sz, + rm[10] * sz, + 0, + + position.x, + position.y, + position.z, + 1 + ); + }, + + /** + * Set the `x`, `y` and `z` values of this Matrix. + * + * @method Phaser.Math.Matrix4#xyz + * @since 3.0.0 + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {number} z - The z value. + * + * @return {this} This Matrix4. + */ + xyz: function (x, y, z) + { + this.identity(); + + var out = this.val; + + out[12] = x; + out[13] = y; + out[14] = z; + + return this; + }, + + /** + * Set the scaling values of this Matrix. + * + * @method Phaser.Math.Matrix4#scaling + * @since 3.0.0 + * + * @param {number} x - The x scaling value. + * @param {number} y - The y scaling value. + * @param {number} z - The z scaling value. + * + * @return {this} This Matrix4. + */ + scaling: function (x, y, z) + { + this.zero(); + + var out = this.val; + + out[0] = x; + out[5] = y; + out[10] = z; + out[15] = 1; + + return this; + }, + + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix4#identity + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + identity: function () + { + return this.setValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + }, + + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix4#transpose + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + transpose: function () + { + var a = this.val; + + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a12 = a[6]; + var a13 = a[7]; + var a23 = a[11]; + + a[1] = a[4]; + a[2] = a[8]; + a[3] = a[12]; + a[4] = a01; + a[6] = a[9]; + a[7] = a[13]; + a[8] = a02; + a[9] = a12; + a[11] = a[14]; + a[12] = a03; + a[13] = a13; + a[14] = a23; + + return this; + }, + + /** + * Copies the given Matrix4 into this Matrix and then inverses it. + * + * @method Phaser.Math.Matrix4#getInverse + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to invert into this Matrix4. + * + * @return {this} This Matrix4. + */ + getInverse: function (m) + { + this.copy(m); + + return this.invert(); + }, + + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix4#invert + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + invert: function () + { + var a = this.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) + { + return this; + } + + det = 1 / det; + + return this.setValues( + (a11 * b11 - a12 * b10 + a13 * b09) * det, + (a02 * b10 - a01 * b11 - a03 * b09) * det, + (a31 * b05 - a32 * b04 + a33 * b03) * det, + (a22 * b04 - a21 * b05 - a23 * b03) * det, + (a12 * b08 - a10 * b11 - a13 * b07) * det, + (a00 * b11 - a02 * b08 + a03 * b07) * det, + (a32 * b02 - a30 * b05 - a33 * b01) * det, + (a20 * b05 - a22 * b02 + a23 * b01) * det, + (a10 * b10 - a11 * b08 + a13 * b06) * det, + (a01 * b08 - a00 * b10 - a03 * b06) * det, + (a30 * b04 - a31 * b02 + a33 * b00) * det, + (a21 * b02 - a20 * b04 - a23 * b00) * det, + (a11 * b07 - a10 * b09 - a12 * b06) * det, + (a00 * b09 - a01 * b07 + a02 * b06) * det, + (a31 * b01 - a30 * b03 - a32 * b00) * det, + (a20 * b03 - a21 * b01 + a22 * b00) * det + ); + }, + + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix4#adjoint + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + adjoint: function () + { + var a = this.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + return this.setValues( + (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)), + -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)), + (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)), + -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)), + -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)), + (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)), + -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)), + (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)), + (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)), + -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)), + (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)), + -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)), + -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)), + (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)), + -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)), + (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)) + ); + }, + + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix4#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: function () + { + var a = this.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + }, + + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix4#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. + * + * @return {this} This Matrix4. + */ + multiply: function (src) + { + var a = this.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b = src.val; + + // Cache only the current line of the second matrix + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + + a[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + + a[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + + a[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + + a[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + return this; + }, + + /** + * Multiply the values of this Matrix4 by those given in the `src` argument. + * + * @method Phaser.Math.Matrix4#multiplyLocal + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The source Matrix4 that this Matrix4 is multiplied by. + * + * @return {this} This Matrix4. + */ + multiplyLocal: function (src) + { + var a = this.val; + var b = src.val; + + return this.setValues( + a[0] * b[0] + a[1] * b[4] + a[2] * b[8] + a[3] * b[12], + a[0] * b[1] + a[1] * b[5] + a[2] * b[9] + a[3] * b[13], + a[0] * b[2] + a[1] * b[6] + a[2] * b[10] + a[3] * b[14], + a[0] * b[3] + a[1] * b[7] + a[2] * b[11] + a[3] * b[15], + + a[4] * b[0] + a[5] * b[4] + a[6] * b[8] + a[7] * b[12], + a[4] * b[1] + a[5] * b[5] + a[6] * b[9] + a[7] * b[13], + a[4] * b[2] + a[5] * b[6] + a[6] * b[10] + a[7] * b[14], + a[4] * b[3] + a[5] * b[7] + a[6] * b[11] + a[7] * b[15], + + a[8] * b[0] + a[9] * b[4] + a[10] * b[8] + a[11] * b[12], + a[8] * b[1] + a[9] * b[5] + a[10] * b[9] + a[11] * b[13], + a[8] * b[2] + a[9] * b[6] + a[10] * b[10] + a[11] * b[14], + a[8] * b[3] + a[9] * b[7] + a[10] * b[11] + a[11] * b[15], + + a[12] * b[0] + a[13] * b[4] + a[14] * b[8] + a[15] * b[12], + a[12] * b[1] + a[13] * b[5] + a[14] * b[9] + a[15] * b[13], + a[12] * b[2] + a[13] * b[6] + a[14] * b[10] + a[15] * b[14], + a[12] * b[3] + a[13] * b[7] + a[14] * b[11] + a[15] * b[15] + ); + }, + + /** + * Multiplies the given Matrix4 object with this Matrix. + * + * This is the same as calling `multiplyMatrices(m, this)`. + * + * @method Phaser.Math.Matrix4#premultiply + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to multiply with this one. + * + * @return {this} This Matrix4. + */ + premultiply: function (m) + { + return this.multiplyMatrices(m, this); + }, + + /** + * Multiplies the two given Matrix4 objects and stores the results in this Matrix. + * + * @method Phaser.Math.Matrix4#multiplyMatrices + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} a - The first Matrix4 to multiply. + * @param {Phaser.Math.Matrix4} b - The second Matrix4 to multiply. + * + * @return {this} This Matrix4. + */ + multiplyMatrices: function (a, b) + { + var am = a.val; + var bm = b.val; + + var a11 = am[0]; + var a12 = am[4]; + var a13 = am[8]; + var a14 = am[12]; + var a21 = am[1]; + var a22 = am[5]; + var a23 = am[9]; + var a24 = am[13]; + var a31 = am[2]; + var a32 = am[6]; + var a33 = am[10]; + var a34 = am[14]; + var a41 = am[3]; + var a42 = am[7]; + var a43 = am[11]; + var a44 = am[15]; + + var b11 = bm[0]; + var b12 = bm[4]; + var b13 = bm[8]; + var b14 = bm[12]; + var b21 = bm[1]; + var b22 = bm[5]; + var b23 = bm[9]; + var b24 = bm[13]; + var b31 = bm[2]; + var b32 = bm[6]; + var b33 = bm[10]; + var b34 = bm[14]; + var b41 = bm[3]; + var b42 = bm[7]; + var b43 = bm[11]; + var b44 = bm[15]; + + return this.setValues( + a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41, + a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41, + a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41, + a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41, + a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42, + a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42, + a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42, + a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42, + a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43, + a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43, + a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43, + a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43, + a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44, + a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44, + a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44, + a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44 + ); + }, + + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix4#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {this} This Matrix4. + */ + translate: function (v) + { + return this.translateXYZ(v.x, v.y, v.z); + }, + + /** + * Translate this Matrix using the given values. + * + * @method Phaser.Math.Matrix4#translateXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Matrix4. + */ + translateXYZ: function (x, y, z) + { + var a = this.val; + + a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + + return this; + }, + + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix4#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {this} This Matrix4. + */ + scale: function (v) + { + return this.scaleXYZ(v.x, v.y, v.z); + }, + + /** + * Apply a scale transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#scaleXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Matrix4. + */ + scaleXYZ: function (x, y, z) + { + var a = this.val; + + a[0] = a[0] * x; + a[1] = a[1] * x; + a[2] = a[2] * x; + a[3] = a[3] * x; + + a[4] = a[4] * y; + a[5] = a[5] * y; + a[6] = a[6] * y; + a[7] = a[7] * y; + + a[8] = a[8] * z; + a[9] = a[9] * z; + a[10] = a[10] * z; + a[11] = a[11] * z; + + return this; + }, + + /** + * Derive a rotation matrix around the given axis. + * + * @method Phaser.Math.Matrix4#makeRotationAxis + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. + * @param {number} angle - The rotation angle in radians. + * + * @return {this} This Matrix4. + */ + makeRotationAxis: function (axis, angle) + { + // Based on http://www.gamedev.net/reference/articles/article1199.asp + + var c = Math.cos(angle); + var s = Math.sin(angle); + var t = 1 - c; + var x = axis.x; + var y = axis.y; + var z = axis.z; + var tx = t * x; + var ty = t * y; + + return this.setValues( + tx * x + c, tx * y - s * z, tx * z + s * y, 0, + tx * y + s * z, ty * y + c, ty * z - s * x, 0, + tx * z - s * y, ty * z + s * x, t * z * z + c, 0, + 0, 0, 0, 1 + ); + }, + + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. + * + * @return {this} This Matrix4. + */ + rotate: function (rad, axis) + { + var a = this.val; + var x = axis.x; + var y = axis.y; + var z = axis.z; + var len = Math.sqrt(x * x + y * y + z * z); + + if (Math.abs(len) < EPSILON) + { + return this; + } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + var s = Math.sin(rad); + var c = Math.cos(rad); + var t = 1 - c; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + // Construct the elements of the rotation matrix + var b00 = x * x * t + c; + var b01 = y * x * t + z * s; + var b02 = z * x * t - y * s; + + var b10 = x * y * t - z * s; + var b11 = y * y * t + c; + var b12 = z * y * t + x * s; + + var b20 = x * z * t + y * s; + var b21 = y * z * t - x * s; + var b22 = z * z * t + c; + + // Perform rotation-specific matrix multiplication + return this.setValues( + a00 * b00 + a10 * b01 + a20 * b02, + a01 * b00 + a11 * b01 + a21 * b02, + a02 * b00 + a12 * b01 + a22 * b02, + a03 * b00 + a13 * b01 + a23 * b02, + a00 * b10 + a10 * b11 + a20 * b12, + a01 * b10 + a11 * b11 + a21 * b12, + a02 * b10 + a12 * b11 + a22 * b12, + a03 * b10 + a13 * b11 + a23 * b12, + a00 * b20 + a10 * b21 + a20 * b22, + a01 * b20 + a11 * b21 + a21 * b22, + a02 * b20 + a12 * b21 + a22 * b22, + a03 * b20 + a13 * b21 + a23 * b22, + a30, a31, a32, a33 + ); + }, + + /** + * Rotate this matrix on its X axis. + * + * @method Phaser.Math.Matrix4#rotateX + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {this} This Matrix4. + */ + rotateX: function (rad) + { + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + // Perform axis-specific matrix multiplication + a[4] = a10 * c + a20 * s; + a[5] = a11 * c + a21 * s; + a[6] = a12 * c + a22 * s; + a[7] = a13 * c + a23 * s; + a[8] = a20 * c - a10 * s; + a[9] = a21 * c - a11 * s; + a[10] = a22 * c - a12 * s; + a[11] = a23 * c - a13 * s; + + return this; + }, + + /** + * Rotate this matrix on its Y axis. + * + * @method Phaser.Math.Matrix4#rotateY + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {this} This Matrix4. + */ + rotateY: function (rad) + { + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + // Perform axis-specific matrix multiplication + a[0] = a00 * c - a20 * s; + a[1] = a01 * c - a21 * s; + a[2] = a02 * c - a22 * s; + a[3] = a03 * c - a23 * s; + a[8] = a00 * s + a20 * c; + a[9] = a01 * s + a21 * c; + a[10] = a02 * s + a22 * c; + a[11] = a03 * s + a23 * c; + + return this; + }, + + /** + * Rotate this matrix on its Z axis. + * + * @method Phaser.Math.Matrix4#rotateZ + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {this} This Matrix4. + */ + rotateZ: function (rad) + { + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + + // Perform axis-specific matrix multiplication + a[0] = a00 * c + a10 * s; + a[1] = a01 * c + a11 * s; + a[2] = a02 * c + a12 * s; + a[3] = a03 * c + a13 * s; + a[4] = a10 * c - a00 * s; + a[5] = a11 * c - a01 * s; + a[6] = a12 * c - a02 * s; + a[7] = a13 * c - a03 * s; + + return this; + }, + + /** + * Set the values of this Matrix from the given rotation Quaternion and translation Vector. + * + * @method Phaser.Math.Matrix4#fromRotationTranslation + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. + * @param {Phaser.Math.Vector3} v - The Vector to set translation from. + * + * @return {this} This Matrix4. + */ + fromRotationTranslation: function (q, v) + { + // Quaternion math + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; + + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + + return this.setValues( + 1 - (yy + zz), + xy + wz, + xz - wy, + 0, + + xy - wz, + 1 - (xx + zz), + yz + wx, + 0, + + xz + wy, + yz - wx, + 1 - (xx + yy), + 0, + + v.x, + v.y, + v.z, + 1 + ); + }, + + /** + * Set the values of this Matrix from the given Quaternion. + * + * @method Phaser.Math.Matrix4#fromQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {this} This Matrix4. + */ + fromQuat: function (q) + { + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; + + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + + return this.setValues( + 1 - (yy + zz), + xy + wz, + xz - wy, + 0, + + xy - wz, + 1 - (xx + zz), + yz + wx, + 0, + + xz + wy, + yz - wx, + 1 - (xx + yy), + 0, + + 0, + 0, + 0, + 1 + ); + }, + + /** + * Generate a frustum matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#frustum + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {this} This Matrix4. + */ + frustum: function (left, right, bottom, top, near, far) + { + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + var nf = 1 / (near - far); + + return this.setValues( + (near * 2) * rl, + 0, + 0, + 0, + + 0, + (near * 2) * tb, + 0, + 0, + + (right + left) * rl, + (top + bottom) * tb, + (far + near) * nf, + -1, + + 0, + 0, + (far * near * 2) * nf, + 0 + ); + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspective + * @since 3.0.0 + * + * @param {number} fovy - Vertical field of view in radians + * @param {number} aspect - Aspect ratio. Typically viewport width /height. + * @param {number} near - Near bound of the frustum. + * @param {number} far - Far bound of the frustum. + * + * @return {this} This Matrix4. + */ + perspective: function (fovy, aspect, near, far) + { + var f = 1.0 / Math.tan(fovy / 2); + var nf = 1 / (near - far); + + return this.setValues( + f / aspect, + 0, + 0, + 0, + + 0, + f, + 0, + 0, + + 0, + 0, + (far + near) * nf, + -1, + + 0, + 0, + (2 * far * near) * nf, + 0 + ); + }, + + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspectiveLH + * @since 3.0.0 + * + * @param {number} width - The width of the frustum. + * @param {number} height - The height of the frustum. + * @param {number} near - Near bound of the frustum. + * @param {number} far - Far bound of the frustum. + * + * @return {this} This Matrix4. + */ + perspectiveLH: function (width, height, near, far) + { + return this.setValues( + (2 * near) / width, + 0, + 0, + 0, + + 0, + (2 * near) / height, + 0, + 0, + + 0, + 0, + -far / (near - far), + 1, + + 0, + 0, + (near * far) / (near - far), + 0 + ); + }, + + /** + * Generate an orthogonal projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#ortho + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {this} This Matrix4. + */ + ortho: function (left, right, bottom, top, near, far) + { + var lr = left - right; + var bt = bottom - top; + var nf = near - far; + + // Avoid division by zero + lr = (lr === 0) ? lr : 1 / lr; + bt = (bt === 0) ? bt : 1 / bt; + nf = (nf === 0) ? nf : 1 / nf; + + return this.setValues( + -2 * lr, + 0, + 0, + 0, + + 0, + -2 * bt, + 0, + 0, + + 0, + 0, + 2 * nf, + 0, + + (left + right) * lr, + (top + bottom) * bt, + (far + near) * nf, + 1 + ); + }, + + /** + * Generate a right-handed look-at matrix with the given eye position, target and up axis. + * + * @method Phaser.Math.Matrix4#lookAtRH + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} eye - Position of the viewer. + * @param {Phaser.Math.Vector3} target - Point the viewer is looking at. + * @param {Phaser.Math.Vector3} up - vec3 pointing up. + * + * @return {this} This Matrix4. + */ + lookAtRH: function (eye, target, up) + { + var m = this.val; + + _z.subVectors(eye, target); + + if (_z.getLengthSquared() === 0) + { + // eye and target are in the same position + _z.z = 1; + } + + _z.normalize(); + _x.crossVectors(up, _z); + + if (_x.getLengthSquared() === 0) + { + // up and z are parallel + + if (Math.abs(up.z) === 1) + { + _z.x += 0.0001; + } + else + { + _z.z += 0.0001; + } + + _z.normalize(); + _x.crossVectors(up, _z); + } + + _x.normalize(); + _y.crossVectors(_z, _x); + + m[0] = _x.x; + m[1] = _x.y; + m[2] = _x.z; + m[4] = _y.x; + m[5] = _y.y; + m[6] = _y.z; + m[8] = _z.x; + m[9] = _z.y; + m[10] = _z.z; + + return this; + }, + + /** + * Generate a look-at matrix with the given eye position, focal point, and up axis. + * + * @method Phaser.Math.Matrix4#lookAt + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} eye - Position of the viewer + * @param {Phaser.Math.Vector3} center - Point the viewer is looking at + * @param {Phaser.Math.Vector3} up - vec3 pointing up. + * + * @return {this} This Matrix4. + */ + lookAt: function (eye, center, up) + { + var eyex = eye.x; + var eyey = eye.y; + var eyez = eye.z; + + var upx = up.x; + var upy = up.y; + var upz = up.z; + + var centerx = center.x; + var centery = center.y; + var centerz = center.z; + + if (Math.abs(eyex - centerx) < EPSILON && + Math.abs(eyey - centery) < EPSILON && + Math.abs(eyez - centerz) < EPSILON) + { + return this.identity(); + } + + var z0 = eyex - centerx; + var z1 = eyey - centery; + var z2 = eyez - centerz; + + var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + + z0 *= len; + z1 *= len; + z2 *= len; + + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; + + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + + if (!len) + { + x0 = 0; + x1 = 0; + x2 = 0; + } + else + { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + var y0 = z1 * x2 - z2 * x1; + var y1 = z2 * x0 - z0 * x2; + var y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + + if (!len) + { + y0 = 0; + y1 = 0; + y2 = 0; + } + else + { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + return this.setValues( + x0, + y0, + z0, + 0, + + x1, + y1, + z1, + 0, + + x2, + y2, + z2, + 0, + + -(x0 * eyex + x1 * eyey + x2 * eyez), + -(y0 * eyex + y1 * eyey + y2 * eyez), + -(z0 * eyex + z1 * eyey + z2 * eyez), + 1 + ); + }, + + /** + * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. + * + * @method Phaser.Math.Matrix4#yawPitchRoll + * @since 3.0.0 + * + * @param {number} yaw - The yaw value. + * @param {number} pitch - The pitch value. + * @param {number} roll - The roll value. + * + * @return {this} This Matrix4. + */ + yawPitchRoll: function (yaw, pitch, roll) + { + this.zero(); + _tempMat1.zero(); + _tempMat2.zero(); + + var m0 = this.val; + var m1 = _tempMat1.val; + var m2 = _tempMat2.val; + + // Rotate Z + var s = Math.sin(roll); + var c = Math.cos(roll); + + m0[10] = 1; + m0[15] = 1; + m0[0] = c; + m0[1] = s; + m0[4] = -s; + m0[5] = c; + + // Rotate X + s = Math.sin(pitch); + c = Math.cos(pitch); + + m1[0] = 1; + m1[15] = 1; + m1[5] = c; + m1[10] = c; + m1[9] = -s; + m1[6] = s; + + // Rotate Y + s = Math.sin(yaw); + c = Math.cos(yaw); + + m2[5] = 1; + m2[15] = 1; + m2[0] = c; + m2[2] = -s; + m2[8] = s; + m2[10] = c; + + this.multiplyLocal(_tempMat1); + this.multiplyLocal(_tempMat2); + + return this; + }, + + /** + * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. + * + * @method Phaser.Math.Matrix4#setWorldMatrix + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. + * @param {Phaser.Math.Vector3} position - The position of the world matrix. + * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. + * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. + * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. + * + * @return {this} This Matrix4. + */ + setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) + { + this.yawPitchRoll(rotation.y, rotation.x, rotation.z); + + _tempMat1.scaling(scale.x, scale.y, scale.z); + _tempMat2.xyz(position.x, position.y, position.z); + + this.multiplyLocal(_tempMat1); + this.multiplyLocal(_tempMat2); + + if (viewMatrix) + { + this.multiplyLocal(viewMatrix); + } + + if (projectionMatrix) + { + this.multiplyLocal(projectionMatrix); + } + + return this; + }, + + /** + * Multiplies this Matrix4 by the given `src` Matrix4 and stores the results in the `out` Matrix4. + * + * @method Phaser.Math.Matrix4#multiplyToMat4 + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix4 to multiply with this one. + * @param {Phaser.Math.Matrix4} out - The receiving Matrix. + * + * @return {Phaser.Math.Matrix4} This `out` Matrix4. + */ + multiplyToMat4: function (src, out) + { + var a = this.val; + var b = src.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b00 = b[0]; + var b01 = b[1]; + var b02 = b[2]; + var b03 = b[3]; + var b10 = b[4]; + var b11 = b[5]; + var b12 = b[6]; + var b13 = b[7]; + var b20 = b[8]; + var b21 = b[9]; + var b22 = b[10]; + var b23 = b[11]; + var b30 = b[12]; + var b31 = b[13]; + var b32 = b[14]; + var b33 = b[15]; + + return out.setValues( + b00 * a00 + b01 * a10 + b02 * a20 + b03 * a30, + b01 * a01 + b01 * a11 + b02 * a21 + b03 * a31, + b02 * a02 + b01 * a12 + b02 * a22 + b03 * a32, + b03 * a03 + b01 * a13 + b02 * a23 + b03 * a33, + + b10 * a00 + b11 * a10 + b12 * a20 + b13 * a30, + b10 * a01 + b11 * a11 + b12 * a21 + b13 * a31, + b10 * a02 + b11 * a12 + b12 * a22 + b13 * a32, + b10 * a03 + b11 * a13 + b12 * a23 + b13 * a33, + + b20 * a00 + b21 * a10 + b22 * a20 + b23 * a30, + b20 * a01 + b21 * a11 + b22 * a21 + b23 * a31, + b20 * a02 + b21 * a12 + b22 * a22 + b23 * a32, + b20 * a03 + b21 * a13 + b22 * a23 + b23 * a33, + + b30 * a00 + b31 * a10 + b32 * a20 + b33 * a30, + b30 * a01 + b31 * a11 + b32 * a21 + b33 * a31, + b30 * a02 + b31 * a12 + b32 * a22 + b33 * a32, + b30 * a03 + b31 * a13 + b32 * a23 + b33 * a33 + ); + }, + + /** + * Takes the rotation and position vectors and builds this Matrix4 from them. + * + * @method Phaser.Math.Matrix4#fromRotationXYTranslation + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} rotation - The rotation vector. + * @param {Phaser.Math.Vector3} position - The position vector. + * @param {boolean} translateFirst - Should the operation translate then rotate (`true`), or rotate then translate? (`false`) + * + * @return {this} This Matrix4. + */ + fromRotationXYTranslation: function (rotation, position, translateFirst) + { + var x = position.x; + var y = position.y; + var z = position.z; + + var sx = Math.sin(rotation.x); + var cx = Math.cos(rotation.x); + + var sy = Math.sin(rotation.y); + var cy = Math.cos(rotation.y); + + var a30 = x; + var a31 = y; + var a32 = z; + + // Rotate X + + var b21 = -sx; + + // Rotate Y + + var c01 = 0 - b21 * sy; + + var c02 = 0 - cx * sy; + + var c21 = b21 * cy; + + var c22 = cx * cy; + + // Translate + if (!translateFirst) + { + // a30 = cy * x + 0 * y + sy * z; + a30 = cy * x + sy * z; + a31 = c01 * x + cx * y + c21 * z; + a32 = c02 * x + sx * y + c22 * z; + } + + return this.setValues( + cy, + c01, + c02, + 0, + 0, + cx, + sx, + 0, + sy, + c21, + c22, + 0, + a30, + a31, + a32, + 1 + ); + }, + + /** + * Returns the maximum axis scale from this Matrix4. + * + * @method Phaser.Math.Matrix4#getMaxScaleOnAxis + * @since 3.50.0 + * + * @return {number} The maximum axis scale. + */ + getMaxScaleOnAxis: function () + { + var m = this.val; + + var scaleXSq = m[0] * m[0] + m[1] * m[1] + m[2] * m[2]; + var scaleYSq = m[4] * m[4] + m[5] * m[5] + m[6] * m[6]; + var scaleZSq = m[8] * m[8] + m[9] * m[9] + m[10] * m[10]; + + return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq)); + } + +}); + +/** + * @ignore + */ +var _tempMat1 = new Matrix4(); + +/** + * @ignore + */ +var _tempMat2 = new Matrix4(); + +/** + * @ignore + */ +var _x = new Vector3(); + +/** + * @ignore + */ +var _y = new Vector3(); + +/** + * @ignore + */ +var _z = new Vector3(); + +module.exports = Matrix4; + + +/***/ }), +/* 74 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var WEBGL_CONST = { + + /** + * 8-bit twos complement signed integer. + * + * @name Phaser.Renderer.WebGL.BYTE + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + BYTE: { enum: 0x1400, size: 1 }, + + /** + * 8-bit twos complement unsigned integer. + * + * @name Phaser.Renderer.WebGL.UNSIGNED_BYTE + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + UNSIGNED_BYTE: { enum: 0x1401, size: 1 }, + + /** + * 16-bit twos complement signed integer. + * + * @name Phaser.Renderer.WebGL.SHORT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + SHORT: { enum: 0x1402, size: 2 }, + + /** + * 16-bit twos complement unsigned integer. + * + * @name Phaser.Renderer.WebGL.UNSIGNED_SHORT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + UNSIGNED_SHORT: { enum: 0x1403, size: 2 }, + + /** + * 32-bit twos complement signed integer. + * + * @name Phaser.Renderer.WebGL.INT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + INT: { enum: 0x1404, size: 4 }, + + /** + * 32-bit twos complement unsigned integer. + * + * @name Phaser.Renderer.WebGL.UNSIGNED_INT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + UNSIGNED_INT: { enum: 0x1405, size: 4 }, + + /** + * 32-bit IEEE floating point number. + * + * @name Phaser.Renderer.WebGL.FLOAT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + FLOAT: { enum: 0x1406, size: 4 } + +}; + +module.exports = WEBGL_CONST; + + +/***/ }), +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var DeepCopy = __webpack_require__(167); +var Events = __webpack_require__(190); +var GetFastValue = __webpack_require__(2); +var Matrix4 = __webpack_require__(73); +var RenderTarget = __webpack_require__(263); +var Utils = __webpack_require__(12); +var WebGLShader = __webpack_require__(574); + +/** + * @classdesc + * The `WebGLPipeline` is a base class used by all of the core Phaser pipelines. + * + * It describes the way elements will be rendered in WebGL. Internally, it handles + * compiling the shaders, creating vertex buffers, assigning primitive topology and + * binding vertex attributes, all based on the given configuration data. + * + * The pipeline is configured by passing in a `WebGLPipelineConfig` object. Please + * see the documentation for this type to fully understand the configuration options + * available to you. + * + * Usually, you would not extend from this class directly, but would instead extend + * from one of the core pipelines, such as the Multi Pipeline. + * + * The pipeline flow per render-step is as follows: + * + * 1) onPreRender - called once at the start of the render step + * 2) onRender - call for each Scene Camera that needs to render (so can be multiple times per render step) + * 3) Internal flow: + * 3a) bind (only called if a Game Object is using this pipeline and it's not currently active) + * 3b) onBind (called for every Game Object that uses this pipeline) + * 3c) flush (can be called by a Game Object, internal method or from outside by changing pipeline) + * 4) onPostRender - called once at the end of the render step + * + * @class WebGLPipeline + * @memberof Phaser.Renderer.WebGL + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. + */ +var WebGLPipeline = new Class({ + + initialize: + + function WebGLPipeline (config) + { + var game = config.game; + var renderer = game.renderer; + var gl = renderer.gl; + + /** + * Name of the pipeline. Used for identification and setting from Game Objects. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#name + * @type {string} + * @since 3.0.0 + */ + this.name = GetFastValue(config, 'name', 'WebGLPipeline'); + + /** + * The Phaser Game instance to which this pipeline is bound. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; + + /** + * The WebGL Renderer instance to which this pipeline is bound. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.0.0 + */ + this.renderer = renderer; + + /** + * A reference to the WebGL Pipeline Manager. + * + * This is initially undefined and only set when this pipeline is added + * to the manager. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#manager + * @type {?Phaser.Renderer.WebGL.PipelineManager} + * @since 3.50.0 + */ + this.manager; + + /** + * The WebGL context this WebGL Pipeline uses. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#gl + * @type {WebGLRenderingContext} + * @since 3.0.0 + */ + this.gl = gl; + + /** + * The canvas which this WebGL Pipeline renders to. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#view + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.view = game.canvas; + + /** + * Width of the current viewport. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#width + * @type {number} + * @since 3.0.0 + */ + this.width = 0; + + /** + * Height of the current viewport. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#height + * @type {number} + * @since 3.0.0 + */ + this.height = 0; + + /** + * The current number of vertices that have been added to the pipeline batch. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.vertexCount = 0; + + /** + * The total number of vertices that this pipeline batch can hold before it will flush. + * + * This defaults to `renderer batchSize * 7`, where `batchSize` is defined in the Renderer Config. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity + * @type {number} + * @since 3.0.0 + */ + this.vertexCapacity = 0; + + /** + * Raw byte buffer of vertices. + * + * Either set via the config object, or generates a new Array Buffer of size `vertexCapacity * vertexSize`. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData + * @type {ArrayBuffer} + * @readonly + * @since 3.0.0 + */ + this.vertexData; + + /** + * The WebGLBuffer that holds the vertex data. + * + * Created from the `vertices` config ArrayBuffer that was passed in, or set by default, by the pipeline. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer + * @type {WebGLBuffer} + * @readonly + * @since 3.0.0 + */ + this.vertexBuffer; + + /** + * The primitive topology which the pipeline will use to submit draw calls. + * + * Defaults to GL_TRIANGLES if not otherwise set in the config. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#topology + * @type {GLenum} + * @since 3.0.0 + */ + this.topology = GetFastValue(config, 'topology', gl.TRIANGLES); + + /** + * Uint8 view to the `vertexData` ArrayBuffer. Used for uploading vertex buffer resources to the GPU. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes + * @type {Uint8Array} + * @since 3.0.0 + */ + this.bytes; + + /** + * Float32 view of the array buffer containing the pipeline's vertices. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32; + + /** + * Uint32 view of the array buffer containing the pipeline's vertices. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexViewU32 + * @type {Uint32Array} + * @since 3.0.0 + */ + this.vertexViewU32; + + /** + * Indicates if the current pipeline is active, or not, for this frame only. + * + * Reset to `true` in the `onRender` method. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#active + * @type {boolean} + * @since 3.10.0 + */ + this.active = false; + + /** + * Holds the most recently assigned texture unit. + + * Treat this value as read-only. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentUnit + * @type {number} + * @since 3.50.0 + */ + this.currentUnit = 0; + + /** + * Some pipelines require the forced use of texture zero (like the light pipeline). + * + * This property should be set when that is the case. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#forceZero + * @type {boolean} + * @since 3.50.0 + */ + this.forceZero = GetFastValue(config, 'forceZero', false); + + /** + * Indicates if this pipeline has booted or not. + * + * A pipeline boots only when the Game instance itself, and all associated systems, is + * fully ready. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#hasBooted + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.hasBooted = false; + + /** + * Indicates if this is a Post FX Pipeline, or not. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#isPostFX + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.isPostFX = false; + + /** + * An array of RenderTarget instances that belong to this pipeline. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#renderTargets + * @type {Phaser.Renderer.WebGL.RenderTarget[]} + * @since 3.50.0 + */ + this.renderTargets = []; + + /** + * A reference to the currently bound Render Target instance from the `WebGLPipeline.renderTargets` array. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentRenderTarget + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.currentRenderTarget; + + /** + * An array of all the WebGLShader instances that belong to this pipeline. + * + * Shaders manage their own attributes and uniforms, but share the same vertex data buffer, + * which belongs to this pipeline. + * + * Shaders are set in a call to the `setShadersFromConfig` method, which happens automatically, + * but can also be called at any point in your game. See the method documentation for details. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#shaders + * @type {Phaser.Renderer.WebGL.WebGLShader[]} + * @since 3.50.0 + */ + this.shaders = []; + + /** + * A reference to the currently bound WebGLShader instance from the `WebGLPipeline.shaders` array. + * + * For lots of pipelines, this is the only shader, so it is a quick way to reference it without + * an array look-up. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.currentShader; + + /** + * The Projection matrix, used by shaders as 'uProjectionMatrix' uniform. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#projectionMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.projectionMatrix; + + /** + * The configuration object that was used to create this pipeline. + * + * Treat this object as 'read only', because changing it post-creation will not + * impact this pipeline in any way. However, it is used internally for cloning + * and post-boot set-up. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#config + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} + * @since 3.50.0 + */ + this.config = config; + }, + + /** + * Called when the Game has fully booted and the Renderer has finished setting up. + * + * By this stage all Game level systems are now in place. You can perform any final tasks that the + * pipeline may need, that relies on game systems such as the Texture Manager being ready. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#boot + * @since 3.11.0 + */ + boot: function () + { + var i; + var gl = this.gl; + var config = this.config; + var renderer = this.renderer; + + if (!this.isPostFX) + { + this.projectionMatrix = new Matrix4().identity(); + } + + // Create the Render Targets + + var renderTargets = this.renderTargets; + + var targets = GetFastValue(config, 'renderTarget', false); + + // If boolean, set to number = 1 + if (typeof(targets) === 'boolean' && targets) + { + targets = 1; + } + + var width = renderer.width; + var height = renderer.height; + + if (typeof(targets) === 'number') + { + // Create this many default RTs + for (i = 0; i < targets; i++) + { + renderTargets.push(new RenderTarget(renderer, width, height, 1, 0, true)); + } + } + else if (Array.isArray(targets)) + { + for (i = 0; i < targets.length; i++) + { + var scale = GetFastValue(targets[i], 'scale', 1); + var minFilter = GetFastValue(targets[i], 'minFilter', 0); + var autoClear = GetFastValue(targets[i], 'autoClear', 1); + + renderTargets.push(new RenderTarget(renderer, width, height, scale, minFilter, autoClear)); + } + } + + if (renderTargets.length) + { + // Default to the first one in the array + this.currentRenderTarget = renderTargets[0]; + } + + // Create the Shaders + + this.setShadersFromConfig(config); + + // Which shader has the largest vertex size? + var shaders = this.shaders; + var vertexSize = 0; + + for (i = 0; i < shaders.length; i++) + { + if (shaders[i].vertexSize > vertexSize) + { + vertexSize = shaders[i].vertexSize; + } + } + + var batchSize = GetFastValue(config, 'batchSize', renderer.config.batchSize); + + // * 6 because there are 6 vertices in a quad and 'batchSize' represents the quantity of quads in the batch + + this.vertexCapacity = batchSize * 6; + + var data = GetFastValue(config, 'vertices', new ArrayBuffer(this.vertexCapacity * vertexSize)); + + this.vertexData = data; + + if (GetFastValue(config, 'vertices', null)) + { + this.vertexBuffer = renderer.createVertexBuffer(data, gl.STATIC_DRAW); + } + else + { + this.vertexBuffer = renderer.createVertexBuffer(data.byteLength, gl.DYNAMIC_DRAW); + } + + this.bytes = new Uint8Array(data); + + this.vertexViewF32 = new Float32Array(data); + + this.vertexViewU32 = new Uint32Array(data); + + // Set-up shaders + + this.renderer.setVertexBuffer(this.vertexBuffer); + + for (i = 0; i < shaders.length; i++) + { + shaders[i].rebind(); + } + + this.currentShader.bind(); + + this.hasBooted = true; + + renderer.on(Events.RESIZE, this.resize, this); + renderer.on(Events.PRE_RENDER, this.onPreRender, this); + renderer.on(Events.RENDER, this.onRender, this); + renderer.on(Events.POST_RENDER, this.onPostRender, this); + + this.onBoot(); + }, + + /** + * This method is called once when this pipeline has finished being set-up + * at the end of the boot process. By the time this method is called, all + * of the shaders are ready and configured. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBoot + * @since 3.50.0 + */ + onBoot: function () + { + }, + + /** + * This method is called once when this pipeline has finished being set-up + * at the end of the boot process. By the time this method is called, all + * of the shaders are ready and configured. It's also called if the renderer + * changes size. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onResize + * @since 3.50.0 + * + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + */ + onResize: function () + { + }, + + /** + * Sets the currently active shader within this pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setShader + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} shader - The shader to set as being current. + * @param {boolean} [setAttributes=false] - Should the vertex attribute pointers be set? + * + * @return {this} This WebGLPipeline instance. + */ + setShader: function (shader, setAttributes) + { + var renderer = this.renderer; + + if (shader !== this.currentShader || renderer.currentProgram !== this.currentShader.program) + { + this.flush(); + + renderer.resetTextures(); + + renderer.setVertexBuffer(this.vertexBuffer); + + shader.bind(setAttributes, false); + + this.currentShader = shader; + } + + return this; + }, + + /** + * Searches all shaders in this pipeline for one matching the given name, then returns it. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#getShaderByName + * @since 3.50.0 + * + * @param {string} name - The index of the shader to set. + * + * @return {Phaser.Renderer.WebGL.WebGLShader} The WebGLShader instance, if found. + */ + getShaderByName: function (name) + { + var shaders = this.shaders; + + for (var i = 0; i < shaders.length; i++) + { + if (shaders[i].name === name) + { + return shaders[i]; + } + } + }, + + /** + * Destroys all shaders currently set in the `WebGLPipeline.shaders` array and then parses the given + * `config` object, extracting the shaders from it, creating `WebGLShader` instances and finally + * setting them into the `shaders` array of this pipeline. + * + * This is a destructive process. Be very careful when you call it, should you need to. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setShadersFromConfig + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. + * + * @return {this} This WebGLPipeline instance. + */ + setShadersFromConfig: function (config) + { + var i; + var shaders = this.shaders; + var renderer = this.renderer; + + for (i = 0; i < shaders.length; i++) + { + shaders[i].destroy(); + } + + var vName = 'vertShader'; + var fName = 'fragShader'; + var uName = 'uniforms'; + var aName = 'attributes'; + + var defaultVertShader = GetFastValue(config, vName, null); + var defaultFragShader = Utils.parseFragmentShaderMaxTextures(GetFastValue(config, fName, null), renderer.maxTextures); + var defaultUniforms = GetFastValue(config, uName, null); + var defaultAttribs = GetFastValue(config, aName, null); + + var configShaders = GetFastValue(config, 'shaders', []); + + var len = configShaders.length; + + if (len === 0) + { + if (defaultVertShader && defaultFragShader) + { + this.shaders = [ new WebGLShader(this, 'default', defaultVertShader, defaultFragShader, DeepCopy(defaultAttribs), DeepCopy(defaultUniforms)) ]; + } + } + else + { + var newShaders = []; + + for (i = 0; i < len; i++) + { + var shaderEntry = configShaders[i]; + + var name = GetFastValue(shaderEntry, 'name', 'default'); + + var vertShader = GetFastValue(shaderEntry, vName, defaultVertShader); + var fragShader = Utils.parseFragmentShaderMaxTextures(GetFastValue(shaderEntry, fName, defaultFragShader), renderer.maxTextures); + var attributes = GetFastValue(shaderEntry, aName, defaultAttribs); + var uniforms = GetFastValue(shaderEntry, uName, defaultUniforms); + + if (vertShader && fragShader) + { + newShaders.push(new WebGLShader(this, name, vertShader, fragShader, DeepCopy(attributes), DeepCopy(uniforms))); + } + } + + this.shaders = newShaders; + } + + if (this.shaders.length === 0) + { + console.warn('Pipeline: ' + this.name + ' - Invalid shader config'); + } + else + { + this.currentShader = this.shaders[0]; + } + + return this; + }, + + /** + * Custom pipelines can use this method in order to perform any required pre-batch tasks + * for the given Game Object. It must return the texture unit the Game Object was assigned. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setGameObject + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. + * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. + * + * @return {number} The texture unit the Game Object has been assigned. + */ + setGameObject: function (gameObject, frame) + { + if (frame === undefined) { frame = gameObject.frame; } + + this.currentUnit = this.renderer.setTextureSource(frame.source); + + return this.currentUnit; + }, + + /** + * Check if the current batch of vertices is full. + * + * You can optionally provide an `amount` parameter. If given, it will check if the batch + * needs to flush _if_ the `amount` is added to it. This allows you to test if you should + * flush before populating the batch. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush + * @since 3.0.0 + * + * @param {number} [amount=0] - Will the batch need to flush if this many vertices are added to it? + * + * @return {boolean} `true` if the current batch should be flushed, otherwise `false`. + */ + shouldFlush: function (amount) + { + if (amount === undefined) { amount = 0; } + + return (this.vertexCount + amount > this.vertexCapacity); + }, + + /** + * Resizes the properties used to describe the viewport. + * + * This method is called automatically by the renderer during its resize handler. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#resize + * @since 3.0.0 + * + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + * + * @return {this} This WebGLPipeline instance. + */ + resize: function (width, height) + { + if (width !== this.width || height !== this.height) + { + this.flush(); + } + + this.width = width; + this.height = height; + + var projectionMatrix = this.projectionMatrix; + + // Because Post FX Pipelines don't have them + if (projectionMatrix) + { + projectionMatrix.ortho(0, width, height, 0, -1000, 1000); + } + + var i; + + var targets = this.renderTargets; + + for (i = 0; i < targets.length; i++) + { + targets[i].resize(width, height); + } + + var shaders = this.shaders; + + for (i = 0; i < shaders.length; i++) + { + var shader = shaders[i]; + + if (shader.hasUniform('uProjectionMatrix')) + { + this.setMatrix4fv('uProjectionMatrix', false, projectionMatrix.val, shader); + } + } + + this.onResize(width, height); + + return this; + }, + + /** + * This method is called every time the Pipeline Manager makes this pipeline the currently active one. + * + * It binds the resources and shader needed for this pipeline, including setting the vertex buffer + * and attribute pointers. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bind + * @since 3.0.0 + * + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * + * @return {this} This WebGLPipeline instance. + */ + bind: function (currentShader) + { + if (currentShader === undefined) { currentShader = this.currentShader; } + + var wasBound = this.renderer.setVertexBuffer(this.vertexBuffer); + + currentShader.bind(wasBound); + + this.currentShader = currentShader; + + return this; + }, + + /** + * This method is called every time the Pipeline Manager rebinds this pipeline. + * + * It resets all shaders this pipeline uses, setting their attributes again. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#rebind + * @since 3.0.0 + * + * @return {this} This WebGLPipeline instance. + */ + rebind: function () + { + this.renderer.setVertexBuffer(this.vertexBuffer); + + var shaders = this.shaders; + + for (var i = 0; i < shaders.length; i++) + { + shaders[i].rebind(); + } + + this.currentShader = shaders[0]; + + this.onRebind(); + + return this; + }, + + /** + * This method is called as a result of the `WebGLPipeline.batchQuad` method, right before a quad + * belonging to a Game Object is about to be added to the batch. When this is called, the + * renderer has just performed a flush. It will bind the current render target, if any are set + * and finally call the `onPreBatch` hook. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#preBatch + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.Cameras.Scene2D.Camera)} [gameObject] - The Game Object or Camera that invoked this pipeline, if any. + * + * @return {this} This WebGLPipeline instance. + */ + preBatch: function (gameObject) + { + if (this.currentRenderTarget) + { + this.currentRenderTarget.bind(); + } + + this.onPreBatch(gameObject); + + return this; + }, + + /** + * This method is called as a result of the `WebGLPipeline.batchQuad` method, right after a quad + * belonging to a Game Object has been added to the batch. When this is called, the + * renderer has just performed a flush. + * + * It calls the `onDraw` hook followed by the `onPostBatch` hook, which can be used to perform + * additional Post FX Pipeline processing. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#postBatch + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.Cameras.Scene2D.Camera)} [gameObject] - The Game Object or Camera that invoked this pipeline, if any. + * + * @return {this} This WebGLPipeline instance. + */ + postBatch: function (gameObject) + { + this.onDraw(this.currentRenderTarget); + + this.onPostBatch(gameObject); + + return this; + }, + + /** + * This method is only used by Post FX Pipelines and those that extend from them. + * + * This method is called every time the `postBatch` method is called and is passed a + * reference to the current render target. + * + * At the very least a Post FX Pipeline should call `this.bindAndDraw(renderTarget)`, + * however, you can do as much additional processing as you like in this method if + * you override it from within your own pipelines. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onDraw + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} renderTarget - The Render Target. + */ + onDraw: function () + { + }, + + /** + * This method is called every time the Pipeline Manager deactivates this pipeline, swapping from + * it to another one. This happens after a call to `flush` and before the new pipeline is bound. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#unbind + * @since 3.50.0 + */ + unbind: function () + { + if (this.currentRenderTarget) + { + this.currentRenderTarget.unbind(); + } + }, + + /** + * Uploads the vertex data and emits a draw call for the current batch of vertices. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#flush + * @since 3.0.0 + * + * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? + * + * @return {this} This WebGLPipeline instance. + */ + flush: function (isPostFlush) + { + if (isPostFlush === undefined) { isPostFlush = false; } + + var vertexCount = this.vertexCount; + + if (vertexCount > 0) + { + this.onBeforeFlush(isPostFlush); + + var gl = this.gl; + var vertexSize = this.currentShader.vertexSize; + + if (vertexCount === this.vertexCapacity) + { + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.DYNAMIC_DRAW); + } + else + { + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); + } + + gl.drawArrays(this.topology, 0, vertexCount); + + this.vertexCount = 0; + + this.onAfterFlush(isPostFlush); + } + + return this; + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called every time a **Game Object** asks the Pipeline Manager to use this pipeline. + * + * Unlike the `bind` method, which is only called once per frame, this is called for every object + * that requests use of this pipeline, allowing you to perform per-object set-up, such as loading + * shader uniform data. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + */ + onBind: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called when the Pipeline Manager needs to rebind this pipeline. This happens after a + * pipeline has been cleared, usually when passing control over to a 3rd party WebGL library, like Spine, + * and then returing to Phaser again. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onRebind + * @since 3.50.0 + */ + onRebind: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called every time the `batchQuad` or `batchTri` methods are called. If this was + * as a result of a Game Object, then the Game Object refernce is passed to this hook too. + * + * This hook is called _after_ the quad (or tri) has been added to the batch, so you can safely + * call 'flush' from within this. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + */ + onBatch: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called immediately before a **Game Object** is about to add itself to the batch. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + */ + onPreBatch: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called immediately after a **Game Object** has been added to the batch. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + */ + onPostBatch: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called once per frame, right before anything has been rendered, but after the canvas + * has been cleared. If this pipeline has a targetTexture, it will be cleared. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender + * @since 3.50.0 + */ + onPreRender: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called once per frame, for every Camera in a Scene that wants to render. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender + * @since 3.50.0 + * + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. + */ + onRender: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called once per frame, after all rendering has happened and snapshots have been taken. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender + * @since 3.50.0 + */ + onPostRender: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called every time this pipeline is asked to flush its batch. + * + * It is called immediately before the gl.bufferData and gl.drawArray calls are made, so you can + * perform any final pre-render modifications. To apply changes post-render, see `onPostBatch`. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBeforeFlush + * @since 3.50.0 + * + * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? + */ + onBeforeFlush: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called immediately after this pipeline has finished flushing its batch. + * + * It is called after the `gl.drawArrays` call. + * + * You can perform additional post-render effects, but be careful not to call `flush` + * on this pipeline from within this method, or you'll cause an infinite loop. + * + * To apply changes pre-render, see `onBeforeFlush`. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onAfterFlush + * @since 3.50.0 + * + * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? + */ + onAfterFlush: function () + { + }, + + /** + * Adds a single vertex to the current vertex buffer and increments the + * `vertexCount` property by 1. + * + * This method is called directly by `batchTri` and `batchQuad`. + * + * It does not perform any batch limit checking itself, so if you need to call + * this method directly, do so in the same way that `batchQuad` does, for example. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#batchVert + * @since 3.50.0 + * + * @param {number} x - The vertex x position. + * @param {number} y - The vertex y position. + * @param {number} u - UV u value. + * @param {number} v - UV v value. + * @param {number} unit - Texture unit to which the texture needs to be bound. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {number} tint - The tint color value. + */ + batchVert: function (x, y, u, v, unit, tintEffect, tint) + { + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; + + vertexViewF32[++vertexOffset] = x; + vertexViewF32[++vertexOffset] = y; + vertexViewF32[++vertexOffset] = u; + vertexViewF32[++vertexOffset] = v; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tint; + + this.vertexCount++; + }, + + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 6 vertices in the following arrangement: + * + * ``` + * 0----3 + * |\ B| + * | \ | + * | \ | + * | A \| + * | \ + * 1----2 + * ``` + * + * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#batchQuad + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|null)} gameObject - The Game Object, if any, drawing this quad. + * @param {number} x0 - The top-left x position. + * @param {number} y0 - The top-left y position. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} u0 - UV u0 value. + * @param {number} v0 - UV v0 value. + * @param {number} u1 - UV u1 value. + * @param {number} v1 - UV v1 value. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * @param {number} tintBR - The bottom-right tint color value. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {number} [unit=0] - Texture unit to which the texture needs to be bound. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchQuad: function (gameObject, x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) + { + if (unit === undefined) { unit = this.currentUnit; } + + var hasFlushed = false; + + if (this.shouldFlush(6)) + { + this.flush(); + + hasFlushed = true; + + unit = this.setTexture2D(texture); + } + + this.batchVert(x0, y0, u0, v0, unit, tintEffect, tintTL); + this.batchVert(x1, y1, u0, v1, unit, tintEffect, tintBL); + this.batchVert(x2, y2, u1, v1, unit, tintEffect, tintBR); + this.batchVert(x0, y0, u0, v0, unit, tintEffect, tintTL); + this.batchVert(x2, y2, u1, v1, unit, tintEffect, tintBR); + this.batchVert(x3, y3, u1, v0, unit, tintEffect, tintTR); + + this.onBatch(gameObject); + + return hasFlushed; + }, + + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 3 vertices in the following arrangement: + * + * ``` + * 0 + * |\ + * | \ + * | \ + * | \ + * | \ + * 1-----2 + * ``` + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#batchTri + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|null)} gameObject - The Game Object, if any, drawing this quad. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} u0 - UV u0 value. + * @param {number} v0 - UV v0 value. + * @param {number} u1 - UV u1 value. + * @param {number} v1 - UV v1 value. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {number} [unit=0] - Texture unit to which the texture needs to be bound. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchTri: function (gameObject, x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) + { + if (unit === undefined) { unit = this.currentUnit; } + + var hasFlushed = false; + + if (this.shouldFlush(3)) + { + this.flush(); + + hasFlushed = true; + + unit = this.setTexture2D(texture); + } + + this.batchVert(x0, y0, u0, v0, unit, tintEffect, tintTL); + this.batchVert(x1, y1, u0, v1, unit, tintEffect, tintTR); + this.batchVert(x2, y2, u1, v1, unit, tintEffect, tintBL); + + this.onBatch(gameObject); + + return hasFlushed; + }, + + /** + * Pushes a filled rectangle into the vertex batch. + * + * The dimensions are run through `Math.floor` before the quad is generated. + * + * Rectangle has no transform values and isn't transformed into the local space. + * + * Used for directly batching untransformed rectangles, such as Camera background colors. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#drawFillRect + * @since 3.50.0 + * + * @param {number} x - Horizontal top left coordinate of the rectangle. + * @param {number} y - Vertical top left coordinate of the rectangle. + * @param {number} width - Width of the rectangle. + * @param {number} height - Height of the rectangle. + * @param {number} color - Color of the rectangle to draw. + * @param {number} alpha - Alpha value of the rectangle to draw. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {boolean} [flipUV=true] - Flip the vertical UV coordinates of the texture before rendering? + */ + drawFillRect: function (x, y, width, height, color, alpha, texture, flipUV) + { + if (texture === undefined) { texture = this.renderer.whiteTexture.glTexture; } + if (flipUV === undefined) { flipUV = true; } + + x = Math.floor(x); + y = Math.floor(y); + + var xw = Math.floor(x + width); + var yh = Math.floor(y + height); + + var unit = this.setTexture2D(texture); + + var tint = Utils.getTintAppendFloatAlphaAndSwap(color, alpha); + + var u0 = 0; + var v0 = 0; + var u1 = 1; + var v1 = 1; + + if (flipUV) + { + v0 = 1; + v1 = 0; + } + + this.batchQuad(null, x, y, x, yh, xw, yh, xw, y, u0, v0, u1, v1, tint, tint, tint, tint, 0, texture, unit); + }, + + /** + * Sets the texture to be bound to the next available texture unit and returns + * the unit id. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setTexture2D + * @since 3.50.0 + * + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses `whiteTexture`. + * + * @return {number} The assigned texture unit. + */ + setTexture2D: function (texture) + { + if (texture === undefined) { texture = this.renderer.whiteTexture.glTexture; } + + this.currentUnit = this.renderer.setTexture2D(texture); + + return this.currentUnit; + }, + + /** + * Activates the given WebGL Texture and binds it to the requested texture slot. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bindTexture + * @since 3.50.0 + * + * @param {WebGLTexture} [target] - The WebGLTexture to activate and bind. + * @param {number} [unit=0] - The WebGL texture ID to activate. Defaults to `gl.TEXTURE0`. + * + * @return {this} This WebGL Pipeline instance. + */ + bindTexture: function (texture, unit) + { + if (unit === undefined) { unit = 0; } + + var gl = this.gl; + + gl.activeTexture(gl.TEXTURE0 + unit); + + gl.bindTexture(gl.TEXTURE_2D, texture); + + return this; + }, + + /** + * Activates the given Render Target texture and binds it to the + * requested WebGL texture slot. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bindRenderTarget + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The Render Target to activate and bind. + * @param {number} [unit=0] - The WebGL texture ID to activate. Defaults to `gl.TEXTURE0`. + * + * @return {this} This WebGL Pipeline instance. + */ + bindRenderTarget: function (target, unit) + { + return this.bindTexture(target.texture, unit); + }, + + /** + * Sets the current duration into a 1f uniform value based on the given name. + * + * This can be used for mapping time uniform values, such as `iTime`. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setTime + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * + * @return {this} This WebGLPipeline instance. + */ + setTime: function (uniform) + { + this.set1f(uniform, this.game.loop.getDuration()); + + return this; + }, + + /** + * Sets a 1f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `float` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1f: function (name, x, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set1f(name, x); + + return this; + }, + + /** + * Sets a 2f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec2` uniform. + * @param {number} y - The new Y component of the `vec2` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2f: function (name, x, y, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set2f(name, x, y); + + return this; + }, + + /** + * Sets a 3f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec3` uniform. + * @param {number} y - The new Y component of the `vec3` uniform. + * @param {number} z - The new Z component of the `vec3` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3f: function (name, x, y, z, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set3f(name, x, y, z); + + return this; + }, + + /** + * Sets a 4f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform + * @param {number} y - Y component of the uniform + * @param {number} z - Z component of the uniform + * @param {number} w - W component of the uniform + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4f: function (name, x, y, z, w, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set4f(name, x, y, z, w); + + return this; + }, + + /** + * Sets a 1fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set1fv(name, arr); + + return this; + }, + + /** + * Sets a 2fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set2fv(name, arr); + + return this; + }, + + /** + * Sets a 3fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set3fv(name, arr); + + return this; + }, + + /** + * Sets a 4fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set4fv(name, arr); + + return this; + }, + + /** + * Sets a 1iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set1iv(name, arr); + + return this; + }, + + /** + * Sets a 2iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set2iv(name, arr); + + return this; + }, + + /** + * Sets a 3iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set3iv(name, arr); + + return this; + }, + + /** + * Sets a 4iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set4iv(name, arr); + + return this; + }, + + /** + * Sets a 1i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `int` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1i: function (name, x, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set1i(name, x); + + return this; + }, + + /** + * Sets a 2i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec2` uniform. + * @param {number} y - The new Y component of the `ivec2` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2i: function (name, x, y, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set2i(name, x, y); + + return this; + }, + + /** + * Sets a 3i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec3` uniform. + * @param {number} y - The new Y component of the `ivec3` uniform. + * @param {number} z - The new Z component of the `ivec3` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3i: function (name, x, y, z, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set3i(name, x, y, z); + + return this; + }, + + /** + * Sets a 4i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform. + * @param {number} y - Y component of the uniform. + * @param {number} z - Z component of the uniform. + * @param {number} w - W component of the uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4i: function (name, x, y, z, w, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.set4i(name, x, y, z, w); + + return this; + }, + + /** + * Sets a matrix 2fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {number[]|Float32Array} matrix - The new values for the `mat2` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setMatrix2fv: function (name, transpose, matrix, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.setMatrix2fv(name, transpose, matrix); + + return this; + }, + + /** + * Sets a matrix 3fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat3` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setMatrix3fv: function (name, transpose, matrix, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.setMatrix3fv(name, transpose, matrix); + + return this; + }, + + /** + * Sets a matrix 4fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Should the matrix be transpose + * @param {Float32Array} matrix - Matrix data + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setMatrix4fv: function (name, transpose, matrix, shader) + { + if (shader === undefined) { shader = this.currentShader; } + + shader.setMatrix4fv(name, transpose, matrix); + + return this; + }, + + /** + * Destroys all shader instances, removes all object references and nulls all external references. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy + * @since 3.0.0 + * + * @return {this} This WebGLPipeline instance. + */ + destroy: function () + { + var i; + + var shaders = this.shaders; + + for (i = 0; i < shaders.length; i++) + { + shaders[i].destroy(); + } + + var targets = this.renderTargets; + + for (i = 0; i < targets.length; i++) + { + targets[i].destroy(); + } + + this.gl.deleteBuffer(this.vertexBuffer); + + var renderer = this.renderer; + + renderer.off(Events.RESIZE, this.resize, this); + renderer.off(Events.PRE_RENDER, this.onPreRender, this); + renderer.off(Events.RENDER, this.onRender, this); + renderer.off(Events.POST_RENDER, this.onPostRender, this); + + this.game = null; + this.renderer = null; + this.manager = null; + this.gl = null; + this.view = null; + this.shaders = null; + this.renderTargets = null; + this.bytes = null; + this.vertexViewF32 = null; + this.vertexViewU32 = null; + this.vertexData = null; + this.vertexBuffer = null; + this.currentShader = null; + this.currentRenderTarget = null; + + return this; + } + +}); + +module.exports = WebGLPipeline; + + +/***/ }), +/* 76 */ /***/ (function(module, exports) { /** @@ -13487,9 +19302,9 @@ module.exports = Circle; * @function Phaser.Utils.Objects.Clone * @since 3.0.0 * - * @param {object} obj - the object from which to clone + * @param {object} obj - The object to clone. * - * @return {object} a new object with the same properties as the input obj + * @return {object} A new object with the same properties as the input object. */ var Clone = function (obj) { @@ -13514,7 +19329,7 @@ module.exports = Clone; /***/ }), -/* 70 */ +/* 77 */ /***/ (function(module, exports) { /** @@ -13530,8 +19345,8 @@ module.exports = Clone; * @since 3.4.0 * * @param {array} array - The array to check. - * @param {integer} startIndex - The start index. - * @param {integer} endIndex - The end index. + * @param {number} startIndex - The start index. + * @param {number} endIndex - The end index. * @param {boolean} [throwError=true] - Throw an error if the range is out of bounds. * * @return {boolean} True if the range is safe, otherwise false. @@ -13563,7 +19378,7 @@ module.exports = SafeRange; /***/ }), -/* 71 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -13572,8 +19387,8 @@ module.exports = SafeRange; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var EaseMap = __webpack_require__(123); -var UppercaseFirst = __webpack_require__(191); +var EaseMap = __webpack_require__(129); +var UppercaseFirst = __webpack_require__(196); /** * This internal function is used to return the correct ease function for a Tween. @@ -13672,7 +19487,7 @@ module.exports = GetEaseFunction; /***/ }), -/* 72 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -13681,7 +19496,7 @@ module.exports = GetEaseFunction; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders a stroke outline around the given Shape. @@ -13699,7 +19514,7 @@ var Utils = __webpack_require__(10); var StrokePathWebGL = function (pipeline, src, alpha, dx, dy) { var strokeTint = pipeline.strokeTint; - var strokeTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.strokeColor, src.strokeAlpha * alpha); + var strokeTintColor = Utils.getTintAppendFloatAlpha(src.strokeColor, src.strokeAlpha * alpha); strokeTint.TL = strokeTintColor; strokeTint.TR = strokeTintColor; @@ -13724,8 +19539,6 @@ var StrokePathWebGL = function (pipeline, src, alpha, dx, dy) var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - pipeline.setTexture2D(); - pipeline.batchLine( px1, py1, @@ -13747,7 +19560,7 @@ module.exports = StrokePathWebGL; /***/ }), -/* 73 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -13757,12 +19570,12 @@ module.exports = StrokePathWebGL; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(85); -var GetPoint = __webpack_require__(443); -var GetPoints = __webpack_require__(444); -var GEOM_CONST = __webpack_require__(49); -var Line = __webpack_require__(40); -var Random = __webpack_require__(168); +var Contains = __webpack_require__(110); +var GetPoint = __webpack_require__(453); +var GetPoints = __webpack_require__(454); +var GEOM_CONST = __webpack_require__(55); +var Line = __webpack_require__(45); +var Random = __webpack_require__(173); /** * @classdesc @@ -13800,7 +19613,7 @@ var Triangle = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Triangle#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -13909,7 +19722,7 @@ var Triangle = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - Number of points to be generated. Can be falsey when `stepRate` should be used. All points have the same distance along the triangle. + * @param {number} quantity - Number of points to be generated. Can be falsey when `stepRate` should be used. All points have the same distance along the triangle. * @param {number} [stepRate] - Distance between two points. Will only be used when `quantity` is falsey. * @param {(array|Phaser.Geom.Point[])} [output] - Optional Array for writing the calculated points into. Otherwise a new array will be created. * @@ -14194,281 +20007,7 @@ module.exports = Triangle; /***/ }), -/* 74 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); -var File = __webpack_require__(22); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); - -/** - * @classdesc - * A single Image File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#image method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#image. - * - * @class ImageFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets. - */ -var ImageFile = new Class({ - - Extends: File, - - initialize: - - function ImageFile (loader, key, url, xhrSettings, frameConfig) - { - var extension = 'png'; - var normalMapURL; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - normalMapURL = GetFastValue(config, 'normalMap'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - frameConfig = GetFastValue(config, 'frameConfig'); - } - - if (Array.isArray(url)) - { - normalMapURL = url[1]; - url = url[0]; - } - - var fileConfig = { - type: 'image', - cache: loader.textureManager, - extension: extension, - responseType: 'blob', - key: key, - url: url, - xhrSettings: xhrSettings, - config: frameConfig - }; - - File.call(this, loader, fileConfig); - - // Do we have a normal map to load as well? - if (normalMapURL) - { - var normalMap = new ImageFile(loader, this.key, normalMapURL, xhrSettings, frameConfig); - - normalMap.type = 'normalMap'; - - this.setLink(normalMap); - - loader.addFile(normalMap); - } - }, - - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.ImageFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; - - this.data = new Image(); - - this.data.crossOrigin = this.crossOrigin; - - var _this = this; - - this.data.onload = function () - { - File.revokeObjectURL(_this.data); - - _this.onProcessComplete(); - }; - - this.data.onerror = function () - { - File.revokeObjectURL(_this.data); - - _this.onProcessError(); - }; - - File.createObjectURL(this.data, this.xhrLoader.response, 'image/png'); - }, - - /** - * Adds this file to its target cache upon successful loading and processing. - * - * @method Phaser.Loader.FileTypes.ImageFile#addToCache - * @since 3.7.0 - */ - addToCache: function () - { - var texture; - var linkFile = this.linkFile; - - if (linkFile && linkFile.state === CONST.FILE_COMPLETE) - { - if (this.type === 'image') - { - texture = this.cache.addImage(this.key, this.data, linkFile.data); - } - else - { - texture = this.cache.addImage(linkFile.key, linkFile.data, this.data); - } - - this.pendingDestroy(texture); - - linkFile.pendingDestroy(texture); - } - else if (!linkFile) - { - texture = this.cache.addImage(this.key, this.data); - - this.pendingDestroy(texture); - } - } - -}); - -/** - * Adds an Image, or array of Images, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.image('logo', 'images/phaserLogo.png'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. - * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback - * of animated gifs to Canvas elements. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.image({ - * key: 'logo', - * url: 'images/AtariLogo.png' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.ImageFileConfig` for more details. - * - * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: - * - * ```javascript - * this.load.image('logo', 'images/AtariLogo.png'); - * // and later in your game ... - * this.add.image(x, y, 'logo'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, - * then you can specify it by providing an array as the `url` where the second element is the normal map: - * - * ```javascript - * this.load.image('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ]); - * ``` - * - * Or, if you are using a config object use the `normalMap` property: - * - * ```javascript - * this.load.image({ - * key: 'logo', - * url: 'images/AtariLogo.png', - * normalMap: 'images/AtariLogo-n.png' - * }); - * ``` - * - * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. - * Normal maps are a WebGL only feature. - * - * Note: The ability to load this type of file will only be available if the Image File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#image - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('image', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new ImageFile(this, key[i])); - } - } - else - { - this.addFile(new ImageFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = ImageFile; - - -/***/ }), -/* 75 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -14477,9 +20016,10 @@ module.exports = ImageFile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CONST = __webpack_require__(29); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Rectangle = __webpack_require__(465); +var Rectangle = __webpack_require__(479); /** * @classdesc @@ -14497,15 +20037,15 @@ var Rectangle = __webpack_require__(465); * @extends Phaser.GameObjects.Components.Visible * * @param {Phaser.Tilemaps.LayerData} layer - The LayerData object in the Tilemap that this tile belongs to. - * @param {integer} index - The unique index of this tile within the map. - * @param {integer} x - The x coordinate of this tile in tile coordinates. - * @param {integer} y - The y coordinate of this tile in tile coordinates. - * @param {integer} width - Width of the tile in pixels. - * @param {integer} height - Height of the tile in pixels. - * @param {integer} baseWidth - The base width a tile in the map (in pixels). Tiled maps support + * @param {number} index - The unique index of this tile within the map. + * @param {number} x - The x coordinate of this tile in tile coordinates. + * @param {number} y - The y coordinate of this tile in tile coordinates. + * @param {number} width - Width of the tile in pixels. + * @param {number} height - Height of the tile in pixels. + * @param {number} baseWidth - The base width a tile in the map (in pixels). Tiled maps support * multiple tileset sizes within one map, but they are still placed at intervals of the base * tile width. - * @param {integer} baseHeight - The base height of the tile in pixels (in pixels). Tiled maps + * @param {number} baseHeight - The base height of the tile in pixels (in pixels). Tiled maps * support multiple tileset sizes within one map, but they are still placed at intervals of the * base tile height. */ @@ -14535,7 +20075,7 @@ var Tile = new Class({ * represents a blank tile. * * @name Phaser.Tilemaps.Tile#index - * @type {integer} + * @type {number} * @since 3.0.0 */ this.index = index; @@ -14544,7 +20084,7 @@ var Tile = new Class({ * The x map coordinate of this tile in tile units. * * @name Phaser.Tilemaps.Tile#x - * @type {integer} + * @type {number} * @since 3.0.0 */ this.x = x; @@ -14553,7 +20093,7 @@ var Tile = new Class({ * The y map coordinate of this tile in tile units. * * @name Phaser.Tilemaps.Tile#y - * @type {integer} + * @type {number} * @since 3.0.0 */ this.y = y; @@ -14562,7 +20102,7 @@ var Tile = new Class({ * The width of the tile in pixels. * * @name Phaser.Tilemaps.Tile#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width = width; @@ -14571,27 +20111,49 @@ var Tile = new Class({ * The height of the tile in pixels. * * @name Phaser.Tilemaps.Tile#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height = height; /** - * The map's base width of a tile in pixels. Tiled maps support multiple tileset sizes + * The right of the tile in pixels. + * + * Set in the `updatePixelXY` method. + * + * @name Phaser.Tilemaps.Tile#right + * @type {number} + * @since 3.50.0 + */ + this.right; + + /** + * The bottom of the tile in pixels. + * + * Set in the `updatePixelXY` method. + * + * @name Phaser.Tilemaps.Tile#bottom + * @type {number} + * @since 3.50.0 + */ + this.bottom; + + /** + * The maps base width of a tile in pixels. Tiled maps support multiple tileset sizes * within one map, but they are still placed at intervals of the base tile size. * * @name Phaser.Tilemaps.Tile#baseWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.baseWidth = (baseWidth !== undefined) ? baseWidth : width; /** - * The map's base height of a tile in pixels. Tiled maps support multiple tileset sizes + * The maps base height of a tile in pixels. Tiled maps support multiple tileset sizes * within one map, but they are still placed at intervals of the base tile size. * * @name Phaser.Tilemaps.Tile#baseHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.baseHeight = (baseHeight !== undefined) ? baseHeight : height; @@ -14675,7 +20237,7 @@ var Tile = new Class({ this.collideDown = false; /** - * Whether the tile's left edge is interesting for collisions. + * Whether the tiles left edge is interesting for collisions. * * @name Phaser.Tilemaps.Tile#faceLeft * @type {boolean} @@ -14684,7 +20246,7 @@ var Tile = new Class({ this.faceLeft = false; /** - * Whether the tile's right edge is interesting for collisions. + * Whether the tiles right edge is interesting for collisions. * * @name Phaser.Tilemaps.Tile#faceRight * @type {boolean} @@ -14693,7 +20255,7 @@ var Tile = new Class({ this.faceRight = false; /** - * Whether the tile's top edge is interesting for collisions. + * Whether the tiles top edge is interesting for collisions. * * @name Phaser.Tilemaps.Tile#faceTop * @type {boolean} @@ -14702,7 +20264,7 @@ var Tile = new Class({ this.faceTop = false; /** - * Whether the tile's bottom edge is interesting for collisions. + * Whether the tiles bottom edge is interesting for collisions. * * @name Phaser.Tilemaps.Tile#faceBottom * @type {boolean} @@ -14717,7 +20279,7 @@ var Tile = new Class({ * @type {function} * @since 3.0.0 */ - this.collisionCallback = null; + this.collisionCallback = undefined; /** * The context in which the collision callback will be called. @@ -14775,7 +20337,7 @@ var Tile = new Class({ * * @param {Phaser.Tilemaps.Tile} tile - The tile to copy from. * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ copy: function (tile) { @@ -14804,7 +20366,7 @@ var Tile = new Class({ * @method Phaser.Tilemaps.Tile#getCollisionGroup * @since 3.0.0 * - * @return {?object} tileset + * @return {?object} The collision group for this Tile, as defined in the Tileset, or `null` if no group was defined. */ getCollisionGroup: function () { @@ -14820,7 +20382,7 @@ var Tile = new Class({ * @method Phaser.Tilemaps.Tile#getTileData * @since 3.0.0 * - * @return {?object} tileset + * @return {?object} The tile data for this Tile, as defined in the Tileset, or `null` if no data was defined. */ getTileData: function () { @@ -14836,7 +20398,7 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The left (x) value of this tile. */ getLeft: function (camera) { @@ -14854,7 +20416,7 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The right (x) value of this tile. */ getRight: function (camera) { @@ -14872,7 +20434,7 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The top (y) value of this tile. */ getTop: function (camera) { @@ -14895,11 +20457,12 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The bottom (y) value of this tile. */ getBottom: function (camera) { var tilemapLayer = this.tilemapLayer; + return tilemapLayer ? this.getTop(camera) + this.height * tilemapLayer.scaleY : this.getTop(camera) + this.height; @@ -14916,7 +20479,7 @@ var Tile = new Class({ * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * @param {Phaser.Geom.Rectangle} [output] - Optional Rectangle object to store the results in. * - * @return {(Phaser.Geom.Rectangle|object)} + * @return {(Phaser.Geom.Rectangle|object)} The bounds of this Tile. */ getBounds: function (camera, output) { @@ -14939,7 +20502,7 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The center x position of this Tile. */ getCenterX: function (camera) { @@ -14955,26 +20518,13 @@ var Tile = new Class({ * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. * - * @return {number} + * @return {number} The center y position of this Tile. */ getCenterY: function (camera) { return (this.getTop(camera) + this.getBottom(camera)) / 2; }, - /** - * Clean up memory. - * - * @method Phaser.Tilemaps.Tile#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.collisionCallback = undefined; - this.collisionCallbackContext = undefined; - this.properties = undefined; - }, - /** * Check for intersection with this tile. This does not factor in camera scroll, layer scale or * layer position. @@ -14987,7 +20537,7 @@ var Tile = new Class({ * @param {number} right - The right point. * @param {number} bottom - The bottom point. * - * @return {boolean} + * @return {boolean} `true` if the Tile intersects with the given dimensions, otherwise `false`. */ intersects: function (x, y, right, bottom) { @@ -15010,9 +20560,19 @@ var Tile = new Class({ */ isInteresting: function (collides, faces) { - if (collides && faces) { return (this.canCollide || this.hasInterestingFace); } - else if (collides) { return this.collides; } - else if (faces) { return this.hasInterestingFace; } + if (collides && faces) + { + return (this.canCollide || this.hasInterestingFace); + } + else if (collides) + { + return this.collides; + } + else if (faces) + { + return this.hasInterestingFace; + } + return false; }, @@ -15024,7 +20584,7 @@ var Tile = new Class({ * * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces for this tile and its neighbors. * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ resetCollision: function (recalculateFaces) { @@ -15059,7 +20619,7 @@ var Tile = new Class({ * @method Phaser.Tilemaps.Tile#resetFaces * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ resetFaces: function () { @@ -15081,10 +20641,9 @@ var Tile = new Class({ * @param {boolean} [right] - Indicating collide with any object on the right. * @param {boolean} [up] - Indicating collide with any object on the top. * @param {boolean} [down] - Indicating collide with any object on the bottom. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces - * for this tile and its neighbors. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces for this tile and its neighbors. * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ setCollision: function (left, right, up, down, recalculateFaces) { @@ -15126,7 +20685,7 @@ var Tile = new Class({ * @param {function} callback - Callback function. * @param {object} context - Callback will be called within this context. * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ setCollisionCallback: function (callback, context) { @@ -15150,12 +20709,12 @@ var Tile = new Class({ * @method Phaser.Tilemaps.Tile#setSize * @since 3.0.0 * - * @param {integer} tileWidth - The width of the tile in pixels. - * @param {integer} tileHeight - The height of the tile in pixels. - * @param {integer} baseWidth - The base width a tile in the map (in pixels). - * @param {integer} baseHeight - The base height of the tile in pixels (in pixels). + * @param {number} tileWidth - The width of the tile in pixels. + * @param {number} tileHeight - The height of the tile in pixels. + * @param {number} baseWidth - The base width a tile in the map (in pixels). + * @param {number} baseHeight - The base height of the tile in pixels (in pixels). * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ setSize: function (tileWidth, tileHeight, baseWidth, baseHeight) { @@ -15170,26 +20729,67 @@ var Tile = new Class({ }, /** - * Used internally. Updates the tile's world XY position based on the current tile size. + * Used internally. Updates the tiles world XY position based on the current tile size. * * @method Phaser.Tilemaps.Tile#updatePixelXY * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile} This Tile object. + * @return {this} This Tile object instance. */ updatePixelXY: function () { - // Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the - // bottom left, while the Phaser renderer assumes the origin is the top left. The y - // coordinate needs to be adjusted by the difference. - this.pixelX = this.x * this.baseWidth; - this.pixelY = this.y * this.baseHeight; + var orientation = this.layer.orientation; - // this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight); + if (orientation === CONST.ORTHOGONAL) + { + // In orthogonal mode, Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the + // bottom left, while the Phaser renderer assumes the origin is the top left. The y + // coordinate needs to be adjusted by the difference. + + this.pixelX = this.x * this.baseWidth; + this.pixelY = this.y * this.baseHeight; + } + else if (orientation === CONST.ISOMETRIC) + { + // Reminder: For the tilemap to be centered we have to move the image to the right with the camera! + // This is crucial for wordtotile, tiletoworld to work. + + this.pixelX = (this.x - this.y) * this.baseWidth * 0.5; + this.pixelY = (this.x + this.y) * this.baseHeight * 0.5; + } + else if (orientation === CONST.STAGGERED) + { + this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); + this.pixelY = this.y * (this.baseHeight / 2); + } + else if (orientation === CONST.HEXAGONAL) + { + var len = this.layer.hexSideLength; + var rowHeight = ((this.baseHeight - len) / 2 + len); + + this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); + this.pixelY = this.y * rowHeight; + } + + this.right = this.pixelX + this.baseWidth; + this.bottom = this.pixelY + this.baseHeight; return this; }, + /** + * Clean up memory. + * + * @method Phaser.Tilemaps.Tile#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.collisionCallback = undefined; + this.collisionCallbackContext = undefined; + this.properties = undefined; + }, + /** * True if this tile can collide on any of its faces or has a collision callback set. * @@ -15199,10 +20799,12 @@ var Tile = new Class({ * @since 3.0.0 */ canCollide: { + get: function () { - return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown || this.collisionCallback); + return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown || (this.collisionCallback !== undefined)); } + }, /** @@ -15214,10 +20816,12 @@ var Tile = new Class({ * @since 3.0.0 */ collides: { + get: function () { return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown); } + }, /** @@ -15229,16 +20833,18 @@ var Tile = new Class({ * @since 3.0.0 */ hasInterestingFace: { + get: function () { return (this.faceTop || this.faceBottom || this.faceLeft || this.faceRight); } + }, /** * The tileset that contains this Tile. This is null if accessed from a LayerData instance - * before the tile is placed in a StaticTilemapLayer or DynamicTilemapLayer, or if the tile has - * an index that doesn't correspond to any of the map's tilesets. + * before the tile is placed in a TilemapLayer, or if the tile has an index that doesn't correspond + * to any of the maps tilesets. * * @name Phaser.Tilemaps.Tile#tileset * @type {?Phaser.Tilemaps.Tileset} @@ -15268,24 +20874,25 @@ var Tile = new Class({ /** * The tilemap layer that contains this Tile. This will only return null if accessed from a - * LayerData instance before the tile is placed within a StaticTilemapLayer or - * DynamicTilemapLayer. + * LayerData instance before the tile is placed within a TilemapLayer. * * @name Phaser.Tilemaps.Tile#tilemapLayer - * @type {?Phaser.Tilemaps.StaticTilemapLayer|Phaser.Tilemaps.DynamicTilemapLayer} + * @type {?Phaser.Tilemaps.TilemapLayer} * @readonly * @since 3.0.0 */ tilemapLayer: { + get: function () { return this.layer.tilemapLayer; } + }, /** * The tilemap that contains this Tile. This will only return null if accessed from a LayerData - * instance before the tile is placed within a StaticTilemapLayer or DynamicTilemapLayer. + * instance before the tile is placed within a TilemapLayer. * * @name Phaser.Tilemaps.Tile#tilemap * @type {?Phaser.Tilemaps.Tilemap} @@ -15293,11 +20900,14 @@ var Tile = new Class({ * @since 3.0.0 */ tilemap: { + get: function () { var tilemapLayer = this.tilemapLayer; + return tilemapLayer ? tilemapLayer.tilemap : null; } + } }); @@ -15306,8 +20916,8 @@ module.exports = Tile; /***/ }), -/* 76 */ -/***/ (function(module, exports, __webpack_require__) { +/* 82 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -15315,481 +20925,94 @@ module.exports = Tile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AnimationState = __webpack_require__(157); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); -var SpriteRender = __webpack_require__(991); - -/** - * @classdesc - * A Sprite Game Object. - * - * A Sprite Game Object is used for the display of both static and animated images in your game. - * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled - * and animated. - * - * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. - * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation - * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. - * - * @class Sprite - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.TextureCrop - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - */ -var Sprite = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.Pipeline, - Components.ScrollFactor, - Components.Size, - Components.TextureCrop, - Components.Tint, - Components.Transform, - Components.Visible, - SpriteRender - ], - - initialize: - - function Sprite (scene, x, y, texture, frame) - { - GameObject.call(this, scene, 'Sprite'); - - /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. - * - * @name Phaser.GameObjects.Sprite#_crop - * @type {object} - * @private - * @since 3.11.0 - */ - this._crop = this.resetCropObject(); - - /** - * The Animation State component of this Sprite. - * - * This component provides features to apply animations to this Sprite. - * It is responsible for playing, loading, queuing animations for later playback, - * mixing between animations and setting the current animation frame to this Sprite. - * - * @name Phaser.GameObjects.Sprite#anims - * @type {Phaser.Animations.AnimationState} - * @since 3.0.0 - */ - this.anims = new AnimationState(this); - - this.setTexture(texture, frame); - this.setPosition(x, y); - this.setSizeToFrame(); - this.setOriginFromFrame(); - this.initPipeline(); - - this.on(GameObjectEvents.ADDED_TO_SCENE, this.addedToScene, this); - this.on(GameObjectEvents.REMOVED_FROM_SCENE, this.removedFromScene, this); - }, - - // Overrides Game Object method - addedToScene: function () - { - this.scene.sys.updateList.add(this); - }, - - // Overrides Game Object method - removedFromScene: function () - { - this.scene.sys.updateList.remove(this); - }, +var PIPELINE_CONST = { /** - * Update this Sprite's animations. + * The Bitmap Mask Pipeline. * - * @method Phaser.GameObjects.Sprite#preUpdate - * @protected - * @since 3.0.0 - * - * @param {number} time - The current timestamp. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. - */ - preUpdate: function (time, delta) - { - this.anims.update(time, delta); - }, - - /** - * Start playing the given animation on this Sprite. - * - * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. - * - * The benefit of a global animation is that multiple Sprites can all play the same animation, without - * having to duplicate the data. You can just create it once and then play it on any Sprite. - * - * The following code shows how to create a global repeating animation. The animation will be created - * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': - * - * ```javascript - * var config = { - * key: 'run', - * frames: 'muybridge', - * frameRate: 15, - * repeat: -1 - * }; - * - * // This code should be run from within a Scene: - * this.anims.create(config); - * ``` - * - * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, - * you can call the `Animation.create` method instead. It accepts the exact same parameters as when - * creating a global animation, however the resulting data is kept locally in this Sprite. - * - * With the animation created, either globally or locally, you can now play it on this Sprite: - * - * ```javascript - * this.add.sprite(x, y).play('run'); - * ``` - * - * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config - * object instead: - * - * ```javascript - * this.add.sprite(x, y).play({ key: 'run', frameRate: 24 }); - * ``` - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * If you need a Sprite to be able to play both local and global animations, make sure they don't - * have conflicting keys. - * - * See the documentation for the `PlayAnimationConfig` config object for more details about this. - * - * Also, see the documentation in the Animation Manager for further details on creating animations. - * - * @method Phaser.GameObjects.Sprite#play - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.0.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. - * - * @return {this} This Game Object. - */ - play: function (key, ignoreIfPlaying) - { - return this.anims.play(key, ignoreIfPlaying); - }, - - /** - * Start playing the given animation on this Sprite, in reverse. - * - * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. - * - * The benefit of a global animation is that multiple Sprites can all play the same animation, without - * having to duplicate the data. You can just create it once and then play it on any Sprite. - * - * The following code shows how to create a global repeating animation. The animation will be created - * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': - * - * ```javascript - * var config = { - * key: 'run', - * frames: 'muybridge', - * frameRate: 15, - * repeat: -1 - * }; - * - * // This code should be run from within a Scene: - * this.anims.create(config); - * ``` - * - * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, - * you can call the `Animation.create` method instead. It accepts the exact same parameters as when - * creating a global animation, however the resulting data is kept locally in this Sprite. - * - * With the animation created, either globally or locally, you can now play it on this Sprite: - * - * ```javascript - * this.add.sprite(x, y).playReverse('run'); - * ``` - * - * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config - * object instead: - * - * ```javascript - * this.add.sprite(x, y).playReverse({ key: 'run', frameRate: 24 }); - * ``` - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * If you need a Sprite to be able to play both local and global animations, make sure they don't - * have conflicting keys. - * - * See the documentation for the `PlayAnimationConfig` config object for more details about this. - * - * Also, see the documentation in the Animation Manager for further details on creating animations. - * - * @method Phaser.GameObjects.Sprite#playReverse - * @fires Phaser.Animations.Events#ANIMATION_START + * @name Phaser.Renderer.WebGL.Pipelines.BITMAPMASK_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. - * - * @return {this} This Game Object. */ - playReverse: function (key, ignoreIfPlaying) - { - return this.anims.playReverse(key, ignoreIfPlaying); - }, + BITMAPMASK_PIPELINE: 'BitmapMaskPipeline', /** - * Waits for the specified delay, in milliseconds, then starts playback of the given animation. + * The Light 2D Pipeline. * - * If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here. - * - * If an animation is already running and a new animation is given to this method, it will wait for - * the given delay before starting the new animation. - * - * If no animation is currently running, the given one begins after the delay. - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * Prior to Phaser 3.50 this method was called 'delayedPlay'. - * - * @method Phaser.GameObjects.Components.Animation#playAfterDelay - * @fires Phaser.Animations.Events#ANIMATION_START + * @name Phaser.Renderer.WebGL.Pipelines.LIGHT_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {integer} delay - The delay, in milliseconds, to wait before starting the animation playing. - * - * @return {this} This Game Object. */ - playAfterDelay: function (key, delay) - { - return this.anims.playAfterDelay(key, delay); - }, + LIGHT_PIPELINE: 'Light2D', /** - * Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback - * of the given animation. + * The Single Texture Pipeline. * - * You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an - * idle animation to a walking animation, by making them blend smoothly into each other. - * - * If no animation is currently running, the given one will start immediately. - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * @method Phaser.GameObjects.Components.Animation#playAfterRepeat - * @fires Phaser.Animations.Events#ANIMATION_START + * @name Phaser.Renderer.WebGL.Pipelines.SINGLE_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {integer} [repeatCount=1] - How many times should the animation repeat before the next one starts? - * - * @return {this} This Game Object. */ - playAfterRepeat: function (key, repeatCount) - { - return this.anims.playAfterRepeat(key, repeatCount); - }, + SINGLE_PIPELINE: 'SinglePipeline', /** - * Sets an animation, or an array of animations, to be played immediately after the current one completes or stops. + * The Multi Texture Pipeline. * - * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, - * or have the `stop` method called directly on it. - * - * An animation set to repeat forever will never enter a completed state. - * - * You can chain a new animation at any point, including before the current one starts playing, during it, - * or when it ends (via its `animationcomplete` event). - * - * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained - * animations without impacting the animation they're playing. - * - * Call this method with no arguments to reset all currently chained animations. - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * @method Phaser.GameObjects.Sprite#chain + * @name Phaser.Renderer.WebGL.Pipelines.MULTI_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig|string[]|Phaser.Animations.Animation[]|Phaser.Types.Animations.PlayAnimationConfig[])} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object, or an array of them. - * - * @return {this} This Game Object. */ - chain: function (key) - { - return this.anims.chain(key); - }, + MULTI_PIPELINE: 'MultiPipeline', /** - * Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` events. + * The Rope Pipeline. * - * If no animation is playing, no event will be dispatched. - * - * If there is another animation queued (via the `chain` method) then it will start playing immediately. - * - * @method Phaser.GameObjects.Sprite#stop - * @fires Phaser.Animations.Events#ANIMATION_STOP + * @name Phaser.Renderer.WebGL.Pipelines.ROPE_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @return {this} This Game Object. */ - stop: function () - { - return this.anims.stop(); - }, + ROPE_PIPELINE: 'RopePipeline', /** - * Stops the current animation from playing after the specified time delay, given in milliseconds. + * The Graphics and Shapes Pipeline. * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * @method Phaser.GameObjects.Sprite#stopAfterDelay - * @fires Phaser.Animations.Events#ANIMATION_STOP + * @name Phaser.Renderer.WebGL.Pipelines.GRAPHICS_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {integer} delay - The number of milliseconds to wait before stopping this animation. - * - * @return {this} This Game Object. */ - stopAfterDelay: function (delay) - { - return this.anims.stopAfterDelay(delay); - }, + GRAPHICS_PIPELINE: 'GraphicsPipeline', /** - * Stops the current animation from playing after the given number of repeats. + * The Post FX Pipeline. * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * @method Phaser.GameObjects.Sprite#stopAfterRepeat - * @fires Phaser.Animations.Events#ANIMATION_STOP + * @name Phaser.Renderer.WebGL.Pipelines.POSTFX_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {integer} [repeatCount=1] - How many times should the animation repeat before stopping? - * - * @return {this} This Game Object. */ - stopAfterRepeat: function (repeatCount) - { - return this.anims.stopAfterRepeat(repeatCount); - }, + POSTFX_PIPELINE: 'PostFXPipeline', /** - * Stops the current animation from playing when it next sets the given frame. - * If this frame doesn't exist within the animation it will not stop it from playing. + * The Utility Pipeline. * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * @method Phaser.GameObjects.Sprite#stopOnFrame - * @fires Phaser.Animations.Events#ANIMATION_STOP + * @name Phaser.Renderer.WebGL.Pipelines.UTILITY_PIPELINE + * @type {string} + * @const * @since 3.50.0 - * - * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. - * - * @return {this} This Game Object. */ - stopOnFrame: function (frame) - { - return this.anims.stopOnFrame(frame); - }, + UTILITY_PIPELINE: 'UtilityPipeline' +}; - /** - * Build a JSON representation of this Sprite. - * - * @method Phaser.GameObjects.Sprite#toJSON - * @since 3.0.0 - * - * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. - */ - toJSON: function () - { - return Components.ToJSON(this); - }, - - /** - * Handles the pre-destroy step for the Sprite, which removes the Animation component. - * - * @method Phaser.GameObjects.Sprite#preDestroy - * @private - * @since 3.14.0 - */ - preDestroy: function () - { - this.anims.destroy(); - - this.anims = undefined; - } - -}); - -module.exports = Sprite; +module.exports = PIPELINE_CONST; /***/ }), -/* 77 */ +/* 83 */ /***/ (function(module, exports) { /** @@ -15817,7 +21040,7 @@ module.exports = GetCenterX; /***/ }), -/* 78 */ +/* 84 */ /***/ (function(module, exports) { /** @@ -15852,7 +21075,7 @@ module.exports = SetCenterX; /***/ }), -/* 79 */ +/* 85 */ /***/ (function(module, exports) { /** @@ -15880,7 +21103,7 @@ module.exports = GetCenterY; /***/ }), -/* 80 */ +/* 86 */ /***/ (function(module, exports) { /** @@ -15915,7 +21138,7 @@ module.exports = SetCenterY; /***/ }), -/* 81 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -15924,854 +21147,87 @@ module.exports = SetCenterY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - -var Class = __webpack_require__(0); +var SpliceOne = __webpack_require__(103); /** - * @classdesc - * A representation of a vector in 3D space. + * Removes the given item, or array of items, from the array. * - * A three-component vector. + * The array is modified in-place. * - * @class Vector3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 + * You can optionally specify a callback to be invoked for each item successfully removed from the array. * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. + * @function Phaser.Utils.Array.Remove + * @since 3.4.0 + * + * @param {array} array - The array to be modified. + * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. + * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. */ -var Vector3 = new Class({ - - initialize: - - function Vector3 (x, y, z) - { - /** - * The x component of this Vector. - * - * @name Phaser.Math.Vector3#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; - - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector3#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; - - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector3#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.z = 0; - - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - }, - - /** - * Set this Vector to point up. - * - * Sets the y component of the vector to 1, and the others to 0. - * - * @method Phaser.Math.Vector3#up - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - up: function () - { - this.x = 0; - this.y = 1; - this.z = 0; - - return this; - }, - - /** - * Make a clone of this Vector3. - * - * @method Phaser.Math.Vector3#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. - */ - clone: function () - { - return new Vector3(this.x, this.y, this.z); - }, - - /** - * Calculate the cross (vector) product of two given Vectors. - * - * @method Phaser.Math.Vector3#crossVectors - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} a - The first Vector to multiply. - * @param {Phaser.Math.Vector3} b - The second Vector to multiply. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - crossVectors: function (a, b) - { - var ax = a.x; - var ay = a.y; - var az = a.z; - var bx = b.x; - var by = b.y; - var bz = b.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict equality check against each Vector's components. - * - * @method Phaser.Math.Vector3#equals - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. - * - * @return {boolean} True if the two vectors strictly match, otherwise false. - */ - equals: function (v) - { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); - }, - - /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector3#copy - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - copy: function (src) - { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - - return this; - }, - - /** - * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. - * - * @method Phaser.Math.Vector3#set - * @since 3.0.0 - * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. - * @param {number} [y] - The y value to set for this Vector. - * @param {number} [z] - The z value to set for this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - set: function (x, y, z) - { - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } - - return this; - }, - - /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector3#add - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - - return this; - }, - - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector3#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - - return this; - }, - - /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - multiply: function (v) - { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - - return this; - }, - - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector3#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - scale: function (scale) - { - if (isFinite(scale)) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - } - else - { - this.x = 0; - this.y = 0; - this.z = 0; - } - - return this; - }, - - /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#divide - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - - return this; - }, - - /** - * Negate the `x`, `y` and `z` components of this Vector. - * - * @method Phaser.Math.Vector3#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - - return this; - }, - - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#distance - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - distance: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return Math.sqrt(dx * dx + dy * dy + dz * dz); - }, - - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector3#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - distanceSq: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - - return dx * dx + dy * dy + dz * dz; - }, - - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector3#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return Math.sqrt(x * x + y * y + z * z); - }, - - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector3#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - - return x * x + y * y + z * z; - }, - - /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. - * - * @method Phaser.Math.Vector3#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - normalize: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var len = x * x + y * y + z * z; - - if (len > 0) - { - len = 1 / Math.sqrt(len); - - this.x = x * len; - this.y = y * len; - this.z = z * len; - } - - return this; - }, - - /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#dot - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. - * - * @return {number} The dot product of this Vector and `v`. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z; - }, - - /** - * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. - * - * @method Phaser.Math.Vector3#cross - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector to cross product with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - cross: function (v) - { - var ax = this.x; - var ay = this.y; - var az = this.z; - var bx = v.x; - var by = v.y; - var bz = v.z; - - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - - return this; - }, - - /** - * Linearly interpolate between this Vector and the given Vector. - * - * Interpolates this Vector towards the given Vector. - * - * @method Phaser.Math.Vector3#lerp - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - lerp: function (v, t) - { - if (t === undefined) { t = 0; } - - var ax = this.x; - var ay = this.y; - var az = this.z; - - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat3: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = x * m[0] + y * m[3] + z * m[6]; - this.y = x * m[1] + y * m[4] + z * m[7]; - this.z = x * m[2] + y * m[5] + z * m[8]; - - return this; - }, - - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector3#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; - this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; - this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; - - return this; - }, - - /** - * Transforms the coordinates of this Vector3 with the given Matrix4. - * - * @method Phaser.Math.Vector3#transformCoordinates - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformCoordinates: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; - var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; - var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; - var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; - - this.x = tx / tw; - this.y = ty / tw; - this.z = tz / tw; - - return this; - }, - - /** - * Transform this Vector with the given Quaternion. - * - * @method Phaser.Math.Vector3#transformQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformQuat: function (q) - { - // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations - var x = this.x; - var y = this.y; - var z = this.z; - var qx = q.x; - var qy = q.y; - var qz = q.z; - var qw = q.w; - - // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; - - // calculate result * inverse quat - this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; - this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; - this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; - - return this; - }, - - /** - * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, - * e.g. unprojecting a 2D point into 3D space. - * - * @method Phaser.Math.Vector3#project - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - project: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var a00 = m[0]; - var a01 = m[1]; - var a02 = m[2]; - var a03 = m[3]; - var a10 = m[4]; - var a11 = m[5]; - var a12 = m[6]; - var a13 = m[7]; - var a20 = m[8]; - var a21 = m[9]; - var a22 = m[10]; - var a23 = m[11]; - var a30 = m[12]; - var a31 = m[13]; - var a32 = m[14]; - var a33 = m[15]; - - var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); - - this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; - this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; - this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; - - return this; - }, - - /** - * Unproject this point from 2D space to 3D space. - * The point should have its x and y properties set to - * 2D screen space, and the z either at 0 (near plane) - * or 1 (far plane). The provided matrix is assumed to already - * be combined, i.e. projection * view * model. - * - * After this operation, this vector's (x, y, z) components will - * represent the unprojected 3D coordinate. - * - * @method Phaser.Math.Vector3#unproject - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. - * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - unproject: function (viewport, invProjectionView) - { - var viewX = viewport.x; - var viewY = viewport.y; - var viewWidth = viewport.z; - var viewHeight = viewport.w; - - var x = this.x - viewX; - var y = (viewHeight - this.y - 1) - viewY; - var z = this.z; - - this.x = (2 * x) / viewWidth - 1; - this.y = (2 * y) / viewHeight - 1; - this.z = 2 * z - 1; - - return this.project(invProjectionView); - }, - - /** - * Make this Vector the zero vector (0, 0, 0). - * - * @method Phaser.Math.Vector3#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - - return this; - } - -}); - -/** - * A static zero Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.ZERO - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.ZERO = new Vector3(); - -/** - * A static right Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.RIGHT - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.RIGHT = new Vector3(1, 0, 0); - -/** - * A static left Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.LEFT - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.LEFT = new Vector3(-1, 0, 0); - -/** - * A static up Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.UP - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.UP = new Vector3(0, -1, 0); - -/** - * A static down Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.DOWN - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.DOWN = new Vector3(0, 1, 0); - -/** - * A static forward Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.FORWARD - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.FORWARD = new Vector3(0, 0, 1); - -/** - * A static back Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.BACK - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.BACK = new Vector3(0, 0, -1); - -/** - * A static one Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.ONE - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.ONE = new Vector3(1, 1, 1); - -module.exports = Vector3; - - -/***/ }), -/* 82 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Removes a single item from an array and returns it without creating gc, like the native splice does. - * Based on code by Mike Reinstein. - * - * @function Phaser.Utils.Array.SpliceOne - * @since 3.0.0 - * - * @param {array} array - The array to splice from. - * @param {integer} index - The index of the item which should be spliced. - * - * @return {*} The item which was spliced (removed). - */ -var SpliceOne = function (array, index) +var Remove = function (array, item, callback, context) { - if (index >= array.length) + if (context === undefined) { context = array; } + + var index; + + // Fast path to avoid array mutation and iteration + if (!Array.isArray(item)) { - return; + index = array.indexOf(item); + + if (index !== -1) + { + SpliceOne(array, index); + + if (callback) + { + callback.call(context, item); + } + + return item; + } + else + { + return null; + } } - var len = array.length - 1; + // If we got this far, we have an array of items to remove - var item = array[index]; + var itemLength = item.length - 1; + var removed = []; - for (var i = index; i < len; i++) + while (itemLength >= 0) { - array[i] = array[i + 1]; + var entry = item[itemLength]; + + index = array.indexOf(entry); + + if (index !== -1) + { + SpliceOne(array, index); + + removed.push(entry); + + if (callback) + { + callback.call(context, entry); + } + } + + itemLength--; } - array.length = len; - - return item; + return removed; }; -module.exports = SpliceOne; +module.exports = Remove; /***/ }), -/* 83 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -16781,7 +21237,7 @@ module.exports = SpliceOne; */ var Class = __webpack_require__(0); -var FromPoints = __webpack_require__(186); +var FromPoints = __webpack_require__(191); var Rectangle = __webpack_require__(9); var Vector2 = __webpack_require__(3); @@ -16817,7 +21273,7 @@ var Curve = new Class({ * The default number of divisions within the curve. * * @name Phaser.Curves.Curve#defaultDivisions - * @type {integer} + * @type {number} * @default 5 * @since 3.0.0 */ @@ -16827,7 +21283,7 @@ var Curve = new Class({ * The quantity of arc length divisions within the curve. * * @name Phaser.Curves.Curve#arcLengthDivisions - * @type {integer} + * @type {number} * @default 100 * @since 3.0.0 */ @@ -16896,7 +21352,7 @@ var Curve = new Class({ * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] * * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. - * @param {integer} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. + * @param {number} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. * * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. */ @@ -16918,7 +21374,7 @@ var Curve = new Class({ * @since 3.0.0 * * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. If falsey a new object will be created. - * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. + * @param {number} [accuracy=16] - The accuracy of the bounds calculations. * * @return {Phaser.Geom.Rectangle} A Rectangle object holding the bounds of this curve. If `out` was given it will be this object. */ @@ -16949,7 +21405,7 @@ var Curve = new Class({ * @method Phaser.Curves.Curve#getDistancePoints * @since 3.0.0 * - * @param {integer} distance - The distance, in pixels, between each point along the curve. + * @param {number} distance - The distance, in pixels, between each point along the curve. * * @return {Phaser.Geom.Point[]} An Array of Point objects. */ @@ -17009,7 +21465,7 @@ var Curve = new Class({ * @method Phaser.Curves.Curve#getLengths * @since 3.0.0 * - * @param {integer} [divisions] - The number of divisions or segments. + * @param {number} [divisions] - The number of divisions or segments. * * @return {number[]} An array of cumulative lengths. */ @@ -17091,7 +21547,7 @@ var Curve = new Class({ * * @generic {Phaser.Math.Vector2[]} O - [out,$return] * - * @param {integer} [divisions] - The number of divisions to make. + * @param {number} [divisions] - The number of divisions to make. * @param {number} [stepRate] - The curve distance between points, implying `divisions`. * @param {(array|Phaser.Math.Vector2[])} [out] - An optional array to store the points in. * @@ -17151,7 +21607,7 @@ var Curve = new Class({ * @method Phaser.Curves.Curve#getSpacedPoints * @since 3.0.0 * - * @param {integer} [divisions=this.defaultDivisions] - The number of divisions to make. + * @param {number} [divisions=this.defaultDivisions] - The number of divisions to make. * @param {number} [stepRate] - Step between points. Used to calculate the number of points to return when divisions is falsy. Ignored if divisions is positive. * @param {(array|Phaser.Math.Vector2[])} [out] - An optional array to store the points in. * @@ -17271,8 +21727,8 @@ var Curve = new Class({ * @method Phaser.Curves.Curve#getTFromDistance * @since 3.0.0 * - * @param {integer} distance - The distance, in pixels. - * @param {integer} [divisions] - Optional amount of divisions. + * @param {number} distance - The distance, in pixels. + * @param {number} [divisions] - Optional amount of divisions. * * @return {number} The distance. */ @@ -17293,8 +21749,8 @@ var Curve = new Class({ * @since 3.0.0 * * @param {number} u - A float between 0 and 1. - * @param {integer} distance - The distance, in pixels. - * @param {integer} [divisions] - Optional amount of divisions. + * @param {number} distance - The distance, in pixels. + * @param {number} [divisions] - Optional amount of divisions. * * @return {number} The equidistant value. */ @@ -17388,7 +21844,7 @@ module.exports = Curve; /***/ }), -/* 84 */ +/* 89 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -17403,75 +21859,198 @@ module.exports = Curve; module.exports = { - ADD: __webpack_require__(898), - COMPLETE: __webpack_require__(899), - FILE_COMPLETE: __webpack_require__(900), - FILE_KEY_COMPLETE: __webpack_require__(901), - FILE_LOAD_ERROR: __webpack_require__(902), - FILE_LOAD: __webpack_require__(903), - FILE_PROGRESS: __webpack_require__(904), - POST_PROCESS: __webpack_require__(905), - PROGRESS: __webpack_require__(906), - START: __webpack_require__(907) + ADD: __webpack_require__(954), + COMPLETE: __webpack_require__(955), + FILE_COMPLETE: __webpack_require__(956), + FILE_KEY_COMPLETE: __webpack_require__(957), + FILE_LOAD_ERROR: __webpack_require__(958), + FILE_LOAD: __webpack_require__(959), + FILE_PROGRESS: __webpack_require__(960), + POST_PROCESS: __webpack_require__(961), + PROGRESS: __webpack_require__(962), + START: __webpack_require__(963) }; /***/ }), -/* 85 */ +/* 90 */ /***/ (function(module, exports) { /** * @author Richard Davey + * @author Angry Bytes (and contributors) * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// http://www.blackpawn.com/texts/pointinpoly/ +/** + * The comparator function. + * + * @ignore + * + * @param {*} a - The first item to test. + * @param {*} b - The second itemt to test. + * + * @return {boolean} True if they localCompare, otherwise false. + */ +function Compare (a, b) +{ + return String(a).localeCompare(b); +} /** - * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds. + * Process the array contents. * - * @function Phaser.Geom.Triangle.Contains + * @ignore + * + * @param {array} array - The array to process. + * @param {function} compare - The comparison function. + * + * @return {array} - The processed array. + */ +function Process (array, compare) +{ + // Short-circuit when there's nothing to sort. + var len = array.length; + + if (len <= 1) + { + return array; + } + + // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc. + // Chunks are the size of the left or right hand in merge sort. + // Stop when the left-hand covers all of the array. + var buffer = new Array(len); + + for (var chk = 1; chk < len; chk *= 2) + { + RunPass(array, compare, chk, buffer); + + var tmp = array; + + array = buffer; + + buffer = tmp; + } + + return array; +} + +/** + * Run a single pass with the given chunk size. + * + * @ignore + * + * @param {array} arr - The array to run the pass on. + * @param {function} comp - The comparison function. + * @param {number} chk - The number of iterations. + * @param {array} result - The array to store the result in. + */ +function RunPass (arr, comp, chk, result) +{ + var len = arr.length; + var i = 0; + + // Step size / double chunk size. + var dbl = chk * 2; + + // Bounds of the left and right chunks. + var l, r, e; + + // Iterators over the left and right chunk. + var li, ri; + + // Iterate over pairs of chunks. + for (l = 0; l < len; l += dbl) + { + r = l + chk; + e = r + chk; + + if (r > len) + { + r = len; + } + + if (e > len) + { + e = len; + } + + // Iterate both chunks in parallel. + li = l; + ri = r; + + while (true) + { + // Compare the chunks. + if (li < r && ri < e) + { + // This works for a regular `sort()` compatible comparator, + // but also for a simple comparator like: `a > b` + if (comp(arr[li], arr[ri]) <= 0) + { + result[i++] = arr[li++]; + } + else + { + result[i++] = arr[ri++]; + } + } + else if (li < r) + { + // Nothing to compare, just flush what's left. + result[i++] = arr[li++]; + } + else if (ri < e) + { + result[i++] = arr[ri++]; + } + else + { + // Both iterators are at the chunk ends. + break; + } + } + } +} + +/** + * An in-place stable array sort, because `Array#sort()` is not guaranteed stable. + * + * This is an implementation of merge sort, without recursion. + * + * Function based on the Two-Screen/stable sort 0.1.8 from https://github.com/Two-Screen/stable + * + * @function Phaser.Utils.Array.StableSort * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to check. - * @param {number} x - The X coordinate of the point to check. - * @param {number} y - The Y coordinate of the point to check. + * @param {array} array - The input array to be sorted. + * @param {function} [compare] - The comparison function. * - * @return {boolean} `true` if the point is inside the Triangle, otherwise `false`. + * @return {array} The sorted result. */ -var Contains = function (triangle, x, y) +var StableSort = function (array, compare) { - var v0x = triangle.x3 - triangle.x1; - var v0y = triangle.y3 - triangle.y1; + if (compare === undefined) { compare = Compare; } - var v1x = triangle.x2 - triangle.x1; - var v1y = triangle.y2 - triangle.y1; + var result = Process(array, compare); - var v2x = x - triangle.x1; - var v2y = y - triangle.y1; + // This simply copies back if the result isn't in the original array, which happens on an odd number of passes. + if (result !== array) + { + RunPass(result, null, array.length, array); + } - var dot00 = (v0x * v0x) + (v0y * v0y); - var dot01 = (v0x * v1x) + (v0y * v1y); - var dot02 = (v0x * v2x) + (v0y * v2y); - var dot11 = (v1x * v1x) + (v1y * v1y); - var dot12 = (v1x * v2x) + (v1y * v2y); - - // Compute barycentric coordinates - var b = ((dot00 * dot11) - (dot01 * dot01)); - var inv = (b === 0) ? 0 : (1 / b); - var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; - var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; - - return (u >= 0 && v >= 0 && (u + v < 1)); + return array; }; -module.exports = Contains; +module.exports = StableSort; /***/ }), -/* 86 */ +/* 91 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -17547,7 +22126,7 @@ module.exports = LineToLine; /***/ }), -/* 87 */ +/* 92 */ /***/ (function(module, exports) { /** @@ -17575,7 +22154,7 @@ module.exports = Angle; /***/ }), -/* 88 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -17592,8 +22171,8 @@ var Vertices = {}; module.exports = Vertices; -var Vector = __webpack_require__(102); -var Common = __webpack_require__(44); +var Vector = __webpack_require__(114); +var Common = __webpack_require__(50); (function() { @@ -18036,7 +22615,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 89 */ +/* 94 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -18045,7 +22624,7 @@ var Common = __webpack_require__(44); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); /** * Return a value based on the range between `min` and `max` and the percentage given. @@ -18070,7 +22649,7 @@ module.exports = FromPercent; /***/ }), -/* 90 */ +/* 95 */ /***/ (function(module, exports) { /** @@ -18111,7 +22690,7 @@ module.exports = GetBoolean; /***/ }), -/* 91 */ +/* 96 */ /***/ (function(module, exports) { /** @@ -18126,7 +22705,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.CREATED - * @type {integer} + * @type {number} * @since 3.0.0 */ CREATED: 0, @@ -18135,7 +22714,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.INIT - * @type {integer} + * @type {number} * @since 3.0.0 */ INIT: 1, @@ -18144,7 +22723,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ DELAY: 2, @@ -18153,7 +22732,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.OFFSET_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ OFFSET_DELAY: 3, @@ -18162,7 +22741,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.PENDING_RENDER - * @type {integer} + * @type {number} * @since 3.0.0 */ PENDING_RENDER: 4, @@ -18171,7 +22750,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.PLAYING_FORWARD - * @type {integer} + * @type {number} * @since 3.0.0 */ PLAYING_FORWARD: 5, @@ -18180,7 +22759,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.PLAYING_BACKWARD - * @type {integer} + * @type {number} * @since 3.0.0 */ PLAYING_BACKWARD: 6, @@ -18189,7 +22768,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.HOLD_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ HOLD_DELAY: 7, @@ -18198,7 +22777,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.REPEAT_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ REPEAT_DELAY: 8, @@ -18207,7 +22786,7 @@ var TWEEN_CONST = { * TweenData state. * * @name Phaser.Tweens.COMPLETE - * @type {integer} + * @type {number} * @since 3.0.0 */ COMPLETE: 9, @@ -18218,7 +22797,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.PENDING_ADD - * @type {integer} + * @type {number} * @since 3.0.0 */ PENDING_ADD: 20, @@ -18227,7 +22806,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.PAUSED - * @type {integer} + * @type {number} * @since 3.0.0 */ PAUSED: 21, @@ -18236,7 +22815,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.LOOP_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ LOOP_DELAY: 22, @@ -18245,7 +22824,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.ACTIVE - * @type {integer} + * @type {number} * @since 3.0.0 */ ACTIVE: 23, @@ -18254,7 +22833,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.COMPLETE_DELAY - * @type {integer} + * @type {number} * @since 3.0.0 */ COMPLETE_DELAY: 24, @@ -18263,7 +22842,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.PENDING_REMOVE - * @type {integer} + * @type {number} * @since 3.0.0 */ PENDING_REMOVE: 25, @@ -18272,7 +22851,7 @@ var TWEEN_CONST = { * Tween state. * * @name Phaser.Tweens.REMOVED - * @type {integer} + * @type {number} * @since 3.0.0 */ REMOVED: 26 @@ -18283,7 +22862,714 @@ module.exports = TWEEN_CONST; /***/ }), -/* 92 */ +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Events = __webpack_require__(307); + +/** + * @callback DataEachCallback + * + * @param {*} parent - The parent object of the DataManager. + * @param {string} key - The key of the value. + * @param {*} value - The value. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. + */ + +/** + * @classdesc + * The Data Manager Component features a means to store pieces of data specific to a Game Object, System or Plugin. + * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, + * or have a property called `events` that is an instance of it. + * + * @class DataManager + * @memberof Phaser.Data + * @constructor + * @since 3.0.0 + * + * @param {object} parent - The object that this DataManager belongs to. + * @param {Phaser.Events.EventEmitter} [eventEmitter] - The DataManager's event emitter. + */ +var DataManager = new Class({ + + initialize: + + function DataManager (parent, eventEmitter) + { + /** + * The object that this DataManager belongs to. + * + * @name Phaser.Data.DataManager#parent + * @type {*} + * @since 3.0.0 + */ + this.parent = parent; + + /** + * The DataManager's event emitter. + * + * @name Phaser.Data.DataManager#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 + */ + this.events = eventEmitter; + + if (!eventEmitter) + { + this.events = (parent.events) ? parent.events : parent; + } + + /** + * The data list. + * + * @name Phaser.Data.DataManager#list + * @type {Object.} + * @default {} + * @since 3.0.0 + */ + this.list = {}; + + /** + * The public values list. You can use this to access anything you have stored + * in this Data Manager. For example, if you set a value called `gold` you can + * access it via: + * + * ```javascript + * this.data.values.gold; + * ``` + * + * You can also modify it directly: + * + * ```javascript + * this.data.values.gold += 1000; + * ``` + * + * Doing so will emit a `setdata` event from the parent of this Data Manager. + * + * Do not modify this object directly. Adding properties directly to this object will not + * emit any events. Always use `DataManager.set` to create new items the first time around. + * + * @name Phaser.Data.DataManager#values + * @type {Object.} + * @default {} + * @since 3.10.0 + */ + this.values = {}; + + /** + * Whether setting data is frozen for this DataManager. + * + * @name Phaser.Data.DataManager#_frozen + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this._frozen = false; + + if (!parent.hasOwnProperty('sys') && this.events) + { + this.events.once(Events.DESTROY, this.destroy, this); + } + }, + + /** + * Retrieves the value for the given key, or undefined if it doesn't exist. + * + * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: + * + * ```javascript + * this.data.get('gold'); + * ``` + * + * Or access the value directly: + * + * ```javascript + * this.data.values.gold; + * ``` + * + * You can also pass in an array of keys, in which case an array of values will be returned: + * + * ```javascript + * this.data.get([ 'gold', 'armor', 'health' ]); + * ``` + * + * This approach is useful for destructuring arrays in ES6. + * + * @method Phaser.Data.DataManager#get + * @since 3.0.0 + * + * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. + * + * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. + */ + get: function (key) + { + var list = this.list; + + if (Array.isArray(key)) + { + var output = []; + + for (var i = 0; i < key.length; i++) + { + output.push(list[key[i]]); + } + + return output; + } + else + { + return list[key]; + } + }, + + /** + * Retrieves all data values in a new object. + * + * @method Phaser.Data.DataManager#getAll + * @since 3.0.0 + * + * @return {Object.} All data values. + */ + getAll: function () + { + var results = {}; + + for (var key in this.list) + { + if (this.list.hasOwnProperty(key)) + { + results[key] = this.list[key]; + } + } + + return results; + }, + + /** + * Queries the DataManager for the values of keys matching the given regular expression. + * + * @method Phaser.Data.DataManager#query + * @since 3.0.0 + * + * @param {RegExp} search - A regular expression object. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj). + * + * @return {Object.} The values of the keys matching the search string. + */ + query: function (search) + { + var results = {}; + + for (var key in this.list) + { + if (this.list.hasOwnProperty(key) && key.match(search)) + { + results[key] = this.list[key]; + } + } + + return results; + }, + + /** + * Sets a value for the given key. If the key doesn't already exist in the Data Manager then it is created. + * + * ```javascript + * data.set('name', 'Red Gem Stone'); + * ``` + * + * You can also pass in an object of key value pairs as the first argument: + * + * ```javascript + * data.set({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); + * ``` + * + * To get a value back again you can call `get`: + * + * ```javascript + * data.get('gold'); + * ``` + * + * Or you can access the value directly via the `values` property, where it works like any other variable: + * + * ```javascript + * data.values.gold += 50; + * ``` + * + * When the value is first set, a `setdata` event is emitted. + * + * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. + * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. + * + * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.Data.DataManager#set + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.0.0 + * + * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. + * @param {*} data - The value to set for the given key. If an object is provided as the key this argument is ignored. + * + * @return {this} This DataManager object. + */ + set: function (key, data) + { + if (this._frozen) + { + return this; + } + + if (typeof key === 'string') + { + return this.setValue(key, data); + } + else + { + for (var entry in key) + { + this.setValue(entry, key[entry]); + } + } + + return this; + }, + + /** + * Increase a value for the given key. If the key doesn't already exist in the Data Manager then it is increased from 0. + * + * When the value is first set, a `setdata` event is emitted. + * + * @method Phaser.Data.DataManager#inc + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.23.0 + * + * @param {(string|object)} key - The key to increase the value for. + * @param {*} [data] - The value to increase for the given key. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + inc: function (key, data) + { + if (this._frozen) + { + return this; + } + + if (data === undefined) + { + data = 1; + } + + var value = this.get(key); + if (value === undefined) + { + value = 0; + } + + this.set(key, (value + data)); + + return this; + }, + + /** + * Toggle a boolean value for the given key. If the key doesn't already exist in the Data Manager then it is toggled from false. + * + * When the value is first set, a `setdata` event is emitted. + * + * @method Phaser.Data.DataManager#toggle + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.23.0 + * + * @param {(string|object)} key - The key to toggle the value for. + * + * @return {Phaser.Data.DataManager} This DataManager object. + */ + toggle: function (key) + { + if (this._frozen) + { + return this; + } + + this.set(key, !this.get(key)); + + return this; + }, + + /** + * Internal value setter, called automatically by the `set` method. + * + * @method Phaser.Data.DataManager#setValue + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @private + * @since 3.10.0 + * + * @param {string} key - The key to set the value for. + * @param {*} data - The value to set. + * + * @return {this} This DataManager object. + */ + setValue: function (key, data) + { + if (this._frozen) + { + return this; + } + + if (this.has(key)) + { + // Hit the key getter, which will in turn emit the events. + this.values[key] = data; + } + else + { + var _this = this; + var list = this.list; + var events = this.events; + var parent = this.parent; + + Object.defineProperty(this.values, key, { + + enumerable: true, + + configurable: true, + + get: function () + { + return list[key]; + }, + + set: function (value) + { + if (!_this._frozen) + { + var previousValue = list[key]; + list[key] = value; + + events.emit(Events.CHANGE_DATA, parent, key, value, previousValue); + events.emit(Events.CHANGE_DATA_KEY + key, parent, value, previousValue); + } + } + + }); + + list[key] = data; + + events.emit(Events.SET_DATA, parent, key, data); + } + + return this; + }, + + /** + * Passes all data entries to the given callback. + * + * @method Phaser.Data.DataManager#each + * @since 3.0.0 + * + * @param {DataEachCallback} callback - The function to call. + * @param {*} [context] - Value to use as `this` when executing callback. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. + * + * @return {this} This DataManager object. + */ + each: function (callback, context) + { + var args = [ this.parent, null, undefined ]; + + for (var i = 1; i < arguments.length; i++) + { + args.push(arguments[i]); + } + + for (var key in this.list) + { + args[1] = key; + args[2] = this.list[key]; + + callback.apply(context, args); + } + + return this; + }, + + /** + * Merge the given object of key value pairs into this DataManager. + * + * Any newly created values will emit a `setdata` event. Any updated values (see the `overwrite` argument) + * will emit a `changedata` event. + * + * @method Phaser.Data.DataManager#merge + * @fires Phaser.Data.Events#SET_DATA + * @fires Phaser.Data.Events#CHANGE_DATA + * @fires Phaser.Data.Events#CHANGE_DATA_KEY + * @since 3.0.0 + * + * @param {Object.} data - The data to merge. + * @param {boolean} [overwrite=true] - Whether to overwrite existing data. Defaults to true. + * + * @return {this} This DataManager object. + */ + merge: function (data, overwrite) + { + if (overwrite === undefined) { overwrite = true; } + + // Merge data from another component into this one + for (var key in data) + { + if (data.hasOwnProperty(key) && (overwrite || (!overwrite && !this.has(key)))) + { + this.setValue(key, data[key]); + } + } + + return this; + }, + + /** + * Remove the value for the given key. + * + * If the key is found in this Data Manager it is removed from the internal lists and a + * `removedata` event is emitted. + * + * You can also pass in an array of keys, in which case all keys in the array will be removed: + * + * ```javascript + * this.data.remove([ 'gold', 'armor', 'health' ]); + * ``` + * + * @method Phaser.Data.DataManager#remove + * @fires Phaser.Data.Events#REMOVE_DATA + * @since 3.0.0 + * + * @param {(string|string[])} key - The key to remove, or an array of keys to remove. + * + * @return {this} This DataManager object. + */ + remove: function (key) + { + if (this._frozen) + { + return this; + } + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + this.removeValue(key[i]); + } + } + else + { + return this.removeValue(key); + } + + return this; + }, + + /** + * Internal value remover, called automatically by the `remove` method. + * + * @method Phaser.Data.DataManager#removeValue + * @private + * @fires Phaser.Data.Events#REMOVE_DATA + * @since 3.10.0 + * + * @param {string} key - The key to set the value for. + * + * @return {this} This DataManager object. + */ + removeValue: function (key) + { + if (this.has(key)) + { + var data = this.list[key]; + + delete this.list[key]; + delete this.values[key]; + + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); + } + + return this; + }, + + /** + * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it. + * + * @method Phaser.Data.DataManager#pop + * @fires Phaser.Data.Events#REMOVE_DATA + * @since 3.0.0 + * + * @param {string} key - The key of the value to retrieve and delete. + * + * @return {*} The value of the given key. + */ + pop: function (key) + { + var data = undefined; + + if (!this._frozen && this.has(key)) + { + data = this.list[key]; + + delete this.list[key]; + delete this.values[key]; + + this.events.emit(Events.REMOVE_DATA, this.parent, key, data); + } + + return data; + }, + + /** + * Determines whether the given key is set in this Data Manager. + * + * Please note that the keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.Data.DataManager#has + * @since 3.0.0 + * + * @param {string} key - The key to check. + * + * @return {boolean} Returns `true` if the key exists, otherwise `false`. + */ + has: function (key) + { + return this.list.hasOwnProperty(key); + }, + + /** + * Freeze or unfreeze this Data Manager. A frozen Data Manager will block all attempts + * to create new values or update existing ones. + * + * @method Phaser.Data.DataManager#setFreeze + * @since 3.0.0 + * + * @param {boolean} value - Whether to freeze or unfreeze the Data Manager. + * + * @return {this} This DataManager object. + */ + setFreeze: function (value) + { + this._frozen = value; + + return this; + }, + + /** + * Delete all data in this Data Manager and unfreeze it. + * + * @method Phaser.Data.DataManager#reset + * @since 3.0.0 + * + * @return {this} This DataManager object. + */ + reset: function () + { + for (var key in this.list) + { + delete this.list[key]; + delete this.values[key]; + } + + this._frozen = false; + + return this; + }, + + /** + * Destroy this data manager. + * + * @method Phaser.Data.DataManager#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.reset(); + + this.events.off(Events.CHANGE_DATA); + this.events.off(Events.SET_DATA); + this.events.off(Events.REMOVE_DATA); + + this.parent = null; + }, + + /** + * Gets or sets the frozen state of this Data Manager. + * A frozen Data Manager will block all attempts to create new values or update existing ones. + * + * @name Phaser.Data.DataManager#freeze + * @type {boolean} + * @since 3.0.0 + */ + freeze: { + + get: function () + { + return this._frozen; + }, + + set: function (value) + { + this._frozen = (value) ? true : false; + } + + }, + + /** + * Return the total number of entries in this Data Manager. + * + * @name Phaser.Data.DataManager#count + * @type {number} + * @since 3.0.0 + */ + count: { + + get: function () + { + var i = 0; + + for (var key in this.list) + { + if (this.list[key] !== undefined) + { + i++; + } + } + + return i; + } + + } + +}); + +module.exports = DataManager; + + +/***/ }), +/* 98 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -18306,7 +23592,7 @@ var Class = __webpack_require__(0); /** * @classdesc * The keys of a Map can be arbitrary values. - * + * * ```javascript * var map = new Map([ * [ 1, 'one' ], @@ -18560,7 +23846,9 @@ var Map = new Class({ }, /** - * Passes all entries in this Map to the given callback. + * Iterates through all entries in this Map, passing each one to the given callback. + * + * If the callback returns `false`, the iteration will break. * * @method Phaser.Structs.Map#each * @since 3.0.0 @@ -18656,7 +23944,7 @@ module.exports = Map; /***/ }), -/* 93 */ +/* 99 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -18667,12 +23955,12 @@ module.exports = Map; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DegToRad = __webpack_require__(41); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(42); +var DegToRad = __webpack_require__(34); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(35); var Rectangle = __webpack_require__(9); -var TransformMatrix = __webpack_require__(31); -var ValueToColor = __webpack_require__(174); +var TransformMatrix = __webpack_require__(24); +var ValueToColor = __webpack_require__(179); var Vector2 = __webpack_require__(3); /** @@ -18695,10 +23983,10 @@ var Vector2 = __webpack_require__(3); * * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, * allowing you to filter Game Objects out on a per-Camera basis. - * + * * The Base Camera is extended by the Camera class, which adds in special effects including Fade, * Flash and Camera Shake, as well as the ability to follow Game Objects. - * + * * The Base Camera was introduced in Phaser 3.12. It was split off from the Camera class, to allow * you to isolate special effects as needed. Therefore the 'since' values for properties of this class relate * to when they were added to the Camera class. @@ -18707,7 +23995,7 @@ var Vector2 = __webpack_require__(3); * @memberof Phaser.Cameras.Scene2D * @constructor * @since 3.12.0 - * + * * @extends Phaser.Events.EventEmitter * @extends Phaser.GameObjects.Components.Alpha * @extends Phaser.GameObjects.Components.Visible @@ -18778,7 +24066,7 @@ var BaseCamera = new Class({ * This value is a bitmask. * * @name Phaser.Cameras.Scene2D.BaseCamera#id - * @type {integer} + * @type {number} * @readonly * @since 3.11.0 */ @@ -18794,19 +24082,6 @@ var BaseCamera = new Class({ */ this.name = ''; - /** - * This property is un-used in v3.16. - * - * The resolution of the Game, used in most Camera calculations. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#resolution - * @type {number} - * @readonly - * @deprecated - * @since 3.12.0 - */ - this.resolution = 1; - /** * Should this camera round its pixel values to integers? * @@ -18856,9 +24131,9 @@ var BaseCamera = new Class({ /** * Is this Camera dirty? - * + * * A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame. - * + * * This flag is cleared during the `postRenderCamera` method of the renderer. * * @name Phaser.Cameras.Scene2D.BaseCamera#dirty @@ -18892,46 +24167,6 @@ var BaseCamera = new Class({ */ this._y = y; - /** - * Internal Camera X value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cx - * @type {number} - * @private - * @since 3.12.0 - */ - this._cx = 0; - - /** - * Internal Camera Y value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cy - * @type {number} - * @private - * @since 3.12.0 - */ - this._cy = 0; - - /** - * Internal Camera Width value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_cw - * @type {number} - * @private - * @since 3.12.0 - */ - this._cw = 0; - - /** - * Internal Camera Height value multiplied by the resolution. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_ch - * @type {number} - * @private - * @since 3.12.0 - */ - this._ch = 0; - /** * The width of the Camera viewport, in pixels. * @@ -19005,7 +24240,7 @@ var BaseCamera = new Class({ this._scrollY = 0; /** - * The Camera zoom value. Change this value to zoom in, or out of, a Scene. + * The Camera horizontal zoom value. Change this value to zoom in, or out of, a Scene. * * A value of 0.5 would zoom the Camera out, so you can now see twice as much * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel @@ -19015,13 +24250,32 @@ var BaseCamera = new Class({ * * Be careful to never set this value to zero. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_zoom + * @name Phaser.Cameras.Scene2D.BaseCamera#_zoomX * @type {number} * @private * @default 1 - * @since 3.11.0 + * @since 3.50.0 */ - this._zoom = 1; + this._zoomX = 1; + + /** + * The Camera vertical zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_zoomY + * @type {number} + * @private + * @default 1 + * @since 3.50.0 + */ + this._zoomY = 1; /** * The rotation of the Camera in radians. @@ -19174,7 +24428,7 @@ var BaseCamera = new Class({ /** * The Camera that this Camera uses for translation during masking. - * + * * If the mask is fixed in position this will be a reference to * the CameraManager.default instance. Otherwise, it'll be a reference * to itself. @@ -19507,19 +24761,18 @@ var BaseCamera = new Class({ var c = Math.cos(this.rotation); var s = Math.sin(this.rotation); - var zoom = this.zoom; - var res = this.resolution; + var zoomX = this.zoomX; + var zoomY = this.zoomY; var scrollX = this.scrollX; var scrollY = this.scrollY; - // Works for zoom of 1 with any resolution, but resolution > 1 and zoom !== 1 breaks - var sx = x + ((scrollX * c - scrollY * s) * zoom); - var sy = y + ((scrollX * s + scrollY * c) * zoom); + var sx = x + ((scrollX * c - scrollY * s) * zoomX); + var sy = y + ((scrollX * s + scrollY * c) * zoomY); // Apply transform to point - output.x = (sx * ima + sy * imc) * res + ime; - output.y = (sx * imb + sy * imd) * res + imf; + output.x = (sx * ima + sy * imc) + ime; + output.y = (sx * imb + sy * imd) + imf; return output; }, @@ -19571,10 +24824,8 @@ var BaseCamera = new Class({ * @method Phaser.Cameras.Scene2D.BaseCamera#preRender * @protected * @since 3.0.0 - * - * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (resolution) + preRender: function () { var width = this.width; var height = this.height; @@ -19582,7 +24833,8 @@ var BaseCamera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * resolution; + var zoomX = this.zoomX; + var zoomY = this.zoomY; var matrix = this.matrix; var originX = width * this.originX; @@ -19614,8 +24866,8 @@ var BaseCamera = new Class({ // Basically the pixel value of what it's looking at in the middle of the cam this.midPoint.set(midX, midY); - var displayWidth = width / zoom; - var displayHeight = height / zoom; + var displayWidth = width / zoomX; + var displayHeight = height / zoomY; this.worldView.setTo( midX - (displayWidth / 2), @@ -19624,7 +24876,7 @@ var BaseCamera = new Class({ displayHeight ); - matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoomX, zoomY); matrix.translate(-originX, -originY); }, @@ -19765,15 +25017,15 @@ var BaseCamera = new Class({ /** * Set the bounds of the Camera. The bounds are an axis-aligned rectangle. - * + * * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the * edges and into blank space. It does not limit the placement of Game Objects, or where * the Camera viewport can be positioned. - * + * * Temporarily disable the bounds by changing the boolean `Camera.useBounds`. - * + * * Clear the bounds entirely by calling `Camera.removeBounds`. - * + * * If you set bounds that are smaller than the viewport it will stop the Camera from being * able to scroll. The bounds can be positioned where-ever you wish. By default they are from * 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of @@ -19785,10 +25037,10 @@ var BaseCamera = new Class({ * @method Phaser.Cameras.Scene2D.BaseCamera#setBounds * @since 3.0.0 * - * @param {integer} x - The top-left x coordinate of the bounds. - * @param {integer} y - The top-left y coordinate of the bounds. - * @param {integer} width - The width of the bounds, in pixels. - * @param {integer} height - The height of the bounds, in pixels. + * @param {number} x - The top-left x coordinate of the bounds. + * @param {number} y - The top-left y coordinate of the bounds. + * @param {number} width - The width of the bounds, in pixels. + * @param {number} height - The height of the bounds, in pixels. * @param {boolean} [centerOn=false] - If `true` the Camera will automatically be centered on the new bounds. * * @return {this} This Camera instance. @@ -19817,9 +25069,9 @@ var BaseCamera = new Class({ /** * Returns a rectangle containing the bounds of the Camera. - * + * * If the Camera does not have any bounds the rectangle will be empty. - * + * * The rectangle is a copy of the bounds, so is safe to modify. * * @method Phaser.Cameras.Scene2D.BaseCamera#getBounds @@ -19906,7 +25158,7 @@ var BaseCamera = new Class({ /** * Should the Camera round pixel values to whole integers when rendering Game Objects? - * + * * In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing. * * @method Phaser.Cameras.Scene2D.BaseCamera#setRoundPixels @@ -19925,8 +25177,6 @@ var BaseCamera = new Class({ /** * Sets the Scene the Camera is bound to. - * - * Also populates the `resolution` property and updates the internal size values. * * @method Phaser.Cameras.Scene2D.BaseCamera#setScene * @since 3.0.0 @@ -19950,15 +25200,6 @@ var BaseCamera = new Class({ this.scaleManager = sys.scale; this.cameraManager = sys.cameras; - var res = this.scaleManager.resolution; - - this.resolution = res; - - this._cx = this._x * res; - this._cy = this._y * res; - this._cw = this._width * res; - this._ch = this._height * res; - this.updateSystem(); return this; @@ -19999,8 +25240,8 @@ var BaseCamera = new Class({ * @method Phaser.Cameras.Scene2D.BaseCamera#setSize * @since 3.0.0 * - * @param {integer} width - The width of the Camera viewport. - * @param {integer} [height=width] - The height of the Camera viewport. + * @param {number} width - The width of the Camera viewport. + * @param {number} [height=width] - The height of the Camera viewport. * * @return {this} This Camera instance. */ @@ -20030,8 +25271,8 @@ var BaseCamera = new Class({ * * @param {number} x - The top-left x coordinate of the Camera viewport. * @param {number} y - The top-left y coordinate of the Camera viewport. - * @param {integer} width - The width of the Camera viewport. - * @param {integer} [height=width] - The height of the Camera viewport. + * @param {number} width - The width of the Camera viewport. + * @param {number} [height=width] - The height of the Camera viewport. * * @return {this} This Camera instance. */ @@ -20055,23 +25296,33 @@ var BaseCamera = new Class({ * * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. * + * As of Phaser 3.50 you can now set the horizontal and vertical zoom values independently. + * * @method Phaser.Cameras.Scene2D.BaseCamera#setZoom * @since 3.0.0 * - * @param {number} [value=1] - The zoom value of the Camera. The minimum it can be is 0.001. + * @param {number} [x=1] - The horizontal zoom value of the Camera. The minimum it can be is 0.001. + * @param {number} [y=x] - The vertical zoom value of the Camera. The minimum it can be is 0.001. * * @return {this} This Camera instance. */ - setZoom: function (value) + setZoom: function (x, y) { - if (value === undefined) { value = 1; } + if (x === undefined) { x = 1; } + if (y === undefined) { y = x; } - if (value === 0) + if (x === 0) { - value = 0.001; + x = 0.001; } - this.zoom = value; + if (y === 0) + { + y = 0.001; + } + + this.zoomX = x; + this.zoomY = y; return this; }, @@ -20080,14 +25331,14 @@ var BaseCamera = new Class({ * Sets the mask to be applied to this Camera during rendering. * * The mask must have been previously created and can be either a GeometryMask or a BitmapMask. - * + * * Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. * * If a mask is already set on this Camera it will be immediately replaced. - * + * * Masks have no impact on physics or input detection. They are purely a rendering component * that allows you to limit what is visible during the render pass. - * + * * Note: You cannot mask a Camera that has `renderToTexture` set. * * @method Phaser.Cameras.Scene2D.BaseCamera#setMask @@ -20190,7 +25441,7 @@ var BaseCamera = new Class({ * @protected * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function () @@ -20234,9 +25485,9 @@ var BaseCamera = new Class({ /** * Destroys this Camera instance and its internal properties and references. * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. - * + * * This method is called automatically by `CameraManager.remove` if that methods `runDestroy` argument is `true`, which is the default. - * + * * Unless you have a specific reason otherwise, always use `CameraManager.remove` and allow it to handle the camera destruction, * rather than calling this method directly. * @@ -20287,7 +25538,6 @@ var BaseCamera = new Class({ set: function (value) { this._x = value; - this._cx = value * this.resolution; this.updateSystem(); } @@ -20312,7 +25562,6 @@ var BaseCamera = new Class({ set: function (value) { this._y = value; - this._cy = value * this.resolution; this.updateSystem(); } @@ -20338,7 +25587,6 @@ var BaseCamera = new Class({ set: function (value) { this._width = value; - this._cw = value * this.resolution; this.updateSystem(); } @@ -20364,7 +25612,6 @@ var BaseCamera = new Class({ set: function (value) { this._height = value; - this._ch = value * this.resolution; this.updateSystem(); } @@ -20450,12 +25697,76 @@ var BaseCamera = new Class({ get: function () { - return this._zoom; + return (this._zoomX + this._zoomY) / 2; }, set: function (value) { - this._zoom = value; + this._zoomX = value; + this._zoomY = value; + + this.dirty = true; + } + + }, + + /** + * The Camera horizontal zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#zoomX + * @type {number} + * @default 1 + * @since 3.50.0 + */ + zoomX: { + + get: function () + { + return this._zoomX; + }, + + set: function (value) + { + this._zoomX = value; + this.dirty = true; + } + + }, + + /** + * The Camera vertical zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#zoomY + * @type {number} + * @default 1 + * @since 3.50.0 + */ + zoomY: { + + get: function () + { + return this._zoomY; + }, + + set: function (value) + { + this._zoomY = value; this.dirty = true; } @@ -20543,7 +25854,7 @@ var BaseCamera = new Class({ get: function () { - return this.width / this.zoom; + return this.width / this.zoomX; } }, @@ -20566,7 +25877,7 @@ var BaseCamera = new Class({ get: function () { - return this.height / this.zoom; + return this.height / this.zoomY; } } @@ -20577,7 +25888,37 @@ module.exports = BaseCamera; /***/ }), -/* 94 */ +/* 100 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Given 3 separate color values this will return an integer representation of it. + * + * @function Phaser.Display.Color.GetColor + * @since 3.0.0 + * + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * + * @return {number} The combined color value. + */ +var GetColor = function (red, green, blue) +{ + return red << 16 | green << 8 | blue; +}; + +module.exports = GetColor; + + +/***/ }), +/* 101 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -20592,18 +25933,203 @@ module.exports = BaseCamera; module.exports = { - ENTER_FULLSCREEN: __webpack_require__(727), - FULLSCREEN_FAILED: __webpack_require__(728), - FULLSCREEN_UNSUPPORTED: __webpack_require__(729), - LEAVE_FULLSCREEN: __webpack_require__(730), - ORIENTATION_CHANGE: __webpack_require__(731), - RESIZE: __webpack_require__(732) + ENTER_FULLSCREEN: __webpack_require__(768), + FULLSCREEN_FAILED: __webpack_require__(769), + FULLSCREEN_UNSUPPORTED: __webpack_require__(770), + LEAVE_FULLSCREEN: __webpack_require__(771), + ORIENTATION_CHANGE: __webpack_require__(772), + RESIZE: __webpack_require__(773) }; /***/ }), -/* 95 */ +/* 102 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Determines the operating system of the device running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.os` from within any Scene. + * + * @typedef {object} Phaser.Device.OS + * @since 3.0.0 + * + * @property {boolean} android - Is running on android? + * @property {boolean} chromeOS - Is running on chromeOS? + * @property {boolean} cordova - Is the game running under Apache Cordova? + * @property {boolean} crosswalk - Is the game running under the Intel Crosswalk XDK? + * @property {boolean} desktop - Is running on a desktop? + * @property {boolean} ejecta - Is the game running under Ejecta? + * @property {boolean} electron - Is the game running under GitHub Electron? + * @property {boolean} iOS - Is running on iOS? + * @property {boolean} iPad - Is running on iPad? + * @property {boolean} iPhone - Is running on iPhone? + * @property {boolean} kindle - Is running on an Amazon Kindle? + * @property {boolean} linux - Is running on linux? + * @property {boolean} macOS - Is running on macOS? + * @property {boolean} node - Is the game running under Node.js? + * @property {boolean} nodeWebkit - Is the game running under Node-Webkit? + * @property {boolean} webApp - Set to true if running as a WebApp, i.e. within a WebView + * @property {boolean} windows - Is running on windows? + * @property {boolean} windowsPhone - Is running on a Windows Phone? + * @property {number} iOSVersion - If running in iOS this will contain the major version number. + * @property {number} pixelRatio - PixelRatio of the host device? + */ +var OS = { + + android: false, + chromeOS: false, + cordova: false, + crosswalk: false, + desktop: false, + ejecta: false, + electron: false, + iOS: false, + iOSVersion: 0, + iPad: false, + iPhone: false, + kindle: false, + linux: false, + macOS: false, + node: false, + nodeWebkit: false, + pixelRatio: 1, + webApp: false, + windows: false, + windowsPhone: false + +}; + +function init () +{ + var ua = navigator.userAgent; + + if ((/Windows/).test(ua)) + { + OS.windows = true; + } + else if ((/Mac OS/).test(ua) && !((/like Mac OS/).test(ua))) + { + // Because iOS 13 identifies as Mac OS: + if (navigator.maxTouchPoints && navigator.maxTouchPoints > 2) + { + OS.iOS = true; + OS.iPad = true; + + (navigator.appVersion).match(/Version\/(\d+)/); + + OS.iOSVersion = parseInt(RegExp.$1, 10); + } + else + { + OS.macOS = true; + } + } + else if ((/Android/).test(ua)) + { + OS.android = true; + } + else if ((/Linux/).test(ua)) + { + OS.linux = true; + } + else if ((/iP[ao]d|iPhone/i).test(ua)) + { + OS.iOS = true; + + (navigator.appVersion).match(/OS (\d+)/); + + OS.iOSVersion = parseInt(RegExp.$1, 10); + + OS.iPhone = ua.toLowerCase().indexOf('iphone') !== -1; + OS.iPad = ua.toLowerCase().indexOf('ipad') !== -1; + } + else if ((/Kindle/).test(ua) || (/\bKF[A-Z][A-Z]+/).test(ua) || (/Silk.*Mobile Safari/).test(ua)) + { + OS.kindle = true; + + // This will NOT detect early generations of Kindle Fire, I think there is no reliable way... + // E.g. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" + } + else if ((/CrOS/).test(ua)) + { + OS.chromeOS = true; + } + + if ((/Windows Phone/i).test(ua) || (/IEMobile/i).test(ua)) + { + OS.android = false; + OS.iOS = false; + OS.macOS = false; + OS.windows = true; + OS.windowsPhone = true; + } + + var silk = (/Silk/).test(ua); + + if (OS.windows || OS.macOS || (OS.linux && !silk) || OS.chromeOS) + { + OS.desktop = true; + } + + // Windows Phone / Table reset + if (OS.windowsPhone || (((/Windows NT/i).test(ua)) && ((/Touch/i).test(ua)))) + { + OS.desktop = false; + } + + // WebApp mode in iOS + if (navigator.standalone) + { + OS.webApp = true; + } + + if (window.cordova !== undefined) + { + OS.cordova = true; + } + + if (typeof process !== 'undefined' && process.versions && process.versions.node) + { + OS.node = true; + } + + if (OS.node && typeof process.versions === 'object') + { + OS.nodeWebkit = !!process.versions['node-webkit']; + + OS.electron = !!process.versions.electron; + } + + if (window.ejecta !== undefined) + { + OS.ejecta = true; + } + + if ((/Crosswalk/).test(ua)) + { + OS.crosswalk = true; + } + + OS.pixelRatio = window['devicePixelRatio'] || 1; + + return OS; +} + +module.exports = init(); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(796))) + +/***/ }), +/* 103 */ /***/ (function(module, exports) { /** @@ -20613,132 +26139,43 @@ module.exports = { */ /** - * Snap a value to nearest grid slice, using floor. + * Removes a single item from an array and returns it without creating gc, like the native splice does. + * Based on code by Mike Reinstein. * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. - * As will `14` snap to `10`... but `16` will snap to `15`. - * - * @function Phaser.Math.Snap.Floor + * @function Phaser.Utils.Array.SpliceOne * @since 3.0.0 * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * @param {array} array - The array to splice from. + * @param {number} index - The index of the item which should be spliced. * - * @return {number} The snapped value. + * @return {*} The item which was spliced (removed). */ -var SnapFloor = function (value, gap, start, divide) +var SpliceOne = function (array, index) { - if (start === undefined) { start = 0; } - - if (gap === 0) + if (index >= array.length) { - return value; + return; } - value -= start; - value = gap * Math.floor(value / gap); + var len = array.length - 1; - return (divide) ? (start + value) / gap : start + value; -}; + var item = array[index]; -module.exports = SnapFloor; - - -/***/ }), -/* 96 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var SpliceOne = __webpack_require__(82); - -/** - * Removes the given item, or array of items, from the array. - * - * The array is modified in-place. - * - * You can optionally specify a callback to be invoked for each item successfully removed from the array. - * - * @function Phaser.Utils.Array.Remove - * @since 3.4.0 - * - * @param {array} array - The array to be modified. - * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. - * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. - * @param {object} [context] - The context in which the callback is invoked. - * - * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. - */ -var Remove = function (array, item, callback, context) -{ - if (context === undefined) { context = array; } - - var index; - - // Fast path to avoid array mutation and iteration - if (!Array.isArray(item)) + for (var i = index; i < len; i++) { - index = array.indexOf(item); - - if (index !== -1) - { - SpliceOne(array, index); - - if (callback) - { - callback.call(context, item); - } - - return item; - } - else - { - return null; - } + array[i] = array[i + 1]; } - // If we got this far, we have an array of items to remove - - var itemLength = item.length - 1; - - while (itemLength >= 0) - { - var entry = item[itemLength]; - - index = array.indexOf(entry); - - if (index !== -1) - { - SpliceOne(array, index); - - if (callback) - { - callback.call(context, entry); - } - } - else - { - // Item wasn't found in the array, so remove it from our return results - item.pop(); - } - - itemLength--; - } + array.length = len; return item; }; -module.exports = Remove; +module.exports = SpliceOne; /***/ }), -/* 97 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -20748,8 +26185,8 @@ module.exports = Remove; */ var Class = __webpack_require__(0); -var Clamp = __webpack_require__(17); -var Extend = __webpack_require__(19); +var Clamp = __webpack_require__(16); +var Extend = __webpack_require__(18); /** * @classdesc @@ -20761,8 +26198,8 @@ var Extend = __webpack_require__(19); * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture this Frame is a part of. - * @param {(integer|string)} name - The name of this Frame. The name is unique within the Texture. - * @param {integer} sourceIndex - The index of the TextureSource that this Frame is a part of. + * @param {(number|string)} name - The name of this Frame. The name is unique within the Texture. + * @param {number} sourceIndex - The index of the TextureSource that this Frame is a part of. * @param {number} x - The x coordinate of the top-left of this Frame. * @param {number} y - The y coordinate of the top-left of this Frame. * @param {number} width - The width of this Frame. @@ -20806,7 +26243,7 @@ var Frame = new Class({ * The index of the TextureSource in the Texture sources array. * * @name Phaser.Textures.Frame#sourceIndex - * @type {integer} + * @type {number} * @since 3.0.0 */ this.sourceIndex = sourceIndex; @@ -20825,7 +26262,7 @@ var Frame = new Class({ * X position within the source image to cut from. * * @name Phaser.Textures.Frame#cutX - * @type {integer} + * @type {number} * @since 3.0.0 */ this.cutX; @@ -20834,7 +26271,7 @@ var Frame = new Class({ * Y position within the source image to cut from. * * @name Phaser.Textures.Frame#cutY - * @type {integer} + * @type {number} * @since 3.0.0 */ this.cutY; @@ -20843,7 +26280,7 @@ var Frame = new Class({ * The width of the area in the source image to cut. * * @name Phaser.Textures.Frame#cutWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.cutWidth; @@ -20852,7 +26289,7 @@ var Frame = new Class({ * The height of the area in the source image to cut. * * @name Phaser.Textures.Frame#cutHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.cutHeight; @@ -20861,7 +26298,7 @@ var Frame = new Class({ * The X rendering offset of this Frame, taking trim into account. * * @name Phaser.Textures.Frame#x - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -20871,7 +26308,7 @@ var Frame = new Class({ * The Y rendering offset of this Frame, taking trim into account. * * @name Phaser.Textures.Frame#y - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -20881,7 +26318,7 @@ var Frame = new Class({ * The rendering width of this Frame, taking trim into account. * * @name Phaser.Textures.Frame#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width; @@ -20890,7 +26327,7 @@ var Frame = new Class({ * The rendering height of this Frame, taking trim into account. * * @name Phaser.Textures.Frame#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height; @@ -20900,7 +26337,7 @@ var Frame = new Class({ * Precalculated for the renderer. * * @name Phaser.Textures.Frame#halfWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.halfWidth; @@ -20910,7 +26347,7 @@ var Frame = new Class({ * Precalculated for the renderer. * * @name Phaser.Textures.Frame#halfHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.halfHeight; @@ -20919,7 +26356,7 @@ var Frame = new Class({ * The x center of this frame, floored. * * @name Phaser.Textures.Frame#centerX - * @type {integer} + * @type {number} * @since 3.0.0 */ this.centerX; @@ -20928,7 +26365,7 @@ var Frame = new Class({ * The y center of this frame, floored. * * @name Phaser.Textures.Frame#centerY - * @type {integer} + * @type {number} * @since 3.0.0 */ this.centerY; @@ -20984,7 +26421,7 @@ var Frame = new Class({ * 1 = Round * * @name Phaser.Textures.Frame#autoRound - * @type {integer} + * @type {number} * @default -1 * @since 3.0.0 */ @@ -21090,10 +26527,10 @@ var Frame = new Class({ * @method Phaser.Textures.Frame#setSize * @since 3.7.0 * - * @param {integer} width - The width of the frame before being trimmed. - * @param {integer} height - The height of the frame before being trimmed. - * @param {integer} [x=0] - The x coordinate of the top-left of this Frame. - * @param {integer} [y=0] - The y coordinate of the top-left of this Frame. + * @param {number} width - The width of the frame before being trimmed. + * @param {number} height - The height of the frame before being trimmed. + * @param {number} [x=0] - The x coordinate of the top-left of this Frame. + * @param {number} [y=0] - The y coordinate of the top-left of this Frame. * * @return {Phaser.Textures.Frame} This Frame object. */ @@ -21595,7 +27032,823 @@ module.exports = Frame; /***/ }), -/* 98 */ +/* 105 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ArrayUtils = __webpack_require__(199); +var Class = __webpack_require__(0); +var NOOP = __webpack_require__(1); +var StableSort = __webpack_require__(90); + +/** + * @callback EachListCallback + * + * @param {I} item - The item which is currently being processed. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + */ + +/** + * @classdesc + * List is a generic implementation of an ordered list which contains utility methods for retrieving, manipulating, and iterating items. + * + * @class List + * @memberof Phaser.Structs + * @constructor + * @since 3.0.0 + * + * @generic T + * + * @param {*} parent - The parent of this list. + */ +var List = new Class({ + + initialize: + + function List (parent) + { + /** + * The parent of this list. + * + * @name Phaser.Structs.List#parent + * @type {*} + * @since 3.0.0 + */ + this.parent = parent; + + /** + * The objects that belong to this collection. + * + * @genericUse {T[]} - [$type] + * + * @name Phaser.Structs.List#list + * @type {Array.<*>} + * @default [] + * @since 3.0.0 + */ + this.list = []; + + /** + * The index of the current element. + * + * This is used internally when iterating through the list with the {@link #first}, {@link #last}, {@link #get}, and {@link #previous} properties. + * + * @name Phaser.Structs.List#position + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.position = 0; + + /** + * A callback that is invoked every time a child is added to this list. + * + * @name Phaser.Structs.List#addCallback + * @type {function} + * @since 3.4.0 + */ + this.addCallback = NOOP; + + /** + * A callback that is invoked every time a child is removed from this list. + * + * @name Phaser.Structs.List#removeCallback + * @type {function} + * @since 3.4.0 + */ + this.removeCallback = NOOP; + + /** + * The property key to sort by. + * + * @name Phaser.Structs.List#_sortKey + * @type {string} + * @since 3.4.0 + */ + this._sortKey = ''; + }, + + /** + * Adds the given item to the end of the list. Each item must be unique. + * + * @method Phaser.Structs.List#add + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*|Array.<*>} child - The item, or array of items, to add to the list. + * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. + * + * @return {*} The list's underlying array. + */ + add: function (child, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.Add(this.list, child); + } + else + { + return ArrayUtils.Add(this.list, child, 0, this.addCallback, this); + } + }, + + /** + * Adds an item to list, starting at a specified index. Each item must be unique within the list. + * + * @method Phaser.Structs.List#addAt + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item, or array of items, to add to the list. + * @param {number} [index=0] - The index in the list at which the element(s) will be inserted. + * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. + * + * @return {*} The List's underlying array. + */ + addAt: function (child, index, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.AddAt(this.list, child, index); + } + else + { + return ArrayUtils.AddAt(this.list, child, index, 0, this.addCallback, this); + } + }, + + /** + * Retrieves the item at a given position inside the List. + * + * @method Phaser.Structs.List#getAt + * @since 3.0.0 + * + * @genericUse {T} - [$return] + * + * @param {number} index - The index of the item. + * + * @return {*} The retrieved item, or `undefined` if it's outside the List's bounds. + */ + getAt: function (index) + { + return this.list[index]; + }, + + /** + * Locates an item within the List and returns its index. + * + * @method Phaser.Structs.List#getIndex + * @since 3.0.0 + * + * @genericUse {T} - [child] + * + * @param {*} child - The item to locate. + * + * @return {number} The index of the item within the List, or -1 if it's not in the List. + */ + getIndex: function (child) + { + // Return -1 if given child isn't a child of this display list + return this.list.indexOf(child); + }, + + /** + * Sort the contents of this List so the items are in order based on the given property. + * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. + * + * @method Phaser.Structs.List#sort + * @since 3.0.0 + * + * @genericUse {T[]} - [children,$return] + * + * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. + * + * @return {Phaser.Structs.List} This List object. + */ + sort: function (property, handler) + { + if (!property) + { + return this; + } + + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } + + StableSort(this.list, handler); + + return this; + }, + + /** + * Searches for the first instance of a child with its `name` + * property matching the given argument. Should more than one child have + * the same name only the first is returned. + * + * @method Phaser.Structs.List#getByName + * @since 3.0.0 + * + * @genericUse {T | null} - [$return] + * + * @param {string} name - The name to search for. + * + * @return {?*} The first child with a matching name, or null if none were found. + */ + getByName: function (name) + { + return ArrayUtils.GetFirst(this.list, 'name', name); + }, + + /** + * Returns a random child from the group. + * + * @method Phaser.Structs.List#getRandom + * @since 3.0.0 + * + * @genericUse {T | null} - [$return] + * + * @param {number} [startIndex=0] - Offset from the front of the group (lowest child). + * @param {number} [length=(to top)] - Restriction on the number of values you want to randomly select from. + * + * @return {?*} A random child of this Group. + */ + getRandom: function (startIndex, length) + { + return ArrayUtils.GetRandom(this.list, startIndex, length); + }, + + /** + * Returns the first element in a given part of the List which matches a specific criterion. + * + * @method Phaser.Structs.List#getFirst + * @since 3.0.0 + * + * @genericUse {T | null} - [$return] + * + * @param {string} property - The name of the property to test or a falsey value to have no criterion. + * @param {*} value - The value to test the `property` against, or `undefined` to allow any value and only check for existence. + * @param {number} [startIndex=0] - The position in the List to start the search at. + * @param {number} [endIndex] - The position in the List to optionally stop the search at. It won't be checked. + * + * @return {?*} The first item which matches the given criterion, or `null` if no such item exists. + */ + getFirst: function (property, value, startIndex, endIndex) + { + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); + }, + + /** + * Returns all children in this List. + * + * You can optionally specify a matching criteria using the `property` and `value` arguments. + * + * For example: `getAll('parent')` would return only children that have a property called `parent`. + * + * You can also specify a value to compare the property to: + * + * `getAll('visible', true)` would return only children that have their visible property set to `true`. + * + * Optionally you can specify a start and end index. For example if this List had 100 children, + * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only + * the first 50 children in the List. + * + * @method Phaser.Structs.List#getAll + * @since 3.0.0 + * + * @genericUse {T} - [value] + * @genericUse {T[]} - [$return] + * + * @param {string} [property] - An optional property to test against the value argument. + * @param {*} [value] - If property is set then Child.property must strictly equal this value to be included in the results. + * @param {number} [startIndex] - The first child index to start the search from. + * @param {number} [endIndex] - The last child index to search up until. + * + * @return {Array.<*>} All items of the List which match the given criterion, if any. + */ + getAll: function (property, value, startIndex, endIndex) + { + return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex); + }, + + /** + * Returns the total number of items in the List which have a property matching the given value. + * + * @method Phaser.Structs.List#count + * @since 3.0.0 + * + * @genericUse {T} - [value] + * + * @param {string} property - The property to test on each item. + * @param {*} value - The value to test the property against. + * + * @return {number} The total number of matching elements. + */ + count: function (property, value) + { + return ArrayUtils.CountAllMatching(this.list, property, value); + }, + + /** + * Swaps the positions of two items in the list. + * + * @method Phaser.Structs.List#swap + * @since 3.0.0 + * + * @genericUse {T} - [child1,child2] + * + * @param {*} child1 - The first item to swap. + * @param {*} child2 - The second item to swap. + */ + swap: function (child1, child2) + { + ArrayUtils.Swap(this.list, child1, child2); + }, + + /** + * Moves an item in the List to a new position. + * + * @method Phaser.Structs.List#moveTo + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to move. + * @param {number} index - Moves an item in the List to a new position. + * + * @return {*} The item that was moved. + */ + moveTo: function (child, index) + { + return ArrayUtils.MoveTo(this.list, child, index); + }, + + /** + * Removes one or many items from the List. + * + * @method Phaser.Structs.List#remove + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item, or array of items, to remove. + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {*} The item, or array of items, which were successfully removed from the List. + */ + remove: function (child, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.Remove(this.list, child); + } + else + { + return ArrayUtils.Remove(this.list, child, this.removeCallback, this); + } + }, + + /** + * Removes the item at the given position in the List. + * + * @method Phaser.Structs.List#removeAt + * @since 3.0.0 + * + * @genericUse {T} - [$return] + * + * @param {number} index - The position to remove the item from. + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {*} The item that was removed. + */ + removeAt: function (index, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.RemoveAt(this.list, index); + } + else + { + return ArrayUtils.RemoveAt(this.list, index, this.removeCallback, this); + } + }, + + /** + * Removes the items within the given range in the List. + * + * @method Phaser.Structs.List#removeBetween + * @since 3.0.0 + * + * @genericUse {T[]} - [$return] + * + * @param {number} [startIndex=0] - The index to start removing from. + * @param {number} [endIndex] - The position to stop removing at. The item at this position won't be removed. + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {Array.<*>} An array of the items which were removed. + */ + removeBetween: function (startIndex, endIndex, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex); + } + else + { + return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeCallback, this); + } + }, + + /** + * Removes all the items. + * + * @method Phaser.Structs.List#removeAll + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.List.} - [$return] + * + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {Phaser.Structs.List} This List object. + */ + removeAll: function (skipCallback) + { + var i = this.list.length; + + while (i--) + { + this.remove(this.list[i], skipCallback); + } + + return this; + }, + + /** + * Brings the given child to the top of this List. + * + * @method Phaser.Structs.List#bringToTop + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to bring to the top of the List. + * + * @return {*} The item which was moved. + */ + bringToTop: function (child) + { + return ArrayUtils.BringToTop(this.list, child); + }, + + /** + * Sends the given child to the bottom of this List. + * + * @method Phaser.Structs.List#sendToBack + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to send to the back of the list. + * + * @return {*} The item which was moved. + */ + sendToBack: function (child) + { + return ArrayUtils.SendToBack(this.list, child); + }, + + /** + * Moves the given child up one place in this group unless it's already at the top. + * + * @method Phaser.Structs.List#moveUp + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to move up. + * + * @return {*} The item which was moved. + */ + moveUp: function (child) + { + ArrayUtils.MoveUp(this.list, child); + + return child; + }, + + /** + * Moves the given child down one place in this group unless it's already at the bottom. + * + * @method Phaser.Structs.List#moveDown + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to move down. + * + * @return {*} The item which was moved. + */ + moveDown: function (child) + { + ArrayUtils.MoveDown(this.list, child); + + return child; + }, + + /** + * Reverses the order of all children in this List. + * + * @method Phaser.Structs.List#reverse + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.List.} - [$return] + * + * @return {Phaser.Structs.List} This List object. + */ + reverse: function () + { + this.list.reverse(); + + return this; + }, + + /** + * Shuffles the items in the list. + * + * @method Phaser.Structs.List#shuffle + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.List.} - [$return] + * + * @return {Phaser.Structs.List} This List object. + */ + shuffle: function () + { + ArrayUtils.Shuffle(this.list); + + return this; + }, + + /** + * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List. + * + * @method Phaser.Structs.List#replace + * @since 3.0.0 + * + * @genericUse {T} - [oldChild,newChild,$return] + * + * @param {*} oldChild - The child in this List that will be replaced. + * @param {*} newChild - The child to be inserted into this List. + * + * @return {*} Returns the oldChild that was replaced within this group. + */ + replace: function (oldChild, newChild) + { + return ArrayUtils.Replace(this.list, oldChild, newChild); + }, + + /** + * Checks if an item exists within the List. + * + * @method Phaser.Structs.List#exists + * @since 3.0.0 + * + * @genericUse {T} - [child] + * + * @param {*} child - The item to check for the existence of. + * + * @return {boolean} `true` if the item is found in the list, otherwise `false`. + */ + exists: function (child) + { + return (this.list.indexOf(child) > -1); + }, + + /** + * Sets the property `key` to the given value on all members of this List. + * + * @method Phaser.Structs.List#setAll + * @since 3.0.0 + * + * @genericUse {T} - [value] + * + * @param {string} property - The name of the property to set. + * @param {*} value - The value to set the property to. + * @param {number} [startIndex] - The first child index to start the search from. + * @param {number} [endIndex] - The last child index to search up until. + */ + setAll: function (property, value, startIndex, endIndex) + { + ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex); + + return this; + }, + + /** + * Passes all children to the given callback. + * + * @method Phaser.Structs.List#each + * @since 3.0.0 + * + * @genericUse {EachListCallback.} - [callback] + * + * @param {EachListCallback} callback - The function to call. + * @param {*} [context] - Value to use as `this` when executing callback. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + */ + each: function (callback, context) + { + var args = [ null ]; + + for (var i = 2; i < arguments.length; i++) + { + args.push(arguments[i]); + } + + for (i = 0; i < this.list.length; i++) + { + args[0] = this.list[i]; + + callback.apply(context, args); + } + }, + + /** + * Clears the List and recreates its internal array. + * + * @method Phaser.Structs.List#shutdown + * @since 3.0.0 + */ + shutdown: function () + { + this.removeAll(); + + this.list = []; + }, + + /** + * Destroys this List. + * + * @method Phaser.Structs.List#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.removeAll(); + + this.parent = null; + this.addCallback = null; + this.removeCallback = null; + }, + + /** + * The number of items inside the List. + * + * @name Phaser.Structs.List#length + * @type {number} + * @readonly + * @since 3.0.0 + */ + length: { + + get: function () + { + return this.list.length; + } + + }, + + /** + * The first item in the List or `null` for an empty List. + * + * @name Phaser.Structs.List#first + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + first: { + + get: function () + { + this.position = 0; + + if (this.list.length > 0) + { + return this.list[0]; + } + else + { + return null; + } + } + + }, + + /** + * The last item in the List, or `null` for an empty List. + * + * @name Phaser.Structs.List#last + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + last: { + + get: function () + { + if (this.list.length > 0) + { + this.position = this.list.length - 1; + + return this.list[this.position]; + } + else + { + return null; + } + } + + }, + + /** + * The next item in the List, or `null` if the entire List has been traversed. + * + * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List. + * + * @name Phaser.Structs.List#next + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + next: { + + get: function () + { + if (this.position < this.list.length) + { + this.position++; + + return this.list[this.position]; + } + else + { + return null; + } + } + + }, + + /** + * The previous item in the List, or `null` if the entire List has been traversed. + * + * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards. + * + * @name Phaser.Structs.List#previous + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + previous: { + + get: function () + { + if (this.position > 0) + { + this.position--; + + return this.list[this.position]; + } + else + { + return null; + } + } + + } + +}); + +module.exports = List; + + +/***/ }), +/* 106 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -21605,11 +27858,11 @@ module.exports = Frame; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(99); -var GetPoint = __webpack_require__(412); -var GetPoints = __webpack_require__(413); -var GEOM_CONST = __webpack_require__(49); -var Random = __webpack_require__(167); +var Contains = __webpack_require__(107); +var GetPoint = __webpack_require__(422); +var GetPoints = __webpack_require__(423); +var GEOM_CONST = __webpack_require__(55); +var Random = __webpack_require__(172); /** * @classdesc @@ -21645,7 +27898,7 @@ var Ellipse = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Ellipse#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -21737,7 +27990,7 @@ var Ellipse = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -21977,7 +28230,7 @@ module.exports = Ellipse; /***/ }), -/* 99 */ +/* 107 */ /***/ (function(module, exports) { /** @@ -22019,7 +28272,7 @@ module.exports = Contains; /***/ }), -/* 100 */ +/* 108 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -22028,16 +28281,17 @@ module.exports = Contains; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Actions = __webpack_require__(252); +var Actions = __webpack_require__(267); var Class = __webpack_require__(0); -var Events = __webpack_require__(29); -var GetAll = __webpack_require__(193); +var Events = __webpack_require__(32); +var EventEmitter = __webpack_require__(10); +var GetAll = __webpack_require__(198); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); var IsPlainObject = __webpack_require__(7); -var Range = __webpack_require__(404); -var Set = __webpack_require__(141); -var Sprite = __webpack_require__(76); +var Range = __webpack_require__(414); +var Set = __webpack_require__(145); +var Sprite = __webpack_require__(70); /** * @classdesc @@ -22049,6 +28303,7 @@ var Sprite = __webpack_require__(76); * * @class Group * @memberof Phaser.GameObjects + * @extends Phaser.Events.EventEmitter * @constructor * @since 3.0.0 * @param {Phaser.Scene} scene - The scene this group belongs to. @@ -22060,10 +28315,14 @@ var Sprite = __webpack_require__(76); */ var Group = new Class({ + Extends: EventEmitter, + initialize: function Group (scene, children, config) { + EventEmitter.call(this); + // They can pass in any of the following as the first argument: // 1) A single child @@ -22173,7 +28432,7 @@ var Group = new Class({ * The maximum size of this group, if used as a pool. -1 is no limit. * * @name Phaser.GameObjects.Group#maxSize - * @type {integer} + * @type {number} * @since 3.0.0 * @default -1 */ @@ -22195,7 +28454,7 @@ var Group = new Class({ * A default texture frame to use when creating new group members. * * @name Phaser.GameObjects.Group#defaultFrame - * @type {(string|integer)} + * @type {(string|number)} * @since 3.0.0 */ this.defaultFrame = GetFastValue(config, 'defaultFrame', null); @@ -22269,6 +28528,21 @@ var Group = new Class({ { this.createMultiple(config); } + + this.on(Events.ADDED_TO_SCENE, this.addedToScene, this); + this.on(Events.REMOVED_FROM_SCENE, this.removedFromScene, this); + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); }, /** @@ -22282,7 +28556,7 @@ var Group = new Class({ * @param {number} [x=0] - The horizontal position of the new Game Object in the world. * @param {number} [y=0] - The vertical position of the new Game Object in the world. * @param {string} [key=defaultKey] - The texture key of the new Game Object. - * @param {(string|integer)} [frame=defaultFrame] - The texture frame of the new Game Object. + * @param {(string|number)} [frame=defaultFrame] - The texture frame of the new Game Object. * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of the new Game Object. * @param {boolean} [active=true] - The {@link Phaser.GameObjects.GameObject#active} state of the new Game Object. * @@ -22758,7 +29032,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getLength * @since 3.0.0 * - * @return {integer} + * @return {number} */ getLength: function () { @@ -22779,14 +29053,14 @@ var Group = new Class({ * * @param {string} [property] - The property to test on each array element. * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex] - An optional start index to search from. - * @param {integer} [endIndex] - An optional end index to search to. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * * @return {any[]} An array of matching Group members. The array will be empty if nothing matched. */ getMatching: function (property, value, startIndex, endIndex) { - return GetAll(this.children, property, value, startIndex, endIndex); + return GetAll(this.children.entries, property, value, startIndex, endIndex); }, /** @@ -22804,7 +29078,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -22824,13 +29098,13 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getFirstNth * @since 3.6.0 * - * @param {integer} nth - The nth matching Group member to search for. + * @param {number} nth - The nth matching Group member to search for. * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -22855,7 +29129,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -22875,13 +29149,13 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getLastNth * @since 3.6.0 * - * @param {integer} nth - The nth matching Group member to search for. + * @param {number} nth - The nth matching Group member to search for. * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -22903,13 +29177,13 @@ var Group = new Class({ * @since 3.6.0 * * @param {boolean} forwards - Search front to back or back to front? - * @param {integer} nth - Stop matching after nth successful matches. + * @param {number} nth - Stop matching after nth successful matches. * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first matching group member, or a newly created member, or null. @@ -23008,7 +29282,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {?any} The first inactive group member, or a newly created member, or null. @@ -23032,7 +29306,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {any} The first active group member, or a newly created member, or null. @@ -23057,7 +29331,7 @@ var Group = new Class({ * @param {number} [x] - The horizontal position of the Game Object in the world. * @param {number} [y] - The vertical position of the Game Object in the world. * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|integer)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * * @return {any} The first inactive group member, or a newly created member, or null. @@ -23113,7 +29387,7 @@ var Group = new Class({ * * @param {boolean} [value=true] - Count active (true) or inactive (false) group members. * - * @return {integer} The number of group members with an active state matching the `active` argument. + * @return {number} The number of group members with an active state matching the `active` argument. */ countActive: function (value) { @@ -23138,7 +29412,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getTotalUsed * @since 3.0.0 * - * @return {integer} The number of group members with an active state of true. + * @return {number} The number of group members with an active state of true. */ getTotalUsed: function () { @@ -23153,7 +29427,7 @@ var Group = new Class({ * @method Phaser.GameObjects.Group#getTotalFree * @since 3.0.0 * - * @return {integer} maxSize minus the number of active group numbers; or a large number (if maxSize is -1). + * @return {number} maxSize minus the number of active group numbers; or a large number (if maxSize is -1). */ getTotalFree: function () { @@ -23208,8 +29482,8 @@ var Group = new Class({ * @param {string} key - The property to be updated. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {this} This Group object. */ @@ -23229,8 +29503,8 @@ var Group = new Class({ * @param {string} key - The property to be updated. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {this} This Group object. */ @@ -23364,7 +29638,7 @@ var Group = new Class({ * * @param {number} x - The x coordinate to place the first item in the array at. * @param {number} y - The y coordinate to place the first item in the array at. - * @param {integer} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. + * @param {number} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. * * @return {this} This Group object. */ @@ -23670,8 +29944,8 @@ var Group = new Class({ * @since 3.21.0 * * @param {boolean} value - The value to set the property to. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {this} This Group object. */ @@ -23729,7 +30003,7 @@ module.exports = Group; /***/ }), -/* 101 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -23738,7 +30012,7 @@ module.exports = Group; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders a filled path for the given Shape. @@ -23756,7 +30030,7 @@ var Utils = __webpack_require__(10); */ var FillPathWebGL = function (pipeline, calcMatrix, src, alpha, dx, dy) { - var fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha); + var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); var path = src.pathData; var pathIndexes = src.pathIndexes; @@ -23783,9 +30057,7 @@ var FillPathWebGL = function (pipeline, calcMatrix, src, alpha, dx, dy) var tx2 = calcMatrix.getX(x2, y2); var ty2 = calcMatrix.getY(x2, y2); - pipeline.setTexture2D(); - - pipeline.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, fillTintColor, fillTintColor, fillTintColor, pipeline.tintEffect); + pipeline.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, fillTintColor, fillTintColor, fillTintColor); } }; @@ -23793,7 +30065,957 @@ module.exports = FillPathWebGL; /***/ }), -/* 102 */ +/* 110 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// http://www.blackpawn.com/texts/pointinpoly/ + +/** + * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds. + * + * @function Phaser.Geom.Triangle.Contains + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. + * + * @return {boolean} `true` if the point is inside the Triangle, otherwise `false`. + */ +var Contains = function (triangle, x, y) +{ + var v0x = triangle.x3 - triangle.x1; + var v0y = triangle.y3 - triangle.y1; + + var v1x = triangle.x2 - triangle.x1; + var v1y = triangle.y2 - triangle.y1; + + var v2x = x - triangle.x1; + var v2y = y - triangle.y1; + + var dot00 = (v0x * v0x) + (v0y * v0y); + var dot01 = (v0x * v1x) + (v0y * v1y); + var dot02 = (v0x * v2x) + (v0y * v2y); + var dot11 = (v1x * v1x) + (v1y * v1y); + var dot12 = (v1x * v2x) + (v1y * v2y); + + // Compute barycentric coordinates + var b = ((dot00 * dot11) - (dot01 * dot01)); + var inv = (b === 0) ? 0 : (1 / b); + var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; + var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; + + return (u >= 0 && v >= 0 && (u + v < 1)); +}; + +module.exports = Contains; + + +/***/ }), +/* 111 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Rectangle = __webpack_require__(9); +var RectangleToRectangle = __webpack_require__(112); +var Vector2 = __webpack_require__(3); + +/** + * Returns the length of the line. + * + * @ignore + * @private + * + * @param {number} x1 - The x1 coordinate. + * @param {number} y1 - The y1 coordinate. + * @param {number} x2 - The x2 coordinate. + * @param {number} y2 - The y2 coordinate. + * + * @return {number} The length of the line. + */ +function GetLength (x1, y1, x2, y2) +{ + var x = x1 - x2; + var y = y1 - y2; + var magnitude = (x * x) + (y * y); + + return Math.sqrt(magnitude); +} + +/** + * @classdesc + * A Face Geometry Object. + * + * A Face is used by the Mesh Game Object. A Mesh consists of one, or more, faces that are + * used to render the Mesh Game Objects in WebGL. + * + * A Face consists of 3 Vertex instances, for the 3 corners of the face and methods to help + * you modify and test them. + * + * @class Face + * @memberof Phaser.Geom.Mesh + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Vertex} vertex1 - The first vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex2 - The second vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex3 - The third vertex of the Face. + */ +var Face = new Class({ + + initialize: + + function Face (vertex1, vertex2, vertex3) + { + /** + * The first vertex in this Face. + * + * @name Phaser.Geom.Mesh.Face#vertex1 + * @type {Phaser.Geom.Mesh.Vertex} + * @since 3.50.0 + */ + this.vertex1 = vertex1; + + /** + * The second vertex in this Face. + * + * @name Phaser.Geom.Mesh.Face#vertex2 + * @type {Phaser.Geom.Mesh.Vertex} + * @since 3.50.0 + */ + this.vertex2 = vertex2; + + /** + * The third vertex in this Face. + * + * @name Phaser.Geom.Mesh.Face#vertex3 + * @type {Phaser.Geom.Mesh.Vertex} + * @since 3.50.0 + */ + this.vertex3 = vertex3; + + /** + * The bounds of this Face. + * + * Be sure to call the `Face.updateBounds` method _before_ using this property. + * + * @name Phaser.Geom.Mesh.Face#bounds + * @type {Phaser.Geom.Rectangle} + * @since 3.50.0 + */ + this.bounds = new Rectangle(); + + /** + * The face inCenter. Do not access directly, instead use the `getInCenter` method. + * + * @name Phaser.Geom.Mesh.Face#_inCenter + * @type {Phaser.Math.Vector2} + * @private + * @since 3.50.0 + */ + this._inCenter = new Vector2(); + }, + + /** + * Calculates and returns the in-center position of this Face. + * + * @method Phaser.Geom.Mesh.Face#getInCenter + * @since 3.50.0 + * + * @param {boolean} [local=true] Return the in center from the un-transformed vertex positions (`true`), or transformed? (`false`) + * + * @return {Phaser.Math.Vector2} A Vector2 containing the in center position of this Face. + */ + getInCenter: function (local) + { + if (local === undefined) { local = true; } + + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + var v1x; + var v1y; + + var v2x; + var v2y; + + var v3x; + var v3y; + + if (local) + { + v1x = v1.x; + v1y = v1.y; + + v2x = v2.x; + v2y = v2.y; + + v3x = v3.x; + v3y = v3.y; + } + else + { + v1x = v1.vx; + v1y = v1.vy; + + v2x = v2.vx; + v2y = v2.vy; + + v3x = v3.vx; + v3y = v3.vy; + } + + var d1 = GetLength(v3x, v3y, v2x, v2y); + var d2 = GetLength(v1x, v1y, v3x, v3y); + var d3 = GetLength(v2x, v2y, v1x, v1y); + + var p = d1 + d2 + d3; + + return this._inCenter.set( + (v1x * d1 + v2x * d2 + v3x * d3) / p, + (v1y * d1 + v2y * d2 + v3y * d3) / p + ); + }, + + /** + * Checks if the given coordinates are within this Face. + * + * You can optionally provide a transform matrix. If given, the Face vertices + * will be transformed first, before being checked against the coordinates. + * + * @method Phaser.Geom.Mesh.Face#contains + * @since 3.50.0 + * + * @param {number} x - The horizontal position to check. + * @param {number} y - The vertical position to check. + * @param {Phaser.GameObjects.Components.TransformMatrix} [calcMatrix] - Optional transform matrix to apply to the vertices before comparison. + * + * @return {boolean} `true` if the coordinates lay within this Face, otherwise `false`. + */ + contains: function (x, y, calcMatrix) + { + var vertex1 = this.vertex1; + var vertex2 = this.vertex2; + var vertex3 = this.vertex3; + + var v1x = vertex1.vx; + var v1y = vertex1.vy; + + var v2x = vertex2.vx; + var v2y = vertex2.vy; + + var v3x = vertex3.vx; + var v3y = vertex3.vy; + + if (calcMatrix) + { + var a = calcMatrix.a; + var b = calcMatrix.b; + var c = calcMatrix.c; + var d = calcMatrix.d; + var e = calcMatrix.e; + var f = calcMatrix.f; + + v1x = vertex1.vx * a + vertex1.vy * c + e; + v1y = vertex1.vx * b + vertex1.vy * d + f; + + v2x = vertex2.vx * a + vertex2.vy * c + e; + v2y = vertex2.vx * b + vertex2.vy * d + f; + + v3x = vertex3.vx * a + vertex3.vy * c + e; + v3y = vertex3.vx * b + vertex3.vy * d + f; + } + + var t0x = v3x - v1x; + var t0y = v3y - v1y; + + var t1x = v2x - v1x; + var t1y = v2y - v1y; + + var t2x = x - v1x; + var t2y = y - v1y; + + var dot00 = (t0x * t0x) + (t0y * t0y); + var dot01 = (t0x * t1x) + (t0y * t1y); + var dot02 = (t0x * t2x) + (t0y * t2y); + var dot11 = (t1x * t1x) + (t1y * t1y); + var dot12 = (t1x * t2x) + (t1y * t2y); + + // Compute barycentric coordinates + var bc = ((dot00 * dot11) - (dot01 * dot01)); + var inv = (bc === 0) ? 0 : (1 / bc); + var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; + var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; + + return (u >= 0 && v >= 0 && (u + v < 1)); + }, + + /** + * Checks if the vertices in this Face are orientated counter-clockwise, or not. + * + * It checks the transformed position of the vertices, not the local one. + * + * @method Phaser.Geom.Mesh.Face#isCounterClockwise + * @since 3.50.0 + * + * @param {number} z - The z-axis value to test against. Typically the `Mesh.modelPosition.z`. + * + * @return {boolean} `true` if the vertices in this Face run counter-clockwise, otherwise `false`. + */ + isCounterClockwise: function (z) + { + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + var d = (v2.vx - v1.vx) * (v3.vy - v1.vy) - (v2.vy - v1.vy) * (v3.vx - v1.vx); + + return (z <= 0) ? d >= 0 : d < 0; + }, + + /** + * Loads the data from this Vertex into the given Typed Arrays. + * + * @method Phaser.Geom.Mesh.Face#load + * @since 3.50.0 + * + * @param {Float32Array} F32 - A Float32 Array to insert the position, UV and unit data in to. + * @param {Uint32Array} U32 - A Uint32 Array to insert the color and alpha data in to. + * @param {number} offset - The index of the array to insert this Vertex to. + * @param {number} textureUnit - The texture unit currently in use. + * @param {number} alpha - The alpha of the parent object. + * @param {number} a - The parent transform matrix data a component. + * @param {number} b - The parent transform matrix data b component. + * @param {number} c - The parent transform matrix data c component. + * @param {number} d - The parent transform matrix data d component. + * @param {number} e - The parent transform matrix data e component. + * @param {number} f - The parent transform matrix data f component. + * @param {boolean} roundPixels - Round the vertex position or not? + * + * @return {number} The new vertex index array offset. + */ + load: function (F32, U32, offset, textureUnit, tintEffect) + { + offset = this.vertex1.load(F32, U32, offset, textureUnit, tintEffect); + offset = this.vertex2.load(F32, U32, offset, textureUnit, tintEffect); + offset = this.vertex3.load(F32, U32, offset, textureUnit, tintEffect); + + return offset; + }, + + /** + * Transforms all Face vertices by the given matrix, storing the results in their `vx`, `vy` and `vz` properties. + * + * @method Phaser.Geom.Mesh.Face#transformCoordinatesLocal + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} transformMatrix - The transform matrix to apply to this vertex. + * @param {number} width - The width of the parent Mesh. + * @param {number} height - The height of the parent Mesh. + * @param {number} cameraZ - The z position of the MeshCamera. + * + * @return {this} This Face instance. + */ + transformCoordinatesLocal: function (transformMatrix, width, height, cameraZ) + { + this.vertex1.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); + this.vertex2.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); + this.vertex3.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); + + return this; + }, + + /** + * Updates the bounds of this Face, based on the translated values of the vertices. + * + * Call this method prior to accessing the `Face.bounds` property. + * + * @method Phaser.Geom.Mesh.Face#updateBounds + * @since 3.50.0 + * + * @return {this} This Face instance. + */ + updateBounds: function () + { + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + var bounds = this.bounds; + + bounds.x = Math.min(v1.vx, v2.vx, v3.vx); + bounds.y = Math.min(v1.vy, v2.vy, v3.vy); + bounds.width = Math.max(v1.vx, v2.vx, v3.vx) - bounds.x; + bounds.height = Math.max(v1.vy, v2.vy, v3.vy) - bounds.y; + + return this; + }, + + /** + * Checks if this Face is within the view of the given Camera. + * + * This method is called in the `MeshWebGLRenderer` function. It performs the following tasks: + * + * First, the `Vertex.update` method is called on each of the vertices. This populates them + * with the new translated values, updating their `tx`, `ty` and `ta` properties. + * + * Then it tests to see if this face is visible due to the alpha values, if not, it returns. + * + * After this, if `hideCCW` is set, it calls `isCounterClockwise` and returns if not. + * + * Finally, it will update the `Face.bounds` based on the newly translated vertex values + * and return the results of an intersection test between the bounds and the camera world view + * rectangle. + * + * @method Phaser.Geom.Mesh.Face#isInView + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against. + * @param {boolean} hideCCW - Test the counter-clockwise orientation of the verts? + * @param {number} z - The Cameras z position, used in the CCW test. + * @param {number} alpha - The alpha of the parent object. + * @param {number} a - The parent transform matrix data a component. + * @param {number} b - The parent transform matrix data b component. + * @param {number} c - The parent transform matrix data c component. + * @param {number} d - The parent transform matrix data d component. + * @param {number} e - The parent transform matrix data e component. + * @param {number} f - The parent transform matrix data f component. + * @param {boolean} roundPixels - Round the vertex position or not? + * + * @return {boolean} `true` if this Face can be seen by the Camera. + */ + isInView: function (camera, hideCCW, z, alpha, a, b, c, d, e, f, roundPixels) + { + var v1 = this.vertex1.update(a, b, c, d, e, f, roundPixels, alpha); + var v2 = this.vertex2.update(a, b, c, d, e, f, roundPixels, alpha); + var v3 = this.vertex3.update(a, b, c, d, e, f, roundPixels, alpha); + + // Alpha check first + if (v1.ta <= 0 && v2.ta <= 0 && v3.ta <= 0) + { + return false; + } + + // CCW check + if (hideCCW && !this.isCounterClockwise(z)) + { + return false; + } + + // Bounds check + var bounds = this.bounds; + + bounds.x = Math.min(v1.tx, v2.tx, v3.tx); + bounds.y = Math.min(v1.ty, v2.ty, v3.ty); + bounds.width = Math.max(v1.tx, v2.tx, v3.tx) - bounds.x; + bounds.height = Math.max(v1.ty, v2.ty, v3.ty) - bounds.y; + + return RectangleToRectangle(bounds, camera.worldView); + }, + + /** + * Translates the vertices of this Face by the given amounts. + * + * The actual vertex positions are adjusted, not their transformed position. + * + * Therefore, this updates the vertex data directly. + * + * @method Phaser.Geom.Mesh.Face#translate + * @since 3.50.0 + * + * @param {number} x - The amount to horizontally translate by. + * @param {number} [y=0] - The amount to vertically translate by. + * + * @return {this} This Face instance. + */ + translate: function (x, y) + { + if (y === undefined) { y = 0; } + + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + v1.x += x; + v1.y += y; + + v2.x += x; + v2.y += y; + + v3.x += x; + v3.y += y; + + return this; + }, + + /** + * The x coordinate of this Face, based on the in center position of the Face. + * + * @name Phaser.Geom.Mesh.Face#x + * @type {number} + * @since 3.50.0 + */ + x: { + + get: function () + { + return this.getInCenter().x; + }, + + set: function (value) + { + var current = this.getInCenter(); + + this.translate(value - current.x, 0); + } + + }, + + /** + * The y coordinate of this Face, based on the in center position of the Face. + * + * @name Phaser.Geom.Mesh.Face#y + * @type {number} + * @since 3.50.0 + */ + y: { + + get: function () + { + return this.getInCenter().y; + }, + + set: function (value) + { + var current = this.getInCenter(); + + this.translate(0, value - current.y); + } + + }, + + /** + * Set the alpha value of this Face. + * + * Each vertex is given the same value. If you need to adjust the alpha on a per-vertex basis + * then use the `Vertex.alpha` property instead. + * + * When getting the alpha of this Face, it will return an average of the alpha + * component of all three vertices. + * + * @name Phaser.Geom.Mesh.Face#alpha + * @type {number} + * @since 3.50.0 + */ + alpha: { + + get: function () + { + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + return (v1.alpha + v2.alpha + v3.alpha) / 3; + }, + + set: function (value) + { + this.vertex1.alpha = value; + this.vertex2.alpha = value; + this.vertex3.alpha = value; + } + + }, + + /** + * The depth of this Face, which is an average of the z component of all three vertices. + * + * The depth is calculated based on the transformed z value, not the local one. + * + * @name Phaser.Geom.Mesh.Face#depth + * @type {number} + * @readonly + * @since 3.50.0 + */ + depth: { + + get: function () + { + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + return (v1.vz + v2.vz + v3.vz) / 3; + } + + }, + + /** + * Destroys this Face and nulls the references to the vertices. + * + * @method Phaser.Geom.Mesh.Face#destroy + * @since 3.50.0 + */ + destroy: function () + { + this.vertex1 = null; + this.vertex2 = null; + this.vertex3 = null; + } + +}); + +module.exports = Face; + + +/***/ }), +/* 112 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Checks if two Rectangles intersect. + * + * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. + * As such, the two Rectangles are considered "solid". + * A Rectangle with no width or no height will never intersect another Rectangle. + * + * @function Phaser.Geom.Intersects.RectangleToRectangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. + * + * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`. + */ +var RectangleToRectangle = function (rectA, rectB) +{ + if (rectA.width <= 0 || rectA.height <= 0 || rectB.width <= 0 || rectB.height <= 0) + { + return false; + } + + return !(rectA.right < rectB.x || rectA.bottom < rectB.y || rectA.x > rectB.right || rectA.y > rectB.bottom); +}; + +module.exports = RectangleToRectangle; + + +/***/ }), +/* 113 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Utils = __webpack_require__(12); +var Vector3 = __webpack_require__(37); + +/** + * @classdesc + * A Vertex Geometry Object. + * + * This class consists of all the information required for a single vertex within a Face Geometry Object. + * + * Faces, and thus Vertex objects, are used by the Mesh Game Object in order to render objects in WebGL. + * + * @class Vertex + * @memberof Phaser.Geom.Mesh + * @constructor + * @extends Phaser.Math.Vector3 + * @since 3.50.0 + * + * @param {number} x - The x position of the vertex. + * @param {number} y - The y position of the vertex. + * @param {number} z - The z position of the vertex. + * @param {number} u - The UV u coordinate of the vertex. + * @param {number} v - The UV v coordinate of the vertex. + * @param {number} [color=0xffffff] - The color value of the vertex. + * @param {number} [alpha=1] - The alpha value of the vertex. + * @param {number} [nx=0] - The x normal value of the vertex. + * @param {number} [ny=0] - The y normal value of the vertex. + * @param {number} [nz=0] - The z normal value of the vertex. + */ +var Vertex = new Class({ + + Extends: Vector3, + + initialize: + + function Vertex (x, y, z, u, v, color, alpha, nx, ny, nz) + { + if (color === undefined) { color = 0xffffff; } + if (alpha === undefined) { alpha = 1; } + if (nx === undefined) { nx = 0; } + if (ny === undefined) { ny = 0; } + if (nz === undefined) { nz = 0; } + + Vector3.call(this, x, y, z); + + /** + * The projected x coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#vx + * @type {number} + * @since 3.50.0 + */ + this.vx = 0; + + /** + * The projected y coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#vy + * @type {number} + * @since 3.50.0 + */ + this.vy = 0; + + /** + * The projected z coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#vz + * @type {number} + * @since 3.50.0 + */ + this.vz = 0; + + /** + * The projected x coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#nx + * @type {number} + * @since 3.50.0 + */ + this.nx = nx; + + /** + * The projected y coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#ny + * @type {number} + * @since 3.50.0 + */ + this.ny = ny; + + /** + * The projected z coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#nz + * @type {number} + * @since 3.50.0 + */ + this.nz = nz; + + /** + * UV u coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#u + * @type {number} + * @since 3.50.0 + */ + this.u = u; + + /** + * UV v coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#v + * @type {number} + * @since 3.50.0 + */ + this.v = v; + + /** + * The color value of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#color + * @type {number} + * @since 3.50.0 + */ + this.color = color; + + /** + * The alpha value of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#alpha + * @type {number} + * @since 3.50.0 + */ + this.alpha = alpha; + + /** + * The translated x coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#tx + * @type {number} + * @since 3.50.0 + */ + this.tx = 0; + + /** + * The translated y coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#ty + * @type {number} + * @since 3.50.0 + */ + this.ty = 0; + + /** + * The translated alpha value of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#ta + * @type {number} + * @since 3.50.0 + */ + this.ta = 0; + }, + + /** + * Sets the U and V properties. + * + * @method Phaser.Geom.Mesh.Vertex#setUVs + * @since 3.50.0 + * + * @param {number} u - The UV u coordinate of the vertex. + * @param {number} v - The UV v coordinate of the vertex. + * + * @return {this} This Vertex. + */ + setUVs: function (u, v) + { + this.u = u; + this.v = v; + + return this; + }, + + /** + * Transforms this vertex by the given matrix, storing the results in `vx`, `vy` and `vz`. + * + * @method Phaser.Geom.Mesh.Vertex#transformCoordinatesLocal + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} transformMatrix - The transform matrix to apply to this vertex. + * @param {number} width - The width of the parent Mesh. + * @param {number} height - The height of the parent Mesh. + * @param {number} cameraZ - The z position of the MeshCamera. + */ + transformCoordinatesLocal: function (transformMatrix, width, height, cameraZ) + { + var x = this.x; + var y = this.y; + var z = this.z; + + var m = transformMatrix.val; + + var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; + var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; + var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; + var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + + this.vx = (tx / tw) * width; + this.vy = -(ty / tw) * height; + + if (cameraZ <= 0) + { + this.vz = (tz / tw); + } + else + { + this.vz = -(tz / tw); + } + }, + + /** + * Updates this Vertex based on the given transform. + * + * @method Phaser.Geom.Mesh.Vertex#update + * @since 3.50.0 + * + * @param {number} a - The parent transform matrix data a component. + * @param {number} b - The parent transform matrix data b component. + * @param {number} c - The parent transform matrix data c component. + * @param {number} d - The parent transform matrix data d component. + * @param {number} e - The parent transform matrix data e component. + * @param {number} f - The parent transform matrix data f component. + * @param {boolean} roundPixels - Round the vertex position or not? + * @param {number} alpha - The alpha of the parent object. + * + * @return {this} This Vertex. + */ + update: function (a, b, c, d, e, f, roundPixels, alpha) + { + var tx = this.vx * a + this.vy * c + e; + var ty = this.vx * b + this.vy * d + f; + + if (roundPixels) + { + tx = Math.round(tx); + ty = Math.round(ty); + } + + this.tx = tx; + this.ty = ty; + this.ta = this.alpha * alpha; + + return this; + }, + + /** + * Loads the data from this Vertex into the given Typed Arrays. + * + * @method Phaser.Geom.Mesh.Vertex#load + * @since 3.50.0 + * + * @param {Float32Array} F32 - A Float32 Array to insert the position, UV and unit data in to. + * @param {Uint32Array} U32 - A Uint32 Array to insert the color and alpha data in to. + * @param {number} offset - The index of the array to insert this Vertex to. + * @param {number} textureUnit - The texture unit currently in use. + * + * @return {number} The new array offset. + */ + load: function (F32, U32, offset, textureUnit, tintEffect) + { + F32[++offset] = this.tx; + F32[++offset] = this.ty; + F32[++offset] = this.u; + F32[++offset] = this.v; + F32[++offset] = textureUnit; + F32[++offset] = tintEffect; + U32[++offset] = Utils.getTintAppendFloatAlpha(this.color, this.ta); + + return offset; + } + +}); + +module.exports = Vertex; + + +/***/ }), +/* 114 */ /***/ (function(module, exports) { /** @@ -24037,7 +31259,7 @@ module.exports = Vector; })(); /***/ }), -/* 103 */ +/* 115 */ /***/ (function(module, exports) { /** @@ -24163,7 +31385,7 @@ module.exports = Bounds; /***/ }), -/* 104 */ +/* 116 */ /***/ (function(module, exports) { /** @@ -24178,8 +31400,8 @@ module.exports = Bounds; * @function Phaser.Tilemaps.Components.IsInLayerBounds * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {boolean} `true` if the tile coordinates are within the bounds of the layer, otherwise `false`. @@ -24193,7 +31415,7 @@ module.exports = IsInLayerBounds; /***/ }), -/* 105 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -24203,12 +31425,13 @@ module.exports = IsInLayerBounds; */ var Class = __webpack_require__(0); +var CONST = __webpack_require__(29); var GetFastValue = __webpack_require__(2); /** * @classdesc * A class for representing data about about a layer in a map. Maps are parsed from CSV, Tiled, - * etc. into this format. Tilemap, StaticTilemapLayer and DynamicTilemapLayer have a reference + * etc. into this format. Tilemap and TilemapLayer objects have a reference * to this data and use it to look up and perform operations on tiles. * * @class LayerData @@ -24307,6 +31530,15 @@ var LayerData = new Class({ */ this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); + /** + * The layers orientation, necessary to be able to determine a tiles pixelX and pixelY as well as the layers width and height. + * + * @name Phaser.Tilemaps.LayerData#orientation + * @type {Phaser.Tilemaps.OrientationType} + * @since 3.50.0 + */ + this.orientation = GetFastValue(config, 'orientation', CONST.ORTHOGONAL); + /** * The width in pixels of the entire layer. * @@ -24401,10 +31633,20 @@ var LayerData = new Class({ * A reference to the Tilemap layer that owns this data. * * @name Phaser.Tilemaps.LayerData#tilemapLayer - * @type {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} + * @type {Phaser.Tilemaps.TilemapLayer} * @since 3.0.0 */ this.tilemapLayer = GetFastValue(config, 'tilemapLayer', null); + + /** + * The length of the horizontal sides of the hexagon. + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.LayerData#hexSideLength + * @type {number} + * @since 3.50.0 + */ + this.hexSideLength = GetFastValue(config, 'hexSideLength', 0); } }); @@ -24413,7 +31655,7 @@ module.exports = LayerData; /***/ }), -/* 106 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -24423,6 +31665,7 @@ module.exports = LayerData; */ var Class = __webpack_require__(0); +var CONST = __webpack_require__(29); var GetFastValue = __webpack_require__(2); /** @@ -24448,7 +31691,7 @@ var MapData = new Class({ /** * The key in the Phaser cache that corresponds to the loaded tilemap data. - * + * * @name Phaser.Tilemaps.MapData#name * @type {string} * @since 3.0.0 @@ -24457,7 +31700,7 @@ var MapData = new Class({ /** * The width of the entire tilemap. - * + * * @name Phaser.Tilemaps.MapData#width * @type {number} * @since 3.0.0 @@ -24466,7 +31709,7 @@ var MapData = new Class({ /** * The height of the entire tilemap. - * + * * @name Phaser.Tilemaps.MapData#height * @type {number} * @since 3.0.0 @@ -24484,7 +31727,7 @@ var MapData = new Class({ /** * The width of the tiles. - * + * * @name Phaser.Tilemaps.MapData#tileWidth * @type {number} * @since 3.0.0 @@ -24493,7 +31736,7 @@ var MapData = new Class({ /** * The height of the tiles. - * + * * @name Phaser.Tilemaps.MapData#tileHeight * @type {number} * @since 3.0.0 @@ -24502,7 +31745,7 @@ var MapData = new Class({ /** * The width in pixels of the entire tilemap. - * + * * @name Phaser.Tilemaps.MapData#widthInPixels * @type {number} * @since 3.0.0 @@ -24511,7 +31754,7 @@ var MapData = new Class({ /** * The height in pixels of the entire tilemap. - * + * * @name Phaser.Tilemaps.MapData#heightInPixels * @type {number} * @since 3.0.0 @@ -24520,30 +31763,30 @@ var MapData = new Class({ /** * The format of the map data. - * + * * @name Phaser.Tilemaps.MapData#format - * @type {integer} + * @type {number} * @since 3.0.0 */ this.format = GetFastValue(config, 'format', null); /** * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. - * + * * @name Phaser.Tilemaps.MapData#orientation - * @type {string} - * @since 3.0.0 + * @type {Phaser.Tilemaps.OrientationType} + * @since 3.50.0 */ - this.orientation = GetFastValue(config, 'orientation', 'orthogonal'); + this.orientation = GetFastValue(config, 'orientation', CONST.ORTHOGONAL); /** * Determines the draw order of tilemap. Default is right-down - * + * * 0, or 'right-down' * 1, or 'left-down' * 2, or 'right-up' * 3, or 'left-up' - * + * * @name Phaser.Tilemaps.MapData#renderOrder * @type {string} * @since 3.12.0 @@ -24552,7 +31795,7 @@ var MapData = new Class({ /** * The version of the map data (as specified in Tiled). - * + * * @name Phaser.Tilemaps.MapData#version * @type {string} * @since 3.0.0 @@ -24561,7 +31804,7 @@ var MapData = new Class({ /** * Map specific properties (can be specified in Tiled) - * + * * @name Phaser.Tilemaps.MapData#properties * @type {object} * @since 3.0.0 @@ -24570,7 +31813,7 @@ var MapData = new Class({ /** * An array with all the layers configured to the MapData. - * + * * @name Phaser.Tilemaps.MapData#layers * @type {(Phaser.Tilemaps.LayerData[]|Phaser.Tilemaps.ObjectLayer)} * @since 3.0.0 @@ -24579,7 +31822,7 @@ var MapData = new Class({ /** * An array of Tiled Image Layers. - * + * * @name Phaser.Tilemaps.MapData#images * @type {array} * @since 3.0.0 @@ -24588,7 +31831,7 @@ var MapData = new Class({ /** * An object of Tiled Object Layers. - * + * * @name Phaser.Tilemaps.MapData#objects * @type {object} * @since 3.0.0 @@ -24597,7 +31840,7 @@ var MapData = new Class({ /** * An object of collision data. Must be created as physics object or will return undefined. - * + * * @name Phaser.Tilemaps.MapData#collision * @type {object} * @since 3.0.0 @@ -24606,7 +31849,7 @@ var MapData = new Class({ /** * An array of Tilesets. - * + * * @name Phaser.Tilemaps.MapData#tilesets * @type {Phaser.Tilemaps.Tileset[]} * @since 3.0.0 @@ -24615,7 +31858,7 @@ var MapData = new Class({ /** * The collection of images the map uses(specified in Tiled) - * + * * @name Phaser.Tilemaps.MapData#imageCollections * @type {array} * @since 3.0.0 @@ -24624,12 +31867,22 @@ var MapData = new Class({ /** * An array of tile instances. - * + * * @name Phaser.Tilemaps.MapData#tiles * @type {array} * @since 3.0.0 */ this.tiles = GetFastValue(config, 'tiles', []); + + /** + * The length of the horizontal sides of the hexagon. + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.MapData#hexSideLength + * @type {number} + * @since 3.50.0 + */ + this.hexSideLength = GetFastValue(config, 'hexSideLength', 0); } }); @@ -24638,7 +31891,7 @@ module.exports = MapData; /***/ }), -/* 107 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -24660,11 +31913,11 @@ var Class = __webpack_require__(0); * @since 3.0.0 * * @param {string} name - The name of the tileset in the map data. - * @param {integer} firstgid - The first tile index this tileset contains. - * @param {integer} [tileWidth=32] - Width of each tile (in pixels). - * @param {integer} [tileHeight=32] - Height of each tile (in pixels). - * @param {integer} [tileMargin=0] - The margin around all tiles in the sheet (in pixels). - * @param {integer} [tileSpacing=0] - The spacing between each tile in the sheet (in pixels). + * @param {number} firstgid - The first tile index this tileset contains. + * @param {number} [tileWidth=32] - Width of each tile (in pixels). + * @param {number} [tileHeight=32] - Height of each tile (in pixels). + * @param {number} [tileMargin=0] - The margin around all tiles in the sheet (in pixels). + * @param {number} [tileSpacing=0] - The spacing between each tile in the sheet (in pixels). * @param {object} [tileProperties={}] - Custom properties defined per tile in the Tileset. * These typically are custom properties created in Tiled when editing a tileset. * @param {object} [tileData={}] - Data stored per tile. These typically are created in Tiled @@ -24696,7 +31949,7 @@ var Tileset = new Class({ * The starting index of the first tile index this Tileset contains. * * @name Phaser.Tilemaps.Tileset#firstgid - * @type {integer} + * @type {number} * @since 3.0.0 */ this.firstgid = firstgid; @@ -24705,7 +31958,7 @@ var Tileset = new Class({ * The width of each tile (in pixels). Use setTileSize to change. * * @name Phaser.Tilemaps.Tileset#tileWidth - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -24715,7 +31968,7 @@ var Tileset = new Class({ * The height of each tile (in pixels). Use setTileSize to change. * * @name Phaser.Tilemaps.Tileset#tileHeight - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -24725,7 +31978,7 @@ var Tileset = new Class({ * The margin around the tiles in the sheet (in pixels). Use `setSpacing` to change. * * @name Phaser.Tilemaps.Tileset#tileMargin - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -24735,7 +31988,7 @@ var Tileset = new Class({ * The spacing between each the tile in the sheet (in pixels). Use `setSpacing` to change. * * @name Phaser.Tilemaps.Tileset#tileSpacing - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -24785,7 +32038,7 @@ var Tileset = new Class({ * The number of tile rows in the the tileset. * * @name Phaser.Tilemaps.Tileset#rows - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -24795,7 +32048,7 @@ var Tileset = new Class({ * The number of tile columns in the tileset. * * @name Phaser.Tilemaps.Tileset#columns - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -24805,7 +32058,7 @@ var Tileset = new Class({ * The total number of tiles in the tileset. * * @name Phaser.Tilemaps.Tileset#total - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -24830,7 +32083,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#getTileProperties * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {?(object|undefined)} */ @@ -24849,7 +32102,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#getTileData * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {?object|undefined} */ @@ -24867,7 +32120,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#getTileCollisionGroup * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {?object} */ @@ -24884,7 +32137,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#containsTileIndex * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {boolean} */ @@ -24903,7 +32156,7 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#getTileTextureCoordinates * @since 3.0.0 * - * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * * @return {?object} Object in the form { x, y } representing the top-left UV coordinate * within the Tileset image. @@ -24942,8 +32195,8 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#setTileSize * @since 3.0.0 * - * @param {integer} [tileWidth] - The width of a tile in pixels. - * @param {integer} [tileHeight] - The height of a tile in pixels. + * @param {number} [tileWidth] - The width of a tile in pixels. + * @param {number} [tileHeight] - The height of a tile in pixels. * * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ @@ -24966,8 +32219,8 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#setSpacing * @since 3.0.0 * - * @param {integer} [margin] - The margin around the tiles in the sheet (in pixels). - * @param {integer} [spacing] - The spacing between the tiles in the sheet (in pixels). + * @param {number} [margin] - The margin around the tiles in the sheet (in pixels). + * @param {number} [spacing] - The spacing between the tiles in the sheet (in pixels). * * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ @@ -24990,8 +32243,8 @@ var Tileset = new Class({ * @method Phaser.Tilemaps.Tileset#updateTileData * @since 3.0.0 * - * @param {integer} imageWidth - The (expected) width of the image to slice. - * @param {integer} imageHeight - The (expected) height of the image to slice. + * @param {number} imageWidth - The (expected) width of the image to slice. + * @param {number} imageHeight - The (expected) height of the image to slice. * * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ @@ -25042,7 +32295,7 @@ module.exports = Tileset; /***/ }), -/* 108 */ +/* 120 */ /***/ (function(module, exports) { /** @@ -25058,7 +32311,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.TOP_LEFT * @since 3.0.0 - * @type {integer} + * @type {number} */ TOP_LEFT: 0, @@ -25067,7 +32320,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.TOP_CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ TOP_CENTER: 1, @@ -25076,7 +32329,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.TOP_RIGHT * @since 3.0.0 - * @type {integer} + * @type {number} */ TOP_RIGHT: 2, @@ -25085,7 +32338,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.LEFT_TOP * @since 3.0.0 - * @type {integer} + * @type {number} */ LEFT_TOP: 3, @@ -25094,7 +32347,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.LEFT_CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ LEFT_CENTER: 4, @@ -25103,7 +32356,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.LEFT_BOTTOM * @since 3.0.0 - * @type {integer} + * @type {number} */ LEFT_BOTTOM: 5, @@ -25112,7 +32365,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ CENTER: 6, @@ -25121,7 +32374,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.RIGHT_TOP * @since 3.0.0 - * @type {integer} + * @type {number} */ RIGHT_TOP: 7, @@ -25130,7 +32383,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.RIGHT_CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ RIGHT_CENTER: 8, @@ -25139,7 +32392,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.RIGHT_BOTTOM * @since 3.0.0 - * @type {integer} + * @type {number} */ RIGHT_BOTTOM: 9, @@ -25148,7 +32401,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.BOTTOM_LEFT * @since 3.0.0 - * @type {integer} + * @type {number} */ BOTTOM_LEFT: 10, @@ -25157,7 +32410,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.BOTTOM_CENTER * @since 3.0.0 - * @type {integer} + * @type {number} */ BOTTOM_CENTER: 11, @@ -25166,7 +32419,7 @@ var ALIGN_CONST = { * @constant * @name Phaser.Display.Align.BOTTOM_RIGHT * @since 3.0.0 - * @type {integer} + * @type {number} */ BOTTOM_RIGHT: 12 @@ -25176,7 +32429,7 @@ module.exports = ALIGN_CONST; /***/ }), -/* 109 */ +/* 121 */ /***/ (function(module, exports) { /** @@ -25210,2541 +32463,7 @@ module.exports = Equal; /***/ }), -/* 110 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var PIPELINE_CONST = { - - /** - * The Bitmap Mask Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.BITMAPMASK_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - BITMAPMASK_PIPELINE: 'BitmapMaskPipeline', - - /** - * The Light 2D Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.LIGHT_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - LIGHT_PIPELINE: 'Light2D', - - /** - * The Single Texture Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.SINGLE_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - SINGLE_PIPELINE: 'SinglePipeline', - - /** - * The Multi Texture Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.MULTI_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - MULTI_PIPELINE: 'MultiPipeline', - - /** - * The Rope Pipeline. - * - * @name Phaser.Renderer.WebGL.Pipelines.ROPE_PIPELINE - * @type {string} - * @const - * @since 3.50.0 - */ - ROPE_PIPELINE: 'RopePipeline' - -}; - -module.exports = PIPELINE_CONST; - - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var Utils = __webpack_require__(10); - -/** - * @classdesc - * - * The `WebGLPipeline` is a base class used by all of the core Phaser pipelines. - * - * It describes the way elements will be rendered in WebGL. Internally, it handles - * compiling the shaders, creating vertex buffers, assigning primitive topolgy and - * binding vertex attributes, all based on the given configuration data. - * - * The pipeline is configured by passing in a `WebGLPipelineConfig` object. Please - * see the documentation for this type to fully understand the configuration options - * available to you. - * - * Usually, you would not extend from this class directly, but would instead extend - * from one of the core pipelines, such as the Multi Pipeline or Rope Pipeline. - * - * @class WebGLPipeline - * @memberof Phaser.Renderer.WebGL - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. - */ -var WebGLPipeline = new Class({ - - initialize: - - function WebGLPipeline (config) - { - var game = config.game; - var renderer = game.renderer; - var gl = renderer.gl; - - /** - * Name of the pipeline. Used for identification. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#name - * @type {string} - * @since 3.0.0 - */ - this.name = GetFastValue(config, 'name', 'WebGLPipeline'); - - /** - * The Phaser Game instance to which this pipeline is bound. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; - - /** - * The WebGL Renderer instance to which this pipeline is bound. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer - * @type {Phaser.Renderer.WebGL.WebGLRenderer} - * @since 3.0.0 - */ - this.renderer = renderer; - - /** - * The WebGL context this WebGL Pipeline uses. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#gl - * @type {WebGLRenderingContext} - * @since 3.0.0 - */ - this.gl = gl; - - /** - * The canvas which this WebGL Pipeline renders to. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#view - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.view = game.canvas; - - /** - * The current game resolution. - * This is hard-coded to 1. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#resolution - * @type {number} - * @since 3.0.0 - */ - this.resolution = 1; - - /** - * Width of the current viewport. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#width - * @type {number} - * @since 3.0.0 - */ - this.width = 0; - - /** - * Height of the current viewport. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#height - * @type {number} - * @since 3.0.0 - */ - this.height = 0; - - /** - * The current number of vertices that have been added to the pipeline batch. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.vertexCount = 0; - - /** - * The total number of vertices that the pipeline batch can hold before it will flush. - * This defaults to `batchSize * 6`, where `batchSize` is defined in the Renderer Config. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity - * @type {integer} - * @since 3.0.0 - */ - this.vertexCapacity = GetFastValue(config, 'vertexCapacity', renderer.config.batchSize * 6); - - /** - * The size in bytes of a vertex. - * - * Derived by adding together all of the vertex attributes. - * - * For example, the Texture Tint Pipeline has 2 + 2 + 1 + 1 + 4 for the attributes - * `inPosition` (size 2), `inTexCoord` (size 2), `inTexId` (size 1), `inTintEffect` (size 1) - * and `inTint` (size 4), for a total of 28, which is the default for this property. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexSize - * @type {integer} - * @since 3.0.0 - */ - this.vertexSize = GetFastValue(config, 'vertexSize', 28); - - /** - * Raw byte buffer of vertices. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData - * @type {ArrayBuffer} - * @since 3.0.0 - */ - this.vertexData = GetFastValue(config, 'vertices', new ArrayBuffer(this.vertexCapacity * this.vertexSize)); - - /** - * The WebGLBuffer that holds the vertex data. - * Created from the `vertices` config ArrayBuffer that was passed in, or set by default, by the pipeline. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer - * @type {WebGLBuffer} - * @since 3.0.0 - */ - if (GetFastValue(config, 'vertices', null)) - { - this.vertexBuffer = this.renderer.createVertexBuffer(this.vertexData, this.gl.STREAM_DRAW); - } - else - { - this.vertexBuffer = this.renderer.createVertexBuffer(this.vertexData.byteLength, this.gl.STREAM_DRAW); - } - - /** - * The handle to a WebGL program. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#program - * @type {WebGLProgram} - * @since 3.0.0 - */ - this.program = this.renderer.createProgram(config.vertShader, config.fragShader); - - /** - * Array of objects that describe the vertex attributes. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#attributes - * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributesConfig} - * @since 3.0.0 - */ - this.attributes = config.attributes; - - /** - * The primitive topology which the pipeline will use to submit draw calls. - * Defaults to GL_TRIANGLES if not otherwise set. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#topology - * @type {GLenum} - * @since 3.0.0 - */ - this.topology = GetFastValue(config, 'topology', gl.TRIANGLES); - - /** - * Uint8 view to the vertex raw buffer. Used for uploading vertex buffer resources to the GPU. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes - * @type {Uint8Array} - * @since 3.0.0 - */ - this.bytes = new Uint8Array(this.vertexData); - - /** - * This will store the amount of components of 32 bit length. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexComponentCount - * @type {integer} - * @since 3.0.0 - */ - this.vertexComponentCount = Utils.getComponentCount(this.attributes, gl); - - /** - * Indicates if the current pipeline is flushing the contents to the GPU. - * When the variable is set the flush function will be locked. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#flushLocked - * @type {boolean} - * @since 3.1.0 - */ - this.flushLocked = false; - - /** - * Indicates if the current pipeline is active or not for this frame only. - * Reset in the onRender method. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#active - * @type {boolean} - * @since 3.10.0 - */ - this.active = false; - - /** - * Holds the most recently assigned texture unit. - * Treat this value as read-only. - * - * @name Phaser.Renderer.WebGL.Pipelines.WebGLPipeline#currentUnit - * @type {number} - * @since 3.50.0 - */ - this.currentUnit = 0; - - /** - * Some pipelines require the forced use of texture zero (like the light pipeline). - * This boolean should be set when that is the case. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#forceZero - * @type {boolean} - * @since 3.50.0 - */ - this.forceZero = false; - - /** - * Indicates if the current pipeline has booted or not. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#hasBooted - * @type {boolean} - * @readonly - * @since 3.50.0 - */ - this.hasBooted = false; - }, - - /** - * Called when the Game has fully booted and the Renderer has finished setting up. - * - * By this stage all Game level systems are now in place and you can perform any final - * tasks that the pipeline may need that relied on game systems such as the Texture Manager. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#boot - * @since 3.11.0 - */ - boot: function () - { - var renderer = this.renderer; - - renderer.setProgram(this.program); - renderer.setVertexBuffer(this.vertexBuffer); - - this.setAttribPointers(true); - - this.hasBooted = true; - - return this; - }, - - /** - * Custom pipelines can use this method in order to perform any required pre-batch tasks - * for the given Game Object. It must return the texture unit the Game Object was assigned. - * - * @method Phaser.Renderer.WebGL.Pipelines.WebGLPipeline#setGameObject - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. - * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. - * - * @return {number} The texture unit the Game Object has been assigned. - */ - setGameObject: function (gameObject, frame) - { - if (frame === undefined) { frame = gameObject.frame; } - - this.currentUnit = this.renderer.setTextureSource(frame.source); - - return this.currentUnit; - }, - - /** - * Adds a description of vertex attribute to the pipeline - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#addAttribute - * @since 3.2.0 - * - * @param {string} name - Name of the vertex attribute - * @param {integer} size - Vertex component size - * @param {integer} type - Type of the attribute - * @param {boolean} normalized - Is the value normalized to a range - * @param {integer} offset - Byte offset to the beginning of the first element in the vertex - * - * @return {this} This WebGLPipeline instance. - */ - addAttribute: function (name, size, type, normalized, offset) - { - this.attributes.push({ - name: name, - size: size, - type: this.renderer.glFormats[type], - normalized: normalized, - offset: offset, - enabled: false, - location: -1 - }); - - this.vertexComponentCount = Utils.getComponentCount( - this.attributes, - this.gl - ); - return this; - }, - - /** - * Check if the current batch of vertices is full. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush - * @since 3.0.0 - * - * @return {boolean} `true` if the current batch should be flushed, otherwise `false`. - */ - shouldFlush: function () - { - return (this.vertexCount >= this.vertexCapacity); - }, - - /** - * Resizes the properties used to describe the viewport - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#resize - * @since 3.0.0 - * - * @param {number} width - The new width of this WebGL Pipeline. - * @param {number} height - The new height of this WebGL Pipeline. - * @param {number} resolution - The resolution this WebGL Pipeline should be resized to. - * - * @return {this} This WebGLPipeline instance. - */ - resize: function (width, height, resolution) - { - this.width = width * resolution; - this.height = height * resolution; - this.resolution = resolution; - - return this; - }, - - /** - * Binds the pipeline resources, including the program, vertex buffer and attribute pointers. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#bind - * @since 3.0.0 - * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? - * - * @return {this} This WebGLPipeline instance. - */ - bind: function (reset) - { - if (reset === undefined) { reset = false; } - - var vertexBuffer = this.vertexBuffer; - var program = this.program; - var renderer = this.renderer; - - renderer.setProgram(program); - renderer.setVertexBuffer(vertexBuffer); - - this.setAttribPointers(reset); - - return this; - }, - - /** - * Sets the vertex attribute pointers. - * This should only be called after the vertex buffer has been bound. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setAttribPointers - * @since 3.50.0 - * - * @param {boolean} [reset=false] - Reset the vertex attribute locations? - * - * @return {this} This WebGLPipeline instance. - */ - setAttribPointers: function (reset) - { - if (reset === undefined) { reset = false; } - - var gl = this.gl; - var attributes = this.attributes; - var vertexSize = this.vertexSize; - var program = this.program; - - for (var i = 0; i < attributes.length; i++) - { - var element = attributes[i]; - - if (reset) - { - var location = gl.getAttribLocation(program, element.name); - - if (location >= 0) - { - gl.enableVertexAttribArray(location); - gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexSize, element.offset); - element.enabled = true; - element.location = location; - } - else if (location !== -1) - { - gl.disableVertexAttribArray(location); - } - } - else if (element.enabled) - { - gl.vertexAttribPointer(element.location, element.size, element.type, element.normalized, vertexSize, element.offset); - } - else if (!element.enabled && element.location > -1) - { - gl.disableVertexAttribArray(element.location); - element.location = -1; - } - } - }, - - /** - * Set whenever this WebGL Pipeline is bound to a WebGL Renderer. - * - * This method is called every time the WebGL Pipeline is attempted to be bound, even if it already is the current pipeline. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - onBind: function () - { - // This is for updating uniform data it's called on each bind attempt. - return this; - }, - - /** - * Called before each frame is rendered, but after the canvas has been cleared. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - onPreRender: function () - { - // called once every frame - return this; - }, - - /** - * Called before a Scene's Camera is rendered. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene being rendered. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. - * - * @return {this} This WebGLPipeline instance. - */ - onRender: function () - { - // called for each camera - return this; - }, - - /** - * Called after each frame has been completely rendered and snapshots have been taken. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - onPostRender: function () - { - // called once every frame - return this; - }, - - /** - * Uploads the vertex data and emits a draw call - * for the current batch of vertices. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#flush - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - flush: function () - { - if (this.flushLocked) { return this; } - - this.flushLocked = true; - - var gl = this.gl; - var vertexCount = this.vertexCount; - var topology = this.topology; - var vertexSize = this.vertexSize; - - if (vertexCount === 0) - { - this.flushLocked = false; - return; - } - - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - gl.drawArrays(topology, 0, vertexCount); - - this.vertexCount = 0; - this.flushLocked = false; - - return this; - }, - - /** - * Removes all object references in this WebGL Pipeline and removes its program from the WebGL context. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - destroy: function () - { - var gl = this.gl; - - gl.deleteProgram(this.program); - gl.deleteBuffer(this.vertexBuffer); - - delete this.program; - delete this.vertexBuffer; - delete this.gl; - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat1 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The new value of the `float` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat1: function (name, x) - { - this.renderer.setFloat1(this.program, name, x); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat2 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The new X component of the `vec2` uniform. - * @param {number} y - The new Y component of the `vec2` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat2: function (name, x, y) - { - this.renderer.setFloat2(this.program, name, x, y); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat3 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The new X component of the `vec3` uniform. - * @param {number} y - The new Y component of the `vec3` uniform. - * @param {number} z - The new Z component of the `vec3` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat3: function (name, x, y, z) - { - this.renderer.setFloat3(this.program, name, x, y, z); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat4 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - X component of the uniform - * @param {number} y - Y component of the uniform - * @param {number} z - Z component of the uniform - * @param {number} w - W component of the uniform - * - * @return {this} This WebGLPipeline instance. - */ - setFloat4: function (name, x, y, z, w) - { - this.renderer.setFloat4(this.program, name, x, y, z, w); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat1v - * @since 3.13.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat1v: function (name, arr) - { - this.renderer.setFloat1v(this.program, name, arr); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat2v - * @since 3.13.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat2v: function (name, arr) - { - this.renderer.setFloat2v(this.program, name, arr); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat3v - * @since 3.13.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat3v: function (name, arr) - { - this.renderer.setFloat3v(this.program, name, arr); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat4v - * @since 3.13.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGLPipeline instance. - */ - setFloat4v: function (name, arr) - { - this.renderer.setFloat4v(this.program, name, arr); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt1 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The new value of the `int` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setInt1: function (name, x) - { - this.renderer.setInt1(this.program, name, x); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt2 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The new X component of the `ivec2` uniform. - * @param {integer} y - The new Y component of the `ivec2` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setInt2: function (name, x, y) - { - this.renderer.setInt2(this.program, name, x, y); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt3 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The new X component of the `ivec3` uniform. - * @param {integer} y - The new Y component of the `ivec3` uniform. - * @param {integer} z - The new Z component of the `ivec3` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setInt3: function (name, x, y, z) - { - this.renderer.setInt3(this.program, name, x, y, z); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt4 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - X component of the uniform - * @param {integer} y - Y component of the uniform - * @param {integer} z - Z component of the uniform - * @param {integer} w - W component of the uniform - * - * @return {this} This WebGLPipeline instance. - */ - setInt4: function (name, x, y, z, w) - { - this.renderer.setInt4(this.program, name, x, y, z, w); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. - * @param {Float32Array} matrix - The new values for the `mat2` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setMatrix2: function (name, transpose, matrix) - { - this.renderer.setMatrix2(this.program, name, transpose, matrix); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. - * @param {Float32Array} matrix - The new values for the `mat3` uniform. - * - * @return {this} This WebGLPipeline instance. - */ - setMatrix3: function (name, transpose, matrix) - { - this.renderer.setMatrix3(this.program, name, transpose, matrix); - - return this; - }, - - /** - * Set a uniform value of the current pipeline program. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4 - * @since 3.2.0 - * - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - Should the matrix be transpose - * @param {Float32Array} matrix - Matrix data - * - * @return {this} This WebGLPipeline instance. - */ - setMatrix4: function (name, transpose, matrix) - { - this.renderer.setMatrix4(this.program, name, transpose, matrix); - - return this; - } - -}); - -module.exports = WebGLPipeline; - - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Earcut = __webpack_require__(60); -var GetFastValue = __webpack_require__(2); -var ModelViewProjection = __webpack_require__(113); -var ProjectOrtho = __webpack_require__(185); -var ShaderSourceFS = __webpack_require__(810); -var ShaderSourceVS = __webpack_require__(811); -var TransformMatrix = __webpack_require__(31); -var Utils = __webpack_require__(10); -var WebGLPipeline = __webpack_require__(111); - -/** - * @classdesc - * - * The Multi Pipeline is the core 2D texture rendering pipeline used by Phaser in WebGL. - * Virtually all Game Objects use this pipeline by default, including Sprites, Graphics - * and Tilemaps. It handles the batching of quads and tris, as well as methods for - * drawing and batching geometry data. - * - * Prior to Phaser v3.50 this pipeline was called the `TextureTintPipeline`. - * - * In previous versions of Phaser only one single texture unit was supported at any one time. - * The Multi Pipeline is an evolution of the old Texture Tint Pipeline, updated to support - * multi-textures for increased performance. - * - * The fragment shader it uses can be found in `shaders/src/Multi.frag`. - * The vertex shader it uses can be found in `shaders/src/Multi.vert`. - * - * The default shader attributes for this pipeline are: - * - * `inPosition` (vec2, offset 0) - * `inTexCoord` (vec2, offset 8) - * `inTexId` (float, offset 16) - * `inTintEffect` (float, offset 20) - * `inTint` (vec4, offset 24, normalized) - * - * The default shader uniforms for this pipeline are: - * - * `uProjectionMatrix` (mat4) - * `uViewMatrix` (mat4) - * `uModelMatrix` (mat4) - * `uMainSampler` (sampler2D array) - * - * If you wish to create a custom pipeline extending from this one, you can use two string - * declarations in your fragment shader source: `%count%` and `%forloop%`, where `count` is - * used to set the number of `sampler2Ds` available, and `forloop` is a block of GLSL code - * that will get the currently bound texture unit. - * - * This pipeline will automatically inject that code for you, should those values exist - * in your shader source. If you wish to handle this yourself, you can also use the - * function `Utils.parseFragmentShaderMaxTextures`. - * - * If you wish to create a pipeline that works from a single texture, or that doesn't have - * internal texture iteration, please see the `SinglePipeline` instead. - * - * @class MultiPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.50.0 - * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. - */ -var MultiPipeline = new Class({ - - Extends: WebGLPipeline, - - Mixins: [ - ModelViewProjection - ], - - initialize: - - function MultiPipeline (config) - { - var renderer = config.game.renderer; - var gl = renderer.gl; - - var fragmentShaderSource = GetFastValue(config, 'fragShader', ShaderSourceFS); - - // Vertex Size = attribute size added together (2 + 2 + 1 + 1 + 4) inc maxTextures - - config.fragShader = Utils.parseFragmentShaderMaxTextures(fragmentShaderSource, renderer.maxTextures); - config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0, - enabled: false, - location: -1 - }, - { - name: 'inTexCoord', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 8, - enabled: false, - location: -1 - }, - { - name: 'inTexId', - size: 1, - type: gl.FLOAT, - normalized: false, - offset: 16, - enabled: false, - location: -1 - }, - { - name: 'inTintEffect', - size: 1, - type: gl.FLOAT, - normalized: false, - offset: 20, - enabled: false, - location: -1 - }, - { - name: 'inTint', - size: 4, - type: gl.UNSIGNED_BYTE, - normalized: true, - offset: 24, - enabled: false, - location: -1 - } - ]); - - WebGLPipeline.call(this, config); - - /** - * Float32 view of the array buffer containing the pipeline's vertices. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#vertexViewF32 - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertexViewF32 = new Float32Array(this.vertexData); - - /** - * Uint32 view of the array buffer containing the pipeline's vertices. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#vertexViewU32 - * @type {Uint32Array} - * @since 3.0.0 - */ - this.vertexViewU32 = new Uint32Array(this.vertexData); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix1 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix2 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix3 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix4 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix4 = new TransformMatrix(); - - /** - * Used internally to draw stroked triangles. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempTriangle - * @type {array} - * @private - * @since 3.12.0 - */ - this.tempTriangle = [ - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 } - ]; - - /** - * The tint effect to be applied by the shader in the next geometry draw: - * - * 0 = texture multiplied by color - * 1 = solid color + texture alpha - * 2 = solid color, no texture - * 3 = solid texture, no color - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tintEffect - * @type {number} - * @private - * @since 3.12.0 - */ - this.tintEffect = 2; - - /** - * Cached stroke tint. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#strokeTint - * @type {object} - * @private - * @since 3.12.0 - */ - this.strokeTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; - - /** - * Cached fill tint. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#fillTint - * @type {object} - * @private - * @since 3.12.0 - */ - this.fillTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; - - /** - * Internal texture frame reference. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#currentFrame - * @type {Phaser.Textures.Frame} - * @private - * @since 3.12.0 - */ - this.currentFrame = { u0: 0, v0: 0, u1: 1, v1: 1 }; - - /** - * Internal path quad cache. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#firstQuad - * @type {array} - * @private - * @since 3.12.0 - */ - this.firstQuad = [ 0, 0, 0, 0, 0 ]; - - /** - * Internal path quad cache. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#prevQuad - * @type {array} - * @private - * @since 3.12.0 - */ - this.prevQuad = [ 0, 0, 0, 0, 0 ]; - - /** - * Used internally for triangulating a polygon. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#polygonCache - * @type {array} - * @private - * @since 3.12.0 - */ - this.polygonCache = []; - - this.mvpInit(); - }, - - /** - * Called every time the pipeline is bound by the renderer. - * Sets the shader program, vertex buffer and other resources. - * Should only be called when changing pipeline. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#bind - * @since 3.50.0 - * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? - * - * @return {this} This WebGLPipeline instance. - */ - bind: function (reset) - { - if (reset === undefined) { reset = false; } - - WebGLPipeline.prototype.bind.call(this, reset); - - this.renderer.setInt1iv(this.program, 'uMainSampler', this.renderer.textureIndexes); - - return this; - }, - - /** - * Called every time a Game Object needs to use this pipeline. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#onBind - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. - * - * @return {this} This WebGLPipeline instance. - */ - onBind: function () - { - this.mvpUpdate(); - - return this; - }, - - /** - * Resizes this pipeline and updates the projection. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#resize - * @since 3.0.0 - * - * @param {number} width - The new width. - * @param {number} height - The new height. - * @param {number} resolution - The resolution. - * - * @return {this} This WebGLPipeline instance. - */ - resize: function (width, height, resolution) - { - WebGLPipeline.prototype.resize.call(this, width, height, resolution); - - ProjectOrtho(this, 0, this.width, this.height, 0, -1000, 1000); - - return this; - }, - - /** - * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#setTexture2D - * @since 3.1.0 - * - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. - * - * @return {number} The assigned texture unit. - */ - setTexture2D: function (texture) - { - if (texture === undefined) { texture = this.renderer.blankTexture.glTexture; } - - this.currentUnit = this.renderer.setTexture2D(texture); - - return this.currentUnit; - }, - - /** - * Uploads the vertex data and emits a draw call for the current batch of vertices. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#flush - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - flush: function () - { - var gl = this.gl; - var vertexCount = this.vertexCount; - var vertexSize = this.vertexSize; - - if (vertexCount > 0) - { - if (vertexCount === this.vertexCapacity) - { - gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.DYNAMIC_DRAW); - } - else - { - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - } - - gl.drawArrays(this.topology, 0, vertexCount); - - this.vertexCount = 0; - } - - return this; - }, - - /** - * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchSprite - * @since 3.0.0 - * - * @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} sprite - The texture based Game Object to add to the batch. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. - */ - batchSprite: function (sprite, camera, parentTransformMatrix) - { - // Will cause a flush if this isn't the current pipeline, vertexbuffer or program - this.renderer.pipelines.set(this); - - var camMatrix = this._tempMatrix1; - var spriteMatrix = this._tempMatrix2; - var calcMatrix = this._tempMatrix3; - - var frame = sprite.frame; - var texture = frame.glTexture; - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - var frameX = frame.x; - var frameY = frame.y; - var frameWidth = frame.cutWidth; - var frameHeight = frame.cutHeight; - var customPivot = frame.customPivot; - - var displayOriginX = sprite.displayOriginX; - var displayOriginY = sprite.displayOriginY; - - var x = -displayOriginX + frameX; - var y = -displayOriginY + frameY; - - if (sprite.isCropped) - { - var crop = sprite._crop; - - if (crop.flipX !== sprite.flipX || crop.flipY !== sprite.flipY) - { - frame.updateCropUVs(crop, sprite.flipX, sprite.flipY); - } - - u0 = crop.u0; - v0 = crop.v0; - u1 = crop.u1; - v1 = crop.v1; - - frameWidth = crop.width; - frameHeight = crop.height; - - frameX = crop.x; - frameY = crop.y; - - x = -displayOriginX + frameX; - y = -displayOriginY + frameY; - } - - var flipX = 1; - var flipY = 1; - - if (sprite.flipX) - { - if (!customPivot) - { - x += (-frame.realWidth + (displayOriginX * 2)); - } - - flipX = -1; - } - - // Auto-invert the flipY if this is coming from a GLTexture - if (sprite.flipY || (frame.source.isGLTexture && !texture.flipY)) - { - if (!customPivot) - { - y += (-frame.realHeight + (displayOriginY * 2)); - } - - flipY = -1; - } - - spriteMatrix.applyITRS(sprite.x, sprite.y, sprite.rotation, sprite.scaleX * flipX, sprite.scaleY * flipY); - - camMatrix.copyFrom(camera.matrix); - - if (parentTransformMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * sprite.scrollFactorX, -camera.scrollY * sprite.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = sprite.x; - spriteMatrix.f = sprite.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * sprite.scrollFactorX; - spriteMatrix.f -= camera.scrollY * sprite.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - var xw = x + frameWidth; - var yh = y + frameHeight; - - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); - - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); - - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); - - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); - - var tintTL = Utils.getTintAppendFloatAlpha(sprite._tintTL, camera.alpha * sprite._alphaTL); - var tintTR = Utils.getTintAppendFloatAlpha(sprite._tintTR, camera.alpha * sprite._alphaTR); - var tintBL = Utils.getTintAppendFloatAlpha(sprite._tintBL, camera.alpha * sprite._alphaBL); - var tintBR = Utils.getTintAppendFloatAlpha(sprite._tintBR, camera.alpha * sprite._alphaBR); - - if (camera.roundPixels) - { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); - - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); - - tx2 = Math.round(tx2); - ty2 = Math.round(ty2); - - tx3 = Math.round(tx3); - ty3 = Math.round(ty3); - } - - // So batchQuad never assigns a unit to the glTexture, but to the textureSource instead - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - } - - var unit = this.setGameObject(sprite); - - var tintEffect = (sprite._isTinted && sprite.tintFill); - - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit); - }, - - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 6 vertices in the following arrangement: - * - * ``` - * 0----3 - * |\ B| - * | \ | - * | \ | - * | A \| - * | \ - * 1----2 - * ``` - * - * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchQuad - * @since 3.12.0 - * - * @param {number} x0 - The top-left x position. - * @param {number} y0 - The top-left y position. - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {number} tintBR - The bottom-right tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) - { - if (unit === undefined) { unit = this.currentUnit; } - - var hasFlushed = false; - - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - - hasFlushed = true; - - unit = this.setTexture2D(texture); - } - - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - - var vertexOffset = (this.vertexCount * this.vertexComponentCount) - 1; - - vertexViewF32[++vertexOffset] = x0; - vertexViewF32[++vertexOffset] = y0; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x1; - vertexViewF32[++vertexOffset] = y1; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBR; - - vertexViewF32[++vertexOffset] = x0; - vertexViewF32[++vertexOffset] = y0; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBR; - - vertexViewF32[++vertexOffset] = x3; - vertexViewF32[++vertexOffset] = y3; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTR; - - this.vertexCount += 6; - - return hasFlushed; - }, - - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 3 vertices in the following arrangement: - * - * ``` - * 0 - * |\ - * | \ - * | \ - * | \ - * | \ - * 1-----2 - * ``` - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTri - * @since 3.12.0 - * - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {integer} [unit=0] - Texture unit to which the texture needs to be bound. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) - { - if (unit === undefined) { unit = this.currentUnit; } - - var hasFlushed = false; - - if (this.vertexCount + 3 > this.vertexCapacity) - { - this.flush(); - - hasFlushed = true; - - unit = this.setTexture2D(texture); - } - - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - - var vertexOffset = (this.vertexCount * this.vertexComponentCount) - 1; - - vertexViewF32[++vertexOffset] = x1; - vertexViewF32[++vertexOffset] = y1; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTR; - - vertexViewF32[++vertexOffset] = x3; - vertexViewF32[++vertexOffset] = y3; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBL; - - this.vertexCount += 3; - - return hasFlushed; - }, - - /** - * Generic function for batching a textured quad using argument values instead of a Game Object. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTexture - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject. - * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad. - * @param {integer} textureWidth - Real texture width. - * @param {integer} textureHeight - Real texture height. - * @param {number} srcX - X coordinate of the quad. - * @param {number} srcY - Y coordinate of the quad. - * @param {number} srcWidth - Width of the quad. - * @param {number} srcHeight - Height of the quad. - * @param {number} scaleX - X component of scale. - * @param {number} scaleY - Y component of scale. - * @param {number} rotation - Rotation of the quad. - * @param {boolean} flipX - Indicates if the quad is horizontally flipped. - * @param {boolean} flipY - Indicates if the quad is vertically flipped. - * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll. - * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll. - * @param {number} displayOriginX - Horizontal origin in pixels. - * @param {number} displayOriginY - Vertical origin in pixels. - * @param {number} frameX - X coordinate of the texture frame. - * @param {number} frameY - Y coordinate of the texture frame. - * @param {number} frameWidth - Width of the texture frame. - * @param {number} frameHeight - Height of the texture frame. - * @param {integer} tintTL - Tint for top left. - * @param {integer} tintTR - Tint for top right. - * @param {integer} tintBL - Tint for bottom left. - * @param {integer} tintBR - Tint for bottom right. - * @param {number} tintEffect - The tint effect. - * @param {number} uOffset - Horizontal offset on texture coordinate. - * @param {number} vOffset - Vertical offset on texture coordinate. - * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container. - * @param {boolean} [skipFlip=false] - Skip the renderTexture check. - * @param {number} [textureUnit] - Use the currently bound texture unit? - */ - batchTexture: function ( - gameObject, - texture, - textureWidth, textureHeight, - srcX, srcY, - srcWidth, srcHeight, - scaleX, scaleY, - rotation, - flipX, flipY, - scrollFactorX, scrollFactorY, - displayOriginX, displayOriginY, - frameX, frameY, frameWidth, frameHeight, - tintTL, tintTR, tintBL, tintBR, tintEffect, - uOffset, vOffset, - camera, - parentTransformMatrix, - skipFlip, - textureUnit) - { - var renderer = this.renderer; - - renderer.pipelines.set(this, gameObject); - - var camMatrix = this._tempMatrix1; - var spriteMatrix = this._tempMatrix2; - var calcMatrix = this._tempMatrix3; - - var u0 = (frameX / textureWidth) + uOffset; - var v0 = (frameY / textureHeight) + vOffset; - var u1 = (frameX + frameWidth) / textureWidth + uOffset; - var v1 = (frameY + frameHeight) / textureHeight + vOffset; - - var width = srcWidth; - var height = srcHeight; - - var x = -displayOriginX; - var y = -displayOriginY; - - if (gameObject.isCropped) - { - var crop = gameObject._crop; - - width = crop.width; - height = crop.height; - - srcWidth = crop.width; - srcHeight = crop.height; - - frameX = crop.x; - frameY = crop.y; - - var ox = frameX; - var oy = frameY; - - if (flipX) - { - ox = (frameWidth - crop.x - crop.width); - } - - if (flipY && !texture.isRenderTexture) - { - oy = (frameHeight - crop.y - crop.height); - } - - u0 = (ox / textureWidth) + uOffset; - v0 = (oy / textureHeight) + vOffset; - u1 = (ox + crop.width) / textureWidth + uOffset; - v1 = (oy + crop.height) / textureHeight + vOffset; - - x = -displayOriginX + frameX; - y = -displayOriginY + frameY; - } - - // Invert the flipY if this is a RenderTexture - flipY = flipY ^ (!skipFlip && texture.isRenderTexture ? 1 : 0); - - if (flipX) - { - width *= -1; - x += srcWidth; - } - - if (flipY) - { - height *= -1; - y += srcHeight; - } - - var xw = x + width; - var yh = y + height; - - spriteMatrix.applyITRS(srcX, srcY, rotation, scaleX, scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentTransformMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = srcX; - spriteMatrix.f = srcY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * scrollFactorX; - spriteMatrix.f -= camera.scrollY * scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); - - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); - - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); - - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); - - if (camera.roundPixels) - { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); - - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); - - tx2 = Math.round(tx2); - ty2 = Math.round(ty2); - - tx3 = Math.round(tx3); - ty3 = Math.round(ty3); - } - - if (textureUnit === undefined) - { - textureUnit = this.renderer.setTexture2D(texture); - } - - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); - }, - - /** - * Adds a Texture Frame into the batch for rendering. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTextureFrame - * @since 3.12.0 - * - * @param {Phaser.Textures.Frame} frame - The Texture Frame to be rendered. - * @param {number} x - The horizontal position to render the texture at. - * @param {number} y - The vertical position to render the texture at. - * @param {number} tint - The tint color. - * @param {number} alpha - The alpha value. - * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - The Transform Matrix to use for the texture. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - A parent Transform Matrix. - */ - batchTextureFrame: function ( - frame, - x, y, - tint, alpha, - transformMatrix, - parentTransformMatrix - ) - { - this.renderer.pipelines.set(this); - - var spriteMatrix = this._tempMatrix1.copyFrom(transformMatrix); - var calcMatrix = this._tempMatrix2; - - var xw = x + frame.width; - var yh = y + frame.height; - - if (parentTransformMatrix) - { - spriteMatrix.multiply(parentTransformMatrix, calcMatrix); - } - else - { - calcMatrix = spriteMatrix; - } - - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); - - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); - - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); - - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); - - // this.setTexture2D(frame.glTexture, 0); - var unit = this.renderer.setTextureSource(frame.source); - - tint = Utils.getTintAppendFloatAlpha(tint, alpha); - - this.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0, frame.glTexture, unit); - }, - - /** - * Pushes a filled rectangle into the vertex batch. - * - * The dimensions are run through `Math.floor` before the quad is generated. - * - * Rectangle has no transform values and isn't transformed into the local space. - * - * Used for directly batching untransformed rectangles, such as Camera background colors. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#drawFillRect - * @since 3.12.0 - * - * @param {number} x - Horizontal top left coordinate of the rectangle. - * @param {number} y - Vertical top left coordinate of the rectangle. - * @param {number} width - Width of the rectangle. - * @param {number} height - Height of the rectangle. - * @param {number} color - Color of the rectangle to draw. - * @param {number} alpha - Alpha value of the rectangle to draw. - */ - drawFillRect: function (x, y, width, height, color, alpha) - { - x = Math.floor(x); - y = Math.floor(y); - - var xw = Math.floor(x + width); - var yh = Math.floor(y + height); - - var blank = this.renderer.blankTexture.glTexture; - - var unit = this.renderer.setTexture2D(blank); - - var tint = Utils.getTintAppendFloatAlphaAndSwap(color, alpha); - - this.batchQuad(x, y, x, yh, xw, yh, xw, y, 0, 0, 1, 1, tint, tint, tint, tint, 2, blank, unit); - }, - - /** - * Pushes a filled rectangle into the vertex batch. - * Rectangle factors in the given transform matrices before adding to the batch. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillRect - * @since 3.12.0 - * - * @param {number} x - Horizontal top left coordinate of the rectangle. - * @param {number} y - Vertical top left coordinate of the rectangle. - * @param {number} width - Width of the rectangle. - * @param {number} height - Height of the rectangle. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchFillRect: function (x, y, width, height, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - var calcMatrix = this._tempMatrix3; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var xw = x + width; - var yh = y + height; - - var x0 = calcMatrix.getX(x, y); - var y0 = calcMatrix.getY(x, y); - - var x1 = calcMatrix.getX(x, yh); - var y1 = calcMatrix.getY(x, yh); - - var x2 = calcMatrix.getX(xw, yh); - var y2 = calcMatrix.getY(xw, yh); - - var x3 = calcMatrix.getX(xw, y); - var y3 = calcMatrix.getY(xw, y); - - var frame = this.currentFrame; - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - - var tint = this.fillTint; - - this.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tint.TL, tint.TR, tint.BL, tint.BR, this.tintEffect); - }, - - /** - * Pushes a filled triangle into the vertex batch. - * Triangle factors in the given transform matrices before adding to the batch. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillTriangle - * @since 3.12.0 - * - * @param {number} x0 - Point 0 x coordinate. - * @param {number} y0 - Point 0 y coordinate. - * @param {number} x1 - Point 1 x coordinate. - * @param {number} y1 - Point 1 y coordinate. - * @param {number} x2 - Point 2 x coordinate. - * @param {number} y2 - Point 2 y coordinate. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchFillTriangle: function (x0, y0, x1, y1, x2, y2, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - var calcMatrix = this._tempMatrix3; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var tx0 = calcMatrix.getX(x0, y0); - var ty0 = calcMatrix.getY(x0, y0); - - var tx1 = calcMatrix.getX(x1, y1); - var ty1 = calcMatrix.getY(x1, y1); - - var tx2 = calcMatrix.getX(x2, y2); - var ty2 = calcMatrix.getY(x2, y2); - - var frame = this.currentFrame; - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - - this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, u0, v0, u1, v1, this.fillTint.TL, this.fillTint.TR, this.fillTint.BL, this.tintEffect); - }, - - /** - * Pushes a stroked triangle into the vertex batch. - * Triangle factors in the given transform matrices before adding to the batch. - * The triangle is created from 3 lines and drawn using the `batchStrokePath` method. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchStrokeTriangle - * @since 3.12.0 - * - * @param {number} x0 - Point 0 x coordinate. - * @param {number} y0 - Point 0 y coordinate. - * @param {number} x1 - Point 1 x coordinate. - * @param {number} y1 - Point 1 y coordinate. - * @param {number} x2 - Point 2 x coordinate. - * @param {number} y2 - Point 2 y coordinate. - * @param {number} lineWidth - The width of the line in pixels. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchStrokeTriangle: function (x0, y0, x1, y1, x2, y2, lineWidth, currentMatrix, parentMatrix) - { - var tempTriangle = this.tempTriangle; - - tempTriangle[0].x = x0; - tempTriangle[0].y = y0; - tempTriangle[0].width = lineWidth; - - tempTriangle[1].x = x1; - tempTriangle[1].y = y1; - tempTriangle[1].width = lineWidth; - - tempTriangle[2].x = x2; - tempTriangle[2].y = y2; - tempTriangle[2].width = lineWidth; - - tempTriangle[3].x = x0; - tempTriangle[3].y = y0; - tempTriangle[3].width = lineWidth; - - this.batchStrokePath(tempTriangle, lineWidth, false, currentMatrix, parentMatrix); - }, - - /** - * Adds the given path to the vertex batch for rendering. - * - * It works by taking the array of path data and then passing it through Earcut, which - * creates a list of polygons. Each polygon is then added to the batch. - * - * The path is always automatically closed because it's filled. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillPath - * @since 3.12.0 - * - * @param {array} path - Collection of points that represent the path. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchFillPath: function (path, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - var calcMatrix = this._tempMatrix3; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var length = path.length; - var polygonCache = this.polygonCache; - var polygonIndexArray; - var point; - - var tintTL = this.fillTint.TL; - var tintTR = this.fillTint.TR; - var tintBL = this.fillTint.BL; - var tintEffect = this.tintEffect; - - for (var pathIndex = 0; pathIndex < length; ++pathIndex) - { - point = path[pathIndex]; - polygonCache.push(point.x, point.y); - } - - polygonIndexArray = Earcut(polygonCache); - length = polygonIndexArray.length; - - var frame = this.currentFrame; - - for (var index = 0; index < length; index += 3) - { - var p0 = polygonIndexArray[index + 0] * 2; - var p1 = polygonIndexArray[index + 1] * 2; - var p2 = polygonIndexArray[index + 2] * 2; - - var x0 = polygonCache[p0 + 0]; - var y0 = polygonCache[p0 + 1]; - var x1 = polygonCache[p1 + 0]; - var y1 = polygonCache[p1 + 1]; - var x2 = polygonCache[p2 + 0]; - var y2 = polygonCache[p2 + 1]; - - var tx0 = calcMatrix.getX(x0, y0); - var ty0 = calcMatrix.getY(x0, y0); - - var tx1 = calcMatrix.getX(x1, y1); - var ty1 = calcMatrix.getY(x1, y1); - - var tx2 = calcMatrix.getX(x2, y2); - var ty2 = calcMatrix.getY(x2, y2); - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - - this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect); - } - - polygonCache.length = 0; - }, - - /** - * Adds the given path to the vertex batch for rendering. - * - * It works by taking the array of path data and calling `batchLine` for each section - * of the path. - * - * The path is optionally closed at the end. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchStrokePath - * @since 3.12.0 - * - * @param {array} path - Collection of points that represent the path. - * @param {number} lineWidth - The width of the line segments in pixels. - * @param {boolean} pathOpen - Indicates if the path should be closed or left open. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchStrokePath: function (path, lineWidth, pathOpen, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - // Reset the closePath booleans - this.prevQuad[4] = 0; - this.firstQuad[4] = 0; - - var pathLength = path.length - 1; - - for (var pathIndex = 0; pathIndex < pathLength; pathIndex++) - { - var point0 = path[pathIndex]; - var point1 = path[pathIndex + 1]; - - this.batchLine( - point0.x, - point0.y, - point1.x, - point1.y, - point0.width / 2, - point1.width / 2, - lineWidth, - pathIndex, - !pathOpen && (pathIndex === pathLength - 1), - currentMatrix, - parentMatrix - ); - } - }, - - /** - * Creates a line out of 4 quads and adds it to the vertex batch based on the given line values. - * Assumes a texture has already been set, prior to calling this function. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchLine - * @since 3.12.0 - * - * @param {number} ax - X coordinate to the start of the line - * @param {number} ay - Y coordinate to the start of the line - * @param {number} bx - X coordinate to the end of the line - * @param {number} by - Y coordinate to the end of the line - * @param {number} aLineWidth - Width of the start of the line - * @param {number} bLineWidth - Width of the end of the line - * @param {Float32Array} currentMatrix - Parent matrix, generally used by containers - */ - batchLine: function (ax, ay, bx, by, aLineWidth, bLineWidth, lineWidth, index, closePath, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - var calcMatrix = this._tempMatrix3; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var dx = bx - ax; - var dy = by - ay; - - var len = Math.sqrt(dx * dx + dy * dy); - var al0 = aLineWidth * (by - ay) / len; - var al1 = aLineWidth * (ax - bx) / len; - var bl0 = bLineWidth * (by - ay) / len; - var bl1 = bLineWidth * (ax - bx) / len; - - var lx0 = bx - bl0; - var ly0 = by - bl1; - var lx1 = ax - al0; - var ly1 = ay - al1; - var lx2 = bx + bl0; - var ly2 = by + bl1; - var lx3 = ax + al0; - var ly3 = ay + al1; - - // tx0 = bottom right - var brX = calcMatrix.getX(lx0, ly0); - var brY = calcMatrix.getY(lx0, ly0); - - // tx1 = bottom left - var blX = calcMatrix.getX(lx1, ly1); - var blY = calcMatrix.getY(lx1, ly1); - - // tx2 = top right - var trX = calcMatrix.getX(lx2, ly2); - var trY = calcMatrix.getY(lx2, ly2); - - // tx3 = top left - var tlX = calcMatrix.getX(lx3, ly3); - var tlY = calcMatrix.getY(lx3, ly3); - - var tint = this.strokeTint; - var tintEffect = this.tintEffect; - - var tintTL = tint.TL; - var tintTR = tint.TR; - var tintBL = tint.BL; - var tintBR = tint.BR; - - var frame = this.currentFrame; - - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - - // TL, BL, BR, TR - this.batchQuad(tlX, tlY, blX, blY, brX, brY, trX, trY, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); - - if (lineWidth <= 2) - { - // No point doing a linejoin if the line isn't thick enough - return; - } - - var prev = this.prevQuad; - var first = this.firstQuad; - - if (index > 0 && prev[4]) - { - this.batchQuad(tlX, tlY, blX, blY, prev[0], prev[1], prev[2], prev[3], u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); - } - else - { - first[0] = tlX; - first[1] = tlY; - first[2] = blX; - first[3] = blY; - first[4] = 1; - } - - if (closePath && first[4]) - { - // Add a join for the final path segment - this.batchQuad(brX, brY, trX, trY, first[0], first[1], first[2], first[3], u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect); - } - else - { - // Store it - - prev[0] = brX; - prev[1] = brY; - prev[2] = trX; - prev[3] = trY; - prev[4] = 1; - } - } - -}); - -module.exports = MultiPipeline; - - -/***/ }), -/* 113 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Implements a model view projection matrices. - * Pipelines can implement this for doing 2D and 3D rendering. - * - * @namespace Phaser.Renderer.WebGL.Pipelines.ModelViewProjection - * @since 3.0.0 - */ -var ModelViewProjection = { - - /** - * Dirty flag for checking if model matrix needs to be updated on GPU. - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelMatrixDirty - * @type {boolean} - * @since 3.0.0 - */ - modelMatrixDirty: false, - - /** - * Dirty flag for checking if view matrix needs to be updated on GPU. - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewMatrixDirty - * @type {boolean} - * @since 3.0.0 - */ - viewMatrixDirty: false, - - /** - * Dirty flag for checking if projection matrix needs to be updated on GPU. - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#projectionMatrixDirty - * @type {boolean} - * @since 3.0.0 - */ - projectionMatrixDirty: false, - - /** - * Model matrix - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#modelMatrix - * @type {?Float32Array} - * @since 3.0.0 - */ - modelMatrix: null, - - /** - * View matrix - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#viewMatrix - * @type {?Float32Array} - * @since 3.0.0 - */ - viewMatrix: null, - - /** - * Projection matrix - * - * @name Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#projectionMatrix - * @type {?Float32Array} - * @since 3.0.0 - */ - projectionMatrix: null, - - /** - * Initializes MVP matrices with an identity matrix - * - * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#mvpInit - * @since 3.0.0 - */ - mvpInit: function () - { - this.modelMatrixDirty = true; - this.viewMatrixDirty = true; - this.projectionMatrixDirty = true; - - this.modelMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - this.viewMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - this.projectionMatrix = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ]); - - return this; - }, - - /** - * If dirty flags are set then the matrices are uploaded to the GPU. - * - * @method Phaser.Renderer.WebGL.Pipelines.ModelViewProjection#mvpUpdate - * @since 3.0.0 - */ - mvpUpdate: function () - { - var program = this.program; - - if (this.modelMatrixDirty) - { - this.renderer.setMatrix4(program, 'uModelMatrix', false, this.modelMatrix); - this.modelMatrixDirty = false; - } - - if (this.viewMatrixDirty) - { - this.renderer.setMatrix4(program, 'uViewMatrix', false, this.viewMatrix); - this.viewMatrixDirty = false; - } - - if (this.projectionMatrixDirty) - { - this.renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); - this.projectionMatrixDirty = false; - } - - return this; - } -}; - -module.exports = ModelViewProjection; - - -/***/ }), -/* 114 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -27756,7 +32475,7 @@ module.exports = ModelViewProjection; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var ImageRender = __webpack_require__(994); +var ImageRender = __webpack_require__(1051); /** * @classdesc @@ -27792,7 +32511,7 @@ var ImageRender = __webpack_require__(994); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ var Image = new Class({ @@ -27845,7 +32564,7 @@ module.exports = Image; /***/ }), -/* 115 */ +/* 123 */ /***/ (function(module, exports) { /** @@ -27874,7 +32593,7 @@ module.exports = HasValue; /***/ }), -/* 116 */ +/* 124 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -27892,12 +32611,12 @@ var Bodies = {}; module.exports = Bodies; -var Vertices = __webpack_require__(88); -var Common = __webpack_require__(44); -var Body = __webpack_require__(64); -var Bounds = __webpack_require__(103); -var Vector = __webpack_require__(102); -var decomp = __webpack_require__(1404); +var Vertices = __webpack_require__(93); +var Common = __webpack_require__(50); +var Body = __webpack_require__(68); +var Bounds = __webpack_require__(115); +var Vector = __webpack_require__(114); +var decomp = __webpack_require__(1466); (function() { @@ -28232,7 +32951,7 @@ var decomp = __webpack_require__(1404); /***/ }), -/* 117 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -28241,14 +32960,14 @@ var decomp = __webpack_require__(1404); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(54); -var Circle = __webpack_require__(68); -var CircleContains = __webpack_require__(57); +var BlendModes = __webpack_require__(48); +var Circle = __webpack_require__(71); +var CircleContains = __webpack_require__(62); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(50); +var RectangleContains = __webpack_require__(56); /** * @classdesc @@ -28331,7 +33050,7 @@ var Zone = new Class({ * display lists without causing a batch flush. * * @name Phaser.GameObjects.Zone#blendMode - * @type {integer} + * @type {number} * @since 3.0.0 */ this.blendMode = BlendModes.NORMAL; @@ -28545,7 +33264,7 @@ module.exports = Zone; /***/ }), -/* 118 */ +/* 126 */ /***/ (function(module, exports) { /** @@ -28573,743 +33292,7 @@ module.exports = Perimeter; /***/ }), -/* 119 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Given a hex color value, such as 0xff00ff (for purple), it will return a - * numeric representation of it (i.e. 16711935) for use in WebGL tinting. - * - * @function Phaser.Display.Color.GetColorFromValue - * @since 3.50.0 - * - * @param {number} red - The hex color value, such as 0xff0000. - * - * @return {number} The combined color value. - */ -var GetColorFromValue = function (value) -{ - return (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); -}; - -module.exports = GetColorFromValue; - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Events = __webpack_require__(293); - -/** - * @callback DataEachCallback - * - * @param {*} parent - The parent object of the DataManager. - * @param {string} key - The key of the value. - * @param {*} value - The value. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. - */ - -/** - * @classdesc - * The Data Manager Component features a means to store pieces of data specific to a Game Object, System or Plugin. - * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, - * or have a property called `events` that is an instance of it. - * - * @class DataManager - * @memberof Phaser.Data - * @constructor - * @since 3.0.0 - * - * @param {object} parent - The object that this DataManager belongs to. - * @param {Phaser.Events.EventEmitter} [eventEmitter] - The DataManager's event emitter. - */ -var DataManager = new Class({ - - initialize: - - function DataManager (parent, eventEmitter) - { - /** - * The object that this DataManager belongs to. - * - * @name Phaser.Data.DataManager#parent - * @type {*} - * @since 3.0.0 - */ - this.parent = parent; - - /** - * The DataManager's event emitter. - * - * @name Phaser.Data.DataManager#events - * @type {Phaser.Events.EventEmitter} - * @since 3.0.0 - */ - this.events = eventEmitter; - - if (!eventEmitter) - { - this.events = (parent.events) ? parent.events : parent; - } - - /** - * The data list. - * - * @name Phaser.Data.DataManager#list - * @type {Object.} - * @default {} - * @since 3.0.0 - */ - this.list = {}; - - /** - * The public values list. You can use this to access anything you have stored - * in this Data Manager. For example, if you set a value called `gold` you can - * access it via: - * - * ```javascript - * this.data.values.gold; - * ``` - * - * You can also modify it directly: - * - * ```javascript - * this.data.values.gold += 1000; - * ``` - * - * Doing so will emit a `setdata` event from the parent of this Data Manager. - * - * Do not modify this object directly. Adding properties directly to this object will not - * emit any events. Always use `DataManager.set` to create new items the first time around. - * - * @name Phaser.Data.DataManager#values - * @type {Object.} - * @default {} - * @since 3.10.0 - */ - this.values = {}; - - /** - * Whether setting data is frozen for this DataManager. - * - * @name Phaser.Data.DataManager#_frozen - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this._frozen = false; - - if (!parent.hasOwnProperty('sys') && this.events) - { - this.events.once('destroy', this.destroy, this); - } - }, - - /** - * Retrieves the value for the given key, or undefined if it doesn't exist. - * - * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: - * - * ```javascript - * this.data.get('gold'); - * ``` - * - * Or access the value directly: - * - * ```javascript - * this.data.values.gold; - * ``` - * - * You can also pass in an array of keys, in which case an array of values will be returned: - * - * ```javascript - * this.data.get([ 'gold', 'armor', 'health' ]); - * ``` - * - * This approach is useful for destructuring arrays in ES6. - * - * @method Phaser.Data.DataManager#get - * @since 3.0.0 - * - * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. - * - * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. - */ - get: function (key) - { - var list = this.list; - - if (Array.isArray(key)) - { - var output = []; - - for (var i = 0; i < key.length; i++) - { - output.push(list[key[i]]); - } - - return output; - } - else - { - return list[key]; - } - }, - - /** - * Retrieves all data values in a new object. - * - * @method Phaser.Data.DataManager#getAll - * @since 3.0.0 - * - * @return {Object.} All data values. - */ - getAll: function () - { - var results = {}; - - for (var key in this.list) - { - if (this.list.hasOwnProperty(key)) - { - results[key] = this.list[key]; - } - } - - return results; - }, - - /** - * Queries the DataManager for the values of keys matching the given regular expression. - * - * @method Phaser.Data.DataManager#query - * @since 3.0.0 - * - * @param {RegExp} search - A regular expression object. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj). - * - * @return {Object.} The values of the keys matching the search string. - */ - query: function (search) - { - var results = {}; - - for (var key in this.list) - { - if (this.list.hasOwnProperty(key) && key.match(search)) - { - results[key] = this.list[key]; - } - } - - return results; - }, - - /** - * Sets a value for the given key. If the key doesn't already exist in the Data Manager then it is created. - * - * ```javascript - * data.set('name', 'Red Gem Stone'); - * ``` - * - * You can also pass in an object of key value pairs as the first argument: - * - * ```javascript - * data.set({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); - * ``` - * - * To get a value back again you can call `get`: - * - * ```javascript - * data.get('gold'); - * ``` - * - * Or you can access the value directly via the `values` property, where it works like any other variable: - * - * ```javascript - * data.values.gold += 50; - * ``` - * - * When the value is first set, a `setdata` event is emitted. - * - * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. - * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. - * - * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. - * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. - * - * @method Phaser.Data.DataManager#set - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @since 3.0.0 - * - * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. - * @param {*} data - The value to set for the given key. If an object is provided as the key this argument is ignored. - * - * @return {this} This DataManager object. - */ - set: function (key, data) - { - if (this._frozen) - { - return this; - } - - if (typeof key === 'string') - { - return this.setValue(key, data); - } - else - { - for (var entry in key) - { - this.setValue(entry, key[entry]); - } - } - - return this; - }, - - /** - * Increase a value for the given key. If the key doesn't already exist in the Data Manager then it is increased from 0. - * - * When the value is first set, a `setdata` event is emitted. - * - * @method Phaser.Data.DataManager#inc - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @since 3.23.0 - * - * @param {(string|object)} key - The key to increase the value for. - * @param {*} [data] - The value to increase for the given key. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - inc: function (key, data) - { - if (this._frozen) - { - return this; - } - - if (data === undefined) - { - data = 1; - } - - var value = this.get(key); - if (value === undefined) - { - value = 0; - } - - this.set(key, (value + data)); - - return this; - }, - - /** - * Toggle a boolean value for the given key. If the key doesn't already exist in the Data Manager then it is toggled from false. - * - * When the value is first set, a `setdata` event is emitted. - * - * @method Phaser.Data.DataManager#toggle - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @since 3.23.0 - * - * @param {(string|object)} key - The key to toggle the value for. - * - * @return {Phaser.Data.DataManager} This DataManager object. - */ - toggle: function (key) - { - if (this._frozen) - { - return this; - } - - this.set(key, !this.get(key)); - - return this; - }, - - /** - * Internal value setter, called automatically by the `set` method. - * - * @method Phaser.Data.DataManager#setValue - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @private - * @since 3.10.0 - * - * @param {string} key - The key to set the value for. - * @param {*} data - The value to set. - * - * @return {this} This DataManager object. - */ - setValue: function (key, data) - { - if (this._frozen) - { - return this; - } - - if (this.has(key)) - { - // Hit the key getter, which will in turn emit the events. - this.values[key] = data; - } - else - { - var _this = this; - var list = this.list; - var events = this.events; - var parent = this.parent; - - Object.defineProperty(this.values, key, { - - enumerable: true, - - configurable: true, - - get: function () - { - return list[key]; - }, - - set: function (value) - { - if (!_this._frozen) - { - var previousValue = list[key]; - list[key] = value; - - events.emit(Events.CHANGE_DATA, parent, key, value, previousValue); - events.emit(Events.CHANGE_DATA_KEY + key, parent, value, previousValue); - } - } - - }); - - list[key] = data; - - events.emit(Events.SET_DATA, parent, key, data); - } - - return this; - }, - - /** - * Passes all data entries to the given callback. - * - * @method Phaser.Data.DataManager#each - * @since 3.0.0 - * - * @param {DataEachCallback} callback - The function to call. - * @param {*} [context] - Value to use as `this` when executing callback. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. - * - * @return {this} This DataManager object. - */ - each: function (callback, context) - { - var args = [ this.parent, null, undefined ]; - - for (var i = 1; i < arguments.length; i++) - { - args.push(arguments[i]); - } - - for (var key in this.list) - { - args[1] = key; - args[2] = this.list[key]; - - callback.apply(context, args); - } - - return this; - }, - - /** - * Merge the given object of key value pairs into this DataManager. - * - * Any newly created values will emit a `setdata` event. Any updated values (see the `overwrite` argument) - * will emit a `changedata` event. - * - * @method Phaser.Data.DataManager#merge - * @fires Phaser.Data.Events#SET_DATA - * @fires Phaser.Data.Events#CHANGE_DATA - * @fires Phaser.Data.Events#CHANGE_DATA_KEY - * @since 3.0.0 - * - * @param {Object.} data - The data to merge. - * @param {boolean} [overwrite=true] - Whether to overwrite existing data. Defaults to true. - * - * @return {this} This DataManager object. - */ - merge: function (data, overwrite) - { - if (overwrite === undefined) { overwrite = true; } - - // Merge data from another component into this one - for (var key in data) - { - if (data.hasOwnProperty(key) && (overwrite || (!overwrite && !this.has(key)))) - { - this.setValue(key, data[key]); - } - } - - return this; - }, - - /** - * Remove the value for the given key. - * - * If the key is found in this Data Manager it is removed from the internal lists and a - * `removedata` event is emitted. - * - * You can also pass in an array of keys, in which case all keys in the array will be removed: - * - * ```javascript - * this.data.remove([ 'gold', 'armor', 'health' ]); - * ``` - * - * @method Phaser.Data.DataManager#remove - * @fires Phaser.Data.Events#REMOVE_DATA - * @since 3.0.0 - * - * @param {(string|string[])} key - The key to remove, or an array of keys to remove. - * - * @return {this} This DataManager object. - */ - remove: function (key) - { - if (this._frozen) - { - return this; - } - - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - this.removeValue(key[i]); - } - } - else - { - return this.removeValue(key); - } - - return this; - }, - - /** - * Internal value remover, called automatically by the `remove` method. - * - * @method Phaser.Data.DataManager#removeValue - * @private - * @fires Phaser.Data.Events#REMOVE_DATA - * @since 3.10.0 - * - * @param {string} key - The key to set the value for. - * - * @return {this} This DataManager object. - */ - removeValue: function (key) - { - if (this.has(key)) - { - var data = this.list[key]; - - delete this.list[key]; - delete this.values[key]; - - this.events.emit(Events.REMOVE_DATA, this.parent, key, data); - } - - return this; - }, - - /** - * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it. - * - * @method Phaser.Data.DataManager#pop - * @fires Phaser.Data.Events#REMOVE_DATA - * @since 3.0.0 - * - * @param {string} key - The key of the value to retrieve and delete. - * - * @return {*} The value of the given key. - */ - pop: function (key) - { - var data = undefined; - - if (!this._frozen && this.has(key)) - { - data = this.list[key]; - - delete this.list[key]; - delete this.values[key]; - - this.events.emit(Events.REMOVE_DATA, this.parent, key, data); - } - - return data; - }, - - /** - * Determines whether the given key is set in this Data Manager. - * - * Please note that the keys are case-sensitive and must be valid JavaScript Object property strings. - * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. - * - * @method Phaser.Data.DataManager#has - * @since 3.0.0 - * - * @param {string} key - The key to check. - * - * @return {boolean} Returns `true` if the key exists, otherwise `false`. - */ - has: function (key) - { - return this.list.hasOwnProperty(key); - }, - - /** - * Freeze or unfreeze this Data Manager. A frozen Data Manager will block all attempts - * to create new values or update existing ones. - * - * @method Phaser.Data.DataManager#setFreeze - * @since 3.0.0 - * - * @param {boolean} value - Whether to freeze or unfreeze the Data Manager. - * - * @return {this} This DataManager object. - */ - setFreeze: function (value) - { - this._frozen = value; - - return this; - }, - - /** - * Delete all data in this Data Manager and unfreeze it. - * - * @method Phaser.Data.DataManager#reset - * @since 3.0.0 - * - * @return {this} This DataManager object. - */ - reset: function () - { - for (var key in this.list) - { - delete this.list[key]; - delete this.values[key]; - } - - this._frozen = false; - - return this; - }, - - /** - * Destroy this data manager. - * - * @method Phaser.Data.DataManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.reset(); - - this.events.off(Events.CHANGE_DATA); - this.events.off(Events.SET_DATA); - this.events.off(Events.REMOVE_DATA); - - this.parent = null; - }, - - /** - * Gets or sets the frozen state of this Data Manager. - * A frozen Data Manager will block all attempts to create new values or update existing ones. - * - * @name Phaser.Data.DataManager#freeze - * @type {boolean} - * @since 3.0.0 - */ - freeze: { - - get: function () - { - return this._frozen; - }, - - set: function (value) - { - this._frozen = (value) ? true : false; - } - - }, - - /** - * Return the total number of entries in this Data Manager. - * - * @name Phaser.Data.DataManager#count - * @type {integer} - * @since 3.0.0 - */ - count: { - - get: function () - { - var i = 0; - - for (var key in this.list) - { - if (this.list[key] !== undefined) - { - i++; - } - } - - return i; - } - - } - -}); - -module.exports = DataManager; - - -/***/ }), -/* 121 */ +/* 127 */ /***/ (function(module, exports) { /** @@ -29350,7 +33333,7 @@ module.exports = Shuffle; /***/ }), -/* 122 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29365,23 +33348,23 @@ module.exports = Shuffle; module.exports = { - ADD_ANIMATION: __webpack_require__(652), - ANIMATION_COMPLETE: __webpack_require__(653), - ANIMATION_COMPLETE_KEY: __webpack_require__(654), - ANIMATION_REPEAT: __webpack_require__(655), - ANIMATION_RESTART: __webpack_require__(656), - ANIMATION_START: __webpack_require__(657), - ANIMATION_STOP: __webpack_require__(658), - ANIMATION_UPDATE: __webpack_require__(659), - PAUSE_ALL: __webpack_require__(660), - REMOVE_ANIMATION: __webpack_require__(661), - RESUME_ALL: __webpack_require__(662) + ADD_ANIMATION: __webpack_require__(692), + ANIMATION_COMPLETE: __webpack_require__(693), + ANIMATION_COMPLETE_KEY: __webpack_require__(694), + ANIMATION_REPEAT: __webpack_require__(695), + ANIMATION_RESTART: __webpack_require__(696), + ANIMATION_START: __webpack_require__(697), + ANIMATION_STOP: __webpack_require__(698), + ANIMATION_UPDATE: __webpack_require__(699), + PAUSE_ALL: __webpack_require__(700), + REMOVE_ANIMATION: __webpack_require__(701), + RESUME_ALL: __webpack_require__(702) }; /***/ }), -/* 123 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29390,18 +33373,18 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Back = __webpack_require__(315); -var Bounce = __webpack_require__(316); -var Circular = __webpack_require__(317); -var Cubic = __webpack_require__(318); -var Elastic = __webpack_require__(319); -var Expo = __webpack_require__(320); -var Linear = __webpack_require__(321); -var Quadratic = __webpack_require__(322); -var Quartic = __webpack_require__(323); -var Quintic = __webpack_require__(324); -var Sine = __webpack_require__(325); -var Stepped = __webpack_require__(326); +var Back = __webpack_require__(326); +var Bounce = __webpack_require__(327); +var Circular = __webpack_require__(328); +var Cubic = __webpack_require__(329); +var Elastic = __webpack_require__(330); +var Expo = __webpack_require__(331); +var Linear = __webpack_require__(332); +var Quadratic = __webpack_require__(333); +var Quartic = __webpack_require__(334); +var Quintic = __webpack_require__(335); +var Sine = __webpack_require__(336); +var Stepped = __webpack_require__(337); // EaseMap module.exports = { @@ -29462,7 +33445,7 @@ module.exports = { /***/ }), -/* 124 */ +/* 130 */ /***/ (function(module, exports) { /** @@ -29492,179 +33475,7 @@ module.exports = Linear; /***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(process) {/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Determines the operating system of the device running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.os` from within any Scene. - * - * @typedef {object} Phaser.Device.OS - * @since 3.0.0 - * - * @property {boolean} android - Is running on android? - * @property {boolean} chromeOS - Is running on chromeOS? - * @property {boolean} cordova - Is the game running under Apache Cordova? - * @property {boolean} crosswalk - Is the game running under the Intel Crosswalk XDK? - * @property {boolean} desktop - Is running on a desktop? - * @property {boolean} ejecta - Is the game running under Ejecta? - * @property {boolean} electron - Is the game running under GitHub Electron? - * @property {boolean} iOS - Is running on iOS? - * @property {boolean} iPad - Is running on iPad? - * @property {boolean} iPhone - Is running on iPhone? - * @property {boolean} kindle - Is running on an Amazon Kindle? - * @property {boolean} linux - Is running on linux? - * @property {boolean} macOS - Is running on macOS? - * @property {boolean} node - Is the game running under Node.js? - * @property {boolean} nodeWebkit - Is the game running under Node-Webkit? - * @property {boolean} webApp - Set to true if running as a WebApp, i.e. within a WebView - * @property {boolean} windows - Is running on windows? - * @property {boolean} windowsPhone - Is running on a Windows Phone? - * @property {number} iOSVersion - If running in iOS this will contain the major version number. - * @property {number} pixelRatio - PixelRatio of the host device? - */ -var OS = { - - android: false, - chromeOS: false, - cordova: false, - crosswalk: false, - desktop: false, - ejecta: false, - electron: false, - iOS: false, - iOSVersion: 0, - iPad: false, - iPhone: false, - kindle: false, - linux: false, - macOS: false, - node: false, - nodeWebkit: false, - pixelRatio: 1, - webApp: false, - windows: false, - windowsPhone: false - -}; - -function init () -{ - var ua = navigator.userAgent; - - if ((/Windows/).test(ua)) - { - OS.windows = true; - } - else if ((/Mac OS/).test(ua) && !((/like Mac OS/).test(ua))) - { - OS.macOS = true; - } - else if ((/Android/).test(ua)) - { - OS.android = true; - } - else if ((/Linux/).test(ua)) - { - OS.linux = true; - } - else if ((/iP[ao]d|iPhone/i).test(ua)) - { - OS.iOS = true; - - (navigator.appVersion).match(/OS (\d+)/); - - OS.iOSVersion = parseInt(RegExp.$1, 10); - - OS.iPhone = ua.toLowerCase().indexOf('iphone') !== -1; - OS.iPad = ua.toLowerCase().indexOf('ipad') !== -1; - } - else if ((/Kindle/).test(ua) || (/\bKF[A-Z][A-Z]+/).test(ua) || (/Silk.*Mobile Safari/).test(ua)) - { - OS.kindle = true; - - // This will NOT detect early generations of Kindle Fire, I think there is no reliable way... - // E.g. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" - } - else if ((/CrOS/).test(ua)) - { - OS.chromeOS = true; - } - - if ((/Windows Phone/i).test(ua) || (/IEMobile/i).test(ua)) - { - OS.android = false; - OS.iOS = false; - OS.macOS = false; - OS.windows = true; - OS.windowsPhone = true; - } - - var silk = (/Silk/).test(ua); - - if (OS.windows || OS.macOS || (OS.linux && !silk) || OS.chromeOS) - { - OS.desktop = true; - } - - // Windows Phone / Table reset - if (OS.windowsPhone || (((/Windows NT/i).test(ua)) && ((/Touch/i).test(ua)))) - { - OS.desktop = false; - } - - // WebApp mode in iOS - if (navigator.standalone) - { - OS.webApp = true; - } - - if (window.cordova !== undefined) - { - OS.cordova = true; - } - - if (typeof process !== 'undefined' && process.versions && process.versions.node) - { - OS.node = true; - } - - if (OS.node && typeof process.versions === 'object') - { - OS.nodeWebkit = !!process.versions['node-webkit']; - - OS.electron = !!process.versions.electron; - } - - if (window.ejecta !== undefined) - { - OS.ejecta = true; - } - - if ((/Crosswalk/).test(ua)) - { - OS.crosswalk = true; - } - - OS.pixelRatio = window['devicePixelRatio'] || 1; - - return OS; -} - -module.exports = init(); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(755))) - -/***/ }), -/* 126 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29673,7 +33484,7 @@ module.exports = init(); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var OS = __webpack_require__(125); +var OS = __webpack_require__(102); /** * Determines the browser type and version running this Phaser Game instance. @@ -29774,7 +33585,7 @@ module.exports = init(); /***/ }), -/* 127 */ +/* 132 */ /***/ (function(module, exports) { /** @@ -29803,7 +33614,7 @@ module.exports = FloatBetween; /***/ }), -/* 128 */ +/* 133 */ /***/ (function(module, exports) { /** @@ -29833,7 +33644,51 @@ module.exports = IsSizePowerOfTwo; /***/ }), -/* 129 */ +/* 134 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Snap a value to nearest grid slice, using ceil. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. + * As will `14` snap to `15`... but `16` will snap to `20`. + * + * @function Phaser.Math.Snap.Ceil + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapCeil = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.ceil(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapCeil; + + +/***/ }), +/* 135 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -30378,7 +34233,7 @@ module.exports = Vector4; /***/ }), -/* 130 */ +/* 136 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -30393,17 +34248,17 @@ module.exports = Vector4; module.exports = { - ADD: __webpack_require__(814), - ERROR: __webpack_require__(815), - LOAD: __webpack_require__(816), - READY: __webpack_require__(817), - REMOVE: __webpack_require__(818) + ADD: __webpack_require__(869), + ERROR: __webpack_require__(870), + LOAD: __webpack_require__(871), + READY: __webpack_require__(872), + REMOVE: __webpack_require__(873) }; /***/ }), -/* 131 */ +/* 137 */ /***/ (function(module, exports) { /** @@ -30461,7 +34316,7 @@ module.exports = AddToDOM; /***/ }), -/* 132 */ +/* 138 */ /***/ (function(module, exports) { /** @@ -30484,7 +34339,7 @@ var KeyCodes = { * The BACKSPACE key. * * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE - * @type {integer} + * @type {number} * @since 3.0.0 */ BACKSPACE: 8, @@ -30493,7 +34348,7 @@ var KeyCodes = { * The TAB key. * * @name Phaser.Input.Keyboard.KeyCodes.TAB - * @type {integer} + * @type {number} * @since 3.0.0 */ TAB: 9, @@ -30502,7 +34357,7 @@ var KeyCodes = { * The ENTER key. * * @name Phaser.Input.Keyboard.KeyCodes.ENTER - * @type {integer} + * @type {number} * @since 3.0.0 */ ENTER: 13, @@ -30511,7 +34366,7 @@ var KeyCodes = { * The SHIFT key. * * @name Phaser.Input.Keyboard.KeyCodes.SHIFT - * @type {integer} + * @type {number} * @since 3.0.0 */ SHIFT: 16, @@ -30520,7 +34375,7 @@ var KeyCodes = { * The CTRL key. * * @name Phaser.Input.Keyboard.KeyCodes.CTRL - * @type {integer} + * @type {number} * @since 3.0.0 */ CTRL: 17, @@ -30529,7 +34384,7 @@ var KeyCodes = { * The ALT key. * * @name Phaser.Input.Keyboard.KeyCodes.ALT - * @type {integer} + * @type {number} * @since 3.0.0 */ ALT: 18, @@ -30538,7 +34393,7 @@ var KeyCodes = { * The PAUSE key. * * @name Phaser.Input.Keyboard.KeyCodes.PAUSE - * @type {integer} + * @type {number} * @since 3.0.0 */ PAUSE: 19, @@ -30547,7 +34402,7 @@ var KeyCodes = { * The CAPS_LOCK key. * * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK - * @type {integer} + * @type {number} * @since 3.0.0 */ CAPS_LOCK: 20, @@ -30556,7 +34411,7 @@ var KeyCodes = { * The ESC key. * * @name Phaser.Input.Keyboard.KeyCodes.ESC - * @type {integer} + * @type {number} * @since 3.0.0 */ ESC: 27, @@ -30565,7 +34420,7 @@ var KeyCodes = { * The SPACE key. * * @name Phaser.Input.Keyboard.KeyCodes.SPACE - * @type {integer} + * @type {number} * @since 3.0.0 */ SPACE: 32, @@ -30574,7 +34429,7 @@ var KeyCodes = { * The PAGE_UP key. * * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP - * @type {integer} + * @type {number} * @since 3.0.0 */ PAGE_UP: 33, @@ -30583,7 +34438,7 @@ var KeyCodes = { * The PAGE_DOWN key. * * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN - * @type {integer} + * @type {number} * @since 3.0.0 */ PAGE_DOWN: 34, @@ -30592,7 +34447,7 @@ var KeyCodes = { * The END key. * * @name Phaser.Input.Keyboard.KeyCodes.END - * @type {integer} + * @type {number} * @since 3.0.0 */ END: 35, @@ -30601,7 +34456,7 @@ var KeyCodes = { * The HOME key. * * @name Phaser.Input.Keyboard.KeyCodes.HOME - * @type {integer} + * @type {number} * @since 3.0.0 */ HOME: 36, @@ -30610,7 +34465,7 @@ var KeyCodes = { * The LEFT key. * * @name Phaser.Input.Keyboard.KeyCodes.LEFT - * @type {integer} + * @type {number} * @since 3.0.0 */ LEFT: 37, @@ -30619,7 +34474,7 @@ var KeyCodes = { * The UP key. * * @name Phaser.Input.Keyboard.KeyCodes.UP - * @type {integer} + * @type {number} * @since 3.0.0 */ UP: 38, @@ -30628,7 +34483,7 @@ var KeyCodes = { * The RIGHT key. * * @name Phaser.Input.Keyboard.KeyCodes.RIGHT - * @type {integer} + * @type {number} * @since 3.0.0 */ RIGHT: 39, @@ -30637,7 +34492,7 @@ var KeyCodes = { * The DOWN key. * * @name Phaser.Input.Keyboard.KeyCodes.DOWN - * @type {integer} + * @type {number} * @since 3.0.0 */ DOWN: 40, @@ -30646,7 +34501,7 @@ var KeyCodes = { * The PRINT_SCREEN key. * * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN - * @type {integer} + * @type {number} * @since 3.0.0 */ PRINT_SCREEN: 42, @@ -30655,7 +34510,7 @@ var KeyCodes = { * The INSERT key. * * @name Phaser.Input.Keyboard.KeyCodes.INSERT - * @type {integer} + * @type {number} * @since 3.0.0 */ INSERT: 45, @@ -30664,7 +34519,7 @@ var KeyCodes = { * The DELETE key. * * @name Phaser.Input.Keyboard.KeyCodes.DELETE - * @type {integer} + * @type {number} * @since 3.0.0 */ DELETE: 46, @@ -30673,7 +34528,7 @@ var KeyCodes = { * The ZERO key. * * @name Phaser.Input.Keyboard.KeyCodes.ZERO - * @type {integer} + * @type {number} * @since 3.0.0 */ ZERO: 48, @@ -30682,7 +34537,7 @@ var KeyCodes = { * The ONE key. * * @name Phaser.Input.Keyboard.KeyCodes.ONE - * @type {integer} + * @type {number} * @since 3.0.0 */ ONE: 49, @@ -30691,7 +34546,7 @@ var KeyCodes = { * The TWO key. * * @name Phaser.Input.Keyboard.KeyCodes.TWO - * @type {integer} + * @type {number} * @since 3.0.0 */ TWO: 50, @@ -30700,7 +34555,7 @@ var KeyCodes = { * The THREE key. * * @name Phaser.Input.Keyboard.KeyCodes.THREE - * @type {integer} + * @type {number} * @since 3.0.0 */ THREE: 51, @@ -30709,7 +34564,7 @@ var KeyCodes = { * The FOUR key. * * @name Phaser.Input.Keyboard.KeyCodes.FOUR - * @type {integer} + * @type {number} * @since 3.0.0 */ FOUR: 52, @@ -30718,7 +34573,7 @@ var KeyCodes = { * The FIVE key. * * @name Phaser.Input.Keyboard.KeyCodes.FIVE - * @type {integer} + * @type {number} * @since 3.0.0 */ FIVE: 53, @@ -30727,7 +34582,7 @@ var KeyCodes = { * The SIX key. * * @name Phaser.Input.Keyboard.KeyCodes.SIX - * @type {integer} + * @type {number} * @since 3.0.0 */ SIX: 54, @@ -30736,7 +34591,7 @@ var KeyCodes = { * The SEVEN key. * * @name Phaser.Input.Keyboard.KeyCodes.SEVEN - * @type {integer} + * @type {number} * @since 3.0.0 */ SEVEN: 55, @@ -30745,7 +34600,7 @@ var KeyCodes = { * The EIGHT key. * * @name Phaser.Input.Keyboard.KeyCodes.EIGHT - * @type {integer} + * @type {number} * @since 3.0.0 */ EIGHT: 56, @@ -30754,7 +34609,7 @@ var KeyCodes = { * The NINE key. * * @name Phaser.Input.Keyboard.KeyCodes.NINE - * @type {integer} + * @type {number} * @since 3.0.0 */ NINE: 57, @@ -30763,7 +34618,7 @@ var KeyCodes = { * The NUMPAD_ZERO key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ZERO - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_ZERO: 96, @@ -30772,7 +34627,7 @@ var KeyCodes = { * The NUMPAD_ONE key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ONE - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_ONE: 97, @@ -30781,7 +34636,7 @@ var KeyCodes = { * The NUMPAD_TWO key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_TWO - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_TWO: 98, @@ -30790,7 +34645,7 @@ var KeyCodes = { * The NUMPAD_THREE key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_THREE - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_THREE: 99, @@ -30799,7 +34654,7 @@ var KeyCodes = { * The NUMPAD_FOUR key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FOUR - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_FOUR: 100, @@ -30808,7 +34663,7 @@ var KeyCodes = { * The NUMPAD_FIVE key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FIVE - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_FIVE: 101, @@ -30817,7 +34672,7 @@ var KeyCodes = { * The NUMPAD_SIX key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SIX - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_SIX: 102, @@ -30826,7 +34681,7 @@ var KeyCodes = { * The NUMPAD_SEVEN key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SEVEN - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_SEVEN: 103, @@ -30835,7 +34690,7 @@ var KeyCodes = { * The NUMPAD_EIGHT key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_EIGHT - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_EIGHT: 104, @@ -30844,7 +34699,7 @@ var KeyCodes = { * The NUMPAD_NINE key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_NINE - * @type {integer} + * @type {number} * @since 3.0.0 */ NUMPAD_NINE: 105, @@ -30853,7 +34708,7 @@ var KeyCodes = { * The Numpad Addition (+) key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ADD - * @type {integer} + * @type {number} * @since 3.21.0 */ NUMPAD_ADD: 107, @@ -30862,7 +34717,7 @@ var KeyCodes = { * The Numpad Subtraction (-) key. * * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SUBTRACT - * @type {integer} + * @type {number} * @since 3.21.0 */ NUMPAD_SUBTRACT: 109, @@ -30871,7 +34726,7 @@ var KeyCodes = { * The A key. * * @name Phaser.Input.Keyboard.KeyCodes.A - * @type {integer} + * @type {number} * @since 3.0.0 */ A: 65, @@ -30880,7 +34735,7 @@ var KeyCodes = { * The B key. * * @name Phaser.Input.Keyboard.KeyCodes.B - * @type {integer} + * @type {number} * @since 3.0.0 */ B: 66, @@ -30889,7 +34744,7 @@ var KeyCodes = { * The C key. * * @name Phaser.Input.Keyboard.KeyCodes.C - * @type {integer} + * @type {number} * @since 3.0.0 */ C: 67, @@ -30898,7 +34753,7 @@ var KeyCodes = { * The D key. * * @name Phaser.Input.Keyboard.KeyCodes.D - * @type {integer} + * @type {number} * @since 3.0.0 */ D: 68, @@ -30907,7 +34762,7 @@ var KeyCodes = { * The E key. * * @name Phaser.Input.Keyboard.KeyCodes.E - * @type {integer} + * @type {number} * @since 3.0.0 */ E: 69, @@ -30916,7 +34771,7 @@ var KeyCodes = { * The F key. * * @name Phaser.Input.Keyboard.KeyCodes.F - * @type {integer} + * @type {number} * @since 3.0.0 */ F: 70, @@ -30925,7 +34780,7 @@ var KeyCodes = { * The G key. * * @name Phaser.Input.Keyboard.KeyCodes.G - * @type {integer} + * @type {number} * @since 3.0.0 */ G: 71, @@ -30934,7 +34789,7 @@ var KeyCodes = { * The H key. * * @name Phaser.Input.Keyboard.KeyCodes.H - * @type {integer} + * @type {number} * @since 3.0.0 */ H: 72, @@ -30943,7 +34798,7 @@ var KeyCodes = { * The I key. * * @name Phaser.Input.Keyboard.KeyCodes.I - * @type {integer} + * @type {number} * @since 3.0.0 */ I: 73, @@ -30952,7 +34807,7 @@ var KeyCodes = { * The J key. * * @name Phaser.Input.Keyboard.KeyCodes.J - * @type {integer} + * @type {number} * @since 3.0.0 */ J: 74, @@ -30961,7 +34816,7 @@ var KeyCodes = { * The K key. * * @name Phaser.Input.Keyboard.KeyCodes.K - * @type {integer} + * @type {number} * @since 3.0.0 */ K: 75, @@ -30970,7 +34825,7 @@ var KeyCodes = { * The L key. * * @name Phaser.Input.Keyboard.KeyCodes.L - * @type {integer} + * @type {number} * @since 3.0.0 */ L: 76, @@ -30979,7 +34834,7 @@ var KeyCodes = { * The M key. * * @name Phaser.Input.Keyboard.KeyCodes.M - * @type {integer} + * @type {number} * @since 3.0.0 */ M: 77, @@ -30988,7 +34843,7 @@ var KeyCodes = { * The N key. * * @name Phaser.Input.Keyboard.KeyCodes.N - * @type {integer} + * @type {number} * @since 3.0.0 */ N: 78, @@ -30997,7 +34852,7 @@ var KeyCodes = { * The O key. * * @name Phaser.Input.Keyboard.KeyCodes.O - * @type {integer} + * @type {number} * @since 3.0.0 */ O: 79, @@ -31006,7 +34861,7 @@ var KeyCodes = { * The P key. * * @name Phaser.Input.Keyboard.KeyCodes.P - * @type {integer} + * @type {number} * @since 3.0.0 */ P: 80, @@ -31015,7 +34870,7 @@ var KeyCodes = { * The Q key. * * @name Phaser.Input.Keyboard.KeyCodes.Q - * @type {integer} + * @type {number} * @since 3.0.0 */ Q: 81, @@ -31024,7 +34879,7 @@ var KeyCodes = { * The R key. * * @name Phaser.Input.Keyboard.KeyCodes.R - * @type {integer} + * @type {number} * @since 3.0.0 */ R: 82, @@ -31033,7 +34888,7 @@ var KeyCodes = { * The S key. * * @name Phaser.Input.Keyboard.KeyCodes.S - * @type {integer} + * @type {number} * @since 3.0.0 */ S: 83, @@ -31042,7 +34897,7 @@ var KeyCodes = { * The T key. * * @name Phaser.Input.Keyboard.KeyCodes.T - * @type {integer} + * @type {number} * @since 3.0.0 */ T: 84, @@ -31051,7 +34906,7 @@ var KeyCodes = { * The U key. * * @name Phaser.Input.Keyboard.KeyCodes.U - * @type {integer} + * @type {number} * @since 3.0.0 */ U: 85, @@ -31060,7 +34915,7 @@ var KeyCodes = { * The V key. * * @name Phaser.Input.Keyboard.KeyCodes.V - * @type {integer} + * @type {number} * @since 3.0.0 */ V: 86, @@ -31069,7 +34924,7 @@ var KeyCodes = { * The W key. * * @name Phaser.Input.Keyboard.KeyCodes.W - * @type {integer} + * @type {number} * @since 3.0.0 */ W: 87, @@ -31078,7 +34933,7 @@ var KeyCodes = { * The X key. * * @name Phaser.Input.Keyboard.KeyCodes.X - * @type {integer} + * @type {number} * @since 3.0.0 */ X: 88, @@ -31087,7 +34942,7 @@ var KeyCodes = { * The Y key. * * @name Phaser.Input.Keyboard.KeyCodes.Y - * @type {integer} + * @type {number} * @since 3.0.0 */ Y: 89, @@ -31096,7 +34951,7 @@ var KeyCodes = { * The Z key. * * @name Phaser.Input.Keyboard.KeyCodes.Z - * @type {integer} + * @type {number} * @since 3.0.0 */ Z: 90, @@ -31105,7 +34960,7 @@ var KeyCodes = { * The F1 key. * * @name Phaser.Input.Keyboard.KeyCodes.F1 - * @type {integer} + * @type {number} * @since 3.0.0 */ F1: 112, @@ -31114,7 +34969,7 @@ var KeyCodes = { * The F2 key. * * @name Phaser.Input.Keyboard.KeyCodes.F2 - * @type {integer} + * @type {number} * @since 3.0.0 */ F2: 113, @@ -31123,7 +34978,7 @@ var KeyCodes = { * The F3 key. * * @name Phaser.Input.Keyboard.KeyCodes.F3 - * @type {integer} + * @type {number} * @since 3.0.0 */ F3: 114, @@ -31132,7 +34987,7 @@ var KeyCodes = { * The F4 key. * * @name Phaser.Input.Keyboard.KeyCodes.F4 - * @type {integer} + * @type {number} * @since 3.0.0 */ F4: 115, @@ -31141,7 +34996,7 @@ var KeyCodes = { * The F5 key. * * @name Phaser.Input.Keyboard.KeyCodes.F5 - * @type {integer} + * @type {number} * @since 3.0.0 */ F5: 116, @@ -31150,7 +35005,7 @@ var KeyCodes = { * The F6 key. * * @name Phaser.Input.Keyboard.KeyCodes.F6 - * @type {integer} + * @type {number} * @since 3.0.0 */ F6: 117, @@ -31159,7 +35014,7 @@ var KeyCodes = { * The F7 key. * * @name Phaser.Input.Keyboard.KeyCodes.F7 - * @type {integer} + * @type {number} * @since 3.0.0 */ F7: 118, @@ -31168,7 +35023,7 @@ var KeyCodes = { * The F8 key. * * @name Phaser.Input.Keyboard.KeyCodes.F8 - * @type {integer} + * @type {number} * @since 3.0.0 */ F8: 119, @@ -31177,7 +35032,7 @@ var KeyCodes = { * The F9 key. * * @name Phaser.Input.Keyboard.KeyCodes.F9 - * @type {integer} + * @type {number} * @since 3.0.0 */ F9: 120, @@ -31186,7 +35041,7 @@ var KeyCodes = { * The F10 key. * * @name Phaser.Input.Keyboard.KeyCodes.F10 - * @type {integer} + * @type {number} * @since 3.0.0 */ F10: 121, @@ -31195,7 +35050,7 @@ var KeyCodes = { * The F11 key. * * @name Phaser.Input.Keyboard.KeyCodes.F11 - * @type {integer} + * @type {number} * @since 3.0.0 */ F11: 122, @@ -31204,7 +35059,7 @@ var KeyCodes = { * The F12 key. * * @name Phaser.Input.Keyboard.KeyCodes.F12 - * @type {integer} + * @type {number} * @since 3.0.0 */ F12: 123, @@ -31213,7 +35068,7 @@ var KeyCodes = { * The SEMICOLON key. * * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON - * @type {integer} + * @type {number} * @since 3.0.0 */ SEMICOLON: 186, @@ -31222,7 +35077,7 @@ var KeyCodes = { * The PLUS key. * * @name Phaser.Input.Keyboard.KeyCodes.PLUS - * @type {integer} + * @type {number} * @since 3.0.0 */ PLUS: 187, @@ -31231,7 +35086,7 @@ var KeyCodes = { * The COMMA key. * * @name Phaser.Input.Keyboard.KeyCodes.COMMA - * @type {integer} + * @type {number} * @since 3.0.0 */ COMMA: 188, @@ -31240,7 +35095,7 @@ var KeyCodes = { * The MINUS key. * * @name Phaser.Input.Keyboard.KeyCodes.MINUS - * @type {integer} + * @type {number} * @since 3.0.0 */ MINUS: 189, @@ -31249,7 +35104,7 @@ var KeyCodes = { * The PERIOD key. * * @name Phaser.Input.Keyboard.KeyCodes.PERIOD - * @type {integer} + * @type {number} * @since 3.0.0 */ PERIOD: 190, @@ -31258,7 +35113,7 @@ var KeyCodes = { * The FORWARD_SLASH key. * * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH - * @type {integer} + * @type {number} * @since 3.0.0 */ FORWARD_SLASH: 191, @@ -31267,7 +35122,7 @@ var KeyCodes = { * The BACK_SLASH key. * * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH - * @type {integer} + * @type {number} * @since 3.0.0 */ BACK_SLASH: 220, @@ -31276,7 +35131,7 @@ var KeyCodes = { * The QUOTES key. * * @name Phaser.Input.Keyboard.KeyCodes.QUOTES - * @type {integer} + * @type {number} * @since 3.0.0 */ QUOTES: 222, @@ -31285,7 +35140,7 @@ var KeyCodes = { * The BACKTICK key. * * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK - * @type {integer} + * @type {number} * @since 3.0.0 */ BACKTICK: 192, @@ -31294,7 +35149,7 @@ var KeyCodes = { * The OPEN_BRACKET key. * * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET - * @type {integer} + * @type {number} * @since 3.0.0 */ OPEN_BRACKET: 219, @@ -31303,7 +35158,7 @@ var KeyCodes = { * The CLOSED_BRACKET key. * * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET - * @type {integer} + * @type {number} * @since 3.0.0 */ CLOSED_BRACKET: 221, @@ -31312,7 +35167,7 @@ var KeyCodes = { * The SEMICOLON_FIREFOX key. * * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON_FIREFOX - * @type {integer} + * @type {number} * @since 3.0.0 */ SEMICOLON_FIREFOX: 59, @@ -31321,7 +35176,7 @@ var KeyCodes = { * The COLON key. * * @name Phaser.Input.Keyboard.KeyCodes.COLON - * @type {integer} + * @type {number} * @since 3.0.0 */ COLON: 58, @@ -31330,7 +35185,7 @@ var KeyCodes = { * The COMMA_FIREFOX_WINDOWS key. * * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX_WINDOWS - * @type {integer} + * @type {number} * @since 3.0.0 */ COMMA_FIREFOX_WINDOWS: 60, @@ -31339,7 +35194,7 @@ var KeyCodes = { * The COMMA_FIREFOX key. * * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX - * @type {integer} + * @type {number} * @since 3.0.0 */ COMMA_FIREFOX: 62, @@ -31348,7 +35203,7 @@ var KeyCodes = { * The BRACKET_RIGHT_FIREFOX key. * * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_RIGHT_FIREFOX - * @type {integer} + * @type {number} * @since 3.0.0 */ BRACKET_RIGHT_FIREFOX: 174, @@ -31357,7 +35212,7 @@ var KeyCodes = { * The BRACKET_LEFT_FIREFOX key. * * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_LEFT_FIREFOX - * @type {integer} + * @type {number} * @since 3.0.0 */ BRACKET_LEFT_FIREFOX: 175 @@ -31367,7 +35222,7 @@ module.exports = KeyCodes; /***/ }), -/* 133 */ +/* 139 */ /***/ (function(module, exports) { /** @@ -31389,7 +35244,7 @@ var CONST = { * * @name Phaser.Scenes.PENDING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ PENDING: 0, @@ -31399,7 +35254,7 @@ var CONST = { * * @name Phaser.Scenes.INIT * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ INIT: 1, @@ -31409,7 +35264,7 @@ var CONST = { * * @name Phaser.Scenes.START * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ START: 2, @@ -31419,7 +35274,7 @@ var CONST = { * * @name Phaser.Scenes.LOADING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ LOADING: 3, @@ -31429,7 +35284,7 @@ var CONST = { * * @name Phaser.Scenes.CREATING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ CREATING: 4, @@ -31439,7 +35294,7 @@ var CONST = { * * @name Phaser.Scenes.RUNNING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ RUNNING: 5, @@ -31449,7 +35304,7 @@ var CONST = { * * @name Phaser.Scenes.PAUSED * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ PAUSED: 6, @@ -31459,7 +35314,7 @@ var CONST = { * * @name Phaser.Scenes.SLEEPING * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ SLEEPING: 7, @@ -31469,7 +35324,7 @@ var CONST = { * * @name Phaser.Scenes.SHUTDOWN * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ SHUTDOWN: 8, @@ -31479,7 +35334,7 @@ var CONST = { * * @name Phaser.Scenes.DESTROYED * @readonly - * @type {integer} + * @type {number} * @since 3.0.0 */ DESTROYED: 9 @@ -31490,7 +35345,7 @@ module.exports = CONST; /***/ }), -/* 134 */ +/* 140 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -31499,7 +35354,7 @@ module.exports = CONST; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Creates a new Object using all values from obj1 and obj2. @@ -31535,7 +35390,7 @@ module.exports = Merge; /***/ }), -/* 135 */ +/* 141 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -31546,13 +35401,13 @@ module.exports = Merge; */ var Class = __webpack_require__(0); -var Clone = __webpack_require__(69); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(61); -var GameEvents = __webpack_require__(21); +var Clone = __webpack_require__(76); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(66); +var GameEvents = __webpack_require__(23); var NOOP = __webpack_require__(1); -var GetAll = __webpack_require__(193); -var GetFirst = __webpack_require__(395); +var GetAll = __webpack_require__(198); +var GetFirst = __webpack_require__(405); /** * @classdesc @@ -32249,7 +36104,7 @@ module.exports = BaseSoundManager; /***/ }), -/* 136 */ +/* 142 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32260,9 +36115,9 @@ module.exports = BaseSoundManager; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(61); -var Extend = __webpack_require__(19); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(66); +var Extend = __webpack_require__(18); var NOOP = __webpack_require__(1); /** @@ -32749,7 +36604,7 @@ module.exports = BaseSound; /***/ }), -/* 137 */ +/* 143 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -32758,824 +36613,8 @@ module.exports = BaseSound; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayUtils = __webpack_require__(194); -var Class = __webpack_require__(0); -var NOOP = __webpack_require__(1); -var StableSort = __webpack_require__(139); - -/** - * @callback EachListCallback - * - * @param {I} item - The item which is currently being processed. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - */ - -/** - * @classdesc - * List is a generic implementation of an ordered list which contains utility methods for retrieving, manipulating, and iterating items. - * - * @class List - * @memberof Phaser.Structs - * @constructor - * @since 3.0.0 - * - * @generic T - * - * @param {*} parent - The parent of this list. - */ -var List = new Class({ - - initialize: - - function List (parent) - { - /** - * The parent of this list. - * - * @name Phaser.Structs.List#parent - * @type {*} - * @since 3.0.0 - */ - this.parent = parent; - - /** - * The objects that belong to this collection. - * - * @genericUse {T[]} - [$type] - * - * @name Phaser.Structs.List#list - * @type {Array.<*>} - * @default [] - * @since 3.0.0 - */ - this.list = []; - - /** - * The index of the current element. - * - * This is used internally when iterating through the list with the {@link #first}, {@link #last}, {@link #get}, and {@link #previous} properties. - * - * @name Phaser.Structs.List#position - * @type {integer} - * @default 0 - * @since 3.0.0 - */ - this.position = 0; - - /** - * A callback that is invoked every time a child is added to this list. - * - * @name Phaser.Structs.List#addCallback - * @type {function} - * @since 3.4.0 - */ - this.addCallback = NOOP; - - /** - * A callback that is invoked every time a child is removed from this list. - * - * @name Phaser.Structs.List#removeCallback - * @type {function} - * @since 3.4.0 - */ - this.removeCallback = NOOP; - - /** - * The property key to sort by. - * - * @name Phaser.Structs.List#_sortKey - * @type {string} - * @since 3.4.0 - */ - this._sortKey = ''; - }, - - /** - * Adds the given item to the end of the list. Each item must be unique. - * - * @method Phaser.Structs.List#add - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*|Array.<*>} child - The item, or array of items, to add to the list. - * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. - * - * @return {*} The list's underlying array. - */ - add: function (child, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.Add(this.list, child); - } - else - { - return ArrayUtils.Add(this.list, child, 0, this.addCallback, this); - } - }, - - /** - * Adds an item to list, starting at a specified index. Each item must be unique within the list. - * - * @method Phaser.Structs.List#addAt - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item, or array of items, to add to the list. - * @param {integer} [index=0] - The index in the list at which the element(s) will be inserted. - * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. - * - * @return {*} The List's underlying array. - */ - addAt: function (child, index, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.AddAt(this.list, child, index); - } - else - { - return ArrayUtils.AddAt(this.list, child, index, 0, this.addCallback, this); - } - }, - - /** - * Retrieves the item at a given position inside the List. - * - * @method Phaser.Structs.List#getAt - * @since 3.0.0 - * - * @genericUse {T} - [$return] - * - * @param {integer} index - The index of the item. - * - * @return {*} The retrieved item, or `undefined` if it's outside the List's bounds. - */ - getAt: function (index) - { - return this.list[index]; - }, - - /** - * Locates an item within the List and returns its index. - * - * @method Phaser.Structs.List#getIndex - * @since 3.0.0 - * - * @genericUse {T} - [child] - * - * @param {*} child - The item to locate. - * - * @return {integer} The index of the item within the List, or -1 if it's not in the List. - */ - getIndex: function (child) - { - // Return -1 if given child isn't a child of this display list - return this.list.indexOf(child); - }, - - /** - * Sort the contents of this List so the items are in order based on the given property. - * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. - * - * @method Phaser.Structs.List#sort - * @since 3.0.0 - * - * @genericUse {T[]} - [children,$return] - * - * @param {string} property - The property to lexically sort by. - * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. - * - * @return {Phaser.Structs.List} This List object. - */ - sort: function (property, handler) - { - if (!property) - { - return this; - } - - if (handler === undefined) - { - handler = function (childA, childB) - { - return childA[property] - childB[property]; - }; - } - - StableSort(this.list, handler); - - return this; - }, - - /** - * Searches for the first instance of a child with its `name` - * property matching the given argument. Should more than one child have - * the same name only the first is returned. - * - * @method Phaser.Structs.List#getByName - * @since 3.0.0 - * - * @genericUse {T | null} - [$return] - * - * @param {string} name - The name to search for. - * - * @return {?*} The first child with a matching name, or null if none were found. - */ - getByName: function (name) - { - return ArrayUtils.GetFirst(this.list, 'name', name); - }, - - /** - * Returns a random child from the group. - * - * @method Phaser.Structs.List#getRandom - * @since 3.0.0 - * - * @genericUse {T | null} - [$return] - * - * @param {integer} [startIndex=0] - Offset from the front of the group (lowest child). - * @param {integer} [length=(to top)] - Restriction on the number of values you want to randomly select from. - * - * @return {?*} A random child of this Group. - */ - getRandom: function (startIndex, length) - { - return ArrayUtils.GetRandom(this.list, startIndex, length); - }, - - /** - * Returns the first element in a given part of the List which matches a specific criterion. - * - * @method Phaser.Structs.List#getFirst - * @since 3.0.0 - * - * @genericUse {T | null} - [$return] - * - * @param {string} property - The name of the property to test or a falsey value to have no criterion. - * @param {*} value - The value to test the `property` against, or `undefined` to allow any value and only check for existence. - * @param {number} [startIndex=0] - The position in the List to start the search at. - * @param {number} [endIndex] - The position in the List to optionally stop the search at. It won't be checked. - * - * @return {?*} The first item which matches the given criterion, or `null` if no such item exists. - */ - getFirst: function (property, value, startIndex, endIndex) - { - return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); - }, - - /** - * Returns all children in this List. - * - * You can optionally specify a matching criteria using the `property` and `value` arguments. - * - * For example: `getAll('parent')` would return only children that have a property called `parent`. - * - * You can also specify a value to compare the property to: - * - * `getAll('visible', true)` would return only children that have their visible property set to `true`. - * - * Optionally you can specify a start and end index. For example if this List had 100 children, - * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only - * the first 50 children in the List. - * - * @method Phaser.Structs.List#getAll - * @since 3.0.0 - * - * @genericUse {T} - [value] - * @genericUse {T[]} - [$return] - * - * @param {string} [property] - An optional property to test against the value argument. - * @param {*} [value] - If property is set then Child.property must strictly equal this value to be included in the results. - * @param {integer} [startIndex] - The first child index to start the search from. - * @param {integer} [endIndex] - The last child index to search up until. - * - * @return {Array.<*>} All items of the List which match the given criterion, if any. - */ - getAll: function (property, value, startIndex, endIndex) - { - return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex); - }, - - /** - * Returns the total number of items in the List which have a property matching the given value. - * - * @method Phaser.Structs.List#count - * @since 3.0.0 - * - * @genericUse {T} - [value] - * - * @param {string} property - The property to test on each item. - * @param {*} value - The value to test the property against. - * - * @return {integer} The total number of matching elements. - */ - count: function (property, value) - { - return ArrayUtils.CountAllMatching(this.list, property, value); - }, - - /** - * Swaps the positions of two items in the list. - * - * @method Phaser.Structs.List#swap - * @since 3.0.0 - * - * @genericUse {T} - [child1,child2] - * - * @param {*} child1 - The first item to swap. - * @param {*} child2 - The second item to swap. - */ - swap: function (child1, child2) - { - ArrayUtils.Swap(this.list, child1, child2); - }, - - /** - * Moves an item in the List to a new position. - * - * @method Phaser.Structs.List#moveTo - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to move. - * @param {integer} index - Moves an item in the List to a new position. - * - * @return {*} The item that was moved. - */ - moveTo: function (child, index) - { - return ArrayUtils.MoveTo(this.list, child, index); - }, - - /** - * Removes one or many items from the List. - * - * @method Phaser.Structs.List#remove - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item, or array of items, to remove. - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {*} The item, or array of items, which were successfully removed from the List. - */ - remove: function (child, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.Remove(this.list, child); - } - else - { - return ArrayUtils.Remove(this.list, child, this.removeCallback, this); - } - }, - - /** - * Removes the item at the given position in the List. - * - * @method Phaser.Structs.List#removeAt - * @since 3.0.0 - * - * @genericUse {T} - [$return] - * - * @param {integer} index - The position to remove the item from. - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {*} The item that was removed. - */ - removeAt: function (index, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.RemoveAt(this.list, index); - } - else - { - return ArrayUtils.RemoveAt(this.list, index, this.removeCallback, this); - } - }, - - /** - * Removes the items within the given range in the List. - * - * @method Phaser.Structs.List#removeBetween - * @since 3.0.0 - * - * @genericUse {T[]} - [$return] - * - * @param {integer} [startIndex=0] - The index to start removing from. - * @param {integer} [endIndex] - The position to stop removing at. The item at this position won't be removed. - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {Array.<*>} An array of the items which were removed. - */ - removeBetween: function (startIndex, endIndex, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex); - } - else - { - return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeCallback, this); - } - }, - - /** - * Removes all the items. - * - * @method Phaser.Structs.List#removeAll - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.List.} - [$return] - * - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {Phaser.Structs.List} This List object. - */ - removeAll: function (skipCallback) - { - var i = this.list.length; - - while (i--) - { - this.remove(this.list[i], skipCallback); - } - - return this; - }, - - /** - * Brings the given child to the top of this List. - * - * @method Phaser.Structs.List#bringToTop - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to bring to the top of the List. - * - * @return {*} The item which was moved. - */ - bringToTop: function (child) - { - return ArrayUtils.BringToTop(this.list, child); - }, - - /** - * Sends the given child to the bottom of this List. - * - * @method Phaser.Structs.List#sendToBack - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to send to the back of the list. - * - * @return {*} The item which was moved. - */ - sendToBack: function (child) - { - return ArrayUtils.SendToBack(this.list, child); - }, - - /** - * Moves the given child up one place in this group unless it's already at the top. - * - * @method Phaser.Structs.List#moveUp - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to move up. - * - * @return {*} The item which was moved. - */ - moveUp: function (child) - { - ArrayUtils.MoveUp(this.list, child); - - return child; - }, - - /** - * Moves the given child down one place in this group unless it's already at the bottom. - * - * @method Phaser.Structs.List#moveDown - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to move down. - * - * @return {*} The item which was moved. - */ - moveDown: function (child) - { - ArrayUtils.MoveDown(this.list, child); - - return child; - }, - - /** - * Reverses the order of all children in this List. - * - * @method Phaser.Structs.List#reverse - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.List.} - [$return] - * - * @return {Phaser.Structs.List} This List object. - */ - reverse: function () - { - this.list.reverse(); - - return this; - }, - - /** - * Shuffles the items in the list. - * - * @method Phaser.Structs.List#shuffle - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.List.} - [$return] - * - * @return {Phaser.Structs.List} This List object. - */ - shuffle: function () - { - ArrayUtils.Shuffle(this.list); - - return this; - }, - - /** - * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List. - * - * @method Phaser.Structs.List#replace - * @since 3.0.0 - * - * @genericUse {T} - [oldChild,newChild,$return] - * - * @param {*} oldChild - The child in this List that will be replaced. - * @param {*} newChild - The child to be inserted into this List. - * - * @return {*} Returns the oldChild that was replaced within this group. - */ - replace: function (oldChild, newChild) - { - return ArrayUtils.Replace(this.list, oldChild, newChild); - }, - - /** - * Checks if an item exists within the List. - * - * @method Phaser.Structs.List#exists - * @since 3.0.0 - * - * @genericUse {T} - [child] - * - * @param {*} child - The item to check for the existence of. - * - * @return {boolean} `true` if the item is found in the list, otherwise `false`. - */ - exists: function (child) - { - return (this.list.indexOf(child) > -1); - }, - - /** - * Sets the property `key` to the given value on all members of this List. - * - * @method Phaser.Structs.List#setAll - * @since 3.0.0 - * - * @genericUse {T} - [value] - * - * @param {string} property - The name of the property to set. - * @param {*} value - The value to set the property to. - * @param {integer} [startIndex] - The first child index to start the search from. - * @param {integer} [endIndex] - The last child index to search up until. - */ - setAll: function (property, value, startIndex, endIndex) - { - ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex); - - return this; - }, - - /** - * Passes all children to the given callback. - * - * @method Phaser.Structs.List#each - * @since 3.0.0 - * - * @genericUse {EachListCallback.} - [callback] - * - * @param {EachListCallback} callback - The function to call. - * @param {*} [context] - Value to use as `this` when executing callback. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - */ - each: function (callback, context) - { - var args = [ null ]; - - for (var i = 2; i < arguments.length; i++) - { - args.push(arguments[i]); - } - - for (i = 0; i < this.list.length; i++) - { - args[0] = this.list[i]; - - callback.apply(context, args); - } - }, - - /** - * Clears the List and recreates its internal array. - * - * @method Phaser.Structs.List#shutdown - * @since 3.0.0 - */ - shutdown: function () - { - this.removeAll(); - - this.list = []; - }, - - /** - * Destroys this List. - * - * @method Phaser.Structs.List#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.removeAll(); - - this.parent = null; - this.addCallback = null; - this.removeCallback = null; - }, - - /** - * The number of items inside the List. - * - * @name Phaser.Structs.List#length - * @type {integer} - * @readonly - * @since 3.0.0 - */ - length: { - - get: function () - { - return this.list.length; - } - - }, - - /** - * The first item in the List or `null` for an empty List. - * - * @name Phaser.Structs.List#first - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - first: { - - get: function () - { - this.position = 0; - - if (this.list.length > 0) - { - return this.list[0]; - } - else - { - return null; - } - } - - }, - - /** - * The last item in the List, or `null` for an empty List. - * - * @name Phaser.Structs.List#last - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - last: { - - get: function () - { - if (this.list.length > 0) - { - this.position = this.list.length - 1; - - return this.list[this.position]; - } - else - { - return null; - } - } - - }, - - /** - * The next item in the List, or `null` if the entire List has been traversed. - * - * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List. - * - * @name Phaser.Structs.List#next - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - next: { - - get: function () - { - if (this.position < this.list.length) - { - this.position++; - - return this.list[this.position]; - } - else - { - return null; - } - } - - }, - - /** - * The previous item in the List, or `null` if the entire List has been traversed. - * - * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards. - * - * @name Phaser.Structs.List#previous - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - previous: { - - get: function () - { - if (this.position > 0) - { - this.position--; - - return this.list[this.position]; - } - else - { - return null; - } - } - - } - -}); - -module.exports = List; - - -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CheckMatrix = __webpack_require__(195); -var TransposeMatrix = __webpack_require__(402); +var CheckMatrix = __webpack_require__(200); +var TransposeMatrix = __webpack_require__(412); /** * Rotates the array matrix based on the given rotation value. @@ -33585,6 +36624,20 @@ var TransposeMatrix = __webpack_require__(402); * * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.RotateMatrix * @since 3.0.0 * @@ -33637,183 +36690,7 @@ module.exports = RotateMatrix; /***/ }), -/* 139 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @author Angry Bytes (and contributors) - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The comparator function. - * - * @ignore - * - * @param {*} a - The first item to test. - * @param {*} b - The second itemt to test. - * - * @return {boolean} True if they localCompare, otherwise false. - */ -function Compare (a, b) -{ - return String(a).localeCompare(b); -} - -/** - * Process the array contents. - * - * @ignore - * - * @param {array} array - The array to process. - * @param {function} compare - The comparison function. - * - * @return {array} - The processed array. - */ -function Process (array, compare) -{ - // Short-circuit when there's nothing to sort. - var len = array.length; - - if (len <= 1) - { - return array; - } - - // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc. - // Chunks are the size of the left or right hand in merge sort. - // Stop when the left-hand covers all of the array. - var buffer = new Array(len); - - for (var chk = 1; chk < len; chk *= 2) - { - RunPass(array, compare, chk, buffer); - - var tmp = array; - - array = buffer; - - buffer = tmp; - } - - return array; -} - -/** - * Run a single pass with the given chunk size. - * - * @ignore - * - * @param {array} arr - The array to run the pass on. - * @param {function} comp - The comparison function. - * @param {number} chk - The number of iterations. - * @param {array} result - The array to store the result in. - */ -function RunPass (arr, comp, chk, result) -{ - var len = arr.length; - var i = 0; - - // Step size / double chunk size. - var dbl = chk * 2; - - // Bounds of the left and right chunks. - var l, r, e; - - // Iterators over the left and right chunk. - var li, ri; - - // Iterate over pairs of chunks. - for (l = 0; l < len; l += dbl) - { - r = l + chk; - e = r + chk; - - if (r > len) - { - r = len; - } - - if (e > len) - { - e = len; - } - - // Iterate both chunks in parallel. - li = l; - ri = r; - - while (true) - { - // Compare the chunks. - if (li < r && ri < e) - { - // This works for a regular `sort()` compatible comparator, - // but also for a simple comparator like: `a > b` - if (comp(arr[li], arr[ri]) <= 0) - { - result[i++] = arr[li++]; - } - else - { - result[i++] = arr[ri++]; - } - } - else if (li < r) - { - // Nothing to compare, just flush what's left. - result[i++] = arr[li++]; - } - else if (ri < e) - { - result[i++] = arr[ri++]; - } - else - { - // Both iterators are at the chunk ends. - break; - } - } - } -} - -/** - * An in-place stable array sort, because `Array#sort()` is not guaranteed stable. - * - * This is an implementation of merge sort, without recursion. - * - * Function based on the Two-Screen/stable sort 0.1.8 from https://github.com/Two-Screen/stable - * - * @function Phaser.Utils.Array.StableSort - * @since 3.0.0 - * - * @param {array} array - The input array to be sorted. - * @param {function} [compare] - The comparison function. - * - * @return {array} The sorted result. - */ -var StableSort = function (array, compare) -{ - if (compare === undefined) { compare = Compare; } - - var result = Process(array, compare); - - // This simply copies back if the result isn't in the original array, which happens on an odd number of passes. - if (result !== array) - { - RunPass(result, null, array.length, array); - } - - return array; -}; - -module.exports = StableSort; - - -/***/ }), -/* 140 */ +/* 144 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -33823,15 +36700,14 @@ module.exports = StableSort; */ var Class = __webpack_require__(0); -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var GetColorFromValue = __webpack_require__(119); -var GetBitmapTextSize = __webpack_require__(969); -var ParseFromAtlas = __webpack_require__(970); -var ParseXMLBitmapFont = __webpack_require__(198); +var GetBitmapTextSize = __webpack_require__(1026); +var ParseFromAtlas = __webpack_require__(1027); +var ParseXMLBitmapFont = __webpack_require__(203); var Rectangle = __webpack_require__(9); -var Render = __webpack_require__(971); +var Render = __webpack_require__(1028); /** * @classdesc @@ -33879,7 +36755,7 @@ var Render = __webpack_require__(971); * @param {string} font - The key of the font to use from the Bitmap Font cache. * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. * @param {number} [size] - The font size of this Bitmap Text. - * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. */ var BitmapText = new Class({ @@ -33983,7 +36859,7 @@ var BitmapText = new Class({ * The alignment position is based on the longest line of text. * * @name Phaser.GameObjects.BitmapText#_align - * @type {integer} + * @type {number} * @private * @since 3.11.0 */ @@ -34064,22 +36940,13 @@ var BitmapText = new Class({ /** * The color of the drop shadow. * - * @name Phaser.GameObjects.BitmapText#_dropShadowColor - * @type {number} - * @private - * @since 3.50.0 - */ - this._dropShadowColor = 0x000000; - - /** - * The GL encoded color of the drop shadow. + * You can set this directly, or use `Phaser.GameObjects.BitmapText#setDropShadow`. * - * @name Phaser.GameObjects.BitmapText#_dropShadowColorGL + * @name Phaser.GameObjects.BitmapText#dropShadowColor * @type {number} - * @private * @since 3.50.0 */ - this._dropShadowColorGL = 0x000000; + this.dropShadowColor = 0x000000; /** * The alpha value of the drop shadow. @@ -34304,10 +37171,10 @@ var BitmapText = new Class({ * @param {number} [start=0] - The starting character to begin the tint at. If negative, it counts back from the end of the text. * @param {number} [length=1] - The number of characters to tint. Remember that spaces count as a character too. Pass -1 to tint all characters from `start` onwards. * @param {boolean} [tintFill=false] - Use a fill-based tint (true), or an additive tint (false) - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the character. If not other values are given this value is applied evenly, tinting the whole character. - * @param {integer} [topRight] - The tint being applied to the top-right of the character. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the character. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the character. + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the character. If not other values are given this value is applied evenly, tinting the whole character. + * @param {number} [topRight] - The tint being applied to the top-right of the character. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the character. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the character. * * @return {this} This BitmapText Object. */ @@ -34354,27 +37221,23 @@ var BitmapText = new Class({ else { var tintEffect = (tintFill) ? 1 : 0; - var tintTL = GetColorFromValue(topLeft); - var tintTR = GetColorFromValue(topRight); - var tintBL = GetColorFromValue(bottomLeft); - var tintBR = GetColorFromValue(bottomRight); if (color) { color.tintEffect = tintEffect; - color.tintTL = tintTL; - color.tintTR = tintTR; - color.tintBL = tintBL; - color.tintBR = tintBR; + color.tintTL = topLeft; + color.tintTR = topRight; + color.tintBL = bottomLeft; + color.tintBR = bottomRight; } else { charColors[i] = { tintEffect: tintEffect, - tintTL: tintTL, - tintTR: tintTR, - tintBL: tintBL, - tintBR: tintBR + tintTL: topLeft, + tintTR: topRight, + tintBL: bottomLeft, + tintBR: bottomRight }; } } @@ -34417,10 +37280,10 @@ var BitmapText = new Class({ * @param {(string|number)} word - The word to search for. Either a string, or an index of the word in the words array. * @param {number} [count=1] - The number of matching words to tint. Pass -1 to tint all matching words. * @param {boolean} [tintFill=false] - Use a fill-based tint (true), or an additive tint (false) - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the word. If not other values are given this value is applied evenly, tinting the whole word. - * @param {integer} [topRight] - The tint being applied to the top-right of the word. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the word. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the word. + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the word. If not other values are given this value is applied evenly, tinting the whole word. + * @param {number} [topRight] - The tint being applied to the top-right of the word. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the word. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the word. * * @return {this} This BitmapText Object. */ @@ -34571,7 +37434,7 @@ var BitmapText = new Class({ * * @param {string} font - The key of the font to use from the Bitmap Font cache. * @param {number} [size] - The font size of this Bitmap Text. If not specified the current size will be used. - * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object. If not specified the current alignment will be used. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. If not specified the current alignment will be used. * * @return {this} This BitmapText Object. */ @@ -34649,7 +37512,7 @@ var BitmapText = new Class({ * The alignment position is based on the longest line of text. * * @name Phaser.GameObjects.BitmapText#align - * @type {integer} + * @type {number} * @since 3.11.0 */ align: { @@ -34807,31 +37670,6 @@ var BitmapText = new Class({ }, - /** - * The color of the drop shadow. - * - * You can also set this via `Phaser.GameObjects.BitmapText#setDropShadow`. - * - * @name Phaser.GameObjects.BitmapText#dropShadowColor - * @type {number} - * @since 3.50.0 - */ - dropShadowColor: { - - get: function () - { - return this._dropShadowColor; - }, - - set: function (value) - { - this._dropShadowColor = value; - - this._dropShadowColorGL = GetColorFromValue(value); - } - - }, - /** * Build a JSON representation of this Bitmap Text. * @@ -34879,7 +37717,7 @@ var BitmapText = new Class({ * Left align the text characters in a multi-line BitmapText object. * * @name Phaser.GameObjects.BitmapText.ALIGN_LEFT - * @type {integer} + * @type {number} * @since 3.11.0 */ BitmapText.ALIGN_LEFT = 0; @@ -34888,7 +37726,7 @@ BitmapText.ALIGN_LEFT = 0; * Center align the text characters in a multi-line BitmapText object. * * @name Phaser.GameObjects.BitmapText.ALIGN_CENTER - * @type {integer} + * @type {number} * @since 3.11.0 */ BitmapText.ALIGN_CENTER = 1; @@ -34897,7 +37735,7 @@ BitmapText.ALIGN_CENTER = 1; * Right align the text characters in a multi-line BitmapText object. * * @name Phaser.GameObjects.BitmapText.ALIGN_RIGHT - * @type {integer} + * @type {number} * @since 3.11.0 */ BitmapText.ALIGN_RIGHT = 2; @@ -34915,8 +37753,8 @@ BitmapText.ALIGN_RIGHT = 2; * @param {string} textureKey - The key of the BitmapFont's texture. * @param {string} frameKey - The key of the BitmapFont texture's frame. * @param {string} xmlKey - The key of the XML data of the font to parse. - * @param {integer} [xSpacing] - The x-axis spacing to add between each letter. - * @param {integer} [ySpacing] - The y-axis spacing to add to the line height. + * @param {number} [xSpacing] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing] - The y-axis spacing to add to the line height. * * @return {boolean} Whether the parsing was successful or not. */ @@ -34930,8 +37768,8 @@ BitmapText.ParseFromAtlas = ParseFromAtlas; * * @param {XMLDocument} xml - The XML Document to parse the font from. * @param {Phaser.Textures.Frame} frame - The texture frame to take into account when creating the uv data. - * @param {integer} [xSpacing=0] - The x-axis spacing to add between each letter. - * @param {integer} [ySpacing=0] - The y-axis spacing to add to the line height. + * @param {number} [xSpacing=0] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing=0] - The y-axis spacing to add to the line height. * * @return {Phaser.Types.GameObjects.BitmapText.BitmapFontData} The parsed Bitmap Font data. */ @@ -34941,7 +37779,7 @@ module.exports = BitmapText; /***/ }), -/* 141 */ +/* 145 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35360,7 +38198,7 @@ var Set = new Class({ * Increasing the size larger than the current size has no effect. * * @name Phaser.Structs.Set#size - * @type {integer} + * @type {number} * @since 3.0.0 */ size: { @@ -35390,216 +38228,7 @@ module.exports = Set; /***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(14); -var MeshRender = __webpack_require__(1097); -var NOOP = __webpack_require__(1); - -/** - * @classdesc - * A Mesh Game Object. - * - * @class Mesh - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @webglOnly - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * @extends Phaser.GameObjects.Components.ScrollFactor - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number[]} vertices - An array containing the vertices data for this Mesh. - * @param {number[]} uv - An array containing the uv data for this Mesh. - * @param {number[]} colors - An array containing the color data for this Mesh. - * @param {number[]} alphas - An array containing the alpha data for this Mesh. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - */ -var Mesh = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.BlendMode, - Components.Depth, - Components.Mask, - Components.Pipeline, - Components.Size, - Components.Texture, - Components.Transform, - Components.Visible, - Components.ScrollFactor, - MeshRender - ], - - initialize: - - function Mesh (scene, x, y, vertices, uv, colors, alphas, texture, frame) - { - GameObject.call(this, scene, 'Mesh'); - - if (vertices.length !== uv.length) - { - throw new Error('Mesh Vertex count must match UV count'); - } - - var verticesUB = (vertices.length / 2) | 0; - - if (colors.length > 0 && colors.length < verticesUB) - { - throw new Error('Mesh Color count must match Vertex count'); - } - - if (alphas.length > 0 && alphas.length < verticesUB) - { - throw new Error('Mesh Alpha count must match Vertex count'); - } - - var i; - - if (colors.length === 0) - { - for (i = 0; i < verticesUB; ++i) - { - colors[i] = 0xFFFFFF; - } - } - - if (alphas.length === 0) - { - for (i = 0; i < verticesUB; ++i) - { - alphas[i] = 1.0; - } - } - - /** - * An array containing the vertices data for this Mesh. - * - * @name Phaser.GameObjects.Mesh#vertices - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertices = new Float32Array(vertices); - - /** - * An array containing the uv data for this Mesh. - * - * @name Phaser.GameObjects.Mesh#uv - * @type {Float32Array} - * @since 3.0.0 - */ - this.uv = new Float32Array(uv); - - /** - * An array containing the color data for this Mesh. - * - * @name Phaser.GameObjects.Mesh#colors - * @type {Uint32Array} - * @since 3.0.0 - */ - this.colors = new Uint32Array(colors); - - /** - * An array containing the alpha data for this Mesh. - * - * @name Phaser.GameObjects.Mesh#alphas - * @type {Float32Array} - * @since 3.0.0 - */ - this.alphas = new Float32Array(alphas); - - /** - * Fill or additive mode used when blending the color values? - * - * @name Phaser.GameObjects.Mesh#tintFill - * @type {boolean} - * @default false - * @since 3.11.0 - */ - this.tintFill = false; - - this.setTexture(texture, frame); - this.setPosition(x, y); - this.setSizeToFrame(); - this.initPipeline(); - }, - - /** - * This method is left intentionally empty and does not do anything. - * It is retained to allow a Mesh or Quad to be added to a Container. - * - * @method Phaser.GameObjects.Mesh#setAlpha - * @since 3.17.0 - */ - setAlpha: NOOP - -}); - -module.exports = Mesh; - - -/***/ }), -/* 143 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Checks if two Rectangles intersect. - * - * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. - * As such, the two Rectangles are considered "solid". - * A Rectangle with no width or no height will never intersect another Rectangle. - * - * @function Phaser.Geom.Intersects.RectangleToRectangle - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. - * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. - * - * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`. - */ -var RectangleToRectangle = function (rectA, rectB) -{ - if (rectA.width <= 0 || rectA.height <= 0 || rectB.width <= 0 || rectB.height <= 0) - { - return false; - } - - return !(rectA.right < rectB.x || rectA.bottom < rectB.y || rectA.x > rectB.right || rectA.y > rectB.bottom); -}; - -module.exports = RectangleToRectangle; - - -/***/ }), -/* 144 */ +/* 146 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35707,7 +38336,7 @@ module.exports = InputPluginCache; /***/ }), -/* 145 */ +/* 147 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35722,19 +38351,19 @@ module.exports = InputPluginCache; module.exports = { - ANY_KEY_DOWN: __webpack_require__(1239), - ANY_KEY_UP: __webpack_require__(1240), - COMBO_MATCH: __webpack_require__(1241), - DOWN: __webpack_require__(1242), - KEY_DOWN: __webpack_require__(1243), - KEY_UP: __webpack_require__(1244), - UP: __webpack_require__(1245) + ANY_KEY_DOWN: __webpack_require__(1303), + ANY_KEY_UP: __webpack_require__(1304), + COMBO_MATCH: __webpack_require__(1305), + DOWN: __webpack_require__(1306), + KEY_DOWN: __webpack_require__(1307), + KEY_UP: __webpack_require__(1308), + UP: __webpack_require__(1309) }; /***/ }), -/* 146 */ +/* 148 */ /***/ (function(module, exports) { /** @@ -35775,7 +38404,7 @@ module.exports = GetURL; /***/ }), -/* 147 */ +/* 149 */ /***/ (function(module, exports) { /** @@ -35794,7 +38423,7 @@ module.exports = GetURL; * @param {boolean} [async=true] - Should the XHR request use async or not? * @param {string} [user=''] - Optional username for the XHR request. * @param {string} [password=''] - Optional password for the XHR request. - * @param {integer} [timeout=0] - Optional XHR timeout value. + * @param {number} [timeout=0] - Optional XHR timeout value. * @param {boolean} [withCredentials=false] - Optional XHR withCredentials value. * * @return {Phaser.Types.Loader.XHRSettingsObject} The XHRSettings object as used by the Loader. @@ -35845,7 +38474,7 @@ module.exports = XHRSettings; /***/ }), -/* 148 */ +/* 150 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35855,8 +38484,8 @@ module.exports = XHRSettings; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(228); -var Sprite = __webpack_require__(76); +var Components = __webpack_require__(235); +var Sprite = __webpack_require__(70); /** * @classdesc @@ -35882,6 +38511,7 @@ var Sprite = __webpack_require__(76); * @extends Phaser.Physics.Arcade.Components.Gravity * @extends Phaser.Physics.Arcade.Components.Immovable * @extends Phaser.Physics.Arcade.Components.Mass + * @extends Phaser.Physics.Arcade.Components.Pushable * @extends Phaser.Physics.Arcade.Components.Size * @extends Phaser.Physics.Arcade.Components.Velocity * @extends Phaser.GameObjects.Components.Alpha @@ -35902,7 +38532,7 @@ var Sprite = __webpack_require__(76); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ var ArcadeSprite = new Class({ @@ -35919,6 +38549,7 @@ var ArcadeSprite = new Class({ Components.Gravity, Components.Immovable, Components.Mass, + Components.Pushable, Components.Size, Components.Velocity ], @@ -35946,7 +38577,7 @@ module.exports = ArcadeSprite; /***/ }), -/* 149 */ +/* 151 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -35955,71 +38586,7 @@ module.exports = ArcadeSprite; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Tilemaps.Components - */ - -module.exports = { - - CalculateFacesAt: __webpack_require__(235), - CalculateFacesWithin: __webpack_require__(53), - Copy: __webpack_require__(1326), - CreateFromTiles: __webpack_require__(1327), - CullTiles: __webpack_require__(1328), - Fill: __webpack_require__(1329), - FilterTiles: __webpack_require__(1330), - FindByIndex: __webpack_require__(1331), - FindTile: __webpack_require__(1332), - ForEachTile: __webpack_require__(1333), - GetTileAt: __webpack_require__(150), - GetTileAtWorldXY: __webpack_require__(1334), - GetTilesWithin: __webpack_require__(24), - GetTilesWithinShape: __webpack_require__(1335), - GetTilesWithinWorldXY: __webpack_require__(1336), - HasTileAt: __webpack_require__(504), - HasTileAtWorldXY: __webpack_require__(1337), - IsInLayerBounds: __webpack_require__(104), - PutTileAt: __webpack_require__(236), - PutTileAtWorldXY: __webpack_require__(1338), - PutTilesAt: __webpack_require__(1339), - Randomize: __webpack_require__(1340), - RemoveTileAt: __webpack_require__(505), - RemoveTileAtWorldXY: __webpack_require__(1341), - RenderDebug: __webpack_require__(1342), - ReplaceByIndex: __webpack_require__(503), - SetCollision: __webpack_require__(1343), - SetCollisionBetween: __webpack_require__(1344), - SetCollisionByExclusion: __webpack_require__(1345), - SetCollisionByProperty: __webpack_require__(1346), - SetCollisionFromCollisionGroup: __webpack_require__(1347), - SetLayerCollisionIndex: __webpack_require__(153), - SetTileCollision: __webpack_require__(65), - SetTileIndexCallback: __webpack_require__(1348), - SetTileLocationCallback: __webpack_require__(1349), - Shuffle: __webpack_require__(1350), - SwapByIndex: __webpack_require__(1351), - TileToWorldX: __webpack_require__(151), - TileToWorldXY: __webpack_require__(1352), - TileToWorldY: __webpack_require__(152), - WeightedRandomize: __webpack_require__(1353), - WorldToTileX: __webpack_require__(66), - WorldToTileXY: __webpack_require__(1354), - WorldToTileY: __webpack_require__(67) - -}; - - -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var IsInLayerBounds = __webpack_require__(104); +var IsInLayerBounds = __webpack_require__(116); /** * Gets a tile at the given tile coordinates from the given layer. @@ -36027,13 +38594,12 @@ var IsInLayerBounds = __webpack_require__(104); * @function Phaser.Tilemaps.Components.GetTileAt * @since 3.0.0 * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {boolean} nonNull - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates - * were invalid. + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. */ var GetTileAt = function (tileX, tileY, nonNull, layer) { @@ -36042,7 +38608,8 @@ var GetTileAt = function (tileX, tileY, nonNull, layer) if (IsInLayerBounds(tileX, tileY, layer)) { var tile = layer.data[tileY][tileX] || null; - if (tile === null) + + if (!tile) { return null; } @@ -36064,50 +38631,6 @@ var GetTileAt = function (tileX, tileY, nonNull, layer) module.exports = GetTileAt; -/***/ }), -/* 151 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the - * layer's position, scale and scroll. - * - * @function Phaser.Tilemaps.Components.TileToWorldX - * @since 3.0.0 - * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} - */ -var TileToWorldX = function (tileX, camera, layer) -{ - var tileWidth = layer.baseTileWidth; - var tilemapLayer = layer.tilemapLayer; - var layerWorldX = 0; - - if (tilemapLayer) - { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - - layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); - - tileWidth *= tilemapLayer.scaleX; - } - - return layerWorldX + tileX * tileWidth; -}; - -module.exports = TileToWorldX; - - /***/ }), /* 152 */ /***/ (function(module, exports) { @@ -36119,37 +38642,119 @@ module.exports = TileToWorldX; */ /** - * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layer's position, scale and scroll. + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. * - * @function Phaser.Tilemaps.Components.TileToWorldY - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.RunCull + * @since 3.50.0 * - * @param {integer} tileY - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {object} bounds - An object containing the `left`, `right`, `top` and `bottom` bounds. + * @param {number} renderOrder - The rendering order constant. + * @param {array} outputArray - The array to store the Tile objects within. * - * @return {number} + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ -var TileToWorldY = function (tileY, camera, layer) +var RunCull = function (layer, bounds, renderOrder, outputArray) { - var tileHeight = layer.baseTileHeight; + var mapData = layer.data; + var mapWidth = layer.width; + var mapHeight = layer.height; + var tilemapLayer = layer.tilemapLayer; - var layerWorldY = 0; - if (tilemapLayer) + var drawLeft = Math.max(0, bounds.left); + var drawRight = Math.min(mapWidth, bounds.right); + var drawTop = Math.max(0, bounds.top); + var drawBottom = Math.min(mapHeight, bounds.bottom); + + var x; + var y; + var tile; + + if (renderOrder === 0) { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } + // right-down - layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + tile = mapData[y][x]; - tileHeight *= tilemapLayer.scaleY; + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + else if (renderOrder === 1) + { + // left-down + + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + else if (renderOrder === 2) + { + // right-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + else if (renderOrder === 3) + { + // left-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } } - return layerWorldY + tileY * tileHeight; + tilemapLayer.tilesDrawn = outputArray.length; + tilemapLayer.tilesTotal = mapWidth * mapHeight; + + return outputArray; }; -module.exports = TileToWorldY; +module.exports = RunCull; /***/ }), @@ -36169,8 +38774,8 @@ module.exports = TileToWorldY; * @function Phaser.Tilemaps.Components.SetLayerCollisionIndex * @since 3.0.0 * - * @param {integer} tileIndex - The tile index to set the collision boolean for. - * @param {boolean} [collides=true] - Should the tile index collide or not? + * @param {number} tileIndex - The tile index to set the collision boolean for. + * @param {boolean} collides - Should the tile index collide or not? * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SetLayerCollisionIndex = function (tileIndex, collides, layer) @@ -36325,17 +38930,17 @@ module.exports = GetNewValue; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Defaults = __webpack_require__(243); +var Defaults = __webpack_require__(256); var GetAdvancedValue = __webpack_require__(15); -var GetBoolean = __webpack_require__(90); -var GetEaseFunction = __webpack_require__(71); +var GetBoolean = __webpack_require__(95); +var GetEaseFunction = __webpack_require__(78); var GetNewValue = __webpack_require__(155); -var GetProps = __webpack_require__(526); -var GetTargets = __webpack_require__(241); +var GetProps = __webpack_require__(562); +var GetTargets = __webpack_require__(254); var GetValue = __webpack_require__(6); -var GetValueOp = __webpack_require__(242); -var Tween = __webpack_require__(244); -var TweenData = __webpack_require__(246); +var GetValueOp = __webpack_require__(255); +var Tween = __webpack_require__(257); +var TweenData = __webpack_require__(259); /** * Creates a new Tween. @@ -36459,10 +39064,10 @@ module.exports = TweenBuilder; */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(92); +var CustomMap = __webpack_require__(98); var GetFastValue = __webpack_require__(2); -var Events = __webpack_require__(122); -var Animation = __webpack_require__(172); +var Events = __webpack_require__(128); +var Animation = __webpack_require__(177); /** * @classdesc @@ -36892,7 +39497,7 @@ var AnimationState = new Class({ * 3 = Waiting for specific frame * * @name Phaser.Animations.AnimationState#_pendingStop - * @type {integer} + * @type {number} * @private * @since 3.4.0 */ @@ -37134,7 +39739,7 @@ var AnimationState = new Class({ * @since 3.50.0 * * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {integer} delay - The delay, in milliseconds, to wait before starting the animation playing. + * @param {number} delay - The delay, in milliseconds, to wait before starting the animation playing. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -37180,7 +39785,7 @@ var AnimationState = new Class({ * @since 3.50.0 * * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {integer} [repeatCount=1] - How many times should the animation repeat before the next one starts? + * @param {number} [repeatCount=1] - How many times should the animation repeat before the next one starts? * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -37629,7 +40234,7 @@ var AnimationState = new Class({ * @method Phaser.Animations.AnimationState#setRepeat * @since 3.4.0 * - * @param {integer} value - The number of times that the animation should repeat. + * @param {number} value - The number of times that the animation should repeat. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -37805,7 +40410,7 @@ var AnimationState = new Class({ * @fires Phaser.Animations.Events#ANIMATION_STOP * @since 3.4.0 * - * @param {integer} delay - The number of milliseconds to wait before stopping this animation. + * @param {number} delay - The number of milliseconds to wait before stopping this animation. * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -37833,7 +40438,7 @@ var AnimationState = new Class({ * @fires Phaser.Animations.Events#ANIMATION_STOP * @since 3.50.0 * - * @param {integer} [repeatCount=1] - How many times should the animation repeat before stopping? + * @param {number} [repeatCount=1] - How many times should the animation repeat before stopping? * * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ @@ -37886,7 +40491,7 @@ var AnimationState = new Class({ * @method Phaser.Animations.AnimationState#getTotalFrames * @since 3.4.0 * - * @return {integer} The total number of frames in the current animation, or zero if no animation has been loaded. + * @return {number} The total number of frames in the current animation, or zero if no animation has been loaded. */ getTotalFrames: function () { @@ -38083,11 +40688,11 @@ var AnimationState = new Class({ * * @param {string} key - The key of the Animation to retrieve. * - * @return {Phaser.Animations.Animation} The Animation, or `undefined` if the key is invalid. + * @return {Phaser.Animations.Animation} The Animation, or `null` if the key is invalid. */ get: function (key) { - return (this.anims && this.anims.get(key)); + return (this.anims) ? this.anims.get(key) : null; }, /** @@ -38098,11 +40703,11 @@ var AnimationState = new Class({ * * @param {string} key - The key of the Animation to check. * - * @return {boolean} `true` if the Animation exists locally, or `false` if the key is available. + * @return {boolean} `true` if the Animation exists locally, or `false` if the key is available, or there are no local animations. */ exists: function (key) { - return (this.anims && this.anims.has(key)); + return (this.anims) ? this.anims.has(key) : false; }, /** @@ -38155,6 +40760,99 @@ var AnimationState = new Class({ return anim; }, + /** + * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. + * + * Generates objects with string based frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNames}. + * + * It's a helper method, designed to make it easier for you to extract all of the frame names from texture atlases. + * If you're working with a sprite sheet, see the `generateFrameNumbers` method instead. + * + * Example: + * + * If you have a texture atlases loaded called `gems` and it contains 6 frames called `ruby_0001`, `ruby_0002`, and so on, + * then you can call this method using: `this.anims.generateFrameNames('gems', { prefix: 'ruby_', end: 6, zeroPad: 4 })`. + * + * The `end` value tells it to look for 6 frames, incrementally numbered, all starting with the prefix `ruby_`. The `zeroPad` + * value tells it how many zeroes pad out the numbers. To create an animation using this method, you can do: + * + * ```javascript + * this.anims.create({ + * key: 'ruby', + * repeat: -1, + * frames: this.anims.generateFrameNames('gems', { + * prefix: 'ruby_', + * end: 6, + * zeroPad: 4 + * }) + * }); + * ``` + * + * Please see the animation examples for further details. + * + * @method Phaser.Animations.AnimationState#generateFrameNames + * @since 3.50.0 + * + * @param {string} key - The key for the texture containing the animation frames. + * @param {Phaser.Types.Animations.GenerateFrameNames} [config] - The configuration object for the animation frame names. + * + * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. + */ + generateFrameNames: function (key, config) + { + return this.animationManager.generateFrameNames(key, config); + }, + + /** + * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. + * + * Generates objects with numbered frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNumbers}. + * + * If you're working with a texture atlas, see the `generateFrameNames` method instead. + * + * It's a helper method, designed to make it easier for you to extract frames from sprite sheets. + * If you're working with a texture atlas, see the `generateFrameNames` method instead. + * + * Example: + * + * If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using: + * `this.anims.generateFrameNumbers('explosion', { start: 0, end: 12 })`. + * + * The `end` value tells it to stop after 12 frames. To create an animation using this method, you can do: + * + * ```javascript + * this.anims.create({ + * key: 'boom', + * frames: this.anims.generateFrameNames('explosion', { + * start: 0, + * end: 12 + * }) + * }); + * ``` + * + * Note that `start` is optional and you don't need to include it if the animation starts from frame 0. + * + * To specify an animation in reverse, swap the `start` and `end` values. + * + * If the frames are not sequential, you may pass an array of frame numbers instead, for example: + * + * `this.anims.generateFrameNumbers('explosion', { frames: [ 0, 1, 2, 1, 2, 3, 4, 0, 1, 2 ] })` + * + * Please see the animation examples and `GenerateFrameNumbers` config docs for further details. + * + * @method Phaser.Animations.AnimationState#generateFrameNumbers + * @since 3.50.0 + * + * @param {string} key - The key for the texture containing the animation frames. + * @param {Phaser.Types.Animations.GenerateFrameNumbers} config - The configuration object for the animation frames. + * + * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. + */ + generateFrameNumbers: function (key, config) + { + return this.animationManager.generateFrameNumbers(key, config); + }, + /** * Removes a locally created Animation from this Sprite, based on the given key. * @@ -38236,6 +40934,568 @@ module.exports = AnimationState; /* 158 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var GetFastValue = __webpack_require__(2); +var ShaderSourceFS = __webpack_require__(860); +var ShaderSourceVS = __webpack_require__(861); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); + +/** + * @classdesc + * + * The Multi Pipeline is the core 2D texture rendering pipeline used by Phaser in WebGL. + * Virtually all Game Objects use this pipeline by default, including Sprites, Graphics + * and Tilemaps. It handles the batching of quads and tris, as well as methods for + * drawing and batching geometry data. + * + * Prior to Phaser v3.50 this pipeline was called the `TextureTintPipeline`. + * + * In previous versions of Phaser only one single texture unit was supported at any one time. + * The Multi Pipeline is an evolution of the old Texture Tint Pipeline, updated to support + * multi-textures for increased performance. + * + * The fragment shader it uses can be found in `shaders/src/Multi.frag`. + * The vertex shader it uses can be found in `shaders/src/Multi.vert`. + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * `inTexId` (float, offset 16) + * `inTintEffect` (float, offset 20) + * `inTint` (vec4, offset 24, normalized) + * + * The default shader uniforms for this pipeline are: + * + * `uProjectionMatrix` (mat4) + * `uMainSampler` (sampler2D array) + * + * If you wish to create a custom pipeline extending from this one, you can use two string + * declarations in your fragment shader source: `%count%` and `%forloop%`, where `count` is + * used to set the number of `sampler2Ds` available, and `forloop` is a block of GLSL code + * that will get the currently bound texture unit. + * + * This pipeline will automatically inject that code for you, should those values exist + * in your shader source. If you wish to handle this yourself, you can also use the + * function `Utils.parseFragmentShaderMaxTextures`. + * + * If you wish to create a pipeline that works from a single texture, or that doesn't have + * internal texture iteration, please see the `SinglePipeline` instead. + * + * @class MultiPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + */ +var MultiPipeline = new Class({ + + Extends: WebGLPipeline, + + initialize: + + function MultiPipeline (config) + { + var renderer = config.game.renderer; + + var fragmentShaderSource = GetFastValue(config, 'fragShader', ShaderSourceFS); + + config.fragShader = Utils.parseFragmentShaderMaxTextures(fragmentShaderSource, renderer.maxTextures); + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTexCoord', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTexId', + size: 1, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTintEffect', + size: 1, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTint', + size: 4, + type: WEBGL_CONST.UNSIGNED_BYTE, + normalized: true + } + ]); + config.uniforms = GetFastValue(config, 'uniforms', [ + 'uProjectionMatrix', + 'uMainSampler' + ]); + + WebGLPipeline.call(this, config); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix1 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this._tempMatrix1 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix2 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this._tempMatrix2 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix3 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this._tempMatrix3 = new TransformMatrix(); + }, + + /** + * Called every time the pipeline is bound by the renderer. + * Sets the shader program, vertex buffer and other resources. + * Should only be called when changing pipeline. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#bind + * @since 3.50.0 + * + * @return {this} This WebGLPipeline instance. + */ + boot: function () + { + WebGLPipeline.prototype.boot.call(this); + + this.currentShader.set1iv('uMainSampler', this.renderer.textureIndexes); + }, + + /** + * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchSprite + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} gameObject - The texture based Game Object to add to the batch. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. + */ + batchSprite: function (gameObject, camera, parentTransformMatrix) + { + this.manager.set(this, gameObject); + + var camMatrix = this._tempMatrix1; + var spriteMatrix = this._tempMatrix2; + var calcMatrix = this._tempMatrix3; + + var frame = gameObject.frame; + var texture = frame.glTexture; + + var u0 = frame.u0; + var v0 = frame.v0; + var u1 = frame.u1; + var v1 = frame.v1; + var frameX = frame.x; + var frameY = frame.y; + var frameWidth = frame.cutWidth; + var frameHeight = frame.cutHeight; + var customPivot = frame.customPivot; + + var displayOriginX = gameObject.displayOriginX; + var displayOriginY = gameObject.displayOriginY; + + var x = -displayOriginX + frameX; + var y = -displayOriginY + frameY; + + if (gameObject.isCropped) + { + var crop = gameObject._crop; + + if (crop.flipX !== gameObject.flipX || crop.flipY !== gameObject.flipY) + { + frame.updateCropUVs(crop, gameObject.flipX, gameObject.flipY); + } + + u0 = crop.u0; + v0 = crop.v0; + u1 = crop.u1; + v1 = crop.v1; + + frameWidth = crop.width; + frameHeight = crop.height; + + frameX = crop.x; + frameY = crop.y; + + x = -displayOriginX + frameX; + y = -displayOriginY + frameY; + } + + var flipX = 1; + var flipY = 1; + + if (gameObject.flipX) + { + if (!customPivot) + { + x += (-frame.realWidth + (displayOriginX * 2)); + } + + flipX = -1; + } + + // Auto-invert the flipY if this is coming from a GLTexture + + if (gameObject.flipY || (frame.source.isGLTexture && !texture.flipY)) + { + if (!customPivot) + { + y += (-frame.realHeight + (displayOriginY * 2)); + } + + flipY = -1; + } + + spriteMatrix.applyITRS(gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX * flipX, gameObject.scaleY * flipY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * gameObject.scrollFactorX, -camera.scrollY * gameObject.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = gameObject.x; + spriteMatrix.f = gameObject.y; + } + else + { + spriteMatrix.e -= camera.scrollX * gameObject.scrollFactorX; + spriteMatrix.f -= camera.scrollY * gameObject.scrollFactorY; + } + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + + var xw = x + frameWidth; + var yh = y + frameHeight; + + var roundPixels = camera.roundPixels; + + var tx0 = calcMatrix.getXRound(x, y, roundPixels); + var ty0 = calcMatrix.getYRound(x, y, roundPixels); + + var tx1 = calcMatrix.getXRound(x, yh, roundPixels); + var ty1 = calcMatrix.getYRound(x, yh, roundPixels); + + var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); + var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); + + var tx3 = calcMatrix.getXRound(xw, y, roundPixels); + var ty3 = calcMatrix.getYRound(xw, y, roundPixels); + + var getTint = Utils.getTintAppendFloatAlpha; + var cameraAlpha = camera.alpha; + + var tintTL = getTint(gameObject.tintTopLeft, cameraAlpha * gameObject._alphaTL); + var tintTR = getTint(gameObject.tintTopRight, cameraAlpha * gameObject._alphaTR); + var tintBL = getTint(gameObject.tintBottomLeft, cameraAlpha * gameObject._alphaBL); + var tintBR = getTint(gameObject.tintBottomRight, cameraAlpha * gameObject._alphaBR); + + if (this.shouldFlush(6)) + { + this.flush(); + } + + var unit = this.setGameObject(gameObject, frame); + + this.manager.preBatch(gameObject); + + this.batchQuad(gameObject, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, gameObject.tintEffect, texture, unit); + + this.manager.postBatch(gameObject); + }, + + /** + * Generic function for batching a textured quad using argument values instead of a Game Object. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTexture + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject. + * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad. + * @param {number} textureWidth - Real texture width. + * @param {number} textureHeight - Real texture height. + * @param {number} srcX - X coordinate of the quad. + * @param {number} srcY - Y coordinate of the quad. + * @param {number} srcWidth - Width of the quad. + * @param {number} srcHeight - Height of the quad. + * @param {number} scaleX - X component of scale. + * @param {number} scaleY - Y component of scale. + * @param {number} rotation - Rotation of the quad. + * @param {boolean} flipX - Indicates if the quad is horizontally flipped. + * @param {boolean} flipY - Indicates if the quad is vertically flipped. + * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll. + * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll. + * @param {number} displayOriginX - Horizontal origin in pixels. + * @param {number} displayOriginY - Vertical origin in pixels. + * @param {number} frameX - X coordinate of the texture frame. + * @param {number} frameY - Y coordinate of the texture frame. + * @param {number} frameWidth - Width of the texture frame. + * @param {number} frameHeight - Height of the texture frame. + * @param {number} tintTL - Tint for top left. + * @param {number} tintTR - Tint for top right. + * @param {number} tintBL - Tint for bottom left. + * @param {number} tintBR - Tint for bottom right. + * @param {number} tintEffect - The tint effect. + * @param {number} uOffset - Horizontal offset on texture coordinate. + * @param {number} vOffset - Vertical offset on texture coordinate. + * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container. + * @param {boolean} [skipFlip=false] - Skip the renderTexture check. + * @param {number} [textureUnit] - Use the currently bound texture unit? + */ + batchTexture: function ( + gameObject, + texture, + textureWidth, textureHeight, + srcX, srcY, + srcWidth, srcHeight, + scaleX, scaleY, + rotation, + flipX, flipY, + scrollFactorX, scrollFactorY, + displayOriginX, displayOriginY, + frameX, frameY, frameWidth, frameHeight, + tintTL, tintTR, tintBL, tintBR, tintEffect, + uOffset, vOffset, + camera, + parentTransformMatrix, + skipFlip, + textureUnit) + { + this.manager.set(this, gameObject); + + var camMatrix = this._tempMatrix1; + var spriteMatrix = this._tempMatrix2; + var calcMatrix = this._tempMatrix3; + + var u0 = (frameX / textureWidth) + uOffset; + var v0 = (frameY / textureHeight) + vOffset; + var u1 = (frameX + frameWidth) / textureWidth + uOffset; + var v1 = (frameY + frameHeight) / textureHeight + vOffset; + + var width = srcWidth; + var height = srcHeight; + + var x = -displayOriginX; + var y = -displayOriginY; + + if (gameObject.isCropped) + { + var crop = gameObject._crop; + + var cropWidth = crop.width; + var cropHeight = crop.height; + + width = cropWidth; + height = cropHeight; + + srcWidth = cropWidth; + srcHeight = cropHeight; + + frameX = crop.x; + frameY = crop.y; + + var ox = frameX; + var oy = frameY; + + if (flipX) + { + ox = (frameWidth - crop.x - cropWidth); + } + + if (flipY) + { + oy = (frameHeight - crop.y - cropHeight); + } + + u0 = (ox / textureWidth) + uOffset; + v0 = (oy / textureHeight) + vOffset; + u1 = (ox + cropWidth) / textureWidth + uOffset; + v1 = (oy + cropHeight) / textureHeight + vOffset; + + x = -displayOriginX + frameX; + y = -displayOriginY + frameY; + } + + // Invert the flipY if this is a RenderTexture + flipY = flipY ^ (!skipFlip && texture.isRenderTexture ? 1 : 0); + + if (flipX) + { + width *= -1; + x += srcWidth; + } + + if (flipY) + { + height *= -1; + y += srcHeight; + } + + var xw = x + width; + var yh = y + height; + + spriteMatrix.applyITRS(srcX, srcY, rotation, scaleX, scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = srcX; + spriteMatrix.f = srcY; + } + else + { + spriteMatrix.e -= camera.scrollX * scrollFactorX; + spriteMatrix.f -= camera.scrollY * scrollFactorY; + } + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + + var roundPixels = camera.roundPixels; + + var tx0 = calcMatrix.getXRound(x, y, roundPixels); + var ty0 = calcMatrix.getYRound(x, y, roundPixels); + + var tx1 = calcMatrix.getXRound(x, yh, roundPixels); + var ty1 = calcMatrix.getYRound(x, yh, roundPixels); + + var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); + var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); + + var tx3 = calcMatrix.getXRound(xw, y, roundPixels); + var ty3 = calcMatrix.getYRound(xw, y, roundPixels); + + if (textureUnit === undefined) + { + textureUnit = this.renderer.setTexture2D(texture); + } + + if (gameObject) + { + this.manager.preBatch(gameObject); + } + + this.batchQuad(gameObject, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); + + if (gameObject) + { + this.manager.postBatch(gameObject); + } + }, + + /** + * Adds a Texture Frame into the batch for rendering. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTextureFrame + * @since 3.12.0 + * + * @param {Phaser.Textures.Frame} frame - The Texture Frame to be rendered. + * @param {number} x - The horizontal position to render the texture at. + * @param {number} y - The vertical position to render the texture at. + * @param {number} tint - The tint color. + * @param {number} alpha - The alpha value. + * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - The Transform Matrix to use for the texture. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - A parent Transform Matrix. + */ + batchTextureFrame: function ( + frame, + x, y, + tint, alpha, + transformMatrix, + parentTransformMatrix + ) + { + this.manager.set(this); + + var spriteMatrix = this._tempMatrix1.copyFrom(transformMatrix); + var calcMatrix = this._tempMatrix2; + + var xw = x + frame.width; + var yh = y + frame.height; + + if (parentTransformMatrix) + { + spriteMatrix.multiply(parentTransformMatrix, calcMatrix); + } + else + { + calcMatrix = spriteMatrix; + } + + var tx0 = calcMatrix.getX(x, y); + var ty0 = calcMatrix.getY(x, y); + + var tx1 = calcMatrix.getX(x, yh); + var ty1 = calcMatrix.getY(x, yh); + + var tx2 = calcMatrix.getX(xw, yh); + var ty2 = calcMatrix.getY(xw, yh); + + var tx3 = calcMatrix.getX(xw, y); + var ty3 = calcMatrix.getY(xw, y); + + var unit = this.renderer.setTextureSource(frame.source); + + tint = Utils.getTintAppendFloatAlpha(tint, alpha); + + this.batchQuad(null, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0, frame.glTexture, unit); + } + +}); + +module.exports = MultiPipeline; + + +/***/ }), +/* 159 */ +/***/ (function(module, exports, __webpack_require__) { + /** * The `Matter.Composite` module contains methods for creating and manipulating composite bodies. * A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. @@ -38251,10 +41511,10 @@ var Composite = {}; module.exports = Composite; -var Events = __webpack_require__(251); -var Common = __webpack_require__(44); -var Bounds = __webpack_require__(103); -var Body = __webpack_require__(64); +var Events = __webpack_require__(266); +var Common = __webpack_require__(50); +var Bounds = __webpack_require__(115); +var Body = __webpack_require__(68); (function() { @@ -38927,7 +42187,7 @@ var Body = __webpack_require__(64); /***/ }), -/* 159 */ +/* 160 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -38966,7 +42226,7 @@ module.exports = CircumferencePoint; /***/ }), -/* 160 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39010,7 +42270,7 @@ module.exports = Random; /***/ }), -/* 161 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39019,7 +42279,7 @@ module.exports = Random; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Perimeter = __webpack_require__(118); +var Perimeter = __webpack_require__(126); var Point = __webpack_require__(4); /** @@ -39091,7 +42351,7 @@ module.exports = GetPoint; /***/ }), -/* 162 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39100,7 +42360,7 @@ module.exports = GetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); var Point = __webpack_require__(4); /** @@ -39117,7 +42377,7 @@ var Point = __webpack_require__(4); * @generic {Phaser.Geom.Point[]} O - [out,$return] * * @param {Phaser.Geom.Line} line - The line. - * @param {integer} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. + * @param {number} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. * @param {number} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. * @param {(array|Phaser.Geom.Point[])} [out] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line. * @@ -39156,7 +42416,7 @@ module.exports = GetPoints; /***/ }), -/* 163 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39196,7 +42456,7 @@ module.exports = Random; /***/ }), -/* 164 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39234,7 +42494,7 @@ module.exports = Random; /***/ }), -/* 165 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39243,7 +42503,8 @@ module.exports = Random; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PIPELINE_CONST = __webpack_require__(110); +var DeepCopy = __webpack_require__(167); +var PIPELINE_CONST = __webpack_require__(82); /** * Provides methods used for setting the WebGL rendering pipeline of a Game Object. @@ -39258,6 +42519,8 @@ var Pipeline = { /** * The initial WebGL pipeline of this Game Object. * + * If you call `resetPipeline` on this Game Object, the pipeline is reset to this default. + * * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline * @type {Phaser.Renderer.WebGL.WebGLPipeline} * @default null @@ -39277,61 +42540,251 @@ var Pipeline = { */ pipeline: null, + /** + * Does this Game Object have any Post Pipelines set? + * + * @name Phaser.GameObjects.Components.Pipeline#hasPostPipeline + * @type {boolean} + * @webglOnly + * @since 3.50.0 + */ + hasPostPipeline: false, + + /** + * Does this Game Object manage its Post Pipeline directly? + * + * @name Phaser.GameObjects.Components.Pipeline#manualPostPipeline + * @type {boolean} + * @webglOnly + * @since 3.50.0 + */ + manualPostPipeline: false, + + /** + * The WebGL Post FX Pipelines this Game Object uses for post-render effects. + * + * The pipelines are processed in the order in which they appear in this array. + * + * If you modify this array directly, be sure to set the + * `hasPostPipeline` property accordingly. + * + * @name Phaser.GameObjects.Components.Pipeline#postPipeline + * @type {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[]} + * @webglOnly + * @since 3.50.0 + */ + postPipelines: null, + + /** + * An object to store pipeline specific data in, to be read by the pipelines this Game Object uses. + * + * @name Phaser.GameObjects.Components.Pipeline#pipelineData + * @type {object} + * @webglOnly + * @since 3.50.0 + */ + pipelineData: null, + /** * Sets the initial WebGL Pipeline of this Game Object. * - * This should only be called during the instantiation of the Game Object. + * This should only be called during the instantiation of the Game Object. After that, use `setPipeline`. * * @method Phaser.GameObjects.Components.Pipeline#initPipeline * @webglOnly * @since 3.0.0 * - * @param {string} [name=MultiPipeline] - The name of the pipeline to set on this Game Object. Defaults to the Multi Pipeline. + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set. * * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. */ - initPipeline: function (name) + initPipeline: function (pipeline) { - if (name === undefined) { name = PIPELINE_CONST.MULTI_PIPELINE; } + if (pipeline === undefined) { pipeline = PIPELINE_CONST.MULTI_PIPELINE; } - var renderer = this.scene.sys.game.renderer; + var renderer = this.scene.sys.renderer; var pipelines = renderer.pipelines; - if (pipelines && pipelines.has(name)) - { - this.defaultPipeline = pipelines.get(name); - this.pipeline = this.defaultPipeline; + this.postPipelines = []; + this.pipelineData = {}; - return true; + if (pipelines) + { + var instance = pipelines.get(pipeline); + + if (instance) + { + this.defaultPipeline = instance; + this.pipeline = instance; + + return true; + } } return false; }, /** - * Sets the active WebGL Pipeline of this Game Object. + * Sets the main WebGL Pipeline of this Game Object. + * + * Also sets the `pipelineData` property, if the parameter is given. + * + * Both the pipeline and post pipelines share the same pipeline data object. * * @method Phaser.GameObjects.Components.Pipeline#setPipeline * @webglOnly * @since 3.0.0 * - * @param {string} name - The name of the pipeline to set on this Game Object. + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set. + * @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object. + * @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. * * @return {this} This Game Object instance. */ - setPipeline: function (name) + setPipeline: function (pipeline, pipelineData, copyData) { - var renderer = this.scene.sys.game.renderer; + var renderer = this.scene.sys.renderer; var pipelines = renderer.pipelines; - if (pipelines && pipelines.has(name)) + if (pipelines) { - this.pipeline = pipelines.get(name); + var instance = pipelines.get(pipeline); + + if (instance) + { + this.pipeline = instance; + } + + if (pipelineData) + { + this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData; + } } return this; }, + /** + * Sets one, or more, Post Pipelines on this Game Object. + * + * Post Pipelines are invoked after this Game Object has rendered to its target and + * are commonly used for post-fx. + * + * The post pipelines are appended to the `postPipelines` array belonging to this + * Game Object. When the renderer processes this Game Object, it iterates through the post + * pipelines in the order in which they appear in the array. If you are stacking together + * multiple effects, be aware that the order is important. + * + * If you call this method multiple times, the new pipelines will be appended to any existing + * post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required. + * + * You can optionally also sets the `pipelineData` property, if the parameter is given. + * + * Both the pipeline and post pipelines share the pipeline data object together. + * + * @method Phaser.GameObjects.Components.Pipeline#setPostPipeline + * @webglOnly + * @since 3.50.0 + * + * @param {(string|string[]|function|function[]|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[])} pipelines - Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them. + * @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object. + * @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. + * + * @return {this} This Game Object instance. + */ + setPostPipeline: function (pipelines, pipelineData, copyData) + { + var renderer = this.scene.sys.renderer; + var pipelineManager = renderer.pipelines; + + if (pipelineManager) + { + if (!Array.isArray(pipelines)) + { + pipelines = [ pipelines ]; + } + + for (var i = 0; i < pipelines.length; i++) + { + var instance = pipelineManager.getPostPipeline(pipelines[i], this); + + if (instance) + { + this.postPipelines.push(instance); + } + } + + if (pipelineData) + { + this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData; + } + } + + this.hasPostPipeline = (this.postPipelines.length > 0); + + return this; + }, + + /** + * Adds an entry to the `pipelineData` object belonging to this Game Object. + * + * If the 'key' already exists, its value is updated. If it doesn't exist, it is created. + * + * If `value` is undefined, and `key` exists, `key` is removed from the data object. + * + * Both the pipeline and post pipelines share the pipeline data object together. + * + * @method Phaser.GameObjects.Components.Pipeline#setPipelineData + * @webglOnly + * @since 3.50.0 + * + * @param {string} key - The key of the pipeline data to set, update, or delete. + * @param {any} [value] - The value to be set with the key. If `undefined` then `key` will be deleted from the object. + * + * @return {this} This Game Object instance. + */ + setPipelineData: function (key, value) + { + var data = this.pipelineData; + + if (value === undefined) + { + delete data[key]; + } + else + { + data[key] = value; + } + + return this; + }, + + /** + * Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it. + * + * @method Phaser.GameObjects.Components.Pipeline#getPostPipeline + * @webglOnly + * @since 3.50.0 + * + * @param {string} name - The name of the Post Pipeline to get. + * + * @return {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} The first Post Pipeline matching the name, or undefined if no match. + */ + getPostPipeline: function (pipeline) + { + var pipelines = this.postPipelines; + + for (var i = 0; i < pipelines.length; i++) + { + var instance = pipelines[i]; + + if ((typeof pipeline === 'string' && instance.name === name) || instance instanceof pipeline) + { + return instance; + } + } + }, + /** * Resets the WebGL Pipeline of this Game Object back to the default it was created with. * @@ -39339,15 +42792,62 @@ var Pipeline = { * @webglOnly * @since 3.0.0 * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. + * @param {boolean} [resetPostPipelines=false] - Reset all of the post pipelines? + * @param {boolean} [resetData=false] - Reset the `pipelineData` object to being an empty object? + * + * @return {boolean} `true` if the pipeline was reset successfully, otherwise `false`. */ - resetPipeline: function () + resetPipeline: function (resetPostPipelines, resetData) { + if (resetPostPipelines === undefined) { resetPostPipelines = false; } + if (resetData === undefined) { resetData = false; } + this.pipeline = this.defaultPipeline; + if (resetPostPipelines) + { + this.postPipelines = []; + this.hasPostPipeline = false; + } + + if (resetData) + { + this.pipelineData = {}; + } + return (this.pipeline !== null); }, + /** + * Resets the WebGL Post Pipelines of this Game Object. It does this by calling + * the `destroy` method on each post pipeline and then clearing the local array. + * + * @method Phaser.GameObjects.Components.Pipeline#resetPostPipeline + * @webglOnly + * @since 3.50.0 + * + * @param {boolean} [resetData=false] - Reset the `pipelineData` object to being an empty object? + */ + resetPostPipeline: function (resetData) + { + if (resetData === undefined) { resetData = false; } + + var pipelines = this.postPipelines; + + for (var i = 0; i < pipelines.length; i++) + { + pipelines[i].destroy(); + } + + this.postPipelines = []; + this.hasPostPipeline = false; + + if (resetData) + { + this.pipelineData = {}; + } + }, + /** * Gets the name of the WebGL Pipeline this Game Object is currently using. * @@ -39368,7 +42868,117 @@ module.exports = Pipeline; /***/ }), -/* 166 */ +/* 167 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Deep Copy the given object or array. + * + * @function Phaser.Utils.Objects.DeepCopy + * @since 3.50.0 + * + * @param {object} obj - The object to deep copy. + * + * @return {object} A deep copy of the original object. + */ +var DeepCopy = function (inObject) +{ + var outObject; + var value; + var key; + + if (typeof inObject !== 'object' || inObject === null) + { + // inObject is not an object + return inObject; + } + + // Create an array or object to hold the values + outObject = Array.isArray(inObject) ? [] : {}; + + for (key in inObject) + { + value = inObject[key]; + + // Recursively (deep) copy for nested objects, including arrays + outObject[key] = DeepCopy(value); + } + + return outObject; +}; + +module.exports = DeepCopy; + + +/***/ }), +/* 168 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Build a JSON representation of the given Game Object. + * + * This is typically extended further by Game Object specific implementations. + * + * @method Phaser.GameObjects.Components.ToJSON + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON. + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. + */ +var ToJSON = function (gameObject) +{ + var out = { + name: gameObject.name, + type: gameObject.type, + x: gameObject.x, + y: gameObject.y, + depth: gameObject.depth, + scale: { + x: gameObject.scaleX, + y: gameObject.scaleY + }, + origin: { + x: gameObject.originX, + y: gameObject.originY + }, + flipX: gameObject.flipX, + flipY: gameObject.flipY, + rotation: gameObject.rotation, + alpha: gameObject.alpha, + visible: gameObject.visible, + blendMode: gameObject.blendMode, + textureKey: '', + frameKey: '', + data: {} + }; + + if (gameObject.texture) + { + out.textureKey = gameObject.texture.key; + out.frameKey = gameObject.frame.name; + } + + return out; +}; + +module.exports = ToJSON; + + +/***/ }), +/* 169 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39423,7 +43033,87 @@ module.exports = TransformXY; /***/ }), -/* 167 */ +/* 170 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Moves the element at the start of the array to the end, shifting all items in the process. + * The "rotation" happens to the left. + * + * @function Phaser.Utils.Array.RotateLeft + * @since 3.0.0 + * + * @param {array} array - The array to shift to the left. This array is modified in place. + * @param {number} [total=1] - The number of times to shift the array. + * + * @return {*} The most recently shifted element. + */ +var RotateLeft = function (array, total) +{ + if (total === undefined) { total = 1; } + + var element = null; + + for (var i = 0; i < total; i++) + { + element = array.shift(); + array.push(element); + } + + return element; +}; + +module.exports = RotateLeft; + + +/***/ }), +/* 171 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Moves the element at the end of the array to the start, shifting all items in the process. + * The "rotation" happens to the right. + * + * @function Phaser.Utils.Array.RotateRight + * @since 3.0.0 + * + * @param {array} array - The array to shift to the right. This array is modified in place. + * @param {number} [total=1] - The number of times to shift the array. + * + * @return {*} The most recently shifted element. + */ +var RotateRight = function (array, total) +{ + if (total === undefined) { total = 1; } + + var element = null; + + for (var i = 0; i < total; i++) + { + element = array.pop(); + array.unshift(element); + } + + return element; +}; + +module.exports = RotateRight; + + +/***/ }), +/* 172 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39464,7 +43154,7 @@ module.exports = Random; /***/ }), -/* 168 */ +/* 173 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39520,7 +43210,7 @@ module.exports = Random; /***/ }), -/* 169 */ +/* 174 */ /***/ (function(module, exports) { /** @@ -39561,7 +43251,7 @@ module.exports = RotateAroundDistance; /***/ }), -/* 170 */ +/* 175 */ /***/ (function(module, exports) { /** @@ -39600,7 +43290,7 @@ module.exports = SmootherStep; /***/ }), -/* 171 */ +/* 176 */ /***/ (function(module, exports) { /** @@ -39647,7 +43337,7 @@ module.exports = SmoothStep; /***/ }), -/* 172 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -39656,13 +43346,13 @@ module.exports = SmoothStep; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(122); -var FindClosestInSorted = __webpack_require__(298); -var Frame = __webpack_require__(299); +var Events = __webpack_require__(128); +var FindClosestInSorted = __webpack_require__(310); +var Frame = __webpack_require__(311); var GetValue = __webpack_require__(6); -var SortByDigits = __webpack_require__(300); +var SortByDigits = __webpack_require__(312); /** * @classdesc @@ -39740,7 +43430,7 @@ var Animation = new Class({ * The frame rate of playback in frames per second (default 24 if duration is null) * * @name Phaser.Animations.Animation#frameRate - * @type {integer} + * @type {number} * @default 24 * @since 3.0.0 */ @@ -39752,7 +43442,7 @@ var Animation = new Class({ * otherwise the `frameRate` is derived from `duration`. * * @name Phaser.Animations.Animation#duration - * @type {integer} + * @type {number} * @since 3.0.0 */ this.duration = GetValue(config, 'duration', null); @@ -39761,7 +43451,7 @@ var Animation = new Class({ * How many ms per frame, not including frame specific modifiers. * * @name Phaser.Animations.Animation#msPerFrame - * @type {integer} + * @type {number} * @since 3.0.0 */ this.msPerFrame; @@ -39780,7 +43470,7 @@ var Animation = new Class({ * The delay in ms before the playback will begin. * * @name Phaser.Animations.Animation#delay - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -39790,7 +43480,7 @@ var Animation = new Class({ * Number of times to repeat the animation. Set to -1 to repeat forever. * * @name Phaser.Animations.Animation#repeat - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -39800,7 +43490,7 @@ var Animation = new Class({ * The delay in ms before the a repeat play starts. * * @name Phaser.Animations.Animation#repeatDelay - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -39874,7 +43564,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#calculateDuration * @since 3.50.0 * - * @param {(Phaser.Animations.Animation|Phaser.GameObjects.Components.Animation)} target - The target to set the values on. + * @param {Phaser.Animations.Animation} target - The target to set the values on. * @param {number} totalFrames - The total number of frames in the animation. * @param {number} duration - The duration to calculate the frame rate from. * @param {number} frameRate - The frame ate to calculate the duration from. @@ -39928,7 +43618,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#addFrameAt * @since 3.0.0 * - * @param {integer} index - The index to insert the frame at within the animation. + * @param {number} index - The index to insert the frame at within the animation. * @param {(string|Phaser.Types.Animations.AnimationFrame[])} config - Either a string, in which case it will use all frames from a texture with the matching key, or an array of Animation Frame configuration objects. * * @return {this} This Animation object. @@ -39967,7 +43657,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#checkFrame * @since 3.0.0 * - * @param {integer} index - The index to be checked. + * @param {number} index - The index to be checked. * * @return {boolean} `true` if the index is valid, otherwise `false`. */ @@ -39984,14 +43674,14 @@ var Animation = new Class({ * @protected * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component belonging to the Game Object invoking this call. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - getFirstTick: function (component) + getFirstTick: function (state) { // When is the first update due? - component.accumulator = 0; + state.accumulator = 0; - component.nextTick = component.msPerFrame + component.currentFrame.duration; + state.nextTick = state.msPerFrame + state.currentFrame.duration; }, /** @@ -40001,7 +43691,7 @@ var Animation = new Class({ * @protected * @since 3.0.0 * - * @param {integer} index - The index in the AnimationFrame array + * @param {number} index - The index in the AnimationFrame array * * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence */ @@ -40125,13 +43815,13 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#getNextTick * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component belonging to the Game Object invoking this call. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - getNextTick: function (component) + getNextTick: function (state) { - component.accumulator -= component.nextTick; + state.accumulator -= state.nextTick; - component.nextTick = component.msPerFrame + component.currentFrame.duration; + state.nextTick = state.msPerFrame + state.currentFrame.duration; }, /** @@ -40157,42 +43847,42 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#nextFrame * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + * @param {Phaser.Animations.AnimationState} state - The Animation State to advance. */ - nextFrame: function (component) + nextFrame: function (state) { - var frame = component.currentFrame; + var frame = state.currentFrame; if (frame.isLast) { // We're at the end of the animation // Yoyo? (happens before repeat) - if (component.yoyo) + if (state.yoyo) { - this.handleYoyoFrame(component, false); + this.handleYoyoFrame(state, false); } - else if (component.repeatCounter > 0) + else if (state.repeatCounter > 0) { // Repeat (happens before complete) - if (component.inReverse && component.forward) + if (state.inReverse && state.forward) { - component.forward = false; + state.forward = false; } else { - this.repeatAnimation(component); + this.repeatAnimation(state); } } else { - component.complete(); + state.complete(); } } else { - this.updateAndGetNextTick(component, frame.nextFrame); + this.updateAndGetNextTick(state, frame.nextFrame); } }, @@ -40203,37 +43893,37 @@ var Animation = new Class({ * @private * @since 3.12.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component to advance. + * @param {Phaser.Animations.AnimationState} state - The Animation State to advance. * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) */ - handleYoyoFrame: function (component, isReverse) + handleYoyoFrame: function (state, isReverse) { if (!isReverse) { isReverse = false; } - if (component.inReverse === !isReverse && component.repeatCounter > 0) + if (state.inReverse === !isReverse && state.repeatCounter > 0) { - if (component.repeatDelay === 0 || component.pendingRepeat) + if (state.repeatDelay === 0 || state.pendingRepeat) { - component.forward = isReverse; + state.forward = isReverse; } - this.repeatAnimation(component); + this.repeatAnimation(state); return; } - if (component.inReverse !== isReverse && component.repeatCounter === 0) + if (state.inReverse !== isReverse && state.repeatCounter === 0) { - component.complete(); + state.complete(); return; } - component.forward = isReverse; + state.forward = isReverse; - var frame = (isReverse) ? component.currentFrame.nextFrame : component.currentFrame.prevFrame; + var frame = (isReverse) ? state.currentFrame.nextFrame : state.currentFrame.prevFrame; - this.updateAndGetNextTick(component, frame); + this.updateAndGetNextTick(state, frame); }, /** @@ -40242,7 +43932,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#getLastFrame * @since 3.12.0 * - * @return {Phaser.Animations.AnimationFrame} component - The Animation Last Frame. + * @return {Phaser.Animations.AnimationFrame} The last Animation Frame. */ getLastFrame: function () { @@ -40256,41 +43946,41 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#previousFrame * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component belonging to the Game Object invoking this call. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - previousFrame: function (component) + previousFrame: function (state) { - var frame = component.currentFrame; + var frame = state.currentFrame; if (frame.isFirst) { // We're at the start of the animation - if (component.yoyo) + if (state.yoyo) { - this.handleYoyoFrame(component, true); + this.handleYoyoFrame(state, true); } - else if (component.repeatCounter > 0) + else if (state.repeatCounter > 0) { - if (component.inReverse && !component.forward) + if (state.inReverse && !state.forward) { - this.repeatAnimation(component); + this.repeatAnimation(state); } else { // Repeat (happens before complete) - component.forward = true; + state.forward = true; - this.repeatAnimation(component); + this.repeatAnimation(state); } } else { - component.complete(); + state.complete(); } } else { - this.updateAndGetNextTick(component, frame.prevFrame); + this.updateAndGetNextTick(state, frame.prevFrame); } }, @@ -40301,13 +43991,14 @@ var Animation = new Class({ * @private * @since 3.12.0 * + * @param {Phaser.Animations.AnimationState} state - The Animation State. * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. */ - updateAndGetNextTick: function (component, frame) + updateAndGetNextTick: function (state, frame) { - component.setCurrentFrame(frame); + state.setCurrentFrame(frame); - this.getNextTick(component); + this.getNextTick(state); }, /** @@ -40340,7 +44031,7 @@ var Animation = new Class({ * @method Phaser.Animations.Animation#removeFrameAt * @since 3.0.0 * - * @param {integer} index - The index in the AnimationFrame array + * @param {number} index - The index in the AnimationFrame array * * @return {this} This Animation object. */ @@ -40363,46 +44054,46 @@ var Animation = new Class({ * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.Animation} component - The Animation Component belonging to the Game Object invoking this call. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - repeatAnimation: function (component) + repeatAnimation: function (state) { - if (component._pendingStop === 2) + if (state._pendingStop === 2) { - if (component._pendingStopValue === 0) + if (state._pendingStopValue === 0) { - return component.stop(); + return state.stop(); } else { - component._pendingStopValue--; + state._pendingStopValue--; } } - if (component.repeatDelay > 0 && !component.pendingRepeat) + if (state.repeatDelay > 0 && !state.pendingRepeat) { - component.pendingRepeat = true; - component.accumulator -= component.nextTick; - component.nextTick += component.repeatDelay; + state.pendingRepeat = true; + state.accumulator -= state.nextTick; + state.nextTick += state.repeatDelay; } else { - component.repeatCounter--; + state.repeatCounter--; - if (component.forward) + if (state.forward) { - component.setCurrentFrame(component.currentFrame.nextFrame); + state.setCurrentFrame(state.currentFrame.nextFrame); } else { - component.setCurrentFrame(component.currentFrame.prevFrame); + state.setCurrentFrame(state.currentFrame.prevFrame); } - if (component.isPlaying) + if (state.isPlaying) { - this.getNextTick(component); + this.getNextTick(state); - component.handleRepeat(); + state.handleRepeat(); } } }, @@ -40561,7 +44252,7 @@ module.exports = Animation; /***/ }), -/* 173 */ +/* 178 */ /***/ (function(module, exports) { /** @@ -40594,9 +44285,9 @@ module.exports = Animation; * @since 3.0.0 * * @param {string|number|object} str - The target string. `toString()` will be called on the string, which means you can also pass in common data types like numbers. - * @param {integer} [len=0] - The number of characters to be added. + * @param {number} [len=0] - The number of characters to be added. * @param {string} [pad=" "] - The string to pad it out with (defaults to a space). - * @param {integer} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). + * @param {number} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). * * @return {string} The padded string. */ @@ -40637,7 +44328,7 @@ module.exports = Pad; /***/ }), -/* 174 */ +/* 179 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -40646,10 +44337,10 @@ module.exports = Pad; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HexStringToColor = __webpack_require__(307); -var IntegerToColor = __webpack_require__(310); -var ObjectToColor = __webpack_require__(312); -var RGBStringToColor = __webpack_require__(313); +var HexStringToColor = __webpack_require__(319); +var IntegerToColor = __webpack_require__(322); +var ObjectToColor = __webpack_require__(323); +var RGBStringToColor = __webpack_require__(324); /** * Converts the given source color value into an instance of a Color class. @@ -40693,37 +44384,7 @@ module.exports = ValueToColor; /***/ }), -/* 175 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Given 3 separate color values this will return an integer representation of it. - * - * @function Phaser.Display.Color.GetColor - * @since 3.0.0 - * - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * - * @return {number} The combined color value. - */ -var GetColor = function (red, green, blue) -{ - return red << 16 | green << 8 | blue; -}; - -module.exports = GetColor; - - -/***/ }), -/* 176 */ +/* 180 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -40732,7 +44393,7 @@ module.exports = GetColor; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetColor = __webpack_require__(175); +var GetColor = __webpack_require__(100); /** * RGB space conversion. @@ -40804,7 +44465,7 @@ module.exports = HSVToRGB; /***/ }), -/* 177 */ +/* 181 */ /***/ (function(module, exports) { /** @@ -40813,130 +44474,46 @@ module.exports = HSVToRGB; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Browser specific prefix, so not going to change between contexts, only between browsers -var prefix = ''; - /** - * @namespace Phaser.Display.Canvas.Smoothing + * Return the component parts of a color as an Object with the properties alpha, red, green, blue. + * + * Alpha will only be set if it exists in the given color (0xAARRGGBB) + * + * @function Phaser.Display.Color.IntegerToRGB * @since 3.0.0 + * + * @param {number} input - The color value to convert into a Color object. + * + * @return {Phaser.Types.Display.ColorObject} An object with the red, green and blue values set in the r, g and b properties. */ -var Smoothing = function () +var IntegerToRGB = function (color) { - /** - * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. - * - * @function Phaser.Display.Canvas.Smoothing.getPrefix - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The canvas context to check. - * - * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported. - */ - var getPrefix = function (context) + if (color > 16777215) { - var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; - - for (var i = 0; i < vendors.length; i++) - { - var s = vendors[i] + 'mageSmoothingEnabled'; - - if (s in context) - { - return s; - } - } - - return null; - }; - - /** - * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. - * By default browsers have image smoothing enabled, which isn't always what you visually want, especially - * when using pixel art in a game. Note that this sets the property on the context itself, so that any image - * drawn to the context will be affected. This sets the property across all current browsers but support is - * patchy on earlier browsers, especially on mobile. - * - * @function Phaser.Display.Canvas.Smoothing.enable - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to enable smoothing. - * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. - */ - var enable = function (context) + // The color value has an alpha component + return { + a: color >>> 24, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } + else { - if (prefix === '') - { - prefix = getPrefix(context); - } - - if (prefix) - { - context[prefix] = true; - } - - return context; - }; - - /** - * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. - * By default browsers have image smoothing enabled, which isn't always what you visually want, especially - * when using pixel art in a game. Note that this sets the property on the context itself, so that any image - * drawn to the context will be affected. This sets the property across all current browsers but support is - * patchy on earlier browsers, especially on mobile. - * - * @function Phaser.Display.Canvas.Smoothing.disable - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to disable smoothing. - * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. - */ - var disable = function (context) - { - if (prefix === '') - { - prefix = getPrefix(context); - } - - if (prefix) - { - context[prefix] = false; - } - - return context; - }; - - /** - * Returns `true` if the given context has image smoothing enabled, otherwise returns `false`. - * Returns null if no smoothing prefix is available. - * - * @function Phaser.Display.Canvas.Smoothing.isEnabled - * @since 3.0.0 - * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context to check. - * - * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported. - */ - var isEnabled = function (context) - { - return (prefix !== null) ? context[prefix] : null; - }; - - return { - disable: disable, - enable: enable, - getPrefix: getPrefix, - isEnabled: isEnabled - }; - + return { + a: 255, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } }; -module.exports = Smoothing(); +module.exports = IntegerToRGB; /***/ }), -/* 178 */ +/* 182 */ /***/ (function(module, exports) { /** @@ -40973,7 +44550,7 @@ module.exports = CenterOn; /***/ }), -/* 179 */ +/* 183 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -40982,9 +44559,9 @@ module.exports = CenterOn; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var OS = __webpack_require__(125); -var Browser = __webpack_require__(126); -var CanvasPool = __webpack_require__(26); +var OS = __webpack_require__(102); +var Browser = __webpack_require__(131); +var CanvasPool = __webpack_require__(31); /** * Determines the features of the browser running this Phaser Game instance. @@ -41165,7 +44742,139 @@ module.exports = init(); /***/ }), -/* 180 */ +/* 184 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Browser specific prefix, so not going to change between contexts, only between browsers +var prefix = ''; + +/** + * @namespace Phaser.Display.Canvas.Smoothing + * @since 3.0.0 + */ +var Smoothing = function () +{ + /** + * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. + * + * @function Phaser.Display.Canvas.Smoothing.getPrefix + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The canvas context to check. + * + * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported. + */ + var getPrefix = function (context) + { + var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; + + for (var i = 0; i < vendors.length; i++) + { + var s = vendors[i] + 'mageSmoothingEnabled'; + + if (s in context) + { + return s; + } + } + + return null; + }; + + /** + * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. + * By default browsers have image smoothing enabled, which isn't always what you visually want, especially + * when using pixel art in a game. Note that this sets the property on the context itself, so that any image + * drawn to the context will be affected. This sets the property across all current browsers but support is + * patchy on earlier browsers, especially on mobile. + * + * @function Phaser.Display.Canvas.Smoothing.enable + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to enable smoothing. + * + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + */ + var enable = function (context) + { + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = true; + } + + return context; + }; + + /** + * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. + * By default browsers have image smoothing enabled, which isn't always what you visually want, especially + * when using pixel art in a game. Note that this sets the property on the context itself, so that any image + * drawn to the context will be affected. This sets the property across all current browsers but support is + * patchy on earlier browsers, especially on mobile. + * + * @function Phaser.Display.Canvas.Smoothing.disable + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to disable smoothing. + * + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + */ + var disable = function (context) + { + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = false; + } + + return context; + }; + + /** + * Returns `true` if the given context has image smoothing enabled, otherwise returns `false`. + * Returns null if no smoothing prefix is available. + * + * @function Phaser.Display.Canvas.Smoothing.isEnabled + * @since 3.0.0 + * + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context to check. + * + * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported. + */ + var isEnabled = function (context) + { + return (prefix !== null) ? context[prefix] : null; + }; + + return { + disable: disable, + enable: enable, + getPrefix: getPrefix, + isEnabled: isEnabled + }; + +}; + +module.exports = Smoothing(); + + +/***/ }), +/* 185 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41175,7 +44884,7 @@ module.exports = init(); */ var CONST = __webpack_require__(13); -var Extend = __webpack_require__(19); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Math @@ -41184,63 +44893,64 @@ var Extend = __webpack_require__(19); var PhaserMath = { // Collections of functions - Angle: __webpack_require__(760), - Distance: __webpack_require__(769), - Easing: __webpack_require__(774), - Fuzzy: __webpack_require__(775), - Interpolation: __webpack_require__(778), - Pow2: __webpack_require__(783), - Snap: __webpack_require__(785), + Angle: __webpack_require__(801), + Distance: __webpack_require__(810), + Easing: __webpack_require__(815), + Fuzzy: __webpack_require__(816), + Interpolation: __webpack_require__(819), + Pow2: __webpack_require__(824), + Snap: __webpack_require__(826), // Expose the RNG Class - RandomDataGenerator: __webpack_require__(787), + RandomDataGenerator: __webpack_require__(828), // Single functions - Average: __webpack_require__(788), - Bernstein: __webpack_require__(337), - Between: __webpack_require__(182), - CatmullRom: __webpack_require__(181), - CeilTo: __webpack_require__(789), - Clamp: __webpack_require__(17), - DegToRad: __webpack_require__(41), - Difference: __webpack_require__(790), - Factorial: __webpack_require__(338), - FloatBetween: __webpack_require__(127), - FloorTo: __webpack_require__(791), - FromPercent: __webpack_require__(89), - GetSpeed: __webpack_require__(792), - IsEven: __webpack_require__(793), - IsEvenStrict: __webpack_require__(794), - Linear: __webpack_require__(124), - MaxAdd: __webpack_require__(795), - MinSub: __webpack_require__(796), - Percent: __webpack_require__(797), - RadToDeg: __webpack_require__(183), - RandomXY: __webpack_require__(798), - RandomXYZ: __webpack_require__(799), - RandomXYZW: __webpack_require__(800), - Rotate: __webpack_require__(344), - RotateAround: __webpack_require__(285), - RotateAroundDistance: __webpack_require__(169), - RotateTo: __webpack_require__(801), - RoundAwayFromZero: __webpack_require__(345), - RoundTo: __webpack_require__(802), - SinCosTableGenerator: __webpack_require__(803), - SmootherStep: __webpack_require__(170), - SmoothStep: __webpack_require__(171), - ToXY: __webpack_require__(804), - TransformXY: __webpack_require__(166), - Within: __webpack_require__(805), - Wrap: __webpack_require__(59), + Average: __webpack_require__(829), + Bernstein: __webpack_require__(348), + Between: __webpack_require__(187), + CatmullRom: __webpack_require__(186), + CeilTo: __webpack_require__(830), + Clamp: __webpack_require__(16), + DegToRad: __webpack_require__(34), + Difference: __webpack_require__(831), + Euler: __webpack_require__(832), + Factorial: __webpack_require__(349), + FloatBetween: __webpack_require__(132), + FloorTo: __webpack_require__(833), + FromPercent: __webpack_require__(94), + GetSpeed: __webpack_require__(834), + IsEven: __webpack_require__(835), + IsEvenStrict: __webpack_require__(836), + Linear: __webpack_require__(130), + MaxAdd: __webpack_require__(837), + MinSub: __webpack_require__(838), + Percent: __webpack_require__(839), + RadToDeg: __webpack_require__(188), + RandomXY: __webpack_require__(840), + RandomXYZ: __webpack_require__(841), + RandomXYZW: __webpack_require__(842), + Rotate: __webpack_require__(354), + RotateAround: __webpack_require__(300), + RotateAroundDistance: __webpack_require__(174), + RotateTo: __webpack_require__(843), + RoundAwayFromZero: __webpack_require__(355), + RoundTo: __webpack_require__(844), + SinCosTableGenerator: __webpack_require__(845), + SmootherStep: __webpack_require__(175), + SmoothStep: __webpack_require__(176), + ToXY: __webpack_require__(846), + TransformXY: __webpack_require__(169), + Within: __webpack_require__(847), + Wrap: __webpack_require__(64), // Vector classes Vector2: __webpack_require__(3), - Vector3: __webpack_require__(81), - Vector4: __webpack_require__(129), - Matrix3: __webpack_require__(346), - Matrix4: __webpack_require__(347), - Quaternion: __webpack_require__(348), - RotateVec3: __webpack_require__(806) + Vector3: __webpack_require__(37), + Vector4: __webpack_require__(135), + Matrix3: __webpack_require__(356), + Matrix4: __webpack_require__(73), + Quaternion: __webpack_require__(357), + RotateVec3: __webpack_require__(848) }; @@ -41254,7 +44964,7 @@ module.exports = PhaserMath; /***/ }), -/* 181 */ +/* 186 */ /***/ (function(module, exports) { /** @@ -41291,7 +45001,7 @@ module.exports = CatmullRom; /***/ }), -/* 182 */ +/* 187 */ /***/ (function(module, exports) { /** @@ -41306,10 +45016,10 @@ module.exports = CatmullRom; * @function Phaser.Math.Between * @since 3.0.0 * - * @param {integer} min - The minimum value. - * @param {integer} max - The maximum value. + * @param {number} min - The minimum value. + * @param {number} max - The maximum value. * - * @return {integer} The random integer. + * @return {number} The random integer. */ var Between = function (min, max) { @@ -41320,7 +45030,7 @@ module.exports = Between; /***/ }), -/* 183 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41339,7 +45049,7 @@ var CONST = __webpack_require__(13); * * @param {number} radians - The angle in radians to convert ot degrees. * - * @return {integer} The given angle converted to degrees. + * @return {number} The given angle converted to degrees. */ var RadToDeg = function (radians) { @@ -41350,7 +45060,7 @@ module.exports = RadToDeg; /***/ }), -/* 184 */ +/* 189 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41360,11 +45070,11 @@ module.exports = RadToDeg; */ /** - * @typedef {object} Phaser.Plugins.DefaultPlugins - * - * @property {array} Global - These are the Global Managers that are created by the Phaser.Game instance. - * @property {array} CoreScene - These are the core plugins that are installed into every Scene.Systems instance, no matter what. - * @property {array} DefaultScene - These plugins are created in Scene.Systems in addition to the CoreScenePlugins. + * The Default Plugins. + * + * @namespace Phaser.Plugins.DefaultPlugins + * @memberof Phaser.Plugins + * @since 3.0.0 */ var DefaultPlugins = { @@ -41386,7 +45096,8 @@ var DefaultPlugins = { 'registry', 'scale', 'sound', - 'textures' + 'textures', + 'renderer' ], @@ -41451,8 +45162,8 @@ module.exports = DefaultPlugins; /***/ }), -/* 185 */ -/***/ (function(module, exports) { +/* 190 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -41461,55 +45172,21 @@ module.exports = DefaultPlugins; */ /** - * Translates the model matrix by the given values. - * - * @method Phaser.Renderer.WebGL.MVP.ProjectOrtho - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * @param {number} left - The left value. - * @param {number} right - The right value. - * @param {number} bottom - The bottom value. - * @param {number} top - The top value. - * @param {number} near - The near value. - * @param {number} far - The far value. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. + * @namespace Phaser.Renderer.WebGL.Events */ -var ProjectOrtho = function (model, left, right, bottom, top, near, far) -{ - var projectionMatrix = model.projectionMatrix; - var leftRight = 1 / (left - right); - var bottomTop = 1 / (bottom - top); - var nearFar = 1 / (near - far); - projectionMatrix[0] = -2 * leftRight; - projectionMatrix[1] = 0; - projectionMatrix[2] = 0; - projectionMatrix[3] = 0; - projectionMatrix[4] = 0; - projectionMatrix[5] = -2 * bottomTop; - projectionMatrix[6] = 0; - projectionMatrix[7] = 0; - projectionMatrix[8] = 0; - projectionMatrix[9] = 0; - projectionMatrix[10] = 2 * nearFar; - projectionMatrix[11] = 0; - projectionMatrix[12] = (left + right) * leftRight; - projectionMatrix[13] = (top + bottom) * bottomTop; - projectionMatrix[14] = (far + near) * nearFar; - projectionMatrix[15] = 1; +module.exports = { - model.projectionMatrixDirty = true; + POST_RENDER: __webpack_require__(849), + PRE_RENDER: __webpack_require__(850), + RENDER: __webpack_require__(851), + RESIZE: __webpack_require__(852) - return model; }; -module.exports = ProjectOrtho; - /***/ }), -/* 186 */ +/* 191 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41595,7 +45272,7 @@ module.exports = FromPoints; /***/ }), -/* 187 */ +/* 192 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41606,10 +45283,10 @@ module.exports = FromPoints; var CONST = { - CENTER: __webpack_require__(370), - ORIENTATION: __webpack_require__(371), - SCALE_MODE: __webpack_require__(372), - ZOOM: __webpack_require__(373) + CENTER: __webpack_require__(380), + ORIENTATION: __webpack_require__(381), + SCALE_MODE: __webpack_require__(382), + ZOOM: __webpack_require__(383) }; @@ -41617,7 +45294,7 @@ module.exports = CONST; /***/ }), -/* 188 */ +/* 193 */ /***/ (function(module, exports) { /** @@ -41646,7 +45323,7 @@ module.exports = RemoveFromDOM; /***/ }), -/* 189 */ +/* 194 */ /***/ (function(module, exports) { /** @@ -41661,7 +45338,7 @@ var INPUT_CONST = { * The mouse pointer is being held down. * * @name Phaser.Input.MOUSE_DOWN - * @type {integer} + * @type {number} * @since 3.10.0 */ MOUSE_DOWN: 0, @@ -41670,7 +45347,7 @@ var INPUT_CONST = { * The mouse pointer is being moved. * * @name Phaser.Input.MOUSE_MOVE - * @type {integer} + * @type {number} * @since 3.10.0 */ MOUSE_MOVE: 1, @@ -41679,7 +45356,7 @@ var INPUT_CONST = { * The mouse pointer is released. * * @name Phaser.Input.MOUSE_UP - * @type {integer} + * @type {number} * @since 3.10.0 */ MOUSE_UP: 2, @@ -41688,7 +45365,7 @@ var INPUT_CONST = { * A touch pointer has been started. * * @name Phaser.Input.TOUCH_START - * @type {integer} + * @type {number} * @since 3.10.0 */ TOUCH_START: 3, @@ -41697,7 +45374,7 @@ var INPUT_CONST = { * A touch pointer has been started. * * @name Phaser.Input.TOUCH_MOVE - * @type {integer} + * @type {number} * @since 3.10.0 */ TOUCH_MOVE: 4, @@ -41706,7 +45383,7 @@ var INPUT_CONST = { * A touch pointer has been started. * * @name Phaser.Input.TOUCH_END - * @type {integer} + * @type {number} * @since 3.10.0 */ TOUCH_END: 5, @@ -41715,7 +45392,7 @@ var INPUT_CONST = { * The pointer lock has changed. * * @name Phaser.Input.POINTER_LOCK_CHANGE - * @type {integer} + * @type {number} * @since 3.10.0 */ POINTER_LOCK_CHANGE: 6, @@ -41724,7 +45401,7 @@ var INPUT_CONST = { * A touch pointer has been been cancelled by the browser. * * @name Phaser.Input.TOUCH_CANCEL - * @type {integer} + * @type {number} * @since 3.15.0 */ TOUCH_CANCEL: 7, @@ -41733,7 +45410,7 @@ var INPUT_CONST = { * The mouse wheel changes. * * @name Phaser.Input.MOUSE_WHEEL - * @type {integer} + * @type {number} * @since 3.18.0 */ MOUSE_WHEEL: 8 @@ -41744,7 +45421,7 @@ module.exports = INPUT_CONST; /***/ }), -/* 190 */ +/* 195 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -41754,13 +45431,13 @@ module.exports = INPUT_CONST; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(133); -var DefaultPlugins = __webpack_require__(184); +var CONST = __webpack_require__(139); +var DefaultPlugins = __webpack_require__(189); var Events = __webpack_require__(20); -var GetPhysicsPlugins = __webpack_require__(386); -var GetScenePlugins = __webpack_require__(387); +var GetPhysicsPlugins = __webpack_require__(396); +var GetScenePlugins = __webpack_require__(397); var NOOP = __webpack_require__(1); -var Settings = __webpack_require__(388); +var Settings = __webpack_require__(398); /** * @classdesc @@ -42114,13 +45791,15 @@ var Systems = new Class({ */ step: function (time, delta) { - this.events.emit(Events.PRE_UPDATE, time, delta); + var events = this.events; - this.events.emit(Events.UPDATE, time, delta); + events.emit(Events.PRE_UPDATE, time, delta); + + events.emit(Events.UPDATE, time, delta); this.sceneUpdate.call(this.scene, time, delta); - this.events.emit(Events.POST_UPDATE, time, delta); + events.emit(Events.POST_UPDATE, time, delta); }, /** @@ -42180,13 +45859,16 @@ var Systems = new Class({ */ pause: function (data) { + var events = this.events; + var settings = this.settings; + if (this.settings.active) { - this.settings.status = CONST.PAUSED; + settings.status = CONST.PAUSED; - this.settings.active = false; + settings.active = false; - this.events.emit(Events.PAUSE, this, data); + events.emit(Events.PAUSE, this, data); } return this; @@ -42205,13 +45887,16 @@ var Systems = new Class({ */ resume: function (data) { + var events = this.events; + var settings = this.settings; + if (!this.settings.active) { - this.settings.status = CONST.RUNNING; + settings.status = CONST.RUNNING; - this.settings.active = true; + settings.active = true; - this.events.emit(Events.RESUME, this, data); + events.emit(Events.RESUME, this, data); } return this; @@ -42235,12 +45920,15 @@ var Systems = new Class({ */ sleep: function (data) { - this.settings.status = CONST.SLEEPING; + var events = this.events; + var settings = this.settings; - this.settings.active = false; - this.settings.visible = false; + settings.status = CONST.SLEEPING; - this.events.emit(Events.SLEEP, this, data); + settings.active = false; + settings.visible = false; + + events.emit(Events.SLEEP, this, data); return this; }, @@ -42258,6 +45946,7 @@ var Systems = new Class({ */ wake: function (data) { + var events = this.events; var settings = this.settings; settings.status = CONST.RUNNING; @@ -42265,11 +45954,11 @@ var Systems = new Class({ settings.active = true; settings.visible = true; - this.events.emit(Events.WAKE, this, data); + events.emit(Events.WAKE, this, data); if (settings.isTransition) { - this.events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); + events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); } return this; @@ -42438,21 +46127,24 @@ var Systems = new Class({ */ start: function (data) { + var events = this.events; + var settings = this.settings; + if (data) { - this.settings.data = data; + settings.data = data; } - this.settings.status = CONST.START; + settings.status = CONST.START; - this.settings.active = true; - this.settings.visible = true; + settings.active = true; + settings.visible = true; // For plugins to listen out for - this.events.emit(Events.START, this); + events.emit(Events.START, this); // For user-land code to listen out for - this.events.emit(Events.READY, this, data); + events.emit(Events.READY, this, data); }, /** @@ -42470,17 +46162,20 @@ var Systems = new Class({ */ shutdown: function (data) { - this.events.off(Events.TRANSITION_INIT); - this.events.off(Events.TRANSITION_START); - this.events.off(Events.TRANSITION_COMPLETE); - this.events.off(Events.TRANSITION_OUT); + var events = this.events; + var settings = this.settings; - this.settings.status = CONST.SHUTDOWN; + events.off(Events.TRANSITION_INIT); + events.off(Events.TRANSITION_START); + events.off(Events.TRANSITION_COMPLETE); + events.off(Events.TRANSITION_OUT); - this.settings.active = false; - this.settings.visible = false; + settings.status = CONST.SHUTDOWN; - this.events.emit(Events.SHUTDOWN, this, data); + settings.active = false; + settings.visible = false; + + events.emit(Events.SHUTDOWN, this, data); }, /** @@ -42495,14 +46190,17 @@ var Systems = new Class({ */ destroy: function () { - this.settings.status = CONST.DESTROYED; + var events = this.events; + var settings = this.settings; - this.settings.active = false; - this.settings.visible = false; + settings.status = CONST.DESTROYED; - this.events.emit(Events.DESTROY, this); + settings.active = false; + settings.visible = false; - this.events.removeAllListeners(); + events.emit(Events.DESTROY, this); + + events.removeAllListeners(); var props = [ 'scene', 'game', 'anims', 'cache', 'plugins', 'registry', 'sound', 'textures', 'add', 'camera', 'displayList', 'events', 'make', 'scenePlugin', 'updateList' ]; @@ -42518,7 +46216,7 @@ module.exports = Systems; /***/ }), -/* 191 */ +/* 196 */ /***/ (function(module, exports) { /** @@ -42555,7 +46253,7 @@ module.exports = UppercaseFirst; /***/ }), -/* 192 */ +/* 197 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -42565,8 +46263,8 @@ module.exports = UppercaseFirst; */ var Class = __webpack_require__(0); -var Frame = __webpack_require__(97); -var TextureSource = __webpack_require__(391); +var Frame = __webpack_require__(104); +var TextureSource = __webpack_require__(401); var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; @@ -42576,7 +46274,7 @@ var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; * The Frames represent the different areas of the Texture. For example a texture atlas * may have many Frames, one for each element within the atlas. Where-as a single image would have * just one frame, that encompasses the whole image. - * + * * Every Texture, no matter where it comes from, always has at least 1 frame called the `__BASE` frame. * This frame represents the entirety of the source image. * @@ -42675,12 +46373,12 @@ var Texture = new Class({ /** * The total number of Frames in this Texture, including the `__BASE` frame. - * + * * A Texture will always contain at least 1 frame because every Texture contains a `__BASE` frame by default, * in addition to any extra frames that have been added to it, such as when parsing a Sprite Sheet or Texture Atlas. * * @name Phaser.Textures.Texture#frameTotal - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -42697,14 +46395,14 @@ var Texture = new Class({ * Adds a new Frame to this Texture. * * A Frame is a rectangular region of a TextureSource with a unique index or string-based key. - * + * * The name given must be unique within this Texture. If it already exists, this method will return `null`. * * @method Phaser.Textures.Texture#add * @since 3.0.0 * - * @param {(integer|string)} name - The name of this Frame. The name is unique within the Texture. - * @param {integer} sourceIndex - The index of the TextureSource that this Frame is a part of. + * @param {(number|string)} name - The name of this Frame. The name is unique within the Texture. + * @param {number} sourceIndex - The index of the TextureSource that this Frame is a part of. * @param {number} x - The x coordinate of the top-left of this Frame. * @param {number} y - The y coordinate of the top-left of this Frame. * @param {number} width - The width of this Frame. @@ -42739,7 +46437,7 @@ var Texture = new Class({ /** * Removes the given Frame from this Texture. The Frame is destroyed immediately. - * + * * Any Game Objects using this Frame should stop using it _before_ you remove it, * as it does not happen automatically. * @@ -42791,7 +46489,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#get * @since 3.0.0 * - * @param {(string|integer)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. * * @return {Phaser.Textures.Frame} The Texture Frame. */ @@ -42826,7 +46524,7 @@ var Texture = new Class({ * * @param {Phaser.Textures.TextureSource} source - The TextureSource to check. * - * @return {integer} The index of the TextureSource within this Texture, or -1 if not in this Texture. + * @return {number} The index of the TextureSource within this Texture, or -1 if not in this Texture. */ getTextureSourceIndex: function (source) { @@ -42847,7 +46545,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#getFramesFromTextureSource * @since 3.0.0 * - * @param {integer} sourceIndex - The index of the TextureSource to get the Frames from. + * @param {number} sourceIndex - The index of the TextureSource to get the Frames from. * @param {boolean} [includeBase=false] - Include the `__BASE` Frame in the output array? * * @return {Phaser.Textures.Frame[]} An array of Texture Frames. @@ -42916,7 +46614,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#getSourceImage * @since 3.0.0 * - * @param {(string|integer)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. * * @return {(HTMLImageElement|HTMLCanvasElement|Phaser.GameObjects.RenderTexture)} The DOM Image, Canvas Element or Render Texture. */ @@ -42950,7 +46648,7 @@ var Texture = new Class({ * @method Phaser.Textures.Texture#getDataSourceImage * @since 3.7.0 * - * @param {(string|integer)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. * * @return {(HTMLImageElement|HTMLCanvasElement)} The DOM Image or Canvas Element. */ @@ -42995,7 +46693,7 @@ var Texture = new Class({ { data = [ data ]; } - + for (var i = 0; i < data.length; i++) { var source = this.source[i]; @@ -43075,7 +46773,7 @@ module.exports = Texture; /***/ }), -/* 193 */ +/* 198 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43084,7 +46782,7 @@ module.exports = Texture; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Returns all elements in the array. @@ -43103,8 +46801,8 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {string} [property] - The property to test on each array element. * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex] - An optional start index to search from. - * @param {integer} [endIndex] - An optional end index to search to. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * * @return {array} All matching elements from the array. */ @@ -43137,7 +46835,7 @@ module.exports = GetAll; /***/ }), -/* 194 */ +/* 199 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43152,46 +46850,46 @@ module.exports = GetAll; module.exports = { - Matrix: __webpack_require__(942), + Matrix: __webpack_require__(998), - Add: __webpack_require__(949), - AddAt: __webpack_require__(950), - BringToTop: __webpack_require__(951), - CountAllMatching: __webpack_require__(952), - Each: __webpack_require__(953), - EachInRange: __webpack_require__(954), - FindClosestInSorted: __webpack_require__(298), - GetAll: __webpack_require__(193), - GetFirst: __webpack_require__(395), - GetRandom: __webpack_require__(196), - MoveDown: __webpack_require__(955), - MoveTo: __webpack_require__(956), - MoveUp: __webpack_require__(957), - NumberArray: __webpack_require__(302), - NumberArrayStep: __webpack_require__(958), - QuickSelect: __webpack_require__(403), - Range: __webpack_require__(404), - Remove: __webpack_require__(96), - RemoveAt: __webpack_require__(959), - RemoveBetween: __webpack_require__(960), - RemoveRandomElement: __webpack_require__(961), - Replace: __webpack_require__(962), - RotateLeft: __webpack_require__(295), - RotateRight: __webpack_require__(296), - SafeRange: __webpack_require__(70), - SendToBack: __webpack_require__(963), - SetAll: __webpack_require__(964), - Shuffle: __webpack_require__(121), - SortByDigits: __webpack_require__(300), - SpliceOne: __webpack_require__(82), - StableSort: __webpack_require__(139), - Swap: __webpack_require__(965) + Add: __webpack_require__(1006), + AddAt: __webpack_require__(1007), + BringToTop: __webpack_require__(1008), + CountAllMatching: __webpack_require__(1009), + Each: __webpack_require__(1010), + EachInRange: __webpack_require__(1011), + FindClosestInSorted: __webpack_require__(310), + GetAll: __webpack_require__(198), + GetFirst: __webpack_require__(405), + GetRandom: __webpack_require__(201), + MoveDown: __webpack_require__(1012), + MoveTo: __webpack_require__(1013), + MoveUp: __webpack_require__(1014), + NumberArray: __webpack_require__(314), + NumberArrayStep: __webpack_require__(1015), + QuickSelect: __webpack_require__(413), + Range: __webpack_require__(414), + Remove: __webpack_require__(87), + RemoveAt: __webpack_require__(1016), + RemoveBetween: __webpack_require__(1017), + RemoveRandomElement: __webpack_require__(1018), + Replace: __webpack_require__(1019), + RotateLeft: __webpack_require__(170), + RotateRight: __webpack_require__(171), + SafeRange: __webpack_require__(77), + SendToBack: __webpack_require__(1020), + SetAll: __webpack_require__(1021), + Shuffle: __webpack_require__(127), + SortByDigits: __webpack_require__(312), + SpliceOne: __webpack_require__(103), + StableSort: __webpack_require__(90), + Swap: __webpack_require__(1022) }; /***/ }), -/* 195 */ +/* 200 */ /***/ (function(module, exports) { /** @@ -43203,22 +46901,23 @@ module.exports = { /** * Checks if an array can be used as a matrix. * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) have the same length. There must be at least two rows: + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: * * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] * ``` * * @function Phaser.Utils.Array.Matrix.CheckMatrix * @since 3.0.0 - * + * * @generic T * @genericUse {T[][]} - [matrix] * @@ -43252,7 +46951,7 @@ module.exports = CheckMatrix; /***/ }), -/* 196 */ +/* 201 */ /***/ (function(module, exports) { /** @@ -43268,8 +46967,8 @@ module.exports = CheckMatrix; * @since 3.0.0 * * @param {array} array - The array to select the random entry from. - * @param {integer} [startIndex=0] - An optional start index. - * @param {integer} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from. + * @param {number} [startIndex=0] - An optional start index. + * @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from. * * @return {*} A random element from the array, or `null` if no element could be found in the range given. */ @@ -43287,7 +46986,7 @@ module.exports = GetRandom; /***/ }), -/* 197 */ +/* 202 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43297,8 +46996,8 @@ module.exports = GetRandom; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(405); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(415); /** * @classdesc @@ -43374,7 +47073,7 @@ var ProcessQueue = new Class({ * The total number of items awaiting processing. * * @name Phaser.Structs.ProcessQueue#_toProcess - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -43556,7 +47255,7 @@ var ProcessQueue = new Class({ * The number of entries in the active list. * * @name Phaser.Structs.ProcessQueue#length - * @type {integer} + * @type {number} * @readonly * @since 3.20.0 */ @@ -43590,7 +47289,7 @@ module.exports = ProcessQueue; /***/ }), -/* 198 */ +/* 203 */ /***/ (function(module, exports) { /** @@ -43609,7 +47308,7 @@ module.exports = ProcessQueue; * @param {Node} node - The XML Node. * @param {string} attribute - The attribute to read. * - * @return {integer} The parsed value. + * @return {number} The parsed value. */ function getValue (node, attribute) { @@ -43625,8 +47324,8 @@ function getValue (node, attribute) * * @param {XMLDocument} xml - The XML Document to parse the font from. * @param {Phaser.Textures.Frame} frame - The texture frame to take into account when creating the uv data. - * @param {integer} [xSpacing=0] - The x-axis spacing to add between each letter. - * @param {integer} [ySpacing=0] - The y-axis spacing to add to the line height. + * @param {number} [xSpacing=0] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing=0] - The y-axis spacing to add to the line height. * @param {Phaser.Textures.Texture} [texture] - If provided, each glyph in the Bitmap Font will be added to this texture as a frame. * * @return {Phaser.Types.GameObjects.BitmapText.BitmapFontData} The parsed Bitmap Font data. @@ -43751,7 +47450,7 @@ module.exports = ParseXMLBitmapFont; /***/ }), -/* 199 */ +/* 204 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43760,19 +47459,19 @@ module.exports = ParseXMLBitmapFont; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlitterRender = __webpack_require__(975); -var Bob = __webpack_require__(407); +var BlitterRender = __webpack_require__(1032); +var Bob = __webpack_require__(417); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Frame = __webpack_require__(97); +var Frame = __webpack_require__(104); var GameObject = __webpack_require__(14); -var List = __webpack_require__(137); +var List = __webpack_require__(105); /** * @callback CreateCallback * * @param {Phaser.GameObjects.Bob} bob - The Bob that was created by the Blitter. - * @param {integer} index - The position of the Bob within the Blitter display list. + * @param {number} index - The position of the Bob within the Blitter display list. */ /** @@ -43812,7 +47511,7 @@ var List = __webpack_require__(137); * @param {number} [x=0] - The x coordinate of this Game Object in world space. * @param {number} [y=0] - The y coordinate of this Game Object in world space. * @param {string} [texture='__DEFAULT'] - The key of the texture this Game Object will use for rendering. The Texture must already exist in the Texture Manager. - * @param {(string|integer)} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet. + * @param {(string|number)} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet. */ var Blitter = new Class({ @@ -43886,9 +47585,9 @@ var Blitter = new Class({ * * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. - * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. * @param {boolean} [visible=true] - Should the created Bob render or not? - * @param {integer} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. + * @param {number} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. * * @return {Phaser.GameObjects.Bob} The newly created Bob object. */ @@ -43922,8 +47621,8 @@ var Blitter = new Class({ * @since 3.0.0 * * @param {CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. - * @param {integer} quantity - The quantity of Bob objects to create. - * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. + * @param {number} quantity - The quantity of Bob objects to create. + * @param {(string|number|Phaser.Textures.Frame|string[]|number[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. @@ -43953,8 +47652,8 @@ var Blitter = new Class({ * @method Phaser.GameObjects.Blitter#createMultiple * @since 3.0.0 * - * @param {integer} quantity - The quantity of Bob objects to create. - * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. + * @param {number} quantity - The quantity of Bob objects to create. + * @param {(string|number|Phaser.Textures.Frame|string[]|number[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {boolean} [visible=true] - Should the created Bob render or not? * * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. @@ -44050,7 +47749,7 @@ module.exports = Blitter; /***/ }), -/* 200 */ +/* 205 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -44060,16 +47759,15 @@ module.exports = Blitter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayUtils = __webpack_require__(194); -var BlendModes = __webpack_require__(54); +var ArrayUtils = __webpack_require__(199); +var BlendModes = __webpack_require__(48); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Events = __webpack_require__(29); +var Events = __webpack_require__(32); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); var Rectangle = __webpack_require__(9); -var Render = __webpack_require__(978); -var Union = __webpack_require__(408); +var Render = __webpack_require__(1035); +var Union = __webpack_require__(418); var Vector2 = __webpack_require__(3); /** @@ -44100,6 +47798,9 @@ var Vector2 = __webpack_require__(3); * Containers can be enabled for input. Because they do not have a texture you need to provide a shape for them * to use as their hit area. Container children can also be enabled for input, independent of the Container. * + * If input enabling a _child_ you should not set both the `origin` and a **negative** scale factor on the child, + * or the input area will become misaligned. + * * Containers can be given a physics body for either Arcade Physics, Impact Physics or Matter Physics. However, * if Container _children_ are enabled for physics you may get unexpected results, such as offset bodies, * if the Container itself, or any of its ancestors, is positioned anywhere other than at 0 x 0. Container children @@ -44123,6 +47824,7 @@ var Vector2 = __webpack_require__(3); * @extends Phaser.GameObjects.Components.ComputedSize * @extends Phaser.GameObjects.Components.Depth * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline * @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Visible * @@ -44141,6 +47843,7 @@ var Container = new Class({ Components.ComputedSize, Components.Depth, Components.Mask, + Components.Pipeline, Components.Transform, Components.Visible, Render @@ -44187,7 +47890,7 @@ var Container = new Class({ * the maximum limit the Container can grow in size to. * * @name Phaser.GameObjects.Container#maxSize - * @type {integer} + * @type {number} * @default -1 * @since 3.4.0 */ @@ -44197,7 +47900,7 @@ var Container = new Class({ * The cursor position. * * @name Phaser.GameObjects.Container#position - * @type {integer} + * @type {number} * @since 3.4.0 */ this.position = 0; @@ -44274,7 +47977,7 @@ var Container = new Class({ * @name Phaser.GameObjects.Container#scrollFactorX * @type {number} * @default 1 - * @since 3.0.0 + * @since 3.4.0 */ this.scrollFactorX = 1; @@ -44301,10 +48004,12 @@ var Container = new Class({ * @name Phaser.GameObjects.Container#scrollFactorY * @type {number} * @default 1 - * @since 3.0.0 + * @since 3.4.0 */ this.scrollFactorY = 1; + this.initPipeline(); + this.setPosition(x, y); this.clearAlpha(); @@ -44512,7 +48217,7 @@ var Container = new Class({ // Is only on the Display List via this Container if (!this.scene.sys.displayList.exists(gameObject)) { - gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); + gameObject.emit(Events.ADDED_TO_SCENE, gameObject, this.scene); } }, @@ -44537,7 +48242,7 @@ var Container = new Class({ // Is only on the Display List via this Container if (!this.scene.sys.displayList.exists(gameObject)) { - gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + gameObject.emit(Events.REMOVED_FROM_SCENE, gameObject, this.scene); } }, @@ -44623,7 +48328,7 @@ var Container = new Class({ * @since 3.4.0 * * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to add to the Container. - * @param {integer} [index=0] - The position to insert the Game Object/s at. + * @param {number} [index=0] - The position to insert the Game Object/s at. * * @return {this} This Container instance. */ @@ -44640,7 +48345,7 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#getAt * @since 3.4.0 * - * @param {integer} index - The position to get the Game Object from. + * @param {number} index - The position to get the Game Object from. * * @return {?Phaser.GameObjects.GameObject} The Game Object at the specified index, or `null` if none found. */ @@ -44657,7 +48362,7 @@ var Container = new Class({ * * @param {Phaser.GameObjects.GameObject} child - The Game Object to search for in this Container. * - * @return {integer} The index of the Game Object in this Container, or -1 if not found. + * @return {number} The index of the Game Object in this Container, or -1 if not found. */ getIndex: function (child) { @@ -44718,8 +48423,8 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#getRandom * @since 3.4.0 * - * @param {integer} [startIndex=0] - An optional start index. - * @param {integer} [length] - An optional length, the total number of elements (from the startIndex) to choose from. + * @param {number} [startIndex=0] - An optional start index. + * @param {number} [length] - An optional length, the total number of elements (from the startIndex) to choose from. * * @return {?Phaser.GameObjects.GameObject} A random child from the Container, or `null` if the Container is empty. */ @@ -44743,8 +48448,8 @@ var Container = new Class({ * * @param {string} property - The property to test on each Game Object in the Container. * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * * @return {?Phaser.GameObjects.GameObject} The first matching Game Object, or `null` if none was found. */ @@ -44773,8 +48478,8 @@ var Container = new Class({ * * @param {string} [property] - The property to test on each Game Object in the Container. * @param {any} [value] - If property is set then the `property` must strictly equal this value to be included in the results. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * * @return {Phaser.GameObjects.GameObject[]} An array of matching Game Objects from this Container. */ @@ -44796,10 +48501,10 @@ var Container = new Class({ * * @param {string} property - The property to check. * @param {any} value - The value to check. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * - * @return {integer} The total number of Game Objects in this Container with a property matching the given value. + * @return {number} The total number of Game Objects in this Container with a property matching the given value. */ count: function (property, value, startIndex, endIndex) { @@ -44837,7 +48542,7 @@ var Container = new Class({ * @since 3.4.0 * * @param {Phaser.GameObjects.GameObject} child - The Game Object to move. - * @param {integer} index - The new position of the Game Object in this Container. + * @param {number} index - The new position of the Game Object in this Container. * * @return {this} This Container instance. */ @@ -44891,7 +48596,7 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#removeAt * @since 3.4.0 * - * @param {integer} index - The index of the Game Object to be removed. + * @param {number} index - The index of the Game Object to be removed. * @param {boolean} [destroyChild=false] - Optionally call `destroy` on the Game Object if successfully removed from this Container. * * @return {this} This Container instance. @@ -44916,8 +48621,8 @@ var Container = new Class({ * @method Phaser.GameObjects.Container#removeBetween * @since 3.4.0 * - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each Game Object successfully removed from this Container. * * @return {this} This Container instance. @@ -45124,8 +48829,8 @@ var Container = new Class({ * * @param {string} property - The property that must exist on the Game Object. * @param {any} value - The value to get the property to. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) * * @return {this} This Container instance. */ @@ -45237,7 +48942,7 @@ var Container = new Class({ * them from physics bodies if not accounted for in your code. * * @method Phaser.GameObjects.Container#setScrollFactor - * @since 3.0.0 + * @since 3.4.0 * * @param {number} x - The horizontal scroll factor of this Game Object. * @param {number} [y=x] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. @@ -45266,7 +48971,7 @@ var Container = new Class({ * The number of Game Objects inside this Container. * * @name Phaser.GameObjects.Container#length - * @type {integer} + * @type {number} * @readonly * @since 3.4.0 */ @@ -45415,7 +49120,7 @@ module.exports = Container; /***/ }), -/* 201 */ +/* 206 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -45424,9 +49129,9 @@ module.exports = Container; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(140); +var BitmapText = __webpack_require__(144); var Class = __webpack_require__(0); -var Render = __webpack_require__(983); +var Render = __webpack_require__(1040); /** * @classdesc @@ -45468,7 +49173,7 @@ var Render = __webpack_require__(983); * @param {string} font - The key of the font to use from the Bitmap Font cache. * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. * @param {number} [size] - The font size of this Bitmap Text. - * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. */ var DynamicBitmapText = new Class({ @@ -45648,7 +49353,7 @@ module.exports = DynamicBitmapText; /***/ }), -/* 202 */ +/* 207 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -45657,26 +49362,24 @@ module.exports = DynamicBitmapText; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCamera = __webpack_require__(93); +var BaseCamera = __webpack_require__(99); var Class = __webpack_require__(0); -var Commands = __webpack_require__(203); -var ComponentsAlpha = __webpack_require__(280); -var ComponentsBlendMode = __webpack_require__(281); -var ComponentsDepth = __webpack_require__(282); -var ComponentsMask = __webpack_require__(286); -var ComponentsPipeline = __webpack_require__(165); -var ComponentsTransform = __webpack_require__(291); -var ComponentsVisible = __webpack_require__(292); -var ComponentsScrollFactor = __webpack_require__(289); - -var TransformMatrix = __webpack_require__(31); - -var Ellipse = __webpack_require__(98); +var Commands = __webpack_require__(208); +var ComponentsAlpha = __webpack_require__(295); +var ComponentsBlendMode = __webpack_require__(296); +var ComponentsDepth = __webpack_require__(297); +var ComponentsMask = __webpack_require__(301); +var ComponentsPipeline = __webpack_require__(166); +var ComponentsScrollFactor = __webpack_require__(304); +var ComponentsTransform = __webpack_require__(305); +var ComponentsVisible = __webpack_require__(306); +var Ellipse = __webpack_require__(106); var GameObject = __webpack_require__(14); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); var MATH_CONST = __webpack_require__(13); -var Render = __webpack_require__(989); +var PIPELINES_CONST = __webpack_require__(82); +var Render = __webpack_require__(1046); /** * @classdesc @@ -45763,7 +49466,7 @@ var Graphics = new Class({ GameObject.call(this, scene, 'Graphics'); this.setPosition(x, y); - this.initPipeline(); + this.initPipeline(PIPELINES_CONST.GRAPHICS_PIPELINE); /** * The horizontal display origin of the Graphics. @@ -45855,36 +49558,6 @@ var Graphics = new Class({ */ this._lineWidth = 1.0; - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.GameObjects.Graphics#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.17.0 - */ - this._tempMatrix1 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.GameObjects.Graphics#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.17.0 - */ - this._tempMatrix2 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.GameObjects.Graphics#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.17.0 - */ - this._tempMatrix3 = new TransformMatrix(); - this.setDefaultStyles(options); }, @@ -45988,21 +49661,28 @@ var Graphics = new Class({ * @webglOnly * @since 3.12.0 * - * @param {integer} topLeft - The tint being applied to the top-left of the Game Object. - * @param {integer} topRight - The tint being applied to the top-right of the Game Object. - * @param {integer} bottomLeft - The tint being applied to the bottom-left of the Game Object. - * @param {integer} bottomRight - The tint being applied to the bottom-right of the Game Object. - * @param {number} [alpha=1] - The fill alpha. + * @param {number} topLeft - The top left fill color. + * @param {number} topRight - The top right fill color. + * @param {number} bottomLeft - The bottom left fill color. + * @param {number} bottomRight - The bottom right fill color. Not used when filling triangles. + * @param {number} [alphaTopLeft=1] - The top left alpha value. If you give only this value, it's used for all corners. + * @param {number} [alphaTopRight=1] - The top right alpha value. + * @param {number} [alphaBottomLeft=1] - The bottom left alpha value. + * @param {number} [alphaBottomRight=1] - The bottom right alpha value. * * @return {this} This Game Object. */ - fillGradientStyle: function (topLeft, topRight, bottomLeft, bottomRight, alpha) + fillGradientStyle: function (topLeft, topRight, bottomLeft, bottomRight, alphaTopLeft, alphaTopRight, alphaBottomLeft, alphaBottomRight) { - if (alpha === undefined) { alpha = 1; } + if (alphaTopLeft === undefined) { alphaTopLeft = 1; } + if (alphaTopRight === undefined) { alphaTopRight = alphaTopLeft; } + if (alphaBottomLeft === undefined) { alphaBottomLeft = alphaTopLeft; } + if (alphaBottomRight === undefined) { alphaBottomRight = alphaTopLeft; } this.commandBuffer.push( Commands.GRADIENT_FILL_STYLE, - alpha, topLeft, topRight, bottomLeft, bottomRight + alphaTopLeft, alphaTopRight, alphaBottomLeft, alphaBottomRight, + topLeft, topRight, bottomLeft, bottomRight ); return this; @@ -46026,10 +49706,10 @@ var Graphics = new Class({ * @since 3.12.0 * * @param {number} lineWidth - The stroke width. - * @param {integer} topLeft - The tint being applied to the top-left of the Game Object. - * @param {integer} topRight - The tint being applied to the top-right of the Game Object. - * @param {integer} bottomLeft - The tint being applied to the bottom-left of the Game Object. - * @param {integer} bottomRight - The tint being applied to the bottom-right of the Game Object. + * @param {number} topLeft - The tint being applied to the top-left of the Game Object. + * @param {number} topRight - The tint being applied to the top-right of the Game Object. + * @param {number} bottomLeft - The tint being applied to the bottom-left of the Game Object. + * @param {number} bottomRight - The tint being applied to the bottom-right of the Game Object. * @param {number} [alpha=1] - The fill alpha. * * @return {this} This Game Object. @@ -46046,62 +49726,6 @@ var Graphics = new Class({ return this; }, - /** - * Sets the texture frame this Graphics Object will use when drawing all shapes defined after calling this. - * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. - * - * Once set, all shapes will use this texture. Call this method with no arguments to clear it. - * - * The textures are not tiled. They are stretched to the dimensions of the shapes being rendered. For this reason, - * it works best with seamless / tileable textures. - * - * The mode argument controls how the textures are combined with the fill colors. The default value (0) will - * multiply the texture by the fill color. A value of 1 will use just the fill color, but the alpha data from the texture, - * and a value of 2 will use just the texture and no fill color at all. - * - * @method Phaser.GameObjects.Graphics#setTexture - * @since 3.12.0 - * @webglOnly - * - * @param {string} [key] - The key of the texture to be used, as stored in the Texture Manager. Leave blank to clear a previously set texture. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. - * @param {number} [mode=0] - The texture tint mode. 0 is multiply, 1 is alpha only and 2 is texture only. - * - * @return {this} This Game Object. - */ - setTexture: function (key, frame, mode) - { - if (mode === undefined) { mode = 0; } - - if (key === undefined) - { - this.commandBuffer.push( - Commands.CLEAR_TEXTURE - ); - } - else - { - var textureFrame = this.scene.sys.textures.getFrame(key, frame); - - if (textureFrame) - { - if (mode === 2) - { - mode = 3; - } - - this.commandBuffer.push( - Commands.SET_TEXTURE, - textureFrame, - mode - ); - } - } - - return this; - }, - /** * Start a new shape path. * @@ -46457,12 +50081,16 @@ var Graphics = new Class({ this.beginPath(); this.moveTo(x + tl, y); this.lineTo(x + width - tr, y); + this.moveTo(x + width - tr, y); this.arc(x + width - tr, y + tr, tr, -MATH_CONST.TAU, 0); this.lineTo(x + width, y + height - br); + this.moveTo(x + width, y + height - br); this.arc(x + width - br, y + height - br, br, 0, MATH_CONST.TAU); this.lineTo(x + bl, y + height); + this.moveTo(x + bl, y + height); this.arc(x + bl, y + height - bl, bl, MATH_CONST.TAU, Math.PI); this.lineTo(x, y + tl); + this.moveTo(x, y + tl); this.arc(x + tl, y + tl, tl, -Math.PI, -MATH_CONST.TAU); this.strokePath(); @@ -46696,7 +50324,7 @@ var Graphics = new Class({ * @param {(array|Phaser.Geom.Point[])} points - The points to stroke. * @param {boolean} [closeShape=false] - When `true`, the shape is closed by joining the last point to the first point. * @param {boolean} [closePath=false] - When `true`, the path is closed before being stroked. - * @param {integer} [endIndex] - The index of `points` to stop drawing at. Defaults to `points.length`. + * @param {number} [endIndex] - The index of `points` to stop drawing at. Defaults to `points.length`. * * @return {this} This Game Object. */ @@ -46743,7 +50371,7 @@ var Graphics = new Class({ * @param {(array|Phaser.Geom.Point[])} points - The points to fill. * @param {boolean} [closeShape=false] - When `true`, the shape is closed by joining the last point to the first point. * @param {boolean} [closePath=false] - When `true`, the path is closed before being stroked. - * @param {integer} [endIndex] - The index of `points` to stop at. Defaults to `points.length`. + * @param {number} [endIndex] - The index of `points` to stop at. Defaults to `points.length`. * * @return {this} This Game Object. */ @@ -46784,7 +50412,7 @@ var Graphics = new Class({ * @since 3.0.0 * * @param {Phaser.Geom.Ellipse} ellipse - The ellipse to stroke. - * @param {integer} [smoothness=32] - The number of points to draw the ellipse with. + * @param {number} [smoothness=32] - The number of points to draw the ellipse with. * * @return {this} This Game Object. */ @@ -46807,7 +50435,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the center of the ellipse. * @param {number} width - The width of the ellipse. * @param {number} height - The height of the ellipse. - * @param {integer} [smoothness=32] - The number of points to draw the ellipse with. + * @param {number} [smoothness=32] - The number of points to draw the ellipse with. * * @return {this} This Game Object. */ @@ -46829,7 +50457,7 @@ var Graphics = new Class({ * @since 3.0.0 * * @param {Phaser.Geom.Ellipse} ellipse - The ellipse to fill. - * @param {integer} [smoothness=32] - The number of points to draw the ellipse with. + * @param {number} [smoothness=32] - The number of points to draw the ellipse with. * * @return {this} This Game Object. */ @@ -46852,7 +50480,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the center of the ellipse. * @param {number} width - The width of the ellipse. * @param {number} height - The height of the ellipse. - * @param {integer} [smoothness=32] - The number of points to draw the ellipse with. + * @param {number} [smoothness=32] - The number of points to draw the ellipse with. * * @return {this} This Game Object. */ @@ -47109,8 +50737,8 @@ var Graphics = new Class({ * @since 3.0.0 * * @param {(string|HTMLCanvasElement)} key - The key to store the texture with in the Texture Manager, or a Canvas to draw to. - * @param {integer} [width] - The width of the graphics to generate. - * @param {integer} [height] - The height of the graphics to generate. + * @param {number} [width] - The width of the graphics to generate. + * @param {number} [height] - The height of the graphics to generate. * * @return {this} This Game Object. */ @@ -47163,8 +50791,8 @@ var Graphics = new Class({ if (ctx) { - // var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix, renderTargetCtx, allowClip) - this.renderCanvas(renderer, this, 0, Graphics.TargetCamera, null, ctx, false); + // var GraphicsCanvasRenderer = function (renderer, src, camera, parentMatrix, renderTargetCtx, allowClip) + this.renderCanvas(renderer, this, Graphics.TargetCamera, null, ctx, false); if (texture) { @@ -47202,7 +50830,7 @@ module.exports = Graphics; /***/ }), -/* 203 */ +/* 208 */ /***/ (function(module, exports) { /** @@ -47230,8 +50858,6 @@ module.exports = { TRANSLATE: 16, SCALE: 17, ROTATE: 18, - SET_TEXTURE: 19, - CLEAR_TEXTURE: 20, GRADIENT_FILL_STYLE: 21, GRADIENT_LINE_STYLE: 22 @@ -47239,7 +50865,7 @@ module.exports = { /***/ }), -/* 204 */ +/* 209 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -47281,7 +50907,763 @@ module.exports = CircumferencePoint; /***/ }), -/* 205 */ +/* 210 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BlendModes = __webpack_require__(48); +var Class = __webpack_require__(0); +var Components = __webpack_require__(11); +var ComponentsToJSON = __webpack_require__(168); +var DataManager = __webpack_require__(97); +var EventEmitter = __webpack_require__(10); +var GameObjectEvents = __webpack_require__(32); +var List = __webpack_require__(105); +var Render = __webpack_require__(1054); +var SceneEvents = __webpack_require__(20); +var StableSort = __webpack_require__(90); + +/** + * @classdesc + * A Layer Game Object. + * + * A Layer is a special type of Game Object that acts as a Display List. You can add any type of Game Object + * to a Layer, just as you would to a Scene. Layers can be used to visually group together 'layers' of Game + * Objects: + * + * ```javascript + * const spaceman = this.add.sprite(150, 300, 'spaceman'); + * const bunny = this.add.sprite(400, 300, 'bunny'); + * const elephant = this.add.sprite(650, 300, 'elephant'); + * + * const layer = this.add.layer(); + * + * layer.add([ spaceman, bunny, elephant ]); + * ``` + * + * The 3 sprites in the example above will now be managed by the Layer they were added to. Therefore, + * if you then set `layer.setVisible(false)` they would all vanish from the display. + * + * You can also control the depth of the Game Objects within the Layer. For example, calling the + * `setDepth` method of a child of a Layer will allow you to adjust the depth of that child _within the + * Layer itself_, rather than the whole Scene. The Layer, too, can have its depth set as well. + * + * The Layer class also offers many different methods for manipulating the list, such as the + * methods `moveUp`, `moveDown`, `sendToBack`, `bringToTop` and so on. These allow you to change the + * display list position of the Layers children, causing it to adjust the order in which they are + * rendered. Using `setDepth` on a child allows you to override this. + * + * Layers can have Post FX Pipelines set, which allows you to easily enable a post pipeline across + * a whole range of children, which, depending on the effect, can often be far more efficient that doing so + * on a per-child basis. + * + * Layers have no position or size within the Scene. This means you cannot enable a Layer for + * physics or input, or change the position, rotation or scale of a Layer. They also have no scroll + * factor, texture, tint, origin, crop or bounds. + * + * If you need those kind of features then you should use a Container instead. Containers can be added + * to Layers, but Layers cannot be added to Containers. + * + * However, you can set the Alpha, Blend Mode, Depth, Mask and Visible state of a Layer. These settings + * will impact all children being rendered by the Layer. + * + * @class Layer + * @extends Phaser.Structs.List. + * @memberof Phaser.GameObjects + * @constructor + * @since 3.50.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Layer. + */ +var Layer = new Class({ + + Extends: List, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.Mask, + Components.Pipeline, + Components.Visible, + EventEmitter, + Render + ], + + initialize: + + function Layer (scene, children) + { + List.call(this, scene); + EventEmitter.call(this); + + /** + * A reference to the Scene to which this Game Object belongs. + * + * Game Objects can only belong to one Scene. + * + * You should consider this property as being read-only. You cannot move a + * Game Object to another Scene by simply changing it. + * + * @name Phaser.GameObjects.Layer#scene + * @type {Phaser.Scene} + * @since 3.50.0 + */ + this.scene = scene; + + /** + * Holds a reference to the Display List that contains this Game Object. + * + * This is set automatically when this Game Object is added to a Scene or Layer. + * + * You should treat this property as being read-only. + * + * @name Phaser.GameObjects.Layer#displayList + * @type {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} + * @default null + * @since 3.50.0 + */ + this.displayList = null; + + /** + * A textual representation of this Game Object, i.e. `sprite`. + * Used internally by Phaser but is available for your own custom classes to populate. + * + * @name Phaser.GameObjects.Layer#type + * @type {string} + * @since 3.50.0 + */ + this.type = 'Layer'; + + /** + * The current state of this Game Object. + * + * Phaser itself will never modify this value, although plugins may do so. + * + * Use this property to track the state of a Game Object during its lifetime. For example, it could change from + * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant + * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @name Phaser.GameObjects.Layer#state + * @type {(number|string)} + * @since 3.50.0 + */ + this.state = 0; + + /** + * The name of this Game Object. + * Empty by default and never populated by Phaser, this is left for developers to use. + * + * @name Phaser.GameObjects.Layer#name + * @type {string} + * @default '' + * @since 3.50.0 + */ + this.name = ''; + + /** + * The active state of this Game Object. + * A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it. + * An active object is one which is having its logic and internal systems updated. + * + * @name Phaser.GameObjects.Layer#active + * @type {boolean} + * @default true + * @since 3.50.0 + */ + this.active = true; + + /** + * A Data Manager. + * It allows you to store, query and get key/value paired information specific to this Game Object. + * `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`. + * + * @name Phaser.GameObjects.Layer#data + * @type {Phaser.Data.DataManager} + * @default null + * @since 3.50.0 + */ + this.data = null; + + /** + * The flags that are compared against `RENDER_MASK` to determine if this Game Object will render or not. + * The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively. + * If those components are not used by your custom class then you can use this bitmask as you wish. + * + * @name Phaser.GameObjects.Layer#renderFlags + * @type {number} + * @default 15 + * @since 3.50.0 + */ + this.renderFlags = 15; + + /** + * A bitmask that controls if this Game Object is drawn by a Camera or not. + * Not usually set directly, instead call `Camera.ignore`, however you can + * set this property directly using the Camera.id property: + * + * @example + * this.cameraFilter |= camera.id + * + * @name Phaser.GameObjects.Layer#cameraFilter + * @type {number} + * @default 0 + * @since 3.50.0 + */ + this.cameraFilter = 0; + + /** + * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`. + * This includes calls that may come from a Group, Container or the Scene itself. + * While it allows you to persist a Game Object across Scenes, please understand you are entirely + * responsible for managing references to and from this Game Object. + * + * @name Phaser.GameObjects.Layer#ignoreDestroy + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.ignoreDestroy = false; + + /** + * A reference to the Scene Systems. + * + * @name Phaser.GameObjects.Layer#systems + * @type {Phaser.Scenes.Systems} + * @since 3.50.0 + */ + this.systems = scene.sys; + + /** + * A reference to the Scene Event Emitter. + * + * @name Phaser.GameObjects.Layer#events + * @type {Phaser.Events.EventEmitter} + * @since 3.50.0 + */ + this.events = scene.sys.events; + + /** + * The flag the determines whether Game Objects should be sorted when `depthSort()` is called. + * + * @name Phaser.GameObjects.Layer#sortChildrenFlag + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.sortChildrenFlag = false; + + // Set the List callbacks + this.addCallback = this.addChildCallback; + this.removeCallback = this.removeChildCallback; + + this.initPipeline(); + + this.clearAlpha(); + + this.setBlendMode(BlendModes.SKIP_CHECK); + + if (children) + { + this.add(children); + } + + // Tell the Scene to re-sort the children + scene.sys.queueDepthSort(); + }, + + /** + * Sets the `active` property of this Game Object and returns this Game Object for further chaining. + * A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList. + * + * @method Phaser.GameObjects.Layer#setActive + * @since 3.50.0 + * + * @param {boolean} value - True if this Game Object should be set as active, false if not. + * + * @return {this} This GameObject. + */ + setActive: function (value) + { + this.active = value; + + return this; + }, + + /** + * Sets the `name` property of this Game Object and returns this Game Object for further chaining. + * The `name` property is not populated by Phaser and is presented for your own use. + * + * @method Phaser.GameObjects.Layer#setName + * @since 3.50.0 + * + * @param {string} value - The name to be given to this Game Object. + * + * @return {this} This GameObject. + */ + setName: function (value) + { + this.name = value; + + return this; + }, + + /** + * Sets the current state of this Game Object. + * + * Phaser itself will never modify the State of a Game Object, although plugins may do so. + * + * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. + * The state value should typically be an integer (ideally mapped to a constant + * in your game code), but could also be a string. It is recommended to keep it light and simple. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @method Phaser.GameObjects.Layer#setState + * @since 3.50.0 + * + * @param {(number|string)} value - The state of the Game Object. + * + * @return {this} This GameObject. + */ + setState: function (value) + { + this.state = value; + + return this; + }, + + /** + * Adds a Data Manager component to this Game Object. + * + * @method Phaser.GameObjects.Layer#setDataEnabled + * @since 3.50.0 + * @see Phaser.Data.DataManager + * + * @return {this} This GameObject. + */ + setDataEnabled: function () + { + if (!this.data) + { + this.data = new DataManager(this); + } + + return this; + }, + + /** + * Allows you to store a key value pair within this Game Objects Data Manager. + * + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. + * + * If the key doesn't already exist in the Data Manager then it is created. + * + * ```javascript + * sprite.setData('name', 'Red Gem Stone'); + * ``` + * + * You can also pass in an object of key value pairs as the first argument: + * + * ```javascript + * sprite.setData({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); + * ``` + * + * To get a value back again you can call `getData`: + * + * ```javascript + * sprite.getData('gold'); + * ``` + * + * Or you can access the value directly via the `values` property, where it works like any other variable: + * + * ```javascript + * sprite.data.values.gold += 50; + * ``` + * + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. + * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. + * + * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.GameObjects.Layer#setData + * @since 3.50.0 + * + * @param {(string|object)} key - The key to set the value for. Or an object of key value pairs. If an object the `data` argument is ignored. + * @param {*} [data] - The value to set for the given key. If an object is provided as the key this argument is ignored. + * + * @return {this} This GameObject. + */ + setData: function (key, value) + { + if (!this.data) + { + this.data = new DataManager(this); + } + + this.data.set(key, value); + + return this; + }, + + /** + * Increase a value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is increased from 0. + * + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. + * + * If the key doesn't already exist in the Data Manager then it is created. + * + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * @method Phaser.GameObjects.Layer#incData + * @since 3.50.0 + * + * @param {(string|object)} key - The key to increase the value for. + * @param {*} [data] - The value to increase for the given key. + * + * @return {this} This GameObject. + */ + incData: function (key, value) + { + if (!this.data) + { + this.data = new DataManager(this); + } + + this.data.inc(key, value); + + return this; + }, + + /** + * Toggle a boolean value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is toggled from false. + * + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. + * + * If the key doesn't already exist in the Data Manager then it is created. + * + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * @method Phaser.GameObjects.Layer#toggleData + * @since 3.50.0 + * + * @param {(string|object)} key - The key to toggle the value for. + * + * @return {this} This GameObject. + */ + toggleData: function (key) + { + if (!this.data) + { + this.data = new DataManager(this); + } + + this.data.toggle(key); + + return this; + }, + + /** + * Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist. + * + * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: + * + * ```javascript + * sprite.getData('gold'); + * ``` + * + * Or access the value directly: + * + * ```javascript + * sprite.data.values.gold; + * ``` + * + * You can also pass in an array of keys, in which case an array of values will be returned: + * + * ```javascript + * sprite.getData([ 'gold', 'armor', 'health' ]); + * ``` + * + * This approach is useful for destructuring arrays in ES6. + * + * @method Phaser.GameObjects.Layer#getData + * @since 3.50.0 + * + * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. + * + * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. + */ + getData: function (key) + { + if (!this.data) + { + this.data = new DataManager(this); + } + + return this.data.get(key); + }, + + /** + * This callback is invoked when this Game Object is added to a Scene. + * + * Can be overriden by custom Game Objects, but be aware of some Game Objects that + * will use this, such as Sprites, to add themselves into the Update List. + * + * You can also listen for the `ADDED_TO_SCENE` event from this Game Object. + * + * @method Phaser.GameObjects.Layer#addedToScene + * @since 3.50.0 + */ + addedToScene: function () + { + }, + + /** + * This callback is invoked when this Game Object is removed from a Scene. + * + * Can be overriden by custom Game Objects, but be aware of some Game Objects that + * will use this, such as Sprites, to removed themselves from the Update List. + * + * You can also listen for the `REMOVED_FROM_SCENE` event from this Game Object. + * + * @method Phaser.GameObjects.Layer#removedFromScene + * @since 3.50.0 + */ + removedFromScene: function () + { + }, + + /** + * To be overridden by custom GameObjects. Allows base objects to be used in a Pool. + * + * @method Phaser.GameObjects.Layer#update + * @since 3.50.0 + * + * @param {...*} [args] - args + */ + update: function () + { + }, + + /** + * Returns a JSON representation of the Game Object. + * + * @method Phaser.GameObjects.Layer#toJSON + * @since 3.50.0 + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. + */ + toJSON: function () + { + return ComponentsToJSON(this); + }, + + /** + * Compares the renderMask with the renderFlags to see if this Game Object will render or not. + * Also checks the Game Object against the given Cameras exclusion list. + * + * @method Phaser.GameObjects.Layer#willRender + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. + * + * @return {boolean} True if the Game Object should be rendered, otherwise false. + */ + willRender: function (camera) + { + return !(this.renderFlags !== 15 || this.list.length === 0 || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); + }, + + /** + * Internal method called from `List.addCallback`. + * + * @method Phaser.GameObjects.Layer#addChildCallback + * @private + * @fires Phaser.Scenes.Events#ADDED_TO_SCENE + * @fires Phaser.GameObjects.Events#ADDED_TO_SCENE + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the list. + */ + addChildCallback: function (gameObject) + { + gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); + + if (gameObject.displayList) + { + gameObject.displayList.remove(gameObject); + } + + gameObject.displayList = this; + + this.queueDepthSort(); + + this.events.emit(SceneEvents.ADDED_TO_SCENE, gameObject, this.scene); + }, + + /** + * Internal method called from `List.removeCallback`. + * + * @method Phaser.GameObjects.Layer#removeChildCallback + * @private + * @fires Phaser.Scenes.Events#REMOVED_FROM_SCENE + * @fires Phaser.GameObjects.Events#REMOVED_FROM_SCENE + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the list. + */ + removeChildCallback: function (gameObject) + { + gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + + gameObject.displayList = null; + + this.queueDepthSort(); + + this.events.emit(SceneEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + }, + + /** + * Force a sort of the display list on the next call to depthSort. + * + * @method Phaser.GameObjects.Layer#queueDepthSort + * @since 3.50.0 + */ + queueDepthSort: function () + { + this.sortChildrenFlag = true; + }, + + /** + * Immediately sorts the display list if the flag is set. + * + * @method Phaser.GameObjects.Layer#depthSort + * @since 3.50.0 + */ + depthSort: function () + { + if (this.sortChildrenFlag) + { + StableSort(this.list, this.sortByDepth); + + this.sortChildrenFlag = false; + } + }, + + /** + * Compare the depth of two Game Objects. + * + * @method Phaser.GameObjects.Layer#sortByDepth + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} childA - The first Game Object. + * @param {Phaser.GameObjects.GameObject} childB - The second Game Object. + * + * @return {number} The difference between the depths of each Game Object. + */ + sortByDepth: function (childA, childB) + { + return childA._depth - childB._depth; + }, + + /** + * Returns an array which contains all Game Objects within this Layer. + * + * This is a reference to the main list array, not a copy of it, so be careful not to modify it. + * + * @method Phaser.GameObjects.Layer#getChildren + * @since 3.50.0 + * + * @return {Phaser.GameObjects.GameObject[]} The group members. + */ + getChildren: function () + { + return this.list; + }, + + /** + * Destroys this Game Object removing it from the Display List and Update List and + * severing all ties to parent resources. + * + * Use this to remove a Game Object from your game if you don't ever plan to use it again. + * As long as no reference to it exists within your own code it should become free for + * garbage collection by the browser. + * + * If you just want to temporarily disable an object then look at using the + * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. + * + * @method Phaser.GameObjects.Layer#destroy + * @fires Phaser.GameObjects.Events#DESTROY + * @since 3.50.0 + * + * @param {boolean} [fromScene=false] - Is this Game Object being destroyed as the result of a Scene shutdown? + */ + destroy: function (fromScene) + { + if (fromScene === undefined) { fromScene = false; } + + // This Game Object has already been destroyed + if (!this.scene || this.ignoreDestroy) + { + return; + } + + this.removeAll(); + this.removeAllListeners(); + this.resetPostPipeline(true); + + this.emit(GameObjectEvents.DESTROY, this); + + if (!fromScene && this.displayList) + { + this.displayList.remove(this); + this.displayList.queueDepthSort(); + } + + if (this.data) + { + this.data.destroy(); + + this.data = undefined; + } + + this.active = false; + this.visible = false; + + this.scene = undefined; + this.displayList = undefined; + this.systems = undefined; + this.events = undefined; + } + +}); + +module.exports = Layer; + + +/***/ }), +/* 211 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -47293,11 +51675,11 @@ module.exports = CircumferencePoint; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); -var GravityWell = __webpack_require__(417); -var List = __webpack_require__(137); -var ParticleEmitter = __webpack_require__(419); -var Render = __webpack_require__(998); +var GameObjectEvents = __webpack_require__(32); +var GravityWell = __webpack_require__(427); +var List = __webpack_require__(105); +var ParticleEmitter = __webpack_require__(429); +var Render = __webpack_require__(1058); /** * @classdesc @@ -47317,7 +51699,7 @@ var Render = __webpack_require__(998); * * @param {Phaser.Scene} scene - The Scene to which this Emitter Manager belongs. * @param {string} texture - The key of the Texture this Emitter Manager will use to render particles, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Emitter Manager will use to render particles. + * @param {(string|number)} [frame] - An optional frame from the Texture this Emitter Manager will use to render particles. * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig|Phaser.Types.GameObjects.Particles.ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. */ var ParticleEmitterManager = new Class({ @@ -47344,7 +51726,7 @@ var ParticleEmitterManager = new Class({ * The blend mode applied to all emitters and particles. * * @name Phaser.GameObjects.Particles.ParticleEmitterManager#blendMode - * @type {integer} + * @type {number} * @default -1 * @private * @since 3.0.0 @@ -47460,7 +51842,7 @@ var ParticleEmitterManager = new Class({ * @since 3.0.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Emitter Manager. */ @@ -47481,7 +51863,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setFrame * @since 3.0.0 * - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Emitter Manager. */ @@ -47630,7 +52012,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#emitParticle * @since 3.0.0 * - * @param {integer} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. + * @param {number} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. * @param {number} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location. * @param {number} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location. * @@ -47661,7 +52043,7 @@ var ParticleEmitterManager = new Class({ * * @param {number} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location. * @param {number} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location. - * @param {integer} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. + * @param {number} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. * * @return {this} This Emitter Manager. */ @@ -47723,7 +52105,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#preUpdate * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ preUpdate: function (time, delta) @@ -47786,7 +52168,7 @@ module.exports = ParticleEmitterManager; /***/ }), -/* 206 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -47795,19 +52177,20 @@ module.exports = ParticleEmitterManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(54); -var Camera = __webpack_require__(93); -var CanvasPool = __webpack_require__(26); +var BlendModes = __webpack_require__(48); +var Camera = __webpack_require__(99); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var CONST = __webpack_require__(34); -var Frame = __webpack_require__(97); +var CONST = __webpack_require__(39); +var Frame = __webpack_require__(104); var GameObject = __webpack_require__(14); var NOOP = __webpack_require__(1); -var ProjectOrtho = __webpack_require__(185); -var Render = __webpack_require__(1002); -var Utils = __webpack_require__(10); -var UUID = __webpack_require__(207); +var PIPELINE_CONST = __webpack_require__(82); +var Render = __webpack_require__(1062); +var RenderTarget = __webpack_require__(263); +var Utils = __webpack_require__(12); +var UUID = __webpack_require__(213); /** * @classdesc @@ -47846,8 +52229,8 @@ var UUID = __webpack_require__(207); * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. * @param {number} [x=0] - The horizontal position of this Game Object in the world. * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {integer} [width=32] - The width of the Render Texture. - * @param {integer} [height=32] - The height of the Render Texture. + * @param {number} [width=32] - The width of the Render Texture. + * @param {number} [height=32] - The height of the Render Texture. * @property {string} [key] - The texture key to make the RenderTexture from. * @property {string} [frame] - the frame to make the RenderTexture from. */ @@ -47891,7 +52274,7 @@ var RenderTexture = new Class({ * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} * @since 3.2.0 */ - this.renderer = scene.sys.game.renderer; + this.renderer = scene.sys.renderer; /** * A reference to the Texture Manager. @@ -47931,16 +52314,6 @@ var RenderTexture = new Class({ */ this.canvas = null; - /** - * A reference to the GL Frame Buffer this Render Texture is drawing to. - * This is only set if Phaser is running with the WebGL Renderer. - * - * @name Phaser.GameObjects.RenderTexture#framebuffer - * @type {?WebGLFramebuffer} - * @since 3.2.0 - */ - this.framebuffer = null; - /** * Is this Render Texture dirty or not? If not it won't spend time clearing or filling itself. * @@ -48045,25 +52418,17 @@ var RenderTexture = new Class({ this.camera = new Camera(0, 0, width, height); /** - * A reference to the WebGL Rendering Context. + * The Render Target that belongs to this Render Texture. * - * @name Phaser.GameObjects.RenderTexture#gl - * @type {WebGLRenderingContext} - * @default null - * @since 3.0.0 - */ - this.gl = null; - - /** - * A reference to the WebGLTexture that is being rendered to in a WebGL Context. + * A Render Target encapsulates a framebuffer and texture for the WebGL Renderer. * - * @name Phaser.GameObjects.RenderTexture#glTexture - * @type {WebGLTexture} - * @default null - * @readonly - * @since 3.19.0 + * This property remains `null` under Canvas. + * + * @name Phaser.GameObjects.RenderTexture#renderTarget + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 */ - this.glTexture = null; + this.renderTarget = null; var renderer = this.renderer; @@ -48073,12 +52438,9 @@ var RenderTexture = new Class({ } else if (renderer.type === CONST.WEBGL) { - var gl = renderer.gl; - - this.gl = gl; - this.glTexture = this.frame.source.glTexture; this.drawGameObject = this.batchGameObjectWebGL; - this.framebuffer = renderer.createFramebuffer(width, height, this.glTexture, false); + + this.renderTarget = new RenderTarget(renderer, width, height, 1, 0, false); } else if (renderer.type === CONST.CANVAS) { @@ -48095,7 +52457,8 @@ var RenderTexture = new Class({ } this.setOrigin(0, 0); - this.initPipeline(); + + this.initPipeline(PIPELINE_CONST.SINGLE_PIPELINE); }, /** @@ -48121,8 +52484,10 @@ var RenderTexture = new Class({ * texture will not change. * * If Render Texture was not created from specific frame, the following will happen: + * * In WebGL it will destroy and then re-create the frame buffer being used by the Render Texture. * In Canvas it will resize the underlying canvas element. + * * Both approaches will erase everything currently drawn to the Render Texture. * * If the dimensions given are the same as those already being used, calling this method will do nothing. @@ -48140,7 +52505,6 @@ var RenderTexture = new Class({ if (height === undefined) { height = width; } var frame = this.frame; - var renderer = this.renderer; if (width !== this.width || height !== this.height) { @@ -48154,30 +52518,48 @@ var RenderTexture = new Class({ this.texture.width = width; this.texture.height = height; - if (this.gl) + var renderTarget = this.renderTarget; + + if (renderTarget) { - var gl = this.gl; + renderTarget.resize(width, height); - renderer.deleteTexture(frame.source.glTexture); - renderer.deleteFramebuffer(this.framebuffer); - - var glTexture = renderer.createTexture2D(0, gl.NEAREST, gl.NEAREST, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE, gl.RGBA, null, width, height, false); - - this.framebuffer = renderer.createFramebuffer(width, height, glTexture, false); + frame.glTexture = renderTarget.texture; frame.source.isRenderTexture = true; - - frame.source.glTexture = glTexture; - - frame.glTexture = glTexture; - - this.glTexture = glTexture; + frame.source.isGLTexture = true; + frame.source.glTexture = renderTarget.texture; } + var camera = this.camera; + frame.source.width = width; frame.source.height = height; - this.camera.setSize(width, height); + var renderer = this.renderer; + var rendererWidth = renderer.width; + var rendererHeight = renderer.height; + + var zoomX = rendererWidth / width; + var zoomY = rendererHeight / height; + + camera.setSize(width, height); + camera.setZoom(zoomX, zoomY); + + var ox = 0.5; + var oy = 0.5; + + if (width !== rendererWidth) + { + ox = 0; + } + + if (height !== rendererHeight) + { + oy = 0; + } + + camera.setOrigin(ox, oy); frame.setSize(width, height); @@ -48223,7 +52605,7 @@ var RenderTexture = new Class({ * @method Phaser.GameObjects.RenderTexture#setGlobalTint * @since 3.2.0 * - * @param {integer} tint - The tint value. + * @param {number} tint - The tint value. * * @return {this} This Render Texture. */ @@ -48308,9 +52690,7 @@ var RenderTexture = new Class({ */ fill: function (rgb, alpha, x, y, width, height) { - var gl = this.gl; var frame = this.frame; - var texture = this.texture; var camera = this.camera; var renderer = this.renderer; @@ -48320,47 +52700,38 @@ var RenderTexture = new Class({ if (width === undefined) { width = frame.cutWidth; } if (height === undefined) { height = frame.cutHeight; } - var r = ((rgb >> 16) | 0) & 0xff; - var g = ((rgb >> 8) | 0) & 0xff; - var b = (rgb | 0) & 0xff; + var r = (rgb >> 16 & 0xFF) / 255; + var g = (rgb >> 8 & 0xFF) / 255; + var b = (rgb & 0xFF) / 255; - camera.preRender(1, 1); + var renderTarget = this.renderTarget; - if (gl) + camera.preRender(); + + if (renderTarget) { - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; - - renderer.resetTextures(true); - - renderer.pushScissor(cx, cy, cw, -ch); - - renderer.setFramebuffer(this.framebuffer, false); + renderTarget.bind(true); var pipeline = this.pipeline; - var tw = texture.width; - var th = texture.height; + pipeline.manager.set(pipeline); - var rw = pipeline.width; - var rh = pipeline.height; + var tw = renderTarget.width; + var th = renderTarget.height; + + var rw = renderer.width; + var rh = renderer.height; var sx = rw / tw; var sy = rh / th; pipeline.drawFillRect( - x * sx, (th - height - y) * sy, width * sx, height * sy, - Utils.getTintFromFloats(r / 255, g / 255, b / 255, 1), + x * sx, y * sy, width * sx, height * sy, + Utils.getTintFromFloats(b, g, r, 1), alpha ); - pipeline.flush(); - - renderer.setFramebuffer(null, false); - - renderer.popScissor(); + renderTarget.unbind(true); } else { @@ -48391,23 +52762,11 @@ var RenderTexture = new Class({ { if (this.dirty) { - var gl = this.gl; + var renderTarget = this.renderTarget; - if (gl) + if (renderTarget) { - var renderer = this.renderer; - - renderer.setFramebuffer(this.framebuffer, true); - - if (this.frame.cutWidth !== this.canvas.width || this.frame.cutHeight !== this.canvas.height) - { - gl.scissor(this.frame.cutX, this.frame.cutY, this.frame.cutWidth, this.frame.cutHeight); - } - - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - - renderer.setFramebuffer(null, true); + renderTarget.clear(); } else { @@ -48559,37 +52918,21 @@ var RenderTexture = new Class({ entries = [ entries ]; } - var gl = this.gl; var camera = this.camera; var renderer = this.renderer; + var renderTarget = this.renderTarget; - camera.preRender(1, 1); + camera.preRender(); - if (gl) + if (renderTarget) { - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; + renderTarget.bind(true); renderer.resetTextures(true); - renderer.setFramebuffer(this.framebuffer, false); - - renderer.pushScissor(cx, cy, cw, ch, ch); - - var pipeline = this.pipeline; - - ProjectOrtho(pipeline, 0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0); - this.batchList(entries, x, y, alpha, tint); - // Causes a flush + popScissor - renderer.setFramebuffer(null, true); - - renderer.resetTextures(true); - - ProjectOrtho(pipeline, 0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); + renderTarget.unbind(true); } else { @@ -48627,7 +52970,7 @@ var RenderTexture = new Class({ * @since 3.12.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * @param {number} [x=0] - The x position to draw the frame at. * @param {number} [y=0] - The y position to draw the frame at. * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property. @@ -48650,41 +52993,21 @@ var RenderTexture = new Class({ tint = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16); } - var gl = this.gl; var camera = this.camera; - var renderer = this.renderer; + var renderTarget = this.renderTarget; var textureFrame = this.textureManager.getFrame(key, frame); if (textureFrame) { - camera.preRender(1, 1); + camera.preRender(); - if (gl) + if (renderTarget) { - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; + renderTarget.bind(true); - renderer.resetTextures(true); + this.pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, camera.matrix, null); - renderer.setFramebuffer(this.framebuffer, false); - - renderer.pushScissor(cx, cy, cw, ch, ch); - - var pipeline = this.pipeline; - - ProjectOrtho(pipeline, 0, this.texture.width, 0, this.texture.height, -1000.0, 1000.0); - - pipeline.batchTextureFrame(textureFrame, x + this.frame.cutX, y + this.frame.cutY, tint, alpha, camera.matrix, null); - - pipeline.flush(); - - renderer.setFramebuffer(null, false); - - renderer.popScissor(); - - ProjectOrtho(pipeline, 0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0); + renderTarget.unbind(true); } else { @@ -48750,7 +53073,7 @@ var RenderTexture = new Class({ }, /** - * Internal method that handles the drawing a Phaser Group contents. + * Internal method that handles drawing a Phaser Group contents. * * @method Phaser.GameObjects.RenderTexture#batchGroup * @private @@ -48772,7 +53095,7 @@ var RenderTexture = new Class({ { var entry = children[i]; - if (entry.willRender()) + if (entry.willRender(this.camera)) { var tx = entry.x + x; var ty = entry.y + y; @@ -48808,7 +53131,7 @@ var RenderTexture = new Class({ gameObject.setPosition(x + this.frame.cutX, y + this.frame.cutY); - gameObject.renderWebGL(this.renderer, gameObject, 0, this.camera, null); + gameObject.renderWebGL(this.renderer, gameObject, this.camera); gameObject.setPosition(prevX, prevY); }, @@ -48841,7 +53164,7 @@ var RenderTexture = new Class({ gameObject.setPosition(x + this.frame.cutX, y + this.frame.cutY); - gameObject.renderCanvas(this.renderer, gameObject, 0, this.camera, null); + gameObject.renderCanvas(this.renderer, gameObject, this.camera, null); gameObject.setPosition(prevX, prevY); @@ -48859,7 +53182,7 @@ var RenderTexture = new Class({ * @since 3.12.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * @param {number} [x=0] - The x position to offset the Game Object by. * @param {number} [y=0] - The y position to offset the Game Object by. * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property. @@ -48895,7 +53218,9 @@ var RenderTexture = new Class({ x += this.frame.cutX; y += this.frame.cutY; - if (this.gl) + var renderTarget = this.renderTarget; + + if (renderTarget) { this.pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, this.camera.matrix, null); } @@ -48930,10 +53255,10 @@ var RenderTexture = new Class({ * @method Phaser.GameObjects.RenderTexture#snapshotArea * @since 3.19.0 * - * @param {integer} x - The x coordinate to grab from. - * @param {integer} y - The y coordinate to grab from. - * @param {integer} width - The width of the area to grab. - * @param {integer} height - The height of the area to grab. + * @param {number} x - The x coordinate to grab from. + * @param {number} y - The y coordinate to grab from. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. @@ -48942,9 +53267,9 @@ var RenderTexture = new Class({ */ snapshotArea: function (x, y, width, height, callback, type, encoderOptions) { - if (this.gl) + if (this.renderTarget) { - this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, false, x, y, width, height, type, encoderOptions); + this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, false, x, y, width, height, type, encoderOptions); } else { @@ -48977,9 +53302,9 @@ var RenderTexture = new Class({ */ snapshot: function (callback, type, encoderOptions) { - if (this.gl) + if (this.renderTarget) { - this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, false, 0, 0, this.width, this.height, type, encoderOptions); + this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, false, 0, 0, this.width, this.height, type, encoderOptions); } else { @@ -49003,17 +53328,17 @@ var RenderTexture = new Class({ * @method Phaser.GameObjects.RenderTexture#snapshotPixel * @since 3.19.0 * - * @param {integer} x - The x coordinate of the pixel to get. - * @param {integer} y - The y coordinate of the pixel to get. + * @param {number} x - The x coordinate of the pixel to get. + * @param {number} y - The y coordinate of the pixel to get. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. * * @return {this} This Render Texture instance. */ snapshotPixel: function (x, y, callback) { - if (this.gl) + if (this.renderTarget) { - this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, true, x, y); + this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, true, x, y); } else { @@ -49036,9 +53361,9 @@ var RenderTexture = new Class({ { CanvasPool.remove(this.canvas); - if (this.gl) + if (this.renderTarget) { - this.renderer.deleteFramebuffer(this.framebuffer); + this.renderTarget.destroy(); } this.texture.destroy(); @@ -49046,9 +53371,7 @@ var RenderTexture = new Class({ this.canvas = null; this.context = null; - this.framebuffer = null; this.texture = null; - this.glTexture = null; } } @@ -49058,7 +53381,7 @@ module.exports = RenderTexture; /***/ }), -/* 207 */ +/* 213 */ /***/ (function(module, exports) { /** @@ -49093,7 +53416,7 @@ module.exports = UUID; /***/ }), -/* 208 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -49106,9 +53429,9 @@ var AnimationState = __webpack_require__(157); var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); -var PIPELINE_CONST = __webpack_require__(110); -var RopeRender = __webpack_require__(1008); +var GameObjectEvents = __webpack_require__(32); +var PIPELINE_CONST = __webpack_require__(82); +var RopeRender = __webpack_require__(1068); var Vector2 = __webpack_require__(3); /** @@ -49147,8 +53470,8 @@ var Vector2 = __webpack_require__(3); * @param {number} [x=0] - The horizontal position of this Game Object in the world. * @param {number} [y=0] - The vertical position of this Game Object in the world. * @param {string} [texture] - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. If not given, `__DEFAULT` is used. - * @param {(string|integer|null)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {(integer|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. See `setPoints` to set this post-creation. + * @param {(string|number|null)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. See `setPoints` to set this post-creation. * @param {boolean} [horizontal=true] - Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? * @param {number[]} [colors] - An optional array containing the color data for this Rope. You should provide one color value per pair of vertices. * @param {number[]} [alphas] - An optional array containing the alpha data for this Rope. You should provide one alpha value per pair of vertices. @@ -49186,7 +53509,7 @@ var Rope = new Class({ * The Animation State of this Rope. * * @name Phaser.GameObjects.Rope#anims - * @type {Phaser.Animation.AnimationState} + * @type {Phaser.Animations.AnimationState} * @since 3.23.0 */ this.anims = new AnimationState(this); @@ -49265,15 +53588,14 @@ var Rope = new Class({ /** * The tint fill mode. * - * 0 = An additive tint (the default), where vertices colors are blended with the texture. - * 1 = A fill tint, where the vertices colors replace the texture, but respects texture alpha. - * 2 = A complete tint, where the vertices colors replace the texture, including alpha, entirely. + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. * * @name Phaser.GameObjects.Rope#tintFill - * @type {integer} + * @type {boolean} * @since 3.23.0 */ - this.tintFill = (texture === '__DEFAULT') ? 2 : 0; + this.tintFill = (texture === '__DEFAULT') ? true : false; /** * If the Rope is marked as `dirty` it will automatically recalculate its vertices @@ -49432,7 +53754,7 @@ var Rope = new Class({ * * @param {string} key - The string-based key of the animation to play. * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. - * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index. + * @param {number} [startFrame=0] - Optionally start the animation playing from this frame index. * * @return {this} This Game Object. */ @@ -49469,7 +53791,7 @@ var Rope = new Class({ * @method Phaser.GameObjects.Rope#setHorizontal * @since 3.23.0 * - * @param {(integer|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. * @param {(number|number[])} [colors] - Either a single color value, or an array of values. * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. * @@ -49498,7 +53820,7 @@ var Rope = new Class({ * @method Phaser.GameObjects.Rope#setVertical * @since 3.23.0 * - * @param {(integer|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. * @param {(number|number[])} [colors] - Either a single color value, or an array of values. * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. * @@ -49521,28 +53843,26 @@ var Rope = new Class({ /** * Sets the tint fill mode. * - * Mode 0 is an additive tint, the default, which blends the vertices colors with the texture. + * Mode 0 (`false`) is an additive tint, the default, which blends the vertices colors with the texture. * This mode respects the texture alpha. * - * Mode 1 is a fill tint. Unlike an additive tint, a fill-tint literally replaces the pixel colors + * Mode 1 (`true`) is a fill tint. Unlike an additive tint, a fill-tint literally replaces the pixel colors * from the texture with those in the tint. You can use this for effects such as making a player flash 'white' * if hit by something. This mode respects the texture alpha. * - * Mode 2 is a complete tint. The texture colors and alpha are replaced entirely by the vertices colors. - * * See the `setColors` method for details of how to color each of the vertices. * * @method Phaser.GameObjects.Rope#setTintFill * @webglOnly * @since 3.23.0 * - * @param {integer} [value=0] - Set to 0 for an Additive tint, 1 for a fill tint with alpha, or 2 for a fill tint without alpha. + * @param {boolean} [value=false] - Set to `false` for an Additive tint or `true` fill tint with alpha. * * @return {this} This Game Object instance. */ setTintFill: function (value) { - if (value === undefined) { value = 0; } + if (value === undefined) { value = false; } this.tintFill = value; @@ -49768,7 +54088,7 @@ var Rope = new Class({ * @method Phaser.GameObjects.Rope#setPoints * @since 3.23.0 * - * @param {(integer|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. * @param {(number|number[])} [colors] - Either a single color value, or an array of values. * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. * @@ -49948,7 +54268,7 @@ var Rope = new Class({ * @method Phaser.GameObjects.Rope#resizeArrays * @since 3.23.0 * - * @param {integer} newSize - The amount of segments to split the Rope in to. + * @param {number} newSize - The amount of segments to split the Rope in to. * * @return {this} This Game Object instance. */ @@ -50049,9 +54369,10 @@ var Rope = new Class({ /** * This method enables rendering of the Rope vertices to the given Graphics instance. * - * If you enable this feature, you must call `Graphics.clear()` in your Scene `update`, - * otherwise the Graphics instance will fill-in with draw calls. This is not done automatically - * to allow for you to debug render multiple Rope objects to a single Graphics instance. + * If you enable this feature, you **must** call `Graphics.clear()` in your Scene `update`, + * otherwise the Graphics instance you provide to debug will fill-up with draw calls, + * eventually crashing the browser. This is not done automatically to allow you to debug + * draw multiple Rope objects to a single Graphics instance. * * The Rope class has a built-in debug rendering callback `Rope.renderDebugVerts`, however * you can also provide your own callback to be used instead. Do this by setting the `callback` parameter. @@ -50106,7 +54427,7 @@ var Rope = new Class({ * @since 3.23.0 * * @param {Phaser.GameObjects.Rope} src - The Rope object being rendered. - * @param {integer} meshLength - The number of vertices in the mesh. + * @param {number} meshLength - The number of vertices in the mesh. * @param {number[]} verts - An array of translated vertex coordinates. */ renderDebugVerts: function (src, meshLength, verts) @@ -50224,7 +54545,7 @@ module.exports = Rope; /***/ }), -/* 209 */ +/* 215 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -50233,26 +54554,26 @@ module.exports = Rope; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AddToDOM = __webpack_require__(131); -var CanvasPool = __webpack_require__(26); +var AddToDOM = __webpack_require__(137); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); var GameObject = __webpack_require__(14); -var GetTextSize = __webpack_require__(425); +var GetTextSize = __webpack_require__(435); var GetValue = __webpack_require__(6); -var RemoveFromDOM = __webpack_require__(188); -var TextRender = __webpack_require__(1011); -var TextStyle = __webpack_require__(426); +var RemoveFromDOM = __webpack_require__(193); +var TextRender = __webpack_require__(1071); +var TextStyle = __webpack_require__(436); /** * @classdesc * A Text Game Object. - * + * * Text objects work by creating their own internal hidden Canvas and then renders text to it using * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered * to your game during the render pass. - * + * * Because it uses the Canvas API you can take advantage of all the features this offers, such as * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts * loaded externally, such as Google or TypeKit Web fonts. @@ -50275,7 +54596,7 @@ var TextStyle = __webpack_require__(426); * * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts * across mobile browsers. - * + * * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of @@ -50349,7 +54670,7 @@ var Text = new Class({ * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} * @since 3.12.0 */ - this.renderer = scene.sys.game.renderer; + this.renderer = scene.sys.renderer; this.setPosition(x, y); this.setOrigin(0, 0); @@ -50449,7 +54770,7 @@ var Text = new Class({ * The line spacing value. * This value is added to the font height to calculate the overall line height. * Only has an effect if this Text object contains multiple lines of text. - * + * * If you update this property directly, instead of using the `setLineSpacing` method, then * be sure to call `updateText` after, or you won't see the change reflected in the Text object. * @@ -50469,10 +54790,10 @@ var Text = new Class({ */ this.dirty = false; - // If resolution wasn't set, then we get it from the game config + // If resolution wasn't set, force it to 1 if (this.style.resolution === 0) { - this.style.resolution = scene.sys.game.config.resolution; + this.style.resolution = 1; } /** @@ -50749,7 +55070,12 @@ var Text = new Class({ { var word = words[j]; var wordWidth = context.measureText(word).width; - var wordWidthWithSpace = wordWidth + whiteSpaceWidth; + var wordWidthWithSpace = wordWidth; + + if (j < lastWordIndex) + { + wordWidthWithSpace += whiteSpaceWidth; + } if (wordWidthWithSpace > spaceLeft) { @@ -50909,10 +55235,10 @@ var Text = new Class({ * ```javascript * Text.setFont('"Press Start 2P"'); * ``` - * + * * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all * quoted properly, too: - * + * * ```javascript * Text.setFont('Georgia, "Goudy Bookletter 1911", Times, serif'); * ``` @@ -51180,9 +55506,9 @@ var Text = new Class({ /** * Set the alignment of the text in this Text object. - * + * * The argument can be one of: `left`, `right`, `center` or `justify`. - * + * * Alignment only works if the Text object has more than one line of text. * * @method Phaser.GameObjects.Text#setAlign @@ -51202,10 +55528,10 @@ var Text = new Class({ * * By default it will be set to match the resolution set in the Game Config, * but you can override it via this method, or by specifying it in the Text style configuration object. - * + * * It allows for much clearer text on High DPI devices, at the cost of memory because it uses larger * internal Canvas textures for the Text. - * + * * Therefore, please use with caution, as the more high res Text you have, the more memory it uses. * * @method Phaser.GameObjects.Text#setResolution @@ -51312,7 +55638,7 @@ var Text = new Class({ * @method Phaser.GameObjects.Text#setMaxLines * @since 3.0.0 * - * @param {integer} [max=0] - The maximum number of lines to draw. + * @param {number} [max=0] - The maximum number of lines to draw. * * @return {this} This Text object. */ @@ -51462,9 +55788,9 @@ var Text = new Class({ var spaceSize = context.measureText(' ').width; var trimmedLine = lines[i].trim(); var array = trimmedLine.split(' '); - + extraSpace += (lines[i].length - trimmedLine.length) * spaceSize; - + var extraSpaceCharacters = Math.floor(extraSpace / spaceSize); var idx = 0; @@ -51474,7 +55800,7 @@ var Text = new Class({ idx = (idx + 1) % (array.length - 1 || 1); --extraSpaceCharacters; } - + lines[i] = array.join(' '); } } @@ -51636,7 +55962,7 @@ module.exports = Text; /***/ }), -/* 210 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -51645,14 +55971,14 @@ module.exports = Text; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); var GameObject = __webpack_require__(14); -var GetPowerOfTwo = __webpack_require__(342); -var Smoothing = __webpack_require__(177); -var TileSpriteRender = __webpack_require__(1014); +var GetPowerOfTwo = __webpack_require__(353); +var Smoothing = __webpack_require__(184); +var TileSpriteRender = __webpack_require__(1074); var Vector2 = __webpack_require__(3); // bitmask flag for GameObject.renderMask @@ -51667,10 +55993,10 @@ var _FLAG = 8; // 1000 * * You shouldn't ever create a TileSprite any larger than your actual canvas size. If you want to create a large repeating background * that scrolls across the whole map of your game, then you create a TileSprite that fits the canvas size and then use the `tilePosition` - * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will + * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will * consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to * adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs. - * + * * An important note about Tile Sprites and NPOT textures: Internally, TileSprite textures use GL_REPEAT to provide * seamless repeating of the textures. This, combined with the way in which the textures are handled in WebGL, means * they need to be POT (power-of-two) sizes in order to wrap. If you provide a NPOT (non power-of-two) texture to a @@ -51705,10 +56031,10 @@ var _FLAG = 8; // 1000 * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. - * @param {integer} width - The width of the Game Object. If zero it will use the size of the texture frame. - * @param {integer} height - The height of the Game Object. If zero it will use the size of the texture frame. + * @param {number} width - The width of the Game Object. If zero it will use the size of the texture frame. + * @param {number} height - The height of the Game Object. If zero it will use the size of the texture frame. * @param {string} textureKey - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frameKey] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frameKey] - An optional frame from the Texture this Game Object is rendering with. */ var TileSprite = new Class({ @@ -51736,7 +56062,7 @@ var TileSprite = new Class({ function TileSprite (scene, x, y, width, height, textureKey, frameKey) { - var renderer = scene.sys.game.renderer; + var renderer = scene.sys.renderer; GameObject.call(this, scene, 'TileSprite'); @@ -51867,7 +56193,7 @@ var TileSprite = new Class({ * The next power of two value from the width of the Fill Pattern frame. * * @name Phaser.GameObjects.TileSprite#potWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.potWidth = GetPowerOfTwo(displayFrame.width); @@ -51876,7 +56202,7 @@ var TileSprite = new Class({ * The next power of two value from the height of the Fill Pattern frame. * * @name Phaser.GameObjects.TileSprite#potHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.potHeight = GetPowerOfTwo(displayFrame.height); @@ -51936,7 +56262,7 @@ var TileSprite = new Class({ * @since 3.0.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Game Object instance. */ @@ -51957,7 +56283,7 @@ var TileSprite = new Class({ * @method Phaser.GameObjects.TileSprite#setFrame * @since 3.0.0 * - * @param {(string|integer)} frame - The name or index of the frame within the Texture. + * @param {(string|number)} frame - The name or index of the frame within the Texture. * * @return {this} This Game Object instance. */ @@ -52288,7 +56614,7 @@ module.exports = TileSprite; /***/ }), -/* 211 */ +/* 217 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -52298,64 +56624,65 @@ module.exports = TileSprite; */ var Class = __webpack_require__(0); -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Components = __webpack_require__(11); -var Events = __webpack_require__(29); -var GameEvents = __webpack_require__(21); +var Events = __webpack_require__(32); +var GameEvents = __webpack_require__(23); +var InputEvents = __webpack_require__(49); var GameObject = __webpack_require__(14); -var SoundEvents = __webpack_require__(61); -var UUID = __webpack_require__(207); -var VideoRender = __webpack_require__(1017); +var SoundEvents = __webpack_require__(66); +var UUID = __webpack_require__(213); +var VideoRender = __webpack_require__(1077); var MATH_CONST = __webpack_require__(13); /** * @classdesc * A Video Game Object. - * + * * This Game Object is capable of handling playback of a previously loaded video from the Phaser Video Cache, * or playing a video based on a given URL. Videos can be either local, or streamed. - * + * * ```javascript * preload () { * this.load.video('pixar', 'nemo.mp4'); * } - * + * * create () { * this.add.video(400, 300, 'pixar'); * } * ``` - * + * * To all intents and purposes, a video is a standard Game Object, just like a Sprite. And as such, you can do * all the usual things to it, such as scaling, rotating, cropping, tinting, making interactive, giving a * physics body, etc. - * + * * Transparent videos are also possible via the WebM file format. Providing the video file has was encoded with * an alpha channel, and providing the browser supports WebM playback (not all of them do), then it will render * in-game with full transparency. - * + * * ### Autoplaying Videos - * + * * Videos can only autoplay if the browser has been unlocked with an interaction, or satisfies the MEI settings. * The policies that control autoplaying are vast and vary between browser. - * You can, ahd should, read more about it here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide - * + * You can, and should, read more about it here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide + * * If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is _loaded_, * and it will often allow the video to play immediately: - * + * * ```javascript * preload () { * this.load.video('pixar', 'nemo.mp4', 'loadeddata', false, true); * } * ``` - * + * * The 5th parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without * audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies * the browsers MEI settings. See the MDN Autoplay Guide for further details. - * + * * Note that due to a bug in IE11 you cannot play a video texture to a Sprite in WebGL. For IE11 force Canvas mode. - * + * * More details about video playback and the supported media formats can be found on MDN: - * + * * https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement * https://developer.mozilla.org/en-US/docs/Web/Media/Formats * @@ -52500,7 +56827,7 @@ var Video = new Class({ * state in this manner until the `retryLimit` is reached and then abort. * * @name Phaser.GameObjects.Video#retryLimit - * @type {integer} + * @type {number} * @since 3.20.0 */ this.retryLimit = 20; @@ -52509,7 +56836,7 @@ var Video = new Class({ * The current retry attempt. * * @name Phaser.GameObjects.Video#retry - * @type {integer} + * @type {number} * @since 3.20.0 */ this.retry = 0; @@ -52518,7 +56845,7 @@ var Video = new Class({ * The number of ms between each retry while monitoring the ready state of a downloading video. * * @name Phaser.GameObjects.Video#retryInterval - * @type {integer} + * @type {number} * @since 3.20.0 */ this.retryInterval = 500; @@ -52527,7 +56854,7 @@ var Video = new Class({ * The setTimeout callback ID. * * @name Phaser.GameObjects.Video#_retryID - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -52613,7 +56940,7 @@ var Video = new Class({ * The in marker. * * @name Phaser.GameObjects.Video#_markerIn - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -52623,7 +56950,7 @@ var Video = new Class({ * The out marker. * * @name Phaser.GameObjects.Video#_markerOut - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -52633,7 +56960,7 @@ var Video = new Class({ * The last time the TextureSource was updated. * * @name Phaser.GameObjects.Video#_lastUpdate - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -52688,40 +57015,55 @@ var Video = new Class({ { sound.on(SoundEvents.GLOBAL_MUTE, this.globalMute, this); } + + this.on(Events.ADDED_TO_SCENE, this.addedToScene, this); + this.on(Events.REMOVED_FROM_SCENE, this.removedFromScene, this); + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); }, /** * Starts this video playing. * * If the video is already playing, or has been queued to play with `changeSource` then this method just returns. - * + * * Videos can only autoplay if the browser has been unlocked. This happens if you have interacted with the browser, i.e. * by clicking on it or pressing a key, or due to server settings. The policies that control autoplaying are vast and * vary between browser. You can read more here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide - * + * * If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is loaded, * and it will often allow the video to play immediately: - * + * * ```javascript * preload () { * this.load.video('pixar', 'nemo.mp4', 'loadeddata', false, true); * } * ``` - * + * * The 5th parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without * audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies * the browsers MEI settings. See the MDN Autoplay Guide for details. - * + * * If you need audio in your videos, then you'll have to consider the fact that the video cannot start playing until the * user has interacted with the browser, into your game flow. * * @method Phaser.GameObjects.Video#play * @since 3.20.0 - * + * * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. - * @param {integer} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. - * @param {integer} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. - * + * @param {number} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. + * @param {number} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. + * * @return {this} This Video Game Object for method chaining. */ play: function (loop, markerIn, markerOut) @@ -52743,7 +57085,7 @@ var Video = new Class({ if (loop === undefined) { loop = video.loop; } var sound = this.scene.sys.sound; - + if (sound && sound.mute) { // Mute will be set based on the global mute state of the Sound Manager (if there is one) @@ -52797,20 +57139,20 @@ var Video = new Class({ * This method allows you to change the source of the current video element. It works by first stopping the * current video, if playing. Then deleting the video texture, if one has been created. Finally, it makes a * new video texture and starts playback of the new source through the existing video element. - * + * * The reason you may wish to do this is because videos that require interaction to unlock, remain in an unlocked * state, even if you change the source of the video. By changing the source to a new video you avoid having to * go through the unlock process again. * * @method Phaser.GameObjects.Video#changeSource * @since 3.20.0 - * + * * @param {string} key - The key of the Video this Game Object will swap to playing, as stored in the Video Cache. * @param {boolean} [autoplay=true] - Should the video start playing immediately, once the swap is complete? * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. - * @param {integer} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. - * @param {integer} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. - * + * @param {number} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. + * @param {number} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. + * * @return {this} This Video Game Object for method chaining. */ changeSource: function (key, autoplay, loop, markerIn, markerOut) @@ -52842,7 +57184,7 @@ var Video = new Class({ this.videoTexture = this.scene.sys.textures.create(this._key, newVideo, newVideo.videoWidth, newVideo.videoHeight); this.videoTextureSource = this.videoTexture.source[0]; this.videoTexture.add('__BASE', 0, 0, 0, newVideo.videoWidth, newVideo.videoHeight); - + this.setTexture(this.videoTexture); this.setSizeToFrame(); this.updateDisplayOrigin(); @@ -52873,23 +57215,23 @@ var Video = new Class({ /** * Adds a sequence marker to this video. - * + * * Markers allow you to split a video up into sequences, delineated by a start and end time, given in seconds. - * + * * You can then play back specific markers via the `playMarker` method. - * + * * Note that marker timing is _not_ frame-perfect. You should construct your videos in such a way that you allow for * plenty of extra padding before and after each sequence to allow for discrepancies in browser seek and currentTime accuracy. - * + * * See https://github.com/w3c/media-and-entertainment/issues/4 for more details about this issue. * * @method Phaser.GameObjects.Video#addMarker * @since 3.20.0 - * + * * @param {string} key - A unique name to give this marker. - * @param {integer} markerIn - The time, in seconds, representing the start of this marker. - * @param {integer} markerOut - The time, in seconds, representing the end of this marker. - * + * @param {number} markerIn - The time, in seconds, representing the start of this marker. + * @param {number} markerOut - The time, in seconds, representing the end of this marker. + * * @return {this} This Video Game Object for method chaining. */ addMarker: function (key, markerIn, markerOut) @@ -52904,21 +57246,21 @@ var Video = new Class({ /** * Plays a pre-defined sequence in this video. - * + * * Markers allow you to split a video up into sequences, delineated by a start and end time, given in seconds and * specified via the `addMarker` method. - * + * * Note that marker timing is _not_ frame-perfect. You should construct your videos in such a way that you allow for * plenty of extra padding before and after each sequence to allow for discrepancies in browser seek and currentTime accuracy. - * + * * See https://github.com/w3c/media-and-entertainment/issues/4 for more details about this issue. * * @method Phaser.GameObjects.Video#playMarker * @since 3.20.0 - * + * * @param {string} key - The name of the marker sequence to play. * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. - * + * * @return {this} This Video Game Object for method chaining. */ playMarker: function (key, loop) @@ -52935,14 +57277,14 @@ var Video = new Class({ /** * Removes a previously set marker from this video. - * + * * If the marker is currently playing it will _not_ stop playback. * * @method Phaser.GameObjects.Video#removeMarker * @since 3.20.0 - * + * * @param {string} key - The name of the marker to remove. - * + * * @return {this} This Video Game Object for method chaining. */ removeMarker: function (key) @@ -52955,17 +57297,17 @@ var Video = new Class({ /** * Takes a snapshot of the current frame of the video and renders it to a CanvasTexture object, * which is then returned. You can optionally resize the grab by passing a width and height. - * + * * This method returns a reference to the `Video.snapshotTexture` object. Calling this method * multiple times will overwrite the previous snapshot with the most recent one. * * @method Phaser.GameObjects.Video#snapshot * @since 3.20.0 - * - * @param {integer} [width] - The width of the resulting CanvasTexture. - * @param {integer} [height] - The height of the resulting CanvasTexture. - * - * @return {Phaser.Textures.CanvasTexture} + * + * @param {number} [width] - The width of the resulting CanvasTexture. + * @param {number} [height] - The height of the resulting CanvasTexture. + * + * @return {Phaser.Textures.CanvasTexture} */ snapshot: function (width, height) { @@ -52978,21 +57320,21 @@ var Video = new Class({ /** * Takes a snapshot of the specified area of the current frame of the video and renders it to a CanvasTexture object, * which is then returned. You can optionally resize the grab by passing a different `destWidth` and `destHeight`. - * + * * This method returns a reference to the `Video.snapshotTexture` object. Calling this method * multiple times will overwrite the previous snapshot with the most recent one. * * @method Phaser.GameObjects.Video#snapshotArea * @since 3.20.0 - * - * @param {integer} [x=0] - The horizontal location of the top-left of the area to grab from. - * @param {integer} [y=0] - The vertical location of the top-left of the area to grab from. - * @param {integer} [srcWidth] - The width of area to grab from the video. If not given it will grab the full video dimensions. - * @param {integer} [srcHeight] - The height of area to grab from the video. If not given it will grab the full video dimensions. - * @param {integer} [destWidth] - The destination width of the grab, allowing you to resize it. - * @param {integer} [destHeight] - The destination height of the grab, allowing you to resize it. - * - * @return {Phaser.Textures.CanvasTexture} + * + * @param {number} [x=0] - The horizontal location of the top-left of the area to grab from. + * @param {number} [y=0] - The vertical location of the top-left of the area to grab from. + * @param {number} [srcWidth] - The width of area to grab from the video. If not given it will grab the full video dimensions. + * @param {number} [srcHeight] - The height of area to grab from the video. If not given it will grab the full video dimensions. + * @param {number} [destWidth] - The destination width of the grab, allowing you to resize it. + * @param {number} [destHeight] - The destination height of the grab, allowing you to resize it. + * + * @return {Phaser.Textures.CanvasTexture} */ snapshotArea: function (x, y, srcWidth, srcHeight, destWidth, destHeight) { @@ -53032,27 +57374,27 @@ var Video = new Class({ /** * Stores a copy of this Videos `snapshotTexture` in the Texture Manager using the given key. - * + * * This texture is created when the `snapshot` or `snapshotArea` methods are called. - * + * * After doing this, any texture based Game Object, such as a Sprite, can use the contents of the * snapshot by using the texture key: - * + * * ```javascript * var vid = this.add.video(0, 0, 'intro'); - * + * * vid.snapshot(); - * + * * vid.saveSnapshotTexture('doodle'); - * + * * this.add.image(400, 300, 'doodle'); * ``` - * + * * Updating the contents of the `snapshotTexture`, for example by calling `snapshot` again, * will automatically update _any_ Game Object that is using it as a texture. * Calling `saveSnapshotTexture` again will not save another copy of the same texture, * it will just rename the existing one. - * + * * By default it will create a single base texture. You can add frames to the texture * by using the `Texture.add` method. After doing this, you can then allow Game Objects * to use a specific frame. @@ -53080,18 +57422,18 @@ var Video = new Class({ /** * Loads a Video from the given URL, ready for playback with the `Video.play` method. - * + * * You can control at what point the browser determines the video as being ready for playback via * the `loadEvent` parameter. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement * for more details. * * @method Phaser.GameObjects.Video#loadURL * @since 3.20.0 - * + * * @param {string} url - The URL of the video to load or be streamed. * @param {string} [loadEvent='loadeddata'] - The load event to listen for. Either `loadeddata`, `canplay` or `canplaythrough`. * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. - * + * * @return {this} This Video Game Object for method chaining. */ loadURL: function (url, loadEvent, noAudio) @@ -53110,7 +57452,7 @@ var Video = new Class({ } var video = document.createElement('video'); - + video.controls = false; if (noAudio) @@ -53135,6 +57477,70 @@ var Video = new Class({ return this; }, + /** + * Loads a Video from the given MediaStream object, ready for playback with the `Video.play` method. + * + * You can control at what point the browser determines the video as being ready for playback via + * the `loadEvent` parameter. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement + * for more details. + * + * @method Phaser.GameObjects.Video#loadMediaStream + * @since 3.50.0 + * + * @param {string} stream - The MediaStream object. + * @param {string} [loadEvent='loadeddata'] - The load event to listen for. Either `loadeddata`, `canplay` or `canplaythrough`. + * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. + * + * @return {this} This Video Game Object for method chaining. + */ + loadMediaStream: function (stream, loadEvent, noAudio) + { + if (loadEvent === undefined) { loadEvent = 'loadeddata'; } + if (noAudio === undefined) { noAudio = false; } + + if (this.video) + { + this.stop(); + } + + if (this.videoTexture) + { + this.scene.sys.textures.remove(this._key); + } + + var video = document.createElement('video'); + + video.controls = false; + + if (noAudio) + { + video.muted = true; + video.defaultMuted = true; + + video.setAttribute('autoplay', 'autoplay'); + } + + video.setAttribute('playsinline', 'playsinline'); + video.setAttribute('preload', 'auto'); + + video.addEventListener('error', this._callbacks.error, true); + + try + { + video.srcObject = stream; + } + catch (error) + { + video.src = window.URL.createObjectURL(stream); + } + + video.load(); + + this.video = video; + + return this; + }, + /** * This internal method is called automatically if the playback Promise resolves successfully. * @@ -53162,12 +57568,12 @@ var Video = new Class({ * @fires Phaser.GameObjects.Events#VIDEO_ERROR * @private * @since 3.20.0 - * + * * @param {any} error - The Promise resolution error. */ playPromiseErrorHandler: function (error) { - this.scene.sys.input.once('pointerdown', this.unlockHandler, this); + this.scene.sys.input.once(InputEvents.POINTER_DOWN, this.unlockHandler, this); this.touchLocked = true; this.playWhenUnlocked = true; @@ -53177,7 +57583,7 @@ var Video = new Class({ /** * Called when the video emits a `playing` event during load. - * + * * This is only listened for if the browser doesn't support Promises. * * @method Phaser.GameObjects.Video#playHandler @@ -53189,7 +57595,7 @@ var Video = new Class({ this.touchLocked = false; this.emit(Events.VIDEO_PLAY, this); - + this.video.removeEventListener('playing', this._callbacks.play, true); }, @@ -53200,7 +57606,7 @@ var Video = new Class({ * @fires Phaser.GameObjects.Events#VIDEO_ERROR * @private * @since 3.20.0 - * + * * @param {Event} event - The error Event. */ loadErrorHandler: function (event) @@ -53219,7 +57625,7 @@ var Video = new Class({ * @fires Phaser.GameObjects.Events#VIDEO_PLAY * @private * @since 3.20.0 - * + * * @param {any} error - The Promise resolution error. */ unlockHandler: function () @@ -53241,7 +57647,7 @@ var Video = new Class({ /** * Called when the video completes playback, i.e. reaches an `ended` state. - * + * * This will never happen if the video is coming from a live stream, where the duration is `Infinity`. * * @method Phaser.GameObjects.Video#completeHandler @@ -53255,7 +57661,7 @@ var Video = new Class({ /** * Called when the video emits a `timeUpdate` event during playback. - * + * * This event is too slow and irregular to be used for actual video timing or texture updating, * but we can use it to determine if a video has looped. * @@ -53368,11 +57774,11 @@ var Video = new Class({ this.videoTexture = this.scene.sys.textures.create(this._key, video, width, height); this.videoTextureSource = this.videoTexture.source[0]; this.videoTexture.add('__BASE', 0, 0, 0, width, height); - + this.setTexture(this.videoTexture); this.setSizeToFrame(); this.updateDisplayOrigin(); - + this.emit(Events.VIDEO_CREATED, this, width, height); } else @@ -53385,7 +57791,7 @@ var Video = new Class({ textureSource.width = width; textureSource.height = height; } - + textureSource.update(); } }, @@ -53396,7 +57802,7 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#getVideoKey * @since 3.20.0 - * + * * @return {string} The key of the video being played from the Video Cache, if any. */ getVideoKey: function () @@ -53407,19 +57813,19 @@ var Video = new Class({ /** * Seeks to a given point in the video. The value is given as a float between 0 and 1, * where 0 represents the start of the video and 1 represents the end. - * + * * Seeking only works if the video has a duration, so will not work for live streams. - * + * * When seeking begins, this video will emit a `seeking` event. When the video completes * seeking (i.e. reaches its designated timestamp) it will emit a `seeked` event. - * + * * If you wish to seek based on time instead, use the `Video.setCurrentTime` method. * * @method Phaser.GameObjects.Video#seekTo * @since 3.20.0 - * + * * @param {number} value - The point in the video to seek to. A value between 0 and 1. - * + * * @return {this} This Video Game Object for method chaining. */ seekTo: function (value) @@ -53447,7 +57853,7 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#getCurrentTime * @since 3.20.0 - * + * * @return {number} A double-precision floating-point value indicating the current playback time in seconds. */ getCurrentTime: function () @@ -53457,22 +57863,22 @@ var Video = new Class({ /** * Seeks to a given playback time in the video. The value is given in _seconds_ or as a string. - * + * * Seeking only works if the video has a duration, so will not work for live streams. - * + * * When seeking begins, this video will emit a `seeking` event. When the video completes * seeking (i.e. reaches its designated timestamp) it will emit a `seeked` event. - * + * * You can provide a string prefixed with either a `+` or a `-`, such as `+2.5` or `-2.5`. * In this case it will seek to +/- the value given, relative to the _current time_. - * + * * If you wish to seek based on a duration percentage instead, use the `Video.seekTo` method. * * @method Phaser.GameObjects.Video#setCurrentTime * @since 3.20.0 - * + * * @param {(string|number)} value - The playback time to seek to in seconds. Can be expressed as a string, such as `+2` to seek 2 seconds ahead from the current time. - * + * * @return {this} This Video Game Object for method chaining. */ setCurrentTime: function (value) @@ -53509,7 +57915,7 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#isSeeking * @since 3.20.0 - * + * * @return {boolean} A boolean indicating if this Video is currently seeking, or not. */ isSeeking: function () @@ -53557,12 +57963,12 @@ var Video = new Class({ /** * Returns the current progress of the video. Progress is defined as a value between 0 (the start) * and 1 (the end). - * + * * Progress can only be returned if the video has a duration, otherwise it will always return zero. * * @method Phaser.GameObjects.Video#getProgress * @since 3.20.0 - * + * * @return {number} The current progress of playback. If the video has no duration, will always return zero. */ getProgress: function () @@ -53579,20 +57985,20 @@ var Video = new Class({ return now / duration; } } - + return 0; }, /** * A double-precision floating-point value which indicates the duration (total length) of the media in seconds, * on the media's timeline. If no media is present on the element, or the media is not valid, the returned value is NaN. - * + * * If the media has no known end (such as for live streams of unknown duration, web radio, media incoming from WebRTC, * and so forth), this value is +Infinity. - * + * * @method Phaser.GameObjects.Video#getDuration * @since 3.20.0 - * + * * @return {number} A double-precision floating-point value indicating the duration of the media in seconds. */ getDuration: function () @@ -53605,9 +58011,9 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#setMute * @since 3.20.0 - * + * * @param {boolean} [value=true] - The mute value. `true` if the video should be muted, otherwise `false`. - * + * * @return {this} This Video Game Object for method chaining. */ setMute: function (value) @@ -53631,7 +58037,7 @@ var Video = new Class({ * * @method Phaser.GameObjects.Video#isMuted * @since 3.20.0 - * + * * @return {boolean} A boolean indicating if this Video is currently muted, or not. */ isMuted: function () @@ -53645,7 +58051,7 @@ var Video = new Class({ * @method Phaser.GameObjects.Video#globalMute * @private * @since 3.20.0 - * + * * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the Sound Manager that emitted the event. * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. */ @@ -53697,17 +58103,17 @@ var Video = new Class({ /** * Sets the paused state of the currently loaded video. - * + * * If the video is playing, calling this method with `true` will pause playback. * If the video is paused, calling this method with `false` will resume playback. - * + * * If no video is loaded, this method does nothing. * * @method Phaser.GameObjects.Video#setPaused * @since 3.20.0 - * + * * @param {boolean} [value=true] - The paused value. `true` if the video should be paused, `false` to resume it. - * + * * @return {this} This Video Game Object for method chaining. */ setPaused: function (value) @@ -53741,27 +58147,27 @@ var Video = new Class({ /** * Returns a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). - * + * * @method Phaser.GameObjects.Video#getVolume * @since 3.20.0 - * + * * @return {number} A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). */ getVolume: function () { return (this.video) ? this.video.volume : 1; }, - + /** * Sets the volume of the currently playing video. - * + * * The value given is a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). - * + * * @method Phaser.GameObjects.Video#setVolume * @since 3.20.0 - * + * * @param {number} [value=1] - A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). - * + * * @return {this} This Video Game Object for method chaining. */ setVolume: function (value) @@ -53778,10 +58184,10 @@ var Video = new Class({ /** * Returns a double that indicates the rate at which the media is being played back. - * + * * @method Phaser.GameObjects.Video#getPlaybackRate * @since 3.20.0 - * + * * @return {number} A double that indicates the rate at which the media is being played back. */ getPlaybackRate: function () @@ -53791,14 +58197,14 @@ var Video = new Class({ /** * Sets the playback rate of the current video. - * + * * The value given is a double that indicates the rate at which the media is being played back. - * + * * @method Phaser.GameObjects.Video#setPlaybackRate * @since 3.20.0 - * + * * @param {number} [rate] - A double that indicates the rate at which the media is being played back. - * + * * @return {this} This Video Game Object for method chaining. */ setPlaybackRate: function (rate) @@ -53813,10 +58219,10 @@ var Video = new Class({ /** * Returns a boolean which indicates whether the media element should start over when it reaches the end. - * + * * @method Phaser.GameObjects.Video#getLoop * @since 3.20.0 - * + * * @return {boolean} A boolean which indicates whether the media element will start over when it reaches the end. */ getLoop: function () @@ -53826,18 +58232,18 @@ var Video = new Class({ /** * Sets the loop state of the current video. - * + * * The value given is a boolean which indicates whether the media element will start over when it reaches the end. - * + * * Not all videos can loop, for example live streams. - * + * * Please note that not all browsers support _seamless_ video looping for all encoding formats. - * + * * @method Phaser.GameObjects.Video#setLoop * @since 3.20.0 - * + * * @param {boolean} [value=true] - A boolean which indicates whether the media element will start over when it reaches the end. - * + * * @return {this} This Video Game Object for method chaining. */ setLoop: function (value) @@ -53854,23 +58260,23 @@ var Video = new Class({ /** * Returns a boolean which indicates whether the video is currently playing. - * + * * @method Phaser.GameObjects.Video#isPlaying * @since 3.20.0 - * + * * @return {boolean} A boolean which indicates whether the video is playing, or not. */ isPlaying: function () { return (this.video) ? !(this.video.paused || this.video.ended) : false; }, - + /** * Returns a boolean which indicates whether the video is currently paused. - * + * * @method Phaser.GameObjects.Video#isPaused * @since 3.20.0 - * + * * @return {boolean} A boolean which indicates whether the video is paused, or not. */ isPaused: function () @@ -53881,26 +58287,26 @@ var Video = new Class({ /** * Stores this Video in the Texture Manager using the given key as a dynamic texture, * which any texture-based Game Object, such as a Sprite, can use as its texture: - * + * * ```javascript * var vid = this.add.video(0, 0, 'intro'); - * + * * vid.play(); - * + * * vid.saveTexture('doodle'); - * + * * this.add.image(400, 300, 'doodle'); * ``` - * + * * The saved texture is automatically updated as the video plays. If you pause this video, * or change its source, then the saved texture updates instantly. - * + * * Calling `saveTexture` again will not save another copy of the same texture, it will just rename the existing one. - * + * * By default it will create a single base texture. You can add frames to the texture * by using the `Texture.add` method. After doing this, you can then allow Game Objects * to use a specific frame. - * + * * If you intend to save the texture so you can use it as the input for a Shader, you may need to set the * `flipY` parameter to `true` if you find the video renders upside down in your shader. * @@ -53937,14 +58343,14 @@ var Video = new Class({ * Stops the video playing and clears all internal event listeners. * * If you only wish to pause playback of the video, and resume it a later time, use the `Video.pause` method instead. - * + * * If the video hasn't finished downloading, calling this method will not abort the download. To do that you need to * call `destroy` instead. * * @method Phaser.GameObjects.Video#stop * @fires Phaser.GameObjects.Events#VIDEO_STOP * @since 3.20.0 - * + * * @return {this} This Video Game Object for method chaining. */ stop: function () @@ -53975,13 +58381,13 @@ var Video = new Class({ /** * Removes the Video element from the DOM by calling parentNode.removeChild on itself. - * + * * Also removes the autoplay and src attributes and nulls the Video reference. - * + * * You should not call this method if you were playing a video from the Video Cache that * you wish to play again in your game, or if another Video object is also using the same * video. - * + * * If you loaded an external video via `Video.loadURL` then you should call this function * to clear up once you are done with the instance. * @@ -54015,9 +58421,9 @@ var Video = new Class({ /** * Handles the pre-destroy step for the Video object. - * + * * This calls `Video.stop` and optionally `Video.removeVideoElement`. - * + * * If any Sprites are using this Video as their texture it is up to you to manage those. * * @method Phaser.GameObjects.Video#preDestroy @@ -54057,7 +58463,7 @@ module.exports = Video; /***/ }), -/* 212 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54067,16 +58473,16 @@ module.exports = Video; */ var Class = __webpack_require__(0); -var Contains = __webpack_require__(213); -var GetPoints = __webpack_require__(437); -var GEOM_CONST = __webpack_require__(49); +var Contains = __webpack_require__(219); +var GetPoints = __webpack_require__(447); +var GEOM_CONST = __webpack_require__(55); /** * @classdesc * A Polygon object * * The polygon is a closed shape consists of a series of connected straight lines defined by list of ordered points. - * Several formats are supported to define the list of points, check the setTo method for details. + * Several formats are supported to define the list of points, check the setTo method for details. * This is a geometry object allowing you to define and inspect the shape. * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. * To render a Polygon you should look at the capabilities of the Graphics class. @@ -54086,7 +58492,7 @@ var GEOM_CONST = __webpack_require__(49); * @constructor * @since 3.0.0 * - * @param {Phaser.Geom.Point[]} [points] - List of points defining the perimeter of this Polygon. Several formats are supported: + * @param {(string|number[]|Phaser.Types.Math.Vector2Like[])} [points] - List of points defining the perimeter of this Polygon. Several formats are supported: * - A string containing paired x y values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` * - An array of objects with public x y properties: `[obj1, obj2, ...]` @@ -54104,7 +58510,7 @@ var Polygon = new Class({ * Used for fast type comparisons. * * @name Phaser.Geom.Polygon#type - * @type {integer} + * @type {number} * @readonly * @since 3.19.0 */ @@ -54167,7 +58573,7 @@ var Polygon = new Class({ * @method Phaser.Geom.Polygon#setTo * @since 3.0.0 * - * @param {array} points - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. + * @param {(string|number[]|Phaser.Types.Math.Vector2Like[])} [points] - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. * * @return {this} This Polygon object. */ @@ -54274,7 +58680,7 @@ var Polygon = new Class({ * * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the perimeter of the Polygon and dividing it by the stepRate. * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -54291,7 +58697,7 @@ module.exports = Polygon; /***/ }), -/* 213 */ +/* 219 */ /***/ (function(module, exports) { /** @@ -54340,668 +58746,7 @@ module.exports = Contains; /***/ }), -/* 214 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Mesh = __webpack_require__(142); - -/** - * @classdesc - * A Quad Game Object. - * - * A Quad is a Mesh Game Object pre-configured with two triangles arranged into a rectangle, with a single - * texture spread across them. - * - * You can manipulate the corner points of the quad via the getters and setters such as `topLeftX`, and also - * change their alpha and color values. The quad itself can be moved by adjusting the `x` and `y` properties. - * - * @class Quad - * @extends Phaser.GameObjects.Mesh - * @memberof Phaser.GameObjects - * @constructor - * @webglOnly - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene to which this Quad belongs. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - */ -var Quad = new Class({ - - Extends: Mesh, - - initialize: - - function Quad (scene, x, y, texture, frame) - { - // 0----3 - // |\ B| - // | \ | - // | \ | - // | A \| - // | \ - // 1----2 - - var vertices = [ - 0, 0, // tl - 0, 0, // bl - 0, 0, // br - 0, 0, // tl - 0, 0, // br - 0, 0 // tr - ]; - - var uv = [ - 0, 0, // tl - 0, 1, // bl - 1, 1, // br - 0, 0, // tl - 1, 1, // br - 1, 0 // tr - ]; - - var colors = [ - 0xffffff, // tl - 0xffffff, // bl - 0xffffff, // br - 0xffffff, // tl - 0xffffff, // br - 0xffffff // tr - ]; - - var alphas = [ - 1, // tl - 1, // bl - 1, // br - 1, // tl - 1, // br - 1 // tr - ]; - - Mesh.call(this, scene, x, y, vertices, uv, colors, alphas, texture, frame); - - this.resetPosition(); - }, - - /** - * Sets the frame this Game Object will use to render with. - * - * The Frame has to belong to the current Texture being used. - * - * It can be either a string or an index. - * - * Calling `setFrame` will modify the `width` and `height` properties of your Game Object. - * It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer. - * - * @method Phaser.GameObjects.Quad#setFrame - * @since 3.11.0 - * - * @param {(string|integer)} frame - The name or index of the frame within the Texture. - * - * @return {this} This Game Object instance. - */ - setFrame: function (frame) - { - this.frame = this.texture.get(frame); - - if (!this.frame.cutWidth || !this.frame.cutHeight) - { - this.renderFlags &= ~8; - } - else - { - this.renderFlags |= 8; - } - - frame = this.frame; - - // TL - this.uv[0] = frame.u0; - this.uv[1] = frame.v0; - - // BL - this.uv[2] = frame.u0; - this.uv[3] = frame.v1; - - // BR - this.uv[4] = frame.u1; - this.uv[5] = frame.v1; - - // TL - this.uv[6] = frame.u0; - this.uv[7] = frame.v0; - - // BR - this.uv[8] = frame.u1; - this.uv[9] = frame.v1; - - // TR - this.uv[10] = frame.u1; - this.uv[11] = frame.v0; - - return this; - }, - - /** - * The top-left x vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#topLeftX - * @type {number} - * @since 3.0.0 - */ - topLeftX: { - - get: function () - { - return this.x + this.vertices[0]; - }, - - set: function (value) - { - this.vertices[0] = value - this.x; - this.vertices[6] = value - this.x; - } - - }, - - /** - * The top-left y vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#topLeftY - * @type {number} - * @since 3.0.0 - */ - topLeftY: { - - get: function () - { - return this.y + this.vertices[1]; - }, - - set: function (value) - { - this.vertices[1] = value - this.y; - this.vertices[7] = value - this.y; - } - - }, - - /** - * The top-right x vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#topRightX - * @type {number} - * @since 3.0.0 - */ - topRightX: { - - get: function () - { - return this.x + this.vertices[10]; - }, - - set: function (value) - { - this.vertices[10] = value - this.x; - } - - }, - - /** - * The top-right y vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#topRightY - * @type {number} - * @since 3.0.0 - */ - topRightY: { - - get: function () - { - return this.y + this.vertices[11]; - }, - - set: function (value) - { - this.vertices[11] = value - this.y; - } - - }, - - /** - * The bottom-left x vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomLeftX - * @type {number} - * @since 3.0.0 - */ - bottomLeftX: { - - get: function () - { - return this.x + this.vertices[2]; - }, - - set: function (value) - { - this.vertices[2] = value - this.x; - } - - }, - - /** - * The bottom-left y vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomLeftY - * @type {number} - * @since 3.0.0 - */ - bottomLeftY: { - - get: function () - { - return this.y + this.vertices[3]; - }, - - set: function (value) - { - this.vertices[3] = value - this.y; - } - - }, - - /** - * The bottom-right x vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomRightX - * @type {number} - * @since 3.0.0 - */ - bottomRightX: { - - get: function () - { - return this.x + this.vertices[4]; - }, - - set: function (value) - { - this.vertices[4] = value - this.x; - this.vertices[8] = value - this.x; - } - - }, - - /** - * The bottom-right y vertex of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomRightY - * @type {number} - * @since 3.0.0 - */ - bottomRightY: { - - get: function () - { - return this.y + this.vertices[5]; - }, - - set: function (value) - { - this.vertices[5] = value - this.y; - this.vertices[9] = value - this.y; - } - - }, - - /** - * The top-left alpha value of this Quad. - * - * @name Phaser.GameObjects.Quad#topLeftAlpha - * @type {number} - * @since 3.0.0 - */ - topLeftAlpha: { - - get: function () - { - return this.alphas[0]; - }, - - set: function (value) - { - this.alphas[0] = value; - this.alphas[3] = value; - } - - }, - - /** - * The top-right alpha value of this Quad. - * - * @name Phaser.GameObjects.Quad#topRightAlpha - * @type {number} - * @since 3.0.0 - */ - topRightAlpha: { - - get: function () - { - return this.alphas[5]; - }, - - set: function (value) - { - this.alphas[5] = value; - } - - }, - - /** - * The bottom-left alpha value of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomLeftAlpha - * @type {number} - * @since 3.0.0 - */ - bottomLeftAlpha: { - - get: function () - { - return this.alphas[1]; - }, - - set: function (value) - { - this.alphas[1] = value; - } - - }, - - /** - * The bottom-right alpha value of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomRightAlpha - * @type {number} - * @since 3.0.0 - */ - bottomRightAlpha: { - - get: function () - { - return this.alphas[2]; - }, - - set: function (value) - { - this.alphas[2] = value; - this.alphas[4] = value; - } - - }, - - /** - * The top-left color value of this Quad. - * - * @name Phaser.GameObjects.Quad#topLeftColor - * @type {number} - * @since 3.0.0 - */ - topLeftColor: { - - get: function () - { - return this.colors[0]; - }, - - set: function (value) - { - this.colors[0] = value; - this.colors[3] = value; - } - - }, - - /** - * The top-right color value of this Quad. - * - * @name Phaser.GameObjects.Quad#topRightColor - * @type {number} - * @since 3.0.0 - */ - topRightColor: { - - get: function () - { - return this.colors[5]; - }, - - set: function (value) - { - this.colors[5] = value; - } - - }, - - /** - * The bottom-left color value of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomLeftColor - * @type {number} - * @since 3.0.0 - */ - bottomLeftColor: { - - get: function () - { - return this.colors[1]; - }, - - set: function (value) - { - this.colors[1] = value; - } - - }, - - /** - * The bottom-right color value of this Quad. - * - * @name Phaser.GameObjects.Quad#bottomRightColor - * @type {number} - * @since 3.0.0 - */ - bottomRightColor: { - - get: function () - { - return this.colors[2]; - }, - - set: function (value) - { - this.colors[2] = value; - this.colors[4] = value; - } - - }, - - /** - * Sets the top-left vertex position of this Quad. - * - * @method Phaser.GameObjects.Quad#setTopLeft - * @since 3.0.0 - * - * @param {number} x - The horizontal coordinate of the vertex. - * @param {number} y - The vertical coordinate of the vertex. - * - * @return {this} This Game Object. - */ - setTopLeft: function (x, y) - { - this.topLeftX = x; - this.topLeftY = y; - - return this; - }, - - /** - * Sets the top-right vertex position of this Quad. - * - * @method Phaser.GameObjects.Quad#setTopRight - * @since 3.0.0 - * - * @param {number} x - The horizontal coordinate of the vertex. - * @param {number} y - The vertical coordinate of the vertex. - * - * @return {this} This Game Object. - */ - setTopRight: function (x, y) - { - this.topRightX = x; - this.topRightY = y; - - return this; - }, - - /** - * Sets the bottom-left vertex position of this Quad. - * - * @method Phaser.GameObjects.Quad#setBottomLeft - * @since 3.0.0 - * - * @param {number} x - The horizontal coordinate of the vertex. - * @param {number} y - The vertical coordinate of the vertex. - * - * @return {this} This Game Object. - */ - setBottomLeft: function (x, y) - { - this.bottomLeftX = x; - this.bottomLeftY = y; - - return this; - }, - - /** - * Sets the bottom-right vertex position of this Quad. - * - * @method Phaser.GameObjects.Quad#setBottomRight - * @since 3.0.0 - * - * @param {number} x - The horizontal coordinate of the vertex. - * @param {number} y - The vertical coordinate of the vertex. - * - * @return {this} This Game Object. - */ - setBottomRight: function (x, y) - { - this.bottomRightX = x; - this.bottomRightY = y; - - return this; - }, - - /** - * Resets the positions of the four corner vertices of this Quad. - * - * @method Phaser.GameObjects.Quad#resetPosition - * @since 3.0.0 - * - * @return {this} This Game Object. - */ - resetPosition: function () - { - var x = this.x; - var y = this.y; - var halfWidth = Math.floor(this.width / 2); - var halfHeight = Math.floor(this.height / 2); - - this.setTopLeft(x - halfWidth, y - halfHeight); - this.setTopRight(x + halfWidth, y - halfHeight); - this.setBottomLeft(x - halfWidth, y + halfHeight); - this.setBottomRight(x + halfWidth, y + halfHeight); - - return this; - }, - - /** - * Resets the alpha values used by this Quad back to 1. - * - * @method Phaser.GameObjects.Quad#resetAlpha - * @since 3.0.0 - * - * @return {this} This Game Object. - */ - resetAlpha: function () - { - var alphas = this.alphas; - - alphas[0] = 1; - alphas[1] = 1; - alphas[2] = 1; - alphas[3] = 1; - alphas[4] = 1; - alphas[5] = 1; - - return this; - }, - - /** - * Resets the color values used by this Quad back to 0xffffff. - * - * @method Phaser.GameObjects.Quad#resetColors - * @since 3.0.0 - * - * @return {this} This Game Object. - */ - resetColors: function () - { - var colors = this.colors; - - colors[0] = 0xffffff; - colors[1] = 0xffffff; - colors[2] = 0xffffff; - colors[3] = 0xffffff; - colors[4] = 0xffffff; - colors[5] = 0xffffff; - - return this; - }, - - /** - * Resets the position, alpha and color values used by this Quad. - * - * @method Phaser.GameObjects.Quad#reset - * @since 3.0.0 - * - * @return {this} This Game Object. - */ - reset: function () - { - this.resetPosition(); - - this.resetAlpha(); - - return this.resetColors(); - } - -}); - -module.exports = Quad; - - -/***/ }), -/* 215 */ +/* 220 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -55014,10 +58759,10 @@ var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); var GetFastValue = __webpack_require__(2); -var Extend = __webpack_require__(19); -var SetValue = __webpack_require__(445); -var ShaderRender = __webpack_require__(1100); -var TransformMatrix = __webpack_require__(31); +var Extend = __webpack_require__(18); +var SetValue = __webpack_require__(455); +var ShaderRender = __webpack_require__(1159); +var TransformMatrix = __webpack_require__(24); /** * @classdesc @@ -55116,7 +58861,7 @@ var Shader = new Class({ * This Game Object cannot have a blend mode, so skip all checks. * * @name Phaser.GameObjects.Shader#blendMode - * @type {integer} + * @type {number} * @private * @since 3.17.0 */ @@ -55510,9 +59255,9 @@ var Shader = new Class({ var program = renderer.createProgram(this.shader.vertexSrc, this.shader.fragmentSrc); // The default uniforms available within the vertex shader - renderer.setMatrix4(program, 'uViewMatrix', false, this.viewMatrix); - renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); - renderer.setFloat2(program, 'uResolution', this.width, this.height); + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uViewMatrix'), false, this.viewMatrix); + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uProjectionMatrix'), false, this.projectionMatrix); + gl.uniform2f(gl.getUniformLocation(program, 'uResolution'), this.width, this.height); this.program = program; @@ -55608,7 +59353,12 @@ var Shader = new Class({ var program = this.program; - this.renderer.setMatrix4(program, 'uProjectionMatrix', false, this.projectionMatrix); + var gl = this.gl; + var renderer = this.renderer; + + renderer.setProgram(program); + + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uProjectionMatrix'), false, this.projectionMatrix); this._rendererWidth = right; this._rendererHeight = bottom; @@ -55674,9 +59424,9 @@ var Shader = new Class({ * * @param {string} uniformKey - The key of the sampler2D uniform to be updated, i.e. `iChannel0`. * @param {WebGLTexture} texture - A WebGLTexture reference. - * @param {integer} width - The width of the texture. - * @param {integer} height - The height of the texture. - * @param {integer} [textureIndex=0] - The texture index. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} [textureIndex=0] - The texture index. * @param {any} [textureData] - Additional texture data. * * @return {this} This Shader instance. @@ -55715,7 +59465,7 @@ var Shader = new Class({ * * @param {string} uniformKey - The key of the sampler2D uniform to be updated, i.e. `iChannel0`. * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. - * @param {integer} [textureIndex=0] - The texture index. + * @param {number} [textureIndex=0] - The texture index. * @param {any} [textureData] - Additional texture data. * * @return {this} This Shader instance. @@ -56222,7 +59972,7 @@ module.exports = Shader; /***/ }), -/* 216 */ +/* 221 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56231,7 +59981,1063 @@ module.exports = Shader; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DistanceBetween = __webpack_require__(55); +var Class = __webpack_require__(0); +var Components = __webpack_require__(11); +var DegToRad = __webpack_require__(34); +var Face = __webpack_require__(111); +var GameObject = __webpack_require__(14); +var GameObjectEvents = __webpack_require__(32); +var GenerateVerts = __webpack_require__(456); +var GenerateObjVerts = __webpack_require__(457); +var GetCalcMatrix = __webpack_require__(21); +var Matrix4 = __webpack_require__(73); +var MeshRender = __webpack_require__(1162); +var StableSort = __webpack_require__(90); +var Vector3 = __webpack_require__(37); +var Vertex = __webpack_require__(113); + +/** + * @classdesc + * A Mesh Game Object. + * + * The Mesh Game Object allows you to render a group of textured vertices and manipulate + * the view of those vertices, such as rotation, translation or scaling. + * + * Support for generating mesh data from grids, model data or Wavefront OBJ Files is included. + * + * Although you can use this to render 3D objects, its primary use is for displaying more complex + * Sprites, or Sprites where you need fine-grained control over the vertice positions in order to + * achieve special effects in your games. Note that rendering still takes place using Phasers + * orthographic camera. As a result, all depth and face tests are done in orthographic space. + * + * The rendering process will iterate through the faces of this Mesh and render out each face + * that is considered as being in view of the camera. No depth buffer is used, and because of this, + * you should be careful not to use model data with too many vertices, or overlapping geometry, + * or you'll probably encounter z-depth fighting. The Mesh was designed to allow for more advanced + * 2D layouts, rather than displaying 3D objects, even though it can do this to a degree. + * + * In short, if you want to remake Crysis, use a 3D engine, not a Mesh. However, if you want + * to easily add some small fun 3D elements into your game, or create some special effects involving + * vertex warping, this is the right object for you. Mesh data becomes part of the WebGL batch, + * just like standard Sprites, so doesn't introduce any additional shader overhead. Because + * the Mesh just generates vertices into the WebGL batch, like any other Sprite, you can use all of + * the common Game Object components on a Mesh too, such as a custom pipeline, mask, blend mode + * or texture. + * + * Note that the Mesh object is WebGL only and does not have a Canvas counterpart. + * + * The Mesh origin is always 0.5 x 0.5 and cannot be changed. + * + * @class Mesh + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @webglOnly + * @since 3.0.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * @extends Phaser.GameObjects.Components.ScrollFactor + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x] - The horizontal position of this Game Object in the world. + * @param {number} [y] - The vertical position of this Game Object in the world. + * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number[]} [vertices] - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} [uvs] - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + */ +var Mesh = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.Mask, + Components.Pipeline, + Components.Size, + Components.Texture, + Components.Transform, + Components.Visible, + Components.ScrollFactor, + MeshRender + ], + + initialize: + + function Mesh (scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (texture === undefined) { texture = '__WHITE'; } + + GameObject.call(this, scene, 'Mesh'); + + /** + * An array containing the Face instances belonging to this Mesh. + * + * A Face consists of 3 Vertex objects. + * + * This array is populated during calls such as `addVertices` or `addOBJ`. + * + * @name Phaser.GameObjects.Mesh#faces + * @type {Phaser.Geom.Mesh.Face[]} + * @since 3.50.0 + */ + this.faces = []; + + /** + * An array containing Vertex instances. One instance per vertex in this Mesh. + * + * This array is populated during calls such as `addVertex` or `addOBJ`. + * + * @name Phaser.GameObjects.Mesh#vertices + * @type {Phaser.Geom.Mesh.Vertex[]} + * @since 3.50.0 + */ + this.vertices = []; + + /** + * The tint fill mode. + * + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertex colors replace the texture, but respects texture alpha. + * + * @name Phaser.GameObjects.Mesh#tintFill + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.tintFill = false; + + /** + * You can optionally choose to render the vertices of this Mesh to a Graphics instance. + * + * Achieve this by setting the `debugCallback` and the `debugGraphic` properties. + * + * You can do this in a single call via the `Mesh.setDebug` method, which will use the + * built-in debug function. You can also set it to your own callback. The callback + * will be invoked _once per render_ and sent the following parameters: + * + * `debugCallback(src, meshLength, verts)` + * + * `src` is the Mesh instance being debugged. + * `meshLength` is the number of mesh vertices in total. + * `verts` is an array of the translated vertex coordinates. + * + * To disable rendering, set this property back to `null`. + * + * Please note that high vertex count Meshes will struggle to debug properly. + * + * @name Phaser.GameObjects.Mesh#debugCallback + * @type {function} + * @since 3.50.0 + */ + this.debugCallback = null; + + /** + * The Graphics instance that the debug vertices will be drawn to, if `setDebug` has + * been called. + * + * @name Phaser.GameObjects.Mesh#debugGraphic + * @type {Phaser.GameObjects.Graphics} + * @since 3.50.0 + */ + this.debugGraphic = null; + + /** + * When rendering, skip any Face that isn't counter clockwise? + * + * Enable this to hide backward-facing Faces during rendering. + * + * Disable it to render all Faces. + * + * @name Phaser.GameObjects.Mesh#hideCCW + * @type {boolean} + * @since 3.50.0 + */ + this.hideCCW = true; + + /** + * A Vector3 containing the 3D position of the vertices in this Mesh. + * + * Modifying the components of this property will allow you to reposition where + * the vertices are rendered within the Mesh. This happens in the `preUpdate` phase, + * where each vertex is transformed using the view and projection matrices. + * + * Changing this property will impact all vertices being rendered by this Mesh. + * + * You can also adjust the 'view' by using the `pan` methods. + * + * @name Phaser.GameObjects.Mesh#modelPosition + * @type {Phaser.Math.Vector3} + * @since 3.50.0 + */ + this.modelPosition = new Vector3(); + + /** + * A Vector3 containing the 3D scale of the vertices in this Mesh. + * + * Modifying the components of this property will allow you to scale + * the vertices within the Mesh. This happens in the `preUpdate` phase, + * where each vertex is transformed using the view and projection matrices. + * + * Changing this property will impact all vertices being rendered by this Mesh. + * + * @name Phaser.GameObjects.Mesh#modelScale + * @type {Phaser.Math.Vector3} + * @since 3.50.0 + */ + this.modelScale = new Vector3(1, 1, 1); + + /** + * A Vector3 containing the 3D rotation of the vertices in this Mesh. + * + * The values should be given in radians, i.e. to rotate the vertices by 90 + * degrees you can use `modelRotation.x = Phaser.Math.DegToRad(90)`. + * + * Modifying the components of this property will allow you to rotate + * the vertices within the Mesh. This happens in the `preUpdate` phase, + * where each vertex is transformed using the view and projection matrices. + * + * Changing this property will impact all vertices being rendered by this Mesh. + * + * @name Phaser.GameObjects.Mesh#modelRotation + * @type {Phaser.Math.Vector3} + * @since 3.50.0 + */ + this.modelRotation = new Vector3(); + + /** + * An internal cache, used to compare position, rotation, scale and face data + * each frame, to avoid math calculations in `preUpdate`. + * + * Cache structure = position xyz | rotation xyz | scale xyz | face count | view | ortho + * + * @name Phaser.GameObjects.Mesh#dirtyCache + * @type {number[]} + * @private + * @since 3.50.0 + */ + this.dirtyCache = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + + /** + * The transformation matrix for this Mesh. + * + * @name Phaser.GameObjects.Mesh#transformMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.transformMatrix = new Matrix4(); + + /** + * The view position for this Mesh. + * + * Use the methods`panX`, `panY` and `panZ` to adjust the view. + * + * @name Phaser.GameObjects.Mesh#viewPosition + * @type {Phaser.Math.Vector3} + * @since 3.50.0 + */ + this.viewPosition = new Vector3(); + + /** + * The view matrix for this Mesh. + * + * @name Phaser.GameObjects.Mesh#viewMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.viewMatrix = new Matrix4(); + + /** + * The projection matrix for this Mesh. + * + * Update it with the `setPerspective` or `setOrtho` methods. + * + * @name Phaser.GameObjects.Mesh#projectionMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.projectionMatrix = new Matrix4(); + + /** + * How many faces were rendered by this Mesh Game Object in the last + * draw? This is reset in the `preUpdate` method and then incremented + * each time a face is drawn. Note that in multi-camera Scenes this + * value may exceed that found in `Mesh.getFaceCount` due to + * cameras drawing the same faces more than once. + * + * @name Phaser.GameObjects.Mesh#totalRendered + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.totalRendered = 0; + + /** + * Internal cache var for the total number of faces rendered this frame. + * + * See `totalRendered` instead for the actual value. + * + * @name Phaser.GameObjects.Mesh#totalFrame + * @type {number} + * @private + * @since 3.50.0 + */ + this.totalFrame = 0; + + /** + * By default, the Mesh will check to see if its model or view transform has + * changed each frame and only recalculate the vertex positions if they have. + * + * This avoids lots of additional math in the `preUpdate` step when not required. + * + * However, if you are performing per-Face or per-Vertex manipulation on this Mesh, + * such as tweening a Face, or moving it without moving the rest of the Mesh, + * then you may need to disable the dirty cache in order for the Mesh to re-render + * correctly. You can toggle this property to do that. Please note that leaving + * this set to `true` will cause the Mesh to recalculate the position of every single + * vertex in it, every single frame. So only really do this if you know you + * need it. + * + * @name Phaser.GameObjects.Mesh#ignoreDirtyCache + * @type {boolean} + * @since 3.50.0 + */ + this.ignoreDirtyCache = false; + + var renderer = scene.sys.renderer; + + this.setPosition(x, y); + this.setTexture(texture, frame); + this.setSize(renderer.width, renderer.height); + this.initPipeline(); + + this.setPerspective(renderer.width, renderer.height, 45, 0.01, 1000); + + if (vertices) + { + this.addVertices(vertices, uvs, indicies, containsZ, normals, colors, alphas); + } + + this.on(GameObjectEvents.ADDED_TO_SCENE, this.addedToScene, this); + this.on(GameObjectEvents.REMOVED_FROM_SCENE, this.removedFromScene, this); + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); + }, + + /** + * Translates the view position of this Mesh on the x axis by the given amount. + * + * @method Phaser.GameObjects.Mesh#panX + * @since 3.50.0 + * + * @param {number} v - The amount to pan by. + */ + panX: function (v) + { + this.viewPosition.addScale(Vector3.LEFT, v); + + this.dirtyCache[10] = 1; + + return this; + }, + + /** + * Translates the view position of this Mesh on the y axis by the given amount. + * + * @method Phaser.GameObjects.Mesh#panY + * @since 3.50.0 + * + * @param {number} v - The amount to pan by. + */ + panY: function (v) + { + this.viewPosition.y += Vector3.DOWN.y * v; + + this.dirtyCache[10] = 1; + + return this; + }, + + /** + * Translates the view position of this Mesh on the z axis by the given amount. + * + * @method Phaser.GameObjects.Mesh#panZ + * @since 3.50.0 + * + * @param {number} v - The amount to pan by. + */ + panZ: function (amount) + { + this.viewPosition.z += amount; + + this.dirtyCache[10] = 1; + + return this; + }, + + /** + * Builds a new perspective projection matrix from the given values. + * + * See also `setOrtho`. + * + * @method Phaser.GameObjects.Mesh#setPerspective + * @since 3.50.0 + * + * @param {number} width - The width of the projection matrix. Typically the same as the Mesh and/or Renderer. + * @param {number} height - The height of the projection matrix. Typically the same as the Mesh and/or Renderer. + * @param {number} [fov=45] - The field of view, in degrees. + * @param {number} [near=0.01] - The near value of the view. + * @param {number} [far=1000] - The far value of the view. + */ + setPerspective: function (width, height, fov, near, far) + { + if (fov === undefined) { fov = 45; } + if (near === undefined) { near = 0.01; } + if (far === undefined) { far = 1000; } + + this.projectionMatrix.perspective(DegToRad(fov), width / height, near, far); + + this.dirtyCache[10] = 1; + this.dirtyCache[11] = 0; + + return this; + }, + + /** + * Builds a new orthographic projection matrix from the given values. + * + * If using this mode you will often need to set `Mesh.hideCCW` to `false` as well. + * + * See also `setPerspective`. + * + * @method Phaser.GameObjects.Mesh#setOrtho + * @since 3.50.0 + * + * @param {number} [scaleX=1] - The default horizontal scale in relation to the Mesh / Renderer dimensions. + * @param {number} [scaleY=1] - The default vertical scale in relation to the Mesh / Renderer dimensions. + * @param {number} [near=-1000] - The near value of the view. + * @param {number} [far=1000] - The far value of the view. + */ + setOrtho: function (scaleX, scaleY, near, far) + { + if (scaleX === undefined) { scaleX = 1; } + if (scaleY === undefined) { scaleY = 1; } + if (near === undefined) { near = -1000; } + if (far === undefined) { far = 1000; } + + this.projectionMatrix.ortho(-scaleX, scaleX, -scaleY, scaleY, near, far); + + this.dirtyCache[10] = 1; + this.dirtyCache[11] = 1; + + return this; + }, + + /** + * Iterates and destroys all current Faces in this Mesh, then resets the + * `faces` and `vertices` arrays. + * + * @method Phaser.GameObjects.Mesh#clear + * @since 3.50.0 + * + * @return {this} This Mesh Game Object. + */ + clear: function () + { + this.faces.forEach(function (face) + { + face.destroy(); + }); + + this.faces = []; + this.vertices = []; + + return this; + }, + + /** + * This method will add the data from a triangulated Wavefront OBJ model file to this Mesh. + * + * The data should have been loaded via the OBJFile: + * + * ```javascript + * this.load.obj(key, url); + * ``` + * + * Then use the same `key` as the first parameter to this method. + * + * Multiple Mesh Game Objects can use the same model data without impacting on each other. + * + * Make sure your 3D package has triangulated the model data prior to exporting it. + * + * You can add multiple models to a single Mesh, although they will act as one when + * moved or rotated. You can scale the model data, should it be too small, or too large, to see. + * You can also offset the vertices of the model via the `x`, `y` and `z` parameters. + * + * @method Phaser.GameObjects.Mesh#addVerticesFromObj + * @since 3.50.0 + * + * @param {string} key - The key of the model data in the OBJ Cache to add to this Mesh. + * @param {number} [scale=1] - An amount to scale the model data by. Use this if the model has exported too small, or large, to see. + * @param {number} [x=0] - Translate the model x position by this amount. + * @param {number} [y=0] - Translate the model y position by this amount. + * @param {number} [z=0] - Translate the model z position by this amount. + * @param {number} [rotateX=0] - Rotate the model on the x axis by this amount, in radians. + * @param {number} [rotateY=0] - Rotate the model on the y axis by this amount, in radians. + * @param {number} [rotateZ=0] - Rotate the model on the z axis by this amount, in radians. + * @param {boolean} [zIsUp=true] - Is the z axis up (true), or is y axis up (false)? + * + * @return {this} This Mesh Game Object. + */ + addVerticesFromObj: function (key, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp) + { + var data = this.scene.sys.cache.obj.get(key); + + if (data) + { + GenerateObjVerts(data, this, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp); + } + + return this; + }, + + /** + * Compare the depth of two Faces. + * + * @method Phaser.GameObjects.Mesh#sortByDepth + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Face} faceA - The first Face. + * @param {Phaser.Geom.Mesh.Face} faceB - The second Face. + * + * @return {number} The difference between the depths of each Face. + */ + sortByDepth: function (faceA, faceB) + { + return faceA.depth - faceB.depth; + }, + + /** + * Runs a depth sort across all Faces in this Mesh, comparing their averaged depth. + * + * This is called automatically if you use any of the `rotate` methods, but you can + * also invoke it to sort the Faces should you manually position them. + * + * @method Phaser.GameObjects.Mesh#depthSort + * @since 3.50.0 + * + * @return {this} This Mesh Game Object. + */ + depthSort: function () + { + StableSort(this.faces, this.sortByDepth); + + return this; + }, + + /** + * Adds a new Vertex into the vertices array of this Mesh. + * + * Just adding a vertex isn't enough to render it. You need to also + * make it part of a Face, with 3 Vertex instances per Face. + * + * @method Phaser.GameObjects.Mesh#addVertex + * @since 3.50.0 + * + * @param {number} x - The x position of the vertex. + * @param {number} y - The y position of the vertex. + * @param {number} z - The z position of the vertex. + * @param {number} u - The UV u coordinate of the vertex. + * @param {number} v - The UV v coordinate of the vertex. + * @param {number} [color=0xffffff] - The color value of the vertex. + * @param {number} [alpha=1] - The alpha value of the vertex. + * + * @return {this} This Mesh Game Object. + */ + addVertex: function (x, y, z, u, v, color, alpha) + { + var vert = new Vertex(x, y, z, u, v, color, alpha); + + this.vertices.push(vert); + + return vert; + }, + + /** + * Adds a new Face into the faces array of this Mesh. + * + * A Face consists of references to 3 Vertex instances, which must be provided. + * + * @method Phaser.GameObjects.Mesh#addFace + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Vertex} vertex1 - The first vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex2 - The second vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex3 - The third vertex of the Face. + * + * @return {this} This Mesh Game Object. + */ + addFace: function (vertex1, vertex2, vertex3) + { + var face = new Face(vertex1, vertex2, vertex3); + + this.faces.push(face); + + this.dirtyCache[9] = -1; + + return face; + }, + + /** + * Adds new vertices to this Mesh by parsing the given data. + * + * This method will take vertex data in one of two formats, based on the `containsZ` parameter. + * + * If your vertex data are `x`, `y` pairs, then `containsZ` should be `false` (this is the default) + * + * If your vertex data is groups of `x`, `y` and `z` values, then the `containsZ` parameter must be true. + * + * The `uvs` parameter is a numeric array consisting of `u` and `v` pairs. + * + * The `normals` parameter is a numeric array consisting of `x`, `y` vertex normal values and, if `containsZ` is true, `z` values as well. + * + * The `indicies` parameter is an optional array that, if given, is an indexed list of vertices to be added. + * + * The `colors` parameter is an optional array, or single value, that if given sets the color of each vertex created. + * + * The `alphas` parameter is an optional array, or single value, that if given sets the alpha of each vertex created. + * + * When providing indexed data it is assumed that _all_ of the arrays are indexed, not just the vertices. + * + * The following example will create a 256 x 256 sized quad using an index array: + * + * ```javascript + * const vertices = [ + * -128, 128, + * 128, 128, + * -128, -128, + * 128, -128 + * ]; + * + * const uvs = [ + * 0, 1, + * 1, 1, + * 0, 0, + * 1, 0 + * ]; + * + * const indices = [ 0, 2, 1, 2, 3, 1 ]; + * + * mesh.addVertices(vertices, uvs, indicies); + * ``` + * + * If the data is not indexed, it's assumed that the arrays all contain sequential data. + * + * @method Phaser.GameObjects.Mesh#addVertices + * @since 3.50.0 + * + * @param {number[]} vertices - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} uvs - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + * + * @return {this} This Mesh Game Object. + */ + addVertices: function (vertices, uvs, indicies, containsZ, normals, colors, alphas) + { + var result = GenerateVerts(vertices, uvs, indicies, containsZ, normals, colors, alphas); + + if (result) + { + this.faces = this.faces.concat(result.faces); + this.vertices = this.vertices.concat(result.vertices); + } + + this.dirtyCache[9] = -1; + + return this; + }, + + /** + * Returns the total number of Faces in this Mesh Game Object. + * + * @method Phaser.GameObjects.Mesh#getFaceCount + * @since 3.50.0 + * + * @return {number} The number of Faces in this Mesh Game Object. + */ + getFaceCount: function () + { + return this.faces.length; + }, + + /** + * Returns the total number of Vertices in this Mesh Game Object. + * + * @method Phaser.GameObjects.Mesh#getVertexCount + * @since 3.50.0 + * + * @return {number} The number of Vertices in this Mesh Game Object. + */ + getVertexCount: function () + { + return this.vertices.length; + }, + + /** + * Returns the Face at the given index in this Mesh Game Object. + * + * @method Phaser.GameObjects.Mesh#getFace + * @since 3.50.0 + * + * @param {number} index - The index of the Face to get. + * + * @return {Phaser.Geom.Mesh.Face} The Face at the given index, or `undefined` if index out of range. + */ + getFace: function (index) + { + return this.faces[index]; + }, + + /** + * Return an array of Face objects from this Mesh that intersect with the given coordinates. + * + * The given position is translated through the matrix of this Mesh and the given Camera, + * before being compared against the vertices. + * + * If more than one Face intersects, they will all be returned in the array, but the array will + * be depth sorted first, so the first element will always be that closest to the camera. + * + * @method Phaser.GameObjects.Mesh#getFaceAt + * @since 3.50.0 + * + * @param {number} x - The x position to check against. + * @param {number} y - The y position to check against. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The camera to pass the coordinates through. If not give, the default Scene Camera is used. + * + * @return {Phaser.Geom.Mesh.Face[]} An array of Face objects that intersect with the given point, ordered by depth. + */ + getFaceAt: function (x, y, camera) + { + if (camera === undefined) { camera = this.scene.sys.cameras.main; } + + var calcMatrix = GetCalcMatrix(this, camera).calc; + + var faces = this.faces; + var results = []; + + for (var i = 0; i < faces.length; i++) + { + var face = faces[i]; + + if (face.contains(x, y, calcMatrix)) + { + results.push(face); + } + } + + return StableSort(results, this.sortByDepth); + }, + + /** + * This method enables rendering of the Mesh vertices to the given Graphics instance. + * + * If you enable this feature, you **must** call `Graphics.clear()` in your Scene `update`, + * otherwise the Graphics instance you provide to debug will fill-up with draw calls, + * eventually crashing the browser. This is not done automatically to allow you to debug + * draw multiple Mesh objects to a single Graphics instance. + * + * The Mesh class has a built-in debug rendering callback `Mesh.renderDebug`, however + * you can also provide your own callback to be used instead. Do this by setting the `callback` parameter. + * + * The callback is invoked _once per render_ and sent the following parameters: + * + * `callback(src, faces)` + * + * `src` is the Mesh instance being debugged. + * `faces` is an array of the Faces that were rendered. + * + * You can get the final drawn vertex position from a Face object like this: + * + * ```javascript + * let face = faces[i]; + * + * let x0 = face.vertex1.tx; + * let y0 = face.vertex1.ty; + * let x1 = face.vertex2.tx; + * let y1 = face.vertex2.ty; + * let x2 = face.vertex3.tx; + * let y2 = face.vertex3.ty; + * + * graphic.strokeTriangle(x0, y0, x1, y1, x2, y2); + * ``` + * + * If using your own callback you do not have to provide a Graphics instance to this method. + * + * To disable debug rendering, to either your own callback or the built-in one, call this method + * with no arguments. + * + * @method Phaser.GameObjects.Mesh#setDebug + * @since 3.50.0 + * + * @param {Phaser.GameObjects.Graphics} [graphic] - The Graphic instance to render to if using the built-in callback. + * @param {function} [callback] - The callback to invoke during debug render. Leave as undefined to use the built-in callback. + * + * @return {this} This Game Object instance. + */ + setDebug: function (graphic, callback) + { + this.debugGraphic = graphic; + + if (!graphic && !callback) + { + this.debugCallback = null; + } + else if (!callback) + { + this.debugCallback = this.renderDebug; + } + else + { + this.debugCallback = callback; + } + + return this; + }, + + /** + * Checks if the transformation data in this mesh is dirty. + * + * This is used internally by the `preUpdate` step to determine if the vertices should + * be recalculated or not. + * + * @method Phaser.GameObjects.Mesh#isDirty + * @since 3.50.0 + * + * @return {boolean} Returns `true` if the data of this mesh is dirty, otherwise `false`. + */ + isDirty: function () + { + var position = this.modelPosition; + var rotation = this.modelRotation; + var scale = this.modelScale; + var dirtyCache = this.dirtyCache; + + var px = position.x; + var py = position.y; + var pz = position.z; + + var rx = rotation.x; + var ry = rotation.y; + var rz = rotation.z; + + var sx = scale.x; + var sy = scale.y; + var sz = scale.z; + + var faces = this.getFaceCount(); + + var pxCached = dirtyCache[0]; + var pyCached = dirtyCache[1]; + var pzCached = dirtyCache[2]; + + var rxCached = dirtyCache[3]; + var ryCached = dirtyCache[4]; + var rzCached = dirtyCache[5]; + + var sxCached = dirtyCache[6]; + var syCached = dirtyCache[7]; + var szCached = dirtyCache[8]; + + var fCached = dirtyCache[9]; + + dirtyCache[0] = px; + dirtyCache[1] = py; + dirtyCache[2] = pz; + + dirtyCache[3] = rx; + dirtyCache[4] = ry; + dirtyCache[5] = rz; + + dirtyCache[6] = sx; + dirtyCache[7] = sy; + dirtyCache[8] = sz; + + dirtyCache[9] = faces; + + return ( + pxCached !== px || pyCached !== py || pzCached !== pz || + rxCached !== rx || ryCached !== ry || rzCached !== rz || + sxCached !== sx || syCached !== sy || szCached !== sz || + fCached !== faces + ); + }, + + /** + * The Mesh update loop. The following takes place in this method: + * + * First, the `totalRendered` and `totalFrame` properties are set. + * + * If the view matrix of this Mesh isn't dirty, and the model position, rotate or scale properties are + * all clean, then the method returns at this point. + * + * Otherwise, if the viewPosition is dirty (i.e. from calling a method like `panZ`), then it will + * refresh the viewMatrix. + * + * After this, a new transformMatrix is built and it then iterates through all Faces in this + * Mesh, calling `transformCoordinatesLocal` on all of them. Internally, this updates every + * vertex, calculating its new transformed position, based on the new transform matrix. + * + * Finally, the faces are depth sorted. + * + * @method Phaser.GameObjects.Mesh#preUpdate + * @protected + * @since 3.50.0 + * + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. + */ + preUpdate: function () + { + this.totalRendered = this.totalFrame; + this.totalFrame = 0; + + var dirty = this.dirtyCache; + + if (!this.ignoreDirtyCache && !dirty[10] && !this.isDirty()) + { + // If neither the view or the mesh is dirty we can bail out and save lots of math + return; + } + + var width = this.width; + var height = this.height; + + var viewMatrix = this.viewMatrix; + var viewPosition = this.viewPosition; + + if (dirty[10]) + { + viewMatrix.identity(); + viewMatrix.translate(viewPosition); + viewMatrix.invert(); + + dirty[10] = 0; + } + + var transformMatrix = this.transformMatrix; + + transformMatrix.setWorldMatrix( + this.modelRotation, + this.modelPosition, + this.modelScale, + this.viewMatrix, + this.projectionMatrix + ); + + var z = viewPosition.z; + + var faces = this.faces; + + for (var i = 0; i < faces.length; i++) + { + faces[i].transformCoordinatesLocal(transformMatrix, width, height, z); + } + + this.depthSort(); + }, + + /** + * The built-in Mesh debug rendering method. + * + * See `Mesh.setDebug` for more details. + * + * @method Phaser.GameObjects.Mesh#renderDebug + * @since 3.50.0 + * + * @param {Phaser.GameObjects.Mesh} src - The Mesh object being rendered. + * @param {Phaser.Geom.Mesh.Face[]} faces - An array of Faces. + */ + renderDebug: function (src, faces) + { + var graphic = src.debugGraphic; + + for (var i = 0; i < faces.length; i++) + { + var face = faces[i]; + + var x0 = face.vertex1.tx; + var y0 = face.vertex1.ty; + var x1 = face.vertex2.tx; + var y1 = face.vertex2.ty; + var x2 = face.vertex3.tx; + var y2 = face.vertex3.ty; + + graphic.strokeTriangle(x0, y0, x1, y1, x2, y2); + } + }, + + /** + * Handles the pre-destroy step for the Mesh, which removes the Animation component and typed arrays. + * + * @method Phaser.GameObjects.Mesh#preDestroy + * @private + * @since 3.50.0 + */ + preDestroy: function () + { + this.clear(); + + this.debugCallback = null; + this.debugGraphic = null; + } + +}); + +module.exports = Mesh; + + +/***/ }), +/* 222 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var DistanceBetween = __webpack_require__(61); /** * Checks if two Circles intersect. @@ -56253,7 +61059,7 @@ module.exports = CircleToCircle; /***/ }), -/* 217 */ +/* 223 */ /***/ (function(module, exports) { /** @@ -56307,7 +61113,7 @@ module.exports = CircleToRectangle; /***/ }), -/* 218 */ +/* 224 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56318,7 +61124,7 @@ module.exports = CircleToRectangle; */ var Point = __webpack_require__(4); -var LineToCircle = __webpack_require__(219); +var LineToCircle = __webpack_require__(225); /** * Checks for intersection between the line segment and circle, @@ -56399,7 +61205,7 @@ module.exports = GetLineToCircle; /***/ }), -/* 219 */ +/* 225 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56408,7 +61214,7 @@ module.exports = GetLineToCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(57); +var Contains = __webpack_require__(62); var Point = __webpack_require__(4); var tmp = new Point(); @@ -56483,7 +61289,7 @@ module.exports = LineToCircle; /***/ }), -/* 220 */ +/* 226 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56494,8 +61300,8 @@ module.exports = LineToCircle; */ var Point = __webpack_require__(4); -var LineToLine = __webpack_require__(86); -var LineToRectangle = __webpack_require__(453); +var LineToLine = __webpack_require__(91); +var LineToRectangle = __webpack_require__(465); /** * Checks for intersection between the Line and a Rectangle shape, @@ -56543,7 +61349,7 @@ module.exports = GetLineToRectangle; /***/ }), -/* 221 */ +/* 227 */ /***/ (function(module, exports) { /** @@ -56630,7 +61436,7 @@ module.exports = ContainsArray; /***/ }), -/* 222 */ +/* 228 */ /***/ (function(module, exports) { /** @@ -56678,7 +61484,7 @@ module.exports = RotateAroundXY; /***/ }), -/* 223 */ +/* 229 */ /***/ (function(module, exports) { /** @@ -56706,7 +61512,7 @@ module.exports = GetAspectRatio; /***/ }), -/* 224 */ +/* 230 */ /***/ (function(module, exports) { /** @@ -56760,7 +61566,7 @@ module.exports = RotateAroundXY; /***/ }), -/* 225 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56775,18 +61581,18 @@ module.exports = RotateAroundXY; module.exports = { - BUTTON_DOWN: __webpack_require__(1226), - BUTTON_UP: __webpack_require__(1227), - CONNECTED: __webpack_require__(1228), - DISCONNECTED: __webpack_require__(1229), - GAMEPAD_BUTTON_DOWN: __webpack_require__(1230), - GAMEPAD_BUTTON_UP: __webpack_require__(1231) + BUTTON_DOWN: __webpack_require__(1290), + BUTTON_UP: __webpack_require__(1291), + CONNECTED: __webpack_require__(1292), + DISCONNECTED: __webpack_require__(1293), + GAMEPAD_BUTTON_DOWN: __webpack_require__(1294), + GAMEPAD_BUTTON_UP: __webpack_require__(1295) }; /***/ }), -/* 226 */ +/* 232 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56795,8 +61601,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(19); -var XHRSettings = __webpack_require__(147); +var Extend = __webpack_require__(18); +var XHRSettings = __webpack_require__(149); /** * Takes two XHRSettings Objects and creates a new XHRSettings object from them. @@ -56834,7 +61640,7 @@ module.exports = MergeXHRSettings; /***/ }), -/* 227 */ +/* 233 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -56844,12 +61650,12 @@ module.exports = MergeXHRSettings; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var ParseXML = __webpack_require__(375); +var ParseXML = __webpack_require__(385); /** * @classdesc @@ -57019,7 +61825,186 @@ module.exports = XMLFile; /***/ }), -/* 228 */ +/* 234 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var CONST = __webpack_require__(19); +var File = __webpack_require__(22); +var FileTypesManager = __webpack_require__(8); +var GetFastValue = __webpack_require__(2); +var IsPlainObject = __webpack_require__(7); + +/** + * @classdesc + * A single Text File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#text method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#text. + * + * @class TextFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var TextFile = new Class({ + + Extends: File, + + initialize: + + function TextFile (loader, key, url, xhrSettings) + { + var type = 'text'; + var extension = 'txt'; + var cache = loader.cacheManager.text; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + type = GetFastValue(config, 'type', type); + cache = GetFastValue(config, 'cache', cache); + } + + var fileConfig = { + type: type, + cache: cache, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.TextFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; + + this.data = this.xhrLoader.responseText; + + this.onProcessComplete(); + } + +}); + +/** + * Adds a Text file, or array of Text files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.text('story', 'files/IntroStory.txt'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Text Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Text Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Text Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.text({ + * key: 'story', + * url: 'files/IntroStory.txt' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.TextFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.text('story', 'files/IntroStory.txt'); + * // and later in your game ... + * var data = this.cache.text.get('story'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the text from the Text Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.txt". It will always add `.txt` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Text File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#text + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('text', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new TextFile(this, key[i])); + } + } + else + { + this.addFile(new TextFile(this, key, url, xhrSettings)); + } + + return this; +}); + +module.exports = TextFile; + + +/***/ }), +/* 235 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57034,26 +62019,27 @@ module.exports = XMLFile; module.exports = { - Acceleration: __webpack_require__(1285), - Angular: __webpack_require__(1286), - Bounce: __webpack_require__(1287), - Debug: __webpack_require__(1288), - Drag: __webpack_require__(1289), - Enable: __webpack_require__(1290), - Friction: __webpack_require__(1291), - Gravity: __webpack_require__(1292), - Immovable: __webpack_require__(1293), - Mass: __webpack_require__(1294), - OverlapCirc: __webpack_require__(484), - OverlapRect: __webpack_require__(229), - Size: __webpack_require__(1295), - Velocity: __webpack_require__(1296) + Acceleration: __webpack_require__(1348), + Angular: __webpack_require__(1349), + Bounce: __webpack_require__(1350), + Debug: __webpack_require__(1351), + Drag: __webpack_require__(1352), + Enable: __webpack_require__(1353), + Friction: __webpack_require__(1354), + Gravity: __webpack_require__(1355), + Immovable: __webpack_require__(1356), + Mass: __webpack_require__(1357), + OverlapCirc: __webpack_require__(500), + OverlapRect: __webpack_require__(236), + Pushable: __webpack_require__(1358), + Size: __webpack_require__(1359), + Velocity: __webpack_require__(1360) }; /***/ }), -/* 229 */ +/* 236 */ /***/ (function(module, exports) { /** @@ -57138,7 +62124,7 @@ module.exports = OverlapRect; /***/ }), -/* 230 */ +/* 237 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57153,20 +62139,20 @@ module.exports = OverlapRect; module.exports = { - COLLIDE: __webpack_require__(1297), - OVERLAP: __webpack_require__(1298), - PAUSE: __webpack_require__(1299), - RESUME: __webpack_require__(1300), - TILE_COLLIDE: __webpack_require__(1301), - TILE_OVERLAP: __webpack_require__(1302), - WORLD_BOUNDS: __webpack_require__(1303), - WORLD_STEP: __webpack_require__(1304) + COLLIDE: __webpack_require__(1361), + OVERLAP: __webpack_require__(1362), + PAUSE: __webpack_require__(1363), + RESUME: __webpack_require__(1364), + TILE_COLLIDE: __webpack_require__(1365), + TILE_OVERLAP: __webpack_require__(1366), + WORLD_BOUNDS: __webpack_require__(1367), + WORLD_STEP: __webpack_require__(1368) }; /***/ }), -/* 231 */ +/* 238 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57175,7 +62161,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(52); +var CONST = __webpack_require__(59); /** * Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties @@ -57219,13 +62205,13 @@ var GetOverlapX = function (body1, body2, overlapOnly, bias) body2.touching.none = false; body2.touching.left = true; - if (body2.physicsType === CONST.STATIC_BODY) + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) { body1.blocked.none = false; body1.blocked.right = true; } - if (body1.physicsType === CONST.STATIC_BODY) + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) { body2.blocked.none = false; body2.blocked.left = true; @@ -57249,13 +62235,13 @@ var GetOverlapX = function (body1, body2, overlapOnly, bias) body2.touching.none = false; body2.touching.right = true; - if (body2.physicsType === CONST.STATIC_BODY) + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) { body1.blocked.none = false; body1.blocked.left = true; } - if (body1.physicsType === CONST.STATIC_BODY) + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) { body2.blocked.none = false; body2.blocked.right = true; @@ -57274,7 +62260,7 @@ module.exports = GetOverlapX; /***/ }), -/* 232 */ +/* 239 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57283,7 +62269,7 @@ module.exports = GetOverlapX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(52); +var CONST = __webpack_require__(59); /** * Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties @@ -57327,13 +62313,13 @@ var GetOverlapY = function (body1, body2, overlapOnly, bias) body2.touching.none = false; body2.touching.up = true; - if (body2.physicsType === CONST.STATIC_BODY) + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) { body1.blocked.none = false; body1.blocked.down = true; } - if (body1.physicsType === CONST.STATIC_BODY) + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) { body2.blocked.none = false; body2.blocked.up = true; @@ -57357,13 +62343,13 @@ var GetOverlapY = function (body1, body2, overlapOnly, bias) body2.touching.none = false; body2.touching.down = true; - if (body2.physicsType === CONST.STATIC_BODY) + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) { body1.blocked.none = false; body1.blocked.up = true; } - if (body1.physicsType === CONST.STATIC_BODY) + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) { body2.blocked.none = false; body2.blocked.down = true; @@ -57382,7 +62368,7 @@ module.exports = GetOverlapY; /***/ }), -/* 233 */ +/* 240 */ /***/ (function(module, exports) { /** @@ -57418,7 +62404,7 @@ module.exports = TileIntersectsBody; /***/ }), -/* 234 */ +/* 241 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57435,12 +62421,12 @@ var Constraint = {}; module.exports = Constraint; -var Vertices = __webpack_require__(88); -var Vector = __webpack_require__(102); -var Sleeping = __webpack_require__(250); -var Bounds = __webpack_require__(103); -var Axes = __webpack_require__(542); -var Common = __webpack_require__(44); +var Vertices = __webpack_require__(93); +var Vector = __webpack_require__(114); +var Sleeping = __webpack_require__(265); +var Bounds = __webpack_require__(115); +var Axes = __webpack_require__(581); +var Common = __webpack_require__(50); (function() { @@ -57907,7 +62893,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 235 */ +/* 242 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -57916,7 +62902,143 @@ var Common = __webpack_require__(44); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTileAt = __webpack_require__(150); +var CONST = __webpack_require__(29); + +/** + * Get the Tilemap orientation from the given string. + * + * @function Phaser.Tilemaps.Orientation.FromOrientationString + * @since 3.50.0 + * + * @param {string} [orientation] - The orientation type as a string. + * + * @return {Phaser.Tilemaps.OrientationType} The Tilemap Orientation type. + */ +var FromOrientationString = function (orientation) +{ + orientation = orientation.toLowerCase(); + + if (orientation === 'isometric') + { + return CONST.ISOMETRIC; + } + else if (orientation === 'staggered') + { + return CONST.STAGGERED; + } + else if (orientation === 'hexagonal') + { + return CONST.HEXAGONAL; + } + else + { + return CONST.ORTHOGONAL; + } +}; + +module.exports = FromOrientationString; + + +/***/ }), +/* 243 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Tilemaps.Components + */ + +module.exports = { + + CalculateFacesAt: __webpack_require__(244), + CalculateFacesWithin: __webpack_require__(60), + CheckIsoBounds: __webpack_require__(520), + Copy: __webpack_require__(1393), + CreateFromTiles: __webpack_require__(1394), + CullBounds: __webpack_require__(522), + CullTiles: __webpack_require__(523), + Fill: __webpack_require__(1395), + FilterTiles: __webpack_require__(1396), + FindByIndex: __webpack_require__(1397), + FindTile: __webpack_require__(1398), + ForEachTile: __webpack_require__(1399), + GetCullTilesFunction: __webpack_require__(1400), + GetTileAt: __webpack_require__(151), + GetTileAtWorldXY: __webpack_require__(1401), + GetTilesWithin: __webpack_require__(26), + GetTilesWithinShape: __webpack_require__(1402), + GetTilesWithinWorldXY: __webpack_require__(506), + GetTileToWorldXFunction: __webpack_require__(1403), + GetTileToWorldXYFunction: __webpack_require__(1404), + GetTileToWorldYFunction: __webpack_require__(1405), + GetWorldToTileXFunction: __webpack_require__(1406), + GetWorldToTileXYFunction: __webpack_require__(1407), + GetWorldToTileYFunction: __webpack_require__(1408), + HasTileAt: __webpack_require__(541), + HasTileAtWorldXY: __webpack_require__(1409), + HexagonalCullBounds: __webpack_require__(525), + HexagonalCullTiles: __webpack_require__(524), + HexagonalTileToWorldXY: __webpack_require__(529), + HexagonalTileToWorldY: __webpack_require__(533), + HexagonalWorldToTileXY: __webpack_require__(535), + HexagonalWorldToTileY: __webpack_require__(539), + IsInLayerBounds: __webpack_require__(116), + IsometricCullTiles: __webpack_require__(526), + IsometricTileToWorldXY: __webpack_require__(530), + IsometricWorldToTileXY: __webpack_require__(536), + PutTileAt: __webpack_require__(249), + PutTileAtWorldXY: __webpack_require__(1410), + PutTilesAt: __webpack_require__(1411), + Randomize: __webpack_require__(1412), + RemoveTileAt: __webpack_require__(542), + RemoveTileAtWorldXY: __webpack_require__(1413), + RenderDebug: __webpack_require__(1414), + ReplaceByIndex: __webpack_require__(521), + RunCull: __webpack_require__(152), + SetCollision: __webpack_require__(1415), + SetCollisionBetween: __webpack_require__(1416), + SetCollisionByExclusion: __webpack_require__(1417), + SetCollisionByProperty: __webpack_require__(1418), + SetCollisionFromCollisionGroup: __webpack_require__(1419), + SetLayerCollisionIndex: __webpack_require__(153), + SetTileCollision: __webpack_require__(69), + SetTileIndexCallback: __webpack_require__(1420), + SetTileLocationCallback: __webpack_require__(1421), + Shuffle: __webpack_require__(1422), + StaggeredCullBounds: __webpack_require__(528), + StaggeredCullTiles: __webpack_require__(527), + StaggeredTileToWorldXY: __webpack_require__(531), + StaggeredTileToWorldY: __webpack_require__(534), + StaggeredWorldToTileXY: __webpack_require__(537), + StaggeredWorldToTileY: __webpack_require__(540), + SwapByIndex: __webpack_require__(1423), + TileToWorldX: __webpack_require__(245), + TileToWorldXY: __webpack_require__(532), + TileToWorldY: __webpack_require__(246), + WeightedRandomize: __webpack_require__(1424), + WorldToTileX: __webpack_require__(247), + WorldToTileXY: __webpack_require__(538), + WorldToTileY: __webpack_require__(248) + +}; + + +/***/ }), +/* 244 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTileAt = __webpack_require__(151); /** * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting @@ -57926,8 +63048,8 @@ var GetTileAt = __webpack_require__(150); * @function Phaser.Tilemaps.Components.CalculateFacesAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. + * @param {number} tileX - The x coordinate. + * @param {number} tileY - The y coordinate. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var CalculateFacesAt = function (tileX, tileY, layer) @@ -58001,7 +63123,191 @@ module.exports = CalculateFacesAt; /***/ }), -/* 236 */ +/* 245 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.TileToWorldX + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} + */ +var TileToWorldX = function (tileX, camera, layer) +{ + var tileWidth = layer.baseTileWidth; + var tilemapLayer = layer.tilemapLayer; + var layerWorldX = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + + tileWidth *= tilemapLayer.scaleX; + } + + return layerWorldX + tileX * tileWidth; +}; + +module.exports = TileToWorldX; + + +/***/ }), +/* 246 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.TileToWorldY + * @since 3.0.0 + * + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in world coordinates. + */ +var TileToWorldY = function (tileY, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + return layerWorldY + tileY * tileHeight; +}; + +module.exports = TileToWorldY; + + +/***/ }), +/* 247 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.WorldToTileX + * @since 3.0.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The X location in tile units. + */ +var WorldToTileX = function (worldX, snapToFloor, camera, layer) +{ + if (snapToFloor === undefined) { snapToFloor = true; } + + var tileWidth = layer.baseTileWidth; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + + tileWidth *= tilemapLayer.scaleX; + } + + return (snapToFloor) ? Math.floor(worldX / tileWidth) : worldX / tileWidth; +}; + +module.exports = WorldToTileX; + + +/***/ }), +/* 248 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.WorldToTileY + * @since 3.0.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in tile units. + */ +var WorldToTileY = function (worldY, snapToFloor, camera, layer) +{ + if (snapToFloor === undefined) { snapToFloor = true; } + + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + return (snapToFloor) ? Math.floor(worldY / tileHeight) : worldY / tileHeight; +}; + +module.exports = WorldToTileY; + + +/***/ }), +/* 249 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58010,10 +63316,10 @@ module.exports = CalculateFacesAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Tile = __webpack_require__(75); -var IsInLayerBounds = __webpack_require__(104); -var CalculateFacesAt = __webpack_require__(235); -var SetTileCollision = __webpack_require__(65); +var Tile = __webpack_require__(81); +var IsInLayerBounds = __webpack_require__(116); +var CalculateFacesAt = __webpack_require__(244); +var SetTileCollision = __webpack_require__(69); /** * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index @@ -58024,19 +63330,23 @@ var SetTileCollision = __webpack_require__(65); * @function Phaser.Tilemaps.Components.PutTileAt * @since 3.0.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. */ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) { - if (!IsInLayerBounds(tileX, tileY, layer)) { return null; } if (recalculateFaces === undefined) { recalculateFaces = true; } + if (!IsInLayerBounds(tileX, tileY, layer)) + { + return null; + } + var oldTile = layer.data[tileY][tileX]; var oldTileCollides = oldTile && oldTile.collides; @@ -58044,7 +63354,7 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) { if (layer.data[tileY][tileX] === null) { - layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height); + layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, layer.tileWidth, layer.tileHeight); } layer.data[tileY][tileX].copy(tile); @@ -58082,7 +63392,7 @@ module.exports = PutTileAt; /***/ }), -/* 237 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58091,10 +63401,10 @@ module.exports = PutTileAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var LayerData = __webpack_require__(105); -var MapData = __webpack_require__(106); -var Tile = __webpack_require__(75); +var Formats = __webpack_require__(38); +var LayerData = __webpack_require__(117); +var MapData = __webpack_require__(118); +var Tile = __webpack_require__(81); /** * Parses a 2D array of tile indexes into a new MapData object with a single layer. @@ -58103,9 +63413,9 @@ var Tile = __webpack_require__(75); * @since 3.0.0 * * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {integer[][]} data - 2D array, CSV string or Tiled JSON object. - * @param {integer} tileWidth - The width of a tile in pixels. - * @param {integer} tileHeight - The height of a tile in pixels. + * @param {number[][]} data - 2D array, CSV string or Tiled JSON object. + * @param {number} tileWidth - The width of a tile in pixels. + * @param {number} tileHeight - The height of a tile in pixels. * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty * location will get a Tile object with an index of -1. If you've a large sparsely populated map and @@ -58121,7 +63431,7 @@ var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull) tileWidth: tileWidth, tileHeight: tileHeight }); - + var mapData = new MapData({ name: name, tileWidth: tileWidth, @@ -58174,7 +63484,87 @@ module.exports = Parse2DArray; /***/ }), -/* 238 */ +/* 251 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Pick = __webpack_require__(550); +var ParseGID = __webpack_require__(252); + +var copyPoints = function (p) { return { x: p.x, y: p.y }; }; + +var commonObjectProps = [ 'id', 'name', 'type', 'rotation', 'properties', 'visible', 'x', 'y', 'width', 'height' ]; + +/** + * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.) + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseObject + * @since 3.0.0 + * + * @param {object} tiledObject - Tiled object to convert to an internal parsed object normalising and copying properties over. + * @param {number} [offsetX=0] - Optional additional offset to apply to the object's x property. Defaults to 0. + * @param {number} [offsetY=0] - Optional additional offset to apply to the object's y property. Defaults to 0. + * + * @return {object} The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets. + */ +var ParseObject = function (tiledObject, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } + + var parsedObject = Pick(tiledObject, commonObjectProps); + + parsedObject.x += offsetX; + parsedObject.y += offsetY; + + if (tiledObject.gid) + { + // Object tiles + var gidInfo = ParseGID(tiledObject.gid); + parsedObject.gid = gidInfo.gid; + parsedObject.flippedHorizontal = gidInfo.flippedHorizontal; + parsedObject.flippedVertical = gidInfo.flippedVertical; + parsedObject.flippedAntiDiagonal = gidInfo.flippedAntiDiagonal; + } + else if (tiledObject.polyline) + { + parsedObject.polyline = tiledObject.polyline.map(copyPoints); + } + else if (tiledObject.polygon) + { + parsedObject.polygon = tiledObject.polygon.map(copyPoints); + } + else if (tiledObject.ellipse) + { + parsedObject.ellipse = tiledObject.ellipse; + } + else if (tiledObject.text) + { + parsedObject.text = tiledObject.text; + } + else if (tiledObject.point) + { + parsedObject.point = true; + } + else + { + // Otherwise, assume it is a rectangle + parsedObject.rectangle = true; + } + + return parsedObject; +}; + +module.exports = ParseObject; + + +/***/ }), +/* 252 */ /***/ (function(module, exports) { /** @@ -58264,7 +63654,7 @@ module.exports = ParseGID; /***/ }), -/* 239 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58273,90 +63663,10 @@ module.exports = ParseGID; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Pick = __webpack_require__(514); -var ParseGID = __webpack_require__(238); - -var copyPoints = function (p) { return { x: p.x, y: p.y }; }; - -var commonObjectProps = [ 'id', 'name', 'type', 'rotation', 'properties', 'visible', 'x', 'y', 'width', 'height' ]; - -/** - * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.) - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseObject - * @since 3.0.0 - * - * @param {object} tiledObject - Tiled object to convert to an internal parsed object normalising and copying properties over. - * @param {number} [offsetX=0] - Optional additional offset to apply to the object's x property. Defaults to 0. - * @param {number} [offsetY=0] - Optional additional offset to apply to the object's y property. Defaults to 0. - * - * @return {object} The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets. - */ -var ParseObject = function (tiledObject, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - var parsedObject = Pick(tiledObject, commonObjectProps); - - parsedObject.x += offsetX; - parsedObject.y += offsetY; - - if (tiledObject.gid) - { - // Object tiles - var gidInfo = ParseGID(tiledObject.gid); - parsedObject.gid = gidInfo.gid; - parsedObject.flippedHorizontal = gidInfo.flippedHorizontal; - parsedObject.flippedVertical = gidInfo.flippedVertical; - parsedObject.flippedAntiDiagonal = gidInfo.flippedAntiDiagonal; - } - else if (tiledObject.polyline) - { - parsedObject.polyline = tiledObject.polyline.map(copyPoints); - } - else if (tiledObject.polygon) - { - parsedObject.polygon = tiledObject.polygon.map(copyPoints); - } - else if (tiledObject.ellipse) - { - parsedObject.ellipse = tiledObject.ellipse; - } - else if (tiledObject.text) - { - parsedObject.text = tiledObject.text; - } - else if (tiledObject.point) - { - parsedObject.point = true; - } - else - { - // Otherwise, assume it is a rectangle - parsedObject.rectangle = true; - } - - return parsedObject; -}; - -module.exports = ParseObject; - - -/***/ }), -/* 240 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Formats = __webpack_require__(33); -var MapData = __webpack_require__(106); -var Parse = __webpack_require__(506); -var Tilemap = __webpack_require__(522); +var Formats = __webpack_require__(38); +var MapData = __webpack_require__(118); +var Parse = __webpack_require__(543); +var Tilemap = __webpack_require__(559); /** * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When @@ -58366,14 +63676,14 @@ var Tilemap = __webpack_require__(522); * * @function Phaser.Tilemaps.ParseToTilemap * @since 3.0.0 - * + * * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. - * @param {integer} [tileWidth=32] - The width of a tile in pixels. - * @param {integer} [tileHeight=32] - The height of a tile in pixels. - * @param {integer} [width=10] - The width of the map in tiles. - * @param {integer} [height=10] - The height of the map in tiles. - * @param {integer[][]} [data] - Instead of loading from the cache, you can also load directly from + * @param {number} [tileWidth=32] - The width of a tile in pixels. + * @param {number} [tileHeight=32] - The height of a tile in pixels. + * @param {number} [width=10] - The width of the map in tiles. + * @param {number} [height=10] - The height of the map in tiles. + * @param {number[][]} [data] - Instead of loading from the cache, you can also load directly from * a 2D array of tile indexes. * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty @@ -58381,7 +63691,7 @@ var Tilemap = __webpack_require__(522); * the tile data doesn't need to change then setting this value to `true` will help with memory * consumption. However if your map is small or you need to update the tiles dynamically, then leave * the default value set. - * + * * @return {Phaser.Tilemaps.Tilemap} */ var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull) @@ -58430,7 +63740,7 @@ module.exports = ParseToTilemap; /***/ }), -/* 241 */ +/* 254 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58479,7 +63789,7 @@ module.exports = GetTargets; /***/ }), -/* 242 */ +/* 255 */ /***/ (function(module, exports) { /** @@ -58747,7 +64057,7 @@ module.exports = GetValueOp; /***/ }), -/* 243 */ +/* 256 */ /***/ (function(module, exports) { /** @@ -58791,7 +64101,7 @@ module.exports = TWEEN_DEFAULTS; /***/ }), -/* 244 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -58801,11 +64111,11 @@ module.exports = TWEEN_DEFAULTS; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(245); -var GameObjectCreator = __webpack_require__(16); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(258); +var GameObjectCreator = __webpack_require__(17); var GameObjectFactory = __webpack_require__(5); -var TWEEN_CONST = __webpack_require__(91); +var TWEEN_CONST = __webpack_require__(96); var MATH_CONST = __webpack_require__(13); /** @@ -58866,7 +64176,7 @@ var Tween = new Class({ * The cached length of the data array. * * @name Phaser.Tweens.Tween#totalData - * @type {integer} + * @type {number} * @since 3.0.0 */ this.totalData = data.length; @@ -58884,7 +64194,7 @@ var Tween = new Class({ * Cached target total (not necessarily the same as the data total) * * @name Phaser.Tweens.Tween#totalTargets - * @type {integer} + * @type {number} * @since 3.0.0 */ this.totalTargets = targets.length; @@ -59019,7 +64329,7 @@ var Tween = new Class({ * The current state of the tween * * @name Phaser.Tweens.Tween#state - * @type {integer} + * @type {number} * @since 3.0.0 */ this.state = TWEEN_CONST.PENDING_ADD; @@ -59028,7 +64338,7 @@ var Tween = new Class({ * The state of the tween when it was paused (used by Resume) * * @name Phaser.Tweens.Tween#_pausedState - * @type {integer} + * @type {number} * @private * @since 3.0.0 */ @@ -59148,7 +64458,7 @@ var Tween = new Class({ * @method Phaser.Tweens.Tween#getValue * @since 3.0.0 * - * @param {integer} [index=0] - The Tween Data to return the value from. + * @param {number} [index=0] - The Tween Data to return the value from. * * @return {number} The value of the requested Tween Data. */ @@ -60080,7 +65390,7 @@ var Tween = new Class({ * @param {Phaser.Types.Tweens.TweenDataConfig} tweenData - The TweenData property to update. * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. * - * @return {integer} The state of this Tween. + * @return {number} The state of this Tween. */ setStateFromEnd: function (tween, tweenData, diff) { @@ -60166,7 +65476,7 @@ var Tween = new Class({ * @param {Phaser.Types.Tweens.TweenDataConfig} tweenData - The TweenData property to update. * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. * - * @return {integer} The state of this Tween. + * @return {number} The state of this Tween. */ setStateFromStart: function (tween, tweenData, diff) { @@ -60434,7 +65744,7 @@ module.exports = Tween; /***/ }), -/* 245 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60449,26 +65759,26 @@ module.exports = Tween; module.exports = { - TIMELINE_COMPLETE: __webpack_require__(1376), - TIMELINE_LOOP: __webpack_require__(1377), - TIMELINE_PAUSE: __webpack_require__(1378), - TIMELINE_RESUME: __webpack_require__(1379), - TIMELINE_START: __webpack_require__(1380), - TIMELINE_UPDATE: __webpack_require__(1381), - TWEEN_ACTIVE: __webpack_require__(1382), - TWEEN_COMPLETE: __webpack_require__(1383), - TWEEN_LOOP: __webpack_require__(1384), - TWEEN_REPEAT: __webpack_require__(1385), - TWEEN_START: __webpack_require__(1386), - TWEEN_STOP: __webpack_require__(1387), - TWEEN_UPDATE: __webpack_require__(1388), - TWEEN_YOYO: __webpack_require__(1389) + TIMELINE_COMPLETE: __webpack_require__(1438), + TIMELINE_LOOP: __webpack_require__(1439), + TIMELINE_PAUSE: __webpack_require__(1440), + TIMELINE_RESUME: __webpack_require__(1441), + TIMELINE_START: __webpack_require__(1442), + TIMELINE_UPDATE: __webpack_require__(1443), + TWEEN_ACTIVE: __webpack_require__(1444), + TWEEN_COMPLETE: __webpack_require__(1445), + TWEEN_LOOP: __webpack_require__(1446), + TWEEN_REPEAT: __webpack_require__(1447), + TWEEN_START: __webpack_require__(1448), + TWEEN_STOP: __webpack_require__(1449), + TWEEN_UPDATE: __webpack_require__(1450), + TWEEN_YOYO: __webpack_require__(1451) }; /***/ }), -/* 246 */ +/* 259 */ /***/ (function(module, exports) { /** @@ -60488,7 +65798,7 @@ module.exports = { * @since 3.0.0 * * @param {any} target - The target to tween. - * @param {integer} index - The target index within the Tween targets array. + * @param {number} index - The target index within the Tween targets array. * @param {string} key - The property of the target to tween. * @param {function} getEnd - What the property will be at the END of the Tween. * @param {function} getStart - What the property will be at the START of the Tween. @@ -60595,7 +65905,7 @@ module.exports = TweenData; /***/ }), -/* 247 */ +/* 260 */ /***/ (function(module, exports) { /** @@ -60617,7 +65927,7 @@ var ScaleModes = { * Default Scale Mode (Linear). * * @name Phaser.ScaleModes.DEFAULT - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -60627,7 +65937,7 @@ var ScaleModes = { * Linear Scale Mode. * * @name Phaser.ScaleModes.LINEAR - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -60637,7 +65947,7 @@ var ScaleModes = { * Nearest Scale Mode. * * @name Phaser.ScaleModes.NEAREST - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -60649,7 +65959,7 @@ module.exports = ScaleModes; /***/ }), -/* 248 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60658,7 +65968,7 @@ module.exports = ScaleModes; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MathWrap = __webpack_require__(59); +var MathWrap = __webpack_require__(64); /** * Wrap an angle. @@ -60681,7 +65991,7 @@ module.exports = Wrap; /***/ }), -/* 249 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60690,7 +66000,7 @@ module.exports = Wrap; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * Wrap an angle in degrees. @@ -60713,7 +66023,1011 @@ module.exports = WrapDegrees; /***/ }), -/* 250 */ +/* 263 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Events = __webpack_require__(190); + +/** + * @classdesc + * A Render Target encapsulates a WebGL framebuffer and the WebGL Texture that displays it. + * + * Instances of this class are typically created by, and belong to WebGL Pipelines, however + * other Game Objects and classes can take advantage of Render Targets as well. + * + * @class RenderTarget + * @memberof Phaser.Renderer.WebGL + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the WebGLRenderer. + * @param {number} width - The width of this Render Target. + * @param {number} height - The height of this Render Target. + * @param {number} [scale=1] - A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. + * @param {number} [minFilter=0] - The minFilter mode of the texture when created. 0 is `LINEAR`, 1 is `NEAREST`. + * @param {boolean} [autoClear=true] - Automatically clear this framebuffer when bound? + * @param {boolean} [autoResize=false] - Automatically resize this Render Target if the WebGL Renderer resizes? + */ +var RenderTarget = new Class({ + + initialize: + + function RenderTarget (renderer, width, height, scale, minFilter, autoClear, autoResize) + { + if (scale === undefined) { scale = 1; } + if (minFilter === undefined) { minFilter = 0; } + if (autoClear === undefined) { autoClear = true; } + if (autoResize === undefined) { autoResize = false; } + + /** + * A reference to the WebGLRenderer instance. + * + * @name Phaser.Renderer.WebGL.RenderTarget#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.50.0 + */ + this.renderer = renderer; + + /** + * The WebGLFramebuffer of this Render Target. + * + * This is created in the `RenderTarget.resize` method. + * + * @name Phaser.Renderer.WebGL.RenderTarget#framebuffer + * @type {WebGLFramebuffer} + * @since 3.50.0 + */ + this.framebuffer = null; + + /** + * The WebGLTexture of this Render Target. + * + * This is created in the `RenderTarget.resize` method. + * + * @name Phaser.Renderer.WebGL.RenderTarget#texture + * @type {WebGLTexture} + * @since 3.50.0 + */ + this.texture = null; + + /** + * The width of the texture. + * + * @name Phaser.Renderer.WebGL.RenderTarget#width + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.width = 0; + + /** + * The height of the texture. + * + * @name Phaser.Renderer.WebGL.RenderTarget#height + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.height = 0; + + /** + * A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. + * + * A value of 1 matches it. 0.5 makes the Render Target half the size of the renderer, etc. + * + * @name Phaser.Renderer.WebGL.RenderTarget#scale + * @type {number} + * @since 3.50.0 + */ + this.scale = scale; + + /** + * The minFilter mode of the texture. 0 is `LINEAR`, 1 is `NEAREST`. + * + * @name Phaser.Renderer.WebGL.RenderTarget#minFilter + * @type {number} + * @since 3.50.0 + */ + this.minFilter = minFilter; + + /** + * Controls if this Render Target is automatically cleared (via `gl.COLOR_BUFFER_BIT`) + * during the `RenderTarget.bind` method. + * + * If you need more control over how, or if, the target is cleared, you can disable + * this via the config on creation, or even toggle it directly at runtime. + * + * @name Phaser.Renderer.WebGL.RenderTarget#autoClear + * @type {boolean} + * @since 3.50.0 + */ + this.autoClear = autoClear; + + /** + * Does this Render Target automatically resize when the WebGL Renderer does? + * + * Modify this property via the `setAutoResize` method. + * + * @name Phaser.Renderer.WebGL.RenderTarget#autoResize + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.autoResize = false; + + this.resize(width, height); + + if (autoResize) + { + this.setAutoResize(true); + } + }, + + /** + * Sets if this Render Target should automatically resize when the WebGL Renderer + * emits a resize event. + * + * @method Phaser.Renderer.WebGL.RenderTarget#setAutoResize + * @since 3.50.0 + * + * @param {boolean} autoResize - Automatically resize this Render Target when the WebGL Renderer resizes? + * + * @return {this} This RenderTarget instance. + */ + setAutoResize: function (autoResize) + { + if (autoResize && !this.autoResize) + { + this.renderer.on(Events.RESIZE, this.resize, this); + + this.autoResize = true; + } + else if (!autoResize && this.autoResize) + { + this.renderer.off(Events.RESIZE, this.resize, this); + + this.autoResize = false; + } + + return this; + }, + + /** + * Resizes this Render Target. + * + * Deletes both the frame buffer and texture, if they exist and then re-creates + * them using the new sizes. + * + * This method is called automatically by the pipeline during its resize handler. + * + * @method Phaser.Renderer.WebGL.RenderTarget#resize + * @since 3.50.0 + * + * @param {number} width - The new width of this Render Target. + * @param {number} height - The new height of this Render Target. + * + * @return {this} This RenderTarget instance. + */ + resize: function (width, height) + { + var renderer = this.renderer; + + renderer.deleteFramebuffer(this.framebuffer); + + renderer.deleteTexture(this.texture); + + width *= this.scale; + height *= this.scale; + + this.texture = renderer.createTextureFromSource(null, width, height, this.minFilter); + this.framebuffer = renderer.createFramebuffer(width, height, this.texture, false); + + this.width = width; + this.height = height; + + return this; + }, + + /** + * Pushes this Render Target as the current frame buffer of the renderer. + * + * If `autoClear` is set, then clears the texture. + * + * If `adjustViewport` is `true` then it will flush the renderer and then adjust the GL viewport. + * + * @method Phaser.Renderer.WebGL.RenderTarget#bind + * @since 3.50.0 + * + * @param {boolean} [adjustViewport=false] - Adjust the GL viewport by calling `RenderTarget.adjustViewport` ? + */ + bind: function (adjustViewport) + { + if (adjustViewport === undefined) { adjustViewport = false; } + + if (adjustViewport) + { + this.renderer.flush(); + } + + this.renderer.pushFramebuffer(this.framebuffer, false, false, false); + + if (this.autoClear) + { + var gl = this.renderer.gl; + + gl.clearColor(0, 0, 0, 0); + + gl.clear(gl.COLOR_BUFFER_BIT); + } + + if (adjustViewport) + { + this.adjustViewport(); + } + }, + + /** + * Adjusts the GL viewport to match the WebGL Renderer width and height, + * with a y offset of `RenderTarget.height` - `WebGLRenderer.height`. + * + * @method Phaser.Renderer.WebGL.RenderTarget#adjustViewport + * @since 3.50.0 + */ + adjustViewport: function () + { + var renderer = this.renderer; + + var textureWidth = this.width; + var textureHeight = this.height; + + renderer.gl.viewport(0, 0, textureWidth, textureHeight); + renderer.gl.disable(renderer.gl.SCISSOR_TEST); + }, + + /** + * Clears this Render Target. + * + * @method Phaser.Renderer.WebGL.RenderTarget#clear + * @since 3.50.0 + */ + clear: function () + { + this.renderer.pushFramebuffer(this.framebuffer); + + var gl = this.renderer.gl; + + gl.clearColor(0, 0, 0, 0); + + gl.clear(gl.COLOR_BUFFER_BIT); + + this.renderer.popFramebuffer(); + }, + + /** + * Unbinds this Render Target and optionally flushes the WebGL Renderer first. + * + * @name Phaser.Renderer.WebGL.RenderTarget#unbind + * @since 3.50.0 + * + * @param {boolean} [flush=false] - Flush the WebGL Renderer before unbinding? + * + * @return {WebGLFramebuffer} The Framebuffer that was set, or `null` if there aren't any more in the stack. + */ + unbind: function (flush) + { + if (flush === undefined) { flush = false; } + + var renderer = this.renderer; + + if (flush) + { + renderer.flush(); + + renderer.gl.enable(renderer.gl.SCISSOR_TEST); + + var scissor = renderer.currentScissor; + + if (scissor) + { + var x = scissor[0]; + var y = scissor[1]; + var width = scissor[2]; + var height = scissor[3]; + + renderer.gl.scissor(x, (renderer.drawingBufferHeight - y - height), width, height); + } + } + + return renderer.popFramebuffer(); + }, + + /** + * Removes all external references from this class and deletes the + * WebGL framebuffer and texture instances. + * + * Does not remove this Render Target from the parent pipeline. + * + * @name Phaser.Renderer.WebGL.RenderTarget#destroy + * @since 3.50.0 + */ + destroy: function () + { + var renderer = this.renderer; + + renderer.deleteFramebuffer(this.framebuffer); + renderer.deleteTexture(this.texture); + + renderer.off(Events.RESIZE, this.resize, this); + + this.renderer = null; + this.framebuffer = null; + this.texture = null; + } + +}); + +module.exports = RenderTarget; + + +/***/ }), +/* 264 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * The ColorMatrix class creates a 5x4 matrix that can be used in shaders and graphics + * operations. It provides methods required to modify the color values, such as adjusting + * the brightness, setting a sepia tone, hue rotation and more. + * + * Use the method `getData` to return a Float32Array containing the current color values. + * + * @class ColorMatrix + * @memberof Phaser.Display + * @constructor + * @since 3.50.0 + */ +var ColorMatrix = new Class({ + + initialize: + + function ColorMatrix () + { + /** + * Internal ColorMatrix array. + * + * @name Phaser.Display.ColorMatrix#_matrix + * @type {number[]} + * @private + * @since 3.50.0 + */ + this._matrix = [ + 1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0 + ]; + + /** + * The value that determines how much of the original color is used + * when mixing the colors. A value between 0 (all original) and 1 (all final) + * + * @name Phaser.Display.ColorMatrix#alpha + * @type {number} + * @since 3.50.0 + */ + this.alpha = 1; + + /** + * Is the ColorMatrix array dirty? + * + * @name Phaser.Display.ColorMatrix#_dirty + * @type {boolean} + * @private + * @since 3.50.0 + */ + this._dirty = true; + + /** + * The matrix data as a Float32Array. + * + * Returned by the `getData` method. + * + * @name Phaser.Display.ColorMatrix#data + * @type {Float32Array} + * @private + * @since 3.50.0 + */ + this._data; + }, + + /** + * Sets this ColorMatrix from the given array of color values. + * + * @method Phaser.Display.ColorMatrix#set + * @since 3.50.0 + * + * @param {number[]} value - The ColorMatrix values to set. + * + * @return {this} This ColorMatrix instance. + */ + set: function (value) + { + this._matrix = value; + + this._dirty = true; + + return this; + }, + + /** + * Resets the ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#reset + * @since 3.50.0 + * + * @return {this} This ColorMatrix instance. + */ + reset: function () + { + // Long-winded, but saves on gc, which happens a lot in Post FX Shaders + // that reset the ColorMatrix every frame. + + var m = this._matrix; + + m[0] = 1; + m[1] = 0; + m[2] = 0; + m[3] = 0; + m[4] = 0; + + m[5] = 0; + m[6] = 1; + m[7] = 0; + m[8] = 0; + m[9] = 0; + + m[10] = 0; + m[11] = 0; + m[12] = 1; + m[13] = 0; + m[14] = 0; + + m[15] = 0; + m[16] = 0; + m[17] = 0; + m[18] = 1; + m[19] = 0; + + this._dirty = true; + + return this; + }, + + /** + * Gets the ColorMatrix as a Float32Array. + * + * Can be used directly as a 1fv shader uniform value. + * + * @method Phaser.Display.ColorMatrix#getData + * @since 3.50.0 + * + * @return {Float32Array} The ColorMatrix as a Float32Array. + */ + getData: function () + { + if (this._dirty) + { + var f32 = new Float32Array(this._matrix); + + f32[4] /= 255; + f32[9] /= 255; + f32[14] /= 255; + f32[19] /= 255; + + this._data = f32; + + this._dirty = false; + } + + return this._data; + }, + + /** + * Changes the brightness of this ColorMatrix by the given amount. + * + * @method Phaser.Display.ColorMatrix#brightness + * @since 3.50.0 + * + * @param {number} [value=0] - The amount of brightness to apply to this ColorMatrix. Between 0 (black) and 1. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + brightness: function (value, multiply) + { + if (value === undefined) { value = 0; } + if (multiply === undefined) { multiply = false; } + + var b = value; + + return this.multiply([ + b, 0, 0, 0, 0, + 0, b, 0, 0, 0, + 0, 0, b, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Changes the saturation of this ColorMatrix by the given amount. + * + * @method Phaser.Display.ColorMatrix#saturate + * @since 3.50.0 + * + * @param {number} [value=0] - The amount of saturation to apply to this ColorMatrix. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + saturate: function (value, multiply) + { + if (value === undefined) { value = 0; } + if (multiply === undefined) { multiply = false; } + + var x = (value * 2 / 3) + 1; + var y = ((x - 1) * -0.5); + + return this.multiply([ + x, y, y, 0, 0, + y, x, y, 0, 0, + y, y, x, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Desaturates this ColorMatrix (removes color from it). + * + * @method Phaser.Display.ColorMatrix#saturation + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + desaturate: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.saturate(-1, multiply); + }, + + /** + * Rotates the hues of this ColorMatrix by the value given. + * + * @method Phaser.Display.ColorMatrix#hue + * @since 3.50.0 + * + * @param {number} [rotation=0] - The amount of hue rotation to apply to this ColorMatrix, in degrees. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + hue: function (rotation, multiply) + { + if (rotation === undefined) { rotation = 0; } + if (multiply === undefined) { multiply = false; } + + rotation = rotation / 180 * Math.PI; + + var cos = Math.cos(rotation); + var sin = Math.sin(rotation); + var lumR = 0.213; + var lumG = 0.715; + var lumB = 0.072; + + return this.multiply([ + lumR + cos * (1 - lumR) + sin * (-lumR),lumG + cos * (-lumG) + sin * (-lumG),lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0, + lumR + cos * (-lumR) + sin * (0.143),lumG + cos * (1 - lumG) + sin * (0.140),lumB + cos * (-lumB) + sin * (-0.283), 0, 0, + lumR + cos * (-lumR) + sin * (-(1 - lumR)),lumG + cos * (-lumG) + sin * (lumG),lumB + cos * (1 - lumB) + sin * (lumB), 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Sets this ColorMatrix to be grayscale. + * + * @method Phaser.Display.ColorMatrix#grayscale + * @since 3.50.0 + * + * @param {number} [value=1] - The grayscale scale (0 is black). + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + grayscale: function (value, multiply) + { + if (value === undefined) { value = 1; } + if (multiply === undefined) { multiply = false; } + + return this.saturate(-value, multiply); + }, + + /** + * Sets this ColorMatrix to be black and white. + * + * @method Phaser.Display.ColorMatrix#blackWhite + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + blackWhite: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Change the contrast of this ColorMatrix by the amount given. + * + * @method Phaser.Display.ColorMatrix#contrast + * @since 3.50.0 + * + * @param {number} [value=0] - The amount of contrast to apply to this ColorMatrix. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + contrast: function (value, multiply) + { + if (value === undefined) { value = 0; } + if (multiply === undefined) { multiply = false; } + + var v = value + 1; + var o = -0.5 * (v - 1); + + return this.multiply([ + v, 0, 0, 0, o, + 0, v, 0, 0, o, + 0, 0, v, 0, o, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Converts this ColorMatrix to have negative values. + * + * @method Phaser.Display.ColorMatrix#negative + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + negative: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + -1, 0, 0, 1, 0, + 0, -1, 0, 1, 0, + 0, 0, -1, 1, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Apply a desaturated luminance to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#desaturateLuminance + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + desaturateLuminance: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.2764723, 0.9297080, 0.0938197, 0, -37.1, + 0.2764723, 0.9297080, 0.0938197, 0, -37.1, + 0.2764723, 0.9297080, 0.0938197, 0, -37.1, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a sepia tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#sepia + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + sepia: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.393, 0.7689999, 0.18899999, 0, 0, + 0.349, 0.6859999, 0.16799999, 0, 0, + 0.272, 0.5339999, 0.13099999, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a night vision tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#night + * @since 3.50.0 + * + * @param {number} [intensity=0.1] - The intensity of this effect. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + night: function (intensity, multiply) + { + if (intensity === undefined) { intensity = 0.1; } + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + intensity * (-2.0), -intensity, 0, 0, 0, + -intensity, 0, intensity, 0, 0, + 0, intensity, intensity * 2.0, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a trippy color tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#lsd + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + lsd: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 2, -0.4, 0.5, 0, 0, + -0.5, 2, -0.4, 0, 0, + -0.4, -0.5, 3, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a brown tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#brown + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + brown: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, + -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, + 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a vintage pinhole color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#vintagePinhole + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + vintagePinhole: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, + 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, + 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a kodachrome color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#kodachrome + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + kodachrome: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, + -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, + -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a technicolor color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#technicolor + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + technicolor: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, + -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, + -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Applies a polaroid color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#polaroid + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + polaroid: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 1.438, -0.062, -0.062, 0, 0, + -0.122, 1.378, -0.122, 0, 0, + -0.016, -0.016, 1.483, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Shifts the values of this ColorMatrix into BGR order. + * + * @method Phaser.Display.ColorMatrix#shiftToBGR + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + shiftToBGR: function (multiply) + { + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + 0, 0, 1, 0, 0, + 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, + + /** + * Multiplies the two given matrices. + * + * @method Phaser.Display.ColorMatrix#multiply + * @since 3.50.0 + * + * @param {number[]} a - The 5x4 array to multiply with ColorMatrix._matrix. + * + * @return {this} This ColorMatrix instance. + */ + multiply: function (a, multiply) + { + // Duplicate _matrix into c + + if (!multiply) + { + this.reset(); + } + + var m = this._matrix; + var c = []; + + for (var i = 0; i < 20; i++) + { + c[i] = m[i]; + } + + // R + m[0] = (c[0] * a[0]) + (c[1] * a[5]) + (c[2] * a[10]) + (c[3] * a[15]); + m[1] = (c[0] * a[1]) + (c[1] * a[6]) + (c[2] * a[11]) + (c[3] * a[16]); + m[2] = (c[0] * a[2]) + (c[1] * a[7]) + (c[2] * a[12]) + (c[3] * a[17]); + m[3] = (c[0] * a[3]) + (c[1] * a[8]) + (c[2] * a[13]) + (c[3] * a[18]); + m[4] = (c[0] * a[4]) + (c[1] * a[9]) + (c[2] * a[14]) + (c[3] * a[19]) + c[4]; + + // G + m[5] = (c[5] * a[0]) + (c[6] * a[5]) + (c[7] * a[10]) + (c[8] * a[15]); + m[6] = (c[5] * a[1]) + (c[6] * a[6]) + (c[7] * a[11]) + (c[8] * a[16]); + m[7] = (c[5] * a[2]) + (c[6] * a[7]) + (c[7] * a[12]) + (c[8] * a[17]); + m[8] = (c[5] * a[3]) + (c[6] * a[8]) + (c[7] * a[13]) + (c[8] * a[18]); + m[9] = (c[5] * a[4]) + (c[6] * a[9]) + (c[7] * a[14]) + (c[8] * a[19]) + c[9]; + + // B + m[10] = (c[10] * a[0]) + (c[11] * a[5]) + (c[12] * a[10]) + (c[13] * a[15]); + m[11] = (c[10] * a[1]) + (c[11] * a[6]) + (c[12] * a[11]) + (c[13] * a[16]); + m[12] = (c[10] * a[2]) + (c[11] * a[7]) + (c[12] * a[12]) + (c[13] * a[17]); + m[13] = (c[10] * a[3]) + (c[11] * a[8]) + (c[12] * a[13]) + (c[13] * a[18]); + m[14] = (c[10] * a[4]) + (c[11] * a[9]) + (c[12] * a[14]) + (c[13] * a[19]) + c[14]; + + // A + m[15] = (c[15] * a[0]) + (c[16] * a[5]) + (c[17] * a[10]) + (c[18] * a[15]); + m[16] = (c[15] * a[1]) + (c[16] * a[6]) + (c[17] * a[11]) + (c[18] * a[16]); + m[17] = (c[15] * a[2]) + (c[16] * a[7]) + (c[17] * a[12]) + (c[18] * a[17]); + m[18] = (c[15] * a[3]) + (c[16] * a[8]) + (c[17] * a[13]) + (c[18] * a[18]); + m[19] = (c[15] * a[4]) + (c[16] * a[9]) + (c[17] * a[14]) + (c[18] * a[19]) + c[19]; + + this._dirty = true; + + return this; + } + +}); + +module.exports = ColorMatrix; + + +/***/ }), +/* 265 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60726,7 +67040,7 @@ var Sleeping = {}; module.exports = Sleeping; -var Events = __webpack_require__(251); +var Events = __webpack_require__(266); (function() { @@ -60848,7 +67162,7 @@ var Events = __webpack_require__(251); /***/ }), -/* 251 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60863,7 +67177,7 @@ var Events = {}; module.exports = Events; -var Common = __webpack_require__(44); +var Common = __webpack_require__(50); (function() { @@ -60966,7 +67280,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 252 */ +/* 267 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -60981,65 +67295,65 @@ var Common = __webpack_require__(44); module.exports = { - AlignTo: __webpack_require__(556), - Angle: __webpack_require__(557), - Call: __webpack_require__(558), - GetFirst: __webpack_require__(559), - GetLast: __webpack_require__(560), - GridAlign: __webpack_require__(561), - IncAlpha: __webpack_require__(606), - IncX: __webpack_require__(607), - IncXY: __webpack_require__(608), - IncY: __webpack_require__(609), - PlaceOnCircle: __webpack_require__(610), - PlaceOnEllipse: __webpack_require__(611), - PlaceOnLine: __webpack_require__(612), - PlaceOnRectangle: __webpack_require__(613), - PlaceOnTriangle: __webpack_require__(614), - PlayAnimation: __webpack_require__(615), - PropertyValueInc: __webpack_require__(39), - PropertyValueSet: __webpack_require__(25), - RandomCircle: __webpack_require__(616), - RandomEllipse: __webpack_require__(617), - RandomLine: __webpack_require__(618), - RandomRectangle: __webpack_require__(619), - RandomTriangle: __webpack_require__(620), - Rotate: __webpack_require__(621), - RotateAround: __webpack_require__(622), - RotateAroundDistance: __webpack_require__(623), - ScaleX: __webpack_require__(624), - ScaleXY: __webpack_require__(625), - ScaleY: __webpack_require__(626), - SetAlpha: __webpack_require__(627), - SetBlendMode: __webpack_require__(628), - SetDepth: __webpack_require__(629), - SetHitArea: __webpack_require__(630), - SetOrigin: __webpack_require__(631), - SetRotation: __webpack_require__(632), - SetScale: __webpack_require__(633), - SetScaleX: __webpack_require__(634), - SetScaleY: __webpack_require__(635), - SetScrollFactor: __webpack_require__(636), - SetScrollFactorX: __webpack_require__(637), - SetScrollFactorY: __webpack_require__(638), - SetTint: __webpack_require__(639), - SetVisible: __webpack_require__(640), - SetX: __webpack_require__(641), - SetXY: __webpack_require__(642), - SetY: __webpack_require__(643), - ShiftPosition: __webpack_require__(644), - Shuffle: __webpack_require__(645), - SmootherStep: __webpack_require__(646), - SmoothStep: __webpack_require__(647), - Spread: __webpack_require__(648), - ToggleVisible: __webpack_require__(649), - WrapInRectangle: __webpack_require__(650) + AlignTo: __webpack_require__(595), + Angle: __webpack_require__(596), + Call: __webpack_require__(597), + GetFirst: __webpack_require__(598), + GetLast: __webpack_require__(599), + GridAlign: __webpack_require__(600), + IncAlpha: __webpack_require__(646), + IncX: __webpack_require__(647), + IncXY: __webpack_require__(648), + IncY: __webpack_require__(649), + PlaceOnCircle: __webpack_require__(650), + PlaceOnEllipse: __webpack_require__(651), + PlaceOnLine: __webpack_require__(652), + PlaceOnRectangle: __webpack_require__(653), + PlaceOnTriangle: __webpack_require__(654), + PlayAnimation: __webpack_require__(655), + PropertyValueInc: __webpack_require__(44), + PropertyValueSet: __webpack_require__(27), + RandomCircle: __webpack_require__(656), + RandomEllipse: __webpack_require__(657), + RandomLine: __webpack_require__(658), + RandomRectangle: __webpack_require__(659), + RandomTriangle: __webpack_require__(660), + Rotate: __webpack_require__(661), + RotateAround: __webpack_require__(662), + RotateAroundDistance: __webpack_require__(663), + ScaleX: __webpack_require__(664), + ScaleXY: __webpack_require__(665), + ScaleY: __webpack_require__(666), + SetAlpha: __webpack_require__(667), + SetBlendMode: __webpack_require__(668), + SetDepth: __webpack_require__(669), + SetHitArea: __webpack_require__(670), + SetOrigin: __webpack_require__(671), + SetRotation: __webpack_require__(672), + SetScale: __webpack_require__(673), + SetScaleX: __webpack_require__(674), + SetScaleY: __webpack_require__(675), + SetScrollFactor: __webpack_require__(676), + SetScrollFactorX: __webpack_require__(677), + SetScrollFactorY: __webpack_require__(678), + SetTint: __webpack_require__(679), + SetVisible: __webpack_require__(680), + SetX: __webpack_require__(681), + SetXY: __webpack_require__(682), + SetY: __webpack_require__(683), + ShiftPosition: __webpack_require__(684), + Shuffle: __webpack_require__(685), + SmootherStep: __webpack_require__(686), + SmoothStep: __webpack_require__(687), + Spread: __webpack_require__(688), + ToggleVisible: __webpack_require__(689), + WrapInRectangle: __webpack_require__(690) }; /***/ }), -/* 253 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61048,22 +67362,22 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ALIGN_CONST = __webpack_require__(108); +var ALIGN_CONST = __webpack_require__(120); var AlignToMap = []; -AlignToMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(254); -AlignToMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(255); -AlignToMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(256); -AlignToMap[ALIGN_CONST.LEFT_BOTTOM] = __webpack_require__(257); -AlignToMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(258); -AlignToMap[ALIGN_CONST.LEFT_TOP] = __webpack_require__(259); -AlignToMap[ALIGN_CONST.RIGHT_BOTTOM] = __webpack_require__(260); -AlignToMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(261); -AlignToMap[ALIGN_CONST.RIGHT_TOP] = __webpack_require__(262); -AlignToMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(263); -AlignToMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(264); -AlignToMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(265); +AlignToMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(269); +AlignToMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(270); +AlignToMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(271); +AlignToMap[ALIGN_CONST.LEFT_BOTTOM] = __webpack_require__(272); +AlignToMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(273); +AlignToMap[ALIGN_CONST.LEFT_TOP] = __webpack_require__(274); +AlignToMap[ALIGN_CONST.RIGHT_BOTTOM] = __webpack_require__(275); +AlignToMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(276); +AlignToMap[ALIGN_CONST.RIGHT_TOP] = __webpack_require__(277); +AlignToMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(278); +AlignToMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(279); +AlignToMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(280); /** * Takes a Game Object and aligns it next to another, at the given position. @@ -61076,7 +67390,7 @@ AlignToMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(265); * * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {integer} position - The position to align the Game Object with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. + * @param {number} position - The position to align the Game Object with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. * @param {number} [offsetX=0] - Optional horizontal offset from the position. * @param {number} [offsetY=0] - Optional vertical offset from the position. * @@ -61091,7 +67405,7 @@ module.exports = QuickSet; /***/ }), -/* 254 */ +/* 269 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61100,10 +67414,10 @@ module.exports = QuickSet; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetCenterX = __webpack_require__(77); -var SetCenterX = __webpack_require__(78); -var SetTop = __webpack_require__(45); +var GetBottom = __webpack_require__(40); +var GetCenterX = __webpack_require__(83); +var SetCenterX = __webpack_require__(84); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other. @@ -61135,7 +67449,7 @@ module.exports = BottomCenter; /***/ }), -/* 255 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61144,10 +67458,10 @@ module.exports = BottomCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetLeft = __webpack_require__(36); -var SetLeft = __webpack_require__(46); -var SetTop = __webpack_require__(45); +var GetBottom = __webpack_require__(40); +var GetLeft = __webpack_require__(41); +var SetLeft = __webpack_require__(52); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other. @@ -61179,7 +67493,7 @@ module.exports = BottomLeft; /***/ }), -/* 256 */ +/* 271 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61188,10 +67502,10 @@ module.exports = BottomLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetRight = __webpack_require__(37); -var SetRight = __webpack_require__(47); -var SetTop = __webpack_require__(45); +var GetBottom = __webpack_require__(40); +var GetRight = __webpack_require__(42); +var SetRight = __webpack_require__(53); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other. @@ -61223,7 +67537,7 @@ module.exports = BottomRight; /***/ }), -/* 257 */ +/* 272 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61232,10 +67546,10 @@ module.exports = BottomRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetLeft = __webpack_require__(36); -var SetBottom = __webpack_require__(48); -var SetRight = __webpack_require__(47); +var GetBottom = __webpack_require__(40); +var GetLeft = __webpack_require__(41); +var SetBottom = __webpack_require__(54); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other. @@ -61267,7 +67581,7 @@ module.exports = LeftBottom; /***/ }), -/* 258 */ +/* 273 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61276,10 +67590,10 @@ module.exports = LeftBottom; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(79); -var GetLeft = __webpack_require__(36); -var SetCenterY = __webpack_require__(80); -var SetRight = __webpack_require__(47); +var GetCenterY = __webpack_require__(85); +var GetLeft = __webpack_require__(41); +var SetCenterY = __webpack_require__(86); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned next to the left center position of the other. @@ -61311,7 +67625,7 @@ module.exports = LeftCenter; /***/ }), -/* 259 */ +/* 274 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61320,10 +67634,10 @@ module.exports = LeftCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLeft = __webpack_require__(36); -var GetTop = __webpack_require__(38); -var SetRight = __webpack_require__(47); -var SetTop = __webpack_require__(45); +var GetLeft = __webpack_require__(41); +var GetTop = __webpack_require__(43); +var SetRight = __webpack_require__(53); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the left top position of the other. @@ -61355,7 +67669,7 @@ module.exports = LeftTop; /***/ }), -/* 260 */ +/* 275 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61364,10 +67678,10 @@ module.exports = LeftTop; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetRight = __webpack_require__(37); -var SetBottom = __webpack_require__(48); -var SetLeft = __webpack_require__(46); +var GetBottom = __webpack_require__(40); +var GetRight = __webpack_require__(42); +var SetBottom = __webpack_require__(54); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other. @@ -61399,7 +67713,7 @@ module.exports = RightBottom; /***/ }), -/* 261 */ +/* 276 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61408,10 +67722,10 @@ module.exports = RightBottom; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(79); -var GetRight = __webpack_require__(37); -var SetCenterY = __webpack_require__(80); -var SetLeft = __webpack_require__(46); +var GetCenterY = __webpack_require__(85); +var GetRight = __webpack_require__(42); +var SetCenterY = __webpack_require__(86); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned next to the right center position of the other. @@ -61443,7 +67757,7 @@ module.exports = RightCenter; /***/ }), -/* 262 */ +/* 277 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61452,10 +67766,10 @@ module.exports = RightCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetRight = __webpack_require__(37); -var GetTop = __webpack_require__(38); -var SetLeft = __webpack_require__(46); -var SetTop = __webpack_require__(45); +var GetRight = __webpack_require__(42); +var GetTop = __webpack_require__(43); +var SetLeft = __webpack_require__(52); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned next to the right top position of the other. @@ -61487,7 +67801,7 @@ module.exports = RightTop; /***/ }), -/* 263 */ +/* 278 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61496,10 +67810,10 @@ module.exports = RightTop; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterX = __webpack_require__(77); -var GetTop = __webpack_require__(38); -var SetBottom = __webpack_require__(48); -var SetCenterX = __webpack_require__(78); +var GetCenterX = __webpack_require__(83); +var GetTop = __webpack_require__(43); +var SetBottom = __webpack_require__(54); +var SetCenterX = __webpack_require__(84); /** * Takes given Game Object and aligns it so that it is positioned next to the top center position of the other. @@ -61531,7 +67845,7 @@ module.exports = TopCenter; /***/ }), -/* 264 */ +/* 279 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61540,10 +67854,10 @@ module.exports = TopCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLeft = __webpack_require__(36); -var GetTop = __webpack_require__(38); -var SetBottom = __webpack_require__(48); -var SetLeft = __webpack_require__(46); +var GetLeft = __webpack_require__(41); +var GetTop = __webpack_require__(43); +var SetBottom = __webpack_require__(54); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned next to the top left position of the other. @@ -61575,7 +67889,7 @@ module.exports = TopLeft; /***/ }), -/* 265 */ +/* 280 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61584,10 +67898,10 @@ module.exports = TopLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetRight = __webpack_require__(37); -var GetTop = __webpack_require__(38); -var SetBottom = __webpack_require__(48); -var SetRight = __webpack_require__(47); +var GetRight = __webpack_require__(42); +var GetTop = __webpack_require__(43); +var SetBottom = __webpack_require__(54); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned next to the top right position of the other. @@ -61619,7 +67933,7 @@ module.exports = TopRight; /***/ }), -/* 266 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61628,19 +67942,19 @@ module.exports = TopRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ALIGN_CONST = __webpack_require__(108); +var ALIGN_CONST = __webpack_require__(120); var AlignInMap = []; -AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(267); -AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(268); -AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(269); -AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(270); -AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(272); -AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(273); -AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(274); -AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(275); -AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(276); +AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(282); +AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(283); +AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(284); +AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(285); +AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(287); +AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(288); +AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(289); +AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(290); +AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(291); AlignInMap[ALIGN_CONST.LEFT_BOTTOM] = AlignInMap[ALIGN_CONST.BOTTOM_LEFT]; AlignInMap[ALIGN_CONST.LEFT_TOP] = AlignInMap[ALIGN_CONST.TOP_LEFT]; AlignInMap[ALIGN_CONST.RIGHT_BOTTOM] = AlignInMap[ALIGN_CONST.BOTTOM_RIGHT]; @@ -61657,7 +67971,7 @@ AlignInMap[ALIGN_CONST.RIGHT_TOP] = AlignInMap[ALIGN_CONST.TOP_RIGHT]; * * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {integer} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. + * @param {number} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. * @param {number} [offsetX=0] - Optional horizontal offset from the position. * @param {number} [offsetY=0] - Optional vertical offset from the position. * @@ -61672,7 +67986,7 @@ module.exports = QuickSet; /***/ }), -/* 267 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61681,10 +67995,10 @@ module.exports = QuickSet; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetCenterX = __webpack_require__(77); -var SetBottom = __webpack_require__(48); -var SetCenterX = __webpack_require__(78); +var GetBottom = __webpack_require__(40); +var GetCenterX = __webpack_require__(83); +var SetBottom = __webpack_require__(54); +var SetCenterX = __webpack_require__(84); /** * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. @@ -61716,7 +68030,7 @@ module.exports = BottomCenter; /***/ }), -/* 268 */ +/* 283 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61725,10 +68039,10 @@ module.exports = BottomCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetLeft = __webpack_require__(36); -var SetBottom = __webpack_require__(48); -var SetLeft = __webpack_require__(46); +var GetBottom = __webpack_require__(40); +var GetLeft = __webpack_require__(41); +var SetBottom = __webpack_require__(54); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. @@ -61760,7 +68074,7 @@ module.exports = BottomLeft; /***/ }), -/* 269 */ +/* 284 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61769,10 +68083,10 @@ module.exports = BottomLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetRight = __webpack_require__(37); -var SetBottom = __webpack_require__(48); -var SetRight = __webpack_require__(47); +var GetBottom = __webpack_require__(40); +var GetRight = __webpack_require__(42); +var SetBottom = __webpack_require__(54); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. @@ -61804,7 +68118,7 @@ module.exports = BottomRight; /***/ }), -/* 270 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61813,9 +68127,9 @@ module.exports = BottomRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CenterOn = __webpack_require__(271); -var GetCenterX = __webpack_require__(77); -var GetCenterY = __webpack_require__(79); +var CenterOn = __webpack_require__(286); +var GetCenterX = __webpack_require__(83); +var GetCenterY = __webpack_require__(85); /** * Takes given Game Object and aligns it so that it is positioned in the center of the other. @@ -61846,7 +68160,7 @@ module.exports = Center; /***/ }), -/* 271 */ +/* 286 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61855,8 +68169,8 @@ module.exports = Center; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetCenterX = __webpack_require__(78); -var SetCenterY = __webpack_require__(80); +var SetCenterX = __webpack_require__(84); +var SetCenterY = __webpack_require__(86); /** * Positions the Game Object so that it is centered on the given coordinates. @@ -61883,7 +68197,7 @@ module.exports = CenterOn; /***/ }), -/* 272 */ +/* 287 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61892,10 +68206,10 @@ module.exports = CenterOn; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(79); -var GetLeft = __webpack_require__(36); -var SetCenterY = __webpack_require__(80); -var SetLeft = __webpack_require__(46); +var GetCenterY = __webpack_require__(85); +var GetLeft = __webpack_require__(41); +var SetCenterY = __webpack_require__(86); +var SetLeft = __webpack_require__(52); /** * Takes given Game Object and aligns it so that it is positioned in the left center of the other. @@ -61927,7 +68241,7 @@ module.exports = LeftCenter; /***/ }), -/* 273 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61936,10 +68250,10 @@ module.exports = LeftCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(79); -var GetRight = __webpack_require__(37); -var SetCenterY = __webpack_require__(80); -var SetRight = __webpack_require__(47); +var GetCenterY = __webpack_require__(85); +var GetRight = __webpack_require__(42); +var SetCenterY = __webpack_require__(86); +var SetRight = __webpack_require__(53); /** * Takes given Game Object and aligns it so that it is positioned in the right center of the other. @@ -61971,7 +68285,7 @@ module.exports = RightCenter; /***/ }), -/* 274 */ +/* 289 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -61980,10 +68294,10 @@ module.exports = RightCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterX = __webpack_require__(77); -var GetTop = __webpack_require__(38); -var SetCenterX = __webpack_require__(78); -var SetTop = __webpack_require__(45); +var GetCenterX = __webpack_require__(83); +var GetTop = __webpack_require__(43); +var SetCenterX = __webpack_require__(84); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned in the top center of the other. @@ -62015,7 +68329,7 @@ module.exports = TopCenter; /***/ }), -/* 275 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62024,10 +68338,10 @@ module.exports = TopCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLeft = __webpack_require__(36); -var GetTop = __webpack_require__(38); -var SetLeft = __webpack_require__(46); -var SetTop = __webpack_require__(45); +var GetLeft = __webpack_require__(41); +var GetTop = __webpack_require__(43); +var SetLeft = __webpack_require__(52); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned in the top left of the other. @@ -62059,7 +68373,7 @@ module.exports = TopLeft; /***/ }), -/* 276 */ +/* 291 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62068,10 +68382,10 @@ module.exports = TopLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetRight = __webpack_require__(37); -var GetTop = __webpack_require__(38); -var SetRight = __webpack_require__(47); -var SetTop = __webpack_require__(45); +var GetRight = __webpack_require__(42); +var GetTop = __webpack_require__(43); +var SetRight = __webpack_require__(53); +var SetTop = __webpack_require__(51); /** * Takes given Game Object and aligns it so that it is positioned in the top right of the other. @@ -62103,7 +68417,7 @@ module.exports = TopRight; /***/ }), -/* 277 */ +/* 292 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62112,8 +68426,8 @@ module.exports = TopRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CircumferencePoint = __webpack_require__(159); -var FromPercent = __webpack_require__(89); +var CircumferencePoint = __webpack_require__(160); +var FromPercent = __webpack_require__(94); var MATH_CONST = __webpack_require__(13); var Point = __webpack_require__(4); @@ -62146,7 +68460,7 @@ module.exports = GetPoint; /***/ }), -/* 278 */ +/* 293 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62155,9 +68469,9 @@ module.exports = GetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circumference = __webpack_require__(279); -var CircumferencePoint = __webpack_require__(159); -var FromPercent = __webpack_require__(89); +var Circumference = __webpack_require__(294); +var CircumferencePoint = __webpack_require__(160); +var FromPercent = __webpack_require__(94); var MATH_CONST = __webpack_require__(13); /** @@ -62168,7 +68482,7 @@ var MATH_CONST = __webpack_require__(13); * @since 3.0.0 * * @param {Phaser.Geom.Circle} circle - The Circle to get the points from. - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -62198,7 +68512,7 @@ module.exports = GetPoints; /***/ }), -/* 279 */ +/* 294 */ /***/ (function(module, exports) { /** @@ -62226,7 +68540,7 @@ module.exports = Circumference; /***/ }), -/* 280 */ +/* 295 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62235,7 +68549,7 @@ module.exports = Circumference; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); // bitmask flag for GameObject.renderMask var _FLAG = 2; // 0010 @@ -62336,7 +68650,7 @@ module.exports = AlphaSingle; /***/ }), -/* 281 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62345,7 +68659,7 @@ module.exports = AlphaSingle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(54); +var BlendModes = __webpack_require__(48); /** * Provides methods used for setting the blend mode of a Game Object. @@ -62361,7 +68675,7 @@ var BlendMode = { * Private internal value. Holds the current blend mode. * * @name Phaser.GameObjects.Components.BlendMode#_blendMode - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -62458,7 +68772,7 @@ module.exports = BlendMode; /***/ }), -/* 282 */ +/* 297 */ /***/ (function(module, exports) { /** @@ -62470,7 +68784,7 @@ module.exports = BlendMode; /** * Provides methods used for setting the depth of a Game Object. * Should be applied as a mixin and not used directly. - * + * * @namespace Phaser.GameObjects.Components.Depth * @since 3.0.0 */ @@ -62479,9 +68793,9 @@ var Depth = { /** * Private internal value. Holds the depth of the Game Object. - * + * * @name Phaser.GameObjects.Components.Depth#_depth - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -62490,7 +68804,7 @@ var Depth = { /** * The depth of this Game Object within the Scene. - * + * * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order * of Game Objects, without actually moving their position in the display list. * @@ -62498,7 +68812,7 @@ var Depth = { * value will always render in front of one with a lower value. * * Setting the depth will queue a depth sort event within the Scene. - * + * * @name Phaser.GameObjects.Components.Depth#depth * @type {number} * @since 3.0.0 @@ -62512,7 +68826,11 @@ var Depth = { set: function (value) { - this.scene.sys.queueDepthSort(); + if (this.displayList) + { + this.displayList.queueDepthSort(); + } + this._depth = value; } @@ -62520,7 +68838,7 @@ var Depth = { /** * The depth of this Game Object within the Scene. - * + * * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order * of Game Objects, without actually moving their position in the display list. * @@ -62528,12 +68846,12 @@ var Depth = { * value will always render in front of one with a lower value. * * Setting the depth will queue a depth sort event within the Scene. - * + * * @method Phaser.GameObjects.Components.Depth#setDepth * @since 3.0.0 * - * @param {integer} value - The depth of this Game Object. - * + * @param {number} value - The depth of this Game Object. + * * @return {this} This Game Object instance. */ setDepth: function (value) @@ -62551,7 +68869,7 @@ module.exports = Depth; /***/ }), -/* 283 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62560,8 +68878,8 @@ module.exports = Depth; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetPoint = __webpack_require__(161); -var Perimeter = __webpack_require__(118); +var GetPoint = __webpack_require__(162); +var Perimeter = __webpack_require__(126); // Return an array of points from the perimeter of the rectangle // each spaced out based on the quantity or step required @@ -62576,7 +68894,7 @@ var Perimeter = __webpack_require__(118); * * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle object to get the points from. * @param {number} step - Step between points. Used to calculate the number of points to return when quantity is falsey. Ignored if quantity is positive. - * @param {integer} quantity - The number of evenly spaced points from the rectangles perimeter to return. If falsey, step param will be used to calculate the number of points. + * @param {number} quantity - The number of evenly spaced points from the rectangles perimeter to return. If falsey, step param will be used to calculate the number of points. * @param {(array|Phaser.Geom.Point[])} [out] - An optional array to store the points in. * * @return {(array|Phaser.Geom.Point[])} An array of Points from the perimeter of the rectangle. @@ -62605,7 +68923,7 @@ module.exports = GetPoints; /***/ }), -/* 284 */ +/* 299 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62644,7 +68962,7 @@ module.exports = GetPoint; /***/ }), -/* 285 */ +/* 300 */ /***/ (function(module, exports) { /** @@ -62688,7 +69006,7 @@ module.exports = RotateAround; /***/ }), -/* 286 */ +/* 301 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62697,8 +69015,8 @@ module.exports = RotateAround; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapMask = __webpack_require__(287); -var GeometryMask = __webpack_require__(288); +var BitmapMask = __webpack_require__(302); +var GeometryMask = __webpack_require__(303); /** * Provides methods used for getting and setting the mask of a Game Object. @@ -62725,10 +69043,10 @@ var Mask = { * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. * * If a mask is already set on this Game Object it will be immediately replaced. - * + * * Masks are positioned in global space and are not relative to the Game Object to which they * are applied. The reason for this is that multiple Game Objects can all share the same mask. - * + * * Masks have no impact on physics or input detection. They are purely a rendering component * that allows you to limit what is visible during the render pass. * @@ -62774,6 +69092,8 @@ var Mask = { * Creates and returns a Bitmap Mask. This mask can be used by any Game Object, * including this one. * + * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. + * * To create the mask you need to pass in a reference to a renderable Game Object. * A renderable Game Object is one that uses a texture to render with, such as an * Image, Sprite, Render Texture or BitmapText. @@ -62784,7 +69104,7 @@ var Mask = { * * @method Phaser.GameObjects.Components.Mask#createBitmapMask * @since 3.6.2 - * + * * @param {Phaser.GameObjects.GameObject} [renderable] - A renderable Game Object that uses a texture, such as a Sprite. * * @return {Phaser.Display.Masks.BitmapMask} This Bitmap Mask that was created. @@ -62808,12 +69128,12 @@ var Mask = { * * If you do not provide a graphics object, and this Game Object is an instance * of a Graphics object, then it will use itself to create the mask. - * + * * This means you can call this method to create a Geometry Mask from any Graphics Game Object. * * @method Phaser.GameObjects.Components.Mask#createGeometryMask * @since 3.6.2 - * + * * @param {Phaser.GameObjects.Graphics} [graphics] - A Graphics Game Object. The geometry within it will be used as the mask. * * @return {Phaser.Display.Masks.GeometryMask} This Geometry Mask that was created. @@ -62835,7 +69155,7 @@ module.exports = Mask; /***/ }), -/* 287 */ +/* 302 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -62845,7 +69165,7 @@ module.exports = Mask; */ var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); /** * @classdesc @@ -62864,6 +69184,9 @@ var GameEvents = __webpack_require__(21); * A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the * corresponding pixel in the mask. * + * Note: You cannot combine Bitmap Masks and Blend Modes on the same Game Object. You can, however, + * combine Geometry Masks and Blend Modes together. + * * The Bitmap Mask's location matches the location of its Game Object, not the location of the * masked objects. Moving or transforming the underlying Game Object will change the mask * (and affect the visibility of any masked objects), whereas moving or transforming a masked object @@ -62888,7 +69211,7 @@ var BitmapMask = new Class({ function BitmapMask (scene, renderable) { - var renderer = scene.sys.game.renderer; + var renderer = scene.sys.renderer; /** * A reference to either the Canvas or WebGL Renderer that this Mask is using. @@ -62956,19 +69279,11 @@ var BitmapMask = new Class({ */ this.maskFramebuffer = null; - /** - * The previous framebuffer set in the renderer before this one was enabled. - * - * @name Phaser.Display.Masks.BitmapMask#prevFramebuffer - * @type {WebGLFramebuffer} - * @since 3.17.0 - */ - this.prevFramebuffer = null; - /** * Whether to invert the masks alpha. * - * If `true`, the alpha of the masking pixel will be inverted before it's multiplied with the masked pixel. Essentially, this means that a masked area will be visible only if the corresponding area in the mask is invisible. + * If `true`, the alpha of the masking pixel will be inverted before it's multiplied with the masked pixel. + * Essentially, this means that a masked area will be visible only if the corresponding area in the mask is invisible. * * @name Phaser.Display.Masks.BitmapMask#invertAlpha * @type {boolean} @@ -62986,36 +69301,73 @@ var BitmapMask = new Class({ */ this.isStencil = false; - if (renderer && renderer.gl) + this.createMask(); + + scene.sys.game.events.on(GameEvents.CONTEXT_RESTORED, this.createMask, this); + }, + + /** + * Creates the WebGL Texture2D objects and Framebuffers required for this + * mask. If this mask has already been created, then `clearMask` is called first. + * + * @method Phaser.Display.Masks.BitmapMask#createMask + * @since 3.50.0 + */ + createMask: function () + { + var renderer = this.renderer; + + if (!renderer.gl) { - var width = renderer.width; - var height = renderer.height; - var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); - var gl = renderer.gl; - var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; - var filter = gl.LINEAR; - - this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, true); - this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, true); - - scene.sys.game.events.on(GameEvents.CONTEXT_RESTORED, function (renderer) - { - var width = renderer.width; - var height = renderer.height; - var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); - var gl = renderer.gl; - var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; - var filter = gl.LINEAR; - - this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, true); - this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, true); - - }, this); + return; } + + if (this.mainTexture) + { + this.clearMask(); + } + + var width = renderer.width; + var height = renderer.height; + var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); + var gl = renderer.gl; + var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; + var filter = gl.LINEAR; + + this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); + this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, true); + this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, true); + }, + + /** + * Deletes the `mainTexture` and `maskTexture` WebGL Textures and deletes + * the `mainFramebuffer` and `maskFramebuffer` too, nulling all references. + * + * This is called when this mask is destroyed, or if you try to creat a new + * mask from this object when one is already set. + * + * @method Phaser.Display.Masks.BitmapMask#clearMask + * @since 3.50.0 + */ + clearMask: function () + { + var renderer = this.renderer; + + if (!renderer.gl || !this.mainTexture) + { + return; + } + + renderer.deleteTexture(this.mainTexture); + renderer.deleteTexture(this.maskTexture); + renderer.deleteFramebuffer(this.mainFramebuffer); + renderer.deleteFramebuffer(this.maskFramebuffer); + + this.mainTexture = null; + this.maskTexture = null; + this.mainFramebuffer = null; + this.maskFramebuffer = null; }, /** @@ -63102,22 +69454,9 @@ var BitmapMask = new Class({ */ destroy: function () { + this.clearMask(); + this.bitmapMask = null; - - var renderer = this.renderer; - - if (renderer && renderer.gl) - { - renderer.deleteTexture(this.mainTexture); - renderer.deleteTexture(this.maskTexture); - renderer.deleteFramebuffer(this.mainFramebuffer); - renderer.deleteFramebuffer(this.maskFramebuffer); - } - - this.mainTexture = null; - this.maskTexture = null; - this.mainFramebuffer = null; - this.maskFramebuffer = null; this.prevFramebuffer = null; this.renderer = null; } @@ -63128,7 +69467,7 @@ module.exports = BitmapMask; /***/ }), -/* 288 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63184,6 +69523,8 @@ var GeometryMask = new Class({ * Similar to the BitmapMasks invertAlpha setting this to true will then hide all pixels * drawn to the Geometry Mask. * + * This is a WebGL only feature. + * * @name Phaser.Display.Masks.GeometryMask#invertAlpha * @type {boolean} * @since 3.16.0 @@ -63218,7 +69559,7 @@ var GeometryMask = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphicsGeometry - The Graphics object which will be used for the Geometry Mask. - * + * * @return {this} This Geometry Mask */ setShape: function (graphicsGeometry) @@ -63230,13 +69571,16 @@ var GeometryMask = new Class({ /** * Sets the `invertAlpha` property of this Geometry Mask. + * * Inverting the alpha essentially flips the way the mask works. * + * This is a WebGL only feature. + * * @method Phaser.Display.Masks.GeometryMask#setInvertAlpha * @since 3.17.0 * * @param {boolean} [value=true] - Invert the alpha of this mask? - * + * * @return {this} This Geometry Mask */ setInvertAlpha: function (value) @@ -63315,7 +69659,7 @@ var GeometryMask = new Class({ } // Write stencil buffer - geometryMask.renderWebGL(renderer, geometryMask, 0, camera); + geometryMask.renderWebGL(renderer, geometryMask, camera); renderer.flush(); @@ -63359,32 +69703,32 @@ var GeometryMask = new Class({ renderer.maskCount--; + // Force flush before disabling stencil test + renderer.flush(); + + var current = renderer.currentMask; + if (renderer.maskStack.length === 0) { // If this is the only mask in the stack, flush and disable - renderer.flush(); - - renderer.currentMask.mask = null; + current.mask = null; gl.disable(gl.STENCIL_TEST); } else { - // Force flush before disabling stencil test - renderer.flush(); - var prev = renderer.maskStack[renderer.maskStack.length - 1]; prev.mask.applyStencil(renderer, prev.camera, false); if (renderer.currentCameraMask.mask !== prev.mask) { - renderer.currentMask.mask = prev.mask; - renderer.currentMask.camera = prev.camera; + current.mask = prev.mask; + current.camera = prev.camera; } else { - renderer.currentMask.mask = null; + current.mask = null; } } }, @@ -63405,7 +69749,7 @@ var GeometryMask = new Class({ renderer.currentContext.save(); - geometryMask.renderCanvas(renderer, geometryMask, 0, camera, null, null, true); + geometryMask.renderCanvas(renderer, geometryMask, camera, null, null, true); renderer.currentContext.clip(); }, @@ -63443,7 +69787,7 @@ module.exports = GeometryMask; /***/ }), -/* 289 */ +/* 304 */ /***/ (function(module, exports) { /** @@ -63550,68 +69894,7 @@ module.exports = ScrollFactor; /***/ }), -/* 290 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Build a JSON representation of the given Game Object. - * - * This is typically extended further by Game Object specific implementations. - * - * @method Phaser.GameObjects.Components.ToJSON - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON. - * - * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. - */ -var ToJSON = function (gameObject) -{ - var out = { - name: gameObject.name, - type: gameObject.type, - x: gameObject.x, - y: gameObject.y, - depth: gameObject.depth, - scale: { - x: gameObject.scaleX, - y: gameObject.scaleY - }, - origin: { - x: gameObject.originX, - y: gameObject.originY - }, - flipX: gameObject.flipX, - flipY: gameObject.flipY, - rotation: gameObject.rotation, - alpha: gameObject.alpha, - visible: gameObject.visible, - blendMode: gameObject.blendMode, - textureKey: '', - frameKey: '', - data: {} - }; - - if (gameObject.texture) - { - out.textureKey = gameObject.texture.key; - out.frameKey = gameObject.frame.name; - } - - return out; -}; - -module.exports = ToJSON; - - -/***/ }), -/* 291 */ +/* 305 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -63621,10 +69904,10 @@ module.exports = ToJSON; */ var MATH_CONST = __webpack_require__(13); -var TransformMatrix = __webpack_require__(31); -var TransformXY = __webpack_require__(166); -var WrapAngle = __webpack_require__(248); -var WrapAngleDegrees = __webpack_require__(249); +var TransformMatrix = __webpack_require__(24); +var TransformXY = __webpack_require__(169); +var WrapAngle = __webpack_require__(261); +var WrapAngleDegrees = __webpack_require__(262); var Vector2 = __webpack_require__(3); // global bitmask flag for GameObject.renderMask (used by Scale) @@ -63822,7 +70105,7 @@ var Transform = { * If you prefer to work in radians, see the `rotation` property instead. * * @name Phaser.GameObjects.Components.Transform#angle - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -63895,6 +70178,26 @@ var Transform = { return this; }, + /** + * Copies an object's coordinates to this Game Object's position. + * + * @method Phaser.GameObjects.Components.Transform#copyPosition + * @since 3.50.0 + * + * @param {(Phaser.Types.Math.Vector2Like|Phaser.Types.Math.Vector3Like|Phaser.Types.Math.Vector4Like)} source - An object with numeric 'x', 'y', 'z', or 'w' properties. Undefined values are not copied. + * + * @return {this} This Game Object instance. + */ + copyPosition: function (source) + { + if (source.x !== undefined) { this.x = source.x; } + if (source.y !== undefined) { this.y = source.y; } + if (source.z !== undefined) { this.z = source.z; } + if (source.w !== undefined) { this.w = source.w; } + + return this; + }, + /** * Sets the position of this Game Object to be a random position within the confines of * the given area. @@ -64202,7 +70505,7 @@ module.exports = Transform; /***/ }), -/* 292 */ +/* 306 */ /***/ (function(module, exports) { /** @@ -64291,7 +70594,7 @@ module.exports = Visible; /***/ }), -/* 293 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -64306,16 +70609,17 @@ module.exports = Visible; module.exports = { - CHANGE_DATA: __webpack_require__(589), - CHANGE_DATA_KEY: __webpack_require__(590), - REMOVE_DATA: __webpack_require__(591), - SET_DATA: __webpack_require__(592) + CHANGE_DATA: __webpack_require__(628), + CHANGE_DATA_KEY: __webpack_require__(629), + DESTROY: __webpack_require__(630), + REMOVE_DATA: __webpack_require__(631), + SET_DATA: __webpack_require__(632) }; /***/ }), -/* 294 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -64324,7 +70628,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Perimeter = __webpack_require__(118); +var Perimeter = __webpack_require__(126); var Point = __webpack_require__(4); @@ -64339,7 +70643,7 @@ var Point = __webpack_require__(4); * * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the perimeter points from. * @param {number} [step] - The distance between each point of the perimeter. Set to `null` if you wish to use the `quantity` parameter instead. - * @param {integer} [quantity] - The total number of points to return. The step is then calculated based on the length of the Rectangle, divided by this value. + * @param {number} [quantity] - The total number of points to return. The step is then calculated based on the length of the Rectangle, divided by this value. * @param {(array|Phaser.Geom.Point[])} [out] - An array in which the perimeter points will be stored. If not given, a new array instance is created. * * @return {(array|Phaser.Geom.Point[])} An array containing the perimeter points from the Rectangle. @@ -64434,87 +70738,7 @@ module.exports = MarchingAnts; /***/ }), -/* 295 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Moves the element at the start of the array to the end, shifting all items in the process. - * The "rotation" happens to the left. - * - * @function Phaser.Utils.Array.RotateLeft - * @since 3.0.0 - * - * @param {array} array - The array to shift to the left. This array is modified in place. - * @param {integer} [total=1] - The number of times to shift the array. - * - * @return {*} The most recently shifted element. - */ -var RotateLeft = function (array, total) -{ - if (total === undefined) { total = 1; } - - var element = null; - - for (var i = 0; i < total; i++) - { - element = array.shift(); - array.push(element); - } - - return element; -}; - -module.exports = RotateLeft; - - -/***/ }), -/* 296 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Moves the element at the end of the array to the start, shifting all items in the process. - * The "rotation" happens to the right. - * - * @function Phaser.Utils.Array.RotateRight - * @since 3.0.0 - * - * @param {array} array - The array to shift to the right. This array is modified in place. - * @param {integer} [total=1] - The number of times to shift the array. - * - * @return {*} The most recently shifted element. - */ -var RotateRight = function (array, total) -{ - if (total === undefined) { total = 1; } - - var element = null; - - for (var i = 0; i < total; i++) - { - element = array.pop(); - array.unshift(element); - } - - return element; -}; - -module.exports = RotateRight; - - -/***/ }), -/* 297 */ +/* 309 */ /***/ (function(module, exports) { /** @@ -64532,7 +70756,7 @@ module.exports = RotateRight; * @since 3.0.0 * * @param {Phaser.Geom.Line} line - The line. - * @param {integer} [stepRate=1] - The optional step rate for the points on the line. + * @param {number} [stepRate=1] - The optional step rate for the points on the line. * @param {Phaser.Types.Math.Vector2Like[]} [results] - An optional array to push the resulting coordinates into. * * @return {Phaser.Types.Math.Vector2Like[]} The array of coordinates on the line. @@ -64588,7 +70812,7 @@ module.exports = BresenhamPoints; /***/ }), -/* 298 */ +/* 310 */ /***/ (function(module, exports) { /** @@ -64672,7 +70896,7 @@ module.exports = FindClosestInSorted; /***/ }), -/* 299 */ +/* 311 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -64698,16 +70922,19 @@ var Class = __webpack_require__(0); * @since 3.0.0 * * @param {string} textureKey - The key of the Texture this AnimationFrame uses. - * @param {(string|integer)} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. - * @param {integer} index - The index of this AnimationFrame within the Animation sequence. + * @param {(string|number)} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. + * @param {number} index - The index of this AnimationFrame within the Animation sequence. * @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering. + * @param {boolean} [isKeyFrame=false] - Is this Frame a Keyframe within the Animation? */ var AnimationFrame = new Class({ initialize: - function AnimationFrame (textureKey, textureFrame, index, frame) + function AnimationFrame (textureKey, textureFrame, index, frame, isKeyFrame) { + if (isKeyFrame === undefined) { isKeyFrame = false; } + /** * The key of the Texture this AnimationFrame uses. * @@ -64721,7 +70948,7 @@ var AnimationFrame = new Class({ * The key of the Frame within the Texture that this AnimationFrame uses. * * @name Phaser.Animations.AnimationFrame#textureFrame - * @type {(string|integer)} + * @type {(string|number)} * @since 3.0.0 */ this.textureFrame = textureFrame; @@ -64730,7 +70957,7 @@ var AnimationFrame = new Class({ * The index of this AnimationFrame within the Animation sequence. * * @name Phaser.Animations.AnimationFrame#index - * @type {integer} + * @type {number} * @since 3.0.0 */ this.index = index; @@ -64810,6 +71037,15 @@ var AnimationFrame = new Class({ * @since 3.0.0 */ this.progress = 0; + + /** + * Is this Frame a KeyFrame within the Animation? + * + * @name Phaser.Animations.AnimationFrame#isKeyFrame + * @type {boolean} + * @since 3.50.0 + */ + this.isKeyFrame = isKeyFrame; }, /** @@ -64825,7 +71061,8 @@ var AnimationFrame = new Class({ return { key: this.textureKey, frame: this.textureFrame, - duration: this.duration + duration: this.duration, + keyframe: this.isKeyFrame }; }, @@ -64846,7 +71083,7 @@ module.exports = AnimationFrame; /***/ }), -/* 300 */ +/* 312 */ /***/ (function(module, exports) { /** @@ -64884,7 +71121,7 @@ module.exports = SortByDigits; /***/ }), -/* 301 */ +/* 313 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -64893,16 +71130,16 @@ module.exports = SortByDigits; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Animation = __webpack_require__(172); +var Animation = __webpack_require__(177); var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(92); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(122); -var GameEvents = __webpack_require__(21); +var CustomMap = __webpack_require__(98); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(128); +var GameEvents = __webpack_require__(23); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); -var Pad = __webpack_require__(173); -var NumberArray = __webpack_require__(302); +var Pad = __webpack_require__(178); +var NumberArray = __webpack_require__(314); /** * @classdesc @@ -64982,7 +71219,7 @@ var AnimationManager = new Class({ * See the {@link #setMix} method for more details. * * @name Phaser.Animations.AnimationManager#mixes - * @type {Phaser.Structs.Map.} + * @type {Phaser.Structs.Map.} * @since 3.50.0 */ this.mixes = new CustomMap(); @@ -65243,17 +71480,17 @@ var AnimationManager = new Class({ * * This was tested with Aseprite 1.2.25. * - * This will export a png and json file which you can load using the Atlas Loader, i.e.: + * This will export a png and json file which you can load using the Aseprite Loader, i.e.: * * ```javascript * function preload () * { * this.load.path = 'assets/animations/aseprite/'; - * this.load.atlas('paladin', 'paladin.png', 'paladin.json'); + * this.load.aseprite('paladin', 'paladin.png', 'paladin.json'); * } * ``` * - * Once exported, you can call this method from within a Scene with the 'atlas' key: + * Once loaded, you can call this method from within a Scene with the 'atlas' key: * * ```javascript * this.anims.createFromAseprite('paladin'); @@ -65572,6 +71809,36 @@ var AnimationManager = new Class({ * * If you're working with a texture atlas, see the `generateFrameNames` method instead. * + * It's a helper method, designed to make it easier for you to extract frames from sprite sheets. + * If you're working with a texture atlas, see the `generateFrameNames` method instead. + * + * Example: + * + * If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using: + * `this.anims.generateFrameNumbers('explosion', { start: 0, end: 12 })`. + * + * The `end` value tells it to stop after 12 frames. To create an animation using this method, you can do: + * + * ```javascript + * this.anims.create({ + * key: 'boom', + * frames: this.anims.generateFrameNames('explosion', { + * start: 0, + * end: 12 + * }) + * }); + * ``` + * + * Note that `start` is optional and you don't need to include it if the animation starts from frame 0. + * + * To specify an animation in reverse, swap the `start` and `end` values. + * + * If the frames are not sequential, you may pass an array of frame numbers instead, for example: + * + * `this.anims.generateFrameNumbers('explosion', { frames: [ 0, 1, 2, 1, 2, 3, 4, 0, 1, 2 ] })` + * + * Please see the animation examples and `GenerateFrameNumbers` config docs for further details. + * * @method Phaser.Animations.AnimationManager#generateFrameNumbers * @since 3.0.0 * @@ -65863,7 +72130,7 @@ module.exports = AnimationManager; /***/ }), -/* 302 */ +/* 314 */ /***/ (function(module, exports) { /** @@ -65956,7 +72223,7 @@ module.exports = NumberArray; /***/ }), -/* 303 */ +/* 315 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -65966,9 +72233,9 @@ module.exports = NumberArray; */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(92); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(304); +var CustomMap = __webpack_require__(98); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(316); /** * @classdesc @@ -66142,7 +72409,7 @@ module.exports = BaseCache; /***/ }), -/* 304 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -66157,14 +72424,14 @@ module.exports = BaseCache; module.exports = { - ADD: __webpack_require__(664), - REMOVE: __webpack_require__(665) + ADD: __webpack_require__(704), + REMOVE: __webpack_require__(705) }; /***/ }), -/* 305 */ +/* 317 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -66173,9 +72440,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCache = __webpack_require__(303); +var BaseCache = __webpack_require__(315); var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); /** * @classdesc @@ -66398,7 +72665,7 @@ module.exports = CacheManager; /***/ }), -/* 306 */ +/* 318 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -66407,14 +72674,14 @@ module.exports = CacheManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCamera = __webpack_require__(93); -var CanvasPool = __webpack_require__(26); -var CenterOn = __webpack_require__(178); -var Clamp = __webpack_require__(17); +var BaseCamera = __webpack_require__(99); +var CenterOn = __webpack_require__(182); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Effects = __webpack_require__(314); -var Linear = __webpack_require__(124); +var Effects = __webpack_require__(325); +var Events = __webpack_require__(35); +var Linear = __webpack_require__(130); var Rectangle = __webpack_require__(9); var Vector2 = __webpack_require__(3); @@ -66449,6 +72716,7 @@ var Vector2 = __webpack_require__(3); * @extends Phaser.Cameras.Scene2D.BaseCamera * @extends Phaser.GameObjects.Components.Flip * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Pipeline * * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas. * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas. @@ -66461,7 +72729,8 @@ var Camera = new Class({ Mixins: [ Components.Flip, - Components.Tint + Components.Tint, + Components.Pipeline ], initialize: @@ -66470,6 +72739,9 @@ var Camera = new Class({ { BaseCamera.call(this, x, y, width, height); + this.postPipelines = []; + this.pipelineData = {}; + /** * Does this Camera allow the Game Objects it renders to receive input events? * @@ -66604,268 +72876,6 @@ var Camera = new Class({ * @since 3.0.0 */ this._follow = null; - - /** - * Is this Camera rendering directly to the canvas or to a texture? - * - * Enable rendering to texture with the method `setRenderToTexture` (just enabling this boolean won't be enough) - * - * Once enabled you can toggle it by switching this property. - * - * To properly remove a render texture you should call the `clearRenderToTexture()` method. - * - * @name Phaser.Cameras.Scene2D.Camera#renderToTexture - * @type {boolean} - * @default false - * @since 3.13.0 - */ - this.renderToTexture = false; - - /** - * If this Camera is rendering to a texture (via `setRenderToTexture`) then you - * have the option to control if it should also render to the Game canvas as well. - * - * By default, a Camera will render both to its texture and to the Game canvas. - * - * However, if you set ths property to `false` it will only render to the texture - * and skip rendering to the Game canvas. - * - * Setting this property if the Camera isn't rendering to a texture has no effect. - * - * @name Phaser.Cameras.Scene2D.Camera#renderToGame - * @type {boolean} - * @default true - * @since 3.23.0 - */ - this.renderToGame = true; - - /** - * If this Camera has been set to render to a texture then this holds a reference - * to the HTML Canvas Element that the Camera is drawing to. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only populated if Phaser is running with the Canvas Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#canvas - * @type {HTMLCanvasElement} - * @since 3.13.0 - */ - this.canvas = null; - - /** - * If this Camera has been set to render to a texture then this holds a reference - * to the Rendering Context belonging to the Canvas element the Camera is drawing to. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only populated if Phaser is running with the Canvas Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#context - * @type {CanvasRenderingContext2D} - * @since 3.13.0 - */ - this.context = null; - - /** - * If this Camera has been set to render to a texture then this holds a reference - * to the GL Texture belonging the Camera is drawing to. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only set if Phaser is running with the WebGL Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#glTexture - * @type {?WebGLTexture} - * @since 3.13.0 - */ - this.glTexture = null; - - /** - * If this Camera has been set to render to a texture then this holds a reference - * to the GL Frame Buffer belonging the Camera is drawing to. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only set if Phaser is running with the WebGL Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#framebuffer - * @type {?WebGLFramebuffer} - * @since 3.13.0 - */ - this.framebuffer = null; - - /** - * If this Camera has been set to render to a texture and to use a custom pipeline, - * then this holds a reference to the pipeline the Camera is drawing with. - * - * Enable texture rendering using the method `setRenderToTexture`. - * - * This is only set if Phaser is running with the WebGL Renderer. - * - * @name Phaser.Cameras.Scene2D.Camera#pipeline - * @type {?Phaser.Renderer.WebGL.WebGLPipeline} - * @since 3.13.0 - */ - this.pipeline = null; - }, - - /** - * Sets the Camera to render to a texture instead of to the main canvas. - * - * The Camera will redirect all Game Objects it's asked to render to this texture. - * - * During the render sequence, the texture itself will then be rendered to the main canvas. - * - * Doing this gives you the ability to modify the texture before this happens, - * allowing for special effects such as Camera specific shaders, or post-processing - * on the texture. - * - * If running under Canvas the Camera will render to its `canvas` property. - * - * If running under WebGL the Camera will create a frame buffer, which is stored in its `framebuffer` and `glTexture` properties. - * - * If you set a camera to render to a texture then it will emit 2 events during the render loop: - * - * First, it will emit the event `prerender`. This happens right before any Game Object's are drawn to the Camera texture. - * - * Then, it will emit the event `postrender`. This happens after all Game Object's have been drawn, but right before the - * Camera texture is rendered to the main game canvas. It's the final point at which you can manipulate the texture before - * it appears in-game. - * - * You should not enable this unless you plan on actually using the texture it creates - * somehow, otherwise you're just doubling the work required to render your game. - * - * If you only require the Camera to render to a texture, and not also to the Game, - * them set the `renderToGame` parameter to `false`. - * - * To temporarily disable rendering to a texture, toggle the `renderToTexture` boolean. - * - * If you no longer require the Camera to render to a texture, call the `clearRenderToTexture` method, - * which will delete the respective textures and free-up resources. - * - * @method Phaser.Cameras.Scene2D.Camera#setRenderToTexture - * @since 3.13.0 - * - * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} [pipeline] - An optional WebGL Pipeline to render with, can be either a string which is the name of the pipeline, or a pipeline reference. - * @param {boolean} [renderToGame=true] - If you do not need the Camera to still render to the Game, set this parameter to `false`. - * - * @return {this} This Camera instance. - */ - setRenderToTexture: function (pipeline, renderToGame) - { - if (renderToGame === undefined) { renderToGame = true; } - - var renderer = this.scene.sys.game.renderer; - - if (renderer.gl) - { - this.glTexture = renderer.createTextureFromSource(null, this.width, this.height, 0); - this.framebuffer = renderer.createFramebuffer(this.width, this.height, this.glTexture, false); - } - else - { - this.canvas = CanvasPool.create2D(this, this.width, this.height); - this.context = this.canvas.getContext('2d'); - } - - this.renderToTexture = true; - this.renderToGame = renderToGame; - - if (pipeline) - { - this.setPipeline(pipeline); - } - - return this; - }, - - /** - * Sets the WebGL pipeline this Camera is using when rendering to a texture. - * - * You can pass either the string-based name of the pipeline, or a reference to the pipeline itself. - * - * Call this method with no arguments to clear any previously set pipeline. - * - * @method Phaser.Cameras.Scene2D.Camera#setPipeline - * @since 3.13.0 - * - * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} [pipeline] - The WebGL Pipeline to render with, can be either a string which is the name of the pipeline, or a pipeline reference. Or if left empty it will clear the pipeline. - * - * @return {this} This Camera instance. - */ - setPipeline: function (pipeline) - { - if (typeof pipeline === 'string') - { - var renderer = this.scene.sys.game.renderer; - - if (renderer.gl && renderer.pipelines.has(pipeline)) - { - this.pipeline = renderer.pipelines.get(pipeline); - } - } - else - { - this.pipeline = pipeline; - } - - return this; - }, - - /** - * If this Camera was set to render to a texture, this will clear the resources it was using and - * redirect it to render back to the primary Canvas again. - * - * If you only wish to temporarily disable rendering to a texture then you can toggle the - * property `renderToTexture` instead. - * - * @method Phaser.Cameras.Scene2D.Camera#clearRenderToTexture - * @since 3.13.0 - * - * @return {this} This Camera instance. - */ - clearRenderToTexture: function () - { - if (!this.scene) - { - return; - } - - var renderer = this.scene.sys.game.renderer; - - if (!renderer) - { - return; - } - - if (renderer.gl) - { - if (this.framebuffer) - { - renderer.deleteFramebuffer(this.framebuffer); - } - - if (this.glTexture) - { - renderer.deleteTexture(this.glTexture); - } - - this.framebuffer = null; - this.glTexture = null; - this.pipeline = null; - } - else - { - CanvasPool.remove(this); - - this.canvas = null; - this.context = null; - } - - this.renderToTexture = false; - - return this; }, /** @@ -66938,10 +72948,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.3.0 * - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. @@ -66962,10 +72972,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.3.0 * - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. @@ -66985,10 +72995,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE * @since 3.5.0 * - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -67009,10 +73019,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE * @since 3.0.0 * - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -67033,10 +73043,10 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.0.0 * - * @param {integer} [duration=250] - The duration of the effect in milliseconds. - * @param {integer} [red=255] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=255] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=250] - The duration of the effect in milliseconds. + * @param {number} [red=255] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=255] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -67057,7 +73067,7 @@ var Camera = new Class({ * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.0.0 * - * @param {integer} [duration=100] - The duration of the effect in milliseconds. + * @param {number} [duration=100] - The duration of the effect in milliseconds. * @param {(number|Phaser.Math.Vector2)} [intensity=0.05] - The intensity of the shake. * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -67082,7 +73092,7 @@ var Camera = new Class({ * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -67106,7 +73116,7 @@ var Camera = new Class({ * * @param {number} radians - The destination angle in radians to rotate the Camera viewport to. If the angle is positive then the rotation is clockwise else anticlockwise * @param {boolean} [shortestPath=false] - If shortest path is set to true the camera will rotate in the quickest direction clockwise or anti-clockwise. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the rotation. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the rotation effect to start immediately, even if already running. * @param {CameraRotateCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -67130,7 +73140,7 @@ var Camera = new Class({ * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -67151,10 +73161,8 @@ var Camera = new Class({ * @method Phaser.Cameras.Scene2D.Camera#preRender * @protected * @since 3.0.0 - * - * @param {number} resolution - The game resolution, as set in the Scale Manager. */ - preRender: function (resolution) + preRender: function () { var width = this.width; var height = this.height; @@ -67162,7 +73170,7 @@ var Camera = new Class({ var halfWidth = width * 0.5; var halfHeight = height * 0.5; - var zoom = this.zoom * resolution; + var zoom = this.zoom; var matrix = this.matrix; var originX = width * this.originX; @@ -67179,6 +73187,8 @@ var Camera = new Class({ CenterOn(deadzone, this.midPoint.x, this.midPoint.y); } + var emitFollowEvent = false; + if (follow && !this.panEffect.isRunning) { var fx = (follow.x - this.followOffset.x); @@ -67209,6 +73219,8 @@ var Camera = new Class({ sx = Linear(sx, fx - originX, this.lerp.x); sy = Linear(sy, fy - originY, this.lerp.y); } + + emitFollowEvent = true; } if (this.useBounds) @@ -67221,6 +73233,9 @@ var Camera = new Class({ { originX = Math.round(originX); originY = Math.round(originY); + + sx = Math.round(sx); + sy = Math.round(sy); } // Values are in pixels and not impacted by zooming the Camera @@ -67237,17 +73252,26 @@ var Camera = new Class({ var displayWidth = width / zoom; var displayHeight = height / zoom; - this.worldView.setTo( - midX - (displayWidth / 2), - midY - (displayHeight / 2), - displayWidth, - displayHeight - ); + var vwx = midX - (displayWidth / 2); + var vwy = midY - (displayHeight / 2); + + if (this.roundPixels) + { + vwx = Math.round(vwx); + vwy = Math.round(vwy); + } + + this.worldView.setTo(vwx, vwy, displayWidth, displayHeight); matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); matrix.translate(-originX, -originY); this.shakeEffect.preRender(); + + if (emitFollowEvent) + { + this.emit(Events.FOLLOW_UPDATE, this, follow); + } }, /** @@ -67407,7 +73431,7 @@ var Camera = new Class({ * @protected * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -67435,8 +73459,6 @@ var Camera = new Class({ */ destroy: function () { - this.clearRenderToTexture(); - this.resetFX(); BaseCamera.prototype.destroy.call(this); @@ -67452,7 +73474,7 @@ module.exports = Camera; /***/ }), -/* 307 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67461,7 +73483,7 @@ module.exports = Camera; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); +var Color = __webpack_require__(36); /** * Converts a hex string into a Phaser Color object. @@ -67505,7 +73527,7 @@ module.exports = HexStringToColor; /***/ }), -/* 308 */ +/* 320 */ /***/ (function(module, exports) { /** @@ -67520,10 +73542,10 @@ module.exports = HexStringToColor; * @function Phaser.Display.Color.GetColor32 * @since 3.0.0 * - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * @param {integer} alpha - The alpha color value. A number between 0 and 255. + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * @param {number} alpha - The alpha color value. A number between 0 and 255. * * @return {number} The combined color value. */ @@ -67536,7 +73558,7 @@ module.exports = GetColor32; /***/ }), -/* 309 */ +/* 321 */ /***/ (function(module, exports) { /** @@ -67554,9 +73576,9 @@ module.exports = GetColor32; * @function Phaser.Display.Color.RGBToHSV * @since 3.0.0 * - * @param {integer} r - The red color value. A number between 0 and 255. - * @param {integer} g - The green color value. A number between 0 and 255. - * @param {integer} b - The blue color value. A number between 0 and 255. + * @param {number} r - The red color value. A number between 0 and 255. + * @param {number} g - The green color value. A number between 0 and 255. + * @param {number} b - The blue color value. A number between 0 and 255. * @param {(Phaser.Types.Display.HSVColorObject|Phaser.Display.Color)} [out] - An object to store the color values in. If not given an HSV Color Object will be created. * * @return {(Phaser.Types.Display.HSVColorObject|Phaser.Display.Color)} An object with the properties `h`, `s` and `v` set. @@ -67616,7 +73638,7 @@ module.exports = RGBToHSV; /***/ }), -/* 310 */ +/* 322 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67625,8 +73647,8 @@ module.exports = RGBToHSV; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); -var IntegerToRGB = __webpack_require__(311); +var Color = __webpack_require__(36); +var IntegerToRGB = __webpack_require__(181); /** * Converts the given color value into an instance of a Color object. @@ -67634,7 +73656,7 @@ var IntegerToRGB = __webpack_require__(311); * @function Phaser.Display.Color.IntegerToColor * @since 3.0.0 * - * @param {integer} input - The color value to convert into a Color object. + * @param {number} input - The color value to convert into a Color object. * * @return {Phaser.Display.Color} A Color object. */ @@ -67649,55 +73671,7 @@ module.exports = IntegerToColor; /***/ }), -/* 311 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Return the component parts of a color as an Object with the properties alpha, red, green, blue. - * - * Alpha will only be set if it exists in the given color (0xAARRGGBB) - * - * @function Phaser.Display.Color.IntegerToRGB - * @since 3.0.0 - * - * @param {integer} input - The color value to convert into a Color object. - * - * @return {Phaser.Types.Display.ColorObject} An object with the red, green and blue values set in the r, g and b properties. - */ -var IntegerToRGB = function (color) -{ - if (color > 16777215) - { - // The color value has an alpha component - return { - a: color >>> 24, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; - } - else - { - return { - a: 255, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; - } -}; - -module.exports = IntegerToRGB; - - -/***/ }), -/* 312 */ +/* 323 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67706,7 +73680,7 @@ module.exports = IntegerToRGB; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); +var Color = __webpack_require__(36); /** * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. @@ -67727,7 +73701,7 @@ module.exports = ObjectToColor; /***/ }), -/* 313 */ +/* 324 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67736,7 +73710,7 @@ module.exports = ObjectToColor; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); +var Color = __webpack_require__(36); /** * Converts a CSS 'web' string into a Phaser Color object. @@ -67773,7 +73747,7 @@ module.exports = RGBStringToColor; /***/ }), -/* 314 */ +/* 325 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -67788,255 +73762,12 @@ module.exports = RGBStringToColor; module.exports = { - Fade: __webpack_require__(688), - Flash: __webpack_require__(689), - Pan: __webpack_require__(690), - Shake: __webpack_require__(723), - RotateTo: __webpack_require__(724), - Zoom: __webpack_require__(725) - -}; - - -/***/ }), -/* 315 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Back - */ - -module.exports = { - - In: __webpack_require__(691), - Out: __webpack_require__(692), - InOut: __webpack_require__(693) - -}; - - -/***/ }), -/* 316 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Bounce - */ - -module.exports = { - - In: __webpack_require__(694), - Out: __webpack_require__(695), - InOut: __webpack_require__(696) - -}; - - -/***/ }), -/* 317 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Circular - */ - -module.exports = { - - In: __webpack_require__(697), - Out: __webpack_require__(698), - InOut: __webpack_require__(699) - -}; - - -/***/ }), -/* 318 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Cubic - */ - -module.exports = { - - In: __webpack_require__(700), - Out: __webpack_require__(701), - InOut: __webpack_require__(702) - -}; - - -/***/ }), -/* 319 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Elastic - */ - -module.exports = { - - In: __webpack_require__(703), - Out: __webpack_require__(704), - InOut: __webpack_require__(705) - -}; - - -/***/ }), -/* 320 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Expo - */ - -module.exports = { - - In: __webpack_require__(706), - Out: __webpack_require__(707), - InOut: __webpack_require__(708) - -}; - - -/***/ }), -/* 321 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -module.exports = __webpack_require__(709); - - -/***/ }), -/* 322 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Quadratic - */ - -module.exports = { - - In: __webpack_require__(710), - Out: __webpack_require__(711), - InOut: __webpack_require__(712) - -}; - - -/***/ }), -/* 323 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Quartic - */ - -module.exports = { - - In: __webpack_require__(713), - Out: __webpack_require__(714), - InOut: __webpack_require__(715) - -}; - - -/***/ }), -/* 324 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Quintic - */ - -module.exports = { - - In: __webpack_require__(716), - Out: __webpack_require__(717), - InOut: __webpack_require__(718) - -}; - - -/***/ }), -/* 325 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Math.Easing.Sine - */ - -module.exports = { - - In: __webpack_require__(719), - Out: __webpack_require__(720), - InOut: __webpack_require__(721) + Fade: __webpack_require__(729), + Flash: __webpack_require__(730), + Pan: __webpack_require__(731), + Shake: __webpack_require__(764), + RotateTo: __webpack_require__(765), + Zoom: __webpack_require__(766) }; @@ -68052,16 +73783,259 @@ module.exports = { */ /** - * @namespace Phaser.Math.Easing.Stepped + * @namespace Phaser.Math.Easing.Back */ -module.exports = __webpack_require__(722); +module.exports = { + + In: __webpack_require__(732), + Out: __webpack_require__(733), + InOut: __webpack_require__(734) + +}; /***/ }), /* 327 */ /***/ (function(module, exports, __webpack_require__) { +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Bounce + */ + +module.exports = { + + In: __webpack_require__(735), + Out: __webpack_require__(736), + InOut: __webpack_require__(737) + +}; + + +/***/ }), +/* 328 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Circular + */ + +module.exports = { + + In: __webpack_require__(738), + Out: __webpack_require__(739), + InOut: __webpack_require__(740) + +}; + + +/***/ }), +/* 329 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Cubic + */ + +module.exports = { + + In: __webpack_require__(741), + Out: __webpack_require__(742), + InOut: __webpack_require__(743) + +}; + + +/***/ }), +/* 330 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Elastic + */ + +module.exports = { + + In: __webpack_require__(744), + Out: __webpack_require__(745), + InOut: __webpack_require__(746) + +}; + + +/***/ }), +/* 331 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Expo + */ + +module.exports = { + + In: __webpack_require__(747), + Out: __webpack_require__(748), + InOut: __webpack_require__(749) + +}; + + +/***/ }), +/* 332 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +module.exports = __webpack_require__(750); + + +/***/ }), +/* 333 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Quadratic + */ + +module.exports = { + + In: __webpack_require__(751), + Out: __webpack_require__(752), + InOut: __webpack_require__(753) + +}; + + +/***/ }), +/* 334 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Quartic + */ + +module.exports = { + + In: __webpack_require__(754), + Out: __webpack_require__(755), + InOut: __webpack_require__(756) + +}; + + +/***/ }), +/* 335 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Quintic + */ + +module.exports = { + + In: __webpack_require__(757), + Out: __webpack_require__(758), + InOut: __webpack_require__(759) + +}; + + +/***/ }), +/* 336 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Sine + */ + +module.exports = { + + In: __webpack_require__(760), + Out: __webpack_require__(761), + InOut: __webpack_require__(762) + +}; + + +/***/ }), +/* 337 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Math.Easing.Stepped + */ + +module.exports = __webpack_require__(763); + + +/***/ }), +/* 338 */ +/***/ (function(module, exports, __webpack_require__) { + /** * @author Richard Davey * @copyright 2020 Photon Storm Ltd. @@ -68069,15 +74043,15 @@ module.exports = __webpack_require__(722); */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(34); -var Device = __webpack_require__(328); +var CONST = __webpack_require__(39); +var Device = __webpack_require__(339); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); var IsPlainObject = __webpack_require__(7); -var PhaserMath = __webpack_require__(180); +var PhaserMath = __webpack_require__(185); var NOOP = __webpack_require__(1); -var DefaultPlugins = __webpack_require__(184); -var ValueToColor = __webpack_require__(174); +var DefaultPlugins = __webpack_require__(189); +var ValueToColor = __webpack_require__(179); /** * @classdesc @@ -68111,25 +74085,20 @@ var Config = new Class({ var defaultBannerTextColor = '#ffffff'; /** - * @const {(integer|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. + * @const {(number|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. */ this.width = GetValue(config, 'width', 1024); /** - * @const {(integer|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. + * @const {(number|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. */ this.height = GetValue(config, 'height', 768); /** - * @const {(Phaser.Scale.ZoomType|integer)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. + * @const {(Phaser.Scale.ZoomType|number)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. */ this.zoom = GetValue(config, 'zoom', 1); - /** - * @const {number} Phaser.Core.Config#resolution - The canvas device pixel resolution. Currently un-used. - */ - this.resolution = GetValue(config, 'resolution', 1); - /** * @const {?*} Phaser.Core.Config#parent - A parent DOM element into which the canvas created by the renderer will be injected. */ @@ -68146,7 +74115,7 @@ var Config = new Class({ this.expandParent = GetValue(config, 'expandParent', true); /** - * @const {integer} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + * @const {number} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. */ this.autoRound = GetValue(config, 'autoRound', false); @@ -68156,7 +74125,7 @@ var Config = new Class({ this.autoCenter = GetValue(config, 'autoCenter', 0); /** - * @const {integer} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? + * @const {number} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? */ this.resizeInterval = GetValue(config, 'resizeInterval', 500); @@ -68166,22 +74135,22 @@ var Config = new Class({ this.fullscreenTarget = GetValue(config, 'fullscreenTarget', null); /** - * @const {integer} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. + * @const {number} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. */ this.minWidth = GetValue(config, 'minWidth', 0); /** - * @const {integer} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. + * @const {number} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. */ this.maxWidth = GetValue(config, 'maxWidth', 0); /** - * @const {integer} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. + * @const {number} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. */ this.minHeight = GetValue(config, 'minHeight', 0); /** - * @const {integer} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. + * @const {number} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. */ this.maxHeight = GetValue(config, 'maxHeight', 0); @@ -68194,7 +74163,6 @@ var Config = new Class({ this.width = GetValue(scaleConfig, 'width', this.width); this.height = GetValue(scaleConfig, 'height', this.height); this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); - this.resolution = GetValue(scaleConfig, 'resolution', this.resolution); this.parent = GetValue(scaleConfig, 'parent', this.parent); this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); this.expandParent = GetValue(scaleConfig, 'expandParent', this.expandParent); @@ -68290,7 +74258,7 @@ var Config = new Class({ this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); /** - * @const {?integer[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. + * @const {?number[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. */ this.inputKeyboardCapture = GetValue(config, 'input.keyboard.capture', []); @@ -68305,9 +74273,24 @@ var Config = new Class({ this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); /** - * @const {boolean} Phaser.Core.Config#inputMouseCapture - Should mouse events be captured? I.e. have prevent default called on them. + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultDown - Should `mousedown` DOM events have `preventDefault` called on them? */ - this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true); + this.inputMousePreventDefaultDown = GetValue(config, 'input.mouse.preventDefaultDown', true); + + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultUp - Should `mouseup` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultUp = GetValue(config, 'input.mouse.preventDefaultUp', true); + + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultMove - Should `mousemove` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultMove = GetValue(config, 'input.mouse.preventDefaultMove', true); + + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultWheel - Should `wheel` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultWheel = GetValue(config, 'input.mouse.preventDefaultWheel', true); /** * @const {boolean} Phaser.Core.Config#inputTouch - Enable the Touch Plugin. This can be disabled in games that don't need touch input. @@ -68325,12 +74308,12 @@ var Config = new Class({ this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); /** - * @const {integer} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. + * @const {number} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. */ this.inputActivePointers = GetValue(config, 'input.activePointers', 1); /** - * @const {integer} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + * @const {number} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. */ this.inputSmoothFactor = GetValue(config, 'input.smoothFactor', 0); @@ -68357,7 +74340,7 @@ var Config = new Class({ /** * @const {Phaser.Types.Core.AudioConfig} Phaser.Core.Config#audio - The Audio Configuration object. */ - this.audio = GetValue(config, 'audio'); + this.audio = GetValue(config, 'audio', {}); // If you do: { banner: false } it won't display any banner at all @@ -68387,7 +74370,7 @@ var Config = new Class({ } /** - * @const {?Phaser.Types.Core.FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. + * @const {Phaser.Types.Core.FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. */ this.fps = GetValue(config, 'fps', null); @@ -68396,6 +74379,11 @@ var Config = new Class({ var renderConfig = GetValue(config, 'render', config); + /** + * @const {Phaser.Types.Core.PipelineConfig} Phaser.Core.Config#pipeline - An object mapping WebGL names to WebGLPipeline classes. These should be class constructors, not instances. + */ + this.pipeline = GetValue(renderConfig, 'pipeline', null); + /** * @const {boolean} Phaser.Core.Config#antialias - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. */ @@ -68429,6 +74417,7 @@ var Config = new Class({ if (this.pixelArt) { this.antialias = false; + this.antialiasGL = false; this.roundPixels = true; } @@ -68458,17 +74447,17 @@ var Config = new Class({ this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); /** - * @const {integer} Phaser.Core.Config#batchSize - The default WebGL Batch size. + * @const {number} Phaser.Core.Config#batchSize - The default WebGL Batch size. Represents the number of _quads_ that can be added to a single batch. */ this.batchSize = GetValue(renderConfig, 'batchSize', 4096); /** - * @const {integer} Phaser.Core.Config#maxTextures - When in WebGL mode, this sets the maximum number of GPU Textures to use. The default, -1, will use all available units. The WebGL1 spec says all browsers should provide a minimum of 8. + * @const {number} Phaser.Core.Config#maxTextures - When in WebGL mode, this sets the maximum number of GPU Textures to use. The default, -1, will use all available units. The WebGL1 spec says all browsers should provide a minimum of 8. */ this.maxTextures = GetValue(renderConfig, 'maxTextures', -1); /** - * @const {integer} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + * @const {number} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. */ this.maxLights = GetValue(renderConfig, 'maxLights', 10); @@ -68479,8 +74468,9 @@ var Config = new Class({ */ this.backgroundColor = ValueToColor(bgc); - if (bgc === 0 && this.transparent) + if (this.transparent) { + this.backgroundColor = ValueToColor(0x000000); this.backgroundColor.alpha = 0; } @@ -68515,9 +74505,11 @@ var Config = new Class({ this.loaderPath = GetValue(config, 'loader.path', ''); /** - * @const {integer} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). + * @const {number} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). */ - this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32); + var defaultParallel = (Device.os.android) ? 6 : 32; + + this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', defaultParallel); /** * @const {(string|undefined)} Phaser.Core.Config#loaderCrossOrigin - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. @@ -68545,7 +74537,7 @@ var Config = new Class({ this.loaderPassword = GetValue(config, 'loader.password', ''); /** - * @const {integer} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. + * @const {number} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. */ this.loaderTimeout = GetValue(config, 'loader.timeout', 0); @@ -68626,6 +74618,11 @@ var Config = new Class({ */ this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); + /** + * @const {string} Phaser.Core.Config#whiteImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is white or not loaded. + */ + this.whiteImage = GetValue(config, 'images.white', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABdJREFUeNpi/P//PwMMMDEgAdwcgAADAJZuAwXJYZOzAAAAAElFTkSuQmCC'); + if (window) { if (window.FORCE_WEBGL) @@ -68645,7 +74642,7 @@ module.exports = Config; /***/ }), -/* 328 */ +/* 339 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68679,20 +74676,20 @@ module.exports = Config; module.exports = { - os: __webpack_require__(125), - browser: __webpack_require__(126), - features: __webpack_require__(179), - input: __webpack_require__(756), - audio: __webpack_require__(757), - video: __webpack_require__(758), - fullscreen: __webpack_require__(759), - canvasFeatures: __webpack_require__(329) + os: __webpack_require__(102), + browser: __webpack_require__(131), + features: __webpack_require__(183), + input: __webpack_require__(797), + audio: __webpack_require__(798), + video: __webpack_require__(799), + fullscreen: __webpack_require__(800), + canvasFeatures: __webpack_require__(340) }; /***/ }), -/* 329 */ +/* 340 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -68701,7 +74698,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); +var CanvasPool = __webpack_require__(31); /** * Determines the canvas features of the browser running this Phaser Game instance. @@ -68806,7 +74803,7 @@ module.exports = init(); /***/ }), -/* 330 */ +/* 341 */ /***/ (function(module, exports) { /** @@ -68837,7 +74834,7 @@ module.exports = Between; /***/ }), -/* 331 */ +/* 342 */ /***/ (function(module, exports) { /** @@ -68868,7 +74865,7 @@ module.exports = BetweenPoints; /***/ }), -/* 332 */ +/* 343 */ /***/ (function(module, exports) { /** @@ -68905,7 +74902,7 @@ module.exports = Normalize; /***/ }), -/* 333 */ +/* 344 */ /***/ (function(module, exports) { /** @@ -68937,7 +74934,7 @@ module.exports = DistanceBetweenPoints; /***/ }), -/* 334 */ +/* 345 */ /***/ (function(module, exports) { /** @@ -68971,7 +74968,7 @@ module.exports = DistanceSquared; /***/ }), -/* 335 */ +/* 346 */ /***/ (function(module, exports) { /** @@ -69005,7 +75002,7 @@ module.exports = GreaterThan; /***/ }), -/* 336 */ +/* 347 */ /***/ (function(module, exports) { /** @@ -69039,7 +75036,7 @@ module.exports = LessThan; /***/ }), -/* 337 */ +/* 348 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -69048,7 +75045,7 @@ module.exports = LessThan; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Factorial = __webpack_require__(338); +var Factorial = __webpack_require__(349); /** * Calculates the Bernstein basis from the three factorial coefficients. @@ -69070,7 +75067,7 @@ module.exports = Bernstein; /***/ }), -/* 338 */ +/* 349 */ /***/ (function(module, exports) { /** @@ -69110,7 +75107,7 @@ module.exports = Factorial; /***/ }), -/* 339 */ +/* 350 */ /***/ (function(module, exports) { /** @@ -69180,7 +75177,7 @@ module.exports = CubicBezierInterpolation; /***/ }), -/* 340 */ +/* 351 */ /***/ (function(module, exports) { /** @@ -69239,7 +75236,7 @@ module.exports = QuadraticBezierInterpolation; /***/ }), -/* 341 */ +/* 352 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -69248,7 +75245,7 @@ module.exports = QuadraticBezierInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SmoothStep = __webpack_require__(171); +var SmoothStep = __webpack_require__(176); /** * A Smooth Step interpolation method. @@ -69272,7 +75269,7 @@ module.exports = SmoothStepInterpolation; /***/ }), -/* 342 */ +/* 353 */ /***/ (function(module, exports) { /** @@ -69289,7 +75286,7 @@ module.exports = SmoothStepInterpolation; * * @param {number} value - The value. * - * @return {integer} The nearest power of 2 to `value`. + * @return {number} The nearest power of 2 to `value`. */ var GetPowerOfTwo = function (value) { @@ -69302,51 +75299,7 @@ module.exports = GetPowerOfTwo; /***/ }), -/* 343 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Snap a value to nearest grid slice, using ceil. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. - * As will `14` snap to `15`... but `16` will snap to `20`. - * - * @function Phaser.Math.Snap.Ceil - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapCeil = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.ceil(value / gap); - - return (divide) ? (start + value) / gap : start + value; -}; - -module.exports = SnapCeil; - - -/***/ }), -/* 344 */ +/* 354 */ /***/ (function(module, exports) { /** @@ -69381,7 +75334,7 @@ module.exports = Rotate; /***/ }), -/* 345 */ +/* 355 */ /***/ (function(module, exports) { /** @@ -69410,7 +75363,7 @@ module.exports = RoundAwayFromZero; /***/ }), -/* 346 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -70003,7 +75956,7 @@ module.exports = Matrix3; /***/ }), -/* 347 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -70016,1470 +75969,9 @@ module.exports = Matrix3; // and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl var Class = __webpack_require__(0); - -var EPSILON = 0.000001; - -/** - * @classdesc - * A four-dimensional matrix. - * - * @class Matrix4 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. - */ -var Matrix4 = new Class({ - - initialize: - - function Matrix4 (m) - { - /** - * The matrix values. - * - * @name Phaser.Math.Matrix4#val - * @type {Float32Array} - * @since 3.0.0 - */ - this.val = new Float32Array(16); - - if (m) - { - // Assume Matrix4 with val: - this.copy(m); - } - else - { - // Default to identity - this.identity(); - } - }, - - /** - * Make a clone of this Matrix4. - * - * @method Phaser.Math.Matrix4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} A clone of this Matrix4. - */ - clone: function () - { - return new Matrix4(this); - }, - - // TODO - Should work with basic values - - /** - * This method is an alias for `Matrix4.copy`. - * - * @method Phaser.Math.Matrix4#set - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - set: function (src) - { - return this.copy(src); - }, - - /** - * Copy the values of a given Matrix into this Matrix. - * - * @method Phaser.Math.Matrix4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - copy: function (src) - { - var out = this.val; - var a = src.val; - - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - - return this; - }, - - /** - * Set the values of this Matrix from the given array. - * - * @method Phaser.Math.Matrix4#fromArray - * @since 3.0.0 - * - * @param {array} a - The array to copy the values from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromArray: function (a) - { - var out = this.val; - - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - - return this; - }, - - /** - * Reset this Matrix. - * - * Sets all values to `0`. - * - * @method Phaser.Math.Matrix4#zero - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - zero: function () - { - var out = this.val; - - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 0; - - return this; - }, - - /** - * Set the `x`, `y` and `z` values of this Matrix. - * - * @method Phaser.Math.Matrix4#xyz - * @since 3.0.0 - * - * @param {number} x - The x value. - * @param {number} y - The y value. - * @param {number} z - The z value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - xyz: function (x, y, z) - { - this.identity(); - - var out = this.val; - - out[12] = x; - out[13] = y; - out[14] = z; - - return this; - }, - - /** - * Set the scaling values of this Matrix. - * - * @method Phaser.Math.Matrix4#scaling - * @since 3.0.0 - * - * @param {number} x - The x scaling value. - * @param {number} y - The y scaling value. - * @param {number} z - The z scaling value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scaling: function (x, y, z) - { - this.zero(); - - var out = this.val; - - out[0] = x; - out[5] = y; - out[10] = z; - out[15] = 1; - - return this; - }, - - /** - * Reset this Matrix to an identity (default) matrix. - * - * @method Phaser.Math.Matrix4#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - identity: function () - { - var out = this.val; - - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - - return this; - }, - - /** - * Transpose this Matrix. - * - * @method Phaser.Math.Matrix4#transpose - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - transpose: function () - { - var a = this.val; - - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a12 = a[6]; - var a13 = a[7]; - var a23 = a[11]; - - a[1] = a[4]; - a[2] = a[8]; - a[3] = a[12]; - a[4] = a01; - a[6] = a[9]; - a[7] = a[13]; - a[8] = a02; - a[9] = a12; - a[11] = a[14]; - a[12] = a03; - a[13] = a13; - a[14] = a23; - - return this; - }, - - /** - * Invert this Matrix. - * - * @method Phaser.Math.Matrix4#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - invert: function () - { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; - - // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - - if (!det) - { - return null; - } - - det = 1 / det; - - a[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - a[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - a[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - a[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; - a[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - a[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - a[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - a[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; - a[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - a[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - a[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - a[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; - a[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; - a[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; - a[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; - a[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; - - return this; - }, - - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix4#adjoint - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - adjoint: function () - { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - a[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); - a[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - a[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); - a[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - a[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - a[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); - a[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - a[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); - a[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); - a[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - a[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); - a[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - a[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - a[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); - a[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - a[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); - - return this; - }, - - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix4#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: function () - { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; - - // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - }, - - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix4#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiply: function (src) - { - var a = this.val; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - var b = src.val; - - // Cache only the current line of the second matrix - var b0 = b[0]; - var b1 = b[1]; - var b2 = b[2]; - var b3 = b[3]; - - a[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; - - a[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; - - a[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; - - a[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - - return this; - }, - - /** - * Multiply the values of this Matrix4 by those given in the `src` argument. - * - * @method Phaser.Math.Matrix4#multiplyLocal - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The source Matrix4 that this Matrix4 is multiplied by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - multiplyLocal: function (src) - { - var a = []; - var m1 = this.val; - var m2 = src.val; - - a[0] = m1[0] * m2[0] + m1[1] * m2[4] + m1[2] * m2[8] + m1[3] * m2[12]; - a[1] = m1[0] * m2[1] + m1[1] * m2[5] + m1[2] * m2[9] + m1[3] * m2[13]; - a[2] = m1[0] * m2[2] + m1[1] * m2[6] + m1[2] * m2[10] + m1[3] * m2[14]; - a[3] = m1[0] * m2[3] + m1[1] * m2[7] + m1[2] * m2[11] + m1[3] * m2[15]; - - a[4] = m1[4] * m2[0] + m1[5] * m2[4] + m1[6] * m2[8] + m1[7] * m2[12]; - a[5] = m1[4] * m2[1] + m1[5] * m2[5] + m1[6] * m2[9] + m1[7] * m2[13]; - a[6] = m1[4] * m2[2] + m1[5] * m2[6] + m1[6] * m2[10] + m1[7] * m2[14]; - a[7] = m1[4] * m2[3] + m1[5] * m2[7] + m1[6] * m2[11] + m1[7] * m2[15]; - - a[8] = m1[8] * m2[0] + m1[9] * m2[4] + m1[10] * m2[8] + m1[11] * m2[12]; - a[9] = m1[8] * m2[1] + m1[9] * m2[5] + m1[10] * m2[9] + m1[11] * m2[13]; - a[10] = m1[8] * m2[2] + m1[9] * m2[6] + m1[10] * m2[10] + m1[11] * m2[14]; - a[11] = m1[8] * m2[3] + m1[9] * m2[7] + m1[10] * m2[11] + m1[11] * m2[15]; - - a[12] = m1[12] * m2[0] + m1[13] * m2[4] + m1[14] * m2[8] + m1[15] * m2[12]; - a[13] = m1[12] * m2[1] + m1[13] * m2[5] + m1[14] * m2[9] + m1[15] * m2[13]; - a[14] = m1[12] * m2[2] + m1[13] * m2[6] + m1[14] * m2[10] + m1[15] * m2[14]; - a[15] = m1[12] * m2[3] + m1[13] * m2[7] + m1[14] * m2[11] + m1[15] * m2[15]; - - return this.fromArray(a); - }, - - /** - * Translate this Matrix using the given Vector. - * - * @method Phaser.Math.Matrix4#translate - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - translate: function (v) - { - var x = v.x; - var y = v.y; - var z = v.z; - var a = this.val; - - a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - - return this; - }, - - /** - * Translate this Matrix using the given values. - * - * @method Phaser.Math.Matrix4#translateXYZ - * @since 3.16.0 - * - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - translateXYZ: function (x, y, z) - { - var a = this.val; - - a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - - return this; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. - * - * @method Phaser.Math.Matrix4#scale - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scale: function (v) - { - var x = v.x; - var y = v.y; - var z = v.z; - var a = this.val; - - a[0] = a[0] * x; - a[1] = a[1] * x; - a[2] = a[2] * x; - a[3] = a[3] * x; - - a[4] = a[4] * y; - a[5] = a[5] * y; - a[6] = a[6] * y; - a[7] = a[7] * y; - - a[8] = a[8] * z; - a[9] = a[9] * z; - a[10] = a[10] * z; - a[11] = a[11] * z; - - return this; - }, - - /** - * Apply a scale transformation to this Matrix. - * - * @method Phaser.Math.Matrix4#scaleXYZ - * @since 3.16.0 - * - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - scaleXYZ: function (x, y, z) - { - var a = this.val; - - a[0] = a[0] * x; - a[1] = a[1] * x; - a[2] = a[2] * x; - a[3] = a[3] * x; - - a[4] = a[4] * y; - a[5] = a[5] * y; - a[6] = a[6] * y; - a[7] = a[7] * y; - - a[8] = a[8] * z; - a[9] = a[9] * z; - a[10] = a[10] * z; - a[11] = a[11] * z; - - return this; - }, - - /** - * Derive a rotation matrix around the given axis. - * - * @method Phaser.Math.Matrix4#makeRotationAxis - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. - * @param {number} angle - The rotation angle in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - makeRotationAxis: function (axis, angle) - { - // Based on http://www.gamedev.net/reference/articles/article1199.asp - - var c = Math.cos(angle); - var s = Math.sin(angle); - var t = 1 - c; - var x = axis.x; - var y = axis.y; - var z = axis.z; - var tx = t * x; - var ty = t * y; - - this.fromArray([ - tx * x + c, tx * y - s * z, tx * z + s * y, 0, - tx * y + s * z, ty * y + c, ty * z - s * x, 0, - tx * z - s * y, ty * z + s * x, t * z * z + c, 0, - 0, 0, 0, 1 - ]); - - return this; - }, - - /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix4#rotate - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotate: function (rad, axis) - { - var a = this.val; - var x = axis.x; - var y = axis.y; - var z = axis.z; - var len = Math.sqrt(x * x + y * y + z * z); - - if (Math.abs(len) < EPSILON) - { - return null; - } - - len = 1 / len; - x *= len; - y *= len; - z *= len; - - var s = Math.sin(rad); - var c = Math.cos(rad); - var t = 1 - c; - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - // Construct the elements of the rotation matrix - var b00 = x * x * t + c; - var b01 = y * x * t + z * s; - var b02 = z * x * t - y * s; - - var b10 = x * y * t - z * s; - var b11 = y * y * t + c; - var b12 = z * y * t + x * s; - - var b20 = x * z * t + y * s; - var b21 = y * z * t - x * s; - var b22 = z * z * t + c; - - // Perform rotation-specific matrix multiplication - a[0] = a00 * b00 + a10 * b01 + a20 * b02; - a[1] = a01 * b00 + a11 * b01 + a21 * b02; - a[2] = a02 * b00 + a12 * b01 + a22 * b02; - a[3] = a03 * b00 + a13 * b01 + a23 * b02; - a[4] = a00 * b10 + a10 * b11 + a20 * b12; - a[5] = a01 * b10 + a11 * b11 + a21 * b12; - a[6] = a02 * b10 + a12 * b11 + a22 * b12; - a[7] = a03 * b10 + a13 * b11 + a23 * b12; - a[8] = a00 * b20 + a10 * b21 + a20 * b22; - a[9] = a01 * b20 + a11 * b21 + a21 * b22; - a[10] = a02 * b20 + a12 * b21 + a22 * b22; - a[11] = a03 * b20 + a13 * b21 + a23 * b22; - - return this; - }, - - /** - * Rotate this matrix on its X axis. - * - * @method Phaser.Math.Matrix4#rotateX - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateX: function (rad) - { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - // Perform axis-specific matrix multiplication - a[4] = a10 * c + a20 * s; - a[5] = a11 * c + a21 * s; - a[6] = a12 * c + a22 * s; - a[7] = a13 * c + a23 * s; - a[8] = a20 * c - a10 * s; - a[9] = a21 * c - a11 * s; - a[10] = a22 * c - a12 * s; - a[11] = a23 * c - a13 * s; - - return this; - }, - - /** - * Rotate this matrix on its Y axis. - * - * @method Phaser.Math.Matrix4#rotateY - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateY: function (rad) - { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - // Perform axis-specific matrix multiplication - a[0] = a00 * c - a20 * s; - a[1] = a01 * c - a21 * s; - a[2] = a02 * c - a22 * s; - a[3] = a03 * c - a23 * s; - a[8] = a00 * s + a20 * c; - a[9] = a01 * s + a21 * c; - a[10] = a02 * s + a22 * c; - a[11] = a03 * s + a23 * c; - - return this; - }, - - /** - * Rotate this matrix on its Z axis. - * - * @method Phaser.Math.Matrix4#rotateZ - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - rotateZ: function (rad) - { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - // Perform axis-specific matrix multiplication - a[0] = a00 * c + a10 * s; - a[1] = a01 * c + a11 * s; - a[2] = a02 * c + a12 * s; - a[3] = a03 * c + a13 * s; - a[4] = a10 * c - a00 * s; - a[5] = a11 * c - a01 * s; - a[6] = a12 * c - a02 * s; - a[7] = a13 * c - a03 * s; - - return this; - }, - - /** - * Set the values of this Matrix from the given rotation Quaternion and translation Vector. - * - * @method Phaser.Math.Matrix4#fromRotationTranslation - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. - * @param {Phaser.Math.Vector3} v - The Vector to set translation from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromRotationTranslation: function (q, v) - { - // Quaternion math - var out = this.val; - - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - - out[12] = v.x; - out[13] = v.y; - out[14] = v.z; - out[15] = 1; - - return this; - }, - - /** - * Set the values of this Matrix from the given Quaternion. - * - * @method Phaser.Math.Matrix4#fromQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - fromQuat: function (q) - { - var out = this.val; - - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - - return this; - }, - - /** - * Generate a frustum matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#frustum - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - frustum: function (left, right, bottom, top, near, far) - { - var out = this.val; - - var rl = 1 / (right - left); - var tb = 1 / (top - bottom); - var nf = 1 / (near - far); - - out[0] = (near * 2) * rl; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = (near * 2) * tb; - out[6] = 0; - out[7] = 0; - - out[8] = (right + left) * rl; - out[9] = (top + bottom) * tb; - out[10] = (far + near) * nf; - out[11] = -1; - - out[12] = 0; - out[13] = 0; - out[14] = (far * near * 2) * nf; - out[15] = 0; - - return this; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspective - * @since 3.0.0 - * - * @param {number} fovy - Vertical field of view in radians - * @param {number} aspect - Aspect ratio. Typically viewport width /height. - * @param {number} near - Near bound of the frustum. - * @param {number} far - Far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspective: function (fovy, aspect, near, far) - { - var out = this.val; - var f = 1.0 / Math.tan(fovy / 2); - var nf = 1 / (near - far); - - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - - out[8] = 0; - out[9] = 0; - out[10] = (far + near) * nf; - out[11] = -1; - - out[12] = 0; - out[13] = 0; - out[14] = (2 * far * near) * nf; - out[15] = 0; - - return this; - }, - - /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspectiveLH - * @since 3.0.0 - * - * @param {number} width - The width of the frustum. - * @param {number} height - The height of the frustum. - * @param {number} near - Near bound of the frustum. - * @param {number} far - Far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - perspectiveLH: function (width, height, near, far) - { - var out = this.val; - - out[0] = (2 * near) / width; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = (2 * near) / height; - out[6] = 0; - out[7] = 0; - - out[8] = 0; - out[9] = 0; - out[10] = -far / (near - far); - out[11] = 1; - - out[12] = 0; - out[13] = 0; - out[14] = (near * far) / (near - far); - out[15] = 0; - - return this; - }, - - /** - * Generate an orthogonal projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#ortho - * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - ortho: function (left, right, bottom, top, near, far) - { - var out = this.val; - var lr = left - right; - var bt = bottom - top; - var nf = near - far; - - // Avoid division by zero - lr = (lr === 0) ? lr : 1 / lr; - bt = (bt === 0) ? bt : 1 / bt; - nf = (nf === 0) ? nf : 1 / nf; - - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - - out[8] = 0; - out[9] = 0; - out[10] = 2 * nf; - out[11] = 0; - - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = (far + near) * nf; - out[15] = 1; - - return this; - }, - - /** - * Generate a look-at matrix with the given eye position, focal point, and up axis. - * - * @method Phaser.Math.Matrix4#lookAt - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} eye - Position of the viewer - * @param {Phaser.Math.Vector3} center - Point the viewer is looking at - * @param {Phaser.Math.Vector3} up - vec3 pointing up. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - lookAt: function (eye, center, up) - { - var out = this.val; - - var eyex = eye.x; - var eyey = eye.y; - var eyez = eye.z; - - var upx = up.x; - var upy = up.y; - var upz = up.z; - - var centerx = center.x; - var centery = center.y; - var centerz = center.z; - - if (Math.abs(eyex - centerx) < EPSILON && - Math.abs(eyey - centery) < EPSILON && - Math.abs(eyez - centerz) < EPSILON) - { - return this.identity(); - } - - var z0 = eyex - centerx; - var z1 = eyey - centery; - var z2 = eyez - centerz; - - var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); - - z0 *= len; - z1 *= len; - z2 *= len; - - var x0 = upy * z2 - upz * z1; - var x1 = upz * z0 - upx * z2; - var x2 = upx * z1 - upy * z0; - - len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); - - if (!len) - { - x0 = 0; - x1 = 0; - x2 = 0; - } - else - { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - - var y0 = z1 * x2 - z2 * x1; - var y1 = z2 * x0 - z0 * x2; - var y2 = z0 * x1 - z1 * x0; - - len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); - - if (!len) - { - y0 = 0; - y1 = 0; - y2 = 0; - } - else - { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - - out[0] = x0; - out[1] = y0; - out[2] = z0; - out[3] = 0; - - out[4] = x1; - out[5] = y1; - out[6] = z1; - out[7] = 0; - - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; - - return this; - }, - - /** - * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. - * - * @method Phaser.Math.Matrix4#yawPitchRoll - * @since 3.0.0 - * - * @param {number} yaw - The yaw value. - * @param {number} pitch - The pitch value. - * @param {number} roll - The roll value. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - yawPitchRoll: function (yaw, pitch, roll) - { - this.zero(); - _tempMat1.zero(); - _tempMat2.zero(); - - var m0 = this.val; - var m1 = _tempMat1.val; - var m2 = _tempMat2.val; - - // Rotate Z - var s = Math.sin(roll); - var c = Math.cos(roll); - - m0[10] = 1; - m0[15] = 1; - m0[0] = c; - m0[1] = s; - m0[4] = -s; - m0[5] = c; - - // Rotate X - s = Math.sin(pitch); - c = Math.cos(pitch); - - m1[0] = 1; - m1[15] = 1; - m1[5] = c; - m1[10] = c; - m1[9] = -s; - m1[6] = s; - - // Rotate Y - s = Math.sin(yaw); - c = Math.cos(yaw); - - m2[5] = 1; - m2[15] = 1; - m2[0] = c; - m2[2] = -s; - m2[8] = s; - m2[10] = c; - - this.multiplyLocal(_tempMat1); - this.multiplyLocal(_tempMat2); - - return this; - }, - - /** - * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. - * - * @method Phaser.Math.Matrix4#setWorldMatrix - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. - * @param {Phaser.Math.Vector3} position - The position of the world matrix. - * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. - * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. - * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. - * - * @return {Phaser.Math.Matrix4} This Matrix4. - */ - setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) - { - this.yawPitchRoll(rotation.y, rotation.x, rotation.z); - - _tempMat1.scaling(scale.x, scale.y, scale.z); - _tempMat2.xyz(position.x, position.y, position.z); - - this.multiplyLocal(_tempMat1); - this.multiplyLocal(_tempMat2); - - if (viewMatrix !== undefined) - { - this.multiplyLocal(viewMatrix); - } - - if (projectionMatrix !== undefined) - { - this.multiplyLocal(projectionMatrix); - } - - return this; - } - -}); - -var _tempMat1 = new Matrix4(); -var _tempMat2 = new Matrix4(); - -module.exports = Matrix4; - - -/***/ }), -/* 348 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - -var Class = __webpack_require__(0); -var Vector3 = __webpack_require__(81); -var Matrix3 = __webpack_require__(346); +var Matrix3 = __webpack_require__(356); +var NOOP = __webpack_require__(1); +var Vector3 = __webpack_require__(37); var EPSILON = 0.000001; @@ -71502,10 +75994,10 @@ var tmpMat3 = new Matrix3(); * @constructor * @since 3.0.0 * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - * @param {number} [w] - The w component. + * @param {number} [x=0] - The x component. + * @param {number} [y=0] - The y component. + * @param {number} [z=0] - The z component. + * @param {number} [w=1] - The w component. */ var Quaternion = new Class({ @@ -71516,52 +76008,141 @@ var Quaternion = new Class({ /** * The x component of this Quaternion. * - * @name Phaser.Math.Quaternion#x + * @name Phaser.Math.Quaternion#_x * @type {number} * @default 0 - * @since 3.0.0 + * @private + * @since 3.50.0 */ /** * The y component of this Quaternion. * - * @name Phaser.Math.Quaternion#y + * @name Phaser.Math.Quaternion#_y * @type {number} * @default 0 - * @since 3.0.0 + * @private + * @since 3.50.0 */ /** * The z component of this Quaternion. * - * @name Phaser.Math.Quaternion#z + * @name Phaser.Math.Quaternion#_z * @type {number} * @default 0 - * @since 3.0.0 + * @private + * @since 3.50.0 */ /** * The w component of this Quaternion. * - * @name Phaser.Math.Quaternion#w + * @name Phaser.Math.Quaternion#_w * @type {number} * @default 0 - * @since 3.0.0 + * @private + * @since 3.50.0 */ - if (typeof x === 'object') + /** + * This callback is invoked, if set, each time a value in this quaternion is changed. + * The callback is passed one argument, a reference to this quaternion. + * + * @name Phaser.Math.Quaternion#onChangeCallback + * @type {function} + * @since 3.50.0 + */ + this.onChangeCallback = NOOP; + + this.set(x, y, z, w); + }, + + /** + * The x component of this Quaternion. + * + * @name Phaser.Math.Quaternion#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + x: { + get: function () { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; + return this._x; + }, + + set: function (value) + { + this._x = value; + + this.onChangeCallback(this); } - else + }, + + /** + * The y component of this Quaternion. + * + * @name Phaser.Math.Quaternion#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + y: { + get: function () { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; + return this._y; + }, + + set: function (value) + { + this._y = value; + + this.onChangeCallback(this); + } + }, + + /** + * The z component of this Quaternion. + * + * @name Phaser.Math.Quaternion#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + z: { + get: function () + { + return this._z; + }, + + set: function (value) + { + this._z = value; + + this.onChangeCallback(this); + } + }, + + /** + * The w component of this Quaternion. + * + * @name Phaser.Math.Quaternion#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + w: { + get: function () + { + return this._w; + }, + + set: function (value) + { + this._w = value; + + this.onChangeCallback(this); } }, @@ -71577,16 +76158,11 @@ var Quaternion = new Class({ */ copy: function (src) { - this.x = src.x; - this.y = src.y; - this.z = src.z; - this.w = src.w; - - return this; + return this.set(src); }, /** - * Set the components of this Quaternion. + * Set the components of this Quaternion and optionally call the `onChangeCallback`. * * @method Phaser.Math.Quaternion#set * @since 3.0.0 @@ -71595,24 +76171,32 @@ var Quaternion = new Class({ * @param {number} [y=0] - The y component. * @param {number} [z=0] - The z component. * @param {number} [w=0] - The w component. + * @param {boolean} [update=true] - Call the `onChangeCallback`? * * @return {Phaser.Math.Quaternion} This Quaternion. */ - set: function (x, y, z, w) + set: function (x, y, z, w, update) { + if (update === undefined) { update = true; } + if (typeof x === 'object') { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; + this._x = x.x || 0; + this._y = x.y || 0; + this._z = x.z || 0; + this._w = x.w || 0; } else { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; + this._x = x || 0; + this._y = y || 0; + this._z = z || 0; + this._w = w || 0; + } + + if (update) + { + this.onChangeCallback(this); } return this; @@ -71630,10 +76214,12 @@ var Quaternion = new Class({ */ add: function (v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; + this._x += v.x; + this._y += v.y; + this._z += v.z; + this._w += v.w; + + this.onChangeCallback(this); return this; }, @@ -71650,10 +76236,12 @@ var Quaternion = new Class({ */ subtract: function (v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; + this._x -= v.x; + this._y -= v.y; + this._z -= v.z; + this._w -= v.w; + + this.onChangeCallback(this); return this; }, @@ -71670,10 +76258,12 @@ var Quaternion = new Class({ */ scale: function (scale) { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; + this._x *= scale; + this._y *= scale; + this._z *= scale; + this._w *= scale; + + this.onChangeCallback(this); return this; }, @@ -71734,12 +76324,14 @@ var Quaternion = new Class({ { len = 1 / Math.sqrt(len); - this.x = x * len; - this.y = y * len; - this.z = z * len; - this.w = w * len; + this._x = x * len; + this._y = y * len; + this._z = z * len; + this._w = w * len; } + this.onChangeCallback(this); + return this; }, @@ -71778,12 +76370,12 @@ var Quaternion = new Class({ var az = this.z; var aw = this.w; - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - this.w = aw + t * (v.w - aw); - - return this; + return this.set( + ax + t * (v.x - ax), + ay + t * (v.y - ay), + az + t * (v.z - az), + aw + t * (v.w - aw) + ); }, /** @@ -71815,21 +76407,16 @@ var Quaternion = new Class({ } else if (dot > 0.999999) { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - return this; + return this.set(0, 0, 0, 1); } else { tmpvec.copy(a).cross(b); - this.x = tmpvec.x; - this.y = tmpvec.y; - this.z = tmpvec.z; - this.w = 1 + dot; + this._x = tmpvec.x; + this._y = tmpvec.y; + this._z = tmpvec.z; + this._w = 1 + dot; return this.normalize(); } @@ -71876,12 +76463,7 @@ var Quaternion = new Class({ */ identity: function () { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 1; - - return this; + return this.set(0, 0, 0, 1); }, /** @@ -71901,12 +76483,12 @@ var Quaternion = new Class({ var s = Math.sin(rad); - this.x = s * axis.x; - this.y = s * axis.y; - this.z = s * axis.z; - this.w = Math.cos(rad); - - return this; + return this.set( + s * axis.x, + s * axis.y, + s * axis.z, + Math.cos(rad) + ); }, /** @@ -71931,12 +76513,12 @@ var Quaternion = new Class({ var bz = b.z; var bw = b.w; - this.x = ax * bw + aw * bx + ay * bz - az * by; - this.y = ay * bw + aw * by + az * bx - ax * bz; - this.z = az * bw + aw * bz + ax * by - ay * bx; - this.w = aw * bw - ax * bx - ay * by - az * bz; - - return this; + return this.set( + ax * bw + aw * bx + ay * bz - az * by, + ay * bw + aw * by + az * bx - ax * bz, + az * bw + aw * bz + ax * by - ay * bx, + aw * bw - ax * bx - ay * by - az * bz + ); }, /** @@ -71994,12 +76576,12 @@ var Quaternion = new Class({ } // calculate final values - this.x = scale0 * ax + scale1 * bx; - this.y = scale0 * ay + scale1 * by; - this.z = scale0 * az + scale1 * bz; - this.w = scale0 * aw + scale1 * bw; - - return this; + return this.set( + scale0 * ax + scale1 * bx, + scale0 * ay + scale1 * by, + scale0 * az + scale1 * bz, + scale0 * aw + scale1 * bw + ); }, /** @@ -72020,14 +76602,12 @@ var Quaternion = new Class({ var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; var invDot = (dot) ? 1 / dot : 0; - // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 - - this.x = -a0 * invDot; - this.y = -a1 * invDot; - this.z = -a2 * invDot; - this.w = a3 * invDot; - - return this; + return this.set( + -a0 * invDot, + -a1 * invDot, + -a2 * invDot, + a3 * invDot + ); }, /** @@ -72042,9 +76622,11 @@ var Quaternion = new Class({ */ conjugate: function () { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; + this._x = -this.x; + this._y = -this.y; + this._z = -this.z; + + this.onChangeCallback(this); return this; }, @@ -72071,12 +76653,12 @@ var Quaternion = new Class({ var bx = Math.sin(rad); var bw = Math.cos(rad); - this.x = ax * bw + aw * bx; - this.y = ay * bw + az * bx; - this.z = az * bw - ay * bx; - this.w = aw * bw - ax * bx; - - return this; + return this.set( + ax * bw + aw * bx, + ay * bw + az * bx, + az * bw - ay * bx, + aw * bw - ax * bx + ); }, /** @@ -72101,12 +76683,12 @@ var Quaternion = new Class({ var by = Math.sin(rad); var bw = Math.cos(rad); - this.x = ax * bw - az * by; - this.y = ay * bw + aw * by; - this.z = az * bw + ax * by; - this.w = aw * bw - ay * by; - - return this; + return this.set( + ax * bw - az * by, + ay * bw + aw * by, + az * bw + ax * by, + aw * bw - ay * by + ); }, /** @@ -72131,12 +76713,12 @@ var Quaternion = new Class({ var bz = Math.sin(rad); var bw = Math.cos(rad); - this.x = ax * bw + ay * bz; - this.y = ay * bw - ax * bz; - this.z = az * bw + aw * bz; - this.w = aw * bw - az * bz; - - return this; + return this.set( + ax * bw + ay * bz, + ay * bw - ax * bz, + az * bw + aw * bz, + aw * bw - az * bz + ); }, /** @@ -72160,6 +76742,190 @@ var Quaternion = new Class({ return this; }, + /** + * Set this Quaternion from the given Euler, based on Euler order. + * + * @method Phaser.Math.Quaternion#setFromEuler + * @since 3.50.0 + * + * @param {Phaser.Math.Euler} euler - The Euler to convert from. + * @param {boolean} [update=true] - Run the `onChangeCallback`? + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setFromEuler: function (euler, update) + { + var x = euler.x / 2; + var y = euler.y / 2; + var z = euler.z / 2; + + var c1 = Math.cos(x); + var c2 = Math.cos(y); + var c3 = Math.cos(z); + + var s1 = Math.sin(x); + var s2 = Math.sin(y); + var s3 = Math.sin(z); + + switch (euler.order) + { + case 'XYZ': + { + this.set( + s1 * c2 * c3 + c1 * s2 * s3, + c1 * s2 * c3 - s1 * c2 * s3, + c1 * c2 * s3 + s1 * s2 * c3, + c1 * c2 * c3 - s1 * s2 * s3, + update + ); + + break; + } + + case 'YXZ': + { + this.set( + s1 * c2 * c3 + c1 * s2 * s3, + c1 * s2 * c3 - s1 * c2 * s3, + c1 * c2 * s3 - s1 * s2 * c3, + c1 * c2 * c3 + s1 * s2 * s3, + update + ); + + break; + } + + case 'ZXY': + { + this.set( + s1 * c2 * c3 - c1 * s2 * s3, + c1 * s2 * c3 + s1 * c2 * s3, + c1 * c2 * s3 + s1 * s2 * c3, + c1 * c2 * c3 - s1 * s2 * s3, + update + ); + + break; + } + + case 'ZYX': + { + this.set( + s1 * c2 * c3 - c1 * s2 * s3, + c1 * s2 * c3 + s1 * c2 * s3, + c1 * c2 * s3 - s1 * s2 * c3, + c1 * c2 * c3 + s1 * s2 * s3, + update + ); + + break; + } + + case 'YZX': + { + this.set( + s1 * c2 * c3 + c1 * s2 * s3, + c1 * s2 * c3 + s1 * c2 * s3, + c1 * c2 * s3 - s1 * s2 * c3, + c1 * c2 * c3 - s1 * s2 * s3, + update + ); + + break; + } + + case 'XZY': + { + this.set( + s1 * c2 * c3 - c1 * s2 * s3, + c1 * s2 * c3 - s1 * c2 * s3, + c1 * c2 * s3 + s1 * s2 * c3, + c1 * c2 * c3 + s1 * s2 * s3, + update + ); + + break; + } + } + + return this; + }, + + /** + * Sets the rotation of this Quaternion from the given Matrix4. + * + * @method Phaser.Math.Quaternion#setFromRotationMatrix + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to set the rotation from. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + setFromRotationMatrix: function (mat4) + { + var m = mat4.val; + + var m11 = m[0]; + var m12 = m[4]; + var m13 = m[8]; + var m21 = m[1]; + var m22 = m[5]; + var m23 = m[9]; + var m31 = m[2]; + var m32 = m[6]; + var m33 = m[10]; + + var trace = m11 + m22 + m33; + var s; + + if (trace > 0) + { + s = 0.5 / Math.sqrt(trace + 1.0); + + this.set( + (m32 - m23) * s, + (m13 - m31) * s, + (m21 - m12) * s, + 0.25 / s + ); + } + else if (m11 > m22 && m11 > m33) + { + s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33); + + this.set( + 0.25 * s, + (m12 + m21) / s, + (m13 + m31) / s, + (m32 - m23) / s + ); + } + else if (m22 > m33) + { + s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33); + + this.set( + (m12 + m21) / s, + 0.25 * s, + (m23 + m32) / s, + (m13 - m31) / s + ); + } + else + { + s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22); + + this.set( + (m13 + m31) / s, + (m23 + m32) / s, + 0.25 * s, + (m21 - m12) / s + ); + } + + return this; + }, + /** * Convert the given Matrix into this Quaternion. * @@ -72191,9 +76957,9 @@ var Quaternion = new Class({ fRoot = 0.5 / fRoot; // 1/(4w) - this.x = (m[7] - m[5]) * fRoot; - this.y = (m[2] - m[6]) * fRoot; - this.z = (m[3] - m[1]) * fRoot; + this._x = (m[7] - m[5]) * fRoot; + this._y = (m[2] - m[6]) * fRoot; + this._z = (m[3] - m[1]) * fRoot; } else { @@ -72222,12 +76988,14 @@ var Quaternion = new Class({ tmp[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; tmp[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; - this.x = tmp[0]; - this.y = tmp[1]; - this.z = tmp[2]; - this.w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; + this._x = tmp[0]; + this._y = tmp[1]; + this._z = tmp[2]; + this._w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; } + this.onChangeCallback(this); + return this; } @@ -72237,7 +77005,7 @@ module.exports = Quaternion; /***/ }), -/* 349 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -72246,10 +77014,10 @@ module.exports = Quaternion; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasInterpolation = __webpack_require__(350); -var CanvasPool = __webpack_require__(26); -var CONST = __webpack_require__(34); -var Features = __webpack_require__(179); +var CanvasInterpolation = __webpack_require__(359); +var CanvasPool = __webpack_require__(31); +var CONST = __webpack_require__(39); +var Features = __webpack_require__(183); /** * Called automatically by Phaser.Game and responsible for creating the renderer it will use. @@ -72339,8 +77107,8 @@ var CreateRenderer = function (game) if (true) { - CanvasRenderer = __webpack_require__(532); - WebGLRenderer = __webpack_require__(535); + CanvasRenderer = __webpack_require__(568); + WebGLRenderer = __webpack_require__(571); // Let the config pick the renderer type, as both are included if (config.renderType === CONST.WEBGL) @@ -72365,7 +77133,7 @@ module.exports = CreateRenderer; /***/ }), -/* 350 */ +/* 359 */ /***/ (function(module, exports) { /** @@ -72428,7 +77196,7 @@ module.exports = CanvasInterpolation; /***/ }), -/* 351 */ +/* 360 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -72437,7 +77205,7 @@ module.exports = CanvasInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(34); +var CONST = __webpack_require__(39); /** * Called automatically by Phaser.Game and responsible for creating the console.log debug header. @@ -72474,11 +77242,11 @@ var DebugHeader = function (game) var audioType; - if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) + if (deviceAudio.webAudio && !audioConfig.disableWebAudio) { audioType = 'Web Audio'; } - else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + else if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) { audioType = 'No Audio'; } @@ -72558,7 +77326,7 @@ module.exports = DebugHeader; /***/ }), -/* 352 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -72570,7 +77338,7 @@ module.exports = DebugHeader; var Class = __webpack_require__(0); var GetValue = __webpack_require__(6); var NOOP = __webpack_require__(1); -var RequestAnimationFrame = __webpack_require__(353); +var RequestAnimationFrame = __webpack_require__(362); // http://www.testufo.com/#test=animation-time-graph @@ -72652,7 +77420,7 @@ var TimeStep = new Class({ * The minimum fps rate you want the Time Step to run at. * * @name Phaser.Core.TimeStep#minFps - * @type {integer} + * @type {number} * @default 5 * @since 3.0.0 */ @@ -72666,7 +77434,7 @@ var TimeStep = new Class({ * is spiraling out of control. * * @name Phaser.Core.TimeStep#targetFps - * @type {integer} + * @type {number} * @default 60 * @since 3.0.0 */ @@ -72698,7 +77466,7 @@ var TimeStep = new Class({ * An exponential moving average of the frames per second. * * @name Phaser.Core.TimeStep#actualFps - * @type {integer} + * @type {number} * @readonly * @default 60 * @since 3.0.0 @@ -72710,7 +77478,7 @@ var TimeStep = new Class({ * When an fps update happens, the `framesThisSecond` value is reset. * * @name Phaser.Core.TimeStep#nextFpsUpdate - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.0.0 @@ -72721,7 +77489,7 @@ var TimeStep = new Class({ * The number of frames processed this second. * * @name Phaser.Core.TimeStep#framesThisSecond - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.0.0 @@ -72786,7 +77554,7 @@ var TimeStep = new Class({ * time has passed and is unaffected by delta smoothing. * * @name Phaser.Core.TimeStep#frame - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.0.0 @@ -72820,7 +77588,7 @@ var TimeStep = new Class({ * An internal counter to allow for the browser 'cooling down' after coming back into focus. * * @name Phaser.Core.TimeStep#_coolDown - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -72831,7 +77599,7 @@ var TimeStep = new Class({ * The delta time, in ms, since the last game step. This is a clamped and smoothed average value. * * @name Phaser.Core.TimeStep#delta - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -72841,7 +77609,7 @@ var TimeStep = new Class({ * Internal index of the delta history position. * * @name Phaser.Core.TimeStep#deltaIndex - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -72851,7 +77619,7 @@ var TimeStep = new Class({ * Internal array holding the previous delta values, used for delta smoothing. * * @name Phaser.Core.TimeStep#deltaHistory - * @type {integer[]} + * @type {number[]} * @since 3.0.0 */ this.deltaHistory = []; @@ -72862,7 +77630,7 @@ var TimeStep = new Class({ * This can be changed in the Game Config via the `fps.deltaHistory` property. The default is 10. * * @name Phaser.Core.TimeStep#deltaSmoothingMax - * @type {integer} + * @type {number} * @default 10 * @since 3.0.0 */ @@ -72875,7 +77643,7 @@ var TimeStep = new Class({ * This can be changed in the Game Config via the `fps.panicMax` property. The default is 120. * * @name Phaser.Core.TimeStep#panicMax - * @type {integer} + * @type {number} * @default 120 * @since 3.0.0 */ @@ -73288,7 +78056,7 @@ module.exports = TimeStep; /***/ }), -/* 353 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73502,7 +78270,7 @@ module.exports = RequestAnimationFrame; /***/ }), -/* 354 */ +/* 363 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73511,7 +78279,7 @@ module.exports = RequestAnimationFrame; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Events = __webpack_require__(21); +var Events = __webpack_require__(23); /** * The Visibility Handler is responsible for listening out for document level visibility change events. @@ -73593,7 +78361,7 @@ module.exports = VisibilityHandler; /***/ }), -/* 355 */ +/* 364 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73602,8 +78370,8 @@ module.exports = VisibilityHandler; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Arne16 = __webpack_require__(356); -var CanvasPool = __webpack_require__(26); +var Arne16 = __webpack_require__(365); +var CanvasPool = __webpack_require__(31); var GetValue = __webpack_require__(6); /** @@ -73715,7 +78483,7 @@ module.exports = GenerateTexture; /***/ }), -/* 356 */ +/* 365 */ /***/ (function(module, exports) { /** @@ -73753,7 +78521,7 @@ module.exports = { /***/ }), -/* 357 */ +/* 366 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73765,8 +78533,8 @@ module.exports = { // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) var Class = __webpack_require__(0); -var CubicBezier = __webpack_require__(339); -var Curve = __webpack_require__(83); +var CubicBezier = __webpack_require__(350); +var Curve = __webpack_require__(88); var Vector2 = __webpack_require__(3); /** @@ -73907,7 +78675,7 @@ var CubicBezierCurve = new Class({ * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] * * @param {Phaser.GameObjects.Graphics} graphics - The graphics object this curve should be drawn to. - * @param {integer} [pointsTotal=32] - The number of intermediary points that make up this curve. A higher number of points will result in a smoother curve. + * @param {number} [pointsTotal=32] - The number of intermediary points that make up this curve. A higher number of points will result in a smoother curve. * * @return {Phaser.GameObjects.Graphics} The graphics object this curve was drawn to. Useful for method chaining. */ @@ -73980,7 +78748,7 @@ module.exports = CubicBezierCurve; /***/ }), -/* 358 */ +/* 367 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -73992,10 +78760,10 @@ module.exports = CubicBezierCurve; // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) var Class = __webpack_require__(0); -var Curve = __webpack_require__(83); -var DegToRad = __webpack_require__(41); +var Curve = __webpack_require__(88); +var DegToRad = __webpack_require__(34); var GetValue = __webpack_require__(6); -var RadToDeg = __webpack_require__(183); +var RadToDeg = __webpack_require__(188); var Vector2 = __webpack_require__(3); /** @@ -74014,10 +78782,10 @@ var Vector2 = __webpack_require__(3); * @param {number} [y=0] - The y coordinate of the ellipse. * @param {number} [xRadius=0] - The horizontal radius of ellipse. * @param {number} [yRadius=0] - The vertical radius of ellipse. - * @param {integer} [startAngle=0] - The start angle of the ellipse, in degrees. - * @param {integer} [endAngle=360] - The end angle of the ellipse, in degrees. + * @param {number} [startAngle=0] - The start angle of the ellipse, in degrees. + * @param {number} [endAngle=360] - The end angle of the ellipse, in degrees. * @param {boolean} [clockwise=false] - Whether the ellipse angles are given as clockwise (`true`) or counter-clockwise (`false`). - * @param {integer} [rotation=0] - The rotation of the ellipse, in degrees. + * @param {number} [rotation=0] - The rotation of the ellipse, in degrees. */ var EllipseCurve = new Class({ @@ -74604,7 +79372,7 @@ module.exports = EllipseCurve; /***/ }), -/* 359 */ +/* 368 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -74616,8 +79384,8 @@ module.exports = EllipseCurve; // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) var Class = __webpack_require__(0); -var Curve = __webpack_require__(83); -var FromPoints = __webpack_require__(186); +var Curve = __webpack_require__(88); +var FromPoints = __webpack_require__(191); var Rectangle = __webpack_require__(9); var Vector2 = __webpack_require__(3); @@ -74677,7 +79445,7 @@ var LineCurve = new Class({ * The quantity of arc length divisions within the curve. * * @name Phaser.Curves.Line#arcLengthDivisions - * @type {integer} + * @type {number} * @default 1 * @since 3.0.0 */ @@ -74810,8 +79578,8 @@ var LineCurve = new Class({ * @since 3.0.0 * * @param {number} u - A float between 0 and 1. - * @param {integer} distance - The distance, in pixels. - * @param {integer} [divisions] - Optional amount of divisions. + * @param {number} distance - The distance, in pixels. + * @param {number} [divisions] - Optional amount of divisions. * * @return {number} The equidistant value. */ @@ -74907,7 +79675,7 @@ module.exports = LineCurve; /***/ }), -/* 360 */ +/* 369 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75046,7 +79814,7 @@ module.exports = MoveTo; /***/ }), -/* 361 */ +/* 370 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75056,8 +79824,8 @@ module.exports = MoveTo; */ var Class = __webpack_require__(0); -var Curve = __webpack_require__(83); -var QuadraticBezierInterpolation = __webpack_require__(340); +var Curve = __webpack_require__(88); +var QuadraticBezierInterpolation = __webpack_require__(351); var Vector2 = __webpack_require__(3); /** @@ -75192,7 +79960,7 @@ var QuadraticBezier = new Class({ * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] * * @param {Phaser.GameObjects.Graphics} graphics - `Graphics` object to draw onto. - * @param {integer} [pointsTotal=32] - Number of points to be used for drawing the curve. Higher numbers result in smoother curve but require more processing. + * @param {number} [pointsTotal=32] - Number of points to be used for drawing the curve. Higher numbers result in smoother curve but require more processing. * * @return {Phaser.GameObjects.Graphics} `Graphics` object that was drawn to. */ @@ -75263,7 +80031,7 @@ module.exports = QuadraticBezier; /***/ }), -/* 362 */ +/* 371 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75274,9 +80042,9 @@ module.exports = QuadraticBezier; // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) -var CatmullRom = __webpack_require__(181); +var CatmullRom = __webpack_require__(186); var Class = __webpack_require__(0); -var Curve = __webpack_require__(83); +var Curve = __webpack_require__(88); var Vector2 = __webpack_require__(3); /** @@ -75488,7 +80256,7 @@ module.exports = SplineCurve; /***/ }), -/* 363 */ +/* 372 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75614,7 +80382,7 @@ module.exports = BaseShader; /***/ }), -/* 364 */ +/* 373 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75623,33 +80391,33 @@ module.exports = BaseShader; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); +var Color = __webpack_require__(36); -Color.ColorToRGBA = __webpack_require__(840); -Color.ComponentToHex = __webpack_require__(365); -Color.GetColor = __webpack_require__(175); -Color.GetColor32 = __webpack_require__(308); -Color.GetColorFromValue = __webpack_require__(119); -Color.HexStringToColor = __webpack_require__(307); -Color.HSLToColor = __webpack_require__(841); -Color.HSVColorWheel = __webpack_require__(842); -Color.HSVToRGB = __webpack_require__(176); -Color.HueToComponent = __webpack_require__(366); -Color.IntegerToColor = __webpack_require__(310); -Color.IntegerToRGB = __webpack_require__(311); -Color.Interpolate = __webpack_require__(843); -Color.ObjectToColor = __webpack_require__(312); -Color.RandomRGB = __webpack_require__(844); -Color.RGBStringToColor = __webpack_require__(313); -Color.RGBToHSV = __webpack_require__(309); -Color.RGBToString = __webpack_require__(845); -Color.ValueToColor = __webpack_require__(174); +Color.ColorSpectrum = __webpack_require__(895); +Color.ColorToRGBA = __webpack_require__(896); +Color.ComponentToHex = __webpack_require__(374); +Color.GetColor = __webpack_require__(100); +Color.GetColor32 = __webpack_require__(320); +Color.HexStringToColor = __webpack_require__(319); +Color.HSLToColor = __webpack_require__(897); +Color.HSVColorWheel = __webpack_require__(898); +Color.HSVToRGB = __webpack_require__(180); +Color.HueToComponent = __webpack_require__(375); +Color.IntegerToColor = __webpack_require__(322); +Color.IntegerToRGB = __webpack_require__(181); +Color.Interpolate = __webpack_require__(899); +Color.ObjectToColor = __webpack_require__(323); +Color.RandomRGB = __webpack_require__(900); +Color.RGBStringToColor = __webpack_require__(324); +Color.RGBToHSV = __webpack_require__(321); +Color.RGBToString = __webpack_require__(901); +Color.ValueToColor = __webpack_require__(179); module.exports = Color; /***/ }), -/* 365 */ +/* 374 */ /***/ (function(module, exports) { /** @@ -75664,7 +80432,7 @@ module.exports = Color; * @function Phaser.Display.Color.ComponentToHex * @since 3.0.0 * - * @param {integer} color - The color channel to get the hex value for, must be a value between 0 and 255. + * @param {number} color - The color channel to get the hex value for, must be a value between 0 and 255. * * @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64. */ @@ -75679,7 +80447,7 @@ module.exports = ComponentToHex; /***/ }), -/* 366 */ +/* 375 */ /***/ (function(module, exports) { /** @@ -75735,7 +80503,7 @@ module.exports = HueToComponent; /***/ }), -/* 367 */ +/* 376 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75744,7 +80512,227 @@ module.exports = HueToComponent; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var OS = __webpack_require__(125); +var Class = __webpack_require__(0); +var NOOP = __webpack_require__(1); + +/** + * @classdesc + * The RGB class holds a single color value and allows for easy modification and reading of it, + * with optional on-change callback notification and a dirty flag. + * + * @class RGB + * @memberof Phaser.Display + * @constructor + * @since 3.50.0 + * + * @param {number} [red=0] - The red color value. A number between 0 and 1. + * @param {number} [green=0] - The green color value. A number between 0 and 1. + * @param {number} [blue=0] - The blue color value. A number between 0 and 1. + */ +var RGB = new Class({ + + initialize: + + function RGB (red, green, blue) + { + /** + * Cached RGB values. + * + * @name Phaser.Display.RGB#_rgb + * @type {number[]} + * @private + * @since 3.50.0 + */ + this._rgb = [ 0, 0, 0 ]; + + /** + * This callback will be invoked each time one of the RGB color values change. + * + * The callback is sent the new color values as the parameters. + * + * @name Phaser.Display.RGB#onChangeCallback + * @type {function} + * @since 3.50.0 + */ + this.onChangeCallback = NOOP; + + /** + * Is this color dirty? + * + * @name Phaser.Display.RGB#dirty + * @type {boolean} + * @since 3.50.0 + */ + this.dirty = false; + + this.set(red, green, blue); + }, + + /** + * Sets the red, green and blue values of this RGB object, flags it as being + * dirty and then invokes the `onChangeCallback`, if set. + * + * @method Phaser.Display.RGB#set + * @since 3.50.0 + * + * @param {number} [red=0] - The red color value. A number between 0 and 1. + * @param {number} [green=0] - The green color value. A number between 0 and 1. + * @param {number} [blue=0] - The blue color value. A number between 0 and 1. + * + * @return {this} This RGB instance. + */ + set: function (red, green, blue) + { + if (red === undefined) { red = 0; } + if (green === undefined) { green = 0; } + if (blue === undefined) { blue = 0; } + + this._rgb = [ red, green, blue ]; + + this.onChange(); + + return this; + }, + + /** + * Compares the given rgb parameters with those in this object and returns + * a boolean `true` value if they are equal, otherwise it returns `false`. + * + * @method Phaser.Display.RGB#equals + * @since 3.50.0 + * + * @param {number} red - The red value to compare with this object. + * @param {number} green - The green value to compare with this object. + * @param {number} blue - The blue value to compare with this object. + * + * @return {boolean} `true` if the given values match those in this object, otherwise `false`. + */ + equals: function (red, green, blue) + { + var rgb = this._rgb; + + return (rgb.r === red && rgb.g === green && rgb.b === blue); + }, + + /** + * Internal on change handler. Sets this object as being dirty and + * then invokes the `onChangeCallback`, if set, passing in the + * new RGB values. + * + * @method Phaser.Display.RGB#onChange + * @since 3.50.0 + */ + onChange: function () + { + this.dirty = true; + + var rgb = this._rgb; + + this.onChangeCallback.call(this, rgb[0], rgb[1], rgb[2]); + }, + + /** + * The red color value. Between 0 and 1. + * + * Changing this property will flag this RGB object as being dirty + * and invoke the `onChangeCallback` , if set. + * + * @name Phaser.Display.RGB#r + * @type {number} + * @since 3.50.0 + */ + r: { + + get: function () + { + return this._rgb[0]; + }, + + set: function (value) + { + this._rgb[0] = value; + this.onChange(); + } + + }, + + /** + * The green color value. Between 0 and 1. + * + * Changing this property will flag this RGB object as being dirty + * and invoke the `onChangeCallback` , if set. + * + * @name Phaser.Display.RGB#g + * @type {number} + * @since 3.50.0 + */ + g: { + + get: function () + { + return this._rgb[1]; + }, + + set: function (value) + { + this._rgb[1] = value; + this.onChange(); + } + + }, + + /** + * The blue color value. Between 0 and 1. + * + * Changing this property will flag this RGB object as being dirty + * and invoke the `onChangeCallback` , if set. + * + * @name Phaser.Display.RGB#b + * @type {number} + * @since 3.50.0 + */ + b: { + + get: function () + { + return this._rgb[2]; + }, + + set: function (value) + { + this._rgb[2] = value; + this.onChange(); + } + + }, + + /** + * Nulls any external references this object contains. + * + * @method Phaser.Display.RGB#destroy + * @since 3.50.0 + */ + destroy: function () + { + this.onChangeCallback = null; + } + +}); + +module.exports = RGB; + + +/***/ }), +/* 377 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var OS = __webpack_require__(102); /** * @callback ContentLoadedCallback @@ -75798,7 +80786,7 @@ module.exports = DOMContentLoaded; /***/ }), -/* 368 */ +/* 378 */ /***/ (function(module, exports) { /** @@ -75857,7 +80845,7 @@ module.exports = GetInnerHeight; /***/ }), -/* 369 */ +/* 379 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -75866,7 +80854,7 @@ module.exports = GetInnerHeight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(187); +var CONST = __webpack_require__(192); /** * Attempts to determine the screen orientation using the Orientation API. @@ -75895,12 +80883,9 @@ var GetScreenOrientation = function (width, height) return orientation; } - if (screen) - { - return (screen.height > screen.width) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; - } - else if (typeof window.orientation === 'number') + if (typeof window.orientation === 'number') { + // Do this check first, as iOS supports this, but also has an incomplete window.screen implementation // This may change by device based on "natural" orientation. return (window.orientation === 0 || window.orientation === 180) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; } @@ -75915,15 +80900,17 @@ var GetScreenOrientation = function (width, height) return CONST.ORIENTATION.LANDSCAPE; } } - - return (height > width) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; + else + { + return (height > width) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; + } }; module.exports = GetScreenOrientation; /***/ }), -/* 370 */ +/* 380 */ /***/ (function(module, exports) { /** @@ -75957,7 +80944,7 @@ module.exports = { * You can still center it yourself via CSS. * * @name Phaser.Scale.Center.NO_CENTER - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -75971,7 +80958,7 @@ module.exports = { * game canvas, and does not factor in any other CSS styles you may have applied. * * @name Phaser.Scale.Center.CENTER_BOTH - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -75985,7 +80972,7 @@ module.exports = { * game canvas, and does not factor in any other CSS styles you may have applied. * * @name Phaser.Scale.Center.CENTER_HORIZONTALLY - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -75999,7 +80986,7 @@ module.exports = { * game canvas, and does not factor in any other CSS styles you may have applied. * * @name Phaser.Scale.Center.CENTER_VERTICALLY - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76009,7 +80996,7 @@ module.exports = { /***/ }), -/* 371 */ +/* 381 */ /***/ (function(module, exports) { /** @@ -76062,7 +81049,7 @@ module.exports = { /***/ }), -/* 372 */ +/* 382 */ /***/ (function(module, exports) { /** @@ -76097,7 +81084,7 @@ module.exports = { * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working. * * @name Phaser.Scale.ScaleModes.NONE - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76107,7 +81094,7 @@ module.exports = { * The height is automatically adjusted based on the width. * * @name Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76117,7 +81104,7 @@ module.exports = { * The width is automatically adjusted based on the height. * * @name Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76129,7 +81116,7 @@ module.exports = { * inside the area which is not covered. * * @name Phaser.Scale.ScaleModes.FIT - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76140,7 +81127,7 @@ module.exports = { * area while keeping the aspect ratio. This may extend further out than the target size. * * @name Phaser.Scale.ScaleModes.ENVELOP - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76150,7 +81137,7 @@ module.exports = { * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio. * * @name Phaser.Scale.ScaleModes.RESIZE - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76160,7 +81147,7 @@ module.exports = { /***/ }), -/* 373 */ +/* 383 */ /***/ (function(module, exports) { /** @@ -76193,7 +81180,7 @@ module.exports = { * The game canvas will not be zoomed by Phaser. * * @name Phaser.Scale.Zoom.NO_ZOOM - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76203,7 +81190,7 @@ module.exports = { * The game canvas will be 2x zoomed by Phaser. * * @name Phaser.Scale.Zoom.ZOOM_2X - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76213,7 +81200,7 @@ module.exports = { * The game canvas will be 4x zoomed by Phaser. * * @name Phaser.Scale.Zoom.ZOOM_4X - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76224,7 +81211,7 @@ module.exports = { * fit into the parent, or browser window if no parent is set. * * @name Phaser.Scale.Zoom.MAX_ZOOM - * @type {integer} + * @type {number} * @const * @since 3.16.0 */ @@ -76234,7 +81221,7 @@ module.exports = { /***/ }), -/* 374 */ +/* 384 */ /***/ (function(module, exports) { /** @@ -76285,7 +81272,7 @@ module.exports = GetTarget; /***/ }), -/* 375 */ +/* 385 */ /***/ (function(module, exports) { /** @@ -76342,7 +81329,7 @@ module.exports = ParseXML; /***/ }), -/* 376 */ +/* 386 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -76352,16 +81339,16 @@ module.exports = ParseXML; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(189); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(56); -var GameEvents = __webpack_require__(21); -var Keyboard = __webpack_require__(377); -var Mouse = __webpack_require__(378); -var Pointer = __webpack_require__(379); -var Touch = __webpack_require__(380); -var TransformMatrix = __webpack_require__(31); -var TransformXY = __webpack_require__(166); +var CONST = __webpack_require__(194); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(49); +var GameEvents = __webpack_require__(23); +var Keyboard = __webpack_require__(387); +var Mouse = __webpack_require__(388); +var Pointer = __webpack_require__(389); +var Touch = __webpack_require__(390); +var TransformMatrix = __webpack_require__(24); +var TransformXY = __webpack_require__(169); /** * @classdesc @@ -76518,7 +81505,7 @@ var InputManager = new Class({ * setting the `input.activePointers` property in the Game Config. * * @name Phaser.Input.InputManager#pointersTotal - * @type {integer} + * @type {number} * @readonly * @since 3.10.0 */ @@ -76738,7 +81725,7 @@ var InputManager = new Class({ /** * Tells the Input system to set a custom cursor. - * + * * This cursor will be the default cursor used when interacting with the game canvas. * * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use. @@ -76748,7 +81735,7 @@ var InputManager = new Class({ * ```javascript * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer'); * ``` - * + * * Please read about the differences between browsers when it comes to the file formats and sizes they support: * * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor @@ -76758,7 +81745,7 @@ var InputManager = new Class({ * * @method Phaser.Input.InputManager#setDefaultCursor * @since 3.10.0 - * + * * @param {string} cursor - The CSS to be used when setting the default cursor. */ setDefaultCursor: function (cursor) @@ -76773,7 +81760,7 @@ var InputManager = new Class({ /** * Called by the InputPlugin when processing over and out events. - * + * * Tells the Input Manager to set a custom cursor during its postUpdate step. * * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor @@ -76781,7 +81768,7 @@ var InputManager = new Class({ * @method Phaser.Input.InputManager#setCursor * @private * @since 3.10.0 - * + * * @param {Phaser.Types.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. */ setCursor: function (interactiveObject) @@ -76794,13 +81781,13 @@ var InputManager = new Class({ /** * Called by the InputPlugin when processing over and out events. - * + * * Tells the Input Manager to clear the hand cursor, if set, during its postUpdate step. * * @method Phaser.Input.InputManager#resetCursor * @private * @since 3.10.0 - * + * * @param {Phaser.Types.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. */ resetCursor: function (interactiveObject) @@ -76825,7 +81812,7 @@ var InputManager = new Class({ * @method Phaser.Input.InputManager#addPointer * @since 3.10.0 * - * @param {integer} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. + * @param {number} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. * * @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created. */ @@ -76866,7 +81853,7 @@ var InputManager = new Class({ * @method Phaser.Input.InputManager#updateInputPlugins * @since 3.16.0 * - * @param {integer} type - The type of event to process. + * @param {number} type - The type of event to process. * @param {Phaser.Input.Pointer[]} pointers - An array of Pointers on which the event occurred. */ updateInputPlugins: function (type, pointers) @@ -77059,9 +82046,13 @@ var InputManager = new Class({ */ onMouseDown: function (event) { - this.mousePointer.down(event); + var mousePointer = this.mousePointer; - this.mousePointer.updateMotion(); + mousePointer.down(event); + + mousePointer.updateMotion(); + + this.activePointer = mousePointer; this.updateInputPlugins(CONST.MOUSE_DOWN, this.mousePointerContainer); }, @@ -77077,9 +82068,13 @@ var InputManager = new Class({ */ onMouseMove: function (event) { - this.mousePointer.move(event); + var mousePointer = this.mousePointer; - this.mousePointer.updateMotion(); + mousePointer.move(event); + + mousePointer.updateMotion(); + + this.activePointer = mousePointer; this.updateInputPlugins(CONST.MOUSE_MOVE, this.mousePointerContainer); }, @@ -77095,9 +82090,13 @@ var InputManager = new Class({ */ onMouseUp: function (event) { - this.mousePointer.up(event); + var mousePointer = this.mousePointer; - this.mousePointer.updateMotion(); + mousePointer.up(event); + + mousePointer.updateMotion(); + + this.activePointer = mousePointer; this.updateInputPlugins(CONST.MOUSE_UP, this.mousePointerContainer); }, @@ -77113,7 +82112,11 @@ var InputManager = new Class({ */ onMouseWheel: function (event) { - this.mousePointer.wheel(event); + var mousePointer = this.mousePointer; + + mousePointer.wheel(event); + + this.activePointer = mousePointer; this.updateInputPlugins(CONST.MOUSE_WHEEL, this.mousePointerContainer); }, @@ -77216,12 +82219,6 @@ var InputManager = new Class({ var x = pointer.x; var y = pointer.y; - if (camera.resolution !== 1) - { - x += camera._x; - y += camera._y; - } - // Stores the world point inside of tempPoint camera.getWorldPoint(x, y, tempPoint); @@ -77257,7 +82254,7 @@ var InputManager = new Class({ { TransformXY(px, py, gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX, gameObject.scaleY, point); } - + if (this.pointWithinHitArea(gameObject, point.x, point.y)) { output.push(gameObject); @@ -77424,7 +82421,7 @@ module.exports = InputManager; /***/ }), -/* 377 */ +/* 387 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -77433,11 +82430,11 @@ module.exports = InputManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayRemove = __webpack_require__(96); +var ArrayRemove = __webpack_require__(87); var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(21); -var InputEvents = __webpack_require__(56); -var KeyCodes = __webpack_require__(132); +var GameEvents = __webpack_require__(23); +var InputEvents = __webpack_require__(49); +var KeyCodes = __webpack_require__(138); var NOOP = __webpack_require__(1); /** @@ -77521,7 +82518,7 @@ var KeyboardManager = new Class({ * can call the `addCapture` method. See also `removeCapture` and `clearCaptures`. * * @name Phaser.Input.Keyboard.KeyboardManager#captures - * @type {integer[]} + * @type {number[]} * @since 3.16.0 */ this.captures = []; @@ -77730,7 +82727,7 @@ var KeyboardManager = new Class({ * @method Phaser.Input.Keyboard.KeyboardManager#addCapture * @since 3.16.0 * - * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable capture for, preventing them reaching the browser. + * @param {(string|number|number[]|any[])} keycode - The Key Codes to enable capture for, preventing them reaching the browser. */ addCapture: function (keycode) { @@ -77797,7 +82794,7 @@ var KeyboardManager = new Class({ * @method Phaser.Input.Keyboard.KeyboardManager#removeCapture * @since 3.16.0 * - * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable capture for, allowing them reaching the browser again. + * @param {(string|number|number[]|any[])} keycode - The Key Codes to disable capture for, allowing them reaching the browser again. */ removeCapture: function (keycode) { @@ -77868,7 +82865,7 @@ module.exports = KeyboardManager; /***/ }), -/* 378 */ +/* 388 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -77878,8 +82875,8 @@ module.exports = KeyboardManager; */ var Class = __webpack_require__(0); -var Features = __webpack_require__(179); -var InputEvents = __webpack_require__(56); +var Features = __webpack_require__(183); +var InputEvents = __webpack_require__(49); var NOOP = __webpack_require__(1); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent @@ -77916,14 +82913,44 @@ var MouseManager = new Class({ this.manager = inputManager; /** - * If true the DOM mouse events will have event.preventDefault applied to them, if false they will propagate fully. + * If `true` the DOM `mousedown` event will have `preventDefault` set. * - * @name Phaser.Input.Mouse.MouseManager#capture + * @name Phaser.Input.Mouse.MouseManager#preventDefaultDown * @type {boolean} * @default true - * @since 3.0.0 + * @since 3.50.0 */ - this.capture = true; + this.preventDefaultDown = true; + + /** + * If `true` the DOM `mouseup` event will have `preventDefault` set. + * + * @name Phaser.Input.Mouse.MouseManager#preventDefaultUp + * @type {boolean} + * @default true + * @since 3.50.0 + */ + this.preventDefaultUp = true; + + /** + * If `true` the DOM `mousemove` event will have `preventDefault` set. + * + * @name Phaser.Input.Mouse.MouseManager#preventDefaultMove + * @type {boolean} + * @default true + * @since 3.50.0 + */ + this.preventDefaultMove = true; + + /** + * If `true` the DOM `wheel` event will have `preventDefault` set. + * + * @name Phaser.Input.Mouse.MouseManager#preventDefaultWheel + * @type {boolean} + * @default true + * @since 3.50.0 + */ + this.preventDefaultWheel = false; /** * A boolean that controls if the Mouse Manager is enabled or not. @@ -78055,6 +83082,20 @@ var MouseManager = new Class({ */ this.pointerLockChange = NOOP; + /** + * Are the event listeners hooked into `window.top` or `window`? + * + * This is set during the `boot` sequence. If the browser does not have access to `window.top`, + * such as in cross-origin iframe environments, this property gets set to `false` and the events + * are hooked into `window` instead. + * + * @name Phaser.Input.Mouse.MouseManager#isTop + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.isTop = true; + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, @@ -78071,7 +83112,12 @@ var MouseManager = new Class({ this.enabled = config.inputMouse; this.target = config.inputMouseEventTarget; - this.capture = config.inputMouseCapture; + this.passive = config.inputMousePassive; + + this.preventDefaultDown = config.inputMousePreventDefaultDown; + this.preventDefaultUp = config.inputMousePreventDefaultUp; + this.preventDefaultMove = config.inputMousePreventDefaultMove; + this.preventDefaultWheel = config.inputMousePreventDefaultWheel; if (!this.target) { @@ -78129,6 +83175,12 @@ var MouseManager = new Class({ * It is important to note that pointer lock can only be enabled after an 'engagement gesture', * see: https://w3c.github.io/pointerlock/#dfn-engagement-gesture. * + * Note for Firefox: There is a bug in certain Firefox releases that cause native DOM events like + * `mousemove` to fire continuously when in pointer lock mode. You can get around this by setting + * `this.preventDefaultMove` to `false` in this class. You may also need to do the same for + * `preventDefaultDown` and/or `preventDefaultUp`. Please test combinations of these if you encounter + * the error. + * * @method Phaser.Input.Mouse.MouseManager#requestPointerLock * @since 3.0.0 */ @@ -78170,17 +83222,25 @@ var MouseManager = new Class({ */ startListeners: function () { + var target = this.target; + + if (!target) + { + return; + } + var _this = this; - var canvas = this.manager.canvas; - var autoFocus = (window && window.focus && this.manager.game.config.autoFocus); + var manager = this.manager; + var canvas = manager.canvas; + var autoFocus = (window && window.focus && manager.game.config.autoFocus); this.onMouseMove = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.onMouseMove(event); + manager.onMouseMove(event); - if (_this.capture) + if (_this.preventDefaultMove) { event.preventDefault(); } @@ -78194,11 +83254,11 @@ var MouseManager = new Class({ window.focus(); } - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.onMouseDown(event); + manager.onMouseDown(event); - if (_this.capture && event.target === canvas) + if (_this.preventDefaultDown && event.target === canvas) { event.preventDefault(); } @@ -78207,20 +83267,20 @@ var MouseManager = new Class({ this.onMouseDownWindow = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled && event.target !== canvas) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) { // Only process the event if the target isn't the canvas - _this.manager.onMouseDown(event); + manager.onMouseDown(event); } }; this.onMouseUp = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.onMouseUp(event); + manager.onMouseUp(event); - if (_this.capture && event.target === canvas) + if (_this.preventDefaultUp && event.target === canvas) { event.preventDefault(); } @@ -78229,58 +83289,73 @@ var MouseManager = new Class({ this.onMouseUpWindow = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled && event.target !== canvas) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) { // Only process the event if the target isn't the canvas - _this.manager.onMouseUp(event); + manager.onMouseUp(event); } }; this.onMouseOver = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.setCanvasOver(event); + manager.setCanvasOver(event); } }; this.onMouseOut = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.setCanvasOut(event); + manager.setCanvasOut(event); } }; this.onMouseWheel = function (event) { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - _this.manager.onMouseWheel(event); + manager.onMouseWheel(event); + } + + if (_this.preventDefaultWheel && event.target === canvas) + { + event.preventDefault(); } }; - var target = this.target; + var passive = { passive: true }; - if (!target) + target.addEventListener('mousemove', this.onMouseMove); + target.addEventListener('mousedown', this.onMouseDown); + target.addEventListener('mouseup', this.onMouseUp); + target.addEventListener('mouseover', this.onMouseOver, passive); + target.addEventListener('mouseout', this.onMouseOut, passive); + + if (this.preventDefaultWheel) { - return; + target.addEventListener('wheel', this.onMouseWheel, { passive: false }); + } + else + { + target.addEventListener('wheel', this.onMouseWheel, passive); } - var passive = { passive: true }; - var nonPassive = { passive: false }; - - target.addEventListener('mousemove', this.onMouseMove, (this.capture) ? nonPassive : passive); - target.addEventListener('mousedown', this.onMouseDown, (this.capture) ? nonPassive : passive); - target.addEventListener('mouseup', this.onMouseUp, (this.capture) ? nonPassive : passive); - target.addEventListener('mouseover', this.onMouseOver, (this.capture) ? nonPassive : passive); - target.addEventListener('mouseout', this.onMouseOut, (this.capture) ? nonPassive : passive); - target.addEventListener('wheel', this.onMouseWheel, (this.capture) ? nonPassive : passive); - - if (window && this.manager.game.config.inputWindowEvents) + if (window && manager.game.config.inputWindowEvents) { - window.top.addEventListener('mousedown', this.onMouseDownWindow, nonPassive); - window.top.addEventListener('mouseup', this.onMouseUpWindow, nonPassive); + try + { + window.top.addEventListener('mousedown', this.onMouseDownWindow, passive); + window.top.addEventListener('mouseup', this.onMouseUpWindow, passive); + } + catch (exception) + { + window.addEventListener('mousedown', this.onMouseDownWindow, passive); + window.addEventListener('mouseup', this.onMouseUpWindow, passive); + + this.isTop = false; + } } if (Features.pointerLock) @@ -78291,7 +83366,7 @@ var MouseManager = new Class({ _this.locked = (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element) ? true : false; - _this.manager.onPointerLockChange(event); + manager.onPointerLockChange(event); }; document.addEventListener('pointerlockchange', this.pointerLockChange, true); @@ -78321,8 +83396,10 @@ var MouseManager = new Class({ if (window) { - window.top.removeEventListener('mousedown', this.onMouseDownWindow); - window.top.removeEventListener('mouseup', this.onMouseUpWindow); + target = (this.isTop) ? window.top : window; + + target.removeEventListener('mousedown', this.onMouseDownWindow); + target.removeEventListener('mouseup', this.onMouseUpWindow); } if (Features.pointerLock) @@ -78354,7 +83431,7 @@ module.exports = MouseManager; /***/ }), -/* 379 */ +/* 389 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -78363,12 +83440,13 @@ module.exports = MouseManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Angle = __webpack_require__(330); +var Angle = __webpack_require__(341); var Class = __webpack_require__(0); -var Distance = __webpack_require__(55); -var FuzzyEqual = __webpack_require__(109); -var SmoothStepInterpolation = __webpack_require__(341); +var Distance = __webpack_require__(61); +var FuzzyEqual = __webpack_require__(121); +var SmoothStepInterpolation = __webpack_require__(352); var Vector2 = __webpack_require__(3); +var OS = __webpack_require__(102); /** * @classdesc @@ -78391,7 +83469,7 @@ var Vector2 = __webpack_require__(3); * @since 3.0.0 * * @param {Phaser.Input.InputManager} manager - A reference to the Input Manager. - * @param {integer} id - The internal ID of this Pointer. + * @param {number} id - The internal ID of this Pointer. */ var Pointer = new Class({ @@ -78412,7 +83490,7 @@ var Pointer = new Class({ * The internal ID of this Pointer. * * @name Phaser.Input.Pointer#id - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -78473,7 +83551,7 @@ var Pointer = new Class({ * however, it should behave as if the left button was clicked in the standard button layout. * * @name Phaser.Input.Pointer#button - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.18.0 @@ -78492,7 +83570,7 @@ var Pointer = new Class({ * In this case, the values are read from right to left. * * @name Phaser.Input.Pointer#buttons - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -78867,17 +83945,8 @@ var Pointer = new Class({ */ updateWorldPoint: function (camera) { - var x = this.x; - var y = this.y; - - if (camera.resolution !== 1) - { - x += camera._x; - y += camera._y; - } - // Stores the world point inside of tempPoint - var temp = camera.getWorldPoint(x, y); + var temp = camera.getWorldPoint(this.x, this.y); this.worldX = temp.x; this.worldY = temp.y; @@ -79027,6 +84096,13 @@ var Pointer = new Class({ this.downY = this.y; } + if (OS.macOS && event.ctrlKey) + { + // Override button settings on macOS + this.buttons = 2; + this.primaryDown = false; + } + if (!this.isDown) { this.isDown = true; @@ -79531,7 +84607,7 @@ var Pointer = new Class({ * @method Phaser.Input.Pointer#getInterpolatedPosition * @since 3.11.0 * - * @param {integer} [steps=10] - The number of interpolation steps to use. + * @param {number} [steps=10] - The number of interpolation steps to use. * @param {array} [out] - An array to store the results in. If not provided a new one will be created. * * @return {array} An array of interpolated values. @@ -79641,7 +84717,7 @@ module.exports = Pointer; /***/ }), -/* 380 */ +/* 390 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -79651,7 +84727,7 @@ module.exports = Pointer; */ var Class = __webpack_require__(0); -var InputEvents = __webpack_require__(56); +var InputEvents = __webpack_require__(49); var NOOP = __webpack_require__(1); // https://developer.mozilla.org/en-US/docs/Web/API/Touch_events @@ -80054,7 +85130,7 @@ module.exports = TouchManager; /***/ }), -/* 381 */ +/* 391 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80064,14 +85140,14 @@ module.exports = TouchManager; */ var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(21); -var EventEmitter = __webpack_require__(12); +var GameEvents = __webpack_require__(23); +var EventEmitter = __webpack_require__(10); var FileTypesManager = __webpack_require__(8); -var GameObjectCreator = __webpack_require__(16); +var GameObjectCreator = __webpack_require__(17); var GameObjectFactory = __webpack_require__(5); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(23); -var Remove = __webpack_require__(96); +var PluginCache = __webpack_require__(25); +var Remove = __webpack_require__(87); /** * @classdesc @@ -80532,7 +85608,7 @@ var PluginManager = new Class({ * * @param {string} key - The unique plugin key. * - * @return {integer} The index of the plugin within the plugins array. + * @return {number} The index of the plugin within the plugins array. */ getIndex: function (key) { @@ -80956,7 +86032,7 @@ module.exports = PluginManager; /***/ }), -/* 382 */ +/* 392 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -80965,18 +86041,18 @@ module.exports = PluginManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(187); +var CONST = __webpack_require__(192); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(94); -var GameEvents = __webpack_require__(21); -var GetInnerHeight = __webpack_require__(368); -var GetTarget = __webpack_require__(374); -var GetScreenOrientation = __webpack_require__(369); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(101); +var GameEvents = __webpack_require__(23); +var GetInnerHeight = __webpack_require__(378); +var GetTarget = __webpack_require__(384); +var GetScreenOrientation = __webpack_require__(379); var NOOP = __webpack_require__(1); var Rectangle = __webpack_require__(9); -var Size = __webpack_require__(383); -var SnapFloor = __webpack_require__(95); +var Size = __webpack_require__(393); +var SnapFloor = __webpack_require__(72); var Vector2 = __webpack_require__(3); /** @@ -81165,7 +86241,7 @@ var ScaleManager = new Class({ /** * The Base Size component. * - * The modified game size, which is the gameSize * resolution, used to set the canvas width and height + * The modified game size, which is the auto-rounded gameSize, used to set the canvas width and height * (but not the CSS style) * * @name Phaser.Scale.ScaleManager#baseSize @@ -81194,17 +86270,6 @@ var ScaleManager = new Class({ */ this.scaleMode = CONST.SCALE_MODE.NONE; - /** - * The canvas resolution. - * - * This is hard-coded to a value of 1 in the 3.16 release of Phaser and will be enabled at a later date. - * - * @name Phaser.Scale.ScaleManager#resolution - * @type {number} - * @since 3.16.0 - */ - this.resolution = 1; - /** * The game zoom factor. * @@ -81326,7 +86391,7 @@ var ScaleManager = new Class({ * checked here. * * @name Phaser.Scale.ScaleManager#resizeInterval - * @type {integer} + * @type {number} * @since 3.16.0 */ this.resizeInterval = 500; @@ -81335,7 +86400,7 @@ var ScaleManager = new Class({ * Internal size interval tracker. * * @name Phaser.Scale.ScaleManager#_lastCheck - * @type {integer} + * @type {number} * @private * @since 3.16.0 */ @@ -81382,7 +86447,7 @@ var ScaleManager = new Class({ // Parse the config to get the scaling values we need this.parseConfig(this.game.config); - this.game.events.once('boot', this.boot, this); + this.game.events.once(GameEvents.BOOT, this.boot, this); }, /** @@ -81425,6 +86490,7 @@ var ScaleManager = new Class({ } game.events.on(GameEvents.PRE_STEP, this.step, this); + game.events.once(GameEvents.READY, this.refresh, this); game.events.once(GameEvents.DESTROY, this.destroy, this); this.startListeners(); @@ -81451,7 +86517,6 @@ var ScaleManager = new Class({ var width = config.width; var height = config.height; var scaleMode = config.scaleMode; - var resolution = config.resolution; var zoom = config.zoom; var autoRound = config.autoRound; @@ -81487,11 +86552,6 @@ var ScaleManager = new Class({ height = Math.floor(parentHeight * parentScaleY); } - // This is fixed at 1 on purpose. - // Changing it will break all user input. - // Wait for another release to solve this issue. - this.resolution = 1; - this.scaleMode = scaleMode; this.autoRound = autoRound; @@ -81521,8 +86581,8 @@ var ScaleManager = new Class({ this._resetZoom = true; } - // The modified game size, which is the w/h * resolution - this.baseSize.setSize(width * resolution, height * resolution); + // The modified game size + this.baseSize.setSize(width, height); if (autoRound) { @@ -81623,9 +86683,8 @@ var ScaleManager = new Class({ DOMRect.height = GetInnerHeight(true); } - var resolution = this.resolution; - var newWidth = DOMRect.width * resolution; - var newHeight = DOMRect.height * resolution; + var newWidth = DOMRect.width; + var newHeight = DOMRect.height; if (parentSize.width !== newWidth || parentSize.height !== newHeight) { @@ -81705,7 +86764,6 @@ var ScaleManager = new Class({ setGameSize: function (width, height) { var autoRound = this.autoRound; - var resolution = this.resolution; if (autoRound) { @@ -81719,8 +86777,8 @@ var ScaleManager = new Class({ // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc this.gameSize.resize(width, height); - // The modified game size, which is the w/h * resolution - this.baseSize.resize(width * resolution, height * resolution); + // The modified game size + this.baseSize.resize(width, height); if (autoRound) { @@ -81770,7 +86828,6 @@ var ScaleManager = new Class({ resize: function (width, height) { var zoom = this.zoom; - var resolution = this.resolution; var autoRound = this.autoRound; if (autoRound) @@ -81785,8 +86842,8 @@ var ScaleManager = new Class({ // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc this.gameSize.resize(width, height); - // The modified game size, which is the w/h * resolution - this.baseSize.resize(width * resolution, height * resolution); + // The modified game size + this.baseSize.resize(width, height); if (autoRound) { @@ -81796,7 +86853,7 @@ var ScaleManager = new Class({ // The size used for the canvas style, factoring in the scale mode and parent and zoom value // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) - this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + this.displaySize.setSize((width * zoom), (height * zoom)); this.canvas.width = this.baseSize.width; this.canvas.height = this.baseSize.height; @@ -81828,7 +86885,7 @@ var ScaleManager = new Class({ * @fires Phaser.Scale.Events#RESIZE * @since 3.16.0 * - * @param {integer} value - The new zoom value of the game. + * @param {number} value - The new zoom value of the game. * * @return {this} The Scale Manager instance. */ @@ -81900,7 +86957,7 @@ var ScaleManager = new Class({ domStyle.marginTop = canvasStyle.marginTop; } - this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, this.resolution, previousWidth, previousHeight); + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, previousWidth, previousHeight); return this; }, @@ -81949,15 +87006,14 @@ var ScaleManager = new Class({ var zoom = this.zoom; var autoRound = this.autoRound; - var resolution = 1; if (this.scaleMode === CONST.SCALE_MODE.NONE) { // No scale - this.displaySize.setSize((width * zoom) * resolution, (height * zoom) * resolution); + this.displaySize.setSize((width * zoom), (height * zoom)); - styleWidth = this.displaySize.width / resolution; - styleHeight = this.displaySize.height / resolution; + styleWidth = this.displaySize.width; + styleHeight = this.displaySize.height; if (autoRound) { @@ -81982,10 +87038,10 @@ var ScaleManager = new Class({ this.gameSize.setSize(this.displaySize.width, this.displaySize.height); - this.baseSize.setSize(this.displaySize.width * resolution, this.displaySize.height * resolution); + this.baseSize.setSize(this.displaySize.width, this.displaySize.height); - styleWidth = this.displaySize.width / resolution; - styleHeight = this.displaySize.height / resolution; + styleWidth = this.displaySize.width; + styleHeight = this.displaySize.height; if (autoRound) { @@ -82001,8 +87057,8 @@ var ScaleManager = new Class({ // All other scale modes this.displaySize.setSize(this.parentSize.width, this.parentSize.height); - styleWidth = this.displaySize.width / resolution; - styleHeight = this.displaySize.height / resolution; + styleWidth = this.displaySize.width; + styleHeight = this.displaySize.height; if (autoRound) { @@ -82029,7 +87085,7 @@ var ScaleManager = new Class({ * @method Phaser.Scale.ScaleManager#getMaxZoom * @since 3.16.0 * - * @return {integer} The maximum possible zoom factor. At a minimum this value is always at least 1. + * @return {number} The maximum possible zoom factor. At a minimum this value is always at least 1. */ getMaxZoom: function () { @@ -82667,7 +87723,7 @@ module.exports = ScaleManager; /***/ }), -/* 383 */ +/* 393 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -82676,9 +87732,9 @@ module.exports = ScaleManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var SnapFloor = __webpack_require__(95); +var SnapFloor = __webpack_require__(72); var Vector2 = __webpack_require__(3); /** @@ -82696,7 +87752,7 @@ var Vector2 = __webpack_require__(3); * * @param {number} [width=0] - The width of the Size component. * @param {number} [height=width] - The height of the Size component. If not given, it will use the `width`. - * @param {integer} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. + * @param {number} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. * @param {any} [parent=null] - The parent of this Size component. Can be any object with public `width` and `height` properties. Dimensions are clamped to keep them within the parent bounds where possible. */ var Size = new Class({ @@ -82745,7 +87801,7 @@ var Size = new Class({ * This property is read-only. To change it use the `setAspectMode` method. * * @name Phaser.Structs.Size#aspectMode - * @type {integer} + * @type {number} * @readonly * @since 3.16.0 */ @@ -82843,7 +87899,7 @@ var Size = new Class({ * @method Phaser.Structs.Size#setAspectMode * @since 3.16.0 * - * @param {integer} [value=0] - The aspect mode value. + * @param {number} [value=0] - The aspect mode value. * * @return {this} This Size component instance. */ @@ -83396,7 +88452,7 @@ var Size = new Class({ * * @name Phaser.Structs.Size.NONE * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.NONE = 0; @@ -83406,7 +88462,7 @@ Size.NONE = 0; * * @name Phaser.Structs.Size.WIDTH_CONTROLS_HEIGHT * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.WIDTH_CONTROLS_HEIGHT = 1; @@ -83416,7 +88472,7 @@ Size.WIDTH_CONTROLS_HEIGHT = 1; * * @name Phaser.Structs.Size.HEIGHT_CONTROLS_WIDTH * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.HEIGHT_CONTROLS_WIDTH = 2; @@ -83426,7 +88482,7 @@ Size.HEIGHT_CONTROLS_WIDTH = 2; * * @name Phaser.Structs.Size.FIT * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.FIT = 3; @@ -83436,7 +88492,7 @@ Size.FIT = 3; * * @name Phaser.Structs.Size.ENVELOP * @constant - * @type {integer} + * @type {number} * @since 3.16.0 */ Size.ENVELOP = 4; @@ -83445,7 +88501,7 @@ module.exports = Size; /***/ }), -/* 384 */ +/* 394 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83455,14 +88511,14 @@ module.exports = Size; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(133); +var CONST = __webpack_require__(139); var Events = __webpack_require__(20); -var GameEvents = __webpack_require__(21); +var GameEvents = __webpack_require__(23); var GetValue = __webpack_require__(6); -var LoaderEvents = __webpack_require__(84); +var LoaderEvents = __webpack_require__(89); var NOOP = __webpack_require__(1); -var Scene = __webpack_require__(385); -var Systems = __webpack_require__(190); +var Scene = __webpack_require__(395); +var Systems = __webpack_require__(195); /** * @classdesc @@ -83470,7 +88526,7 @@ var Systems = __webpack_require__(190); * * The Scene Manager is a Game level system, responsible for creating, processing and updating all of the * Scenes in a Game instance. - * +ó * * * @class SceneManager * @memberof Phaser.Scenes @@ -84606,33 +89662,39 @@ var SceneManager = new Class({ if (scene) { + var sys = scene.sys; + // If the Scene is already running (perhaps they called start from a launched sub-Scene?) // then we close it down before starting it again. - if (scene.sys.isActive() || scene.sys.isPaused()) + if (sys.isActive() || sys.isPaused()) { - scene.sys.shutdown(); + sys.shutdown(); - scene.sys.start(data); + sys.sceneUpdate = NOOP; + + sys.start(data); } else { - scene.sys.start(data); + sys.sceneUpdate = NOOP; + + sys.start(data); var loader; - if (scene.sys.load) + if (sys.load) { - loader = scene.sys.load; + loader = sys.load; } // Files payload? - if (loader && scene.sys.settings.hasOwnProperty('pack')) + if (loader && sys.settings.hasOwnProperty('pack')) { loader.reset(); - if (loader.addPack({ payload: scene.sys.settings.pack })) + if (loader.addPack({ payload: sys.settings.pack })) { - scene.sys.settings.status = CONST.LOADING; + sys.settings.status = CONST.LOADING; loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this); @@ -84711,7 +89773,7 @@ var SceneManager = new Class({ * @method Phaser.Scenes.SceneManager#getAt * @since 3.0.0 * - * @param {integer} index - The index of the Scene to retrieve. + * @param {number} index - The index of the Scene to retrieve. * * @return {(Phaser.Scene|undefined)} The Scene. */ @@ -84728,7 +89790,7 @@ var SceneManager = new Class({ * * @param {(string|Phaser.Scene)} key - The key of the Scene. * - * @return {integer} The index of the Scene. + * @return {number} The index of the Scene. */ getIndex: function (key) { @@ -85083,7 +90145,7 @@ module.exports = SceneManager; /***/ }), -/* 385 */ +/* 395 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85093,7 +90155,7 @@ module.exports = SceneManager; */ var Class = __webpack_require__(0); -var Systems = __webpack_require__(190); +var Systems = __webpack_require__(195); /** * @classdesc @@ -85347,6 +90409,15 @@ var Scene = new Class({ * @since 3.0.0 */ this.plugins; + + /** + * A reference to the renderer instance Phaser is using, either Canvas or WebGL. + * + * @name Phaser.Scene#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.50.0 + */ + this.renderer; }, /** @@ -85369,7 +90440,7 @@ module.exports = Scene; /***/ }), -/* 386 */ +/* 396 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85379,7 +90450,7 @@ module.exports = Scene; */ var GetFastValue = __webpack_require__(2); -var UppercaseFirst = __webpack_require__(191); +var UppercaseFirst = __webpack_require__(196); /** * Builds an array of which physics plugins should be activated for the given Scene. @@ -85431,7 +90502,7 @@ module.exports = GetPhysicsPlugins; /***/ }), -/* 387 */ +/* 397 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85478,7 +90549,7 @@ module.exports = GetScenePlugins; /***/ }), -/* 388 */ +/* 398 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85487,10 +90558,10 @@ module.exports = GetScenePlugins; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(133); +var CONST = __webpack_require__(139); var GetValue = __webpack_require__(6); -var Merge = __webpack_require__(134); -var InjectionMap = __webpack_require__(908); +var Merge = __webpack_require__(140); +var InjectionMap = __webpack_require__(964); /** * @namespace Phaser.Scenes.Settings @@ -85574,7 +90645,7 @@ module.exports = Settings; /***/ }), -/* 389 */ +/* 399 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -85583,18 +90654,18 @@ module.exports = Settings; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); -var CanvasTexture = __webpack_require__(390); +var CanvasPool = __webpack_require__(31); +var CanvasTexture = __webpack_require__(400); var Class = __webpack_require__(0); -var Color = __webpack_require__(32); -var CONST = __webpack_require__(34); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(130); -var GameEvents = __webpack_require__(21); -var GenerateTexture = __webpack_require__(355); +var Color = __webpack_require__(36); +var CONST = __webpack_require__(39); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(136); +var GameEvents = __webpack_require__(23); +var GenerateTexture = __webpack_require__(364); var GetValue = __webpack_require__(6); -var Parser = __webpack_require__(392); -var Texture = __webpack_require__(192); +var Parser = __webpack_require__(402); +var Texture = __webpack_require__(197); /** * @callback EachTextureCallback @@ -85683,7 +90754,7 @@ var TextureManager = new Class({ * An counting value used for emitting 'ready' event after all of managers in game is loaded. * * @name Phaser.Textures.TextureManager#_pending - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -85702,13 +90773,16 @@ var TextureManager = new Class({ */ boot: function () { - this._pending = 2; - this.on(Events.LOAD, this.updatePending, this); this.on(Events.ERROR, this.updatePending, this); - this.addBase64('__DEFAULT', this.game.config.defaultImage); - this.addBase64('__MISSING', this.game.config.missingImage); + var config = this.game.config; + + this.addBase64('__DEFAULT', config.defaultImage); + this.addBase64('__MISSING', config.missingImage); + this.addBase64('__WHITE', config.whiteImage); + + this._pending = 3; this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, @@ -85823,6 +90897,10 @@ var TextureManager = new Class({ /** * Adds a new Texture to the Texture Manager created from the given Base64 encoded data. * + * It works by creating an `Image` DOM object, then setting the `src` attribute to + * the given base64 encoded data. As a result, the process is asynchronous by its nature, + * so be sure to listen for the events this method dispatches before using the texture. + * * @method Phaser.Textures.TextureManager#addBase64 * @fires Phaser.Textures.Events#ADD * @fires Phaser.Textures.Events#ERROR @@ -85831,7 +90909,7 @@ var TextureManager = new Class({ * * @param {string} key - The unique string-based key of the Texture. * @param {*} data - The Base64 encoded data. - * + * * @return {this} This Texture Manager instance. */ addBase64: function (key, data) @@ -85866,9 +90944,9 @@ var TextureManager = new Class({ /** * Gets an existing texture frame and converts it into a base64 encoded image and returns the base64 data. - * + * * You can also provide the image type and encoder options. - * + * * This will only work with bitmap based texture frames, such as those created from Texture Atlases. * It will not work with GL Texture objects, such as Shaders, or Render Textures. For those please * see the WebGL Snapshot function instead. @@ -85877,10 +90955,10 @@ var TextureManager = new Class({ * @since 3.12.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. * @param {string} [type='image/png'] - A DOMString indicating the image format. The default format type is image/png. * @param {number} [encoderOptions=0.92] - A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. If this argument is anything else, the default value for image quality is used. The default value is 0.92. Other arguments are ignored. - * + * * @return {string} The base64 encoded data, or an empty string if the texture frame could not be found. */ getBase64: function (key, frame, type, encoderOptions) @@ -85953,15 +91031,18 @@ var TextureManager = new Class({ this.emit(Events.ADD, key, texture); } - + return texture; }, /** * Takes a WebGL Texture and creates a Phaser Texture from it, which is added to the Texture Manager using the given key. - * + * * This allows you to then use the Texture as a normal texture for texture based Game Objects like Sprites. - * + * + * If the `width` and `height` arguments are omitted, but the WebGL Texture was created by Phaser's WebGL Renderer + * and has `glTexture.width` and `glTexture.height` properties, these values will be used instead. + * * This is a WebGL only feature. * * @method Phaser.Textures.TextureManager#addGLTexture @@ -85970,8 +91051,8 @@ var TextureManager = new Class({ * * @param {string} key - The unique string-based key of the Texture. * @param {WebGLTexture} glTexture - The source Render Texture. - * @param {number} width - The new width of the Texture. - * @param {number} height - The new height of the Texture. + * @param {number} [width] - The new width of the Texture. Read from `glTexture.width` if omitted. + * @param {number} [height] - The new height of the Texture. Read from `glTexture.height` if omitted. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -85981,13 +91062,16 @@ var TextureManager = new Class({ if (this.checkKey(key)) { + if (width === undefined) { width = glTexture.width; } + if (height === undefined) { height = glTexture.height; } + texture = this.create(key, glTexture, width, height); texture.add('__BASE', 0, 0, 0, width, height); this.emit(Events.ADD, key, texture); } - + return texture; }, @@ -86016,17 +91100,17 @@ var TextureManager = new Class({ this.emit(Events.ADD, key, texture); } - + return texture; }, /** * Creates a new Texture using the given config values. - * + * * Generated textures consist of a Canvas element to which the texture data is drawn. - * + * * Generates a texture based on the given Create configuration object. - * + * * The texture is drawn using a fixed-size indexed palette of 16 colors, where the hex value in the * data cells map to a single color. For example, if the texture config looked like this: * @@ -86045,14 +91129,14 @@ var TextureManager = new Class({ * '.27887.78872.', * '.787.....787.' * ]; - * + * * this.textures.generate('star', { data: star, pixelWidth: 4 }); * ``` - * + * * Then it would generate a texture that is 52 x 48 pixels in size, because each cell of the data array * represents 1 pixel multiplied by the `pixelWidth` value. The cell values, such as `8`, maps to color * number 8 in the palette. If a cell contains a period character `.` then it is transparent. - * + * * The default palette is Arne16, but you can specify your own using the `palette` property. * * @method Phaser.Textures.TextureManager#generate @@ -86091,8 +91175,8 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {integer} [width=256] - The width of the Canvas element. - * @param {integer} [height=256] - The height of the Canvas element. + * @param {number} [width=256] - The width of the Canvas element. + * @param {number} [height=256] - The height of the Canvas element. * * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. */ @@ -86296,7 +91380,7 @@ var TextureManager = new Class({ if (this.checkKey(key)) { texture = this.create(key, source); - + Parser.AtlasXML(texture, 0, data); if (dataSource) @@ -86442,8 +91526,8 @@ var TextureManager = new Class({ * * @param {string} key - The unique string-based key of the Texture. * @param {HTMLImageElement} source - The source Image element. - * @param {integer} width - The width of the Texture. - * @param {integer} height - The height of the Texture. + * @param {number} width - The width of the Texture. + * @param {number} height - The height of the Texture. * * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ @@ -86478,11 +91562,11 @@ var TextureManager = new Class({ /** * Returns a Texture from the Texture Manager that matches the given key. - * + * * If the key is `undefined` it will return the `__DEFAULT` Texture. - * + * * If the key is an instance of a Texture, it will return the key directly. - * + * * Finally. if the key is given, but not found and not a Texture instance, it will return the `__MISSING` Texture. * * @method Phaser.Textures.TextureManager#get @@ -86517,7 +91601,7 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} frame - The string or index of the Frame to be cloned. + * @param {(string|number)} frame - The string or index of the Frame to be cloned. * * @return {Phaser.Textures.Frame} A Clone of the given Frame. */ @@ -86536,7 +91620,7 @@ var TextureManager = new Class({ * @since 3.0.0 * * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. * * @return {Phaser.Textures.Frame} A Texture Frame object. */ @@ -86580,10 +91664,10 @@ var TextureManager = new Class({ * @method Phaser.Textures.TextureManager#getPixel * @since 3.0.0 * - * @param {integer} x - The x coordinate of the pixel within the Texture. - * @param {integer} y - The y coordinate of the pixel within the Texture. + * @param {number} x - The x coordinate of the pixel within the Texture. + * @param {number} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string or index of the Frame. + * @param {(string|number)} [frame] - The string or index of the Frame. * * @return {?Phaser.Display.Color} A Color object populated with the color values of the requested pixel, * or `null` if the coordinates were out of bounds. @@ -86627,12 +91711,12 @@ var TextureManager = new Class({ * @method Phaser.Textures.TextureManager#getPixelAlpha * @since 3.10.0 * - * @param {integer} x - The x coordinate of the pixel within the Texture. - * @param {integer} y - The y coordinate of the pixel within the Texture. + * @param {number} x - The x coordinate of the pixel within the Texture. + * @param {number} y - The y coordinate of the pixel within the Texture. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string or index of the Frame. + * @param {(string|number)} [frame] - The string or index of the Frame. * - * @return {integer} A value between 0 and 255, or `null` if the coordinates were out of bounds. + * @return {number} A value between 0 and 255, or `null` if the coordinates were out of bounds. */ getPixelAlpha: function (x, y, key, frame) { @@ -86655,9 +91739,9 @@ var TextureManager = new Class({ ctx.clearRect(0, 0, 1, 1); ctx.drawImage(textureFrame.source.image, x, y, 1, 1, 0, 0, 1, 1); - + var rgb = ctx.getImageData(0, 0, 1, 1); - + return rgb.data[3]; } } @@ -86674,7 +91758,7 @@ var TextureManager = new Class({ * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the texture would be set on. * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string or index of the Frame. + * @param {(string|number)} [frame] - The string or index of the Frame. * * @return {Phaser.GameObjects.GameObject} The Game Object the texture was set on. */ @@ -86691,9 +91775,9 @@ var TextureManager = new Class({ /** * Changes the key being used by a Texture to the new key provided. - * + * * The old key is removed, allowing it to be re-used. - * + * * Game Objects are linked to Textures by a reference to the Texture object, so * all existing references will be retained. * @@ -86776,7 +91860,7 @@ module.exports = TextureManager; /***/ }), -/* 390 */ +/* 400 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -86786,11 +91870,11 @@ module.exports = TextureManager; */ var Class = __webpack_require__(0); -var Clamp = __webpack_require__(17); -var Color = __webpack_require__(32); -var CONST = __webpack_require__(34); -var IsSizePowerOfTwo = __webpack_require__(128); -var Texture = __webpack_require__(192); +var Clamp = __webpack_require__(16); +var Color = __webpack_require__(36); +var CONST = __webpack_require__(39); +var IsSizePowerOfTwo = __webpack_require__(133); +var Texture = __webpack_require__(197); /** * @classdesc @@ -86804,10 +91888,10 @@ var Texture = __webpack_require__(192); * you should call `CanvasTexture.refresh()` once you are finished with your changes to the canvas. Try and keep * this to a minimum, especially on large canvas sizes, or you may inadvertently thrash the GPU by constantly uploading * texture data to it. This restriction does not apply if using the Canvas Renderer. - * + * * It starts with only one frame that covers the whole of the canvas. You can add further frames, that specify * sections of the canvas using the `add` method. - * + * * Should you need to resize the canvas use the `setSize` method so that it accurately updates all of the underlying * texture data as well. Forgetting to do this (i.e. by changing the canvas size directly from your code) could cause * graphical errors. @@ -86821,8 +91905,8 @@ var Texture = __webpack_require__(192); * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. * @param {string} key - The unique string-based key of this Texture. * @param {HTMLCanvasElement} source - The canvas element that is used as the base of this texture. - * @param {integer} width - The width of the canvas. - * @param {integer} height - The height of the canvas. + * @param {number} width - The width of the canvas. + * @param {number} height - The height of the canvas. */ var CanvasTexture = new Class({ @@ -86872,7 +91956,7 @@ var CanvasTexture = new Class({ * * @name Phaser.Textures.CanvasTexture#width * @readonly - * @type {integer} + * @type {number} * @since 3.7.0 */ this.width = width; @@ -86883,7 +91967,7 @@ var CanvasTexture = new Class({ * * @name Phaser.Textures.CanvasTexture#height * @readonly - * @type {integer} + * @type {number} * @since 3.7.0 */ this.height = height; @@ -86997,11 +92081,11 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#draw * @since 3.13.0 - * - * @param {integer} x - The x coordinate to draw the source at. - * @param {integer} y - The y coordinate to draw the source at. + * + * @param {number} x - The x coordinate to draw the source at. + * @param {number} y - The y coordinate to draw the source at. * @param {(HTMLImageElement|HTMLCanvasElement)} source - The element to draw to this canvas. - * + * * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. */ draw: function (x, y, source) @@ -87017,12 +92101,12 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#drawFrame * @since 3.16.0 - * + * * @param {string} key - The unique string-based key of the Texture. - * @param {(string|integer)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. - * @param {integer} [x=0] - The x coordinate to draw the source at. - * @param {integer} [y=0] - The y coordinate to draw the source at. - * + * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {number} [x=0] - The x coordinate to draw the source at. + * @param {number} [y=0] - The y coordinate to draw the source at. + * * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. */ drawFrame: function (key, frame, x, y) @@ -87065,14 +92149,14 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#setPixel * @since 3.16.0 - * - * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} red - The red color value. A number between 0 and 255. - * @param {integer} green - The green color value. A number between 0 and 255. - * @param {integer} blue - The blue color value. A number between 0 and 255. - * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255. - * + * + * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. + * * @return {this} This CanvasTexture. */ setPixel: function (x, y, red, green, blue, alpha) @@ -87104,15 +92188,15 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#putData * @since 3.16.0 - * + * * @param {ImageData} imageData - The ImageData to put at the given location. - * @param {integer} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. - * @param {integer} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. - * @param {integer} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. - * @param {integer} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. - * + * @param {number} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {number} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {number} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. + * @param {number} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. + * * @return {this} This CanvasTexture. */ putData: function (imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) @@ -87133,12 +92217,12 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#getData * @since 3.16.0 - * - * @param {integer} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. - * @param {integer} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. - * + * + * @param {number} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. + * @param {number} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. + * * @return {ImageData} The ImageData extracted from this CanvasTexture. */ getData: function (x, y, width, height) @@ -87155,17 +92239,17 @@ var CanvasTexture = new Class({ /** * Get the color of a specific pixel from this texture and store it in a Color object. - * + * * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. * * @method Phaser.Textures.CanvasTexture#getPixel * @since 3.13.0 - * - * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * + * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. * @param {Phaser.Display.Color} [out] - A Color object to store the pixel values in. If not provided a new Color object will be created. - * + * * @return {Phaser.Display.Color} An object with the red, green, blue and alpha values set in the r, g, b and a properties. */ getPixel: function (x, y, out) @@ -87197,18 +92281,18 @@ var CanvasTexture = new Class({ * * If the requested region extends outside the bounds of this CanvasTexture, * the region is truncated to fit. - * + * * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. * * @method Phaser.Textures.CanvasTexture#getPixels * @since 3.16.0 - * - * @param {integer} [x=0] - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} [y=0] - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} [width] - The width of the region to get. Must be an integer. Defaults to the canvas width if not given. - * @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. - * + * + * @param {number} [x=0] - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} [y=0] - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} [width] - The width of the region to get. Must be an integer. Defaults to the canvas width if not given. + * @param {number} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. + * * @return {Phaser.Types.Textures.PixelConfig[][]} A 2d array of Pixel objects. */ getPixels: function (x, y, width, height) @@ -87257,11 +92341,11 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#getIndex * @since 3.16.0 - * - * @param {integer} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {integer} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * - * @return {integer} + * + * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * + * @return {number} */ getIndex: function (x, y) { @@ -87327,11 +92411,11 @@ var CanvasTexture = new Class({ * * @method Phaser.Textures.CanvasTexture#clear * @since 3.7.0 - * - * @param {integer} [x=0] - The x coordinate of the top-left of the region to clear. - * @param {integer} [y=0] - The y coordinate of the top-left of the region to clear. - * @param {integer} [width] - The width of the region. - * @param {integer} [height] - The height of the region. + * + * @param {number} [x=0] - The x coordinate of the top-left of the region to clear. + * @param {number} [y=0] - The y coordinate of the top-left of the region to clear. + * @param {number} [width] - The width of the region. + * @param {number} [height] - The height of the region. * * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. */ @@ -87353,8 +92437,8 @@ var CanvasTexture = new Class({ * @method Phaser.Textures.CanvasTexture#setSize * @since 3.7.0 * - * @param {integer} width - The new width of the Canvas. - * @param {integer} [height] - The new height of the Canvas. If not given it will use the width as the height. + * @param {number} width - The new width of the Canvas. + * @param {number} [height] - The new height of the Canvas. If not given it will use the width as the height. * * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. */ @@ -87411,7 +92495,7 @@ module.exports = CanvasTexture; /***/ }), -/* 391 */ +/* 401 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87420,10 +92504,10 @@ module.exports = CanvasTexture; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); -var IsSizePowerOfTwo = __webpack_require__(128); -var ScaleModes = __webpack_require__(247); +var IsSizePowerOfTwo = __webpack_require__(133); +var ScaleModes = __webpack_require__(260); /** * @classdesc @@ -87440,8 +92524,8 @@ var ScaleModes = __webpack_require__(247); * * @param {Phaser.Textures.Texture} texture - The Texture this TextureSource belongs to. * @param {(HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|Phaser.GameObjects.RenderTexture|WebGLTexture)} source - The source image data. - * @param {integer} [width] - Optional width of the source image. If not given it's derived from the source itself. - * @param {integer} [height] - Optional height of the source image. If not given it's derived from the source itself. + * @param {number} [width] - Optional width of the source image. If not given it's derived from the source itself. + * @param {number} [height] - Optional height of the source image. If not given it's derived from the source itself. * @param {boolean} [flipY=false] - Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. */ var TextureSource = new Class({ @@ -87498,7 +92582,7 @@ var TextureSource = new Class({ * Currently un-used. * * @name Phaser.Textures.TextureSource#compressionAlgorithm - * @type {integer} + * @type {number} * @default null * @since 3.0.0 */ @@ -87519,7 +92603,7 @@ var TextureSource = new Class({ * the `naturalWidth` and then `width` properties of the source image. * * @name Phaser.Textures.TextureSource#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width = width || source.naturalWidth || source.videoWidth || source.width || 0; @@ -87529,7 +92613,7 @@ var TextureSource = new Class({ * the `naturalHeight` and then `height` properties of the source image. * * @name Phaser.Textures.TextureSource#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height = height || source.naturalHeight || source.videoHeight || source.height || 0; @@ -87755,7 +92839,7 @@ var TextureSource = new Class({ { if (this.glTexture) { - this.renderer.deleteTexture(this.glTexture); + this.renderer.deleteTexture(this.glTexture, false); } if (this.isCanvas) @@ -87776,7 +92860,7 @@ module.exports = TextureSource; /***/ }), -/* 392 */ +/* 402 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87791,20 +92875,20 @@ module.exports = TextureSource; module.exports = { - AtlasXML: __webpack_require__(909), - Canvas: __webpack_require__(910), - Image: __webpack_require__(911), - JSONArray: __webpack_require__(912), - JSONHash: __webpack_require__(913), - SpriteSheet: __webpack_require__(914), - SpriteSheetFromAtlas: __webpack_require__(915), - UnityYAML: __webpack_require__(916) + AtlasXML: __webpack_require__(965), + Canvas: __webpack_require__(966), + Image: __webpack_require__(967), + JSONArray: __webpack_require__(968), + JSONHash: __webpack_require__(969), + SpriteSheet: __webpack_require__(970), + SpriteSheetFromAtlas: __webpack_require__(971), + UnityYAML: __webpack_require__(972) }; /***/ }), -/* 393 */ +/* 403 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87814,9 +92898,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HTML5AudioSoundManager = __webpack_require__(394); -var NoAudioSoundManager = __webpack_require__(397); -var WebAudioSoundManager = __webpack_require__(399); +var HTML5AudioSoundManager = __webpack_require__(404); +var NoAudioSoundManager = __webpack_require__(407); +var WebAudioSoundManager = __webpack_require__(409); /** * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings. @@ -87827,7 +92911,7 @@ var WebAudioSoundManager = __webpack_require__(399); * @since 3.0.0 * * @param {Phaser.Game} game - Reference to the current game instance. - * + * * @return {(Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager|Phaser.Sound.NoAudioSoundManager)} The Sound Manager instance that was created. */ var SoundManagerCreator = { @@ -87837,12 +92921,12 @@ var SoundManagerCreator = { var audioConfig = game.config.audio; var deviceAudio = game.device.audio; - if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) { return new NoAudioSoundManager(game); } - if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) + if (deviceAudio.webAudio && !audioConfig.disableWebAudio) { return new WebAudioSoundManager(game); } @@ -87856,7 +92940,7 @@ module.exports = SoundManagerCreator; /***/ }), -/* 394 */ +/* 404 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -87866,10 +92950,10 @@ module.exports = SoundManagerCreator; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSoundManager = __webpack_require__(135); +var BaseSoundManager = __webpack_require__(141); var Class = __webpack_require__(0); -var Events = __webpack_require__(61); -var HTML5AudioSound = __webpack_require__(396); +var Events = __webpack_require__(66); +var HTML5AudioSound = __webpack_require__(406); /** * HTML5 Audio implementation of the Sound Manager. @@ -88325,7 +93409,7 @@ module.exports = HTML5AudioSoundManager; /***/ }), -/* 395 */ +/* 405 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -88334,7 +93418,7 @@ module.exports = HTML5AudioSoundManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Returns the first element in the array. @@ -88352,8 +93436,8 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {string} [property] - The property to test on each array element. * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex=0] - An optional start index to search from. - * @param {integer} [endIndex=array.length] - An optional end index to search up to (but not included) + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=array.length] - An optional end index to search up to (but not included) * * @return {object} The first matching element from the array, or `null` if no element could be found in the range given. */ @@ -88384,7 +93468,7 @@ module.exports = GetFirst; /***/ }), -/* 396 */ +/* 406 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -88394,10 +93478,10 @@ module.exports = GetFirst; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSound = __webpack_require__(136); +var BaseSound = __webpack_require__(142); var Class = __webpack_require__(0); -var Events = __webpack_require__(61); -var Clamp = __webpack_require__(17); +var Events = __webpack_require__(66); +var Clamp = __webpack_require__(16); /** * @classdesc @@ -89314,7 +94398,7 @@ module.exports = HTML5AudioSound; /***/ }), -/* 397 */ +/* 407 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89324,10 +94408,10 @@ module.exports = HTML5AudioSound; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSoundManager = __webpack_require__(135); +var BaseSoundManager = __webpack_require__(141); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var NoAudioSound = __webpack_require__(398); +var EventEmitter = __webpack_require__(10); +var NoAudioSound = __webpack_require__(408); var NOOP = __webpack_require__(1); /** @@ -89432,7 +94516,7 @@ module.exports = NoAudioSoundManager; /***/ }), -/* 398 */ +/* 408 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89442,10 +94526,10 @@ module.exports = NoAudioSoundManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSound = __webpack_require__(136); +var BaseSound = __webpack_require__(142); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Extend = __webpack_require__(19); +var EventEmitter = __webpack_require__(10); +var Extend = __webpack_require__(18); var returnFalse = function () { @@ -89623,7 +94707,7 @@ module.exports = NoAudioSound; /***/ }), -/* 399 */ +/* 409 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -89633,11 +94717,11 @@ module.exports = NoAudioSound; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Base64ToArrayBuffer = __webpack_require__(400); -var BaseSoundManager = __webpack_require__(135); +var Base64ToArrayBuffer = __webpack_require__(410); +var BaseSoundManager = __webpack_require__(141); var Class = __webpack_require__(0); -var Events = __webpack_require__(61); -var WebAudioSound = __webpack_require__(401); +var Events = __webpack_require__(66); +var WebAudioSound = __webpack_require__(411); /** * @classdesc @@ -89736,7 +94820,7 @@ var WebAudioSoundManager = new Class({ { var audioConfig = game.config.audio; - if (audioConfig && audioConfig.context) + if (audioConfig.context) { audioConfig.context.resume(); @@ -89983,7 +95067,7 @@ var WebAudioSoundManager = new Class({ this.masterMuteNode.disconnect(); this.masterMuteNode = null; - if (this.game.config.audio && this.game.config.audio.context) + if (this.game.config.audio.context) { this.context.suspend(); } @@ -90086,7 +95170,7 @@ module.exports = WebAudioSoundManager; /***/ }), -/* 400 */ +/* 410 */ /***/ (function(module, exports) { /** @@ -90161,7 +95245,7 @@ module.exports = Base64ToArrayBuffer; /***/ }), -/* 401 */ +/* 411 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -90171,9 +95255,9 @@ module.exports = Base64ToArrayBuffer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSound = __webpack_require__(136); +var BaseSound = __webpack_require__(142); var Class = __webpack_require__(0); -var Events = __webpack_require__(61); +var Events = __webpack_require__(66); /** * @classdesc @@ -91067,7 +96151,7 @@ module.exports = WebAudioSound; /***/ }), -/* 402 */ +/* 412 */ /***/ (function(module, exports) { /** @@ -91081,12 +96165,26 @@ module.exports = WebAudioSound; * * The transpose of a matrix is a new matrix whose rows are the columns of the original. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.TransposeMatrix * @since 3.0.0 - * + * * @generic T * @genericUse {T[][]} - [array,$return] - * + * * @param {T[][]} [array] - The array matrix to transpose. * * @return {T[][]} A new array matrix which is a transposed version of the given array. @@ -91115,7 +96213,7 @@ module.exports = TransposeMatrix; /***/ }), -/* 403 */ +/* 413 */ /***/ (function(module, exports) { /** @@ -91156,9 +96254,9 @@ function defaultCompare (a, b) * @since 3.0.0 * * @param {array} arr - The array to sort. - * @param {integer} k - The k-th element index. - * @param {integer} [left=0] - The index of the left part of the range. - * @param {integer} [right] - The index of the right part of the range. + * @param {number} k - The k-th element index. + * @param {number} [left=0] - The index of the left part of the range. + * @param {number} [right] - The index of the right part of the range. * @param {function} [compare] - An optional comparison function. Is passed two elements and should return 0, 1 or -1. */ var QuickSelect = function (arr, k, left, right, compare) @@ -91237,7 +96335,7 @@ module.exports = QuickSelect; /***/ }), -/* 404 */ +/* 414 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91247,7 +96345,7 @@ module.exports = QuickSelect; */ var GetValue = __webpack_require__(6); -var Shuffle = __webpack_require__(121); +var Shuffle = __webpack_require__(127); var BuildChunk = function (a, b, qty) { @@ -91375,7 +96473,7 @@ module.exports = Range; /***/ }), -/* 405 */ +/* 415 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91390,14 +96488,14 @@ module.exports = Range; module.exports = { - PROCESS_QUEUE_ADD: __webpack_require__(967), - PROCESS_QUEUE_REMOVE: __webpack_require__(968) + PROCESS_QUEUE_ADD: __webpack_require__(1024), + PROCESS_QUEUE_REMOVE: __webpack_require__(1025) }; /***/ }), -/* 406 */ +/* 416 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91437,7 +96535,7 @@ var BuildGameObjectAnimation = function (sprite, config) { // { anims: { // key: string - // startFrame: [string|integer] + // startFrame: [string|number] // delay: [float] // repeat: [integer] // repeatDelay: [float] @@ -91494,7 +96592,7 @@ module.exports = BuildGameObjectAnimation; /***/ }), -/* 407 */ +/* 417 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91504,7 +96602,7 @@ module.exports = BuildGameObjectAnimation; */ var Class = __webpack_require__(0); -var Frame = __webpack_require__(97); +var Frame = __webpack_require__(104); /** * @classdesc @@ -91530,7 +96628,7 @@ var Frame = __webpack_require__(97); * @param {Phaser.GameObjects.Blitter} blitter - The parent Blitter object is responsible for updating this Bob. * @param {number} x - The horizontal position of this Game Object in the world, relative to the parent Blitter position. * @param {number} y - The vertical position of this Game Object in the world, relative to the parent Blitter position. - * @param {(string|integer)} frame - The Frame this Bob will render with, as defined in the Texture the parent Blitter is using. + * @param {(string|number)} frame - The Frame this Bob will render with, as defined in the Texture the parent Blitter is using. * @param {boolean} visible - Should the Bob render visible or not to start with? */ var Bob = new Class({ @@ -91649,7 +96747,7 @@ var Bob = new Class({ * @method Phaser.GameObjects.Bob#setFrame * @since 3.0.0 * - * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. * * @return {this} This Bob Game Object. */ @@ -91699,7 +96797,7 @@ var Bob = new Class({ * * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. - * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. * * @return {this} This Bob Game Object. */ @@ -91798,7 +96896,7 @@ var Bob = new Class({ /** * Sets the visibility of this Bob. - * + * * An invisible Bob will skip rendering. * * @method Phaser.GameObjects.Bob#setVisible @@ -91818,7 +96916,7 @@ var Bob = new Class({ /** * Set the Alpha level of this Bob. The alpha controls the opacity of the Game Object as it renders. * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. - * + * * A Bob with alpha 0 will skip rendering. * * @method Phaser.GameObjects.Bob#setAlpha @@ -91872,7 +96970,7 @@ var Bob = new Class({ /** * The visible state of the Bob. - * + * * An invisible Bob will skip rendering. * * @name Phaser.GameObjects.Bob#visible @@ -91896,7 +96994,7 @@ var Bob = new Class({ /** * The alpha value of the Bob, between 0 and 1. - * + * * A Bob with alpha 0 will skip rendering. * * @name Phaser.GameObjects.Bob#alpha @@ -91924,7 +97022,7 @@ module.exports = Bob; /***/ }), -/* 408 */ +/* 418 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91966,7 +97064,7 @@ module.exports = Union; /***/ }), -/* 409 */ +/* 419 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91977,13 +97075,13 @@ module.exports = Union; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DOMElementRender = __webpack_require__(981); +var DOMElementRender = __webpack_require__(1038); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); +var GameObjectEvents = __webpack_require__(32); var IsPlainObject = __webpack_require__(7); -var RemoveFromDOM = __webpack_require__(188); +var RemoveFromDOM = __webpack_require__(193); var SCENE_EVENTS = __webpack_require__(20); -var Vector4 = __webpack_require__(129); +var Vector4 = __webpack_require__(135); /** * @classdesc @@ -92962,7 +98060,7 @@ module.exports = DOMElement; /***/ }), -/* 410 */ +/* 420 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92971,8 +98069,13 @@ module.exports = DOMElement; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CSSBlendModes = __webpack_require__(982); +var CSSBlendModes = __webpack_require__(1039); var GameObject = __webpack_require__(14); +var TransformMatrix = __webpack_require__(24); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -92985,11 +98088,10 @@ var GameObject = __webpack_require__(14); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active renderer. * @param {Phaser.GameObjects.DOMElement} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var DOMElementCSSRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var DOMElementCSSRenderer = function (renderer, src, camera, parentMatrix) { var node = src.node; var style = node.style; @@ -93001,7 +98103,7 @@ var DOMElementCSSRenderer = function (renderer, src, interpolationPercentage, ca { style.display = 'none'; } - + return; } @@ -93013,9 +98115,9 @@ var DOMElementCSSRenderer = function (renderer, src, interpolationPercentage, ca alpha *= parent.alpha; } - var camMatrix = renderer._tempMatrix1; - var srcMatrix = renderer._tempMatrix2; - var calcMatrix = renderer._tempMatrix3; + var camMatrix = tempMatrix1; + var srcMatrix = tempMatrix2; + var calcMatrix = tempMatrix3; var dx = 0; var dy = 0; @@ -93046,9 +98148,9 @@ var DOMElementCSSRenderer = function (renderer, src, interpolationPercentage, ca { dx = (src.width) * src.originX; dy = (src.height) * src.originY; - + srcMatrix.applyITRS(src.x - dx, src.y - dy, src.rotation, src.scaleX, src.scaleY); - + camMatrix.copyFrom(camera.matrix); tx = (100 * src.originX) + '%'; @@ -93084,7 +98186,7 @@ module.exports = DOMElementCSSRenderer; /***/ }), -/* 411 */ +/* 421 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93096,8 +98198,8 @@ module.exports = DOMElementCSSRenderer; var Class = __webpack_require__(0); var Components = __webpack_require__(11); var GameObject = __webpack_require__(14); -var GameObjectEvents = __webpack_require__(29); -var ExternRender = __webpack_require__(986); +var GameObjectEvents = __webpack_require__(32); +var ExternRender = __webpack_require__(1043); /** * @classdesc @@ -93196,7 +98298,7 @@ module.exports = Extern; /***/ }), -/* 412 */ +/* 422 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93205,8 +98307,8 @@ module.exports = Extern; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CircumferencePoint = __webpack_require__(204); -var FromPercent = __webpack_require__(89); +var CircumferencePoint = __webpack_require__(209); +var FromPercent = __webpack_require__(94); var MATH_CONST = __webpack_require__(13); var Point = __webpack_require__(4); @@ -93239,7 +98341,7 @@ module.exports = GetPoint; /***/ }), -/* 413 */ +/* 423 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93248,9 +98350,9 @@ module.exports = GetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circumference = __webpack_require__(414); -var CircumferencePoint = __webpack_require__(204); -var FromPercent = __webpack_require__(89); +var Circumference = __webpack_require__(424); +var CircumferencePoint = __webpack_require__(209); +var FromPercent = __webpack_require__(94); var MATH_CONST = __webpack_require__(13); /** @@ -93263,7 +98365,7 @@ var MATH_CONST = __webpack_require__(13); * @generic {Phaser.Geom.Point[]} O - [out,$return] * * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the points from. - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. * @param {(array|Phaser.Geom.Point[])} [out] - An array to insert the points in to. If not provided a new array will be created. * @@ -93293,7 +98395,7 @@ module.exports = GetPoints; /***/ }), -/* 414 */ +/* 424 */ /***/ (function(module, exports) { /** @@ -93325,7 +98427,7 @@ module.exports = Circumference; /***/ }), -/* 415 */ +/* 425 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93334,8 +98436,8 @@ module.exports = Circumference; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Commands = __webpack_require__(203); -var SetTransform = __webpack_require__(28); +var Commands = __webpack_require__(208); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -93348,13 +98450,12 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Graphics} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested * @param {CanvasRenderingContext2D} [renderTargetCtx] - The target rendering context. * @param {boolean} allowClip - If `true` then path operations will be used instead of fill operations. */ -var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix, renderTargetCtx, allowClip) +var GraphicsCanvasRenderer = function (renderer, src, camera, parentMatrix, renderTargetCtx, allowClip) { var commandBuffer = src.commandBuffer; var commandBufferLength = commandBuffer.length; @@ -93560,10 +98661,6 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c case Commands.GRADIENT_LINE_STYLE: index += 6; break; - - case Commands.SET_TEXTURE: - index += 2; - break; } } @@ -93575,7 +98672,7 @@ module.exports = GraphicsCanvasRenderer; /***/ }), -/* 416 */ +/* 426 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -93585,10 +98682,10 @@ module.exports = GraphicsCanvasRenderer; */ var Class = __webpack_require__(0); -var FloatBetween = __webpack_require__(127); -var GetEaseFunction = __webpack_require__(71); +var FloatBetween = __webpack_require__(132); +var GetEaseFunction = __webpack_require__(78); var GetFastValue = __webpack_require__(2); -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * @classdesc @@ -93814,6 +98911,10 @@ var EmitterOp = new Class({ var t = typeof value; + // Reset them in case they're not changed below + this.onEmit = this.defaultEmit; + this.onUpdate = this.defaultUpdate; + if (t === 'number') { // Explicit static value: @@ -93850,28 +98951,17 @@ var EmitterOp = new Class({ this.onUpdate = value; } } - else if (t === 'object' && (this.has(value, 'random') || this.hasBoth(value, 'start', 'end') || this.hasBoth(value, 'min', 'max'))) + else if (t === 'object' && this.hasBoth(value, 'start', 'end')) { - this.start = this.has(value, 'start') ? value.start : value.min; - this.end = this.has(value, 'end') ? value.end : value.max; + this.start = value.start; + this.end = value.end; - var isRandom = (this.hasBoth(value, 'min', 'max') || !!value.random); + // x: { start: 100, end: 400, random: true } (random optional) = eases between start and end - // A random starting value (using 'min | max' instead of 'start | end' automatically implies a random value) - - // x: { start: 100, end: 400, random: true } OR { min: 100, max: 400 } OR { random: [ 100, 400 ] } + var isRandom = this.has(value, 'random'); if (isRandom) { - var rnd = value.random; - - // x: { random: [ 100, 400 ] } = the same as doing: x: { start: 100, end: 400, random: true } - if (Array.isArray(rnd)) - { - this.start = rnd[0]; - this.end = rnd[1]; - } - this.onEmit = this.randomRangedValueEmit; } @@ -93896,19 +98986,38 @@ var EmitterOp = new Class({ var easeType = this.has(value, 'ease') ? value.ease : 'Linear'; - this.ease = GetEaseFunction(easeType); + this.ease = GetEaseFunction(easeType, value.easeParams); if (!isRandom) { this.onEmit = this.easedValueEmit; } - // BUG: alpha, rotate, scaleX, scaleY, or tint are eased here if {min, max} is given. - // Probably this branch should exclude isRandom entirely. - this.onUpdate = this.easeValueUpdate; } } + else if (t === 'object' && this.hasBoth(value, 'min', 'max')) + { + // { min: 100, max: 400 } = pick a random number between min and max + + this.start = value.min; + this.end = value.max; + this.onEmit = this.randomRangedValueEmit; + } + else if (t === 'object' && this.has(value, 'random')) + { + // { random: [ 100, 400 ] } = pick a random number between the two elements of the array + + var rnd = value.random; + + if (Array.isArray(rnd)) + { + this.start = rnd[0]; + this.end = rnd[1]; + } + + this.onEmit = this.randomRangedValueEmit; + } else if (t === 'object' && this.hasEither(value, 'onEmit', 'onUpdate')) { // Custom onEmit and onUpdate callbacks @@ -94166,7 +99275,7 @@ module.exports = EmitterOp; /***/ }), -/* 417 */ +/* 427 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94385,7 +99494,7 @@ module.exports = GravityWell; /***/ }), -/* 418 */ +/* 428 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94395,8 +99504,8 @@ module.exports = GravityWell; */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(41); -var DistanceBetween = __webpack_require__(55); +var DegToRad = __webpack_require__(34); +var DistanceBetween = __webpack_require__(61); /** * @classdesc @@ -94581,7 +99690,7 @@ var Particle = new Class({ * The tint applied to this Particle. * * @name Phaser.GameObjects.Particles.Particle#tint - * @type {integer} + * @type {number} * @webglOnly * @since 3.0.0 */ @@ -94691,11 +99800,6 @@ var Particle = new Class({ if (x === undefined) { - if (emitter.follow) - { - this.x += emitter.follow.x + emitter.followOffset.x; - } - this.x += emitter.x.onEmit(this, 'x'); } else @@ -94705,11 +99809,6 @@ var Particle = new Class({ if (y === undefined) { - if (emitter.follow) - { - this.y += emitter.follow.y + emitter.followOffset.y; - } - this.y += emitter.y.onEmit(this, 'y'); } else @@ -94954,7 +100053,7 @@ module.exports = Particle; /***/ }), -/* 419 */ +/* 429 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -94963,22 +100062,22 @@ module.exports = Particle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(54); +var BlendModes = __webpack_require__(48); var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DeathZone = __webpack_require__(420); -var EdgeZone = __webpack_require__(421); -var EmitterOp = __webpack_require__(416); +var DeathZone = __webpack_require__(430); +var EdgeZone = __webpack_require__(431); +var EmitterOp = __webpack_require__(426); var GetFastValue = __webpack_require__(2); -var GetRandom = __webpack_require__(196); -var HasAny = __webpack_require__(422); -var HasValue = __webpack_require__(115); -var Particle = __webpack_require__(418); -var RandomZone = __webpack_require__(423); +var GetRandom = __webpack_require__(201); +var HasAny = __webpack_require__(432); +var HasValue = __webpack_require__(123); +var Particle = __webpack_require__(428); +var RandomZone = __webpack_require__(433); var Rectangle = __webpack_require__(9); -var StableSort = __webpack_require__(139); +var StableSort = __webpack_require__(90); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * @classdesc @@ -95326,14 +100425,14 @@ var ParticleEmitter = new Class({ this.scaleY = new EmitterOp(config, 'scaleY', 1); /** - * Color tint applied to emitted particles. Any alpha component (0xAA000000) is ignored. + * Color tint applied to emitted particles. Value must not include the alpha channel. * * @name Phaser.GameObjects.Particles.ParticleEmitter#tint * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0xffffffff + * @default 0xffffff * @since 3.0.0 */ - this.tint = new EmitterOp(config, 'tint', 0xffffffff); + this.tint = new EmitterOp(config, 'tint', 0xffffff); /** * The alpha (transparency) of emitted particles. @@ -95423,7 +100522,7 @@ var ParticleEmitter = new Class({ * 0 means unlimited. * * @name Phaser.GameObjects.Particles.ParticleEmitter#maxParticles - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -95600,7 +100699,7 @@ var ParticleEmitter = new Class({ * The blend mode of this emitter's particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#blendMode - * @type {integer} + * @type {number} * @since 3.0.0 * @see Phaser.GameObjects.Particles.ParticleEmitter#setBlendMode */ @@ -95644,7 +100743,7 @@ var ParticleEmitter = new Class({ * The current texture frame, as an index of {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#currentFrame - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame @@ -95666,7 +100765,7 @@ var ParticleEmitter = new Class({ * The number of consecutive particles that receive a single texture frame (per frame cycle). * * @name Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity - * @type {integer} + * @type {number} * @default 1 * @since 3.0.0 * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame @@ -95708,7 +100807,7 @@ var ParticleEmitter = new Class({ * Counts up to {@link Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#_frameCounter - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -95822,6 +100921,11 @@ var ParticleEmitter = new Class({ this.setFrame(config.frame); } + if (HasValue(config, 'reserve')) + { + this.reserve(config.reserve); + } + return this; }, @@ -95964,9 +101068,9 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setFrame * @since 3.0.0 * - * @param {(array|string|integer|Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig)} frames - One or more texture frames, or a configuration object. + * @param {(array|string|number|Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig)} frames - One or more texture frames, or a configuration object. * @param {boolean} [pickRandom=true] - Whether frames should be assigned at random from `frames`. - * @param {integer} [quantity=1] - The number of consecutive particles that will receive each frame. + * @param {number} [quantity=1] - The number of consecutive particles that will receive each frame. * * @return {this} This Particle Emitter. */ @@ -96488,7 +101592,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#reserve * @since 3.0.0 * - * @param {integer} particleCount - The number of particles to create. + * @param {number} particleCount - The number of particles to create. * * @return {this} This Particle Emitter. */ @@ -96510,7 +101614,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#getAliveParticleCount * @since 3.0.0 * - * @return {integer} The number of particles with `active=true`. + * @return {number} The number of particles with `active=true`. */ getAliveParticleCount: function () { @@ -96523,7 +101627,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#getDeadParticleCount * @since 3.0.0 * - * @return {integer} The number of particles with `active=false`. + * @return {number} The number of particles with `active=false`. */ getDeadParticleCount: function () { @@ -96536,7 +101640,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#getParticleCount * @since 3.0.0 * - * @return {integer} The number of particles, including both alive and dead. + * @return {number} The number of particles, including both alive and dead. */ getParticleCount: function () { @@ -96818,7 +101922,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#explode * @since 3.0.0 * - * @param {integer} count - The amount of Particles to emit. + * @param {number} count - The amount of Particles to emit. * @param {number} x - The x coordinate to emit the Particles from. * @param {number} y - The y coordinate to emit the Particles from. * @@ -96839,7 +101943,7 @@ var ParticleEmitter = new Class({ * * @param {number} [x=this.x] - The x coordinate to emit the Particles from. * @param {number} [y=this.x] - The y coordinate to emit the Particles from. - * @param {integer} [count=this.quantity] - The number of Particles to emit. + * @param {number} [count=this.quantity] - The number of Particles to emit. * * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. */ @@ -96854,7 +101958,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticle * @since 3.0.0 * - * @param {integer} [count=this.quantity] - The number of Particles to emit. + * @param {number} [count=this.quantity] - The number of Particles to emit. * @param {number} [x=this.x] - The x coordinate to emit the Particles from. * @param {number} [y=this.x] - The y coordinate to emit the Particles from. * @@ -96916,7 +102020,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#preUpdate * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ preUpdate: function (time, delta) @@ -97012,7 +102116,7 @@ var ParticleEmitter = new Class({ * @param {object} a - The first particle. * @param {object} b - The second particle. * - * @return {integer} The difference of a and b's y coordinates. + * @return {number} The difference of a and b's y coordinates. */ depthSortCallback: function (a, b) { @@ -97025,7 +102129,7 @@ module.exports = ParticleEmitter; /***/ }), -/* 420 */ +/* 430 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97103,7 +102207,7 @@ module.exports = DeathZone; /***/ }), -/* 421 */ +/* 431 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97124,7 +102228,7 @@ var Class = __webpack_require__(0); * @since 3.0.0 * * @param {Phaser.Types.GameObjects.Particles.EdgeZoneSource} source - An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. - * @param {integer} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. + * @param {number} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. * @param {number} stepRate - The distance between each particle. When set, `quantity` is implied and should be set to 0. * @param {boolean} [yoyo=false] - Whether particles are placed from start to end and then end to start. * @param {boolean} [seamless=true] - Whether one endpoint will be removed if it's identical to the other. @@ -97161,7 +102265,7 @@ var EdgeZone = new Class({ * The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. * * @name Phaser.GameObjects.Particles.Zones.EdgeZone#quantity - * @type {integer} + * @type {number} * @since 3.0.0 */ this.quantity = quantity; @@ -97347,7 +102451,7 @@ module.exports = EdgeZone; /***/ }), -/* 422 */ +/* 432 */ /***/ (function(module, exports) { /** @@ -97384,7 +102488,7 @@ module.exports = HasAny; /***/ }), -/* 423 */ +/* 433 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97398,7 +102502,7 @@ var Vector2 = __webpack_require__(3); /** * @classdesc - * A zone that places particles randomly within a shape's area. + * A zone that places particles randomly within a shapes area. * * @class RandomZone * @memberof Phaser.GameObjects.Particles.Zones @@ -97457,7 +102561,7 @@ module.exports = RandomZone; /***/ }), -/* 424 */ +/* 434 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97468,7 +102572,7 @@ module.exports = RandomZone; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var Sprite = __webpack_require__(76); +var Sprite = __webpack_require__(70); /** * @classdesc @@ -97496,7 +102600,7 @@ var Sprite = __webpack_require__(76); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ var PathFollower = new Class({ @@ -97524,7 +102628,7 @@ var PathFollower = new Class({ * @protected * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ preUpdate: function (time, delta) @@ -97539,7 +102643,7 @@ module.exports = PathFollower; /***/ }), -/* 425 */ +/* 435 */ /***/ (function(module, exports) { /** @@ -97621,7 +102725,7 @@ module.exports = GetTextSize; /***/ }), -/* 426 */ +/* 436 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -97633,7 +102737,7 @@ module.exports = GetTextSize; var Class = __webpack_require__(0); var GetAdvancedValue = __webpack_require__(15); var GetValue = __webpack_require__(6); -var MeasureText = __webpack_require__(427); +var MeasureText = __webpack_require__(437); // Key: [ Object Key, Default Value ] @@ -97839,7 +102943,7 @@ var TextStyle = new Class({ * The maximum number of lines to draw. * * @name Phaser.GameObjects.TextStyle#maxLines - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -98656,7 +103760,7 @@ var TextStyle = new Class({ * @method Phaser.GameObjects.TextStyle#setMaxLines * @since 3.0.0 * - * @param {integer} [max=0] - The maximum number of lines to draw. + * @param {number} [max=0] - The maximum number of lines to draw. * * @return {Phaser.GameObjects.Text} The parent Text object. */ @@ -98727,7 +103831,7 @@ module.exports = TextStyle; /***/ }), -/* 427 */ +/* 437 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98736,7 +103840,7 @@ module.exports = TextStyle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); +var CanvasPool = __webpack_require__(31); /** * Calculates the ascent, descent and fontSize of a given font style. @@ -98750,15 +103854,28 @@ var CanvasPool = __webpack_require__(26); */ var MeasureText = function (textStyle) { - // @property {HTMLCanvasElement} canvas - The canvas element that the text is rendered. var canvas = CanvasPool.create(this); - - // @property {HTMLCanvasElement} context - The context of the canvas element that the text is rendered to. var context = canvas.getContext('2d'); textStyle.syncFont(canvas, context); - var width = Math.ceil(context.measureText(textStyle.testString).width * textStyle.baselineX); + var metrics = context.measureText(textStyle.testString); + + if (metrics.hasOwnProperty('actualBoundingBoxAscent')) + { + var ascent = metrics.actualBoundingBoxAscent; + var descent = metrics.actualBoundingBoxDescent; + + CanvasPool.remove(canvas); + + return { + ascent: ascent, + descent: descent, + fontSize: ascent + descent + }; + } + + var width = Math.ceil(metrics.width * textStyle.baselineX); var baseline = width; var height = 2 * baseline; @@ -98862,7 +103979,7 @@ module.exports = MeasureText; /***/ }), -/* 428 */ +/* 438 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -98871,13 +103988,13 @@ module.exports = MeasureText; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArcRender = __webpack_require__(1020); +var ArcRender = __webpack_require__(1080); var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(41); -var Earcut = __webpack_require__(60); -var GeomCircle = __webpack_require__(68); +var DegToRad = __webpack_require__(34); +var Earcut = __webpack_require__(65); +var GeomCircle = __webpack_require__(71); var MATH_CONST = __webpack_require__(13); -var Shape = __webpack_require__(30); +var Shape = __webpack_require__(33); /** * @classdesc @@ -98907,8 +104024,8 @@ var Shape = __webpack_require__(30); * @param {number} [x=0] - The horizontal position of this Game Object in the world. * @param {number} [y=0] - The vertical position of this Game Object in the world. * @param {number} [radius=128] - The radius of the arc. - * @param {integer} [startAngle=0] - The start angle of the arc, in degrees. - * @param {integer} [endAngle=360] - The end angle of the arc, in degrees. + * @param {number} [startAngle=0] - The start angle of the arc, in degrees. + * @param {number} [endAngle=360] - The end angle of the arc, in degrees. * @param {boolean} [anticlockwise=false] - The winding order of the start and end angles. * @param {number} [fillColor] - The color the arc will be filled with, i.e. 0xff0000 for red. * @param {number} [fillAlpha] - The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. @@ -98938,7 +104055,7 @@ var Arc = new Class({ * Private internal value. Holds the start angle in degrees. * * @name Phaser.GameObjects.Arc#_startAngle - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -98948,7 +104065,7 @@ var Arc = new Class({ * Private internal value. Holds the end angle in degrees. * * @name Phaser.GameObjects.Arc#_endAngle - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -99045,7 +104162,7 @@ var Arc = new Class({ * The start angle of the arc, in degrees. * * @name Phaser.GameObjects.Arc#startAngle - * @type {integer} + * @type {number} * @since 3.13.0 */ startAngle: { @@ -99068,7 +104185,7 @@ var Arc = new Class({ * The end angle of the arc, in degrees. * * @name Phaser.GameObjects.Arc#endAngle - * @type {integer} + * @type {number} * @since 3.13.0 */ endAngle: { @@ -99157,7 +104274,7 @@ var Arc = new Class({ * @method Phaser.GameObjects.Arc#setStartAngle * @since 3.13.0 * - * @param {integer} value - The value to set the starting angle to. + * @param {number} value - The value to set the starting angle to. * * @return {this} This Game Object instance. */ @@ -99180,7 +104297,7 @@ var Arc = new Class({ * @method Phaser.GameObjects.Arc#setEndAngle * @since 3.13.0 * - * @param {integer} value - The value to set the ending angle to. + * @param {number} value - The value to set the ending angle to. * * @return {this} This Game Object instance. */ @@ -99271,7 +104388,7 @@ module.exports = Arc; /***/ }), -/* 429 */ +/* 439 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99281,10 +104398,10 @@ module.exports = Arc; */ var Class = __webpack_require__(0); -var CurveRender = __webpack_require__(1023); -var Earcut = __webpack_require__(60); +var CurveRender = __webpack_require__(1083); +var Earcut = __webpack_require__(65); var Rectangle = __webpack_require__(9); -var Shape = __webpack_require__(30); +var Shape = __webpack_require__(33); /** * @classdesc @@ -99338,7 +104455,7 @@ var Curve = new Class({ * The number of points used to draw the curve. Higher values create smoother renders at the cost of more triangles being drawn. * * @name Phaser.GameObjects.Curve#_smoothness - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -99372,7 +104489,7 @@ var Curve = new Class({ * Increase this value for smoother curves, at the cost of more polygons being rendered. * * @name Phaser.GameObjects.Curve#smoothness - * @type {integer} + * @type {number} * @default 32 * @since 3.13.0 */ @@ -99400,7 +104517,7 @@ var Curve = new Class({ * @method Phaser.GameObjects.Curve#setSmoothness * @since 3.13.0 * - * @param {integer} value - The value to set the smoothness to. + * @param {number} value - The value to set the smoothness to. * * @return {this} This Game Object instance. */ @@ -99453,7 +104570,7 @@ module.exports = Curve; /***/ }), -/* 430 */ +/* 440 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99463,10 +104580,10 @@ module.exports = Curve; */ var Class = __webpack_require__(0); -var Earcut = __webpack_require__(60); -var EllipseRender = __webpack_require__(1026); -var GeomEllipse = __webpack_require__(98); -var Shape = __webpack_require__(30); +var Earcut = __webpack_require__(65); +var EllipseRender = __webpack_require__(1086); +var GeomEllipse = __webpack_require__(106); +var Shape = __webpack_require__(33); /** * @classdesc @@ -99524,7 +104641,7 @@ var Ellipse = new Class({ * The number of points used to draw the curve. Higher values create smoother renders at the cost of more triangles being drawn. * * @name Phaser.GameObjects.Ellipse#_smoothness - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -99549,7 +104666,7 @@ var Ellipse = new Class({ * Increase this value for a smoother ellipse, at the cost of more polygons being rendered. * * @name Phaser.GameObjects.Ellipse#smoothness - * @type {integer} + * @type {number} * @default 64 * @since 3.13.0 */ @@ -99583,6 +104700,9 @@ var Ellipse = new Class({ */ setSize: function (width, height) { + this.width = width; + this.height = height; + this.geom.setPosition(width / 2, height / 2); this.geom.setSize(width, height); return this.updateData(); @@ -99596,7 +104716,7 @@ var Ellipse = new Class({ * @method Phaser.GameObjects.Ellipse#setSmoothness * @since 3.13.0 * - * @param {integer} value - The value to set the smoothness to. + * @param {number} value - The value to set the smoothness to. * * @return {this} This Game Object instance. */ @@ -99640,7 +104760,7 @@ module.exports = Ellipse; /***/ }), -/* 431 */ +/* 441 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99650,8 +104770,8 @@ module.exports = Ellipse; */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(30); -var GridRender = __webpack_require__(1029); +var Shape = __webpack_require__(33); +var GridRender = __webpack_require__(1089); /** * @classdesc @@ -99797,7 +104917,11 @@ var Grid = new Class({ this.setSize(width, height); this.setFillStyle(fillColor, fillAlpha); - this.setOutlineStyle(outlineFillColor, outlineFillAlpha); + + if (outlineFillColor !== undefined) + { + this.setOutlineStyle(outlineFillColor, outlineFillAlpha); + } this.updateDisplayOrigin(); }, @@ -99915,7 +105039,7 @@ module.exports = Grid; /***/ }), -/* 432 */ +/* 442 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -99924,9 +105048,9 @@ module.exports = Grid; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var IsoBoxRender = __webpack_require__(1032); +var IsoBoxRender = __webpack_require__(1092); var Class = __webpack_require__(0); -var Shape = __webpack_require__(30); +var Shape = __webpack_require__(33); /** * @classdesc @@ -99985,7 +105109,7 @@ var IsoBox = new Class({ * The projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. * * @name Phaser.GameObjects.IsoBox#projection - * @type {integer} + * @type {number} * @default 4 * @since 3.13.0 */ @@ -100063,7 +105187,7 @@ var IsoBox = new Class({ * @method Phaser.GameObjects.IsoBox#setProjection * @since 3.13.0 * - * @param {integer} value - The value to set the projection to. + * @param {number} value - The value to set the projection to. * * @return {this} This Game Object instance. */ @@ -100130,7 +105254,7 @@ module.exports = IsoBox; /***/ }), -/* 433 */ +/* 443 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100140,8 +105264,8 @@ module.exports = IsoBox; */ var Class = __webpack_require__(0); -var IsoTriangleRender = __webpack_require__(1035); -var Shape = __webpack_require__(30); +var IsoTriangleRender = __webpack_require__(1095); +var Shape = __webpack_require__(33); /** * @classdesc @@ -100203,7 +105327,7 @@ var IsoTriangle = new Class({ * The projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. * * @name Phaser.GameObjects.IsoTriangle#projection - * @type {integer} + * @type {number} * @default 4 * @since 3.13.0 */ @@ -100291,7 +105415,7 @@ var IsoTriangle = new Class({ * @method Phaser.GameObjects.IsoTriangle#setProjection * @since 3.13.0 * - * @param {integer} value - The value to set the projection to. + * @param {number} value - The value to set the projection to. * * @return {this} This Game Object instance. */ @@ -100376,7 +105500,7 @@ module.exports = IsoTriangle; /***/ }), -/* 434 */ +/* 444 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100386,9 +105510,9 @@ module.exports = IsoTriangle; */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(30); -var GeomLine = __webpack_require__(40); -var LineRender = __webpack_require__(1038); +var Shape = __webpack_require__(33); +var GeomLine = __webpack_require__(45); +var LineRender = __webpack_require__(1098); /** * @classdesc @@ -100396,13 +105520,13 @@ var LineRender = __webpack_require__(1038); * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling * it for input or physics. It provides a quick and easy way for you to render this shape in your * game without using a texture, while still taking advantage of being fully batched in WebGL. - * + * * This shape supports only stroke colors and cannot be filled. - * + * * A Line Shape allows you to draw a line between two points in your game. You can control the * stroke color and thickness of the line. In WebGL only you can also specify a different * thickness for the start and end of the line, allowing you to render lines that taper-off. - * + * * If you need to draw multiple lines in a sequence you may wish to use the Polygon Shape instead. * * Be aware that as with all Game Objects the default origin is 0.5. If you need to draw a Line @@ -100445,8 +105569,8 @@ var Line = new Class({ Shape.call(this, scene, 'Line', new GeomLine(x1, y1, x2, y2)); - var width = this.geom.right - this.geom.left; - var height = this.geom.bottom - this.geom.top; + var width = Math.max(1, this.geom.right - this.geom.left); + var height = Math.max(1, this.geom.bottom - this.geom.top); /** * The width (or thickness) of the line. @@ -100491,15 +105615,15 @@ var Line = new Class({ /** * Sets the width of the line. - * + * * When using the WebGL renderer you can have different start and end widths. * When using the Canvas renderer only the `startWidth` value is used. The `endWidth` is ignored. - * + * * This call can be chained. * * @method Phaser.GameObjects.Line#setLineWidth * @since 3.13.0 - * + * * @param {number} startWidth - The start width of the line. * @param {number} [endWidth] - The end width of the line. Only used in WebGL. * @@ -100543,7 +105667,7 @@ module.exports = Line; /***/ }), -/* 435 */ +/* 445 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100552,13 +105676,13 @@ module.exports = Line; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PolygonRender = __webpack_require__(1041); +var PolygonRender = __webpack_require__(1101); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(60); -var GetAABB = __webpack_require__(436); -var GeomPolygon = __webpack_require__(212); -var Shape = __webpack_require__(30); -var Smooth = __webpack_require__(439); +var Earcut = __webpack_require__(65); +var GetAABB = __webpack_require__(446); +var GeomPolygon = __webpack_require__(218); +var Shape = __webpack_require__(33); +var Smooth = __webpack_require__(449); /** * @classdesc @@ -100633,7 +105757,7 @@ var Polygon = new Class({ * @method Phaser.GameObjects.Polygon#smooth * @since 3.13.0 * - * @param {integer} [iterations=1] - The number of times to apply the polygon smoothing. + * @param {number} [iterations=1] - The number of times to apply the polygon smoothing. * * @return {this} This Game Object instance. */ @@ -100682,7 +105806,7 @@ module.exports = Polygon; /***/ }), -/* 436 */ +/* 446 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100738,7 +105862,7 @@ module.exports = GetAABB; /***/ }), -/* 437 */ +/* 447 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100747,9 +105871,9 @@ module.exports = GetAABB; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); -var Line = __webpack_require__(40); -var Perimeter = __webpack_require__(438); +var Length = __webpack_require__(63); +var Line = __webpack_require__(45); +var Perimeter = __webpack_require__(448); /** * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, @@ -100759,7 +105883,7 @@ var Perimeter = __webpack_require__(438); * @since 3.12.0 * * @param {Phaser.Geom.Polygon} polygon - The Polygon to get the points from. - * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. * @param {number} [stepRate] - Sets the quantity by getting the perimeter of the Polygon and dividing it by the stepRate. * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. * @@ -100815,7 +105939,7 @@ module.exports = GetPoints; /***/ }), -/* 438 */ +/* 448 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100824,8 +105948,8 @@ module.exports = GetPoints; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); -var Line = __webpack_require__(40); +var Length = __webpack_require__(63); +var Line = __webpack_require__(45); /** * Returns the perimeter of the given Polygon. @@ -100863,7 +105987,7 @@ module.exports = Perimeter; /***/ }), -/* 439 */ +/* 449 */ /***/ (function(module, exports) { /** @@ -100939,7 +106063,7 @@ module.exports = Smooth; /***/ }), -/* 440 */ +/* 450 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -100950,8 +106074,8 @@ module.exports = Smooth; var Class = __webpack_require__(0); var GeomRectangle = __webpack_require__(9); -var Shape = __webpack_require__(30); -var RectangleRender = __webpack_require__(1044); +var Shape = __webpack_require__(33); +var RectangleRender = __webpack_require__(1104); /** * @classdesc @@ -101082,7 +106206,7 @@ module.exports = Rectangle; /***/ }), -/* 441 */ +/* 451 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101091,10 +106215,10 @@ module.exports = Rectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var StarRender = __webpack_require__(1047); +var StarRender = __webpack_require__(1107); var Class = __webpack_require__(0); -var Earcut = __webpack_require__(60); -var Shape = __webpack_require__(30); +var Earcut = __webpack_require__(65); +var Shape = __webpack_require__(33); /** * @classdesc @@ -101153,7 +106277,7 @@ var Star = new Class({ * The number of points in the star. * * @name Phaser.GameObjects.Star#_points - * @type {integer} + * @type {number} * @private * @since 3.13.0 */ @@ -101200,7 +106324,7 @@ var Star = new Class({ * @method Phaser.GameObjects.Star#setPoints * @since 3.13.0 * - * @param {integer} value - The amount of points the Star will have. + * @param {number} value - The amount of points the Star will have. * * @return {this} This Game Object instance. */ @@ -101251,7 +106375,7 @@ var Star = new Class({ * The number of points that make up the Star shape. * * @name Phaser.GameObjects.Star#points - * @type {integer} + * @type {number} * @default 5 * @since 3.13.0 */ @@ -101370,7 +106494,7 @@ module.exports = Star; /***/ }), -/* 442 */ +/* 452 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101380,9 +106504,9 @@ module.exports = Star; */ var Class = __webpack_require__(0); -var Shape = __webpack_require__(30); -var GeomTriangle = __webpack_require__(73); -var TriangleRender = __webpack_require__(1050); +var Shape = __webpack_require__(33); +var GeomTriangle = __webpack_require__(80); +var TriangleRender = __webpack_require__(1110); /** * @classdesc @@ -101513,7 +106637,7 @@ module.exports = Triangle; /***/ }), -/* 443 */ +/* 453 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101523,7 +106647,7 @@ module.exports = Triangle; */ var Point = __webpack_require__(4); -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); /** * Returns a Point from around the perimeter of a Triangle. @@ -101600,7 +106724,7 @@ module.exports = GetPoint; /***/ }), -/* 444 */ +/* 454 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101609,7 +106733,7 @@ module.exports = GetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); var Point = __webpack_require__(4); /** @@ -101621,7 +106745,7 @@ var Point = __webpack_require__(4); * @generic {Phaser.Geom.Point} O - [out,$return] * * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the points from. - * @param {integer} quantity - The number of evenly spaced points to return. Set to 0 to return an arbitrary number of points based on the `stepRate`. + * @param {number} quantity - The number of evenly spaced points to return. Set to 0 to return an arbitrary number of points based on the `stepRate`. * @param {number} stepRate - If `quantity` is 0, the distance between each returned point. * @param {(array|Phaser.Geom.Point[])} [out] - An array to which the points should be appended. * @@ -101693,7 +106817,7 @@ module.exports = GetPoints; /***/ }), -/* 445 */ +/* 455 */ /***/ (function(module, exports) { /** @@ -101776,7 +106900,342 @@ module.exports = SetValue; /***/ }), -/* 446 */ +/* 456 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Face = __webpack_require__(111); +var Vertex = __webpack_require__(113); + +/** + * Generates a set of Face and Vertex objects by parsing the given data. + * + * This method will take vertex data in one of two formats, based on the `containsZ` parameter. + * + * If your vertex data are `x`, `y` pairs, then `containsZ` should be `false` (this is the default) + * + * If your vertex data is groups of `x`, `y` and `z` values, then the `containsZ` parameter must be true. + * + * The `uvs` parameter is a numeric array consisting of `u` and `v` pairs. + * + * The `normals` parameter is a numeric array consisting of `x`, `y` vertex normal values and, if `containsZ` is true, `z` values as well. + * + * The `indicies` parameter is an optional array that, if given, is an indexed list of vertices to be added. + * + * The `colors` parameter is an optional array, or single value, that if given sets the color of each vertex created. + * + * The `alphas` parameter is an optional array, or single value, that if given sets the alpha of each vertex created. + * + * When providing indexed data it is assumed that _all_ of the arrays are indexed, not just the vertices. + * + * The following example will create a 256 x 256 sized quad using an index array: + * + * ```javascript + * const vertices = [ + * -128, 128, + * 128, 128, + * -128, -128, + * 128, -128 + * ]; + * + * const uvs = [ + * 0, 1, + * 1, 1, + * 0, 0, + * 1, 0 + * ]; + * + * const indices = [ 0, 2, 1, 2, 3, 1 ]; + * + * GenerateVerts(vertices, uvs, indicies); + * ``` + * + * If the data is not indexed, it's assumed that the arrays all contain sequential data. + * + * @function Phaser.Geom.Mesh.GenerateVerts + * @since 3.50.0 + * + * @param {number[]} vertices - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} uvs - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + * + * @return {Phaser.Types.Geom.Mesh.GenerateVertsResult} The parsed Face and Vertex objects. + */ +var GenerateVerts = function (vertices, uvs, indicies, containsZ, normals, colors, alphas) +{ + if (containsZ === undefined) { containsZ = false; } + if (colors === undefined) { colors = 0xffffff; } + if (alphas === undefined) { alphas = 1; } + + if (vertices.length !== uvs.length) + { + console.warn('GenerateVerts: vertices and uvs count not equal'); + return; + } + + var result = { + faces: [], + verts: [] + }; + + var i; + + var x; + var y; + var z; + + var u; + var v; + + var color; + var alpha; + + var normalX; + var normalY; + var normalZ; + + var iInc = (containsZ) ? 3 : 2; + + var isColorArray = Array.isArray(colors); + var isAlphaArray = Array.isArray(alphas); + + if (Array.isArray(indicies) && indicies.length > 0) + { + for (i = 0; i < indicies.length; i++) + { + var index1 = indicies[i]; + var index2 = indicies[i] * 2; + var index3 = indicies[i] * iInc; + + x = vertices[index3]; + y = vertices[index3 + 1]; + z = (containsZ) ? vertices[index3 + 2] : 0; + + u = uvs[index2]; + v = uvs[index2 + 1]; + + color = (isColorArray) ? colors[index1] : colors; + alpha = (isAlphaArray) ? alphas[index1] : alphas; + + normalX = 0; + normalY = 0; + normalZ = 0; + + if (normals) + { + normalX = normals[index3]; + normalY = normals[index3 + 1]; + normalZ = (containsZ) ? normals[index3 + 2] : 0; + } + + result.verts.push(new Vertex(x, y, z, u, v, color, alpha, normalX, normalY, normalZ)); + } + } + else + { + var uvIndex = 0; + var colorIndex = 0; + + for (i = 0; i < vertices.length; i += iInc) + { + x = vertices[i]; + y = vertices[i + 1]; + z = (containsZ) ? vertices[i + 2] : 0; + + u = uvs[uvIndex]; + v = uvs[uvIndex + 1]; + + color = (isColorArray) ? colors[colorIndex] : colors; + alpha = (isAlphaArray) ? alphas[colorIndex] : alphas; + + normalX = 0; + normalY = 0; + normalZ = 0; + + if (normals) + { + normalX = normals[i]; + normalY = normals[i + 1]; + normalZ = (containsZ) ? normals[i + 2] : 0; + } + + result.verts.push(new Vertex(x, y, z, u, v, color, alpha, normalX, normalY, normalZ)); + + uvIndex += 2; + colorIndex++; + } + } + + for (i = 0; i < result.verts.length; i += 3) + { + var vert1 = result.verts[i]; + var vert2 = result.verts[i + 1]; + var vert3 = result.verts[i + 2]; + + result.faces.push(new Face(vert1, vert2, vert3)); + } + + return result; +}; + +module.exports = GenerateVerts; + + +/***/ }), +/* 457 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Face = __webpack_require__(111); +var Matrix4 = __webpack_require__(73); +var Vector3 = __webpack_require__(37); +var Vertex = __webpack_require__(113); + +var tempPosition = new Vector3(); +var tempRotation = new Vector3(); +var tempMatrix = new Matrix4(); + +/** + * This method will return an object containing Face and Vertex instances, generated + * from the parsed triangulated OBJ Model data given to this function. + * + * The obj data should have been parsed in advance via the ParseObj function: + * + * ```javascript + * var data = Phaser.Geom.Mesh.ParseObj(rawData, flipUV); + * + * var results = GenerateObjVerts(data); + * ``` + * + * Alternatively, you can parse obj files loaded via the OBJFile loader: + * + * ```javascript + * preload () + * { + * this.load.obj('alien', 'assets/3d/alien.obj); + * } + * + * var results = GenerateObjVerts(this.cache.obj.get('alien)); + * ``` + * + * Make sure your 3D package has triangulated the model data prior to exporting it. + * + * You can use the data returned by this function to populate the vertices of a Mesh Game Object. + * + * You may add multiple models to a single Mesh, although they will act as one when + * moved or rotated. You can scale the model data, should it be too small (or large) to visualize. + * You can also offset the model via the `x`, `y` and `z` parameters. + * + * @function Phaser.Geom.Mesh.GenerateObjVerts + * @since 3.50.0 + * + * @param {Phaser.Types.Geom.Mesh.OBJData} data - The parsed OBJ model data. + * @param {Phaser.GameObjects.Mesh} [mesh] - An optional Mesh Game Object. If given, the generated Faces will be automatically added to this Mesh. Set to `null` to skip. + * @param {number} [scale=1] - An amount to scale the model data by. Use this if the model has exported too small, or large, to see. + * @param {number} [x=0] - Translate the model x position by this amount. + * @param {number} [y=0] - Translate the model y position by this amount. + * @param {number} [z=0] - Translate the model z position by this amount. + * @param {number} [rotateX=0] - Rotate the model on the x axis by this amount, in radians. + * @param {number} [rotateY=0] - Rotate the model on the y axis by this amount, in radians. + * @param {number} [rotateZ=0] - Rotate the model on the z axis by this amount, in radians. + * @param {boolean} [zIsUp=true] - Is the z axis up (true), or is y axis up (false)? + * + * @return {Phaser.Types.Geom.Mesh.GenerateVertsResult} The parsed Face and Vertex objects. + */ +var GenerateObjVerts = function (data, mesh, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp) +{ + if (scale === undefined) { scale = 1; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (z === undefined) { z = 0; } + if (rotateX === undefined) { rotateX = 0; } + if (rotateY === undefined) { rotateY = 0; } + if (rotateZ === undefined) { rotateZ = 0; } + if (zIsUp === undefined) { zIsUp = true; } + + var result = { + faces: [], + verts: [] + }; + + var materials = data.materials; + + tempPosition.set(x, y, z); + tempRotation.set(rotateX, rotateY, rotateZ); + tempMatrix.fromRotationXYTranslation(tempRotation, tempPosition, zIsUp); + + for (var m = 0; m < data.models.length; m++) + { + var model = data.models[m]; + + var vertices = model.vertices; + var textureCoords = model.textureCoords; + var faces = model.faces; + + for (var i = 0; i < faces.length; i++) + { + var face = faces[i]; + + var v1 = face.vertices[0]; + var v2 = face.vertices[1]; + var v3 = face.vertices[2]; + + var m1 = vertices[v1.vertexIndex]; + var m2 = vertices[v2.vertexIndex]; + var m3 = vertices[v3.vertexIndex]; + + var t1 = v1.textureCoordsIndex; + var t2 = v2.textureCoordsIndex; + var t3 = v3.textureCoordsIndex; + + var uv1 = (t1 === -1) ? { u: 0, v: 1 } : textureCoords[t1]; + var uv2 = (t2 === -1) ? { u: 0, v: 0 } : textureCoords[t2]; + var uv3 = (t3 === -1) ? { u: 1, v: 1 } : textureCoords[t3]; + + var color = 0xffffff; + + if (face.material !== '' && materials[face.material]) + { + color = materials[face.material]; + } + + var vert1 = new Vertex(m1.x * scale, m1.y * scale, m1.z * scale, uv1.u, uv1.v, color).transformMat4(tempMatrix); + var vert2 = new Vertex(m2.x * scale, m2.y * scale, m2.z * scale, uv2.u, uv2.v, color).transformMat4(tempMatrix); + var vert3 = new Vertex(m3.x * scale, m3.y * scale, m3.z * scale, uv3.u, uv3.v, color).transformMat4(tempMatrix); + + result.verts.push(vert1, vert2, vert3); + result.faces.push(new Face(vert1, vert2, vert3)); + } + } + + if (mesh) + { + mesh.faces = mesh.faces.concat(result.faces); + mesh.vertices = mesh.vertices.concat(result.verts); + } + + return result; +}; + +module.exports = GenerateObjVerts; + + +/***/ }), +/* 458 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -101786,7 +107245,7 @@ module.exports = SetValue; */ var Class = __webpack_require__(0); -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * @classdesc @@ -102267,7 +107726,7 @@ module.exports = Light; /***/ }), -/* 447 */ +/* 459 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102277,8 +107736,9 @@ module.exports = Light; */ var Class = __webpack_require__(0); -var Light = __webpack_require__(446); -var Utils = __webpack_require__(10); +var Light = __webpack_require__(458); +var Utils = __webpack_require__(12); +var PointLight = __webpack_require__(1169); /** * @callback LightForEach @@ -102361,13 +107821,18 @@ var LightsManager = new Class({ * Change this via the `maxLights` property in your game config, as it cannot be changed at runtime. * * @name Phaser.GameObjects.LightsManager#maxLights - * @type {integer} + * @type {number} * @readonly * @since 3.15.0 */ this.maxLights = -1; }, + addPointLight: function (x, y, color, radius, intensity) + { + return this.systems.displayList.add(new PointLight(this.scene, x, y, color, radius, intensity)); + }, + /** * Enable the Lights Manager. * @@ -102380,7 +107845,7 @@ var LightsManager = new Class({ { if (this.maxLights === -1) { - this.maxLights = this.scene.sys.game.renderer.config.maxLights; + this.maxLights = this.scene.sys.renderer.config.maxLights; } this.active = true; @@ -102504,7 +107969,7 @@ var LightsManager = new Class({ * @method Phaser.GameObjects.LightsManager#getMaxVisibleLights * @since 3.0.0 * - * @return {integer} The maximum number of Lights allowed to appear at once. + * @return {number} The maximum number of Lights allowed to appear at once. */ getMaxVisibleLights: function () { @@ -102517,7 +107982,7 @@ var LightsManager = new Class({ * @method Phaser.GameObjects.LightsManager#getLightCount * @since 3.0.0 * - * @return {integer} The number of Lights managed by this Lights Manager. + * @return {number} The number of Lights managed by this Lights Manager. */ getLightCount: function () { @@ -102636,7 +108101,7 @@ module.exports = LightsManager; /***/ }), -/* 448 */ +/* 460 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102645,23 +108110,24 @@ module.exports = LightsManager; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(49); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(55); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Geom */ var Geom = { - - Circle: __webpack_require__(1110), - Ellipse: __webpack_require__(1120), - Intersects: __webpack_require__(449), - Line: __webpack_require__(1140), - Point: __webpack_require__(1162), - Polygon: __webpack_require__(1176), - Rectangle: __webpack_require__(465), - Triangle: __webpack_require__(1209) + + Circle: __webpack_require__(1171), + Ellipse: __webpack_require__(1181), + Intersects: __webpack_require__(461), + Line: __webpack_require__(1201), + Mesh: __webpack_require__(1223), + Point: __webpack_require__(1226), + Polygon: __webpack_require__(1240), + Rectangle: __webpack_require__(479), + Triangle: __webpack_require__(1273) }; @@ -102672,7 +108138,7 @@ module.exports = Geom; /***/ }), -/* 449 */ +/* 461 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102687,39 +108153,39 @@ module.exports = Geom; module.exports = { - CircleToCircle: __webpack_require__(216), - CircleToRectangle: __webpack_require__(217), - GetCircleToCircle: __webpack_require__(1130), - GetCircleToRectangle: __webpack_require__(1131), - GetLineToCircle: __webpack_require__(218), - GetLineToLine: __webpack_require__(450), - GetLineToPoints: __webpack_require__(451), - GetLineToPolygon: __webpack_require__(452), - GetLineToRectangle: __webpack_require__(220), - GetRaysFromPointToPolygon: __webpack_require__(1132), - GetRectangleIntersection: __webpack_require__(1133), - GetRectangleToRectangle: __webpack_require__(1134), - GetRectangleToTriangle: __webpack_require__(1135), - GetTriangleToCircle: __webpack_require__(1136), - GetTriangleToLine: __webpack_require__(457), - GetTriangleToTriangle: __webpack_require__(1137), - LineToCircle: __webpack_require__(219), - LineToLine: __webpack_require__(86), - LineToRectangle: __webpack_require__(453), - PointToLine: __webpack_require__(461), - PointToLineSegment: __webpack_require__(1138), - RectangleToRectangle: __webpack_require__(143), - RectangleToTriangle: __webpack_require__(454), - RectangleToValues: __webpack_require__(1139), - TriangleToCircle: __webpack_require__(456), - TriangleToLine: __webpack_require__(458), - TriangleToTriangle: __webpack_require__(459) + CircleToCircle: __webpack_require__(222), + CircleToRectangle: __webpack_require__(223), + GetCircleToCircle: __webpack_require__(1191), + GetCircleToRectangle: __webpack_require__(1192), + GetLineToCircle: __webpack_require__(224), + GetLineToLine: __webpack_require__(462), + GetLineToPoints: __webpack_require__(463), + GetLineToPolygon: __webpack_require__(464), + GetLineToRectangle: __webpack_require__(226), + GetRaysFromPointToPolygon: __webpack_require__(1193), + GetRectangleIntersection: __webpack_require__(1194), + GetRectangleToRectangle: __webpack_require__(1195), + GetRectangleToTriangle: __webpack_require__(1196), + GetTriangleToCircle: __webpack_require__(1197), + GetTriangleToLine: __webpack_require__(469), + GetTriangleToTriangle: __webpack_require__(1198), + LineToCircle: __webpack_require__(225), + LineToLine: __webpack_require__(91), + LineToRectangle: __webpack_require__(465), + PointToLine: __webpack_require__(473), + PointToLineSegment: __webpack_require__(1199), + RectangleToRectangle: __webpack_require__(112), + RectangleToTriangle: __webpack_require__(466), + RectangleToValues: __webpack_require__(1200), + TriangleToCircle: __webpack_require__(468), + TriangleToLine: __webpack_require__(470), + TriangleToTriangle: __webpack_require__(471) }; /***/ }), -/* 450 */ +/* 462 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102728,7 +108194,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector3 = __webpack_require__(81); +var Vector3 = __webpack_require__(37); /** * Checks for intersection between the two line segments and returns the intersection point as a Vector3, @@ -102748,23 +108214,35 @@ var Vector3 = __webpack_require__(81); */ var GetLineToLine = function (line1, line2, out) { - var dx1 = line1.x2 - line1.x1; - var dy1 = line1.y2 - line1.y1; + var x1 = line1.x1; + var y1 = line1.y1; + var x2 = line1.x2; + var y2 = line1.y2; - var dx2 = line2.x2 - line2.x1; - var dy2 = line2.y2 - line2.y1; + var x3 = line2.x1; + var y3 = line2.y1; + var x4 = line2.x2; + var y4 = line2.y2; - var mag1 = Math.sqrt(dx1 * dx1 + dy1 * dy1); - var mag2 = Math.sqrt(dx2 * dx2 + dy2 * dy2); + var dx1 = x2 - x1; + var dy1 = y2 - y1; - // Parallel? - if (dx1 / mag1 === dx2 / mag2 && dy1 / mag1 === dy2 / mag2) + var dx2 = x4 - x3; + var dy2 = y4 - y3; + + var denom = dy2 * dx1 - dx2 * dy1; + + // Make sure there is not a division by zero - this also indicates that the lines are parallel. + // If numA and numB were both equal to zero the lines would be on top of each other (coincidental). + // This check is not done because it is not necessary for this implementation (the parallel check accounts for this). + + if (dx1 === 0 || denom === 0) { - return null; + return false; } - var T2 = (dx1 * (line2.y1 - line1.y1) + dy1 * (line1.x1 - line2.x1)) / (dx2 * dy1 - dy2 * dx1); - var T1 = (line2.x1 + dx2 * T2 - line1.x1) / dx1; + var T2 = (dx1 * (y3 - y1) + dy1 * (x1 - x3)) / (dx2 * dy1 - dy2 * dx1); + var T1 = (x3 + dx2 * T2 - x1) / dx1; // Intersects? if (T1 < 0 || T2 < 0 || T2 > 1) @@ -102778,8 +108256,8 @@ var GetLineToLine = function (line1, line2, out) } return out.set( - line1.x1 + dx1 * T1, - line1.y1 + dy1 * T1, + x1 + dx1 * T1, + y1 + dy1 * T1, T1 ); }; @@ -102788,7 +108266,7 @@ module.exports = GetLineToLine; /***/ }), -/* 451 */ +/* 463 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102797,9 +108275,9 @@ module.exports = GetLineToLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector3 = __webpack_require__(81); -var GetLineToLine = __webpack_require__(450); -var Line = __webpack_require__(40); +var Vector3 = __webpack_require__(37); +var GetLineToLine = __webpack_require__(462); +var Line = __webpack_require__(45); // Temp calculation segment var segment = new Line(); @@ -102865,7 +108343,7 @@ module.exports = GetLineToPoints; /***/ }), -/* 452 */ +/* 464 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -102874,9 +108352,9 @@ module.exports = GetLineToPoints; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector3 = __webpack_require__(81); -var Vector4 = __webpack_require__(129); -var GetLineToPoints = __webpack_require__(451); +var Vector3 = __webpack_require__(37); +var Vector4 = __webpack_require__(135); +var GetLineToPoints = __webpack_require__(463); // Temp vec3 var tempIntersect = new Vector3(); @@ -102936,7 +108414,7 @@ module.exports = GetLineToPolygon; /***/ }), -/* 453 */ +/* 465 */ /***/ (function(module, exports) { /** @@ -103037,7 +108515,7 @@ module.exports = LineToRectangle; /***/ }), -/* 454 */ +/* 466 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103046,10 +108524,10 @@ module.exports = LineToRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LineToLine = __webpack_require__(86); -var Contains = __webpack_require__(50); -var ContainsArray = __webpack_require__(221); -var Decompose = __webpack_require__(455); +var LineToLine = __webpack_require__(91); +var Contains = __webpack_require__(56); +var ContainsArray = __webpack_require__(227); +var Decompose = __webpack_require__(467); /** * Checks for intersection between Rectangle shape and Triangle shape. @@ -103130,7 +108608,7 @@ module.exports = RectangleToTriangle; /***/ }), -/* 455 */ +/* 467 */ /***/ (function(module, exports) { /** @@ -103167,7 +108645,7 @@ module.exports = Decompose; /***/ }), -/* 456 */ +/* 468 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103176,8 +108654,8 @@ module.exports = Decompose; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LineToCircle = __webpack_require__(219); -var Contains = __webpack_require__(85); +var LineToCircle = __webpack_require__(225); +var Contains = __webpack_require__(110); /** * Checks if a Triangle and a Circle intersect. @@ -103232,7 +108710,7 @@ module.exports = TriangleToCircle; /***/ }), -/* 457 */ +/* 469 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103243,8 +108721,8 @@ module.exports = TriangleToCircle; */ var Point = __webpack_require__(4); -var TriangleToLine = __webpack_require__(458); -var LineToLine = __webpack_require__(86); +var TriangleToLine = __webpack_require__(470); +var LineToLine = __webpack_require__(91); /** * Checks if a Triangle and a Line intersect, and returns the intersection points as a Point object array. @@ -103291,7 +108769,7 @@ module.exports = GetTriangleToLine; /***/ }), -/* 458 */ +/* 470 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103300,12 +108778,11 @@ module.exports = GetTriangleToLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(85); -var LineToLine = __webpack_require__(86); +var LineToLine = __webpack_require__(91); /** * Checks if a Triangle and a Line intersect. - * + * * The Line intersects the Triangle if it starts inside of it, ends inside of it, or crosses any of the Triangle's sides. Thus, the Triangle is considered "solid". * * @function Phaser.Geom.Intersects.TriangleToLine @@ -103319,7 +108796,7 @@ var LineToLine = __webpack_require__(86); var TriangleToLine = function (triangle, line) { // If the Triangle contains either the start or end point of the line, it intersects - if (Contains(triangle, line.getPointA()) || Contains(triangle, line.getPointB())) + if (triangle.contains(line.x1, line.y1) || triangle.contains(line.x2, line.y2)) { return true; } @@ -103347,7 +108824,7 @@ module.exports = TriangleToLine; /***/ }), -/* 459 */ +/* 471 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103356,9 +108833,9 @@ module.exports = TriangleToLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ContainsArray = __webpack_require__(221); -var Decompose = __webpack_require__(460); -var LineToLine = __webpack_require__(86); +var ContainsArray = __webpack_require__(227); +var Decompose = __webpack_require__(472); +var LineToLine = __webpack_require__(91); /** * Checks if two Triangles intersect. @@ -103437,7 +108914,7 @@ module.exports = TriangleToTriangle; /***/ }), -/* 460 */ +/* 472 */ /***/ (function(module, exports) { /** @@ -103472,7 +108949,7 @@ module.exports = Decompose; /***/ }), -/* 461 */ +/* 473 */ /***/ (function(module, exports) { /** @@ -103542,7 +109019,7 @@ module.exports = PointToLine; /***/ }), -/* 462 */ +/* 474 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103552,8 +109029,8 @@ module.exports = PointToLine; */ var MATH_CONST = __webpack_require__(13); -var Wrap = __webpack_require__(59); -var Angle = __webpack_require__(87); +var Wrap = __webpack_require__(64); +var Angle = __webpack_require__(92); /** * Get the angle of the normal of the given line in radians. @@ -103576,7 +109053,401 @@ module.exports = NormalAngle; /***/ }), -/* 463 */ +/* 475 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var flip = true; + +var defaultModelName = 'untitled'; +var currentGroup = ''; +var currentMaterial = ''; + +/** + * @ignore + */ +function stripComments (line) +{ + var idx = line.indexOf('#'); + + return (idx > -1) ? line.substring(0, idx) : line; +} + +/** + * @ignore + */ +function currentModel (result) +{ + if (result.models.length === 0) + { + result.models.push({ + faces: [], + name: defaultModelName, + textureCoords: [], + vertexNormals: [], + vertices: [] + }); + } + + currentGroup = ''; + + return result.models[result.models.length - 1]; +} + +/** + * @ignore + */ +function parseObject (lineItems, result) +{ + var modelName = lineItems.length >= 2 ? lineItems[1] : defaultModelName; + + result.models.push({ + faces: [], + name: modelName, + textureCoords: [], + vertexNormals: [], + vertices: [] + }); + + currentGroup = ''; +} + +/** + * @ignore + */ +function parseGroup (lineItems) +{ + if (lineItems.length === 2) + { + currentGroup = lineItems[1]; + } +} + +/** + * @ignore + */ +function parseVertexCoords (lineItems, result) +{ + var len = lineItems.length; + + var x = (len >= 2) ? parseFloat(lineItems[1]) : 0; + var y = (len >= 3) ? parseFloat(lineItems[2]) : 0; + var z = (len >= 4) ? parseFloat(lineItems[3]) : 0; + + currentModel(result).vertices.push({ x: x, y: y, z: z }); +} + +/** + * @ignore + */ +function parseTextureCoords (lineItems, result) +{ + var len = lineItems.length; + + var u = (len >= 2) ? parseFloat(lineItems[1]) : 0; + var v = (len >= 3) ? parseFloat(lineItems[2]) : 0; + var w = (len >= 4) ? parseFloat(lineItems[3]) : 0; + + if (isNaN(u)) + { + u = 0; + } + + if (isNaN(v)) + { + v = 0; + } + + if (isNaN(w)) + { + w = 0; + } + + if (flip) + { + v = 1 - v; + } + + currentModel(result).textureCoords.push({ u: u, v: v, w: w }); +} + +/** + * @ignore + */ +function parseVertexNormal (lineItems, result) +{ + var len = lineItems.length; + + var x = (len >= 2) ? parseFloat(lineItems[1]) : 0; + var y = (len >= 3) ? parseFloat(lineItems[2]) : 0; + var z = (len >= 4) ? parseFloat(lineItems[3]) : 0; + + currentModel(result).vertexNormals.push({ x: x, y: y, z: z }); +} + +/** + * @ignore + */ +function parsePolygon (lineItems, result) +{ + var totalVertices = lineItems.length - 1; + + if (totalVertices < 3) + { + return; + } + + var face = { + group: currentGroup, + material: currentMaterial, + vertices: [] + }; + + for (var i = 0; i < totalVertices; i++) + { + var vertexString = lineItems[i + 1]; + var vertexValues = vertexString.split('/'); + var vvLen = vertexValues.length; + + if (vvLen < 1 || vvLen > 3) + { + continue; + } + + var vertexIndex = 0; + var textureCoordsIndex = 0; + var vertexNormalIndex = 0; + + vertexIndex = parseInt(vertexValues[0], 10); + + if (vvLen > 1 && vertexValues[1] !== '') + { + textureCoordsIndex = parseInt(vertexValues[1], 10); + } + + if (vvLen > 2) + { + vertexNormalIndex = parseInt(vertexValues[2], 10); + } + + if (vertexIndex !== 0) + { + // Negative vertex indices refer to the nth last defined vertex + // convert these to postive indices for simplicity + if (vertexIndex < 0) + { + vertexIndex = currentModel(result).vertices.length + 1 + vertexIndex; + } + + textureCoordsIndex -= 1; + vertexIndex -= 1; + vertexNormalIndex -= 1; + + face.vertices.push({ + textureCoordsIndex: textureCoordsIndex, + vertexIndex: vertexIndex, + vertexNormalIndex: vertexNormalIndex + }); + } + } + + currentModel(result).faces.push(face); +} + +/** + * @ignore + */ +function parseMtlLib (lineItems, result) +{ + if (lineItems.length >= 2) + { + result.materialLibraries.push(lineItems[1]); + } +} + +/** + * @ignore + */ +function parseUseMtl (lineItems) +{ + if (lineItems.length >= 2) + { + currentMaterial = lineItems[1]; + } +} + +/** + * Parses a Wavefront OBJ File, extracting the models from it and returning them in an array. + * + * The model data *must* be triangulated for a Mesh Game Object to be able to render it. + * + * @function Phaser.Geom.Mesh.ParseObj + * @since 3.50.0 + * + * @param {string} data - The OBJ File data as a raw string. + * @param {boolean} [flipUV=true] - Flip the UV coordinates? + * + * @return {Phaser.Types.Geom.Mesh.OBJData} The parsed model and material data. + */ +var ParseObj = function (data, flipUV) +{ + if (flipUV === undefined) { flipUV = true; } + + flip = flipUV; + + // Store results in here + var result = { + materials: {}, + materialLibraries: [], + models: [] + }; + + currentGroup = ''; + currentMaterial = ''; + + var lines = data.split('\n'); + + for (var i = 0; i < lines.length; i++) + { + var line = stripComments(lines[i]); + + var lineItems = line.replace(/\s\s+/g, ' ').trim().split(' '); + + switch (lineItems[0].toLowerCase()) + { + case 'o': + // Start A New Model + parseObject(lineItems, result); + break; + + case 'g': + // Start a new polygon group + parseGroup(lineItems); + break; + + case 'v': + // Define a vertex for the current model + parseVertexCoords(lineItems, result); + break; + + case 'vt': + // Texture Coords + parseTextureCoords(lineItems, result); + break; + + case 'vn': + // Define a vertex normal for the current model + parseVertexNormal(lineItems, result); + break; + + case 'f': + // Define a Face/Polygon + parsePolygon(lineItems, result); + break; + + case 'mtllib': + // Reference to a material library file (.mtl) + parseMtlLib(lineItems, result); + break; + + case 'usemtl': + // Sets the current material to be applied to polygons defined from this point forward + parseUseMtl(lineItems); + break; + } + } + + return result; +}; + +module.exports = ParseObj; + + +/***/ }), +/* 476 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetColor = __webpack_require__(100); + +/** + * Takes a Wavefront Material file and extracts the diffuse reflectivity of the named + * materials, converts them to integer color values and returns them. + * + * This is used internally by the `addOBJ` and `addModel` methods, but is exposed for + * public consumption as well. + * + * Note this only works with diffuse values, specified in the `Kd r g b` format, where + * `g` and `b` are optional, but `r` is required. It does not support spectral rfl files, + * or any other material statement (such as `Ka` or `Ks`) + * + * @method Phaser.Geom.Mesh.ParseObjMaterial + * @since 3.50.0 + * + * @param {string} mtl - The OBJ MTL file as a raw string, i.e. loaded via `this.load.text`. + * + * @return {object} The parsed material colors, where each property of the object matches the material name. + */ +var ParseObjMaterial = function (mtl) +{ + var output = {}; + + var lines = mtl.split('\n'); + + var currentMaterial = ''; + + for (var i = 0; i < lines.length; i++) + { + var line = lines[i].trim(); + + if (line.indexOf('#') === 0 || line === '') + { + continue; + } + + var lineItems = line.replace(/\s\s+/g, ' ').trim().split(' '); + + switch (lineItems[0].toLowerCase()) + { + case 'newmtl': + { + currentMaterial = lineItems[1]; + break; + } + + // The diffuse reflectivity of the current material + // Support r, [g], [b] format, where g and b are optional + case 'kd': + { + var r = Math.floor(lineItems[1] * 255); + var g = (lineItems.length >= 2) ? Math.floor(lineItems[2] * 255) : r; + var b = (lineItems.length >= 3) ? Math.floor(lineItems[3] * 255) : r; + + output[currentMaterial] = GetColor(r, g, b); + + break; + } + } + } + + return output; +}; + +module.exports = ParseObjMaterial; + + +/***/ }), +/* 477 */ /***/ (function(module, exports) { /** @@ -103604,7 +109475,7 @@ module.exports = GetMagnitude; /***/ }), -/* 464 */ +/* 478 */ /***/ (function(module, exports) { /** @@ -103632,7 +109503,7 @@ module.exports = GetMagnitudeSq; /***/ }), -/* 465 */ +/* 479 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103643,50 +109514,50 @@ module.exports = GetMagnitudeSq; var Rectangle = __webpack_require__(9); -Rectangle.Area = __webpack_require__(1183); -Rectangle.Ceil = __webpack_require__(1184); -Rectangle.CeilAll = __webpack_require__(1185); -Rectangle.CenterOn = __webpack_require__(178); -Rectangle.Clone = __webpack_require__(1186); -Rectangle.Contains = __webpack_require__(50); -Rectangle.ContainsPoint = __webpack_require__(1187); -Rectangle.ContainsRect = __webpack_require__(466); -Rectangle.CopyFrom = __webpack_require__(1188); -Rectangle.Decompose = __webpack_require__(455); -Rectangle.Equals = __webpack_require__(1189); -Rectangle.FitInside = __webpack_require__(1190); -Rectangle.FitOutside = __webpack_require__(1191); -Rectangle.Floor = __webpack_require__(1192); -Rectangle.FloorAll = __webpack_require__(1193); -Rectangle.FromPoints = __webpack_require__(186); -Rectangle.FromXY = __webpack_require__(1194); -Rectangle.GetAspectRatio = __webpack_require__(223); -Rectangle.GetCenter = __webpack_require__(1195); -Rectangle.GetPoint = __webpack_require__(161); -Rectangle.GetPoints = __webpack_require__(283); -Rectangle.GetSize = __webpack_require__(1196); -Rectangle.Inflate = __webpack_require__(1197); -Rectangle.Intersection = __webpack_require__(1198); -Rectangle.MarchingAnts = __webpack_require__(294); -Rectangle.MergePoints = __webpack_require__(1199); -Rectangle.MergeRect = __webpack_require__(1200); -Rectangle.MergeXY = __webpack_require__(1201); -Rectangle.Offset = __webpack_require__(1202); -Rectangle.OffsetPoint = __webpack_require__(1203); -Rectangle.Overlaps = __webpack_require__(1204); -Rectangle.Perimeter = __webpack_require__(118); -Rectangle.PerimeterPoint = __webpack_require__(1205); -Rectangle.Random = __webpack_require__(164); -Rectangle.RandomOutside = __webpack_require__(1206); -Rectangle.SameDimensions = __webpack_require__(1207); -Rectangle.Scale = __webpack_require__(1208); -Rectangle.Union = __webpack_require__(408); +Rectangle.Area = __webpack_require__(1247); +Rectangle.Ceil = __webpack_require__(1248); +Rectangle.CeilAll = __webpack_require__(1249); +Rectangle.CenterOn = __webpack_require__(182); +Rectangle.Clone = __webpack_require__(1250); +Rectangle.Contains = __webpack_require__(56); +Rectangle.ContainsPoint = __webpack_require__(1251); +Rectangle.ContainsRect = __webpack_require__(480); +Rectangle.CopyFrom = __webpack_require__(1252); +Rectangle.Decompose = __webpack_require__(467); +Rectangle.Equals = __webpack_require__(1253); +Rectangle.FitInside = __webpack_require__(1254); +Rectangle.FitOutside = __webpack_require__(1255); +Rectangle.Floor = __webpack_require__(1256); +Rectangle.FloorAll = __webpack_require__(1257); +Rectangle.FromPoints = __webpack_require__(191); +Rectangle.FromXY = __webpack_require__(1258); +Rectangle.GetAspectRatio = __webpack_require__(229); +Rectangle.GetCenter = __webpack_require__(1259); +Rectangle.GetPoint = __webpack_require__(162); +Rectangle.GetPoints = __webpack_require__(298); +Rectangle.GetSize = __webpack_require__(1260); +Rectangle.Inflate = __webpack_require__(1261); +Rectangle.Intersection = __webpack_require__(1262); +Rectangle.MarchingAnts = __webpack_require__(308); +Rectangle.MergePoints = __webpack_require__(1263); +Rectangle.MergeRect = __webpack_require__(1264); +Rectangle.MergeXY = __webpack_require__(1265); +Rectangle.Offset = __webpack_require__(1266); +Rectangle.OffsetPoint = __webpack_require__(1267); +Rectangle.Overlaps = __webpack_require__(1268); +Rectangle.Perimeter = __webpack_require__(126); +Rectangle.PerimeterPoint = __webpack_require__(1269); +Rectangle.Random = __webpack_require__(165); +Rectangle.RandomOutside = __webpack_require__(1270); +Rectangle.SameDimensions = __webpack_require__(1271); +Rectangle.Scale = __webpack_require__(1272); +Rectangle.Union = __webpack_require__(418); module.exports = Rectangle; /***/ }), -/* 466 */ +/* 480 */ /***/ (function(module, exports) { /** @@ -103726,7 +109597,7 @@ module.exports = ContainsRect; /***/ }), -/* 467 */ +/* 481 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103770,7 +109641,7 @@ module.exports = Centroid; /***/ }), -/* 468 */ +/* 482 */ /***/ (function(module, exports) { /** @@ -103811,7 +109682,7 @@ module.exports = Offset; /***/ }), -/* 469 */ +/* 483 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -103876,7 +109747,7 @@ module.exports = InCenter; /***/ }), -/* 470 */ +/* 484 */ /***/ (function(module, exports) { /** @@ -103894,7 +109765,7 @@ module.exports = InCenter; * @since 3.10.0 * * @param {Phaser.Textures.TextureManager} textureManager - A reference to the Texture Manager. - * @param {integer} alphaTolerance - The alpha level that the pixel should be above to be included as a successful interaction. + * @param {number} alphaTolerance - The alpha level that the pixel should be above to be included as a successful interaction. * * @return {function} The new Pixel Perfect Handler function. */ @@ -103912,7 +109783,7 @@ module.exports = CreatePixelPerfectHandler; /***/ }), -/* 471 */ +/* 485 */ /***/ (function(module, exports) { /** @@ -103983,7 +109854,7 @@ module.exports = CreateInteractiveObject; /***/ }), -/* 472 */ +/* 486 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104005,7 +109876,7 @@ var Class = __webpack_require__(0); * @since 3.0.0 * * @param {Phaser.Input.Gamepad.Gamepad} pad - A reference to the Gamepad that this Axis belongs to. - * @param {integer} index - The index of this Axis. + * @param {number} index - The index of this Axis. */ var Axis = new Class({ @@ -104035,7 +109906,7 @@ var Axis = new Class({ * The index of this Axis. * * @name Phaser.Input.Gamepad.Axis#index - * @type {integer} + * @type {number} * @since 3.0.0 */ this.index = index; @@ -104108,7 +109979,7 @@ module.exports = Axis; /***/ }), -/* 473 */ +/* 487 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104118,7 +109989,7 @@ module.exports = Axis; */ var Class = __webpack_require__(0); -var Events = __webpack_require__(225); +var Events = __webpack_require__(231); /** * @classdesc @@ -104131,7 +110002,7 @@ var Events = __webpack_require__(225); * @since 3.0.0 * * @param {Phaser.Input.Gamepad.Gamepad} pad - A reference to the Gamepad that this Button belongs to. - * @param {integer} index - The index of this Button. + * @param {number} index - The index of this Button. */ var Button = new Class({ @@ -104161,7 +110032,7 @@ var Button = new Class({ * The index of this Button. * * @name Phaser.Input.Gamepad.Button#index - * @type {integer} + * @type {number} * @since 3.0.0 */ this.index = index; @@ -104254,7 +110125,7 @@ module.exports = Button; /***/ }), -/* 474 */ +/* 488 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -104263,10 +110134,10 @@ module.exports = Button; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Axis = __webpack_require__(472); -var Button = __webpack_require__(473); +var Axis = __webpack_require__(486); +var Button = __webpack_require__(487); var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); +var EventEmitter = __webpack_require__(10); var Vector2 = __webpack_require__(3); /** @@ -104572,6 +110443,16 @@ var Gamepad = new Class({ * @since 3.10.0 */ this.rightStick = new Vector2(); + + /** + * When was this Gamepad created? Used to avoid duplicate event spamming in the update loop. + * + * @name Phaser.Input.Gamepad.Gamepad#_created + * @type {number} + * @private + * @since 3.50.0 + */ + this._created = performance.now(); }, /** @@ -104580,7 +110461,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#getAxisTotal * @since 3.10.0 * - * @return {integer} The total number of axes this Gamepad claims to support. + * @return {number} The total number of axes this Gamepad claims to support. */ getAxisTotal: function () { @@ -104595,7 +110476,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#getAxisValue * @since 3.10.0 * - * @param {integer} index - The index of the axes to get the value for. + * @param {number} index - The index of the axes to get the value for. * * @return {number} The value of the axis, between 0 and 1. */ @@ -104627,7 +110508,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#getButtonTotal * @since 3.10.0 * - * @return {integer} The total number of buttons this Gamepad claims to have. + * @return {number} The total number of buttons this Gamepad claims to have. */ getButtonTotal: function () { @@ -104644,7 +110525,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#getButtonValue * @since 3.10.0 * - * @param {integer} index - The index of the button to get the value for. + * @param {number} index - The index of the button to get the value for. * * @return {number} The value of the button, between 0 and 1. */ @@ -104660,7 +110541,7 @@ var Gamepad = new Class({ * @method Phaser.Input.Gamepad.Gamepad#isButtonDown * @since 3.10.0 * - * @param {integer} index - The index of the button to get the value for. + * @param {number} index - The index of the button to get the value for. * * @return {boolean} `true` if the button is considered as being pressed down, otherwise `false`. */ @@ -104679,6 +110560,11 @@ var Gamepad = new Class({ */ update: function (pad) { + if (pad.timestamp < this._created) + { + return; + } + var i; // Sync the button values @@ -105012,7 +110898,7 @@ module.exports = Gamepad; /***/ }), -/* 475 */ +/* 489 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105022,8 +110908,8 @@ module.exports = Gamepad; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(145); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(147); /** * @classdesc @@ -105037,7 +110923,7 @@ var Events = __webpack_require__(145); * @since 3.0.0 * * @param {Phaser.Input.Keyboard.KeyboardPlugin} plugin - The Keyboard Plugin instance that owns this Key object. - * @param {integer} keyCode - The keycode of this key. + * @param {number} keyCode - The keycode of this key. */ var Key = new Class({ @@ -105062,7 +110948,7 @@ var Key = new Class({ * The keycode of this key. * * @name Phaser.Input.Keyboard.Key#keyCode - * @type {integer} + * @type {number} * @since 3.0.0 */ this.keyCode = keyCode; @@ -105414,7 +111300,7 @@ module.exports = Key; /***/ }), -/* 476 */ +/* 490 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105424,10 +111310,10 @@ module.exports = Key; */ var Class = __webpack_require__(0); -var Events = __webpack_require__(145); +var Events = __webpack_require__(147); var GetFastValue = __webpack_require__(2); -var ProcessKeyCombo = __webpack_require__(1247); -var ResetKeyCombo = __webpack_require__(1249); +var ProcessKeyCombo = __webpack_require__(491); +var ResetKeyCombo = __webpack_require__(493); /** * @classdesc @@ -105464,7 +111350,7 @@ var ResetKeyCombo = __webpack_require__(1249); * @since 3.0.0 * * @param {Phaser.Input.Keyboard.KeyboardPlugin} keyboardPlugin - A reference to the Keyboard Plugin. - * @param {(string|integer[]|object[])} keys - The keys that comprise this combo. + * @param {(string|number[]|object[])} keys - The keys that comprise this combo. * @param {Phaser.Types.Input.Keyboard.KeyComboConfig} [config] - A Key Combo configuration object. */ var KeyCombo = new Class({ @@ -105534,7 +111420,7 @@ var KeyCombo = new Class({ * The current keyCode the combo is waiting for. * * @name Phaser.Input.Keyboard.KeyCombo#current - * @type {integer} + * @type {number} * @since 3.0.0 */ this.current = this.keyCodes[0]; @@ -105543,7 +111429,7 @@ var KeyCombo = new Class({ * The current index of the key being waited for in the 'keys' string. * * @name Phaser.Input.Keyboard.KeyCombo#index - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -105602,7 +111488,7 @@ var KeyCombo = new Class({ * The max delay in ms between each key press. Above this the combo is reset. 0 means disabled. * * @name Phaser.Input.Keyboard.KeyCombo#maxKeyDelay - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -105707,7 +111593,7 @@ module.exports = KeyCombo; /***/ }), -/* 477 */ +/* 491 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105716,7 +111602,165 @@ module.exports = KeyCombo; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MergeXHRSettings = __webpack_require__(226); +var AdvanceKeyCombo = __webpack_require__(492); + +/** + * Used internally by the KeyCombo class. + * + * @function Phaser.Input.Keyboard.ProcessKeyCombo + * @private + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native Keyboard Event. + * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to be processed. + * + * @return {boolean} `true` if the combo was matched, otherwise `false`. + */ +var ProcessKeyCombo = function (event, combo) +{ + if (combo.matched) + { + return true; + } + + var comboMatched = false; + var keyMatched = false; + + if (event.keyCode === combo.current) + { + // Key was correct + + if (combo.index > 0 && combo.maxKeyDelay > 0) + { + // We have to check to see if the delay between + // the new key and the old one was too long (if enabled) + + var timeLimit = combo.timeLastMatched + combo.maxKeyDelay; + + // Check if they pressed it in time or not + if (event.timeStamp <= timeLimit) + { + keyMatched = true; + comboMatched = AdvanceKeyCombo(event, combo); + } + } + else + { + keyMatched = true; + + // We don't check the time for the first key pressed, so just advance it + comboMatched = AdvanceKeyCombo(event, combo); + } + } + + if (!keyMatched && combo.resetOnWrongKey) + { + // Wrong key was pressed + combo.index = 0; + combo.current = combo.keyCodes[0]; + } + + if (comboMatched) + { + combo.timeLastMatched = event.timeStamp; + combo.matched = true; + combo.timeMatched = event.timeStamp; + } + + return comboMatched; +}; + +module.exports = ProcessKeyCombo; + + +/***/ }), +/* 492 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Used internally by the KeyCombo class. + * Return `true` if it reached the end of the combo, `false` if not. + * + * @function Phaser.Input.Keyboard.AdvanceKeyCombo + * @private + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native Keyboard Event. + * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to advance. + * + * @return {boolean} `true` if it reached the end of the combo, `false` if not. + */ +var AdvanceKeyCombo = function (event, combo) +{ + combo.timeLastMatched = event.timeStamp; + combo.index++; + + if (combo.index === combo.size) + { + return true; + } + else + { + combo.current = combo.keyCodes[combo.index]; + return false; + } +}; + +module.exports = AdvanceKeyCombo; + + +/***/ }), +/* 493 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Used internally by the KeyCombo class. + * + * @function Phaser.Input.Keyboard.ResetKeyCombo + * @private + * @since 3.0.0 + * + * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo to reset. + * + * @return {Phaser.Input.Keyboard.KeyCombo} The KeyCombo. + */ +var ResetKeyCombo = function (combo) +{ + combo.current = combo.keyCodes[0]; + combo.index = 0; + combo.timeLastMatched = 0; + combo.matched = false; + combo.timeMatched = 0; + + return combo; +}; + +module.exports = ResetKeyCombo; + + +/***/ }), +/* 494 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var MergeXHRSettings = __webpack_require__(232); /** * Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings @@ -105788,7 +111832,7 @@ module.exports = XHRLoader; /***/ }), -/* 478 */ +/* 495 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -105798,11 +111842,11 @@ module.exports = XHRLoader; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var HTML5AudioFile = __webpack_require__(479); +var HTML5AudioFile = __webpack_require__(496); var IsPlainObject = __webpack_require__(7); /** @@ -105915,7 +111959,7 @@ AudioFile.create = function (loader, key, urls, config, xhrSettings) // https://developers.google.com/web/updates/2012/02/HTML5-audio-and-the-Web-Audio-API-are-BFFs // var stream = GetFastValue(config, 'stream', false); - if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) + if (deviceAudio.webAudio && !audioConfig.disableWebAudio) { return new AudioFile(loader, key, urlConfig, xhrSettings, game.sound.context); } @@ -106024,7 +112068,7 @@ FileTypesManager.register('audio', function (key, urls, config, xhrSettings) var audioConfig = game.config.audio; var deviceAudio = game.device.audio; - if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) { // Sounds are disabled, so skip loading audio return this; @@ -106062,7 +112106,7 @@ module.exports = AudioFile; /***/ }), -/* 479 */ +/* 496 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106072,10 +112116,10 @@ module.exports = AudioFile; */ var Class = __webpack_require__(0); -var Events = __webpack_require__(84); +var Events = __webpack_require__(89); var File = __webpack_require__(22); var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(146); +var GetURL = __webpack_require__(148); var IsPlainObject = __webpack_require__(7); /** @@ -106265,7 +112309,7 @@ module.exports = HTML5AudioFile; /***/ }), -/* 480 */ +/* 497 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106275,7 +112319,7 @@ module.exports = HTML5AudioFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -106436,7 +112480,7 @@ module.exports = ScriptFile; /***/ }), -/* 481 */ +/* 498 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106445,187 +112489,12 @@ module.exports = ScriptFile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var ArcadeImage = __webpack_require__(499); +var ArcadeSprite = __webpack_require__(150); var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); -var File = __webpack_require__(22); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); - -/** - * @classdesc - * A single Text File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#text method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#text. - * - * @class TextFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var TextFile = new Class({ - - Extends: File, - - initialize: - - function TextFile (loader, key, url, xhrSettings) - { - var extension = 'txt'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - } - - var fileConfig = { - type: 'text', - cache: loader.cacheManager.text, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; - - File.call(this, loader, fileConfig); - }, - - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.TextFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; - - this.data = this.xhrLoader.responseText; - - this.onProcessComplete(); - } - -}); - -/** - * Adds a Text file, or array of Text files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.text('story', 'files/IntroStory.txt'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Text Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Text Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Text Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.text({ - * key: 'story', - * url: 'files/IntroStory.txt' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.TextFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.text('story', 'files/IntroStory.txt'); - * // and later in your game ... - * var data = this.cache.text.get('story'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and - * this is what you would use to retrieve the text from the Text Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" - * and no URL is given then the Loader will set the URL to be "story.txt". It will always add `.txt` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Text File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#text - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('text', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new TextFile(this, key[i])); - } - } - else - { - this.addFile(new TextFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = TextFile; - - -/***/ }), -/* 482 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var ArcadeImage = __webpack_require__(483); -var ArcadeSprite = __webpack_require__(148); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); -var PhysicsGroup = __webpack_require__(485); -var StaticPhysicsGroup = __webpack_require__(486); +var CONST = __webpack_require__(59); +var PhysicsGroup = __webpack_require__(501); +var StaticPhysicsGroup = __webpack_require__(502); /** * @classdesc @@ -106742,7 +112611,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.Types.Physics.Arcade.ImageWithStaticBody} The Image object that was created. */ @@ -106766,7 +112635,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.Types.Physics.Arcade.ImageWithDynamicBody} The Image object that was created. */ @@ -106790,7 +112659,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.Types.Physics.Arcade.SpriteWithStaticBody} The Sprite object that was created. */ @@ -106815,7 +112684,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.Types.Physics.Arcade.SpriteWithDynamicBody} The Sprite object that was created. */ @@ -106884,7 +112753,7 @@ module.exports = Factory; /***/ }), -/* 483 */ +/* 499 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -106894,8 +112763,8 @@ module.exports = Factory; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(228); -var Image = __webpack_require__(114); +var Components = __webpack_require__(235); +var Image = __webpack_require__(122); /** * @classdesc @@ -106920,6 +112789,7 @@ var Image = __webpack_require__(114); * @extends Phaser.Physics.Arcade.Components.Gravity * @extends Phaser.Physics.Arcade.Components.Immovable * @extends Phaser.Physics.Arcade.Components.Mass + * @extends Phaser.Physics.Arcade.Components.Pushable * @extends Phaser.Physics.Arcade.Components.Size * @extends Phaser.Physics.Arcade.Components.Velocity * @extends Phaser.GameObjects.Components.Alpha @@ -106940,7 +112810,7 @@ var Image = __webpack_require__(114); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ var ArcadeImage = new Class({ @@ -106957,6 +112827,7 @@ var ArcadeImage = new Class({ Components.Gravity, Components.Immovable, Components.Mass, + Components.Pushable, Components.Size, Components.Velocity ], @@ -106984,13 +112855,13 @@ module.exports = ArcadeImage; /***/ }), -/* 484 */ +/* 500 */ /***/ (function(module, exports, __webpack_require__) { -var OverlapRect = __webpack_require__(229); -var Circle = __webpack_require__(68); -var CircleToCircle = __webpack_require__(216); -var CircleToRectangle = __webpack_require__(217); +var OverlapRect = __webpack_require__(236); +var Circle = __webpack_require__(71); +var CircleToCircle = __webpack_require__(222); +var CircleToRectangle = __webpack_require__(223); /** * This method will search the given circular area and return an array of all physics bodies that @@ -107052,7 +112923,7 @@ module.exports = OverlapCirc; /***/ }), -/* 485 */ +/* 501 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107061,11 +112932,11 @@ module.exports = OverlapCirc; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArcadeSprite = __webpack_require__(148); +var ArcadeSprite = __webpack_require__(150); var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); +var CONST = __webpack_require__(59); var GetFastValue = __webpack_require__(2); -var Group = __webpack_require__(100); +var Group = __webpack_require__(108); var IsPlainObject = __webpack_require__(7); /** @@ -107170,7 +113041,7 @@ var PhysicsGroup = new Class({ * The physics type of the Group's members. * * @name Phaser.Physics.Arcade.Group#physicsType - * @type {integer} + * @type {number} * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 */ @@ -107202,6 +113073,8 @@ var PhysicsGroup = new Class({ setGravityY: GetFastValue(config, 'gravityY', 0), setFrictionX: GetFastValue(config, 'frictionX', 0), setFrictionY: GetFastValue(config, 'frictionY', 0), + setMaxVelocityX: GetFastValue(config, 'maxVelocityX', 10000), + setMaxVelocityY: GetFastValue(config, 'maxVelocityY', 10000), setVelocityX: GetFastValue(config, 'velocityX', 0), setVelocityY: GetFastValue(config, 'velocityY', 0), setAngularVelocity: GetFastValue(config, 'angularVelocity', 0), @@ -107346,7 +113219,7 @@ module.exports = PhysicsGroup; /***/ }), -/* 486 */ +/* 502 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107355,11 +113228,11 @@ module.exports = PhysicsGroup; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArcadeSprite = __webpack_require__(148); +var ArcadeSprite = __webpack_require__(150); var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); +var CONST = __webpack_require__(59); var GetFastValue = __webpack_require__(2); -var Group = __webpack_require__(100); +var Group = __webpack_require__(108); var IsPlainObject = __webpack_require__(7); /** @@ -107445,7 +113318,7 @@ var StaticPhysicsGroup = new Class({ * The scene this group belongs to. * * @name Phaser.Physics.Arcade.StaticGroup#physicsType - * @type {integer} + * @type {number} * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ @@ -107545,7 +113418,7 @@ module.exports = StaticPhysicsGroup; /***/ }), -/* 487 */ +/* 503 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -107554,35 +113427,36 @@ module.exports = StaticPhysicsGroup; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AngleBetweenPoints = __webpack_require__(331); -var Body = __webpack_require__(488); -var Clamp = __webpack_require__(17); +var AngleBetweenPoints = __webpack_require__(342); +var Body = __webpack_require__(504); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Collider = __webpack_require__(489); -var CONST = __webpack_require__(52); -var DistanceBetween = __webpack_require__(55); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(230); -var FuzzyEqual = __webpack_require__(109); -var FuzzyGreaterThan = __webpack_require__(335); -var FuzzyLessThan = __webpack_require__(336); -var GetOverlapX = __webpack_require__(231); -var GetOverlapY = __webpack_require__(232); +var Collider = __webpack_require__(505); +var CONST = __webpack_require__(59); +var DistanceBetween = __webpack_require__(61); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(237); +var FuzzyEqual = __webpack_require__(121); +var FuzzyGreaterThan = __webpack_require__(346); +var FuzzyLessThan = __webpack_require__(347); +var GetOverlapX = __webpack_require__(238); +var GetOverlapY = __webpack_require__(239); +var GetTilesWithinWorldXY = __webpack_require__(506); var GetValue = __webpack_require__(6); var MATH_CONST = __webpack_require__(13); -var ProcessQueue = __webpack_require__(197); -var ProcessTileCallbacks = __webpack_require__(490); +var ProcessQueue = __webpack_require__(202); +var ProcessTileCallbacks = __webpack_require__(507); var Rectangle = __webpack_require__(9); -var RTree = __webpack_require__(491); -var SeparateTile = __webpack_require__(492); -var SeparateX = __webpack_require__(497); -var SeparateY = __webpack_require__(498); -var Set = __webpack_require__(141); -var StaticBody = __webpack_require__(499); -var TileIntersectsBody = __webpack_require__(233); -var TransformMatrix = __webpack_require__(31); +var RTree = __webpack_require__(508); +var SeparateTile = __webpack_require__(509); +var SeparateX = __webpack_require__(514); +var SeparateY = __webpack_require__(515); +var Set = __webpack_require__(145); +var StaticBody = __webpack_require__(516); +var TileIntersectsBody = __webpack_require__(240); +var TransformMatrix = __webpack_require__(24); var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * @classdesc @@ -107871,7 +113745,7 @@ var World = new Class({ * to allow more items per node and less node division. * * @name Phaser.Physics.Arcade.World#maxEntries - * @type {integer} + * @type {number} * @default 16 * @since 3.0.0 */ @@ -107981,7 +113855,7 @@ var World = new Class({ * @since 3.0.0 * * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object - The object, or objects, on which to create the bodies. - * @param {integer} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. + * @param {number} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. */ enable: function (object, bodyType) { @@ -108048,7 +113922,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.GameObject} object - The Game Object on which to create the body. - * @param {integer} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. + * @param {number} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. * * @return {Phaser.GameObjects.GameObject} The Game Object on which the body was created. */ @@ -108444,7 +114318,7 @@ var World = new Class({ * @method Phaser.Physics.Arcade.World#setFPS * @since 3.10.0 * - * @param {integer} framerate - The frame rate to advance the simulation at. + * @param {number} framerate - The frame rate to advance the simulation at. * * @return {this} This World object. */ @@ -108532,7 +114406,7 @@ var World = new Class({ } } - this.emit(Events.WORLD_STEP); + this.emit(Events.WORLD_STEP, fixedDelta); } // Process any additional steps this frame @@ -108591,7 +114465,7 @@ var World = new Class({ } } - this.emit(Events.WORLD_STEP); + this.emit(Events.WORLD_STEP, delta); this.stepsLastFrame++; }, @@ -108797,6 +114671,7 @@ var World = new Class({ if (useDamping) { // Damping based deceleration + dragX = Math.pow(dragX, delta); velocityX *= dragX; @@ -108836,6 +114711,8 @@ var World = new Class({ if (useDamping) { // Damping based deceleration + dragY = Math.pow(dragY, delta); + velocityY *= dragY; speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY); @@ -109016,9 +114893,6 @@ var World = new Class({ */ separateCircle: function (body1, body2, overlapOnly, bias) { - body1.updateCenter(); - body2.updateCenter(); - // Set the bounding box overlap values into the bodies themselves (hence we don't use the return values here) GetOverlapX(body1, body2, false, bias); GetOverlapY(body1, body2, false, bias); @@ -109070,6 +114944,9 @@ var World = new Class({ overlap = (body1.halfWidth + body2.halfWidth) - DistanceBetween(body1.center.x, body1.center.y, body2.center.x, body2.center.y); } + body1.overlapR = overlap; + body2.overlapR = overlap; + // Can't separate two immovable bodies, or a body with its own custom separation logic if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateX || body2.customSeparateX) { @@ -109597,10 +115474,10 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.Group} group - The first object to check for collision. - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. + * @param {ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. + * @param {ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} callbackContext - The context in which to run the callbacks. * @param {boolean} overlapOnly - Whether this is a collision or overlap check. * * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. @@ -109715,7 +115592,7 @@ var World = new Class({ * @since 3.0.0 * * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {any} [callbackContext] - The context in which to run the callbacks. @@ -109737,9 +115614,6 @@ var World = new Class({ var w = body.width; var h = body.height; - // TODO: this logic should be encapsulated within the Tilemap API at some point. - // If the maps base tile size differs from the layer's tile size, we need to adjust the - // selection area by the difference between the two. var layerData = tilemapLayer.layer; if (layerData.tileWidth > layerData.baseTileWidth) @@ -109757,7 +115631,7 @@ var World = new Class({ h += yDiff; } - var mapData = tilemapLayer.getTilesWithinWorldXY(x, y, w, h); + var mapData = GetTilesWithinWorldXY(x, y, w, h, null, tilemapLayer.scene.cameras.main, tilemapLayer.layer); if (mapData.length === 0) { @@ -109780,7 +115654,7 @@ var World = new Class({ * @since 3.17.0 * * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {any} [callbackContext] - The context in which to run the callbacks. @@ -109804,11 +115678,13 @@ var World = new Class({ tilemapLayer = tile.tilemapLayer; - tileWorldRect.left = tilemapLayer.tileToWorldX(tile.x); - tileWorldRect.top = tilemapLayer.tileToWorldY(tile.y); + var point = tilemapLayer.tileToWorldXY(tile.x, tile.y); - // If the map's base tile size differs from the layer's tile size, only the top of the rect - // needs to be adjusted since its origin is (0, 1). + tileWorldRect.left = point.x; + tileWorldRect.top = point.y; + + // If the maps base tile size differs from the layer tile size, only the top of the rect + // needs to be adjusted since its origin is (0, 1). if (tile.baseHeight !== tile.height) { tileWorldRect.top -= (tile.height - tile.baseHeight) * tilemapLayer.scaleY; @@ -109885,7 +115761,7 @@ var World = new Class({ * @method Phaser.Physics.Arcade.World#wrap * @since 3.3.0 * - * @param {*} object - A Game Object, a Group, an object with `x` and `y` coordinates, or an array of such objects. + * @param {any} object - A Game Object, a Group, an object with `x` and `y` coordinates, or an array of such objects. * @param {number} [padding=0] - An amount added to each boundary edge during the operation. */ wrap: function (object, padding) @@ -109978,7 +115854,7 @@ module.exports = World; /***/ }), -/* 488 */ +/* 504 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -109989,11 +115865,11 @@ module.exports = World; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); -var Events = __webpack_require__(230); -var RadToDeg = __webpack_require__(183); +var CONST = __webpack_require__(59); +var Events = __webpack_require__(237); +var RadToDeg = __webpack_require__(188); var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(50); +var RectangleContains = __webpack_require__(56); var Vector2 = __webpack_require__(3); /** @@ -110076,7 +115952,7 @@ var Body = new Class({ * The color of this Body on the debug display. * * @name Phaser.Physics.Arcade.Body#debugBodyColor - * @type {integer} + * @type {number} * @since 3.0.0 */ this.debugBodyColor = world.defaults.bodyDebugColor; @@ -110318,10 +116194,11 @@ var Body = new Class({ /** * When `useDamping` is false (the default), this is absolute loss of velocity due to movement, in pixels per second squared. * - * When `useDamping` is true, this is 1 minus the damping factor. + * When `useDamping` is true, this is a damping multiplier between 0 and 1. + * A value of 0 means the Body stops instantly. + * A value of 0.01 mean the Body loses 99% of its velocity per second. + * A value of 0.1 means the Body loses 90% of its velocity per second. * A value of 1 means the Body loses no velocity. - * A value of 0.95 means the Body loses 5% of its velocity per step. - * A value of 0.5 means the Body loses 50% of its velocity per step. * * The x and y components are applied separately. * @@ -110469,8 +116346,8 @@ var Body = new Class({ * by using damping, avoiding the axis-drift that is prone with linear deceleration. * * If you enable this property then you should use far smaller `drag` values than with linear, as - * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow - * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. + * they are used as a multiplier on the velocity. Values such as 0.05 will give a nice slow + * deceleration. * * @name Phaser.Physics.Arcade.Body#useDamping * @type {boolean} @@ -110558,7 +116435,7 @@ var Body = new Class({ * If the Body is moving on both axes, this describes motion on the vertical axis only. * * @name Phaser.Physics.Arcade.Body#facing - * @type {integer} + * @type {number} * @since 3.0.0 * * @see Phaser.Physics.Arcade.FACING_UP @@ -110578,6 +116455,25 @@ var Body = new Class({ */ this.immovable = false; + /** + * Sets if this Body can be pushed by another Body. + * + * A body that cannot be pushed will reflect back all of the velocity it is given to the + * colliding body. If that body is also not pushable, then the separation will be split + * between them evenly. + * + * If you want your body to never move or seperate at all, see the `setImmovable` method. + * + * By default, Dynamic Bodies are always pushable. + * + * @name Phaser.Physics.Arcade.Body#pushable + * @type {boolean} + * @default true + * @since 3.50.0 + * @see Phaser.GameObjects.Components.Pushable#setPushable + */ + this.pushable = true; + /** * Whether the Body's position and rotation are affected by its velocity, acceleration, drag, and gravity. * @@ -110722,7 +116618,7 @@ var Body = new Class({ * The Body's physics type (dynamic or static). * * @name Phaser.Physics.Arcade.Body#physicsType - * @type {integer} + * @type {number} * @readonly * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 @@ -111195,6 +117091,7 @@ var Body = new Class({ if (wasSet) { this.blocked.none = false; + this.updateCenter(); } return wasSet; @@ -111202,6 +117099,7 @@ var Body = new Class({ /** * Sets the offset of the Body's position from its Game Object's position. + * The Body's `position` isn't changed until the next `preUpdate`. * * @method Phaser.Physics.Arcade.Body#setOffset * @since 3.0.0 @@ -111216,7 +117114,6 @@ var Body = new Class({ if (y === undefined) { y = x; } this.offset.set(x, y); - this.updateCenter(); return this; }, @@ -111229,8 +117126,8 @@ var Body = new Class({ * @method Phaser.Physics.Arcade.Body#setSize * @since 3.0.0 * - * @param {integer} [width] - The width of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. - * @param {integer} [height] - The height of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. + * @param {number} [width] - The width of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. + * @param {number} [height] - The height of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. * @param {boolean} [center=true] - Modify the Body's `offset`, placing the Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method. * * @return {Phaser.Physics.Arcade.Body} This Body object. @@ -111320,14 +117217,14 @@ var Body = new Class({ }, /** - * Resets this Body to the given coordinates. Also positions its parent Game Object to the same coordinates. + * Sets this Body's parent Game Object to the given coordinates and resets this Body at the new coordinates. * If the Body had any velocity or acceleration it is lost as a result of calling this. * * @method Phaser.Physics.Arcade.Body#reset * @since 3.0.0 * - * @param {number} x - The horizontal position to place the Game Object and Body. - * @param {number} y - The vertical position to place the Game Object and Body. + * @param {number} x - The horizontal position to place the Game Object. + * @param {number} y - The vertical position to place the Game Object. */ reset: function (x, y) { @@ -111670,18 +117567,19 @@ var Body = new Class({ /** * Sets whether this Body collides with the world boundary. * - * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first. + * Optionally also sets the World Bounce and `onWorldBounds` values. * * @method Phaser.Physics.Arcade.Body#setCollideWorldBounds * @since 3.0.0 * - * @param {boolean} [value=true] - `true` if this body should collide with the world bounds, otherwise `false`. - * @param {number} [bounceX] - If given this will be replace the `worldBounce.x` value. - * @param {number} [bounceY] - If given this will be replace the `worldBounce.y` value. + * @param {boolean} [value=true] - `true` if the Body should collide with the world bounds, otherwise `false`. + * @param {number} [bounceX] - If given this replaces the Body's `worldBounce.x` value. + * @param {number} [bounceY] - If given this replaces the Body's `worldBounce.y` value. + * @param {boolean} [onWorldBounds] - If given this replaces the Body's `onWorldBounds` value. * * @return {Phaser.Physics.Arcade.Body} This Body object. */ - setCollideWorldBounds: function (value, bounceX, bounceY) + setCollideWorldBounds: function (value, bounceX, bounceY, onWorldBounds) { if (value === undefined) { value = true; } @@ -111708,6 +117606,11 @@ var Body = new Class({ } } + if (onWorldBounds !== undefined) + { + this.onWorldBounds = onWorldBounds; + } + return this; }, @@ -111796,6 +117699,40 @@ var Body = new Class({ return this; }, + /** + * Sets the Body's maximum horizontal velocity. + * + * @method Phaser.Physics.Arcade.Body#setMaxVelocityX + * @since 3.50.0 + * + * @param {number} value - The maximum horizontal velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxVelocityX: function (value) + { + this.maxVelocity.x = value; + + return this; + }, + + /** + * Sets the Body's maximum vertical velocity. + * + * @method Phaser.Physics.Arcade.Body#setMaxVelocityY + * @since 3.50.0 + * + * @param {number} value - The maximum vertical velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxVelocityY: function (value) + { + this.maxVelocity.y = value; + + return this; + }, + /** * Sets the maximum speed the Body can move. * @@ -111995,6 +117932,31 @@ var Body = new Class({ return this; }, + /** + * If this Body is using `drag` for deceleration this property controls how the drag is applied. + * If set to `true` drag will use a damping effect rather than a linear approach. If you are + * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in + * the game Asteroids) then you will get a far smoother and more visually correct deceleration + * by using damping, avoiding the axis-drift that is prone with linear deceleration. + * + * If you enable this property then you should use far smaller `drag` values than with linear, as + * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow + * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. + * + * @method Phaser.Physics.Arcade.Body#setDamping + * @since 3.50.0 + * + * @param {boolean} value - `true` to use damping, or `false` to use drag. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setDamping: function (value) + { + this.useDamping = value; + + return this; + }, + /** * Sets the Body's horizontal drag. * @@ -112240,7 +118202,79 @@ var Body = new Class({ }, /** - * The Body's horizontal position (left edge). + * This is an internal handler, called by the `ProcessX` function as part + * of the collision step. You should almost never call this directly. + * + * @method Phaser.Physics.Arcade.Body#processX + * @since 3.50.0 + * + * @param {number} x - The amount to add to the Body position. + * @param {number} [vx] - The amount to add to the Body velocity. + * @param {boolean} [left] - Set the blocked.left value? + * @param {boolean} [right] - Set the blocked.right value? + */ + processX: function (x, vx, left, right) + { + this.x += x; + + this.updateCenter(); + + if (vx !== null) + { + this.velocity.x = vx; + } + + var blocked = this.blocked; + + if (left) + { + blocked.left = true; + } + + if (right) + { + blocked.right = true; + } + }, + + /** + * This is an internal handler, called by the `ProcessY` function as part + * of the collision step. You should almost never call this directly. + * + * @method Phaser.Physics.Arcade.Body#processY + * @since 3.50.0 + * + * @param {number} y - The amount to add to the Body position. + * @param {number} [vy] - The amount to add to the Body velocity. + * @param {boolean} [up] - Set the blocked.up value? + * @param {boolean} [down] - Set the blocked.down value? + */ + processY: function (y, vy, up, down) + { + this.y += y; + + this.updateCenter(); + + if (vy !== null) + { + this.velocity.y = vy; + } + + var blocked = this.blocked; + + if (up) + { + blocked.up = true; + } + + if (down) + { + blocked.down = true; + } + }, + + /** + * The Bodys horizontal position (left edge). * * @name Phaser.Physics.Arcade.Body#x * @type {number} @@ -112261,7 +118295,7 @@ var Body = new Class({ }, /** - * The Body's vertical position (top edge). + * The Bodys vertical position (top edge). * * @name Phaser.Physics.Arcade.Body#y * @type {number} @@ -112355,7 +118389,7 @@ module.exports = Body; /***/ }), -/* 489 */ +/* 505 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112475,7 +118509,7 @@ var Collider = new Class({ /** * A name for the Collider. - * + * * Phaser does not use this value, it's for your own reference. * * @method Phaser.Physics.Arcade.Collider#setName @@ -112538,7 +118572,61 @@ module.exports = Collider; /***/ }), -/* 490 */ +/* 506 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTilesWithin = __webpack_require__(26); +var Vector2 = __webpack_require__(3); + +var pointStart = new Vector2(); +var pointEnd = new Vector2(); + +/** + * Gets the tiles in the given rectangular area (in world coordinates) of the layer. + * + * @function Phaser.Tilemaps.Components.GetTilesWithinWorldXY + * @since 3.0.0 + * + * @param {number} worldX - The world x coordinate for the top-left of the area. + * @param {number} worldY - The world y coordinate for the top-left of the area. + * @param {number} width - The width of the area. + * @param {number} height - The height of the area. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + */ +var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer) +{ + var worldToTileXY = layer.tilemapLayer.tilemap._convert.WorldToTileXY; + + // Top left corner of the rect, rounded down to include partial tiles + worldToTileXY(worldX, worldY, true, pointStart, camera, layer); + + var xStart = pointStart.x; + var yStart = pointStart.y; + + // Bottom right corner of the rect, rounded up to include partial tiles + worldToTileXY(worldX + width, worldY + height, false, pointEnd, camera, layer); + + var xEnd = Math.ceil(pointEnd.x); + var yEnd = Math.ceil(pointEnd.y); + + return GetTilesWithin(xStart, yStart, xEnd - xStart, yEnd - yStart, filteringOptions, layer); +}; + +module.exports = GetTilesWithinWorldXY; + + +/***/ }), +/* 507 */ /***/ (function(module, exports) { /** @@ -112579,7 +118667,7 @@ module.exports = ProcessTileCallbacks; /***/ }), -/* 491 */ +/* 508 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -112589,7 +118677,7 @@ module.exports = ProcessTileCallbacks; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var quickselect = __webpack_require__(403); +var quickselect = __webpack_require__(413); /** * @classdesc @@ -113190,7 +119278,7 @@ function multiSelect (arr, left, right, n, compare) module.exports = rbush; /***/ }), -/* 492 */ +/* 509 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113199,9 +119287,9 @@ module.exports = rbush; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileCheckX = __webpack_require__(493); -var TileCheckY = __webpack_require__(495); -var TileIntersectsBody = __webpack_require__(233); +var TileCheckX = __webpack_require__(510); +var TileCheckY = __webpack_require__(512); +var TileIntersectsBody = __webpack_require__(240); /** * The core separation function to separate a physics body and a tile. @@ -113213,7 +119301,7 @@ var TileIntersectsBody = __webpack_require__(233); * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tilemaps.Tile} tile - The tile to collide against. * @param {Phaser.Geom.Rectangle} tileWorldRect - A rectangle-like object defining the dimensions of the tile. - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemapLayer to collide against. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The tilemapLayer to collide against. * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? * @@ -113310,7 +119398,7 @@ module.exports = SeparateTile; /***/ }), -/* 493 */ +/* 510 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113319,7 +119407,7 @@ module.exports = SeparateTile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ProcessTileSeparationX = __webpack_require__(494); +var ProcessTileSeparationX = __webpack_require__(511); /** * Check the body against the given tile on the X axis. @@ -113400,7 +119488,7 @@ module.exports = TileCheckX; /***/ }), -/* 494 */ +/* 511 */ /***/ (function(module, exports) { /** @@ -113447,7 +119535,7 @@ module.exports = ProcessTileSeparationX; /***/ }), -/* 495 */ +/* 512 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113456,7 +119544,7 @@ module.exports = ProcessTileSeparationX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ProcessTileSeparationY = __webpack_require__(496); +var ProcessTileSeparationY = __webpack_require__(513); /** * Check the body against the given tile on the Y axis. @@ -113537,7 +119625,7 @@ module.exports = TileCheckY; /***/ }), -/* 496 */ +/* 513 */ /***/ (function(module, exports) { /** @@ -113584,7 +119672,7 @@ module.exports = ProcessTileSeparationY; /***/ }), -/* 497 */ +/* 514 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113593,7 +119681,8 @@ module.exports = ProcessTileSeparationY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetOverlapX = __webpack_require__(231); +var GetOverlapX = __webpack_require__(238); +var ProcessX = __webpack_require__(1369); /** * Separates two overlapping bodies on the X-axis (horizontally). @@ -113610,63 +119699,40 @@ var GetOverlapX = __webpack_require__(231); * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. * - * @return {boolean} `true` if the two bodies overlap horizontally, otherwise `false`. + * @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`. */ var SeparateX = function (body1, body2, overlapOnly, bias) { var overlap = GetOverlapX(body1, body2, overlapOnly, bias); + var body1Immovable = body1.immovable; + var body2Immovable = body2.immovable; + // Can't separate two immovable bodies, or a body with its own custom separation logic - if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateX || body2.customSeparateX) + if (overlapOnly || overlap === 0 || (body1Immovable && body2Immovable) || body1.customSeparateX || body2.customSeparateX) { // return true if there was some overlap, otherwise false return (overlap !== 0) || (body1.embedded && body2.embedded); } - // Adjust their positions and velocities accordingly (if there was any overlap) - var v1 = body1.velocity.x; - var v2 = body2.velocity.x; + var blockedState = ProcessX.Set(body1, body2, overlap); - if (!body1.immovable && !body2.immovable) + if (!body1Immovable && !body2Immovable) { - overlap *= 0.5; - - body1.x -= overlap; - body2.x += overlap; - - var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); - var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); - var avg = (nv1 + nv2) * 0.5; - - nv1 -= avg; - nv2 -= avg; - - body1.velocity.x = avg + nv1 * body1.bounce.x; - body2.velocity.x = avg + nv2 * body2.bounce.x; - } - else if (!body1.immovable) - { - body1.x -= overlap; - body1.velocity.x = v2 - v1 * body1.bounce.x; - - // This is special case code that handles things like vertically moving platforms you can ride - if (body2.moves) + if (blockedState > 0) { - body1.y += (body2.y - body2.prev.y) * body2.friction.y; - body1._dy = body1.y - body1.prev.y; + return true; } - } - else - { - body2.x += overlap; - body2.velocity.x = v1 - v2 * body2.bounce.x; - // This is special case code that handles things like vertically moving platforms you can ride - if (body1.moves) - { - body2.y += (body1.y - body1.prev.y) * body1.friction.y; - body2._dy = body2.y - body2.prev.y; - } + return ProcessX.Check(); + } + else if (body1Immovable) + { + ProcessX.RunImmovableBody1(blockedState); + } + else if (body2Immovable) + { + ProcessX.RunImmovableBody2(blockedState); } // If we got this far then there WAS overlap, and separation is complete, so return true @@ -113677,7 +119743,7 @@ module.exports = SeparateX; /***/ }), -/* 498 */ +/* 515 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113686,7 +119752,8 @@ module.exports = SeparateX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetOverlapY = __webpack_require__(232); +var GetOverlapY = __webpack_require__(239); +var ProcessY = __webpack_require__(1370); /** * Separates two overlapping bodies on the Y-axis (vertically). @@ -113709,57 +119776,34 @@ var SeparateY = function (body1, body2, overlapOnly, bias) { var overlap = GetOverlapY(body1, body2, overlapOnly, bias); + var body1Immovable = body1.immovable; + var body2Immovable = body2.immovable; + // Can't separate two immovable bodies, or a body with its own custom separation logic - if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateY || body2.customSeparateY) + if (overlapOnly || overlap === 0 || (body1Immovable && body2Immovable) || body1.customSeparateY || body2.customSeparateY) { // return true if there was some overlap, otherwise false return (overlap !== 0) || (body1.embedded && body2.embedded); } - // Adjust their positions and velocities accordingly (if there was any overlap) - var v1 = body1.velocity.y; - var v2 = body2.velocity.y; + var blockedState = ProcessY.Set(body1, body2, overlap); - if (!body1.immovable && !body2.immovable) + if (!body1Immovable && !body2Immovable) { - overlap *= 0.5; - - body1.y -= overlap; - body2.y += overlap; - - var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); - var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); - var avg = (nv1 + nv2) * 0.5; - - nv1 -= avg; - nv2 -= avg; - - body1.velocity.y = avg + nv1 * body1.bounce.y; - body2.velocity.y = avg + nv2 * body2.bounce.y; - } - else if (!body1.immovable) - { - body1.y -= overlap; - body1.velocity.y = v2 - v1 * body1.bounce.y; - - // This is special case code that handles things like horizontal moving platforms you can ride - if (body2.moves) + if (blockedState > 0) { - body1.x += (body2.x - body2.prev.x) * body2.friction.x; - body1._dx = body1.x - body1.prev.x; + return true; } - } - else - { - body2.y += overlap; - body2.velocity.y = v1 - v2 * body2.bounce.y; - // This is special case code that handles things like horizontal moving platforms you can ride - if (body1.moves) - { - body2.x += (body1.x - body1.prev.x) * body1.friction.x; - body2._dx = body2.x - body2.prev.x; - } + return ProcessY.Check(); + } + else if (body1Immovable) + { + ProcessY.RunImmovableBody1(blockedState); + } + else if (body2Immovable) + { + ProcessY.RunImmovableBody2(blockedState); } // If we got this far then there WAS overlap, and separation is complete, so return true @@ -113770,7 +119814,7 @@ module.exports = SeparateY; /***/ }), -/* 499 */ +/* 516 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -113779,10 +119823,10 @@ module.exports = SeparateY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CircleContains = __webpack_require__(57); +var CircleContains = __webpack_require__(62); var Class = __webpack_require__(0); -var CONST = __webpack_require__(52); -var RectangleContains = __webpack_require__(50); +var CONST = __webpack_require__(59); +var RectangleContains = __webpack_require__(56); var Vector2 = __webpack_require__(3); /** @@ -113844,7 +119888,7 @@ var StaticBody = new Class({ * The color of this Static Body on the debug display. * * @name Phaser.Physics.Arcade.StaticBody#debugBodyColor - * @type {integer} + * @type {number} * @since 3.0.0 */ this.debugBodyColor = world.defaults.staticBodyDebugColor; @@ -114046,6 +120090,25 @@ var StaticBody = new Class({ */ this.immovable = true; + /** + * Sets if this Body can be pushed by another Body. + * + * A body that cannot be pushed will reflect back all of the velocity it is given to the + * colliding body. If that body is also not pushable, then the separation will be split + * between them evenly. + * + * If you want your body to never move or seperate at all, see the `setImmovable` method. + * + * By default, Static Bodies are not pushable. + * + * @name Phaser.Physics.Arcade.StaticBody#pushable + * @type {boolean} + * @default false + * @since 3.50.0 + * @see Phaser.GameObjects.Components.Pushable#setPushable + */ + this.pushable = false; + /** * A flag disabling the default horizontal separation of colliding bodies. Pass your own `collideHandler` to the collider. * @@ -114128,7 +120191,8 @@ var StaticBody = new Class({ this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; /** - * Whether this StaticBody has ever collided with another body and in which direction. + * This property is kept for compatibility with Dynamic Bodies. + * Avoid using it. * * @name Phaser.Physics.Arcade.StaticBody#touching * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} @@ -114137,7 +120201,9 @@ var StaticBody = new Class({ this.touching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody was colliding with another body during the last step or any previous step, and in which direction. + * This property is kept for compatibility with Dynamic Bodies. + * Avoid using it. + * The values are always false for a Static Body. * * @name Phaser.Physics.Arcade.StaticBody#wasTouching * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} @@ -114146,7 +120212,8 @@ var StaticBody = new Class({ this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; /** - * Whether this StaticBody has ever collided with a tile or the world boundary. + * This property is kept for compatibility with Dynamic Bodies. + * Avoid using it. * * @name Phaser.Physics.Arcade.StaticBody#blocked * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} @@ -114158,7 +120225,7 @@ var StaticBody = new Class({ * The StaticBody's physics type (static by default). * * @name Phaser.Physics.Arcade.StaticBody#physicsType - * @type {integer} + * @type {number} * @default Phaser.Physics.Arcade.STATIC_BODY * @since 3.0.0 */ @@ -114294,8 +120361,8 @@ var StaticBody = new Class({ * @method Phaser.Physics.Arcade.StaticBody#setSize * @since 3.0.0 * - * @param {integer} [width] - The width of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. - * @param {integer} [height] - The height of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. + * @param {number} [width] - The width of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. + * @param {number} [height] - The height of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. * @param {boolean} [center=true] - Place the Static Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method. * * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. @@ -114759,7 +120826,7 @@ module.exports = StaticBody; /***/ }), -/* 500 */ +/* 517 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -114774,24 +120841,24 @@ module.exports = StaticBody; module.exports = { - Bounce: __webpack_require__(1417), - Collision: __webpack_require__(1418), - Force: __webpack_require__(1419), - Friction: __webpack_require__(1420), - Gravity: __webpack_require__(1421), - Mass: __webpack_require__(1422), - Sensor: __webpack_require__(1423), - SetBody: __webpack_require__(1424), - Sleep: __webpack_require__(1425), - Static: __webpack_require__(1442), - Transform: __webpack_require__(1443), - Velocity: __webpack_require__(1444) + Bounce: __webpack_require__(1479), + Collision: __webpack_require__(1480), + Force: __webpack_require__(1481), + Friction: __webpack_require__(1482), + Gravity: __webpack_require__(1483), + Mass: __webpack_require__(1484), + Sensor: __webpack_require__(1485), + SetBody: __webpack_require__(1486), + Sleep: __webpack_require__(1487), + Static: __webpack_require__(1504), + Transform: __webpack_require__(1505), + Velocity: __webpack_require__(1506) }; /***/ }), -/* 501 */ +/* 518 */ /***/ (function(module, exports) { /** @@ -114917,7 +120984,7 @@ module.exports = Pair; /***/ }), -/* 502 */ +/* 519 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115047,7 +121114,7 @@ module.exports = BasePlugin; /***/ }), -/* 503 */ +/* 520 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115056,7 +121123,53 @@ module.exports = BasePlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); + +/** + * Checks if the given tile coordinate is within the isometric layer bounds, or not. + * + * @function Phaser.Tilemaps.Components.CheckIsoBounds + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to check against. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. + * + * @return {boolean} Returns `true` if the coordinates are within the iso bounds. + */ +var CheckIsoBounds = function (tileX, tileY, layer, camera) +{ + var tilemapLayer = layer.tilemapLayer; + + var cullPaddingX = tilemapLayer.cullPaddingX; + var cullPaddingY = tilemapLayer.cullPaddingY; + + var pos = tilemapLayer.tilemap.tileToWorldXY(tileX, tileY, point, camera, tilemapLayer); + + // we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles. + return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (-cullPaddingX - 0.5) + && pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullPaddingX - 0.5) + && pos.y > camera.worldView.y + tilemapLayer.scaleY * layer.tileHeight * (-cullPaddingY - 1.0) + && pos.y < camera.worldView.bottom + tilemapLayer.scaleY * layer.tileHeight * (cullPaddingY - 0.5); +}; + +module.exports = CheckIsoBounds; + + +/***/ }), +/* 521 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTilesWithin = __webpack_require__(26); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -115066,12 +121179,12 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.ReplaceByIndex * @since 3.0.0 * - * @param {integer} findIndex - The index of the tile to search for. - * @param {integer} newIndex - The index of the tile to replace it with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} findIndex - The index of the tile to search for. + * @param {number} newIndex - The index of the tile to replace it with. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var ReplaceByIndex = function (findIndex, newIndex, tileX, tileY, width, height, layer) @@ -115091,7 +121204,7 @@ module.exports = ReplaceByIndex; /***/ }), -/* 504 */ +/* 522 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115100,7 +121213,1143 @@ module.exports = ReplaceByIndex; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var IsInLayerBounds = __webpack_require__(104); +var Rectangle = __webpack_require__(9); +var SnapCeil = __webpack_require__(134); +var SnapFloor = __webpack_require__(72); + +var bounds = new Rectangle(); + +/** + * Returns the bounds in the given orthogonal layer that are within the cameras viewport. + * This is used internally by the cull tiles function. + * + * @function Phaser.Tilemaps.Components.CullBounds + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * + * @return {Phaser.Geom.Rectangle} A rectangle containing the culled bounds. If you wish to retain this object, clone it, as it's recycled internally. + */ +var CullBounds = function (layer, camera) +{ + var tilemap = layer.tilemapLayer.tilemap; + var tilemapLayer = layer.tilemapLayer; + + // We need to use the tile sizes defined for the map as a whole, not the layer, + // in order to calculate the bounds correctly. As different sized tiles may be + // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. + var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); + var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); + + var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; + var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; + + var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH, 0, true) - tilemapLayer.cullPaddingY; + var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH, 0, true) + tilemapLayer.cullPaddingY; + + return bounds.setTo( + boundsLeft, + boundsTop, + (boundsRight - boundsLeft), + (boundsBottom - boundsTop) + ); +}; + +module.exports = CullBounds; + + +/***/ }), +/* 523 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CullBounds = __webpack_require__(522); +var RunCull = __webpack_require__(152); + +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.CullTiles + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var CullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } + + outputArray.length = 0; + + var tilemapLayer = layer.tilemapLayer; + + // Camera world view bounds, snapped for scaled tile size + // Cull Padding values are given in tiles, not pixels + var bounds = CullBounds(layer, camera); + + if (tilemapLayer.skipCull || tilemapLayer.scrollFactorX !== 1 || tilemapLayer.scrollFactorY !== 1) + { + bounds.left = 0; + bounds.right = layer.width; + bounds.top = 0; + bounds.bottom = layer.height; + } + + RunCull(layer, bounds, renderOrder, outputArray); + + return outputArray; +}; + +module.exports = CullTiles; + + +/***/ }), +/* 524 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CullBounds = __webpack_require__(525); +var RunCull = __webpack_require__(152); + +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.HexagonalCullTiles + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var HexagonalCullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } + + outputArray.length = 0; + + var tilemapLayer = layer.tilemapLayer; + + if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) + { + // Camera world view bounds, snapped for scaled tile size + // Cull Padding values are given in tiles, not pixels + + var bounds = CullBounds(layer, camera); + + RunCull(layer, bounds, renderOrder, outputArray); + } + + return outputArray; +}; + +module.exports = HexagonalCullTiles; + + +/***/ }), +/* 525 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var SnapCeil = __webpack_require__(134); +var SnapFloor = __webpack_require__(72); + +/** + * Returns the bounds in the given layer that are within the camera's viewport. + * This is used internally by the cull tiles function. + * + * @function Phaser.Tilemaps.Components.HexagonalCullBounds + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * + * @return {object} An object containing the `left`, `right`, `top` and `bottom` bounds. + */ +var HexagonalCullBounds = function (layer, camera) +{ + var tilemap = layer.tilemapLayer.tilemap; + var tilemapLayer = layer.tilemapLayer; + + // We need to use the tile sizes defined for the map as a whole, not the layer, + // in order to calculate the bounds correctly. As different sized tiles may be + // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. + var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); + var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); + + var len = layer.hexSideLength; + var rowH = ((tileH - len) / 2 + len); + + var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; + var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; + + var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, rowH, 0, true) - tilemapLayer.cullPaddingY; + var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, rowH, 0, true) + tilemapLayer.cullPaddingY; + + return { + left: boundsLeft, + right: boundsRight, + top: boundsTop, + bottom: boundsBottom + }; +}; + +module.exports = HexagonalCullBounds; + + +/***/ }), +/* 526 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CheckIsoBounds = __webpack_require__(520); + +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.IsometricCullTiles + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var IsometricCullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } + + outputArray.length = 0; + + var tilemapLayer = layer.tilemapLayer; + + var mapData = layer.data; + var mapWidth = layer.width; + var mapHeight = layer.height; + + var drawLeft = 0; + var drawRight = mapWidth; + var drawTop = 0; + var drawBottom = mapHeight; + + if (!tilemapLayer.skipCull) + { + var x; + var y; + var tile; + + if (renderOrder === 0) + { + // right-down + + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + if (CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + else if (renderOrder === 1) + { + // left-down + + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + if (CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + else if (renderOrder === 2) + { + // right-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + if (CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + else if (renderOrder === 3) + { + // left-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + if (CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + } + + tilemapLayer.tilesDrawn = outputArray.length; + tilemapLayer.tilesTotal = mapWidth * mapHeight; + + return outputArray; +}; + +module.exports = IsometricCullTiles; + + +/***/ }), +/* 527 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CullBounds = __webpack_require__(528); +var RunCull = __webpack_require__(152); + +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.StaggeredCullTiles + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var StaggeredCullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } + + outputArray.length = 0; + + var tilemapLayer = layer.tilemapLayer; + + if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) + { + // Camera world view bounds, snapped for scaled tile size + // Cull Padding values are given in tiles, not pixels + + var bounds = CullBounds(layer, camera); + + RunCull(layer, bounds, renderOrder, outputArray); + } + + return outputArray; +}; + +module.exports = StaggeredCullTiles; + + +/***/ }), +/* 528 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var SnapCeil = __webpack_require__(134); +var SnapFloor = __webpack_require__(72); + +/** + * Returns the bounds in the given layer that are within the camera's viewport. + * This is used internally by the cull tiles function. + * + * @function Phaser.Tilemaps.Components.StaggeredCullBounds + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * + * @return {object} An object containing the `left`, `right`, `top` and `bottom` bounds. + */ +var StaggeredCullBounds = function (layer, camera) +{ + var tilemap = layer.tilemapLayer.tilemap; + var tilemapLayer = layer.tilemapLayer; + + // We need to use the tile sizes defined for the map as a whole, not the layer, + // in order to calculate the bounds correctly. As different sized tiles may be + // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. + var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); + var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); + + var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; + var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; + + var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH / 2, 0, true) - tilemapLayer.cullPaddingY; + var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH / 2, 0, true) + tilemapLayer.cullPaddingY; + + return { + left: boundsLeft, + right: boundsRight, + top: boundsTop, + bottom: boundsBottom + }; +}; + +module.exports = StaggeredCullBounds; + + +/***/ }), +/* 529 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from hexagonal tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.HexagonalTileToWorldXY + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + var layerWorldX = 0; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + + tileWidth *= tilemapLayer.scaleX; + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var len = layer.hexSideLength; + var rowHeight = ((tileHeight - len) / 2 + len); + + // similar to staggered, because Tiled uses the oddr representation. + var x = layerWorldX + tileX * tileWidth + tileY % 2 * (tileWidth / 2); + var y = layerWorldY + tileY * rowHeight; + + return point.set(x, y); +}; + +module.exports = HexagonalTileToWorldXY; + + +/***/ }), +/* 530 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from isometric tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.IsometricTileToWorldXY + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var IsometricTileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + var layerWorldX = 0; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + + tileWidth *= tilemapLayer.scaleX; + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var x = layerWorldX + (tileX - tileY) * (tileWidth / 2); + var y = layerWorldY + (tileX + tileY) * (tileHeight / 2); + + return point.set(x, y); +}; + +module.exports = IsometricTileToWorldXY; + + +/***/ }), +/* 531 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from staggered tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.StaggeredTileToWorldXY + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var StaggeredTileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + var layerWorldX = 0; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + + tileWidth *= tilemapLayer.scaleX; + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var x = layerWorldX + tileX * tileWidth + tileY % 2 * (tileWidth / 2); + var y = layerWorldY + tileY * (tileHeight / 2); + + return point.set(x, y); +}; + +module.exports = StaggeredTileToWorldXY; + + +/***/ }), +/* 532 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var TileToWorldX = __webpack_require__(245); +var TileToWorldY = __webpack_require__(246); +var Vector2 = __webpack_require__(3); + +/** + * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.TileToWorldXY + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var TileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(0, 0); } + + point.x = TileToWorldX(tileX, camera, layer); + point.y = TileToWorldY(tileY, camera, layer); + + return point; +}; + +module.exports = TileToWorldXY; + + +/***/ }), +/* 533 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from hexagonal tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.HexagonalTileToWorldY + * @since 3.50.0 + * + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in world coordinates. + */ +var HexagonalTileToWorldY = function (tileY, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var len = tilemapLayer.tilemap.hexSideLength; + + var rowHeight = ((tileHeight - len) / 2 + len); + + return layerWorldY + tileY * rowHeight; +}; + +module.exports = HexagonalTileToWorldY; + + +/***/ }), +/* 534 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from staggered tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layers position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.StaggeredTileToWorldY + * @since 3.50.0 + * + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in world coordinates. + */ +var StaggeredTileToWorldY = function (tileY, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + var layerWorldY = 0; + + if (tilemapLayer) + { + if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + return layerWorldY + tileY * (tileHeight / 2); +}; + +module.exports = StaggeredTileToWorldY; + + +/***/ }), +/* 535 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from world XY coordinates (pixels) to hexagonal tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.HexagonalWorldToTileXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinates down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. + */ +var HexagonalWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + + tileWidth *= tilemapLayer.scaleX; + } + + var len = layer.hexSideLength; + var rowHeight = ((tileHeight - len) / 2 + len); + + // similar to staggered, because Tiled uses the oddr representation. + var y = (snapToFloor) ? Math.floor((worldY / rowHeight)) : (worldY / rowHeight); + var x = (snapToFloor) ? Math.floor((worldX - (y % 2) * 0.5 * tileWidth) / tileWidth) : (worldX - (y % 2) * 0.5 * tileWidth) / tileWidth; + + return point.set(x, y); +}; + +module.exports = HexagonalWorldToTileXY; + + +/***/ }), +/* 536 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from world XY coordinates (pixels) to isometric tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.IsometricWorldToTileXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. + */ +var IsometricWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + + tileWidth *= tilemapLayer.scaleX; + } + + worldX -= tileWidth / 2; + + var x = (snapToFloor) ? Math.floor((worldX / (tileWidth / 2) + worldY / (tileHeight / 2)) / 2) : ((worldX / (tileWidth / 2) + worldY / (tileHeight / 2)) / 2); + var y = (snapToFloor) ? Math.floor((worldY / (tileHeight / 2) - worldX / (tileWidth / 2)) / 2) : ((worldY / (tileHeight / 2) - worldX / (tileWidth / 2)) / 2); + + return point.set(x, y); +}; + +module.exports = IsometricWorldToTileXY; + + +/***/ }), +/* 537 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(3); + +/** + * Converts from world XY coordinates (pixels) to staggered tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.StaggeredWorldToTileXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. + */ +var StaggeredWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (!point) { point = new Vector2(); } + + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + + tileWidth *= tilemapLayer.scaleX; + } + + var y = (snapToFloor) ? Math.floor((worldY / (tileHeight / 2))) : (worldY / (tileHeight / 2)); + var x = (snapToFloor) ? Math.floor((worldX + (y % 2) * 0.5 * tileWidth) / tileWidth) : (worldX + (y % 2) * 0.5 * tileWidth) / tileWidth; + + return point.set(x, y); +}; + +module.exports = StaggeredWorldToTileXY; + + +/***/ }), +/* 538 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var WorldToTileX = __webpack_require__(247); +var WorldToTileY = __webpack_require__(248); +var Vector2 = __webpack_require__(3); + +/** + * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.WorldToTileXY + * @since 3.0.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. + */ +var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (snapToFloor === undefined) { snapToFloor = true; } + if (!point) { point = new Vector2(0, 0); } + + point.x = WorldToTileX(worldX, snapToFloor, camera, layer); + point.y = WorldToTileY(worldY, snapToFloor, camera, layer); + + return point; +}; + +module.exports = WorldToTileXY; + + +/***/ }), +/* 539 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from world Y coordinates (pixels) to hexagonal tile Y coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.HexagonalWorldToTileY + * @since 3.50.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in tile units. + */ +var HexagonalWorldToTileY = function (worldY, snapToFloor, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + var len = layer.hexSideLength; + + var rowHeight = ((tileHeight - len) / 2 + len); + + return (snapToFloor) ? Math.floor(worldY / rowHeight) : worldY / rowHeight; +}; + +module.exports = HexagonalWorldToTileY; + + +/***/ }), +/* 540 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from world Y coordinates (pixels) to staggered tile Y coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.StaggeredWorldToTileY + * @since 3.50.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in tile units. + */ +var StaggeredWorldToTileY = function (worldY, snapToFloor, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; + } + + return (snapToFloor) ? Math.floor(worldY / (tileHeight / 2)) : worldY / (tileHeight / 2); +}; + +module.exports = StaggeredWorldToTileY; + + +/***/ }), +/* 541 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var IsInLayerBounds = __webpack_require__(116); /** * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns @@ -115109,8 +122358,8 @@ var IsInLayerBounds = __webpack_require__(104); * @function Phaser.Tilemaps.Components.HasTileAt * @since 3.0.0 * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. @@ -115133,7 +122382,7 @@ module.exports = HasTileAt; /***/ }), -/* 505 */ +/* 542 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115142,9 +122391,9 @@ module.exports = HasTileAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Tile = __webpack_require__(75); -var IsInLayerBounds = __webpack_require__(104); -var CalculateFacesAt = __webpack_require__(235); +var Tile = __webpack_require__(81); +var IsInLayerBounds = __webpack_require__(116); +var CalculateFacesAt = __webpack_require__(244); /** * Removes the tile at the given tile coordinates in the specified layer and updates the layer's @@ -115153,17 +122402,17 @@ var CalculateFacesAt = __webpack_require__(235); * @function Phaser.Tilemaps.Components.RemoveTileAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {number} tileX - The x coordinate. + * @param {number} tileY - The y coordinate. + * @param {boolean} replaceWithNull - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile} The Tile object that was removed. */ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, layer) { - if (replaceWithNull === undefined) { replaceWithNull = false; } + if (replaceWithNull === undefined) { replaceWithNull = true; } if (recalculateFaces === undefined) { recalculateFaces = true; } if (!IsInLayerBounds(tileX, tileY, layer)) @@ -115179,7 +122428,7 @@ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, la } else { - layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, tile.width, tile.height); + layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, layer.tileWidth, layer.tileHeight); } // Recalculate faces only if the removed tile was a colliding tile @@ -115195,7 +122444,7 @@ module.exports = RemoveTileAt; /***/ }), -/* 506 */ +/* 543 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115204,11 +122453,11 @@ module.exports = RemoveTileAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var Parse2DArray = __webpack_require__(237); -var ParseCSV = __webpack_require__(507); -var ParseJSONTiled = __webpack_require__(508); -var ParseWeltmeister = __webpack_require__(519); +var Formats = __webpack_require__(38); +var Parse2DArray = __webpack_require__(250); +var ParseCSV = __webpack_require__(544); +var ParseJSONTiled = __webpack_require__(545); +var ParseWeltmeister = __webpack_require__(556); /** * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format @@ -115220,11 +122469,11 @@ var ParseWeltmeister = __webpack_require__(519); * @since 3.0.0 * * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {integer} mapFormat - See ../Formats.js. - * @param {(integer[][]|string|object)} data - 2D array, CSV string or Tiled JSON object. - * @param {integer} tileWidth - The width of a tile in pixels. Required for 2D array and CSV, but + * @param {number} mapFormat - See ../Formats.js. + * @param {(number[][]|string|object)} data - 2D array, CSV string or Tiled JSON object. + * @param {number} tileWidth - The width of a tile in pixels. Required for 2D array and CSV, but * ignored for Tiled JSON. - * @param {integer} tileHeight - The height of a tile in pixels. Required for 2D array and CSV, but + * @param {number} tileHeight - The height of a tile in pixels. Required for 2D array and CSV, but * ignored for Tiled JSON. * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty @@ -115265,7 +122514,7 @@ module.exports = Parse; /***/ }), -/* 507 */ +/* 544 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115274,8 +122523,8 @@ module.exports = Parse; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var Parse2DArray = __webpack_require__(237); +var Formats = __webpack_require__(38); +var Parse2DArray = __webpack_require__(250); /** * Parses a CSV string of tile indexes into a new MapData object with a single layer. @@ -115285,8 +122534,8 @@ var Parse2DArray = __webpack_require__(237); * * @param {string} name - The name of the tilemap, used to set the name on the MapData. * @param {string} data - CSV string of tile indexes. - * @param {integer} tileWidth - The width of a tile in pixels. - * @param {integer} tileHeight - The height of a tile in pixels. + * @param {number} tileWidth - The width of a tile in pixels. + * @param {number} tileHeight - The height of a tile in pixels. * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty * location will get a Tile object with an index of -1. If you've a large sparsely populated map and @@ -115313,7 +122562,7 @@ module.exports = ParseCSV; /***/ }), -/* 508 */ +/* 545 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115322,14 +122571,16 @@ module.exports = ParseCSV; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var MapData = __webpack_require__(106); -var ParseTileLayers = __webpack_require__(509); -var ParseImageLayers = __webpack_require__(511); -var ParseTilesets = __webpack_require__(512); -var ParseObjectLayers = __webpack_require__(515); -var BuildTilesetIndex = __webpack_require__(517); -var AssignTileProperties = __webpack_require__(518); +var AssignTileProperties = __webpack_require__(546); +var BuildTilesetIndex = __webpack_require__(547); +var CONST = __webpack_require__(29); +var Formats = __webpack_require__(38); +var FromOrientationString = __webpack_require__(242); +var MapData = __webpack_require__(118); +var ParseImageLayers = __webpack_require__(548); +var ParseObjectLayers = __webpack_require__(549); +var ParseTileLayers = __webpack_require__(552); +var ParseTilesets = __webpack_require__(554); /** * Parses a Tiled JSON object into a new MapData object. @@ -115350,12 +122601,6 @@ var AssignTileProperties = __webpack_require__(518); */ var ParseJSONTiled = function (name, json, insertNull) { - if (json.orientation !== 'orthogonal') - { - console.warn('Only orthogonal map types are supported in this version of Phaser'); - return null; - } - // Map data will consist of: layers, objects, images, tilesets, sizes var mapData = new MapData({ width: json.width, @@ -115363,7 +122608,7 @@ var ParseJSONTiled = function (name, json, insertNull) name: name, tileWidth: json.tilewidth, tileHeight: json.tileheight, - orientation: json.orientation, + orientation: FromOrientationString(json.orientation), format: Formats.TILED_JSON, version: json.version, properties: json.properties, @@ -115371,10 +122616,16 @@ var ParseJSONTiled = function (name, json, insertNull) infinite: json.infinite }); + if (mapData.orientation === CONST.HEXAGONAL) + { + mapData.hexSideLength = json.hexsidelength; + } + mapData.layers = ParseTileLayers(json, insertNull); mapData.images = ParseImageLayers(json); var sets = ParseTilesets(json); + mapData.tilesets = sets.tilesets; mapData.imageCollections = sets.imageCollections; @@ -115391,7 +122642,7 @@ module.exports = ParseJSONTiled; /***/ }), -/* 509 */ +/* 546 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115400,257 +122651,72 @@ module.exports = ParseJSONTiled; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Base64Decode = __webpack_require__(510); -var GetFastValue = __webpack_require__(2); -var LayerData = __webpack_require__(105); -var ParseGID = __webpack_require__(238); -var Tile = __webpack_require__(75); -var CreateGroupLayer = __webpack_require__(154); +var Extend = __webpack_require__(18); /** - * Parses all tilemap layers in a Tiled JSON object into new LayerData objects. + * Copy properties from tileset to tiles. * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseTileLayers + * @function Phaser.Tilemaps.Parsers.Tiled.AssignTileProperties * @since 3.0.0 * - * @param {object} json - The Tiled JSON object. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}). - * - * @return {Phaser.Tilemaps.LayerData[]} - An array of LayerData objects, one for each entry in - * json.layers with the type 'tilelayer'. + * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. */ -var ParseTileLayers = function (json, insertNull) +var AssignTileProperties = function (mapData) { - var infiniteMap = GetFastValue(json, 'infinite', false); - var tileLayers = []; + var layerData; + var tile; + var sid; + var set; + var row; - // State inherited from a parent group - var groupStack = []; - var curGroupState = CreateGroupLayer(json); - - while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) + // go through each of the map data layers + for (var i = 0; i < mapData.layers.length; i++) { - if (curGroupState.i >= curGroupState.layers.length) + layerData = mapData.layers[i]; + + set = null; + + // rows of tiles + for (var j = 0; j < layerData.data.length; j++) { - // Ensure recursion stack is not empty first - if (groupStack.length < 1) + row = layerData.data[j]; + + // individual tiles + for (var k = 0; k < row.length; k++) { - console.warn( - 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' - ); - break; - } + tile = row[k]; - // Return to previous recursive state - curGroupState = groupStack.pop(); - continue; - } - - var curl = curGroupState.layers[curGroupState.i]; - curGroupState.i++; - - if (curl.type !== 'tilelayer') - { - if (curl.type === 'group') - { - // Compute next state inherited from group - var nextGroupState = CreateGroupLayer(json, curl, curGroupState); - - // Preserve current state before recursing - groupStack.push(curGroupState); - curGroupState = nextGroupState; - } - - // Skip this layer OR 'recurse' (iterative style) into the group - continue; - } - - // Base64 decode data if necessary. NOTE: uncompressed base64 only. - if (curl.compression) - { - console.warn( - 'TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer \'' - + curl.name + '\'' - ); - continue; - } - else if (curl.encoding && curl.encoding === 'base64') - { - // Chunks for an infinite map - if (curl.chunks) - { - for (var i = 0; i < curl.chunks.length; i++) + if (tile === null || tile.index < 0) { - curl.chunks[i].data = Base64Decode(curl.chunks[i].data); + continue; } - } - // Non-infinite map data - if (curl.data) - { - curl.data = Base64Decode(curl.data); - } + // find the relevant tileset + sid = mapData.tiles[tile.index][2]; + set = mapData.tilesets[sid]; - delete curl.encoding; // Allow the same map to be parsed multiple times - } + // Ensure that a tile's size matches its tileset + tile.width = set.tileWidth; + tile.height = set.tileHeight; - // This is an array containing the tile indexes, one after the other. -1 = no tile, - // everything else = the tile index (starting at 1 for Tiled, 0 for CSV) If the map - // contains multiple tilesets then the indexes are relative to that which the set starts - // from. Need to set which tileset in the cache = which tileset in the JSON, if you do this - // manually it means you can use the same map data but a new tileset. - - var layerData; - var gidInfo; - var tile; - var blankTile; - - var output = []; - var x = 0; - - if (infiniteMap) - { - var layerOffsetX = (GetFastValue(curl, 'startx', 0) + curl.x); - var layerOffsetY = (GetFastValue(curl, 'starty', 0) + curl.y); - layerData = new LayerData({ - name: (curGroupState.name + curl.name), - x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth), - y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight), - width: curl.width, - height: curl.height, - tileWidth: json.tilewidth, - tileHeight: json.tileheight, - alpha: (curGroupState.opacity * curl.opacity), - visible: (curGroupState.visible && curl.visible), - properties: GetFastValue(curl, 'properties', []) - }); - - for (var c = 0; c < curl.height; c++) - { - output.push([ null ]); - - for (var j = 0; j < curl.width; j++) + // if that tile type has any properties, add them to the tile object + if (set.tileProperties && set.tileProperties[tile.index - set.firstgid]) { - output[c][j] = null; - } - } - - for (c = 0, len = curl.chunks.length; c < len; c++) - { - var chunk = curl.chunks[c]; - - var offsetX = (chunk.x - layerOffsetX); - var offsetY = (chunk.y - layerOffsetY); - - var y = 0; - - for (var t = 0, len2 = chunk.data.length; t < len2; t++) - { - var newOffsetX = x + offsetX; - var newOffsetY = y + offsetY; - - gidInfo = ParseGID(chunk.data[t]); - - // index, x, y, width, height - if (gidInfo.gid > 0) - { - tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth, - json.tileheight); - - // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal - // propeties into flipX, flipY and rotation - tile.rotation = gidInfo.rotation; - tile.flipX = gidInfo.flipped; - - output[newOffsetY][newOffsetX] = tile; - } - else - { - blankTile = insertNull - ? null - : new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); - - output[newOffsetY][newOffsetX] = blankTile; - } - - x++; - - if (x === chunk.width) - { - y++; - x = 0; - } + tile.properties = Extend( + tile.properties, set.tileProperties[tile.index - set.firstgid] + ); } } } - else - { - layerData = new LayerData({ - name: (curGroupState.name + curl.name), - x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x), - y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y), - width: curl.width, - height: curl.height, - tileWidth: json.tilewidth, - tileHeight: json.tileheight, - alpha: (curGroupState.opacity * curl.opacity), - visible: (curGroupState.visible && curl.visible), - properties: GetFastValue(curl, 'properties', []) - }); - - var row = []; - - // Loop through the data field in the JSON. - for (var k = 0, len = curl.data.length; k < len; k++) - { - gidInfo = ParseGID(curl.data[k]); - - // index, x, y, width, height - if (gidInfo.gid > 0) - { - tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth, - json.tileheight); - - // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal - // propeties into flipX, flipY and rotation - tile.rotation = gidInfo.rotation; - tile.flipX = gidInfo.flipped; - - row.push(tile); - } - else - { - blankTile = insertNull - ? null - : new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight); - row.push(blankTile); - } - - x++; - - if (x === curl.width) - { - output.push(row); - x = 0; - row = []; - } - } - } - - layerData.data = output; - tileLayers.push(layerData); } - - return tileLayers; }; -module.exports = ParseTileLayers; +module.exports = AssignTileProperties; /***/ }), -/* 510 */ -/***/ (function(module, exports) { +/* 547 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -115658,41 +122724,92 @@ module.exports = ParseTileLayers; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Tileset = __webpack_require__(119); + /** - * Decode base-64 encoded data, for example as exported by Tiled. + * Master list of tiles -> x, y, index in tileset. * - * @function Phaser.Tilemaps.Parsers.Tiled.Base64Decode + * @function Phaser.Tilemaps.Parsers.Tiled.BuildTilesetIndex * @since 3.0.0 * - * @param {object} data - Base-64 encoded data to decode. + * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. * - * @return {array} Array containing the decoded bytes. + * @return {array} An array of Tileset objects. */ -var Base64Decode = function (data) +var BuildTilesetIndex = function (mapData) { - var binaryString = window.atob(data); - var len = binaryString.length; - var bytes = new Array(len / 4); + var i; + var set; + var tiles = []; - // Interpret binaryString as an array of bytes representing little-endian encoded uint32 values. - for (var i = 0; i < len; i += 4) + for (i = 0; i < mapData.imageCollections.length; i++) { - bytes[i / 4] = ( - binaryString.charCodeAt(i) | - binaryString.charCodeAt(i + 1) << 8 | - binaryString.charCodeAt(i + 2) << 16 | - binaryString.charCodeAt(i + 3) << 24 - ) >>> 0; + var collection = mapData.imageCollections[i]; + var images = collection.images; + + for (var j = 0; j < images.length; j++) + { + var image = images[j]; + + set = new Tileset(image.image, image.gid, collection.imageWidth, collection.imageHeight, 0, 0); + + set.updateTileData(collection.imageWidth, collection.imageHeight); + + mapData.tilesets.push(set); + } } - return bytes; + for (i = 0; i < mapData.tilesets.length; i++) + { + set = mapData.tilesets[i]; + + var x = set.tileMargin; + var y = set.tileMargin; + + var count = 0; + var countX = 0; + var countY = 0; + + for (var t = set.firstgid; t < set.firstgid + set.total; t++) + { + // Can add extra properties here as needed + tiles[t] = [ x, y, i ]; + + x += set.tileWidth + set.tileSpacing; + + count++; + + if (count === set.total) + { + break; + } + + countX++; + + if (countX === set.columns) + { + x = set.tileMargin; + y += set.tileHeight + set.tileSpacing; + + countX = 0; + countY++; + + if (countY === set.rows) + { + break; + } + } + } + } + + return tiles; }; -module.exports = Base64Decode; +module.exports = BuildTilesetIndex; /***/ }), -/* 511 */ +/* 548 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -115780,392 +122897,7 @@ module.exports = ParseImageLayers; /***/ }), -/* 512 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Tileset = __webpack_require__(107); -var ImageCollection = __webpack_require__(513); -var ParseObject = __webpack_require__(239); - -/** - * Tilesets and Image Collections - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseTilesets - * @since 3.0.0 - * - * @param {object} json - The Tiled JSON data. - * - * @return {object} An object containing the tileset and image collection data. - */ -var ParseTilesets = function (json) -{ - var tilesets = []; - var imageCollections = []; - var lastSet = null; - var stringID; - - for (var i = 0; i < json.tilesets.length; i++) - { - // name, firstgid, width, height, margin, spacing, properties - var set = json.tilesets[i]; - - if (set.source) - { - console.warn('Phaser can\'t load external tilesets. Use the Embed Tileset button and then export the map again.'); - } - else if (set.image) - { - var newSet = new Tileset(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing); - - if (json.version > 1) - { - // Tiled 1.2+ - - if (Array.isArray(set.tiles)) - { - var tiles = {}; - var props = {}; - - for (var t = 0; t < set.tiles.length; t++) - { - var tile = set.tiles[t]; - - // Convert tileproperties - if (tile.properties) - { - var newPropData = {}; - - tile.properties.forEach(function (propData) - { - newPropData[propData['name']] = propData['value']; - }); - - props[tile.id] = newPropData; - } - - // Convert objectgroup - if (tile.objectgroup) - { - tiles[tile.id] = { objectgroup: tile.objectgroup }; - - if (tile.objectgroup.objects) - { - var parsedObjects2 = tile.objectgroup.objects.map( - function (obj) { return ParseObject(obj); } - ); - - tiles[tile.id].objectgroup.objects = parsedObjects2; - } - } - - // Copy animation data - if (tile.animation) - { - if (tiles.hasOwnProperty(tile.id)) - { - tiles[tile.id].animation = tile.animation; - } - else - { - tiles[tile.id] = { animation: tile.animation }; - } - } - } - - newSet.tileData = tiles; - newSet.tileProperties = props; - } - } - else - { - // Tiled 1 - - // Properties stored per-tile in object with string indexes starting at "0" - if (set.tileproperties) - { - newSet.tileProperties = set.tileproperties; - } - - // Object & terrain shapes stored per-tile in object with string indexes starting at "0" - if (set.tiles) - { - newSet.tileData = set.tiles; - - // Parse the objects into Phaser format to match handling of other Tiled objects - for (stringID in newSet.tileData) - { - var objectGroup = newSet.tileData[stringID].objectgroup; - if (objectGroup && objectGroup.objects) - { - var parsedObjects1 = objectGroup.objects.map( - function (obj) { return ParseObject(obj); } - ); - newSet.tileData[stringID].objectgroup.objects = parsedObjects1; - } - } - } - } - - // For a normal sliced tileset the row/count/size information is computed when updated. - // This is done (again) after the image is set. - newSet.updateTileData(set.imagewidth, set.imageheight); - - tilesets.push(newSet); - } - else - { - var newCollection = new ImageCollection(set.name, set.firstgid, set.tilewidth, - set.tileheight, set.margin, set.spacing, set.properties); - - for (stringID in set.tiles) - { - var image = set.tiles[stringID].image; - var gid = set.firstgid + parseInt(stringID, 10); - newCollection.addImage(gid, image); - } - - imageCollections.push(newCollection); - } - - // We've got a new Tileset, so set the lastgid into the previous one - if (lastSet) - { - lastSet.lastgid = set.firstgid - 1; - } - - lastSet = set; - } - - return { tilesets: tilesets, imageCollections: imageCollections }; -}; - -module.exports = ParseTilesets; - - -/***/ }), -/* 513 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); - -/** - * @classdesc - * An Image Collection is a special Tile Set containing multiple images, with no slicing into each image. - * - * Image Collections are normally created automatically when Tiled data is loaded. - * - * @class ImageCollection - * @memberof Phaser.Tilemaps - * @constructor - * @since 3.0.0 - * - * @param {string} name - The name of the image collection in the map data. - * @param {integer} firstgid - The first image index this image collection contains. - * @param {integer} [width=32] - Width of widest image (in pixels). - * @param {integer} [height=32] - Height of tallest image (in pixels). - * @param {integer} [margin=0] - The margin around all images in the collection (in pixels). - * @param {integer} [spacing=0] - The spacing between each image in the collection (in pixels). - * @param {object} [properties={}] - Custom Image Collection properties. - */ -var ImageCollection = new Class({ - - initialize: - - function ImageCollection (name, firstgid, width, height, margin, spacing, properties) - { - if (width === undefined || width <= 0) { width = 32; } - if (height === undefined || height <= 0) { height = 32; } - if (margin === undefined) { margin = 0; } - if (spacing === undefined) { spacing = 0; } - - /** - * The name of the Image Collection. - * - * @name Phaser.Tilemaps.ImageCollection#name - * @type {string} - * @since 3.0.0 - */ - this.name = name; - - /** - * The Tiled firstgid value. - * This is the starting index of the first image index this Image Collection contains. - * - * @name Phaser.Tilemaps.ImageCollection#firstgid - * @type {integer} - * @since 3.0.0 - */ - this.firstgid = firstgid | 0; - - /** - * The width of the widest image (in pixels). - * - * @name Phaser.Tilemaps.ImageCollection#imageWidth - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.imageWidth = width | 0; - - /** - * The height of the tallest image (in pixels). - * - * @name Phaser.Tilemaps.ImageCollection#imageHeight - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.imageHeight = height | 0; - - /** - * The margin around the images in the collection (in pixels). - * Use `setSpacing` to change. - * - * @name Phaser.Tilemaps.ImageCollection#imageMarge - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.imageMargin = margin | 0; - - /** - * The spacing between each image in the collection (in pixels). - * Use `setSpacing` to change. - * - * @name Phaser.Tilemaps.ImageCollection#imageSpacing - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.imageSpacing = spacing | 0; - - /** - * Image Collection-specific properties that are typically defined in the Tiled editor. - * - * @name Phaser.Tilemaps.ImageCollection#properties - * @type {object} - * @since 3.0.0 - */ - this.properties = properties || {}; - - /** - * The cached images that are a part of this collection. - * - * @name Phaser.Tilemaps.ImageCollection#images - * @type {array} - * @readonly - * @since 3.0.0 - */ - this.images = []; - - /** - * The total number of images in the image collection. - * - * @name Phaser.Tilemaps.ImageCollection#total - * @type {integer} - * @readonly - * @since 3.0.0 - */ - this.total = 0; - }, - - /** - * Returns true if and only if this image collection contains the given image index. - * - * @method Phaser.Tilemaps.ImageCollection#containsImageIndex - * @since 3.0.0 - * - * @param {integer} imageIndex - The image index to search for. - * - * @return {boolean} True if this Image Collection contains the given index. - */ - containsImageIndex: function (imageIndex) - { - return (imageIndex >= this.firstgid && imageIndex < (this.firstgid + this.total)); - }, - - /** - * Add an image to this Image Collection. - * - * @method Phaser.Tilemaps.ImageCollection#addImage - * @since 3.0.0 - * - * @param {integer} gid - The gid of the image in the Image Collection. - * @param {string} image - The the key of the image in the Image Collection and in the cache. - * - * @return {Phaser.Tilemaps.ImageCollection} This ImageCollection object. - */ - addImage: function (gid, image) - { - this.images.push({ gid: gid, image: image }); - this.total++; - - return this; - } - -}); - -module.exports = ImageCollection; - - -/***/ }), -/* 514 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var HasValue = __webpack_require__(115); - -/** - * Returns a new object that only contains the `keys` that were found on the object provided. - * If no `keys` are found, an empty object is returned. - * - * @function Phaser.Utils.Objects.Pick - * @since 3.18.0 - * - * @param {object} object - The object to pick the provided keys from. - * @param {array} keys - An array of properties to retrieve from the provided object. - * - * @return {object} A new object that only contains the `keys` that were found on the provided object. If no `keys` were found, an empty object will be returned. - */ -var Pick = function (object, keys) -{ - var obj = {}; - - for (var i = 0; i < keys.length; i++) - { - var key = keys[i]; - - if (HasValue(object, key)) - { - obj[key] = object[key]; - } - } - - return obj; -}; - -module.exports = Pick; - - -/***/ }), -/* 515 */ +/* 549 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116175,8 +122907,8 @@ module.exports = Pick; */ var GetFastValue = __webpack_require__(2); -var ParseObject = __webpack_require__(239); -var ObjectLayer = __webpack_require__(516); +var ParseObject = __webpack_require__(251); +var ObjectLayer = __webpack_require__(551); var CreateGroupLayer = __webpack_require__(154); /** @@ -116264,7 +122996,51 @@ module.exports = ParseObjectLayers; /***/ }), -/* 516 */ +/* 550 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var HasValue = __webpack_require__(123); + +/** + * Returns a new object that only contains the `keys` that were found on the object provided. + * If no `keys` are found, an empty object is returned. + * + * @function Phaser.Utils.Objects.Pick + * @since 3.18.0 + * + * @param {object} object - The object to pick the provided keys from. + * @param {array} keys - An array of properties to retrieve from the provided object. + * + * @return {object} A new object that only contains the `keys` that were found on the provided object. If no `keys` were found, an empty object will be returned. + */ +var Pick = function (object, keys) +{ + var obj = {}; + + for (var i = 0; i < keys.length; i++) + { + var key = keys[i]; + + if (HasValue(object, key)) + { + obj[key] = object[key]; + } + } + + return obj; +}; + +module.exports = Pick; + + +/***/ }), +/* 551 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116386,7 +123162,7 @@ module.exports = ObjectLayer; /***/ }), -/* 517 */ +/* 552 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116395,93 +123171,269 @@ module.exports = ObjectLayer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Tileset = __webpack_require__(107); +var Base64Decode = __webpack_require__(553); +var CONST = __webpack_require__(29); +var CreateGroupLayer = __webpack_require__(154); +var FromOrientationString = __webpack_require__(242); +var GetFastValue = __webpack_require__(2); +var LayerData = __webpack_require__(117); +var ParseGID = __webpack_require__(252); +var Tile = __webpack_require__(81); /** - * Master list of tiles -> x, y, index in tileset. + * Parses all tilemap layers in a Tiled JSON object into new LayerData objects. * - * @function Phaser.Tilemaps.Parsers.Tiled.BuildTilesetIndex + * @function Phaser.Tilemaps.Parsers.Tiled.ParseTileLayers * @since 3.0.0 * - * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. + * @param {object} json - The Tiled JSON object. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}). * - * @return {array} An array of Tileset objects. + * @return {Phaser.Tilemaps.LayerData[]} - An array of LayerData objects, one for each entry in + * json.layers with the type 'tilelayer'. */ -var BuildTilesetIndex = function (mapData) +var ParseTileLayers = function (json, insertNull) { - var i; - var set; - var tiles = []; + var infiniteMap = GetFastValue(json, 'infinite', false); + var tileLayers = []; - for (i = 0; i < mapData.imageCollections.length; i++) + // State inherited from a parent group + var groupStack = []; + var curGroupState = CreateGroupLayer(json); + + while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) { - var collection = mapData.imageCollections[i]; - var images = collection.images; - - for (var j = 0; j < images.length; j++) + if (curGroupState.i >= curGroupState.layers.length) { - var image = images[j]; - - set = new Tileset(image.image, image.gid, collection.imageWidth, collection.imageHeight, 0, 0); - - set.updateTileData(collection.imageWidth, collection.imageHeight); - - mapData.tilesets.push(set); - } - } - - for (i = 0; i < mapData.tilesets.length; i++) - { - set = mapData.tilesets[i]; - - var x = set.tileMargin; - var y = set.tileMargin; - - var count = 0; - var countX = 0; - var countY = 0; - - for (var t = set.firstgid; t < set.firstgid + set.total; t++) - { - // Can add extra properties here as needed - tiles[t] = [ x, y, i ]; - - x += set.tileWidth + set.tileSpacing; - - count++; - - if (count === set.total) + // Ensure recursion stack is not empty first + if (groupStack.length < 1) { + console.warn( + 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' + ); break; } - countX++; + // Return to previous recursive state + curGroupState = groupStack.pop(); + continue; + } - if (countX === set.columns) + var curl = curGroupState.layers[curGroupState.i]; + curGroupState.i++; + + if (curl.type !== 'tilelayer') + { + if (curl.type === 'group') { - x = set.tileMargin; - y += set.tileHeight + set.tileSpacing; + // Compute next state inherited from group + var nextGroupState = CreateGroupLayer(json, curl, curGroupState); - countX = 0; - countY++; + // Preserve current state before recursing + groupStack.push(curGroupState); + curGroupState = nextGroupState; + } - if (countY === set.rows) + // Skip this layer OR 'recurse' (iterative style) into the group + continue; + } + + // Base64 decode data if necessary. NOTE: uncompressed base64 only. + if (curl.compression) + { + console.warn( + 'TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer \'' + + curl.name + '\'' + ); + continue; + } + else if (curl.encoding && curl.encoding === 'base64') + { + // Chunks for an infinite map + if (curl.chunks) + { + for (var i = 0; i < curl.chunks.length; i++) { - break; + curl.chunks[i].data = Base64Decode(curl.chunks[i].data); + } + } + + // Non-infinite map data + if (curl.data) + { + curl.data = Base64Decode(curl.data); + } + + delete curl.encoding; // Allow the same map to be parsed multiple times + } + + // This is an array containing the tile indexes, one after the other. -1 = no tile, + // everything else = the tile index (starting at 1 for Tiled, 0 for CSV) If the map + // contains multiple tilesets then the indexes are relative to that which the set starts + // from. Need to set which tileset in the cache = which tileset in the JSON, if you do this + // manually it means you can use the same map data but a new tileset. + + var layerData; + var gidInfo; + var tile; + var blankTile; + + var output = []; + var x = 0; + + if (infiniteMap) + { + var layerOffsetX = (GetFastValue(curl, 'startx', 0) + curl.x); + var layerOffsetY = (GetFastValue(curl, 'starty', 0) + curl.y); + + layerData = new LayerData({ + name: (curGroupState.name + curl.name), + x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth), + y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight), + width: curl.width, + height: curl.height, + tileWidth: json.tilewidth, + tileHeight: json.tileheight, + alpha: (curGroupState.opacity * curl.opacity), + visible: (curGroupState.visible && curl.visible), + properties: GetFastValue(curl, 'properties', []), + orientation: FromOrientationString(json.orientation) + }); + + if (layerData.orientation === CONST.HEXAGONAL) + { + layerData.hexSideLength = json.hexsidelength; + } + + for (var c = 0; c < curl.height; c++) + { + output.push([ null ]); + + for (var j = 0; j < curl.width; j++) + { + output[c][j] = null; + } + } + + for (c = 0, len = curl.chunks.length; c < len; c++) + { + var chunk = curl.chunks[c]; + + var offsetX = (chunk.x - layerOffsetX); + var offsetY = (chunk.y - layerOffsetY); + + var y = 0; + + for (var t = 0, len2 = chunk.data.length; t < len2; t++) + { + var newOffsetX = x + offsetX; + var newOffsetY = y + offsetY; + + gidInfo = ParseGID(chunk.data[t]); + + // index, x, y, width, height + if (gidInfo.gid > 0) + { + tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); + + // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal + // propeties into flipX, flipY and rotation + tile.rotation = gidInfo.rotation; + tile.flipX = gidInfo.flipped; + + output[newOffsetY][newOffsetX] = tile; + } + else + { + blankTile = insertNull + ? null + : new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); + + output[newOffsetY][newOffsetX] = blankTile; + } + + x++; + + if (x === chunk.width) + { + y++; + x = 0; + } } } } + else + { + layerData = new LayerData({ + name: (curGroupState.name + curl.name), + x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x), + y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y), + width: curl.width, + height: curl.height, + tileWidth: json.tilewidth, + tileHeight: json.tileheight, + alpha: (curGroupState.opacity * curl.opacity), + visible: (curGroupState.visible && curl.visible), + properties: GetFastValue(curl, 'properties', []), + orientation: FromOrientationString(json.orientation) + }); + + if (layerData.orientation === CONST.HEXAGONAL) + { + layerData.hexSideLength = json.hexsidelength; + } + var row = []; + + // Loop through the data field in the JSON. + for (var k = 0, len = curl.data.length; k < len; k++) + { + gidInfo = ParseGID(curl.data[k]); + + // index, x, y, width, height + if (gidInfo.gid > 0) + { + tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth, json.tileheight); + + // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal + // propeties into flipX, flipY and rotation + tile.rotation = gidInfo.rotation; + tile.flipX = gidInfo.flipped; + + row.push(tile); + } + else + { + blankTile = insertNull + ? null + : new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight); + row.push(blankTile); + } + + x++; + + if (x === curl.width) + { + output.push(row); + x = 0; + row = []; + } + } + } + + layerData.data = output; + tileLayers.push(layerData); } - return tiles; + return tileLayers; }; -module.exports = BuildTilesetIndex; +module.exports = ParseTileLayers; /***/ }), -/* 518 */ -/***/ (function(module, exports, __webpack_require__) { +/* 553 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -116489,71 +123441,41 @@ module.exports = BuildTilesetIndex; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(19); - /** - * Copy properties from tileset to tiles. + * Decode base-64 encoded data, for example as exported by Tiled. * - * @function Phaser.Tilemaps.Parsers.Tiled.AssignTileProperties + * @function Phaser.Tilemaps.Parsers.Tiled.Base64Decode * @since 3.0.0 * - * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. + * @param {object} data - Base-64 encoded data to decode. + * + * @return {array} Array containing the decoded bytes. */ -var AssignTileProperties = function (mapData) +var Base64Decode = function (data) { - var layerData; - var tile; - var sid; - var set; - var row; + var binaryString = window.atob(data); + var len = binaryString.length; + var bytes = new Array(len / 4); - // go through each of the map data layers - for (var i = 0; i < mapData.layers.length; i++) + // Interpret binaryString as an array of bytes representing little-endian encoded uint32 values. + for (var i = 0; i < len; i += 4) { - layerData = mapData.layers[i]; - - set = null; - - // rows of tiles - for (var j = 0; j < layerData.data.length; j++) - { - row = layerData.data[j]; - - // individual tiles - for (var k = 0; k < row.length; k++) - { - tile = row[k]; - - if (tile === null || tile.index < 0) - { - continue; - } - - // find the relevant tileset - sid = mapData.tiles[tile.index][2]; - set = mapData.tilesets[sid]; - - // Ensure that a tile's size matches its tileset - tile.width = set.tileWidth; - tile.height = set.tileHeight; - - // if that tile type has any properties, add them to the tile object - if (set.tileProperties && set.tileProperties[tile.index - set.firstgid]) - { - tile.properties = Extend( - tile.properties, set.tileProperties[tile.index - set.firstgid] - ); - } - } - } + bytes[i / 4] = ( + binaryString.charCodeAt(i) | + binaryString.charCodeAt(i + 1) << 8 | + binaryString.charCodeAt(i + 2) << 16 | + binaryString.charCodeAt(i + 3) << 24 + ) >>> 0; } + + return bytes; }; -module.exports = AssignTileProperties; +module.exports = Base64Decode; /***/ }), -/* 519 */ +/* 554 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116562,10 +123484,363 @@ module.exports = AssignTileProperties; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Formats = __webpack_require__(33); -var MapData = __webpack_require__(106); -var ParseTileLayers = __webpack_require__(520); -var ParseTilesets = __webpack_require__(521); +var Tileset = __webpack_require__(119); +var ImageCollection = __webpack_require__(555); +var ParseObject = __webpack_require__(251); + +/** + * Tilesets and Image Collections + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseTilesets + * @since 3.0.0 + * + * @param {object} json - The Tiled JSON data. + * + * @return {object} An object containing the tileset and image collection data. + */ +var ParseTilesets = function (json) +{ + var tilesets = []; + var imageCollections = []; + var lastSet = null; + var stringID; + + for (var i = 0; i < json.tilesets.length; i++) + { + // name, firstgid, width, height, margin, spacing, properties + var set = json.tilesets[i]; + + if (set.source) + { + console.warn('External tilesets unsupported. Use Embed Tileset and re-export'); + } + else if (set.image) + { + var newSet = new Tileset(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing); + + if (json.version > 1) + { + // Tiled 1.2+ + + if (Array.isArray(set.tiles)) + { + var tiles = {}; + var props = {}; + + for (var t = 0; t < set.tiles.length; t++) + { + var tile = set.tiles[t]; + + // Convert tileproperties + if (tile.properties) + { + var newPropData = {}; + + tile.properties.forEach(function (propData) + { + newPropData[propData['name']] = propData['value']; + }); + + props[tile.id] = newPropData; + } + + // Convert objectgroup + if (tile.objectgroup) + { + tiles[tile.id] = { objectgroup: tile.objectgroup }; + + if (tile.objectgroup.objects) + { + var parsedObjects2 = tile.objectgroup.objects.map(function (obj) + { + return ParseObject(obj); + }); + + tiles[tile.id].objectgroup.objects = parsedObjects2; + } + } + + // Copy animation data + if (tile.animation) + { + if (tiles.hasOwnProperty(tile.id)) + { + tiles[tile.id].animation = tile.animation; + } + else + { + tiles[tile.id] = { animation: tile.animation }; + } + } + } + + newSet.tileData = tiles; + newSet.tileProperties = props; + } + } + else + { + // Tiled 1 + + // Properties stored per-tile in object with string indexes starting at "0" + if (set.tileproperties) + { + newSet.tileProperties = set.tileproperties; + } + + // Object & terrain shapes stored per-tile in object with string indexes starting at "0" + if (set.tiles) + { + newSet.tileData = set.tiles; + + // Parse the objects into Phaser format to match handling of other Tiled objects + for (stringID in newSet.tileData) + { + var objectGroup = newSet.tileData[stringID].objectgroup; + + if (objectGroup && objectGroup.objects) + { + var parsedObjects1 = objectGroup.objects.map(function (obj) + { + return ParseObject(obj); + }); + + newSet.tileData[stringID].objectgroup.objects = parsedObjects1; + } + } + } + } + + // For a normal sliced tileset the row/count/size information is computed when updated. + // This is done (again) after the image is set. + newSet.updateTileData(set.imagewidth, set.imageheight); + + tilesets.push(newSet); + } + else + { + var newCollection = new ImageCollection(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing, set.properties); + + var maxId = 0; + + for (t = 0; t < set.tiles.length; t++) + { + tile = set.tiles[t]; + + var image = tile.image; + var tileId = parseInt(tile.id, 10); + var gid = set.firstgid + tileId; + newCollection.addImage(gid, image); + + maxId = Math.max(tileId, maxId); + } + + newCollection.maxId = maxId; + + imageCollections.push(newCollection); + } + + // We've got a new Tileset, so set the lastgid into the previous one + if (lastSet) + { + lastSet.lastgid = set.firstgid - 1; + } + + lastSet = set; + } + + return { tilesets: tilesets, imageCollections: imageCollections }; +}; + +module.exports = ParseTilesets; + + +/***/ }), +/* 555 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); + +/** + * @classdesc + * An Image Collection is a special Tile Set containing multiple images, with no slicing into each image. + * + * Image Collections are normally created automatically when Tiled data is loaded. + * + * @class ImageCollection + * @memberof Phaser.Tilemaps + * @constructor + * @since 3.0.0 + * + * @param {string} name - The name of the image collection in the map data. + * @param {number} firstgid - The first image index this image collection contains. + * @param {number} [width=32] - Width of widest image (in pixels). + * @param {number} [height=32] - Height of tallest image (in pixels). + * @param {number} [margin=0] - The margin around all images in the collection (in pixels). + * @param {number} [spacing=0] - The spacing between each image in the collection (in pixels). + * @param {object} [properties={}] - Custom Image Collection properties. + */ +var ImageCollection = new Class({ + + initialize: + + function ImageCollection (name, firstgid, width, height, margin, spacing, properties) + { + if (width === undefined || width <= 0) { width = 32; } + if (height === undefined || height <= 0) { height = 32; } + if (margin === undefined) { margin = 0; } + if (spacing === undefined) { spacing = 0; } + + /** + * The name of the Image Collection. + * + * @name Phaser.Tilemaps.ImageCollection#name + * @type {string} + * @since 3.0.0 + */ + this.name = name; + + /** + * The Tiled firstgid value. + * This is the starting index of the first image index this Image Collection contains. + * + * @name Phaser.Tilemaps.ImageCollection#firstgid + * @type {number} + * @since 3.0.0 + */ + this.firstgid = firstgid | 0; + + /** + * The width of the widest image (in pixels). + * + * @name Phaser.Tilemaps.ImageCollection#imageWidth + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageWidth = width | 0; + + /** + * The height of the tallest image (in pixels). + * + * @name Phaser.Tilemaps.ImageCollection#imageHeight + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageHeight = height | 0; + + /** + * The margin around the images in the collection (in pixels). + * Use `setSpacing` to change. + * + * @name Phaser.Tilemaps.ImageCollection#imageMarge + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageMargin = margin | 0; + + /** + * The spacing between each image in the collection (in pixels). + * Use `setSpacing` to change. + * + * @name Phaser.Tilemaps.ImageCollection#imageSpacing + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageSpacing = spacing | 0; + + /** + * Image Collection-specific properties that are typically defined in the Tiled editor. + * + * @name Phaser.Tilemaps.ImageCollection#properties + * @type {object} + * @since 3.0.0 + */ + this.properties = properties || {}; + + /** + * The cached images that are a part of this collection. + * + * @name Phaser.Tilemaps.ImageCollection#images + * @type {array} + * @readonly + * @since 3.0.0 + */ + this.images = []; + + /** + * The total number of images in the image collection. + * + * @name Phaser.Tilemaps.ImageCollection#total + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.total = 0; + }, + + /** + * Returns true if and only if this image collection contains the given image index. + * + * @method Phaser.Tilemaps.ImageCollection#containsImageIndex + * @since 3.0.0 + * + * @param {number} imageIndex - The image index to search for. + * + * @return {boolean} True if this Image Collection contains the given index. + */ + containsImageIndex: function (imageIndex) + { + return (imageIndex >= this.firstgid && imageIndex < (this.firstgid + this.total)); + }, + + /** + * Add an image to this Image Collection. + * + * @method Phaser.Tilemaps.ImageCollection#addImage + * @since 3.0.0 + * + * @param {number} gid - The gid of the image in the Image Collection. + * @param {string} image - The the key of the image in the Image Collection and in the cache. + * + * @return {Phaser.Tilemaps.ImageCollection} This ImageCollection object. + */ + addImage: function (gid, image) + { + this.images.push({ gid: gid, image: image }); + this.total++; + + return this; + } + +}); + +module.exports = ImageCollection; + + +/***/ }), +/* 556 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Formats = __webpack_require__(38); +var MapData = __webpack_require__(118); +var ParseTileLayers = __webpack_require__(557); +var ParseTilesets = __webpack_require__(558); /** * Parses a Weltmeister JSON object into a new MapData object. @@ -116620,7 +123895,7 @@ module.exports = ParseWeltmeister; /***/ }), -/* 520 */ +/* 557 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116629,8 +123904,8 @@ module.exports = ParseWeltmeister; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LayerData = __webpack_require__(105); -var Tile = __webpack_require__(75); +var LayerData = __webpack_require__(117); +var Tile = __webpack_require__(81); /** * Parses all tilemap layers in an Impact JSON object into new LayerData objects. @@ -116706,7 +123981,7 @@ module.exports = ParseTileLayers; /***/ }), -/* 521 */ +/* 558 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116715,7 +123990,7 @@ module.exports = ParseTileLayers; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Tileset = __webpack_require__(107); +var Tileset = __webpack_require__(119); /** * Tilesets and Image Collections @@ -116757,7 +124032,7 @@ module.exports = ParseTilesets; /***/ }), -/* 522 */ +/* 559 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -116767,17 +124042,17 @@ module.exports = ParseTilesets; */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(41); -var DynamicTilemapLayer = __webpack_require__(523); -var Extend = __webpack_require__(19); -var Formats = __webpack_require__(33); -var LayerData = __webpack_require__(105); -var Rotate = __webpack_require__(344); -var SpliceOne = __webpack_require__(82); -var StaticTilemapLayer = __webpack_require__(524); -var Tile = __webpack_require__(75); -var TilemapComponents = __webpack_require__(149); -var Tileset = __webpack_require__(107); +var DegToRad = __webpack_require__(34); +var Formats = __webpack_require__(38); +var GetFastValue = __webpack_require__(2); +var LayerData = __webpack_require__(117); +var Rotate = __webpack_require__(354); +var SpliceOne = __webpack_require__(103); +var Sprite = __webpack_require__(70); +var Tile = __webpack_require__(81); +var TilemapComponents = __webpack_require__(243); +var TilemapLayer = __webpack_require__(560); +var Tileset = __webpack_require__(119); /** * @callback TilemapFilterCallback @@ -116803,25 +124078,39 @@ var Tileset = __webpack_require__(107); * @classdesc * A Tilemap is a container for Tilemap data. This isn't a display object, rather, it holds data * about the map and allows you to add tilesets and tilemap layers to it. A map can have one or - * more tilemap layers (StaticTilemapLayer or DynamicTilemapLayer), which are the display - * objects that actually render tiles. + * more tilemap layers, which are the display objects that actually render the tiles. * - * The Tilemap data be parsed from a Tiled JSON file, a CSV file or a 2D array. Tiled is a free + * The Tilemap data can be parsed from a Tiled JSON file, a CSV file or a 2D array. Tiled is a free * software package specifically for creating tile maps, and is available from: * http://www.mapeditor.org * - * A Tilemap has handy methods for getting & manipulating the tiles within a layer. You can only - * use the methods that change tiles (e.g. removeTileAt) on a DynamicTilemapLayer. + * As of Phaser 3.50.0 the Tilemap API now supports the following types of map: + * + * 1) Orthogonal + * 2) Isometric + * 3) Hexagonal + * 4) Staggered + * + * Prior to this release, only orthogonal maps were supported. + * + * Another large change in 3.50 was the consolidation of Tilemap Layers. Previously, you created + * either a Static or Dynamic Tilemap Layer. However, as of 3.50 the features of both have been + * merged and the API simplified, so now there is just the single `TilemapLayer` class. + * + * A Tilemap has handy methods for getting and manipulating the tiles within a layer, allowing + * you to build or modify the tilemap data at runtime. * * Note that all Tilemaps use a base tile size to calculate dimensions from, but that a - * StaticTilemapLayer or DynamicTilemapLayer may have its own unique tile size that overrides - * it. + * TilemapLayer may have its own unique tile size that overrides this. * * As of Phaser 3.21.0, if your tilemap includes layer groups (a feature of Tiled 1.2.0+) these - * will be traversed and the following properties will affect children: - * - opacity (blended with parent) and visibility (parent overrides child) + * will be traversed and the following properties will impact children: + * + * - Opacity (blended with parent) and visibility (parent overrides child) * - Vertical and horizontal offset + * * The grouping hierarchy is not preserved and all layers will be flattened into a single array. + * * Group layers are parsed during Tilemap construction but are discarded after parsing so dynamic * layers will NOT continue to be affected by a parent. * @@ -116856,7 +124145,7 @@ var Tilemap = new Class({ * width. * * @name Phaser.Tilemaps.Tilemap#tileWidth - * @type {integer} + * @type {number} * @since 3.0.0 */ this.tileWidth = mapData.tileWidth; @@ -116866,7 +124155,7 @@ var Tilemap = new Class({ * tile height. * * @name Phaser.Tilemaps.Tilemap#tileHeight - * @type {integer} + * @type {number} * @since 3.0.0 */ this.tileHeight = mapData.tileHeight; @@ -116962,6 +124251,7 @@ var Tilemap = new Class({ this.heightInPixels = mapData.heightInPixels; /** + * A collection of Images, as parsed from Tiled map data. * * @name Phaser.Tilemaps.Tilemap#imageCollections * @type {Phaser.Tilemaps.ImageCollection[]} @@ -117009,10 +124299,70 @@ var Tilemap = new Class({ * The index of the currently selected LayerData object. * * @name Phaser.Tilemaps.Tilemap#currentLayerIndex - * @type {integer} + * @type {number} * @since 3.0.0 */ this.currentLayerIndex = 0; + + /** + * The length of the horizontal sides of the hexagon. + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.Tilemap#hexSideLength + * @type {number} + * @since 3.50.0 + */ + this.hexSideLength = mapData.hexSideLength; + + var orientation = this.orientation; + + /** + * Functions used to handle world to tile, and tile to world, conversion. + * Cached here for internal use by public methods such as `worldToTileXY`, etc. + * + * @name Phaser.Tilemaps.Tilemap#_convert + * @private + * @type {object} + * @since 3.50.0 + */ + this._convert = { + WorldToTileXY: TilemapComponents.GetWorldToTileXYFunction(orientation), + WorldToTileX: TilemapComponents.GetWorldToTileXFunction(orientation), + WorldToTileY: TilemapComponents.GetWorldToTileYFunction(orientation), + TileToWorldXY: TilemapComponents.GetTileToWorldXYFunction(orientation), + TileToWorldX: TilemapComponents.GetTileToWorldXFunction(orientation), + TileToWorldY: TilemapComponents.GetTileToWorldYFunction(orientation) + }; + }, + + /** + * @ignore + */ + createBlankDynamicLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) + { + console.warn('createBlankDynamicLayer is deprecated. Use createBlankLayer'); + + return this.createBlankLayer(name, tileset, x, y, width, height, tileWidth, tileHeight); + }, + + /** + * @ignore + */ + createDynamicLayer: function (layerID, tileset, x, y) + { + console.warn('createDynamicLayer is deprecated. Use createLayer'); + + return this.createLayer(layerID, tileset, x, y); + }, + + /** + * @ignore + */ + createStaticLayer: function (layerID, tileset, x, y) + { + console.warn('createStaticLayer is deprecated. Use createLayer'); + + return this.createLayer(layerID, tileset, x, y); }, /** @@ -117033,14 +124383,14 @@ var Tilemap = new Class({ * * You can provide either an integer (0 to 3), or the string version of the order. * - * Calling this method _after_ creating Static or Dynamic Tilemap Layers will **not** automatically + * Calling this method _after_ creating Tilemap Layers will **not** automatically * update them to use the new render order. If you call this method after creating layers, use their * own `setRenderOrder` methods to change them as needed. * * @method Phaser.Tilemaps.Tilemap#setRenderOrder * @since 3.12.0 * - * @param {(integer|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. + * @param {(number|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. * * @return {this} This Tilemap object. */ @@ -117072,17 +124422,17 @@ var Tilemap = new Class({ * @param {string} tilesetName - The name of the tileset as specified in the map data. * @param {string} [key] - The key of the Phaser.Cache image used for this tileset. If * `undefined` or `null` it will look for an image with a key matching the tilesetName parameter. - * @param {integer} [tileWidth] - The width of the tile (in pixels) in the Tileset Image. If not + * @param {number} [tileWidth] - The width of the tile (in pixels) in the Tileset Image. If not * given it will default to the map's tileWidth value, or the tileWidth specified in the Tiled * JSON file. - * @param {integer} [tileHeight] - The height of the tiles (in pixels) in the Tileset Image. If + * @param {number} [tileHeight] - The height of the tiles (in pixels) in the Tileset Image. If * not given it will default to the map's tileHeight value, or the tileHeight specified in the * Tiled JSON file. - * @param {integer} [tileMargin] - The margin around the tiles in the sheet (in pixels). If not + * @param {number} [tileMargin] - The margin around the tiles in the sheet (in pixels). If not * specified, it will default to 0 or the value specified in the Tiled JSON file. - * @param {integer} [tileSpacing] - The spacing between each the tile in the sheet (in pixels). + * @param {number} [tileSpacing] - The spacing between each the tile in the sheet (in pixels). * If not specified, it will default to 0 or the value specified in the Tiled JSON file. - * @param {integer} [gid=0] - If adding multiple tilesets to a blank map, specify the starting + * @param {number} [gid=0] - If adding multiple tilesets to a blank map, specify the starting * GID this set will use here. * * @return {?Phaser.Tilemaps.Tileset} Returns the Tileset object that was created or updated, or null if it @@ -117135,51 +124485,6 @@ var Tilemap = new Class({ return tileset; }, - /** - * Turns the DynamicTilemapLayer associated with the given layer into a StaticTilemapLayer. If - * no layer specified, the map's current layer is used. This is useful if you want to manipulate - * a map at the start of a scene, but then make it non-manipulable and optimize it for speed. - * Note: the DynamicTilemapLayer passed in is destroyed, so make sure to store the value - * returned from this method if you want to manipulate the new StaticTilemapLayer. - * - * @method Phaser.Tilemaps.Tilemap#convertLayerToStatic - * @since 3.0.0 - * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer)} [layer] - The name of the layer from Tiled, the - * index of the layer in the map, or a DynamicTilemapLayer. - * - * @return {?Phaser.Tilemaps.StaticTilemapLayer} Returns the new layer that was created, or null if it - * failed. - */ - convertLayerToStatic: function (layer) - { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - var dynamicLayer = layer.tilemapLayer; - - if (!dynamicLayer || !(dynamicLayer instanceof DynamicTilemapLayer)) - { - return null; - } - - var staticLayer = new StaticTilemapLayer( - dynamicLayer.scene, - dynamicLayer.tilemap, - dynamicLayer.layerIndex, - dynamicLayer.tileset, - dynamicLayer.x, - dynamicLayer.y - ); - - this.scene.sys.displayList.add(staticLayer); - - dynamicLayer.destroy(); - - return staticLayer; - }, - /** * Copies the tiles in the source rectangular area to a new destination (all specified in tile * coordinates) within the layer. This copies all tile properties & recalculates collision @@ -117190,14 +124495,14 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#copy * @since 3.0.0 * - * @param {integer} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} width - The width of the area to copy, in tiles, not pixels. - * @param {integer} height - The height of the area to copy, in tiles, not pixels. - * @param {integer} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. - * @param {integer} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. + * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. + * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. + * @param {number} width - The width of the area to copy, in tiles, not pixels. + * @param {number} height - The height of the area to copy, in tiles, not pixels. + * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. + * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -117205,8 +124510,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'copy')) { return this; } - if (layer !== null) { TilemapComponents.Copy( @@ -117225,23 +124528,25 @@ var Tilemap = new Class({ }, /** - * Creates a new and empty DynamicTilemapLayer. The currently selected layer in the map is set to this new layer. + * Creates a new and empty Tilemap Layer. The currently selected layer in the map is set to this new layer. * - * @method Phaser.Tilemaps.Tilemap#createBlankDynamicLayer + * Prior to v3.50.0 this method was called `createBlankDynamicLayer`. + * + * @method Phaser.Tilemaps.Tilemap#createBlankLayer * @since 3.0.0 * * @param {string} name - The name of this layer. Must be unique within the map. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. * @param {number} [x=0] - The world x position where the top left of this layer will be placed. * @param {number} [y=0] - The world y position where the top left of this layer will be placed. - * @param {integer} [width] - The width of the layer in tiles. If not specified, it will default to the map's width. - * @param {integer} [height] - The height of the layer in tiles. If not specified, it will default to the map's height. - * @param {integer} [tileWidth] - The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth. - * @param {integer} [tileHeight] - The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight. + * @param {number} [width] - The width of the layer in tiles. If not specified, it will default to the map's width. + * @param {number} [height] - The height of the layer in tiles. If not specified, it will default to the map's height. + * @param {number} [tileWidth] - The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth. + * @param {number} [tileHeight] - The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight. * - * @return {?Phaser.Tilemaps.DynamicTilemapLayer} Returns the new layer that was created, or `null` if it failed. + * @return {?Phaser.Tilemaps.TilemapLayer} Returns the new layer that was created, or `null` if it failed. */ - createBlankDynamicLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) + createBlankLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) { if (x === undefined) { x = 0; } if (y === undefined) { y = 0; } @@ -117263,7 +124568,8 @@ var Tilemap = new Class({ tileWidth: tileWidth, tileHeight: tileHeight, width: width, - height: height + height: height, + orientation: this.orientation }); var row; @@ -117284,37 +124590,36 @@ var Tilemap = new Class({ this.currentLayerIndex = this.layers.length - 1; - var dynamicLayer = new DynamicTilemapLayer(this.scene, this, this.currentLayerIndex, tileset, x, y); + var layer = new TilemapLayer(this.scene, this, this.currentLayerIndex, tileset, x, y); - dynamicLayer.setRenderOrder(this.renderOrder); + layer.setRenderOrder(this.renderOrder); - this.scene.sys.displayList.add(dynamicLayer); + this.scene.sys.displayList.add(layer); - return dynamicLayer; + return layer; }, /** - * Creates a new DynamicTilemapLayer that renders the LayerData associated with the given + * Creates a new Tilemap Layer that renders the LayerData associated with the given * `layerID`. The currently selected layer in the map is set to this new layer. * * The `layerID` is important. If you've created your map in Tiled then you can get this by * looking in Tiled and looking at the layer name. Or you can open the JSON file it exports and * look at the layers[].name value. Either way it must match. * - * Unlike a static layer, a dynamic layer can be modified. See DynamicTilemapLayer for more - * information. + * Prior to v3.50.0 this method was called `createDynamicLayer`. * - * @method Phaser.Tilemaps.Tilemap#createDynamicLayer + * @method Phaser.Tilemaps.Tilemap#createLayer * @since 3.0.0 * - * @param {(integer|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. + * @param {(number|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. * - * @return {?Phaser.Tilemaps.DynamicTilemapLayer} Returns the new layer was created, or null if it failed. + * @return {?Phaser.Tilemaps.TilemapLayer} Returns the new layer was created, or null if it failed. */ - createDynamicLayer: function (layerID, tileset, x, y) + createLayer: function (layerID, tileset, x, y) { var index = this.getLayerIndex(layerID); @@ -117353,7 +124658,7 @@ var Tilemap = new Class({ y = layerData.y; } - var layer = new DynamicTilemapLayer(this.scene, this, index, tileset, x, y); + var layer = new TilemapLayer(this.scene, this, index, tileset, x, y); layer.setRenderOrder(this.renderOrder); @@ -117363,87 +124668,188 @@ var Tilemap = new Class({ }, /** - * Creates a Sprite for every object matching the given gid in the map data. All properties from - * the map data objectgroup are copied into the `spriteConfig`, so you can use this as an easy - * way to configure Sprite properties from within the map editor. For example giving an object a - * property of alpha: 0.5 in the map editor will duplicate that when the Sprite is created. + * This method will iterate through all of the objects defined in a Tiled Object Layer and then + * convert the matching results into Phaser Game Objects (by default, Sprites) * - * Custom object properties not sharing names with the Sprite's own properties are copied to the - * Sprite's {@link Phaser.GameObjects.Sprite#data data store}. + * Objects are matched on one of 3 criteria: The Object ID, the Object GID or the Object Name. + * + * Within Tiled, Object IDs are unique per Object. Object GIDs, however, are shared by all objects + * using the same image. Finally, Object Names are strings and the same name can be used on multiple + * Objects in Tiled, they do not have to be unique. + * + * You set the configuration parameter accordingly, based on which type of criteria you wish + * to match against. For example, to convert all items on an Object Layer with a `gid` of 26: + * + * ```javascript + * createFromObjects(layerName, { + * gid: 26 + * }); + * ``` + * + * Or, to convert objects with the name 'bonus': + * + * ```javascript + * createFromObjects(layerName, { + * name: 'bonus' + * }); + * ``` + * + * Or, to convert an object with a specific id: + * + * ```javascript + * createFromObjects(layerName, { + * id: 9 + * }); + * ``` + * + * You should only specify either `id`, `gid`, `name`, or none of them. Do not add more than + * one criteria to your config. If you do not specify any criteria, then _all_ objects in the + * Object Layer will be converted. + * + * By default this method will convert objects into `Sprite` instances, but you can override + * this by providing your own class type: + * + * ```javascript + * createFromObjects(layerName, { + * gid: 26, + * classType: Coin + * }); + * ``` + * + * This will convert all Objects with a gid of 26 into your custom `Coin` class. You can pass + * any class type here, but it _must_ extend `Phaser.GameObjects.GameObject` as its base class. + * Your class will always be passed 1 parameter: `scene`, which is a reference to either the Scene + * specified in the config object or, if not given, the Scene to which this Tilemap belongs. + * + * All properties from object are copied into the Game Object, so you can use this as an easy + * way to configure properties from within the map editor. For example giving an object a + * property of `alpha: 0.5` in Tiled will be reflected in the Game Object that is created. + * + * Custom object properties that do not exist as a Game Object property are set in the + * Game Objects {@link Phaser.GameObjects.GameObject#data data store}. + * + * You can use set a `container` property in the config. If given, the class will be added to + * the Container instance instead of the Scene. + * + * Finally, you can provide an array of config objects, to convert multiple types of object in + * a single call: + * + * ```javascript + * createFromObjects(layerName, [ + * { + * gid: 26, + * classType: Coin + * }, + * { + * id: 9, + * classType: BossMonster + * }, + * { + * name: 'lava', + * classType: LavaTile + * } + * ]); + * ``` + * + * The signature of this method changed significantly in v3.50.0. Prior to this, it did not take config objects. * * @method Phaser.Tilemaps.Tilemap#createFromObjects * @since 3.0.0 * - * @param {string} name - The name of the object layer (from Tiled) to create Sprites from. - * @param {(integer|string)} id - Either the id (object), gid (tile object) or name (object or - * tile object) from Tiled. Ids are unique in Tiled, but a gid is shared by all tile objects - * with the same graphic. The same name can be used on multiple objects. - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. - * scene.make.sprite). - * @param {Phaser.Scene} [scene=the scene the map is within] - The Scene to create the Sprites within. + * @param {string} objectLayerName - The name of the Tiled object layer to create the Game Objects from. + * @param {Phaser.Types.Tilemaps.CreateFromObjectLayerConfig|Phaser.Types.Tilemaps.CreateFromObjectLayerConfig[]} config - A CreateFromObjects configuration object, or an array of them. * - * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. + * @return {Phaser.GameObjects.GameObject[]} An array containing the Game Objects that were created. Empty if invalid object layer, or no matching id/gid/name was found. */ - createFromObjects: function (name, id, spriteConfig, scene) + createFromObjects: function (objectLayerName, config) { - if (spriteConfig === undefined) { spriteConfig = {}; } - if (scene === undefined) { scene = this.scene; } + var results = []; - var objectLayer = this.getObjectLayer(name); + var objectLayer = this.getObjectLayer(objectLayerName); if (!objectLayer) { - console.warn('Cannot create from object. Invalid objectgroup name given: ' + name); + console.warn('createFromObjects: Invalid objectLayerName given: ' + objectLayerName); - if (typeof layerID === 'string') - { - console.warn('Valid objectgroup names:\n\t' + this.getObjectLayerNames().join(',\n\t')); - } + return results; + } - return null; + if (!Array.isArray(config)) + { + config = [ config ]; } var objects = objectLayer.objects; - var sprites = []; - for (var i = 0; i < objects.length; i++) + for (var c = 0; c < config.length; c++) { - var found = false; - var obj = objects[i]; + var singleConfig = config[c]; - if (obj.gid !== undefined && typeof id === 'number' && obj.gid === id || - obj.id !== undefined && typeof id === 'number' && obj.id === id || - obj.name !== undefined && typeof id === 'string' && obj.name === id) + var id = GetFastValue(singleConfig, 'id', null); + var gid = GetFastValue(singleConfig, 'gid', null); + var name = GetFastValue(singleConfig, 'name', null); + + var obj; + var toConvert = []; + + // Sweep to get all the objects we want to convert in this pass + for (var s = 0; s < objects.length; s++) { - found = true; + obj = objects[s]; + + if ( + (id === null && gid === null && name === null) || + (id !== null && obj.id === id) || + (gid !== null && obj.gid === gid) || + (name !== null && obj.name === name) + ) + { + toConvert.push(obj); + } } - if (found) + // Now let's convert them ... + + var classType = GetFastValue(singleConfig, 'classType', Sprite); + var scene = GetFastValue(singleConfig, 'scene', this.scene); + var container = GetFastValue(singleConfig, 'container', null); + var texture = GetFastValue(singleConfig, 'key', null); + var frame = GetFastValue(singleConfig, 'frame', null); + + for (var i = 0; i < toConvert.length; i++) { - var config = Extend({}, spriteConfig, obj.properties); + obj = toConvert[i]; - config.x = obj.x; - config.y = obj.y; + var sprite = new classType(scene); - var sprite = scene.make.sprite(config); + sprite.setName(obj.name); + sprite.setPosition(obj.x, obj.y); + sprite.setTexture(texture, frame); - sprite.name = obj.name; + if (obj.width) + { + sprite.displayWidth = obj.width; + } - if (obj.width) { sprite.displayWidth = obj.width; } - if (obj.height) { sprite.displayHeight = obj.height; } + if (obj.height) + { + sprite.displayHeight = obj.height; + } - // Origin is (0, 1) in Tiled, so find the offset that matches the Sprite's origin. - // Do not offset objects with zero dimensions (e.g. points). + // Origin is (0, 1) in Tiled, so find the offset that matches the Sprites origin. + // Do not offset objects with zero dimensions (e.g. points). var offset = { x: sprite.originX * obj.width, y: (sprite.originY - 1) * obj.height }; - // If the object is rotated, then the origin offset also needs to be rotated. + // If the object is rotated, then the origin offset also needs to be rotated. if (obj.rotation) { var angle = DegToRad(obj.rotation); + Rotate(offset, angle); + sprite.rotation = angle; } @@ -117455,23 +124861,38 @@ var Tilemap = new Class({ sprite.setFlip(obj.flippedHorizontal, obj.flippedVertical); } - if (!obj.visible) { sprite.visible = false; } - - for (var key in obj.properties) + if (!obj.visible) { - if (sprite.hasOwnProperty(key)) - { - continue; - } - - sprite.setData(key, obj.properties[key]); + sprite.visible = false; } - sprites.push(sprite); + // Set properties the class may have, or setData those it doesn't + for (var key in obj.properties) + { + if (sprite[key] !== undefined) + { + sprite[key] = obj.properties[key]; + } + else + { + sprite.setData(key, obj.properties[key]); + } + } + + if (container) + { + container.add(sprite); + } + else + { + scene.add.existing(sprite); + } + + results.push(sprite); } } - return sprites; + return results; }, /** @@ -117483,14 +124904,14 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#createFromTiles * @since 3.0.0 * - * @param {(integer|array)} indexes - The tile index, or array of indexes, to create Sprites from. - * @param {(integer|array)} replacements - The tile index, or array of indexes, to change a converted + * @param {(number|array)} indexes - The tile index, or array of indexes, to create Sprites from. + * @param {(number|array)} replacements - The tile index, or array of indexes, to change a converted * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a * one-to-one mapping with the indexes array. * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). - * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Scene} [scene] - The Scene to create the Sprites within. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.GameObjects.Sprite[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -117503,80 +124924,6 @@ var Tilemap = new Class({ return TilemapComponents.CreateFromTiles(indexes, replacements, spriteConfig, scene, camera, layer); }, - /** - * Creates a new StaticTilemapLayer that renders the LayerData associated with the given - * `layerID`. The currently selected layer in the map is set to this new layer. - * - * The `layerID` is important. If you've created your map in Tiled then you can get this by - * looking in Tiled and looking at the layer name. Or you can open the JSON file it exports and - * look at the layers[].name value. Either way it must match. - * - * It's important to remember that a static layer cannot be modified. See StaticTilemapLayer for - * more information. - * - * @method Phaser.Tilemaps.Tilemap#createStaticLayer - * @since 3.0.0 - * - * @param {(integer|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. - * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. - * - * @return {?Phaser.Tilemaps.StaticTilemapLayer} Returns the new layer was created, or null if it failed. - */ - createStaticLayer: function (layerID, tileset, x, y) - { - var index = this.getLayerIndex(layerID); - - if (index === null) - { - console.warn('Invalid Tilemap Layer ID: ' + layerID); - if (typeof layerID === 'string') - { - console.warn('Valid tilelayer names:\n\t' + this.getTileLayerNames().join(',\n\t')); - } - return null; - } - - var layerData = this.layers[index]; - - // Check for an associated static or dynamic tilemap layer - if (layerData.tilemapLayer) - { - console.warn('Tilemap Layer ID already exists:' + layerID); - return null; - } - - this.currentLayerIndex = index; - - // Default the x/y position to match Tiled layer offset, if it exists. - if (x === undefined && this.layers[index].x) { x = this.layers[index].x; } - if (y === undefined && this.layers[index].y) { y = this.layers[index].y; } - - var layer = new StaticTilemapLayer(this.scene, this, index, tileset, x, y); - - layer.setRenderOrder(this.renderOrder); - - this.scene.sys.displayList.add(layer); - - return layer; - }, - - /** - * Removes all layer data from this Tilemap and nulls the scene reference. This will destroy any - * StaticTilemapLayers or DynamicTilemapLayers that have been linked to LayerData. - * - * @method Phaser.Tilemaps.Tilemap#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.removeAllLayers(); - this.tilesets.length = 0; - this.objects.length = 0; - this.scene = undefined; - }, - /** * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the * specified index. Tiles will be set to collide if the given index is a colliding index. @@ -117588,24 +124935,24 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#fill * @since 3.0.0 * - * @param {integer} index - The tile index to fill the area with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} index - The tile index to fill the area with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ fill: function (index, tileX, tileY, width, height, recalculateFaces, layer) { + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } - if (this._isStaticCall(layer, 'fill')) { return this; } - TilemapComponents.Fill(index, tileX, tileY, width, height, recalculateFaces, layer); return this; @@ -117623,7 +124970,7 @@ var Tilemap = new Class({ * @param {TilemapFilterCallback} callback - The callback. Each object in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. * - * @return {?Phaser.GameObjects.GameObject[]} An array of object that match the search, or null if the objectLayer given was invalid. + * @return {?Phaser.Types.Tilemaps.TiledObject[]} An array of object that match the search, or null if the objectLayer given was invalid. */ filterObjects: function (objectLayer, callback, context) { @@ -117656,12 +125003,12 @@ var Tilemap = new Class({ * callback as the first and only parameter. The callback should return true for tiles that pass the * filter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -117685,10 +125032,10 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#findByIndex * @since 3.0.0 * - * @param {integer} index - The tile index value to search for. - * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. + * @param {number} index - The tile index value to search for. + * @param {number} [skip=0] - The number of times to skip a matching tile before returning. * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -117713,7 +125060,7 @@ var Tilemap = new Class({ * @param {TilemapFindCallback} callback - The callback. Each object in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. * - * @return {?Phaser.GameObjects.GameObject} An object that matches the search, or null if no object found. + * @return {?Phaser.Types.Tilemaps.TiledObject} An object that matches the search, or null if no object found. */ findObject: function (objectLayer, callback, context) { @@ -117744,12 +125091,12 @@ var Tilemap = new Class({ * * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. */ @@ -117773,12 +125120,12 @@ var Tilemap = new Class({ * * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -117801,7 +125148,7 @@ var Tilemap = new Class({ * * @param {string} name - The name of the image to get. * - * @return {integer} The index of the image in this tilemap, or null if not found. + * @return {number} The index of the image in this tilemap, or null if not found. */ getImageIndex: function (name) { @@ -117855,15 +125202,12 @@ var Tilemap = new Class({ }, /** - * Gets the LayerData from this.layers that is associated with `layer`, or null if an invalid - * `layer` is given. + * Gets the LayerData from `this.layers` that is associated with the given `layer`, or null if the layer is invalid. * * @method Phaser.Tilemaps.Tilemap#getLayer * @since 3.0.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The name of the - * layer from Tiled, the index of the layer in the map, a DynamicTilemapLayer or a - * StaticTilemapLayer. If not given will default to the maps current layer index. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or Tilemap Layer. If not given will default to the maps current layer index. * * @return {Phaser.Tilemaps.LayerData} The corresponding LayerData within this.layers. */ @@ -117875,15 +125219,14 @@ var Tilemap = new Class({ }, /** - * Gets the ObjectLayer from this.objects that has the given `name`, or null if no ObjectLayer - * is found with that name. + * Gets the ObjectLayer from `this.objects` that has the given `name`, or null if no ObjectLayer is found with that name. * * @method Phaser.Tilemaps.Tilemap#getObjectLayer * @since 3.0.0 * * @param {string} [name] - The name of the object layer from Tiled. * - * @return {?Phaser.Tilemaps.ObjectLayer} The corresponding ObjectLayer within this.objects or null. + * @return {?Phaser.Tilemaps.ObjectLayer} The corresponding `ObjectLayer` within `this.objects`, or null. */ getObjectLayer: function (name) { @@ -117920,11 +125263,9 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#getLayerIndex * @since 3.0.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The name of the - * layer from Tiled, the index of the layer in the map, a DynamicTilemapLayer or a - * StaticTilemapLayer. If not given will default to the map's current layer index. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a Tilemap Layer. If not given will default to the map's current layer index. * - * @return {integer} The LayerData index within this.layers. + * @return {number} The LayerData index within this.layers. */ getLayerIndex: function (layer) { @@ -117940,7 +125281,7 @@ var Tilemap = new Class({ { return layer; } - else if (layer instanceof StaticTilemapLayer || layer instanceof DynamicTilemapLayer) + else if (layer instanceof TilemapLayer) { return layer.layerIndex; } @@ -117959,7 +125300,7 @@ var Tilemap = new Class({ * * @param {string} name - The name of the layer to get. * - * @return {integer} The LayerData index within this.layers. + * @return {number} The LayerData index within this.layers. */ getLayerIndexByName: function (name) { @@ -117968,15 +125309,16 @@ var Tilemap = new Class({ /** * Gets a tile at the given tile coordinates from the given layer. - * If no layer specified, the map's current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTileAt * @since 3.0.0 * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {boolean} [nonNull] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -117991,16 +125333,17 @@ var Tilemap = new Class({ /** * Gets a tile at the given world coordinates from the given layer. - * If no layer specified, the map's current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTileAtWorldXY * @since 3.0.0 * * @param {number} worldX - X position to get the tile from (given in pixels) * @param {number} worldY - Y position to get the tile from (given in pixels) - * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [nonNull] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ @@ -118036,17 +125379,18 @@ var Tilemap = new Class({ /** * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * If no layer specified, the maps current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTilesWithin * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -118062,15 +125406,16 @@ var Tilemap = new Class({ /** * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, * Line, Rectangle or Triangle. The shape should be in world coordinates. - * If no layer specified, the maps current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTilesWithinShape * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -118085,7 +125430,8 @@ var Tilemap = new Class({ /** * Gets the tiles in the given rectangular area (in world coordinates) of the layer. - * If no layer specified, the maps current layer is used. + * + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#getTilesWithinWorldXY * @since 3.0.0 @@ -118095,8 +125441,8 @@ var Tilemap = new Class({ * @param {number} width - The width of the area. * @param {number} height - The height of the area. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. */ @@ -118135,7 +125481,7 @@ var Tilemap = new Class({ * * @param {string} name - The name of the Tileset to get. * - * @return {integer} The Tileset index within this.tilesets. + * @return {number} The Tileset index within this.tilesets. */ getTilesetIndex: function (name) { @@ -118146,14 +125492,14 @@ var Tilemap = new Class({ * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns * false if there is no tile or if the tile at that location has an index of -1. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#hasTileAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -118170,15 +125516,15 @@ var Tilemap = new Class({ * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns * false if there is no tile or if the tile at that location has an index of -1. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#hasTileAtWorldXY * @since 3.0.0 * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ @@ -118217,26 +125563,24 @@ var Tilemap = new Class({ * location. If you pass in an index, only the index at the specified location will be changed. * Collision information will be recalculated at the specified location. * - * If no layer specified, the maps current layer is used. - * - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#putTileAt * @since 3.0.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid or the coordinates were out of bounds. */ putTileAt: function (tile, tileX, tileY, recalculateFaces, layer) { - layer = this.getLayer(layer); + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'putTileAt')) { return null; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118249,26 +125593,25 @@ var Tilemap = new Class({ * specified location. If you pass in an index, only the index at the specified location will be * changed. Collision information will be recalculated at the specified location. * - * If no layer specified, the maps current layer is used. This - * cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#putTileAtWorldXY * @since 3.0.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera, layer) { - layer = this.getLayer(layer); + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'putTileAtWorldXY')) { return null; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118282,25 +125625,24 @@ var Tilemap = new Class({ * index at the specified location will be changed. Collision information will be recalculated * within the region tiles were changed. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#putTilesAt * @since 3.0.0 * - * @param {(integer[]|integer[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces, layer) { - layer = this.getLayer(layer); + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'putTilesAt')) { return this; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118316,18 +125658,17 @@ var Tilemap = new Class({ * indexes found within the region (excluding -1) will be used for randomly assigning new tile * indexes. This method only modifies tile indexes and does not change collision information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#randomize * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {number[]} [indexes] - An array of indexes to randomly draw from during randomization. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -118335,8 +125676,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'randomize')) { return this; } - if (layer === null) { return null; } TilemapComponents.Randomize(tileX, tileY, width, height, indexes, layer); @@ -118349,14 +125688,14 @@ var Tilemap = new Class({ * faces are used internally for optimizing collisions against tiles. This method is mostly used * internally to optimize recalculating faces when only one tile has been changed. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#calculateFacesAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -118376,16 +125715,16 @@ var Tilemap = new Class({ * layer. Interesting faces are used internally for optimizing collisions against tiles. This method * is mostly used internally. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#calculateFacesWithin * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -118403,12 +125742,12 @@ var Tilemap = new Class({ /** * Removes the given TilemapLayer from this Tilemap without destroying it. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#removeLayer * @since 3.17.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to be removed. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to be removed. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -118419,6 +125758,7 @@ var Tilemap = new Class({ if (index !== null) { SpliceOne(this.layers, index); + for (var i = index; i < this.layers.length; i++) { if (this.layers[i].tilemapLayer) @@ -118443,12 +125783,12 @@ var Tilemap = new Class({ /** * Destroys the given TilemapLayer and removes it from this Tilemap. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#destroyLayer * @since 3.17.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to be destroyed. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to be destroyed. * * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ @@ -118478,19 +125818,17 @@ var Tilemap = new Class({ }, /** - * Removes all layers from this Tilemap and destroys any associated StaticTilemapLayers or - * DynamicTilemapLayers. + * Removes all Tilemap Layers from this Tilemap and calls `destroy` on each of them. * * @method Phaser.Tilemaps.Tilemap#removeAllLayers * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tilemap} This Tilemap object. + * @return {this} This Tilemap object. */ removeAllLayers: function () { var layers = this.layers; - // Destroy any StaticTilemapLayers or DynamicTilemapLayers that are stored in LayerData for (var i = 0; i < layers.length; i++) { if (layers[i].tilemapLayer) @@ -118510,13 +125848,11 @@ var Tilemap = new Class({ * Removes the given Tile, or an array of Tiles, from the layer to which they belong, * and optionally recalculates the collision information. * - * This cannot be applied to Tiles that belong to Static Tilemap Layers. - * * @method Phaser.Tilemaps.Tilemap#removeTile * @since 3.17.0 * * @param {(Phaser.Tilemaps.Tile|Phaser.Tilemaps.Tile[])} tiles - The Tile to remove, or an array of Tiles. - * @param {integer} [replaceIndex=-1] - After removing the Tile, insert a brand new Tile into its location with the given index. Leave as -1 to just remove the tile. + * @param {number} [replaceIndex=-1] - After removing the Tile, insert a brand new Tile into its location with the given index. Leave as -1 to just remove the tile. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * * @return {Phaser.Tilemaps.Tile[]} Returns an array of Tiles that were removed. @@ -118549,28 +125885,27 @@ var Tilemap = new Class({ }, /** - * Removes the tile at the given tile coordinates in the specified layer and updates the layer's - * collision information. + * Removes the tile at the given tile coordinates in the specified layer and updates the layers collision information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#removeTileAt * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [replaceWithNull] - If `true` (the default), this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} [recalculateFaces] - If `true` (the default), the faces data will be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns the Tile that was removed, or null if the layer given was invalid. */ removeTileAt: function (tileX, tileY, replaceWithNull, recalculateFaces, layer) { - layer = this.getLayer(layer); + if (replaceWithNull === undefined) { replaceWithNull = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'removeTileAt')) { return null; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118578,29 +125913,28 @@ var Tilemap = new Class({ }, /** - * Removes the tile at the given world coordinates in the specified layer and updates the layer's - * collision information. + * Removes the tile at the given world coordinates in the specified layer and updates the layers collision information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#removeTileAtWorldXY * @since 3.0.0 * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [replaceWithNull] - If `true` (the default), this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} [recalculateFaces] - If `true` (the default), the faces data will be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. */ removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer) { - layer = this.getLayer(layer); + if (replaceWithNull === undefined) { replaceWithNull = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (this._isStaticCall(layer, 'removeTileAtWorldXY')) { return null; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118608,19 +125942,19 @@ var Tilemap = new Class({ }, /** - * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to + * Draws a debug representation of the layer to the given Graphics object. This is helpful when you want to * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation * wherever you want on the screen. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#renderDebug * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -118646,15 +125980,14 @@ var Tilemap = new Class({ * @since 3.17.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. + * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {this} This Tilemap instance. */ renderDebugFull: function (graphics, styleConfig) { var layers = this.layers; - // Destroy any StaticTilemapLayers or DynamicTilemapLayers that are stored in LayerData for (var i = 0; i < layers.length; i++) { TilemapComponents.RenderDebug(graphics, styleConfig, layers[i]); @@ -118668,19 +126001,18 @@ var Tilemap = new Class({ * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does * not change collision information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#replaceByIndex * @since 3.0.0 * - * @param {integer} findIndex - The index of the tile to search for. - * @param {integer} newIndex - The index of the tile to replace it with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} findIndex - The index of the tile to search for. + * @param {number} newIndex - The index of the tile to replace it with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -118688,8 +126020,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'replaceByIndex')) { return this; } - if (layer === null) { return null; } TilemapComponents.ReplaceByIndex(findIndex, newIndex, tileX, tileY, width, height, layer); @@ -118702,21 +126032,25 @@ var Tilemap = new Class({ * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if * collision will be enabled (true) or disabled (false). * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollision * @since 3.0.0 * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollision: function (indexes, collides, recalculateFaces, layer, updateLayer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + if (updateLayer === undefined) { updateLayer = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118732,21 +126066,24 @@ var Tilemap = new Class({ * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be * enabled (true) or disabled (false). * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollisionBetween * @since 3.0.0 * - * @param {integer} start - The first index of the tile to be set for collision. - * @param {integer} stop - The last index of the tile to be set for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} start - The first index of the tile to be set for collision. + * @param {number} stop - The last index of the tile to be set for collision. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollisionBetween: function (start, stop, collides, recalculateFaces, layer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118765,20 +126102,23 @@ var Tilemap = new Class({ * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a * "types" property that matches any of those values, its collision flag will be updated. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollisionByProperty * @since 3.0.0 * * @param {object} properties - An object with tile properties and corresponding values that should be checked. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollisionByProperty: function (properties, collides, recalculateFaces, layer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118793,20 +126133,23 @@ var Tilemap = new Class({ * the given array. The `collides` parameter controls if collision will be enabled (true) or * disabled (false). Tile indexes not currently in the layer are not affected. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollisionByExclusion * @since 3.0.0 * - * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollisionByExclusion: function (indexes, collides, recalculateFaces, layer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118817,24 +126160,27 @@ var Tilemap = new Class({ }, /** - * Sets collision on the tiles within a layer by checking each tile's collision group data + * Sets collision on the tiles within a layer by checking each tiles collision group data * (typically defined in Tiled within the tileset collision editor). If any objects are found within - * a tile's collision group, the tile's colliding information will be set. The `collides` parameter + * a tiles collision group, the tiles colliding information will be set. The `collides` parameter * controls if collision will be enabled (true) or disabled (false). * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setCollisionFromCollisionGroup * @since 3.0.0 * - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ setCollisionFromCollisionGroup: function (collides, recalculateFaces, layer) { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + layer = this.getLayer(layer); if (layer === null) { return null; } @@ -118848,17 +126194,17 @@ var Tilemap = new Class({ * Sets a global collision callback for the given tile index within the layer. This will affect all * tiles on this layer that have the same index. If a callback is already set for the tile index it * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile - * at a specific location on the map then see setTileLocationCallback. + * at a specific location on the map then see `setTileLocationCallback`. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setTileIndexCallback * @since 3.0.0 * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. + * @param {(number|number[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. All values should be integers. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -118878,18 +126224,18 @@ var Tilemap = new Class({ * If a callback is already set for the tile index it will be replaced. Set the callback to null to * remove it. * - * If no layer specified, the map's current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#setTileLocationCallback * @since 3.0.0 * - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} [callbackContext] - The context under which the callback is called. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -118910,11 +126256,9 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#setLayer * @since 3.0.0 * - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The name of the - * layer from Tiled, the index of the layer in the map, a DynamicTilemapLayer or a - * StaticTilemapLayer. If not given will default to the map's current layer index. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a TilemapLayer. If not given will default to the maps current layer index. * - * @return {Phaser.Tilemaps.Tilemap} This Tilemap object. + * @return {this} This Tilemap object. */ setLayer: function (layer) { @@ -118935,10 +126279,10 @@ var Tilemap = new Class({ * @method Phaser.Tilemaps.Tilemap#setBaseTileSize * @since 3.0.0 * - * @param {integer} tileWidth - The width of the tiles the map uses for calculations. - * @param {integer} tileHeight - The height of the tiles the map uses for calculations. + * @param {number} tileWidth - The width of the tiles the map uses for calculations. + * @param {number} tileHeight - The height of the tiles the map uses for calculations. * - * @return {Phaser.Tilemaps.Tilemap} This Tilemap object. + * @return {this} This Tilemap object. */ setBaseTileSize: function (tileWidth, tileHeight) { @@ -118947,7 +126291,7 @@ var Tilemap = new Class({ this.widthInPixels = this.width * tileWidth; this.heightInPixels = this.height * tileHeight; - // Update the base tile size on all layers & tiles + // Update the base tile size on all layers & tiles for (var i = 0; i < this.layers.length; i++) { this.layers[i].baseTileWidth = tileWidth; @@ -118975,20 +126319,18 @@ var Tilemap = new Class({ }, /** - * Sets the tile size for a specific `layer`. Note: this does not necessarily match the map's + * Sets the tile size for a specific `layer`. Note: this does not necessarily match the maps * tileWidth and tileHeight for all layers. This will set the tile size for the layer and any * tiles the layer has. * * @method Phaser.Tilemaps.Tilemap#setLayerTileSize * @since 3.0.0 * - * @param {integer} tileWidth - The width of the tiles (in pixels) in the layer. - * @param {integer} tileHeight - The height of the tiles (in pixels) in the layer. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The name of the - * layer from Tiled, the index of the layer in the map, a DynamicTilemapLayer or a - * StaticTilemapLayer. If not given will default to the map's current layer index. + * @param {number} tileWidth - The width of the tiles (in pixels) in the layer. + * @param {number} tileHeight - The height of the tiles (in pixels) in the layer. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a TilemapLayer. If not given will default to the maps current layer index. * - * @return {Phaser.Tilemaps.Tilemap} This Tilemap object. + * @return {this} This Tilemap object. */ setLayerTileSize: function (tileWidth, tileHeight, layer) { @@ -119025,17 +126367,16 @@ var Tilemap = new Class({ * appear to have changed! This method only modifies tile indexes and does not change collision * information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#shuffle * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -119043,8 +126384,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'shuffle')) { return this; } - if (layer === null) { return null; } TilemapComponents.Shuffle(tileX, tileY, width, height, layer); @@ -119057,19 +126396,18 @@ var Tilemap = new Class({ * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision * information. * - * If no layer specified, the maps current layer is used. - * This cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#swapByIndex * @since 3.0.0 * - * @param {integer} tileA - First tile index. - * @param {integer} tileB - Second tile index. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileA - First tile index. + * @param {number} tileB - Second tile index. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ @@ -119077,8 +126415,6 @@ var Tilemap = new Class({ { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'swapByIndex')) { return this; } - if (layer === null) { return null; } TilemapComponents.SwapByIndex(indexA, indexB, tileX, tileY, width, height, layer); @@ -119090,14 +126426,14 @@ var Tilemap = new Class({ * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the * layers position, scale and scroll. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#tileToWorldX * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -119107,22 +126443,21 @@ var Tilemap = new Class({ if (layer === null) { return null; } - return TilemapComponents.TileToWorldX(tileX, camera, layer); + return this._convert.TileToWorldX(tileX, camera, layer); }, /** * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the * layers position, scale and scroll. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#tileToWorldY * @since 3.0.0 * - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer - * to use. If not given the current layer is used. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -119132,7 +126467,7 @@ var Tilemap = new Class({ if (layer === null) { return null; } - return TilemapComponents.TileToWorldY(tileX, camera, layer); + return this._convert.TileToWorldY(tileX, camera, layer); }, /** @@ -119140,26 +126475,26 @@ var Tilemap = new Class({ * layers position, scale and scroll. This will return a new Vector2 object or update the given * `point` object. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#tileToWorldXY * @since 3.0.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} [vec2] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * - * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. + * @return {?Phaser.Math.Vector2} Returns a Vector2, or null if the layer given was invalid. */ - tileToWorldXY: function (tileX, tileY, point, camera, layer) + tileToWorldXY: function (tileX, tileY, vec2, camera, layer) { layer = this.getLayer(layer); if (layer === null) { return null; } - return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, layer); + return this._convert.TileToWorldXY(tileX, tileY, vec2, camera, layer); }, /** @@ -119174,32 +126509,27 @@ var Tilemap = new Class({ * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8 * ] * - * The probability of any index being choose is (the index's weight) / (sum of all weights). This + * The probability of any index being picked is (the indexs weight) / (sum of all weights). This * method only modifies tile indexes and does not change collision information. * - * If no layer specified, the map's current layer is used. This - * cannot be applied to StaticTilemapLayers. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#weightedRandomize * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during - * randomization. They should be in the form: { index: 0, weight: 4 } or - * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {object[]} weightedIndexes - An array of objects to randomly draw from during randomization. They should be in the form: { index: 0, weight: 4 } or { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ - weightedRandomize: function (tileX, tileY, width, height, weightedIndexes, layer) + weightedRandomize: function (weightedIndexes, tileX, tileY, width, height, layer) { layer = this.getLayer(layer); - if (this._isStaticCall(layer, 'weightedRandomize')) { return this; } - if (layer === null) { return null; } TilemapComponents.WeightedRandomize(tileX, tileY, width, height, weightedIndexes, layer); @@ -119211,16 +126541,15 @@ var Tilemap = new Class({ * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the * layers position, scale and scroll. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#worldToTileX * @since 3.0.0 * * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer - * to use. If not given the current layer is used. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -119230,22 +126559,22 @@ var Tilemap = new Class({ if (layer === null) { return null; } - return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, layer); + return this._convert.WorldToTileX(worldX, snapToFloor, camera, layer); }, /** * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the * layers position, scale and scroll. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#worldToTileY * @since 3.0.0 * * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * * @return {?number} Returns a number, or null if the layer given was invalid. */ @@ -119255,7 +126584,7 @@ var Tilemap = new Class({ if (layer === null) { return null; } - return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, layer); + return this._convert.WorldToTileY(worldY, snapToFloor, camera, layer); }, /** @@ -119263,49 +126592,44 @@ var Tilemap = new Class({ * layers position, scale and scroll. This will return a new Vector2 object or update the given * `point` object. * - * If no layer specified, the maps current layer is used. + * If no layer is specified, the maps current layer is used. * * @method Phaser.Tilemaps.Tilemap#worldToTileXY * @since 3.0.0 * * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} [vec2] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. * - * @return {?Phaser.Math.Vector2} Returns a point, or null if the layer given was invalid. + * @return {?Phaser.Math.Vector2} Returns a vec2, or null if the layer given was invalid. */ - worldToTileXY: function (worldX, worldY, snapToFloor, point, camera, layer) + worldToTileXY: function (worldX, worldY, snapToFloor, vec2, camera, layer) { layer = this.getLayer(layer); if (layer === null) { return null; } - return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, layer); + return this._convert.WorldToTileXY(worldX, worldY, snapToFloor, vec2, camera, layer); }, /** - * Used internally to check if a layer is static and prints out a warning. + * Removes all layer data from this Tilemap and nulls the scene reference. This will destroy any + * TilemapLayers that have been created. * - * @method Phaser.Tilemaps.Tilemap#_isStaticCall - * @private + * @method Phaser.Tilemaps.Tilemap#destroy * @since 3.0.0 - * - * @return {boolean} */ - _isStaticCall: function (layer, functionName) + destroy: function () { - if (layer.tilemapLayer instanceof StaticTilemapLayer) - { - console.warn(functionName + ': You cannot change the tiles in a static tilemap layer'); - return true; - } - else - { - return false; - } + this.removeAllLayers(); + + this.tilesets.length = 0; + this.objects.length = 0; + + this.scene = null; } }); @@ -119314,7 +126638,7 @@ module.exports = Tilemap; /***/ }), -/* 523 */ +/* 560 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -119325,26 +126649,20 @@ module.exports = Tilemap; var Class = __webpack_require__(0); var Components = __webpack_require__(11); -var DynamicTilemapLayerRender = __webpack_require__(1358); var GameObject = __webpack_require__(14); -var TilemapComponents = __webpack_require__(149); +var TilemapComponents = __webpack_require__(243); +var TilemapLayerRender = __webpack_require__(1428); /** * @classdesc - * A Dynamic Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination + * A Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination * with one, or more, Tilesets. * - * A Dynamic Tilemap Layer trades some speed for being able to apply powerful effects. Unlike a - * Static Tilemap Layer, you can apply per-tile effects like tint or alpha, and you can change the - * tiles in a DynamicTilemapLayer. - * - * Use this over a Static Tilemap Layer when you need those features. - * - * @class DynamicTilemapLayer + * @class TilemapLayer * @extends Phaser.GameObjects.GameObject * @memberof Phaser.Tilemaps * @constructor - * @since 3.0.0 + * @since 3.50.0 * * @extends Phaser.GameObjects.Components.Alpha * @extends Phaser.GameObjects.Components.BlendMode @@ -119360,12 +126678,12 @@ var TilemapComponents = __webpack_require__(149); * * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. * @param {Phaser.Tilemaps.Tilemap} tilemap - The Tilemap this layer is a part of. - * @param {integer} layerIndex - The index of the LayerData associated with this layer. + * @param {number} layerIndex - The index of the LayerData associated with this layer. * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. * @param {number} [x=0] - The world x position where the top left of this layer will be placed. * @param {number} [y=0] - The world y position where the top left of this layer will be placed. */ -var DynamicTilemapLayer = new Class({ +var TilemapLayer = new Class({ Extends: GameObject, @@ -119381,40 +126699,40 @@ var DynamicTilemapLayer = new Class({ Components.Transform, Components.Visible, Components.ScrollFactor, - DynamicTilemapLayerRender + TilemapLayerRender ], initialize: - function DynamicTilemapLayer (scene, tilemap, layerIndex, tileset, x, y) + function TilemapLayer (scene, tilemap, layerIndex, tileset, x, y) { - GameObject.call(this, scene, 'DynamicTilemapLayer'); + GameObject.call(this, scene, 'TilemapLayer'); /** * Used internally by physics system to perform fast type checks. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#isTilemap + * @name Phaser.Tilemaps.TilemapLayer#isTilemap * @type {boolean} * @readonly - * @since 3.0.0 + * @since 3.50.0 */ this.isTilemap = true; /** * The Tilemap that this layer is a part of. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#tilemap + * @name Phaser.Tilemaps.TilemapLayer#tilemap * @type {Phaser.Tilemaps.Tilemap} - * @since 3.0.0 + * @since 3.50.0 */ this.tilemap = tilemap; /** * The index of the LayerData associated with this layer. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#layerIndex - * @type {integer} - * @since 3.0.0 + * @name Phaser.Tilemaps.TilemapLayer#layerIndex + * @type {number} + * @since 3.50.0 */ this.layerIndex = layerIndex; @@ -119422,9 +126740,9 @@ var DynamicTilemapLayer = new Class({ * The LayerData associated with this layer. LayerData can only be associated with one * tilemap layer. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#layer + * @name Phaser.Tilemaps.TilemapLayer#layer * @type {Phaser.Tilemaps.LayerData} - * @since 3.0.0 + * @since 3.50.0 */ this.layer = tilemap.layers[layerIndex]; @@ -119432,68 +126750,66 @@ var DynamicTilemapLayer = new Class({ this.layer.tilemapLayer = this; /** - * The Tileset/s associated with this layer. + * An array of `Tileset` objects associated with this layer. * - * As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference. - * - * @name Phaser.Tilemaps.DynamicTilemapLayer#tileset + * @name Phaser.Tilemaps.TilemapLayer#tileset * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.0.0 + * @since 3.50.0 */ this.tileset = []; - /** - * Used internally with the canvas render. This holds the tiles that are visible within the - * camera. - * - * @name Phaser.Tilemaps.DynamicTilemapLayer#culledTiles - * @type {array} - * @since 3.0.0 - */ - this.culledTiles = []; - - /** - * You can control if the Cameras should cull tiles before rendering them or not. - * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. - * - * However, there are some instances when you may wish to disable this, and toggling this flag allows - * you to do so. Also see `setSkipCull` for a chainable method that does the same thing. - * - * @name Phaser.Tilemaps.DynamicTilemapLayer#skipCull - * @type {boolean} - * @since 3.11.0 - */ - this.skipCull = false; - /** * The total number of tiles drawn by the renderer in the last frame. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#tilesDrawn - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#tilesDrawn + * @type {number} * @readonly - * @since 3.11.0 + * @since 3.50.0 */ this.tilesDrawn = 0; /** * The total number of tiles in this layer. Updated every frame. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#tilesTotal - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#tilesTotal + * @type {number} * @readonly - * @since 3.11.0 + * @since 3.50.0 */ this.tilesTotal = this.layer.width * this.layer.height; + /** + * Used internally during rendering. This holds the tiles that are visible within the Camera. + * + * @name Phaser.Tilemaps.TilemapLayer#culledTiles + * @type {Phaser.Tilemaps.Tile[]} + * @since 3.50.0 + */ + this.culledTiles = []; + + /** + * You can control if the camera should cull tiles on this layer before rendering them or not. + * + * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. + * + * However, there are some instances when you may wish to disable this, and toggling this flag allows + * you to do so. Also see `setSkipCull` for a chainable method that does the same thing. + * + * @name Phaser.Tilemaps.TilemapLayer#skipCull + * @type {boolean} + * @since 3.50.0 + */ + this.skipCull = false; + /** * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size. * * See the method `setCullPadding` for more details. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#cullPaddingX - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#cullPaddingX + * @type {number} * @default 1 - * @since 3.11.0 + * @since 3.50.0 */ this.cullPaddingX = 1; @@ -119502,31 +126818,39 @@ var DynamicTilemapLayer = new Class({ * * See the method `setCullPadding` for more details. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#cullPaddingY - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#cullPaddingY + * @type {number} * @default 1 - * @since 3.11.0 + * @since 3.50.0 */ this.cullPaddingY = 1; /** * The callback that is invoked when the tiles are culled. * - * By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like. + * It will call a different function based on the map orientation: * - * It will be sent 3 arguments: + * Orthogonal (the default) is `TilemapComponents.CullTiles` + * Isometric is `TilemapComponents.IsometricCullTiles` + * Hexagonal is `TilemapComponents.HexagonalCullTiles` + * Staggered is `TilemapComponents.StaggeredCullTiles` + * + * However, you can override this to call any function you like. + * + * It will be sent 4 arguments: * * 1. The Phaser.Tilemaps.LayerData object for this Layer * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 4. The Render Order constant. * * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#cullCallback + * @name Phaser.Tilemaps.TilemapLayer#cullCallback * @type {function} - * @since 3.11.0 + * @since 3.50.0 */ - this.cullCallback = TilemapComponents.CullTiles; + this.cullCallback = TilemapComponents.GetCullTilesFunction(this.layer.orientation); /** * The rendering (draw) order of the tiles in this layer. @@ -119543,20 +126867,20 @@ var DynamicTilemapLayer = new Class({ * * This can be changed via the `setRenderOrder` method. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#_renderOrder - * @type {integer} + * @name Phaser.Tilemaps.TilemapLayer#_renderOrder + * @type {number} * @default 0 * @private - * @since 3.12.0 + * @since 3.50.0 */ this._renderOrder = 0; /** * An array holding the mapping between the tile indexes and the tileset they belong to. * - * @name Phaser.Tilemaps.DynamicTilemapLayer#gidMap + * @name Phaser.Tilemaps.TilemapLayer#gidMap * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.14.0 + * @since 3.50.0 */ this.gidMap = []; @@ -119572,9 +126896,9 @@ var DynamicTilemapLayer = new Class({ /** * Populates the internal `tileset` array with the Tileset references this Layer requires for rendering. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setTilesets + * @method Phaser.Tilemaps.TilemapLayer#setTilesets * @private - * @since 3.14.0 + * @since 3.50.0 * * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. */ @@ -119633,10 +126957,10 @@ var DynamicTilemapLayer = new Class({ * * You can provide either an integer (0 to 3), or the string version of the order. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setRenderOrder - * @since 3.12.0 + * @method Phaser.Tilemaps.TilemapLayer#setRenderOrder + * @since 3.50.0 * - * @param {(integer|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. + * @param {(number|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. * * @return {this} This Tilemap Layer object. */ @@ -119662,13 +126986,13 @@ var DynamicTilemapLayer = new Class({ * faces are used internally for optimizing collisions against tiles. This method is mostly used * internally to optimize recalculating faces when only one tile has been changed. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#calculateFacesAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#calculateFacesAt + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. + * @param {number} tileX - The x coordinate. + * @param {number} tileY - The y coordinate. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ calculateFacesAt: function (tileX, tileY) { @@ -119682,15 +127006,15 @@ var DynamicTilemapLayer = new Class({ * layer. Interesting faces are used internally for optimizing collisions against tiles. This method * is mostly used internally. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#calculateFacesWithin - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#calculateFacesWithin + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ calculateFacesWithin: function (tileX, tileY, width, height) { @@ -119705,17 +127029,17 @@ var DynamicTilemapLayer = new Class({ * created. This is useful if you want to lay down special tiles in a level that are converted to * Sprites, but want to replace the tile itself with a floor tile or similar once converted. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#createFromTiles - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#createFromTiles + * @since 3.50.0 * - * @param {(integer|array)} indexes - The tile index, or array of indexes, to create Sprites from. - * @param {(integer|array)} replacements - The tile index, or array of indexes, to change a converted + * @param {(number|array)} indexes - The tile index, or array of indexes, to create Sprites from. + * @param {(number|array)} replacements - The tile index, or array of indexes, to change a converted * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a * one-to-one mapping with the indexes array. - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} [spriteConfig] - The config object to pass into the Sprite creator (i.e. * scene.make.sprite). - * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when determining the world XY + * @param {Phaser.Scene} [scene] - The Scene to create the Sprites within. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when determining the world XY * * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. */ @@ -119726,14 +127050,14 @@ var DynamicTilemapLayer = new Class({ /** * Returns the tiles in the given layer that are within the cameras viewport. - * This is used internally. + * This is used internally during rendering. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#cull - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#cull + * @since 3.50.0 * * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects to render. */ cull: function (camera) { @@ -119745,18 +127069,18 @@ var DynamicTilemapLayer = new Class({ * coordinates) within the layer. This copies all tile properties & recalculates collision * information in the destination region. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#copy - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#copy + * @since 3.50.0 * - * @param {integer} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} width - The width of the area to copy, in tiles, not pixels. - * @param {integer} height - The height of the area to copy, in tiles, not pixels. - * @param {integer} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. - * @param {integer} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. + * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. + * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. + * @param {number} width - The width of the area to copy, in tiles, not pixels. + * @param {number} height - The height of the area to copy, in tiles, not pixels. + * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. + * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ copy: function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces) { @@ -119765,62 +127089,22 @@ var DynamicTilemapLayer = new Class({ return this; }, - /** - * Destroys this DynamicTilemapLayer and removes its link to the associated LayerData. - * - * @method Phaser.Tilemaps.DynamicTilemapLayer#destroy - * @since 3.0.0 - * - * @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap? - */ - destroy: function (removeFromTilemap) - { - if (removeFromTilemap === undefined) { removeFromTilemap = true; } - - if (!this.tilemap) - { - // Abort, we've already been destroyed - return; - } - - // Uninstall this layer only if it is still installed on the LayerData object - if (this.layer.tilemapLayer === this) - { - this.layer.tilemapLayer = undefined; - } - - if (removeFromTilemap) - { - this.tilemap.removeLayer(this); - } - - this.tilemap = undefined; - this.layer = undefined; - this.culledTiles.length = 0; - this.cullCallback = null; - - this.gidMap = []; - this.tileset = []; - - GameObject.prototype.destroy.call(this); - }, - /** * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the * specified index. Tiles will be set to collide if the given index is a colliding index. * Collision information in the region will be recalculated. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#fill - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#fill + * @since 3.50.0 * - * @param {integer} index - The tile index to fill the area with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} index - The tile index to fill the area with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ fill: function (index, tileX, tileY, width, height, recalculateFaces) { @@ -119834,17 +127118,17 @@ var DynamicTilemapLayer = new Class({ * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#filterTiles - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#filterTiles + * @since 3.50.0 * * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. The callback should return true for tiles that pass the * filter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. @@ -119861,15 +127145,14 @@ var DynamicTilemapLayer = new Class({ * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to * the top-left. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#findByIndex - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#findByIndex + * @since 3.50.0 * - * @param {integer} index - The tile index value to search for. - * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. - * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the - * bottom-right. Otherwise it scans from the top-left. + * @param {number} index - The tile index value to search for. + * @param {number} [skip=0] - The number of times to skip a matching tile before returning. + * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. * - * @return {Phaser.Tilemaps.Tile} A Tile object. + * @return {Phaser.Tilemaps.Tile} The first matching Tile object. */ findByIndex: function (findIndex, skip, reverse) { @@ -119881,18 +127164,18 @@ var DynamicTilemapLayer = new Class({ * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns * true. Similar to Array.prototype.find in vanilla JS. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#findTile - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#findTile + * @since 3.50.0 * * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * - * @return {?Phaser.Tilemaps.Tile} + * @return {?Phaser.Tilemaps.Tile} The first Tile found at the given location. */ findTile: function (callback, context, tileX, tileY, width, height, filteringOptions) { @@ -119903,18 +127186,18 @@ var DynamicTilemapLayer = new Class({ * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given * callback. Similar to Array.prototype.forEach in vanilla JS. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#forEachTile - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#forEachTile + * @since 3.50.0 * * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {object} [context] - The context, or scope, under which the callback should be run. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions) { @@ -119926,14 +127209,14 @@ var DynamicTilemapLayer = new Class({ /** * Gets a tile at the given tile coordinates from the given layer. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTileAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTileAt + * @since 3.50.0 * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. + * @return {Phaser.Tilemaps.Tile} The Tile at the given coordinates or null if no tile was found or the coordinates were invalid. */ getTileAt: function (tileX, tileY, nonNull) { @@ -119943,16 +127226,15 @@ var DynamicTilemapLayer = new Class({ /** * Gets a tile at the given world coordinates from the given layer. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTileAtWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTileAtWorldXY + * @since 3.50.0 * * @param {number} worldX - X position to get the tile from (given in pixels) * @param {number} worldY - Y position to get the tile from (given in pixels) * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates - * were invalid. + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. */ getTileAtWorldXY: function (worldX, worldY, nonNull, camera) { @@ -119962,16 +127244,16 @@ var DynamicTilemapLayer = new Class({ /** * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTilesWithin - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTilesWithin + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the area. */ getTilesWithin: function (tileX, tileY, width, height, filteringOptions) { @@ -119982,14 +127264,14 @@ var DynamicTilemapLayer = new Class({ * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, * Line, Rectangle or Triangle. The shape should be in world coordinates. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTilesWithinShape - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTilesWithinShape + * @since 3.50.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the shape. */ getTilesWithinShape: function (shape, filteringOptions, camera) { @@ -119999,17 +127281,17 @@ var DynamicTilemapLayer = new Class({ /** * Gets the tiles in the given rectangular area (in world coordinates) of the layer. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#getTilesWithinWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#getTilesWithinWorldXY + * @since 3.50.0 * * @param {number} worldX - The world x coordinate for the top-left of the area. * @param {number} worldY - The world y coordinate for the top-left of the area. * @param {number} width - The width of the area. * @param {number} height - The height of the area. * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the area. */ getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera) { @@ -120020,11 +127302,11 @@ var DynamicTilemapLayer = new Class({ * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns * false if there is no tile or if the tile at that location has an index of -1. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#hasTileAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#hasTileAt + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * * @return {boolean} `true` if a tile was found at the given location, otherwise `false`. */ @@ -120037,12 +127319,12 @@ var DynamicTilemapLayer = new Class({ * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns * false if there is no tile or if the tile at that location has an index of -1. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#hasTileAtWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#hasTileAtWorldXY + * @since 3.50.0 * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. * * @return {boolean} `true` if a tile was found at the given location, otherwise `false`. */ @@ -120057,15 +127339,15 @@ var DynamicTilemapLayer = new Class({ * location. If you pass in an index, only the index at the specified location will be changed. * Collision information will be recalculated at the specified location. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#putTileAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#putTileAt + * @since 3.50.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * - * @return {Phaser.Tilemaps.Tile} A Tile object. + * @return {Phaser.Tilemaps.Tile} The Tile object that was inserted at the given coordinates. */ putTileAt: function (tile, tileX, tileY, recalculateFaces) { @@ -120078,16 +127360,16 @@ var DynamicTilemapLayer = new Class({ * specified location. If you pass in an index, only the index at the specified location will be * changed. Collision information will be recalculated at the specified location. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#putTileAtWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#putTileAtWorldXY + * @since 3.50.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Tilemaps.Tile} A Tile object. + * @return {Phaser.Tilemaps.Tile} The Tile object that was inserted at the given coordinates. */ putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera) { @@ -120101,15 +127383,15 @@ var DynamicTilemapLayer = new Class({ * index at the specified location will be changed. Collision information will be recalculated * within the region tiles were changed. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#putTilesAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#putTilesAt + * @since 3.50.0 * - * @param {(integer[]|integer[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces) { @@ -120125,16 +127407,16 @@ var DynamicTilemapLayer = new Class({ * indexes found within the region (excluding -1) will be used for randomly assigning new tile * indexes. This method only modifies tile indexes and does not change collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#randomize - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#randomize + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {number[]} [indexes] - An array of indexes to randomly draw from during randomization. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ randomize: function (tileX, tileY, width, height, indexes) { @@ -120144,14 +127426,14 @@ var DynamicTilemapLayer = new Class({ }, /** - * Removes the tile at the given tile coordinates in the specified layer and updates the layer's + * Removes the tile at the given tile coordinates in the specified layer and updates the layers * collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#removeTileAt - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#removeTileAt + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. * @@ -120163,19 +127445,19 @@ var DynamicTilemapLayer = new Class({ }, /** - * Removes the tile at the given world coordinates in the specified layer and updates the layer's + * Removes the tile at the given world coordinates in the specified layer and updates the layers * collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#removeTileAtWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#removeTileAtWorldXY + * @since 3.50.0 * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Tilemaps.Tile} A Tile object. + * @return {Phaser.Tilemaps.Tile} The Tile object that was removed from the given location. */ removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera) { @@ -120188,13 +127470,13 @@ var DynamicTilemapLayer = new Class({ * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation * wherever you want on the screen. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#renderDebug - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#renderDebug + * @since 3.50.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. + * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ renderDebug: function (graphics, styleConfig) { @@ -120208,17 +127490,17 @@ var DynamicTilemapLayer = new Class({ * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does * not change collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#replaceByIndex - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#replaceByIndex + * @since 3.50.0 * - * @param {integer} findIndex - The index of the tile to search for. - * @param {integer} newIndex - The index of the tile to replace it with. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} findIndex - The index of the tile to search for. + * @param {number} newIndex - The index of the tile to replace it with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height) { @@ -120229,12 +127511,13 @@ var DynamicTilemapLayer = new Class({ /** * You can control if the Cameras should cull tiles before rendering them or not. + * * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. * * However, there are some instances when you may wish to disable this. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setSkipCull - * @since 3.11.0 + * @method Phaser.Tilemaps.TilemapLayer#setSkipCull + * @since 3.50.0 * * @param {boolean} [value=true] - Set to `true` to stop culling tiles. Set to `false` to enable culling again. * @@ -120256,11 +127539,11 @@ var DynamicTilemapLayer = new Class({ * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale) * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCullPadding - * @since 3.11.0 + * @method Phaser.Tilemaps.TilemapLayer#setCullPadding + * @since 3.50.0 * - * @param {integer} [paddingX=1] - The amount of extra horizontal tiles to add to the cull check padding. - * @param {integer} [paddingY=1] - The amount of extra vertical tiles to add to the cull check padding. + * @param {number} [paddingX=1] - The amount of extra horizontal tiles to add to the cull check padding. + * @param {number} [paddingY=1] - The amount of extra vertical tiles to add to the cull check padding. * * @return {this} This Tilemap Layer object. */ @@ -120280,18 +127563,15 @@ var DynamicTilemapLayer = new Class({ * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if * collision will be enabled (true) or disabled (false). * - * If no layer specified, the map's current layer is used. + * @method Phaser.Tilemaps.TilemapLayer#setCollision + * @since 3.50.0 * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollision - * @since 3.0.0 - * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to - * false if no tiles have been placed for significant performance boost. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {this} This Tilemap Layer object. */ setCollision: function (indexes, collides, recalculateFaces, updateLayer) { @@ -120306,15 +127586,15 @@ var DynamicTilemapLayer = new Class({ * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be * enabled (true) or disabled (false). * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionBetween - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setCollisionBetween + * @since 3.50.0 * - * @param {integer} start - The first index of the tile to be set for collision. - * @param {integer} stop - The last index of the tile to be set for collision. + * @param {number} start - The first index of the tile to be set for collision. + * @param {number} stop - The last index of the tile to be set for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setCollisionBetween: function (start, stop, collides, recalculateFaces) { @@ -120332,14 +127612,14 @@ var DynamicTilemapLayer = new Class({ * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a * "types" property that matches any of those values, its collision flag will be updated. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionByProperty - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setCollisionByProperty + * @since 3.50.0 * * @param {object} properties - An object with tile properties and corresponding values that should be checked. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setCollisionByProperty: function (properties, collides, recalculateFaces) { @@ -120353,14 +127633,14 @@ var DynamicTilemapLayer = new Class({ * the given array. The `collides` parameter controls if collision will be enabled (true) or * disabled (false). Tile indexes not currently in the layer are not affected. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionByExclusion - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setCollisionByExclusion + * @since 3.50.0 * - * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setCollisionByExclusion: function (indexes, collides, recalculateFaces) { @@ -120375,13 +127655,13 @@ var DynamicTilemapLayer = new Class({ * a tiles collision group, the tile's colliding information will be set. The `collides` parameter * controls if collision will be enabled (true) or disabled (false). * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionFromCollisionGroup - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setCollisionFromCollisionGroup + * @since 3.50.0 * * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setCollisionFromCollisionGroup: function (collides, recalculateFaces) { @@ -120396,14 +127676,14 @@ var DynamicTilemapLayer = new Class({ * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile * at a specific location on the map then see setTileLocationCallback. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setTileIndexCallback - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setTileIndexCallback + * @since 3.50.0 * - * @param {(integer|integer[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. + * @param {(number|number[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setTileIndexCallback: function (indexes, callback, callbackContext) { @@ -120417,17 +127697,17 @@ var DynamicTilemapLayer = new Class({ * If a callback is already set for the tile index it will be replaced. Set the callback to null to * remove it. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#setTileLocationCallback - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#setTileLocationCallback + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * @param {function} [callback] - The callback that will be invoked when the tile is collided with. - * @param {object} [callbackContext] - The context under which the callback is called. + * @param {object} [callbackContext] - The context, or scope, under which the callback is invoked. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext) { @@ -120442,15 +127722,15 @@ var DynamicTilemapLayer = new Class({ * appear to have changed! This method only modifies tile indexes and does not change collision * information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#shuffle - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#shuffle + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ shuffle: function (tileX, tileY, width, height) { @@ -120464,17 +127744,17 @@ var DynamicTilemapLayer = new Class({ * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision * information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#swapByIndex - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#swapByIndex + * @since 3.50.0 * - * @param {integer} tileA - First tile index. - * @param {integer} tileB - Second tile index. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileA - First tile index. + * @param {number} tileB - Second tile index. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ swapByIndex: function (indexA, indexB, tileX, tileY, width, height) { @@ -120487,34 +127767,34 @@ var DynamicTilemapLayer = new Class({ * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the * layers position, scale and scroll. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldX - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#tileToWorldX + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {number} + * @return {number} The Tile X coordinate converted to pixels. */ tileToWorldX: function (tileX, camera) { - return TilemapComponents.TileToWorldX(tileX, camera, this.layer); + return this.tilemap.tileToWorldX(tileX, camera, this); }, /** * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the * layers position, scale and scroll. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#tileToWorldY + * @since 3.50.0 * - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {number} + * @return {number} The Tile Y coordinate converted to pixels. */ tileToWorldY: function (tileY, camera) { - return TilemapComponents.TileToWorldY(tileY, camera, this.layer); + return this.tilemap.tileToWorldY(tileY, camera, this); }, /** @@ -120522,19 +127802,19 @@ var DynamicTilemapLayer = new Class({ * layers position, scale and scroll. This will return a new Vector2 object or update the given * `point` object. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#tileToWorldXY + * @since 3.50.0 * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Math.Vector2} + * @return {Phaser.Math.Vector2} A Vector2 containing the world coordinates of the Tile. */ tileToWorldXY: function (tileX, tileY, point, camera) { - return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer); + return this.tilemap.tileToWorldXY(tileX, tileY, point, camera, this); }, /** @@ -120552,18 +127832,16 @@ var DynamicTilemapLayer = new Class({ * The probability of any index being choose is (the index's weight) / (sum of all weights). This * method only modifies tile indexes and does not change collision information. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#weightedRandomize - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#weightedRandomize + * @since 3.50.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during - * randomization. They should be in the form: { index: 0, weight: 4 } or - * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. + * @param {object[]} weightedIndexes - An array of objects to randomly draw from during randomization. They should be in the form: { index: 0, weight: 4 } or { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object. + * @return {this} This Tilemap Layer object. */ weightedRandomize: function (tileX, tileY, width, height, weightedIndexes) { @@ -120576,36 +127854,36 @@ var DynamicTilemapLayer = new Class({ * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the * layers position, scale and scroll. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileX - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#worldToTileX + * @since 3.50.0 * * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {number} + * @return {number} The tile X coordinate based on the world value. */ worldToTileX: function (worldX, snapToFloor, camera) { - return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer); + return this.tilemap.worldToTileX(worldX, snapToFloor, camera, this); }, /** * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the * layers position, scale and scroll. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#worldToTileY + * @since 3.50.0 * * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {number} + * @return {number} The tile Y coordinate based on the world value. */ worldToTileY: function (worldY, snapToFloor, camera) { - return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer); + return this.tilemap.worldToTileY(worldY, snapToFloor, camera, this); }, /** @@ -120613,1497 +127891,27 @@ var DynamicTilemapLayer = new Class({ * layers position, scale and scroll. This will return a new Vector2 object or update the given * `point` object. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileXY - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#worldToTileXY + * @since 3.50.0 * * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. * - * @return {Phaser.Math.Vector2} + * @return {Phaser.Math.Vector2} A Vector2 containing the tile coordinates of the world values. */ worldToTileXY: function (worldX, worldY, snapToFloor, point, camera) { - return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer); - } - -}); - -module.exports = DynamicTilemapLayer; - - -/***/ }), -/* 524 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameEvents = __webpack_require__(21); -var GameObject = __webpack_require__(14); -var ModelViewProjection = __webpack_require__(113); -var StaticTilemapLayerRender = __webpack_require__(1361); -var TilemapComponents = __webpack_require__(149); -var TransformMatrix = __webpack_require__(31); -var Utils = __webpack_require__(10); - -/** - * @classdesc - * A Static Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination - * with one, or more, Tilesets. - * - * A Static Tilemap Layer is optimized for rendering speed over flexibility. You cannot apply per-tile - * effects like tint or alpha, or change the tiles or tilesets the layer uses. - * - * Use a Static Tilemap Layer instead of a Dynamic Tilemap Layer when you don't need tile manipulation features. - * - * @class StaticTilemapLayer - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.Tilemaps - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.ComputedSize - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.Renderer.WebGL.Pipelines.ModelViewProjection - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. - * @param {Phaser.Tilemaps.Tilemap} tilemap - The Tilemap this layer is a part of. - * @param {integer} layerIndex - The index of the LayerData associated with this layer. - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} [x=0] - The world x position where the top left of this layer will be placed. - * @param {number} [y=0] - The world y position where the top left of this layer will be placed. - */ -var StaticTilemapLayer = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.ComputedSize, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Origin, - Components.Pipeline, - Components.Transform, - Components.Visible, - Components.ScrollFactor, - StaticTilemapLayerRender, - ModelViewProjection - ], - - initialize: - - function StaticTilemapLayer (scene, tilemap, layerIndex, tileset, x, y) - { - GameObject.call(this, scene, 'StaticTilemapLayer'); - - /** - * Used internally by physics system to perform fast type checks. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#isTilemap - * @type {boolean} - * @readonly - * @since 3.0.0 - */ - this.isTilemap = true; - - /** - * The Tilemap that this layer is a part of. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#tilemap - * @type {Phaser.Tilemaps.Tilemap} - * @since 3.0.0 - */ - this.tilemap = tilemap; - - /** - * The index of the LayerData associated with this layer. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#layerIndex - * @type {integer} - * @since 3.0.0 - */ - this.layerIndex = layerIndex; - - /** - * The LayerData associated with this layer. LayerData can only be associated with one - * tilemap layer. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#layer - * @type {Phaser.Tilemaps.LayerData} - * @since 3.0.0 - */ - this.layer = tilemap.layers[layerIndex]; - - // Link the LayerData with this static tilemap layer - this.layer.tilemapLayer = this; - - /** - * The Tileset/s associated with this layer. - * - * As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#tileset - * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.0.0 - */ - this.tileset = []; - - /** - * Used internally by the Canvas renderer. - * This holds the tiles that are visible within the camera in the last frame. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#culledTiles - * @type {array} - * @since 3.0.0 - */ - this.culledTiles = []; - - /** - * Canvas only. - * - * You can control if the Cameras should cull tiles before rendering them or not. - * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. - * - * However, there are some instances when you may wish to disable this, and toggling this flag allows - * you to do so. Also see `setSkipCull` for a chainable method that does the same thing. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#skipCull - * @type {boolean} - * @since 3.12.0 - */ - this.skipCull = false; - - /** - * Canvas only. - * - * The total number of tiles drawn by the renderer in the last frame. - * - * This only works when rending with Canvas. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#tilesDrawn - * @type {integer} - * @readonly - * @since 3.12.0 - */ - this.tilesDrawn = 0; - - /** - * Canvas only. - * - * The total number of tiles in this layer. Updated every frame. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#tilesTotal - * @type {integer} - * @readonly - * @since 3.12.0 - */ - this.tilesTotal = this.layer.width * this.layer.height; - - /** - * Canvas only. - * - * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size. - * - * See the method `setCullPadding` for more details. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#cullPaddingX - * @type {integer} - * @default 1 - * @since 3.12.0 - */ - this.cullPaddingX = 1; - - /** - * Canvas only. - * - * The amount of extra tiles to add into the cull rectangle when calculating its vertical size. - * - * See the method `setCullPadding` for more details. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#cullPaddingY - * @type {integer} - * @default 1 - * @since 3.12.0 - */ - this.cullPaddingY = 1; - - /** - * Canvas only. - * - * The callback that is invoked when the tiles are culled. - * - * By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like. - * - * It will be sent 3 arguments: - * - * 1. The Phaser.Tilemaps.LayerData object for this Layer - * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. - * - * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#cullCallback - * @type {function} - * @since 3.12.0 - */ - this.cullCallback = TilemapComponents.CullTiles; - - /** - * A reference to the renderer. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @private - * @since 3.0.0 - */ - this.renderer = scene.sys.game.renderer; - - /** - * An array of vertex buffer objects, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single instance. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#vertexBuffer - * @type {WebGLBuffer[]} - * @private - * @since 3.0.0 - */ - this.vertexBuffer = []; - - /** - * An array of ArrayBuffer objects, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single instance. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#bufferData - * @type {ArrayBuffer[]} - * @private - * @since 3.0.0 - */ - this.bufferData = []; - - /** - * An array of Float32 Array objects, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single instance. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#vertexViewF32 - * @type {Float32Array[]} - * @private - * @since 3.0.0 - */ - this.vertexViewF32 = []; - - /** - * An array of Uint32 Array objects, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single instance. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#vertexViewU32 - * @type {Uint32Array[]} - * @private - * @since 3.0.0 - */ - this.vertexViewU32 = []; - - /** - * An array of booleans, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single boolean. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#dirty - * @type {boolean[]} - * @private - * @since 3.0.0 - */ - this.dirty = []; - - /** - * An array of integers, used by the WebGL renderer. - * - * As of Phaser 3.14 this property is now an array, where each element maps to a Tileset instance. Previously it was a single integer. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#vertexCount - * @type {integer[]} - * @private - * @since 3.0.0 - */ - this.vertexCount = []; - - /** - * The rendering (draw) order of the tiles in this layer. - * - * The default is 0 which is 'right-down', meaning it will draw the tiles starting from the top-left, - * drawing to the right and then moving down to the next row. - * - * The draw orders are: - * - * 0 = right-down - * 1 = left-down - * 2 = right-up - * 3 = left-up - * - * This can be changed via the `setRenderOrder` method. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#_renderOrder - * @type {integer} - * @default 0 - * @private - * @since 3.12.0 - */ - this._renderOrder = 0; - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#_tempMatrix - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.14.0 - */ - this._tempMatrix = new TransformMatrix(); - - /** - * An array holding the mapping between the tile indexes and the tileset they belong to. - * - * @name Phaser.Tilemaps.StaticTilemapLayer#gidMap - * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.14.0 - */ - this.gidMap = []; - - this.setTilesets(tileset); - this.setAlpha(this.layer.alpha); - this.setPosition(x, y); - this.setOrigin(); - this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); - - this.updateVBOData(); - - this.initPipeline(); - - this.mvpInit(); - - scene.sys.game.events.on(GameEvents.CONTEXT_RESTORED, function () - { - this.updateVBOData(); - }, this); + return this.tilemap.worldToTileXY(worldX, worldY, snapToFloor, point, camera, this); }, /** - * Populates the internal `tileset` array with the Tileset references this Layer requires for rendering. + * Destroys this TilemapLayer and removes its link to the associated LayerData. * - * @method Phaser.Tilemaps.StaticTilemapLayer#setTilesets - * @private - * @since 3.14.0 - * - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - */ - setTilesets: function (tilesets) - { - var gidMap = []; - var setList = []; - var map = this.tilemap; - - if (!Array.isArray(tilesets)) - { - tilesets = [ tilesets ]; - } - - for (var i = 0; i < tilesets.length; i++) - { - var tileset = tilesets[i]; - - if (typeof tileset === 'string') - { - tileset = map.getTileset(tileset); - } - - if (tileset) - { - setList.push(tileset); - - var s = tileset.firstgid; - - for (var t = 0; t < tileset.total; t++) - { - gidMap[s + t] = tileset; - } - } - } - - this.gidMap = gidMap; - this.tileset = setList; - }, - - /** - * Prepares the VBO data arrays for population by the `upload` method. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#updateVBOData - * @private - * @since 3.14.0 - * - * @return {this} This Tilemap Layer object. - */ - updateVBOData: function () - { - for (var i = 0; i < this.tileset.length; i++) - { - this.dirty[i] = true; - this.vertexCount[i] = 0; - this.vertexBuffer[i] = null; - this.bufferData[i] = null; - this.vertexViewF32[i] = null; - this.vertexViewU32[i] = null; - } - - return this; - }, - - /** - * If the given tileset is dirty, or hasn't been rendered before, this will create a new - * ArrayBuffer object and iterate through all of the tiles, generating batch data for - * each one, storing the final results into a STATIC vertex buffer. - * - * If the tileset isn't dirty, this method simply returns after setting the vertex buffer - * and buffering the data. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#upload - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to render to. - * @param {integer} tilesetIndex - The tileset index. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - upload: function (camera, tilesetIndex) - { - var pipeline = this.pipeline; - - var renderer = this.renderer; - - var gl = renderer.gl; - - var vertexBuffer = this.vertexBuffer[tilesetIndex]; - var bufferData = this.bufferData[tilesetIndex]; - - if (!this.dirty[tilesetIndex] && vertexBuffer) - { - renderer.setVertexBuffer(vertexBuffer); - - pipeline.setAttribPointers(); - - gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData); - - return this; - } - - var layer = this.layer; - var tileset = this.tileset[tilesetIndex]; - var mapWidth = layer.width; - var mapHeight = layer.height; - var width = tileset.image.source[0].width; - var height = tileset.image.source[0].height; - var mapData = layer.data; - var tile; - var row; - var col; - var renderOrder = this._renderOrder; - var minTileIndex = tileset.firstgid; - var maxTileIndex = tileset.firstgid + tileset.total; - var vOffset = -1; - var bufferSize = (mapWidth * mapHeight) * pipeline.vertexSize * 6; - - this.vertexCount[tilesetIndex] = 0; - - if (bufferData === null) - { - bufferData = new ArrayBuffer(bufferSize); - - this.bufferData[tilesetIndex] = bufferData; - - this.vertexViewF32[tilesetIndex] = new Float32Array(bufferData); - this.vertexViewU32[tilesetIndex] = new Uint32Array(bufferData); - } - - if (renderOrder === 0) - { - // right-down - - for (row = 0; row < mapHeight; row++) - { - for (col = 0; col < mapWidth; col++) - { - tile = mapData[row][col]; - - if (!tile || tile.index < minTileIndex || tile.index > maxTileIndex || !tile.visible) - { - continue; - } - - vOffset = this.batchTile(vOffset, tile, tileset, width, height, camera, tilesetIndex); - } - } - } - else if (renderOrder === 1) - { - // left-down - - for (row = 0; row < mapHeight; row++) - { - for (col = mapWidth - 1; col >= 0; col--) - { - tile = mapData[row][col]; - - if (!tile || tile.index < minTileIndex || tile.index > maxTileIndex || !tile.visible) - { - continue; - } - - vOffset = this.batchTile(vOffset, tile, tileset, width, height, camera, tilesetIndex); - } - } - } - else if (renderOrder === 2) - { - // right-up - - for (row = mapHeight - 1; row >= 0; row--) - { - for (col = 0; col < mapWidth; col++) - { - tile = mapData[row][col]; - - if (!tile || tile.index < minTileIndex || tile.index > maxTileIndex || !tile.visible) - { - continue; - } - - vOffset = this.batchTile(vOffset, tile, tileset, width, height, camera, tilesetIndex); - } - } - } - else if (renderOrder === 3) - { - // left-up - - for (row = mapHeight - 1; row >= 0; row--) - { - for (col = mapWidth - 1; col >= 0; col--) - { - tile = mapData[row][col]; - - if (!tile || tile.index < minTileIndex || tile.index > maxTileIndex || !tile.visible) - { - continue; - } - - vOffset = this.batchTile(vOffset, tile, tileset, width, height, camera, tilesetIndex); - } - } - } - - this.dirty[tilesetIndex] = false; - - if (vertexBuffer === null) - { - vertexBuffer = renderer.createVertexBuffer(bufferData, gl.STATIC_DRAW); - - this.vertexBuffer[tilesetIndex] = vertexBuffer; - } - - renderer.setVertexBuffer(vertexBuffer); - - pipeline.setAttribPointers(); - - gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData); - - return this; - }, - - /** - * Add a single tile into the batch. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#batchTile - * @private - * @since 3.12.0 - * - * @param {integer} vOffset - The vertex offset. - * @param {any} tile - The tile being rendered. - * @param {any} tileset - The tileset being used for rendering. - * @param {integer} width - The width of the tileset image in pixels. - * @param {integer} height - The height of the tileset image in pixels. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the layer is being rendered with. - * @param {integer} tilesetIndex - The tileset index. - * - * @return {integer} The new vOffset value. - */ - batchTile: function (vOffset, tile, tileset, width, height, camera, tilesetIndex) - { - var texCoords = tileset.getTileTextureCoordinates(tile.index); - - if (!texCoords) - { - return vOffset; - } - - var tileWidth = tileset.tileWidth; - var tileHeight = tileset.tileHeight; - - var halfTileWidth = tileWidth / 2; - var halfTileHeight = tileHeight / 2; - - var u0 = texCoords.x / width; - var v0 = texCoords.y / height; - var u1 = (texCoords.x + tileWidth) / width; - var v1 = (texCoords.y + tileHeight) / height; - - var matrix = this._tempMatrix; - - var x = -halfTileWidth; - var y = -halfTileHeight; - - if (tile.flipX) - { - tileWidth *= -1; - x += tileset.tileWidth; - } - - if (tile.flipY) - { - tileHeight *= -1; - y += tileset.tileHeight; - } - - var xw = x + tileWidth; - var yh = y + tileHeight; - - matrix.applyITRS(halfTileWidth + tile.pixelX, halfTileHeight + tile.pixelY, tile.rotation, 1, 1); - - var tint = Utils.getTintAppendFloatAlpha(0xffffff, camera.alpha * this.alpha * tile.alpha); - - var tx0 = matrix.getX(x, y); - var ty0 = matrix.getY(x, y); - - var tx1 = matrix.getX(x, yh); - var ty1 = matrix.getY(x, yh); - - var tx2 = matrix.getX(xw, yh); - var ty2 = matrix.getY(xw, yh); - - var tx3 = matrix.getX(xw, y); - var ty3 = matrix.getY(xw, y); - - if (camera.roundPixels) - { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); - - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); - - tx2 = Math.round(tx2); - ty2 = Math.round(ty2); - - tx3 = Math.round(tx3); - ty3 = Math.round(ty3); - } - - var vertexViewF32 = this.vertexViewF32[tilesetIndex]; - var vertexViewU32 = this.vertexViewU32[tilesetIndex]; - - vertexViewF32[++vOffset] = tx0; - vertexViewF32[++vOffset] = ty0; - vertexViewF32[++vOffset] = u0; - vertexViewF32[++vOffset] = v0; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx1; - vertexViewF32[++vOffset] = ty1; - vertexViewF32[++vOffset] = u0; - vertexViewF32[++vOffset] = v1; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx2; - vertexViewF32[++vOffset] = ty2; - vertexViewF32[++vOffset] = u1; - vertexViewF32[++vOffset] = v1; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx0; - vertexViewF32[++vOffset] = ty0; - vertexViewF32[++vOffset] = u0; - vertexViewF32[++vOffset] = v0; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx2; - vertexViewF32[++vOffset] = ty2; - vertexViewF32[++vOffset] = u1; - vertexViewF32[++vOffset] = v1; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - vertexViewF32[++vOffset] = tx3; - vertexViewF32[++vOffset] = ty3; - vertexViewF32[++vOffset] = u1; - vertexViewF32[++vOffset] = v0; - vertexViewF32[++vOffset] = 0; - vertexViewF32[++vOffset] = 0; - vertexViewU32[++vOffset] = tint; - - this.vertexCount[tilesetIndex] += 6; - - return vOffset; - }, - - /** - * Sets the rendering (draw) order of the tiles in this layer. - * - * The default is 'right-down', meaning it will order the tiles starting from the top-left, - * drawing to the right and then moving down to the next row. - * - * The draw orders are: - * - * 0 = right-down - * 1 = left-down - * 2 = right-up - * 3 = left-up - * - * Setting the render order does not change the tiles or how they are stored in the layer, - * it purely impacts the order in which they are rendered. - * - * You can provide either an integer (0 to 3), or the string version of the order. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setRenderOrder - * @since 3.12.0 - * - * @param {(integer|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. - * - * @return {this} This Tilemap Layer object. - */ - setRenderOrder: function (renderOrder) - { - var orders = [ 'right-down', 'left-down', 'right-up', 'left-up' ]; - - if (typeof renderOrder === 'string') - { - renderOrder = orders.indexOf(renderOrder); - } - - if (renderOrder >= 0 && renderOrder < 4) - { - this._renderOrder = renderOrder; - - for (var i = 0; i < this.tileset.length; i++) - { - this.dirty[i] = true; - } - } - - return this; - }, - - /** - * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting - * faces are used internally for optimizing collisions against tiles. This method is mostly used - * internally to optimize recalculating faces when only one tile has been changed. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#calculateFacesAt - * @since 3.0.0 - * - * @param {integer} tileX - The x coordinate. - * @param {integer} tileY - The y coordinate. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - calculateFacesAt: function (tileX, tileY) - { - TilemapComponents.CalculateFacesAt(tileX, tileY, this.layer); - - return this; - }, - - /** - * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the - * layer. Interesting faces are used internally for optimizing collisions against tiles. This method - * is mostly used internally. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#calculateFacesWithin - * @since 3.0.0 - * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - calculateFacesWithin: function (tileX, tileY, width, height) - { - TilemapComponents.CalculateFacesWithin(tileX, tileY, width, height, this.layer); - - return this; - }, - - /** - * Creates a Sprite for every object matching the given tile indexes in the layer. You can - * optionally specify if each tile will be replaced with a new tile after the Sprite has been - * created. This is useful if you want to lay down special tiles in a level that are converted to - * Sprites, but want to replace the tile itself with a floor tile or similar once converted. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#createFromTiles - * @since 3.0.0 - * - * @param {(integer|array)} indexes - The tile index, or array of indexes, to create Sprites from. - * @param {(integer|array)} replacements - The tile index, or array of indexes, to change a converted - * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a - * one-to-one mapping with the indexes array. - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. - * scene.make.sprite). - * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when determining the world XY - * - * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. - */ - createFromTiles: function (indexes, replacements, spriteConfig, scene, camera) - { - return TilemapComponents.CreateFromTiles(indexes, replacements, spriteConfig, scene, camera, this.layer); - }, - - /** - * Returns the tiles in the given layer that are within the cameras viewport. - * This is used internally. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#cull - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - cull: function (camera) - { - return this.cullCallback(this.layer, camera, this.culledTiles); - }, - - /** - * Canvas only. - * - * You can control if the Cameras should cull tiles before rendering them or not. - * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. - * - * However, there are some instances when you may wish to disable this. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setSkipCull - * @since 3.12.0 - * - * @param {boolean} [value=true] - Set to `true` to stop culling tiles. Set to `false` to enable culling again. - * - * @return {this} This Tilemap Layer object. - */ - setSkipCull: function (value) - { - if (value === undefined) { value = true; } - - this.skipCull = value; - - return this; - }, - - /** - * Canvas only. - * - * When a Camera culls the tiles in this layer it does so using its view into the world, building up a - * rectangle inside which the tiles must exist or they will be culled. Sometimes you may need to expand the size - * of this 'cull rectangle', especially if you plan on rotating the Camera viewing the layer. Do so - * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px - * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale) - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCullPadding - * @since 3.12.0 - * - * @param {integer} [paddingX=1] - The amount of extra horizontal tiles to add to the cull check padding. - * @param {integer} [paddingY=1] - The amount of extra vertical tiles to add to the cull check padding. - * - * @return {this} This Tilemap Layer object. - */ - setCullPadding: function (paddingX, paddingY) - { - if (paddingX === undefined) { paddingX = 1; } - if (paddingY === undefined) { paddingY = 1; } - - this.cullPaddingX = paddingX; - this.cullPaddingY = paddingY; - - return this; - }, - - /** - * Searches the entire map layer for the first tile matching the given index, then returns that Tile - * object. If no match is found, it returns null. The search starts from the top-left tile and - * continues horizontally until it hits the end of the row, then it drops down to the next column. - * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to - * the top-left. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#findByIndex - * @since 3.0.0 - * - * @param {integer} index - The tile index value to search for. - * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. - * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the - * bottom-right. Otherwise it scans from the top-left. - * - * @return {Phaser.Tilemaps.Tile} A Tile object. - */ - findByIndex: function (findIndex, skip, reverse) - { - return TilemapComponents.FindByIndex(findIndex, skip, reverse, this.layer); - }, - - /** - * Find the first tile in the given rectangular area (in tile coordinates) of the layer that - * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns - * true. Similar to Array.prototype.find in vanilla JS. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#findTile - * @since 3.0.0 - * - * @param {function} callback - The callback. Each tile in the given area will be passed to this - * callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * - * @return {?Phaser.Tilemaps.Tile} - */ - findTile: function (callback, context, tileX, tileY, width, height, filteringOptions) - { - return TilemapComponents.FindTile(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); - }, - - /** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns - * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#filterTiles - * @since 3.0.0 - * - * @param {function} callback - The callback. Each tile in the given area will be passed to this - * callback as the first and only parameter. The callback should return true for tiles that pass the - * filter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - filterTiles: function (callback, context, tileX, tileY, width, height, filteringOptions) - { - return TilemapComponents.FilterTiles(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); - }, - - /** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * callback. Similar to Array.prototype.forEach in vanilla JS. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#forEachTile - * @since 3.0.0 - * - * @param {function} callback - The callback. Each tile in the given area will be passed to this - * callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions) - { - TilemapComponents.ForEachTile(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); - - return this; - }, - - /** - * Gets a tile at the given tile coordinates from the given layer. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTileAt - * @since 3.0.0 - * - * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile - * object with an index of -1. - * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. - */ - getTileAt: function (tileX, tileY, nonNull) - { - return TilemapComponents.GetTileAt(tileX, tileY, nonNull, this.layer); - }, - - /** - * Gets a tile at the given world coordinates from the given layer. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTileAtWorldXY - * @since 3.0.0 - * - * @param {number} worldX - X position to get the tile from (given in pixels) - * @param {number} worldY - Y position to get the tile from (given in pixels) - * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile - * object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates - * were invalid. - */ - getTileAtWorldXY: function (worldX, worldY, nonNull, camera) - { - return TilemapComponents.GetTileAtWorldXY(worldX, worldY, nonNull, camera, this.layer); - }, - - /** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithin - * @since 3.0.0 - * - * @param {integer} [tileX=0] - The leftmost tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The topmost tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - getTilesWithin: function (tileX, tileY, width, height, filteringOptions) - { - return TilemapComponents.GetTilesWithin(tileX, tileY, width, height, filteringOptions, this.layer); - }, - - /** - * Gets the tiles in the given rectangular area (in world coordinates) of the layer. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithinWorldXY - * @since 3.0.0 - * - * @param {number} worldX - The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} worldY - The topmost tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles high from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera) - { - return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer); - }, - - /** - * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, - * Line, Rectangle or Triangle. The shape should be in world coordinates. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#getTilesWithinShape - * @since 3.0.0 - * - * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ - getTilesWithinShape: function (shape, filteringOptions, camera) - { - return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer); - }, - - /** - * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAt - * @since 3.0.0 - * - * @param {integer} tileX - X position to get the tile from in tile coordinates. - * @param {integer} tileY - Y position to get the tile from in tile coordinates. - * - * @return {boolean} - */ - hasTileAt: function (tileX, tileY) - { - return TilemapComponents.HasTileAt(tileX, tileY, this.layer); - }, - - /** - * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#hasTileAtWorldXY - * @since 3.0.0 - * - * @param {number} worldX - The X coordinate of the world position. - * @param {number} worldY - The Y coordinate of the world position. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {boolean} - */ - hasTileAtWorldXY: function (worldX, worldY, camera) - { - return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, this.layer); - }, - - /** - * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to - * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles - * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation - * wherever you want on the screen. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#renderDebug - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - renderDebug: function (graphics, styleConfig) - { - TilemapComponents.RenderDebug(graphics, styleConfig, this.layer); - - return this; - }, - - /** - * Sets collision on the given tile or tiles within a layer by index. You can pass in either a - * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if - * collision will be enabled (true) or disabled (false). - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollision - * @since 3.0.0 - * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to - * false if no tiles have been placed for significant performance boost. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollision: function (indexes, collides, recalculateFaces, updateLayer) - { - TilemapComponents.SetCollision(indexes, collides, recalculateFaces, this.layer, updateLayer); - - return this; - }, - - /** - * Sets collision on a range of tiles in a layer whose index is between the specified `start` and - * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set - * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be - * enabled (true) or disabled (false). - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionBetween - * @since 3.0.0 - * - * @param {integer} start - The first index of the tile to be set for collision. - * @param {integer} stop - The last index of the tile to be set for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionBetween: function (start, stop, collides, recalculateFaces) - { - TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property - * that matches the given properties object, its collision flag will be set. The `collides` - * parameter controls if collision will be enabled (true) or disabled (false). Passing in - * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that - * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can - * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a - * "types" property that matches any of those values, its collision flag will be updated. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionByProperty - * @since 3.0.0 - * - * @param {object} properties - An object with tile properties and corresponding values that should - * be checked. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionByProperty: function (properties, collides, recalculateFaces) - { - TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets collision on all tiles in the given layer, except for tiles that have an index specified in - * the given array. The `collides` parameter controls if collision will be enabled (true) or - * disabled (false). Tile indexes not currently in the layer are not affected. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionByExclusion - * @since 3.0.0 - * - * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionByExclusion: function (indexes, collides, recalculateFaces) - { - TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets a global collision callback for the given tile index within the layer. This will affect all - * tiles on this layer that have the same index. If a callback is already set for the tile index it - * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile - * at a specific location on the map then see setTileLocationCallback. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setTileIndexCallback - * @since 3.0.0 - * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes to have a - * collision callback set for. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} callbackContext - The context under which the callback is called. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setTileIndexCallback: function (indexes, callback, callbackContext) - { - TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, this.layer); - - return this; - }, - - /** - * Sets collision on the tiles within a layer by checking each tiles collision group data - * (typically defined in Tiled within the tileset collision editor). If any objects are found within - * a tiles collision group, the tile's colliding information will be set. The `collides` parameter - * controls if collision will be enabled (true) or disabled (false). - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setCollisionFromCollisionGroup - * @since 3.0.0 - * - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear - * collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the - * update. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setCollisionFromCollisionGroup: function (collides, recalculateFaces) - { - TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, this.layer); - - return this; - }, - - /** - * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. - * If a callback is already set for the tile index it will be replaced. Set the callback to null to - * remove it. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#setTileLocationCallback - * @since 3.0.0 - * - * @param {integer} tileX - The leftmost tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The topmost tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} [callbackContext] - The context under which the callback is called. - * - * @return {Phaser.Tilemaps.StaticTilemapLayer} This Tilemap Layer object. - */ - setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext) - { - TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, this.layer); - - return this; - }, - - /** - * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldX - * @since 3.0.0 - * - * @param {integer} tileX - The X coordinate, in tile coordinates. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. - * - * @return {number} - */ - tileToWorldX: function (tileX, camera) - { - return TilemapComponents.TileToWorldX(tileX, camera, this.layer); - }, - - /** - * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldY - * @since 3.0.0 - * - * @param {integer} tileY - The Y coordinate, in tile coordinates. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. - * - * @return {number} - */ - tileToWorldY: function (tileY, camera) - { - return TilemapComponents.TileToWorldY(tileY, camera, this.layer); - }, - - /** - * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#tileToWorldXY - * @since 3.0.0 - * - * @param {integer} tileX - The X coordinate, in tile coordinates. - * @param {integer} tileY - The Y coordinate, in tile coordinates. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the world values from the tile index. - * - * @return {Phaser.Math.Vector2} - */ - tileToWorldXY: function (tileX, tileY, point, camera) - { - return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer); - }, - - /** - * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileX - * @since 3.0.0 - * - * @param {number} worldX - The X coordinate, in world pixels. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the - * nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.] - * - * @return {number} - */ - worldToTileX: function (worldX, snapToFloor, camera) - { - return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer); - }, - - /** - * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the - * layers position, scale and scroll. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileY - * @since 3.0.0 - * - * @param {number} worldY - The Y coordinate, in world pixels. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the - * nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {number} - */ - worldToTileY: function (worldY, snapToFloor, camera) - { - return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer); - }, - - /** - * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#worldToTileXY - * @since 3.0.0 - * - * @param {number} worldX - The X coordinate, in world pixels. - * @param {number} worldY - The Y coordinate, in world pixels. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the - * nearest integer. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given, a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * - * @return {Phaser.Math.Vector2} - */ - worldToTileXY: function (worldX, worldY, snapToFloor, point, camera) - { - return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer); - }, - - /** - * Destroys this StaticTilemapLayer and removes its link to the associated LayerData. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#destroy - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#destroy + * @since 3.50.0 * * @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap? */ @@ -122133,16 +127941,6 @@ var StaticTilemapLayer = new Class({ this.culledTiles.length = 0; this.cullCallback = null; - for (var i = 0; i < this.tileset.length; i++) - { - this.dirty[i] = true; - this.vertexCount[i] = 0; - this.vertexBuffer[i] = null; - this.bufferData[i] = null; - this.vertexViewF32[i] = null; - this.vertexViewU32[i] = null; - } - this.gidMap = []; this.tileset = []; @@ -122151,11 +127949,11 @@ var StaticTilemapLayer = new Class({ }); -module.exports = StaticTilemapLayer; +module.exports = TilemapLayer; /***/ }), -/* 525 */ +/* 561 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122428,6 +128226,58 @@ var TimerEvent = new Class({ return this.elapsed * 0.001; }, + /** + * Returns the time interval until the next iteration of the Timer Event. + * + * @method Phaser.Time.TimerEvent#getRemaining + * @since 3.50.0 + * + * @return {number} The time interval in milliseconds. + */ + getRemaining: function () + { + return this.delay - this.elapsed; + }, + + /** + * Returns the time interval until the next iteration of the Timer Event in seconds. + * + * @method Phaser.Time.TimerEvent#getRemainingSeconds + * @since 3.50.0 + * + * @return {number} The time interval in seconds. + */ + getRemainingSeconds: function () + { + return this.getRemaining() * 0.001; + }, + + /** + * Returns the time interval until the last iteration of the Timer Event. + * + * @method Phaser.Time.TimerEvent#getOverallRemaining + * @since 3.50.0 + * + * @return {number} The time interval in milliseconds. + */ + getOverallRemaining: function () + { + return this.delay * (1 + this.repeatCount) - this.elapsed; + }, + + /** + * Returns the time interval until the last iteration of the Timer Event in seconds. + * + * @method Phaser.Time.TimerEvent#getOverallRemainingSeconds + * @since 3.50.0 + * + * @return {number} The time interval in seconds. + */ + getOverallRemainingSeconds: function () + { + return this.getOverallRemaining() * 0.001; + }, + /** * Forces the Timer Event to immediately expire, thus scheduling its removal in the next frame. * @@ -122468,7 +128318,7 @@ module.exports = TimerEvent; /***/ }), -/* 526 */ +/* 562 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122477,7 +128327,7 @@ module.exports = TimerEvent; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RESERVED = __webpack_require__(1375); +var RESERVED = __webpack_require__(1437); /** * Internal function used by the Tween Builder to return an array of properties @@ -122529,7 +128379,7 @@ module.exports = GetProps; /***/ }), -/* 527 */ +/* 563 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122577,7 +128427,7 @@ module.exports = GetTweens; /***/ }), -/* 528 */ +/* 564 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122586,15 +128436,15 @@ module.exports = GetTweens; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Defaults = __webpack_require__(243); +var Defaults = __webpack_require__(256); var GetAdvancedValue = __webpack_require__(15); -var GetBoolean = __webpack_require__(90); -var GetEaseFunction = __webpack_require__(71); +var GetBoolean = __webpack_require__(95); +var GetEaseFunction = __webpack_require__(78); var GetNewValue = __webpack_require__(155); var GetValue = __webpack_require__(6); -var GetValueOp = __webpack_require__(242); -var Tween = __webpack_require__(244); -var TweenData = __webpack_require__(246); +var GetValueOp = __webpack_require__(255); +var Tween = __webpack_require__(257); +var TweenData = __webpack_require__(259); /** * Creates a new Number Tween. @@ -122707,7 +128557,7 @@ module.exports = NumberTweenBuilder; /***/ }), -/* 529 */ +/* 565 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122716,7 +128566,7 @@ module.exports = NumberTweenBuilder; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetEaseFunction = __webpack_require__(71); +var GetEaseFunction = __webpack_require__(78); var GetValue = __webpack_require__(6); var MATH_CONST = __webpack_require__(13); @@ -122953,7 +128803,7 @@ module.exports = StaggerBuilder; /***/ }), -/* 530 */ +/* 566 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -122962,16 +128812,16 @@ module.exports = StaggerBuilder; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); -var Defaults = __webpack_require__(243); +var Clone = __webpack_require__(76); +var Defaults = __webpack_require__(256); var GetAdvancedValue = __webpack_require__(15); -var GetBoolean = __webpack_require__(90); -var GetEaseFunction = __webpack_require__(71); +var GetBoolean = __webpack_require__(95); +var GetEaseFunction = __webpack_require__(78); var GetNewValue = __webpack_require__(155); -var GetTargets = __webpack_require__(241); -var GetTweens = __webpack_require__(527); +var GetTargets = __webpack_require__(254); +var GetTweens = __webpack_require__(563); var GetValue = __webpack_require__(6); -var Timeline = __webpack_require__(531); +var Timeline = __webpack_require__(567); var TweenBuilder = __webpack_require__(156); /** @@ -123107,7 +128957,7 @@ module.exports = TimelineBuilder; /***/ }), -/* 531 */ +/* 567 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -123117,10 +128967,10 @@ module.exports = TimelineBuilder; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(245); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(258); var TweenBuilder = __webpack_require__(156); -var TWEEN_CONST = __webpack_require__(91); +var TWEEN_CONST = __webpack_require__(96); /** * @classdesc @@ -123262,7 +129112,7 @@ var Timeline = new Class({ * The current state of the Timeline. * * @name Phaser.Tweens.Timeline#state - * @type {integer} + * @type {number} * @since 3.0.0 */ this.state = TWEEN_CONST.PENDING_ADD; @@ -123271,7 +129121,7 @@ var Timeline = new Class({ * The state of the Timeline when it was paused (used by Resume) * * @name Phaser.Tweens.Timeline#_pausedState - * @type {integer} + * @type {number} * @private * @since 3.0.0 */ @@ -124012,7 +129862,7 @@ module.exports = Timeline; /***/ }), -/* 532 */ +/* 568 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -124022,13 +129872,13 @@ module.exports = Timeline; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasSnapshot = __webpack_require__(533); -var CameraEvents = __webpack_require__(42); +var CameraEvents = __webpack_require__(35); +var CanvasSnapshot = __webpack_require__(569); var Class = __webpack_require__(0); -var CONST = __webpack_require__(34); -var GetBlendModes = __webpack_require__(534); -var ScaleEvents = __webpack_require__(94); -var TransformMatrix = __webpack_require__(31); +var CONST = __webpack_require__(39); +var GetBlendModes = __webpack_require__(570); +var ScaleEvents = __webpack_require__(101); +var TransformMatrix = __webpack_require__(24); /** * @classdesc @@ -124060,7 +129910,7 @@ var CanvasRenderer = new Class({ * A constant which allows the renderer to be easily identified as a Canvas Renderer. * * @name Phaser.Renderer.Canvas.CanvasRenderer#type - * @type {integer} + * @type {number} * @since 3.0.0 */ this.type = CONST.CANVAS; @@ -124079,7 +129929,7 @@ var CanvasRenderer = new Class({ * The width of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width = 0; @@ -124088,7 +129938,7 @@ var CanvasRenderer = new Class({ * The height of the canvas being rendered to. * * @name Phaser.Renderer.Canvas.CanvasRenderer#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height = 0; @@ -124103,7 +129953,6 @@ var CanvasRenderer = new Class({ this.config = { clearBeforeRender: game.config.clearBeforeRender, backgroundColor: game.config.backgroundColor, - resolution: game.config.resolution, antialias: game.config.antialias, roundPixels: game.config.roundPixels }; @@ -124186,7 +130035,7 @@ var CanvasRenderer = new Class({ * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix1 * @private * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 + * @since 3.11.0 */ this._tempMatrix1 = new TransformMatrix(); @@ -124196,7 +130045,7 @@ var CanvasRenderer = new Class({ * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix2 * @private * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 + * @since 3.11.0 */ this._tempMatrix2 = new TransformMatrix(); @@ -124206,20 +130055,10 @@ var CanvasRenderer = new Class({ * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix3 * @private * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 + * @since 3.11.0 */ this._tempMatrix3 = new TransformMatrix(); - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix4 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix4 = new TransformMatrix(); - this.init(); }, @@ -124246,8 +130085,6 @@ var CanvasRenderer = new Class({ * * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. - * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. - * @param {number} [resolution] - The Scale Manager resolution setting. */ onResize: function (gameSize, baseSize) { @@ -124370,25 +130207,30 @@ var CanvasRenderer = new Class({ }, /** - * Renders the Scene to the given Camera. + * The core render step for a Scene Camera. + * + * Iterates through the given array of Game Objects and renders them with the given Camera. + * + * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked + * by the Scene Systems.render method. + * + * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. * * @method Phaser.Renderer.Canvas.CanvasRenderer#render * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to render. - * @param {Phaser.GameObjects.DisplayList} children - The Game Objects within the Scene to be rendered. - * @param {number} interpolationPercentage - The interpolation percentage to apply. Currently unused. + * @param {Phaser.GameObjects.GameObject[]} children - An array of filtered Game Objects that can be rendered by the given Camera. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. */ - render: function (scene, children, interpolationPercentage, camera) + render: function (scene, children, camera) { - var list = children.list; - var childCount = list.length; + var childCount = children.length; - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; + var cx = camera.x; + var cy = camera.y; + var cw = camera.width; + var ch = camera.height; var ctx = (camera.renderToTexture) ? camera.context : scene.sys.context; @@ -124421,7 +130263,7 @@ var CanvasRenderer = new Class({ ctx.globalCompositeOperation = 'source-over'; - this.drawCount += list.length; + this.drawCount += childCount; if (camera.renderToTexture) { @@ -124432,19 +130274,14 @@ var CanvasRenderer = new Class({ for (var i = 0; i < childCount; i++) { - var child = list[i]; - - if (!child.willRender(camera)) - { - continue; - } + var child = children[i]; if (child.mask) { child.mask.preRenderCanvas(this, child, camera); } - child.renderCanvas(this, child, interpolationPercentage, camera); + child.renderCanvas(this, child, camera); if (child.mask) { @@ -124518,10 +130355,10 @@ var CanvasRenderer = new Class({ * @param {HTMLCanvasElement} canvas - The canvas to grab from. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {boolean} [getPixel=false] - Grab a single pixel as a Color object, or an area as an Image object? - * @param {integer} [x=0] - The x coordinate to grab from. - * @param {integer} [y=0] - The y coordinate to grab from. - * @param {integer} [width=canvas.width] - The width of the area to grab. - * @param {integer} [height=canvas.height] - The height of the area to grab. + * @param {number} [x=0] - The x coordinate to grab from. + * @param {number} [y=0] - The y coordinate to grab from. + * @param {number} [width=canvas.width] - The width of the area to grab. + * @param {number} [height=canvas.height] - The height of the area to grab. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. * @@ -124583,10 +130420,10 @@ var CanvasRenderer = new Class({ * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotArea * @since 3.16.0 * - * @param {integer} x - The x coordinate to grab from. - * @param {integer} y - The y coordinate to grab from. - * @param {integer} width - The width of the area to grab. - * @param {integer} height - The height of the area to grab. + * @param {number} x - The x coordinate to grab from. + * @param {number} y - The y coordinate to grab from. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. @@ -124624,8 +130461,8 @@ var CanvasRenderer = new Class({ * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotPixel * @since 3.16.0 * - * @param {integer} x - The x coordinate of the pixel to get. - * @param {integer} y - The y coordinate of the pixel to get. + * @param {number} x - The x coordinate of the pixel to get. + * @param {number} y - The y coordinate of the pixel to get. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. * * @return {this} This WebGL Renderer. @@ -124819,7 +130656,7 @@ module.exports = CanvasRenderer; /***/ }), -/* 533 */ +/* 569 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -124828,8 +130665,8 @@ module.exports = CanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); -var Color = __webpack_require__(32); +var CanvasPool = __webpack_require__(31); +var Color = __webpack_require__(36); var GetFastValue = __webpack_require__(2); /** @@ -124912,7 +130749,7 @@ module.exports = CanvasSnapshot; /***/ }), -/* 534 */ +/* 570 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -124921,8 +130758,8 @@ module.exports = CanvasSnapshot; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var modes = __webpack_require__(54); -var CanvasFeatures = __webpack_require__(329); +var modes = __webpack_require__(48); +var CanvasFeatures = __webpack_require__(340); /** * Returns an array which maps the default blend modes to supported Canvas blend modes. @@ -124976,7 +130813,7 @@ module.exports = GetBlendModes; /***/ }), -/* 535 */ +/* 571 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -124986,22 +130823,21 @@ module.exports = GetBlendModes; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCamera = __webpack_require__(93); -var CameraEvents = __webpack_require__(42); +var ArrayRemove = __webpack_require__(87); +var BaseCamera = __webpack_require__(99); +var CameraEvents = __webpack_require__(35); var Class = __webpack_require__(0); -var CONST = __webpack_require__(34); -var GameEvents = __webpack_require__(21); -var IsSizePowerOfTwo = __webpack_require__(128); +var CONST = __webpack_require__(39); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(190); +var GameEvents = __webpack_require__(23); +var IsSizePowerOfTwo = __webpack_require__(133); var NOOP = __webpack_require__(1); -var PIPELINE_CONST = __webpack_require__(110); -var PipelineManager = __webpack_require__(536); -var ProjectOrtho = __webpack_require__(185); -var ScaleEvents = __webpack_require__(94); -var SpliceOne = __webpack_require__(82); -var TextureEvents = __webpack_require__(130); -var TransformMatrix = __webpack_require__(31); -var Utils = __webpack_require__(10); -var WebGLSnapshot = __webpack_require__(541); +var PipelineManager = __webpack_require__(572); +var ScaleEvents = __webpack_require__(101); +var TextureEvents = __webpack_require__(136); +var Utils = __webpack_require__(12); +var WebGLSnapshot = __webpack_require__(580); /** * @callback WebGLContextCallback @@ -125021,6 +130857,7 @@ var WebGLSnapshot = __webpack_require__(541); * * @class WebGLRenderer * @memberof Phaser.Renderer.WebGL + * @extends Phaser.Events.EventEmitter * @constructor * @since 3.0.0 * @@ -125028,10 +130865,14 @@ var WebGLSnapshot = __webpack_require__(541); */ var WebGLRenderer = new Class({ + Extends: EventEmitter, + initialize: function WebGLRenderer (game) { + EventEmitter.call(this); + var gameConfig = game.config; var contextCreationConfig = { @@ -125057,7 +130898,6 @@ var WebGLRenderer = new Class({ antialias: gameConfig.antialias, backgroundColor: gameConfig.backgroundColor, contextCreation: contextCreationConfig, - resolution: gameConfig.resolution, roundPixels: gameConfig.roundPixels, maxTextures: gameConfig.maxTextures, maxTextureSize: gameConfig.maxTextureSize, @@ -125079,7 +130919,7 @@ var WebGLRenderer = new Class({ * A constant which allows the renderer to be easily identified as a WebGL Renderer. * * @name Phaser.Renderer.WebGL.WebGLRenderer#type - * @type {integer} + * @type {number} * @since 3.0.0 */ this.type = CONST.WEBGL; @@ -125106,7 +130946,7 @@ var WebGLRenderer = new Class({ * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#width - * @type {integer} + * @type {number} * @since 3.0.0 */ this.width = 0; @@ -125116,7 +130956,7 @@ var WebGLRenderer = new Class({ * This is populated in the onResize event handler. * * @name Phaser.Renderer.WebGL.WebGLRenderer#height - * @type {integer} + * @type {number} * @since 3.0.0 */ this.height = 0; @@ -125142,16 +130982,6 @@ var WebGLRenderer = new Class({ */ this.blendModes = []; - /** - * Keeps track of any WebGLTexture created with the current WebGLRenderingContext. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#nativeTextures - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.nativeTextures = []; - /** * This property is set to `true` if the WebGL context of the renderer is lost. * @@ -125185,13 +131015,11 @@ var WebGLRenderer = new Class({ bufferHeight: 0 }; - // Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc) - /** * Cached value for the last texture unit that was used. * * @name Phaser.Renderer.WebGL.WebGLRenderer#currentActiveTexture - * @type {integer} + * @type {number} * @since 3.1.0 */ this.currentActiveTexture = 0; @@ -125201,7 +131029,7 @@ var WebGLRenderer = new Class({ * This value is constantly updated and should be treated as read-only by your code. * * @name Phaser.Renderer.WebGL.WebGLRenderer#startActiveTexture - * @type {integer} + * @type {number} * @since 3.50.0 */ this.startActiveTexture = 0; @@ -125211,7 +131039,7 @@ var WebGLRenderer = new Class({ * This is set via the Game Config `maxTextures` property and should never be changed after boot. * * @name Phaser.Renderer.WebGL.WebGLRenderer#maxTextures - * @type {integer} + * @type {number} * @since 3.50.0 */ this.maxTextures = 0; @@ -125257,7 +131085,7 @@ var WebGLRenderer = new Class({ this.normalTexture; /** - * Current framebuffer in use. + * The currently bound framebuffer in use. * * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer * @type {WebGLFramebuffer} @@ -125266,6 +131094,15 @@ var WebGLRenderer = new Class({ */ this.currentFramebuffer = null; + /** + * A stack into which the frame buffer objects are pushed and popped. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#fboStack + * @type {WebGLFramebuffer[]} + * @since 3.50.0 + */ + this.fboStack = []; + /** * Current WebGLProgram in use. * @@ -125300,7 +131137,7 @@ var WebGLRenderer = new Class({ * Current blend mode in use * * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode - * @type {integer} + * @type {number} * @since 3.0.0 */ this.currentBlendMode = Infinity; @@ -125364,17 +131201,40 @@ var WebGLRenderer = new Class({ this.gl = null; /** - * Array of strings that indicate which WebGL extensions are supported by the browser + * Array of strings that indicate which WebGL extensions are supported by the browser. + * This is populated in the `boot` method. * * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions - * @type {object} + * @type {string[]} * @default null * @since 3.0.0 */ this.supportedExtensions = null; /** - * Extensions loaded into the current context + * If the browser supports the `ANGLE_instanced_arrays` extension, this property will hold + * a reference to the glExtension for it. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#instancedArraysExtension + * @type {ANGLE_instanced_arrays} + * @default null + * @since 3.50.0 + */ + this.instancedArraysExtension = null; + + /** + * If the browser supports the `OES_vertex_array_object` extension, this property will hold + * a reference to the glExtension for it. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#vaoExtension + * @type {OES_vertex_array_object} + * @default null + * @since 3.50.0 + */ + this.vaoExtension = null; + + /** + * The WebGL Extensions loaded into the current context. * * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions * @type {object} @@ -125384,7 +131244,7 @@ var WebGLRenderer = new Class({ this.extensions = {}; /** - * Stores the current WebGL component formats for further use + * Stores the current WebGL component formats for further use. * * @name Phaser.Renderer.WebGL.WebGLRenderer#glFormats * @type {array} @@ -125397,7 +131257,7 @@ var WebGLRenderer = new Class({ * Stores the supported WebGL texture compression formats. * * @name Phaser.Renderer.WebGL.WebGLRenderer#compression - * @type {array} + * @type {object} * @since 3.8.0 */ this.compression = { @@ -125427,6 +131287,17 @@ var WebGLRenderer = new Class({ */ this.blankTexture = null; + /** + * A pure white 4x4 texture, as used by the Graphics system where needed. + * This is set in the `boot` method. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#whiteTexture + * @type {WebGLTexture} + * @readonly + * @since 3.50.0 + */ + this.whiteTexture = null; + /** * A default Camera used in calls when no other camera has been provided. * @@ -125436,51 +131307,11 @@ var WebGLRenderer = new Class({ */ this.defaultCamera = new BaseCamera(0, 0, 0, 0); - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix1 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix2 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix3 = new TransformMatrix(); - - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#_tempMatrix4 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.12.0 - */ - this._tempMatrix4 = new TransformMatrix(); - /** * The total number of masks currently stacked. * * @name Phaser.Renderer.WebGL.WebGLRenderer#maskCount - * @type {integer} + * @type {number} * @since 3.17.0 */ this.maskCount = 0; @@ -125596,6 +131427,25 @@ var WebGLRenderer = new Class({ */ this.textureFlush = 0; + /** + * The default scissor, set during `preRender` and modified during `resize`. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#defaultScissor + * @type {number[]} + * @private + * @since 3.50.0 + */ + this.defaultScissor = [ 0, 0, 0, 0 ]; + + /** + * Has this renderer fully booted yet? + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#isBooted + * @type {boolean} + * @since 3.50.0 + */ + this.isBooted = false; + this.init(this.config); }, @@ -125713,7 +131563,7 @@ var WebGLRenderer = new Class({ }; - // Load supported extensions + // Load supported extensions var exts = gl.getSupportedExtensions(); if (!config.maxTextures || config.maxTextures === -1) @@ -125721,6 +131571,11 @@ var WebGLRenderer = new Class({ config.maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); } + if (!config.maxTextureSize) + { + config.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); + } + var extString = 'WEBGL_compressed_texture_'; var wkExtString = 'WEBKIT_' + extString; @@ -125730,6 +131585,14 @@ var WebGLRenderer = new Class({ this.supportedExtensions = exts; + var angleString = 'ANGLE_instanced_arrays'; + + this.instancedArraysExtension = (exts.indexOf(angleString) > -1) ? gl.getExtension(angleString) : null; + + var vaoString = 'OES_vertex_array_object'; + + this.vaoExtension = (exts.indexOf(vaoString) > -1) ? gl.getExtension(vaoString) : null; + // Setup initial WebGL state gl.disable(gl.DEPTH_TEST); gl.disable(gl.CULL_FACE); @@ -125770,7 +131633,7 @@ var WebGLRenderer = new Class({ gl.bindTexture(gl.TEXTURE_2D, tempTexture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 255, 255, 255, 255 ])); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 0, 0, 255, 255 ])); tempTextures[index] = tempTexture; @@ -125803,16 +131666,23 @@ var WebGLRenderer = new Class({ boot: function () { var game = this.game; + var pipelineManager = this.pipelines; - this.pipelines.boot(); + var baseSize = game.scale.baseSize; - var multi = this.pipelines.get(PIPELINE_CONST.MULTI_PIPELINE); + this.width = baseSize.width; + this.height = baseSize.height; - var blank = game.textures.getFrame('__DEFAULT'); + this.isBooted = true; - multi.currentFrame = blank; + // Set-up pipelines - this.blankTexture = blank; + pipelineManager.boot(game.config.pipeline); + + // Set-up default textures, fbo and scissor + + this.blankTexture = game.textures.getFrame('__DEFAULT'); + this.whiteTexture = game.textures.getFrame('__WHITE'); var gl = this.gl; @@ -125822,9 +131692,7 @@ var WebGLRenderer = new Class({ game.scale.on(ScaleEvents.RESIZE, this.onResize, this); - var baseSize = game.scale.baseSize; - - this.resize(baseSize.width, baseSize.height, game.scale.resolution); + this.resize(baseSize.width, baseSize.height); }, /** @@ -125834,16 +131702,14 @@ var WebGLRenderer = new Class({ * @since 3.16.0 * * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. - * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. - * @param {Phaser.Structs.Size} displaySize - The display Size object. The size of the canvas style width / height attributes. - * @param {number} [resolution] - The Scale Manager resolution setting. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions. The canvas width / height values match this. */ - onResize: function (gameSize, baseSize, displaySize, resolution) + onResize: function (gameSize, baseSize) { // Has the underlying canvas size changed? - if (baseSize.width !== this.width || baseSize.height !== this.height || resolution !== this.resolution) + if (baseSize.width !== this.width || baseSize.height !== this.height) { - this.resize(baseSize.width, baseSize.height, resolution); + this.resize(baseSize.width, baseSize.height); } }, @@ -125851,32 +131717,34 @@ var WebGLRenderer = new Class({ * Resizes the drawing buffer to match that required by the Scale Manager. * * @method Phaser.Renderer.WebGL.WebGLRenderer#resize + * @fires Phaser.Renderer.WebGL.Events#RESIZE * @since 3.0.0 * * @param {number} [width] - The new width of the renderer. * @param {number} [height] - The new height of the renderer. - * @param {number} [resolution] - The new resolution of the renderer. * * @return {this} This WebGLRenderer instance. */ - resize: function (width, height, resolution) + resize: function (width, height) { var gl = this.gl; this.width = width; this.height = height; - this.resolution = resolution; gl.viewport(0, 0, width, height); - this.pipelines.resize(width, height, resolution); - this.drawingBufferHeight = gl.drawingBufferHeight; gl.scissor(0, (gl.drawingBufferHeight - height), width, height); this.defaultCamera.setSize(width, height); + this.defaultScissor[2] = width; + this.defaultScissor[3] = height; + + this.emit(Events.RESIZE, width, height); + return this; }, @@ -125934,13 +131802,13 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor * @since 3.0.0 * - * @param {integer} x - The x position of the scissor. - * @param {integer} y - The y position of the scissor. - * @param {integer} width - The width of the scissor. - * @param {integer} height - The height of the scissor. - * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. + * @param {number} x - The x position of the scissor. + * @param {number} y - The y position of the scissor. + * @param {number} width - The width of the scissor. + * @param {number} height - The height of the scissor. + * @param {number} [drawingBufferHeight] - Optional drawingBufferHeight override value. * - * @return {integer[]} An array containing the scissor values. + * @return {number[]} An array containing the scissor values. */ pushScissor: function (x, y, width, height, drawingBufferHeight) { @@ -125965,11 +131833,11 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor * @since 3.0.0 * - * @param {integer} x - The x position of the scissor. - * @param {integer} y - The y position of the scissor. - * @param {integer} width - The width of the scissor. - * @param {integer} height - The height of the scissor. - * @param {integer} [drawingBufferHeight] - Optional drawingBufferHeight override value. + * @param {number} x - The x position of the scissor. + * @param {number} y - The y position of the scissor. + * @param {number} width - The width of the scissor. + * @param {number} height - The height of the scissor. + * @param {number} [drawingBufferHeight] - Optional drawingBufferHeight override value. */ setScissor: function (x, y, width, height, drawingBufferHeight) { @@ -126049,7 +131917,7 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode * @since 3.0.0 * - * @param {integer} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. + * @param {number} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. * @param {boolean} [force=false] - Force the blend mode to be set, regardless of the currently set blend mode. * * @return {boolean} `true` if the blend mode was changed as a result of this call, forcing a flush, otherwise `false`. @@ -126096,7 +131964,7 @@ var WebGLRenderer = new Class({ * @param {GLenum[]} func - An array containing the WebGL functions to use for the source and the destination blending factors, respectively. See the possible constants for {@link WebGLRenderingContext#blendFunc()}. * @param {GLenum} equation - The equation to use for combining the RGB and alpha components of a new pixel with a rendered one. See the possible constants for {@link WebGLRenderingContext#blendEquation()}. * - * @return {integer} The index of the new blend mode, used for referencing it in the future. + * @return {number} The index of the new blend mode, used for referencing it in the future. */ addBlendMode: function (func, equation) { @@ -126111,7 +131979,7 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#updateBlendMode * @since 3.0.0 * - * @param {integer} index - The index of the custom blend mode. + * @param {number} index - The index of the custom blend mode. * @param {function} func - The function to use for the blend mode. * @param {function} equation - The equation to use for the blend mode. * @@ -126139,7 +132007,7 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#removeBlendMode * @since 3.0.0 * - * @param {integer} index - The index of the custom blend mode to be removed. + * @param {number} index - The index of the custom blend mode to be removed. * * @return {this} This WebGLRenderer instance. */ @@ -126179,7 +132047,7 @@ var WebGLRenderer = new Class({ */ setTextureSource: function (textureSource) { - if (this.pipelines.current.forceZero) + if (this.pipelines.forceZero()) { this.setTextureZero(textureSource.glTexture, true); @@ -126372,16 +132240,22 @@ var WebGLRenderer = new Class({ var gl = this.gl; var temp = this.tempTextures; - var total = (all) ? temp.length : 2; - - for (var i = 0; i < total; i++) - { - gl.activeTexture(gl.TEXTURE0 + i); - gl.bindTexture(gl.TEXTURE_2D, temp[i]); - } - if (all) { + for (var i = 0; i < temp.length; i++) + { + gl.activeTexture(gl.TEXTURE0 + i); + gl.bindTexture(gl.TEXTURE_2D, temp[i]); + } + + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_2D, temp[1]); + } + else + { + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, temp[0]); + gl.activeTexture(gl.TEXTURE1); gl.bindTexture(gl.TEXTURE_2D, temp[1]); } @@ -126409,7 +132283,7 @@ var WebGLRenderer = new Class({ */ setTexture2D: function (texture) { - if (this.pipelines.current.forceZero) + if (this.pipelines.forceZero()) { this.setTextureZero(texture, true); @@ -126456,117 +132330,228 @@ var WebGLRenderer = new Class({ }, /** - * Binds a framebuffer. If there was another framebuffer already bound it will force a pipeline flush. + * Pushes a new framebuffer onto the FBO stack and makes it the currently bound framebuffer. + * + * If there was another framebuffer already bound it will force a pipeline flush. + * + * Call `popFramebuffer` to remove it again. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#pushFramebuffer + * @since 3.50.0 + * + * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. + * @param {boolean} [updateScissor=false] - Set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [resetTextures=false] - Should the WebGL Textures be reset after the new framebuffer is bound? + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? + * + * @return {this} This WebGLRenderer instance. + */ + pushFramebuffer: function (framebuffer, updateScissor, resetTextures, setViewport) + { + if (framebuffer === this.currentFramebuffer) + { + return this; + } + + this.fboStack.push(framebuffer); + + return this.setFramebuffer(framebuffer, updateScissor, resetTextures, setViewport); + }, + + /** + * Sets the given framebuffer as the active and currently bound framebuffer. + * + * If there was another framebuffer already bound it will force a pipeline flush. + * + * Typically, you should call `pushFramebuffer` instead of this method. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer * @since 3.0.0 * * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [resetTextures=false] - Should the WebGL Textures be reset after the new framebuffer is bound? + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? * * @return {this} This WebGLRenderer instance. */ - setFramebuffer: function (framebuffer, updateScissor) + setFramebuffer: function (framebuffer, updateScissor, resetTextures, setViewport) { if (updateScissor === undefined) { updateScissor = false; } + if (resetTextures === undefined) { resetTextures = false; } + if (setViewport === undefined) { setViewport = true; } + + if (framebuffer === this.currentFramebuffer) + { + return this; + } var gl = this.gl; var width = this.width; var height = this.height; - if (framebuffer !== this.currentFramebuffer) + if (framebuffer && framebuffer.renderTexture && setViewport) { - if (framebuffer && framebuffer.renderTexture) + width = framebuffer.renderTexture.width; + height = framebuffer.renderTexture.height; + } + else + { + this.flush(); + } + + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + + if (setViewport) + { + gl.viewport(0, 0, width, height); + } + + if (updateScissor) + { + if (framebuffer) { - width = framebuffer.renderTexture.width; - height = framebuffer.renderTexture.height; + this.drawingBufferHeight = height; + + this.pushScissor(0, 0, width, height); } else { - this.flush(); + this.drawingBufferHeight = this.height; + + this.popScissor(); } + } - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + this.currentFramebuffer = framebuffer; - gl.viewport(0, 0, width, height); - - if (updateScissor) - { - if (framebuffer) - { - this.drawingBufferHeight = height; - - this.pushScissor(0, 0, width, height); - } - else - { - this.drawingBufferHeight = this.height; - - this.popScissor(); - } - } - - this.currentFramebuffer = framebuffer; + if (resetTextures) + { + this.resetTextures(); } return this; }, /** - * Binds a program. If there was another program already bound it will force a pipeline flush. + * Pops the previous framebuffer from the fbo stack and sets it. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#popFramebuffer + * @since 3.50.0 + * + * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [resetTextures=false] - Should the WebGL Textures be reset after the new framebuffer is bound? + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? + * + * @return {WebGLFramebuffer} The Framebuffer that was set, or `null` if there aren't any more in the stack. + */ + popFramebuffer: function (updateScissor, resetTextures, setViewport) + { + if (updateScissor === undefined) { updateScissor = false; } + if (resetTextures === undefined) { resetTextures = false; } + if (setViewport === undefined) { setViewport = true; } + + var fboStack = this.fboStack; + + // Remove the current fbo + fboStack.pop(); + + // Reset the previous framebuffer + var framebuffer = fboStack[fboStack.length - 1]; + + if (!framebuffer) + { + framebuffer = null; + } + + this.setFramebuffer(framebuffer, updateScissor, resetTextures, setViewport); + + return framebuffer; + }, + + /** + * Binds a shader program. + * + * If there was a different program already bound it will force a pipeline flush first. + * + * If the same program given to this method is already set as the current program, no change + * will take place and this method will return `false`. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram * @since 3.0.0 * * @param {WebGLProgram} program - The program that needs to be bound. * - * @return {this} This WebGLRenderer instance. + * @return {boolean} `true` if the given program was bound, otherwise `false`. */ setProgram: function (program) { - var gl = this.gl; - if (program !== this.currentProgram) { this.flush(); - gl.useProgram(program); + this.gl.useProgram(program); this.currentProgram = program; + + return true; } + return false; + }, + + /** + * Rebinds whatever program `WebGLRenderer.currentProgram` is set as, without + * changing anything, or flushing. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#resetProgram + * @since 3.50.0 + * + * @return {this} This WebGLRenderer instance. + */ + resetProgram: function () + { + this.gl.useProgram(this.currentProgram); + return this; }, /** - * Bounds a vertex buffer. If there is a vertex buffer already bound it'll force a pipeline flush. + * Binds a vertex buffer. + * + * If there was a different vertex buffer already bound it will force a pipeline flush first. + * + * If the same buffer given to this method is already set as the current buffer, no change + * will take place and this method will return `false`. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setVertexBuffer * @since 3.0.0 * * @param {WebGLBuffer} vertexBuffer - The buffer that needs to be bound. * - * @return {this} This WebGLRenderer instance. + * @return {boolean} `true` if the given buffer was bound, otherwise `false`. */ setVertexBuffer: function (vertexBuffer) { - var gl = this.gl; - - if (vertexBuffer !== this.currentVertexBuffer) + if (vertexBuffer && vertexBuffer !== this.currentVertexBuffer) { + var gl = this.gl; + this.flush(); gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); this.currentVertexBuffer = vertexBuffer; + + return true; } - return this; + return false; }, /** - * Bounds a index buffer. If there is a index buffer already bound it'll force a pipeline flush. + * Binds an index buffer. If there is an index buffer already bound it'll force a pipeline flush. * * @method Phaser.Renderer.WebGL.WebGLRenderer#setIndexBuffer * @since 3.0.0 @@ -126579,7 +132564,7 @@ var WebGLRenderer = new Class({ { var gl = this.gl; - if (indexBuffer !== this.currentIndexBuffer) + if (indexBuffer && indexBuffer !== this.currentIndexBuffer) { this.flush(); @@ -126598,9 +132583,9 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {object} source - The source of the texture. - * @param {integer} width - The width of the texture. - * @param {integer} height - The height of the texture. - * @param {integer} scaleMode - The scale mode to be used by the texture. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} scaleMode - The scale mode to be used by the texture. * * @return {?WebGLTexture} The WebGL Texture that was created, or `null` if it couldn't be created. */ @@ -126646,15 +132631,15 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D * @since 3.0.0 * - * @param {integer} mipLevel - Mip level of the texture. - * @param {integer} minFilter - Filtering of the texture. - * @param {integer} magFilter - Filtering of the texture. - * @param {integer} wrapT - Wrapping mode of the texture. - * @param {integer} wrapS - Wrapping mode of the texture. - * @param {integer} format - Which format does the texture use. + * @param {number} mipLevel - Mip level of the texture. + * @param {number} minFilter - Filtering of the texture. + * @param {number} magFilter - Filtering of the texture. + * @param {number} wrapT - Wrapping mode of the texture. + * @param {number} wrapS - Wrapping mode of the texture. + * @param {number} format - Which format does the texture use. * @param {?object} pixels - pixel data. - * @param {integer} width - Width of the texture in pixels. - * @param {integer} height - Height of the texture in pixels. + * @param {number} width - Width of the texture in pixels. + * @param {number} height - Height of the texture in pixels. * @param {boolean} [pma=true] - Does the texture have premultiplied alpha? * @param {boolean} [forceSize=false] - If `true` it will use the width and height passed to this method, regardless of the pixels dimension. * @param {boolean} [flipY=false] - Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. @@ -126716,21 +132701,19 @@ var WebGLRenderer = new Class({ texture.glIndex = 0; texture.glIndexCounter = -1; - this.nativeTextures.push(texture); - return texture; }, /** - * Wrapper for creating WebGLFramebuffer. + * Creates a WebGL Framebuffer object and optionally binds a depth stencil render buffer. * * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer * @since 3.0.0 * - * @param {integer} width - Width in pixels of the framebuffer - * @param {integer} height - Height in pixels of the framebuffer - * @param {WebGLTexture} renderTexture - The color texture to where the color pixels are written - * @param {boolean} addDepthStencilBuffer - Indicates if the current framebuffer support depth and stencil buffers + * @param {number} width - If `addDepthStencilBuffer` is true, this controls the width of the depth stencil. + * @param {number} height - If `addDepthStencilBuffer` is true, this controls the height of the depth stencil. + * @param {WebGLTexture} renderTexture - The color texture where the color pixels are written. + * @param {boolean} [addDepthStencilBuffer=false] - Create a Renderbuffer for the depth stencil? * * @return {WebGLFramebuffer} Raw WebGLFramebuffer */ @@ -126745,6 +132728,7 @@ var WebGLRenderer = new Class({ if (addDepthStencilBuffer) { var depthStencilBuffer = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer); gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer); @@ -126766,28 +132750,30 @@ var WebGLRenderer = new Class({ 36061: 'Framebuffer Unsupported' }; - throw new Error('Framebuffer incomplete. Framebuffer status: ' + errors[complete]); + throw new Error('Framebuffer status: ' + errors[complete]); } framebuffer.renderTexture = renderTexture; this.setFramebuffer(null); - this.resetTextures(true); + this.resetTextures(); return framebuffer; }, /** - * Wrapper for creating a WebGLProgram + * Creates a WebGLProgram instance based on the given vertex and fragment shader source. + * + * Then compiles, attaches and links the program before returning it. * * @method Phaser.Renderer.WebGL.WebGLRenderer#createProgram * @since 3.0.0 * - * @param {string} vertexShader - Source to the vertex shader - * @param {string} fragmentShader - Source to the fragment shader + * @param {string} vertexShader - The vertex shader source code as a single string. + * @param {string} fragmentShader - The fragment shader source code as a single string. * - * @return {WebGLProgram} Raw WebGLProgram + * @return {WebGLProgram} The linked WebGLProgram created from the given shader source. */ createProgram: function (vertexShader, fragmentShader) { @@ -126803,11 +132789,12 @@ var WebGLRenderer = new Class({ if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) { - throw new Error('Failed to compile Vertex Shader:\n' + gl.getShaderInfoLog(vs)); + throw new Error('Vertex Shader failed:\n' + gl.getShaderInfoLog(vs)); } + if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) { - throw new Error('Failed to compile Fragment Shader:\n' + gl.getShaderInfoLog(fs)); + throw new Error('Fragment Shader failed:\n' + gl.getShaderInfoLog(fs)); } gl.attachShader(program, vs); @@ -126816,9 +132803,11 @@ var WebGLRenderer = new Class({ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { - throw new Error('Failed to link program:\n' + gl.getProgramInfoLog(program)); + throw new Error('Link Program failed:\n' + gl.getProgramInfoLog(program)); } + gl.useProgram(program); + return program; }, @@ -126829,7 +132818,7 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {ArrayBuffer} initialDataOrSize - It's either ArrayBuffer or an integer indicating the size of the vbo - * @param {integer} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW + * @param {number} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW * * @return {WebGLBuffer} Raw vertex buffer */ @@ -126838,11 +132827,9 @@ var WebGLRenderer = new Class({ var gl = this.gl; var vertexBuffer = gl.createBuffer(); - this.setVertexBuffer(vertexBuffer); - + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); - - this.setVertexBuffer(null); + gl.bindBuffer(gl.ARRAY_BUFFER, null); return vertexBuffer; }, @@ -126854,7 +132841,7 @@ var WebGLRenderer = new Class({ * @since 3.0.0 * * @param {ArrayBuffer} initialDataOrSize - Either ArrayBuffer or an integer indicating the size of the vbo. - * @param {integer} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW. + * @param {number} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW. * * @return {WebGLBuffer} Raw index buffer */ @@ -126863,37 +132850,36 @@ var WebGLRenderer = new Class({ var gl = this.gl; var indexBuffer = gl.createBuffer(); - this.setIndexBuffer(indexBuffer); - + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, initialDataOrSize, bufferUsage); - - this.setIndexBuffer(null); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); return indexBuffer; }, /** - * Removes the given texture from the nativeTextures array and then deletes it from the GPU. + * Calls `GL.deleteTexture` on the given WebGLTexture and also optionally + * resets the currently defined textures. * * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture * @since 3.0.0 * * @param {WebGLTexture} texture - The WebGL Texture to be deleted. + * @param {boolean} [reset=false] - Call the `resetTextures` method after deleting this texture? * * @return {this} This WebGLRenderer instance. */ - deleteTexture: function (texture) + deleteTexture: function (texture, reset) { - var index = this.nativeTextures.indexOf(texture); - - if (index !== -1) + if (texture) { - SpliceOne(this.nativeTextures, index); + this.gl.deleteTexture(texture); } - this.gl.deleteTexture(texture); - - this.resetTextures(); + if (reset) + { + this.resetTextures(); + } return this; }, @@ -126910,7 +132896,17 @@ var WebGLRenderer = new Class({ */ deleteFramebuffer: function (framebuffer) { - this.gl.deleteFramebuffer(framebuffer); + if (framebuffer) + { + this.gl.deleteFramebuffer(framebuffer); + + ArrayRemove(this.fboStack, framebuffer); + + if (this.currentFramebuffer === framebuffer) + { + this.currentFramebuffer = null; + } + } return this; }, @@ -126927,7 +132923,10 @@ var WebGLRenderer = new Class({ */ deleteProgram: function (program) { - this.gl.deleteProgram(program); + if (program) + { + this.gl.deleteProgram(program); + } return this; }, @@ -126960,70 +132959,36 @@ var WebGLRenderer = new Class({ */ preRenderCamera: function (camera) { - var cx = camera._cx; - var cy = camera._cy; - var cw = camera._cw; - var ch = camera._ch; + var cx = camera.x; + var cy = camera.y; + var cw = camera.width; + var ch = camera.height; var color = camera.backgroundColor; - var MultiPipeline = this.pipelines.MULTI_PIPELINE; + camera.emit(CameraEvents.PRE_RENDER, camera); - if (camera.renderToTexture) + this.pipelines.preBatchCamera(camera); + + this.pushScissor(cx, cy, cw, ch); + + if (camera.mask) { - this.flush(); + this.currentCameraMask.mask = camera.mask; + this.currentCameraMask.camera = camera._maskCamera; - this.pushScissor(cx, cy, cw, -ch); - - this.setFramebuffer(camera.framebuffer); - - var gl = this.gl; - - gl.clearColor(0, 0, 0, 0); - - gl.clear(gl.COLOR_BUFFER_BIT); - - ProjectOrtho(MultiPipeline, cx, cw + cx, cy, ch + cy, -1000, 1000); - - if (camera.mask) - { - this.currentCameraMask.mask = camera.mask; - this.currentCameraMask.camera = camera._maskCamera; - - camera.mask.preRenderWebGL(this, camera, camera._maskCamera); - } - - if (color.alphaGL > 0) - { - MultiPipeline.drawFillRect( - cx, cy, cw + cx, ch + cy, - Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1), - color.alphaGL - ); - } - - camera.emit(CameraEvents.PRE_RENDER, camera); + camera.mask.preRenderWebGL(this, camera, camera._maskCamera); } - else + + if (color.alphaGL > 0) { - this.pushScissor(cx, cy, cw, ch); + var pipeline = this.pipelines.setMulti(); - if (camera.mask) - { - this.currentCameraMask.mask = camera.mask; - this.currentCameraMask.camera = camera._maskCamera; - - camera.mask.preRenderWebGL(this, camera, camera._maskCamera); - } - - if (color.alphaGL > 0) - { - MultiPipeline.drawFillRect( - cx, cy, cw , ch, - Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1), - color.alphaGL - ); - } + pipeline.drawFillRect( + cx, cy, cw, ch, + Utils.getTintFromFloats(color.blueGL, color.greenGL, color.redGL, 1), + color.alphaGL + ); } }, @@ -127054,7 +133019,8 @@ var WebGLRenderer = new Class({ /** * Controls the post-render operations for the given camera. - * Renders the foreground camera effects like flash and fading. It resets the current scissor state. + * + * Renders the foreground camera effects like flash and fading, then resets the current scissor state. * * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera * @since 3.0.0 @@ -127063,70 +133029,35 @@ var WebGLRenderer = new Class({ */ postRenderCamera: function (camera) { - var multiPipeline = this.pipelines.setMulti(); + if (camera.flashEffect.isRunning || camera.fadeEffect.isRunning) + { + var pipeline = this.pipelines.setMulti(); - camera.flashEffect.postRenderWebGL(multiPipeline, Utils.getTintFromFloats); - camera.fadeEffect.postRenderWebGL(multiPipeline, Utils.getTintFromFloats); + camera.flashEffect.postRenderWebGL(pipeline, Utils.getTintFromFloats); + camera.fadeEffect.postRenderWebGL(pipeline, Utils.getTintFromFloats); + } camera.dirty = false; this.popScissor(); - if (camera.renderToTexture) - { - multiPipeline.flush(); - - this.setFramebuffer(null); - - camera.emit(CameraEvents.POST_RENDER, camera); - - if (camera.renderToGame) - { - ProjectOrtho(multiPipeline, 0, multiPipeline.width, multiPipeline.height, 0, -1000.0, 1000.0); - - var getTint = Utils.getTintAppendFloatAlpha; - - var pipeline = (camera.pipeline) ? camera.pipeline : multiPipeline; - - pipeline.batchTexture( - camera, - camera.glTexture, - camera.width, camera.height, - camera.x, camera.y, - camera.width, camera.height, - 1, 1, - 0, - camera.flipX, !camera.flipY, - 1, 1, - 0, 0, - 0, 0, camera.width, camera.height, - getTint(camera._tintTL, camera._alphaTL), - getTint(camera._tintTR, camera._alphaTR), - getTint(camera._tintBL, camera._alphaBL), - getTint(camera._tintBR, camera._alphaBR), - (camera._isTinted && camera.tintFill), - 0, 0, - this.defaultCamera, - null - ); - } - - // Force clear the current texture so that items next in the batch (like Graphics) don't try and use it - this.setBlankTexture(true); - } - if (camera.mask) { this.currentCameraMask.mask = null; camera.mask.postRenderWebGL(this, camera._maskCamera); } + + this.pipelines.postBatchCamera(camera); + + camera.emit(CameraEvents.POST_RENDER, camera); }, /** * Clears the current vertex buffer and updates pipelines. * * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender + * @fires Phaser.Renderer.WebGL.Events#PRE_RENDER * @since 3.0.0 */ preRender: function () @@ -127149,13 +133080,10 @@ var WebGLRenderer = new Class({ gl.enable(gl.SCISSOR_TEST); - this.pipelines.preRender(); + this.currentScissor = this.defaultScissor; - // TODO - Find a way to stop needing to create these arrays every frame - // and equally not need a huge array buffer created to hold them - - this.currentScissor = [ 0, 0, this.width, this.height ]; - this.scissorStack = [ this.currentScissor ]; + this.scissorStack.length = 0; + this.scissorStack.push(this.currentScissor); if (this.game.scene.customViewports) { @@ -127168,13 +133096,13 @@ var WebGLRenderer = new Class({ this.textureFlush = 0; - this.pipelines.setMulti(); + this.emit(Events.PRE_RENDER); }, /** * The core render step for a Scene Camera. * - * Iterates through the given Game Object's array and renders them with the given Camera. + * Iterates through the given array of Game Objects and renders them with the given Camera. * * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked * by the Scene Systems.render method. @@ -127182,21 +133110,20 @@ var WebGLRenderer = new Class({ * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. * * @method Phaser.Renderer.WebGL.WebGLRenderer#render + * @fires Phaser.Renderer.WebGL.Events#RENDER * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene to render. - * @param {Phaser.GameObjects.GameObject} children - The Game Object's within the Scene to be rendered. - * @param {number} interpolationPercentage - The interpolation percentage to apply. Currently un-used. + * @param {Phaser.GameObjects.GameObject[]} children - An array of filtered Game Objects that can be rendered by the given Camera. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. */ - render: function (scene, children, interpolationPercentage, camera) + render: function (scene, children, camera) { if (this.contextLost) { return; } - var list = children.list; - var childCount = list.length; + var childCount = children.length; - this.pipelines.render(scene, camera); + this.emit(Events.RENDER, scene, camera); // Apply scissor for cam region + render background color, if not transparent this.preRenderCamera(camera); @@ -127221,17 +133148,7 @@ var WebGLRenderer = new Class({ { this.finalType = (i === childCount - 1); - var child = list[i]; - - if (!child.willRender(camera)) - { - continue; - } - - if (child.blendMode !== this.currentBlendMode) - { - this.setBlendMode(child.blendMode); - } + var child = children[i]; var mask = child.mask; @@ -127248,6 +133165,11 @@ var WebGLRenderer = new Class({ mask.preRenderWebGL(this, child, camera); } + if (child.blendMode !== this.currentBlendMode) + { + this.setBlendMode(child.blendMode); + } + var type = child.type; if (type !== this.currentType) @@ -127256,9 +133178,16 @@ var WebGLRenderer = new Class({ this.currentType = type; } - this.nextTypeMatch = (i < childCount - 1) ? (list[i + 1].type === this.currentType) : false; + if (!this.finalType) + { + this.nextTypeMatch = (children[i + 1].type === this.currentType); + } + else + { + this.nextTypeMatch = false; + } - child.renderWebGL(this, child, interpolationPercentage, camera); + child.renderWebGL(this, child, camera); this.newType = false; } @@ -127281,6 +133210,7 @@ var WebGLRenderer = new Class({ * The post-render step happens after all Cameras in all Scenes have been rendered. * * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender + * @fires Phaser.Renderer.WebGL.Events#POST_RENDER * @since 3.0.0 */ postRender: function () @@ -127289,7 +133219,7 @@ var WebGLRenderer = new Class({ this.flush(); - // Unbind custom framebuffer here + this.emit(Events.POST_RENDER); var state = this.snapshotState; @@ -127300,8 +133230,6 @@ var WebGLRenderer = new Class({ state.callback = null; } - this.pipelines.postRender(); - if (this.textureFlush > 0) { this.startActiveTexture++; @@ -127352,10 +133280,10 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotArea * @since 3.16.0 * - * @param {integer} x - The x coordinate to grab from. - * @param {integer} y - The y coordinate to grab from. - * @param {integer} width - The width of the area to grab. - * @param {integer} height - The height of the area to grab. + * @param {number} x - The x coordinate to grab from. + * @param {number} y - The y coordinate to grab from. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. @@ -127393,8 +133321,8 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotPixel * @since 3.16.0 * - * @param {integer} x - The x coordinate of the pixel to get. - * @param {integer} y - The y coordinate of the pixel to get. + * @param {number} x - The x coordinate of the pixel to get. + * @param {number} y - The y coordinate of the pixel to get. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. * * @return {this} This WebGL Renderer. @@ -127422,14 +133350,14 @@ var WebGLRenderer = new Class({ * @since 3.19.0 * * @param {WebGLFramebuffer} framebuffer - The framebuffer to grab from. - * @param {integer} bufferWidth - The width of the framebuffer. - * @param {integer} bufferHeight - The height of the framebuffer. + * @param {number} bufferWidth - The width of the framebuffer. + * @param {number} bufferHeight - The height of the framebuffer. * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. * @param {boolean} [getPixel=false] - Grab a single pixel as a Color object, or an area as an Image object? - * @param {integer} [x=0] - The x coordinate to grab from. - * @param {integer} [y=0] - The y coordinate to grab from. - * @param {integer} [width=bufferWidth] - The width of the area to grab. - * @param {integer} [height=bufferHeight] - The height of the area to grab. + * @param {number} [x=0] - The x coordinate to grab from. + * @param {number} [y=0] - The y coordinate to grab from. + * @param {number} [width=bufferWidth] - The width of the area to grab. + * @param {number} [height=bufferHeight] - The height of the area to grab. * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. * @@ -127674,8 +133602,8 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter * @since 3.0.0 * - * @param {integer} texture - The texture to set the filter for. - * @param {integer} filter - The filter to set. 0 for linear filtering, 1 for nearest neighbor (blocky) filtering. + * @param {number} texture - The texture to set the filter for. + * @param {number} filter - The filter to set. 0 for linear filtering, 1 for nearest neighbor (blocky) filtering. * * @return {this} This WebGL Renderer instance. */ @@ -127701,403 +133629,6 @@ var WebGLRenderer = new Class({ return this; }, - /** - * Sets a 1f uniform value on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The 1f value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat1: function (program, name, x) - { - this.setProgram(program); - - this.gl.uniform1f(this.gl.getUniformLocation(program, name), x); - - return this; - }, - - /** - * Sets the 2f uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The 2f x value to set on the named uniform. - * @param {number} y - The 2f y value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat2: function (program, name, x, y) - { - this.setProgram(program); - - this.gl.uniform2f(this.gl.getUniformLocation(program, name), x, y); - - return this; - }, - - /** - * Sets the 3f uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The 3f x value to set on the named uniform. - * @param {number} y - The 3f y value to set on the named uniform. - * @param {number} z - The 3f z value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat3: function (program, name, x, y, z) - { - this.setProgram(program); - - this.gl.uniform3f(this.gl.getUniformLocation(program, name), x, y, z); - - return this; - }, - - /** - * Sets the 4f uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {number} x - The 4f x value to set on the named uniform. - * @param {number} y - The 4f y value to set on the named uniform. - * @param {number} z - The 4f z value to set on the named uniform. - * @param {number} w - The 4f w value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat4: function (program, name, x, y, z, w) - { - this.setProgram(program); - - this.gl.uniform4f(this.gl.getUniformLocation(program, name), x, y, z, w); - - return this; - }, - - /** - * Sets the value of a 1fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat1v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat1v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform1fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a 2fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat2v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat2v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform2fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a 3fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat3v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - setFloat3v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform3fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets the value of a 4fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFloat4v - * @since 3.13.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Float32Array} arr - The new value to be used for the uniform variable. - * - * @return {this} This WebGL Renderer instance. - */ - - setFloat4v: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform4fv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets a 1iv uniform value on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1iv - * @since 3.50.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {Int32List} arr - The 1iv value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt1iv: function (program, name, arr) - { - this.setProgram(program); - - this.gl.uniform1iv(this.gl.getUniformLocation(program, name), arr); - - return this; - }, - - /** - * Sets a 1i uniform value on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt1 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The 1i value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt1: function (program, name, x) - { - this.setProgram(program); - - this.gl.uniform1i(this.gl.getUniformLocation(program, name), x); - - return this; - }, - - /** - * Sets the 2i uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The 2i x value to set on the named uniform. - * @param {integer} y - The 2i y value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt2: function (program, name, x, y) - { - this.setProgram(program); - - this.gl.uniform2i(this.gl.getUniformLocation(program, name), x, y); - - return this; - }, - - /** - * Sets the 3i uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The 3i x value to set on the named uniform. - * @param {integer} y - The 3i y value to set on the named uniform. - * @param {integer} z - The 3i z value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt3: function (program, name, x, y, z) - { - this.setProgram(program); - - this.gl.uniform3i(this.gl.getUniformLocation(program, name), x, y, z); - - return this; - }, - - /** - * Sets the 4i uniform values on the given shader. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setInt4 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {integer} x - The 4i x value to set on the named uniform. - * @param {integer} y - The 4i y value to set on the named uniform. - * @param {integer} z - The 4i z value to set on the named uniform. - * @param {integer} w - The 4i w value to set on the named uniform. - * - * @return {this} This WebGL Renderer instance. - */ - setInt4: function (program, name, x, y, z, w) - { - this.setProgram(program); - - this.gl.uniform4i(this.gl.getUniformLocation(program, name), x, y, z, w); - - return this; - }, - - /** - * Sets the value of a matrix 2fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix2 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - The value indicating whether to transpose the matrix. Must be false. - * @param {Float32Array} matrix - A Float32Array or sequence of 4 float values. - * - * @return {this} This WebGL Renderer instance. - */ - setMatrix2: function (program, name, transpose, matrix) - { - this.setProgram(program); - - this.gl.uniformMatrix2fv(this.gl.getUniformLocation(program, name), transpose, matrix); - - return this; - }, - - /** - * Sets the value of a matrix 3fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix3 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - The value indicating whether to transpose the matrix. Must be false. - * @param {Float32Array} matrix - A Float32Array or sequence of 9 float values. - * - * @return {this} This WebGL Renderer instance. - */ - setMatrix3: function (program, name, transpose, matrix) - { - this.setProgram(program); - - this.gl.uniformMatrix3fv(this.gl.getUniformLocation(program, name), transpose, matrix); - - return this; - }, - - /** - * Sets the value of a matrix 4fv uniform variable in the given WebGLProgram. - * - * If the shader is not currently active, it is made active first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setMatrix4 - * @since 3.0.0 - * - * @param {WebGLProgram} program - The target WebGLProgram from which the uniform location will be looked-up. - * @param {string} name - The name of the uniform to look-up and modify. - * @param {boolean} transpose - The value indicating whether to transpose the matrix. Must be false. - * @param {Float32Array} matrix - A Float32Array or sequence of 16 float values. - * - * @return {this} This WebGL Renderer instance. - */ - setMatrix4: function (program, name, transpose, matrix) - { - this.setProgram(program); - - this.gl.uniformMatrix4fv(this.gl.getUniformLocation(program, name), transpose, matrix); - - return this; - }, - - /** - * Returns the maximum number of texture units that can be used in a fragment shader. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextures - * @since 3.8.0 - * - * @return {integer} The maximum number of textures WebGL supports. - */ - getMaxTextures: function () - { - return this.config.maxTextures; - }, - /** * Returns the largest texture size (either width or height) that can be created. * Note that VRAM may not allow a texture of any given size, it just expresses @@ -128106,7 +133637,7 @@ var WebGLRenderer = new Class({ * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextureSize * @since 3.8.0 * - * @return {integer} The maximum supported texture size. + * @return {number} The maximum supported texture size. */ getMaxTextureSize: function () { @@ -128121,46 +133652,34 @@ var WebGLRenderer = new Class({ */ destroy: function () { - // Clear-up anything that should be cleared :) + this.canvas.removeEventListener('webglcontextlost', this.contextLostHandler, false); + this.canvas.removeEventListener('webglcontextrestored', this.contextRestoredHandler, false); - var i; var gl = this.gl; var temp = this.tempTextures; - var native = this.nativeTextures; - for (i = 0; i < temp.length; i++) + for (var i = 0; i < temp.length; i++) { gl.deleteTexture(temp[i]); } - for (i = 0; i < native.length; i++) - { - gl.deleteTexture(native[i]); - } - - this.textureIndexes = []; - this.nativeTextures = []; - this.pipelines.destroy(); - this.defaultCamera.destroy(); + this.removeAllListeners(); + + this.fboStack = []; + this.maskStack = []; + this.extensions = {}; + this.textureIndexes = []; + + this.gl = null; + this.game = null; + this.canvas = null; + this.contextLost = true; this.currentMask = null; this.currentCameraMask = null; - - this.canvas.removeEventListener('webglcontextlost', this.contextLostHandler, false); - this.canvas.removeEventListener('webglcontextrestored', this.contextRestoredHandler, false); - - this.game = null; - this.gl = null; - this.canvas = null; - - this.maskStack = []; - - this.contextLost = true; - - this.extensions = {}; } }); @@ -128169,7 +133688,7 @@ module.exports = WebGLRenderer; /***/ }), -/* 536 */ +/* 572 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -128179,19 +133698,36 @@ module.exports = WebGLRenderer; */ var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(92); -var CONST = __webpack_require__(110); +var CONST = __webpack_require__(82); +var CustomMap = __webpack_require__(98); // Default Phaser 3 Pipelines -var BitmapMaskPipeline = __webpack_require__(537); -var LightPipeline = __webpack_require__(538); -var MultiPipeline = __webpack_require__(112); -var RopePipeline = __webpack_require__(539); -var SinglePipeline = __webpack_require__(540); +var BitmapMaskPipeline = __webpack_require__(573); +var GraphicsPipeline = __webpack_require__(575); +var LightPipeline = __webpack_require__(576); +var MultiPipeline = __webpack_require__(158); +var RopePipeline = __webpack_require__(577); +var SinglePipeline = __webpack_require__(578); +var UtilityPipeline = __webpack_require__(864); /** * @classdesc + * The Pipeline Manager is responsible for the creation, activation, running and destruction + * of WebGL Pipelines in Phaser 3. * + * The `WebGLRenderer` owns a single instance of the Pipeline Manager, which you can access + * via the `WebGLRenderer.pipelines` property. + * + * By default, there are 5 pipelines installed into the Pipeline Manager when Phaser boots: + * + * 1. The Multi Pipeline. Responsible for all multi-texture rendering, i.e. Sprites, Shapes. + * 2. The Single Pipeline. Responsible for rendering Game Objects that explicitly require one bound texture. + * 3. The Rope Pipeline. Responsible for rendering the Rope Game Object. + * 4. The Light Pipeline. Responsible for rendering the Light Game Object. + * 5. The Bitmap Mask Pipeline. Responsible for Bitmap Mask rendering. + * + * You can add your own custom pipeline via the `PipelineManager.add` method. Pipelines are + * identified by unique string-based keys. * * @class PipelineManager * @memberof Phaser.Renderer.WebGL @@ -128224,12 +133760,31 @@ var PipelineManager = new Class({ */ this.renderer = renderer; + /** + * This map stores all pipeline classes available in this manager. + * + * The Utility Class must always come first. + * + * @name Phaser.Renderer.WebGL.PipelineManager#classes + * @type {Phaser.Structs.Map.} + * @since 3.50.0 + */ + this.classes = new CustomMap([ + [ CONST.UTILITY_PIPELINE, UtilityPipeline ], + [ CONST.MULTI_PIPELINE, MultiPipeline ], + [ CONST.BITMAPMASK_PIPELINE, BitmapMaskPipeline ], + [ CONST.SINGLE_PIPELINE, SinglePipeline ], + [ CONST.ROPE_PIPELINE, RopePipeline ], + [ CONST.LIGHT_PIPELINE, LightPipeline ], + [ CONST.GRAPHICS_PIPELINE, GraphicsPipeline ] + ]); + /** * This map stores all pipeline instances in this manager. * * This is populated with the default pipelines in the `boot` method. * - * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines + * @name Phaser.Renderer.WebGL.PipelineManager#pipelines * @type {Phaser.Structs.Map.} * @since 3.50.0 */ @@ -128282,6 +133837,80 @@ var PipelineManager = new Class({ * @since 3.50.0 */ this.BITMAPMASK_PIPELINE = null; + + /** + * A constant-style reference to the Utility Pipeline Instance. + * + * @name Phaser.Renderer.WebGL.PipelineManager#UTILITY_PIPELINE + * @type {Phaser.Renderer.WebGL.Pipelines.UtilityPipeline} + * @default null + * @since 3.50.0 + */ + this.UTILITY_PIPELINE = null; + + /** + * A reference to the Full Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#fullFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.fullFrame1; + + /** + * A reference to the Full Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#fullFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.fullFrame2; + + /** + * A reference to the Half Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#halfFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.halfFrame1; + + /** + * A reference to the Half Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#halfFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.halfFrame2; }, /** @@ -128294,19 +133923,57 @@ var PipelineManager = new Class({ * * @method Phaser.Renderer.WebGL.PipelineManager#boot * @since 3.50.0 + * + * @param {Phaser.Types.Core.PipelineConfig} [pipelineConfig] - The pipeline configuration object as set in the Game Config. */ - boot: function () + boot: function (pipelineConfig) { + // Install each of the default pipelines + + var instance; + var _this = this; var game = this.game; - this.MULTI_PIPELINE = this.add(CONST.MULTI_PIPELINE, new MultiPipeline({ game: game })); - this.BITMAPMASK_PIPELINE = this.add(CONST.BITMAPMASK_PIPELINE, new BitmapMaskPipeline({ game: game })); + this.classes.each(function (name, pipeline) + { + instance = _this.add(name, new pipeline({ game: game })); - this.add(CONST.SINGLE_PIPELINE, new SinglePipeline({ game: game })); - this.add(CONST.ROPE_PIPELINE, new RopePipeline({ game: game })); - this.add(CONST.LIGHT_PIPELINE, new LightPipeline({ game: game })); + if (name === CONST.UTILITY_PIPELINE) + { + _this.UTILITY_PIPELINE = instance; - this.set(this.MULTI_PIPELINE); + // FBO references + _this.fullFrame1 = instance.fullFrame1; + _this.fullFrame2 = instance.fullFrame2; + _this.halfFrame1 = instance.halfFrame1; + _this.halfFrame2 = instance.halfFrame2; + } + }); + + // Our const-like references + this.MULTI_PIPELINE = this.get(CONST.MULTI_PIPELINE); + this.BITMAPMASK_PIPELINE = this.get(CONST.BITMAPMASK_PIPELINE); + + // And now the ones in the config, if any + if (pipelineConfig) + { + for (var pipelineName in pipelineConfig) + { + var pipelineClass = pipelineConfig[pipelineName]; + + if (!this.has(pipelineName)) + { + this.classes.set(pipelineName, pipelineClass); + + instance = new pipelineClass(game); + + if (!instance.isPostFX) + { + this.add(pipelineName, instance); + } + } + } + } }, /** @@ -128314,13 +133981,23 @@ var PipelineManager = new Class({ * * The name of the instance must be unique within this manager. * - * Make sure to pass an instance to this method, not a base class. For example: + * Make sure to pass an instance to this method, not a base class. + * + * For example, you should pass it like this: * * ```javascript - * this.add('yourName', new MultiPipeline());` + * this.add('yourName', new CustomPipeline());` * ``` * - * @method Phaser.Renderer.WebGL.PipelineManager#addPipeline + * and **not** like this: + * + * ```javascript + * this.add('yourName', CustomPipeline);` + * ``` + * + * To add a **Post Pipeline**, see `addPostPipeline` instead. + * + * @method Phaser.Renderer.WebGL.PipelineManager#add * @since 3.50.0 * * @param {string} name - A unique string-based key for the pipeline within the manager. @@ -128330,11 +134007,21 @@ var PipelineManager = new Class({ */ add: function (name, pipeline) { + if (pipeline.isPostFX) + { + console.warn(name + ' is a Post Pipeline. Use `addPostPipeline` instead'); + + return; + } + var pipelines = this.pipelines; var renderer = this.renderer; if (!pipelines.has(name)) { + pipeline.name = name; + pipeline.manager = this; + pipelines.set(name, pipeline); } else @@ -128342,95 +134029,52 @@ var PipelineManager = new Class({ console.warn('Pipeline exists: ' + name); } - pipeline.name = name; - if (!pipeline.hasBooted) { pipeline.boot(); } - pipeline.resize(renderer.width, renderer.height, renderer.config.resolution); + if (renderer.width !== 0 && renderer.height !== 0) + { + pipeline.resize(renderer.width, renderer.height); + } return pipeline; }, /** - * Resizes handler. + * Adds a Post Pipeline to this Pipeline Manager. * - * This is called automatically by the `WebGLRenderer` when the game resizes. + * Make sure to pass a base class to this method, not an instance. * - * @method Phaser.Renderer.WebGL.PipelineManager#resize + * For example, you should pass it like this: + * + * ```javascript + * this.addPostPipeline('yourName', CustomPipeline);` + * ``` + * + * and **not** like this: + * + * ```javascript + * this.addPostPipeline('yourName', new CustomPipeline());` + * ``` + * + * To add a regular pipeline, see the `add` method instead. + * + * @method Phaser.Renderer.WebGL.PipelineManager#addPostPipeline * @since 3.50.0 * - * @param {number} [width] - The new width of the renderer. - * @param {number} [height] - The new height of the renderer. - * @param {number} [resolution] - The new resolution of the renderer. + * @param {string} name - A unique string-based key for the pipeline within the manager. + * @param {function} pipeline - A pipeline class which must extend `PostFXPipeline`. + * + * @return {this} This Pipeline Manager. */ - resize: function (width, height, resolution) + addPostPipeline: function (name, pipeline) { - var pipelines = this.pipelines; - - pipelines.each(function (pipelineName, pipelineInstance) + if (!this.classes.has(name)) { - pipelineInstance.resize(width, height, resolution); - }); - }, - - /** - * Calls the `onPreRender` method on each pipeline in this manager. - * - * This is called automatically by the `WebGLRenderer.preRender` method. - * - * @method Phaser.Renderer.WebGL.PipelineManager#preRender - * @since 3.50.0 - */ - preRender: function () - { - var pipelines = this.pipelines; - - pipelines.each(function (pipelineName, pipelineInstance) - { - pipelineInstance.onPreRender(); - }); - }, - - /** - * Calls the `onRender` method on each pipeline in this manager. - * - * This is called automatically by the `WebGLRenderer.render` method. - * - * @method Phaser.Renderer.WebGL.PipelineManager#render - * @since 3.50.0 - * - * @param {Phaser.Scene} scene - The Scene to render. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. - */ - render: function (scene, camera) - { - var pipelines = this.pipelines; - - pipelines.each(function (pipelineName, pipelineInstance) - { - pipelineInstance.onRender(scene, camera); - }); - }, - - /** - * Calls the `onPostRender` method on each pipeline in this manager. - * - * This is called automatically by the `WebGLRenderer.postRender` method. - * - * @method Phaser.Renderer.WebGL.PipelineManager#postRender - * @since 3.50.0 - */ - postRender: function () - { - var pipelines = this.pipelines; - - pipelines.each(function (pipelineName, pipelineInstance) - { - pipelineInstance.onPostRender(); - }); + this.classes.set(name, pipeline); + } }, /** @@ -128448,39 +134092,109 @@ var PipelineManager = new Class({ }, /** - * Checks if a pipeline is present in the Pipeline Manager. + * Checks if a pipeline is present in this Pipeline Manager. * * @method Phaser.Renderer.WebGL.PipelineManager#has * @since 3.50.0 * - * @param {string} name - The name of the pipeline to check for. + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance to look-up. * * @return {boolean} `true` if the given pipeline is loaded, otherwise `false`. */ - has: function (name) + has: function (pipeline) { - return this.pipelines.has(name); + var pipelines = this.pipelines; + + if (typeof pipeline === 'string') + { + return pipelines.has(pipeline); + } + else if (pipelines.contains(pipeline)) + { + return true; + } + + return false; }, /** - * Returns the pipeline instance based on the given name. + * Returns the pipeline instance based on the given name, or instance. * - * If no instance exists in this manager, it returns `undefined` instead. + * If no instance, or matching name, exists in this manager, it returns `undefined`. * * @method Phaser.Renderer.WebGL.PipelineManager#get * @since 3.50.0 * - * @param {string} name - The name of the pipeline to get. + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance to look-up. * * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance, or `undefined` if not found. */ - get: function (name) + get: function (pipeline) { - return this.pipelines.get(name); + var pipelines = this.pipelines; + + if (typeof pipeline === 'string') + { + return pipelines.get(pipeline); + } + else if (pipelines.contains(pipeline)) + { + return pipeline; + } }, /** - * Removes a pipeline based on the given name. + * Returns a _new instance_ of the post pipeline based on the given name, or class. + * + * If no instance, or matching name, exists in this manager, it returns `undefined`. + * + * @method Phaser.Renderer.WebGL.PipelineManager#getPostPipeline + * @since 3.50.0 + * + * @param {(string|function|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance, or class to look-up. + * @param {Phaser.GameObjects.GameObject} [gameObject] - If this post pipeline is being installed into a Game Object or Camera, this is a reference to it. + * + * @return {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} The pipeline instance, or `undefined` if not found. + */ + getPostPipeline: function (pipeline, gameObject) + { + var pipelineClasses = this.classes; + + var instance; + + if (typeof pipeline === 'string') + { + instance = pipelineClasses.get(pipeline); + } + else if (typeof pipeline === 'function') + { + // A class + if (pipelineClasses.contains(pipeline)) + { + instance = pipeline; + } + } + else if (typeof pipeline === 'object') + { + // Instance + instance = pipelineClasses.get(pipeline.name); + } + + if (instance) + { + var newPipeline = new instance(this.game); + + if (gameObject) + { + newPipeline.gameObject = gameObject; + } + + return newPipeline; + } + }, + + /** + * Removes a pipeline instance based on the given name. * * If no pipeline matches the name, this method does nothing. * @@ -128491,10 +134205,18 @@ var PipelineManager = new Class({ * @since 3.50.0 * * @param {string} name - The name of the pipeline to be removed. + * @param {boolean} [removeClass=true] - Remove the class as well as the instance? */ - remove: function (name) + remove: function (name, removeClass) { + if (removeClass === undefined) { removeClass = true; } + this.pipelines.delete(name); + + if (removeClass) + { + this.classes.delete(name); + } }, /** @@ -128502,33 +134224,39 @@ var PipelineManager = new Class({ * * This method accepts a pipeline instance as its parameter, not the name. * - * If the pipeline isn't already the current one, it will also call `resetTextures` on - * the `WebGLRenderer`. After this, `WebGLPipeline.bind` and then `onBind` are called. + * If the pipeline isn't already the current one it will call `WebGLPipeline.bind` and then `onBind`. + * + * You cannot set Post FX Pipelines using this method. To use a Post FX Pipeline, you should + * apply it to either a Camera, Container or other supporting Game Object. * * @method Phaser.Renderer.WebGL.PipelineManager#set * @since 3.50.0 * * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline instance to be set as current. * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline that was set. + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline that was set, or undefined if it couldn't be set. */ - set: function (pipeline, gameObject) + set: function (pipeline, gameObject, currentShader) { - var renderer = this.renderer; - var current = this.current; - - if ( - current !== pipeline || - current.vertexBuffer !== renderer.currentVertexBuffer || - current.program !== renderer.currentProgram - ) + if (pipeline.isPostFX) { - renderer.resetTextures(); + return; + } + + if (!this.isCurrent(pipeline, currentShader)) + { + this.flush(); + + if (this.current) + { + this.current.unbind(); + } this.current = pipeline; - pipeline.bind(); + pipeline.bind(currentShader); } pipeline.onBind(gameObject); @@ -128536,6 +134264,307 @@ var PipelineManager = new Class({ return pipeline; }, + /** + * This method is called by the `WebGLPipeline.batchQuad` method, right before a quad + * belonging to a Game Object is about to be added to the batch. It causes a batch + * flush, then calls the `preBatch` method on the post-fx pipelines belonging to the + * Game Object. + * + * @method Phaser.Renderer.WebGL.PipelineManager#preBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object about to be batched. + */ + preBatch: function (gameObject) + { + if (gameObject.hasPostPipeline) + { + this.flush(); + + var pipelines = gameObject.postPipelines; + + // Iterate in reverse because we need them stacked in the order they're in the array + for (var i = pipelines.length - 1; i >= 0; i--) + { + pipelines[i].preBatch(gameObject); + } + } + }, + + /** + * This method is called by the `WebGLPipeline.batchQuad` method, right after a quad + * belonging to a Game Object has been added to the batch. It causes a batch + * flush, then calls the `postBatch` method on the post-fx pipelines belonging to the + * Game Object. + * + * @method Phaser.Renderer.WebGL.PipelineManager#postBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just added to the batch. + */ + postBatch: function (gameObject) + { + if (gameObject.hasPostPipeline) + { + this.flush(); + + var pipelines = gameObject.postPipelines; + + for (var i = 0; i < pipelines.length; i++) + { + pipelines[i].postBatch(gameObject); + } + } + }, + + /** + * Called at the start of the `WebGLRenderer.preRenderCamera` method. + * + * If the Camera has post pipelines set, it will flush the batch and then call the + * `preBatch` method on the post-fx pipelines belonging to the Camera. + * + * @method Phaser.Renderer.WebGL.PipelineManager#preBatchCamera + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera about to be rendered. + */ + preBatchCamera: function (camera) + { + if (camera.hasPostPipeline) + { + this.flush(); + + var pipelines = camera.postPipelines; + + // Iterate in reverse because we need them stacked in the order they're in the array + for (var i = pipelines.length - 1; i >= 0; i--) + { + pipelines[i].preBatch(camera); + } + } + }, + + /** + * Called at the end of the `WebGLRenderer.postRenderCamera` method. + * + * If the Camera has post pipelines set, it will flush the batch and then call the + * `postBatch` method on the post-fx pipelines belonging to the Camera. + * + * @method Phaser.Renderer.WebGL.PipelineManager#postBatchCamera + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that was just rendered. + */ + postBatchCamera: function (camera) + { + if (camera.hasPostPipeline) + { + this.flush(); + + var pipelines = camera.postPipelines; + + for (var i = 0; i < pipelines.length; i++) + { + pipelines[i].postBatch(camera); + } + } + }, + + /** + * Checks to see if the given pipeline is already the active pipeline, both within this + * Pipeline Manager, and also has the same vertex buffer and shader set within the Renderer. + * + * @method Phaser.Renderer.WebGL.PipelineManager#isCurrent + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline instance to be checked. + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * + * @return {boolean} `true` if the given pipeline is already the current pipeline, otherwise `false`. + */ + isCurrent: function (pipeline, currentShader) + { + var renderer = this.renderer; + var current = this.current; + + if (current && !currentShader) + { + currentShader = current.currentShader; + } + + return !( + current !== pipeline || + current.vertexBuffer !== renderer.currentVertexBuffer || + currentShader.program !== renderer.currentProgram + ); + }, + + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * You can optionally set the brightness factor of the copy. + * + * The difference between this method and `drawFrame` is that this method + * uses a faster copy shader, where only the brightness can be modified. + * If you need color level manipulation, see `drawFrame` instead. + * + * The copy itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#copyFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. + */ + copyFrame: function (source, target, brightness, clear, clearAlpha) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.copyShader); + + pipeline.copyFrame(source, target, brightness, clear, clearAlpha); + + return this; + }, + + /** + * Pops the framebuffer from the renderers FBO stack and sets that as the active target, + * then draws the `source` Render Target to it. It then resets the renderer textures. + * + * This should be done when you need to draw the _final_ results of a pipeline to the game + * canvas, or the next framebuffer in line on the FBO stack. You should only call this once + * in the `onDraw` handler and it should be the final thing called. Be careful not to call + * this if you need to actually use the pipeline shader, instead of the copy shader. In + * those cases, use the `bindAndDraw` method. + * + * @method Phaser.Renderer.WebGL.PipelineManager#copyToGame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + */ + copyToGame: function (source) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.copyShader); + + pipeline.copyToGame(source); + + return this; + }, + + /** + * Copy the `source` Render Target to the `target` Render Target, using the + * given Color Matrix. + * + * The difference between this method and `copyFrame` is that this method + * uses a color matrix shader, where you have full control over the luminance + * values used during the copy. If you don't need this, you can use the faster + * `copyFrame` method instead. + * + * The copy itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#drawFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Display.ColorMatrix} [colorMatrix] - The Color Matrix to use when performing the draw. + * + * @return {this} This Pipeline Manager instance. + */ + drawFrame: function (source, target, clearAlpha, colorMatrix) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.colorMatrixShader); + + pipeline.drawFrame(source, target, clearAlpha, colorMatrix); + + return this; + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using a linear blend effect, which is controlled by the `strength` parameter. + * + * The draw itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#blendFrames + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. + */ + blendFrames: function (source1, source2, target, strength, clearAlpha) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.linearShader); + + pipeline.blendFrames(source1, source2, target, strength, clearAlpha); + + return this; + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using an additive blend effect, which is controlled by the `strength` parameter. + * + * The draw itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#blendFramesAdditive + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. + */ + blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) + { + var pipeline = this.setUtility(this.UTILITY_PIPELINE.addShader); + + pipeline.blendFrames(source1, source2, target, strength, clearAlpha); + + return this; + }, + + /** + * Clears the given Render Target. + * + * @method Phaser.Renderer.WebGL.PipelineManager#clearFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + clearFrame: function (target, clearAlpha) + { + this.UTILITY_PIPELINE.clearFrame(target, clearAlpha); + + return this; + }, + + /** + * Returns `true` if the current pipeline is forced to use texture unit zero. + * + * @method Phaser.Renderer.WebGL.PipelineManager#forceZero + * @since 3.50.0 + * + * @return {boolean} `true` if the current pipeline is forced to use texture unit zero. + */ + forceZero: function () + { + return (this.current && this.current.forceZero); + }, + /** * Sets the Multi Pipeline to be the currently bound pipeline. * @@ -128551,6 +134580,21 @@ var PipelineManager = new Class({ return this.set(this.MULTI_PIPELINE); }, + /** + * Sets the Utility Pipeline to be the currently bound pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#setUtility + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * + * @return {Phaser.Renderer.WebGL.Pipelines.UtilityPipeline} The Utility Pipeline instance. + */ + setUtility: function (currentShader) + { + return this.UTILITY_PIPELINE.bind(currentShader); + }, + /** * Use this to reset the gl context to the state that Phaser requires to continue rendering. * @@ -128608,12 +134652,9 @@ var PipelineManager = new Class({ renderer.setBlendMode(0, true); - renderer.resetTextures(); - this.current = pipeline; - pipeline.bind(true); - pipeline.onBind(); + pipeline.rebind(); }, /** @@ -128654,10 +134695,12 @@ var PipelineManager = new Class({ { this.flush(); + this.classes.clear(); this.pipelines.clear(); this.renderer = null; this.game = null; + this.classes = null; this.pipelines = null; this.current = null; this.previous = null; @@ -128669,7 +134712,7 @@ module.exports = PipelineManager; /***/ }), -/* 537 */ +/* 573 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -128681,9 +134724,10 @@ module.exports = PipelineManager; var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var ShaderSourceFS = __webpack_require__(807); -var ShaderSourceVS = __webpack_require__(808); -var WebGLPipeline = __webpack_require__(111); +var ShaderSourceFS = __webpack_require__(853); +var ShaderSourceVS = __webpack_require__(854); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); /** * @classdesc @@ -128724,50 +134768,38 @@ var BitmapMaskPipeline = new Class({ { config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS), config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS), - config.vertexSize = GetFastValue(config, 'vertexSize', 8), - config.vertexCapacity = GetFastValue(config, 'vertexCapacity', 3), + config.batchSize = GetFastValue(config, 'batchSize', 1), config.vertices = GetFastValue(config, 'vertices', new Float32Array([ -1, 1, -1, -7, 7, 1 ]).buffer), config.attributes = GetFastValue(config, 'attributes', [ { name: 'inPosition', size: 2, - type: config.game.renderer.gl.FLOAT, - normalized: false, - offset: 0, - enabled: false, - location: -1 + type: WEBGL_CONST.FLOAT } ]); + config.uniforms = GetFastValue(config, 'uniforms', [ + 'uResolution', + 'uMainSampler', + 'uMaskSampler', + 'uInvertMaskAlpha' + ]); WebGLPipeline.call(this, config); }, - /** - * Called every time the pipeline is bound by the renderer. - * Sets the shader program, vertex buffer and other resources. - * Should only be called when changing pipeline. - * - * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#bind - * @since 3.50.0 - * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? - * - * @return {this} This WebGLPipeline instance. - */ - bind: function (reset) + boot: function () { - if (reset === undefined) { reset = false; } + WebGLPipeline.prototype.boot.call(this); - WebGLPipeline.prototype.bind.call(this, reset); + this.set1i('uMainSampler', 0); + this.set1i('uMaskSampler', 1); + }, - var renderer = this.renderer; - var program = this.program; + resize: function (width, height) + { + WebGLPipeline.prototype.resize.call(this, width, height); - renderer.setFloat2(program, 'uResolution', this.width, this.height); - renderer.setInt1(program, 'uMainSampler', 0); - renderer.setInt1(program, 'uMaskSampler', 1); - - return this; + this.set2f('uResolution', width, height); }, /** @@ -128783,24 +134815,19 @@ var BitmapMaskPipeline = new Class({ */ beginMask: function (mask, maskedObject, camera) { - var renderer = this.renderer; var gl = this.gl; // The renderable Game Object that is being used for the bitmap mask - var bitmapMask = mask.bitmapMask; - - if (bitmapMask && gl) + if (mask.bitmapMask && gl) { + var renderer = this.renderer; + renderer.flush(); - mask.prevFramebuffer = renderer.currentFramebuffer; - - renderer.setFramebuffer(mask.mainFramebuffer); + renderer.pushFramebuffer(mask.mainFramebuffer); gl.disable(gl.STENCIL_TEST); - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); if (renderer.currentCameraMask.mask !== mask) @@ -128832,21 +134859,25 @@ var BitmapMaskPipeline = new Class({ if (bitmapMask && gl) { + // mask.mainFramebuffer should now contain all the Game Objects we want masked renderer.flush(); - // First we draw the mask to the mask fb - renderer.setFramebuffer(mask.maskFramebuffer); + // Swap to the mask framebuffer (push, in case the bitmapMask GO has a post-pipeline) + renderer.pushFramebuffer(mask.maskFramebuffer); + // Clear it and draw the Game Object that is acting as a mask to it gl.clearColor(0, 0, 0, 0); gl.clear(gl.COLOR_BUFFER_BIT); renderer.setBlendMode(0, true); - bitmapMask.renderWebGL(renderer, bitmapMask, 0, camera); + bitmapMask.renderWebGL(renderer, bitmapMask, camera); renderer.flush(); - renderer.setFramebuffer(mask.prevFramebuffer); + // Clear the mask framebuffer + main framebuffer + renderer.popFramebuffer(); + renderer.popFramebuffer(); // Is there a stencil further up the stack? var prev = renderer.getCurrentStencilMask(); @@ -128862,7 +134893,7 @@ var BitmapMaskPipeline = new Class({ renderer.currentMask.mask = null; } - // Bind bitmap mask pipeline and draw + // Bind this pipeline and draw renderer.pipelines.set(this); gl.activeTexture(gl.TEXTURE1); @@ -128871,10 +134902,12 @@ var BitmapMaskPipeline = new Class({ gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, mask.mainTexture); - gl.uniform1i(gl.getUniformLocation(this.program, 'uInvertMaskAlpha'), mask.invertAlpha); + this.set1i('uInvertMaskAlpha', mask.invertAlpha); // Finally, draw a triangle filling the whole screen gl.drawArrays(this.topology, 0, 3); + + renderer.resetTextures(); } } @@ -128884,7 +134917,1720 @@ module.exports = BitmapMaskPipeline; /***/ }), -/* 538 */ +/* 574 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var GetFastValue = __webpack_require__(2); +var WEBGL_CONST = __webpack_require__(74); + +/** + * @classdesc + * TODO + * + * @class WebGLShader + * @memberof Phaser.Renderer.WebGL + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGLPipeline to which this Shader belongs. + * @param {string} name - The name of this Shader. + * @param {string} vertexShader - The vertex shader source code as a single string. + * @param {string} fragmentShader - The fragment shader source code as a single string. + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributesConfig[]} attributes - An array of attributes. + * @param {string[]} [uniforms] - An array of shader uniform names that will be looked-up to get the locations for. + */ +var WebGLShader = new Class({ + + initialize: + + function WebGLShader (pipeline, name, vertexShader, fragmentShader, attributes, uniforms) + { + /** + * A reference to the WebGLPipeline that owns this Shader. + * + * A Shader class can only belong to a single pipeline. + * + * @name Phaser.Renderer.WebGL.WebGLShader#pipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @since 3.50.0 + */ + this.pipeline = pipeline; + + /** + * The name of this shader. + * + * @name Phaser.Renderer.WebGL.WebGLShader#name + * @type {string} + * @since 3.50.0 + */ + this.name = name; + + /** + * A reference to the WebGLRenderer instance. + * + * @name Phaser.Renderer.WebGL.WebGLShader#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.50.0 + */ + this.renderer = pipeline.renderer; + + /** + * A reference to the WebGL Rendering Context the WebGL Renderer is using. + * + * @name Phaser.Renderer.WebGL.WebGLShader#gl + * @type {WebGLRenderingContext} + * @since 3.50.0 + */ + this.gl = this.renderer.gl; + + /** + * The WebGLProgram created from the vertex and fragment shaders. + * + * @name Phaser.Renderer.WebGL.WebGLShader#program + * @type {WebGLProgram} + * @since 3.50.0 + */ + this.program = this.renderer.createProgram(vertexShader, fragmentShader); + + /** + * Array of objects that describe the vertex attributes. + * + * @name Phaser.Renderer.WebGL.WebGLShader#attributes + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineAttribute[]} + * @since 3.50.0 + */ + this.attributes; + + /** + * The amount of vertex attribute components of 32 bit length. + * + * @name Phaser.Renderer.WebGL.WebGLShader#vertexComponentCount + * @type {number} + * @since 3.50.0 + */ + this.vertexComponentCount = 0; + + /** + * The size, in bytes, of a single vertex. + * + * This is derived by adding together all of the vertex attributes. + * + * For example, the Multi Pipeline has the following attributes: + * + * inPosition - (size 2 x gl.FLOAT) = 8 + * inTexCoord - (size 2 x gl.FLOAT) = 8 + * inTexId - (size 1 x gl.FLOAT) = 4 + * inTintEffect - (size 1 x gl.FLOAT) = 4 + * inTint - (size 4 x gl.UNSIGNED_BYTE) = 4 + * + * The total, in this case, is 8 + 8 + 4 + 4 + 4 = 28. + * + * This is calculated automatically during the `createAttributes` method. + * + * @name Phaser.Renderer.WebGL.WebGLShader#vertexSize + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.vertexSize = 0; + + /** + * The uniforms that this shader requires, as set via the configuration object. + * + * This is an object that maps the uniform names to their WebGL location. + * + * It is populated with their locations via the `setUniformLocations` method. + * + * @name Phaser.Renderer.WebGL.WebGLShader#uniforms + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineUniformsConfig} + * @since 3.50.0 + */ + this.uniforms = {}; + + this.createAttributes(attributes); + + if (uniforms) + { + this.setUniformLocations(uniforms); + } + }, + + /** + * Takes the vertex attributes config and parses it, creating the resulting array that is stored + * in this shaders `attributes` property, calculating the offset, normalization and location + * in the process. + * + * Calling this method resets `WebGLShader.attributes`, `WebGLShader.vertexSize` and + * `WebGLShader.vertexComponentCount`. + * + * It is called automatically when this class is created, but can be called manually if required. + * + * @method Phaser.Renderer.WebGL.WebGLShader#createAttributes + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributesConfig[]} attributes - An array of attributes configs. + */ + createAttributes: function (attributes) + { + var count = 0; + var offset = 0; + var result = []; + + this.vertexComponentCount = 0; + + for (var i = 0; i < attributes.length; i++) + { + var element = attributes[i]; + + var name = element.name; + var size = element.size; // i.e. 1 for a float, 2 for a vec2, 4 for a vec4, etc + var glType = GetFastValue(element, 'type', WEBGL_CONST.FLOAT); + var type = glType.enum; // The GLenum + var typeSize = glType.size; // The size in bytes of the type + + var normalized = (element.normalized) ? true : false; + + result.push({ + name: name, + size: size, + type: type, + normalized: normalized, + offset: offset, + enabled: false, + location: -1 + }); + + if (typeSize === 4) + { + count += size; + } + else + { + count++; + } + + offset += size * typeSize; + } + + this.vertexSize = offset; + this.vertexComponentCount = count; + this.attributes = result; + }, + + /** + * Sets the program this shader uses as being the active shader in the WebGL Renderer. + * + * This method is called every time the parent pipeline is made the current active pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLShader#bind + * @since 3.50.0 + * + * @param {boolean} [setAttributes=false] - Should the vertex attribute pointers be set? + * @param {boolean} [flush=false] - Flush the pipeline before binding this shader? + * + * @return {this} This WebGLShader instance. + */ + bind: function (setAttributes, flush) + { + if (setAttributes === undefined) { setAttributes = false; } + if (flush === undefined) { flush = false; } + + if (flush) + { + this.pipeline.flush(); + } + + this.renderer.setProgram(this.program); + + if (setAttributes) + { + this.setAttribPointers(); + } + + return this; + }, + + /** + * Sets the program this shader uses as being the active shader in the WebGL Renderer. + * + * Then resets all of the attribute pointers. + * + * @method Phaser.Renderer.WebGL.WebGLShader#rebind + * @since 3.50.0 + * + * @return {this} This WebGLShader instance. + */ + rebind: function () + { + this.renderer.setProgram(this.program); + + this.setAttribPointers(true); + + return this; + }, + + /** + * Sets the vertex attribute pointers. + * + * This should only be called after the vertex buffer has been bound. + * + * It is called automatically during the `bind` method. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setAttribPointers + * @since 3.50.0 + * + * @param {boolean} [reset=false] - Reset the vertex attribute locations? + * + * @return {this} This WebGLShader instance. + */ + setAttribPointers: function (reset) + { + if (reset === undefined) { reset = false; } + + var gl = this.gl; + var vertexSize = this.vertexSize; + var attributes = this.attributes; + var program = this.program; + + for (var i = 0; i < attributes.length; i++) + { + var element = attributes[i]; + + var size = element.size; + var type = element.type; + var offset = element.offset; + var enabled = element.enabled; + var location = element.location; + var normalized = (element.normalized) ? true : false; + + if (reset) + { + var attribLocation = gl.getAttribLocation(program, element.name); + + if (attribLocation >= 0) + { + gl.enableVertexAttribArray(attribLocation); + + gl.vertexAttribPointer(attribLocation, size, type, normalized, vertexSize, offset); + + element.enabled = true; + element.location = attribLocation; + } + else if (attribLocation !== -1) + { + gl.disableVertexAttribArray(attribLocation); + } + } + else if (enabled) + { + gl.vertexAttribPointer(location, size, type, normalized, vertexSize, offset); + } + else if (!enabled && location > -1) + { + gl.disableVertexAttribArray(location); + + element.location = -1; + } + } + + return this; + }, + + /** + * Sets up the `WebGLShader.uniforms` object, populating it with the names + * and locations of the shader uniforms this shader requires. + * + * This method is called automatically when this class is created. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniformLocations + * @since 3.50.0 + * + * @param {string[]} uniformNames - An array of the uniform names to get the locations for. + * + * @return {this} This WebGLShader instance. + */ + setUniformLocations: function (uniformNames) + { + var gl = this.gl; + var program = this.program; + var uniforms = this.uniforms; + + for (var i = 0; i < uniformNames.length; i++) + { + var name = uniformNames[i]; + + var location = gl.getUniformLocation(program, name); + + if (location !== null) + { + uniforms[name] = + { + name: name, + location: location, + value1: null, + value2: null, + value3: null, + value4: null + }; + } + } + + return this; + }, + + /** + * Checks to see if the given uniform name exists and is active in this shader. + * + * @method Phaser.Renderer.WebGL.WebGLShader#hasUniform + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to check for. + * + * @return {boolean} `true` if the uniform exists, otherwise `false`. + */ + hasUniform: function (name) + { + return this.uniforms.hasOwnProperty(name); + }, + + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform1 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * + * @return {this} This WebGLShader instance. + */ + setUniform1: function (setter, name, value1) + { + var uniform = this.uniforms[name]; + + if (!uniform) + { + return this; + } + + if (uniform.value1 !== value1) + { + uniform.value1 = value1; + + this.renderer.setProgram(this.program); + + setter.call(this.gl, uniform.location, value1); + + this.pipeline.currentShader = this; + } + + return this; + }, + + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform2 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. + * + * @return {this} This WebGLShader instance. + */ + setUniform2: function (setter, name, value1, value2) + { + var uniform = this.uniforms[name]; + + if (!uniform) + { + return this; + } + + if (uniform.value1 !== value1 || uniform.value2 !== value2) + { + uniform.value1 = value1; + uniform.value2 = value2; + + this.renderer.setProgram(this.program); + + setter.call(this.gl, uniform.location, value1, value2); + + this.pipeline.currentShader = this; + } + + return this; + }, + + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform3 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value3 - The new value of the uniform. + * + * @return {this} This WebGLShader instance. + */ + setUniform3: function (setter, name, value1, value2, value3) + { + var uniform = this.uniforms[name]; + + if (!uniform) + { + return this; + } + + if (uniform.value1 !== value1 || uniform.value2 !== value2 || uniform.value3 !== value3) + { + uniform.value1 = value1; + uniform.value2 = value2; + uniform.value3 = value3; + + this.renderer.setProgram(this.program); + + setter.call(this.gl, uniform.location, value1, value2, value3); + + this.pipeline.currentShader = this; + } + + return this; + }, + + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform4 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value3 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value4 - The new value of the uniform. + * + * @return {this} This WebGLShader instance. + */ + setUniform4: function (setter, name, value1, value2, value3, value4) + { + var uniform = this.uniforms[name]; + + if (!uniform) + { + return this; + } + + if (uniform.value1 !== value1 || uniform.value2 !== value2 || uniform.value3 !== value3 || uniform.value4 !== value4) + { + uniform.value1 = value1; + uniform.value2 = value2; + uniform.value3 = value3; + uniform.value4 = value4; + + this.renderer.setProgram(this.program); + + setter.call(this.gl, uniform.location, value1, value2, value3, value4); + + this.pipeline.currentShader = this; + } + + return this; + }, + + /** + * Sets a 1f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `float` uniform. + * + * @return {this} This WebGLShader instance. + */ + set1f: function (name, x) + { + return this.setUniform1(this.gl.uniform1f, name, x); + }, + + /** + * Sets a 2f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec2` uniform. + * @param {number} y - The new Y component of the `vec2` uniform. + * + * @return {this} This WebGLShader instance. + */ + set2f: function (name, x, y) + { + return this.setUniform2(this.gl.uniform2f, name, x, y); + }, + + /** + * Sets a 3f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec3` uniform. + * @param {number} y - The new Y component of the `vec3` uniform. + * @param {number} z - The new Z component of the `vec3` uniform. + * + * @return {this} This WebGLShader instance. + */ + set3f: function (name, x, y, z) + { + return this.setUniform3(this.gl.uniform3f, name, x, y, z); + }, + + /** + * Sets a 4f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform + * @param {number} y - Y component of the uniform + * @param {number} z - Z component of the uniform + * @param {number} w - W component of the uniform + * + * @return {this} This WebGLShader instance. + */ + set4f: function (name, x, y, z, w) + { + return this.setUniform4(this.gl.uniform4f, name, x, y, z, w); + }, + + /** + * Sets a 1fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set1fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform1fv, name, arr); + }, + + /** + * Sets a 2fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set2fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform2fv, name, arr); + }, + + /** + * Sets a 3fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set3fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform3fv, name, arr); + }, + + /** + * Sets a 4fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set4fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform4fv, name, arr); + }, + + /** + * Sets a 1iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set1iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform1iv, name, arr); + }, + + /** + * Sets a 2iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set2iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform2iv, name, arr); + }, + + /** + * Sets a 3iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set3iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform3iv, name, arr); + }, + + /** + * Sets a 4iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set4iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform4iv, name, arr); + }, + + /** + * Sets a 1i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `int` uniform. + * + * @return {this} This WebGLShader instance. + */ + set1i: function (name, x) + { + return this.setUniform1(this.gl.uniform1i, name, x); + }, + + /** + * Sets a 2i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec2` uniform. + * @param {number} y - The new Y component of the `ivec2` uniform. + * + * @return {this} This WebGLShader instance. + */ + set2i: function (name, x, y) + { + return this.setUniform2(this.gl.uniform2i, name, x, y); + }, + + /** + * Sets a 3i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec3` uniform. + * @param {number} y - The new Y component of the `ivec3` uniform. + * @param {number} z - The new Z component of the `ivec3` uniform. + * + * @return {this} This WebGLShader instance. + */ + set3i: function (name, x, y, z) + { + return this.setUniform3(this.gl.uniform3i, name, x, y, z); + }, + + /** + * Sets a 4i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform + * @param {number} y - Y component of the uniform + * @param {number} z - Z component of the uniform + * @param {number} w - W component of the uniform + * + * @return {this} This WebGLShader instance. + */ + set4i: function (name, x, y, z, w) + { + return this.setUniform4(this.gl.uniform4i, name, x, y, z, w); + }, + + /** + * Sets a matrix 2fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {number[]|Float32Array} matrix - The new values for the `mat2` uniform. + * + * @return {this} This WebGLShader instance. + */ + setMatrix2fv: function (name, transpose, matrix) + { + return this.setUniform2(this.gl.uniformMatrix2fv, name, transpose, matrix); + }, + + /** + * Sets a matrix 3fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat3` uniform. + * + * @return {this} This WebGLShader instance. + */ + setMatrix3fv: function (name, transpose, matrix) + { + return this.setUniform2(this.gl.uniformMatrix3fv, name, transpose, matrix); + }, + + /** + * Sets a matrix 4fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Should the matrix be transpose + * @param {Float32Array} matrix - Matrix data + * + * @return {this} This WebGLShader instance. + */ + setMatrix4fv: function (name, transpose, matrix) + { + return this.setUniform2(this.gl.uniformMatrix4fv, name, transpose, matrix); + }, + + /** + * Removes all external references from this class and deletes the WebGL program from the WebGL context. + * + * Does not remove this shader from the parent pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLShader#destroy + * @since 3.50.0 + */ + destroy: function () + { + this.gl.deleteProgram(this.program); + + this.pipeline = null; + this.renderer = null; + this.gl = null; + this.program = null; + this.attributes = null; + this.uniforms = null; + } + +}); + +module.exports = WebGLShader; + + +/***/ }), +/* 575 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var Earcut = __webpack_require__(65); +var GetFastValue = __webpack_require__(2); +var ShaderSourceFS = __webpack_require__(855); +var ShaderSourceVS = __webpack_require__(856); +var TransformMatrix = __webpack_require__(24); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); + +/** + * @classdesc + * The Graphics Pipeline is the rendering pipeline used by Phaser in WebGL when drawing + * primitive geometry objects, such as the Graphics Game Object, or the Shape Game Objects + * such as Arc, Line, Rectangle and Star. It handles the preperation and batching of related vertices. + * + * Prior to Phaser v3.50 the functions of this pipeline were merged with the `TextureTintPipeline`. + * + * The fragment shader it uses can be found in `shaders/src/Graphics.frag`. + * The vertex shader it uses can be found in `shaders/src/Graphics.vert`. + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2) + * `inColor` (vec4, normalized) + * + * The default shader uniforms for this pipeline are: + * + * `uProjectionMatrix` (mat4) + * + * @class GraphicsPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + */ +var GraphicsPipeline = new Class({ + + Extends: WebGLPipeline, + + initialize: + + function GraphicsPipeline (config) + { + config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS); + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inColor', + size: 4, + type: WEBGL_CONST.UNSIGNED_BYTE, + normalized: true + } + ]); + config.uniforms = GetFastValue(config, 'uniforms', [ + 'uProjectionMatrix' + ]); + + WebGLPipeline.call(this, config); + + /** + * A temporary Transform Matrix, re-used internally during batching by the + * Shape Game Objects. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#calcMatrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.50.0 + */ + this.calcMatrix = new TransformMatrix(); + + /** + * Used internally to draw stroked triangles. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#tempTriangle + * @type {array} + * @private + * @since 3.50.0 + */ + this.tempTriangle = [ + { x: 0, y: 0, width: 0 }, + { x: 0, y: 0, width: 0 }, + { x: 0, y: 0, width: 0 }, + { x: 0, y: 0, width: 0 } + ]; + + /** + * Cached stroke tint. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#strokeTint + * @type {object} + * @private + * @since 3.50.0 + */ + this.strokeTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; + + /** + * Cached fill tint. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#fillTint + * @type {object} + * @private + * @since 3.50.0 + */ + this.fillTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; + + /** + * Internal texture frame reference. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#currentFrame + * @type {Phaser.Textures.Frame} + * @private + * @since 3.50.0 + */ + this.currentFrame = { u0: 0, v0: 0, u1: 1, v1: 1 }; + + /** + * Internal path quad cache. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#firstQuad + * @type {number[]} + * @private + * @since 3.50.0 + */ + this.firstQuad = [ 0, 0, 0, 0, 0 ]; + + /** + * Internal path quad cache. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#prevQuad + * @type {number[]} + * @private + * @since 3.50.0 + */ + this.prevQuad = [ 0, 0, 0, 0, 0 ]; + + /** + * Used internally for triangulating a polygon. + * + * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#polygonCache + * @type {array} + * @private + * @since 3.50.0 + */ + this.polygonCache = []; + }, + + /** + * Pushes a filled rectangle into the vertex batch. + * + * Rectangle factors in the given transform matrices before adding to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchFillRect + * @since 3.50.0 + * + * @param {number} x - Horizontal top left coordinate of the rectangle. + * @param {number} y - Vertical top left coordinate of the rectangle. + * @param {number} width - Width of the rectangle. + * @param {number} height - Height of the rectangle. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchFillRect: function (x, y, width, height, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + var calcMatrix = this.calcMatrix; + + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } + + var xw = x + width; + var yh = y + height; + + var x0 = calcMatrix.getX(x, y); + var y0 = calcMatrix.getY(x, y); + + var x1 = calcMatrix.getX(x, yh); + var y1 = calcMatrix.getY(x, yh); + + var x2 = calcMatrix.getX(xw, yh); + var y2 = calcMatrix.getY(xw, yh); + + var x3 = calcMatrix.getX(xw, y); + var y3 = calcMatrix.getY(xw, y); + + var tint = this.fillTint; + + this.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint.TL, tint.TR, tint.BL, tint.BR); + }, + + /** + * Pushes a filled triangle into the vertex batch. + * + * Triangle factors in the given transform matrices before adding to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchFillTriangle + * @since 3.50.0 + * + * @param {number} x0 - Point 0 x coordinate. + * @param {number} y0 - Point 0 y coordinate. + * @param {number} x1 - Point 1 x coordinate. + * @param {number} y1 - Point 1 y coordinate. + * @param {number} x2 - Point 2 x coordinate. + * @param {number} y2 - Point 2 y coordinate. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchFillTriangle: function (x0, y0, x1, y1, x2, y2, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + var calcMatrix = this.calcMatrix; + + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } + + var tx0 = calcMatrix.getX(x0, y0); + var ty0 = calcMatrix.getY(x0, y0); + + var tx1 = calcMatrix.getX(x1, y1); + var ty1 = calcMatrix.getY(x1, y1); + + var tx2 = calcMatrix.getX(x2, y2); + var ty2 = calcMatrix.getY(x2, y2); + + var tint = this.fillTint; + + this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, tint.TL, tint.TR, tint.BL); + }, + + /** + * Pushes a stroked triangle into the vertex batch. + * + * Triangle factors in the given transform matrices before adding to the batch. + * + * The triangle is created from 3 lines and drawn using the `batchStrokePath` method. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchStrokeTriangle + * @since 3.50.0 + * + * @param {number} x0 - Point 0 x coordinate. + * @param {number} y0 - Point 0 y coordinate. + * @param {number} x1 - Point 1 x coordinate. + * @param {number} y1 - Point 1 y coordinate. + * @param {number} x2 - Point 2 x coordinate. + * @param {number} y2 - Point 2 y coordinate. + * @param {number} lineWidth - The width of the line in pixels. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchStrokeTriangle: function (x0, y0, x1, y1, x2, y2, lineWidth, currentMatrix, parentMatrix) + { + var tempTriangle = this.tempTriangle; + + tempTriangle[0].x = x0; + tempTriangle[0].y = y0; + tempTriangle[0].width = lineWidth; + + tempTriangle[1].x = x1; + tempTriangle[1].y = y1; + tempTriangle[1].width = lineWidth; + + tempTriangle[2].x = x2; + tempTriangle[2].y = y2; + tempTriangle[2].width = lineWidth; + + tempTriangle[3].x = x0; + tempTriangle[3].y = y0; + tempTriangle[3].width = lineWidth; + + this.batchStrokePath(tempTriangle, lineWidth, false, currentMatrix, parentMatrix); + }, + + /** + * Adds the given path to the vertex batch for rendering. + * + * It works by taking the array of path data and then passing it through Earcut, which + * creates a list of polygons. Each polygon is then added to the batch. + * + * The path is always automatically closed because it's filled. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchFillPath + * @since 3.50.0 + * + * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchFillPath: function (path, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + var calcMatrix = this.calcMatrix; + + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } + + var length = path.length; + var polygonCache = this.polygonCache; + var polygonIndexArray; + var point; + + var tintTL = this.fillTint.TL; + var tintTR = this.fillTint.TR; + var tintBL = this.fillTint.BL; + + for (var pathIndex = 0; pathIndex < length; ++pathIndex) + { + point = path[pathIndex]; + polygonCache.push(point.x, point.y); + } + + polygonIndexArray = Earcut(polygonCache); + length = polygonIndexArray.length; + + for (var index = 0; index < length; index += 3) + { + var p0 = polygonIndexArray[index + 0] * 2; + var p1 = polygonIndexArray[index + 1] * 2; + var p2 = polygonIndexArray[index + 2] * 2; + + var x0 = polygonCache[p0 + 0]; + var y0 = polygonCache[p0 + 1]; + var x1 = polygonCache[p1 + 0]; + var y1 = polygonCache[p1 + 1]; + var x2 = polygonCache[p2 + 0]; + var y2 = polygonCache[p2 + 1]; + + var tx0 = calcMatrix.getX(x0, y0); + var ty0 = calcMatrix.getY(x0, y0); + + var tx1 = calcMatrix.getX(x1, y1); + var ty1 = calcMatrix.getY(x1, y1); + + var tx2 = calcMatrix.getX(x2, y2); + var ty2 = calcMatrix.getY(x2, y2); + + this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, tintTL, tintTR, tintBL); + } + + polygonCache.length = 0; + }, + + /** + * Adds the given path to the vertex batch for rendering. + * + * It works by taking the array of path data and calling `batchLine` for each section + * of the path. + * + * The path is optionally closed at the end. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchStrokePath + * @since 3.50.0 + * + * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. + * @param {number} lineWidth - The width of the line segments in pixels. + * @param {boolean} pathOpen - Indicates if the path should be closed or left open. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchStrokePath: function (path, lineWidth, pathOpen, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + // Reset the closePath booleans + this.prevQuad[4] = 0; + this.firstQuad[4] = 0; + + var pathLength = path.length - 1; + + for (var pathIndex = 0; pathIndex < pathLength; pathIndex++) + { + var point0 = path[pathIndex]; + var point1 = path[pathIndex + 1]; + + this.batchLine( + point0.x, + point0.y, + point1.x, + point1.y, + point0.width / 2, + point1.width / 2, + lineWidth, + pathIndex, + !pathOpen && (pathIndex === pathLength - 1), + currentMatrix, + parentMatrix + ); + } + }, + + /** + * Creates a line out of 4 quads and adds it to the vertex batch based on the given line values. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchLine + * @since 3.50.0 + * + * @param {number} ax - x coordinate of the start of the line. + * @param {number} ay - y coordinate of the start of the line. + * @param {number} bx - x coordinate of the end of the line. + * @param {number} by - y coordinate of the end of the line. + * @param {number} aLineWidth - Width of the start of the line. + * @param {number} bLineWidth - Width of the end of the line. + * @param {number} index - If this line is part of a multi-line draw, the index of the line in the draw. + * @param {boolean} closePath - Does this line close a multi-line path? + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchLine: function (ax, ay, bx, by, aLineWidth, bLineWidth, lineWidth, index, closePath, currentMatrix, parentMatrix) + { + this.renderer.pipelines.set(this); + + var calcMatrix = this.calcMatrix; + + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } + + var dx = bx - ax; + var dy = by - ay; + + var len = Math.sqrt(dx * dx + dy * dy); + var al0 = aLineWidth * (by - ay) / len; + var al1 = aLineWidth * (ax - bx) / len; + var bl0 = bLineWidth * (by - ay) / len; + var bl1 = bLineWidth * (ax - bx) / len; + + var lx0 = bx - bl0; + var ly0 = by - bl1; + var lx1 = ax - al0; + var ly1 = ay - al1; + var lx2 = bx + bl0; + var ly2 = by + bl1; + var lx3 = ax + al0; + var ly3 = ay + al1; + + // tx0 = bottom right + var brX = calcMatrix.getX(lx0, ly0); + var brY = calcMatrix.getY(lx0, ly0); + + // tx1 = bottom left + var blX = calcMatrix.getX(lx1, ly1); + var blY = calcMatrix.getY(lx1, ly1); + + // tx2 = top right + var trX = calcMatrix.getX(lx2, ly2); + var trY = calcMatrix.getY(lx2, ly2); + + // tx3 = top left + var tlX = calcMatrix.getX(lx3, ly3); + var tlY = calcMatrix.getY(lx3, ly3); + + var tint = this.strokeTint; + + var tintTL = tint.TL; + var tintTR = tint.TR; + var tintBL = tint.BL; + var tintBR = tint.BR; + + // TL, BL, BR, TR + this.batchQuad(tlX, tlY, blX, blY, brX, brY, trX, trY, tintTL, tintTR, tintBL, tintBR); + + if (lineWidth <= 2) + { + // No point doing a linejoin if the line isn't thick enough + return; + } + + var prev = this.prevQuad; + var first = this.firstQuad; + + if (index > 0 && prev[4]) + { + this.batchQuad(tlX, tlY, blX, blY, prev[0], prev[1], prev[2], prev[3], tintTL, tintTR, tintBL, tintBR); + } + else + { + first[0] = tlX; + first[1] = tlY; + first[2] = blX; + first[3] = blY; + first[4] = 1; + } + + if (closePath && first[4]) + { + // Add a join for the final path segment + this.batchQuad(brX, brY, trX, trY, first[0], first[1], first[2], first[3], tintTL, tintTR, tintBL, tintBR); + } + else + { + // Store it + + prev[0] = brX; + prev[1] = brY; + prev[2] = trX; + prev[3] = trY; + prev[4] = 1; + } + }, + + /** + * Adds a single vertex to the current vertex buffer and increments the + * `vertexCount` property by 1. + * + * This method is called directly by `batchTri` and `batchQuad`. + * + * It does not perform any batch limit checking itself, so if you need to call + * this method directly, do so in the same way that `batchQuad` does, for example. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchVert + * @since 3.50.0 + * + * @param {number} x - The vertex x position. + * @param {number} y - The vertex y position. + * @param {number} tint - The tint color value. + */ + batchVert: function (x, y, tint) + { + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; + + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; + + vertexViewF32[++vertexOffset] = x; + vertexViewF32[++vertexOffset] = y; + vertexViewU32[++vertexOffset] = tint; + + this.vertexCount++; + }, + + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 6 vertices in the following arrangement: + * + * ``` + * 0----3 + * |\ B| + * | \ | + * | \ | + * | A \| + * | \ + * 1----2 + * ``` + * + * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchQuad + * @override + * @since 3.50.0 + * + * @param {number} x0 - The top-left x position. + * @param {number} y0 - The top-left y position. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * @param {number} tintBR - The bottom-right tint color value. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, tintTL, tintTR, tintBL, tintBR) + { + var hasFlushed = false; + + if (this.shouldFlush(6)) + { + this.flush(); + + hasFlushed = true; + } + + this.batchVert(x0, y0, tintTL); + this.batchVert(x1, y1, tintBL); + this.batchVert(x2, y2, tintBR); + this.batchVert(x0, y0, tintTL); + this.batchVert(x2, y2, tintBR); + this.batchVert(x3, y3, tintTR); + + return hasFlushed; + }, + + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 3 vertices in the following arrangement: + * + * ``` + * 0 + * |\ + * | \ + * | \ + * | \ + * | \ + * 1-----2 + * ``` + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchTri + * @override + * @since 3.50.0 + * + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchTri: function (x0, y0, x1, y1, x2, y2, tintTL, tintTR, tintBL) + { + var hasFlushed = false; + + if (this.shouldFlush(3)) + { + this.flush(); + + hasFlushed = true; + } + + this.batchVert(x0, y0, tintTL); + this.batchVert(x1, y1, tintTR); + this.batchVert(x2, y2, tintBL); + + return hasFlushed; + }, + + /** + * Destroys all shader instances, removes all object references and nulls all external references. + * + * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#destroy + * @since 3.50.0 + * + * @return {this} This WebGLPipeline instance. + */ + destroy: function () + { + WebGLPipeline.prototype.destroy.call(this); + + this.polygonCache = null; + + return this; + } + +}); + +module.exports = GraphicsPipeline; + + +/***/ }), +/* 576 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -128896,9 +136642,12 @@ module.exports = BitmapMaskPipeline; var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var ShaderSourceFS = __webpack_require__(809); -var MultiPipeline = __webpack_require__(112); -var WebGLPipeline = __webpack_require__(111); +var LightShaderSourceFS = __webpack_require__(857); +var PointLightShaderSourceFS = __webpack_require__(858); +var PointLightShaderSourceVS = __webpack_require__(859); +var TransformMatrix = __webpack_require__(24); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); var LIGHT_COUNT = 10; @@ -128952,7 +136701,7 @@ var LIGHT_COUNT = 10; */ var LightPipeline = new Class({ - Extends: MultiPipeline, + Extends: WebGLPipeline, initialize: @@ -128960,11 +136709,73 @@ var LightPipeline = new Class({ { LIGHT_COUNT = config.game.renderer.config.maxLights; - var fragmentShaderSource = GetFastValue(config, 'fragShader', ShaderSourceFS); + config.shaders = GetFastValue(config, 'shaders', [ + { + name: 'PointLight', + fragShader: PointLightShaderSourceFS, + vertShader: PointLightShaderSourceVS, + uniforms: [ + 'uProjectionMatrix', + 'uResolution' + ] + }, + { + name: 'Light', + fragShader: LightShaderSourceFS.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString()) + } + ]); - config.fragShader = fragmentShaderSource.replace('%LIGHT_COUNT%', LIGHT_COUNT.toString()); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inLightPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inLightRadius', + size: 1, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inLightColor', + size: 4, + type: WEBGL_CONST.FLOAT + } + ]); - MultiPipeline.call(this, config); + WebGLPipeline.call(this, config); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempMatrix1 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this.tempMatrix1 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempMatrix2 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this.tempMatrix2 = new TransformMatrix(); + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempMatrix3 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this.tempMatrix3 = new TransformMatrix(); /** * Inverse rotation matrix for normal map rotations. @@ -129000,6 +136811,9 @@ var LightPipeline = new Class({ this.lightCount = 0; this.forceZero = true; + + this.pointLightShader; + this.lightShader; }, /** @@ -129008,7 +136822,7 @@ var LightPipeline = new Class({ * By this stage all Game level systems are now in place and you can perform any final * tasks that the pipeline may need that relied on game systems such as the Texture Manager. * - * @method Phaser.Renderer.WebGL.LightPipeline#boot + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#boot * @since 3.11.0 */ boot: function () @@ -129027,48 +136841,101 @@ var LightPipeline = new Class({ this.defaultNormalMap = { glTexture: tempTexture }; - return this; + this.pointLightShader = this.shaders[0]; + this.lightShader = this.shaders[1]; }, /** - * Called every time the pipeline is bound by the renderer. - * Sets the shader program, vertex buffer and other resources. - * Should only be called when changing pipeline. + * Adds a single vertex to the current vertex buffer and increments the + * `vertexCount` property by 1. * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#bind + * This method is called directly by `batchTri` and `batchQuad`. + * + * It does not perform any batch limit checking itself, so if you need to call + * this method directly, do so in the same way that `batchQuad` does, for example. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#batchVert * @since 3.50.0 * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? + * @param {number} x - The vertex x position. + * @param {number} y - The vertex y position. + * @param {number} u - UV u value. + * @param {number} v - UV v value. + * @param {number} unit - Texture unit to which the texture needs to be bound. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {number} tint - The tint color value. + */ + batchVert: function (x, y, lightX, lightY, radius, r, g, b, a) + { + var vertexViewF32 = this.vertexViewF32; + + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; + + vertexViewF32[++vertexOffset] = x; + vertexViewF32[++vertexOffset] = y; + vertexViewF32[++vertexOffset] = lightX; + vertexViewF32[++vertexOffset] = lightY; + vertexViewF32[++vertexOffset] = radius; + vertexViewF32[++vertexOffset] = r; + vertexViewF32[++vertexOffset] = g; + vertexViewF32[++vertexOffset] = b; + vertexViewF32[++vertexOffset] = a; + + this.vertexCount++; + }, + + batchLight: function (light, camera, x0, y0, x1, y1, x2, y2, x3, y3, lightX, lightY) + { + var color = light.color; + var intensity = light.intensity; + var radius = light.radius; + + var r = color.r * intensity; + var g = color.g * intensity; + var b = color.b * intensity; + var a = camera.alpha * light.alpha; + + if (this.shouldFlush(6)) + { + this.flush(); + } + + this.batchVert(x0, y0, lightX, lightY, radius, r, g, b, a); + this.batchVert(x1, y1, lightX, lightY, radius, r, g, b, a); + this.batchVert(x2, y2, lightX, lightY, radius, r, g, b, a); + this.batchVert(x0, y0, lightX, lightY, radius, r, g, b, a); + this.batchVert(x2, y2, lightX, lightY, radius, r, g, b, a); + this.batchVert(x3, y3, lightX, lightY, radius, r, g, b, a); + }, + + /** + * Called every time a Game Object needs to use this pipeline. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#onBind + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. * * @return {this} This WebGLPipeline instance. */ - bind: function (reset) + onBind: function () { - if (reset === undefined) { reset = false; } - - WebGLPipeline.prototype.bind.call(this, reset); - - var renderer = this.renderer; - var program = this.program; - - renderer.setInt1(program, 'uMainSampler', 0); - renderer.setInt1(program, 'uNormSampler', 1); - renderer.setFloat2(program, 'uResolution', this.width, this.height); - - return this; + this.set1i('uMainSampler', 0); + this.set1i('uNormSampler', 1); + this.set2f('uResolution', this.width / 2, this.height / 2); }, /** * This function sets all the needed resources for each camera pass. * * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#onRender + * @ignore * @since 3.0.0 * * @param {Phaser.Scene} scene - The Scene being rendered. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. * * @return {this} This WebGLPipeline instance. - */ onRender: function (scene, camera) { this.active = false; @@ -129140,6 +137007,7 @@ var LightPipeline = new Class({ return this; }, + */ /** * Rotates the normal map vectors inversely by the given angle. @@ -129187,11 +137055,11 @@ var LightPipeline = new Class({ * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object. * * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setTexture2D + * @ignore * @since 3.50.0 * * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object being rendered or added to the batch. - */ setTexture2D: function (texture, gameObject) { var renderer = this.renderer; @@ -129216,19 +137084,20 @@ var LightPipeline = new Class({ return 0; }, + */ /** * Custom pipelines can use this method in order to perform any required pre-batch tasks * for the given Game Object. It must return the texture unit the Game Object was assigned. * * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setGameObject + * @ignore * @since 3.50.0 * * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. * * @return {number} The texture unit the Game Object has been assigned. - */ setGameObject: function (gameObject, frame) { if (frame === undefined) { frame = gameObject.frame; } @@ -129251,6 +137120,7 @@ var LightPipeline = new Class({ return 0; }, + */ /** * Returns the normal map WebGLTexture from the given Game Object. @@ -129307,7 +137177,7 @@ module.exports = LightPipeline; /***/ }), -/* 539 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129317,8 +137187,8 @@ module.exports = LightPipeline; */ var Class = __webpack_require__(0); -var ModelViewProjection = __webpack_require__(113); -var MultiPipeline = __webpack_require__(112); +var GetFastValue = __webpack_require__(2); +var MultiPipeline = __webpack_require__(158); /** * @classdesc @@ -129361,15 +137231,13 @@ var RopePipeline = new Class({ Extends: MultiPipeline, - Mixins: [ - ModelViewProjection - ], - initialize: function RopePipeline (config) { - config.topology = config.game.renderer.gl.TRIANGLE_STRIP; + // GLenum 5 = TRIANGLE_STRIP + config.topology = 5; + config.batchSize = GetFastValue(config, 'batchSize', 256); MultiPipeline.call(this, config); } @@ -129379,7 +137247,7 @@ module.exports = RopePipeline; /***/ }), -/* 540 */ +/* 578 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129390,17 +137258,15 @@ module.exports = RopePipeline; var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var ModelViewProjection = __webpack_require__(113); -var MultiPipeline = __webpack_require__(112); -var ShaderSourceFS = __webpack_require__(812); -var ShaderSourceVS = __webpack_require__(813); -var WebGLPipeline = __webpack_require__(111); +var MultiPipeline = __webpack_require__(158); +var ShaderSourceFS = __webpack_require__(862); +var ShaderSourceVS = __webpack_require__(863); +var WebGLPipeline = __webpack_require__(75); /** * @classdesc - * * The Single Pipeline is a special version of the Multi Pipeline that only ever - * uses one single texture, bound to texture unit zero. Although not as efficient as the + * uses one texture, bound to texture unit zero. Although not as efficient as the * Multi Pipeline, it provides an easier way to create custom pipelines that only require * a single bound texture. * @@ -129413,14 +137279,13 @@ var WebGLPipeline = __webpack_require__(111); * * `inPosition` (vec2, offset 0) * `inTexCoord` (vec2, offset 8) - * `inTintEffect` (float, offset 16) - * `inTint` (vec4, offset 20, normalized) + * `inTexId` (float, offset 16) - this value is always zero in the Single Pipeline + * `inTintEffect` (float, offset 20) + * `inTint` (vec4, offset 24, normalized) * * The default shader uniforms for this pipeline are: * * `uProjectionMatrix` (mat4) - * `uViewMatrix` (mat4) - * `uModelMatrix` (mat4) * `uMainSampler` (sampler2D) * * @class SinglePipeline @@ -129435,274 +137300,22 @@ var SinglePipeline = new Class({ Extends: MultiPipeline, - Mixins: [ - ModelViewProjection - ], - initialize: function SinglePipeline (config) { - var gl = config.game.renderer.gl; - config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS), config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS), - config.vertexSize = GetFastValue(config, 'vertexSize', 24), - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 0, - enabled: false, - location: -1 - }, - { - name: 'inTexCoord', - size: 2, - type: gl.FLOAT, - normalized: false, - offset: 8, - enabled: false, - location: -1 - }, - { - name: 'inTintEffect', - size: 1, - type: gl.FLOAT, - normalized: false, - offset: 16, - enabled: false, - location: -1 - }, - { - name: 'inTint', - size: 4, - type: gl.UNSIGNED_BYTE, - normalized: true, - offset: 20, - enabled: false, - location: -1 - } - ]); + config.forceZero = true; MultiPipeline.call(this, config); - - this.forceZero = true; }, - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 6 vertices in the following arrangement: - * - * ``` - * 0----3 - * |\ B| - * | \ | - * | \ | - * | A \| - * | \ - * 1----2 - * ``` - * - * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 - * - * @method Phaser.Renderer.WebGL.Pipelines.SinglePipeline#batchQuad - * @since 3.50.0 - * - * @param {number} x0 - The top-left x position. - * @param {number} y0 - The top-left y position. - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {number} tintBR - The bottom-right tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {integer} [unit=0] - This parameter isn't used by this pipeline, but is retained for TTP support. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) + boot: function () { - if (unit === undefined) { unit = this.currentUnit; } + WebGLPipeline.prototype.boot.call(this); - var hasFlushed = false; - - if (this.vertexCount + 6 > this.vertexCapacity) - { - this.flush(); - - hasFlushed = true; - - unit = this.setTexture2D(texture); - } - - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - - var vertexOffset = (this.vertexCount * this.vertexComponentCount) - 1; - - vertexViewF32[++vertexOffset] = x0; - vertexViewF32[++vertexOffset] = y0; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x1; - vertexViewF32[++vertexOffset] = y1; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBR; - - vertexViewF32[++vertexOffset] = x0; - vertexViewF32[++vertexOffset] = y0; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBR; - - vertexViewF32[++vertexOffset] = x3; - vertexViewF32[++vertexOffset] = y3; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTR; - - this.vertexCount += 6; - - return hasFlushed; - }, - - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 3 vertices in the following arrangement: - * - * ``` - * 0 - * |\ - * | \ - * | \ - * | \ - * | \ - * 1-----2 - * ``` - * - * @method Phaser.Renderer.WebGL.Pipelines.SinglePipeline#batchTri - * @since 3.50.0 - * - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {integer} [unit=0] - This parameter isn't used by this pipeline, but is retained for TTP support. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchTri: function (x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) - { - if (unit === undefined) { unit = this.currentUnit; } - - var hasFlushed = false; - - if (this.vertexCount + 3 > this.vertexCapacity) - { - this.flush(); - - hasFlushed = true; - - unit = this.setTexture2D(texture); - } - - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; - - var vertexOffset = (this.vertexCount * this.vertexComponentCount) - 1; - - vertexViewF32[++vertexOffset] = x1; - vertexViewF32[++vertexOffset] = y1; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v0; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTL; - - vertexViewF32[++vertexOffset] = x2; - vertexViewF32[++vertexOffset] = y2; - vertexViewF32[++vertexOffset] = u0; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintTR; - - vertexViewF32[++vertexOffset] = x3; - vertexViewF32[++vertexOffset] = y3; - vertexViewF32[++vertexOffset] = u1; - vertexViewF32[++vertexOffset] = v1; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tintBL; - - this.vertexCount += 3; - - return hasFlushed; - }, - - /** - * Called every time the pipeline is bound by the renderer. - * Sets the shader program, vertex buffer and other resources. - * Should only be called when changing pipeline. - * - * @method Phaser.Renderer.WebGL.Pipelines.SinglePipeline#bind - * @since 3.50.0 - * - * @param {boolean} [reset=false] - Should the pipeline be fully re-bound after a renderer pipeline clear? - * - * @return {this} This WebGLPipeline instance. - */ - bind: function (reset) - { - if (reset === undefined) { reset = false; } - - WebGLPipeline.prototype.bind.call(this, reset); - - return this; + this.set1i('uMainSampler', 0); } }); @@ -129711,7 +137324,33 @@ module.exports = SinglePipeline; /***/ }), -/* 541 */ +/* 579 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_QUAD_VS', + '', + 'precision mediump float;', + '', + 'attribute vec2 inPosition;', + 'attribute vec2 inTexCoord;', + '', + 'varying vec2 outFragCoord;', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' outFragCoord = inPosition.xy * 0.5 + 0.5;', + ' outTexCoord = inTexCoord;', + '', + ' gl_Position = vec4(inPosition, 0, 1);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 580 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129720,13 +137359,13 @@ module.exports = SinglePipeline; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(26); -var Color = __webpack_require__(32); +var CanvasPool = __webpack_require__(31); +var Color = __webpack_require__(36); var GetFastValue = __webpack_require__(2); /** * Takes a snapshot of an area from the current frame displayed by a WebGL canvas. - * + * * This is then copied to an Image object. When this loads, the results are sent * to the callback provided in the Snapshot Configuration object. * @@ -129773,19 +137412,19 @@ var WebGLSnapshot = function (sourceCanvas, config) var pixels = new Uint8Array(total); gl.readPixels(x, bufferHeight - y - height, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels); - + var canvas = CanvasPool.createWebGL(this, width, height); var ctx = canvas.getContext('2d'); var imageData = ctx.getImageData(0, 0, width, height); - + var data = imageData.data; for (var py = 0; py < height; py++) { for (var px = 0; px < width; px++) { - var sourceIndex = ((height - py) * width + px) * 4; + var sourceIndex = ((height - py - 1) * width + px) * 4; var destIndex = (isFramebuffer) ? total - ((py * width + (width - px)) * 4) : (py * width + px) * 4; data[destIndex + 0] = pixels[sourceIndex + 0]; @@ -129796,7 +137435,7 @@ var WebGLSnapshot = function (sourceCanvas, config) } ctx.putImageData(imageData, 0, 0); - + var image = new Image(); image.onerror = function () @@ -129821,7 +137460,7 @@ module.exports = WebGLSnapshot; /***/ }), -/* 542 */ +/* 581 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129834,8 +137473,8 @@ var Axes = {}; module.exports = Axes; -var Vector = __webpack_require__(102); -var Common = __webpack_require__(44); +var Vector = __webpack_require__(114); +var Common = __webpack_require__(50); (function() { @@ -129891,7 +137530,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 543 */ +/* 582 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129906,28 +137545,28 @@ var Common = __webpack_require__(44); module.exports = { - AFTER_ADD: __webpack_require__(1426), - AFTER_REMOVE: __webpack_require__(1427), - AFTER_UPDATE: __webpack_require__(1428), - BEFORE_ADD: __webpack_require__(1429), - BEFORE_REMOVE: __webpack_require__(1430), - BEFORE_UPDATE: __webpack_require__(1431), - COLLISION_ACTIVE: __webpack_require__(1432), - COLLISION_END: __webpack_require__(1433), - COLLISION_START: __webpack_require__(1434), - DRAG_END: __webpack_require__(1435), - DRAG: __webpack_require__(1436), - DRAG_START: __webpack_require__(1437), - PAUSE: __webpack_require__(1438), - RESUME: __webpack_require__(1439), - SLEEP_END: __webpack_require__(1440), - SLEEP_START: __webpack_require__(1441) + AFTER_ADD: __webpack_require__(1488), + AFTER_REMOVE: __webpack_require__(1489), + AFTER_UPDATE: __webpack_require__(1490), + BEFORE_ADD: __webpack_require__(1491), + BEFORE_REMOVE: __webpack_require__(1492), + BEFORE_UPDATE: __webpack_require__(1493), + COLLISION_ACTIVE: __webpack_require__(1494), + COLLISION_END: __webpack_require__(1495), + COLLISION_START: __webpack_require__(1496), + DRAG_END: __webpack_require__(1497), + DRAG: __webpack_require__(1498), + DRAG_START: __webpack_require__(1499), + PAUSE: __webpack_require__(1500), + RESUME: __webpack_require__(1501), + SLEEP_END: __webpack_require__(1502), + SLEEP_START: __webpack_require__(1503) }; /***/ }), -/* 544 */ +/* 583 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -129942,9 +137581,9 @@ var Detector = {}; module.exports = Detector; -var SAT = __webpack_require__(545); -var Pair = __webpack_require__(501); -var Bounds = __webpack_require__(103); +var SAT = __webpack_require__(584); +var Pair = __webpack_require__(518); +var Bounds = __webpack_require__(115); (function() { @@ -130040,7 +137679,7 @@ var Bounds = __webpack_require__(103); /***/ }), -/* 545 */ +/* 584 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130055,8 +137694,8 @@ var SAT = {}; module.exports = SAT; -var Vertices = __webpack_require__(88); -var Vector = __webpack_require__(102); +var Vertices = __webpack_require__(93); +var Vector = __webpack_require__(114); (function() { @@ -130316,7 +137955,7 @@ var Vector = __webpack_require__(102); /***/ }), -/* 546 */ +/* 585 */ /***/ (function(module, exports) { var g; @@ -130342,21 +137981,21 @@ module.exports = g; /***/ }), -/* 547 */ +/* 586 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(548); -__webpack_require__(549); -__webpack_require__(550); -__webpack_require__(551); -__webpack_require__(552); -__webpack_require__(553); -__webpack_require__(554); -__webpack_require__(555); +__webpack_require__(587); +__webpack_require__(588); +__webpack_require__(589); +__webpack_require__(590); +__webpack_require__(591); +__webpack_require__(592); +__webpack_require__(593); +__webpack_require__(594); /***/ }), -/* 548 */ +/* 587 */ /***/ (function(module, exports) { /** @@ -130396,7 +138035,7 @@ if (!Array.prototype.forEach) /***/ }), -/* 549 */ +/* 588 */ /***/ (function(module, exports) { /** @@ -130412,7 +138051,7 @@ if (!Array.isArray) /***/ }), -/* 550 */ +/* 589 */ /***/ (function(module, exports) { /* Copyright 2013 Chris Wilson @@ -130599,7 +138238,7 @@ BiquadFilterNode.type and OscillatorNode.type. /***/ }), -/* 551 */ +/* 590 */ /***/ (function(module, exports) { /** @@ -130614,7 +138253,7 @@ if (!window.console) /***/ }), -/* 552 */ +/* 591 */ /***/ (function(module, exports) { // ES6 Math.trunc - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc @@ -130626,7 +138265,7 @@ if (!Math.trunc) { /***/ }), -/* 553 */ +/* 592 */ /***/ (function(module, exports) { /** @@ -130663,7 +138302,7 @@ if (!Math.trunc) { /***/ }), -/* 554 */ +/* 593 */ /***/ (function(module, exports) { // References: @@ -130720,7 +138359,7 @@ if (!window.cancelAnimationFrame) /***/ }), -/* 555 */ +/* 594 */ /***/ (function(module, exports) { /** @@ -130773,7 +138412,7 @@ if (typeof window.Uint32Array !== 'function' && typeof window.Uint32Array !== 'o /***/ }), -/* 556 */ +/* 595 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130782,7 +138421,7 @@ if (typeof window.Uint32Array !== 'function' && typeof window.Uint32Array !== 'o * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var QuickSet = __webpack_require__(253); +var QuickSet = __webpack_require__(268); /** * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, and aligns them next to each other. @@ -130795,7 +138434,7 @@ var QuickSet = __webpack_require__(253); * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {integer} position - The position to align the items with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. + * @param {number} position - The position to align the items with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. * @param {number} [offsetX=0] - Optional horizontal offset from the position. * @param {number} [offsetY=0] - Optional vertical offset from the position. * @@ -130821,7 +138460,7 @@ module.exports = AlignTo; /***/ }), -/* 557 */ +/* 596 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -130830,7 +138469,7 @@ module.exports = AlignTo; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `angle` property, @@ -130848,8 +138487,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `angle` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -130862,7 +138501,7 @@ module.exports = Angle; /***/ }), -/* 558 */ +/* 597 */ /***/ (function(module, exports) { /** @@ -130901,7 +138540,7 @@ module.exports = Call; /***/ }), -/* 559 */ +/* 598 */ /***/ (function(module, exports) { /** @@ -130924,7 +138563,7 @@ module.exports = Call; * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be searched by this action. * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [index=0] - An optional offset to start searching from within the items array. * * @return {?(object|Phaser.GameObjects.GameObject)} The first object in the array that matches the comparison object, or `null` if no match was found. */ @@ -130959,7 +138598,7 @@ module.exports = GetFirst; /***/ }), -/* 560 */ +/* 599 */ /***/ (function(module, exports) { /** @@ -130982,7 +138621,7 @@ module.exports = GetFirst; * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be searched by this action. * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [index=0] - An optional offset to start searching from within the items array. * * @return {?(object|Phaser.GameObjects.GameObject)} The last object in the array that matches the comparison object, or `null` if no match was found. */ @@ -131017,7 +138656,7 @@ module.exports = GetLast; /***/ }), -/* 561 */ +/* 600 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131026,11 +138665,11 @@ module.exports = GetLast; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AlignIn = __webpack_require__(266); -var CONST = __webpack_require__(108); +var AlignIn = __webpack_require__(281); +var CONST = __webpack_require__(120); var GetFastValue = __webpack_require__(2); var NOOP = __webpack_require__(1); -var Zone = __webpack_require__(117); +var Zone = __webpack_require__(125); var tempZone = new Zone({ sys: { queueDepthSort: NOOP, events: { once: NOOP } } }, 0, 0, 1, 1); @@ -131136,7 +138775,7 @@ module.exports = GridAlign; /***/ }), -/* 562 */ +/* 601 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131145,7 +138784,7 @@ module.exports = GridAlign; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); // bitmask flag for GameObject.renderMask var _FLAG = 2; // 0010 @@ -131431,7 +139070,7 @@ module.exports = Alpha; /***/ }), -/* 563 */ +/* 602 */ /***/ (function(module, exports) { /** @@ -131580,7 +139219,7 @@ module.exports = ComputedSize; /***/ }), -/* 564 */ +/* 603 */ /***/ (function(module, exports) { /** @@ -131705,7 +139344,7 @@ module.exports = Crop; /***/ }), -/* 565 */ +/* 604 */ /***/ (function(module, exports) { /** @@ -131869,7 +139508,7 @@ module.exports = Flip; /***/ }), -/* 566 */ +/* 605 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -131879,7 +139518,7 @@ module.exports = Flip; */ var Rectangle = __webpack_require__(9); -var RotateAround = __webpack_require__(285); +var RotateAround = __webpack_require__(300); var Vector2 = __webpack_require__(3); /** @@ -132228,7 +139867,7 @@ module.exports = GetBounds; /***/ }), -/* 567 */ +/* 606 */ /***/ (function(module, exports) { /** @@ -132251,7 +139890,7 @@ module.exports = 'blur'; /***/ }), -/* 568 */ +/* 607 */ /***/ (function(module, exports) { /** @@ -132273,7 +139912,7 @@ module.exports = 'boot'; /***/ }), -/* 569 */ +/* 608 */ /***/ (function(module, exports) { /** @@ -132296,7 +139935,7 @@ module.exports = 'contextlost'; /***/ }), -/* 570 */ +/* 609 */ /***/ (function(module, exports) { /** @@ -132319,7 +139958,7 @@ module.exports = 'contextrestored'; /***/ }), -/* 571 */ +/* 610 */ /***/ (function(module, exports) { /** @@ -132342,7 +139981,7 @@ module.exports = 'destroy'; /***/ }), -/* 572 */ +/* 611 */ /***/ (function(module, exports) { /** @@ -132364,7 +140003,7 @@ module.exports = 'focus'; /***/ }), -/* 573 */ +/* 612 */ /***/ (function(module, exports) { /** @@ -132390,7 +140029,7 @@ module.exports = 'hidden'; /***/ }), -/* 574 */ +/* 613 */ /***/ (function(module, exports) { /** @@ -132411,7 +140050,7 @@ module.exports = 'pause'; /***/ }), -/* 575 */ +/* 614 */ /***/ (function(module, exports) { /** @@ -132437,7 +140076,7 @@ module.exports = 'postrender'; /***/ }), -/* 576 */ +/* 615 */ /***/ (function(module, exports) { /** @@ -132462,7 +140101,7 @@ module.exports = 'poststep'; /***/ }), -/* 577 */ +/* 616 */ /***/ (function(module, exports) { /** @@ -132487,7 +140126,7 @@ module.exports = 'prerender'; /***/ }), -/* 578 */ +/* 617 */ /***/ (function(module, exports) { /** @@ -132512,7 +140151,7 @@ module.exports = 'prestep'; /***/ }), -/* 579 */ +/* 618 */ /***/ (function(module, exports) { /** @@ -132534,7 +140173,7 @@ module.exports = 'ready'; /***/ }), -/* 580 */ +/* 619 */ /***/ (function(module, exports) { /** @@ -132555,7 +140194,7 @@ module.exports = 'resume'; /***/ }), -/* 581 */ +/* 620 */ /***/ (function(module, exports) { /** @@ -132580,7 +140219,7 @@ module.exports = 'step'; /***/ }), -/* 582 */ +/* 621 */ /***/ (function(module, exports) { /** @@ -132604,7 +140243,7 @@ module.exports = 'visible'; /***/ }), -/* 583 */ +/* 622 */ /***/ (function(module, exports) { /** @@ -132807,7 +140446,7 @@ module.exports = Origin; /***/ }), -/* 584 */ +/* 623 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -132816,10 +140455,10 @@ module.exports = Origin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DegToRad = __webpack_require__(41); -var GetBoolean = __webpack_require__(90); +var DegToRad = __webpack_require__(34); +var GetBoolean = __webpack_require__(95); var GetValue = __webpack_require__(6); -var TWEEN_CONST = __webpack_require__(91); +var TWEEN_CONST = __webpack_require__(96); var Vector2 = __webpack_require__(3); /** @@ -132914,7 +140553,7 @@ var PathFollower = { * Records the direction of the follower so it can change direction. * * @name Phaser.GameObjects.PathFollower#_prevDirection - * @type {integer} + * @type {number} * @private * @since 3.0.0 */ @@ -133234,7 +140873,7 @@ module.exports = PathFollower; /***/ }), -/* 585 */ +/* 624 */ /***/ (function(module, exports) { /** @@ -133421,7 +141060,7 @@ module.exports = Size; /***/ }), -/* 586 */ +/* 625 */ /***/ (function(module, exports) { /** @@ -133479,7 +141118,7 @@ var Texture = { * @since 3.0.0 * * @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Game Object instance. */ @@ -133503,7 +141142,7 @@ var Texture = { * @method Phaser.GameObjects.Components.Texture#setFrame * @since 3.0.0 * - * @param {(string|integer)} frame - The name or index of the frame within the Texture. + * @param {(string|number)} frame - The name or index of the frame within the Texture. * @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object? * @param {boolean} [updateOrigin=true] - Should this call adjust the origin of the Game Object? * @@ -133551,7 +141190,7 @@ module.exports = Texture; /***/ }), -/* 587 */ +/* 626 */ /***/ (function(module, exports) { /** @@ -133603,24 +141242,24 @@ var TextureCrop = { /** * Applies a crop to a texture based Game Object, such as a Sprite or Image. - * + * * The crop is a rectangle that limits the area of the texture frame that is visible during rendering. - * + * * Cropping a Game Object does not change its size, dimensions, physics body or hit area, it just * changes what is shown when rendered. - * + * * The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left. - * + * * Therefore, if you had a Game Object that had an 800x600 sized texture, and you wanted to show only the left * half of it, you could call `setCrop(0, 0, 400, 600)`. - * + * * It is also scaled to match the Game Object scale automatically. Therefore a crop rect of 100x50 would crop * an area of 200x100 when applied to a Game Object that had a scale factor of 2. - * + * * You can either pass in numeric values directly, or you can provide a single Rectangle object as the first argument. - * + * * Call this method with no arguments at all to reset the crop, or toggle the property `isCropped` to `false`. - * + * * You should do this if the crop rectangle becomes the same size as the frame itself, as it will allow * the renderer to skip several internal calculations. * @@ -133668,7 +141307,7 @@ var TextureCrop = { * @since 3.0.0 * * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. * * @return {this} This Game Object instance. */ @@ -133692,7 +141331,7 @@ var TextureCrop = { * @method Phaser.GameObjects.Components.TextureCrop#setFrame * @since 3.0.0 * - * @param {(string|integer)} frame - The name or index of the frame within the Texture. + * @param {(string|number)} frame - The name or index of the frame within the Texture. * @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object? * @param {boolean} [updateOrigin=true] - Should this call adjust the origin of the Game Object? * @@ -133745,7 +141384,7 @@ var TextureCrop = { * @method Phaser.GameObjects.Components.TextureCrop#resetCropObject * @private * @since 3.12.0 - * + * * @return {object} The crop object. */ resetCropObject: function () @@ -133759,8 +141398,8 @@ module.exports = TextureCrop; /***/ }), -/* 588 */ -/***/ (function(module, exports, __webpack_require__) { +/* 627 */ +/***/ (function(module, exports) { /** * @author Richard Davey @@ -133768,8 +141407,6 @@ module.exports = TextureCrop; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetColorFromValue = __webpack_require__(119); - /** * Provides methods used for setting the tint of a Game Object. * Should be applied as a mixin and not used directly. @@ -133782,62 +141419,58 @@ var GetColorFromValue = __webpack_require__(119); var Tint = { /** - * Private internal value. Holds the top-left tint value. + * The tint value being applied to the top-left vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @name Phaser.GameObjects.Components.Tint#_tintTL + * @name Phaser.GameObjects.Components.Tint#tintTopLeft * @type {number} - * @private - * @default 16777215 + * @default 0xffffff * @since 3.0.0 */ - _tintTL: 16777215, + tintTopLeft: 0xffffff, /** - * Private internal value. Holds the top-right tint value. + * The tint value being applied to the top-right vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @name Phaser.GameObjects.Components.Tint#_tintTR + * @name Phaser.GameObjects.Components.Tint#tintTopRight * @type {number} - * @private - * @default 16777215 + * @default 0xffffff * @since 3.0.0 */ - _tintTR: 16777215, + tintTopRight: 0xffffff, /** - * Private internal value. Holds the bottom-left tint value. + * The tint value being applied to the bottom-left vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @name Phaser.GameObjects.Components.Tint#_tintBL + * @name Phaser.GameObjects.Components.Tint#tintBottomLeft * @type {number} - * @private - * @default 16777215 + * @default 0xffffff * @since 3.0.0 */ - _tintBL: 16777215, + tintBottomLeft: 0xffffff, /** - * Private internal value. Holds the bottom-right tint value. + * The tint value being applied to the bottom-right vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @name Phaser.GameObjects.Components.Tint#_tintBR + * @name Phaser.GameObjects.Components.Tint#tintBottomRight * @type {number} - * @private - * @default 16777215 + * @default 0xffffff * @since 3.0.0 */ - _tintBR: 16777215, + tintBottomRight: 0xffffff, /** - * Private internal value. Holds if the Game Object is tinted or not. + * The tint fill mode. * - * @name Phaser.GameObjects.Components.Tint#_isTinted - * @type {boolean} - * @private - * @default false - * @since 3.11.0 - */ - _isTinted: false, - - /** - * Fill or additive? + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. * * @name Phaser.GameObjects.Components.Tint#tintFill * @type {boolean} @@ -133862,8 +141495,6 @@ var Tint = { { this.setTint(0xffffff); - this._isTinted = false; - return this; }, @@ -133887,10 +141518,10 @@ var Tint = { * @webglOnly * @since 3.0.0 * - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If no other values are given this value is applied evenly, tinting the whole Game Object. - * @param {integer} [topRight] - The tint being applied to the top-right of the Game Object. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the Game Object. + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If no other values are given this value is applied evenly, tinting the whole Game Object. + * @param {number} [topRight] - The tint being applied to the top-right of the Game Object. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the Game Object. * * @return {this} This Game Object instance. */ @@ -133905,12 +141536,10 @@ var Tint = { bottomRight = topLeft; } - this._tintTL = GetColorFromValue(topLeft); - this._tintTR = GetColorFromValue(topRight); - this._tintBL = GetColorFromValue(bottomLeft); - this._tintBR = GetColorFromValue(bottomRight); - - this._isTinted = true; + this.tintTopLeft = topLeft; + this.tintTopRight = topRight; + this.tintBottomLeft = bottomLeft; + this.tintBottomRight = bottomRight; this.tintFill = false; @@ -133938,10 +141567,10 @@ var Tint = { * @webglOnly * @since 3.11.0 * - * @param {integer} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. - * @param {integer} [topRight] - The tint being applied to the top-right of the Game Object. - * @param {integer} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. - * @param {integer} [bottomRight] - The tint being applied to the bottom-right of the Game Object. + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. + * @param {number} [topRight] - The tint being applied to the top-right of the Game Object. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the Game Object. * * @return {this} This Game Object instance. */ @@ -133954,108 +141583,12 @@ var Tint = { return this; }, - /** - * The tint value being applied to the top-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintTopLeft - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tintTopLeft: { - - get: function () - { - return this._tintTL; - }, - - set: function (value) - { - this._tintTL = GetColorFromValue(value); - this._isTinted = true; - } - - }, - - /** - * The tint value being applied to the top-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintTopRight - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tintTopRight: { - - get: function () - { - return this._tintTR; - }, - - set: function (value) - { - this._tintTR = GetColorFromValue(value); - this._isTinted = true; - } - - }, - - /** - * The tint value being applied to the bottom-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintBottomLeft - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tintBottomLeft: { - - get: function () - { - return this._tintBL; - }, - - set: function (value) - { - this._tintBL = GetColorFromValue(value); - this._isTinted = true; - } - - }, - - /** - * The tint value being applied to the bottom-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Tint#tintBottomRight - * @type {integer} - * @webglOnly - * @since 3.0.0 - */ - tintBottomRight: { - - get: function () - { - return this._tintBR; - }, - - set: function (value) - { - this._tintBR = GetColorFromValue(value); - this._isTinted = true; - } - - }, - /** * The tint value being applied to the whole of the Game Object. * This property is a setter-only. Use the properties `tintTopLeft` etc to read the current tint value. * * @name Phaser.GameObjects.Components.Tint#tint - * @type {integer} + * @type {number} * @webglOnly * @since 3.0.0 */ @@ -134068,7 +141601,10 @@ var Tint = { }, /** - * Does this Game Object have a tint applied to it or not? + * Does this Game Object have a tint applied? + * + * It checks to see if the 4 tint properties are set to the value 0xffffff + * and that the `tintFill` property is `false`. This indicates that a Game Object isn't tinted. * * @name Phaser.GameObjects.Components.Tint#isTinted * @type {boolean} @@ -134080,7 +141616,15 @@ var Tint = { get: function () { - return this._isTinted; + var white = 0xffffff; + + return ( + this.tintFill || + this.tintTopLeft !== white || + this.tintTopRight !== white || + this.tintBottomLeft !== white || + this.tintBottomRight !== white + ); } } @@ -134091,7 +141635,7 @@ module.exports = Tint; /***/ }), -/* 589 */ +/* 628 */ /***/ (function(module, exports) { /** @@ -134123,7 +141667,7 @@ module.exports = 'changedata'; /***/ }), -/* 590 */ +/* 629 */ /***/ (function(module, exports) { /** @@ -134153,7 +141697,28 @@ module.exports = 'changedata-'; /***/ }), -/* 591 */ +/* 630 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Data Manager Destroy Event. + * + * The Data Manager will listen for the destroy event from its parent, and then close itself down. + * + * @event Phaser.Data.Events#DESTROY + * @since 3.50.0 + */ +module.exports = 'destroy'; + + +/***/ }), +/* 631 */ /***/ (function(module, exports) { /** @@ -134181,7 +141746,7 @@ module.exports = 'removedata'; /***/ }), -/* 592 */ +/* 632 */ /***/ (function(module, exports) { /** @@ -134209,7 +141774,7 @@ module.exports = 'setdata'; /***/ }), -/* 593 */ +/* 633 */ /***/ (function(module, exports) { /** @@ -134235,7 +141800,7 @@ module.exports = 'addedtoscene'; /***/ }), -/* 594 */ +/* 634 */ /***/ (function(module, exports) { /** @@ -134260,7 +141825,7 @@ module.exports = 'destroy'; /***/ }), -/* 595 */ +/* 635 */ /***/ (function(module, exports) { /** @@ -134286,7 +141851,7 @@ module.exports = 'removedfromscene'; /***/ }), -/* 596 */ +/* 636 */ /***/ (function(module, exports) { /** @@ -134318,7 +141883,7 @@ module.exports = 'complete'; /***/ }), -/* 597 */ +/* 637 */ /***/ (function(module, exports) { /** @@ -134340,14 +141905,14 @@ module.exports = 'complete'; * @since 3.20.0 * * @param {Phaser.GameObjects.Video} video - The Video Game Object which raised the event. - * @param {integer} width - The width of the video. - * @param {integer} height - The height of the video. + * @param {number} width - The width of the video. + * @param {number} height - The height of the video. */ module.exports = 'created'; /***/ }), -/* 598 */ +/* 638 */ /***/ (function(module, exports) { /** @@ -134373,7 +141938,7 @@ module.exports = 'error'; /***/ }), -/* 599 */ +/* 639 */ /***/ (function(module, exports) { /** @@ -134405,7 +141970,7 @@ module.exports = 'loop'; /***/ }), -/* 600 */ +/* 640 */ /***/ (function(module, exports) { /** @@ -134433,7 +141998,7 @@ module.exports = 'play'; /***/ }), -/* 601 */ +/* 641 */ /***/ (function(module, exports) { /** @@ -134458,7 +142023,7 @@ module.exports = 'seeked'; /***/ }), -/* 602 */ +/* 642 */ /***/ (function(module, exports) { /** @@ -134484,7 +142049,7 @@ module.exports = 'seeking'; /***/ }), -/* 603 */ +/* 643 */ /***/ (function(module, exports) { /** @@ -134510,7 +142075,7 @@ module.exports = 'stop'; /***/ }), -/* 604 */ +/* 644 */ /***/ (function(module, exports) { /** @@ -134536,7 +142101,7 @@ module.exports = 'timeout'; /***/ }), -/* 605 */ +/* 645 */ /***/ (function(module, exports) { /** @@ -134562,7 +142127,7 @@ module.exports = 'unlocked'; /***/ }), -/* 606 */ +/* 646 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -134571,7 +142136,7 @@ module.exports = 'unlocked'; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `alpha` property, @@ -134589,8 +142154,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `alpha` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -134603,7 +142168,7 @@ module.exports = IncAlpha; /***/ }), -/* 607 */ +/* 647 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -134612,7 +142177,7 @@ module.exports = IncAlpha; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `x` property, @@ -134630,8 +142195,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `x` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -134644,7 +142209,7 @@ module.exports = IncX; /***/ }), -/* 608 */ +/* 648 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -134653,7 +142218,7 @@ module.exports = IncX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, @@ -134673,8 +142238,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {number} [y=x] - The amount to be added to the `y` property. If `undefined` or `null` it uses the `x` value. * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -134691,7 +142256,7 @@ module.exports = IncXY; /***/ }), -/* 609 */ +/* 649 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -134700,7 +142265,7 @@ module.exports = IncXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `y` property, @@ -134718,8 +142283,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `y` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -134732,7 +142297,7 @@ module.exports = IncY; /***/ }), -/* 610 */ +/* 650 */ /***/ (function(module, exports) { /** @@ -134781,7 +142346,7 @@ module.exports = PlaceOnCircle; /***/ }), -/* 611 */ +/* 651 */ /***/ (function(module, exports) { /** @@ -134833,7 +142398,7 @@ module.exports = PlaceOnEllipse; /***/ }), -/* 612 */ +/* 652 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -134842,7 +142407,7 @@ module.exports = PlaceOnEllipse; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetPoints = __webpack_require__(162); +var GetPoints = __webpack_require__(163); /** * Positions an array of Game Objects on evenly spaced points of a Line. @@ -134877,7 +142442,7 @@ module.exports = PlaceOnLine; /***/ }), -/* 613 */ +/* 653 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -134886,9 +142451,9 @@ module.exports = PlaceOnLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MarchingAnts = __webpack_require__(294); -var RotateLeft = __webpack_require__(295); -var RotateRight = __webpack_require__(296); +var MarchingAnts = __webpack_require__(308); +var RotateLeft = __webpack_require__(170); +var RotateRight = __webpack_require__(171); /** * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Rectangle. @@ -134903,7 +142468,7 @@ var RotateRight = __webpack_require__(296); * * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. * @param {Phaser.Geom.Rectangle} rect - The Rectangle to position the Game Objects on. - * @param {integer} [shift=1] - An optional positional offset. + * @param {number} [shift=1] - An optional positional offset. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ @@ -134935,7 +142500,7 @@ module.exports = PlaceOnRectangle; /***/ }), -/* 614 */ +/* 654 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -134944,7 +142509,7 @@ module.exports = PlaceOnRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BresenhamPoints = __webpack_require__(297); +var BresenhamPoints = __webpack_require__(309); /** * Takes an array of Game Objects and positions them on evenly spaced points around the edges of a Triangle. @@ -134996,7 +142561,7 @@ module.exports = PlaceOnTriangle; /***/ }), -/* 615 */ +/* 655 */ /***/ (function(module, exports) { /** @@ -135015,7 +142580,7 @@ module.exports = PlaceOnTriangle; * * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. * @param {string} key - The name of the animation to play. - * @param {(string|integer)} [startFrame] - The starting frame of the animation with the given key. + * @param {(string|number)} [startFrame] - The starting frame of the animation with the given key. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ @@ -135033,7 +142598,7 @@ module.exports = PlayAnimation; /***/ }), -/* 616 */ +/* 656 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135042,7 +142607,7 @@ module.exports = PlayAnimation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(160); +var Random = __webpack_require__(161); /** * Takes an array of Game Objects and positions them at random locations within the Circle. @@ -135073,7 +142638,7 @@ module.exports = RandomCircle; /***/ }), -/* 617 */ +/* 657 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135082,7 +142647,7 @@ module.exports = RandomCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(167); +var Random = __webpack_require__(172); /** * Takes an array of Game Objects and positions them at random locations within the Ellipse. @@ -135113,7 +142678,7 @@ module.exports = RandomEllipse; /***/ }), -/* 618 */ +/* 658 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135122,7 +142687,7 @@ module.exports = RandomEllipse; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(163); +var Random = __webpack_require__(164); /** * Takes an array of Game Objects and positions them at random locations on the Line. @@ -135153,7 +142718,7 @@ module.exports = RandomLine; /***/ }), -/* 619 */ +/* 659 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135162,7 +142727,7 @@ module.exports = RandomLine; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(164); +var Random = __webpack_require__(165); /** * Takes an array of Game Objects and positions them at random locations within the Rectangle. @@ -135191,7 +142756,7 @@ module.exports = RandomRectangle; /***/ }), -/* 620 */ +/* 660 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135200,7 +142765,7 @@ module.exports = RandomRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Random = __webpack_require__(168); +var Random = __webpack_require__(173); /** * Takes an array of Game Objects and positions them at random locations within the Triangle. @@ -135231,7 +142796,7 @@ module.exports = RandomTriangle; /***/ }), -/* 621 */ +/* 661 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135240,7 +142805,7 @@ module.exports = RandomTriangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `rotation` property, @@ -135258,8 +142823,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `rotation` property (in radians). * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135272,7 +142837,7 @@ module.exports = Rotate; /***/ }), -/* 622 */ +/* 662 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135281,8 +142846,8 @@ module.exports = Rotate; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundDistance = __webpack_require__(169); -var DistanceBetween = __webpack_require__(55); +var RotateAroundDistance = __webpack_require__(174); +var DistanceBetween = __webpack_require__(61); /** * Rotates each item around the given point by the given angle. @@ -135318,7 +142883,7 @@ module.exports = RotateAround; /***/ }), -/* 623 */ +/* 663 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135327,7 +142892,7 @@ module.exports = RotateAround; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MathRotateAroundDistance = __webpack_require__(169); +var MathRotateAroundDistance = __webpack_require__(174); /** * Rotates an array of Game Objects around a point by the given angle and distance. @@ -135367,7 +142932,7 @@ module.exports = RotateAroundDistance; /***/ }), -/* 624 */ +/* 664 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135376,7 +142941,7 @@ module.exports = RotateAroundDistance; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `scaleX` property, @@ -135394,8 +142959,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `scaleX` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135408,7 +142973,7 @@ module.exports = ScaleX; /***/ }), -/* 625 */ +/* 665 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135417,7 +142982,7 @@ module.exports = ScaleX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have public `scaleX` and `scaleY` properties, @@ -135437,8 +143002,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {number} [scaleY] - The amount to be added to the `scaleY` property. If `undefined` or `null` it uses the `scaleX` value. * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135455,7 +143020,7 @@ module.exports = ScaleXY; /***/ }), -/* 626 */ +/* 666 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135464,7 +143029,7 @@ module.exports = ScaleXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(39); +var PropertyValueInc = __webpack_require__(44); /** * Takes an array of Game Objects, or any objects that have a public `scaleY` property, @@ -135482,8 +143047,8 @@ var PropertyValueInc = __webpack_require__(39); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to be added to the `scaleY` property. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135496,7 +143061,7 @@ module.exports = ScaleY; /***/ }), -/* 627 */ +/* 667 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135505,7 +143070,7 @@ module.exports = ScaleY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `alpha` @@ -135523,8 +143088,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135537,7 +143102,7 @@ module.exports = SetAlpha; /***/ }), -/* 628 */ +/* 668 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135546,7 +143111,7 @@ module.exports = SetAlpha; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `blendMode` @@ -135563,8 +143128,8 @@ var PropertyValueSet = __webpack_require__(25); * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135577,7 +143142,7 @@ module.exports = SetBlendMode; /***/ }), -/* 629 */ +/* 669 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135586,7 +143151,7 @@ module.exports = SetBlendMode; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `depth` @@ -135604,8 +143169,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135618,7 +143183,7 @@ module.exports = SetDepth; /***/ }), -/* 630 */ +/* 670 */ /***/ (function(module, exports) { /** @@ -135657,7 +143222,7 @@ module.exports = SetHitArea; /***/ }), -/* 631 */ +/* 671 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135666,7 +143231,7 @@ module.exports = SetHitArea; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `originX` and `originY` @@ -135686,8 +143251,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {number} [originY] - The amount to set the `originY` property to. If `undefined` or `null` it uses the `originX` value. * @param {number} [stepX=0] - This is added to the `originX` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `originY` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135710,7 +143275,7 @@ module.exports = SetOrigin; /***/ }), -/* 632 */ +/* 672 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135719,7 +143284,7 @@ module.exports = SetOrigin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `rotation` @@ -135737,8 +143302,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135751,7 +143316,7 @@ module.exports = SetRotation; /***/ }), -/* 633 */ +/* 673 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135760,7 +143325,7 @@ module.exports = SetRotation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `scaleX` and `scaleY` @@ -135780,8 +143345,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {number} [scaleY] - The amount to set the `scaleY` property to. If `undefined` or `null` it uses the `scaleX` value. * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135798,7 +143363,7 @@ module.exports = SetScale; /***/ }), -/* 634 */ +/* 674 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135807,7 +143372,7 @@ module.exports = SetScale; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scaleX` @@ -135825,8 +143390,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135839,7 +143404,7 @@ module.exports = SetScaleX; /***/ }), -/* 635 */ +/* 675 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135848,7 +143413,7 @@ module.exports = SetScaleX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scaleY` @@ -135866,8 +143431,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135880,7 +143445,7 @@ module.exports = SetScaleY; /***/ }), -/* 636 */ +/* 676 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135889,7 +143454,7 @@ module.exports = SetScaleY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `scrollFactorX` and `scrollFactorY` @@ -135909,8 +143474,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {number} [scrollFactorY] - The amount to set the `scrollFactorY` property to. If `undefined` or `null` it uses the `scrollFactorX` value. * @param {number} [stepX=0] - This is added to the `scrollFactorX` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `scrollFactorY` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135927,7 +143492,7 @@ module.exports = SetScrollFactor; /***/ }), -/* 637 */ +/* 677 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135936,7 +143501,7 @@ module.exports = SetScrollFactor; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scrollFactorX` @@ -135954,8 +143519,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -135968,7 +143533,7 @@ module.exports = SetScrollFactorX; /***/ }), -/* 638 */ +/* 678 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -135977,7 +143542,7 @@ module.exports = SetScrollFactorX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `scrollFactorY` @@ -135995,8 +143560,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -136009,7 +143574,7 @@ module.exports = SetScrollFactorY; /***/ }), -/* 639 */ +/* 679 */ /***/ (function(module, exports) { /** @@ -136048,7 +143613,7 @@ module.exports = SetTint; /***/ }), -/* 640 */ +/* 680 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136057,7 +143622,7 @@ module.exports = SetTint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `visible` @@ -136072,8 +143637,8 @@ var PropertyValueSet = __webpack_require__(25); * * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {boolean} value - The value to set the property to. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -136086,7 +143651,7 @@ module.exports = SetVisible; /***/ }), -/* 641 */ +/* 681 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136095,7 +143660,7 @@ module.exports = SetVisible; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `x` @@ -136113,8 +143678,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -136127,7 +143692,7 @@ module.exports = SetX; /***/ }), -/* 642 */ +/* 682 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136136,7 +143701,7 @@ module.exports = SetX; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public properties `x` and `y` @@ -136156,8 +143721,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {number} [y=x] - The amount to set the `y` property to. If `undefined` or `null` it uses the `x` value. * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -136174,7 +143739,7 @@ module.exports = SetXY; /***/ }), -/* 643 */ +/* 683 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136183,7 +143748,7 @@ module.exports = SetXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(25); +var PropertyValueSet = __webpack_require__(27); /** * Takes an array of Game Objects, or any objects that have the public property `y` @@ -136201,8 +143766,8 @@ var PropertyValueSet = __webpack_require__(25); * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. * @param {number} value - The amount to set the property to. * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {integer} [index=0] - An optional offset to start searching from within the items array. - * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ @@ -136215,7 +143780,7 @@ module.exports = SetY; /***/ }), -/* 644 */ +/* 684 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136243,7 +143808,7 @@ var Vector2 = __webpack_require__(3); * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. * @param {number} x - The x coordinate to place the first item in the array at. * @param {number} y - The y coordinate to place the first item in the array at. - * @param {integer} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. + * @param {number} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. * @param {(Phaser.Math.Vector2|object)} [output] - An optional objec to store the final objects position in. * * @return {Phaser.Math.Vector2} The output vector. @@ -136345,7 +143910,7 @@ module.exports = ShiftPosition; /***/ }), -/* 645 */ +/* 685 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136354,7 +143919,7 @@ module.exports = ShiftPosition; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayShuffle = __webpack_require__(121); +var ArrayShuffle = __webpack_require__(127); /** * Shuffles the array in place. The shuffled array is both modified and returned. @@ -136378,7 +143943,7 @@ module.exports = Shuffle; /***/ }), -/* 646 */ +/* 686 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136387,7 +143952,7 @@ module.exports = Shuffle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MathSmootherStep = __webpack_require__(170); +var MathSmootherStep = __webpack_require__(175); /** * Smootherstep is a sigmoid-like interpolation and clamping function. @@ -136436,7 +144001,7 @@ module.exports = SmootherStep; /***/ }), -/* 647 */ +/* 687 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136445,7 +144010,7 @@ module.exports = SmootherStep; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MathSmoothStep = __webpack_require__(171); +var MathSmoothStep = __webpack_require__(176); /** * Smoothstep is a sigmoid-like interpolation and clamping function. @@ -136494,7 +144059,7 @@ module.exports = SmoothStep; /***/ }), -/* 648 */ +/* 688 */ /***/ (function(module, exports) { /** @@ -136557,7 +144122,7 @@ module.exports = Spread; /***/ }), -/* 649 */ +/* 689 */ /***/ (function(module, exports) { /** @@ -136593,7 +144158,7 @@ module.exports = ToggleVisible; /***/ }), -/* 650 */ +/* 690 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136603,7 +144168,7 @@ module.exports = ToggleVisible; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Wrap = __webpack_require__(59); +var Wrap = __webpack_require__(64); /** * Wrap each item's coordinates within a rectangle's area. @@ -136642,7 +144207,7 @@ module.exports = WrapInRectangle; /***/ }), -/* 651 */ +/* 691 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -136657,17 +144222,17 @@ module.exports = WrapInRectangle; module.exports = { - Animation: __webpack_require__(172), - AnimationFrame: __webpack_require__(299), - AnimationManager: __webpack_require__(301), + Animation: __webpack_require__(177), + AnimationFrame: __webpack_require__(311), + AnimationManager: __webpack_require__(313), AnimationState: __webpack_require__(157), - Events: __webpack_require__(122) + Events: __webpack_require__(128) }; /***/ }), -/* 652 */ +/* 692 */ /***/ (function(module, exports) { /** @@ -136694,7 +144259,7 @@ module.exports = 'add'; /***/ }), -/* 653 */ +/* 693 */ /***/ (function(module, exports) { /** @@ -136740,7 +144305,7 @@ module.exports = 'animationcomplete'; /***/ }), -/* 654 */ +/* 694 */ /***/ (function(module, exports) { /** @@ -136790,7 +144355,7 @@ module.exports = 'animationcomplete-'; /***/ }), -/* 655 */ +/* 695 */ /***/ (function(module, exports) { /** @@ -136833,7 +144398,7 @@ module.exports = 'animationrepeat'; /***/ }), -/* 656 */ +/* 696 */ /***/ (function(module, exports) { /** @@ -136874,7 +144439,7 @@ module.exports = 'animationrestart'; /***/ }), -/* 657 */ +/* 697 */ /***/ (function(module, exports) { /** @@ -136916,7 +144481,7 @@ module.exports = 'animationstart'; /***/ }), -/* 658 */ +/* 698 */ /***/ (function(module, exports) { /** @@ -136958,7 +144523,7 @@ module.exports = 'animationstop'; /***/ }), -/* 659 */ +/* 699 */ /***/ (function(module, exports) { /** @@ -137004,7 +144569,7 @@ module.exports = 'animationupdate'; /***/ }), -/* 660 */ +/* 700 */ /***/ (function(module, exports) { /** @@ -137028,7 +144593,7 @@ module.exports = 'pauseall'; /***/ }), -/* 661 */ +/* 701 */ /***/ (function(module, exports) { /** @@ -137052,7 +144617,7 @@ module.exports = 'remove'; /***/ }), -/* 662 */ +/* 702 */ /***/ (function(module, exports) { /** @@ -137075,7 +144640,7 @@ module.exports = 'resumeall'; /***/ }), -/* 663 */ +/* 703 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -137090,15 +144655,15 @@ module.exports = 'resumeall'; module.exports = { - BaseCache: __webpack_require__(303), - CacheManager: __webpack_require__(305), - Events: __webpack_require__(304) + BaseCache: __webpack_require__(315), + CacheManager: __webpack_require__(317), + Events: __webpack_require__(316) }; /***/ }), -/* 664 */ +/* 704 */ /***/ (function(module, exports) { /** @@ -137123,7 +144688,7 @@ module.exports = 'add'; /***/ }), -/* 665 */ +/* 705 */ /***/ (function(module, exports) { /** @@ -137148,7 +144713,7 @@ module.exports = 'remove'; /***/ }), -/* 666 */ +/* 706 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -137167,14 +144732,14 @@ module.exports = 'remove'; module.exports = { - Controls: __webpack_require__(667), - Scene2D: __webpack_require__(670) + Controls: __webpack_require__(707), + Scene2D: __webpack_require__(710) }; /***/ }), -/* 667 */ +/* 707 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -137189,14 +144754,14 @@ module.exports = { module.exports = { - FixedKeyControl: __webpack_require__(668), - SmoothedKeyControl: __webpack_require__(669) + FixedKeyControl: __webpack_require__(708), + SmoothedKeyControl: __webpack_require__(709) }; /***/ }), -/* 668 */ +/* 708 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -137502,7 +145067,7 @@ module.exports = FixedKeyControl; /***/ }), -/* 669 */ +/* 709 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -137985,7 +145550,7 @@ module.exports = SmoothedKeyControl; /***/ }), -/* 670 */ +/* 710 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138000,17 +145565,17 @@ module.exports = SmoothedKeyControl; module.exports = { - Camera: __webpack_require__(306), - BaseCamera: __webpack_require__(93), - CameraManager: __webpack_require__(726), - Effects: __webpack_require__(314), - Events: __webpack_require__(42) + Camera: __webpack_require__(318), + BaseCamera: __webpack_require__(99), + CameraManager: __webpack_require__(767), + Effects: __webpack_require__(325), + Events: __webpack_require__(35) }; /***/ }), -/* 671 */ +/* 711 */ /***/ (function(module, exports) { /** @@ -138033,7 +145598,7 @@ module.exports = 'cameradestroy'; /***/ }), -/* 672 */ +/* 712 */ /***/ (function(module, exports) { /** @@ -138059,7 +145624,7 @@ module.exports = 'camerafadeincomplete'; /***/ }), -/* 673 */ +/* 713 */ /***/ (function(module, exports) { /** @@ -138080,16 +145645,16 @@ module.exports = 'camerafadeincomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. + * @param {number} duration - The duration of the effect. + * @param {number} red - The red color channel value. + * @param {number} green - The green color channel value. + * @param {number} blue - The blue color channel value. */ module.exports = 'camerafadeinstart'; /***/ }), -/* 674 */ +/* 714 */ /***/ (function(module, exports) { /** @@ -138115,7 +145680,7 @@ module.exports = 'camerafadeoutcomplete'; /***/ }), -/* 675 */ +/* 715 */ /***/ (function(module, exports) { /** @@ -138136,16 +145701,16 @@ module.exports = 'camerafadeoutcomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. + * @param {number} duration - The duration of the effect. + * @param {number} red - The red color channel value. + * @param {number} green - The green color channel value. + * @param {number} blue - The blue color channel value. */ module.exports = 'camerafadeoutstart'; /***/ }), -/* 676 */ +/* 716 */ /***/ (function(module, exports) { /** @@ -138169,7 +145734,7 @@ module.exports = 'cameraflashcomplete'; /***/ }), -/* 677 */ +/* 717 */ /***/ (function(module, exports) { /** @@ -138188,16 +145753,44 @@ module.exports = 'cameraflashcomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. - * @param {integer} red - The red color channel value. - * @param {integer} green - The green color channel value. - * @param {integer} blue - The blue color channel value. + * @param {number} duration - The duration of the effect. + * @param {number} red - The red color channel value. + * @param {number} green - The green color channel value. + * @param {number} blue - The blue color channel value. */ module.exports = 'cameraflashstart'; /***/ }), -/* 678 */ +/* 718 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Camera Follower Update Event. + * + * This event is dispatched by a Camera instance when it is following a + * Game Object and the Camera position has been updated as a result of + * that following. + * + * Listen to it from a Camera instance using: `camera.on('followupdate', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FOLLOW_UPDATE + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that emitted the event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the camera is following. + */ +module.exports = 'followupdate'; + + +/***/ }), +/* 719 */ /***/ (function(module, exports) { /** @@ -138221,7 +145814,7 @@ module.exports = 'camerapancomplete'; /***/ }), -/* 679 */ +/* 720 */ /***/ (function(module, exports) { /** @@ -138240,7 +145833,7 @@ module.exports = 'camerapancomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. + * @param {number} duration - The duration of the effect. * @param {number} x - The destination scroll x coordinate. * @param {number} y - The destination scroll y coordinate. */ @@ -138248,7 +145841,7 @@ module.exports = 'camerapanstart'; /***/ }), -/* 680 */ +/* 721 */ /***/ (function(module, exports) { /** @@ -138274,7 +145867,7 @@ module.exports = 'postrender'; /***/ }), -/* 681 */ +/* 722 */ /***/ (function(module, exports) { /** @@ -138300,7 +145893,7 @@ module.exports = 'prerender'; /***/ }), -/* 682 */ +/* 723 */ /***/ (function(module, exports) { /** @@ -138324,7 +145917,7 @@ module.exports = 'camerarotatecomplete'; /***/ }), -/* 683 */ +/* 724 */ /***/ (function(module, exports) { /** @@ -138343,14 +145936,14 @@ module.exports = 'camerarotatecomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.RotateTo} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. + * @param {number} duration - The duration of the effect. * @param {number} destination - The destination value. */ module.exports = 'camerarotatestart'; /***/ }), -/* 684 */ +/* 725 */ /***/ (function(module, exports) { /** @@ -138374,7 +145967,7 @@ module.exports = 'camerashakecomplete'; /***/ }), -/* 685 */ +/* 726 */ /***/ (function(module, exports) { /** @@ -138393,14 +145986,14 @@ module.exports = 'camerashakecomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. + * @param {number} duration - The duration of the effect. * @param {number} intensity - The intensity of the effect. */ module.exports = 'camerashakestart'; /***/ }), -/* 686 */ +/* 727 */ /***/ (function(module, exports) { /** @@ -138424,7 +146017,7 @@ module.exports = 'camerazoomcomplete'; /***/ }), -/* 687 */ +/* 728 */ /***/ (function(module, exports) { /** @@ -138443,14 +146036,14 @@ module.exports = 'camerazoomcomplete'; * * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - * @param {integer} duration - The duration of the effect. + * @param {number} duration - The duration of the effect. * @param {number} zoom - The destination zoom value. */ module.exports = 'camerazoomstart'; /***/ }), -/* 688 */ +/* 729 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138459,9 +146052,9 @@ module.exports = 'camerazoomstart'; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(42); +var Events = __webpack_require__(35); /** * @classdesc @@ -138538,7 +146131,7 @@ var Fade = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Fade#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.5.0 @@ -138550,7 +146143,7 @@ var Fade = new Class({ * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Fade#red - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -138561,7 +146154,7 @@ var Fade = new Class({ * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Fade#green - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -138572,7 +146165,7 @@ var Fade = new Class({ * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Fade#blue - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -138639,10 +146232,10 @@ var Fade = new Class({ * @since 3.5.0 * * @param {boolean} [direction=true] - The direction of the fade. `true` = fade out (transparent to color), `false` = fade in (color to transparent) - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. - * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraFadeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -138695,7 +146288,7 @@ var Fade = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Fade#update * @since 3.5.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -138745,7 +146338,7 @@ var Fade = new Class({ var camera = this.camera; ctx.fillStyle = 'rgba(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')'; - ctx.fillRect(camera._cx, camera._cy, camera._cw, camera._ch); + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); return true; }, @@ -138770,12 +146363,12 @@ var Fade = new Class({ var camera = this.camera; var red = this.red / 255; - var blue = this.blue / 255; var green = this.green / 255; + var blue = this.blue / 255; pipeline.drawFillRect( - camera._cx, camera._cy, camera._cw, camera._ch, - getTintFunction(red, green, blue, 1), + camera.x, camera.y, camera.width, camera.height, + getTintFunction(blue, green, red, 1), this.alpha ); @@ -138838,7 +146431,7 @@ module.exports = Fade; /***/ }), -/* 689 */ +/* 730 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -138847,9 +146440,9 @@ module.exports = Fade; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(42); +var Events = __webpack_require__(35); /** * @classdesc @@ -138901,7 +146494,7 @@ var Flash = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Flash#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.5.0 @@ -138909,40 +146502,40 @@ var Flash = new Class({ this.duration = 0; /** - * The value of the red color channel the camera will use for the fade effect. + * The value of the red color channel the camera will use for the flash effect. * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Flash#red - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ this.red = 0; /** - * The value of the green color channel the camera will use for the fade effect. + * The value of the green color channel the camera will use for the flash effect. * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Flash#green - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ this.green = 0; /** - * The value of the blue color channel the camera will use for the fade effect. + * The value of the blue color channel the camera will use for the flash effect. * A value between 0 and 255. * * @name Phaser.Cameras.Scene2D.Effects.Flash#blue - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ this.blue = 0; /** - * The value of the alpha channel used during the fade effect. + * The value of the alpha channel used during the flash effect. * A value between 0 and 1. * * @name Phaser.Cameras.Scene2D.Effects.Flash#alpha @@ -139001,10 +146594,10 @@ var Flash = new Class({ * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE * @since 3.5.0 * - * @param {integer} [duration=250] - The duration of the effect in milliseconds. - * @param {integer} [red=255] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {integer} [green=255] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {integer} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {number} [duration=250] - The duration of the effect in milliseconds. + * @param {number} [red=255] - The amount to flash the red channel towards. A value between 0 and 255. + * @param {number} [green=255] - The amount to flash the green channel towards. A value between 0 and 255. + * @param {number} [blue=255] - The amount to flash the blue channel towards. A value between 0 and 255. * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraFlashCallback} [callback] - This callback will be invoked every frame for the duration of the effect. * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. @@ -139052,7 +146645,7 @@ var Flash = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Flash#update * @since 3.5.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -139101,7 +146694,7 @@ var Flash = new Class({ var camera = this.camera; ctx.fillStyle = 'rgba(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')'; - ctx.fillRect(camera._cx, camera._cy, camera._cw, camera._ch); + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); return true; }, @@ -139126,12 +146719,12 @@ var Flash = new Class({ var camera = this.camera; var red = this.red / 255; - var blue = this.blue / 255; var green = this.green / 255; + var blue = this.blue / 255; pipeline.drawFillRect( - camera._cx, camera._cy, camera._cw, camera._ch, - getTintFunction(red, green, blue, 1), + camera.x, camera.y, camera.width, camera.height, + getTintFunction(blue, green, red, 1), this.alpha ); @@ -139189,7 +146782,7 @@ module.exports = Flash; /***/ }), -/* 690 */ +/* 731 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -139198,10 +146791,10 @@ module.exports = Flash; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var EaseMap = __webpack_require__(123); -var Events = __webpack_require__(42); +var EaseMap = __webpack_require__(129); +var Events = __webpack_require__(35); var Vector2 = __webpack_require__(3); /** @@ -139255,7 +146848,7 @@ var Pan = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Pan#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.11.0 @@ -139350,7 +146943,7 @@ var Pan = new Class({ * * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -139414,7 +147007,7 @@ var Pan = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Pan#update * @since 3.11.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -139514,7 +147107,7 @@ module.exports = Pan; /***/ }), -/* 691 */ +/* 732 */ /***/ (function(module, exports) { /** @@ -139545,7 +147138,7 @@ module.exports = In; /***/ }), -/* 692 */ +/* 733 */ /***/ (function(module, exports) { /** @@ -139576,7 +147169,7 @@ module.exports = Out; /***/ }), -/* 693 */ +/* 734 */ /***/ (function(module, exports) { /** @@ -139616,7 +147209,7 @@ module.exports = InOut; /***/ }), -/* 694 */ +/* 735 */ /***/ (function(module, exports) { /** @@ -139661,7 +147254,7 @@ module.exports = In; /***/ }), -/* 695 */ +/* 736 */ /***/ (function(module, exports) { /** @@ -139704,7 +147297,7 @@ module.exports = Out; /***/ }), -/* 696 */ +/* 737 */ /***/ (function(module, exports) { /** @@ -139768,7 +147361,7 @@ module.exports = InOut; /***/ }), -/* 697 */ +/* 738 */ /***/ (function(module, exports) { /** @@ -139796,7 +147389,7 @@ module.exports = In; /***/ }), -/* 698 */ +/* 739 */ /***/ (function(module, exports) { /** @@ -139824,7 +147417,7 @@ module.exports = Out; /***/ }), -/* 699 */ +/* 740 */ /***/ (function(module, exports) { /** @@ -139859,7 +147452,7 @@ module.exports = InOut; /***/ }), -/* 700 */ +/* 741 */ /***/ (function(module, exports) { /** @@ -139887,7 +147480,7 @@ module.exports = In; /***/ }), -/* 701 */ +/* 742 */ /***/ (function(module, exports) { /** @@ -139915,7 +147508,7 @@ module.exports = Out; /***/ }), -/* 702 */ +/* 743 */ /***/ (function(module, exports) { /** @@ -139950,7 +147543,7 @@ module.exports = InOut; /***/ }), -/* 703 */ +/* 744 */ /***/ (function(module, exports) { /** @@ -140005,7 +147598,7 @@ module.exports = In; /***/ }), -/* 704 */ +/* 745 */ /***/ (function(module, exports) { /** @@ -140060,7 +147653,7 @@ module.exports = Out; /***/ }), -/* 705 */ +/* 746 */ /***/ (function(module, exports) { /** @@ -140122,7 +147715,7 @@ module.exports = InOut; /***/ }), -/* 706 */ +/* 747 */ /***/ (function(module, exports) { /** @@ -140150,7 +147743,7 @@ module.exports = In; /***/ }), -/* 707 */ +/* 748 */ /***/ (function(module, exports) { /** @@ -140178,7 +147771,7 @@ module.exports = Out; /***/ }), -/* 708 */ +/* 749 */ /***/ (function(module, exports) { /** @@ -140213,7 +147806,7 @@ module.exports = InOut; /***/ }), -/* 709 */ +/* 750 */ /***/ (function(module, exports) { /** @@ -140241,7 +147834,7 @@ module.exports = Linear; /***/ }), -/* 710 */ +/* 751 */ /***/ (function(module, exports) { /** @@ -140269,7 +147862,7 @@ module.exports = In; /***/ }), -/* 711 */ +/* 752 */ /***/ (function(module, exports) { /** @@ -140297,7 +147890,7 @@ module.exports = Out; /***/ }), -/* 712 */ +/* 753 */ /***/ (function(module, exports) { /** @@ -140332,7 +147925,7 @@ module.exports = InOut; /***/ }), -/* 713 */ +/* 754 */ /***/ (function(module, exports) { /** @@ -140360,7 +147953,7 @@ module.exports = In; /***/ }), -/* 714 */ +/* 755 */ /***/ (function(module, exports) { /** @@ -140388,7 +147981,7 @@ module.exports = Out; /***/ }), -/* 715 */ +/* 756 */ /***/ (function(module, exports) { /** @@ -140423,7 +148016,7 @@ module.exports = InOut; /***/ }), -/* 716 */ +/* 757 */ /***/ (function(module, exports) { /** @@ -140451,7 +148044,7 @@ module.exports = In; /***/ }), -/* 717 */ +/* 758 */ /***/ (function(module, exports) { /** @@ -140479,7 +148072,7 @@ module.exports = Out; /***/ }), -/* 718 */ +/* 759 */ /***/ (function(module, exports) { /** @@ -140514,7 +148107,7 @@ module.exports = InOut; /***/ }), -/* 719 */ +/* 760 */ /***/ (function(module, exports) { /** @@ -140553,7 +148146,7 @@ module.exports = In; /***/ }), -/* 720 */ +/* 761 */ /***/ (function(module, exports) { /** @@ -140592,7 +148185,7 @@ module.exports = Out; /***/ }), -/* 721 */ +/* 762 */ /***/ (function(module, exports) { /** @@ -140631,7 +148224,7 @@ module.exports = InOut; /***/ }), -/* 722 */ +/* 763 */ /***/ (function(module, exports) { /** @@ -140673,7 +148266,7 @@ module.exports = Stepped; /***/ }), -/* 723 */ +/* 764 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -140682,9 +148275,9 @@ module.exports = Stepped; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(42); +var Events = __webpack_require__(35); var Vector2 = __webpack_require__(3); /** @@ -140737,7 +148330,7 @@ var Shake = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Shake#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.5.0 @@ -140826,7 +148419,7 @@ var Shake = new Class({ * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE * @since 3.5.0 * - * @param {integer} [duration=100] - The duration of the effect in milliseconds. + * @param {number} [duration=100] - The duration of the effect in milliseconds. * @param {(number|Phaser.Math.Vector2)} [intensity=0.05] - The intensity of the shake. * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraShakeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -140893,7 +148486,7 @@ var Shake = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Shake#update * @since 3.5.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -140915,8 +148508,8 @@ var Shake = new Class({ if (this._elapsed < this.duration) { var intensity = this.intensity; - var width = this.camera._cw; - var height = this.camera._ch; + var width = this.camera.width; + var height = this.camera.height; var zoom = this.camera.zoom; this._offsetX = (Math.random() * intensity.x * width * 2 - intensity.x * width) * zoom; @@ -140992,7 +148585,7 @@ module.exports = Shake; /***/ }), -/* 724 */ +/* 765 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -141001,10 +148594,10 @@ module.exports = Shake; * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var Events = __webpack_require__(42); -var EaseMap = __webpack_require__(123); +var Events = __webpack_require__(35); +var EaseMap = __webpack_require__(129); /** * @classdesc @@ -141063,7 +148656,7 @@ var RotateTo = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.RotateTo#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.23.0 @@ -141184,7 +148777,7 @@ var RotateTo = new Class({ * * @param {number} radians - The destination angle in radians to rotate the Camera viewport to. If the angle is positive then the rotation is clockwise else anticlockwise * @param {boolean} [shortestPath=false] - If shortest path is set to true the camera will rotate in the quickest direction clockwise or anti-clockwise. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the Rotate. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the rotation effect to start immediately, even if already running. * @param {CameraRotateCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -141299,7 +148892,7 @@ var RotateTo = new Class({ * @method Phaser.Cameras.Scene2D.Effects.RotateTo#update * @since 3.23.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -141425,7 +149018,7 @@ module.exports = RotateTo; /***/ }), -/* 725 */ +/* 766 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -141434,10 +149027,10 @@ module.exports = RotateTo; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); -var EaseMap = __webpack_require__(123); -var Events = __webpack_require__(42); +var EaseMap = __webpack_require__(129); +var Events = __webpack_require__(35); /** * @classdesc @@ -141486,7 +149079,7 @@ var Zoom = new Class({ * The duration of the effect, in milliseconds. * * @name Phaser.Cameras.Scene2D.Effects.Zoom#duration - * @type {integer} + * @type {number} * @readonly * @default 0 * @since 3.11.0 @@ -141570,7 +149163,7 @@ var Zoom = new Class({ * @since 3.11.0 * * @param {number} zoom - The target Camera zoom value. - * @param {integer} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. * @param {(string|function)} [ease='Linear'] - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function. * @param {boolean} [force=false] - Force the zoom effect to start immediately, even if already running. * @param {Phaser.Types.Cameras.Scene2D.CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect. @@ -141631,7 +149224,7 @@ var Zoom = new Class({ * @method Phaser.Cameras.Scene2D.Effects.Zoom#update * @since 3.11.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -141718,7 +149311,7 @@ module.exports = Zoom; /***/ }), -/* 726 */ +/* 767 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -141727,24 +149320,24 @@ module.exports = Zoom; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Camera = __webpack_require__(306); +var Camera = __webpack_require__(318); var Class = __webpack_require__(0); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(23); -var RectangleContains = __webpack_require__(50); -var ScaleEvents = __webpack_require__(94); +var PluginCache = __webpack_require__(25); +var RectangleContains = __webpack_require__(56); +var ScaleEvents = __webpack_require__(101); var SceneEvents = __webpack_require__(20); /** * @classdesc * The Camera Manager is a plugin that belongs to a Scene and is responsible for managing all of the Scene Cameras. - * + * * By default you can access the Camera Manager from within a Scene using `this.cameras`, although this can be changed * in your game config. - * + * * Create new Cameras using the `add` method. Or extend the Camera class with your own addition code and then add * the new Camera in using the `addExisting` method. - * + * * Cameras provide a view into your game world, and can be positioned, rotated, zoomed and scrolled accordingly. * * A Camera consists of two elements: The viewport and the scroll values. @@ -141759,7 +149352,7 @@ var SceneEvents = __webpack_require__(20); * viewport, and changing the viewport has no impact on the scrolling. * * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, - * allowing you to filter Game Objects out on a per-Camera basis. The Camera Manager can manage up to 31 unique + * allowing you to filter Game Objects out on a per-Camera basis. The Camera Manager can manage up to 31 unique * 'Game Object ignore capable' Cameras. Any Cameras beyond 31 that you create will all be given a Camera ID of * zero, meaning that they cannot be used for Game Object exclusion. This means if you need your Camera to ignore * Game Objects, make sure it's one of the first 31 created. @@ -141825,11 +149418,11 @@ var CameraManager = new Class({ * A handy reference to the 'main' camera. By default this is the first Camera the * Camera Manager creates. You can also set it directly, or use the `makeMain` argument * in the `add` and `addExisting` methods. It allows you to access it from your game: - * + * * ```javascript * var cam = this.cameras.main; * ``` - * + * * Also see the properties `camera1`, `camera2` and so on. * * @name Phaser.Cameras.Scene2D.CameraManager#main @@ -141915,7 +149508,7 @@ var CameraManager = new Class({ // Make one this.add(); } - + this.main = this.cameras[0]; } @@ -141927,28 +149520,28 @@ var CameraManager = new Class({ /** * Adds a new Camera into the Camera Manager. The Camera Manager can support up to 31 different Cameras. - * + * * Each Camera has its own viewport, which controls the size of the Camera and its position within the canvas. - * + * * Use the `Camera.scrollX` and `Camera.scrollY` properties to change where the Camera is looking, or the * Camera methods such as `centerOn`. Cameras also have built in special effects, such as fade, flash, shake, * pan and zoom. - * + * * By default Cameras are transparent and will render anything that they can see based on their `scrollX` * and `scrollY` values. Game Objects can be set to be ignored by a Camera by using the `Camera.ignore` method. - * + * * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after creation if required. - * + * * See the Camera class documentation for more details. * * @method Phaser.Cameras.Scene2D.CameraManager#add * @since 3.0.0 * - * @param {integer} [x=0] - The horizontal position of the Camera viewport. - * @param {integer} [y=0] - The vertical position of the Camera viewport. - * @param {integer} [width] - The width of the Camera viewport. If not given it'll be the game config size. - * @param {integer} [height] - The height of the Camera viewport. If not given it'll be the game config size. + * @param {number} [x=0] - The horizontal position of the Camera viewport. + * @param {number} [y=0] - The vertical position of the Camera viewport. + * @param {number} [width] - The width of the Camera viewport. If not given it'll be the game config size. + * @param {number} [height] - The height of the Camera viewport. If not given it'll be the game config size. * @param {boolean} [makeMain=false] - Set this Camera as being the 'main' camera. This just makes the property `main` a reference to it. * @param {string} [name=''] - The name of the Camera. * @@ -141983,15 +149576,15 @@ var CameraManager = new Class({ /** * Adds an existing Camera into the Camera Manager. - * + * * The Camera should either be a `Phaser.Cameras.Scene2D.Camera` instance, or a class that extends from it. - * + * * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change * it after addition if required. - * + * * The Camera will be assigned an ID, which is used for Game Object exclusion and then added to the * manager. As long as it doesn't already exist in the manager it will be added then returned. - * + * * If this method returns `null` then the Camera already exists in this Camera Manager. * * @method Phaser.Cameras.Scene2D.CameraManager#addExisting @@ -142020,7 +149613,7 @@ var CameraManager = new Class({ { this.main = camera; } - + return camera; } @@ -142029,7 +149622,7 @@ var CameraManager = new Class({ /** * Gets the next available Camera ID number. - * + * * The Camera Manager supports up to 31 unique cameras, after which the ID returned will always be zero. * You can create additional cameras beyond 31, but they cannot be used for Game Object exclusion. * @@ -142077,15 +149670,15 @@ var CameraManager = new Class({ /** * Gets the total number of Cameras in this Camera Manager. - * + * * If the optional `isVisible` argument is set it will only count Cameras that are currently visible. * * @method Phaser.Cameras.Scene2D.CameraManager#getTotal * @since 3.11.0 - * + * * @param {boolean} [isVisible=false] - Set the `true` to only include visible Cameras in the total. * - * @return {integer} The total number of Cameras in this Camera Manager. + * @return {number} The total number of Cameras in this Camera Manager. */ getTotal: function (isVisible) { @@ -142110,7 +149703,7 @@ var CameraManager = new Class({ /** * Populates this Camera Manager based on the given configuration object, or an array of config objects. - * + * * See the `Phaser.Types.Cameras.Scene2D.CameraConfig` documentation for details of the object structure. * * @method Phaser.Cameras.Scene2D.CameraManager#fromJSON @@ -142179,7 +149772,7 @@ var CameraManager = new Class({ /** * Gets a Camera based on its name. - * + * * Camera names are optional and don't have to be set, so this method is only of any use if you * have given your Cameras unique names. * @@ -142207,7 +149800,7 @@ var CameraManager = new Class({ /** * Returns an array of all cameras below the given Pointer. - * + * * The first camera in the array is the top-most camera in the camera list. * * @method Phaser.Cameras.Scene2D.CameraManager#getCamerasBelowPointer @@ -142242,10 +149835,10 @@ var CameraManager = new Class({ /** * Removes the given Camera, or an array of Cameras, from this Camera Manager. - * + * * If found in the Camera Manager it will be immediately removed from the local cameras array. * If also currently the 'main' camera, 'main' will be reset to be camera 0. - * + * * The removed Cameras are automatically destroyed if the `runDestroy` argument is `true`, which is the default. * If you wish to re-use the cameras then set this to `false`, but know that they will retain their references * and internal data until destroyed or re-added to a Camera Manager. @@ -142255,8 +149848,8 @@ var CameraManager = new Class({ * * @param {(Phaser.Cameras.Scene2D.Camera|Phaser.Cameras.Scene2D.Camera[])} camera - The Camera, or an array of Cameras, to be removed from this Camera Manager. * @param {boolean} [runDestroy=true] - Automatically call `Camera.destroy` on each Camera removed from this Camera Manager. - * - * @return {integer} The total number of Cameras removed. + * + * @return {number} The total number of Cameras removed. */ remove: function (camera, runDestroy) { @@ -142297,7 +149890,7 @@ var CameraManager = new Class({ /** * The internal render method. This is called automatically by the Scene and should not be invoked directly. - * + * * It will iterate through all local cameras and render them in turn, as long as they're visible and have * an alpha level > 0. * @@ -142306,10 +149899,9 @@ var CameraManager = new Class({ * @since 3.0.0 * * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Renderer that will render the children to this camera. - * @param {Phaser.GameObjects.GameObject[]} children - An array of renderable Game Objects. - * @param {number} interpolation - Interpolation value. Reserved for future use. + * @param {Phaser.GameObjects.DisplayList} children - The Display List for the Scene. */ - render: function (renderer, children, interpolation) + render: function (renderer, children) { var scene = this.scene; var cameras = this.cameras; @@ -142320,17 +149912,48 @@ var CameraManager = new Class({ if (camera.visible && camera.alpha > 0) { - // Hard-coded to 1 for now - camera.preRender(1); + camera.preRender(); - renderer.render(scene, children, interpolation, camera); + var visibleChildren = this.getVisibleChildren(children.getChildren(), camera); + + renderer.render(scene, visibleChildren, camera); } } }, + /** + * Takes an array of Game Objects and a Camera and returns a new array + * containing only those Game Objects that pass the `willRender` test + * against the given Camera. + * + * @method Phaser.Cameras.Scene2D.CameraManager#getVisibleChildren + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject[]} children - An array of Game Objects to be checked against the camera. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to filte the Game Objects against. + * + * @return {Phaser.GameObjects.GameObject[]} A filtered list of only Game Objects within the Scene that will render against the given Camera. + */ + getVisibleChildren: function (children, camera) + { + var visible = []; + + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + + if (child.willRender(camera)) + { + visible.push(child); + } + } + + return visible; + }, + /** * Resets this Camera Manager. - * + * * This will iterate through all current Cameras, destroying them all, then it will reset the * cameras array, reset the ID counter and create 1 new single camera using the default values. * @@ -142360,7 +149983,7 @@ var CameraManager = new Class({ * @protected * @since 3.0.0 * - * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ update: function (time, delta) @@ -142378,9 +150001,9 @@ var CameraManager = new Class({ * @since 3.18.0 * * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. - * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions. The canvas width / height values match this. */ - onResize: function (gameSize, baseSize, displaySize, resolution, previousWidth, previousHeight) + onResize: function (gameSize, baseSize, displaySize, previousWidth, previousHeight) { for (var i = 0; i < this.cameras.length; i++) { @@ -142466,7 +150089,7 @@ module.exports = CameraManager; /***/ }), -/* 727 */ +/* 768 */ /***/ (function(module, exports) { /** @@ -142485,7 +150108,7 @@ module.exports = 'enterfullscreen'; /***/ }), -/* 728 */ +/* 769 */ /***/ (function(module, exports) { /** @@ -142504,7 +150127,7 @@ module.exports = 'fullscreenfailed'; /***/ }), -/* 729 */ +/* 770 */ /***/ (function(module, exports) { /** @@ -142523,7 +150146,7 @@ module.exports = 'fullscreenunsupported'; /***/ }), -/* 730 */ +/* 771 */ /***/ (function(module, exports) { /** @@ -142543,7 +150166,7 @@ module.exports = 'leavefullscreen'; /***/ }), -/* 731 */ +/* 772 */ /***/ (function(module, exports) { /** @@ -142555,16 +150178,18 @@ module.exports = 'leavefullscreen'; /** * The Scale Manager Orientation Change Event. * + * This event is dispatched whenever the Scale Manager detects an orientation change event from the browser. + * * @event Phaser.Scale.Events#ORIENTATION_CHANGE * @since 3.16.1 - * - * @param {string} orientation - + * + * @param {string} orientation - The new orientation value. Either `Phaser.Scale.Orientation.LANDSCAPE` or `Phaser.Scale.Orientation.PORTRAIT`. */ module.exports = 'orientationchange'; /***/ }), -/* 732 */ +/* 773 */ /***/ (function(module, exports) { /** @@ -142575,7 +150200,7 @@ module.exports = 'orientationchange'; /** * The Scale Manager Resize Event. - * + * * This event is dispatched whenever the Scale Manager detects a resize event from the browser. * It sends three parameters to the callback, each of them being Size components. You can read * the `width`, `height`, `aspectRatio` and other properties of these components to help with @@ -142583,11 +150208,10 @@ module.exports = 'orientationchange'; * * @event Phaser.Scale.Events#RESIZE * @since 3.16.1 - * + * * @param {Phaser.Structs.Size} gameSize - A reference to the Game Size component. This is the un-scaled size of your game canvas. - * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size multiplied by resolution. + * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size. * @param {Phaser.Structs.Size} displaySize - A reference to the Display Size component. This is the scaled canvas size, after applying zoom and scale mode. - * @param {number} resolution - The current resolution. Defaults to 1 at the moment. * @param {number} previousWidth - If the `gameSize` has changed, this value contains its previous width, otherwise it contains the current width. * @param {number} previousHeight - If the `gameSize` has changed, this value contains its previous height, otherwise it contains the current height. */ @@ -142595,7 +150219,7 @@ module.exports = 'resize'; /***/ }), -/* 733 */ +/* 774 */ /***/ (function(module, exports) { /** @@ -142621,7 +150245,7 @@ module.exports = 'addedtoscene'; /***/ }), -/* 734 */ +/* 775 */ /***/ (function(module, exports) { /** @@ -142646,7 +150270,7 @@ module.exports = 'boot'; /***/ }), -/* 735 */ +/* 776 */ /***/ (function(module, exports) { /** @@ -142675,7 +150299,7 @@ module.exports = 'create'; /***/ }), -/* 736 */ +/* 777 */ /***/ (function(module, exports) { /** @@ -142702,7 +150326,7 @@ module.exports = 'destroy'; /***/ }), -/* 737 */ +/* 778 */ /***/ (function(module, exports) { /** @@ -142729,7 +150353,7 @@ module.exports = 'pause'; /***/ }), -/* 738 */ +/* 779 */ /***/ (function(module, exports) { /** @@ -142766,7 +150390,7 @@ module.exports = 'postupdate'; /***/ }), -/* 739 */ +/* 780 */ /***/ (function(module, exports) { /** @@ -142803,7 +150427,7 @@ module.exports = 'preupdate'; /***/ }), -/* 740 */ +/* 781 */ /***/ (function(module, exports) { /** @@ -142831,7 +150455,7 @@ module.exports = 'ready'; /***/ }), -/* 741 */ +/* 782 */ /***/ (function(module, exports) { /** @@ -142857,7 +150481,7 @@ module.exports = 'removedfromscene'; /***/ }), -/* 742 */ +/* 783 */ /***/ (function(module, exports) { /** @@ -142893,7 +150517,7 @@ module.exports = 'render'; /***/ }), -/* 743 */ +/* 784 */ /***/ (function(module, exports) { /** @@ -142920,7 +150544,7 @@ module.exports = 'resume'; /***/ }), -/* 744 */ +/* 785 */ /***/ (function(module, exports) { /** @@ -142950,7 +150574,7 @@ module.exports = 'shutdown'; /***/ }), -/* 745 */ +/* 786 */ /***/ (function(module, exports) { /** @@ -142977,7 +150601,7 @@ module.exports = 'sleep'; /***/ }), -/* 746 */ +/* 787 */ /***/ (function(module, exports) { /** @@ -143002,7 +150626,7 @@ module.exports = 'start'; /***/ }), -/* 747 */ +/* 788 */ /***/ (function(module, exports) { /** @@ -143038,7 +150662,7 @@ module.exports = 'transitioncomplete'; /***/ }), -/* 748 */ +/* 789 */ /***/ (function(module, exports) { /** @@ -143075,7 +150699,7 @@ module.exports = 'transitioninit'; /***/ }), -/* 749 */ +/* 790 */ /***/ (function(module, exports) { /** @@ -143109,7 +150733,7 @@ module.exports = 'transitionout'; /***/ }), -/* 750 */ +/* 791 */ /***/ (function(module, exports) { /** @@ -143149,7 +150773,7 @@ module.exports = 'transitionstart'; /***/ }), -/* 751 */ +/* 792 */ /***/ (function(module, exports) { /** @@ -143184,7 +150808,7 @@ module.exports = 'transitionwake'; /***/ }), -/* 752 */ +/* 793 */ /***/ (function(module, exports) { /** @@ -143221,7 +150845,7 @@ module.exports = 'update'; /***/ }), -/* 753 */ +/* 794 */ /***/ (function(module, exports) { /** @@ -143248,7 +150872,7 @@ module.exports = 'wake'; /***/ }), -/* 754 */ +/* 795 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143263,18 +150887,18 @@ module.exports = 'wake'; module.exports = { - Config: __webpack_require__(327), - CreateRenderer: __webpack_require__(349), - DebugHeader: __webpack_require__(351), - Events: __webpack_require__(21), - TimeStep: __webpack_require__(352), - VisibilityHandler: __webpack_require__(354) + Config: __webpack_require__(338), + CreateRenderer: __webpack_require__(358), + DebugHeader: __webpack_require__(360), + Events: __webpack_require__(23), + TimeStep: __webpack_require__(361), + VisibilityHandler: __webpack_require__(363) }; /***/ }), -/* 755 */ +/* 796 */ /***/ (function(module, exports) { // shim for using process in browser @@ -143464,7 +151088,7 @@ process.umask = function() { return 0; }; /***/ }), -/* 756 */ +/* 797 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143473,7 +151097,7 @@ process.umask = function() { return 0; }; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Browser = __webpack_require__(126); +var Browser = __webpack_require__(131); /** * Determines the input support of the browser running this Phaser Game instance. @@ -143539,7 +151163,7 @@ module.exports = init(); /***/ }), -/* 757 */ +/* 798 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143548,17 +151172,17 @@ module.exports = init(); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Browser = __webpack_require__(126); +var Browser = __webpack_require__(131); /** * Determines the audio playback capabilities of the device running this Phaser Game instance. * These values are read-only and populated during the boot sequence of the game. * They are then referenced by internal game systems and are available for you to access * via `this.sys.game.device.audio` from within any Scene. - * + * * @typedef {object} Phaser.Device.Audio * @since 3.0.0 - * + * * @property {boolean} audioData - Can this device play HTML Audio tags? * @property {boolean} dolby - Can this device play EC-3 Dolby Digital Plus files? * @property {boolean} m4a - Can this device can play m4a files. @@ -143614,8 +151238,7 @@ function init () // Mimetypes accepted: // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements - // bit.ly/iphoneoscodecs - if (audioElement.canPlayType('audio/wav; codecs="1"').replace(/^no$/, '')) + if (audioElement.canPlayType('audio/wav').replace(/^no$/, '')) { Audio.wav = true; } @@ -143664,7 +151287,7 @@ module.exports = init(); /***/ }), -/* 758 */ +/* 799 */ /***/ (function(module, exports) { /** @@ -143751,7 +151374,7 @@ module.exports = init(); /***/ }), -/* 759 */ +/* 800 */ /***/ (function(module, exports) { /** @@ -143855,7 +151478,7 @@ module.exports = init(); /***/ }), -/* 760 */ +/* 801 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143870,25 +151493,25 @@ module.exports = init(); module.exports = { - Between: __webpack_require__(330), - BetweenPoints: __webpack_require__(331), - BetweenPointsY: __webpack_require__(761), - BetweenY: __webpack_require__(762), - CounterClockwise: __webpack_require__(763), - Normalize: __webpack_require__(332), - Random: __webpack_require__(764), - RandomDegrees: __webpack_require__(765), - Reverse: __webpack_require__(766), - RotateTo: __webpack_require__(767), - ShortestBetween: __webpack_require__(768), - Wrap: __webpack_require__(248), - WrapDegrees: __webpack_require__(249) + Between: __webpack_require__(341), + BetweenPoints: __webpack_require__(342), + BetweenPointsY: __webpack_require__(802), + BetweenY: __webpack_require__(803), + CounterClockwise: __webpack_require__(804), + Normalize: __webpack_require__(343), + Random: __webpack_require__(805), + RandomDegrees: __webpack_require__(806), + Reverse: __webpack_require__(807), + RotateTo: __webpack_require__(808), + ShortestBetween: __webpack_require__(809), + Wrap: __webpack_require__(261), + WrapDegrees: __webpack_require__(262) }; /***/ }), -/* 761 */ +/* 802 */ /***/ (function(module, exports) { /** @@ -143920,7 +151543,7 @@ module.exports = BetweenPointsY; /***/ }), -/* 762 */ +/* 803 */ /***/ (function(module, exports) { /** @@ -143954,7 +151577,7 @@ module.exports = BetweenY; /***/ }), -/* 763 */ +/* 804 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -143999,7 +151622,7 @@ module.exports = CounterClockwise; /***/ }), -/* 764 */ +/* 805 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144009,7 +151632,7 @@ module.exports = CounterClockwise; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FloatBetween = __webpack_require__(127); +var FloatBetween = __webpack_require__(132); /** * Returns a random angle in the range [-pi, pi]. @@ -144028,7 +151651,7 @@ module.exports = Random; /***/ }), -/* 765 */ +/* 806 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144038,7 +151661,7 @@ module.exports = Random; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FloatBetween = __webpack_require__(127); +var FloatBetween = __webpack_require__(132); /** * Returns a random angle in the range [-180, 180]. @@ -144057,7 +151680,7 @@ module.exports = RandomDegrees; /***/ }), -/* 766 */ +/* 807 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144066,7 +151689,7 @@ module.exports = RandomDegrees; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Normalize = __webpack_require__(332); +var Normalize = __webpack_require__(343); /** * Reverse the given angle. @@ -144087,7 +151710,7 @@ module.exports = Reverse; /***/ }), -/* 767 */ +/* 808 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144154,7 +151777,7 @@ module.exports = RotateTo; /***/ }), -/* 768 */ +/* 809 */ /***/ (function(module, exports) { /** @@ -144203,7 +151826,7 @@ module.exports = ShortestBetween; /***/ }), -/* 769 */ +/* 810 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144218,19 +151841,19 @@ module.exports = ShortestBetween; module.exports = { - Between: __webpack_require__(55), - BetweenPoints: __webpack_require__(333), - BetweenPointsSquared: __webpack_require__(770), - Chebyshev: __webpack_require__(771), - Power: __webpack_require__(772), - Snake: __webpack_require__(773), - Squared: __webpack_require__(334) + Between: __webpack_require__(61), + BetweenPoints: __webpack_require__(344), + BetweenPointsSquared: __webpack_require__(811), + Chebyshev: __webpack_require__(812), + Power: __webpack_require__(813), + Snake: __webpack_require__(814), + Squared: __webpack_require__(345) }; /***/ }), -/* 770 */ +/* 811 */ /***/ (function(module, exports) { /** @@ -144262,7 +151885,7 @@ module.exports = DistanceBetweenPointsSquared; /***/ }), -/* 771 */ +/* 812 */ /***/ (function(module, exports) { /** @@ -144296,7 +151919,7 @@ module.exports = ChebyshevDistance; /***/ }), -/* 772 */ +/* 813 */ /***/ (function(module, exports) { /** @@ -144330,7 +151953,7 @@ module.exports = DistancePower; /***/ }), -/* 773 */ +/* 814 */ /***/ (function(module, exports) { /** @@ -144364,7 +151987,7 @@ module.exports = SnakeDistance; /***/ }), -/* 774 */ +/* 815 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144379,24 +152002,24 @@ module.exports = SnakeDistance; module.exports = { - Back: __webpack_require__(315), - Bounce: __webpack_require__(316), - Circular: __webpack_require__(317), - Cubic: __webpack_require__(318), - Elastic: __webpack_require__(319), - Expo: __webpack_require__(320), - Linear: __webpack_require__(321), - Quadratic: __webpack_require__(322), - Quartic: __webpack_require__(323), - Quintic: __webpack_require__(324), - Sine: __webpack_require__(325), - Stepped: __webpack_require__(326) + Back: __webpack_require__(326), + Bounce: __webpack_require__(327), + Circular: __webpack_require__(328), + Cubic: __webpack_require__(329), + Elastic: __webpack_require__(330), + Expo: __webpack_require__(331), + Linear: __webpack_require__(332), + Quadratic: __webpack_require__(333), + Quartic: __webpack_require__(334), + Quintic: __webpack_require__(335), + Sine: __webpack_require__(336), + Stepped: __webpack_require__(337) }; /***/ }), -/* 775 */ +/* 816 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144411,17 +152034,17 @@ module.exports = { module.exports = { - Ceil: __webpack_require__(776), - Equal: __webpack_require__(109), - Floor: __webpack_require__(777), - GreaterThan: __webpack_require__(335), - LessThan: __webpack_require__(336) + Ceil: __webpack_require__(817), + Equal: __webpack_require__(121), + Floor: __webpack_require__(818), + GreaterThan: __webpack_require__(346), + LessThan: __webpack_require__(347) }; /***/ }), -/* 776 */ +/* 817 */ /***/ (function(module, exports) { /** @@ -144452,7 +152075,7 @@ module.exports = Ceil; /***/ }), -/* 777 */ +/* 818 */ /***/ (function(module, exports) { /** @@ -144483,7 +152106,7 @@ module.exports = Floor; /***/ }), -/* 778 */ +/* 819 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144498,19 +152121,19 @@ module.exports = Floor; module.exports = { - Bezier: __webpack_require__(779), - CatmullRom: __webpack_require__(780), - CubicBezier: __webpack_require__(339), - Linear: __webpack_require__(781), - QuadraticBezier: __webpack_require__(340), - SmoothStep: __webpack_require__(341), - SmootherStep: __webpack_require__(782) + Bezier: __webpack_require__(820), + CatmullRom: __webpack_require__(821), + CubicBezier: __webpack_require__(350), + Linear: __webpack_require__(822), + QuadraticBezier: __webpack_require__(351), + SmoothStep: __webpack_require__(352), + SmootherStep: __webpack_require__(823) }; /***/ }), -/* 779 */ +/* 820 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144519,7 +152142,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bernstein = __webpack_require__(337); +var Bernstein = __webpack_require__(348); /** * A bezier interpolation method. @@ -144549,7 +152172,7 @@ module.exports = BezierInterpolation; /***/ }), -/* 780 */ +/* 821 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144558,7 +152181,7 @@ module.exports = BezierInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CatmullRom = __webpack_require__(181); +var CatmullRom = __webpack_require__(186); /** * A Catmull-Rom interpolation method. @@ -144606,7 +152229,7 @@ module.exports = CatmullRomInterpolation; /***/ }), -/* 781 */ +/* 822 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144615,7 +152238,7 @@ module.exports = CatmullRomInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Linear = __webpack_require__(124); +var Linear = __webpack_require__(130); /** * A linear interpolation method. @@ -144653,7 +152276,7 @@ module.exports = LinearInterpolation; /***/ }), -/* 782 */ +/* 823 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144662,7 +152285,7 @@ module.exports = LinearInterpolation; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SmootherStep = __webpack_require__(170); +var SmootherStep = __webpack_require__(175); /** * A Smoother Step interpolation method. @@ -144686,7 +152309,7 @@ module.exports = SmootherStepInterpolation; /***/ }), -/* 783 */ +/* 824 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144701,15 +152324,15 @@ module.exports = SmootherStepInterpolation; module.exports = { - GetNext: __webpack_require__(342), - IsSize: __webpack_require__(128), - IsValue: __webpack_require__(784) + GetNext: __webpack_require__(353), + IsSize: __webpack_require__(133), + IsValue: __webpack_require__(825) }; /***/ }), -/* 784 */ +/* 825 */ /***/ (function(module, exports) { /** @@ -144737,7 +152360,7 @@ module.exports = IsValuePowerOfTwo; /***/ }), -/* 785 */ +/* 826 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -144752,15 +152375,15 @@ module.exports = IsValuePowerOfTwo; module.exports = { - Ceil: __webpack_require__(343), - Floor: __webpack_require__(95), - To: __webpack_require__(786) + Ceil: __webpack_require__(134), + Floor: __webpack_require__(72), + To: __webpack_require__(827) }; /***/ }), -/* 786 */ +/* 827 */ /***/ (function(module, exports) { /** @@ -144803,7 +152426,7 @@ module.exports = SnapTo; /***/ }), -/* 787 */ +/* 828 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -145313,7 +152936,7 @@ module.exports = RandomDataGenerator; /***/ }), -/* 788 */ +/* 829 */ /***/ (function(module, exports) { /** @@ -145348,7 +152971,7 @@ module.exports = Average; /***/ }), -/* 789 */ +/* 830 */ /***/ (function(module, exports) { /** @@ -145367,7 +152990,7 @@ module.exports = Average; * * @param {number} value - The value to round. * @param {number} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * @param {number} [base=10] - The base to round in. Default is 10 for decimal. * * @return {number} The rounded value. */ @@ -145385,7 +153008,7 @@ module.exports = CeilTo; /***/ }), -/* 790 */ +/* 831 */ /***/ (function(module, exports) { /** @@ -145414,7 +153037,290 @@ module.exports = Difference; /***/ }), -/* 791 */ +/* 832 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Clamp = __webpack_require__(16); +var Class = __webpack_require__(0); +var Matrix4 = __webpack_require__(73); +var NOOP = __webpack_require__(1); + +var tempMatrix = new Matrix4(); + +/** + * @classdesc + * + * @class Euler + * @memberof Phaser.Math + * @constructor + * @since 3.50.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + */ +var Euler = new Class({ + + initialize: + + function Euler (x, y, z, order) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (z === undefined) { z = 0; } + if (order === undefined) { order = Euler.DefaultOrder; } + + this._x = x; + this._y = y; + this._z = z; + this._order = order; + + this.onChangeCallback = NOOP; + }, + + x: { + get: function () + { + return this._x; + }, + + set: function (value) + { + this._x = value; + + this.onChangeCallback(this); + } + }, + + y: { + get: function () + { + return this._y; + }, + + set: function (value) + { + this._y = value; + + this.onChangeCallback(this); + } + }, + + z: { + get: function () + { + return this._z; + }, + + set: function (value) + { + this._z = value; + + this.onChangeCallback(this); + } + }, + + order: { + get: function () + { + return this._order; + }, + + set: function (value) + { + this._order = value; + + this.onChangeCallback(this); + } + }, + + set: function (x, y, z, order) + { + if (order === undefined) { order = this._order; } + + this._x = x; + this._y = y; + this._z = z; + this._order = order; + + this.onChangeCallback(this); + + return this; + }, + + copy: function (euler) + { + return this.set(euler.x, euler.y, euler.z, euler.order); + }, + + setFromQuaternion: function (quaternion, order, update) + { + if (order === undefined) { order = this._order; } + if (update === undefined) { update = false; } + + tempMatrix.fromQuat(quaternion); + + return this.setFromRotationMatrix(tempMatrix, order, update); + }, + + setFromRotationMatrix: function (matrix, order, update) + { + if (order === undefined) { order = this._order; } + if (update === undefined) { update = false; } + + var elements = matrix.val; + + // Upper 3x3 of matrix is un-scaled rotation matrix + var m11 = elements[0]; + var m12 = elements[4]; + var m13 = elements[8]; + var m21 = elements[1]; + var m22 = elements[5]; + var m23 = elements[9]; + var m31 = elements[2]; + var m32 = elements[6]; + var m33 = elements[10]; + + var x = 0; + var y = 0; + var z = 0; + var epsilon = 0.99999; + + switch (order) + { + case 'XYZ': + { + y = Math.asin(Clamp(m13, -1, 1)); + + if (Math.abs(m13) < epsilon) + { + x = Math.atan2(-m23, m33); + z = Math.atan2(-m12, m11); + } + else + { + x = Math.atan2(m32, m22); + } + + break; + } + + case 'YXZ': + { + x = Math.asin(-Clamp(m23, -1, 1)); + + if (Math.abs(m23) < epsilon) + { + y = Math.atan2(m13, m33); + z = Math.atan2(m21, m22); + } + else + { + y = Math.atan2(-m31, m11); + } + + break; + } + + case 'ZXY': + { + x = Math.asin(Clamp(m32, -1, 1)); + + if (Math.abs(m32) < epsilon) + { + y = Math.atan2(-m31, m33); + z = Math.atan2(-m12, m22); + } + else + { + z = Math.atan2(m21, m11); + } + + break; + } + + case 'ZYX': + { + y = Math.asin(-Clamp(m31, -1, 1)); + + if (Math.abs(m31) < epsilon) + { + x = Math.atan2(m32, m33); + z = Math.atan2(m21, m11); + } + else + { + z = Math.atan2(-m12, m22); + } + + break; + } + + case 'YZX': + { + z = Math.asin(Clamp(m21, -1, 1)); + + if (Math.abs(m21) < epsilon) + { + x = Math.atan2(-m23, m22); + y = Math.atan2(-m31, m11); + } + else + { + y = Math.atan2(m13, m33); + } + + break; + } + + case 'XZY': + { + z = Math.asin(-Clamp(m12, -1, 1)); + + if (Math.abs(m12) < epsilon) + { + x = Math.atan2(m32, m22); + y = Math.atan2(m13, m11); + } + else + { + x = Math.atan2(-m23, m33); + } + + break; + } + } + + this._x = x; + this._y = y; + this._z = z; + this._order = order; + + if (update) + { + this.onChangeCallback(this); + } + + return this; + } + +}); + +Euler.RotationOrders = [ 'XYZ', 'YXZ', 'ZXY', 'ZYX', 'YZX', 'XZY' ]; + +Euler.DefaultOrder = 'XYZ'; + +module.exports = Euler; + + +/***/ }), +/* 833 */ /***/ (function(module, exports) { /** @@ -145432,8 +153338,8 @@ module.exports = Difference; * @since 3.0.0 * * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * @param {number} [place=0] - The place to round to. + * @param {number} [base=10] - The base to round in. Default is 10 for decimal. * * @return {number} The rounded value. */ @@ -145451,7 +153357,7 @@ module.exports = FloorTo; /***/ }), -/* 792 */ +/* 834 */ /***/ (function(module, exports) { /** @@ -145467,7 +153373,7 @@ module.exports = FloorTo; * @since 3.0.0 * * @param {number} distance - The distance. - * @param {integer} time - The time, in seconds. + * @param {number} time - The time, in seconds. * * @return {number} The speed, in distance per ms. * @@ -145484,7 +153390,7 @@ module.exports = GetSpeed; /***/ }), -/* 793 */ +/* 835 */ /***/ (function(module, exports) { /** @@ -145515,7 +153421,7 @@ module.exports = IsEven; /***/ }), -/* 794 */ +/* 836 */ /***/ (function(module, exports) { /** @@ -145544,7 +153450,7 @@ module.exports = IsEvenStrict; /***/ }), -/* 795 */ +/* 837 */ /***/ (function(module, exports) { /** @@ -145574,7 +153480,7 @@ module.exports = MaxAdd; /***/ }), -/* 796 */ +/* 838 */ /***/ (function(module, exports) { /** @@ -145604,7 +153510,7 @@ module.exports = MinSub; /***/ }), -/* 797 */ +/* 839 */ /***/ (function(module, exports) { /** @@ -145663,7 +153569,7 @@ module.exports = Percent; /***/ }), -/* 798 */ +/* 840 */ /***/ (function(module, exports) { /** @@ -145703,7 +153609,7 @@ module.exports = RandomXY; /***/ }), -/* 799 */ +/* 841 */ /***/ (function(module, exports) { /** @@ -145742,7 +153648,7 @@ module.exports = RandomXYZ; /***/ }), -/* 800 */ +/* 842 */ /***/ (function(module, exports) { /** @@ -145779,7 +153685,7 @@ module.exports = RandomXYZW; /***/ }), -/* 801 */ +/* 843 */ /***/ (function(module, exports) { /** @@ -145816,7 +153722,7 @@ module.exports = RotateTo; /***/ }), -/* 802 */ +/* 844 */ /***/ (function(module, exports) { /** @@ -145849,8 +153755,8 @@ module.exports = RotateTo; * @since 3.0.0 * * @param {number} value - The value to round. - * @param {integer} [place=0] - The place to round to. Positive to round the units, negative to round the decimal. - * @param {integer} [base=10] - The base to round in. Default is 10 for decimal. + * @param {number} [place=0] - The place to round to. Positive to round the units, negative to round the decimal. + * @param {number} [base=10] - The base to round in. Default is 10 for decimal. * * @return {number} The rounded value. */ @@ -145868,7 +153774,7 @@ module.exports = RoundTo; /***/ }), -/* 803 */ +/* 845 */ /***/ (function(module, exports) { /** @@ -145921,7 +153827,7 @@ module.exports = SinCosTableGenerator; /***/ }), -/* 804 */ +/* 846 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -145942,9 +153848,9 @@ var Vector2 = __webpack_require__(3); * @function Phaser.Math.ToXY * @since 3.19.0 * - * @param {integer} index - The position within the grid to get the x/y value for. - * @param {integer} width - The width of the grid. - * @param {integer} height - The height of the grid. + * @param {number} index - The position within the grid to get the x/y value for. + * @param {number} width - The width of the grid. + * @param {number} height - The height of the grid. * @param {Phaser.Math.Vector2} [out] - An optional Vector2 to store the result in. If not given, a new Vector2 instance will be created. * * @return {Phaser.Math.Vector2} A Vector2 where the x and y properties contain the given grid index. @@ -145979,7 +153885,7 @@ module.exports = ToXY; /***/ }), -/* 805 */ +/* 847 */ /***/ (function(module, exports) { /** @@ -146009,7 +153915,7 @@ module.exports = Within; /***/ }), -/* 806 */ +/* 848 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146018,9 +153924,9 @@ module.exports = Within; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector3 = __webpack_require__(81); -var Matrix4 = __webpack_require__(347); -var Quaternion = __webpack_require__(348); +var Vector3 = __webpack_require__(37); +var Matrix4 = __webpack_require__(73); +var Quaternion = __webpack_require__(357); var tmpMat4 = new Matrix4(); var tmpQuat = new Quaternion(); @@ -146057,7 +153963,103 @@ module.exports = RotateVec3; /***/ }), -/* 807 */ +/* 849 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Post-Render Event. + * + * This event is dispatched by the WebGL Renderer when all rendering, for all cameras in all Scenes, + * has completed. + * + * @event Phaser.Renderer.WebGL.Events#POST_RENDER + * @since 3.50.0 + */ +module.exports = 'postrender'; + + +/***/ }), +/* 850 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Pre-Render Event. + * + * This event is dispatched by the WebGL Renderer. This happens right at the start of the render + * process, after the context has been cleared, the scissors enabled and everything has been + * reset ready for the render. + * + * @event Phaser.Renderer.WebGL.Events#PRE_RENDER + * @since 3.50.0 + */ +module.exports = 'prerender'; + + +/***/ }), +/* 851 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Render Event. + * + * This event is dispatched by the WebGL Renderer for every camera in every Scene. + * + * It is dispatched before any of the children in the Scene have been rendered. + * + * @event Phaser.Renderer.WebGL.Events#RENDER + * @since 3.50.0 + * + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered. + */ +module.exports = 'render'; + + +/***/ }), +/* 852 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Renderer Resize Event. + * + * This event is dispatched by the WebGL Renderer when it is resized, usually as a result + * of the Scale Manager resizing. + * + * @event Phaser.Renderer.WebGL.Events#RESIZE + * @since 3.50.0 + * + * @param {number} width - The new width of the renderer. + * @param {number} height - The new height of the renderer. + */ +module.exports = 'resize'; + + +/***/ }), +/* 853 */ /***/ (function(module, exports) { module.exports = [ @@ -146070,7 +154072,7 @@ module.exports = [ 'uniform sampler2D uMaskSampler;', 'uniform bool uInvertMaskAlpha;', '', - 'void main()', + 'void main ()', '{', ' vec2 uv = gl_FragCoord.xy / uResolution;', ' vec4 mainColor = texture2D(uMainSampler, uv);', @@ -146093,7 +154095,7 @@ module.exports = [ /***/ }), -/* 808 */ +/* 854 */ /***/ (function(module, exports) { module.exports = [ @@ -146103,7 +154105,7 @@ module.exports = [ '', 'attribute vec2 inPosition;', '', - 'void main()', + 'void main ()', '{', ' gl_Position = vec4(inPosition, 0.0, 1.0);', '}', @@ -146112,7 +154114,52 @@ module.exports = [ /***/ }), -/* 809 */ +/* 855 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_GRAPHICS_FS', + '', + 'precision mediump float;', + '', + 'varying vec4 outColor;', + '', + 'void main ()', + '{', + ' gl_FragColor = vec4(outColor.bgr * outColor.a, outColor.a);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 856 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_GRAPHICS_VS', + '', + 'precision mediump float;', + '', + 'uniform mat4 uProjectionMatrix;', + '', + 'attribute vec2 inPosition;', + 'attribute vec4 inColor;', + '', + 'varying vec4 outColor;', + '', + 'void main ()', + '{', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', + '', + ' outColor = inColor;', + '}', + '' +].join('\n'); + + +/***/ }), +/* 857 */ /***/ (function(module, exports) { module.exports = [ @@ -146144,7 +154191,7 @@ module.exports = [ 'void main()', '{', ' vec3 finalColor = vec3(0.0, 0.0, 0.0);', - ' vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);', + ' vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.bgr * outTint.a, outTint.a);', ' vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;', ' vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));', ' vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;', @@ -146171,7 +154218,73 @@ module.exports = [ /***/ }), -/* 810 */ +/* 858 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_POINTLIGHT_FS', + '', + 'precision mediump float;', + '', + 'uniform vec2 uResolution;', + '', + 'varying vec4 lightPosition;', + 'varying vec4 lightColor;', + 'varying float lightRadius;', + '', + 'void main ()', + '{', + ' vec2 center = vec2((lightPosition.x + 1.0) * uResolution.x, (lightPosition.y + 1.0) * uResolution.y);', + '', + ' float distance = length(center - gl_FragCoord.xy);', + '', + ' float attenuation = 1.0 / (0.01 * distance * distance);', + ' float radius = 1.0 - min(distance, lightRadius) / lightRadius;', + ' float intensity = smoothstep(0.0, 1.0, min(attenuation, radius));', + '', + ' vec4 color = vec4(intensity, intensity, intensity, 0.0) * lightColor;', + '', + ' gl_FragColor = vec4(color.rgb * lightColor.a, color.a);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 859 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_POINTLIGHT_VS', + '', + 'precision mediump float;', + '', + 'uniform mat4 uProjectionMatrix;', + '', + 'attribute vec2 inPosition;', + 'attribute vec2 inLightPosition;', + 'attribute vec4 inLightColor;', + 'attribute float inLightRadius;', + 'attribute float inLightIntensity;', + '', + 'varying vec4 lightPosition;', + 'varying vec4 lightColor;', + 'varying float lightRadius;', + '', + 'void main ()', + '{', + ' lightColor = inLightColor;', + ' lightRadius = inLightRadius;', + ' lightPosition = uProjectionMatrix * vec4(inLightPosition, 1.0, 1.0);', + '', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 860 */ /***/ (function(module, exports) { module.exports = [ @@ -146186,25 +154299,21 @@ module.exports = [ 'varying float outTintEffect;', 'varying vec4 outTint;', '', - 'void main()', + 'void main ()', '{', ' vec4 texture;', '', ' %forloop%', '', - ' vec4 texel = vec4(outTint.rgb * outTint.a, outTint.a);', - ' vec4 color = texture;', + ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', '', - ' if (outTintEffect == 0.0)', - ' {', - ' // Multiply texture tint', - ' color = texture * texel;', - ' }', - ' else if (outTintEffect == 1.0)', + ' // Multiply texture tint', + ' vec4 color = texture * texel;', + '', + ' if (outTintEffect == 1.0)', ' {', ' // Solid color + texture alpha', - ' color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);', - ' color.a = texture.a * texel.a;', + ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', ' }', ' else if (outTintEffect == 2.0)', ' {', @@ -146219,7 +154328,7 @@ module.exports = [ /***/ }), -/* 811 */ +/* 861 */ /***/ (function(module, exports) { module.exports = [ @@ -146228,8 +154337,6 @@ module.exports = [ 'precision mediump float;', '', 'uniform mat4 uProjectionMatrix;', - 'uniform mat4 uViewMatrix;', - 'uniform mat4 uModelMatrix;', '', 'attribute vec2 inPosition;', 'attribute vec2 inTexCoord;', @@ -146244,20 +154351,19 @@ module.exports = [ '', 'void main ()', '{', - ' gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', '', ' outTexCoord = inTexCoord;', ' outTexId = inTexId;', ' outTint = inTint;', ' outTintEffect = inTintEffect;', '}', - '', '' ].join('\n'); /***/ }), -/* 812 */ +/* 862 */ /***/ (function(module, exports) { module.exports = [ @@ -146271,22 +154377,18 @@ module.exports = [ 'varying float outTintEffect;', 'varying vec4 outTint;', '', - 'void main()', + 'void main ()', '{', ' vec4 texture = texture2D(uMainSampler, outTexCoord);', - ' vec4 texel = vec4(outTint.rgb * outTint.a, outTint.a);', - ' vec4 color = texture;', + ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', '', - ' if (outTintEffect == 0.0)', - ' {', - ' // Multiply texture tint', - ' color = texture * texel;', - ' }', - ' else if (outTintEffect == 1.0)', + ' // Multiply texture tint', + ' vec4 color = texture * texel;', + '', + ' if (outTintEffect == 1.0)', ' {', ' // Solid color + texture alpha', - ' color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);', - ' color.a = texture.a * texel.a;', + ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', ' }', ' else if (outTintEffect == 2.0)', ' {', @@ -146301,7 +154403,7 @@ module.exports = [ /***/ }), -/* 813 */ +/* 863 */ /***/ (function(module, exports) { module.exports = [ @@ -146310,11 +154412,10 @@ module.exports = [ 'precision mediump float;', '', 'uniform mat4 uProjectionMatrix;', - 'uniform mat4 uViewMatrix;', - 'uniform mat4 uModelMatrix;', '', 'attribute vec2 inPosition;', 'attribute vec2 inTexCoord;', + 'attribute float inTexId;', 'attribute float inTintEffect;', 'attribute vec4 inTint;', '', @@ -146324,7 +154425,7 @@ module.exports = [ '', 'void main ()', '{', - ' gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', '', ' outTexCoord = inTexCoord;', ' outTint = inTint;', @@ -146335,7 +154436,688 @@ module.exports = [ /***/ }), -/* 814 */ +/* 864 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var AddBlendFS = __webpack_require__(865); +var Class = __webpack_require__(0); +var ColorMatrix = __webpack_require__(264); +var ColorMatrixFS = __webpack_require__(866); +var CopyFS = __webpack_require__(867); +var GetFastValue = __webpack_require__(2); +var LinearBlendFS = __webpack_require__(868); +var QuadVS = __webpack_require__(579); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); + +/** + * @classdesc + * The Utility Pipeline is a special-use pipeline that belongs to the Pipeline Manager. + * + * It provides 4 shaders and handy associated methods: + * + * 1) Copy Shader. A fast texture to texture copy shader with optional brightness setting. + * 2) Additive Blend Mode Shader. Blends two textures using an additive blend mode. + * 3) Linear Blend Mode Shader. Blends two textures using a linear blend mode. + * 4) Color Matrix Copy Shader. Draws a texture to a target using a Color Matrix. + * + * You typically do not extend or access this pipeline directly, but instead go + * via the following methods in the Pipeline Manager: + * + * `copyFrame` + * `drawFrame` + * `blendFrames` + * `blendFramesAdditive` + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * + * This pipeline has a hard-coded batch size of 1 and a hard coded set of vertices. + * + * @class UtilityPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + */ +var UtilityPipeline = new Class({ + + Extends: WebGLPipeline, + + initialize: + + function UtilityPipeline (config) + { + config.renderTarget = GetFastValue(config, 'renderTarget', [ + { + scale: 1 + }, + { + scale: 1 + }, + { + scale: 0.5 + }, + { + scale: 0.5 + } + ]); + + config.vertShader = GetFastValue(config, 'vertShader', QuadVS); + + config.shaders = GetFastValue(config, 'shaders', [ + { + name: 'Copy', + fragShader: CopyFS, + uniforms: [ + 'uMainSampler', + 'uBrightness' + ] + }, + { + name: 'AddBlend', + fragShader: AddBlendFS, + uniforms: [ + 'uMainSampler1', + 'uMainSampler2', + 'uStrength' + ] + }, + { + name: 'LinearBlend', + fragShader: LinearBlendFS, + uniforms: [ + 'uMainSampler1', + 'uMainSampler2', + 'uStrength' + ] + }, + { + name: 'ColorMatrix', + fragShader: ColorMatrixFS, + uniforms: [ + 'uMainSampler', + 'uColorMatrix', + 'uAlpha' + ] + } + ]); + + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTexCoord', + size: 2, + type: WEBGL_CONST.FLOAT + } + ]); + + // x, y, u, v (x/y in NDC) + config.vertices = new Float32Array([ + -1, -1, 0, 0, + -1, 1, 0, 1, + 1, 1, 1, 1, + -1, -1, 0, 0, + 1, 1, 1, 1, + 1, -1, 1, 0 + ]); + + config.batchSize = 1; + + WebGLPipeline.call(this, config); + + /** + * A default Color Matrix, used by the Color Matrix Shader when one + * isn't provided. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#colorMatrix + * @type {Phaser.Display.ColorMatrix} + * @since 3.50.0 + */ + this.colorMatrix = new ColorMatrix(); + + /** + * A reference to the Copy Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @default null + * @since 3.50.0 + */ + this.copyShader; + + /** + * A reference to the Additive Blend Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#addShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.addShader; + + /** + * A reference to the Linear Blend Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#linearShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.linearShader; + + /** + * A reference to the Color Matrix Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#colorMatrixShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.colorMatrixShader; + + /** + * A reference to the Full Frame 1 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#fullFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.fullFrame1; + + /** + * A reference to the Full Frame 2 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#fullFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.fullFrame2; + + /** + * A reference to the Half Frame 1 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#halfFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.halfFrame1; + + /** + * A reference to the Half Frame 2 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#halfFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.halfFrame2; + }, + + boot: function () + { + WebGLPipeline.prototype.boot.call(this); + + var shaders = this.shaders; + var targets = this.renderTargets; + + this.copyShader = shaders[0]; + this.addShader = shaders[1]; + this.linearShader = shaders[2]; + this.colorMatrixShader = shaders[3]; + + this.fullFrame1 = targets[0]; + this.fullFrame2 = targets[1]; + this.halfFrame1 = targets[2]; + this.halfFrame2 = targets[3]; + }, + + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * You can optionally set the brightness factor of the copy. + * + * The difference between this method and `drawFrame` is that this method + * uses a faster copy shader, where only the brightness can be modified. + * If you need color level manipulation, see `drawFrame` instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + copyFrame: function (source, target, brightness, clear, clearAlpha) + { + if (brightness === undefined) { brightness = 1; } + if (clear === undefined) { clear = true; } + if (clearAlpha === undefined) { clearAlpha = true; } + + var gl = this.gl; + + this.set1i('uMainSampler', 0, this.copyShader); + this.set1f('uBrightness', brightness, this.copyShader); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); + + if (target) + { + gl.viewport(0, 0, target.width, target.height); + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + } + else + { + gl.viewport(0, 0, source.width, source.height); + } + + if (clear) + { + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + } + + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, + + /** + * Pops the framebuffer from the renderers FBO stack and sets that as the active target, + * then draws the `source` Render Target to it. It then resets the renderer textures. + * + * This should be done when you need to draw the _final_ results of a pipeline to the game + * canvas, or the next framebuffer in line on the FBO stack. You should only call this once + * in the `onDraw` handler and it should be the final thing called. Be careful not to call + * this if you need to actually use the pipeline shader, instead of the copy shader. In + * those cases, use the `bindAndDraw` method. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyToGame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + */ + copyToGame: function (source) + { + var gl = this.gl; + + this.set1i('uMainSampler', 0, this.copyShader); + this.set1f('uBrightness', 1, this.copyShader); + + this.renderer.popFramebuffer(); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); + + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + this.renderer.resetTextures(); + }, + + /** + * Copy the `source` Render Target to the `target` Render Target, using the + * given Color Matrix. + * + * The difference between this method and `copyFrame` is that this method + * uses a color matrix shader, where you have full control over the luminance + * values used during the copy. If you don't need this, you can use the faster + * `copyFrame` method instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#drawFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Display.ColorMatrix} [colorMatrix] - The Color Matrix to use when performing the draw. + */ + drawFrame: function (source, target, clearAlpha, colorMatrix) + { + if (clearAlpha === undefined) { clearAlpha = true; } + if (colorMatrix === undefined) { colorMatrix = this.colorMatrix; } + + var gl = this.gl; + + this.set1i('uMainSampler', 0, this.colorMatrixShader); + this.set1fv('uColorMatrix', colorMatrix.getData(), this.colorMatrixShader); + this.set1f('uAlpha', colorMatrix.alpha, this.colorMatrixShader); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); + + if (target) + { + gl.viewport(0, 0, target.width, target.height); + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + } + else + { + gl.viewport(0, 0, source.width, source.height); + } + + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using a linear blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blendFrames + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Renderer.WebGL.WebGLShader} [blendShader] - The shader to use during the blend copy. + */ + blendFrames: function (source1, source2, target, strength, clearAlpha, blendShader) + { + if (strength === undefined) { strength = 1; } + if (clearAlpha === undefined) { clearAlpha = true; } + if (blendShader === undefined) { blendShader = this.linearShader; } + + var gl = this.gl; + + this.set1i('uMainSampler1', 0, blendShader); + this.set1i('uMainSampler2', 1, blendShader); + this.set1f('uStrength', strength, blendShader); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source1.texture); + + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_2D, source2.texture); + + if (target) + { + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + gl.viewport(0, 0, target.width, target.height); + } + else + { + gl.viewport(0, 0, source1.width, source1.height); + } + + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using an additive blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blendFramesAdditive + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) + { + this.blendFrames(source1, source2, target, strength, clearAlpha, this.addShader); + }, + + /** + * Clears the given Render Target. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#clearFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + clearFrame: function (target, clearAlpha) + { + if (clearAlpha === undefined) { clearAlpha = true; } + + var gl = this.gl; + + gl.viewport(0, 0, target.width, target.height); + + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + + var fbo = this.renderer.currentFramebuffer; + + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + } + +}); + +module.exports = UtilityPipeline; + + +/***/ }), +/* 865 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_ADD_BLEND_FS', + '', + 'precision mediump float;', + '', + 'uniform sampler2D uMainSampler1;', + 'uniform sampler2D uMainSampler2;', + 'uniform float uStrength;', + '', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' vec4 frame1 = texture2D(uMainSampler1, outTexCoord);', + ' vec4 frame2 = texture2D(uMainSampler2, outTexCoord);', + '', + ' gl_FragColor = frame1 + frame2 * uStrength;', + '}', + '' +].join('\n'); + + +/***/ }), +/* 866 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_COLORMATRIX_FS', + '', + 'precision mediump float;', + '', + 'uniform sampler2D uMainSampler;', + 'uniform float uColorMatrix[20];', + 'uniform float uAlpha;', + '', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' vec4 c = texture2D(uMainSampler, outTexCoord);', + '', + ' if (uAlpha == 0.0)', + ' {', + ' gl_FragColor = c;', + '', + ' return;', + ' }', + '', + ' if (c.a > 0.0)', + ' {', + ' c.rgb /= c.a;', + ' }', + '', + ' vec4 result;', + '', + ' result.r = (uColorMatrix[0] * c.r) + (uColorMatrix[1] * c.g) + (uColorMatrix[2] * c.b) + (uColorMatrix[3] * c.a) + uColorMatrix[4];', + ' result.g = (uColorMatrix[5] * c.r) + (uColorMatrix[6] * c.g) + (uColorMatrix[7] * c.b) + (uColorMatrix[8] * c.a) + uColorMatrix[9];', + ' result.b = (uColorMatrix[10] * c.r) + (uColorMatrix[11] * c.g) + (uColorMatrix[12] * c.b) + (uColorMatrix[13] * c.a) + uColorMatrix[14];', + ' result.a = (uColorMatrix[15] * c.r) + (uColorMatrix[16] * c.g) + (uColorMatrix[17] * c.b) + (uColorMatrix[18] * c.a) + uColorMatrix[19];', + '', + ' vec3 rgb = mix(c.rgb, result.rgb, uAlpha);', + '', + ' rgb *= result.a;', + '', + ' gl_FragColor = vec4(rgb, result.a);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 867 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_COPY_FS', + '', + 'precision mediump float;', + '', + 'uniform sampler2D uMainSampler;', + 'uniform float uBrightness;', + '', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' gl_FragColor = texture2D(uMainSampler, outTexCoord) * uBrightness;', + '}', + '' +].join('\n'); + + +/***/ }), +/* 868 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_LINEAR_BLEND_FS', + '', + 'precision mediump float;', + '', + 'uniform sampler2D uMainSampler1;', + 'uniform sampler2D uMainSampler2;', + 'uniform float uStrength;', + '', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' vec4 frame1 = texture2D(uMainSampler1, outTexCoord);', + ' vec4 frame2 = texture2D(uMainSampler2, outTexCoord);', + '', + ' gl_FragColor = mix(frame1, frame2 * uStrength, 0.5);', + '}', + '' +].join('\n'); + + +/***/ }), +/* 869 */ /***/ (function(module, exports) { /** @@ -146361,7 +155143,7 @@ module.exports = 'addtexture'; /***/ }), -/* 815 */ +/* 870 */ /***/ (function(module, exports) { /** @@ -146387,7 +155169,7 @@ module.exports = 'onerror'; /***/ }), -/* 816 */ +/* 871 */ /***/ (function(module, exports) { /** @@ -146416,7 +155198,7 @@ module.exports = 'onload'; /***/ }), -/* 817 */ +/* 872 */ /***/ (function(module, exports) { /** @@ -146439,7 +155221,7 @@ module.exports = 'ready'; /***/ }), -/* 818 */ +/* 873 */ /***/ (function(module, exports) { /** @@ -146467,7 +155249,7 @@ module.exports = 'removetexture'; /***/ }), -/* 819 */ +/* 874 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146482,14 +155264,14 @@ module.exports = 'removetexture'; module.exports = { - GenerateTexture: __webpack_require__(355), - Palettes: __webpack_require__(820) + GenerateTexture: __webpack_require__(364), + Palettes: __webpack_require__(875) }; /***/ }), -/* 820 */ +/* 875 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146504,17 +155286,17 @@ module.exports = { module.exports = { - ARNE16: __webpack_require__(356), - C64: __webpack_require__(821), - CGA: __webpack_require__(822), - JMP: __webpack_require__(823), - MSX: __webpack_require__(824) + ARNE16: __webpack_require__(365), + C64: __webpack_require__(876), + CGA: __webpack_require__(877), + JMP: __webpack_require__(878), + MSX: __webpack_require__(879) }; /***/ }), -/* 821 */ +/* 876 */ /***/ (function(module, exports) { /** @@ -146552,7 +155334,7 @@ module.exports = { /***/ }), -/* 822 */ +/* 877 */ /***/ (function(module, exports) { /** @@ -146590,7 +155372,7 @@ module.exports = { /***/ }), -/* 823 */ +/* 878 */ /***/ (function(module, exports) { /** @@ -146628,7 +155410,7 @@ module.exports = { /***/ }), -/* 824 */ +/* 879 */ /***/ (function(module, exports) { /** @@ -146666,7 +155448,7 @@ module.exports = { /***/ }), -/* 825 */ +/* 880 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146680,20 +155462,20 @@ module.exports = { */ module.exports = { - Path: __webpack_require__(826), - MoveTo: __webpack_require__(360), + Path: __webpack_require__(881), + MoveTo: __webpack_require__(369), - CubicBezier: __webpack_require__(357), - Curve: __webpack_require__(83), - Ellipse: __webpack_require__(358), - Line: __webpack_require__(359), - QuadraticBezier: __webpack_require__(361), - Spline: __webpack_require__(362) + CubicBezier: __webpack_require__(366), + Curve: __webpack_require__(88), + Ellipse: __webpack_require__(367), + Line: __webpack_require__(368), + QuadraticBezier: __webpack_require__(370), + Spline: __webpack_require__(371) }; /***/ }), -/* 826 */ +/* 881 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -146705,14 +155487,14 @@ module.exports = { // Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) var Class = __webpack_require__(0); -var CubicBezierCurve = __webpack_require__(357); -var EllipseCurve = __webpack_require__(358); +var CubicBezierCurve = __webpack_require__(366); +var EllipseCurve = __webpack_require__(367); var GameObjectFactory = __webpack_require__(5); -var LineCurve = __webpack_require__(359); -var MovePathTo = __webpack_require__(360); -var QuadraticBezierCurve = __webpack_require__(361); +var LineCurve = __webpack_require__(368); +var MovePathTo = __webpack_require__(369); +var QuadraticBezierCurve = __webpack_require__(370); var Rectangle = __webpack_require__(9); -var SplineCurve = __webpack_require__(362); +var SplineCurve = __webpack_require__(371); var Vector2 = __webpack_require__(3); var MATH_CONST = __webpack_require__(13); @@ -146974,7 +155756,7 @@ var Path = new Class({ * @generic {Phaser.GameObjects.Graphics} G - [out,$return] * * @param {Phaser.GameObjects.Graphics} graphics - The Graphics Game Object to draw to. - * @param {integer} [pointsTotal=32] - The number of points to draw for each Curve. Higher numbers result in a smoother curve but require more processing. + * @param {number} [pointsTotal=32] - The number of points to draw for each Curve. Higher numbers result in a smoother curve but require more processing. * * @return {Phaser.GameObjects.Graphics} The Graphics object which was drawn to. */ @@ -147003,8 +155785,8 @@ var Path = new Class({ * * @param {number} [xRadius=0] - The horizontal radius of ellipse. * @param {number} [yRadius=0] - The vertical radius of ellipse. - * @param {integer} [startAngle=0] - The start angle of the ellipse, in degrees. - * @param {integer} [endAngle=360] - The end angle of the ellipse, in degrees. + * @param {number} [startAngle=0] - The start angle of the ellipse, in degrees. + * @param {number} [endAngle=360] - The end angle of the ellipse, in degrees. * @param {boolean} [clockwise=false] - Whether the ellipse angles are given as clockwise (`true`) or counter-clockwise (`false`). * @param {number} [rotation=0] - The rotation of the ellipse, in degrees. * @@ -147090,7 +155872,7 @@ var Path = new Class({ * @generic {Phaser.Math.Vector2} O - [out,$return] * * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. - * @param {integer} [accuracy=16] - The accuracy of the bounds calculations. Higher values are more accurate at the cost of calculation speed. + * @param {number} [accuracy=16] - The accuracy of the bounds calculations. Higher values are more accurate at the cost of calculation speed. * * @return {Phaser.Geom.Rectangle} The modified `out` Rectangle, or a new Rectangle if none was provided. */ @@ -147272,7 +156054,7 @@ var Path = new Class({ * @method Phaser.Curves.Path#getPoints * @since 3.0.0 * - * @param {integer} [divisions=12] - The number of divisions per resolution per curve. + * @param {number} [divisions=12] - The number of divisions per resolution per curve. * * @return {Phaser.Math.Vector2[]} An array of Vector2 objects that containing the points along the Path. */ @@ -147349,7 +156131,7 @@ var Path = new Class({ * @method Phaser.Curves.Path#getSpacedPoints * @since 3.0.0 * - * @param {integer} [divisions=40] - The amount of points to divide this Path into. + * @param {number} [divisions=40] - The amount of points to divide this Path into. * * @return {Phaser.Math.Vector2[]} A list of the points this path was subdivided into. */ @@ -147582,7 +156364,7 @@ module.exports = Path; /***/ }), -/* 827 */ +/* 882 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147597,15 +156379,15 @@ module.exports = Path; module.exports = { - DataManager: __webpack_require__(120), - DataManagerPlugin: __webpack_require__(828), - Events: __webpack_require__(293) + DataManager: __webpack_require__(97), + DataManagerPlugin: __webpack_require__(883), + Events: __webpack_require__(307) }; /***/ }), -/* 828 */ +/* 883 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147615,8 +156397,8 @@ module.exports = { */ var Class = __webpack_require__(0); -var DataManager = __webpack_require__(120); -var PluginCache = __webpack_require__(23); +var DataManager = __webpack_require__(97); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); /** @@ -147732,7 +156514,7 @@ module.exports = DataManagerPlugin; /***/ }), -/* 829 */ +/* 884 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147747,18 +156529,20 @@ module.exports = DataManagerPlugin; module.exports = { - Align: __webpack_require__(830), - BaseShader: __webpack_require__(363), - Bounds: __webpack_require__(833), - Canvas: __webpack_require__(837), - Color: __webpack_require__(364), - Masks: __webpack_require__(846) + Align: __webpack_require__(885), + BaseShader: __webpack_require__(372), + Bounds: __webpack_require__(888), + Canvas: __webpack_require__(892), + Color: __webpack_require__(373), + ColorMatrix: __webpack_require__(264), + Masks: __webpack_require__(902), + RGB: __webpack_require__(376) }; /***/ }), -/* 830 */ +/* 885 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147767,8 +156551,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(108); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(120); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Display.Align @@ -147776,8 +156560,8 @@ var Extend = __webpack_require__(19); var Align = { - In: __webpack_require__(831), - To: __webpack_require__(832) + In: __webpack_require__(886), + To: __webpack_require__(887) }; @@ -147788,7 +156572,7 @@ module.exports = Align; /***/ }), -/* 831 */ +/* 886 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147803,22 +156587,22 @@ module.exports = Align; module.exports = { - BottomCenter: __webpack_require__(267), - BottomLeft: __webpack_require__(268), - BottomRight: __webpack_require__(269), - Center: __webpack_require__(270), - LeftCenter: __webpack_require__(272), - QuickSet: __webpack_require__(266), - RightCenter: __webpack_require__(273), - TopCenter: __webpack_require__(274), - TopLeft: __webpack_require__(275), - TopRight: __webpack_require__(276) + BottomCenter: __webpack_require__(282), + BottomLeft: __webpack_require__(283), + BottomRight: __webpack_require__(284), + Center: __webpack_require__(285), + LeftCenter: __webpack_require__(287), + QuickSet: __webpack_require__(281), + RightCenter: __webpack_require__(288), + TopCenter: __webpack_require__(289), + TopLeft: __webpack_require__(290), + TopRight: __webpack_require__(291) }; /***/ }), -/* 832 */ +/* 887 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147833,25 +156617,25 @@ module.exports = { module.exports = { - BottomCenter: __webpack_require__(254), - BottomLeft: __webpack_require__(255), - BottomRight: __webpack_require__(256), - LeftBottom: __webpack_require__(257), - LeftCenter: __webpack_require__(258), - LeftTop: __webpack_require__(259), - QuickSet: __webpack_require__(253), - RightBottom: __webpack_require__(260), - RightCenter: __webpack_require__(261), - RightTop: __webpack_require__(262), - TopCenter: __webpack_require__(263), - TopLeft: __webpack_require__(264), - TopRight: __webpack_require__(265) + BottomCenter: __webpack_require__(269), + BottomLeft: __webpack_require__(270), + BottomRight: __webpack_require__(271), + LeftBottom: __webpack_require__(272), + LeftCenter: __webpack_require__(273), + LeftTop: __webpack_require__(274), + QuickSet: __webpack_require__(268), + RightBottom: __webpack_require__(275), + RightCenter: __webpack_require__(276), + RightTop: __webpack_require__(277), + TopCenter: __webpack_require__(278), + TopLeft: __webpack_require__(279), + TopRight: __webpack_require__(280) }; /***/ }), -/* 833 */ +/* 888 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147866,28 +156650,28 @@ module.exports = { module.exports = { - CenterOn: __webpack_require__(271), - GetBottom: __webpack_require__(35), - GetBounds: __webpack_require__(834), - GetCenterX: __webpack_require__(77), - GetCenterY: __webpack_require__(79), - GetLeft: __webpack_require__(36), - GetOffsetX: __webpack_require__(835), - GetOffsetY: __webpack_require__(836), - GetRight: __webpack_require__(37), - GetTop: __webpack_require__(38), - SetBottom: __webpack_require__(48), - SetCenterX: __webpack_require__(78), - SetCenterY: __webpack_require__(80), - SetLeft: __webpack_require__(46), - SetRight: __webpack_require__(47), - SetTop: __webpack_require__(45) + CenterOn: __webpack_require__(286), + GetBottom: __webpack_require__(40), + GetBounds: __webpack_require__(889), + GetCenterX: __webpack_require__(83), + GetCenterY: __webpack_require__(85), + GetLeft: __webpack_require__(41), + GetOffsetX: __webpack_require__(890), + GetOffsetY: __webpack_require__(891), + GetRight: __webpack_require__(42), + GetTop: __webpack_require__(43), + SetBottom: __webpack_require__(54), + SetCenterX: __webpack_require__(84), + SetCenterY: __webpack_require__(86), + SetLeft: __webpack_require__(52), + SetRight: __webpack_require__(53), + SetTop: __webpack_require__(51) }; /***/ }), -/* 834 */ +/* 889 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -147896,10 +156680,10 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(35); -var GetLeft = __webpack_require__(36); -var GetRight = __webpack_require__(37); -var GetTop = __webpack_require__(38); +var GetBottom = __webpack_require__(40); +var GetLeft = __webpack_require__(41); +var GetRight = __webpack_require__(42); +var GetTop = __webpack_require__(43); /** * Returns the unrotated bounds of the Game Object as a rectangle. @@ -147931,7 +156715,7 @@ module.exports = GetBounds; /***/ }), -/* 835 */ +/* 890 */ /***/ (function(module, exports) { /** @@ -147961,7 +156745,7 @@ module.exports = GetOffsetX; /***/ }), -/* 836 */ +/* 891 */ /***/ (function(module, exports) { /** @@ -147991,7 +156775,7 @@ module.exports = GetOffsetY; /***/ }), -/* 837 */ +/* 892 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148006,17 +156790,17 @@ module.exports = GetOffsetY; module.exports = { - CanvasInterpolation: __webpack_require__(350), - CanvasPool: __webpack_require__(26), - Smoothing: __webpack_require__(177), - TouchAction: __webpack_require__(838), - UserSelect: __webpack_require__(839) + CanvasInterpolation: __webpack_require__(359), + CanvasPool: __webpack_require__(31), + Smoothing: __webpack_require__(184), + TouchAction: __webpack_require__(893), + UserSelect: __webpack_require__(894) }; /***/ }), -/* 838 */ +/* 893 */ /***/ (function(module, exports) { /** @@ -148051,7 +156835,7 @@ module.exports = TouchAction; /***/ }), -/* 839 */ +/* 894 */ /***/ (function(module, exports) { /** @@ -148098,7 +156882,75 @@ module.exports = UserSelect; /***/ }), -/* 840 */ +/* 895 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetColor = __webpack_require__(100); + +/** + * Return an array of Colors in a Color Spectrum. + * + * @function Phaser.Display.Color.ColorSpectrum + * @since 3.50.0 + * + * @return {Phaser.Types.Display.ColorObject[]} An array containing 1024 elements, where each contains a Color Object. + */ +var ColorSpectrum = function () +{ + var colors = []; + + var range = 255; + + var i; + var r = 255; + var g = 0; + var b = 0; + + // Red to Yellow + for (i = 0; i <= range; i++) + { + colors.push({ r: r, g: i, b: b, color: GetColor(r, i, b) }); + } + + g = 255; + + // Yellow to Green + for (i = range; i >= 0; i--) + { + colors.push({ r: i, g: g, b: b, color: GetColor(i, g, b) }); + } + + r = 0; + + // Green to Blue + for (i = 0; i <= range; i++, g--) + { + colors.push({ r: r, g: g, b: i, color: GetColor(r, g, i) }); + } + + g = 0; + b = 255; + + // Blue to Red + for (i = 0; i <= range; i++, b--, r++) + { + colors.push({ r: r, g: g, b: b, color: GetColor(r, g, b) }); + } + + return colors; +}; + +module.exports = ColorSpectrum; + + +/***/ }), +/* 896 */ /***/ (function(module, exports) { /** @@ -148138,7 +156990,7 @@ module.exports = ColorToRGBA; /***/ }), -/* 841 */ +/* 897 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148147,8 +156999,8 @@ module.exports = ColorToRGBA; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(32); -var HueToComponent = __webpack_require__(366); +var Color = __webpack_require__(36); +var HueToComponent = __webpack_require__(375); /** * Converts HSL (hue, saturation and lightness) values to a Phaser Color object. @@ -148188,7 +157040,7 @@ module.exports = HSLToColor; /***/ }), -/* 842 */ +/* 898 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148197,7 +157049,7 @@ module.exports = HSLToColor; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HSVToRGB = __webpack_require__(176); +var HSVToRGB = __webpack_require__(180); /** * Get HSV color wheel values in an array which will be 360 elements in size. @@ -148229,7 +157081,7 @@ module.exports = HSVColorWheel; /***/ }), -/* 843 */ +/* 899 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148238,7 +157090,7 @@ module.exports = HSVColorWheel; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Linear = __webpack_require__(124); +var Linear = __webpack_require__(130); /** * @namespace Phaser.Display.Color.Interpolate @@ -148337,7 +157189,7 @@ module.exports = { /***/ }), -/* 844 */ +/* 900 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148346,8 +157198,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Between = __webpack_require__(182); -var Color = __webpack_require__(32); +var Between = __webpack_require__(187); +var Color = __webpack_require__(36); /** * Creates a new Color object where the r, g, and b values have been set to random values @@ -148356,8 +157208,8 @@ var Color = __webpack_require__(32); * @function Phaser.Display.Color.RandomRGB * @since 3.0.0 * - * @param {integer} [min=0] - The minimum value to set the random range from (between 0 and 255) - * @param {integer} [max=255] - The maximum value to set the random range from (between 0 and 255) + * @param {number} [min=0] - The minimum value to set the random range from (between 0 and 255) + * @param {number} [max=255] - The maximum value to set the random range from (between 0 and 255) * * @return {Phaser.Display.Color} A Color object. */ @@ -148373,7 +157225,7 @@ module.exports = RandomRGB; /***/ }), -/* 845 */ +/* 901 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148382,7 +157234,7 @@ module.exports = RandomRGB; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ComponentToHex = __webpack_require__(365); +var ComponentToHex = __webpack_require__(374); /** * Converts the color values into an HTML compatible color string, prefixed with either `#` or `0x`. @@ -148390,10 +157242,10 @@ var ComponentToHex = __webpack_require__(365); * @function Phaser.Display.Color.RGBToString * @since 3.0.0 * - * @param {integer} r - The red color value. A number between 0 and 255. - * @param {integer} g - The green color value. A number between 0 and 255. - * @param {integer} b - The blue color value. A number between 0 and 255. - * @param {integer} [a=255] - The alpha value. A number between 0 and 255. + * @param {number} r - The red color value. A number between 0 and 255. + * @param {number} g - The green color value. A number between 0 and 255. + * @param {number} b - The blue color value. A number between 0 and 255. + * @param {number} [a=255] - The alpha value. A number between 0 and 255. * @param {string} [prefix=#] - The prefix of the string. Either `#` or `0x`. * * @return {string} A string-based representation of the color values. @@ -148417,7 +157269,7 @@ module.exports = RGBToString; /***/ }), -/* 846 */ +/* 902 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148432,14 +157284,14 @@ module.exports = RGBToString; module.exports = { - BitmapMask: __webpack_require__(287), - GeometryMask: __webpack_require__(288) + BitmapMask: __webpack_require__(302), + GeometryMask: __webpack_require__(303) }; /***/ }), -/* 847 */ +/* 903 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148454,14 +157306,14 @@ module.exports = { var Dom = { - AddToDOM: __webpack_require__(131), - DOMContentLoaded: __webpack_require__(367), - GetInnerHeight: __webpack_require__(368), - GetScreenOrientation: __webpack_require__(369), - GetTarget: __webpack_require__(374), - ParseXML: __webpack_require__(375), - RemoveFromDOM: __webpack_require__(188), - RequestAnimationFrame: __webpack_require__(353) + AddToDOM: __webpack_require__(137), + DOMContentLoaded: __webpack_require__(377), + GetInnerHeight: __webpack_require__(378), + GetScreenOrientation: __webpack_require__(379), + GetTarget: __webpack_require__(384), + ParseXML: __webpack_require__(385), + RemoveFromDOM: __webpack_require__(193), + RequestAnimationFrame: __webpack_require__(362) }; @@ -148469,7 +157321,7 @@ module.exports = Dom; /***/ }), -/* 848 */ +/* 904 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148482,11 +157334,11 @@ module.exports = Dom; * @namespace Phaser.Events */ -module.exports = { EventEmitter: __webpack_require__(849) }; +module.exports = { EventEmitter: __webpack_require__(905) }; /***/ }), -/* 849 */ +/* 905 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148496,8 +157348,8 @@ module.exports = { EventEmitter: __webpack_require__(849) }; */ var Class = __webpack_require__(0); -var EE = __webpack_require__(12); -var PluginCache = __webpack_require__(23); +var EE = __webpack_require__(10); +var PluginCache = __webpack_require__(25); /** * @classdesc @@ -148670,7 +157522,7 @@ module.exports = EventEmitter; /***/ }), -/* 850 */ +/* 906 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -148679,33 +157531,33 @@ module.exports = EventEmitter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AddToDOM = __webpack_require__(131); -var AnimationManager = __webpack_require__(301); -var CacheManager = __webpack_require__(305); -var CanvasPool = __webpack_require__(26); +var AddToDOM = __webpack_require__(137); +var AnimationManager = __webpack_require__(313); +var CacheManager = __webpack_require__(317); +var CanvasPool = __webpack_require__(31); var Class = __webpack_require__(0); -var Config = __webpack_require__(327); -var CreateDOMContainer = __webpack_require__(851); -var CreateRenderer = __webpack_require__(349); -var DataManager = __webpack_require__(120); -var DebugHeader = __webpack_require__(351); -var Device = __webpack_require__(328); -var DOMContentLoaded = __webpack_require__(367); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(21); -var InputManager = __webpack_require__(376); -var PluginCache = __webpack_require__(23); -var PluginManager = __webpack_require__(381); -var ScaleManager = __webpack_require__(382); -var SceneManager = __webpack_require__(384); -var TextureEvents = __webpack_require__(130); -var TextureManager = __webpack_require__(389); -var TimeStep = __webpack_require__(352); -var VisibilityHandler = __webpack_require__(354); +var Config = __webpack_require__(338); +var CreateDOMContainer = __webpack_require__(907); +var CreateRenderer = __webpack_require__(358); +var DataManager = __webpack_require__(97); +var DebugHeader = __webpack_require__(360); +var Device = __webpack_require__(339); +var DOMContentLoaded = __webpack_require__(377); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(23); +var InputManager = __webpack_require__(386); +var PluginCache = __webpack_require__(25); +var PluginManager = __webpack_require__(391); +var ScaleManager = __webpack_require__(392); +var SceneManager = __webpack_require__(394); +var TextureEvents = __webpack_require__(136); +var TextureManager = __webpack_require__(399); +var TimeStep = __webpack_require__(361); +var VisibilityHandler = __webpack_require__(363); if (true) { - var SoundManagerCreator = __webpack_require__(393); + var SoundManagerCreator = __webpack_require__(403); } if (false) @@ -149373,7 +158225,7 @@ module.exports = Game; /***/ }), -/* 851 */ +/* 907 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -149382,7 +158234,7 @@ module.exports = Game; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AddToDOM = __webpack_require__(131); +var AddToDOM = __webpack_require__(137); var CreateDOMContainer = function (game) { @@ -149417,7 +158269,7 @@ module.exports = CreateDOMContainer; /***/ }), -/* 852 */ +/* 908 */ /***/ (function(module, exports) { /** @@ -149438,7 +158290,7 @@ module.exports = 'boot'; /***/ }), -/* 853 */ +/* 909 */ /***/ (function(module, exports) { /** @@ -149459,7 +158311,7 @@ module.exports = 'destroy'; /***/ }), -/* 854 */ +/* 910 */ /***/ (function(module, exports) { /** @@ -149487,7 +158339,7 @@ module.exports = 'dragend'; /***/ }), -/* 855 */ +/* 911 */ /***/ (function(module, exports) { /** @@ -149518,7 +158370,7 @@ module.exports = 'dragenter'; /***/ }), -/* 856 */ +/* 912 */ /***/ (function(module, exports) { /** @@ -149550,7 +158402,7 @@ module.exports = 'drag'; /***/ }), -/* 857 */ +/* 913 */ /***/ (function(module, exports) { /** @@ -149581,7 +158433,7 @@ module.exports = 'dragleave'; /***/ }), -/* 858 */ +/* 914 */ /***/ (function(module, exports) { /** @@ -149615,7 +158467,7 @@ module.exports = 'dragover'; /***/ }), -/* 859 */ +/* 915 */ /***/ (function(module, exports) { /** @@ -149645,7 +158497,7 @@ module.exports = 'dragstart'; /***/ }), -/* 860 */ +/* 916 */ /***/ (function(module, exports) { /** @@ -149674,7 +158526,7 @@ module.exports = 'drop'; /***/ }), -/* 861 */ +/* 917 */ /***/ (function(module, exports) { /** @@ -149701,7 +158553,7 @@ module.exports = 'gameout'; /***/ }), -/* 862 */ +/* 918 */ /***/ (function(module, exports) { /** @@ -149728,7 +158580,7 @@ module.exports = 'gameover'; /***/ }), -/* 863 */ +/* 919 */ /***/ (function(module, exports) { /** @@ -149769,7 +158621,7 @@ module.exports = 'gameobjectdown'; /***/ }), -/* 864 */ +/* 920 */ /***/ (function(module, exports) { /** @@ -149800,7 +158652,7 @@ module.exports = 'dragend'; /***/ }), -/* 865 */ +/* 921 */ /***/ (function(module, exports) { /** @@ -149830,7 +158682,7 @@ module.exports = 'dragenter'; /***/ }), -/* 866 */ +/* 922 */ /***/ (function(module, exports) { /** @@ -149861,7 +158713,7 @@ module.exports = 'drag'; /***/ }), -/* 867 */ +/* 923 */ /***/ (function(module, exports) { /** @@ -149891,7 +158743,7 @@ module.exports = 'dragleave'; /***/ }), -/* 868 */ +/* 924 */ /***/ (function(module, exports) { /** @@ -149924,7 +158776,7 @@ module.exports = 'dragover'; /***/ }), -/* 869 */ +/* 925 */ /***/ (function(module, exports) { /** @@ -149958,7 +158810,7 @@ module.exports = 'dragstart'; /***/ }), -/* 870 */ +/* 926 */ /***/ (function(module, exports) { /** @@ -149988,7 +158840,7 @@ module.exports = 'drop'; /***/ }), -/* 871 */ +/* 927 */ /***/ (function(module, exports) { /** @@ -150029,7 +158881,7 @@ module.exports = 'gameobjectmove'; /***/ }), -/* 872 */ +/* 928 */ /***/ (function(module, exports) { /** @@ -150070,7 +158922,7 @@ module.exports = 'gameobjectout'; /***/ }), -/* 873 */ +/* 929 */ /***/ (function(module, exports) { /** @@ -150111,7 +158963,7 @@ module.exports = 'gameobjectover'; /***/ }), -/* 874 */ +/* 930 */ /***/ (function(module, exports) { /** @@ -150152,7 +159004,7 @@ module.exports = 'pointerdown'; /***/ }), -/* 875 */ +/* 931 */ /***/ (function(module, exports) { /** @@ -150193,7 +159045,7 @@ module.exports = 'pointermove'; /***/ }), -/* 876 */ +/* 932 */ /***/ (function(module, exports) { /** @@ -150232,7 +159084,7 @@ module.exports = 'pointerout'; /***/ }), -/* 877 */ +/* 933 */ /***/ (function(module, exports) { /** @@ -150273,7 +159125,7 @@ module.exports = 'pointerover'; /***/ }), -/* 878 */ +/* 934 */ /***/ (function(module, exports) { /** @@ -150314,7 +159166,7 @@ module.exports = 'pointerup'; /***/ }), -/* 879 */ +/* 935 */ /***/ (function(module, exports) { /** @@ -150356,7 +159208,7 @@ module.exports = 'wheel'; /***/ }), -/* 880 */ +/* 936 */ /***/ (function(module, exports) { /** @@ -150397,7 +159249,7 @@ module.exports = 'gameobjectup'; /***/ }), -/* 881 */ +/* 937 */ /***/ (function(module, exports) { /** @@ -150441,7 +159293,7 @@ module.exports = 'gameobjectwheel'; /***/ }), -/* 882 */ +/* 938 */ /***/ (function(module, exports) { /** @@ -150462,7 +159314,7 @@ module.exports = 'boot'; /***/ }), -/* 883 */ +/* 939 */ /***/ (function(module, exports) { /** @@ -150487,7 +159339,7 @@ module.exports = 'process'; /***/ }), -/* 884 */ +/* 940 */ /***/ (function(module, exports) { /** @@ -150508,7 +159360,7 @@ module.exports = 'update'; /***/ }), -/* 885 */ +/* 941 */ /***/ (function(module, exports) { /** @@ -150543,7 +159395,7 @@ module.exports = 'pointerdown'; /***/ }), -/* 886 */ +/* 942 */ /***/ (function(module, exports) { /** @@ -150577,7 +159429,7 @@ module.exports = 'pointerdownoutside'; /***/ }), -/* 887 */ +/* 943 */ /***/ (function(module, exports) { /** @@ -150612,7 +159464,7 @@ module.exports = 'pointermove'; /***/ }), -/* 888 */ +/* 944 */ /***/ (function(module, exports) { /** @@ -150647,7 +159499,7 @@ module.exports = 'pointerout'; /***/ }), -/* 889 */ +/* 945 */ /***/ (function(module, exports) { /** @@ -150682,7 +159534,7 @@ module.exports = 'pointerover'; /***/ }), -/* 890 */ +/* 946 */ /***/ (function(module, exports) { /** @@ -150717,7 +159569,7 @@ module.exports = 'pointerup'; /***/ }), -/* 891 */ +/* 947 */ /***/ (function(module, exports) { /** @@ -150751,7 +159603,7 @@ module.exports = 'pointerupoutside'; /***/ }), -/* 892 */ +/* 948 */ /***/ (function(module, exports) { /** @@ -150789,7 +159641,7 @@ module.exports = 'wheel'; /***/ }), -/* 893 */ +/* 949 */ /***/ (function(module, exports) { /** @@ -150813,7 +159665,7 @@ module.exports = 'pointerlockchange'; /***/ }), -/* 894 */ +/* 950 */ /***/ (function(module, exports) { /** @@ -150835,7 +159687,7 @@ module.exports = 'preupdate'; /***/ }), -/* 895 */ +/* 951 */ /***/ (function(module, exports) { /** @@ -150856,7 +159708,7 @@ module.exports = 'shutdown'; /***/ }), -/* 896 */ +/* 952 */ /***/ (function(module, exports) { /** @@ -150878,7 +159730,7 @@ module.exports = 'start'; /***/ }), -/* 897 */ +/* 953 */ /***/ (function(module, exports) { /** @@ -150903,7 +159755,7 @@ module.exports = 'update'; /***/ }), -/* 898 */ +/* 954 */ /***/ (function(module, exports) { /** @@ -150933,7 +159785,7 @@ module.exports = 'addfile'; /***/ }), -/* 899 */ +/* 955 */ /***/ (function(module, exports) { /** @@ -150954,14 +159806,14 @@ module.exports = 'addfile'; * @since 3.0.0 * * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. - * @param {integer} totalComplete - The total number of files that successfully loaded. - * @param {integer} totalFailed - The total number of files that failed to load. + * @param {number} totalComplete - The total number of files that successfully loaded. + * @param {number} totalFailed - The total number of files that failed to load. */ module.exports = 'complete'; /***/ }), -/* 900 */ +/* 956 */ /***/ (function(module, exports) { /** @@ -150990,7 +159842,7 @@ module.exports = 'filecomplete'; /***/ }), -/* 901 */ +/* 957 */ /***/ (function(module, exports) { /** @@ -151044,7 +159896,7 @@ module.exports = 'filecomplete-'; /***/ }), -/* 902 */ +/* 958 */ /***/ (function(module, exports) { /** @@ -151069,7 +159921,7 @@ module.exports = 'loaderror'; /***/ }), -/* 903 */ +/* 959 */ /***/ (function(module, exports) { /** @@ -151095,7 +159947,7 @@ module.exports = 'load'; /***/ }), -/* 904 */ +/* 960 */ /***/ (function(module, exports) { /** @@ -151122,7 +159974,7 @@ module.exports = 'fileprogress'; /***/ }), -/* 905 */ +/* 961 */ /***/ (function(module, exports) { /** @@ -151151,7 +160003,7 @@ module.exports = 'postprocess'; /***/ }), -/* 906 */ +/* 962 */ /***/ (function(module, exports) { /** @@ -151176,7 +160028,7 @@ module.exports = 'progress'; /***/ }), -/* 907 */ +/* 963 */ /***/ (function(module, exports) { /** @@ -151203,7 +160055,7 @@ module.exports = 'start'; /***/ }), -/* 908 */ +/* 964 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151265,7 +160117,7 @@ module.exports = InjectionMap; /***/ }), -/* 909 */ +/* 965 */ /***/ (function(module, exports) { /** @@ -151283,7 +160135,7 @@ module.exports = InjectionMap; * @since 3.7.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * @param {*} xml - The XML data. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. @@ -151346,7 +160198,7 @@ module.exports = AtlasXML; /***/ }), -/* 910 */ +/* 966 */ /***/ (function(module, exports) { /** @@ -151364,7 +160216,7 @@ module.exports = AtlasXML; * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. */ @@ -151381,7 +160233,7 @@ module.exports = Canvas; /***/ }), -/* 911 */ +/* 967 */ /***/ (function(module, exports) { /** @@ -151399,7 +160251,7 @@ module.exports = Canvas; * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. */ @@ -151416,7 +160268,7 @@ module.exports = Image; /***/ }), -/* 912 */ +/* 968 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151425,7 +160277,7 @@ module.exports = Image; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Parses a Texture Atlas JSON Array and adds the Frames to the Texture. @@ -151437,7 +160289,7 @@ var Clone = __webpack_require__(69); * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * @param {object} json - The JSON data. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. @@ -151525,7 +160377,7 @@ module.exports = JSONArray; /***/ }), -/* 913 */ +/* 969 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151534,7 +160386,7 @@ module.exports = JSONArray; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Parses a Texture Atlas JSON Hash and adds the Frames to the Texture. @@ -151546,7 +160398,7 @@ var Clone = __webpack_require__(69); * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * @param {object} json - The JSON data. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. @@ -151638,7 +160490,7 @@ module.exports = JSONHash; /***/ }), -/* 914 */ +/* 970 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151661,11 +160513,11 @@ var GetFastValue = __webpack_require__(2); * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. - * @param {integer} x - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. - * @param {integer} y - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. - * @param {integer} width - The width of the source image. - * @param {integer} height - The height of the source image. + * @param {number} sourceIndex - The index of the TextureSource. + * @param {number} x - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. + * @param {number} y - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. + * @param {number} width - The width of the source image. + * @param {number} height - The height of the source image. * @param {object} config - An object describing how to parse the Sprite Sheet. * @param {number} config.frameWidth - Width in pixels of a single frame in the sprite sheet. * @param {number} [config.frameHeight] - Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided. @@ -151763,7 +160615,7 @@ module.exports = SpriteSheet; /***/ }), -/* 915 */ +/* 971 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -151954,7 +160806,7 @@ module.exports = SpriteSheetFromAtlas; /***/ }), -/* 916 */ +/* 972 */ /***/ (function(module, exports) { /** @@ -152004,7 +160856,7 @@ var addFrame = function (texture, sourceIndex, name, frame) * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {integer} sourceIndex - The index of the TextureSource. + * @param {number} sourceIndex - The index of the TextureSource. * @param {object} yaml - The YAML data. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. @@ -152124,7 +160976,7 @@ TextureImporter: /***/ }), -/* 917 */ +/* 973 */ /***/ (function(module, exports) { /** @@ -152155,7 +161007,7 @@ module.exports = 'complete'; /***/ }), -/* 918 */ +/* 974 */ /***/ (function(module, exports) { /** @@ -152185,7 +161037,7 @@ module.exports = 'decoded'; /***/ }), -/* 919 */ +/* 975 */ /***/ (function(module, exports) { /** @@ -152217,7 +161069,7 @@ module.exports = 'decodedall'; /***/ }), -/* 920 */ +/* 976 */ /***/ (function(module, exports) { /** @@ -152249,7 +161101,7 @@ module.exports = 'destroy'; /***/ }), -/* 921 */ +/* 977 */ /***/ (function(module, exports) { /** @@ -152282,7 +161134,7 @@ module.exports = 'detune'; /***/ }), -/* 922 */ +/* 978 */ /***/ (function(module, exports) { /** @@ -152310,7 +161162,7 @@ module.exports = 'detune'; /***/ }), -/* 923 */ +/* 979 */ /***/ (function(module, exports) { /** @@ -152337,7 +161189,7 @@ module.exports = 'mute'; /***/ }), -/* 924 */ +/* 980 */ /***/ (function(module, exports) { /** @@ -152365,7 +161217,7 @@ module.exports = 'rate'; /***/ }), -/* 925 */ +/* 981 */ /***/ (function(module, exports) { /** @@ -152392,7 +161244,7 @@ module.exports = 'volume'; /***/ }), -/* 926 */ +/* 982 */ /***/ (function(module, exports) { /** @@ -152426,7 +161278,7 @@ module.exports = 'loop'; /***/ }), -/* 927 */ +/* 983 */ /***/ (function(module, exports) { /** @@ -152460,7 +161312,7 @@ module.exports = 'looped'; /***/ }), -/* 928 */ +/* 984 */ /***/ (function(module, exports) { /** @@ -152493,7 +161345,7 @@ module.exports = 'mute'; /***/ }), -/* 929 */ +/* 985 */ /***/ (function(module, exports) { /** @@ -152520,7 +161372,7 @@ module.exports = 'pauseall'; /***/ }), -/* 930 */ +/* 986 */ /***/ (function(module, exports) { /** @@ -152552,7 +161404,7 @@ module.exports = 'pause'; /***/ }), -/* 931 */ +/* 987 */ /***/ (function(module, exports) { /** @@ -152583,7 +161435,7 @@ module.exports = 'play'; /***/ }), -/* 932 */ +/* 988 */ /***/ (function(module, exports) { /** @@ -152616,7 +161468,7 @@ module.exports = 'rate'; /***/ }), -/* 933 */ +/* 989 */ /***/ (function(module, exports) { /** @@ -152643,7 +161495,7 @@ module.exports = 'resumeall'; /***/ }), -/* 934 */ +/* 990 */ /***/ (function(module, exports) { /** @@ -152676,7 +161528,7 @@ module.exports = 'resume'; /***/ }), -/* 935 */ +/* 991 */ /***/ (function(module, exports) { /** @@ -152709,7 +161561,7 @@ module.exports = 'seek'; /***/ }), -/* 936 */ +/* 992 */ /***/ (function(module, exports) { /** @@ -152736,7 +161588,7 @@ module.exports = 'stopall'; /***/ }), -/* 937 */ +/* 993 */ /***/ (function(module, exports) { /** @@ -152768,7 +161620,7 @@ module.exports = 'stop'; /***/ }), -/* 938 */ +/* 994 */ /***/ (function(module, exports) { /** @@ -152795,7 +161647,7 @@ module.exports = 'unlocked'; /***/ }), -/* 939 */ +/* 995 */ /***/ (function(module, exports) { /** @@ -152828,7 +161680,7 @@ module.exports = 'volume'; /***/ }), -/* 940 */ +/* 996 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152843,111 +161695,114 @@ module.exports = 'volume'; var GameObjects = { - Events: __webpack_require__(29), + Events: __webpack_require__(32), - DisplayList: __webpack_require__(941), - GameObjectCreator: __webpack_require__(16), + DisplayList: __webpack_require__(997), + GameObjectCreator: __webpack_require__(17), GameObjectFactory: __webpack_require__(5), - UpdateList: __webpack_require__(966), + UpdateList: __webpack_require__(1023), Components: __webpack_require__(11), - BuildGameObject: __webpack_require__(27), - BuildGameObjectAnimation: __webpack_require__(406), + BuildGameObject: __webpack_require__(28), + BuildGameObjectAnimation: __webpack_require__(416), GameObject: __webpack_require__(14), - BitmapText: __webpack_require__(140), - Blitter: __webpack_require__(199), - Bob: __webpack_require__(407), - Container: __webpack_require__(200), - DOMElement: __webpack_require__(409), - DynamicBitmapText: __webpack_require__(201), - Extern: __webpack_require__(411), - Graphics: __webpack_require__(202), - Group: __webpack_require__(100), - Image: __webpack_require__(114), - Particles: __webpack_require__(997), - PathFollower: __webpack_require__(424), - RenderTexture: __webpack_require__(206), - RetroFont: __webpack_require__(1005), - Rope: __webpack_require__(208), - Sprite: __webpack_require__(76), + BitmapText: __webpack_require__(144), + Blitter: __webpack_require__(204), + Bob: __webpack_require__(417), + Container: __webpack_require__(205), + DOMElement: __webpack_require__(419), + DynamicBitmapText: __webpack_require__(206), + Extern: __webpack_require__(421), + Graphics: __webpack_require__(207), + Group: __webpack_require__(108), + Image: __webpack_require__(122), + Layer: __webpack_require__(210), + Particles: __webpack_require__(1057), + PathFollower: __webpack_require__(434), + RenderTexture: __webpack_require__(212), + RetroFont: __webpack_require__(1065), + Rope: __webpack_require__(214), + Sprite: __webpack_require__(70), - Text: __webpack_require__(209), - GetTextSize: __webpack_require__(425), - MeasureText: __webpack_require__(427), - TextStyle: __webpack_require__(426), + Text: __webpack_require__(215), + GetTextSize: __webpack_require__(435), + MeasureText: __webpack_require__(437), + TextStyle: __webpack_require__(436), - TileSprite: __webpack_require__(210), - Zone: __webpack_require__(117), - Video: __webpack_require__(211), + TileSprite: __webpack_require__(216), + Zone: __webpack_require__(125), + Video: __webpack_require__(217), // Shapes - Shape: __webpack_require__(30), - Arc: __webpack_require__(428), - Curve: __webpack_require__(429), - Ellipse: __webpack_require__(430), - Grid: __webpack_require__(431), - IsoBox: __webpack_require__(432), - IsoTriangle: __webpack_require__(433), - Line: __webpack_require__(434), - Polygon: __webpack_require__(435), - Rectangle: __webpack_require__(440), - Star: __webpack_require__(441), - Triangle: __webpack_require__(442), + Shape: __webpack_require__(33), + Arc: __webpack_require__(438), + Curve: __webpack_require__(439), + Ellipse: __webpack_require__(440), + Grid: __webpack_require__(441), + IsoBox: __webpack_require__(442), + IsoTriangle: __webpack_require__(443), + Line: __webpack_require__(444), + Polygon: __webpack_require__(445), + Rectangle: __webpack_require__(450), + Star: __webpack_require__(451), + Triangle: __webpack_require__(452), // Game Object Factories Factories: { - Blitter: __webpack_require__(1053), - Container: __webpack_require__(1054), - DOMElement: __webpack_require__(1055), - DynamicBitmapText: __webpack_require__(1056), - Extern: __webpack_require__(1057), - Graphics: __webpack_require__(1058), - Group: __webpack_require__(1059), - Image: __webpack_require__(1060), - Particles: __webpack_require__(1061), - PathFollower: __webpack_require__(1062), - RenderTexture: __webpack_require__(1063), - Rope: __webpack_require__(1064), - Sprite: __webpack_require__(1065), - StaticBitmapText: __webpack_require__(1066), - Text: __webpack_require__(1067), - TileSprite: __webpack_require__(1068), - Zone: __webpack_require__(1069), - Video: __webpack_require__(1070), + Blitter: __webpack_require__(1113), + Container: __webpack_require__(1114), + DOMElement: __webpack_require__(1115), + DynamicBitmapText: __webpack_require__(1116), + Extern: __webpack_require__(1117), + Graphics: __webpack_require__(1118), + Group: __webpack_require__(1119), + Image: __webpack_require__(1120), + Layer: __webpack_require__(1121), + Particles: __webpack_require__(1122), + PathFollower: __webpack_require__(1123), + RenderTexture: __webpack_require__(1124), + Rope: __webpack_require__(1125), + Sprite: __webpack_require__(1126), + StaticBitmapText: __webpack_require__(1127), + Text: __webpack_require__(1128), + TileSprite: __webpack_require__(1129), + Zone: __webpack_require__(1130), + Video: __webpack_require__(1131), // Shapes - Arc: __webpack_require__(1071), - Curve: __webpack_require__(1072), - Ellipse: __webpack_require__(1073), - Grid: __webpack_require__(1074), - IsoBox: __webpack_require__(1075), - IsoTriangle: __webpack_require__(1076), - Line: __webpack_require__(1077), - Polygon: __webpack_require__(1078), - Rectangle: __webpack_require__(1079), - Star: __webpack_require__(1080), - Triangle: __webpack_require__(1081) + Arc: __webpack_require__(1132), + Curve: __webpack_require__(1133), + Ellipse: __webpack_require__(1134), + Grid: __webpack_require__(1135), + IsoBox: __webpack_require__(1136), + IsoTriangle: __webpack_require__(1137), + Line: __webpack_require__(1138), + Polygon: __webpack_require__(1139), + Rectangle: __webpack_require__(1140), + Star: __webpack_require__(1141), + Triangle: __webpack_require__(1142) }, Creators: { - Blitter: __webpack_require__(1082), - Container: __webpack_require__(1083), - DynamicBitmapText: __webpack_require__(1084), - Graphics: __webpack_require__(1085), - Group: __webpack_require__(1086), - Image: __webpack_require__(1087), - Particles: __webpack_require__(1088), - RenderTexture: __webpack_require__(1089), - Rope: __webpack_require__(1090), - Sprite: __webpack_require__(1091), - StaticBitmapText: __webpack_require__(1092), - Text: __webpack_require__(1093), - TileSprite: __webpack_require__(1094), - Zone: __webpack_require__(1095), - Video: __webpack_require__(1096) + Blitter: __webpack_require__(1143), + Container: __webpack_require__(1144), + DynamicBitmapText: __webpack_require__(1145), + Graphics: __webpack_require__(1146), + Group: __webpack_require__(1147), + Image: __webpack_require__(1148), + Layer: __webpack_require__(1149), + Particles: __webpack_require__(1150), + RenderTexture: __webpack_require__(1151), + Rope: __webpack_require__(1152), + Sprite: __webpack_require__(1153), + StaticBitmapText: __webpack_require__(1154), + Text: __webpack_require__(1155), + TileSprite: __webpack_require__(1156), + Zone: __webpack_require__(1157), + Video: __webpack_require__(1158) } }; @@ -152955,28 +161810,25 @@ var GameObjects = { if (true) { // WebGL only Game Objects - GameObjects.Mesh = __webpack_require__(142); - GameObjects.Quad = __webpack_require__(214); - GameObjects.Shader = __webpack_require__(215); + GameObjects.Shader = __webpack_require__(220); + GameObjects.Mesh = __webpack_require__(221); - GameObjects.Factories.Mesh = __webpack_require__(1103); - GameObjects.Factories.Quad = __webpack_require__(1104); - GameObjects.Factories.Shader = __webpack_require__(1105); + GameObjects.Factories.Shader = __webpack_require__(1165); + GameObjects.Factories.Mesh = __webpack_require__(1166); - GameObjects.Creators.Mesh = __webpack_require__(1106); - GameObjects.Creators.Quad = __webpack_require__(1107); - GameObjects.Creators.Shader = __webpack_require__(1108); + GameObjects.Creators.Shader = __webpack_require__(1167); + GameObjects.Creators.Mesh = __webpack_require__(1168); - GameObjects.Light = __webpack_require__(446); - GameObjects.LightsManager = __webpack_require__(447); - GameObjects.LightsPlugin = __webpack_require__(1109); + GameObjects.Light = __webpack_require__(458); + GameObjects.LightsManager = __webpack_require__(459); + GameObjects.LightsPlugin = __webpack_require__(1170); } module.exports = GameObjects; /***/ }), -/* 941 */ +/* 997 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -152986,11 +161838,11 @@ module.exports = GameObjects; */ var Class = __webpack_require__(0); -var List = __webpack_require__(137); -var PluginCache = __webpack_require__(23); -var GameObjectEvents = __webpack_require__(29); +var List = __webpack_require__(105); +var PluginCache = __webpack_require__(25); +var GameObjectEvents = __webpack_require__(32); var SceneEvents = __webpack_require__(20); -var StableSort = __webpack_require__(139); +var StableSort = __webpack_require__(90); /** * @classdesc @@ -153091,6 +161943,15 @@ var DisplayList = new Class({ { gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); + if (gameObject.displayList) + { + gameObject.displayList.remove(gameObject); + } + + gameObject.displayList = this; + + this.queueDepthSort(); + this.events.emit(SceneEvents.ADDED_TO_SCENE, gameObject, this.scene); }, @@ -153109,6 +161970,10 @@ var DisplayList = new Class({ { gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + gameObject.displayList = null; + + this.queueDepthSort(); + this.events.emit(SceneEvents.REMOVED_FROM_SCENE, gameObject, this.scene); }, @@ -153162,7 +162027,7 @@ var DisplayList = new Class({ * @param {Phaser.GameObjects.GameObject} childA - The first Game Object. * @param {Phaser.GameObjects.GameObject} childB - The second Game Object. * - * @return {integer} The difference between the depths of each Game Object. + * @return {number} The difference between the depths of each Game Object. */ sortByDepth: function (childA, childB) { @@ -153234,7 +162099,7 @@ module.exports = DisplayList; /***/ }), -/* 942 */ +/* 998 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153249,21 +162114,22 @@ module.exports = DisplayList; module.exports = { - CheckMatrix: __webpack_require__(195), - MatrixToString: __webpack_require__(943), - ReverseColumns: __webpack_require__(944), - ReverseRows: __webpack_require__(945), - Rotate180: __webpack_require__(946), - RotateLeft: __webpack_require__(947), - RotateMatrix: __webpack_require__(138), - RotateRight: __webpack_require__(948), - TransposeMatrix: __webpack_require__(402) + CheckMatrix: __webpack_require__(200), + MatrixToString: __webpack_require__(999), + ReverseColumns: __webpack_require__(1000), + ReverseRows: __webpack_require__(1001), + Rotate180: __webpack_require__(1002), + RotateLeft: __webpack_require__(1003), + RotateMatrix: __webpack_require__(143), + RotateRight: __webpack_require__(1004), + Translate: __webpack_require__(1005), + TransposeMatrix: __webpack_require__(412) }; /***/ }), -/* 943 */ +/* 999 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153272,12 +162138,26 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Pad = __webpack_require__(173); -var CheckMatrix = __webpack_require__(195); +var Pad = __webpack_require__(178); +var CheckMatrix = __webpack_require__(200); /** * Generates a string (which you can pass to console.log) from the given Array Matrix. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.MatrixToString * @since 3.0.0 * @@ -153344,7 +162224,7 @@ module.exports = MatrixToString; /***/ }), -/* 944 */ +/* 1000 */ /***/ (function(module, exports) { /** @@ -153356,6 +162236,20 @@ module.exports = MatrixToString; /** * Reverses the columns in the given Array Matrix. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.ReverseColumns * @since 3.0.0 * @@ -153375,7 +162269,7 @@ module.exports = ReverseColumns; /***/ }), -/* 945 */ +/* 1001 */ /***/ (function(module, exports) { /** @@ -153387,6 +162281,20 @@ module.exports = ReverseColumns; /** * Reverses the rows in the given Array Matrix. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.ReverseRows * @since 3.0.0 * @@ -153411,7 +162319,7 @@ module.exports = ReverseRows; /***/ }), -/* 946 */ +/* 1002 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153420,11 +162328,25 @@ module.exports = ReverseRows; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateMatrix = __webpack_require__(138); +var RotateMatrix = __webpack_require__(143); /** * Rotates the array matrix 180 degrees. * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.Rotate180 * @since 3.0.0 * @@ -153444,7 +162366,7 @@ module.exports = Rotate180; /***/ }), -/* 947 */ +/* 1003 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153453,11 +162375,25 @@ module.exports = Rotate180; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateMatrix = __webpack_require__(138); +var RotateMatrix = __webpack_require__(143); /** * Rotates the array matrix to the left (or 90 degrees) * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.RotateLeft * @since 3.0.0 * @@ -153477,7 +162413,7 @@ module.exports = RotateLeft; /***/ }), -/* 948 */ +/* 1004 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153486,11 +162422,25 @@ module.exports = RotateLeft; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateMatrix = __webpack_require__(138); +var RotateMatrix = __webpack_require__(143); /** * Rotates the array matrix to the left (or -90 degrees) * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * * @function Phaser.Utils.Array.Matrix.RotateRight * @since 3.0.0 * @@ -153510,7 +162460,96 @@ module.exports = RotateRight; /***/ }), -/* 949 */ +/* 1005 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var RotateLeft = __webpack_require__(170); +var RotateRight = __webpack_require__(171); + +/** + * Translates the given Array Matrix by shifting each column and row the + * amount specified. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.Translate + * @since 3.50.0 + * + * @generic T + * @genericUse {T[][]} - [matrix,$return] + * + * @param {T[][]} [matrix] - The array matrix to translate. + * @param {number} [x=0] - The amount to horizontally translate the matrix by. + * @param {number} [y=0] - The amount to vertically translate the matrix by. + * + * @return {T[][]} The translated matrix. + */ +var TranslateMatrix = function (matrix, x, y) +{ + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + // Vertical translation + + if (y !== 0) + { + if (y < 0) + { + // Shift Up + RotateLeft(matrix, Math.abs(y)); + } + else + { + // Shift Down + RotateRight(matrix, y); + } + } + + // Horizontal translation + + if (x !== 0) + { + for (var i = 0; i < matrix.length; i++) + { + var row = matrix[i]; + + if (x < 0) + { + RotateLeft(row, Math.abs(x)); + } + else + { + RotateRight(row, x); + } + } + } + + return matrix; +}; + +module.exports = TranslateMatrix; + + +/***/ }), +/* 1006 */ /***/ (function(module, exports) { /** @@ -153536,7 +162575,7 @@ module.exports = RotateRight; * * @param {array} array - The array to be added to. * @param {any|any[]} item - The item, or array of items, to add to the array. Each item must be unique within the array. - * @param {integer} [limit] - Optional limit which caps the size of the array. + * @param {number} [limit] - Optional limit which caps the size of the array. * @param {function} [callback] - A callback to be invoked for each item successfully added to the array. * @param {object} [context] - The context in which the callback is invoked. * @@ -153627,7 +162666,7 @@ module.exports = Add; /***/ }), -/* 950 */ +/* 1007 */ /***/ (function(module, exports) { /** @@ -153655,8 +162694,8 @@ module.exports = Add; * * @param {array} array - The array to be added to. * @param {any|any[]} item - The item, or array of items, to add to the array. - * @param {integer} [index=0] - The index in the array where the item will be inserted. - * @param {integer} [limit] - Optional limit which caps the size of the array. + * @param {number} [index=0] - The index in the array where the item will be inserted. + * @param {number} [limit] - Optional limit which caps the size of the array. * @param {function} [callback] - A callback to be invoked for each item successfully added to the array. * @param {object} [context] - The context in which the callback is invoked. * @@ -153749,7 +162788,7 @@ module.exports = AddAt; /***/ }), -/* 951 */ +/* 1008 */ /***/ (function(module, exports) { /** @@ -153787,7 +162826,7 @@ module.exports = BringToTop; /***/ }), -/* 952 */ +/* 1009 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153796,7 +162835,7 @@ module.exports = BringToTop; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Returns the total number of elements in the array which have a property matching the given value. @@ -153807,10 +162846,10 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {string} property - The property to test on each array element. * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {integer} [startIndex] - An optional start index to search from. - * @param {integer} [endIndex] - An optional end index to search to. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * - * @return {integer} The total number of elements with properties matching the given value. + * @return {number} The total number of elements with properties matching the given value. */ var CountAllMatching = function (array, property, value, startIndex, endIndex) { @@ -153839,7 +162878,7 @@ module.exports = CountAllMatching; /***/ }), -/* 953 */ +/* 1010 */ /***/ (function(module, exports) { /** @@ -153885,7 +162924,7 @@ module.exports = Each; /***/ }), -/* 954 */ +/* 1011 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -153894,7 +162933,7 @@ module.exports = Each; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Passes each element in the array, between the start and end indexes, to the given callback. @@ -153905,8 +162944,8 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {function} callback - A callback to be invoked for each item in the array. * @param {object} context - The context in which the callback is invoked. - * @param {integer} startIndex - The start index to search from. - * @param {integer} endIndex - The end index to search to. + * @param {number} startIndex - The start index to search from. + * @param {number} endIndex - The end index to search to. * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. * * @return {array} The input array. @@ -153941,7 +162980,7 @@ module.exports = EachInRange; /***/ }), -/* 955 */ +/* 1012 */ /***/ (function(module, exports) { /** @@ -153983,7 +163022,7 @@ module.exports = MoveDown; /***/ }), -/* 956 */ +/* 1013 */ /***/ (function(module, exports) { /** @@ -154001,7 +163040,7 @@ module.exports = MoveDown; * * @param {array} array - The array. * @param {*} item - The element to move. - * @param {integer} index - The new index that the element will be moved to. + * @param {number} index - The new index that the element will be moved to. * * @return {*} The element that was moved. */ @@ -154030,7 +163069,7 @@ module.exports = MoveTo; /***/ }), -/* 957 */ +/* 1014 */ /***/ (function(module, exports) { /** @@ -154072,7 +163111,7 @@ module.exports = MoveUp; /***/ }), -/* 958 */ +/* 1015 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154081,7 +163120,7 @@ module.exports = MoveUp; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RoundAwayFromZero = __webpack_require__(345); +var RoundAwayFromZero = __webpack_require__(355); /** * Create an array of numbers (positive and/or negative) progressing from `start` @@ -154149,7 +163188,7 @@ module.exports = NumberArrayStep; /***/ }), -/* 959 */ +/* 1016 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154158,7 +163197,7 @@ module.exports = NumberArrayStep; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SpliceOne = __webpack_require__(82); +var SpliceOne = __webpack_require__(103); /** * Removes the item from the given position in the array. @@ -154171,7 +163210,7 @@ var SpliceOne = __webpack_require__(82); * @since 3.4.0 * * @param {array} array - The array to be modified. - * @param {integer} index - The array index to remove the item from. The index must be in bounds or it will throw an error. + * @param {number} index - The array index to remove the item from. The index must be in bounds or it will throw an error. * @param {function} [callback] - A callback to be invoked for the item removed from the array. * @param {object} [context] - The context in which the callback is invoked. * @@ -154200,7 +163239,7 @@ module.exports = RemoveAt; /***/ }), -/* 960 */ +/* 1017 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154209,7 +163248,7 @@ module.exports = RemoveAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Removes the item within the given range in the array. @@ -154222,8 +163261,8 @@ var SafeRange = __webpack_require__(70); * @since 3.4.0 * * @param {array} array - The array to be modified. - * @param {integer} startIndex - The start index to remove from. - * @param {integer} endIndex - The end index to remove to. + * @param {number} startIndex - The start index to remove from. + * @param {number} endIndex - The end index to remove to. * @param {function} [callback] - A callback to be invoked for the item removed from the array. * @param {object} [context] - The context in which the callback is invoked. * @@ -154263,7 +163302,7 @@ module.exports = RemoveBetween; /***/ }), -/* 961 */ +/* 1018 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154272,7 +163311,7 @@ module.exports = RemoveBetween; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SpliceOne = __webpack_require__(82); +var SpliceOne = __webpack_require__(103); /** * Removes a random object from the given array and returns it. @@ -154282,8 +163321,8 @@ var SpliceOne = __webpack_require__(82); * @since 3.0.0 * * @param {array} array - The array to removed a random element from. - * @param {integer} [start=0] - The array index to start the search from. - * @param {integer} [length=array.length] - Optional restriction on the number of elements to randomly select from. + * @param {number} [start=0] - The array index to start the search from. + * @param {number} [length=array.length] - Optional restriction on the number of elements to randomly select from. * * @return {object} The random element that was removed, or `null` if there were no array elements that fell within the given range. */ @@ -154301,7 +163340,7 @@ module.exports = RemoveRandomElement; /***/ }), -/* 962 */ +/* 1019 */ /***/ (function(module, exports) { /** @@ -154345,7 +163384,7 @@ module.exports = Replace; /***/ }), -/* 963 */ +/* 1020 */ /***/ (function(module, exports) { /** @@ -154383,7 +163422,7 @@ module.exports = SendToBack; /***/ }), -/* 964 */ +/* 1021 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154392,7 +163431,7 @@ module.exports = SendToBack; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(70); +var SafeRange = __webpack_require__(77); /** * Scans the array for elements with the given property. If found, the property is set to the `value`. @@ -154408,8 +163447,8 @@ var SafeRange = __webpack_require__(70); * @param {array} array - The array to search. * @param {string} property - The property to test for on each array element. * @param {*} value - The value to set the property to. - * @param {integer} [startIndex] - An optional start index to search from. - * @param {integer} [endIndex] - An optional end index to search to. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * * @return {array} The input array. */ @@ -154438,7 +163477,7 @@ module.exports = SetAll; /***/ }), -/* 965 */ +/* 1022 */ /***/ (function(module, exports) { /** @@ -154486,7 +163525,7 @@ module.exports = Swap; /***/ }), -/* 966 */ +/* 1023 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -154496,8 +163535,8 @@ module.exports = Swap; */ var Class = __webpack_require__(0); -var ProcessQueue = __webpack_require__(197); -var PluginCache = __webpack_require__(23); +var ProcessQueue = __webpack_require__(202); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); /** @@ -154581,7 +163620,7 @@ var UpdateList = new Class({ * The total number of items awaiting processing. * * @name Phaser.GameObjects.UpdateList#_toProcess - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -154778,7 +163817,7 @@ var UpdateList = new Class({ * The number of entries in the active list. * * @name Phaser.GameObjects.UpdateList#length - * @type {integer} + * @type {number} * @readonly * @since 3.20.0 */ @@ -154790,7 +163829,7 @@ module.exports = UpdateList; /***/ }), -/* 967 */ +/* 1024 */ /***/ (function(module, exports) { /** @@ -154817,7 +163856,7 @@ module.exports = 'add'; /***/ }), -/* 968 */ +/* 1025 */ /***/ (function(module, exports) { /** @@ -154844,7 +163883,7 @@ module.exports = 'remove'; /***/ }), -/* 969 */ +/* 1026 */ /***/ (function(module, exports) { /** @@ -155366,7 +164405,7 @@ module.exports = GetBitmapTextSize; /***/ }), -/* 970 */ +/* 1027 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155375,7 +164414,7 @@ module.exports = GetBitmapTextSize; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ParseXMLBitmapFont = __webpack_require__(198); +var ParseXMLBitmapFont = __webpack_require__(203); /** * Parse an XML Bitmap Font from an Atlas. @@ -155391,8 +164430,8 @@ var ParseXMLBitmapFont = __webpack_require__(198); * @param {string} textureKey - The key of the BitmapFont's texture. * @param {string} frameKey - The key of the BitmapFont texture's frame. * @param {string} xmlKey - The key of the XML data of the font to parse. - * @param {integer} [xSpacing] - The x-axis spacing to add between each letter. - * @param {integer} [ySpacing] - The y-axis spacing to add to the line height. + * @param {number} [xSpacing] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing] - The y-axis spacing to add to the line height. * * @return {boolean} Whether the parsing was successful or not. */ @@ -155420,7 +164459,7 @@ module.exports = ParseFromAtlas; /***/ }), -/* 971 */ +/* 1028 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155434,12 +164473,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(972); + renderWebGL = __webpack_require__(1029); } if (true) { - renderCanvas = __webpack_require__(974); + renderCanvas = __webpack_require__(1031); } module.exports = { @@ -155451,7 +164490,7 @@ module.exports = { /***/ }), -/* 972 */ +/* 1029 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155460,8 +164499,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BatchChar = __webpack_require__(973); -var Utils = __webpack_require__(10); +var BatchChar = __webpack_require__(1030); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -155474,11 +164514,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix) { var text = src._text; var textLength = text.length; @@ -155488,36 +164527,9 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, return; } - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); - var camMatrix = pipeline._tempMatrix1; - var spriteMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; - - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; var roundPixels = camera.roundPixels; @@ -155525,12 +164537,12 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, var charColors = src.charColors; - var tintEffect = (src._isTinted && src.tintFill); + var tintEffect = src.tintFill; - var tintTL = Utils.getTintAppendFloatAlpha(src._tintTL, cameraAlpha * src._alphaTL); - var tintTR = Utils.getTintAppendFloatAlpha(src._tintTR, cameraAlpha * src._alphaTR); - var tintBL = Utils.getTintAppendFloatAlpha(src._tintBL, cameraAlpha * src._alphaBL); - var tintBR = Utils.getTintAppendFloatAlpha(src._tintBR, cameraAlpha * src._alphaBR); + var tintTL = Utils.getTintAppendFloatAlpha(src.tintTopLeft, cameraAlpha * src._alphaTL); + var tintTR = Utils.getTintAppendFloatAlpha(src.tintTopRight, cameraAlpha * src._alphaTR); + var tintBL = Utils.getTintAppendFloatAlpha(src.tintBottomLeft, cameraAlpha * src._alphaBL); + var tintBR = Utils.getTintAppendFloatAlpha(src.tintBottomRight, cameraAlpha * src._alphaBR); var texture = src.frame.glTexture; var textureUnit = pipeline.setGameObject(src); @@ -155549,6 +164561,8 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, var dropShadow = (dropShadowX !== 0 || dropShadowY !== 0); + renderer.pipelines.preBatch(src); + if (dropShadow) { var srcShadowColor = src._dropShadowColorGL; @@ -155603,13 +164617,15 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, // Debug test if the characters are in the correct place when rendered: // pipeline.drawFillRect(tx0, ty0, tx2 - tx0, ty2 - ty0, 0x00ff00, 0.5); } + + renderer.pipelines.postBatch(src); }; module.exports = BitmapTextWebGLRenderer; /***/ }), -/* 973 */ +/* 1030 */ /***/ (function(module, exports) { /** @@ -155661,14 +164677,14 @@ var BatchChar = function (pipeline, src, char, glyph, offsetX, offsetY, calcMatr var tx3 = calcMatrix.getXRound(xw, y, roundPixels); var ty3 = calcMatrix.getYRound(xw, y, roundPixels); - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, glyph.u0, glyph.v0, glyph.u1, glyph.v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); + pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, glyph.u0, glyph.v0, glyph.u1, glyph.v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); }; module.exports = BatchChar; /***/ }), -/* 974 */ +/* 1031 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155677,7 +164693,7 @@ module.exports = BatchChar; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTransform = __webpack_require__(28); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -155690,11 +164706,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var BitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix) { var text = src._text; var textLength = text.length; @@ -155705,7 +164720,7 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, { return; } - + var textureFrame = src.frame; var chars = src.fontData.chars; @@ -155850,7 +164865,7 @@ module.exports = BitmapTextCanvasRenderer; /***/ }), -/* 975 */ +/* 1032 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155864,12 +164879,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(976); + renderWebGL = __webpack_require__(1033); } if (true) { - renderCanvas = __webpack_require__(977); + renderCanvas = __webpack_require__(1034); } module.exports = { @@ -155881,7 +164896,7 @@ module.exports = { /***/ }), -/* 976 */ +/* 1033 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -155890,7 +164905,10 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); + +var tempMatrix = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -155903,11 +164921,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Blitter} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var BlitterWebGLRenderer = function (renderer, src, camera, parentMatrix) { var list = src.getRenderList(); @@ -155921,9 +164938,7 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam var cameraScrollX = camera.scrollX * src.scrollFactorX; var cameraScrollY = camera.scrollY * src.scrollFactorY; - var calcMatrix = pipeline._tempMatrix1; - - calcMatrix.copyFrom(camera.matrix); + var calcMatrix = tempMatrix.copyFrom(camera.matrix); if (parentMatrix) { @@ -155940,6 +164955,8 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam var alpha = camera.alpha * src.alpha; var roundPixels = camera.roundPixels; + renderer.pipelines.preBatch(src); + for (var index = 0; index < list.length; index++) { var bob = list[index]; @@ -155998,18 +165015,20 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam } // TL x/y, BL x/y, BR x/y, TR x/y - if (pipeline.batchQuad(tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, frame.glTexture, textureUnit)) + if (pipeline.batchQuad(src, tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, frame.glTexture, textureUnit)) { prevTextureSourceIndex = -1; } } + + renderer.pipelines.postBatch(src); }; module.exports = BlitterWebGLRenderer; /***/ }), -/* 977 */ +/* 1034 */ /***/ (function(module, exports) { /** @@ -156029,11 +165048,10 @@ module.exports = BlitterWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Blitter} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var BlitterCanvasRenderer = function (renderer, src, camera, parentMatrix) { var list = src.getRenderList(); @@ -156089,7 +165107,7 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca } ctx.globalAlpha = bobAlpha; - + if (!flip) { if (roundPixels) @@ -156131,7 +165149,7 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca ctx.restore(); } } - + ctx.restore(); }; @@ -156139,7 +165157,7 @@ module.exports = BlitterCanvasRenderer; /***/ }), -/* 978 */ +/* 1035 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156154,12 +165172,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(979); + renderWebGL = __webpack_require__(1036); } if (true) { - renderCanvas = __webpack_require__(980); + renderCanvas = __webpack_require__(1037); } module.exports = { @@ -156171,7 +165189,7 @@ module.exports = { /***/ }), -/* 979 */ +/* 1036 */ /***/ (function(module, exports) { /** @@ -156192,21 +165210,21 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Container} container - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ContainerWebGLRenderer = function (renderer, container, interpolationPercentage, camera, parentMatrix) +var ContainerWebGLRenderer = function (renderer, container, camera, parentMatrix) { var children = container.list; + var childCount = children.length; - if (children.length === 0) + if (childCount === 0) { return; } var transformMatrix = container.localTransform; - + if (parentMatrix) { transformMatrix.loadIdentity(); @@ -156220,6 +165238,8 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY); } + renderer.pipelines.preBatch(container); + var containerHasBlendMode = (container.blendMode !== -1); if (!containerHasBlendMode) @@ -156233,9 +165253,6 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent var scrollFactorX = container.scrollFactorX; var scrollFactorY = container.scrollFactorY; - var list = children; - var childCount = children.length; - for (var i = 0; i < childCount; i++) { var child = children[i]; @@ -156291,7 +165308,7 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent renderer.currentType = type; } - renderer.nextTypeMatch = (i < childCount - 1) ? (list[i + 1].type === renderer.currentType) : false; + renderer.nextTypeMatch = (i < childCount - 1) ? (children[i + 1].type === renderer.currentType) : false; // Set parent values child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY); @@ -156299,7 +165316,7 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha); // Render - child.renderWebGL(renderer, child, interpolationPercentage, camera, transformMatrix); + child.renderWebGL(renderer, child, camera, transformMatrix); // Restore original values @@ -156314,13 +165331,15 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent renderer.newType = false; } + + renderer.pipelines.postBatch(container); }; module.exports = ContainerWebGLRenderer; /***/ }), -/* 980 */ +/* 1037 */ /***/ (function(module, exports) { /** @@ -156341,11 +165360,10 @@ module.exports = ContainerWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Container} container - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ContainerCanvasRenderer = function (renderer, container, interpolationPercentage, camera, parentMatrix) +var ContainerCanvasRenderer = function (renderer, container, camera, parentMatrix) { var children = container.list; @@ -156410,7 +165428,7 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen child.setAlpha(childAlpha * alpha); // Render - child.renderCanvas(renderer, child, interpolationPercentage, camera, transformMatrix); + child.renderCanvas(renderer, child, camera, transformMatrix); // Restore original values child.setAlpha(childAlpha); @@ -156427,7 +165445,7 @@ module.exports = ContainerCanvasRenderer; /***/ }), -/* 981 */ +/* 1038 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156441,12 +165459,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(410); + renderWebGL = __webpack_require__(420); } if (true) { - renderCanvas = __webpack_require__(410); + renderCanvas = __webpack_require__(420); } module.exports = { @@ -156458,7 +165476,7 @@ module.exports = { /***/ }), -/* 982 */ +/* 1039 */ /***/ (function(module, exports) { /** @@ -156500,7 +165518,7 @@ module.exports = [ /***/ }), -/* 983 */ +/* 1040 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156514,12 +165532,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(984); + renderWebGL = __webpack_require__(1041); } if (true) { - renderCanvas = __webpack_require__(985); + renderCanvas = __webpack_require__(1042); } module.exports = { @@ -156531,7 +165549,7 @@ module.exports = { /***/ }), -/* 984 */ +/* 1041 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156540,8 +165558,11 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); -var GetColorFromValue = __webpack_require__(119); +var GetCalcMatrix = __webpack_require__(21); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); + +var tempMatrix = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -156554,11 +165575,10 @@ var GetColorFromValue = __webpack_require__(119); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.DynamicBitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix) { var text = src.text; var textLength = text.length; @@ -156568,37 +165588,14 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce return; } - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); - var camMatrix = pipeline._tempMatrix1; - var spriteMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; - var fontMatrix = pipeline._tempMatrix4; + var result = GetCalcMatrix(src, camera, parentMatrix); - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + var spriteMatrix = result.sprite; + var calcMatrix = result.calc; - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } + var fontMatrix = tempMatrix; var crop = (src.cropWidth > 0 || src.cropHeight > 0); @@ -156616,16 +165613,12 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce var frame = src.frame; var texture = frame.glTexture; - var textureX = frame.cutX; - var textureY = frame.cutY; - var textureWidth = texture.width; - var textureHeight = texture.height; - var tintEffect = (src._isTinted && src.tintFill); - var tintTL = Utils.getTintAppendFloatAlpha(src._tintTL, camera.alpha * src._alphaTL); - var tintTR = Utils.getTintAppendFloatAlpha(src._tintTR, camera.alpha * src._alphaTR); - var tintBL = Utils.getTintAppendFloatAlpha(src._tintBL, camera.alpha * src._alphaBL); - var tintBR = Utils.getTintAppendFloatAlpha(src._tintBR, camera.alpha * src._alphaBR); + var tintEffect = src.tintFill; + var tintTL = Utils.getTintAppendFloatAlpha(src.tintTopLeft, camera.alpha * src._alphaTL); + var tintTR = Utils.getTintAppendFloatAlpha(src.tintTopRight, camera.alpha * src._alphaTR); + var tintBL = Utils.getTintAppendFloatAlpha(src.tintBottomLeft, camera.alpha * src._alphaBL); + var tintBR = Utils.getTintAppendFloatAlpha(src.tintBottomRight, camera.alpha * src._alphaBR); var textureUnit = pipeline.setGameObject(src); @@ -156635,8 +165628,6 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce var lastCharCode = 0; var letterSpacing = src.letterSpacing; var glyph; - var glyphX = 0; - var glyphY = 0; var glyphW = 0; var glyphH = 0; var lastGlyph; @@ -156654,7 +165645,14 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce var lineOffsetX = 0; // Update the bounds - skipped internally if not dirty - src.getTextBounds(false); + var bounds = src.getTextBounds(false); + + // In case the method above changed it (word wrapping) + if (src.maxWidth > 0) + { + text = bounds.wrappedText; + textLength = text.length; + } var lineData = src._bounds.lines; @@ -156671,6 +165669,8 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce var displayCallback = src.displayCallback; var callbackData = src.callbackData; + renderer.pipelines.preBatch(src); + for (var i = 0; i < textLength; i++) { charCode = text.charCodeAt(i); @@ -156703,9 +165703,6 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce continue; } - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; - glyphW = glyph.width; glyphH = glyph.height; @@ -156768,10 +165765,10 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce tintBR = output.tint.bottomRight; } - tintTL = Utils.getTintAppendFloatAlpha(GetColorFromValue(tintTL), camera.alpha * src._alphaTL); - tintTR = Utils.getTintAppendFloatAlpha(GetColorFromValue(tintTR), camera.alpha * src._alphaTR); - tintBL = Utils.getTintAppendFloatAlpha(GetColorFromValue(tintBL), camera.alpha * src._alphaBL); - tintBR = Utils.getTintAppendFloatAlpha(GetColorFromValue(tintBR), camera.alpha * src._alphaBR); + tintTL = Utils.getTintAppendFloatAlpha(tintTL, camera.alpha * src._alphaTL); + tintTR = Utils.getTintAppendFloatAlpha(tintTR, camera.alpha * src._alphaTR); + tintBL = Utils.getTintAppendFloatAlpha(tintBL, camera.alpha * src._alphaBL); + tintBR = Utils.getTintAppendFloatAlpha(tintBR, camera.alpha * src._alphaBR); } x *= scale; @@ -156786,10 +165783,10 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce calcMatrix.multiply(fontMatrix, spriteMatrix); - var u0 = glyphX / textureWidth; - var v0 = glyphY / textureHeight; - var u1 = (glyphX + glyphW) / textureWidth; - var v1 = (glyphY + glyphH) / textureHeight; + var u0 = glyph.u0; + var v0 = glyph.v0; + var u1 = glyph.u1; + var v1 = glyph.v1; var xw = glyphW; var yh = glyphH; @@ -156821,7 +165818,7 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce ty3 = Math.round(ty3); } - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); + pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); } if (crop) @@ -156830,13 +165827,15 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce renderer.popScissor(); } + + renderer.pipelines.postBatch(src); }; module.exports = DynamicBitmapTextWebGLRenderer; /***/ }), -/* 985 */ +/* 1042 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -156845,7 +165844,7 @@ module.exports = DynamicBitmapTextWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTransform = __webpack_require__(28); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -156858,11 +165857,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.DynamicBitmapText} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var DynamicBitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix) { var text = src._text; var textLength = text.length; @@ -156873,7 +165871,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc { return; } - + var textureFrame = src.frame; var displayCallback = src.displayCallback; @@ -157047,7 +166045,7 @@ module.exports = DynamicBitmapTextCanvasRenderer; /***/ }), -/* 986 */ +/* 1043 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157061,12 +166059,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(987); + renderWebGL = __webpack_require__(1044); } if (true) { - renderCanvas = __webpack_require__(988); + renderCanvas = __webpack_require__(1045); } module.exports = { @@ -157078,8 +166076,8 @@ module.exports = { /***/ }), -/* 987 */ -/***/ (function(module, exports) { +/* 1044 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -157087,6 +166085,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetCalcMatrix = __webpack_require__(21); + /** * Renders this Game Object with the WebGL Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. @@ -157098,44 +166098,15 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Extern} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ExternWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ExternWebGLRenderer = function (renderer, src, camera, parentMatrix) { renderer.pipelines.clear(); - var camMatrix = renderer._tempMatrix1; - var spriteMatrix = renderer._tempMatrix2; - var calcMatrix = renderer._tempMatrix3; + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - // Callback src.render.call(src, renderer, camera, calcMatrix); renderer.pipelines.rebind(); @@ -157145,13 +166116,13 @@ module.exports = ExternWebGLRenderer; /***/ }), -/* 988 */ +/* 1045 */ /***/ (function(module, exports) { /***/ }), -/* 989 */ +/* 1046 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157165,15 +166136,15 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(990); + renderWebGL = __webpack_require__(1047); // Needed for Graphics.generateTexture - renderCanvas = __webpack_require__(415); + renderCanvas = __webpack_require__(425); } if (true) { - renderCanvas = __webpack_require__(415); + renderCanvas = __webpack_require__(425); } module.exports = { @@ -157185,7 +166156,7 @@ module.exports = { /***/ }), -/* 990 */ +/* 1047 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157194,10 +166165,11 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Commands = __webpack_require__(203); -var Utils = __webpack_require__(10); +var Commands = __webpack_require__(208); +var GetCalcMatrix = __webpack_require__(21); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); -// TODO: Remove the use of this var Point = function (x, y, width) { this.x = x; @@ -157205,7 +166177,6 @@ var Point = function (x, y, width) this.width = width; }; -// TODO: Remove the use of this var Path = function (x, y, width) { this.points = []; @@ -157214,6 +166185,7 @@ var Path = function (x, y, width) }; var matrixStack = []; +var tempMatrix = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -157226,49 +166198,23 @@ var matrixStack = []; * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Graphics} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var GraphicsWebGLRenderer = function (renderer, src, camera, parentMatrix) { if (src.commandBuffer.length === 0) { return; } - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); - var camMatrix = src._tempMatrix1; - var graphicsMatrix = src._tempMatrix2; - var currentMatrix = src._tempMatrix3; + renderer.pipelines.preBatch(src); - currentMatrix.loadIdentity(); + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; - graphicsMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - graphicsMatrix.e = src.x; - graphicsMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(graphicsMatrix); - } - else - { - graphicsMatrix.e -= camera.scrollX * src.scrollFactorX; - graphicsMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(graphicsMatrix); - } + var currentMatrix = tempMatrix.loadIdentity(); var commands = src.commandBuffer; var alpha = camera.alpha * src.alpha; @@ -157287,13 +166233,10 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca var path = []; var pathIndex = 0; - var pathOpen = false; + var pathOpen = true; var lastPath = null; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; - - // Set to a white texture, not a blank one, so Lights2D works too! - var currentTexture = renderer.tempTextures[0]; + var getTint = Utils.getTintAppendFloatAlpha; for (var cmdIndex = 0; cmdIndex < commands.length; cmdIndex++) { @@ -157302,14 +166245,15 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca switch (cmd) { case Commands.BEGIN_PATH: - + { path.length = 0; lastPath = null; pathOpen = true; break; + } case Commands.CLOSE_PATH: - + { pathOpen = false; if (lastPath && lastPath.points.length) @@ -157317,36 +166261,38 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca lastPath.points.push(lastPath.points[0]); } break; + } case Commands.FILL_PATH: + { for (pathIndex = 0; pathIndex < path.length; pathIndex++) { - pipeline.setTexture2D(currentTexture, src); - pipeline.batchFillPath( path[pathIndex].points, currentMatrix, - camMatrix + calcMatrix ); } break; + } case Commands.STROKE_PATH: + { for (pathIndex = 0; pathIndex < path.length; pathIndex++) { - pipeline.setTexture2D(currentTexture, src); - pipeline.batchStrokePath( path[pathIndex].points, lineWidth, pathOpen, currentMatrix, - camMatrix + calcMatrix ); } break; + } case Commands.LINE_STYLE: + { lineWidth = commands[++cmdIndex]; var strokeColor = commands[++cmdIndex]; var strokeAlpha = commands[++cmdIndex] * alpha; @@ -157356,8 +166302,10 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca strokeTint.BL = strokeTintColor; strokeTint.BR = strokeTintColor; break; + } case Commands.FILL_STYLE: + { var fillColor = commands[++cmdIndex]; var fillAlpha = commands[++cmdIndex] * alpha; var fillTintColor = getTint(fillColor, fillAlpha); @@ -157366,16 +166314,24 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca fillTint.BL = fillTintColor; fillTint.BR = fillTintColor; break; + } case Commands.GRADIENT_FILL_STYLE: - var gradientFillAlpha = commands[++cmdIndex] * alpha; - fillTint.TL = getTint(commands[++cmdIndex], gradientFillAlpha); - fillTint.TR = getTint(commands[++cmdIndex], gradientFillAlpha); - fillTint.BL = getTint(commands[++cmdIndex], gradientFillAlpha); - fillTint.BR = getTint(commands[++cmdIndex], gradientFillAlpha); + { + var alphaTL = commands[++cmdIndex] * alpha; + var alphaTR = commands[++cmdIndex] * alpha; + var alphaBL = commands[++cmdIndex] * alpha; + var alphaBR = commands[++cmdIndex] * alpha; + + fillTint.TL = getTint(commands[++cmdIndex], alphaTL); + fillTint.TR = getTint(commands[++cmdIndex], alphaTR); + fillTint.BL = getTint(commands[++cmdIndex], alphaBL); + fillTint.BR = getTint(commands[++cmdIndex], alphaBR); break; + } case Commands.GRADIENT_LINE_STYLE: + { lineWidth = commands[++cmdIndex]; var gradientLineAlpha = commands[++cmdIndex] * alpha; strokeTint.TL = getTint(commands[++cmdIndex], gradientLineAlpha); @@ -157383,8 +166339,10 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca strokeTint.BL = getTint(commands[++cmdIndex], gradientLineAlpha); strokeTint.BR = getTint(commands[++cmdIndex], gradientLineAlpha); break; + } case Commands.ARC: + { var iteration = 0; var x = commands[++cmdIndex]; var y = commands[++cmdIndex]; @@ -157441,21 +166399,23 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca lastPath.points.push(new Point(tx, ty, lineWidth)); break; + } case Commands.FILL_RECT: - pipeline.setTexture2D(currentTexture, src); + { pipeline.batchFillRect( commands[++cmdIndex], commands[++cmdIndex], commands[++cmdIndex], commands[++cmdIndex], currentMatrix, - camMatrix + calcMatrix ); break; + } case Commands.FILL_TRIANGLE: - pipeline.setTexture2D(currentTexture, src); + { pipeline.batchFillTriangle( commands[++cmdIndex], commands[++cmdIndex], @@ -157464,12 +166424,13 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca commands[++cmdIndex], commands[++cmdIndex], currentMatrix, - camMatrix + calcMatrix ); break; + } case Commands.STROKE_TRIANGLE: - pipeline.setTexture2D(currentTexture, src); + { pipeline.batchStrokeTriangle( commands[++cmdIndex], commands[++cmdIndex], @@ -157479,11 +166440,13 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca commands[++cmdIndex], lineWidth, currentMatrix, - camMatrix + calcMatrix ); break; + } case Commands.LINE_TO: + { if (lastPath !== null) { lastPath.points.push(new Point(commands[++cmdIndex], commands[++cmdIndex], lineWidth)); @@ -157494,62 +166457,59 @@ var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, ca path.push(lastPath); } break; + } case Commands.MOVE_TO: + { lastPath = new Path(commands[++cmdIndex], commands[++cmdIndex], lineWidth); path.push(lastPath); break; + } case Commands.SAVE: + { matrixStack.push(currentMatrix.copyToArray()); break; + } case Commands.RESTORE: + { currentMatrix.copyFromArray(matrixStack.pop()); break; + } case Commands.TRANSLATE: + { x = commands[++cmdIndex]; y = commands[++cmdIndex]; currentMatrix.translate(x, y); break; + } case Commands.SCALE: + { x = commands[++cmdIndex]; y = commands[++cmdIndex]; currentMatrix.scale(x, y); break; + } case Commands.ROTATE: + { currentMatrix.rotate(commands[++cmdIndex]); break; - - case Commands.SET_TEXTURE: - var frame = commands[++cmdIndex]; - var mode = commands[++cmdIndex]; - - pipeline.currentFrame = frame; - pipeline.setTexture2D(frame.glTexture, src); - pipeline.tintEffect = mode; - - currentTexture = frame.glTexture; - - break; - - case Commands.CLEAR_TEXTURE: - pipeline.currentFrame = renderer.blankTexture; - pipeline.tintEffect = 2; - currentTexture = renderer.tempTextures[0]; - break; + } } } + + renderer.pipelines.postBatch(src); }; module.exports = GraphicsWebGLRenderer; /***/ }), -/* 991 */ +/* 1048 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157563,12 +166523,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(992); + renderWebGL = __webpack_require__(1049); } if (true) { - renderCanvas = __webpack_require__(993); + renderCanvas = __webpack_require__(1050); } module.exports = { @@ -157580,7 +166540,7 @@ module.exports = { /***/ }), -/* 992 */ +/* 1049 */ /***/ (function(module, exports) { /** @@ -157600,11 +166560,10 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var SpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var SpriteWebGLRenderer = function (renderer, src, camera, parentMatrix) { this.pipeline.batchSprite(src, camera, parentMatrix); }; @@ -157613,7 +166572,7 @@ module.exports = SpriteWebGLRenderer; /***/ }), -/* 993 */ +/* 1050 */ /***/ (function(module, exports) { /** @@ -157633,11 +166592,10 @@ module.exports = SpriteWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var SpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var SpriteCanvasRenderer = function (renderer, src, camera, parentMatrix) { renderer.batchSprite(src, src.frame, camera, parentMatrix); }; @@ -157646,7 +166604,7 @@ module.exports = SpriteCanvasRenderer; /***/ }), -/* 994 */ +/* 1051 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157660,12 +166618,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(995); + renderWebGL = __webpack_require__(1052); } if (true) { - renderCanvas = __webpack_require__(996); + renderCanvas = __webpack_require__(1053); } module.exports = { @@ -157677,7 +166635,7 @@ module.exports = { /***/ }), -/* 995 */ +/* 1052 */ /***/ (function(module, exports) { /** @@ -157697,11 +166655,10 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ImageWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ImageWebGLRenderer = function (renderer, src, camera, parentMatrix) { this.pipeline.batchSprite(src, camera, parentMatrix); }; @@ -157710,7 +166667,7 @@ module.exports = ImageWebGLRenderer; /***/ }), -/* 996 */ +/* 1053 */ /***/ (function(module, exports) { /** @@ -157730,11 +166687,10 @@ module.exports = ImageWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ImageCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ImageCanvasRenderer = function (renderer, src, camera, parentMatrix) { renderer.batchSprite(src, src.frame, camera, parentMatrix); }; @@ -157743,7 +166699,247 @@ module.exports = ImageCanvasRenderer; /***/ }), -/* 997 */ +/* 1054 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var renderWebGL = __webpack_require__(1); +var renderCanvas = __webpack_require__(1); + +if (true) +{ + renderWebGL = __webpack_require__(1055); +} + +if (true) +{ + renderCanvas = __webpack_require__(1056); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), +/* 1055 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Layer#renderWebGL + * @since 3.50.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Layer} layer - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var LayerWebGLRenderer = function (renderer, layer, camera) +{ + var children = layer.list; + var childCount = children.length; + + if (childCount === 0) + { + return; + } + + layer.depthSort(); + + renderer.pipelines.preBatch(layer); + + var layerHasBlendMode = (layer.blendMode !== -1); + + if (!layerHasBlendMode) + { + // If Layer is SKIP_TEST then set blend mode to be Normal + renderer.setBlendMode(0); + } + + var alpha = layer.alpha; + + for (var i = 0; i < childCount; i++) + { + var child = children[i]; + + if (!child.willRender(camera)) + { + continue; + } + + var childAlphaTopLeft; + var childAlphaTopRight; + var childAlphaBottomLeft; + var childAlphaBottomRight; + + if (child.alphaTopLeft !== undefined) + { + childAlphaTopLeft = child.alphaTopLeft; + childAlphaTopRight = child.alphaTopRight; + childAlphaBottomLeft = child.alphaBottomLeft; + childAlphaBottomRight = child.alphaBottomRight; + } + else + { + var childAlpha = child.alpha; + + childAlphaTopLeft = childAlpha; + childAlphaTopRight = childAlpha; + childAlphaBottomLeft = childAlpha; + childAlphaBottomRight = childAlpha; + } + + if (!layerHasBlendMode && child.blendMode !== renderer.currentBlendMode) + { + // If Layer doesn't have its own blend mode, then a child can have one + renderer.setBlendMode(child.blendMode); + } + + var mask = child.mask; + + if (mask) + { + mask.preRenderWebGL(renderer, child, camera); + } + + var type = child.type; + + if (type !== renderer.currentType) + { + renderer.newType = true; + renderer.currentType = type; + } + + renderer.nextTypeMatch = (i < childCount - 1) ? (children[i + 1].type === renderer.currentType) : false; + + child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha); + + // Render + child.renderWebGL(renderer, child, camera); + + // Restore original values + child.setAlpha(childAlphaTopLeft, childAlphaTopRight, childAlphaBottomLeft, childAlphaBottomRight); + + if (mask) + { + mask.postRenderWebGL(renderer, camera); + } + + renderer.newType = false; + } + + renderer.pipelines.postBatch(layer); +}; + +module.exports = LayerWebGLRenderer; + + +/***/ }), +/* 1056 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Layer#renderCanvas + * @since 3.50.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Layer} layer - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var LayerCanvasRenderer = function (renderer, layer, camera) +{ + var children = layer.list; + + if (children.length === 0) + { + return; + } + + layer.depthSort(); + + var layerHasBlendMode = (layer.blendMode !== -1); + + if (!layerHasBlendMode) + { + // If Layer is SKIP_TEST then set blend mode to be Normal + renderer.setBlendMode(0); + } + + var alpha = layer._alpha; + + if (layer.mask) + { + layer.mask.preRenderCanvas(renderer, null, camera); + } + + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + + if (!child.willRender(camera)) + { + continue; + } + + var childAlpha = child.alpha; + + if (!layerHasBlendMode && child.blendMode !== renderer.currentBlendMode) + { + // If Layer doesn't have its own blend mode, then a child can have one + renderer.setBlendMode(child.blendMode); + } + + // Set parent values + child.setAlpha(childAlpha * alpha); + + // Render + child.renderCanvas(renderer, child, camera); + + // Restore original values + child.setAlpha(childAlpha); + } + + if (layer.mask) + { + layer.mask.postRenderCanvas(renderer); + } +}; + +module.exports = LayerCanvasRenderer; + + +/***/ }), +/* 1057 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157758,18 +166954,18 @@ module.exports = ImageCanvasRenderer; module.exports = { - EmitterOp: __webpack_require__(416), - GravityWell: __webpack_require__(417), - Particle: __webpack_require__(418), - ParticleEmitter: __webpack_require__(419), - ParticleEmitterManager: __webpack_require__(205), - Zones: __webpack_require__(1001) + EmitterOp: __webpack_require__(426), + GravityWell: __webpack_require__(427), + Particle: __webpack_require__(428), + ParticleEmitter: __webpack_require__(429), + ParticleEmitterManager: __webpack_require__(211), + Zones: __webpack_require__(1061) }; /***/ }), -/* 998 */ +/* 1058 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157783,12 +166979,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(999); + renderWebGL = __webpack_require__(1059); } if (true) { - renderCanvas = __webpack_require__(1000); + renderCanvas = __webpack_require__(1060); } module.exports = { @@ -157800,7 +166996,7 @@ module.exports = { /***/ }), -/* 999 */ +/* 1059 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -157809,7 +167005,13 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var TransformMatrix = __webpack_require__(24); +var Utils = __webpack_require__(12); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); +var tempMatrix4 = new TransformMatrix(); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -157822,11 +167024,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpolationPercentage, camera, parentMatrix) +var ParticleManagerWebGLRenderer = function (renderer, emitterManager, camera, parentMatrix) { var emitters = emitterManager.emitters.list; var emittersLength = emitters.length; @@ -157836,21 +167037,34 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola return; } - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(emitterManager.pipeline); - var camMatrix = pipeline._tempMatrix1.copyFrom(camera.matrix); - var calcMatrix = pipeline._tempMatrix2; - var particleMatrix = pipeline._tempMatrix3; - var managerMatrix = pipeline._tempMatrix4.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + var camMatrix = tempMatrix1; + var calcMatrix = tempMatrix2; + var particleMatrix = tempMatrix3; + var managerMatrix = tempMatrix4; - camMatrix.multiply(managerMatrix); + if (parentMatrix) + { + managerMatrix.loadIdentity(); + managerMatrix.multiply(parentMatrix); + managerMatrix.translate(emitterManager.x, emitterManager.y); + managerMatrix.rotate(emitterManager.rotation); + managerMatrix.scale(emitterManager.scaleX, emitterManager.scaleY); + } + else + { + managerMatrix.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + } var roundPixels = camera.roundPixels; var texture = emitterManager.defaultFrame.glTexture; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; + var getTint = Utils.getTintAppendFloatAlpha; var textureUnit = pipeline.setGameObject(emitterManager, emitterManager.defaultFrame); + renderer.pipelines.preBatch(emitterManager); + for (var e = 0; e < emittersLength; e++) { var emitter = emitters[e]; @@ -157862,29 +167076,19 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola continue; } - var scrollX = camera.scrollX * emitter.scrollFactorX; - var scrollY = camera.scrollY * emitter.scrollFactorY; + var followX = (emitter.follow) ? emitter.follow.x + emitter.followOffset.x : 0; + var followY = (emitter.follow) ? emitter.follow.y + emitter.followOffset.y : 0; - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -scrollX, -scrollY); + var scrollFactorX = emitter.scrollFactorX; + var scrollFactorY = emitter.scrollFactorY; - scrollX = 0; - scrollY = 0; - } - - if (renderer.setBlendMode(emitter.blendMode)) - { - // Rebind the texture if we've flushed - // pipeline.setTexture2D(texture, 0); - } + renderer.setBlendMode(emitter.blendMode); if (emitter.mask) { emitter.mask.preRenderWebGL(renderer, emitter, camera); - // pipeline.setTexture2D(texture, 0); + renderer.pipelines.set(emitterManager.pipeline); } var tintEffect = 0; @@ -157900,67 +167104,58 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola continue; } + particleMatrix.applyITRS(particle.x, particle.y, particle.rotation, particle.scaleX, particle.scaleY); + + camMatrix.copyFrom(camera.matrix); + + camMatrix.multiplyWithOffset(managerMatrix, followX + -camera.scrollX * scrollFactorX, followY + -camera.scrollY * scrollFactorY); + + // Undo the camera scroll + particleMatrix.e = particle.x; + particleMatrix.f = particle.y; + + // Multiply by the particle matrix, store result in calcMatrix + camMatrix.multiply(particleMatrix, calcMatrix); + var frame = particle.frame; - var x = -(frame.halfWidth); - var y = -(frame.halfHeight); + var x = -frame.halfWidth; + var y = -frame.halfHeight; var xw = x + frame.width; var yh = y + frame.height; - particleMatrix.applyITRS(0, 0, particle.rotation, particle.scaleX, particle.scaleY); + var tx0 = calcMatrix.getXRound(x, y, roundPixels); + var ty0 = calcMatrix.getYRound(x, y, roundPixels); - particleMatrix.e = particle.x - scrollX; - particleMatrix.f = particle.y - scrollY; + var tx1 = calcMatrix.getXRound(x, yh, roundPixels); + var ty1 = calcMatrix.getYRound(x, yh, roundPixels); - camMatrix.multiply(particleMatrix, calcMatrix); + var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); + var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); - - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); - - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); - - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); - - if (roundPixels) - { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); - - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); - - tx2 = Math.round(tx2); - ty2 = Math.round(ty2); - - tx3 = Math.round(tx3); - ty3 = Math.round(ty3); - } + var tx3 = calcMatrix.getXRound(xw, y, roundPixels); + var ty3 = calcMatrix.getYRound(xw, y, roundPixels); var tint = getTint(particle.tint, alpha); - pipeline.batchQuad(tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, texture, textureUnit); + pipeline.batchQuad(emitter, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, texture, textureUnit); } if (emitter.mask) { emitter.mask.postRenderWebGL(renderer, camera); - - // pipeline.setTexture2D(texture, 0); } } + + renderer.pipelines.postBatch(emitterManager); }; module.exports = ParticleManagerWebGLRenderer; /***/ }), -/* 1000 */ -/***/ (function(module, exports) { +/* 1060 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -157968,6 +167163,13 @@ module.exports = ParticleManagerWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var TransformMatrix = __webpack_require__(24); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); +var tempMatrix4 = new TransformMatrix(); + /** * Renders this Game Object with the Canvas Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. @@ -157979,11 +167181,10 @@ module.exports = ParticleManagerWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpolationPercentage, camera, parentMatrix) +var ParticleManagerCanvasRenderer = function (renderer, emitterManager, camera, parentMatrix) { var emitters = emitterManager.emitters.list; var emittersLength = emitters.length; @@ -157993,18 +167194,26 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol return; } - var camMatrix = renderer._tempMatrix1.copyFrom(camera.matrix); - var calcMatrix = renderer._tempMatrix2; - var particleMatrix = renderer._tempMatrix3; - var managerMatrix = renderer._tempMatrix4.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + var camMatrix = tempMatrix1.copyFrom(camera.matrix); + var calcMatrix = tempMatrix2; + var particleMatrix = tempMatrix3; + var managerMatrix = tempMatrix4; - camMatrix.multiply(managerMatrix); - - var roundPixels = camera.roundPixels; + if (parentMatrix) + { + managerMatrix.loadIdentity(); + managerMatrix.multiply(parentMatrix); + managerMatrix.translate(emitterManager.x, emitterManager.y); + managerMatrix.rotate(emitterManager.rotation); + managerMatrix.scale(emitterManager.scaleX, emitterManager.scaleY); + } + else + { + managerMatrix.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + } var ctx = renderer.currentContext; - - ctx.save(); + var roundPixels = camera.roundPixels; for (var e = 0; e < emittersLength; e++) { @@ -158017,17 +167226,13 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol continue; } - var scrollX = camera.scrollX * emitter.scrollFactorX; - var scrollY = camera.scrollY * emitter.scrollFactorY; + var followX = (emitter.follow) ? emitter.follow.x + emitter.followOffset.x : 0; + var followY = (emitter.follow) ? emitter.follow.y + emitter.followOffset.y : 0; - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -scrollX, -scrollY); + var scrollFactorX = emitter.scrollFactorX; + var scrollFactorY = emitter.scrollFactorY; - scrollX = 0; - scrollY = 0; - } + ctx.save(); ctx.globalCompositeOperation = renderer.blendModes[emitter.blendMode]; @@ -158042,24 +167247,30 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol continue; } + particleMatrix.applyITRS(particle.x, particle.y, particle.rotation, particle.scaleX, particle.scaleY); + + camMatrix.copyFrom(camera.matrix); + + camMatrix.multiplyWithOffset(managerMatrix, followX + -camera.scrollX * scrollFactorX, followY + -camera.scrollY * scrollFactorY); + + // Undo the camera scroll + particleMatrix.e = particle.x; + particleMatrix.f = particle.y; + + // Multiply by the particle matrix, store result in calcMatrix + camMatrix.multiply(particleMatrix, calcMatrix); + var frame = particle.frame; var cd = frame.canvasData; var x = -(frame.halfWidth); var y = -(frame.halfHeight); - particleMatrix.applyITRS(0, 0, particle.rotation, particle.scaleX, particle.scaleY); - - particleMatrix.e = particle.x - scrollX; - particleMatrix.f = particle.y - scrollY; - - camMatrix.multiply(particleMatrix, calcMatrix); - ctx.globalAlpha = alpha; - + ctx.save(); - calcMatrix.copyToContext(ctx); + calcMatrix.setToContext(ctx); if (roundPixels) { @@ -158073,16 +167284,16 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol ctx.restore(); } - } - ctx.restore(); + ctx.restore(); + } }; module.exports = ParticleManagerCanvasRenderer; /***/ }), -/* 1001 */ +/* 1061 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158097,15 +167308,15 @@ module.exports = ParticleManagerCanvasRenderer; module.exports = { - DeathZone: __webpack_require__(420), - EdgeZone: __webpack_require__(421), - RandomZone: __webpack_require__(423) + DeathZone: __webpack_require__(430), + EdgeZone: __webpack_require__(431), + RandomZone: __webpack_require__(433) }; /***/ }), -/* 1002 */ +/* 1062 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158119,12 +167330,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1003); + renderWebGL = __webpack_require__(1063); } if (true) { - renderCanvas = __webpack_require__(1004); + renderCanvas = __webpack_require__(1064); } module.exports = { @@ -158136,7 +167347,7 @@ module.exports = { /***/ }), -/* 1003 */ +/* 1063 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158145,7 +167356,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -158158,23 +167369,28 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.RenderTexture} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RenderTextureWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RenderTextureWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var frame = src.frame; - var width = frame.width; - var height = frame.height; - var getTint = Utils.getTintAppendFloatAlpha; - var pipeline = renderer.pipelines.set(src.pipeline, src); + var cameraAlpha = camera.alpha; - var textureUnit = pipeline.setTexture2D(frame.glTexture, src); + var renderTarget = src.renderTarget; + var width = renderTarget.width; + var height = renderTarget.height; + + var getTint = Utils.getTintAppendFloatAlpha; + + var pipeline = renderer.pipelines.set(src.pipeline); + + var textureUnit = pipeline.setTexture2D(renderTarget.texture); + + renderer.pipelines.preBatch(src); pipeline.batchTexture( src, - frame.glTexture, + renderTarget.texture, width, height, src.x, src.y, width, height, @@ -158184,24 +167400,28 @@ var RenderTextureWebGLRenderer = function (renderer, src, interpolationPercentag src.scrollFactorX, src.scrollFactorY, src.displayOriginX, src.displayOriginY, 0, 0, width, height, - getTint(src._tintTL, camera.alpha * src._alphaTL), - getTint(src._tintTR, camera.alpha * src._alphaTR), - getTint(src._tintBL, camera.alpha * src._alphaBL), - getTint(src._tintBR, camera.alpha * src._alphaBR), - (src._isTinted && src.tintFill), + getTint(src.tintTopLeft, cameraAlpha * src._alphaTL), + getTint(src.tintTopRight, cameraAlpha * src._alphaTR), + getTint(src.tintBottomLeft, cameraAlpha * src._alphaBL), + getTint(src.tintBottomRight, cameraAlpha * src._alphaBR), + src.tintFill, 0, 0, camera, parentMatrix, - false, + true, textureUnit ); + + renderer.resetTextures(); + + renderer.pipelines.postBatch(src); }; module.exports = RenderTextureWebGLRenderer; /***/ }), -/* 1004 */ +/* 1064 */ /***/ (function(module, exports) { /** @@ -158221,11 +167441,10 @@ module.exports = RenderTextureWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.RenderTexture} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RenderTextureCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RenderTextureCanvasRenderer = function (renderer, src, camera, parentMatrix) { renderer.batchSprite(src, src.frame, camera, parentMatrix); }; @@ -158234,7 +167453,7 @@ module.exports = RenderTextureCanvasRenderer; /***/ }), -/* 1005 */ +/* 1065 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158243,15 +167462,15 @@ module.exports = RenderTextureCanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RETRO_FONT_CONST = __webpack_require__(1006); -var Extend = __webpack_require__(19); +var RETRO_FONT_CONST = __webpack_require__(1066); +var Extend = __webpack_require__(18); /** * @namespace Phaser.GameObjects.RetroFont * @since 3.6.0 */ -var RetroFont = { Parse: __webpack_require__(1007) }; +var RetroFont = { Parse: __webpack_require__(1067) }; // Merge in the consts RetroFont = Extend(false, RetroFont, RETRO_FONT_CONST); @@ -158260,7 +167479,7 @@ module.exports = RetroFont; /***/ }), -/* 1006 */ +/* 1066 */ /***/ (function(module, exports) { /** @@ -158376,7 +167595,7 @@ module.exports = RETRO_FONT_CONST; /***/ }), -/* 1007 */ +/* 1067 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158403,8 +167622,10 @@ var ParseRetroFont = function (scene, config) { var w = config.width; var h = config.height; + var cx = Math.floor(w / 2); var cy = Math.floor(h / 2); + var letters = GetValue(config, 'chars', ''); if (letters === '') @@ -158413,6 +167634,13 @@ var ParseRetroFont = function (scene, config) } var key = GetValue(config, 'image', ''); + + var frame = scene.sys.textures.getFrame(key); + var textureX = frame.cutX; + var textureY = frame.cutY; + var textureWidth = frame.source.width; + var textureHeight = frame.source.height; + var offsetX = GetValue(config, 'offset.x', 0); var offsetY = GetValue(config, 'offset.y', 0); var spacingX = GetValue(config, 'spacing.x', 0); @@ -158423,7 +167651,7 @@ var ParseRetroFont = function (scene, config) if (charsPerRow === null) { - charsPerRow = scene.sys.textures.getFrame(key).width / w; + charsPerRow = textureWidth / w; if (charsPerRow > letters.length) { @@ -158446,10 +167674,13 @@ var ParseRetroFont = function (scene, config) for (var i = 0; i < letters.length; i++) { - // var node = letters[i]; - var charCode = letters.charCodeAt(i); + var u0 = (textureX + x) / textureWidth; + var v0 = (textureY + y) / textureHeight; + var u1 = (textureX + x + w) / textureWidth; + var v1 = (textureY + y + h) / textureHeight; + data.chars[charCode] = { x: x, @@ -158462,7 +167693,11 @@ var ParseRetroFont = function (scene, config) yOffset: 0, xAdvance: w, data: {}, - kerning: {} + kerning: {}, + u0: u0, + v0: v0, + u1: u1, + v1: v1 }; r++; @@ -158492,7 +167727,7 @@ module.exports = ParseRetroFont; /***/ }), -/* 1008 */ +/* 1068 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158506,12 +167741,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1009); + renderWebGL = __webpack_require__(1069); } if (true) { - renderCanvas = __webpack_require__(1010); + renderCanvas = __webpack_require__(1070); } module.exports = { @@ -158523,7 +167758,7 @@ module.exports = { /***/ }), -/* 1009 */ +/* 1069 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158532,7 +167767,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -158545,49 +167781,21 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Rope} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RopeWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RopeWebGLRenderer = function (renderer, src, camera, parentMatrix) { var pipeline = renderer.pipelines.set(src.pipeline, src); - var camMatrix = pipeline._tempMatrix1; - var spriteMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; - - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; var vertices = src.vertices; var uvs = src.uv; var colors = src.colors; var alphas = src.alphas; var alpha = src.alpha; - var getTint = Utils.getTintAppendFloatAlphaAndSwap; + var getTint = Utils.getTintAppendFloatAlpha; var roundPixels = camera.roundPixels; var meshVerticesLength = vertices.length; @@ -158596,12 +167804,14 @@ var RopeWebGLRenderer = function (renderer, src, interpolationPercentage, camera // Because it's a triangle strip and we don't want lots of degenerate triangles joining things up pipeline.flush(); + renderer.pipelines.preBatch(src); + var textureUnit = pipeline.setGameObject(src); var vertexViewF32 = pipeline.vertexViewF32; var vertexViewU32 = pipeline.vertexViewU32; - var vertexOffset = (pipeline.vertexCount * pipeline.vertexComponentCount) - 1; + var vertexOffset = (pipeline.vertexCount * pipeline.currentShader.vertexComponentCount) - 1; var colorIndex = 0; @@ -158652,13 +167862,15 @@ var RopeWebGLRenderer = function (renderer, src, interpolationPercentage, camera } pipeline.vertexCount += vertexCount; + + renderer.pipelines.postBatch(src); }; module.exports = RopeWebGLRenderer; /***/ }), -/* 1010 */ +/* 1070 */ /***/ (function(module, exports) { /** @@ -158676,7 +167888,6 @@ module.exports = RopeWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Rope} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ var RopeCanvasRenderer = function () @@ -158687,7 +167898,7 @@ module.exports = RopeCanvasRenderer; /***/ }), -/* 1011 */ +/* 1071 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158701,12 +167912,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1012); + renderWebGL = __webpack_require__(1072); } if (true) { - renderCanvas = __webpack_require__(1013); + renderCanvas = __webpack_require__(1073); } module.exports = { @@ -158718,7 +167929,7 @@ module.exports = { /***/ }), -/* 1012 */ +/* 1072 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158727,7 +167938,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -158740,11 +167951,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Text} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TextWebGLRenderer = function (renderer, src, camera, parentMatrix) { if (src.width === 0 || src.height === 0) { @@ -158755,10 +167965,12 @@ var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera var width = frame.width; var height = frame.height; var getTint = Utils.getTintAppendFloatAlpha; - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); var textureUnit = pipeline.setTexture2D(frame.glTexture, src); + renderer.pipelines.preBatch(src); + pipeline.batchTexture( src, frame.glTexture, @@ -158771,24 +167983,26 @@ var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera src.scrollFactorX, src.scrollFactorY, src.displayOriginX, src.displayOriginY, 0, 0, width, height, - getTint(src._tintTL, camera.alpha * src._alphaTL), - getTint(src._tintTR, camera.alpha * src._alphaTR), - getTint(src._tintBL, camera.alpha * src._alphaBL), - getTint(src._tintBR, camera.alpha * src._alphaBR), - (src._isTinted && src.tintFill), + getTint(src.tintTopLeft, camera.alpha * src._alphaTL), + getTint(src.tintTopRight, camera.alpha * src._alphaTR), + getTint(src.tintBottomLeft, camera.alpha * src._alphaBL), + getTint(src.tintBottomRight, camera.alpha * src._alphaBR), + src.tintFill, 0, 0, camera, parentMatrix, false, textureUnit ); + + renderer.pipelines.postBatch(src); }; module.exports = TextWebGLRenderer; /***/ }), -/* 1013 */ +/* 1073 */ /***/ (function(module, exports) { /** @@ -158808,13 +168022,12 @@ module.exports = TextWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Text} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TextCanvasRenderer = function (renderer, src, camera, parentMatrix) { - if ((src.width === 0) || (src.height === 0)) + if (src.width === 0 || src.height === 0) { return; } @@ -158826,7 +168039,7 @@ module.exports = TextCanvasRenderer; /***/ }), -/* 1014 */ +/* 1074 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158840,12 +168053,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1015); + renderWebGL = __webpack_require__(1075); } if (true) { - renderCanvas = __webpack_require__(1016); + renderCanvas = __webpack_require__(1076); } module.exports = { @@ -158857,7 +168070,7 @@ module.exports = { /***/ }), -/* 1015 */ +/* 1075 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158866,7 +168079,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -158879,11 +168092,10 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.TileSprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TileSpriteWebGLRenderer = function (renderer, src, camera, parentMatrix) { src.updateCanvas(); @@ -158894,9 +168106,11 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, return; } + renderer.pipelines.preBatch(src); + var getTint = Utils.getTintAppendFloatAlpha; - var pipeline = renderer.pipelines.set(this.pipeline, src); + var pipeline = renderer.pipelines.set(src.pipeline, src); var textureUnit = pipeline.setTexture2D(src.fillPattern, src); @@ -158912,11 +168126,11 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, src.scrollFactorX, src.scrollFactorY, src.originX * width, src.originY * height, 0, 0, width, height, - getTint(src._tintTL, camera.alpha * src._alphaTL), - getTint(src._tintTR, camera.alpha * src._alphaTR), - getTint(src._tintBL, camera.alpha * src._alphaBL), - getTint(src._tintBR, camera.alpha * src._alphaBR), - (src._isTinted && src.tintFill), + getTint(src.tintTopLeft, camera.alpha * src._alphaTL), + getTint(src.tintTopRight, camera.alpha * src._alphaTR), + getTint(src.tintBottomLeft, camera.alpha * src._alphaBL), + getTint(src.tintBottomRight, camera.alpha * src._alphaBR), + src.tintFill, (src.tilePositionX % src.displayFrame.width) / src.displayFrame.width, (src.tilePositionY % src.displayFrame.height) / src.displayFrame.height, camera, @@ -158924,13 +168138,15 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, false, textureUnit ); + + renderer.pipelines.postBatch(src); }; module.exports = TileSpriteWebGLRenderer; /***/ }), -/* 1016 */ +/* 1076 */ /***/ (function(module, exports) { /** @@ -158950,11 +168166,10 @@ module.exports = TileSpriteWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.TileSprite} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TileSpriteCanvasRenderer = function (renderer, src, camera, parentMatrix) { src.updateCanvas(); @@ -158965,7 +168180,7 @@ module.exports = TileSpriteCanvasRenderer; /***/ }), -/* 1017 */ +/* 1077 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -158979,12 +168194,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1018); + renderWebGL = __webpack_require__(1078); } if (true) { - renderCanvas = __webpack_require__(1019); + renderCanvas = __webpack_require__(1079); } module.exports = { @@ -158996,7 +168211,7 @@ module.exports = { /***/ }), -/* 1018 */ +/* 1078 */ /***/ (function(module, exports) { /** @@ -159016,15 +168231,14 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Video} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var VideoWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var VideoWebGLRenderer = function (renderer, src, camera, parentMatrix) { if (src.videoTexture) { - this.pipeline.batchSprite(src, camera, parentMatrix); + src.pipeline.batchSprite(src, camera, parentMatrix); } }; @@ -159032,7 +168246,7 @@ module.exports = VideoWebGLRenderer; /***/ }), -/* 1019 */ +/* 1079 */ /***/ (function(module, exports) { /** @@ -159052,11 +168266,10 @@ module.exports = VideoWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Video} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var VideoCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var VideoCanvasRenderer = function (renderer, src, camera, parentMatrix) { if (src.videoTexture) { @@ -159068,7 +168281,7 @@ module.exports = VideoCanvasRenderer; /***/ }), -/* 1020 */ +/* 1080 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159082,12 +168295,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1021); + renderWebGL = __webpack_require__(1081); } if (true) { - renderCanvas = __webpack_require__(1022); + renderCanvas = __webpack_require__(1082); } module.exports = { @@ -159099,7 +168312,7 @@ module.exports = { /***/ }), -/* 1021 */ +/* 1081 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159108,8 +168321,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var GetCalcMatrix = __webpack_require__(21); +var FillPathWebGL = __webpack_require__(109); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -159122,44 +168336,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Arc} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ArcWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ArcWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -159169,13 +168363,15 @@ var ArcWebGLRenderer = function (renderer, src, interpolationPercentage, camera, { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = ArcWebGLRenderer; /***/ }), -/* 1022 */ +/* 1082 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159184,10 +168380,10 @@ module.exports = ArcWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DegToRad = __webpack_require__(41); -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var DegToRad = __webpack_require__(34); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -159200,11 +168396,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Arc} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ArcCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ArcCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -159251,7 +168446,7 @@ module.exports = ArcCanvasRenderer; /***/ }), -/* 1023 */ +/* 1083 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159265,12 +168460,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1024); + renderWebGL = __webpack_require__(1084); } if (true) { - renderCanvas = __webpack_require__(1025); + renderCanvas = __webpack_require__(1085); } module.exports = { @@ -159282,7 +168477,7 @@ module.exports = { /***/ }), -/* 1024 */ +/* 1084 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159291,8 +168486,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var FillPathWebGL = __webpack_require__(109); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -159305,44 +168501,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Curve} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var CurveWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var CurveWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX + src._curveBounds.x; var dy = src._displayOriginY + src._curveBounds.y; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -159352,13 +168528,15 @@ var CurveWebGLRenderer = function (renderer, src, interpolationPercentage, camer { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = CurveWebGLRenderer; /***/ }), -/* 1025 */ +/* 1085 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159367,9 +168545,9 @@ module.exports = CurveWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -159382,11 +168560,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Curve} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var CurveCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var CurveCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -159394,27 +168571,27 @@ var CurveCanvasRenderer = function (renderer, src, interpolationPercentage, came { var dx = src._displayOriginX + src._curveBounds.x; var dy = src._displayOriginY + src._curveBounds.y; - + var path = src.pathData; var pathLength = path.length - 1; - + var px1 = path[0] - dx; var py1 = path[1] - dy; ctx.beginPath(); ctx.moveTo(px1, py1); - + if (!src.closePath) { pathLength -= 2; } - + for (var i = 2; i < pathLength; i += 2) { var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - + ctx.lineTo(px2, py2); } @@ -159446,7 +168623,7 @@ module.exports = CurveCanvasRenderer; /***/ }), -/* 1026 */ +/* 1086 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159460,12 +168637,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1027); + renderWebGL = __webpack_require__(1087); } if (true) { - renderCanvas = __webpack_require__(1028); + renderCanvas = __webpack_require__(1088); } module.exports = { @@ -159477,7 +168654,7 @@ module.exports = { /***/ }), -/* 1027 */ +/* 1087 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159486,8 +168663,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var FillPathWebGL = __webpack_require__(109); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -159500,44 +168678,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Ellipse} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var EllipseWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var EllipseWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -159547,13 +168705,15 @@ var EllipseWebGLRenderer = function (renderer, src, interpolationPercentage, cam { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = EllipseWebGLRenderer; /***/ }), -/* 1028 */ +/* 1088 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159562,9 +168722,9 @@ module.exports = EllipseWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -159577,11 +168737,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Ellipse} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var EllipseCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var EllipseCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -159592,24 +168751,24 @@ var EllipseCanvasRenderer = function (renderer, src, interpolationPercentage, ca var path = src.pathData; var pathLength = path.length - 1; - + var px1 = path[0] - dx; var py1 = path[1] - dy; ctx.beginPath(); ctx.moveTo(px1, py1); - + if (!src.closePath) { pathLength -= 2; } - + for (var i = 2; i < pathLength; i += 2) { var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - + ctx.lineTo(px2, py2); } @@ -159638,7 +168797,7 @@ module.exports = EllipseCanvasRenderer; /***/ }), -/* 1029 */ +/* 1089 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159652,12 +168811,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1030); + renderWebGL = __webpack_require__(1090); } if (true) { - renderCanvas = __webpack_require__(1031); + renderCanvas = __webpack_require__(1091); } module.exports = { @@ -159669,7 +168828,7 @@ module.exports = { /***/ }), -/* 1030 */ +/* 1090 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159678,7 +168837,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -159691,38 +168851,16 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Grid} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var GridWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); calcMatrix.translate(-src._displayOriginX, -src._displayOriginY); @@ -159758,8 +168896,6 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera var cw = 0; var ch = 0; - pipeline.setTexture2D(); - if (showOutline) { // To make room for the grid lines (in case alpha < 1) @@ -159777,10 +168913,12 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera } } + renderer.pipelines.preBatch(src); + if (showCells && src.fillAlpha > 0) { fillTint = pipeline.fillTint; - fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha); + fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); fillTint.TL = fillTintColor; fillTint.TR = fillTintColor; @@ -159820,7 +168958,7 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera if (showAltCells && src.altFillAlpha > 0) { fillTint = pipeline.fillTint; - fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.altFillColor, src.altFillAlpha * alpha); + fillTintColor = Utils.getTintAppendFloatAlpha(src.altFillColor, src.altFillAlpha * alpha); fillTint.TL = fillTintColor; fillTint.TR = fillTintColor; @@ -159860,7 +168998,7 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera if (showOutline && src.outlineFillAlpha > 0) { var strokeTint = pipeline.strokeTint; - var color = Utils.getTintAppendFloatAlphaAndSwap(src.outlineFillColor, src.outlineFillAlpha * alpha); + var color = Utils.getTintAppendFloatAlpha(src.outlineFillColor, src.outlineFillAlpha * alpha); strokeTint.TL = color; strokeTint.TR = color; @@ -159881,13 +169019,15 @@ var GridWebGLRenderer = function (renderer, src, interpolationPercentage, camera pipeline.batchLine(0, y1, width, y1, 1, 1, 1, 0, false); } } + + renderer.pipelines.postBatch(src); }; module.exports = GridWebGLRenderer; /***/ }), -/* 1031 */ +/* 1091 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -159896,9 +169036,9 @@ module.exports = GridWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -159911,11 +169051,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Grid} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var GridCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var GridCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -160076,7 +169215,7 @@ module.exports = GridCanvasRenderer; /***/ }), -/* 1032 */ +/* 1092 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160090,12 +169229,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1033); + renderWebGL = __webpack_require__(1093); } if (true) { - renderCanvas = __webpack_require__(1034); + renderCanvas = __webpack_require__(1094); } module.exports = { @@ -160107,7 +169246,7 @@ module.exports = { /***/ }), -/* 1033 */ +/* 1093 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160116,7 +169255,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -160129,38 +169269,16 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.IsoBox} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var IsoBoxWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var size = src.width; var height = src.height; @@ -160189,13 +169307,14 @@ var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, came var x3; var y3; - pipeline.setTexture2D(); + + renderer.pipelines.preBatch(src); // Top Face if (src.showTop) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillTop, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillTop, alpha); x0 = calcMatrix.getX(-sizeA, -height); y0 = calcMatrix.getY(-sizeA, -height); @@ -160209,14 +169328,14 @@ var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, came x3 = calcMatrix.getX(0, sizeB - height); y3 = calcMatrix.getY(0, sizeB - height); - pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint, tint, tint, tint); } // Left Face if (src.showLeft) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillLeft, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillLeft, alpha); x0 = calcMatrix.getX(-sizeA, 0); y0 = calcMatrix.getY(-sizeA, 0); @@ -160230,14 +169349,14 @@ var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, came x3 = calcMatrix.getX(-sizeA, -height); y3 = calcMatrix.getY(-sizeA, -height); - pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint, tint, tint, tint); } // Right Face if (src.showRight) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillRight, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillRight, alpha); x0 = calcMatrix.getX(sizeA, 0); y0 = calcMatrix.getY(sizeA, 0); @@ -160251,15 +169370,17 @@ var IsoBoxWebGLRenderer = function (renderer, src, interpolationPercentage, came x3 = calcMatrix.getX(sizeA, -height); y3 = calcMatrix.getY(sizeA, -height); - pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint, tint, tint, tint); } + + renderer.pipelines.postBatch(src); }; module.exports = IsoBoxWebGLRenderer; /***/ }), -/* 1034 */ +/* 1094 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160268,8 +169389,8 @@ module.exports = IsoBoxWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -160282,11 +169403,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.IsoBox} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var IsoBoxCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var IsoBoxCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -160294,7 +169414,7 @@ var IsoBoxCanvasRenderer = function (renderer, src, interpolationPercentage, cam { var size = src.width; var height = src.height; - + var sizeA = size / 2; var sizeB = size / src.projection; @@ -160324,7 +169444,7 @@ var IsoBoxCanvasRenderer = function (renderer, src, interpolationPercentage, cam FillStyleCanvas(ctx, src, src.fillLeft); ctx.beginPath(); - + ctx.moveTo(-sizeA, 0); ctx.lineTo(0, sizeB); ctx.lineTo(0, sizeB - height); @@ -160360,7 +169480,7 @@ module.exports = IsoBoxCanvasRenderer; /***/ }), -/* 1035 */ +/* 1095 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160374,12 +169494,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1036); + renderWebGL = __webpack_require__(1096); } if (true) { - renderCanvas = __webpack_require__(1037); + renderCanvas = __webpack_require__(1097); } module.exports = { @@ -160391,7 +169511,7 @@ module.exports = { /***/ }), -/* 1036 */ +/* 1096 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160400,7 +169520,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -160413,38 +169534,16 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.IsoTriangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var IsoTriangleWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var size = src.width; var height = src.height; @@ -160461,6 +169560,8 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, return; } + renderer.pipelines.preBatch(src); + var tint; var x0; @@ -160472,13 +169573,11 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, var x2; var y2; - pipeline.setTexture2D(); - // Top Face if (src.showTop && reversed) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillTop, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillTop, alpha); x0 = calcMatrix.getX(-sizeA, -height); y0 = calcMatrix.getY(-sizeA, -height); @@ -160492,14 +169591,14 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, var x3 = calcMatrix.getX(0, sizeB - height); var y3 = calcMatrix.getY(0, sizeB - height); - pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint, tint, tint, tint); } // Left Face if (src.showLeft) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillLeft, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillLeft, alpha); if (reversed) { @@ -160524,14 +169623,14 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, y2 = calcMatrix.getY(0, sizeB - height); } - pipeline.batchTri(x0, y0, x1, y1, x2, y2, 0, 0, 1, 1, tint, tint, tint, 2); + pipeline.batchTri(x0, y0, x1, y1, x2, y2, tint, tint, tint); } // Right Face if (src.showRight) { - tint = Utils.getTintAppendFloatAlphaAndSwap(src.fillRight, alpha); + tint = Utils.getTintAppendFloatAlpha(src.fillRight, alpha); if (reversed) { @@ -160556,15 +169655,17 @@ var IsoTriangleWebGLRenderer = function (renderer, src, interpolationPercentage, y2 = calcMatrix.getY(0, sizeB - height); } - pipeline.batchTri(x0, y0, x1, y1, x2, y2, 0, 0, 1, 1, tint, tint, tint, 2); + pipeline.batchTri(x0, y0, x1, y1, x2, y2, tint, tint, tint); } + + renderer.pipelines.postBatch(src); }; module.exports = IsoTriangleWebGLRenderer; /***/ }), -/* 1037 */ +/* 1097 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160573,8 +169674,8 @@ module.exports = IsoTriangleWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -160587,11 +169688,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.IsoTriangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var IsoTriangleCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var IsoTriangleCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -160599,7 +169699,7 @@ var IsoTriangleCanvasRenderer = function (renderer, src, interpolationPercentage { var size = src.width; var height = src.height; - + var sizeA = size / 2; var sizeB = size / src.projection; @@ -160678,7 +169778,7 @@ module.exports = IsoTriangleCanvasRenderer; /***/ }), -/* 1038 */ +/* 1098 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160692,12 +169792,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1039); + renderWebGL = __webpack_require__(1099); } if (true) { - renderCanvas = __webpack_require__(1040); + renderCanvas = __webpack_require__(1100); } module.exports = { @@ -160709,7 +169809,7 @@ module.exports = { /***/ }), -/* 1039 */ +/* 1099 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160718,7 +169818,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -160731,44 +169832,27 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Line} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var LineWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var LineWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } + pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isStroked) { var strokeTint = pipeline.strokeTint; - var color = Utils.getTintAppendFloatAlphaAndSwap(src.strokeColor, src.strokeAlpha * alpha); + var color = Utils.getTintAppendFloatAlpha(src.strokeColor, src.strokeAlpha * alpha); strokeTint.TL = color; strokeTint.TR = color; @@ -160778,8 +169862,6 @@ var LineWebGLRenderer = function (renderer, src, interpolationPercentage, camera var startWidth = src._startWidth; var endWidth = src._endWidth; - pipeline.setTexture2D(); - pipeline.batchLine( src.geom.x1 - dx, src.geom.y1 - dy, @@ -160790,17 +169872,19 @@ var LineWebGLRenderer = function (renderer, src, interpolationPercentage, camera 1, 0, false, - shapeMatrix, - camMatrix + result.sprite, + result.camera ); } + + renderer.pipelines.postBatch(src); }; module.exports = LineWebGLRenderer; /***/ }), -/* 1040 */ +/* 1100 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160809,8 +169893,8 @@ module.exports = LineWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -160823,11 +169907,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Line} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var LineCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var LineCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -160844,7 +169927,7 @@ var LineCanvasRenderer = function (renderer, src, interpolationPercentage, camer ctx.moveTo(src.geom.x1 - dx, src.geom.y1 - dy); ctx.lineTo(src.geom.x2 - dx, src.geom.y2 - dy); - + ctx.stroke(); } @@ -160857,7 +169940,7 @@ module.exports = LineCanvasRenderer; /***/ }), -/* 1041 */ +/* 1101 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160871,12 +169954,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1042); + renderWebGL = __webpack_require__(1102); } if (true) { - renderCanvas = __webpack_require__(1043); + renderCanvas = __webpack_require__(1103); } module.exports = { @@ -160888,7 +169971,7 @@ module.exports = { /***/ }), -/* 1042 */ +/* 1102 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160897,8 +169980,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var FillPathWebGL = __webpack_require__(109); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -160911,44 +169995,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Polygon} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var PolygonWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var PolygonWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -160958,13 +170022,15 @@ var PolygonWebGLRenderer = function (renderer, src, interpolationPercentage, cam { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = PolygonWebGLRenderer; /***/ }), -/* 1043 */ +/* 1103 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -160973,9 +170039,9 @@ module.exports = PolygonWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -160988,11 +170054,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Polygon} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var PolygonCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var PolygonCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -161003,24 +170068,24 @@ var PolygonCanvasRenderer = function (renderer, src, interpolationPercentage, ca var path = src.pathData; var pathLength = path.length - 1; - + var px1 = path[0] - dx; var py1 = path[1] - dy; ctx.beginPath(); ctx.moveTo(px1, py1); - + if (!src.closePath) { pathLength -= 2; } - + for (var i = 2; i < pathLength; i += 2) { var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - + ctx.lineTo(px2, py2); } @@ -161049,7 +170114,7 @@ module.exports = PolygonCanvasRenderer; /***/ }), -/* 1044 */ +/* 1104 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161063,12 +170128,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1045); + renderWebGL = __webpack_require__(1105); } if (true) { - renderCanvas = __webpack_require__(1046); + renderCanvas = __webpack_require__(1106); } module.exports = { @@ -161080,7 +170145,7 @@ module.exports = { /***/ }), -/* 1045 */ +/* 1105 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161089,8 +170154,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var StrokePathWebGL = __webpack_require__(72); -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -161103,55 +170169,33 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Rectangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RectangleWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RectangleWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { var fillTint = pipeline.fillTint; - var fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha); + var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); fillTint.TL = fillTintColor; fillTint.TR = fillTintColor; fillTint.BL = fillTintColor; fillTint.BR = fillTintColor; - pipeline.setTexture2D(); - pipeline.batchFillRect( -dx, -dy, @@ -161164,13 +170208,15 @@ var RectangleWebGLRenderer = function (renderer, src, interpolationPercentage, c { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = RectangleWebGLRenderer; /***/ }), -/* 1046 */ +/* 1106 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161179,9 +170225,9 @@ module.exports = RectangleWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -161194,11 +170240,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Rectangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var RectangleCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -161210,7 +170255,7 @@ var RectangleCanvasRenderer = function (renderer, src, interpolationPercentage, if (src.isFilled) { FillStyleCanvas(ctx, src); - + ctx.fillRect( -dx, -dy, @@ -161244,7 +170289,7 @@ module.exports = RectangleCanvasRenderer; /***/ }), -/* 1047 */ +/* 1107 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161258,12 +170303,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1048); + renderWebGL = __webpack_require__(1108); } if (true) { - renderCanvas = __webpack_require__(1049); + renderCanvas = __webpack_require__(1109); } module.exports = { @@ -161275,7 +170320,7 @@ module.exports = { /***/ }), -/* 1048 */ +/* 1108 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161284,8 +170329,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(101); -var StrokePathWebGL = __webpack_require__(72); +var FillPathWebGL = __webpack_require__(109); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -161298,44 +170344,24 @@ var StrokePathWebGL = __webpack_require__(72); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Star} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var StarWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var StarWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); @@ -161345,13 +170371,15 @@ var StarWebGLRenderer = function (renderer, src, interpolationPercentage, camera { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = StarWebGLRenderer; /***/ }), -/* 1049 */ +/* 1109 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161360,9 +170388,9 @@ module.exports = StarWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -161375,11 +170403,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Star} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var StarCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var StarCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -161390,24 +170417,24 @@ var StarCanvasRenderer = function (renderer, src, interpolationPercentage, camer var path = src.pathData; var pathLength = path.length - 1; - + var px1 = path[0] - dx; var py1 = path[1] - dy; ctx.beginPath(); ctx.moveTo(px1, py1); - + if (!src.closePath) { pathLength -= 2; } - + for (var i = 2; i < pathLength; i += 2) { var px2 = path[i] - dx; var py2 = path[i + 1] - dy; - + ctx.lineTo(px2, py2); } @@ -161436,7 +170463,7 @@ module.exports = StarCanvasRenderer; /***/ }), -/* 1050 */ +/* 1110 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161450,12 +170477,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1051); + renderWebGL = __webpack_require__(1111); } if (true) { - renderCanvas = __webpack_require__(1052); + renderCanvas = __webpack_require__(1112); } module.exports = { @@ -161467,7 +170494,7 @@ module.exports = { /***/ }), -/* 1051 */ +/* 1111 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161476,8 +170503,9 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var StrokePathWebGL = __webpack_require__(72); -var Utils = __webpack_require__(10); +var GetCalcMatrix = __webpack_require__(21); +var StrokePathWebGL = __webpack_require__(79); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -161490,47 +170518,27 @@ var Utils = __webpack_require__(10); * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Triangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TriangleWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TriangleWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var pipeline = renderer.pipelines.set(this.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline); - var camMatrix = pipeline._tempMatrix1; - var shapeMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; + var result = GetCalcMatrix(src, camera, parentMatrix); - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + pipeline.calcMatrix.copyFrom(result.calc); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; + renderer.pipelines.preBatch(src); + if (src.isFilled) { var fillTint = pipeline.fillTint; - var fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha); + var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); fillTint.TL = fillTintColor; fillTint.TR = fillTintColor; @@ -161544,8 +170552,6 @@ var TriangleWebGLRenderer = function (renderer, src, interpolationPercentage, ca var x3 = src.geom.x3 - dx; var y3 = src.geom.y3 - dy; - pipeline.setTexture2D(); - pipeline.batchFillTriangle( x1, y1, @@ -161553,8 +170559,8 @@ var TriangleWebGLRenderer = function (renderer, src, interpolationPercentage, ca y2, x3, y3, - shapeMatrix, - camMatrix + result.sprite, + result.camera ); } @@ -161562,13 +170568,15 @@ var TriangleWebGLRenderer = function (renderer, src, interpolationPercentage, ca { StrokePathWebGL(pipeline, src, alpha, dx, dy); } + + renderer.pipelines.postBatch(src); }; module.exports = TriangleWebGLRenderer; /***/ }), -/* 1052 */ +/* 1112 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161577,9 +170585,9 @@ module.exports = TriangleWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(43); -var LineStyleCanvas = __webpack_require__(51); -var SetTransform = __webpack_require__(28); +var FillStyleCanvas = __webpack_require__(46); +var LineStyleCanvas = __webpack_require__(57); +var SetTransform = __webpack_require__(30); /** * Renders this Game Object with the Canvas Renderer to the given Camera. @@ -161592,11 +170600,10 @@ var SetTransform = __webpack_require__(28); * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Triangle} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var TriangleCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TriangleCanvasRenderer = function (renderer, src, camera, parentMatrix) { var ctx = renderer.currentContext; @@ -161643,7 +170650,7 @@ module.exports = TriangleCanvasRenderer; /***/ }), -/* 1053 */ +/* 1113 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161652,7 +170659,7 @@ module.exports = TriangleCanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Blitter = __webpack_require__(199); +var Blitter = __webpack_require__(204); var GameObjectFactory = __webpack_require__(5); /** @@ -161666,8 +170673,8 @@ var GameObjectFactory = __webpack_require__(5); * @param {number} x - The x position of the Game Object. * @param {number} y - The y position of the Game Object. * @param {string} key - The key of the Texture the Blitter object will use. - * @param {(string|integer)} [frame] - The default Frame children of the Blitter will use. - * + * @param {(string|number)} [frame] - The default Frame children of the Blitter will use. + * * @return {Phaser.GameObjects.Blitter} The Game Object that was created. */ GameObjectFactory.register('blitter', function (x, y, key, frame) @@ -161676,16 +170683,16 @@ GameObjectFactory.register('blitter', function (x, y, key, frame) }); // When registering a factory function 'this' refers to the GameObjectFactory context. -// +// // There are several properties available to use: -// +// // this.scene - a reference to the Scene that owns the GameObjectFactory // this.displayList - a reference to the Display List the Scene owns // this.updateList - a reference to the Update List the Scene owns /***/ }), -/* 1054 */ +/* 1114 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161695,7 +170702,7 @@ GameObjectFactory.register('blitter', function (x, y, key, frame) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Container = __webpack_require__(200); +var Container = __webpack_require__(205); var GameObjectFactory = __webpack_require__(5); /** @@ -161719,7 +170726,7 @@ GameObjectFactory.register('container', function (x, y, children) /***/ }), -/* 1055 */ +/* 1115 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161728,7 +170735,7 @@ GameObjectFactory.register('container', function (x, y, children) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DOMElement = __webpack_require__(409); +var DOMElement = __webpack_require__(419); var GameObjectFactory = __webpack_require__(5); /** @@ -161808,7 +170815,7 @@ GameObjectFactory.register('dom', function (x, y, element, style, innerText) /***/ }), -/* 1056 */ +/* 1116 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161817,7 +170824,7 @@ GameObjectFactory.register('dom', function (x, y, element, style, innerText) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DynamicBitmapText = __webpack_require__(201); +var DynamicBitmapText = __webpack_require__(206); var GameObjectFactory = __webpack_require__(5); /** @@ -161877,7 +170884,7 @@ GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size /***/ }), -/* 1057 */ +/* 1117 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161886,7 +170893,7 @@ GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extern = __webpack_require__(411); +var Extern = __webpack_require__(421); var GameObjectFactory = __webpack_require__(5); /** @@ -161918,7 +170925,7 @@ GameObjectFactory.register('extern', function () /***/ }), -/* 1058 */ +/* 1118 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161927,7 +170934,7 @@ GameObjectFactory.register('extern', function () * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Graphics = __webpack_require__(202); +var Graphics = __webpack_require__(207); var GameObjectFactory = __webpack_require__(5); /** @@ -161957,7 +170964,7 @@ GameObjectFactory.register('graphics', function (config) /***/ }), -/* 1059 */ +/* 1119 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161966,7 +170973,7 @@ GameObjectFactory.register('graphics', function (config) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Group = __webpack_require__(100); +var Group = __webpack_require__(108); var GameObjectFactory = __webpack_require__(5); /** @@ -161989,7 +170996,7 @@ GameObjectFactory.register('group', function (children, config) /***/ }), -/* 1060 */ +/* 1120 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -161998,7 +171005,7 @@ GameObjectFactory.register('group', function (children, config) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Image = __webpack_require__(114); +var Image = __webpack_require__(122); var GameObjectFactory = __webpack_require__(5); /** @@ -162012,7 +171019,7 @@ var GameObjectFactory = __webpack_require__(5); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.GameObjects.Image} The Game Object that was created. */ @@ -162031,7 +171038,38 @@ GameObjectFactory.register('image', function (x, y, key, frame) /***/ }), -/* 1061 */ +/* 1121 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Layer = __webpack_require__(210); +var GameObjectFactory = __webpack_require__(5); + +/** + * Creates a new Layer Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Layer Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#layer + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Layer. + * + * @return {Phaser.GameObjects.Layer} The Game Object that was created. + */ +GameObjectFactory.register('layer', function (children) +{ + return this.displayList.add(new Layer(this.scene, children)); +}); + + +/***/ }), +/* 1122 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162041,7 +171079,7 @@ GameObjectFactory.register('image', function (x, y, key, frame) */ var GameObjectFactory = __webpack_require__(5); -var ParticleEmitterManager = __webpack_require__(205); +var ParticleEmitterManager = __webpack_require__(211); /** * Creates a new Particle Emitter Manager Game Object and adds it to the Scene. @@ -162052,7 +171090,7 @@ var ParticleEmitterManager = __webpack_require__(205); * @since 3.0.0 * * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer|object)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number|object)} [frame] - An optional frame from the Texture this Game Object is rendering with. * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig|Phaser.Types.GameObjects.Particles.ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. * * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} The Game Object that was created. @@ -162062,17 +171100,9 @@ GameObjectFactory.register('particles', function (key, frame, emitters) return this.displayList.add(new ParticleEmitterManager(this.scene, key, frame, emitters)); }); -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns - /***/ }), -/* 1062 */ +/* 1123 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162082,7 +171112,7 @@ GameObjectFactory.register('particles', function (key, frame, emitters) */ var GameObjectFactory = __webpack_require__(5); -var PathFollower = __webpack_require__(424); +var PathFollower = __webpack_require__(434); /** * Creates a new PathFollower Game Object and adds it to the Scene. @@ -162096,7 +171126,7 @@ var PathFollower = __webpack_require__(424); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.GameObjects.PathFollower} The Game Object that was created. */ @@ -162120,7 +171150,7 @@ GameObjectFactory.register('follower', function (path, x, y, key, frame) /***/ }), -/* 1063 */ +/* 1124 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162130,7 +171160,7 @@ GameObjectFactory.register('follower', function (path, x, y, key, frame) */ var GameObjectFactory = __webpack_require__(5); -var RenderTexture = __webpack_require__(206); +var RenderTexture = __webpack_require__(212); /** * Creates a new Render Texture Game Object and adds it to the Scene. @@ -162146,8 +171176,8 @@ var RenderTexture = __webpack_require__(206); * * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. - * @param {integer} [width=32] - The width of the Render Texture. - * @param {integer} [height=32] - The height of the Render Texture. + * @param {number} [width=32] - The width of the Render Texture. + * @param {number} [height=32] - The height of the Render Texture. * @property {string} [key] - The texture key to make the RenderTexture from. * @property {string} [frame] - the frame to make the RenderTexture from. * @@ -162160,7 +171190,7 @@ GameObjectFactory.register('renderTexture', function (x, y, width, height, key, /***/ }), -/* 1064 */ +/* 1125 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162169,7 +171199,7 @@ GameObjectFactory.register('renderTexture', function (x, y, width, height, key, * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Rope = __webpack_require__(208); +var Rope = __webpack_require__(214); var GameObjectFactory = __webpack_require__(5); /** @@ -162184,7 +171214,7 @@ var GameObjectFactory = __webpack_require__(5); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * @param {Phaser.Types.Math.Vector2Like[]} [points] - An array containing the vertices data for this Rope. If none is provided a simple quad is created. See `setPoints` to set this post-creation. * @param {boolean} [horizontal=true] - Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? * @param {number[]} [colors] - An optional array containing the color data for this Rope. You should provide one color value per pair of vertices. @@ -162200,17 +171230,9 @@ if (true) }); } -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns - /***/ }), -/* 1065 */ +/* 1126 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162220,7 +171242,7 @@ if (true) */ var GameObjectFactory = __webpack_require__(5); -var Sprite = __webpack_require__(76); +var Sprite = __webpack_require__(70); /** * Creates a new Sprite Game Object and adds it to the Scene. @@ -162233,7 +171255,7 @@ var Sprite = __webpack_require__(76); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.GameObjects.Sprite} The Game Object that was created. */ @@ -162256,7 +171278,7 @@ GameObjectFactory.register('sprite', function (x, y, key, frame) /***/ }), -/* 1066 */ +/* 1127 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162265,7 +171287,7 @@ GameObjectFactory.register('sprite', function (x, y, key, frame) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(140); +var BitmapText = __webpack_require__(144); var GameObjectFactory = __webpack_require__(5); /** @@ -162301,7 +171323,7 @@ var GameObjectFactory = __webpack_require__(5); * @param {string} font - The key of the font to use from the BitmapFont cache. * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. * @param {number} [size] - The font size to set. - * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. * * @return {Phaser.GameObjects.BitmapText} The Game Object that was created. */ @@ -162320,7 +171342,7 @@ GameObjectFactory.register('bitmapText', function (x, y, font, text, size, align /***/ }), -/* 1067 */ +/* 1128 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162329,18 +171351,18 @@ GameObjectFactory.register('bitmapText', function (x, y, font, text, size, align * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Text = __webpack_require__(209); +var Text = __webpack_require__(215); var GameObjectFactory = __webpack_require__(5); /** * Creates a new Text Game Object and adds it to the Scene. - * + * * A Text Game Object. - * + * * Text objects work by creating their own internal hidden Canvas and then renders text to it using * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered * to your game during the render pass. - * + * * Because it uses the Canvas API you can take advantage of all the features this offers, such as * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts * loaded externally, such as Google or TypeKit Web fonts. @@ -162351,7 +171373,7 @@ var GameObjectFactory = __webpack_require__(5); * * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts * across mobile browsers. - * + * * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of @@ -162385,7 +171407,7 @@ GameObjectFactory.register('text', function (x, y, text, style) /***/ }), -/* 1068 */ +/* 1129 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162394,7 +171416,7 @@ GameObjectFactory.register('text', function (x, y, text, style) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileSprite = __webpack_require__(210); +var TileSprite = __webpack_require__(216); var GameObjectFactory = __webpack_require__(5); /** @@ -162407,10 +171429,10 @@ var GameObjectFactory = __webpack_require__(5); * * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. - * @param {integer} width - The width of the Game Object. If zero it will use the size of the texture frame. - * @param {integer} height - The height of the Game Object. If zero it will use the size of the texture frame. + * @param {number} width - The width of the Game Object. If zero it will use the size of the texture frame. + * @param {number} height - The height of the Game Object. If zero it will use the size of the texture frame. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * * @return {Phaser.GameObjects.TileSprite} The Game Object that was created. */ @@ -162429,7 +171451,7 @@ GameObjectFactory.register('tileSprite', function (x, y, width, height, key, fra /***/ }), -/* 1069 */ +/* 1130 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162438,7 +171460,7 @@ GameObjectFactory.register('tileSprite', function (x, y, width, height, key, fra * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Zone = __webpack_require__(117); +var Zone = __webpack_require__(125); var GameObjectFactory = __webpack_require__(5); /** @@ -162471,7 +171493,7 @@ GameObjectFactory.register('zone', function (x, y, width, height) /***/ }), -/* 1070 */ +/* 1131 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162480,7 +171502,7 @@ GameObjectFactory.register('zone', function (x, y, width, height) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Video = __webpack_require__(211); +var Video = __webpack_require__(217); var GameObjectFactory = __webpack_require__(5); /** @@ -162499,25 +171521,12 @@ var GameObjectFactory = __webpack_require__(5); */ GameObjectFactory.register('video', function (x, y, key) { - var video = new Video(this.scene, x, y, key); - - this.displayList.add(video); - this.updateList.add(video); - - return video; + return this.displayList.add(new Video(this.scene, x, y, key)); }); -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns - /***/ }), -/* 1071 */ +/* 1132 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162526,7 +171535,7 @@ GameObjectFactory.register('video', function (x, y, key) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Arc = __webpack_require__(428); +var Arc = __webpack_require__(438); var GameObjectFactory = __webpack_require__(5); /** @@ -162552,8 +171561,8 @@ var GameObjectFactory = __webpack_require__(5); * @param {number} [x=0] - The horizontal position of this Game Object in the world. * @param {number} [y=0] - The vertical position of this Game Object in the world. * @param {number} [radius=128] - The radius of the arc. - * @param {integer} [startAngle=0] - The start angle of the arc, in degrees. - * @param {integer} [endAngle=360] - The end angle of the arc, in degrees. + * @param {number} [startAngle=0] - The start angle of the arc, in degrees. + * @param {number} [endAngle=360] - The end angle of the arc, in degrees. * @param {boolean} [anticlockwise=false] - The winding order of the start and end angles. * @param {number} [fillColor] - The color the arc will be filled with, i.e. 0xff0000 for red. * @param {number} [fillAlpha] - The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. @@ -162590,7 +171599,7 @@ GameObjectFactory.register('circle', function (x, y, radius, fillColor, fillAlph /***/ }), -/* 1072 */ +/* 1133 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162600,7 +171609,7 @@ GameObjectFactory.register('circle', function (x, y, radius, fillColor, fillAlph */ var GameObjectFactory = __webpack_require__(5); -var Curve = __webpack_require__(429); +var Curve = __webpack_require__(439); /** * Creates a new Curve Shape Game Object and adds it to the Scene. @@ -162640,7 +171649,7 @@ GameObjectFactory.register('curve', function (x, y, curve, fillColor, fillAlpha) /***/ }), -/* 1073 */ +/* 1134 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162649,7 +171658,7 @@ GameObjectFactory.register('curve', function (x, y, curve, fillColor, fillAlpha) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Ellipse = __webpack_require__(430); +var Ellipse = __webpack_require__(440); var GameObjectFactory = __webpack_require__(5); /** @@ -162692,7 +171701,7 @@ GameObjectFactory.register('ellipse', function (x, y, width, height, fillColor, /***/ }), -/* 1074 */ +/* 1135 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162702,7 +171711,7 @@ GameObjectFactory.register('ellipse', function (x, y, width, height, fillColor, */ var GameObjectFactory = __webpack_require__(5); -var Grid = __webpack_require__(431); +var Grid = __webpack_require__(441); /** * Creates a new Grid Shape Game Object and adds it to the Scene. @@ -162747,7 +171756,7 @@ GameObjectFactory.register('grid', function (x, y, width, height, cellWidth, cel /***/ }), -/* 1075 */ +/* 1136 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162757,7 +171766,7 @@ GameObjectFactory.register('grid', function (x, y, width, height, cellWidth, cel */ var GameObjectFactory = __webpack_require__(5); -var IsoBox = __webpack_require__(432); +var IsoBox = __webpack_require__(442); /** * Creates a new IsoBox Shape Game Object and adds it to the Scene. @@ -162798,7 +171807,7 @@ GameObjectFactory.register('isobox', function (x, y, size, height, fillTop, fill /***/ }), -/* 1076 */ +/* 1137 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162808,7 +171817,7 @@ GameObjectFactory.register('isobox', function (x, y, size, height, fillTop, fill */ var GameObjectFactory = __webpack_require__(5); -var IsoTriangle = __webpack_require__(433); +var IsoTriangle = __webpack_require__(443); /** * Creates a new IsoTriangle Shape Game Object and adds it to the Scene. @@ -162851,7 +171860,7 @@ GameObjectFactory.register('isotriangle', function (x, y, size, height, reversed /***/ }), -/* 1077 */ +/* 1138 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162861,7 +171870,7 @@ GameObjectFactory.register('isotriangle', function (x, y, size, height, reversed */ var GameObjectFactory = __webpack_require__(5); -var Line = __webpack_require__(434); +var Line = __webpack_require__(444); /** * Creates a new Line Shape Game Object and adds it to the Scene. @@ -162902,7 +171911,7 @@ GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, /***/ }), -/* 1078 */ +/* 1139 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162912,7 +171921,7 @@ GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, */ var GameObjectFactory = __webpack_require__(5); -var Polygon = __webpack_require__(435); +var Polygon = __webpack_require__(445); /** * Creates a new Polygon Shape Game Object and adds it to the Scene. @@ -162955,7 +171964,7 @@ GameObjectFactory.register('polygon', function (x, y, points, fillColor, fillAlp /***/ }), -/* 1079 */ +/* 1140 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -162965,7 +171974,7 @@ GameObjectFactory.register('polygon', function (x, y, points, fillColor, fillAlp */ var GameObjectFactory = __webpack_require__(5); -var Rectangle = __webpack_require__(440); +var Rectangle = __webpack_require__(450); /** * Creates a new Rectangle Shape Game Object and adds it to the Scene. @@ -163000,7 +172009,7 @@ GameObjectFactory.register('rectangle', function (x, y, width, height, fillColor /***/ }), -/* 1080 */ +/* 1141 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163009,7 +172018,7 @@ GameObjectFactory.register('rectangle', function (x, y, width, height, fillColor * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Star = __webpack_require__(441); +var Star = __webpack_require__(451); var GameObjectFactory = __webpack_require__(5); /** @@ -163052,7 +172061,7 @@ GameObjectFactory.register('star', function (x, y, points, innerRadius, outerRad /***/ }), -/* 1081 */ +/* 1142 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163062,7 +172071,7 @@ GameObjectFactory.register('star', function (x, y, points, innerRadius, outerRad */ var GameObjectFactory = __webpack_require__(5); -var Triangle = __webpack_require__(442); +var Triangle = __webpack_require__(452); /** * Creates a new Triangle Shape Game Object and adds it to the Scene. @@ -163103,7 +172112,7 @@ GameObjectFactory.register('triangle', function (x, y, x1, y1, x2, y2, x3, y3, f /***/ }), -/* 1082 */ +/* 1143 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163112,9 +172121,9 @@ GameObjectFactory.register('triangle', function (x, y, x1, y1, x2, y2, x3, y3, f * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Blitter = __webpack_require__(199); -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var Blitter = __webpack_require__(204); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); /** @@ -163153,7 +172162,7 @@ GameObjectCreator.register('blitter', function (config, addToScene) /***/ }), -/* 1083 */ +/* 1144 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163163,9 +172172,9 @@ GameObjectCreator.register('blitter', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var Container = __webpack_require__(200); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var Container = __webpack_require__(205); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); /** @@ -163203,7 +172212,7 @@ GameObjectCreator.register('container', function (config, addToScene) /***/ }), -/* 1084 */ +/* 1145 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163212,9 +172221,9 @@ GameObjectCreator.register('container', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(201); -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BitmapText = __webpack_require__(206); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); /** @@ -163254,7 +172263,7 @@ GameObjectCreator.register('dynamicBitmapText', function (config, addToScene) /***/ }), -/* 1085 */ +/* 1146 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163263,8 +172272,8 @@ GameObjectCreator.register('dynamicBitmapText', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var Graphics = __webpack_require__(202); +var GameObjectCreator = __webpack_require__(17); +var Graphics = __webpack_require__(207); /** * Creates a new Graphics Game Object and returns it. @@ -163302,7 +172311,7 @@ GameObjectCreator.register('graphics', function (config, addToScene) /***/ }), -/* 1086 */ +/* 1147 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163311,8 +172320,8 @@ GameObjectCreator.register('graphics', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var Group = __webpack_require__(100); +var GameObjectCreator = __webpack_require__(17); +var Group = __webpack_require__(108); /** * Creates a new Group Game Object and returns it. @@ -163335,7 +172344,7 @@ GameObjectCreator.register('group', function (config) /***/ }), -/* 1087 */ +/* 1148 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163344,10 +172353,10 @@ GameObjectCreator.register('group', function (config) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Image = __webpack_require__(114); +var Image = __webpack_require__(122); /** * Creates a new Image Game Object and returns it. @@ -163385,7 +172394,55 @@ GameObjectCreator.register('image', function (config, addToScene) /***/ }), -/* 1088 */ +/* 1149 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BuildGameObject = __webpack_require__(28); +var Layer = __webpack_require__(210); +var GameObjectCreator = __webpack_require__(17); +var GetAdvancedValue = __webpack_require__(15); + +/** + * Creates a new Layer Game Object and returns it. + * + * Note: This method will only be available if the Layer Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#layer + * @since 3.50.0 + * + * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Layer} The Game Object that was created. + */ +GameObjectCreator.register('layer', function (config, addToScene) +{ + if (config === undefined) { config = {}; } + + var children = GetAdvancedValue(config, 'children', null); + + var layer = new Layer(this.scene, children); + + if (addToScene !== undefined) + { + config.add = addToScene; + } + + BuildGameObject(this.scene, layer, config); + + return layer; +}); + + +/***/ }), +/* 1150 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163394,10 +172451,10 @@ GameObjectCreator.register('image', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); var GetFastValue = __webpack_require__(2); -var ParticleEmitterManager = __webpack_require__(205); +var ParticleEmitterManager = __webpack_require__(211); /** * Creates a new Particle Emitter Manager Game Object and returns it. @@ -163434,13 +172491,17 @@ GameObjectCreator.register('particles', function (config, addToScene) { this.displayList.add(manager); } + else + { + this.updateList.add(manager); + } return manager; }); /***/ }), -/* 1089 */ +/* 1151 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163449,10 +172510,10 @@ GameObjectCreator.register('particles', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var RenderTexture = __webpack_require__(206); +var RenderTexture = __webpack_require__(212); /** * Creates a new Render Texture Game Object and returns it. @@ -163492,7 +172553,7 @@ GameObjectCreator.register('renderTexture', function (config, addToScene) /***/ }), -/* 1090 */ +/* 1152 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163501,11 +172562,11 @@ GameObjectCreator.register('renderTexture', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); var GetValue = __webpack_require__(6); -var Rope = __webpack_require__(208); +var Rope = __webpack_require__(214); /** * Creates a new Rope Game Object and returns it. @@ -163540,6 +172601,11 @@ GameObjectCreator.register('rope', function (config, addToScene) BuildGameObject(this.scene, rope, config); + if (!config.add) + { + this.updateList.add(rope); + } + return rope; }); @@ -163547,7 +172613,7 @@ GameObjectCreator.register('rope', function (config, addToScene) /***/ }), -/* 1091 */ +/* 1153 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163556,11 +172622,11 @@ GameObjectCreator.register('rope', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var BuildGameObjectAnimation = __webpack_require__(406); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var BuildGameObjectAnimation = __webpack_require__(416); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Sprite = __webpack_require__(76); +var Sprite = __webpack_require__(70); /** * Creates a new Sprite Game Object and returns it. @@ -163600,7 +172666,7 @@ GameObjectCreator.register('sprite', function (config, addToScene) /***/ }), -/* 1092 */ +/* 1154 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163609,9 +172675,9 @@ GameObjectCreator.register('sprite', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(140); -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BitmapText = __webpack_require__(144); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); var GetValue = __webpack_require__(6); @@ -163653,7 +172719,7 @@ GameObjectCreator.register('bitmapText', function (config, addToScene) /***/ }), -/* 1093 */ +/* 1155 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163662,10 +172728,10 @@ GameObjectCreator.register('bitmapText', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Text = __webpack_require__(209); +var Text = __webpack_require__(215); /** * Creates a new Text Game Object and returns it. @@ -163740,7 +172806,7 @@ GameObjectCreator.register('text', function (config, addToScene) /***/ }), -/* 1094 */ +/* 1156 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163749,10 +172815,10 @@ GameObjectCreator.register('text', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var TileSprite = __webpack_require__(210); +var TileSprite = __webpack_require__(216); /** * Creates a new TileSprite Game Object and returns it. @@ -163792,7 +172858,7 @@ GameObjectCreator.register('tileSprite', function (config, addToScene) /***/ }), -/* 1095 */ +/* 1157 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163801,9 +172867,9 @@ GameObjectCreator.register('tileSprite', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Zone = __webpack_require__(117); +var Zone = __webpack_require__(125); /** * Creates a new Zone Game Object and returns it. @@ -163831,7 +172897,7 @@ GameObjectCreator.register('zone', function (config) /***/ }), -/* 1096 */ +/* 1158 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163840,10 +172906,10 @@ GameObjectCreator.register('zone', function (config) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Video = __webpack_require__(211); +var Video = __webpack_require__(217); /** * Creates a new Video Game Object and returns it. @@ -163873,6 +172939,11 @@ GameObjectCreator.register('video', function (config, addToScene) BuildGameObject(this.scene, video, config); + if (!config.add) + { + this.updateList.add(video); + } + return video; }); @@ -163880,7 +172951,7 @@ GameObjectCreator.register('video', function (config, addToScene) /***/ }), -/* 1097 */ +/* 1159 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163894,12 +172965,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1098); + renderWebGL = __webpack_require__(1160); } if (true) { - renderCanvas = __webpack_require__(1099); + renderCanvas = __webpack_require__(1161); } module.exports = { @@ -163911,7 +172982,7 @@ module.exports = { /***/ }), -/* 1098 */ +/* 1160 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -163920,179 +172991,7 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); - -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Mesh#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) -{ - var pipeline = renderer.pipelines.set(this.pipeline, src); - - var camMatrix = pipeline._tempMatrix1; - var spriteMatrix = pipeline._tempMatrix2; - var calcMatrix = pipeline._tempMatrix3; - - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - } - - var vertices = src.vertices; - var uvs = src.uv; - var colors = src.colors; - var alphas = src.alphas; - - var meshVerticesLength = vertices.length; - var vertexCount = Math.floor(meshVerticesLength * 0.5); - - if (pipeline.vertexCount + vertexCount > pipeline.vertexCapacity) - { - pipeline.flush(); - } - - var textureUnit = pipeline.setGameObject(src); - - var vertexViewF32 = pipeline.vertexViewF32; - var vertexViewU32 = pipeline.vertexViewU32; - - var vertexOffset = (pipeline.vertexCount * pipeline.vertexComponentCount) - 1; - - var colorIndex = 0; - var tintEffect = src.tintFill; - - for (var i = 0; i < meshVerticesLength; i += 2) - { - var x = vertices[i + 0]; - var y = vertices[i + 1]; - - var tx = x * calcMatrix.a + y * calcMatrix.c + calcMatrix.e; - var ty = x * calcMatrix.b + y * calcMatrix.d + calcMatrix.f; - - if (camera.roundPixels) - { - tx = Math.round(tx); - ty = Math.round(ty); - } - - vertexViewF32[++vertexOffset] = tx; - vertexViewF32[++vertexOffset] = ty; - vertexViewF32[++vertexOffset] = uvs[i + 0]; - vertexViewF32[++vertexOffset] = uvs[i + 1]; - vertexViewF32[++vertexOffset] = textureUnit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = Utils.getTintAppendFloatAlpha(colors[colorIndex], camera.alpha * alphas[colorIndex]); - - colorIndex++; - } - - pipeline.vertexCount += vertexCount; -}; - -module.exports = MeshWebGLRenderer; - - -/***/ }), -/* 1099 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * This is a stub function for Mesh.Render. There is no Canvas renderer for Mesh objects. - * - * @method Phaser.GameObjects.Mesh#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var MeshCanvasRenderer = function () -{ -}; - -module.exports = MeshCanvasRenderer; - - -/***/ }), -/* 1100 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); - -if (true) -{ - renderWebGL = __webpack_require__(1101); -} - -if (true) -{ - renderCanvas = __webpack_require__(1102); -} - -module.exports = { - - renderWebGL: renderWebGL, - renderCanvas: renderCanvas - -}; - - -/***/ }), -/* 1101 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var GetCalcMatrix = __webpack_require__(21); /** * Renders this Game Object with the WebGL Renderer to the given Camera. @@ -164105,11 +173004,10 @@ module.exports = { * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. * @param {Phaser.GameObjects.Shader} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var ShaderWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var ShaderWebGLRenderer = function (renderer, src, camera, parentMatrix) { if (!src.shader) { @@ -164125,30 +173023,7 @@ var ShaderWebGLRenderer = function (renderer, src, interpolationPercentage, came } else { - var camMatrix = src._tempMatrix1; - var shapeMatrix = src._tempMatrix2; - var calcMatrix = src._tempMatrix3; - - shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - shapeMatrix.e = src.x; - shapeMatrix.f = src.y; - } - else - { - shapeMatrix.e -= camera.scrollX * src.scrollFactorX; - shapeMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - camMatrix.multiply(shapeMatrix, calcMatrix); + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; // Renderer size changed? if (renderer.width !== src._rendererWidth || renderer.height !== src._rendererHeight) @@ -164167,7 +173042,7 @@ module.exports = ShaderWebGLRenderer; /***/ }), -/* 1102 */ +/* 1161 */ /***/ (function(module, exports) { /** @@ -164185,7 +173060,6 @@ module.exports = ShaderWebGLRenderer; * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. * @param {Phaser.GameObjects.Shader} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ var ShaderCanvasRenderer = function () @@ -164196,7 +173070,7 @@ module.exports = ShaderCanvasRenderer; /***/ }), -/* 1103 */ +/* 1162 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164205,48 +173079,29 @@ module.exports = ShaderCanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Mesh = __webpack_require__(142); -var GameObjectFactory = __webpack_require__(5); +var renderWebGL = __webpack_require__(1); +var renderCanvas = __webpack_require__(1); -/** - * Creates a new Mesh Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#mesh - * @webglOnly - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number[]} vertices - An array containing the vertices data for this Mesh. - * @param {number[]} uv - An array containing the uv data for this Mesh. - * @param {number[]} colors - An array containing the color data for this Mesh. - * @param {number[]} alphas - An array containing the alpha data for this Mesh. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.GameObjects.Mesh} The Game Object that was created. - */ if (true) { - GameObjectFactory.register('mesh', function (x, y, vertices, uv, colors, alphas, texture, frame) - { - return this.displayList.add(new Mesh(this.scene, x, y, vertices, uv, colors, alphas, texture, frame)); - }); + renderWebGL = __webpack_require__(1163); } -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns +if (true) +{ + renderCanvas = __webpack_require__(1164); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; /***/ }), -/* 1104 */ +/* 1163 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164255,44 +173110,136 @@ if (true) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Quad = __webpack_require__(214); -var GameObjectFactory = __webpack_require__(5); +var GetCalcMatrix = __webpack_require__(21); /** - * Creates a new Quad Game Object and adds it to the Scene. + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * Note: This method will only be available if the Quad Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#quad - * @webglOnly + * @method Phaser.GameObjects.Mesh#renderWebGL * @since 3.0.0 + * @private * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.GameObjects.Quad} The Game Object that was created. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -if (true) +var MeshWebGLRenderer = function (renderer, src, camera, parentMatrix) { - GameObjectFactory.register('quad', function (x, y, key, frame) - { - return this.displayList.add(new Quad(this.scene, x, y, key, frame)); - }); -} + var faces = src.faces; + var totalFaces = faces.length; -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + if (totalFaces === 0) + { + return; + } + + var pipeline = renderer.pipelines.set(src.pipeline, src); + + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + var textureUnit = pipeline.setGameObject(src); + + var F32 = pipeline.vertexViewF32; + var U32 = pipeline.vertexViewU32; + + var vertexOffset = (pipeline.vertexCount * pipeline.currentShader.vertexComponentCount) - 1; + + var tintEffect = src.tintFill; + + var debugFaces = []; + var debugCallback = src.debugCallback; + + var a = calcMatrix.a; + var b = calcMatrix.b; + var c = calcMatrix.c; + var d = calcMatrix.d; + var e = calcMatrix.e; + var f = calcMatrix.f; + + var z = src.viewPosition.z; + + var hideCCW = src.hideCCW; + var roundPixels = camera.roundPixels; + var alpha = camera.alpha * src.alpha; + + var totalFacesRendered = 0; + + renderer.pipelines.preBatch(src); + + for (var i = 0; i < totalFaces; i++) + { + var face = faces[i]; + + // If face has alpha <= 0, or hideCCW + clockwise, or isn't in camera view, then don't draw it + if (!face.isInView(camera, hideCCW, z, alpha, a, b, c, d, e, f, roundPixels)) + { + continue; + } + + if (pipeline.shouldFlush(3)) + { + pipeline.flush(); + + vertexOffset = 0; + } + + vertexOffset = face.load(F32, U32, vertexOffset, textureUnit, tintEffect); + + totalFacesRendered++; + pipeline.vertexCount += 3; + + if (debugCallback) + { + debugFaces.push(face); + } + } + + src.totalFrame += totalFacesRendered; + + if (debugCallback) + { + debugCallback.call(src, src, debugFaces); + } + + renderer.pipelines.postBatch(src); +}; + +module.exports = MeshWebGLRenderer; /***/ }), -/* 1105 */ +/* 1164 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * This is a stub function for Mesh.Render. There is no Canvas renderer for Mesh objects. + * + * @method Phaser.GameObjects.Mesh#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var MeshCanvasRenderer = function () +{ +}; + +module.exports = MeshCanvasRenderer; + + +/***/ }), +/* 1165 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164301,7 +173248,7 @@ if (true) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Shader = __webpack_require__(215); +var Shader = __webpack_require__(220); var GameObjectFactory = __webpack_require__(5); /** @@ -164333,7 +173280,7 @@ if (true) /***/ }), -/* 1106 */ +/* 1166 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164342,53 +173289,43 @@ if (true) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(15); -var GetValue = __webpack_require__(6); -var Mesh = __webpack_require__(142); +var Mesh = __webpack_require__(221); +var GameObjectFactory = __webpack_require__(5); /** - * Creates a new Mesh Game Object and returns it. + * Creates a new Mesh Game Object and adds it to the Scene. * * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. * - * @method Phaser.GameObjects.GameObjectCreator#mesh + * @method Phaser.GameObjects.GameObjectFactory#mesh + * @webglOnly * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * @param {number} [x] - The horizontal position of this Game Object in the world. + * @param {number} [y] - The vertical position of this Game Object in the world. + * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number[]} [vertices] - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} [uvs] - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. * * @return {Phaser.GameObjects.Mesh} The Game Object that was created. */ -GameObjectCreator.register('mesh', function (config, addToScene) +if (true) { - if (config === undefined) { config = {}; } - - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - var vertices = GetValue(config, 'vertices', []); - var colors = GetValue(config, 'colors', []); - var alphas = GetValue(config, 'alphas', []); - var uv = GetValue(config, 'uv', []); - - var mesh = new Mesh(this.scene, 0, 0, vertices, uv, colors, alphas, key, frame); - - if (addToScene !== undefined) + GameObjectFactory.register('mesh', function (x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) { - config.add = addToScene; - } - - BuildGameObject(this.scene, mesh, config); - - return mesh; -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. + return this.displayList.add(new Mesh(this.scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas)); + }); +} /***/ }), -/* 1107 */ +/* 1167 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164397,60 +173334,10 @@ GameObjectCreator.register('mesh', function (config, addToScene) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); var GetAdvancedValue = __webpack_require__(15); -var Quad = __webpack_require__(214); - -/** - * Creates a new Quad Game Object and returns it. - * - * Note: This method will only be available if the Quad Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#quad - * @since 3.0.0 - * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. - * - * @return {Phaser.GameObjects.Quad} The Game Object that was created. - */ -GameObjectCreator.register('quad', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var x = GetAdvancedValue(config, 'x', 0); - var y = GetAdvancedValue(config, 'y', 0); - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - - var quad = new Quad(this.scene, x, y, key, frame); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, quad, config); - - return quad; -}); - - -/***/ }), -/* 1108 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var BuildGameObject = __webpack_require__(27); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(15); -var Shader = __webpack_require__(215); +var Shader = __webpack_require__(220); /** * Creates a new Shader Game Object and returns it. @@ -164491,7 +173378,63 @@ GameObjectCreator.register('shader', function (config, addToScene) /***/ }), -/* 1109 */ +/* 1168 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BuildGameObject = __webpack_require__(28); +var GameObjectCreator = __webpack_require__(17); +var GetAdvancedValue = __webpack_require__(15); +var GetValue = __webpack_require__(6); +var Mesh = __webpack_require__(221); + +/** + * Creates a new Mesh Game Object and returns it. + * + * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#mesh + * @since 3.0.0 + * + * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Mesh} The Game Object that was created. + */ +GameObjectCreator.register('mesh', function (config, addToScene) +{ + if (config === undefined) { config = {}; } + + var key = GetAdvancedValue(config, 'key', null); + var frame = GetAdvancedValue(config, 'frame', null); + var vertices = GetValue(config, 'vertices', []); + var uvs = GetValue(config, 'uvs', []); + var indicies = GetValue(config, 'indicies', []); + var containsZ = GetValue(config, 'containsZ', false); + var normals = GetValue(config, 'normals', []); + var colors = GetValue(config, 'colors', 0xffffff); + var alphas = GetValue(config, 'alphas', 1); + + var mesh = new Mesh(this.scene, 0, 0, key, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas); + + if (addToScene !== undefined) + { + config.add = addToScene; + } + + BuildGameObject(this.scene, mesh, config); + + return mesh; +}); + + +/***/ }), +/* 1169 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164501,8 +173444,251 @@ GameObjectCreator.register('shader', function (config, addToScene) */ var Class = __webpack_require__(0); -var LightsManager = __webpack_require__(447); -var PluginCache = __webpack_require__(23); +var Components = __webpack_require__(11); +var GameObject = __webpack_require__(14); +var IntegerToRGB = __webpack_require__(181); +var RGB = __webpack_require__(376); + +/** + * @classdesc + * An Image Game Object. + * + * An Image is a light-weight Game Object useful for the display of static images in your game, + * such as logos, backgrounds, scenery or other non-animated elements. Images can have input + * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an + * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. + * + * @class PointLight + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.50.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + */ +var PointLight = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.GetBounds, + Components.Mask, + Components.Pipeline, + Components.ScrollFactor, + Components.Transform, + Components.Visible + ], + + initialize: + + function PointLight (scene, x, y, color, radius, intensity) + { + if (color === undefined) { color = 0xffffff; } + if (radius === undefined) { radius = 128; } + if (intensity === undefined) { intensity = 10; } + + GameObject.call(this, scene, 'PointLight'); + + this.initPipeline('Light2D'); + + this.setPosition(x, y); + + var rgb = IntegerToRGB(color); + + this.color = new RGB( + rgb.r / 255, + rgb.g / 255, + rgb.b / 255 + ); + + this.intensity = intensity; + + // read only: + this.width = radius * 2; + this.height = radius * 2; + + // private + this._radius = radius; + }, + + radius: { + + get: function () + { + return this._radius; + }, + + set: function (value) + { + this._radius = value; + this.width = value * 2; + this.height = value * 2; + } + + }, + + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#originX + * @type {number} + * @readonly + * @since 3.4.0 + */ + originX: { + + get: function () + { + return 0.5; + } + + }, + + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#originY + * @type {number} + * @readonly + * @since 3.4.0 + */ + originY: { + + get: function () + { + return 0.5; + } + + }, + + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#displayOriginX + * @type {number} + * @readonly + * @since 3.4.0 + */ + displayOriginX: { + + get: function () + { + return this._radius; + } + + }, + + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#displayOriginY + * @type {number} + * @readonly + * @since 3.4.0 + */ + displayOriginY: { + + get: function () + { + return this._radius; + } + + }, + + renderWebGL: function (renderer, src, camera, parentTransformMatrix) + { + var pipeline = renderer.pipelines.set(src.pipeline); + + var camMatrix = pipeline.tempMatrix1; + var lightMatrix = pipeline.tempMatrix2; + var calcMatrix = pipeline.tempMatrix3; + + var width = src.width; + var height = src.height; + + var x = -src.radius; + var y = -src.radius; + + var xw = x + width; + var yh = y + height; + + lightMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + + // Undo the camera scroll + lightMatrix.e = src.x; + lightMatrix.f = src.y; + } + else + { + lightMatrix.e -= camera.scrollX * src.scrollFactorX; + lightMatrix.f -= camera.scrollY * src.scrollFactorY; + } + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(lightMatrix, calcMatrix); + + var lightX = calcMatrix.getX(0, 0); + var lightY = calcMatrix.getY(0, 0); + + var tx0 = calcMatrix.getX(x, y); + var ty0 = calcMatrix.getY(x, y); + + var tx1 = calcMatrix.getX(x, yh); + var ty1 = calcMatrix.getY(x, yh); + + var tx2 = calcMatrix.getX(xw, yh); + var ty2 = calcMatrix.getY(xw, yh); + + var tx3 = calcMatrix.getX(xw, y); + var ty3 = calcMatrix.getY(xw, y); + + pipeline.batchLight(src, camera, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, lightX, lightY); + } + +}); + +module.exports = PointLight; + + +/***/ }), +/* 1170 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var LightsManager = __webpack_require__(459); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); /** @@ -164607,7 +173793,7 @@ module.exports = LightsPlugin; /***/ }), -/* 1110 */ +/* 1171 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164616,29 +173802,29 @@ module.exports = LightsPlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(68); +var Circle = __webpack_require__(71); -Circle.Area = __webpack_require__(1111); -Circle.Circumference = __webpack_require__(279); -Circle.CircumferencePoint = __webpack_require__(159); -Circle.Clone = __webpack_require__(1112); -Circle.Contains = __webpack_require__(57); -Circle.ContainsPoint = __webpack_require__(1113); -Circle.ContainsRect = __webpack_require__(1114); -Circle.CopyFrom = __webpack_require__(1115); -Circle.Equals = __webpack_require__(1116); -Circle.GetBounds = __webpack_require__(1117); -Circle.GetPoint = __webpack_require__(277); -Circle.GetPoints = __webpack_require__(278); -Circle.Offset = __webpack_require__(1118); -Circle.OffsetPoint = __webpack_require__(1119); -Circle.Random = __webpack_require__(160); +Circle.Area = __webpack_require__(1172); +Circle.Circumference = __webpack_require__(294); +Circle.CircumferencePoint = __webpack_require__(160); +Circle.Clone = __webpack_require__(1173); +Circle.Contains = __webpack_require__(62); +Circle.ContainsPoint = __webpack_require__(1174); +Circle.ContainsRect = __webpack_require__(1175); +Circle.CopyFrom = __webpack_require__(1176); +Circle.Equals = __webpack_require__(1177); +Circle.GetBounds = __webpack_require__(1178); +Circle.GetPoint = __webpack_require__(292); +Circle.GetPoints = __webpack_require__(293); +Circle.Offset = __webpack_require__(1179); +Circle.OffsetPoint = __webpack_require__(1180); +Circle.Random = __webpack_require__(161); module.exports = Circle; /***/ }), -/* 1111 */ +/* 1172 */ /***/ (function(module, exports) { /** @@ -164666,7 +173852,7 @@ module.exports = Area; /***/ }), -/* 1112 */ +/* 1173 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164675,7 +173861,7 @@ module.exports = Area; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(68); +var Circle = __webpack_require__(71); /** * Creates a new Circle instance based on the values contained in the given source. @@ -164696,7 +173882,7 @@ module.exports = Clone; /***/ }), -/* 1113 */ +/* 1174 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164705,7 +173891,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(57); +var Contains = __webpack_require__(62); /** * Check to see if the Circle contains the given Point object. @@ -164727,7 +173913,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1114 */ +/* 1175 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164736,7 +173922,7 @@ module.exports = ContainsPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(57); +var Contains = __webpack_require__(62); /** * Check to see if the Circle contains all four points of the given Rectangle object. @@ -164763,7 +173949,7 @@ module.exports = ContainsRect; /***/ }), -/* 1115 */ +/* 1176 */ /***/ (function(module, exports) { /** @@ -164795,7 +173981,7 @@ module.exports = CopyFrom; /***/ }), -/* 1116 */ +/* 1177 */ /***/ (function(module, exports) { /** @@ -164829,7 +174015,7 @@ module.exports = Equals; /***/ }), -/* 1117 */ +/* 1178 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164869,7 +174055,7 @@ module.exports = GetBounds; /***/ }), -/* 1118 */ +/* 1179 */ /***/ (function(module, exports) { /** @@ -164904,7 +174090,7 @@ module.exports = Offset; /***/ }), -/* 1119 */ +/* 1180 */ /***/ (function(module, exports) { /** @@ -164938,7 +174124,7 @@ module.exports = OffsetPoint; /***/ }), -/* 1120 */ +/* 1181 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -164947,29 +174133,29 @@ module.exports = OffsetPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Ellipse = __webpack_require__(98); +var Ellipse = __webpack_require__(106); -Ellipse.Area = __webpack_require__(1121); -Ellipse.Circumference = __webpack_require__(414); -Ellipse.CircumferencePoint = __webpack_require__(204); -Ellipse.Clone = __webpack_require__(1122); -Ellipse.Contains = __webpack_require__(99); -Ellipse.ContainsPoint = __webpack_require__(1123); -Ellipse.ContainsRect = __webpack_require__(1124); -Ellipse.CopyFrom = __webpack_require__(1125); -Ellipse.Equals = __webpack_require__(1126); -Ellipse.GetBounds = __webpack_require__(1127); -Ellipse.GetPoint = __webpack_require__(412); -Ellipse.GetPoints = __webpack_require__(413); -Ellipse.Offset = __webpack_require__(1128); -Ellipse.OffsetPoint = __webpack_require__(1129); -Ellipse.Random = __webpack_require__(167); +Ellipse.Area = __webpack_require__(1182); +Ellipse.Circumference = __webpack_require__(424); +Ellipse.CircumferencePoint = __webpack_require__(209); +Ellipse.Clone = __webpack_require__(1183); +Ellipse.Contains = __webpack_require__(107); +Ellipse.ContainsPoint = __webpack_require__(1184); +Ellipse.ContainsRect = __webpack_require__(1185); +Ellipse.CopyFrom = __webpack_require__(1186); +Ellipse.Equals = __webpack_require__(1187); +Ellipse.GetBounds = __webpack_require__(1188); +Ellipse.GetPoint = __webpack_require__(422); +Ellipse.GetPoints = __webpack_require__(423); +Ellipse.Offset = __webpack_require__(1189); +Ellipse.OffsetPoint = __webpack_require__(1190); +Ellipse.Random = __webpack_require__(172); module.exports = Ellipse; /***/ }), -/* 1121 */ +/* 1182 */ /***/ (function(module, exports) { /** @@ -165003,7 +174189,7 @@ module.exports = Area; /***/ }), -/* 1122 */ +/* 1183 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165012,7 +174198,7 @@ module.exports = Area; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Ellipse = __webpack_require__(98); +var Ellipse = __webpack_require__(106); /** * Creates a new Ellipse instance based on the values contained in the given source. @@ -165033,7 +174219,7 @@ module.exports = Clone; /***/ }), -/* 1123 */ +/* 1184 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165042,7 +174228,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(99); +var Contains = __webpack_require__(107); /** * Check to see if the Ellipse contains the given Point object. @@ -165064,7 +174250,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1124 */ +/* 1185 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165073,7 +174259,7 @@ module.exports = ContainsPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(99); +var Contains = __webpack_require__(107); /** * Check to see if the Ellipse contains all four points of the given Rectangle object. @@ -165100,7 +174286,7 @@ module.exports = ContainsRect; /***/ }), -/* 1125 */ +/* 1186 */ /***/ (function(module, exports) { /** @@ -165132,7 +174318,7 @@ module.exports = CopyFrom; /***/ }), -/* 1126 */ +/* 1187 */ /***/ (function(module, exports) { /** @@ -165167,7 +174353,7 @@ module.exports = Equals; /***/ }), -/* 1127 */ +/* 1188 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165207,7 +174393,7 @@ module.exports = GetBounds; /***/ }), -/* 1128 */ +/* 1189 */ /***/ (function(module, exports) { /** @@ -165242,7 +174428,7 @@ module.exports = Offset; /***/ }), -/* 1129 */ +/* 1190 */ /***/ (function(module, exports) { /** @@ -165276,7 +174462,7 @@ module.exports = OffsetPoint; /***/ }), -/* 1130 */ +/* 1191 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165287,7 +174473,7 @@ module.exports = OffsetPoint; */ var Point = __webpack_require__(4); -var CircleToCircle = __webpack_require__(216); +var CircleToCircle = __webpack_require__(222); /** * Checks if two Circles intersect and returns the intersection points as a Point object array. @@ -165370,7 +174556,7 @@ module.exports = GetCircleToCircle; /***/ }), -/* 1131 */ +/* 1192 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165380,8 +174566,8 @@ module.exports = GetCircleToCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLineToCircle = __webpack_require__(218); -var CircleToRectangle = __webpack_require__(217); +var GetLineToCircle = __webpack_require__(224); +var CircleToRectangle = __webpack_require__(223); /** * Checks for intersection between a circle and a rectangle, @@ -165420,7 +174606,7 @@ module.exports = GetCircleToRectangle; /***/ }), -/* 1132 */ +/* 1193 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165429,9 +174615,9 @@ module.exports = GetCircleToRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector4 = __webpack_require__(129); -var GetLineToPolygon = __webpack_require__(452); -var Line = __webpack_require__(40); +var Vector4 = __webpack_require__(135); +var GetLineToPolygon = __webpack_require__(464); +var Line = __webpack_require__(45); // Temp calculation segment var segment = new Line(); @@ -165522,7 +174708,7 @@ module.exports = GetRaysFromPointToPolygon; /***/ }), -/* 1133 */ +/* 1194 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165532,7 +174718,7 @@ module.exports = GetRaysFromPointToPolygon; */ var Rectangle = __webpack_require__(9); -var RectangleToRectangle = __webpack_require__(143); +var RectangleToRectangle = __webpack_require__(112); /** * Checks if two Rectangle shapes intersect and returns the area of this intersection as Rectangle object. @@ -165571,7 +174757,7 @@ module.exports = GetRectangleIntersection; /***/ }), -/* 1134 */ +/* 1195 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165581,8 +174767,8 @@ module.exports = GetRectangleIntersection; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLineToRectangle = __webpack_require__(220); -var RectangleToRectangle = __webpack_require__(143); +var GetLineToRectangle = __webpack_require__(226); +var RectangleToRectangle = __webpack_require__(112); /** * Checks if two Rectangles intersect and returns the intersection points as a Point object array. @@ -165622,7 +174808,7 @@ module.exports = GetRectangleToRectangle; /***/ }), -/* 1135 */ +/* 1196 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165632,8 +174818,8 @@ module.exports = GetRectangleToRectangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RectangleToTriangle = __webpack_require__(454); -var GetLineToRectangle = __webpack_require__(220); +var RectangleToTriangle = __webpack_require__(466); +var GetLineToRectangle = __webpack_require__(226); /** * Checks for intersection between Rectangle shape and Triangle shape, @@ -165670,7 +174856,7 @@ module.exports = GetRectangleToTriangle; /***/ }), -/* 1136 */ +/* 1197 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165680,8 +174866,8 @@ module.exports = GetRectangleToTriangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLineToCircle = __webpack_require__(218); -var TriangleToCircle = __webpack_require__(456); +var GetLineToCircle = __webpack_require__(224); +var TriangleToCircle = __webpack_require__(468); /** * Checks if a Triangle and a Circle intersect, and returns the intersection points as a Point object array. @@ -165719,7 +174905,7 @@ module.exports = GetTriangleToCircle; /***/ }), -/* 1137 */ +/* 1198 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165729,8 +174915,8 @@ module.exports = GetTriangleToCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TriangleToTriangle = __webpack_require__(459); -var GetTriangleToLine = __webpack_require__(457); +var TriangleToTriangle = __webpack_require__(471); +var GetTriangleToLine = __webpack_require__(469); /** * Checks if two Triangles intersect, and returns the intersection points as a Point object array. @@ -165768,7 +174954,7 @@ module.exports = GetTriangleToTriangle; /***/ }), -/* 1138 */ +/* 1199 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165777,7 +174963,7 @@ module.exports = GetTriangleToTriangle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PointToLine = __webpack_require__(461); +var PointToLine = __webpack_require__(473); /** * Checks if a Point is located on the given line segment. @@ -165809,7 +174995,7 @@ module.exports = PointToLineSegment; /***/ }), -/* 1139 */ +/* 1200 */ /***/ (function(module, exports) { /** @@ -165849,7 +175035,7 @@ module.exports = RectangleToValues; /***/ }), -/* 1140 */ +/* 1201 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165858,43 +175044,43 @@ module.exports = RectangleToValues; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Line = __webpack_require__(40); +var Line = __webpack_require__(45); -Line.Angle = __webpack_require__(87); -Line.BresenhamPoints = __webpack_require__(297); -Line.CenterOn = __webpack_require__(1141); -Line.Clone = __webpack_require__(1142); -Line.CopyFrom = __webpack_require__(1143); -Line.Equals = __webpack_require__(1144); -Line.Extend = __webpack_require__(1145); -Line.GetEasedPoints = __webpack_require__(1146); -Line.GetMidPoint = __webpack_require__(1147); -Line.GetNearestPoint = __webpack_require__(1148); -Line.GetNormal = __webpack_require__(1149); -Line.GetPoint = __webpack_require__(284); -Line.GetPoints = __webpack_require__(162); -Line.GetShortestDistance = __webpack_require__(1150); -Line.Height = __webpack_require__(1151); -Line.Length = __webpack_require__(58); -Line.NormalAngle = __webpack_require__(462); -Line.NormalX = __webpack_require__(1152); -Line.NormalY = __webpack_require__(1153); -Line.Offset = __webpack_require__(1154); -Line.PerpSlope = __webpack_require__(1155); -Line.Random = __webpack_require__(163); -Line.ReflectAngle = __webpack_require__(1156); -Line.Rotate = __webpack_require__(1157); -Line.RotateAroundPoint = __webpack_require__(1158); -Line.RotateAroundXY = __webpack_require__(222); -Line.SetToAngle = __webpack_require__(1159); -Line.Slope = __webpack_require__(1160); -Line.Width = __webpack_require__(1161); +Line.Angle = __webpack_require__(92); +Line.BresenhamPoints = __webpack_require__(309); +Line.CenterOn = __webpack_require__(1202); +Line.Clone = __webpack_require__(1203); +Line.CopyFrom = __webpack_require__(1204); +Line.Equals = __webpack_require__(1205); +Line.Extend = __webpack_require__(1206); +Line.GetEasedPoints = __webpack_require__(1207); +Line.GetMidPoint = __webpack_require__(1208); +Line.GetNearestPoint = __webpack_require__(1209); +Line.GetNormal = __webpack_require__(1210); +Line.GetPoint = __webpack_require__(299); +Line.GetPoints = __webpack_require__(163); +Line.GetShortestDistance = __webpack_require__(1211); +Line.Height = __webpack_require__(1212); +Line.Length = __webpack_require__(63); +Line.NormalAngle = __webpack_require__(474); +Line.NormalX = __webpack_require__(1213); +Line.NormalY = __webpack_require__(1214); +Line.Offset = __webpack_require__(1215); +Line.PerpSlope = __webpack_require__(1216); +Line.Random = __webpack_require__(164); +Line.ReflectAngle = __webpack_require__(1217); +Line.Rotate = __webpack_require__(1218); +Line.RotateAroundPoint = __webpack_require__(1219); +Line.RotateAroundXY = __webpack_require__(228); +Line.SetToAngle = __webpack_require__(1220); +Line.Slope = __webpack_require__(1221); +Line.Width = __webpack_require__(1222); module.exports = Line; /***/ }), -/* 1141 */ +/* 1202 */ /***/ (function(module, exports) { /** @@ -165934,7 +175120,7 @@ module.exports = CenterOn; /***/ }), -/* 1142 */ +/* 1203 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -165943,7 +175129,7 @@ module.exports = CenterOn; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Line = __webpack_require__(40); +var Line = __webpack_require__(45); /** * Clone the given line. @@ -165964,7 +175150,7 @@ module.exports = Clone; /***/ }), -/* 1143 */ +/* 1204 */ /***/ (function(module, exports) { /** @@ -165995,7 +175181,7 @@ module.exports = CopyFrom; /***/ }), -/* 1144 */ +/* 1205 */ /***/ (function(module, exports) { /** @@ -166029,7 +175215,7 @@ module.exports = Equals; /***/ }), -/* 1145 */ +/* 1206 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166038,7 +175224,7 @@ module.exports = Equals; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); /** * Extends the start and end points of a Line by the given amounts. @@ -166087,7 +175273,7 @@ module.exports = Extend; /***/ }), -/* 1146 */ +/* 1207 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166096,8 +175282,8 @@ module.exports = Extend; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DistanceBetweenPoints = __webpack_require__(333); -var GetEaseFunction = __webpack_require__(71); +var DistanceBetweenPoints = __webpack_require__(344); +var GetEaseFunction = __webpack_require__(78); var Point = __webpack_require__(4); /** @@ -166129,7 +175315,7 @@ var Point = __webpack_require__(4); * * @param {Phaser.Geom.Line} line - The Line object. * @param {(string|function)} ease - The ease to use. This can be either a string from the EaseMap, or a custom function. - * @param {integer} quantity - The number of points to return. Note that if you provide a `collinearThreshold`, the resulting array may not always contain this number of points. + * @param {number} quantity - The number of points to return. Note that if you provide a `collinearThreshold`, the resulting array may not always contain this number of points. * @param {number} [collinearThreshold=0] - An optional threshold. The final array is reduced so that each point is spaced out at least this distance apart. This helps reduce clustering in noisey eases. * @param {number[]} [easeParams] - An optional array of ease parameters to go with the ease. * @@ -166207,7 +175393,7 @@ module.exports = GetEasedPoints; /***/ }), -/* 1147 */ +/* 1208 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166245,7 +175431,7 @@ module.exports = GetMidPoint; /***/ }), -/* 1148 */ +/* 1209 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166300,7 +175486,7 @@ module.exports = GetNearestPoint; /***/ }), -/* 1149 */ +/* 1210 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166310,7 +175496,7 @@ module.exports = GetNearestPoint; */ var MATH_CONST = __webpack_require__(13); -var Angle = __webpack_require__(87); +var Angle = __webpack_require__(92); var Point = __webpack_require__(4); /** @@ -166344,7 +175530,7 @@ module.exports = GetNormal; /***/ }), -/* 1150 */ +/* 1211 */ /***/ (function(module, exports) { /** @@ -166391,7 +175577,7 @@ module.exports = GetShortestDistance; /***/ }), -/* 1151 */ +/* 1212 */ /***/ (function(module, exports) { /** @@ -166419,7 +175605,7 @@ module.exports = Height; /***/ }), -/* 1152 */ +/* 1213 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166429,7 +175615,7 @@ module.exports = Height; */ var MATH_CONST = __webpack_require__(13); -var Angle = __webpack_require__(87); +var Angle = __webpack_require__(92); /** * Returns the x component of the normal vector of the given line. @@ -166450,7 +175636,7 @@ module.exports = NormalX; /***/ }), -/* 1153 */ +/* 1214 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166460,7 +175646,7 @@ module.exports = NormalX; */ var MATH_CONST = __webpack_require__(13); -var Angle = __webpack_require__(87); +var Angle = __webpack_require__(92); /** * The Y value of the normal of the given line. @@ -166482,7 +175668,7 @@ module.exports = NormalY; /***/ }), -/* 1154 */ +/* 1215 */ /***/ (function(module, exports) { /** @@ -166520,7 +175706,7 @@ module.exports = Offset; /***/ }), -/* 1155 */ +/* 1216 */ /***/ (function(module, exports) { /** @@ -166548,7 +175734,7 @@ module.exports = PerpSlope; /***/ }), -/* 1156 */ +/* 1217 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166557,8 +175743,8 @@ module.exports = PerpSlope; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Angle = __webpack_require__(87); -var NormalAngle = __webpack_require__(462); +var Angle = __webpack_require__(92); +var NormalAngle = __webpack_require__(474); /** * Calculate the reflected angle between two lines. @@ -166582,7 +175768,7 @@ module.exports = ReflectAngle; /***/ }), -/* 1157 */ +/* 1218 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166591,7 +175777,7 @@ module.exports = ReflectAngle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundXY = __webpack_require__(222); +var RotateAroundXY = __webpack_require__(228); /** * Rotate a line around its midpoint by the given angle in radians. @@ -166618,7 +175804,7 @@ module.exports = Rotate; /***/ }), -/* 1158 */ +/* 1219 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166627,7 +175813,7 @@ module.exports = Rotate; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundXY = __webpack_require__(222); +var RotateAroundXY = __webpack_require__(228); /** * Rotate a line around a point by the given angle in radians. @@ -166652,7 +175838,7 @@ module.exports = RotateAroundPoint; /***/ }), -/* 1159 */ +/* 1220 */ /***/ (function(module, exports) { /** @@ -166692,7 +175878,7 @@ module.exports = SetToAngle; /***/ }), -/* 1160 */ +/* 1221 */ /***/ (function(module, exports) { /** @@ -166720,7 +175906,7 @@ module.exports = Slope; /***/ }), -/* 1161 */ +/* 1222 */ /***/ (function(module, exports) { /** @@ -166748,7 +175934,334 @@ module.exports = Width; /***/ }), -/* 1162 */ +/* 1223 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Geom.Mesh + */ + +var Mesh = { + + Face: __webpack_require__(111), + GenerateGridVerts: __webpack_require__(1224), + GenerateObjVerts: __webpack_require__(457), + GenerateVerts: __webpack_require__(456), + ParseObj: __webpack_require__(475), + ParseObjMaterial: __webpack_require__(476), + RotateFace: __webpack_require__(1225), + Vertex: __webpack_require__(113) + +}; + +module.exports = Mesh; + + +/***/ }), +/* 1224 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Face = __webpack_require__(111); +var GetFastValue = __webpack_require__(2); +var Matrix4 = __webpack_require__(73); +var Vector3 = __webpack_require__(37); +var Vertex = __webpack_require__(113); + +var tempPosition = new Vector3(); +var tempRotation = new Vector3(); +var tempMatrix = new Matrix4(); + +/** + * Creates a grid of vertices based on the given configuration object and optionally adds it to a Mesh. + * + * The size of the grid is given in pixels. An example configuration may be: + * + * `{ width: 256, height: 256, widthSegments: 2, heightSegments: 2, tile: true }` + * + * This will create a grid 256 x 256 pixels in size, split into 2 x 2 segments, with + * the texture tiling across the cells. + * + * You can split the grid into segments both vertically and horizontally. This will + * generate two faces per grid segment as a result. + * + * The `tile` parameter allows you to control if the tile will repeat across the grid + * segments, or be displayed in full. + * + * If adding this grid to a Mesh you can offset the grid via the `x` and `y` properties. + * + * UV coordinates are generated based on the given texture and frame in the config. For + * example, no frame is given, the UVs will be in the range 0 to 1. If a frame is given, + * such as from a texture atlas, the UVs will be generated within the range of that frame. + * + * @function Phaser.Geom.Mesh.GeneraterGridVerts + * @since 3.50.0 + * + * @param {Phaser.Types.Geom.Mesh.GenerateGridConfig} config - A Grid configuration object. + * + * @return {Phaser.Types.Geom.Mesh.GenerateGridVertsResult} A Grid Result object, containing the generated vertices and indicies. + */ +var GenerateGridVerts = function (config) +{ + var mesh = GetFastValue(config, 'mesh'); + var texture = GetFastValue(config, 'texture', null); + var frame = GetFastValue(config, 'frame'); + var width = GetFastValue(config, 'width', 1); + var height = GetFastValue(config, 'height', width); + var widthSegments = GetFastValue(config, 'widthSegments', 1); + var heightSegments = GetFastValue(config, 'heightSegments', widthSegments); + var posX = GetFastValue(config, 'x', 0); + var posY = GetFastValue(config, 'y', 0); + var posZ = GetFastValue(config, 'z', 0); + var rotateX = GetFastValue(config, 'rotateX', 0); + var rotateY = GetFastValue(config, 'rotateY', 0); + var rotateZ = GetFastValue(config, 'rotateZ', 0); + var zIsUp = GetFastValue(config, 'zIsUp', true); + var isOrtho = GetFastValue(config, 'isOrtho', (mesh) ? mesh.dirtyCache[11] : false); + var colors = GetFastValue(config, 'colors', [ 0xffffff ]); + var alphas = GetFastValue(config, 'alphas', [ 1 ]); + var tile = GetFastValue(config, 'tile', false); + + var widthSet = GetFastValue(config, 'width', null); + + var result = { + faces: [], + verts: [] + }; + + tempPosition.set(posX, posY, posZ); + tempRotation.set(rotateX, rotateY, rotateZ); + tempMatrix.fromRotationXYTranslation(tempRotation, tempPosition, zIsUp); + + if (!texture && mesh) + { + texture = mesh.texture; + } + else if (mesh && typeof(texture) === 'string') + { + texture = mesh.scene.sys.textures.get(texture); + } + else + { + // There's nothing more we can do without a texture + return result; + } + + var textureFrame = texture.get(frame); + + // If the Mesh is ortho and no width / height is given, we'll default to texture sizes (if set!) + if (!widthSet && isOrtho && texture && mesh) + { + width = textureFrame.width / mesh.height; + height = textureFrame.height / mesh.height; + } + + var halfWidth = width / 2; + var halfHeight = height / 2; + + var gridX = Math.floor(widthSegments); + var gridY = Math.floor(heightSegments); + + var gridX1 = gridX + 1; + var gridY1 = gridY + 1; + + var segmentWidth = width / gridX; + var segmentHeight = height / gridY; + + var uvs = []; + var vertices = []; + + var ix; + var iy; + + var frameU0 = 0; + var frameU1 = 1; + var frameV0 = 0; + var frameV1 = 1; + + if (textureFrame) + { + frameU0 = textureFrame.u0; + frameU1 = textureFrame.u1; + frameV0 = textureFrame.v0; + frameV1 = textureFrame.v1; + } + + var frameU = frameU1 - frameU0; + var frameV = frameV1 - frameV0; + + for (iy = 0; iy < gridY1; iy++) + { + var y = iy * segmentHeight - halfHeight; + + for (ix = 0; ix < gridX1; ix++) + { + var x = ix * segmentWidth - halfWidth; + + vertices.push(x, -y); + + var tu = frameU0 + frameU * (ix / gridX); + var tv = frameV0 + frameV * (iy / gridY); + + uvs.push(tu, tv); + } + } + + if (!Array.isArray(colors)) + { + colors = [ colors ]; + } + + if (!Array.isArray(alphas)) + { + alphas = [ alphas ]; + } + + var alphaIndex = 0; + var colorIndex = 0; + + for (iy = 0; iy < gridY; iy++) + { + for (ix = 0; ix < gridX; ix++) + { + var a = (ix + gridX1 * iy) * 2; + var b = (ix + gridX1 * (iy + 1)) * 2; + var c = ((ix + 1) + gridX1 * (iy + 1)) * 2; + var d = ((ix + 1) + gridX1 * iy) * 2; + + var color = colors[colorIndex]; + var alpha = alphas[alphaIndex]; + + var vert1 = new Vertex(vertices[a], vertices[a + 1], 0, uvs[a], uvs[a + 1], color, alpha).transformMat4(tempMatrix); + var vert2 = new Vertex(vertices[b], vertices[b + 1], 0, uvs[b], uvs[b + 1], color, alpha).transformMat4(tempMatrix); + var vert3 = new Vertex(vertices[d], vertices[d + 1], 0, uvs[d], uvs[d + 1], color, alpha).transformMat4(tempMatrix); + var vert4 = new Vertex(vertices[b], vertices[b + 1], 0, uvs[b], uvs[b + 1], color, alpha).transformMat4(tempMatrix); + var vert5 = new Vertex(vertices[c], vertices[c + 1], 0, uvs[c], uvs[c + 1], color, alpha).transformMat4(tempMatrix); + var vert6 = new Vertex(vertices[d], vertices[d + 1], 0, uvs[d], uvs[d + 1], color, alpha).transformMat4(tempMatrix); + + if (tile) + { + vert1.setUVs(frameU0, frameV1); + vert2.setUVs(frameU0, frameV0); + vert3.setUVs(frameU1, frameV1); + vert4.setUVs(frameU0, frameV0); + vert5.setUVs(frameU1, frameV0); + vert6.setUVs(frameU1, frameV1); + } + + colorIndex++; + + if (colorIndex === colors.length) + { + colorIndex = 0; + } + + alphaIndex++; + + if (alphaIndex === alphas.length) + { + alphaIndex = 0; + } + + result.verts.push(vert1, vert2, vert3, vert4, vert5, vert6); + + result.faces.push( + new Face(vert1, vert2, vert3), + new Face(vert4, vert5, vert6) + ); + } + } + + if (mesh) + { + mesh.faces = mesh.faces.concat(result.faces); + mesh.vertices = mesh.vertices.concat(result.verts); + } + + return result; +}; + +module.exports = GenerateGridVerts; + + +/***/ }), +/* 1225 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Rotates the vertices of a Face to the given angle. + * + * The actual vertex positions are adjusted, not their transformed positions. + * + * Therefore, this updates the vertex data directly. + * + * @function Phaser.Geom.Mesh.RotateFace + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Face} face - The Face to rotate. + * @param {number} angle - The angle to rotate to, in radians. + * @param {number} [cx] - An optional center of rotation. If not given, the Face in-center is used. + * @param {number} [cy] - An optional center of rotation. If not given, the Face in-center is used. + */ +var RotateFace = function (face, angle, cx, cy) +{ + var x; + var y; + + // No point of rotation? Use the inCenter instead, then. + if (cx === undefined && cy === undefined) + { + var inCenter = face.getInCenter(); + + x = inCenter.x; + y = inCenter.y; + } + + var c = Math.cos(angle); + var s = Math.sin(angle); + + var v1 = face.vertex1; + var v2 = face.vertex2; + var v3 = face.vertex3; + + var tx = v1.x - x; + var ty = v1.y - y; + + v1.set(tx * c - ty * s + x, tx * s + ty * c + y); + + tx = v2.x - x; + ty = v2.y - y; + + v2.set(tx * c - ty * s + x, tx * s + ty * c + y); + + tx = v3.x - x; + ty = v3.y - y; + + v3.set(tx * c - ty * s + x, tx * s + ty * c + y); +}; + +module.exports = RotateFace; + + +/***/ }), +/* 1226 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166759,27 +176272,27 @@ module.exports = Width; var Point = __webpack_require__(4); -Point.Ceil = __webpack_require__(1163); -Point.Clone = __webpack_require__(1164); -Point.CopyFrom = __webpack_require__(1165); -Point.Equals = __webpack_require__(1166); -Point.Floor = __webpack_require__(1167); -Point.GetCentroid = __webpack_require__(1168); -Point.GetMagnitude = __webpack_require__(463); -Point.GetMagnitudeSq = __webpack_require__(464); -Point.GetRectangleFromPoints = __webpack_require__(1169); -Point.Interpolate = __webpack_require__(1170); -Point.Invert = __webpack_require__(1171); -Point.Negative = __webpack_require__(1172); -Point.Project = __webpack_require__(1173); -Point.ProjectUnit = __webpack_require__(1174); -Point.SetMagnitude = __webpack_require__(1175); +Point.Ceil = __webpack_require__(1227); +Point.Clone = __webpack_require__(1228); +Point.CopyFrom = __webpack_require__(1229); +Point.Equals = __webpack_require__(1230); +Point.Floor = __webpack_require__(1231); +Point.GetCentroid = __webpack_require__(1232); +Point.GetMagnitude = __webpack_require__(477); +Point.GetMagnitudeSq = __webpack_require__(478); +Point.GetRectangleFromPoints = __webpack_require__(1233); +Point.Interpolate = __webpack_require__(1234); +Point.Invert = __webpack_require__(1235); +Point.Negative = __webpack_require__(1236); +Point.Project = __webpack_require__(1237); +Point.ProjectUnit = __webpack_require__(1238); +Point.SetMagnitude = __webpack_require__(1239); module.exports = Point; /***/ }), -/* 1163 */ +/* 1227 */ /***/ (function(module, exports) { /** @@ -166809,7 +176322,7 @@ module.exports = Ceil; /***/ }), -/* 1164 */ +/* 1228 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166839,7 +176352,7 @@ module.exports = Clone; /***/ }), -/* 1165 */ +/* 1229 */ /***/ (function(module, exports) { /** @@ -166870,7 +176383,7 @@ module.exports = CopyFrom; /***/ }), -/* 1166 */ +/* 1230 */ /***/ (function(module, exports) { /** @@ -166899,7 +176412,7 @@ module.exports = Equals; /***/ }), -/* 1167 */ +/* 1231 */ /***/ (function(module, exports) { /** @@ -166929,7 +176442,7 @@ module.exports = Floor; /***/ }), -/* 1168 */ +/* 1232 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -166993,7 +176506,7 @@ module.exports = GetCentroid; /***/ }), -/* 1169 */ +/* 1233 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167063,7 +176576,7 @@ module.exports = GetRectangleFromPoints; /***/ }), -/* 1170 */ +/* 1234 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167104,7 +176617,7 @@ module.exports = Interpolate; /***/ }), -/* 1171 */ +/* 1235 */ /***/ (function(module, exports) { /** @@ -167134,7 +176647,7 @@ module.exports = Invert; /***/ }), -/* 1172 */ +/* 1236 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167169,7 +176682,7 @@ module.exports = Negative; /***/ }), -/* 1173 */ +/* 1237 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167179,7 +176692,7 @@ module.exports = Negative; */ var Point = __webpack_require__(4); -var GetMagnitudeSq = __webpack_require__(464); +var GetMagnitudeSq = __webpack_require__(478); /** * Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the @@ -167216,7 +176729,7 @@ module.exports = Project; /***/ }), -/* 1174 */ +/* 1238 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167261,7 +176774,7 @@ module.exports = ProjectUnit; /***/ }), -/* 1175 */ +/* 1239 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167270,7 +176783,7 @@ module.exports = ProjectUnit; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetMagnitude = __webpack_require__(463); +var GetMagnitude = __webpack_require__(477); /** * Changes the magnitude (length) of a two-dimensional vector without changing its direction. @@ -167305,7 +176818,7 @@ module.exports = SetMagnitude; /***/ }), -/* 1176 */ +/* 1240 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167314,26 +176827,26 @@ module.exports = SetMagnitude; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Polygon = __webpack_require__(212); +var Polygon = __webpack_require__(218); -Polygon.Clone = __webpack_require__(1177); -Polygon.Contains = __webpack_require__(213); -Polygon.ContainsPoint = __webpack_require__(1178); -Polygon.Earcut = __webpack_require__(60); -Polygon.GetAABB = __webpack_require__(436); -Polygon.GetNumberArray = __webpack_require__(1179); -Polygon.GetPoints = __webpack_require__(437); -Polygon.Perimeter = __webpack_require__(438); -Polygon.Reverse = __webpack_require__(1180); -Polygon.Simplify = __webpack_require__(1181); -Polygon.Smooth = __webpack_require__(439); -Polygon.Translate = __webpack_require__(1182); +Polygon.Clone = __webpack_require__(1241); +Polygon.Contains = __webpack_require__(219); +Polygon.ContainsPoint = __webpack_require__(1242); +Polygon.Earcut = __webpack_require__(65); +Polygon.GetAABB = __webpack_require__(446); +Polygon.GetNumberArray = __webpack_require__(1243); +Polygon.GetPoints = __webpack_require__(447); +Polygon.Perimeter = __webpack_require__(448); +Polygon.Reverse = __webpack_require__(1244); +Polygon.Simplify = __webpack_require__(1245); +Polygon.Smooth = __webpack_require__(449); +Polygon.Translate = __webpack_require__(1246); module.exports = Polygon; /***/ }), -/* 1177 */ +/* 1241 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167342,7 +176855,7 @@ module.exports = Polygon; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Polygon = __webpack_require__(212); +var Polygon = __webpack_require__(218); /** * Create a new polygon which is a copy of the specified polygon @@ -167363,7 +176876,7 @@ module.exports = Clone; /***/ }), -/* 1178 */ +/* 1242 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167372,7 +176885,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(213); +var Contains = __webpack_require__(219); /** * Checks the given Point again the Polygon to see if the Point lays within its vertices. @@ -167394,7 +176907,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1179 */ +/* 1243 */ /***/ (function(module, exports) { /** @@ -167437,7 +176950,7 @@ module.exports = GetNumberArray; /***/ }), -/* 1180 */ +/* 1244 */ /***/ (function(module, exports) { /** @@ -167469,10 +176982,9 @@ module.exports = Reverse; /***/ }), -/* 1181 */ -/***/ (function(module, exports, __webpack_require__) { +/* 1245 */ +/***/ (function(module, exports) { -"use strict"; /** * @author Richard Davey * @author Vladimir Agafonkin @@ -167504,8 +177016,6 @@ module.exports = Reverse; * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - /** * @ignore */ @@ -167679,7 +177189,7 @@ module.exports = Simplify; /***/ }), -/* 1182 */ +/* 1246 */ /***/ (function(module, exports) { /** @@ -167719,7 +177229,7 @@ module.exports = Translate; /***/ }), -/* 1183 */ +/* 1247 */ /***/ (function(module, exports) { /** @@ -167747,7 +177257,7 @@ module.exports = Area; /***/ }), -/* 1184 */ +/* 1248 */ /***/ (function(module, exports) { /** @@ -167780,7 +177290,7 @@ module.exports = Ceil; /***/ }), -/* 1185 */ +/* 1249 */ /***/ (function(module, exports) { /** @@ -167815,7 +177325,7 @@ module.exports = CeilAll; /***/ }), -/* 1186 */ +/* 1250 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167845,7 +177355,7 @@ module.exports = Clone; /***/ }), -/* 1187 */ +/* 1251 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167854,7 +177364,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(50); +var Contains = __webpack_require__(56); /** * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. @@ -167876,7 +177386,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1188 */ +/* 1252 */ /***/ (function(module, exports) { /** @@ -167907,7 +177417,7 @@ module.exports = CopyFrom; /***/ }), -/* 1189 */ +/* 1253 */ /***/ (function(module, exports) { /** @@ -167941,7 +177451,7 @@ module.exports = Equals; /***/ }), -/* 1190 */ +/* 1254 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -167950,7 +177460,7 @@ module.exports = Equals; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetAspectRatio = __webpack_require__(223); +var GetAspectRatio = __webpack_require__(229); /** * Adjusts the target rectangle, changing its width, height and position, @@ -167994,7 +177504,7 @@ module.exports = FitInside; /***/ }), -/* 1191 */ +/* 1255 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168003,7 +177513,7 @@ module.exports = FitInside; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetAspectRatio = __webpack_require__(223); +var GetAspectRatio = __webpack_require__(229); /** * Adjusts the target rectangle, changing its width, height and position, @@ -168047,7 +177557,7 @@ module.exports = FitOutside; /***/ }), -/* 1192 */ +/* 1256 */ /***/ (function(module, exports) { /** @@ -168080,7 +177590,7 @@ module.exports = Floor; /***/ }), -/* 1193 */ +/* 1257 */ /***/ (function(module, exports) { /** @@ -168115,7 +177625,7 @@ module.exports = FloorAll; /***/ }), -/* 1194 */ +/* 1258 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168158,7 +177668,7 @@ module.exports = FromXY; /***/ }), -/* 1195 */ +/* 1259 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168196,7 +177706,7 @@ module.exports = GetCenter; /***/ }), -/* 1196 */ +/* 1260 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168236,7 +177746,7 @@ module.exports = GetSize; /***/ }), -/* 1197 */ +/* 1261 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168245,7 +177755,7 @@ module.exports = GetSize; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CenterOn = __webpack_require__(178); +var CenterOn = __webpack_require__(182); /** @@ -168278,7 +177788,7 @@ module.exports = Inflate; /***/ }), -/* 1198 */ +/* 1262 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168288,7 +177798,7 @@ module.exports = Inflate; */ var Rectangle = __webpack_require__(9); -var Intersects = __webpack_require__(143); +var Intersects = __webpack_require__(112); /** * Takes two Rectangles and first checks to see if they intersect. @@ -168329,7 +177839,7 @@ module.exports = Intersection; /***/ }), -/* 1199 */ +/* 1263 */ /***/ (function(module, exports) { /** @@ -168378,7 +177888,7 @@ module.exports = MergePoints; /***/ }), -/* 1200 */ +/* 1264 */ /***/ (function(module, exports) { /** @@ -168425,7 +177935,7 @@ module.exports = MergeRect; /***/ }), -/* 1201 */ +/* 1265 */ /***/ (function(module, exports) { /** @@ -168469,7 +177979,7 @@ module.exports = MergeXY; /***/ }), -/* 1202 */ +/* 1266 */ /***/ (function(module, exports) { /** @@ -168504,7 +178014,7 @@ module.exports = Offset; /***/ }), -/* 1203 */ +/* 1267 */ /***/ (function(module, exports) { /** @@ -168538,7 +178048,7 @@ module.exports = OffsetPoint; /***/ }), -/* 1204 */ +/* 1268 */ /***/ (function(module, exports) { /** @@ -168572,7 +178082,7 @@ module.exports = Overlaps; /***/ }), -/* 1205 */ +/* 1269 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168582,7 +178092,7 @@ module.exports = Overlaps; */ var Point = __webpack_require__(4); -var DegToRad = __webpack_require__(41); +var DegToRad = __webpack_require__(34); /** * Returns a Point from the perimeter of a Rectangle based on the given angle. @@ -168593,7 +178103,7 @@ var DegToRad = __webpack_require__(41); * @generic {Phaser.Geom.Point} O - [out,$return] * * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle to get the perimeter point from. - * @param {integer} angle - The angle of the point, in degrees. + * @param {number} angle - The angle of the point, in degrees. * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. * * @return {Phaser.Geom.Point} A Point object holding the coordinates of the Rectangle perimeter. @@ -168629,7 +178139,7 @@ module.exports = PerimeterPoint; /***/ }), -/* 1206 */ +/* 1270 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168638,8 +178148,8 @@ module.exports = PerimeterPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Between = __webpack_require__(182); -var ContainsRect = __webpack_require__(466); +var Between = __webpack_require__(187); +var ContainsRect = __webpack_require__(480); var Point = __webpack_require__(4); /** @@ -168700,7 +178210,7 @@ module.exports = RandomOutside; /***/ }), -/* 1207 */ +/* 1271 */ /***/ (function(module, exports) { /** @@ -168729,7 +178239,7 @@ module.exports = SameDimensions; /***/ }), -/* 1208 */ +/* 1272 */ /***/ (function(module, exports) { /** @@ -168768,7 +178278,7 @@ module.exports = Scale; /***/ }), -/* 1209 */ +/* 1273 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168777,38 +178287,38 @@ module.exports = Scale; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Triangle = __webpack_require__(73); +var Triangle = __webpack_require__(80); -Triangle.Area = __webpack_require__(1210); -Triangle.BuildEquilateral = __webpack_require__(1211); -Triangle.BuildFromPolygon = __webpack_require__(1212); -Triangle.BuildRight = __webpack_require__(1213); -Triangle.CenterOn = __webpack_require__(1214); -Triangle.Centroid = __webpack_require__(467); -Triangle.CircumCenter = __webpack_require__(1215); -Triangle.CircumCircle = __webpack_require__(1216); -Triangle.Clone = __webpack_require__(1217); -Triangle.Contains = __webpack_require__(85); -Triangle.ContainsArray = __webpack_require__(221); -Triangle.ContainsPoint = __webpack_require__(1218); -Triangle.CopyFrom = __webpack_require__(1219); -Triangle.Decompose = __webpack_require__(460); -Triangle.Equals = __webpack_require__(1220); -Triangle.GetPoint = __webpack_require__(443); -Triangle.GetPoints = __webpack_require__(444); -Triangle.InCenter = __webpack_require__(469); -Triangle.Perimeter = __webpack_require__(1221); -Triangle.Offset = __webpack_require__(468); -Triangle.Random = __webpack_require__(168); -Triangle.Rotate = __webpack_require__(1222); -Triangle.RotateAroundPoint = __webpack_require__(1223); -Triangle.RotateAroundXY = __webpack_require__(224); +Triangle.Area = __webpack_require__(1274); +Triangle.BuildEquilateral = __webpack_require__(1275); +Triangle.BuildFromPolygon = __webpack_require__(1276); +Triangle.BuildRight = __webpack_require__(1277); +Triangle.CenterOn = __webpack_require__(1278); +Triangle.Centroid = __webpack_require__(481); +Triangle.CircumCenter = __webpack_require__(1279); +Triangle.CircumCircle = __webpack_require__(1280); +Triangle.Clone = __webpack_require__(1281); +Triangle.Contains = __webpack_require__(110); +Triangle.ContainsArray = __webpack_require__(227); +Triangle.ContainsPoint = __webpack_require__(1282); +Triangle.CopyFrom = __webpack_require__(1283); +Triangle.Decompose = __webpack_require__(472); +Triangle.Equals = __webpack_require__(1284); +Triangle.GetPoint = __webpack_require__(453); +Triangle.GetPoints = __webpack_require__(454); +Triangle.InCenter = __webpack_require__(483); +Triangle.Perimeter = __webpack_require__(1285); +Triangle.Offset = __webpack_require__(482); +Triangle.Random = __webpack_require__(173); +Triangle.Rotate = __webpack_require__(1286); +Triangle.RotateAroundPoint = __webpack_require__(1287); +Triangle.RotateAroundXY = __webpack_require__(230); module.exports = Triangle; /***/ }), -/* 1210 */ +/* 1274 */ /***/ (function(module, exports) { /** @@ -168847,7 +178357,7 @@ module.exports = Area; /***/ }), -/* 1211 */ +/* 1275 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168856,7 +178366,7 @@ module.exports = Area; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Triangle = __webpack_require__(73); +var Triangle = __webpack_require__(80); /** * Builds an equilateral triangle. In the equilateral triangle, all the sides are the same length (congruent) and all the angles are the same size (congruent). @@ -168891,7 +178401,7 @@ module.exports = BuildEquilateral; /***/ }), -/* 1212 */ +/* 1276 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168900,8 +178410,8 @@ module.exports = BuildEquilateral; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var EarCut = __webpack_require__(60); -var Triangle = __webpack_require__(73); +var EarCut = __webpack_require__(65); +var Triangle = __webpack_require__(80); /** * Takes an array of vertex coordinates, and optionally an array of hole indices, then returns an array @@ -168967,7 +178477,7 @@ module.exports = BuildFromPolygon; /***/ }), -/* 1213 */ +/* 1277 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -168976,7 +178486,7 @@ module.exports = BuildFromPolygon; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Triangle = __webpack_require__(73); +var Triangle = __webpack_require__(80); // Builds a right triangle, with one 90 degree angle and two acute angles // The x/y is the coordinate of the 90 degree angle (and will map to x1/y1 in the resulting Triangle) @@ -169016,7 +178526,7 @@ module.exports = BuildRight; /***/ }), -/* 1214 */ +/* 1278 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169025,8 +178535,8 @@ module.exports = BuildRight; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Centroid = __webpack_require__(467); -var Offset = __webpack_require__(468); +var Centroid = __webpack_require__(481); +var Offset = __webpack_require__(482); /** * @callback CenterFunction @@ -169069,7 +178579,7 @@ module.exports = CenterOn; /***/ }), -/* 1215 */ +/* 1279 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169145,7 +178655,7 @@ module.exports = CircumCenter; /***/ }), -/* 1216 */ +/* 1280 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169154,7 +178664,7 @@ module.exports = CircumCenter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(68); +var Circle = __webpack_require__(71); // Adapted from https://gist.github.com/mutoo/5617691 @@ -169228,7 +178738,7 @@ module.exports = CircumCircle; /***/ }), -/* 1217 */ +/* 1281 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169237,7 +178747,7 @@ module.exports = CircumCircle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Triangle = __webpack_require__(73); +var Triangle = __webpack_require__(80); /** * Clones a Triangle object. @@ -169258,7 +178768,7 @@ module.exports = Clone; /***/ }), -/* 1218 */ +/* 1282 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169267,7 +178777,7 @@ module.exports = Clone; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(85); +var Contains = __webpack_require__(110); /** * Tests if a triangle contains a point. @@ -169289,7 +178799,7 @@ module.exports = ContainsPoint; /***/ }), -/* 1219 */ +/* 1283 */ /***/ (function(module, exports) { /** @@ -169320,7 +178830,7 @@ module.exports = CopyFrom; /***/ }), -/* 1220 */ +/* 1284 */ /***/ (function(module, exports) { /** @@ -169356,7 +178866,7 @@ module.exports = Equals; /***/ }), -/* 1221 */ +/* 1285 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169365,7 +178875,7 @@ module.exports = Equals; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(58); +var Length = __webpack_require__(63); /** * Gets the length of the perimeter of the given triangle. @@ -169391,7 +178901,7 @@ module.exports = Perimeter; /***/ }), -/* 1222 */ +/* 1286 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169400,8 +178910,8 @@ module.exports = Perimeter; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundXY = __webpack_require__(224); -var InCenter = __webpack_require__(469); +var RotateAroundXY = __webpack_require__(230); +var InCenter = __webpack_require__(483); /** * Rotates a Triangle about its incenter, which is the point at which its three angle bisectors meet. @@ -169427,7 +178937,7 @@ module.exports = Rotate; /***/ }), -/* 1223 */ +/* 1287 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169436,7 +178946,7 @@ module.exports = Rotate; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundXY = __webpack_require__(224); +var RotateAroundXY = __webpack_require__(230); /** * Rotates a Triangle at a certain angle about a given Point or object with public `x` and `y` properties. @@ -169461,7 +178971,7 @@ module.exports = RotateAroundPoint; /***/ }), -/* 1224 */ +/* 1288 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169470,8 +178980,8 @@ module.exports = RotateAroundPoint; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(189); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(194); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Input @@ -169479,17 +178989,17 @@ var Extend = __webpack_require__(19); var Input = { - CreatePixelPerfectHandler: __webpack_require__(470), - CreateInteractiveObject: __webpack_require__(471), - Events: __webpack_require__(56), - Gamepad: __webpack_require__(1225), - InputManager: __webpack_require__(376), - InputPlugin: __webpack_require__(1237), - InputPluginCache: __webpack_require__(144), - Keyboard: __webpack_require__(1238), - Mouse: __webpack_require__(1255), - Pointer: __webpack_require__(379), - Touch: __webpack_require__(1256) + CreatePixelPerfectHandler: __webpack_require__(484), + CreateInteractiveObject: __webpack_require__(485), + Events: __webpack_require__(49), + Gamepad: __webpack_require__(1289), + InputManager: __webpack_require__(386), + InputPlugin: __webpack_require__(1301), + InputPluginCache: __webpack_require__(146), + Keyboard: __webpack_require__(1302), + Mouse: __webpack_require__(1316), + Pointer: __webpack_require__(389), + Touch: __webpack_require__(1317) }; @@ -169500,7 +179010,7 @@ module.exports = Input; /***/ }), -/* 1225 */ +/* 1289 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169515,18 +179025,18 @@ module.exports = Input; module.exports = { - Axis: __webpack_require__(472), - Button: __webpack_require__(473), - Events: __webpack_require__(225), - Gamepad: __webpack_require__(474), - GamepadPlugin: __webpack_require__(1232), + Axis: __webpack_require__(486), + Button: __webpack_require__(487), + Events: __webpack_require__(231), + Gamepad: __webpack_require__(488), + GamepadPlugin: __webpack_require__(1296), - Configs: __webpack_require__(1233) + Configs: __webpack_require__(1297) }; /***/ }), -/* 1226 */ +/* 1290 */ /***/ (function(module, exports) { /** @@ -169555,7 +179065,7 @@ module.exports = 'down'; /***/ }), -/* 1227 */ +/* 1291 */ /***/ (function(module, exports) { /** @@ -169584,7 +179094,7 @@ module.exports = 'up'; /***/ }), -/* 1228 */ +/* 1292 */ /***/ (function(module, exports) { /** @@ -169615,7 +179125,7 @@ module.exports = 'connected'; /***/ }), -/* 1229 */ +/* 1293 */ /***/ (function(module, exports) { /** @@ -169641,7 +179151,7 @@ module.exports = 'disconnected'; /***/ }), -/* 1230 */ +/* 1294 */ /***/ (function(module, exports) { /** @@ -169665,7 +179175,7 @@ module.exports = 'disconnected'; * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN * @since 3.10.0 * - * @param {integer} index - The index of the button that was pressed. + * @param {number} index - The index of the button that was pressed. * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. */ @@ -169673,7 +179183,7 @@ module.exports = 'down'; /***/ }), -/* 1231 */ +/* 1295 */ /***/ (function(module, exports) { /** @@ -169697,7 +179207,7 @@ module.exports = 'down'; * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP * @since 3.10.0 * - * @param {integer} index - The index of the button that was released. + * @param {number} index - The index of the button that was released. * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. */ @@ -169705,7 +179215,7 @@ module.exports = 'up'; /***/ }), -/* 1232 */ +/* 1296 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -169715,12 +179225,12 @@ module.exports = 'up'; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(225); -var Gamepad = __webpack_require__(474); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(231); +var Gamepad = __webpack_require__(488); var GetValue = __webpack_require__(6); -var InputPluginCache = __webpack_require__(144); -var InputEvents = __webpack_require__(56); +var InputPluginCache = __webpack_require__(146); +var InputEvents = __webpack_require__(49); /** * @classdesc @@ -169750,6 +179260,9 @@ var InputEvents = __webpack_require__(56); * to the gamepads you can poll its buttons and axis sticks. See the properties and methods available on * the `Gamepad` class for more details. * + * As of September 2020 Chrome, and likely other browsers, will soon start to require that games requesting + * access to the Gamepad API are running under SSL. They will actively block API access if they are not. + * * For more information about Gamepad support in browsers see the following resources: * * https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API @@ -169931,6 +179444,8 @@ var GamepadPlugin = new Class({ if (this.enabled) { this.startListeners(); + + this.refreshPads(); } this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); @@ -170002,6 +179517,11 @@ var GamepadPlugin = new Class({ this.target.removeEventListener('gamepaddisconnected', this.onGamepadHandler); this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update); + + for (var i = 0; i < this.gamepads.length; i++) + { + this.gamepads[i].removeAllListeners(); + } }, /** @@ -170014,7 +179534,7 @@ var GamepadPlugin = new Class({ { for (var i = 0; i < this.gamepads.length; i++) { - this.gamepads.connected = false; + this.gamepads[i].pad.connected = false; } }, @@ -170199,8 +179719,6 @@ var GamepadPlugin = new Class({ { this.stopListeners(); - this.disconnectAll(); - this.removeAllListeners(); }, @@ -170235,7 +179753,7 @@ var GamepadPlugin = new Class({ * The total number of connected game pads. * * @name Phaser.Input.Gamepad.GamepadPlugin#total - * @type {integer} + * @type {number} * @since 3.10.0 */ total: { @@ -170343,7 +179861,7 @@ module.exports = GamepadPlugin; /***/ }), -/* 1233 */ +/* 1297 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170358,15 +179876,15 @@ module.exports = GamepadPlugin; module.exports = { - DUALSHOCK_4: __webpack_require__(1234), - SNES_USB: __webpack_require__(1235), - XBOX_360: __webpack_require__(1236) + DUALSHOCK_4: __webpack_require__(1298), + SNES_USB: __webpack_require__(1299), + XBOX_360: __webpack_require__(1300) }; /***/ }), -/* 1234 */ +/* 1298 */ /***/ (function(module, exports) { /** @@ -170416,7 +179934,7 @@ module.exports = { /***/ }), -/* 1235 */ +/* 1299 */ /***/ (function(module, exports) { /** @@ -170455,7 +179973,7 @@ module.exports = { /***/ }), -/* 1236 */ +/* 1300 */ /***/ (function(module, exports) { /** @@ -170506,7 +180024,7 @@ module.exports = { /***/ }), -/* 1237 */ +/* 1301 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -170515,27 +180033,27 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(68); -var CircleContains = __webpack_require__(57); +var Circle = __webpack_require__(71); +var CircleContains = __webpack_require__(62); var Class = __webpack_require__(0); -var CONST = __webpack_require__(189); -var CreateInteractiveObject = __webpack_require__(471); -var CreatePixelPerfectHandler = __webpack_require__(470); -var DistanceBetween = __webpack_require__(55); -var Ellipse = __webpack_require__(98); -var EllipseContains = __webpack_require__(99); -var Events = __webpack_require__(56); -var EventEmitter = __webpack_require__(12); +var CONST = __webpack_require__(194); +var CreateInteractiveObject = __webpack_require__(485); +var CreatePixelPerfectHandler = __webpack_require__(484); +var DistanceBetween = __webpack_require__(61); +var Ellipse = __webpack_require__(106); +var EllipseContains = __webpack_require__(107); +var Events = __webpack_require__(49); +var EventEmitter = __webpack_require__(10); var GetFastValue = __webpack_require__(2); -var GEOM_CONST = __webpack_require__(49); -var InputPluginCache = __webpack_require__(144); +var GEOM_CONST = __webpack_require__(55); +var InputPluginCache = __webpack_require__(146); var IsPlainObject = __webpack_require__(7); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); var Rectangle = __webpack_require__(9); -var RectangleContains = __webpack_require__(50); +var RectangleContains = __webpack_require__(56); var SceneEvents = __webpack_require__(20); -var Triangle = __webpack_require__(73); -var TriangleContains = __webpack_require__(85); +var Triangle = __webpack_require__(80); +var TriangleContains = __webpack_require__(110); /** * @classdesc @@ -170711,7 +180229,7 @@ var InputPlugin = new Class({ * Set to 0 to poll constantly. Set to -1 to only poll on user movement. * * @name Phaser.Input.InputPlugin#pollRate - * @type {integer} + * @type {number} * @default -1 * @since 3.0.0 */ @@ -170861,7 +180379,7 @@ var InputPlugin = new Class({ * A array containing the dragStates, for this Scene, index by the Pointer ID. * * @name Phaser.Input.InputPlugin#_dragState - * @type {integer[]} + * @type {number[]} * @private * @since 3.16.0 */ @@ -171178,7 +180696,7 @@ var InputPlugin = new Class({ * @fires Phaser.Input.Events#UPDATE * @since 3.0.0 * - * @param {integer} type - The type of event to process. + * @param {number} type - The type of event to process. * @param {Phaser.Input.Pointer[]} pointers - An array of Pointers on which the event occurred. * * @return {boolean} `true` if this Scene has captured the input events from all other Scenes, otherwise `false`. @@ -171307,8 +180825,6 @@ var InputPlugin = new Class({ input.hitAreaCallback = undefined; input.callbackContext = undefined; - this.manager.resetCursor(input); - gameObject.input = null; // Clear from _draggable, _drag and _over @@ -171331,6 +180847,8 @@ var InputPlugin = new Class({ if (index > -1) { this._over[0].splice(index, 1); + + this.manager.resetCursor(input); } return gameObject; @@ -171468,7 +180986,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer being tested. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processDownEvents: function (pointer) { @@ -171544,7 +181062,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to get the drag state for. * - * @return {integer} The drag state of the given Pointer. + * @return {number} The drag state of the given Pointer. */ getDragState: function (pointer) { @@ -171567,7 +181085,7 @@ var InputPlugin = new Class({ * @since 3.16.0 * * @param {Phaser.Input.Pointer} pointer - The Pointer to set the drag state for. - * @param {integer} state - The drag state value. An integer between 0 and 5. + * @param {number} state - The drag state value. An integer between 0 and 5. */ setDragState: function (pointer, state) { @@ -171621,7 +181139,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {integer} The number of items that DRAG_START was called on. + * @return {number} The number of items that DRAG_START was called on. */ processDragStartList: function (pointer) { @@ -171670,7 +181188,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {integer} The number of items that were collected on the drag list. + * @return {number} The number of items that were collected on the drag list. */ processDragDownEvent: function (pointer) { @@ -171750,7 +181268,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {integer} The number of items that were updated by this drag event. + * @return {number} The number of items that were updated by this drag event. */ processDragMoveEvent: function (pointer) { @@ -171890,7 +181408,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {integer} The number of items that were updated by this drag event. + * @return {number} The number of items that were updated by this drag event. */ processDragUpEvent: function (pointer) { @@ -171955,7 +181473,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processMoveEvents: function (pointer) { @@ -172023,7 +181541,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processWheelEvent: function (pointer) { @@ -172091,7 +181609,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processOverEvents: function (pointer) { @@ -172171,7 +181689,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processOutEvents: function (pointer) { @@ -172199,34 +181717,31 @@ var InputPlugin = new Class({ var gameObject = previouslyOver[i]; // Call onOut for everything in the previouslyOver array - for (i = 0; i < total; i++) + gameObject = previouslyOver[i]; + + if (!gameObject.input) { - gameObject = previouslyOver[i]; + continue; + } - if (!gameObject.input) - { - continue; - } + manager.resetCursor(gameObject.input); - manager.resetCursor(gameObject.input); + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); - gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); + totalInteracted++; - totalInteracted++; + if (_eventData.cancelled || !gameObject.input) + { + aborted = true; + break; + } - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } + this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); - this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); - - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } + if (_eventData.cancelled || !gameObject.input) + { + aborted = true; + break; } if (!aborted) @@ -172256,7 +181771,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processOverOutEvents: function (pointer) { @@ -172432,7 +181947,7 @@ var InputPlugin = new Class({ * * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {integer} The total number of objects interacted with. + * @return {number} The total number of objects interacted with. */ processUpEvents: function (pointer) { @@ -172601,7 +182116,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#makePixelPerfect * @since 3.10.0 * - * @param {integer} [alphaTolerance=1] - The alpha level that the pixel should be above to be included as a successful interaction. + * @param {number} [alphaTolerance=1] - The alpha level that the pixel should be above to be included as a successful interaction. * * @return {function} A Pixel Perfect Handler for use as a hitArea shape callback. */ @@ -173171,7 +182686,7 @@ var InputPlugin = new Class({ * @param {Phaser.GameObjects.GameObject} childA - The first Game Object to compare. * @param {Phaser.GameObjects.GameObject} childB - The second Game Object to compare. * - * @return {integer} Returns either a negative or positive integer, or zero if they match. + * @return {number} Returns either a negative or positive integer, or zero if they match. */ sortHandlerGO: function (childA, childB) { @@ -173259,7 +182774,7 @@ var InputPlugin = new Class({ * @method Phaser.Input.InputPlugin#addPointer * @since 3.10.0 * - * @param {integer} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. + * @param {number} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. * * @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created. */ @@ -173370,6 +182885,10 @@ var InputPlugin = new Class({ this.removeAllListeners(); + var manager = this.manager; + + manager.canvas.style.cursor = manager.defaultCursor; + var eventEmitter = this.systems.events; eventEmitter.off(SceneEvents.TRANSITION_START, this.transitionIn, this); @@ -173377,8 +182896,8 @@ var InputPlugin = new Class({ eventEmitter.off(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); - this.manager.events.off(Events.GAME_OUT, this.onGameOut, this); - this.manager.events.off(Events.GAME_OVER, this.onGameOver, this); + manager.events.off(Events.GAME_OUT, this.onGameOut, this); + manager.events.off(Events.GAME_OVER, this.onGameOver, this); eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, @@ -173687,7 +183206,7 @@ module.exports = InputPlugin; /***/ }), -/* 1238 */ +/* 1302 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -173702,26 +183221,30 @@ module.exports = InputPlugin; module.exports = { - Events: __webpack_require__(145), + Events: __webpack_require__(147), - KeyboardManager: __webpack_require__(377), - KeyboardPlugin: __webpack_require__(1246), + KeyboardManager: __webpack_require__(387), + KeyboardPlugin: __webpack_require__(1310), - Key: __webpack_require__(475), - KeyCodes: __webpack_require__(132), + Key: __webpack_require__(489), + KeyCodes: __webpack_require__(138), - KeyCombo: __webpack_require__(476), + KeyCombo: __webpack_require__(490), + + AdvanceKeyCombo: __webpack_require__(492), + ProcessKeyCombo: __webpack_require__(491), + ResetKeyCombo: __webpack_require__(493), + + JustDown: __webpack_require__(1312), + JustUp: __webpack_require__(1313), + DownDuration: __webpack_require__(1314), + UpDuration: __webpack_require__(1315) - JustDown: __webpack_require__(1251), - JustUp: __webpack_require__(1252), - DownDuration: __webpack_require__(1253), - UpDuration: __webpack_require__(1254) - }; /***/ }), -/* 1239 */ +/* 1303 */ /***/ (function(module, exports) { /** @@ -173757,7 +183280,7 @@ module.exports = 'keydown'; /***/ }), -/* 1240 */ +/* 1304 */ /***/ (function(module, exports) { /** @@ -173786,7 +183309,7 @@ module.exports = 'keyup'; /***/ }), -/* 1241 */ +/* 1305 */ /***/ (function(module, exports) { /** @@ -173820,7 +183343,7 @@ module.exports = 'keycombomatch'; /***/ }), -/* 1242 */ +/* 1306 */ /***/ (function(module, exports) { /** @@ -173854,7 +183377,7 @@ module.exports = 'down'; /***/ }), -/* 1243 */ +/* 1307 */ /***/ (function(module, exports) { /** @@ -173893,7 +183416,7 @@ module.exports = 'keydown-'; /***/ }), -/* 1244 */ +/* 1308 */ /***/ (function(module, exports) { /** @@ -173925,7 +183448,7 @@ module.exports = 'keyup-'; /***/ }), -/* 1245 */ +/* 1309 */ /***/ (function(module, exports) { /** @@ -173959,7 +183482,7 @@ module.exports = 'up'; /***/ }), -/* 1246 */ +/* 1310 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -173969,18 +183492,18 @@ module.exports = 'up'; */ var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(145); -var GameEvents = __webpack_require__(21); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(147); +var GameEvents = __webpack_require__(23); var GetValue = __webpack_require__(6); -var InputEvents = __webpack_require__(56); -var InputPluginCache = __webpack_require__(144); -var Key = __webpack_require__(475); -var KeyCodes = __webpack_require__(132); -var KeyCombo = __webpack_require__(476); -var KeyMap = __webpack_require__(1250); +var InputEvents = __webpack_require__(49); +var InputPluginCache = __webpack_require__(146); +var Key = __webpack_require__(489); +var KeyCodes = __webpack_require__(138); +var KeyCombo = __webpack_require__(490); +var KeyMap = __webpack_require__(1311); var SceneEvents = __webpack_require__(20); -var SnapFloor = __webpack_require__(95); +var SnapFloor = __webpack_require__(72); /** * @classdesc @@ -174228,7 +183751,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#addCapture * @since 3.16.0 * - * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to enable event capture for. + * @param {(string|number|number[]|any[])} keycode - The Key Codes to enable event capture for. * * @return {this} This KeyboardPlugin object. */ @@ -174270,7 +183793,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#removeCapture * @since 3.16.0 * - * @param {(string|integer|integer[]|any[])} keycode - The Key Codes to disable event capture for. + * @param {(string|number|number[]|any[])} keycode - The Key Codes to disable event capture for. * * @return {this} This KeyboardPlugin object. */ @@ -174287,7 +183810,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#getCaptures * @since 3.16.0 * - * @return {integer[]} An array of all the currently capturing key codes. + * @return {number[]} An array of all the currently capturing key codes. */ getCaptures: function () { @@ -174435,7 +183958,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#addKey * @since 3.10.0 * - * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * @param {(Phaser.Input.Keyboard.Key|string|number)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). * @@ -174499,7 +184022,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#removeKey * @since 3.10.0 * - * @param {(Phaser.Input.Keyboard.Key|string|integer)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * @param {(Phaser.Input.Keyboard.Key|string|number)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. * @param {boolean} [destroy=false] - Call `Key.destroy` on the removed Key object? * * @return {this} This KeyboardPlugin object. @@ -174611,7 +184134,7 @@ var KeyboardPlugin = new Class({ * @method Phaser.Input.Keyboard.KeyboardPlugin#createCombo * @since 3.10.0 * - * @param {(string|integer[]|object[])} keys - The keys that comprise this combo. + * @param {(string|number[]|object[])} keys - The keys that comprise this combo. * @param {Phaser.Types.Input.Keyboard.KeyComboConfig} [config] - A Key Combo configuration object. * * @return {Phaser.Input.Keyboard.KeyCombo} The new KeyCombo object. @@ -174894,7 +184417,7 @@ module.exports = KeyboardPlugin; /***/ }), -/* 1247 */ +/* 1311 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -174903,165 +184426,7 @@ module.exports = KeyboardPlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AdvanceKeyCombo = __webpack_require__(1248); - -/** - * Used internally by the KeyCombo class. - * - * @function Phaser.Input.Keyboard.KeyCombo.ProcessKeyCombo - * @private - * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native Keyboard Event. - * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to be processed. - * - * @return {boolean} `true` if the combo was matched, otherwise `false`. - */ -var ProcessKeyCombo = function (event, combo) -{ - if (combo.matched) - { - return true; - } - - var comboMatched = false; - var keyMatched = false; - - if (event.keyCode === combo.current) - { - // Key was correct - - if (combo.index > 0 && combo.maxKeyDelay > 0) - { - // We have to check to see if the delay between - // the new key and the old one was too long (if enabled) - - var timeLimit = combo.timeLastMatched + combo.maxKeyDelay; - - // Check if they pressed it in time or not - if (event.timeStamp <= timeLimit) - { - keyMatched = true; - comboMatched = AdvanceKeyCombo(event, combo); - } - } - else - { - keyMatched = true; - - // We don't check the time for the first key pressed, so just advance it - comboMatched = AdvanceKeyCombo(event, combo); - } - } - - if (!keyMatched && combo.resetOnWrongKey) - { - // Wrong key was pressed - combo.index = 0; - combo.current = combo.keyCodes[0]; - } - - if (comboMatched) - { - combo.timeLastMatched = event.timeStamp; - combo.matched = true; - combo.timeMatched = event.timeStamp; - } - - return comboMatched; -}; - -module.exports = ProcessKeyCombo; - - -/***/ }), -/* 1248 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Used internally by the KeyCombo class. - * Return `true` if it reached the end of the combo, `false` if not. - * - * @function Phaser.Input.Keyboard.KeyCombo.AdvanceKeyCombo - * @private - * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native Keyboard Event. - * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to advance. - * - * @return {boolean} `true` if it reached the end of the combo, `false` if not. - */ -var AdvanceKeyCombo = function (event, combo) -{ - combo.timeLastMatched = event.timeStamp; - combo.index++; - - if (combo.index === combo.size) - { - return true; - } - else - { - combo.current = combo.keyCodes[combo.index]; - return false; - } -}; - -module.exports = AdvanceKeyCombo; - - -/***/ }), -/* 1249 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Used internally by the KeyCombo class. - * - * @function Phaser.Input.Keyboard.KeyCombo.ResetKeyCombo - * @private - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo to reset. - * - * @return {Phaser.Input.Keyboard.KeyCombo} The KeyCombo. - */ -var ResetKeyCombo = function (combo) -{ - combo.current = combo.keyCodes[0]; - combo.index = 0; - combo.timeLastMatched = 0; - combo.matched = false; - combo.timeMatched = 0; - - return combo; -}; - -module.exports = ResetKeyCombo; - - -/***/ }), -/* 1250 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var KeyCodes = __webpack_require__(132); +var KeyCodes = __webpack_require__(138); var KeyMap = {}; @@ -175074,7 +184439,7 @@ module.exports = KeyMap; /***/ }), -/* 1251 */ +/* 1312 */ /***/ (function(module, exports) { /** @@ -175116,7 +184481,7 @@ module.exports = JustDown; /***/ }), -/* 1252 */ +/* 1313 */ /***/ (function(module, exports) { /** @@ -175158,7 +184523,7 @@ module.exports = JustUp; /***/ }), -/* 1253 */ +/* 1314 */ /***/ (function(module, exports) { /** @@ -175175,7 +184540,7 @@ module.exports = JustUp; * @since 3.0.0 * * @param {Phaser.Input.Keyboard.Key} key - The Key object to test. - * @param {integer} [duration=50] - The duration, in ms, within which the key must have been pressed down. + * @param {number} [duration=50] - The duration, in ms, within which the key must have been pressed down. * * @return {boolean} `true` if the Key was pressed down within `duration` ms ago, otherwise `false`. */ @@ -175192,7 +184557,7 @@ module.exports = DownDuration; /***/ }), -/* 1254 */ +/* 1315 */ /***/ (function(module, exports) { /** @@ -175209,7 +184574,7 @@ module.exports = DownDuration; * @since 3.0.0 * * @param {Phaser.Input.Keyboard.Key} key - The Key object to test. - * @param {integer} [duration=50] - The duration, in ms, within which the key must have been released. + * @param {number} [duration=50] - The duration, in ms, within which the key must have been released. * * @return {boolean} `true` if the Key was released within `duration` ms ago, otherwise `false`. */ @@ -175226,7 +184591,7 @@ module.exports = UpDuration; /***/ }), -/* 1255 */ +/* 1316 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175242,14 +184607,14 @@ module.exports = UpDuration; /* eslint-disable */ module.exports = { - MouseManager: __webpack_require__(378) + MouseManager: __webpack_require__(388) }; /* eslint-enable */ /***/ }), -/* 1256 */ +/* 1317 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175265,14 +184630,14 @@ module.exports = { /* eslint-disable */ module.exports = { - TouchManager: __webpack_require__(380) + TouchManager: __webpack_require__(390) }; /* eslint-enable */ /***/ }), -/* 1257 */ +/* 1318 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175281,8 +184646,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(18); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(19); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Loader @@ -175290,18 +184655,18 @@ var Extend = __webpack_require__(19); var Loader = { - Events: __webpack_require__(84), + Events: __webpack_require__(89), - FileTypes: __webpack_require__(1258), + FileTypes: __webpack_require__(1319), File: __webpack_require__(22), FileTypesManager: __webpack_require__(8), - GetURL: __webpack_require__(146), - LoaderPlugin: __webpack_require__(1282), - MergeXHRSettings: __webpack_require__(226), - MultiFile: __webpack_require__(63), - XHRLoader: __webpack_require__(477), - XHRSettings: __webpack_require__(147) + GetURL: __webpack_require__(148), + LoaderPlugin: __webpack_require__(1345), + MergeXHRSettings: __webpack_require__(232), + MultiFile: __webpack_require__(47), + XHRLoader: __webpack_require__(494), + XHRSettings: __webpack_require__(149) }; @@ -175312,7 +184677,7 @@ module.exports = Loader; /***/ }), -/* 1258 */ +/* 1319 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175327,42 +184692,44 @@ module.exports = Loader; module.exports = { - AnimationJSONFile: __webpack_require__(1259), - AtlasJSONFile: __webpack_require__(1260), - AtlasXMLFile: __webpack_require__(1261), - AudioFile: __webpack_require__(478), - AudioSpriteFile: __webpack_require__(1262), - BinaryFile: __webpack_require__(1263), - BitmapFontFile: __webpack_require__(1264), - CSSFile: __webpack_require__(1265), - GLSLFile: __webpack_require__(1266), - HTML5AudioFile: __webpack_require__(479), - HTMLFile: __webpack_require__(1267), - HTMLTextureFile: __webpack_require__(1268), - ImageFile: __webpack_require__(74), - JSONFile: __webpack_require__(62), - MultiAtlasFile: __webpack_require__(1269), - MultiScriptFile: __webpack_require__(1270), - PackFile: __webpack_require__(1271), - PluginFile: __webpack_require__(1272), - SceneFile: __webpack_require__(1273), - ScenePluginFile: __webpack_require__(1274), - ScriptFile: __webpack_require__(480), - SpriteSheetFile: __webpack_require__(1275), - SVGFile: __webpack_require__(1276), - TextFile: __webpack_require__(481), - TilemapCSVFile: __webpack_require__(1277), - TilemapImpactFile: __webpack_require__(1278), - TilemapJSONFile: __webpack_require__(1279), - UnityAtlasFile: __webpack_require__(1280), - VideoFile: __webpack_require__(1281), - XMLFile: __webpack_require__(227) + AnimationJSONFile: __webpack_require__(1320), + AsepriteFile: __webpack_require__(1321), + AtlasJSONFile: __webpack_require__(1322), + AtlasXMLFile: __webpack_require__(1323), + AudioFile: __webpack_require__(495), + AudioSpriteFile: __webpack_require__(1324), + BinaryFile: __webpack_require__(1325), + BitmapFontFile: __webpack_require__(1326), + CSSFile: __webpack_require__(1327), + GLSLFile: __webpack_require__(1328), + HTML5AudioFile: __webpack_require__(496), + HTMLFile: __webpack_require__(1329), + HTMLTextureFile: __webpack_require__(1330), + ImageFile: __webpack_require__(67), + JSONFile: __webpack_require__(58), + MultiAtlasFile: __webpack_require__(1331), + MultiScriptFile: __webpack_require__(1332), + OBJFile: __webpack_require__(1333), + PackFile: __webpack_require__(1334), + PluginFile: __webpack_require__(1335), + SceneFile: __webpack_require__(1336), + ScenePluginFile: __webpack_require__(1337), + ScriptFile: __webpack_require__(497), + SpriteSheetFile: __webpack_require__(1338), + SVGFile: __webpack_require__(1339), + TextFile: __webpack_require__(234), + TilemapCSVFile: __webpack_require__(1340), + TilemapImpactFile: __webpack_require__(1341), + TilemapJSONFile: __webpack_require__(1342), + UnityAtlasFile: __webpack_require__(1343), + VideoFile: __webpack_require__(1344), + XMLFile: __webpack_require__(233) }; /***/ }), -/* 1259 */ +/* 1320 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175373,8 +184740,8 @@ module.exports = { var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(62); -var LoaderEvents = __webpack_require__(84); +var JSONFile = __webpack_require__(58); +var LoaderEvents = __webpack_require__(89); /** * @classdesc @@ -175563,7 +184930,7 @@ module.exports = AnimationJSONFile; /***/ }), -/* 1260 */ +/* 1321 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175575,10 +184942,280 @@ module.exports = AnimationJSONFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(62); -var MultiFile = __webpack_require__(63); +var JSONFile = __webpack_require__(58); +var MultiFile = __webpack_require__(47); + +/** + * @classdesc + * A single JSON based Texture Atlas File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#atlas method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlas. + * + * https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?source=photonstorm + * + * @class AsepriteFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.AsepriteFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + */ +var AsepriteFile = new Class({ + + Extends: MultiFile, + + initialize: + + function AsepriteFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) + { + var image; + var data; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + + image = new ImageFile(loader, { + key: key, + url: GetFastValue(config, 'textureURL'), + extension: GetFastValue(config, 'textureExtension', 'png'), + normalMap: GetFastValue(config, 'normalMap'), + xhrSettings: GetFastValue(config, 'textureXhrSettings') + }); + + data = new JSONFile(loader, { + key: key, + url: GetFastValue(config, 'atlasURL'), + extension: GetFastValue(config, 'atlasExtension', 'json'), + xhrSettings: GetFastValue(config, 'atlasXhrSettings') + }); + } + else + { + image = new ImageFile(loader, key, textureURL, textureXhrSettings); + data = new JSONFile(loader, key, atlasURL, atlasXhrSettings); + } + + if (image.linkFile) + { + // Image has a normal map + MultiFile.call(this, loader, 'atlasjson', key, [ image, data, image.linkFile ]); + } + else + { + MultiFile.call(this, loader, 'atlasjson', key, [ image, data ]); + } + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.AsepriteFile#addToCache + * @since 3.7.0 + */ + addToCache: function () + { + if (this.isReadyToProcess()) + { + var image = this.files[0]; + var json = this.files[1]; + var normalMap = (this.files[2]) ? this.files[2].data : null; + + this.loader.textureManager.addAtlas(image.key, image.data, json.data, normalMap); + + json.addToCache(); + + this.complete = true; + } + } + +}); + +/** + * Aseprite is a powerful animated sprite editor and pixel art tool. + * + * You can find more details at https://www.aseprite.org/ + * + * Adds a JSON based Aseprite Animation, or array of animations, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.aseprite('gladiator', 'images/Gladiator.png', 'images/Gladiator.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * To export a compatible JSON file in Aseprite, please do the following: + * + * 1. Go to "File - Export Sprite Sheet" + * + * 2. On the **Layout** tab: + * 2a. Set the "Sheet type" to "Packed" + * 2b. Set the "Constraints" to "None" + * 2c. Check the "Merge Duplicates" checkbox + * + * 3. On the **Sprite** tab: + * 3a. Set "Layers" to "Visible layers" + * 3b. Set "Frames" to "All frames", unless you only wish to export a sub-set of tags + * + * 4. On the **Borders** tab: + * 4a. Check the "Trim Sprite" and "Trim Cells" options + * 4b. Ensure "Border Padding", "Spacing" and "Inner Padding" are all > 0 (1 is usually enough) + * + * 5. On the **Output** tab: + * 5a. Check "Output File", give your image a name and make sure you choose "png files" as the file type + * 5b. Check "JSON Data" and give your json file a name + * 5c. The JSON Data type can be either a Hash or Array, Phaser doesn't mind. + * 5d. Make sure "Tags" is checked in the Meta options + * 5e. In the "Item Filename" input box, make sure it says just "{frame}" and nothing more. + * + * 6. Click export + * + * This was tested with Aseprite 1.2.25. + * + * This will export a png and json file which you can load using the Aseprite Loader, i.e.: + * + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.aseprite({ + * key: 'gladiator', + * textureURL: 'images/Gladiator.png', + * atlasURL: 'images/Gladiator.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.AsepriteFileConfig` for more details. + * + * Instead of passing a URL for the JSON data you can also pass in a well formed JSON object instead. + * + * Once loaded, you can call this method from within a Scene with the 'atlas' key: + * + * ```javascript + * this.anims.createFromAseprite('paladin'); + * ``` + * + * Any animations defined in the JSON will now be available to use in Phaser and you play them + * via their Tag name. For example, if you have an animation called 'War Cry' on your Aseprite timeline, + * you can play it in Phaser using that Tag name: + * + * ```javascript + * this.add.sprite(400, 300).play('War Cry'); + * ``` + * + * When calling this method you can optionally provide an array of tag names, and only those animations + * will be created. For example: + * + * ```javascript + * this.anims.createFromAseprite('paladin', [ 'step', 'War Cry', 'Magnum Break' ]); + * ``` + * + * This will only create the 3 animations defined. Note that the tag names are case-sensitive. + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Aseprite File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#aseprite + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.50.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.AsepriteFileConfig|Phaser.Types.Loader.FileTypes.AsepriteFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('aseprite', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) +{ + var multifile; + + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + multifile = new AsepriteFile(this, key[i]); + + this.addFile(multifile.files); + } + } + else + { + multifile = new AsepriteFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); + + this.addFile(multifile.files); + } + + return this; +}); + +module.exports = AsepriteFile; + + +/***/ }), +/* 1322 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var FileTypesManager = __webpack_require__(8); +var GetFastValue = __webpack_require__(2); +var ImageFile = __webpack_require__(67); +var IsPlainObject = __webpack_require__(7); +var JSONFile = __webpack_require__(58); +var MultiFile = __webpack_require__(47); /** * @classdesc @@ -175668,8 +185305,6 @@ var AtlasJSONFile = new Class({ this.loader.textureManager.addAtlas(image.key, image.data, json.data, normalMap); - json.addToCache(); - this.complete = true; } } @@ -175812,7 +185447,7 @@ module.exports = AtlasJSONFile; /***/ }), -/* 1261 */ +/* 1323 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -175824,10 +185459,10 @@ module.exports = AtlasJSONFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(63); -var XMLFile = __webpack_require__(227); +var MultiFile = __webpack_require__(47); +var XMLFile = __webpack_require__(233); /** * @classdesc @@ -175915,8 +185550,6 @@ var AtlasXMLFile = new Class({ this.loader.textureManager.addAtlasXML(image.key, image.data, xml.data, normalMap); - xml.addToCache(); - this.complete = true; } } @@ -176055,7 +185688,7 @@ module.exports = AtlasXMLFile; /***/ }), -/* 1262 */ +/* 1324 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -176064,13 +185697,13 @@ module.exports = AtlasXMLFile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AudioFile = __webpack_require__(478); +var AudioFile = __webpack_require__(495); var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(62); -var MultiFile = __webpack_require__(63); +var JSONFile = __webpack_require__(58); +var MultiFile = __webpack_require__(47); /** * @classdesc @@ -176345,7 +185978,7 @@ FileTypesManager.register('audioSprite', function (key, jsonURL, audioURL, audio /***/ }), -/* 1263 */ +/* 1325 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -176355,7 +185988,7 @@ FileTypesManager.register('audioSprite', function (key, jsonURL, audioURL, audio */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -176527,7 +186160,7 @@ module.exports = BinaryFile; /***/ }), -/* 1264 */ +/* 1326 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -176539,11 +186172,11 @@ module.exports = BinaryFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(63); -var ParseXMLBitmapFont = __webpack_require__(198); -var XMLFile = __webpack_require__(227); +var MultiFile = __webpack_require__(47); +var ParseXMLBitmapFont = __webpack_require__(203); +var XMLFile = __webpack_require__(233); /** * @classdesc @@ -176629,7 +186262,6 @@ var BitmapFontFile = new Class({ var xml = this.files[1]; image.addToCache(); - xml.addToCache(); var texture = image.cache.get(image.key); @@ -176774,7 +186406,7 @@ module.exports = BitmapFontFile; /***/ }), -/* 1265 */ +/* 1327 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -176784,7 +186416,7 @@ module.exports = BitmapFontFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -176942,7 +186574,7 @@ module.exports = CSSFile; /***/ }), -/* 1266 */ +/* 1328 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -176952,12 +186584,12 @@ module.exports = CSSFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var Shader = __webpack_require__(363); +var Shader = __webpack_require__(372); /** * @classdesc @@ -177200,7 +186832,7 @@ var GLSLFile = new Class({ * @since 3.17.0 * * @param {string[]} data - The array of shader data to process. - * @param {integer} offset - The offset to start processing from. + * @param {number} offset - The offset to start processing from. * * @return {any} The processed shader block, or null. */ @@ -177353,7 +186985,7 @@ module.exports = GLSLFile; /***/ }), -/* 1267 */ +/* 1329 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -177363,7 +186995,7 @@ module.exports = GLSLFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -177385,7 +187017,7 @@ var IsPlainObject = __webpack_require__(7); * * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Types.Loader.FileTypes.HTMLFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.html". + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var HTMLFile = new Class({ @@ -177528,7 +187160,7 @@ module.exports = HTMLFile; /***/ }), -/* 1268 */ +/* 1330 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -177538,7 +187170,7 @@ module.exports = HTMLFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -177561,8 +187193,8 @@ var IsPlainObject = __webpack_require__(7); * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. * @param {(string|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig)} key - The key to use for this file, or a file configuration object. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {integer} [width] - The width of the texture the HTML will be rendered to. - * @param {integer} [height] - The height of the texture the HTML will be rendered to. + * @param {number} [width] - The width of the texture the HTML will be rendered to. + * @param {number} [height] - The height of the texture the HTML will be rendered to. * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ var HTMLTextureFile = new Class({ @@ -177758,8 +187390,8 @@ var HTMLTextureFile = new Class({ * * @param {(string|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". - * @param {integer} [width=512] - The width of the texture the HTML will be rendered to. - * @param {integer} [height=512] - The height of the texture the HTML will be rendered to. + * @param {number} [width=512] - The width of the texture the HTML will be rendered to. + * @param {number} [height=512] - The height of the texture the HTML will be rendered to. * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * * @return {this} The Loader instance. @@ -177786,7 +187418,7 @@ module.exports = HTMLTextureFile; /***/ }), -/* 1269 */ +/* 1331 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -177798,10 +187430,10 @@ module.exports = HTMLTextureFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(62); -var MultiFile = __webpack_require__(63); +var JSONFile = __webpack_require__(58); +var MultiFile = __webpack_require__(47); /** * @classdesc @@ -178119,7 +187751,7 @@ module.exports = MultiAtlasFile; /***/ }), -/* 1270 */ +/* 1332 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -178132,8 +187764,8 @@ var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(63); -var ScriptFile = __webpack_require__(480); +var MultiFile = __webpack_require__(47); +var ScriptFile = __webpack_require__(497); /** * @classdesc @@ -178336,7 +187968,7 @@ module.exports = MultiScriptFile; /***/ }), -/* 1271 */ +/* 1333 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -178346,9 +187978,263 @@ module.exports = MultiScriptFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(62); +var GetFastValue = __webpack_require__(2); +var IsPlainObject = __webpack_require__(7); +var MultiFile = __webpack_require__(47); +var ParseObj = __webpack_require__(475); +var ParseObjMaterial = __webpack_require__(476); +var TextFile = __webpack_require__(234); + +/** + * @classdesc + * A single Wavefront OBJ File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#obj method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#obj. + * + * @class OBJFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.OBJFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [objURL] - The absolute or relative URL to load the obj file from. If undefined or `null` it will be set to `.obj`, i.e. if `key` was "alien" then the URL will be "alien.obj". + * @param {string} [matURL] - The absolute or relative URL to load the material file from. If undefined or `null` it will be set to `.mat`, i.e. if `key` was "alien" then the URL will be "alien.mat". + * @param {boolean} [flipUV] - Flip the UV coordinates stored in the model data? + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for these files. + */ +var OBJFile = new Class({ + + Extends: MultiFile, + + initialize: + + function OBJFile (loader, key, objURL, matURL, flipUV, xhrSettings) + { + var obj; + var mat; + + var cache = loader.cacheManager.obj; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + + obj = new TextFile(loader, { + key: key, + type: 'obj', + cache: cache, + url: GetFastValue(config, 'url'), + extension: GetFastValue(config, 'extension', 'obj'), + xhrSettings: GetFastValue(config, 'xhrSettings'), + config: { + flipUV: GetFastValue(config, 'flipUV', flipUV) + } + }); + + matURL = GetFastValue(config, 'matURL'); + + if (matURL) + { + mat = new TextFile(loader, { + key: key, + type: 'mat', + cache: cache, + url: matURL, + extension: GetFastValue(config, 'matExtension', 'mat'), + xhrSettings: GetFastValue(config, 'xhrSettings') + }); + } + } + else + { + obj = new TextFile(loader, { + key: key, + url: objURL, + type: 'obj', + cache: cache, + extension: 'obj', + xhrSettings: xhrSettings, + config: { + flipUV: flipUV + } + }); + + if (matURL) + { + mat = new TextFile(loader, { + key: key, + url: matURL, + type: 'mat', + cache: cache, + extension: 'mat', + xhrSettings: xhrSettings + }); + } + } + + MultiFile.call(this, loader, 'obj', key, [ obj, mat ]); + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.OBJFile#addToCache + * @since 3.50.0 + */ + addToCache: function () + { + if (this.isReadyToProcess()) + { + var obj = this.files[0]; + var mat = this.files[1]; + + var objData = ParseObj(obj.data, obj.config.flipUV); + + if (mat) + { + objData.materials = ParseObjMaterial(mat.data); + } + + obj.cache.add(obj.key, objData); + + this.complete = true; + } + } + +}); + +/** + * Adds a Wavefront OBJ file, or array of OBJ files, to the current load queue. + * + * Note: You should ensure your 3D package has triangulated the OBJ file prior to export. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.obj('ufo', 'files/spaceship.obj'); + * } + * ``` + * + * You can optionally also load a Wavefront Material file as well, by providing the 3rd parameter: + * + * ```javascript + * function preload () + * { + * this.load.obj('ufo', 'files/spaceship.obj', 'files/spaceship.mtl'); + * } + * ``` + * + * If given, the material will be parsed and stored along with the obj data in the cache. + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global OBJ Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the OBJ Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the OBJ Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.obj({ + * key: 'ufo', + * url: 'files/spaceship.obj', + * matURL: 'files/spaceship.mtl', + * flipUV: true + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.OBJFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.obj('ufo', 'files/spaceship.obj'); + * // and later in your game ... + * var data = this.cache.obj.get('ufo'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the obj from the OBJ Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.obj". It will always add `.obj` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the OBJ File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#obj + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.50.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.OBJFileConfig|Phaser.Types.Loader.FileTypes.OBJFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [objURL] - The absolute or relative URL to load the obj file from. If undefined or `null` it will be set to `.obj`, i.e. if `key` was "alien" then the URL will be "alien.obj". + * @param {string} [matURL] - Optional absolute or relative URL to load the obj material file from. + * @param {boolean} [flipUV] - Flip the UV coordinates stored in the model data? + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('obj', function (key, objURL, matURL, flipUVs, xhrSettings) +{ + var multifile; + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + multifile = new OBJFile(this, key[i]); + + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(multifile.files); + } + } + else + { + multifile = new OBJFile(this, key, objURL, matURL, flipUVs, xhrSettings); + + this.addFile(multifile.files); + } + + return this; +}); + +module.exports = OBJFile; + + +/***/ }), +/* 1334 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var CONST = __webpack_require__(19); +var FileTypesManager = __webpack_require__(8); +var JSONFile = __webpack_require__(58); /** * @classdesc @@ -178554,7 +188440,7 @@ module.exports = PackFile; /***/ }), -/* 1272 */ +/* 1335 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -178564,7 +188450,7 @@ module.exports = PackFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -178766,7 +188652,7 @@ module.exports = PluginFile; /***/ }), -/* 1273 */ +/* 1336 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -178776,7 +188662,7 @@ module.exports = PluginFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -178823,7 +188709,6 @@ var SceneFile = new Class({ var fileConfig = { type: 'text', - cache: loader.cacheManager.text, extension: extension, responseType: 'text', key: key, @@ -178987,7 +188872,7 @@ module.exports = SceneFile; /***/ }), -/* 1274 */ +/* 1337 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -178997,7 +188882,7 @@ module.exports = SceneFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -179193,7 +189078,7 @@ module.exports = ScenePluginFile; /***/ }), -/* 1275 */ +/* 1338 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -179204,7 +189089,7 @@ module.exports = ScenePluginFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); /** * @classdesc @@ -179384,7 +189269,7 @@ module.exports = SpriteSheetFile; /***/ }), -/* 1276 */ +/* 1339 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -179394,7 +189279,7 @@ module.exports = SpriteSheetFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); @@ -179723,7 +189608,7 @@ module.exports = SVGFile; /***/ }), -/* 1277 */ +/* 1340 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -179733,12 +189618,12 @@ module.exports = SVGFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); -var TILEMAP_FORMATS = __webpack_require__(33); +var TILEMAP_FORMATS = __webpack_require__(38); /** * @classdesc @@ -179918,7 +189803,7 @@ module.exports = TilemapCSVFile; /***/ }), -/* 1278 */ +/* 1341 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -179929,8 +189814,8 @@ module.exports = TilemapCSVFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(62); -var TILEMAP_FORMATS = __webpack_require__(33); +var JSONFile = __webpack_require__(58); +var TILEMAP_FORMATS = __webpack_require__(38); /** * @classdesc @@ -180074,7 +189959,7 @@ module.exports = TilemapImpactFile; /***/ }), -/* 1279 */ +/* 1342 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180085,8 +189970,8 @@ module.exports = TilemapImpactFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(62); -var TILEMAP_FORMATS = __webpack_require__(33); +var JSONFile = __webpack_require__(58); +var TILEMAP_FORMATS = __webpack_require__(38); /** * @classdesc @@ -180230,7 +190115,7 @@ module.exports = TilemapJSONFile; /***/ }), -/* 1280 */ +/* 1343 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180242,10 +190127,10 @@ module.exports = TilemapJSONFile; var Class = __webpack_require__(0); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(74); +var ImageFile = __webpack_require__(67); var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(63); -var TextFile = __webpack_require__(481); +var MultiFile = __webpack_require__(47); +var TextFile = __webpack_require__(234); /** * @classdesc @@ -180333,8 +190218,6 @@ var UnityAtlasFile = new Class({ this.loader.textureManager.addUnityAtlas(image.key, image.data, text.data, normalMap); - text.addToCache(); - this.complete = true; } } @@ -180472,7 +190355,7 @@ module.exports = UnityAtlasFile; /***/ }), -/* 1281 */ +/* 1344 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180482,10 +190365,10 @@ module.exports = UnityAtlasFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); +var CONST = __webpack_require__(19); var File = __webpack_require__(22); var FileTypesManager = __webpack_require__(8); -var GetURL = __webpack_require__(146); +var GetURL = __webpack_require__(148); var GetFastValue = __webpack_require__(2); var IsPlainObject = __webpack_require__(7); @@ -180866,7 +190749,7 @@ module.exports = VideoFile; /***/ }), -/* 1282 */ +/* 1345 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -180876,15 +190759,15 @@ module.exports = VideoFile; */ var Class = __webpack_require__(0); -var CONST = __webpack_require__(18); -var CustomSet = __webpack_require__(141); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(84); +var CONST = __webpack_require__(19); +var CustomSet = __webpack_require__(145); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(89); var FileTypesManager = __webpack_require__(8); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); -var XHRSettings = __webpack_require__(147); +var XHRSettings = __webpack_require__(149); /** * @classdesc @@ -181048,7 +190931,7 @@ var LoaderPlugin = new Class({ * The default is 32 but you can change this in your Game Config, or by changing this property before the Loader starts. * * @name Phaser.Loader.LoaderPlugin#maxParallelDownloads - * @type {integer} + * @type {number} * @since 3.0.0 */ this.maxParallelDownloads = GetFastValue(sceneConfig, 'maxParallelDownloads', gameConfig.loaderMaxParallelDownloads); @@ -181083,7 +190966,7 @@ var LoaderPlugin = new Class({ * of loading, especially if you load a Pack File. Therefore this value can change, but in most cases remains static. * * @name Phaser.Loader.LoaderPlugin#totalToLoad - * @type {integer} + * @type {number} * @default 0 * @since 3.0.0 */ @@ -181158,7 +191041,7 @@ var LoaderPlugin = new Class({ * This value is reset when you call `Loader.start`. * * @name Phaser.Loader.LoaderPlugin#totalFailed - * @type {integer} + * @type {number} * @default 0 * @since 3.7.0 */ @@ -181169,7 +191052,7 @@ var LoaderPlugin = new Class({ * This value is reset when you call `Loader.start`. * * @name Phaser.Loader.LoaderPlugin#totalComplete - * @type {integer} + * @type {number} * @default 0 * @since 3.7.0 */ @@ -181179,7 +191062,7 @@ var LoaderPlugin = new Class({ * The current state of the Loader. * * @name Phaser.Loader.LoaderPlugin#state - * @type {integer} + * @type {number} * @readonly * @since 3.0.0 */ @@ -181189,7 +191072,7 @@ var LoaderPlugin = new Class({ * The current index being used by multi-file loaders to avoid key clashes. * * @name Phaser.Loader.LoaderPlugin#multiKeyIndex - * @type {integer} + * @type {number} * @private * @since 3.20.0 */ @@ -181949,7 +191832,7 @@ module.exports = LoaderPlugin; /***/ }), -/* 1283 */ +/* 1346 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -181958,8 +191841,8 @@ module.exports = LoaderPlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(52); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(59); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Physics.Arcade @@ -181967,23 +191850,23 @@ var Extend = __webpack_require__(19); var Arcade = { - ArcadePhysics: __webpack_require__(1284), - Body: __webpack_require__(488), - Collider: __webpack_require__(489), - Components: __webpack_require__(228), - Events: __webpack_require__(230), - Factory: __webpack_require__(482), - GetOverlapX: __webpack_require__(231), - GetOverlapY: __webpack_require__(232), - SeparateX: __webpack_require__(497), - SeparateY: __webpack_require__(498), - Group: __webpack_require__(485), - Image: __webpack_require__(483), - Sprite: __webpack_require__(148), - StaticBody: __webpack_require__(499), - StaticGroup: __webpack_require__(486), - Tilemap: __webpack_require__(1305), - World: __webpack_require__(487) + ArcadePhysics: __webpack_require__(1347), + Body: __webpack_require__(504), + Collider: __webpack_require__(505), + Components: __webpack_require__(235), + Events: __webpack_require__(237), + Factory: __webpack_require__(498), + GetOverlapX: __webpack_require__(238), + GetOverlapY: __webpack_require__(239), + SeparateX: __webpack_require__(514), + SeparateY: __webpack_require__(515), + Group: __webpack_require__(501), + Image: __webpack_require__(499), + Sprite: __webpack_require__(150), + StaticBody: __webpack_require__(516), + StaticGroup: __webpack_require__(502), + Tilemap: __webpack_require__(1371), + World: __webpack_require__(503) }; @@ -181994,7 +191877,7 @@ module.exports = Arcade; /***/ }), -/* 1284 */ +/* 1347 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -182004,18 +191887,18 @@ module.exports = Arcade; */ var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(41); -var DistanceBetween = __webpack_require__(55); -var DistanceSquared = __webpack_require__(334); -var Factory = __webpack_require__(482); +var DegToRad = __webpack_require__(34); +var DistanceBetween = __webpack_require__(61); +var DistanceSquared = __webpack_require__(345); +var Factory = __webpack_require__(498); var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(134); -var OverlapCirc = __webpack_require__(484); -var OverlapRect = __webpack_require__(229); -var PluginCache = __webpack_require__(23); +var Merge = __webpack_require__(140); +var OverlapCirc = __webpack_require__(500); +var OverlapRect = __webpack_require__(236); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); var Vector2 = __webpack_require__(3); -var World = __webpack_require__(487); +var World = __webpack_require__(503); /** * @classdesc @@ -182719,7 +192602,7 @@ module.exports = ArcadePhysics; /***/ }), -/* 1285 */ +/* 1348 */ /***/ (function(module, exports) { /** @@ -182794,7 +192677,7 @@ module.exports = Acceleration; /***/ }), -/* 1286 */ +/* 1349 */ /***/ (function(module, exports) { /** @@ -182876,7 +192759,7 @@ module.exports = Angular; /***/ }), -/* 1287 */ +/* 1350 */ /***/ (function(module, exports) { /** @@ -182975,7 +192858,7 @@ module.exports = Bounce; /***/ }), -/* 1288 */ +/* 1351 */ /***/ (function(module, exports) { /** @@ -183102,7 +192985,7 @@ module.exports = Debug; /***/ }), -/* 1289 */ +/* 1352 */ /***/ (function(module, exports) { /** @@ -183235,7 +193118,7 @@ module.exports = Drag; /***/ }), -/* 1290 */ +/* 1353 */ /***/ (function(module, exports) { /** @@ -183359,7 +193242,7 @@ module.exports = Enable; /***/ }), -/* 1291 */ +/* 1354 */ /***/ (function(module, exports) { /** @@ -183447,7 +193330,7 @@ module.exports = Friction; /***/ }), -/* 1292 */ +/* 1355 */ /***/ (function(module, exports) { /** @@ -183525,7 +193408,7 @@ module.exports = Gravity; /***/ }), -/* 1293 */ +/* 1356 */ /***/ (function(module, exports) { /** @@ -183543,12 +193426,16 @@ module.exports = Gravity; var Immovable = { /** - * Sets Whether this Body can be moved by collisions with another Body. + * Sets if this Body can be separated during collisions with other bodies. + * + * When a body is immovable it means it won't move at all, not even to separate it from collision + * overlap. If you just wish to prevent a body from being knocked around by other bodies, see + * the `setPushable` method instead. * * @method Phaser.Physics.Arcade.Components.Immovable#setImmovable * @since 3.0.0 * - * @param {boolean} [value=true] - Sets if this body can be moved by collisions with another Body. + * @param {boolean} [value=true] - Sets if this body will be separated during collisions with other bodies. * * @return {this} This Game Object. */ @@ -183567,7 +193454,7 @@ module.exports = Immovable; /***/ }), -/* 1294 */ +/* 1357 */ /***/ (function(module, exports) { /** @@ -183607,7 +193494,55 @@ module.exports = Mass; /***/ }), -/* 1295 */ +/* 1358 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the pushable property of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Pushable + * @since 3.50.0 + */ +var Pushable = { + + /** + * Sets if this Body can be pushed by another Body. + * + * A body that cannot be pushed will reflect back all of the velocity it is given to the + * colliding body. If that body is also not pushable, then the separation will be split + * between them evenly. + * + * If you want your body to never move or seperate at all, see the `setImmovable` method. + * + * @method Phaser.Physics.Arcade.Components.Pushable#setPushable + * @since 3.50.0 + * + * @param {boolean} [value=true] - Sets if this body can be pushed by collisions with another Body. + * + * @return {this} This Game Object. + */ + setPushable: function (value) + { + if (value === undefined) { value = true; } + + this.body.pushable = value; + + return this; + } + +}; + +module.exports = Pushable; + + +/***/ }), +/* 1359 */ /***/ (function(module, exports) { /** @@ -183710,7 +193645,7 @@ module.exports = Size; /***/ }), -/* 1296 */ +/* 1360 */ /***/ (function(module, exports) { /** @@ -183809,7 +193744,7 @@ module.exports = Velocity; /***/ }), -/* 1297 */ +/* 1361 */ /***/ (function(module, exports) { /** @@ -183842,7 +193777,7 @@ module.exports = 'collide'; /***/ }), -/* 1298 */ +/* 1362 */ /***/ (function(module, exports) { /** @@ -183875,7 +193810,7 @@ module.exports = 'overlap'; /***/ }), -/* 1299 */ +/* 1363 */ /***/ (function(module, exports) { /** @@ -183898,7 +193833,7 @@ module.exports = 'pause'; /***/ }), -/* 1300 */ +/* 1364 */ /***/ (function(module, exports) { /** @@ -183921,7 +193856,7 @@ module.exports = 'resume'; /***/ }), -/* 1301 */ +/* 1365 */ /***/ (function(module, exports) { /** @@ -183953,7 +193888,7 @@ module.exports = 'tilecollide'; /***/ }), -/* 1302 */ +/* 1366 */ /***/ (function(module, exports) { /** @@ -183985,7 +193920,7 @@ module.exports = 'tileoverlap'; /***/ }), -/* 1303 */ +/* 1367 */ /***/ (function(module, exports) { /** @@ -184017,7 +193952,7 @@ module.exports = 'worldbounds'; /***/ }), -/* 1304 */ +/* 1368 */ /***/ (function(module, exports) { /** @@ -184028,22 +193963,858 @@ module.exports = 'worldbounds'; /** * The Arcade Physics World Step Event. - * + * * This event is dispatched by an Arcade Physics World instance whenever a physics step is run. * It is emitted _after_ the bodies and colliders have been updated. - * + * * In high framerate settings this can be multiple times per game frame. - * + * * Listen to it from a Scene using: `this.physics.world.on('worldstep', listener)`. * * @event Phaser.Physics.Arcade.Events#WORLD_STEP * @since 3.18.0 + * + * @param {number} delta - The delta time amount of this step, in seconds. */ module.exports = 'worldstep'; /***/ }), -/* 1305 */ +/* 1369 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var body1; +var body2; +var body1Pushable; +var body2Pushable; +var body1MassImpact; +var body2MassImpact; +var body1FullImpact; +var body2FullImpact; +var body1MovingLeft; +var body1MovingRight; +var body1Stationary; +var body2MovingLeft; +var body2MovingRight; +var body2Stationary; +var body1OnLeft; +var body2OnLeft; +var overlap; + +/** + * Sets all of the local processing values and calculates the velocity exchanges. + * + * Then runs `BlockCheck` and returns the value from it. + * + * This method is called by `Phaser.Physics.Arcade.SeparateX` and should not be + * called directly. + * + * @function Phaser.Physics.Arcade.ProcessX.Set + * @ignore + * @since 3.50.0 + * + * @param {Phaser.Physics.Arcade.Body} b1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} b2 - The second Body to separate. + * @param {number} ov - The overlap value. + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var Set = function (b1, b2, ov) +{ + body1 = b1; + body2 = b2; + + var v1 = body1.velocity.x; + var v2 = body2.velocity.x; + + body1Pushable = body1.pushable; + body1MovingLeft = body1._dx < 0; + body1MovingRight = body1._dx > 0; + body1Stationary = body1._dx === 0; + body1OnLeft = Math.abs(body1.right - body2.x) <= Math.abs(body2.right - body1.x); + body1FullImpact = v2 - v1 * body1.bounce.x; + + body2Pushable = body2.pushable; + body2MovingLeft = body2._dx < 0; + body2MovingRight = body2._dx > 0; + body2Stationary = body2._dx === 0; + body2OnLeft = !body1OnLeft; + body2FullImpact = v1 - v2 * body2.bounce.x; + + // negative delta = up, positive delta = down (inc. gravity) + overlap = Math.abs(ov); + + return BlockCheck(); +}; + +/** + * Blocked Direction checks, because it doesn't matter if an object can be pushed + * or not, blocked is blocked. + * + * @function Phaser.Physics.Arcade.ProcessX.BlockCheck + * @ignore + * @since 3.50.0 + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var BlockCheck = function () +{ + // Body1 is moving right and Body2 is blocked from going right any further + if (body1MovingRight && body1OnLeft && body2.blocked.right) + { + body1.processX(-overlap, body1FullImpact, false, true); + + return 1; + } + + // Body1 is moving up and Body2 is blocked from going up any further + if (body1MovingLeft && body2OnLeft && body2.blocked.left) + { + body1.processX(overlap, body1FullImpact, true); + + return 1; + } + + // Body2 is moving right and Body1 is blocked from going right any further + if (body2MovingRight && body2OnLeft && body1.blocked.right) + { + body2.processX(-overlap, body2FullImpact, false, true); + + return 2; + } + + // Body2 is moving up and Body1 is blocked from going up any further + if (body2MovingLeft && body1OnLeft && body1.blocked.left) + { + body2.processX(overlap, body2FullImpact, true); + + return 2; + } + + return 0; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessX.Check + * @ignore + * @since 3.50.0 + * + * @return {boolean} `true` if a check passed, otherwise `false`. + */ +var Check = function () +{ + var v1 = body1.velocity.x; + var v2 = body2.velocity.x; + + var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); + var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); + var avg = (nv1 + nv2) * 0.5; + + nv1 -= avg; + nv2 -= avg; + + body1MassImpact = avg + nv1 * body1.bounce.x; + body2MassImpact = avg + nv2 * body2.bounce.x; + + // Body1 hits Body2 on the right hand side + if (body1MovingLeft && body2OnLeft) + { + return Run(0); + } + + // Body2 hits Body1 on the right hand side + if (body2MovingLeft && body1OnLeft) + { + return Run(1); + } + + // Body1 hits Body2 on the left hand side + if (body1MovingRight && body1OnLeft) + { + return Run(2); + } + + // Body2 hits Body1 on the left hand side + if (body2MovingRight && body2OnLeft) + { + return Run(3); + } + + return false; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessX.Run + * @ignore + * @since 3.50.0 + * + * @param {number} side - The side to test. As passed in by the `Check` function. + * + * @return {boolean} Always returns `true`. + */ +var Run = function (side) +{ + if (body1Pushable && body2Pushable) + { + // Both pushable, or both moving at the same time, so equal rebound + overlap *= 0.5; + + if (side === 0 || side === 3) + { + // body1MovingLeft && body2OnLeft + // body2MovingRight && body2OnLeft + body1.processX(overlap, body1MassImpact); + body2.processX(-overlap, body2MassImpact); + } + else + { + // body2MovingLeft && body1OnLeft + // body1MovingRight && body1OnLeft + body1.processX(-overlap, body1MassImpact); + body2.processX(overlap, body2MassImpact); + } + } + else if (body1Pushable && !body2Pushable) + { + // Body1 pushable, Body2 not + + if (side === 0 || side === 3) + { + // body1MovingLeft && body2OnLeft + // body2MovingRight && body2OnLeft + body1.processX(overlap, body1FullImpact, true); + } + else + { + // body2MovingLeft && body1OnLeft + // body1MovingRight && body1OnLeft + body1.processX(-overlap, body1FullImpact, false, true); + } + } + else if (!body1Pushable && body2Pushable) + { + // Body2 pushable, Body1 not + + if (side === 0 || side === 3) + { + // body1MovingLeft && body2OnLeft + // body2MovingRight && body2OnLeft + body2.processX(-overlap, body2FullImpact, false, true); + } + else + { + // body2MovingLeft && body1OnLeft + // body1MovingRight && body1OnLeft + body2.processX(overlap, body2FullImpact, true); + } + } + else + { + // Neither body is pushable, so base it on movement + + var halfOverlap = overlap * 0.5; + + if (side === 0) + { + // body1MovingLeft && body2OnLeft + + if (body2Stationary) + { + body1.processX(overlap, 0, true); + body2.processX(0, null, false, true); + } + else if (body2MovingRight) + { + body1.processX(halfOverlap, 0, true); + body2.processX(-halfOverlap, 0, false, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processX(halfOverlap, body2.velocity.x, true); + body2.processX(-halfOverlap, null, false, true); + } + } + else if (side === 1) + { + // body2MovingLeft && body1OnLeft + + if (body1Stationary) + { + body1.processX(0, null, false, true); + body2.processX(overlap, 0, true); + } + else if (body1MovingRight) + { + body1.processX(-halfOverlap, 0, false, true); + body2.processX(halfOverlap, 0, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processX(-halfOverlap, null, false, true); + body2.processX(halfOverlap, body1.velocity.x, true); + } + } + else if (side === 2) + { + // body1MovingRight && body1OnLeft + + if (body2Stationary) + { + body1.processX(-overlap, 0, false, true); + body2.processX(0, null, true); + } + else if (body2MovingLeft) + { + body1.processX(-halfOverlap, 0, false, true); + body2.processX(halfOverlap, 0, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processX(-halfOverlap, body2.velocity.x, false, true); + body2.processX(halfOverlap, null, true); + } + } + else if (side === 3) + { + // body2MovingRight && body2OnLeft + + if (body1Stationary) + { + body1.processX(0, null, true); + body2.processX(-overlap, 0, false, true); + } + else if (body1MovingLeft) + { + body1.processX(halfOverlap, 0, true); + body2.processX(-halfOverlap, 0, false, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processX(halfOverlap, body2.velocity.y, true); + body2.processX(-halfOverlap, null, false, true); + } + } + } + + return true; +}; + +/** + * This function is run when Body1 is Immovable and Body2 is not. + * + * @function Phaser.Physics.Arcade.ProcessX.RunImmovableBody1 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody1 = function (blockedState) +{ + if (blockedState === 1) + { + // But Body2 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body2.velocity.x = 0; + } + else if (body1OnLeft) + { + body2.processX(overlap, body2FullImpact, true); + } + else + { + body2.processX(-overlap, body2FullImpact, false, true); + } + + // This is special case code that handles things like vertically moving platforms you can ride + if (body1.moves) + { + body2.y += (body1.y - body1.prev.y) * body1.friction.y; + body2._dy = body2.y - body2.prev.y; + } +}; + +/** + * This function is run when Body2 is Immovable and Body1 is not. + * + * @function Phaser.Physics.Arcade.ProcessX.RunImmovableBody2 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody2 = function (blockedState) +{ + if (blockedState === 2) + { + // But Body1 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body1.velocity.x = 0; + } + if (body2OnLeft) + { + body1.processX(overlap, body1FullImpact, true); + } + else + { + body1.processX(-overlap, body1FullImpact, false, true); + } + + // This is special case code that handles things like vertically moving platforms you can ride + if (body2.moves) + { + body1.y += (body2.y - body2.prev.y) * body2.friction.y; + body1._dy = body1.y - body1.prev.y; + } +}; + +/** + * @namespace Phaser.Physics.Arcade.ProcessX + * @ignore + */ + +module.exports = { + BlockCheck: BlockCheck, + Check: Check, + Set: Set, + Run: Run, + RunImmovableBody1: RunImmovableBody1, + RunImmovableBody2: RunImmovableBody2 +}; + + +/***/ }), +/* 1370 */ +/***/ (function(module, exports) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var body1; +var body2; +var body1Pushable; +var body2Pushable; +var body1MassImpact; +var body2MassImpact; +var body1FullImpact; +var body2FullImpact; +var body1MovingUp; +var body1MovingDown; +var body1Stationary; +var body2MovingUp; +var body2MovingDown; +var body2Stationary; +var body1OnTop; +var body2OnTop; +var overlap; + +/** + * Sets all of the local processing values and calculates the velocity exchanges. + * + * Then runs `BlockCheck` and returns the value from it. + * + * This method is called by `Phaser.Physics.Arcade.SeparateY` and should not be + * called directly. + * + * @function Phaser.Physics.Arcade.ProcessY.Set + * @ignore + * @since 3.50.0 + * + * @param {Phaser.Physics.Arcade.Body} b1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} b2 - The second Body to separate. + * @param {number} ov - The overlap value. + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var Set = function (b1, b2, ov) +{ + body1 = b1; + body2 = b2; + + var v1 = body1.velocity.y; + var v2 = body2.velocity.y; + + body1Pushable = body1.pushable; + body1MovingUp = body1._dy < 0; + body1MovingDown = body1._dy > 0; + body1Stationary = body1._dy === 0; + body1OnTop = Math.abs(body1.bottom - body2.y) <= Math.abs(body2.bottom - body1.y); + body1FullImpact = v2 - v1 * body1.bounce.y; + + body2Pushable = body2.pushable; + body2MovingUp = body2._dy < 0; + body2MovingDown = body2._dy > 0; + body2Stationary = body2._dy === 0; + body2OnTop = !body1OnTop; + body2FullImpact = v1 - v2 * body2.bounce.y; + + // negative delta = up, positive delta = down (inc. gravity) + overlap = Math.abs(ov); + + return BlockCheck(); +}; + +/** + * Blocked Direction checks, because it doesn't matter if an object can be pushed + * or not, blocked is blocked. + * + * @function Phaser.Physics.Arcade.ProcessY.BlockCheck + * @ignore + * @since 3.50.0 + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var BlockCheck = function () +{ + // Body1 is moving down and Body2 is blocked from going down any further + if (body1MovingDown && body1OnTop && body2.blocked.down) + { + body1.processY(-overlap, body1FullImpact, false, true); + + return 1; + } + + // Body1 is moving up and Body2 is blocked from going up any further + if (body1MovingUp && body2OnTop && body2.blocked.up) + { + body1.processY(overlap, body1FullImpact, true); + + return 1; + } + + // Body2 is moving down and Body1 is blocked from going down any further + if (body2MovingDown && body2OnTop && body1.blocked.down) + { + body2.processY(-overlap, body2FullImpact, false, true); + + return 2; + } + + // Body2 is moving up and Body1 is blocked from going up any further + if (body2MovingUp && body1OnTop && body1.blocked.up) + { + body2.processY(overlap, body2FullImpact, true); + + return 2; + } + + return 0; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessY.Check + * @ignore + * @since 3.50.0 + * + * @return {boolean} `true` if a check passed, otherwise `false`. + */ +var Check = function () +{ + var v1 = body1.velocity.y; + var v2 = body2.velocity.y; + + var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); + var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); + var avg = (nv1 + nv2) * 0.5; + + nv1 -= avg; + nv2 -= avg; + + body1MassImpact = avg + nv1 * body1.bounce.y; + body2MassImpact = avg + nv2 * body2.bounce.y; + + // Body1 hits Body2 on the bottom side + if (body1MovingUp && body2OnTop) + { + return Run(0); + } + + // Body2 hits Body1 on the bottom side + if (body2MovingUp && body1OnTop) + { + return Run(1); + } + + // Body1 hits Body2 on the top side + if (body1MovingDown && body1OnTop) + { + return Run(2); + } + + // Body2 hits Body1 on the top side + if (body2MovingDown && body2OnTop) + { + return Run(3); + } + + return false; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessY.Run + * @ignore + * @since 3.50.0 + * + * @param {number} side - The side to test. As passed in by the `Check` function. + * + * @return {boolean} Always returns `true`. + */ +var Run = function (side) +{ + if (body1Pushable && body2Pushable) + { + // Both pushable, or both moving at the same time, so equal rebound + overlap *= 0.5; + + if (side === 0 || side === 3) + { + // body1MovingUp && body2OnTop + // body2MovingDown && body2OnTop + body1.processY(overlap, body1MassImpact); + body2.processY(-overlap, body2MassImpact); + } + else + { + // body2MovingUp && body1OnTop + // body1MovingDown && body1OnTop + body1.processY(-overlap, body1MassImpact); + body2.processY(overlap, body2MassImpact); + } + } + else if (body1Pushable && !body2Pushable) + { + // Body1 pushable, Body2 not + + if (side === 0 || side === 3) + { + // body1MovingUp && body2OnTop + // body2MovingDown && body2OnTop + body1.processY(overlap, body1FullImpact, true); + } + else + { + // body2MovingUp && body1OnTop + // body1MovingDown && body1OnTop + body1.processY(-overlap, body1FullImpact, false, true); + } + } + else if (!body1Pushable && body2Pushable) + { + // Body2 pushable, Body1 not + + if (side === 0 || side === 3) + { + // body1MovingUp && body2OnTop + // body2MovingDown && body2OnTop + body2.processY(-overlap, body2FullImpact, false, true); + } + else + { + // body2MovingUp && body1OnTop + // body1MovingDown && body1OnTop + body2.processY(overlap, body2FullImpact, true); + } + } + else + { + // Neither body is pushable, so base it on movement + + var halfOverlap = overlap * 0.5; + + if (side === 0) + { + // body1MovingUp && body2OnTop + + if (body2Stationary) + { + body1.processY(overlap, 0, true); + body2.processY(0, null, false, true); + } + else if (body2MovingDown) + { + body1.processY(halfOverlap, 0, true); + body2.processY(-halfOverlap, 0, false, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processY(halfOverlap, body2.velocity.y, true); + body2.processY(-halfOverlap, null, false, true); + } + } + else if (side === 1) + { + // body2MovingUp && body1OnTop + + if (body1Stationary) + { + body1.processY(0, null, false, true); + body2.processY(overlap, 0, true); + } + else if (body1MovingDown) + { + body1.processY(-halfOverlap, 0, false, true); + body2.processY(halfOverlap, 0, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processY(-halfOverlap, null, false, true); + body2.processY(halfOverlap, body1.velocity.y, true); + } + } + else if (side === 2) + { + // body1MovingDown && body1OnTop + + if (body2Stationary) + { + body1.processY(-overlap, 0, false, true); + body2.processY(0, null, true); + } + else if (body2MovingUp) + { + body1.processY(-halfOverlap, 0, false, true); + body2.processY(halfOverlap, 0, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processY(-halfOverlap, body2.velocity.y, false, true); + body2.processY(halfOverlap, null, true); + } + } + else if (side === 3) + { + // body2MovingDown && body2OnTop + + if (body1Stationary) + { + body1.processY(0, null, true); + body2.processY(-overlap, 0, false, true); + } + else if (body1MovingUp) + { + body1.processY(halfOverlap, 0, true); + body2.processY(-halfOverlap, 0, false, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processY(halfOverlap, body2.velocity.y, true); + body2.processY(-halfOverlap, null, false, true); + } + } + } + + return true; +}; + +/** + * This function is run when Body1 is Immovable and Body2 is not. + * + * @function Phaser.Physics.Arcade.ProcessY.RunImmovableBody1 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody1 = function (blockedState) +{ + if (blockedState === 1) + { + // But Body2 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body2.velocity.y = 0; + } + else if (body1OnTop) + { + body2.processY(overlap, body2FullImpact, true); + } + else + { + body2.processY(-overlap, body2FullImpact, false, true); + } + + // This is special case code that handles things like horizontally moving platforms you can ride + if (body1.moves) + { + body2.x += (body1.x - body1.prev.x) * body1.friction.x; + body2._dx = body2.x - body2.prev.x; + } +}; + +/** + * This function is run when Body2 is Immovable and Body1 is not. + * + * @function Phaser.Physics.Arcade.ProcessY.RunImmovableBody2 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody2 = function (blockedState) +{ + if (blockedState === 2) + { + // But Body1 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body1.velocity.y = 0; + } + else if (body2OnTop) + { + body1.processY(overlap, body1FullImpact, true); + } + else + { + body1.processY(-overlap, body1FullImpact, false, true); + } + + // This is special case code that handles things like horizontally moving platforms you can ride + if (body2.moves) + { + body1.x += (body2.x - body2.prev.x) * body2.friction.x; + body1._dx = body1.x - body1.prev.x; + } +}; + +/** + * @namespace Phaser.Physics.Arcade.ProcessY + * @ignore + */ + +module.exports = { + BlockCheck: BlockCheck, + Check: Check, + Set: Set, + Run: Run, + RunImmovableBody1: RunImmovableBody1, + RunImmovableBody2: RunImmovableBody2 +}; + + +/***/ }), +/* 1371 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -184058,13 +194829,13 @@ module.exports = 'worldstep'; var Tilemap = { - ProcessTileCallbacks: __webpack_require__(490), - ProcessTileSeparationX: __webpack_require__(494), - ProcessTileSeparationY: __webpack_require__(496), - SeparateTile: __webpack_require__(492), - TileCheckX: __webpack_require__(493), - TileCheckY: __webpack_require__(495), - TileIntersectsBody: __webpack_require__(233) + ProcessTileCallbacks: __webpack_require__(507), + ProcessTileSeparationX: __webpack_require__(511), + ProcessTileSeparationY: __webpack_require__(513), + SeparateTile: __webpack_require__(509), + TileCheckX: __webpack_require__(510), + TileCheckY: __webpack_require__(512), + TileIntersectsBody: __webpack_require__(240) }; @@ -184072,7 +194843,7 @@ module.exports = Tilemap; /***/ }), -/* 1306 */ +/* 1372 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -184083,11 +194854,11 @@ module.exports = Tilemap; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(116); -var Body = __webpack_require__(64); -var Common = __webpack_require__(44); +var Bodies = __webpack_require__(124); +var Body = __webpack_require__(68); +var Common = __webpack_require__(50); var GetFastValue = __webpack_require__(2); -var Vertices = __webpack_require__(88); +var Vertices = __webpack_require__(93); /** * Use PhysicsEditorParser.parseBody() to build a Matter body object, based on a physics data file @@ -184214,7 +194985,7 @@ module.exports = PhysicsEditorParser; /***/ }), -/* 1307 */ +/* 1373 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -184223,8 +194994,8 @@ module.exports = PhysicsEditorParser; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(116); -var Body = __webpack_require__(64); +var Bodies = __webpack_require__(124); +var Body = __webpack_require__(68); /** * Creates a body using the supplied physics data, as provided by a JSON file. @@ -184331,7 +195102,7 @@ module.exports = PhysicsJSONParser; /***/ }), -/* 1308 */ +/* 1374 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -184347,11 +195118,11 @@ var Composites = {}; module.exports = Composites; -var Composite = __webpack_require__(158); -var Constraint = __webpack_require__(234); -var Common = __webpack_require__(44); -var Body = __webpack_require__(64); -var Bodies = __webpack_require__(116); +var Composite = __webpack_require__(159); +var Constraint = __webpack_require__(241); +var Common = __webpack_require__(50); +var Body = __webpack_require__(68); +var Bodies = __webpack_require__(124); (function() { @@ -184664,7 +195435,7 @@ var Bodies = __webpack_require__(116); /***/ }), -/* 1309 */ +/* 1375 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -184681,8 +195452,8 @@ var Svg = {}; module.exports = Svg; -var Bounds = __webpack_require__(103); -var Common = __webpack_require__(44); +var Bounds = __webpack_require__(115); +var Common = __webpack_require__(50); (function() { @@ -184895,7 +195666,7 @@ var Common = __webpack_require__(44); })(); /***/ }), -/* 1310 */ +/* 1376 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -184904,14 +195675,14 @@ var Common = __webpack_require__(44); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(116); -var Body = __webpack_require__(64); +var Bodies = __webpack_require__(124); +var Body = __webpack_require__(68); var Class = __webpack_require__(0); -var Components = __webpack_require__(500); -var EventEmitter = __webpack_require__(12); +var Components = __webpack_require__(517); +var EventEmitter = __webpack_require__(10); var GetFastValue = __webpack_require__(2); -var HasValue = __webpack_require__(115); -var Vertices = __webpack_require__(88); +var HasValue = __webpack_require__(123); +var Vertices = __webpack_require__(93); /** * @classdesc @@ -185215,7 +195986,7 @@ module.exports = MatterTileBody; /***/ }), -/* 1311 */ +/* 1377 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185228,36 +195999,36 @@ module.exports = MatterTileBody; * @namespace Phaser.Physics.Matter.Matter */ -var Matter = __webpack_require__(1410); +var Matter = __webpack_require__(1472); -Matter.Body = __webpack_require__(64); -Matter.Composite = __webpack_require__(158); -Matter.World = __webpack_require__(1313); +Matter.Body = __webpack_require__(68); +Matter.Composite = __webpack_require__(159); +Matter.World = __webpack_require__(1379); -Matter.Detector = __webpack_require__(544); -Matter.Grid = __webpack_require__(1314); -Matter.Pairs = __webpack_require__(1315); -Matter.Pair = __webpack_require__(501); -Matter.Query = __webpack_require__(1411); -Matter.Resolver = __webpack_require__(1316); -Matter.SAT = __webpack_require__(545); +Matter.Detector = __webpack_require__(583); +Matter.Grid = __webpack_require__(1380); +Matter.Pairs = __webpack_require__(1381); +Matter.Pair = __webpack_require__(518); +Matter.Query = __webpack_require__(1473); +Matter.Resolver = __webpack_require__(1382); +Matter.SAT = __webpack_require__(584); -Matter.Constraint = __webpack_require__(234); +Matter.Constraint = __webpack_require__(241); -Matter.Common = __webpack_require__(44); -Matter.Engine = __webpack_require__(1412); -Matter.Events = __webpack_require__(251); -Matter.Sleeping = __webpack_require__(250); -Matter.Plugin = __webpack_require__(1312); +Matter.Common = __webpack_require__(50); +Matter.Engine = __webpack_require__(1474); +Matter.Events = __webpack_require__(266); +Matter.Sleeping = __webpack_require__(265); +Matter.Plugin = __webpack_require__(1378); -Matter.Bodies = __webpack_require__(116); -Matter.Composites = __webpack_require__(1308); +Matter.Bodies = __webpack_require__(124); +Matter.Composites = __webpack_require__(1374); -Matter.Axes = __webpack_require__(542); -Matter.Bounds = __webpack_require__(103); -Matter.Svg = __webpack_require__(1309); -Matter.Vector = __webpack_require__(102); -Matter.Vertices = __webpack_require__(88); +Matter.Axes = __webpack_require__(581); +Matter.Bounds = __webpack_require__(115); +Matter.Svg = __webpack_require__(1375); +Matter.Vector = __webpack_require__(114); +Matter.Vertices = __webpack_require__(93); // aliases @@ -185272,7 +196043,7 @@ module.exports = Matter; /***/ }), -/* 1312 */ +/* 1378 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185285,7 +196056,7 @@ var Plugin = {}; module.exports = Plugin; -var Common = __webpack_require__(44); +var Common = __webpack_require__(50); (function() { @@ -185622,7 +196393,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 1313 */ +/* 1379 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185642,9 +196413,9 @@ var World = {}; module.exports = World; -var Composite = __webpack_require__(158); -var Constraint = __webpack_require__(234); -var Common = __webpack_require__(44); +var Composite = __webpack_require__(159); +var Constraint = __webpack_require__(241); +var Common = __webpack_require__(50); (function() { @@ -185775,7 +196546,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 1314 */ +/* 1380 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -185788,9 +196559,9 @@ var Grid = {}; module.exports = Grid; -var Pair = __webpack_require__(501); -var Detector = __webpack_require__(544); -var Common = __webpack_require__(44); +var Pair = __webpack_require__(518); +var Detector = __webpack_require__(583); +var Common = __webpack_require__(50); (function() { @@ -186102,7 +196873,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 1315 */ +/* 1381 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -186115,8 +196886,8 @@ var Pairs = {}; module.exports = Pairs; -var Pair = __webpack_require__(501); -var Common = __webpack_require__(44); +var Pair = __webpack_require__(518); +var Common = __webpack_require__(50); (function() { @@ -186267,7 +197038,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 1316 */ +/* 1382 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -186280,10 +197051,10 @@ var Resolver = {}; module.exports = Resolver; -var Vertices = __webpack_require__(88); -var Vector = __webpack_require__(102); -var Common = __webpack_require__(44); -var Bounds = __webpack_require__(103); +var Vertices = __webpack_require__(93); +var Vector = __webpack_require__(114); +var Common = __webpack_require__(50); +var Bounds = __webpack_require__(115); (function() { @@ -186623,7 +197394,7 @@ var Bounds = __webpack_require__(103); /***/ }), -/* 1317 */ +/* 1383 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -186638,17 +197409,17 @@ var Bounds = __webpack_require__(103); module.exports = { - BasePlugin: __webpack_require__(502), - DefaultPlugins: __webpack_require__(184), - PluginCache: __webpack_require__(23), - PluginManager: __webpack_require__(381), - ScenePlugin: __webpack_require__(1318) + BasePlugin: __webpack_require__(519), + DefaultPlugins: __webpack_require__(189), + PluginCache: __webpack_require__(25), + PluginManager: __webpack_require__(391), + ScenePlugin: __webpack_require__(1384) }; /***/ }), -/* 1318 */ +/* 1384 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -186657,7 +197428,7 @@ module.exports = { * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} */ -var BasePlugin = __webpack_require__(502); +var BasePlugin = __webpack_require__(519); var Class = __webpack_require__(0); var SceneEvents = __webpack_require__(20); @@ -186776,7 +197547,7 @@ module.exports = ScenePlugin; /***/ }), -/* 1319 */ +/* 1385 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -186785,8 +197556,8 @@ module.exports = ScenePlugin; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(19); -var CONST = __webpack_require__(187); +var Extend = __webpack_require__(18); +var CONST = __webpack_require__(192); /** * @namespace Phaser.Scale @@ -186814,12 +197585,12 @@ var CONST = __webpack_require__(187); var Scale = { - Center: __webpack_require__(370), - Events: __webpack_require__(94), - Orientation: __webpack_require__(371), - ScaleManager: __webpack_require__(382), - ScaleModes: __webpack_require__(372), - Zoom: __webpack_require__(373) + Center: __webpack_require__(380), + Events: __webpack_require__(101), + Orientation: __webpack_require__(381), + ScaleManager: __webpack_require__(392), + ScaleModes: __webpack_require__(382), + Zoom: __webpack_require__(383) }; @@ -186832,7 +197603,7 @@ module.exports = Scale; /***/ }), -/* 1320 */ +/* 1386 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -186841,8 +197612,8 @@ module.exports = Scale; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(133); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(139); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Scenes @@ -186851,12 +197622,12 @@ var Extend = __webpack_require__(19); var Scene = { Events: __webpack_require__(20), - GetPhysicsPlugins: __webpack_require__(386), - GetScenePlugins: __webpack_require__(387), - SceneManager: __webpack_require__(384), - ScenePlugin: __webpack_require__(1321), - Settings: __webpack_require__(388), - Systems: __webpack_require__(190) + GetPhysicsPlugins: __webpack_require__(396), + GetScenePlugins: __webpack_require__(397), + SceneManager: __webpack_require__(394), + ScenePlugin: __webpack_require__(1387), + Settings: __webpack_require__(398), + Systems: __webpack_require__(195) }; @@ -186867,7 +197638,7 @@ module.exports = Scene; /***/ }), -/* 1321 */ +/* 1387 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -186876,11 +197647,11 @@ module.exports = Scene; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); var Class = __webpack_require__(0); var Events = __webpack_require__(20); var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); /** * @classdesc @@ -186958,7 +197729,7 @@ var ScenePlugin = new Class({ * Transition elapsed timer. * * @name Phaser.Scenes.ScenePlugin#_elapsed - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -186978,7 +197749,7 @@ var ScenePlugin = new Class({ * Transition duration. * * @name Phaser.Scenes.ScenePlugin#_duration - * @type {integer} + * @type {number} * @private * @since 3.5.0 */ @@ -187823,7 +198594,7 @@ var ScenePlugin = new Class({ * * @param {(string|Phaser.Scene)} [key] - The Scene to get the index of. * - * @return {integer} The index of the Scene. + * @return {number} The index of the Scene. */ getIndex: function (key) { @@ -187877,7 +198648,7 @@ module.exports = ScenePlugin; /***/ }), -/* 1322 */ +/* 1388 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -187892,19 +198663,19 @@ module.exports = ScenePlugin; module.exports = { - Events: __webpack_require__(405), - List: __webpack_require__(137), - Map: __webpack_require__(92), - ProcessQueue: __webpack_require__(197), - RTree: __webpack_require__(491), - Set: __webpack_require__(141), - Size: __webpack_require__(383) + Events: __webpack_require__(415), + List: __webpack_require__(105), + Map: __webpack_require__(98), + ProcessQueue: __webpack_require__(202), + RTree: __webpack_require__(508), + Set: __webpack_require__(145), + Size: __webpack_require__(393) }; /***/ }), -/* 1323 */ +/* 1389 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -187913,8 +198684,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(19); -var FilterMode = __webpack_require__(1324); +var Extend = __webpack_require__(18); +var FilterMode = __webpack_require__(1390); /** * @namespace Phaser.Textures @@ -187924,7 +198695,7 @@ var FilterMode = __webpack_require__(1324); * Linear filter type. * * @name Phaser.Textures.LINEAR - * @type {integer} + * @type {number} * @const * @since 3.0.0 */ @@ -187933,21 +198704,21 @@ var FilterMode = __webpack_require__(1324); * Nearest Neighbor filter type. * * @name Phaser.Textures.NEAREST - * @type {integer} + * @type {number} * @const * @since 3.0.0 */ var Textures = { - CanvasTexture: __webpack_require__(390), - Events: __webpack_require__(130), + CanvasTexture: __webpack_require__(400), + Events: __webpack_require__(136), FilterMode: FilterMode, - Frame: __webpack_require__(97), - Parsers: __webpack_require__(392), - Texture: __webpack_require__(192), - TextureManager: __webpack_require__(389), - TextureSource: __webpack_require__(391) + Frame: __webpack_require__(104), + Parsers: __webpack_require__(402), + Texture: __webpack_require__(197), + TextureManager: __webpack_require__(399), + TextureSource: __webpack_require__(401) }; @@ -187957,7 +198728,7 @@ module.exports = Textures; /***/ }), -/* 1324 */ +/* 1390 */ /***/ (function(module, exports) { /** @@ -187979,7 +198750,7 @@ var CONST = { * Linear filter type. * * @name Phaser.Textures.FilterMode.LINEAR - * @type {integer} + * @type {number} * @const * @since 3.0.0 */ @@ -187989,7 +198760,7 @@ var CONST = { * Nearest neighbor filter type. * * @name Phaser.Textures.FilterMode.NEAREST - * @type {integer} + * @type {number} * @const * @since 3.0.0 */ @@ -188001,7 +198772,7 @@ module.exports = CONST; /***/ }), -/* 1325 */ +/* 1391 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188010,36 +198781,47 @@ module.exports = CONST; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Extend = __webpack_require__(18); +var CONST = __webpack_require__(1392); + /** * @namespace Phaser.Tilemaps + * + * @borrows Phaser.Tilemaps.Orientation.ORTHOGONAL as ORTHOGONAL + * @borrows Phaser.Tilemaps.Orientation.ISOMETRIC as ISOMETRIC + * @borrows Phaser.Tilemaps.Orientation.STAGGERED as STAGGERED + * @borrows Phaser.Tilemaps.Orientation.HEXAGONAL as HEXAGONAL */ -module.exports = { +var Tilemaps = { - Components: __webpack_require__(149), - Parsers: __webpack_require__(1355), + Components: __webpack_require__(243), + Parsers: __webpack_require__(1425), - Formats: __webpack_require__(33), - ImageCollection: __webpack_require__(513), - ParseToTilemap: __webpack_require__(240), - Tile: __webpack_require__(75), - Tilemap: __webpack_require__(522), - TilemapCreator: __webpack_require__(1369), - TilemapFactory: __webpack_require__(1370), - Tileset: __webpack_require__(107), + Formats: __webpack_require__(38), + ImageCollection: __webpack_require__(555), + ParseToTilemap: __webpack_require__(253), + Tile: __webpack_require__(81), + Tilemap: __webpack_require__(559), + TilemapCreator: __webpack_require__(1431), + TilemapFactory: __webpack_require__(1432), + Tileset: __webpack_require__(119), + TilemapLayer: __webpack_require__(560), + Orientation: __webpack_require__(29), - LayerData: __webpack_require__(105), - MapData: __webpack_require__(106), - ObjectLayer: __webpack_require__(516), - - DynamicTilemapLayer: __webpack_require__(523), - StaticTilemapLayer: __webpack_require__(524) + LayerData: __webpack_require__(117), + MapData: __webpack_require__(118), + ObjectLayer: __webpack_require__(551) }; +Tilemaps = Extend(false, Tilemaps, CONST.ORIENTATION); + +module.exports = Tilemaps; + /***/ }), -/* 1326 */ +/* 1392 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188048,8 +198830,28 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var CalculateFacesWithin = __webpack_require__(53); +var CONST = { + + FromOrientationString: __webpack_require__(242), + ORIENTATION: __webpack_require__(29) + +}; + +module.exports = CONST; + + +/***/ }), +/* 1393 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTilesWithin = __webpack_require__(26); +var CalculateFacesWithin = __webpack_require__(60); /** * Copies the tiles in the source rectangular area to a new destination (all specified in tile @@ -188059,20 +198861,21 @@ var CalculateFacesWithin = __webpack_require__(53); * @function Phaser.Tilemaps.Components.Copy * @since 3.0.0 * - * @param {integer} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. - * @param {integer} width - The width of the area to copy, in tiles, not pixels. - * @param {integer} height - The height of the area to copy, in tiles, not pixels. - * @param {integer} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. - * @param {integer} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. + * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. + * @param {number} width - The width of the area to copy, in tiles, not pixels. + * @param {number} height - The height of the area to copy, in tiles, not pixels. + * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. + * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var Copy = function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer) { + if (recalculateFaces === undefined) { recalculateFaces = true; } + if (srcTileX < 0) { srcTileX = 0; } if (srcTileY < 0) { srcTileY = 0; } - if (recalculateFaces === undefined) { recalculateFaces = true; } var srcTiles = GetTilesWithin(srcTileX, srcTileY, width, height, null, layer); @@ -188104,7 +198907,7 @@ module.exports = Copy; /***/ }), -/* 1327 */ +/* 1394 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188113,10 +198916,8 @@ module.exports = Copy; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileToWorldX = __webpack_require__(151); -var TileToWorldY = __webpack_require__(152); -var GetTilesWithin = __webpack_require__(24); -var ReplaceByIndex = __webpack_require__(503); +var GetTilesWithin = __webpack_require__(26); +var ReplaceByIndex = __webpack_require__(521); /** * Creates a Sprite for every object matching the given tile indexes in the layer. You can @@ -188130,15 +198931,15 @@ var ReplaceByIndex = __webpack_require__(503); * @param {(number|number[])} indexes - The tile index, or array of indexes, to create Sprites from. * @param {(number|number[])} replacements - The tile index, or array of indexes, to change a converted tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a one-to-one mapping with the indexes array. * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). - * @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when determining the world XY + * @param {Phaser.Scene} scene - The Scene to create the Sprites within. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when determining the world XY * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. */ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, camera, layer) { - if (spriteConfig === undefined) { spriteConfig = {}; } + if (!spriteConfig) { spriteConfig = {}; } if (!Array.isArray(indexes)) { @@ -188147,8 +198948,8 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came var tilemapLayer = layer.tilemapLayer; - if (scene === undefined) { scene = tilemapLayer.scene; } - if (camera === undefined) { camera = scene.cameras.main; } + if (!scene) { scene = tilemapLayer.scene; } + if (!camera) { camera = scene.cameras.main; } var tiles = GetTilesWithin(0, 0, layer.width, layer.height, null, layer); var sprites = []; @@ -188160,8 +198961,10 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came if (indexes.indexOf(tile.index) !== -1) { - spriteConfig.x = TileToWorldX(tile.x, camera, layer); - spriteConfig.y = TileToWorldY(tile.y, camera, layer); + var point = tilemapLayer.tileToWorldXY(tile.x, tile.y, undefined, camera,layer); + + spriteConfig.x = point.x; + spriteConfig.y = point.y; sprites.push(scene.make.sprite(spriteConfig)); } @@ -188191,7 +198994,7 @@ module.exports = CreateFromTiles; /***/ }), -/* 1328 */ +/* 1395 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188200,165 +199003,9 @@ module.exports = CreateFromTiles; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SnapFloor = __webpack_require__(95); -var SnapCeil = __webpack_require__(343); - -/** - * Returns the tiles in the given layer that are within the camera's viewport. This is used internally. - * - * @function Phaser.Tilemaps.Components.CullTiles - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. - * @param {array} [outputArray] - An optional array to store the Tile objects within. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ -var CullTiles = function (layer, camera, outputArray, renderOrder) -{ - if (outputArray === undefined) { outputArray = []; } - if (renderOrder === undefined) { renderOrder = 0; } - - outputArray.length = 0; - - var tilemap = layer.tilemapLayer.tilemap; - var tilemapLayer = layer.tilemapLayer; - - var mapData = layer.data; - var mapWidth = layer.width; - var mapHeight = layer.height; - - // We need to use the tile sizes defined for the map as a whole, not the layer, - // in order to calculate the bounds correctly. As different sized tiles may be - // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. - var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); - var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); - - var drawLeft = 0; - var drawRight = mapWidth; - var drawTop = 0; - var drawBottom = mapHeight; - - if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) - { - // Camera world view bounds, snapped for scaled tile size - // Cull Padding values are given in tiles, not pixels - - var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; - var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; - var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH, 0, true) - tilemapLayer.cullPaddingY; - var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH, 0, true) + tilemapLayer.cullPaddingY; - - drawLeft = Math.max(0, boundsLeft); - drawRight = Math.min(mapWidth, boundsRight); - drawTop = Math.max(0, boundsTop); - drawBottom = Math.min(mapHeight, boundsBottom); - } - - var x; - var y; - var tile; - - if (renderOrder === 0) - { - // right-down - - for (y = drawTop; y < drawBottom; y++) - { - for (x = drawLeft; mapData[y] && x < drawRight; x++) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - else if (renderOrder === 1) - { - // left-down - - for (y = drawTop; y < drawBottom; y++) - { - for (x = drawRight; mapData[y] && x >= drawLeft; x--) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - else if (renderOrder === 2) - { - // right-up - - for (y = drawBottom; y >= drawTop; y--) - { - for (x = drawLeft; mapData[y] && x < drawRight; x++) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - else if (renderOrder === 3) - { - // left-up - - for (y = drawBottom; y >= drawTop; y--) - { - for (x = drawRight; mapData[y] && x >= drawLeft; x--) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - - tilemapLayer.tilesDrawn = outputArray.length; - tilemapLayer.tilesTotal = mapWidth * mapHeight; - - return outputArray; -}; - -module.exports = CullTiles; - - -/***/ }), -/* 1329 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var GetTilesWithin = __webpack_require__(24); -var CalculateFacesWithin = __webpack_require__(53); -var SetTileCollision = __webpack_require__(65); +var GetTilesWithin = __webpack_require__(26); +var CalculateFacesWithin = __webpack_require__(60); +var SetTileCollision = __webpack_require__(69); /** * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the @@ -188368,11 +199015,11 @@ var SetTileCollision = __webpack_require__(65); * @function Phaser.Tilemaps.Components.Fill * @since 3.0.0 * - * @param {integer} index - The tile index to fill the area with. - * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} width - How many tiles wide from the `tileX` index the area will be. - * @param {integer} height - How many tiles tall from the `tileY` index the area will be. + * @param {number} index - The tile index to fill the area with. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The tile layer to use. If not given the current layer is used. */ @@ -188400,7 +199047,7 @@ module.exports = Fill; /***/ }), -/* 1330 */ +/* 1396 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188409,7 +199056,7 @@ module.exports = Fill; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given @@ -188422,15 +199069,12 @@ var GetTilesWithin = __webpack_require__(24); * @param {function} callback - The callback. Each tile in the given area will be passed to this * callback as the first and only parameter. The callback should return true for tiles that pass the * filter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} context - The context under which the callback should be run. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile[]} The filtered array of Tiles. @@ -188446,7 +199090,7 @@ module.exports = FilterTiles; /***/ }), -/* 1331 */ +/* 1397 */ /***/ (function(module, exports) { /** @@ -188465,10 +199109,9 @@ module.exports = FilterTiles; * @function Phaser.Tilemaps.Components.FindByIndex * @since 3.0.0 * - * @param {integer} index - The tile index value to search for. - * @param {integer} [skip=0] - The number of times to skip a matching tile before returning. - * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the - * bottom-right. Otherwise it scans from the top-left. + * @param {number} index - The tile index value to search for. + * @param {number} skip - The number of times to skip a matching tile before returning. + * @param {boolean} reverse - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {?Phaser.Tilemaps.Tile} The first (or n skipped) tile with the matching index. @@ -188533,7 +199176,7 @@ module.exports = FindByIndex; /***/ }), -/* 1332 */ +/* 1398 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188542,13 +199185,13 @@ module.exports = FindByIndex; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * @callback FindTileCallback * * @param {Phaser.Tilemaps.Tile} value - The Tile. - * @param {integer} index - The index of the tile. + * @param {number} index - The index of the tile. * @param {Phaser.Tilemaps.Tile[]} array - An array of Tile objects. * * @return {boolean} Return `true` if the callback should run, otherwise `false`. @@ -188563,15 +199206,12 @@ var GetTilesWithin = __webpack_require__(24); * @since 3.0.0 * * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} context - The context under which the callback should be run. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {?Phaser.Tilemaps.Tile} A Tile that matches the search, or null if no Tile found @@ -188579,6 +199219,7 @@ var GetTilesWithin = __webpack_require__(24); var FindTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) { var tiles = GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); + return tiles.find(callback, context) || null; }; @@ -188586,7 +199227,7 @@ module.exports = FindTile; /***/ }), -/* 1333 */ +/* 1399 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188595,13 +199236,13 @@ module.exports = FindTile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * @callback EachTileCallback * * @param {Phaser.Tilemaps.Tile} value - The Tile. - * @param {integer} index - The index of the tile. + * @param {number} index - The index of the tile. * @param {Phaser.Tilemaps.Tile[]} array - An array of Tile objects. */ @@ -188613,15 +199254,12 @@ var GetTilesWithin = __webpack_require__(24); * @since 3.0.0 * * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. + * @param {object} context - The context under which the callback should be run. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var ForEachTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) @@ -188635,7 +199273,7 @@ module.exports = ForEachTile; /***/ }), -/* 1334 */ +/* 1400 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188644,9 +199282,64 @@ module.exports = ForEachTile; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTileAt = __webpack_require__(150); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var CONST = __webpack_require__(29); +var CullTiles = __webpack_require__(523); +var HexagonalCullTiles = __webpack_require__(524); +var IsometricCullTiles = __webpack_require__(526); +var NOOP = __webpack_require__(1); +var StaggeredCullTiles = __webpack_require__(527); + +/** + * Gets the correct function to use to cull tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetCullTilesFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to cull tiles for the given map type. + */ +var GetCullTilesFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return CullTiles; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalCullTiles; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredCullTiles; + } + else if (orientation === CONST.ISOMETRIC) + { + return IsometricCullTiles; + } + else + { + return NOOP; + } +}; + +module.exports = GetCullTilesFunction; + + +/***/ }), +/* 1401 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTileAt = __webpack_require__(151); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); /** * Gets a tile at the given world coordinates from the given layer. @@ -188656,26 +199349,24 @@ var WorldToTileY = __webpack_require__(67); * * @param {number} worldX - X position to get the tile from (given in pixels) * @param {number} worldY - Y position to get the tile from (given in pixels) - * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} nonNull - If true, function won't return null for empty tiles, but a Tile object with an index of -1. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates - * were invalid. + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. */ var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer) { - var tileX = WorldToTileX(worldX, true, camera, layer); - var tileY = WorldToTileY(worldY, true, camera, layer); + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera); - return GetTileAt(tileX, tileY, nonNull, layer); + return GetTileAt(point.x, point.y, nonNull, layer); }; module.exports = GetTileAtWorldXY; /***/ }), -/* 1335 */ +/* 1402 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188684,22 +199375,20 @@ module.exports = GetTileAtWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Geom = __webpack_require__(448); -var GetTilesWithin = __webpack_require__(24); -var Intersects = __webpack_require__(449); +var Geom = __webpack_require__(460); +var GetTilesWithin = __webpack_require__(26); +var Intersects = __webpack_require__(461); var NOOP = __webpack_require__(1); -var TileToWorldX = __webpack_require__(151); -var TileToWorldY = __webpack_require__(152); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var Vector2 = __webpack_require__(3); var TriangleToRectangle = function (triangle, rect) { return Intersects.RectangleToTriangle(rect, triangle); }; -// Note: Could possibly be optimized by copying the shape and shifting it into tilemapLayer -// coordinates instead of shifting the tiles. +var point = new Vector2(); +var pointStart = new Vector2(); +var pointEnd = new Vector2(); /** * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, @@ -188709,11 +199398,8 @@ var TriangleToRectangle = function (triangle, rect) * @since 3.0.0 * * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. @@ -188725,45 +199411,40 @@ var GetTilesWithinShape = function (shape, filteringOptions, camera, layer) // intersectTest is a function with parameters: shape, rect var intersectTest = NOOP; - switch (typeof(shape)) + if (shape instanceof Geom.Circle) { - case Geom.Circle: - { - intersectTest = Intersects.CircleToRectangle; - break; - } - - case Geom.Rectangle: - { - intersectTest = Intersects.RectangleToRectangle; - break; - } - - case Geom.Triangle: - { - intersectTest = TriangleToRectangle; - break; - } - - case Geom.Line: - { - intersectTest = Intersects.LineToRectangle; - break; - } + intersectTest = Intersects.CircleToRectangle; + } + else if (shape instanceof Geom.Rectangle) + { + intersectTest = Intersects.RectangleToRectangle; + } + else if (shape instanceof Geom.Triangle) + { + intersectTest = TriangleToRectangle; + } + else if (shape instanceof Geom.Line) + { + intersectTest = Intersects.LineToRectangle; } // Top left corner of the shapes's bounding box, rounded down to include partial tiles - var xStart = WorldToTileX(shape.left, true, camera, layer); - var yStart = WorldToTileY(shape.top, true, camera, layer); + layer.tilemapLayer.worldToTileXY(shape.left, shape.top, true, pointStart, camera); + + var xStart = pointStart.x; + var yStart = pointStart.y; // Bottom right corner of the shapes's bounding box, rounded up to include partial tiles - var xEnd = Math.ceil(WorldToTileX(shape.right, false, camera, layer)); - var yEnd = Math.ceil(WorldToTileY(shape.bottom, false, camera, layer)); + layer.tilemapLayer.worldToTileXY(shape.right, shape.bottom, true, pointEnd, camera); + + var xEnd = Math.ceil(pointEnd.x); + var yEnd = Math.ceil(pointEnd.y); // Tiles within bounding rectangle of shape. Bounds are forced to be at least 1 x 1 tile in size // to grab tiles for shapes that don't have a height or width (e.g. a horizontal line). var width = Math.max(xEnd - xStart, 1); var height = Math.max(yEnd - yStart, 1); + var tiles = GetTilesWithin(xStart, yStart, width, height, filteringOptions, layer); var tileWidth = layer.tileWidth; @@ -188782,8 +199463,10 @@ var GetTilesWithinShape = function (shape, filteringOptions, camera, layer) { var tile = tiles[i]; - tileRect.x = TileToWorldX(tile.x, camera, layer); - tileRect.y = TileToWorldY(tile.y, camera, layer); + layer.tilemapLayer.tileToWorldXY(tile.x, tile.y, point, camera); + + tileRect.x = point.x; + tileRect.y = point.y; if (intersectTest(shape, tileRect)) { @@ -188798,7 +199481,7 @@ module.exports = GetTilesWithinShape; /***/ }), -/* 1336 */ +/* 1403 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188807,47 +199490,37 @@ module.exports = GetTilesWithinShape; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var CONST = __webpack_require__(29); +var NOOP = __webpack_require__(1); +var TileToWorldX = __webpack_require__(245); /** - * Gets the tiles in the given rectangular area (in world coordinates) of the layer. + * Gets the correct function to use to translate tiles, based on the map orientation. * - * @function Phaser.Tilemaps.Components.GetTilesWithinWorldXY - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.GetTileToWorldXFunction + * @since 3.50.0 * - * @param {number} worldX - The world x coordinate for the top-left of the area. - * @param {number} worldY - The world y coordinate for the top-left of the area. - * @param {number} width - The width of the area. - * @param {number} height - The height of the area. - * @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. - * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least one side. - * @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {number} orientation - The Tilemap orientation constant. * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + * @return {function} The function to use to translate tiles for the given map type. */ -var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer) +var GetTileToWorldXFunction = function (orientation) { - // Top left corner of the rect, rounded down to include partial tiles - var xStart = WorldToTileX(worldX, true, camera, layer); - var yStart = WorldToTileY(worldY, true, camera, layer); - - // Bottom right corner of the rect, rounded up to include partial tiles - var xEnd = Math.ceil(WorldToTileX(worldX + width, false, camera, layer)); - var yEnd = Math.ceil(WorldToTileY(worldY + height, false, camera, layer)); - - return GetTilesWithin(xStart, yStart, xEnd - xStart, yEnd - yStart, filteringOptions, layer); + if (orientation === CONST.ORTHOGONAL) + { + return TileToWorldX; + } + else + { + return NOOP; + } }; -module.exports = GetTilesWithinWorldXY; +module.exports = GetTileToWorldXFunction; /***/ }), -/* 1337 */ +/* 1404 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188856,9 +199529,255 @@ module.exports = GetTilesWithinWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HasTileAt = __webpack_require__(504); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var CONST = __webpack_require__(29); +var HexagonalTileToWorldXY = __webpack_require__(529); +var IsometricTileToWorldXY = __webpack_require__(530); +var NOOP = __webpack_require__(1); +var StaggeredTileToWorldXY = __webpack_require__(531); +var TileToWorldXY = __webpack_require__(532); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetTileToWorldXYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetTileToWorldXYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return TileToWorldXY; + } + else if (orientation === CONST.ISOMETRIC) + { + return IsometricTileToWorldXY; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalTileToWorldXY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredTileToWorldXY; + } + else + { + return NOOP; + } +}; + +module.exports = GetTileToWorldXYFunction; + + +/***/ }), +/* 1405 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(29); +var HexagonalTileToWorldY = __webpack_require__(533); +var NOOP = __webpack_require__(1); +var StaggeredTileToWorldY = __webpack_require__(534); +var TileToWorldY = __webpack_require__(246); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetTileToWorldYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetTileToWorldYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return TileToWorldY; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalTileToWorldY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredTileToWorldY; + } + else + { + return NOOP; + } +}; + +module.exports = GetTileToWorldYFunction; + + +/***/ }), +/* 1406 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(29); +var NOOP = __webpack_require__(1); +var WorldToTileX = __webpack_require__(247); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetWorldToTileXFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetWorldToTileXFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return WorldToTileX; + } + else + { + return NOOP; + } +}; + +module.exports = GetWorldToTileXFunction; + + +/***/ }), +/* 1407 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(29); +var HexagonalWorldToTileXY = __webpack_require__(535); +var IsometricWorldToTileXY = __webpack_require__(536); +var NOOP = __webpack_require__(1); +var StaggeredWorldToTileXY = __webpack_require__(537); +var WorldToTileXY = __webpack_require__(538); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetWorldToTileXYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetWorldToTileXYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return WorldToTileXY; + } + else if (orientation === CONST.ISOMETRIC) + { + return IsometricWorldToTileXY; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalWorldToTileXY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredWorldToTileXY; + } + else + { + return NOOP; + } +}; + +module.exports = GetWorldToTileXYFunction; + + +/***/ }), +/* 1408 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(29); +var HexagonalWorldToTileY = __webpack_require__(539); +var NOOP = __webpack_require__(1); +var StaggeredWorldToTileY = __webpack_require__(540); +var WorldToTileY = __webpack_require__(248); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetWorldToTileYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetWorldToTileYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return WorldToTileY; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalWorldToTileY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredWorldToTileY; + } + else + { + return NOOP; + } +}; + +module.exports = GetWorldToTileYFunction; + + +/***/ }), +/* 1409 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var HasTileAt = __webpack_require__(541); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); /** * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns @@ -188869,15 +199788,17 @@ var WorldToTileY = __webpack_require__(67); * * @param {number} worldX - The X coordinate of the world position. * @param {number} worldY - The Y coordinate of the world position. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when factoring in which tiles to return. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ var HasTileAtWorldXY = function (worldX, worldY, camera, layer) { - var tileX = WorldToTileX(worldX, true, camera, layer); - var tileY = WorldToTileY(worldY, true, camera, layer); + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera); + + var tileX = point.x; + var tileY = point.y; return HasTileAt(tileX, tileY, layer); }; @@ -188886,7 +199807,7 @@ module.exports = HasTileAtWorldXY; /***/ }), -/* 1338 */ +/* 1410 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188895,9 +199816,10 @@ module.exports = HasTileAtWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PutTileAt = __webpack_require__(236); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var PutTileAt = __webpack_require__(249); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); /** * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either @@ -188908,28 +199830,27 @@ var WorldToTileY = __webpack_require__(67); * @function Phaser.Tilemaps.Components.PutTileAtWorldXY * @since 3.0.0 * - * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. */ var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer) { - var tileX = WorldToTileX(worldX, true, camera, layer); - var tileY = WorldToTileY(worldY, true, camera, layer); + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera, layer); - return PutTileAt(tile, tileX, tileY, recalculateFaces, layer); + return PutTileAt(tile, point.x, point.y, recalculateFaces, layer); }; module.exports = PutTileAtWorldXY; /***/ }), -/* 1339 */ +/* 1411 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -188938,8 +199859,8 @@ module.exports = PutTileAtWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CalculateFacesWithin = __webpack_require__(53); -var PutTileAt = __webpack_require__(236); +var CalculateFacesWithin = __webpack_require__(60); +var PutTileAt = __webpack_require__(249); /** * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified @@ -188951,17 +199872,21 @@ var PutTileAt = __webpack_require__(236); * @function Phaser.Tilemaps.Components.PutTilesAt * @since 3.0.0 * - * @param {(integer[]|integer[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer) { - if (!Array.isArray(tilesArray)) { return null; } if (recalculateFaces === undefined) { recalculateFaces = true; } + if (!Array.isArray(tilesArray)) + { + return null; + } + // Force the input array to be a 2D array if (!Array.isArray(tilesArray[0])) { @@ -188992,7 +199917,7 @@ module.exports = PutTilesAt; /***/ }), -/* 1340 */ +/* 1412 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189001,8 +199926,8 @@ module.exports = PutTilesAt; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var GetRandom = __webpack_require__(196); +var GetTilesWithin = __webpack_require__(26); +var GetRandom = __webpack_require__(201); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -189014,20 +199939,20 @@ var GetRandom = __webpack_require__(196); * @function Phaser.Tilemaps.Components.Randomize * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {number[]} indexes - An array of indexes to randomly draw from during randomization. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var Randomize = function (tileX, tileY, width, height, indexes, layer) { var i; - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + var tiles = GetTilesWithin(tileX, tileY, width, height, {}, layer); // If no indices are given, then find all the unique indexes within the specified region - if (indexes === undefined) + if (!indexes) { indexes = []; @@ -189050,7 +199975,7 @@ module.exports = Randomize; /***/ }), -/* 1341 */ +/* 1413 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189059,9 +199984,10 @@ module.exports = Randomize; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RemoveTileAt = __webpack_require__(505); -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); +var RemoveTileAt = __webpack_require__(542); +var Vector2 = __webpack_require__(3); + +var point = new Vector2(); /** * Removes the tile at the given world coordinates in the specified layer and updates the layer's @@ -189072,26 +199998,25 @@ var WorldToTileY = __webpack_require__(67); * * @param {number} worldX - The x coordinate, in pixels. * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. + * @param {boolean} replaceWithNull - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {Phaser.Tilemaps.Tile} The Tile object that was removed. */ var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer) { - var tileX = WorldToTileX(worldX, true, camera, layer); - var tileY = WorldToTileY(worldY, true, camera, layer); + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera, layer); - return RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer); + return RemoveTileAt(point.x, point.y, replaceWithNull, recalculateFaces, layer); }; module.exports = RemoveTileAtWorldXY; /***/ }), -/* 1342 */ +/* 1414 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189100,8 +200025,8 @@ module.exports = RemoveTileAtWorldXY; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var Color = __webpack_require__(364); +var GetTilesWithin = __webpack_require__(26); +var Color = __webpack_require__(373); var defaultTileColor = new Color(105, 210, 231, 150); var defaultCollidingTileColor = new Color(243, 134, 48, 200); @@ -189117,13 +200042,7 @@ var defaultFaceColor = new Color(40, 39, 37, 150); * @since 3.0.0 * * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {object} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {?Phaser.Display.Color} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at - * non-colliding tile locations. If set to null, non-colliding tiles will not be drawn. - * @param {?Phaser.Display.Color} [styleConfig.collidingTileColor=orange] - Color to use for drawing a filled - * rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn. - * @param {?Phaser.Display.Color} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting - * tile faces. If set to null, interesting tile faces will not be drawn. + * @param {Phaser.Types.Tilemaps.DebugStyleOptions} styleConfig - An object specifying the colors to use for the debug drawing. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var RenderDebug = function (graphics, styleConfig, layer) @@ -189179,7 +200098,7 @@ module.exports = RenderDebug; /***/ }), -/* 1343 */ +/* 1415 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189188,8 +200107,8 @@ module.exports = RenderDebug; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); var SetLayerCollisionIndex = __webpack_require__(153); /** @@ -189200,20 +200119,23 @@ var SetLayerCollisionIndex = __webpack_require__(153); * @function Phaser.Tilemaps.Components.SetCollision * @since 3.0.0 * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {boolean} updateLayer - If true, updates the current tiles on the layer. Set to - * false if no tiles have been placed for significant performance boost. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. */ var SetCollision = function (indexes, collides, recalculateFaces, layer, updateLayer) { if (collides === undefined) { collides = true; } if (recalculateFaces === undefined) { recalculateFaces = true; } - if (!Array.isArray(indexes)) { indexes = [ indexes ]; } if (updateLayer === undefined) { updateLayer = true; } + if (!Array.isArray(indexes)) + { + indexes = [ indexes ]; + } + // Update the array of colliding indexes for (var i = 0; i < indexes.length; i++) { @@ -189247,7 +200169,7 @@ module.exports = SetCollision; /***/ }), -/* 1344 */ +/* 1416 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189256,8 +200178,8 @@ module.exports = SetCollision; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); var SetLayerCollisionIndex = __webpack_require__(153); /** @@ -189269,13 +200191,12 @@ var SetLayerCollisionIndex = __webpack_require__(153); * @function Phaser.Tilemaps.Components.SetCollisionBetween * @since 3.0.0 * - * @param {integer} start - The first index of the tile to be set for collision. - * @param {integer} stop - The last index of the tile to be set for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {number} start - The first index of the tile to be set for collision. + * @param {number} stop - The last index of the tile to be set for collision. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to - * false if no tiles have been placed for significant performance boost. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. */ var SetCollisionBetween = function (start, stop, collides, recalculateFaces, layer, updateLayer) { @@ -189283,15 +200204,18 @@ var SetCollisionBetween = function (start, stop, collides, recalculateFaces, lay if (recalculateFaces === undefined) { recalculateFaces = true; } if (updateLayer === undefined) { updateLayer = true; } - if (start > stop) { return; } + if (start > stop) + { + return; + } - // Update the array of colliding indexes + // Update the array of colliding indexes for (var index = start; index <= stop; index++) { SetLayerCollisionIndex(index, collides, layer); } - // Update the tiles + // Update the tiles if (updateLayer) { for (var ty = 0; ty < layer.height; ty++) @@ -189321,7 +200245,7 @@ module.exports = SetCollisionBetween; /***/ }), -/* 1345 */ +/* 1417 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189330,8 +200254,8 @@ module.exports = SetCollisionBetween; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); var SetLayerCollisionIndex = __webpack_require__(153); /** @@ -189342,16 +200266,20 @@ var SetLayerCollisionIndex = __webpack_require__(153); * @function Phaser.Tilemaps.Components.SetCollisionByExclusion * @since 3.0.0 * - * @param {integer[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SetCollisionByExclusion = function (indexes, collides, recalculateFaces, layer) { if (collides === undefined) { collides = true; } if (recalculateFaces === undefined) { recalculateFaces = true; } - if (!Array.isArray(indexes)) { indexes = [ indexes ]; } + + if (!Array.isArray(indexes)) + { + indexes = [ indexes ]; + } // Note: this only updates layer.collideIndexes for tile indexes found currently in the layer for (var ty = 0; ty < layer.height; ty++) @@ -189359,6 +200287,7 @@ var SetCollisionByExclusion = function (indexes, collides, recalculateFaces, lay for (var tx = 0; tx < layer.width; tx++) { var tile = layer.data[ty][tx]; + if (tile && indexes.indexOf(tile.index) === -1) { SetTileCollision(tile, collides); @@ -189377,7 +200306,7 @@ module.exports = SetCollisionByExclusion; /***/ }), -/* 1346 */ +/* 1418 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189386,9 +200315,9 @@ module.exports = SetCollisionByExclusion; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); -var HasValue = __webpack_require__(115); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); +var HasValue = __webpack_require__(123); /** * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property @@ -189403,8 +200332,8 @@ var HasValue = __webpack_require__(115); * @since 3.0.0 * * @param {object} properties - An object with tile properties and corresponding values that should be checked. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SetCollisionByProperty = function (properties, collides, recalculateFaces, layer) @@ -189425,6 +200354,7 @@ var SetCollisionByProperty = function (properties, collides, recalculateFaces, l if (!HasValue(tile.properties, property)) { continue; } var values = properties[property]; + if (!Array.isArray(values)) { values = [ values ]; @@ -189451,7 +200381,7 @@ module.exports = SetCollisionByProperty; /***/ }), -/* 1347 */ +/* 1419 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189460,8 +200390,8 @@ module.exports = SetCollisionByProperty; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTileCollision = __webpack_require__(65); -var CalculateFacesWithin = __webpack_require__(53); +var SetTileCollision = __webpack_require__(69); +var CalculateFacesWithin = __webpack_require__(60); /** * Sets collision on the tiles within a layer by checking each tile's collision group data @@ -189472,8 +200402,8 @@ var CalculateFacesWithin = __webpack_require__(53); * @function Phaser.Tilemaps.Components.SetCollisionFromCollisionGroup * @since 3.0.0 * - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SetCollisionFromCollisionGroup = function (collides, recalculateFaces, layer) @@ -189510,7 +200440,7 @@ module.exports = SetCollisionFromCollisionGroup; /***/ }), -/* 1348 */ +/* 1420 */ /***/ (function(module, exports) { /** @@ -189528,7 +200458,7 @@ module.exports = SetCollisionFromCollisionGroup; * @function Phaser.Tilemaps.Components.SetTileIndexCallback * @since 3.0.0 * - * @param {(integer|array)} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. @@ -189556,7 +200486,7 @@ module.exports = SetTileIndexCallback; /***/ }), -/* 1349 */ +/* 1421 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189565,7 +200495,7 @@ module.exports = SetTileIndexCallback; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. @@ -189575,10 +200505,10 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.SetTileLocationCallback * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. @@ -189597,7 +200527,7 @@ module.exports = SetTileLocationCallback; /***/ }), -/* 1350 */ +/* 1422 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189606,8 +200536,8 @@ module.exports = SetTileLocationCallback; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); -var ShuffleArray = __webpack_require__(121); +var GetTilesWithin = __webpack_require__(26); +var ShuffleArray = __webpack_require__(127); /** * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given @@ -189618,10 +200548,10 @@ var ShuffleArray = __webpack_require__(121); * @function Phaser.Tilemaps.Components.Shuffle * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var Shuffle = function (tileX, tileY, width, height, layer) @@ -189642,7 +200572,7 @@ module.exports = Shuffle; /***/ }), -/* 1351 */ +/* 1423 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189651,7 +200581,7 @@ module.exports = Shuffle; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching @@ -189661,12 +200591,12 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.SwapByIndex * @since 3.0.0 * - * @param {integer} tileA - First tile index. - * @param {integer} tileB - Second tile index. - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. + * @param {number} tileA - First tile index. + * @param {number} tileB - Second tile index. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var SwapByIndex = function (indexA, indexB, tileX, tileY, width, height, layer) @@ -189693,7 +200623,7 @@ module.exports = SwapByIndex; /***/ }), -/* 1352 */ +/* 1424 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189702,50 +200632,7 @@ module.exports = SwapByIndex; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileToWorldX = __webpack_require__(151); -var TileToWorldY = __webpack_require__(152); -var Vector2 = __webpack_require__(3); - -/** - * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @function Phaser.Tilemaps.Components.TileToWorldXY - * @since 3.0.0 - * - * @param {integer} tileX - The x coordinate, in tiles, not pixels. - * @param {integer} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Math.Vector2} The XY location in world coordinates. - */ -var TileToWorldXY = function (tileX, tileY, point, camera, layer) -{ - if (point === undefined) { point = new Vector2(0, 0); } - - point.x = TileToWorldX(tileX, camera, layer); - point.y = TileToWorldY(tileY, camera, layer); - - return point; -}; - -module.exports = TileToWorldXY; - - -/***/ }), -/* 1353 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var GetTilesWithin = __webpack_require__(24); +var GetTilesWithin = __webpack_require__(26); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -189765,23 +200652,24 @@ var GetTilesWithin = __webpack_require__(24); * @function Phaser.Tilemaps.Components.WeightedRandomize * @since 3.0.0 * - * @param {integer} [tileX=0] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be. - * @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be. - * @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {object[]} weightedIndexes - An array of objects to randomly draw from during * randomization. They should be in the form: { index: 0, weight: 4 } or * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ var WeightedRandomize = function (tileX, tileY, width, height, weightedIndexes, layer) { - if (weightedIndexes === undefined) { return; } + if (!weightedIndexes) { return; } var i; var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); var weightTotal = 0; + for (i = 0; i < weightedIndexes.length; i++) { weightTotal += weightedIndexes[i].weight; @@ -189818,51 +200706,7 @@ module.exports = WeightedRandomize; /***/ }), -/* 1354 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var WorldToTileX = __webpack_require__(66); -var WorldToTileY = __webpack_require__(67); -var Vector2 = __webpack_require__(3); - -/** - * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @function Phaser.Tilemaps.Components.WorldToTileXY - * @since 3.0.0 - * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Math.Vector2} The XY location in tile units. - */ -var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) -{ - if (point === undefined) { point = new Vector2(0, 0); } - - point.x = WorldToTileX(worldX, snapToFloor, camera, layer); - point.y = WorldToTileY(worldY, snapToFloor, camera, layer); - - return point; -}; - -module.exports = WorldToTileXY; - - -/***/ }), -/* 1355 */ +/* 1425 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189877,18 +200721,18 @@ module.exports = WorldToTileXY; module.exports = { - Parse: __webpack_require__(506), - Parse2DArray: __webpack_require__(237), - ParseCSV: __webpack_require__(507), + Parse: __webpack_require__(543), + Parse2DArray: __webpack_require__(250), + ParseCSV: __webpack_require__(544), - Impact: __webpack_require__(1356), - Tiled: __webpack_require__(1357) + Impact: __webpack_require__(1426), + Tiled: __webpack_require__(1427) }; /***/ }), -/* 1356 */ +/* 1426 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189903,15 +200747,15 @@ module.exports = { module.exports = { - ParseTileLayers: __webpack_require__(520), - ParseTilesets: __webpack_require__(521), - ParseWeltmeister: __webpack_require__(519) + ParseTileLayers: __webpack_require__(557), + ParseTilesets: __webpack_require__(558), + ParseWeltmeister: __webpack_require__(556) }; /***/ }), -/* 1357 */ +/* 1427 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189926,23 +200770,23 @@ module.exports = { module.exports = { - AssignTileProperties: __webpack_require__(518), - Base64Decode: __webpack_require__(510), - BuildTilesetIndex: __webpack_require__(517), + AssignTileProperties: __webpack_require__(546), + Base64Decode: __webpack_require__(553), + BuildTilesetIndex: __webpack_require__(547), CreateGroupLayer: __webpack_require__(154), - ParseGID: __webpack_require__(238), - ParseImageLayers: __webpack_require__(511), - ParseJSONTiled: __webpack_require__(508), - ParseObject: __webpack_require__(239), - ParseObjectLayers: __webpack_require__(515), - ParseTileLayers: __webpack_require__(509), - ParseTilesets: __webpack_require__(512) + ParseGID: __webpack_require__(252), + ParseImageLayers: __webpack_require__(548), + ParseJSONTiled: __webpack_require__(545), + ParseObject: __webpack_require__(251), + ParseObjectLayers: __webpack_require__(549), + ParseTileLayers: __webpack_require__(552), + ParseTilesets: __webpack_require__(554) }; /***/ }), -/* 1358 */ +/* 1428 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189956,12 +200800,12 @@ var renderCanvas = __webpack_require__(1); if (true) { - renderWebGL = __webpack_require__(1359); + renderWebGL = __webpack_require__(1429); } if (true) { - renderCanvas = __webpack_require__(1360); + renderCanvas = __webpack_require__(1430); } module.exports = { @@ -189973,7 +200817,7 @@ module.exports = { /***/ }), -/* 1359 */ +/* 1429 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -189982,27 +200826,25 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(10); +var Utils = __webpack_require__(12); /** * Renders this Game Object with the WebGL Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. * This method should not be called directly. It is a utility function of the Render module. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#renderWebGL + * @method Phaser.Tilemaps.TilemapLayer#renderWebGL * @since 3.0.0 * @private * * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.Tilemaps.DynamicTilemapLayer} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Tilemaps.TilemapLayer} src - The Game Object being rendered in this call. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ -var DynamicTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera) +var TilemapLayerWebGLRenderer = function (renderer, src, camera) { - src.cull(camera); + var renderTiles = src.cull(camera); - var renderTiles = src.culledTiles; var tileCount = renderTiles.length; var alpha = camera.alpha * src.alpha; @@ -190012,9 +200854,9 @@ var DynamicTilemapLayerWebGLRenderer = function (renderer, src, interpolationPer } var gidMap = src.gidMap; - var pipeline = renderer.pipelines.set(src.pipeline); + var pipeline = renderer.pipelines.set(src.pipeline, src); - var getTint = Utils.getTintAppendFloatAlphaAndSwap; + var getTint = Utils.getTintAppendFloatAlpha; var scrollFactorX = src.scrollFactorX; var scrollFactorY = src.scrollFactorY; @@ -190025,75 +200867,66 @@ var DynamicTilemapLayerWebGLRenderer = function (renderer, src, interpolationPer var sx = src.scaleX; var sy = src.scaleY; - var tilesets = src.tileset; + renderer.pipelines.preBatch(src); - // Loop through each tileset in this layer, drawing just the tiles that are in that set each time - // Doing it this way around allows us to batch tiles using the same tileset - for (var c = 0; c < tilesets.length; c++) + for (var i = 0; i < tileCount; i++) { - var currentSet = tilesets[c]; - var texture = currentSet.glTexture; + var tile = renderTiles[i]; + + var tileset = gidMap[tile.index]; + + var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); + + if (tileTexCoords === null) + { + continue; + } + + var texture = tileset.glTexture; + var textureUnit = pipeline.setTexture2D(texture, src); - for (var i = 0; i < tileCount; i++) - { - var tile = renderTiles[i]; + var frameWidth = tileset.tileWidth; + var frameHeight = tileset.tileHeight; - var tileset = gidMap[tile.index]; + var frameX = tileTexCoords.x; + var frameY = tileTexCoords.y; - if (tileset !== currentSet) - { - // Skip tiles that aren't in this set - continue; - } + var tw = tileset.tileWidth * 0.5; + var th = tileset.tileHeight * 0.5; - var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); + var tint = getTint(tile.tint, alpha * tile.alpha); - if (tileTexCoords === null) - { - continue; - } - - var frameWidth = tile.width; - var frameHeight = tile.height; - - var frameX = tileTexCoords.x; - var frameY = tileTexCoords.y; - - var tw = tile.width * 0.5; - var th = tile.height * 0.5; - - var tint = getTint(tile.tint, alpha * tile.alpha); - - pipeline.batchTexture( - src, - texture, - texture.width, texture.height, - x + ((tw + tile.pixelX) * sx), y + ((th + tile.pixelY) * sy), - tile.width, tile.height, - sx, sy, - tile.rotation, - tile.flipX, tile.flipY, - scrollFactorX, scrollFactorY, - tw, th, - frameX, frameY, frameWidth, frameHeight, - tint, tint, tint, tint, false, - 0, 0, - camera, - null, - true, - textureUnit - ); - } + pipeline.batchTexture( + src, + texture, + texture.width, texture.height, + x + ((tw + tile.pixelX) * sx), y + ((th + tile.pixelY) * sy), + tile.width, tile.height, + sx, sy, + tile.rotation, + tile.flipX, tile.flipY, + scrollFactorX, scrollFactorY, + tw, th, + frameX, frameY, frameWidth, frameHeight, + tint, tint, tint, tint, false, + 0, 0, + camera, + null, + true, + textureUnit + ); } + + renderer.pipelines.postBatch(src); }; -module.exports = DynamicTilemapLayerWebGLRenderer; +module.exports = TilemapLayerWebGLRenderer; /***/ }), -/* 1360 */ -/***/ (function(module, exports) { +/* 1430 */ +/***/ (function(module, exports, __webpack_require__) { /** * @author Richard Davey @@ -190101,36 +200934,41 @@ module.exports = DynamicTilemapLayerWebGLRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var TransformMatrix = __webpack_require__(24); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); + /** * Renders this Game Object with the Canvas Renderer to the given Camera. * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. * This method should not be called directly. It is a utility function of the Render module. * - * @method Phaser.Tilemaps.DynamicTilemapLayer#renderCanvas - * @since 3.0.0 + * @method Phaser.Tilemaps.TilemapLayer#renderCanvas + * @since 3.50.0 * @private * * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.Tilemaps.DynamicTilemapLayer} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. + * @param {Phaser.Tilemaps.TilemapLayer} src - The Game Object being rendered in this call. * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var DynamicTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) +var TilemapLayerCanvasRenderer = function (renderer, src, camera, parentMatrix) { - src.cull(camera); + var renderTiles = src.cull(camera); - var renderTiles = src.culledTiles; var tileCount = renderTiles.length; + var alpha = camera.alpha * src.alpha; - if (tileCount === 0) + if (tileCount === 0 || alpha <= 0) { return; } - var camMatrix = renderer._tempMatrix1; - var layerMatrix = renderer._tempMatrix2; - var calcMatrix = renderer._tempMatrix3; + var camMatrix = tempMatrix1; + var layerMatrix = tempMatrix2; + var calcMatrix = tempMatrix3; layerMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); @@ -190163,8 +201001,6 @@ var DynamicTilemapLayerCanvasRenderer = function (renderer, src, interpolationPe layerMatrix.copyToContext(ctx); } - var alpha = camera.alpha * src.alpha; - if (!renderer.antialias || src.scaleX > 1 || src.scaleY > 1) { ctx.imageSmoothingEnabled = false; @@ -190186,482 +201022,9 @@ var DynamicTilemapLayerCanvasRenderer = function (renderer, src, interpolationPe if (tileTexCoords) { - var halfWidth = tile.width / 2; - var halfHeight = tile.height / 2; - - ctx.save(); + var halfWidth = tileset.tileWidth / 2; + var halfHeight = tileset.tileHeight / 2; - ctx.translate(tile.pixelX + halfWidth, tile.pixelY + halfHeight); - - if (tile.rotation !== 0) - { - ctx.rotate(tile.rotation); - } - - if (tile.flipX || tile.flipY) - { - ctx.scale((tile.flipX) ? -1 : 1, (tile.flipY) ? -1 : 1); - } - - ctx.globalAlpha = alpha * tile.alpha; - - ctx.drawImage( - image, - tileTexCoords.x, tileTexCoords.y, - tile.width, tile.height, - -halfWidth, -halfHeight, - tile.width, tile.height - ); - - ctx.restore(); - } - } - - ctx.restore(); -}; - -module.exports = DynamicTilemapLayerCanvasRenderer; - - -/***/ }), -/* 1361 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); - -if (true) -{ - renderWebGL = __webpack_require__(1362); -} - -if (true) -{ - renderCanvas = __webpack_require__(1368); -} - -module.exports = { - - renderWebGL: renderWebGL, - renderCanvas: renderCanvas - -}; - - -/***/ }), -/* 1362 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Identity = __webpack_require__(1363); -var Scale = __webpack_require__(1365); -var Translate = __webpack_require__(1366); -var ViewLoad2D = __webpack_require__(1367); - -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * A Static Tilemap Layer renders immediately and does not use any batching. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.Tilemaps.StaticTilemapLayer} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var StaticTilemapLayerWebGLRenderer = function (renderer, src, interpolationPercentage, camera) -{ - var gl = renderer.gl; - var pipeline = src.pipeline; - - renderer.flush(); - - // Restore when we're done - var pipelineVertexBuffer = pipeline.vertexBuffer; - - Identity(src); - Translate(src, src.x - (camera.scrollX * src.scrollFactorX), src.y - (camera.scrollY * src.scrollFactorY), 0); - Scale(src, src.scaleX, src.scaleY, 1); - ViewLoad2D(src, camera.matrix.matrix); - - renderer.pipelines.set(pipeline); - - // The above alters the uniforms, so make sure we call it _after_ setting the MVP stuff above - renderer.setMatrix4(pipeline.program, 'uModelMatrix', false, src.modelMatrix); - renderer.setMatrix4(pipeline.program, 'uViewMatrix', false, src.viewMatrix); - renderer.setMatrix4(pipeline.program, 'uProjectionMatrix', false, pipeline.projectionMatrix); - - for (var i = 0; i < src.tileset.length; i++) - { - var tileset = src.tileset[i]; - var vertexCount = src.vertexCount[i]; - - src.upload(camera, i); - - if (vertexCount > 0) - { - if (pipeline.forceZero) - { - // Light Pipeline, or similar - pipeline.setGameObject(src, tileset); - } - else - { - renderer.setTextureZero(tileset.glTexture); - } - - gl.drawArrays(gl.TRIANGLES, 0, vertexCount); - } - } - - renderer.resetTextures(); - - // Restore the pipeline buffer - pipeline.vertexBuffer = pipelineVertexBuffer; - - renderer.currentVertexBuffer = pipelineVertexBuffer; - - pipeline.setAttribPointers(); - - // Reset the uniforms - renderer.setMatrix4(pipeline.program, 'uModelMatrix', false, pipeline.modelMatrix); - renderer.setMatrix4(pipeline.program, 'uViewMatrix', false, pipeline.viewMatrix); - renderer.setMatrix4(pipeline.program, 'uProjectionMatrix', false, pipeline.projectionMatrix); -}; - -module.exports = StaticTilemapLayerWebGLRenderer; - - -/***/ }), -/* 1363 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var SetIdentity = __webpack_require__(1364); - -/** - * Loads an identity matrix into the model matrix. - * - * @method Phaser.Renderer.WebGL.MVP.Identity - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. - */ -var Identity = function (model) -{ - SetIdentity(model.modelMatrix); - - model.modelMatrixDirty = true; - - return model; -}; - -module.exports = Identity; - - -/***/ }), -/* 1364 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Loads an identity matrix into the model matrix. - * - * @method Phaser.Renderer.WebGL.MVP.SetIdentity - * @since 3.50.0 - * - * @param {Float32Array} array - The array to set to be an identity matrix. - */ -var SetIdentity = function (array) -{ - array[0] = 1; - array[1] = 0; - array[2] = 0; - array[3] = 0; - array[4] = 0; - array[5] = 1; - array[6] = 0; - array[7] = 0; - array[8] = 0; - array[9] = 0; - array[10] = 1; - array[11] = 0; - array[12] = 0; - array[13] = 0; - array[14] = 0; - array[15] = 1; -}; - -module.exports = SetIdentity; - - -/***/ }), -/* 1365 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Scales the model matrix by the given values. - * - * @method Phaser.Renderer.WebGL.MVP.Scale - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. - */ -var Scale = function (model, x, y, z) -{ - var modelMatrix = model.modelMatrix; - - modelMatrix[0] = modelMatrix[0] * x; - modelMatrix[1] = modelMatrix[1] * x; - modelMatrix[2] = modelMatrix[2] * x; - modelMatrix[3] = modelMatrix[3] * x; - modelMatrix[4] = modelMatrix[4] * y; - modelMatrix[5] = modelMatrix[5] * y; - modelMatrix[6] = modelMatrix[6] * y; - modelMatrix[7] = modelMatrix[7] * y; - modelMatrix[8] = modelMatrix[8] * z; - modelMatrix[9] = modelMatrix[9] * z; - modelMatrix[10] = modelMatrix[10] * z; - modelMatrix[11] = modelMatrix[11] * z; - - model.modelMatrixDirty = true; - - return model; -}; - -module.exports = Scale; - - -/***/ }), -/* 1366 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Translates the model matrix by the given values. - * - * @method Phaser.Renderer.WebGL.MVP.Translate - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. - */ -var Translate = function (model, x, y, z) -{ - var modelMatrix = model.modelMatrix; - - modelMatrix[12] = modelMatrix[0] * x + modelMatrix[4] * y + modelMatrix[8] * z + modelMatrix[12]; - modelMatrix[13] = modelMatrix[1] * x + modelMatrix[5] * y + modelMatrix[9] * z + modelMatrix[13]; - modelMatrix[14] = modelMatrix[2] * x + modelMatrix[6] * y + modelMatrix[10] * z + modelMatrix[14]; - modelMatrix[15] = modelMatrix[3] * x + modelMatrix[7] * y + modelMatrix[11] * z + modelMatrix[15]; - - model.modelMatrixDirty = true; - - return model; -}; - -module.exports = Translate; - - -/***/ }), -/* 1367 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Loads a 2D view matrix (3x2 matrix) into a 4x4 view matrix. - * - * @method Phaser.Renderer.WebGL.MVP.ViewLoad2D - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} model - The Model View Projection object. - * @param {Float32Array} matrix2D - The Matrix2D. - * - * @return {Phaser.Renderer.WebGL.Pipelines.ModelViewProjection} The Model View Projection object. - */ -var ViewLoad2D = function (model, matrix2D) -{ - var vm = model.viewMatrix; - - vm[0] = matrix2D[0]; - vm[1] = matrix2D[1]; - vm[2] = 0; - vm[3] = 0; - vm[4] = matrix2D[2]; - vm[5] = matrix2D[3]; - vm[6] = 0; - vm[7] = 0; - vm[8] = matrix2D[4]; - vm[9] = matrix2D[5]; - vm[10] = 1; - vm[11] = 0; - vm[12] = 0; - vm[13] = 0; - vm[14] = 0; - vm[15] = 1; - - model.viewMatrixDirty = true; - - return model; -}; - -module.exports = ViewLoad2D; - - -/***/ }), -/* 1368 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.Tilemaps.StaticTilemapLayer#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.Tilemaps.StaticTilemapLayer} src - The Game Object being rendered in this call. - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) -{ - src.cull(camera); - - var renderTiles = src.culledTiles; - var tileCount = renderTiles.length; - - if (tileCount === 0) - { - return; - } - - var camMatrix = renderer._tempMatrix1; - var layerMatrix = renderer._tempMatrix2; - var calcMatrix = renderer._tempMatrix3; - - layerMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - var ctx = renderer.currentContext; - var gidMap = src.gidMap; - - ctx.save(); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - layerMatrix.e = src.x; - layerMatrix.f = src.y; - - camMatrix.multiply(layerMatrix, calcMatrix); - - calcMatrix.copyToContext(ctx); - } - else - { - // Undo the camera scroll - layerMatrix.e -= camera.scrollX * src.scrollFactorX; - layerMatrix.f -= camera.scrollY * src.scrollFactorY; - - layerMatrix.copyToContext(ctx); - } - - var alpha = camera.alpha * src.alpha; - - if (!renderer.antialias || src.scaleX > 1 || src.scaleY > 1) - { - ctx.imageSmoothingEnabled = false; - } - - for (var i = 0; i < tileCount; i++) - { - var tile = renderTiles[i]; - - var tileset = gidMap[tile.index]; - - if (!tileset) - { - continue; - } - - var image = tileset.image.getSourceImage(); - var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); - - if (tileTexCoords) - { - var tileWidth = tileset.tileWidth; - var tileHeight = tileset.tileHeight; - var halfWidth = tileWidth / 2; - var halfHeight = tileHeight / 2; - ctx.save(); ctx.translate(tile.pixelX + halfWidth, tile.pixelY + halfHeight); @@ -190670,22 +201033,22 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer { ctx.rotate(tile.rotation); } - + if (tile.flipX || tile.flipY) { ctx.scale((tile.flipX) ? -1 : 1, (tile.flipY) ? -1 : 1); } ctx.globalAlpha = alpha * tile.alpha; - + ctx.drawImage( image, tileTexCoords.x, tileTexCoords.y, - tileWidth, tileHeight, + tileset.tileWidth , tileset.Height, -halfWidth, -halfHeight, - tileWidth, tileHeight + tileset.tileWidth , tileset.tileHeight ); - + ctx.restore(); } } @@ -190693,11 +201056,11 @@ var StaticTilemapLayerCanvasRenderer = function (renderer, src, interpolationPer ctx.restore(); }; -module.exports = StaticTilemapLayerCanvasRenderer; +module.exports = TilemapLayerCanvasRenderer; /***/ }), -/* 1369 */ +/* 1431 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -190706,8 +201069,8 @@ module.exports = StaticTilemapLayerCanvasRenderer; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var ParseToTilemap = __webpack_require__(240); +var GameObjectCreator = __webpack_require__(17); +var ParseToTilemap = __webpack_require__(253); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -190741,7 +201104,7 @@ GameObjectCreator.register('tilemap', function (config) /***/ }), -/* 1370 */ +/* 1432 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -190751,7 +201114,7 @@ GameObjectCreator.register('tilemap', function (config) */ var GameObjectFactory = __webpack_require__(5); -var ParseToTilemap = __webpack_require__(240); +var ParseToTilemap = __webpack_require__(253); /** * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. @@ -190763,15 +201126,15 @@ var ParseToTilemap = __webpack_require__(240); * @since 3.0.0 * * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. - * @param {integer} [tileWidth=32] - The width of a tile in pixels. Pass in `null` to leave as the + * @param {number} [tileWidth=32] - The width of a tile in pixels. Pass in `null` to leave as the * default. - * @param {integer} [tileHeight=32] - The height of a tile in pixels. Pass in `null` to leave as the + * @param {number} [tileHeight=32] - The height of a tile in pixels. Pass in `null` to leave as the * default. - * @param {integer} [width=10] - The width of the map in tiles. Pass in `null` to leave as the + * @param {number} [width=10] - The width of the map in tiles. Pass in `null` to leave as the * default. - * @param {integer} [height=10] - The height of the map in tiles. Pass in `null` to leave as the + * @param {number} [height=10] - The height of the map in tiles. Pass in `null` to leave as the * default. - * @param {integer[][]} [data] - Instead of loading from the cache, you can also load directly from + * @param {number[][]} [data] - Instead of loading from the cache, you can also load directly from * a 2D array of tile indexes. Pass in `null` for no data. * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty @@ -190807,7 +201170,7 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt /***/ }), -/* 1371 */ +/* 1433 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -190822,14 +201185,14 @@ GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, widt module.exports = { - Clock: __webpack_require__(1372), - TimerEvent: __webpack_require__(525) + Clock: __webpack_require__(1434), + TimerEvent: __webpack_require__(561) }; /***/ }), -/* 1372 */ +/* 1434 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -190839,10 +201202,10 @@ module.exports = { */ var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(23); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); -var TimerEvent = __webpack_require__(525); -var Remove = __webpack_require__(96); +var TimerEvent = __webpack_require__(561); +var Remove = __webpack_require__(87); /** * @classdesc @@ -191004,7 +201367,7 @@ var Clock = new Class({ { var event; - if (config instanceof Phaser.Time.TimerEvent) + if (config instanceof TimerEvent) { event = config; @@ -191285,7 +201648,7 @@ module.exports = Clock; /***/ }), -/* 1373 */ +/* 1435 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -191294,8 +201657,8 @@ module.exports = Clock; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(91); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(96); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Tweens @@ -191303,13 +201666,13 @@ var Extend = __webpack_require__(19); var Tweens = { - Builders: __webpack_require__(1374), - Events: __webpack_require__(245), + Builders: __webpack_require__(1436), + Events: __webpack_require__(258), - TweenManager: __webpack_require__(1390), - Tween: __webpack_require__(244), - TweenData: __webpack_require__(246), - Timeline: __webpack_require__(531) + TweenManager: __webpack_require__(1452), + Tween: __webpack_require__(257), + TweenData: __webpack_require__(259), + Timeline: __webpack_require__(567) }; @@ -191320,7 +201683,7 @@ module.exports = Tweens; /***/ }), -/* 1374 */ +/* 1436 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -191335,23 +201698,23 @@ module.exports = Tweens; module.exports = { - GetBoolean: __webpack_require__(90), - GetEaseFunction: __webpack_require__(71), + GetBoolean: __webpack_require__(95), + GetEaseFunction: __webpack_require__(78), GetNewValue: __webpack_require__(155), - GetProps: __webpack_require__(526), - GetTargets: __webpack_require__(241), - GetTweens: __webpack_require__(527), - GetValueOp: __webpack_require__(242), - NumberTweenBuilder: __webpack_require__(528), - StaggerBuilder: __webpack_require__(529), - TimelineBuilder: __webpack_require__(530), + GetProps: __webpack_require__(562), + GetTargets: __webpack_require__(254), + GetTweens: __webpack_require__(563), + GetValueOp: __webpack_require__(255), + NumberTweenBuilder: __webpack_require__(564), + StaggerBuilder: __webpack_require__(565), + TimelineBuilder: __webpack_require__(566), TweenBuilder: __webpack_require__(156) }; /***/ }), -/* 1375 */ +/* 1437 */ /***/ (function(module, exports) { /** @@ -191429,7 +201792,7 @@ module.exports = [ /***/ }), -/* 1376 */ +/* 1438 */ /***/ (function(module, exports) { /** @@ -191465,7 +201828,7 @@ module.exports = 'complete'; /***/ }), -/* 1377 */ +/* 1439 */ /***/ (function(module, exports) { /** @@ -191502,7 +201865,7 @@ module.exports = 'loop'; /***/ }), -/* 1378 */ +/* 1440 */ /***/ (function(module, exports) { /** @@ -191539,7 +201902,7 @@ module.exports = 'pause'; /***/ }), -/* 1379 */ +/* 1441 */ /***/ (function(module, exports) { /** @@ -191576,7 +201939,7 @@ module.exports = 'resume'; /***/ }), -/* 1380 */ +/* 1442 */ /***/ (function(module, exports) { /** @@ -191612,7 +201975,7 @@ module.exports = 'start'; /***/ }), -/* 1381 */ +/* 1443 */ /***/ (function(module, exports) { /** @@ -191649,7 +202012,7 @@ module.exports = 'update'; /***/ }), -/* 1382 */ +/* 1444 */ /***/ (function(module, exports) { /** @@ -191689,7 +202052,7 @@ module.exports = 'active'; /***/ }), -/* 1383 */ +/* 1445 */ /***/ (function(module, exports) { /** @@ -191730,7 +202093,7 @@ module.exports = 'complete'; /***/ }), -/* 1384 */ +/* 1446 */ /***/ (function(module, exports) { /** @@ -191774,7 +202137,7 @@ module.exports = 'loop'; /***/ }), -/* 1385 */ +/* 1447 */ /***/ (function(module, exports) { /** @@ -191819,7 +202182,7 @@ module.exports = 'repeat'; /***/ }), -/* 1386 */ +/* 1448 */ /***/ (function(module, exports) { /** @@ -191859,7 +202222,7 @@ module.exports = 'start'; /***/ }), -/* 1387 */ +/* 1449 */ /***/ (function(module, exports) { /** @@ -191895,7 +202258,7 @@ module.exports = 'stop'; /***/ }), -/* 1388 */ +/* 1450 */ /***/ (function(module, exports) { /** @@ -191938,7 +202301,7 @@ module.exports = 'update'; /***/ }), -/* 1389 */ +/* 1451 */ /***/ (function(module, exports) { /** @@ -191984,7 +202347,7 @@ module.exports = 'yoyo'; /***/ }), -/* 1390 */ +/* 1452 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -191993,14 +202356,14 @@ module.exports = 'yoyo'; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayRemove = __webpack_require__(96); +var ArrayRemove = __webpack_require__(87); var Class = __webpack_require__(0); -var NumberTweenBuilder = __webpack_require__(528); -var PluginCache = __webpack_require__(23); +var NumberTweenBuilder = __webpack_require__(564); +var PluginCache = __webpack_require__(25); var SceneEvents = __webpack_require__(20); -var StaggerBuilder = __webpack_require__(529); -var TimelineBuilder = __webpack_require__(530); -var TWEEN_CONST = __webpack_require__(91); +var StaggerBuilder = __webpack_require__(565); +var TimelineBuilder = __webpack_require__(566); +var TWEEN_CONST = __webpack_require__(96); var TweenBuilder = __webpack_require__(156); /** @@ -192094,7 +202457,7 @@ var TweenManager = new Class({ * The number of Tweens and Timelines which need to be processed by the Tween Manager at the start of the frame. * * @name Phaser.Tweens.TweenManager#_toProcess - * @type {integer} + * @type {number} * @private * @default 0 * @since 3.0.0 @@ -192773,7 +203136,7 @@ module.exports = TweenManager; /***/ }), -/* 1391 */ +/* 1453 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -192788,17 +203151,17 @@ module.exports = TweenManager; module.exports = { - Array: __webpack_require__(194), - Base64: __webpack_require__(1392), - Objects: __webpack_require__(1394), - String: __webpack_require__(1398), + Array: __webpack_require__(199), + Base64: __webpack_require__(1454), + Objects: __webpack_require__(1456), + String: __webpack_require__(1460), NOOP: __webpack_require__(1) }; /***/ }), -/* 1392 */ +/* 1454 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -192813,14 +203176,14 @@ module.exports = { module.exports = { - ArrayBufferToBase64: __webpack_require__(1393), - Base64ToArrayBuffer: __webpack_require__(400) + ArrayBufferToBase64: __webpack_require__(1455), + Base64ToArrayBuffer: __webpack_require__(410) }; /***/ }), -/* 1393 */ +/* 1455 */ /***/ (function(module, exports) { /** @@ -192878,7 +203241,7 @@ module.exports = ArrayBufferToBase64; /***/ }), -/* 1394 */ +/* 1456 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -192893,26 +203256,27 @@ module.exports = ArrayBufferToBase64; module.exports = { - Clone: __webpack_require__(69), - Extend: __webpack_require__(19), + Clone: __webpack_require__(76), + DeepCopy: __webpack_require__(167), + Extend: __webpack_require__(18), GetAdvancedValue: __webpack_require__(15), GetFastValue: __webpack_require__(2), - GetMinMaxValue: __webpack_require__(1395), + GetMinMaxValue: __webpack_require__(1457), GetValue: __webpack_require__(6), - HasAll: __webpack_require__(1396), - HasAny: __webpack_require__(422), - HasValue: __webpack_require__(115), + HasAll: __webpack_require__(1458), + HasAny: __webpack_require__(432), + HasValue: __webpack_require__(123), IsPlainObject: __webpack_require__(7), - Merge: __webpack_require__(134), - MergeRight: __webpack_require__(1397), - Pick: __webpack_require__(514), - SetValue: __webpack_require__(445) + Merge: __webpack_require__(140), + MergeRight: __webpack_require__(1459), + Pick: __webpack_require__(550), + SetValue: __webpack_require__(455) }; /***/ }), -/* 1395 */ +/* 1457 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -192922,7 +203286,7 @@ module.exports = { */ var GetValue = __webpack_require__(6); -var Clamp = __webpack_require__(17); +var Clamp = __webpack_require__(16); /** * Retrieves and clamps a numerical value from an object. @@ -192951,7 +203315,7 @@ module.exports = GetMinMaxValue; /***/ }), -/* 1396 */ +/* 1458 */ /***/ (function(module, exports) { /** @@ -192988,7 +203352,7 @@ module.exports = HasAll; /***/ }), -/* 1397 */ +/* 1459 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -192997,7 +203361,7 @@ module.exports = HasAll; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(69); +var Clone = __webpack_require__(76); /** * Creates a new Object using all values from obj1. @@ -193031,7 +203395,7 @@ module.exports = MergeRight; /***/ }), -/* 1398 */ +/* 1460 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -193046,18 +203410,18 @@ module.exports = MergeRight; module.exports = { - Format: __webpack_require__(1399), - Pad: __webpack_require__(173), - RemoveAt: __webpack_require__(1400), - Reverse: __webpack_require__(1401), - UppercaseFirst: __webpack_require__(191), - UUID: __webpack_require__(207) + Format: __webpack_require__(1461), + Pad: __webpack_require__(178), + RemoveAt: __webpack_require__(1462), + Reverse: __webpack_require__(1463), + UppercaseFirst: __webpack_require__(196), + UUID: __webpack_require__(213) }; /***/ }), -/* 1399 */ +/* 1461 */ /***/ (function(module, exports) { /** @@ -193092,7 +203456,7 @@ module.exports = Format; /***/ }), -/* 1400 */ +/* 1462 */ /***/ (function(module, exports) { /** @@ -193128,7 +203492,7 @@ module.exports = RemoveAt; /***/ }), -/* 1401 */ +/* 1463 */ /***/ (function(module, exports) { /** @@ -193157,7 +203521,7 @@ module.exports = Reverse; /***/ }), -/* 1402 */ +/* 1464 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -193173,27 +203537,27 @@ module.exports = Reverse; module.exports = { - SoundManagerCreator: __webpack_require__(393), + SoundManagerCreator: __webpack_require__(403), - Events: __webpack_require__(61), + Events: __webpack_require__(66), - BaseSound: __webpack_require__(136), - BaseSoundManager: __webpack_require__(135), + BaseSound: __webpack_require__(142), + BaseSoundManager: __webpack_require__(141), - WebAudioSound: __webpack_require__(401), - WebAudioSoundManager: __webpack_require__(399), + WebAudioSound: __webpack_require__(411), + WebAudioSoundManager: __webpack_require__(409), - HTML5AudioSound: __webpack_require__(396), - HTML5AudioSoundManager: __webpack_require__(394), + HTML5AudioSound: __webpack_require__(406), + HTML5AudioSoundManager: __webpack_require__(404), - NoAudioSound: __webpack_require__(398), - NoAudioSoundManager: __webpack_require__(397) + NoAudioSound: __webpack_require__(408), + NoAudioSoundManager: __webpack_require__(407) }; /***/ }), -/* 1403 */ +/* 1465 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -193599,7 +203963,7 @@ module.exports = BodyBounds; /***/ }), -/* 1404 */ +/* 1466 */ /***/ (function(module, exports) { /** @@ -194269,7 +204633,7 @@ function points_eq(a,b,precision){ /***/ }), -/* 1405 */ +/* 1467 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -194278,19 +204642,19 @@ function points_eq(a,b,precision){ * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(116); +var Bodies = __webpack_require__(124); var Class = __webpack_require__(0); -var Composites = __webpack_require__(1308); -var Constraint = __webpack_require__(234); -var Svg = __webpack_require__(1309); -var MatterGameObject = __webpack_require__(1406); -var MatterImage = __webpack_require__(1407); -var MatterSprite = __webpack_require__(1408); -var MatterTileBody = __webpack_require__(1310); -var PhysicsEditorParser = __webpack_require__(1306); -var PhysicsJSONParser = __webpack_require__(1307); -var PointerConstraint = __webpack_require__(1409); -var Vertices = __webpack_require__(88); +var Composites = __webpack_require__(1374); +var Constraint = __webpack_require__(241); +var Svg = __webpack_require__(1375); +var MatterGameObject = __webpack_require__(1468); +var MatterImage = __webpack_require__(1469); +var MatterSprite = __webpack_require__(1470); +var MatterTileBody = __webpack_require__(1376); +var PhysicsEditorParser = __webpack_require__(1372); +var PhysicsJSONParser = __webpack_require__(1373); +var PointerConstraint = __webpack_require__(1471); +var Vertices = __webpack_require__(93); /** * @classdesc @@ -194654,7 +205018,7 @@ var Factory = new Class({ * @since 3.0.0 * * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} frame - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. + * @param {(string|number)} frame - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. * @param {number} x - The horizontal position of this composite in the world. * @param {number} y - The vertical position of this composite in the world. * @param {number} columns - The number of columns in the grid. @@ -195086,7 +205450,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. * * @return {Phaser.Physics.Matter.Image} The Matter Image Game Object. @@ -195142,7 +205506,7 @@ var Factory = new Class({ * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. * * @return {Phaser.Physics.Matter.Sprite} The Matter Sprite Game Object. @@ -195173,7 +205537,7 @@ var Factory = new Class({ * @param {(Phaser.Types.Physics.Matter.MatterBodyConfig|MatterJS.Body)} [options] - A Matter Body configuration object, or an instance of a Matter Body. * @param {boolean} [addToWorld=true] - Add this Matter Body to the World? * - * @return {Phaser.Physics.Matter.MatterGameObject} The Game Object that had the Matter Components injected into it. + * @return {(Phaser.Physics.Matter.Image|Phaser.Physics.Matter.Sprite|Phaser.GameObjects.GameObject)} The Game Object that had the Matter Components injected into it. */ gameObject: function (gameObject, options, addToWorld) { @@ -195199,7 +205563,7 @@ module.exports = Factory; /***/ }), -/* 1406 */ +/* 1468 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -195208,7 +205572,7 @@ module.exports = Factory; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Components = __webpack_require__(500); +var Components = __webpack_require__(517); var GetFastValue = __webpack_require__(2); var Vector2 = __webpack_require__(3); @@ -195325,7 +205689,7 @@ module.exports = MatterGameObject; /***/ }), -/* 1407 */ +/* 1469 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -195335,11 +205699,11 @@ module.exports = MatterGameObject; */ var Class = __webpack_require__(0); -var Components = __webpack_require__(500); +var Components = __webpack_require__(517); var GameObject = __webpack_require__(14); var GetFastValue = __webpack_require__(2); -var Image = __webpack_require__(114); -var Pipeline = __webpack_require__(165); +var Image = __webpack_require__(122); +var Pipeline = __webpack_require__(166); var Vector2 = __webpack_require__(3); /** @@ -195387,7 +205751,7 @@ var Vector2 = __webpack_require__(3); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. */ var MatterImage = new Class({ @@ -195471,7 +205835,7 @@ module.exports = MatterImage; /***/ }), -/* 1408 */ +/* 1470 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -195482,11 +205846,11 @@ module.exports = MatterImage; var AnimationState = __webpack_require__(157); var Class = __webpack_require__(0); -var Components = __webpack_require__(500); +var Components = __webpack_require__(517); var GameObject = __webpack_require__(14); var GetFastValue = __webpack_require__(2); -var Pipeline = __webpack_require__(165); -var Sprite = __webpack_require__(76); +var Pipeline = __webpack_require__(166); +var Sprite = __webpack_require__(70); var Vector2 = __webpack_require__(3); /** @@ -195537,7 +205901,7 @@ var Vector2 = __webpack_require__(3); * @param {number} x - The horizontal position of this Game Object in the world. * @param {number} y - The vertical position of this Game Object in the world. * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. */ var MatterSprite = new Class({ @@ -195623,7 +205987,7 @@ module.exports = MatterSprite; /***/ }), -/* 1409 */ +/* 1471 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -195632,17 +205996,17 @@ module.exports = MatterSprite; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bounds = __webpack_require__(103); +var Bounds = __webpack_require__(115); var Class = __webpack_require__(0); -var Composite = __webpack_require__(158); -var Constraint = __webpack_require__(234); -var Detector = __webpack_require__(544); -var Events = __webpack_require__(543); -var InputEvents = __webpack_require__(56); -var Merge = __webpack_require__(134); -var Sleeping = __webpack_require__(250); +var Composite = __webpack_require__(159); +var Constraint = __webpack_require__(241); +var Detector = __webpack_require__(583); +var Events = __webpack_require__(582); +var InputEvents = __webpack_require__(49); +var Merge = __webpack_require__(140); +var Sleeping = __webpack_require__(265); var Vector2 = __webpack_require__(3); -var Vertices = __webpack_require__(88); +var Vertices = __webpack_require__(93); /** * @classdesc @@ -196011,7 +206375,7 @@ module.exports = PointerConstraint; /***/ }), -/* 1410 */ +/* 1472 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -196024,8 +206388,8 @@ var Matter = {}; module.exports = Matter; -var Plugin = __webpack_require__(1312); -var Common = __webpack_require__(44); +var Plugin = __webpack_require__(1378); +var Common = __webpack_require__(50); (function() { @@ -196103,7 +206467,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 1411 */ +/* 1473 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -196118,11 +206482,11 @@ var Query = {}; module.exports = Query; -var Vector = __webpack_require__(102); -var SAT = __webpack_require__(545); -var Bounds = __webpack_require__(103); -var Bodies = __webpack_require__(116); -var Vertices = __webpack_require__(88); +var Vector = __webpack_require__(114); +var SAT = __webpack_require__(584); +var Bounds = __webpack_require__(115); +var Bodies = __webpack_require__(124); +var Vertices = __webpack_require__(93); (function() { @@ -196245,7 +206609,7 @@ var Vertices = __webpack_require__(88); /***/ }), -/* 1412 */ +/* 1474 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -196262,17 +206626,17 @@ var Engine = {}; module.exports = Engine; -var World = __webpack_require__(1313); -var Sleeping = __webpack_require__(250); -var Resolver = __webpack_require__(1316); -var Pairs = __webpack_require__(1315); -var Metrics = __webpack_require__(1445); -var Grid = __webpack_require__(1314); -var Events = __webpack_require__(251); -var Composite = __webpack_require__(158); -var Constraint = __webpack_require__(234); -var Common = __webpack_require__(44); -var Body = __webpack_require__(64); +var World = __webpack_require__(1379); +var Sleeping = __webpack_require__(265); +var Resolver = __webpack_require__(1382); +var Pairs = __webpack_require__(1381); +var Metrics = __webpack_require__(1507); +var Grid = __webpack_require__(1380); +var Events = __webpack_require__(266); +var Composite = __webpack_require__(159); +var Constraint = __webpack_require__(241); +var Common = __webpack_require__(50); +var Body = __webpack_require__(68); (function() { @@ -196738,7 +207102,7 @@ var Body = __webpack_require__(64); /***/ }), -/* 1413 */ +/* 1475 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -196747,21 +207111,21 @@ var Body = __webpack_require__(64); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(116); -var Body = __webpack_require__(64); +var Bodies = __webpack_require__(124); +var Body = __webpack_require__(68); var Class = __webpack_require__(0); -var Common = __webpack_require__(44); -var Composite = __webpack_require__(158); -var Engine = __webpack_require__(1412); -var EventEmitter = __webpack_require__(12); -var Events = __webpack_require__(543); +var Common = __webpack_require__(50); +var Composite = __webpack_require__(159); +var Engine = __webpack_require__(1474); +var EventEmitter = __webpack_require__(10); +var Events = __webpack_require__(582); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); -var MatterBody = __webpack_require__(64); -var MatterEvents = __webpack_require__(251); -var MatterTileBody = __webpack_require__(1310); -var MatterWorld = __webpack_require__(1313); -var Vector = __webpack_require__(102); +var MatterBody = __webpack_require__(68); +var MatterEvents = __webpack_require__(266); +var MatterTileBody = __webpack_require__(1376); +var MatterWorld = __webpack_require__(1379); +var Vector = __webpack_require__(114); /** * @classdesc @@ -197723,8 +208087,7 @@ var World = new Class({ * @method Phaser.Physics.Matter.World#convertTilemapLayer * @since 3.0.0 * - * @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - - * An array of tiles. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - An array of tiles. * @param {object} [options] - Options to be passed to the MatterTileBody constructor. {@see Phaser.Physics.Matter.TileBody} * * @return {this} This Matter World object. @@ -198959,7 +209322,7 @@ module.exports = World; /***/ }), -/* 1414 */ +/* 1476 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** @@ -198968,10 +209331,10 @@ module.exports = World; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -__webpack_require__(547); +__webpack_require__(586); -var CONST = __webpack_require__(34); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(39); +var Extend = __webpack_require__(18); /** * @namespace Phaser @@ -198979,46 +209342,46 @@ var Extend = __webpack_require__(19); var Phaser = { - Actions: __webpack_require__(252), - Animations: __webpack_require__(651), - BlendModes: __webpack_require__(54), - Cache: __webpack_require__(663), - Cameras: __webpack_require__(666), - Core: __webpack_require__(754), + Actions: __webpack_require__(267), + Animations: __webpack_require__(691), + BlendModes: __webpack_require__(48), + Cache: __webpack_require__(703), + Cameras: __webpack_require__(706), + Core: __webpack_require__(795), Class: __webpack_require__(0), - Create: __webpack_require__(819), - Curves: __webpack_require__(825), - Data: __webpack_require__(827), - Display: __webpack_require__(829), - DOM: __webpack_require__(847), - Events: __webpack_require__(848), - Game: __webpack_require__(850), - GameObjects: __webpack_require__(940), - Geom: __webpack_require__(448), - Input: __webpack_require__(1224), - Loader: __webpack_require__(1257), - Math: __webpack_require__(180), - Physics: __webpack_require__(1415), - Plugins: __webpack_require__(1317), - Renderer: __webpack_require__(1450), - Scale: __webpack_require__(1319), - ScaleModes: __webpack_require__(247), - Scene: __webpack_require__(385), - Scenes: __webpack_require__(1320), - Structs: __webpack_require__(1322), - Textures: __webpack_require__(1323), - Tilemaps: __webpack_require__(1325), - Time: __webpack_require__(1371), - Tweens: __webpack_require__(1373), - Utils: __webpack_require__(1391) + Create: __webpack_require__(874), + Curves: __webpack_require__(880), + Data: __webpack_require__(882), + Display: __webpack_require__(884), + DOM: __webpack_require__(903), + Events: __webpack_require__(904), + Game: __webpack_require__(906), + GameObjects: __webpack_require__(996), + Geom: __webpack_require__(460), + Input: __webpack_require__(1288), + Loader: __webpack_require__(1318), + Math: __webpack_require__(185), + Physics: __webpack_require__(1477), + Plugins: __webpack_require__(1383), + Renderer: __webpack_require__(1512), + Scale: __webpack_require__(1385), + ScaleModes: __webpack_require__(260), + Scene: __webpack_require__(395), + Scenes: __webpack_require__(1386), + Structs: __webpack_require__(1388), + Textures: __webpack_require__(1389), + Tilemaps: __webpack_require__(1391), + Time: __webpack_require__(1433), + Tweens: __webpack_require__(1435), + Utils: __webpack_require__(1453) }; -// Merge in the optional plugins +// Merge in the optional plugins and WebGL only features if (true) { - Phaser.Sound = __webpack_require__(1402); + Phaser.Sound = __webpack_require__(1464); } if (false) @@ -199050,10 +209413,10 @@ global.Phaser = Phaser; * -- Dick Brandon */ -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(546))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(585))) /***/ }), -/* 1415 */ +/* 1477 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -199072,14 +209435,14 @@ global.Phaser = Phaser; module.exports = { - Arcade: __webpack_require__(1283), - Matter: __webpack_require__(1416) + Arcade: __webpack_require__(1346), + Matter: __webpack_require__(1478) }; /***/ }), -/* 1416 */ +/* 1478 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -199094,27 +209457,27 @@ module.exports = { module.exports = { - BodyBounds: __webpack_require__(1403), - Components: __webpack_require__(500), - Events: __webpack_require__(543), - Factory: __webpack_require__(1405), - MatterGameObject: __webpack_require__(1406), - Image: __webpack_require__(1407), - Matter: __webpack_require__(1311), - MatterPhysics: __webpack_require__(1446), - PolyDecomp: __webpack_require__(1404), - Sprite: __webpack_require__(1408), - TileBody: __webpack_require__(1310), - PhysicsEditorParser: __webpack_require__(1306), - PhysicsJSONParser: __webpack_require__(1307), - PointerConstraint: __webpack_require__(1409), - World: __webpack_require__(1413) + BodyBounds: __webpack_require__(1465), + Components: __webpack_require__(517), + Events: __webpack_require__(582), + Factory: __webpack_require__(1467), + MatterGameObject: __webpack_require__(1468), + Image: __webpack_require__(1469), + Matter: __webpack_require__(1377), + MatterPhysics: __webpack_require__(1508), + PolyDecomp: __webpack_require__(1466), + Sprite: __webpack_require__(1470), + TileBody: __webpack_require__(1376), + PhysicsEditorParser: __webpack_require__(1372), + PhysicsJSONParser: __webpack_require__(1373), + PointerConstraint: __webpack_require__(1471), + World: __webpack_require__(1475) }; /***/ }), -/* 1417 */ +/* 1479 */ /***/ (function(module, exports) { /** @@ -199154,7 +209517,7 @@ module.exports = Bounce; /***/ }), -/* 1418 */ +/* 1480 */ /***/ (function(module, exports) { /** @@ -199340,7 +209703,7 @@ module.exports = Collision; /***/ }), -/* 1419 */ +/* 1481 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -199349,7 +209712,7 @@ module.exports = Collision; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(64); +var Body = __webpack_require__(68); /** * A component to apply force to Matter.js bodies. @@ -199496,7 +209859,7 @@ module.exports = Force; /***/ }), -/* 1420 */ +/* 1482 */ /***/ (function(module, exports) { /** @@ -199586,7 +209949,7 @@ module.exports = Friction; /***/ }), -/* 1421 */ +/* 1483 */ /***/ (function(module, exports) { /** @@ -199626,7 +209989,7 @@ module.exports = Gravity; /***/ }), -/* 1422 */ +/* 1484 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -199635,7 +209998,7 @@ module.exports = Gravity; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(64); +var Body = __webpack_require__(68); var Vector2 = __webpack_require__(3); /** @@ -199708,7 +210071,7 @@ module.exports = Mass; /***/ }), -/* 1423 */ +/* 1485 */ /***/ (function(module, exports) { /** @@ -199762,7 +210125,7 @@ module.exports = Sensor; /***/ }), -/* 1424 */ +/* 1486 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -199771,13 +210134,13 @@ module.exports = Sensor; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(116); -var Body = __webpack_require__(64); -var FuzzyEquals = __webpack_require__(109); +var Bodies = __webpack_require__(124); +var Body = __webpack_require__(68); +var FuzzyEquals = __webpack_require__(121); var GetFastValue = __webpack_require__(2); -var PhysicsEditorParser = __webpack_require__(1306); -var PhysicsJSONParser = __webpack_require__(1307); -var Vertices = __webpack_require__(88); +var PhysicsEditorParser = __webpack_require__(1372); +var PhysicsJSONParser = __webpack_require__(1373); +var Vertices = __webpack_require__(93); /** * Enables a Matter-enabled Game Object to set its Body. Should be used as a mixin and not directly. @@ -200052,7 +210415,7 @@ module.exports = SetBody; /***/ }), -/* 1425 */ +/* 1487 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -200061,9 +210424,9 @@ module.exports = SetBody; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Events = __webpack_require__(543); -var Sleeping = __webpack_require__(250); -var MatterEvents = __webpack_require__(251); +var Events = __webpack_require__(582); +var Sleeping = __webpack_require__(265); +var MatterEvents = __webpack_require__(266); /** * Enables a Matter-enabled Game Object to be able to go to sleep. Should be used as a mixin and not directly. @@ -200206,7 +210569,7 @@ module.exports = Sleep; /***/ }), -/* 1426 */ +/* 1488 */ /***/ (function(module, exports) { /** @@ -200240,7 +210603,7 @@ module.exports = 'afteradd'; /***/ }), -/* 1427 */ +/* 1489 */ /***/ (function(module, exports) { /** @@ -200274,7 +210637,7 @@ module.exports = 'afterremove'; /***/ }), -/* 1428 */ +/* 1490 */ /***/ (function(module, exports) { /** @@ -200307,7 +210670,7 @@ module.exports = 'afterupdate'; /***/ }), -/* 1429 */ +/* 1491 */ /***/ (function(module, exports) { /** @@ -200341,7 +210704,7 @@ module.exports = 'beforeadd'; /***/ }), -/* 1430 */ +/* 1492 */ /***/ (function(module, exports) { /** @@ -200375,7 +210738,7 @@ module.exports = 'beforeremove'; /***/ }), -/* 1431 */ +/* 1493 */ /***/ (function(module, exports) { /** @@ -200408,7 +210771,7 @@ module.exports = 'beforeupdate'; /***/ }), -/* 1432 */ +/* 1494 */ /***/ (function(module, exports) { /** @@ -200445,7 +210808,7 @@ module.exports = 'collisionactive'; /***/ }), -/* 1433 */ +/* 1495 */ /***/ (function(module, exports) { /** @@ -200482,7 +210845,7 @@ module.exports = 'collisionend'; /***/ }), -/* 1434 */ +/* 1496 */ /***/ (function(module, exports) { /** @@ -200519,7 +210882,7 @@ module.exports = 'collisionstart'; /***/ }), -/* 1435 */ +/* 1497 */ /***/ (function(module, exports) { /** @@ -200546,7 +210909,7 @@ module.exports = 'dragend'; /***/ }), -/* 1436 */ +/* 1498 */ /***/ (function(module, exports) { /** @@ -200573,7 +210936,7 @@ module.exports = 'drag'; /***/ }), -/* 1437 */ +/* 1499 */ /***/ (function(module, exports) { /** @@ -200601,7 +210964,7 @@ module.exports = 'dragstart'; /***/ }), -/* 1438 */ +/* 1500 */ /***/ (function(module, exports) { /** @@ -200624,7 +210987,7 @@ module.exports = 'pause'; /***/ }), -/* 1439 */ +/* 1501 */ /***/ (function(module, exports) { /** @@ -200647,7 +211010,7 @@ module.exports = 'resume'; /***/ }), -/* 1440 */ +/* 1502 */ /***/ (function(module, exports) { /** @@ -200680,7 +211043,7 @@ module.exports = 'sleepend'; /***/ }), -/* 1441 */ +/* 1503 */ /***/ (function(module, exports) { /** @@ -200713,7 +211076,7 @@ module.exports = 'sleepstart'; /***/ }), -/* 1442 */ +/* 1504 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -200722,7 +211085,7 @@ module.exports = 'sleepstart'; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(64); +var Body = __webpack_require__(68); /** * Provides methods used for getting and setting the static state of a physics body. @@ -200768,7 +211131,7 @@ module.exports = Static; /***/ }), -/* 1443 */ +/* 1505 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -200777,10 +211140,10 @@ module.exports = Static; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(64); +var Body = __webpack_require__(68); var MATH_CONST = __webpack_require__(13); -var WrapAngle = __webpack_require__(248); -var WrapAngleDegrees = __webpack_require__(249); +var WrapAngle = __webpack_require__(261); +var WrapAngleDegrees = __webpack_require__(262); // global bitmask flag for GameObject.renderMask (used by Scale) var _FLAG = 4; // 0100 @@ -201083,7 +211446,7 @@ module.exports = Transform; /***/ }), -/* 1444 */ +/* 1506 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -201092,7 +211455,7 @@ module.exports = Transform; * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(64); +var Body = __webpack_require__(68); /** * Contains methods for changing the velocity of a Matter Body. Should be used as a mixin and not called directly. @@ -201184,7 +211547,7 @@ module.exports = Velocity; /***/ }), -/* 1445 */ +/* 1507 */ /***/ (function(module, exports, __webpack_require__) { // @if DEBUG @@ -201197,8 +211560,8 @@ var Metrics = {}; module.exports = Metrics; -var Composite = __webpack_require__(158); -var Common = __webpack_require__(44); +var Composite = __webpack_require__(159); +var Common = __webpack_require__(50); (function() { @@ -201283,7 +211646,7 @@ var Common = __webpack_require__(44); /***/ }), -/* 1446 */ +/* 1508 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -201292,39 +211655,39 @@ var Common = __webpack_require__(44); * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ALIGN_CONST = __webpack_require__(108); -var Axes = __webpack_require__(542); -var Bodies = __webpack_require__(116); -var Body = __webpack_require__(64); -var BodyBounds = __webpack_require__(1403); -var Bounds = __webpack_require__(103); +var ALIGN_CONST = __webpack_require__(120); +var Axes = __webpack_require__(581); +var Bodies = __webpack_require__(124); +var Body = __webpack_require__(68); +var BodyBounds = __webpack_require__(1465); +var Bounds = __webpack_require__(115); var Class = __webpack_require__(0); -var Composite = __webpack_require__(158); -var Composites = __webpack_require__(1308); -var Constraint = __webpack_require__(234); -var Detector = __webpack_require__(544); -var DistanceBetween = __webpack_require__(55); -var Factory = __webpack_require__(1405); +var Composite = __webpack_require__(159); +var Composites = __webpack_require__(1374); +var Constraint = __webpack_require__(241); +var Detector = __webpack_require__(583); +var DistanceBetween = __webpack_require__(61); +var Factory = __webpack_require__(1467); var GetFastValue = __webpack_require__(2); var GetValue = __webpack_require__(6); -var Grid = __webpack_require__(1314); -var MatterAttractors = __webpack_require__(1447); -var MatterCollisionEvents = __webpack_require__(1448); -var MatterLib = __webpack_require__(1410); -var MatterWrap = __webpack_require__(1449); -var Merge = __webpack_require__(134); -var Pair = __webpack_require__(501); -var Pairs = __webpack_require__(1315); -var Plugin = __webpack_require__(1312); -var PluginCache = __webpack_require__(23); -var Query = __webpack_require__(1411); -var Resolver = __webpack_require__(1316); -var SAT = __webpack_require__(545); +var Grid = __webpack_require__(1380); +var MatterAttractors = __webpack_require__(1509); +var MatterCollisionEvents = __webpack_require__(1510); +var MatterLib = __webpack_require__(1472); +var MatterWrap = __webpack_require__(1511); +var Merge = __webpack_require__(140); +var Pair = __webpack_require__(518); +var Pairs = __webpack_require__(1381); +var Plugin = __webpack_require__(1378); +var PluginCache = __webpack_require__(25); +var Query = __webpack_require__(1473); +var Resolver = __webpack_require__(1382); +var SAT = __webpack_require__(584); var SceneEvents = __webpack_require__(20); -var Svg = __webpack_require__(1309); -var Vector = __webpack_require__(102); -var Vertices = __webpack_require__(88); -var World = __webpack_require__(1413); +var Svg = __webpack_require__(1375); +var Vector = __webpack_require__(114); +var Vertices = __webpack_require__(93); +var World = __webpack_require__(1475); /** * @classdesc @@ -202631,7 +212994,7 @@ var MatterPhysics = new Class({ * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to align. * @param {number} x - The horizontal position to align the body to. * @param {number} y - The vertical position to align the body to. - * @param {integer} align - One of the `Phaser.Display.Align` constants, such as `Phaser.Display.Align.TOP_LEFT`. + * @param {number} align - One of the `Phaser.Display.Align` constants, such as `Phaser.Display.Align.TOP_LEFT`. * * @return {this} This Matter Physics instance. */ @@ -202752,10 +213115,10 @@ module.exports = MatterPhysics; /***/ }), -/* 1447 */ +/* 1509 */ /***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(1311); +var Matter = __webpack_require__(1377); /** * An attractors plugin for matter.js. @@ -202911,7 +213274,7 @@ module.exports = MatterAttractors; /***/ }), -/* 1448 */ +/* 1510 */ /***/ (function(module, exports) { /** @@ -203044,10 +213407,10 @@ module.exports = MatterCollisionEvents; /***/ }), -/* 1449 */ +/* 1511 */ /***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(1311); +var Matter = __webpack_require__(1377); /** * A coordinate wrapping plugin for matter.js. @@ -203226,7 +213589,7 @@ module.exports = MatterWrap; */ /***/ }), -/* 1450 */ +/* 1512 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -203245,15 +213608,15 @@ module.exports = MatterWrap; module.exports = { - Canvas: __webpack_require__(1451), - Snapshot: __webpack_require__(1452), - WebGL: __webpack_require__(1453) + Canvas: __webpack_require__(1513), + Snapshot: __webpack_require__(1514), + WebGL: __webpack_require__(1515) }; /***/ }), -/* 1451 */ +/* 1513 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -203268,15 +213631,15 @@ module.exports = { module.exports = { - CanvasRenderer: __webpack_require__(532), - GetBlendModes: __webpack_require__(534), - SetTransform: __webpack_require__(28) + CanvasRenderer: __webpack_require__(568), + GetBlendModes: __webpack_require__(570), + SetTransform: __webpack_require__(30) }; /***/ }), -/* 1452 */ +/* 1514 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -203291,14 +213654,14 @@ module.exports = { module.exports = { - Canvas: __webpack_require__(533), - WebGL: __webpack_require__(541) + Canvas: __webpack_require__(569), + WebGL: __webpack_require__(580) }; /***/ }), -/* 1453 */ +/* 1515 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -203307,23 +213670,36 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var WEBGL_CONST = __webpack_require__(74); +var Extend = __webpack_require__(18); + /** * @namespace Phaser.Renderer.WebGL */ -module.exports = { +var WebGL = { - PipelineManager: __webpack_require__(536), - Pipelines: __webpack_require__(1454), - Utils: __webpack_require__(10), - WebGLPipeline: __webpack_require__(111), - WebGLRenderer: __webpack_require__(535) + PipelineManager: __webpack_require__(572), + Pipelines: __webpack_require__(1516), + RenderTarget: __webpack_require__(263), + Utils: __webpack_require__(12), + WebGLPipeline: __webpack_require__(75), + WebGLRenderer: __webpack_require__(571), + WebGLShader: __webpack_require__(574) }; +// Merge in the consts + +WebGL = Extend(false, WebGL, WEBGL_CONST); + +// Export it + +module.exports = WebGL; + /***/ }), -/* 1454 */ +/* 1516 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -203332,8 +213708,8 @@ module.exports = { * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(110); -var Extend = __webpack_require__(19); +var CONST = __webpack_require__(82); +var Extend = __webpack_require__(18); /** * @namespace Phaser.Renderer.WebGL.Pipelines @@ -203341,12 +213717,13 @@ var Extend = __webpack_require__(19); var Pipelines = { - BitmapMaskPipeline: __webpack_require__(537), - LightPipeline: __webpack_require__(538), - SinglePipeline: __webpack_require__(540), - MultiPipeline: __webpack_require__(112), - RopePipeline: __webpack_require__(539), - ModelViewProjection: __webpack_require__(113) + BitmapMaskPipeline: __webpack_require__(573), + GraphicsPipeline: __webpack_require__(575), + LightPipeline: __webpack_require__(576), + MultiPipeline: __webpack_require__(158), + PostFXPipeline: __webpack_require__(1517), + RopePipeline: __webpack_require__(577), + SinglePipeline: __webpack_require__(578) }; @@ -203359,6 +213736,404 @@ Pipelines = Extend(false, Pipelines, CONST); module.exports = Pipelines; +/***/ }), +/* 1517 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(0); +var ColorMatrix = __webpack_require__(264); +var GetFastValue = __webpack_require__(2); +var ShaderSourceFS = __webpack_require__(1518); +var ShaderSourceVS = __webpack_require__(579); +var WEBGL_CONST = __webpack_require__(74); +var WebGLPipeline = __webpack_require__(75); + +/** + * @classdesc + * TODO + * + * The fragment shader it uses can be found in `shaders/src/PostFX.frag`. + * The vertex shader it uses can be found in `shaders/src/PostFX.vert`. + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * + * The default shader uniforms for this pipeline are: + * + * `uMainSampler` (sampler2D) + * + * @class PostFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + */ +var PostFXPipeline = new Class({ + + Extends: WebGLPipeline, + + initialize: + + function PostFXPipeline (config) + { + config.renderTarget = GetFastValue(config, 'renderTarget', 1); + config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS); + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); + config.uniforms = GetFastValue(config, 'uniforms', [ + 'uMainSampler' + ]); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + }, + { + name: 'inTexCoord', + size: 2, + type: WEBGL_CONST.FLOAT + } + ]); + config.batchSize = 1; + config.vertices = new Float32Array([ + -1, -1, 0, 0, + -1, 1, 0, 1, + 1, 1, 1, 1, + -1, -1, 0, 0, + 1, 1, 1, 1, + 1, -1, 1, 0 + ]); + + WebGLPipeline.call(this, config); + + this.isPostFX = true; + + /** + * If this post-pipeline belongs to a Game Object or Camera, this contains a reference to it. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#gameObject + * @type {Phaser.GameObjects.GameObject} + * @since 3.50.0 + */ + this.gameObject; + + /** + * A Color Matrix instance belonging to this pipeline. + * + * Used during calls to the `drawFrame` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#colorMatrix + * @type {Phaser.Display.ColorMatrix} + * @since 3.50.0 + */ + this.colorMatrix = new ColorMatrix(); + + /** + * A reference to the Full Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#fullFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.fullFrame1; + + /** + * A reference to the Full Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#fullFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.fullFrame2; + + /** + * A reference to the Half Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#halfFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.halfFrame1; + + /** + * A reference to the Half Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#halfFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.halfFrame2; + + if (this.renderer.isBooted) + { + this.manager = this.renderer.pipelines; + + this.boot(); + } + }, + + boot: function () + { + WebGLPipeline.prototype.boot.call(this); + + var utility = this.manager.UTILITY_PIPELINE; + + this.fullFrame1 = utility.fullFrame1; + this.fullFrame2 = utility.fullFrame2; + this.halfFrame1 = utility.halfFrame1; + this.halfFrame2 = utility.halfFrame2; + + this.set1i('uMainSampler', 0); + }, + + onDraw: function (renderTarget) + { + this.bindAndDraw(renderTarget); + }, + + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * You can optionally set the brightness factor of the copy. + * + * The difference between this method and `drawFrame` is that this method + * uses a faster copy shader, where only the brightness can be modified. + * If you need color level manipulation, see `drawFrame` instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#copyFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + copyFrame: function (source, target, brightness, clear, clearAlpha) + { + this.manager.copyFrame(source, target, brightness, clear, clearAlpha); + }, + + /** + * Pops the framebuffer from the renderers FBO stack and sets that as the active target, + * then draws the `source` Render Target to it. It then resets the renderer textures. + * + * This should be done when you need to draw the _final_ results of a pipeline to the game + * canvas, or the next framebuffer in line on the FBO stack. You should only call this once + * in the `onDraw` handler and it should be the final thing called. Be careful not to call + * this if you need to actually use the pipeline shader, instead of the copy shader. In + * those cases, use the `bindAndDraw` method. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#copyToGame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + */ + copyToGame: function (source) + { + this.manager.copyToGame(source); + }, + + /** + * Copy the `source` Render Target to the `target` Render Target, using the + * given Color Matrix. + * + * The difference between this method and `copyFrame` is that this method + * uses a color matrix shader, where you have full control over the luminance + * values used during the copy. If you don't need this, you can use the faster + * `copyFrame` method instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#drawFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + drawFrame: function (source, target, clearAlpha) + { + this.manager.drawFrame(source, target, clearAlpha, this.colorMatrix); + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using a linear blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#blendFrames + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + blendFrames: function (source1, source2, target, strength, clearAlpha) + { + this.manager.blendFrames(source1, source2, target, strength, clearAlpha); + }, + + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using an additive blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#blendFramesAdditive + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) + { + this.manager.blendFramesAdditive(source1, source2, target, strength, clearAlpha); + }, + + /** + * Binds this pipeline and draws the `source` Render Target to the `target` Render Target. + * + * If no `target` is specified, it will pop the framebuffer from the Renderers FBO stack + * and use that instead, which should be done when you need to draw the final results of + * this pipeline to the game canvas. + * + * You can optionally set the shader to be used for the draw here, if this is a multi-shader + * pipeline. By default `currentShader` will be used. If you need to set a shader but not + * a target, just pass `null` as the `target` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#bindAndDraw + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The Render Target to draw to. If not set, it will pop the fbo from the stack. + * @param {boolean} [clear=true] - Clear the target before copying? Only used if `target` parameter is set. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to use during the draw. + */ + bindAndDraw: function (source, target, clear, clearAlpha, currentShader) + { + if (clear === undefined) { clear = true; } + if (clearAlpha === undefined) { clearAlpha = true; } + + var gl = this.gl; + var renderer = this.renderer; + + this.bind(currentShader); + + this.set1i('uMainSampler', 0); + + if (target) + { + gl.viewport(0, 0, target.width, target.height); + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + + if (clear) + { + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); + } + } + else + { + renderer.popFramebuffer(false, false, false); + + if (!renderer.currentFramebuffer) + { + gl.viewport(0, 0, renderer.width, renderer.height); + } + } + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); + + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + if (!target) + { + renderer.resetTextures(); + } + else + { + gl.bindTexture(gl.TEXTURE_2D, null); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + } + +}); + +module.exports = PostFXPipeline; + + +/***/ }), +/* 1518 */ +/***/ (function(module, exports) { + +module.exports = [ + '#define SHADER_NAME PHASER_POSTFX_FS', + '', + 'precision mediump float;', + '', + 'uniform sampler2D uMainSampler;', + '', + 'varying vec2 outTexCoord;', + '', + 'void main ()', + '{', + ' gl_FragColor = texture2D(uMainSampler, outTexCoord);', + '}', + '' +].join('\n'); + + /***/ }) /******/ ]); }); \ No newline at end of file diff --git a/dist/phaser.min.js b/dist/phaser.min.js index 6cf9c1147..67edb2c43 100644 --- a/dist/phaser.min.js +++ b/dist/phaser.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Phaser",[],e):"object"==typeof exports?exports.Phaser=e():t.Phaser=e()}(window,function(){return n={},s.m=i=[function(t,e){function r(t,e,i,n){for(var s in e)if(e.hasOwnProperty(s)){var r=(l=e,u=s,f=d=void 0,f=(c=i)?l[u]:Object.getOwnPropertyDescriptor(l,u),!c&&f.value&&"object"==typeof f.value&&(f=f.value),!(!f||!((d=f).get&&"function"==typeof d.get||d.set&&"function"==typeof d.set))&&(void 0===f.enumerable&&(f.enumerable=!0),void 0===f.configurable&&(f.configurable=!0),f));if(!1!==r){if(o=(n||t).prototype,a=s,h=void 0,(h=Object.getOwnPropertyDescriptor(o,a))&&(h.value&&"object"==typeof h.value&&(h=h.value),!1===h.configurable)){if(p.ignoreFinals)continue;throw new Error("cannot override final property '"+s+"', set Class.ignoreFinals = true to skip")}Object.defineProperty(t.prototype,s,r)}else t.prototype[s]=e[s]}var o,a,h,l,u,c,d,f}function o(t,e){if(e){Array.isArray(e)||(e=[e]);for(var i=0;i=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=u},function(t,e){t.exports={getTintFromFloats:function(t,e,i,n){return((255&(255*n|0))<<24|(255&(255*t|0))<<16|(255&(255*e|0))<<8|255&(255*i|0))>>>0},getTintAppendFloatAlpha:function(t,e){return((255&(255*e|0))<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255&(255*e|0))<<24|(255&(0|t))<<16|(255&(t>>8|0))<<8|255&(t>>16|0))>>>0},getFloatsFromUintRGB:function(t){return[(255&(t>>16|0))/255,(255&(t>>8|0))/255,(255&(0|t))/255]},getComponentCount:function(t,e){for(var i=0,n=0;nr.width&&(i=Math.max(r.width-t,0)),e+n>r.height&&(n=Math.max(r.height-e,0));for(var l=[],u=e;uthis.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=l},function(t,e,i){var n=i(13);t.exports=function(t){return t*n.DEG_TO_RAD}},function(t,e,i){t.exports={DESTROY:i(671),FADE_IN_COMPLETE:i(672),FADE_IN_START:i(673),FADE_OUT_COMPLETE:i(674),FADE_OUT_START:i(675),FLASH_COMPLETE:i(676),FLASH_START:i(677),PAN_COMPLETE:i(678),PAN_START:i(679),POST_RENDER:i(680),PRE_RENDER:i(681),ROTATE_COMPLETE:i(682),ROTATE_START:i(683),SHAKE_COMPLETE:i(684),SHAKE_START:i(685),ZOOM_COMPLETE:i(686),ZOOM_START:i(687)}},function(t,e){t.exports=function(t,e,i,n){var s=i||e.fillColor,r=n||e.fillAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.fillStyle="rgba("+o+","+a+","+h+","+r+")"}},function(t,e){var h={};t.exports=h,function(){h._nextId=0,h._seed=0,h._nowStartTime=+new Date,h.extend=function(t,e){for(var i,n="boolean"==typeof e?(i=2,e):(i=1,!0),s=i;s=e&&t.y<=i&&t.y+t.height>=i)}},function(t,e){t.exports=function(t,e,i,n){var s=i||e.strokeColor,r=n||e.strokeAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth}},function(t,e){t.exports={DYNAMIC_BODY:0,STATIC_BODY:1,GROUP:2,TILEMAPLAYER:3,FACING_NONE:10,FACING_UP:11,FACING_DOWN:12,FACING_LEFT:13,FACING_RIGHT:14}},function(t,e,i){var d=i(150),f=i(24);t.exports=function(t,e,i,n,s){for(var r,o,a,h,l=f(t,e,i,n,null,s),u=0;u=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},function(t,e){t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},function(t,e){t.exports=function(t,e,i){var n=i-e;return e+((t-e)%n+n)%n}},function(t,e,i){"use strict";function n(t,e,i){i=i||2;var n,s,r,o,a,h,l,u=e&&e.length,c=u?e[0]*i:t.length,d=g(t,0,c,i,!0),f=[];if(!d||d.next===d.prev)return f;if(u&&(d=function(t,e,i,n){var s,r,o,a,h,l=[];for(s=0,r=e.length;s=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&o=n.x&&n.x>=u&&s!==n.x&&T(ri.x||n.x===i.x&&function(t,e){return w(t.prev,t,e.prev)<0&&w(e.next,t,t.next)<0}(i,n)))&&(i=n,d=h)),n=n.next,n!==l;);return i}(t,e))&&(i=E(e,t),v(e,e.next),v(i,i.next))}}(l[s],i),i=v(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=r=t[0],s=o=t[1];for(var p=i;pr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=x(a,h,e,i,n),d=x(l,u,e,i,n),f=t.prevZ,p=t.nextZ;for(;f&&f.z>=c&&p&&p.z<=d;){if(f!==t.prev&&f!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=w(f.prev,f,f.next))return!1;if(f=f.prevZ,p!==t.prev&&p!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&0<=w(p.prev,p,p.next))return!1;p=p.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=w(f.prev,f,f.next))return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&0<=w(p.prev,p,p.next))return!1;p=p.nextZ}return!0}(t,n,s,r):function(t){var e=t.prev,i=t,n=t.next;if(0<=w(e,i,n))return!1;var s=t.next.next;for(;s!==t.prev;){if(T(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&0<=w(s.prev,s,s.next))return!1;s=s.next}return!0}(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),d(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?m(t=function(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!u(s,r)&&c(s,n,n.next,r)&&b(s,r)&&b(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),d(n),d(n.next),n=t=r),n=n.next}while(n!==t);return v(n)}(v(t),e,i),e,i,n,s,r,2):2===o&&function(t,e,i,n,s,r){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&c(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(b(t,e)&&b(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;for(;i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next,i!==t;);return n}(t,e)&&(w(t.prev,t,e.prev)||w(t,e.prev,e))||u(t,e)&&0=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function l(t){return 0=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t;this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e=0,e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t;this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e=0,e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t;this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=u},function(t,e,i){var n=i(0),s=i(18),c=i(22),r=i(8),d=i(2),f=i(7),o=new n({Extends:c,initialize:function t(e,i,n,s,r){var o,a,h="png";f(i)&&(i=d(a=i,"key"),n=d(a,"url"),o=d(a,"normalMap"),s=d(a,"xhrSettings"),h=d(a,"extension",h),r=d(a,"frameConfig")),Array.isArray(n)&&(o=n[1],n=n[0]);var l,u={type:"image",cache:e.textureManager,extension:h,responseType:"blob",key:i,url:n,xhrSettings:s,config:r};c.call(this,e,u),o&&((l=new t(e,this.key,o,s,r)).type="normalMap",this.setLink(l),e.addFile(l))},onProcess:function(){this.state=s.FILE_PROCESSING,this.data=new Image,this.data.crossOrigin=this.crossOrigin;var t=this;this.data.onload=function(){c.revokeObjectURL(t.data),t.onProcessComplete()},this.data.onerror=function(){c.revokeObjectURL(t.data),t.onProcessError()},c.createObjectURL(this.data,this.xhrLoader.response,"image/png")},addToCache:function(){var t,e=this.linkFile;e&&e.state===s.FILE_COMPLETE?(t="image"===this.type?this.cache.addImage(this.key,this.data,e.data):this.cache.addImage(e.key,e.data,this.data),this.pendingDestroy(t),e.pendingDestroy(t)):e||(t=this.cache.addImage(this.key,this.data),this.pendingDestroy(t))}});r.register("image",function(t,e,i){if(Array.isArray(t))for(var n=0;nthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*e.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new r),e.x=this.getLeft(),e.y=this.getTop(),e.width=this.getRight()-e.x,e.height=this.getBottom()-e.y,e},getCenterX:function(t){return(this.getLeft(t)+this.getRight(t))/2},getCenterY:function(t){return(this.getTop(t)+this.getBottom(t))/2},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},intersects:function(t,e,i,n){return!(i<=this.pixelX||n<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){return void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,n,s){return void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=t),void 0===s&&(s=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n,s&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,n){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==n&&(this.baseHeight=n),this.updatePixelXY(),this},updatePixelXY:function(){return this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight,this},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=o},function(t,e,i){var r=i(157),n=i(0),s=i(11),o=i(14),a=i(29),h=i(991),l=new n({Extends:o,Mixins:[s.Alpha,s.BlendMode,s.Depth,s.Flip,s.GetBounds,s.Mask,s.Origin,s.Pipeline,s.ScrollFactor,s.Size,s.TextureCrop,s.Tint,s.Transform,s.Visible,h],initialize:function(t,e,i,n,s){o.call(this,t,"Sprite"),this._crop=this.resetCropObject(),this.anims=new r(this),this.setTexture(n,s),this.setPosition(e,i),this.setSizeToFrame(),this.setOriginFromFrame(),this.initPipeline(),this.on(a.ADDED_TO_SCENE,this.addedToScene,this),this.on(a.REMOVED_FROM_SCENE,this.removedFromScene,this)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},preUpdate:function(t,e){this.anims.update(t,e)},play:function(t,e){return this.anims.play(t,e)},playReverse:function(t,e){return this.anims.playReverse(t,e)},playAfterDelay:function(t,e){return this.anims.playAfterDelay(t,e)},playAfterRepeat:function(t,e){return this.anims.playAfterRepeat(t,e)},chain:function(t){return this.anims.chain(t)},stop:function(){return this.anims.stop()},stopAfterDelay:function(t){return this.anims.stopAfterDelay(t)},stopAfterRepeat:function(t){return this.anims.stopAfterRepeat(t)},stopOnFrame:function(t){return this.anims.stopOnFrame(t)},toJSON:function(){return s.ToJSON(this)},preDestroy:function(){this.anims.destroy(),this.anims=void 0}});t.exports=l},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e){t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},function(t,e){t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i){this.x=0,this.y=0,this.z=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0)},up:function(){return this.x=0,this.y=1,this.z=0,this},clone:function(){return new n(this.x,this.y,this.z)},crossVectors:function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=n*a-s*o,this.y=s*r-i*a,this.z=i*o-n*r,this},equals:function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},set:function(t,e,i){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0):(this.x=t||0,this.y=e||0,this.z=i||0),this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z||0,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z||1,this},scale:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z||1,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},distance:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return Math.sqrt(e*e+i*i+n*n)},distanceSq:function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z||0;return e*e+i*i+n*n},length:function(){var t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)},lengthSq:function(){var t=this.x,e=this.y,i=this.z;return t*t+e*e+i*i},normalize:function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return 0=t.length)){for(var i=t.length-1,n=t[e],s=e;sh||a.y>l)?(u=Math.max(a.x,e),c=Math.max(a.y,i),b=d=Math.min(a.r,h)-u,E=f=Math.min(a.b,l)-c,T=r?p+(v-(u-a.x)-d):p+(u-a.x),w=o?g+(m-(c-a.y)-f):g+(c-a.y),e=u,i=c,n=d,s=f):E=b=w=T=0):(r&&(T=p+(v-e-n)),o&&(w=g+(m-i-s)));var _=this.source.width,A=this.source.height;return t.u0=Math.max(0,T/_),t.v0=Math.max(0,w/A),t.u1=Math.min(1,(T+b)/_),t.v1=Math.min(1,(w+E)/A),t.x=e,t.y=i,t.cx=T,t.cy=w,t.cw=b,t.ch=E,t.width=n,t.height=s,t.flipX=r,t.flipY=o,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},setUVs:function(t,e,i,n,s,r){var o=this.data.drawImage;return o.width=t,o.height=e,this.u0=i,this.v0=n,this.u1=s,this.v1=r,this},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new r(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=s(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.source=null,this.texture=null,this.glTexture=null,this.customData=null,this.data=null},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=r},function(t,e,i){var n=i(0),s=i(99),r=i(412),o=i(413),a=i(49),h=i(167),l=new n({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.type=a.ELLIPSE,this.x=t,this.y=e,this.width=i,this.height=n},contains:function(t,e){return s(this,t,e)},getPoint:function(t,e){return r(this,t,e)},getPoints:function(t,e,i){return o(this,t,e,i)},getRandomPoint:function(t){return h(this,t)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},setEmpty:function(){return this.width=0,this.height=0,this},setPosition:function(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this},setSize:function(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this},isEmpty:function(){return this.width<=0||this.height<=0},getMinorRadius:function(){return Math.min(this.width,this.height)/2},getMajorRadius:function(){return Math.max(this.width,this.height)/2},left:{get:function(){return this.x-this.width/2},set:function(t){this.x=t+this.width/2}},right:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},top:{get:function(){return this.y-this.height/2},set:function(t){this.y=t+this.height/2}},bottom:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=l},function(t,e){t.exports=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var n=(e-t.x)/t.width,s=(i-t.y)/t.height;return(n*=n)+(s*=s)<.25}},function(t,e,i){var U=i(252),n=i(0),r=i(29),s=i(193),z=i(2),G=i(6),o=i(7),W=i(404),a=i(141),h=i(76),l=new n({initialize:function(t,e,i){i?e&&!Array.isArray(e)&&(e=[e]):Array.isArray(e)?o(e[0])&&(i=e,e=null):o(e)&&(i=e,e=null),this.scene=t,this.children=new a,this.isParent=!0,this.type="Group",this.classType=z(i,"classType",h),this.name=z(i,"name",""),this.active=z(i,"active",!0),this.maxSize=z(i,"maxSize",-1),this.defaultKey=z(i,"defaultKey",null),this.defaultFrame=z(i,"defaultFrame",null),this.runChildUpdate=z(i,"runChildUpdate",!1),this.createCallback=z(i,"createCallback",null),this.removeCallback=z(i,"removeCallback",null),this.createMultipleCallback=z(i,"createMultipleCallback",null),this.internalCreateCallback=z(i,"internalCreateCallback",null),this.internalRemoveCallback=z(i,"internalRemoveCallback",null),e&&this.addMultiple(e),i&&this.createMultiple(i)},create:function(t,e,i,n,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=this.defaultKey),void 0===n&&(n=this.defaultFrame),void 0===s&&(s=!0),void 0===r&&(r=!0),this.isFull())return null;var o=new this.classType(this.scene,t,e,i,n);return this.scene.sys.displayList.add(o),o.preUpdate&&this.scene.sys.updateList.add(o),o.visible=s,o.setActive(r),this.add(o),o},createMultiple:function(t){if(this.isFull())return[];Array.isArray(t)||(t=[t]);var e=[];if(t[0].key)for(var i=0;i=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;it.max.x&&(t.max.x=s.x),s.xt.max.y&&(t.max.y=s.y),s.y=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},i.overlaps=function(t,e){return t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y},i.translate=function(t,e){t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},i.shift=function(t,e){var i=t.max.x-t.min.x,n=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+i,t.min.y=e.y,t.max.y=e.y+n}},function(t,e){t.exports=function(t,e,i){return 0<=t&&t=this.firstgid&&t=this.vertexCapacity},resize:function(t,e,i){return this.width=t*i,this.height=e*i,this.resolution=i,this},bind:function(t){void 0===t&&(t=!1);var e=this.vertexBuffer,i=this.program,n=this.renderer;return n.setProgram(i),n.setVertexBuffer(e),this.setAttribPointers(t),this},setAttribPointers:function(t){void 0===t&&(t=!1);for(var e=this.gl,i=this.attributes,n=this.vertexSize,s=this.program,r=0;rthis.vertexCapacity&&this.flush();var N=this.setGameObject(t),Y=t._isTinted&&t.tintFill;this.batchQuad(A,C,M,O,P,R,L,F,l,u,c,d,D,k,I,B,Y,h,N)},batchQuad:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,m,y){void 0===y&&(y=this.currentUnit);var x=!1;this.vertexCount+6>this.vertexCapacity&&(this.flush(),x=!0,y=this.setTexture2D(m));var T=this.vertexViewF32,w=this.vertexViewU32,b=this.vertexCount*this.vertexComponentCount-1;return T[++b]=t,T[++b]=e,T[++b]=h,T[++b]=l,T[++b]=y,T[++b]=v,w[++b]=d,T[++b]=i,T[++b]=n,T[++b]=h,T[++b]=c,T[++b]=y,T[++b]=v,w[++b]=p,T[++b]=s,T[++b]=r,T[++b]=u,T[++b]=c,T[++b]=y,T[++b]=v,w[++b]=g,T[++b]=t,T[++b]=e,T[++b]=h,T[++b]=l,T[++b]=y,T[++b]=v,w[++b]=d,T[++b]=s,T[++b]=r,T[++b]=u,T[++b]=c,T[++b]=y,T[++b]=v,w[++b]=g,T[++b]=o,T[++b]=a,T[++b]=u,T[++b]=l,T[++b]=y,T[++b]=v,w[++b]=f,this.vertexCount+=6,x},batchTri:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g){void 0===g&&(g=this.currentUnit);var v=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),v=!0,g=this.setTexture2D(p));var m=this.vertexViewF32,y=this.vertexViewU32,x=this.vertexCount*this.vertexComponentCount-1;return m[++x]=t,m[++x]=e,m[++x]=o,m[++x]=a,m[++x]=g,m[++x]=f,y[++x]=u,m[++x]=i,m[++x]=n,m[++x]=o,m[++x]=l,m[++x]=g,m[++x]=f,y[++x]=c,m[++x]=s,m[++x]=r,m[++x]=h,m[++x]=l,m[++x]=g,m[++x]=f,y[++x]=d,this.vertexCount+=3,v},batchTexture:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,m,y,x,T,w,b,E,S,_,A,C,M,O,P,R){this.renderer.pipelines.set(this,t);var L,F,D,k=this._tempMatrix1,I=this._tempMatrix2,B=this._tempMatrix3,N=m/i+A,Y=y/n+C,X=(m+x)/i+A,U=(y+T)/n+C,z=o,G=a,W=-g,V=-v;t.isCropped&&(z=(L=t._crop).width,G=L.height,o=L.width,a=L.height,F=m=L.x,D=y=L.y,c&&(F=x-L.x-L.width),d&&!e.isRenderTexture&&(D=T-L.y-L.height),N=F/i+A,Y=D/n+C,X=(F+L.width)/i+A,U=(D+L.height)/n+C,W=-g+m,V=-v+y),c&&(z*=-1,W+=o),(d^=!P&&e.isRenderTexture?1:0)&&(G*=-1,V+=a);var H=W+z,j=V+G;I.applyITRS(s,r,u,h,l),k.copyFrom(M.matrix),O?(k.multiplyWithOffset(O,-M.scrollX*f,-M.scrollY*p),I.e=s,I.f=r):(I.e-=M.scrollX*f,I.f-=M.scrollY*p),k.multiply(I,B);var q=B.getX(W,V),K=B.getY(W,V),Z=B.getX(W,j),J=B.getY(W,j),Q=B.getX(H,j),$=B.getY(H,j),tt=B.getX(H,V),et=B.getY(H,V);M.roundPixels&&(q=Math.round(q),K=Math.round(K),Z=Math.round(Z),J=Math.round(J),Q=Math.round(Q),$=Math.round($),tt=Math.round(tt),et=Math.round(et)),void 0===R&&(R=this.renderer.setTexture2D(e)),this.batchQuad(q,K,Z,J,Q,$,tt,et,N,Y,X,U,w,b,E,S,_,e,R)},batchTextureFrame:function(t,e,i,n,s,r,o){this.renderer.pipelines.set(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,l=e+t.width,u=i+t.height;o?a.multiply(o,h):h=a;var c=h.getX(e,i),d=h.getY(e,i),f=h.getX(e,u),p=h.getY(e,u),g=h.getX(l,u),v=h.getY(l,u),m=h.getX(l,i),y=h.getY(l,i),x=this.renderer.setTextureSource(t.source);n=X.getTintAppendFloatAlpha(n,s),this.batchQuad(c,d,f,p,g,v,m,y,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0,t.glTexture,x)},drawFillRect:function(t,e,i,n,s,r){t=Math.floor(t),e=Math.floor(e);var o=Math.floor(t+i),a=Math.floor(e+n),h=this.renderer.blankTexture.glTexture,l=this.renderer.setTexture2D(h),u=X.getTintAppendFloatAlphaAndSwap(s,r);this.batchQuad(t,e,t,a,o,a,o,e,0,0,1,1,u,u,u,u,2,h,l)},batchFillRect:function(t,e,i,n,s,r){this.renderer.pipelines.set(this);var o=this._tempMatrix3;r&&r.multiply(s,o);var a=t+i,h=e+n,l=o.getX(t,e),u=o.getY(t,e),c=o.getX(t,h),d=o.getY(t,h),f=o.getX(a,h),p=o.getY(a,h),g=o.getX(a,e),v=o.getY(a,e),m=this.currentFrame,y=m.u0,x=m.v0,T=m.u1,w=m.v1,b=this.fillTint;this.batchQuad(l,u,c,d,f,p,g,v,y,x,T,w,b.TL,b.TR,b.BL,b.BR,this.tintEffect)},batchFillTriangle:function(t,e,i,n,s,r,o,a){this.renderer.pipelines.set(this);var h=this._tempMatrix3;a&&a.multiply(o,h);var l=h.getX(t,e),u=h.getY(t,e),c=h.getX(i,n),d=h.getY(i,n),f=h.getX(s,r),p=h.getY(s,r),g=this.currentFrame,v=g.u0,m=g.v0,y=g.u1,x=g.v1;this.batchTri(l,u,c,d,f,p,v,m,y,x,this.fillTint.TL,this.fillTint.TR,this.fillTint.BL,this.tintEffect)},batchStrokeTriangle:function(t,e,i,n,s,r,o,a,h){var l=this.tempTriangle;l[0].x=t,l[0].y=e,l[0].width=o,l[1].x=i,l[1].y=n,l[1].width=o,l[2].x=s,l[2].y=r,l[2].width=o,l[3].x=t,l[3].y=e,l[3].width=o,this.batchStrokePath(l,o,!1,a,h)},batchFillPath:function(t,e,i){this.renderer.pipelines.set(this);var n=this._tempMatrix3;i&&i.multiply(e,n);for(var s,r,o=t.length,a=this.polygonCache,h=this.fillTint.TL,l=this.fillTint.TR,u=this.fillTint.BL,c=this.tintEffect,d=0;d>16)+(65280&t)+((255&t)<<16)}},function(t,e,i){var n=i(0),a=i(293),s=new n({initialize:function(t,e){this.parent=t,(this.events=e)||(this.events=t.events?t.events:t),this.list={},this.values={},this._frozen=!1,!t.hasOwnProperty("sys")&&this.events&&this.events.once("destroy",this.destroy,this)},get:function(t){var e=this.list;if(Array.isArray(t)){for(var i=[],n=0;ne.right||t.y>e.bottom)}},function(t,e,i){var l=i(6),u={},n={register:function(t,e,i,n,s){u[t]={plugin:e,mapping:i,settingsKey:n,configKey:s}},getPlugin:function(t){return u[t]},install:function(t){var e=t.scene.sys,i=e.settings.input,n=e.game.config;for(var s in u){var r=u[s].plugin,o=u[s].mapping,a=u[s].settingsKey,h=u[s].configKey;l(i,a,n[h])&&(t[o]=new r(t))}},remove:function(t){u.hasOwnProperty(t)&&delete u[t]}};t.exports=n},function(t,e,i){t.exports={ANY_KEY_DOWN:i(1239),ANY_KEY_UP:i(1240),COMBO_MATCH:i(1241),DOWN:i(1242),KEY_DOWN:i(1243),KEY_UP:i(1244),UP:i(1245)}},function(t,e){t.exports=function(t,e){return!!t.url&&(t.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)?t.url:e+t.url)}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===t&&(t=""),void 0===e&&(e=!0),void 0===i&&(i=""),void 0===n&&(n=""),void 0===s&&(s=0),void 0===r&&(r=!1),{responseType:t,async:e,user:i,password:n,timeout:s,headers:void 0,header:void 0,headerValue:void 0,requestedWith:!1,overrideMimeType:void 0,withCredentials:r}}},function(t,e,i){var n=i(0),s=i(228),r=i(76),o=new n({Extends:r,Mixins:[s.Acceleration,s.Angular,s.Bounce,s.Debug,s.Drag,s.Enable,s.Friction,s.Gravity,s.Immovable,s.Mass,s.Size,s.Velocity],initialize:function(t,e,i,n,s){r.call(this,t,e,i,n,s),this.body=null}});t.exports=o},function(t,e,i){t.exports={CalculateFacesAt:i(235),CalculateFacesWithin:i(53),Copy:i(1326),CreateFromTiles:i(1327),CullTiles:i(1328),Fill:i(1329),FilterTiles:i(1330),FindByIndex:i(1331),FindTile:i(1332),ForEachTile:i(1333),GetTileAt:i(150),GetTileAtWorldXY:i(1334),GetTilesWithin:i(24),GetTilesWithinShape:i(1335),GetTilesWithinWorldXY:i(1336),HasTileAt:i(504),HasTileAtWorldXY:i(1337),IsInLayerBounds:i(104),PutTileAt:i(236),PutTileAtWorldXY:i(1338),PutTilesAt:i(1339),Randomize:i(1340),RemoveTileAt:i(505),RemoveTileAtWorldXY:i(1341),RenderDebug:i(1342),ReplaceByIndex:i(503),SetCollision:i(1343),SetCollisionBetween:i(1344),SetCollisionByExclusion:i(1345),SetCollisionByProperty:i(1346),SetCollisionFromCollisionGroup:i(1347),SetLayerCollisionIndex:i(153),SetTileCollision:i(65),SetTileIndexCallback:i(1348),SetTileLocationCallback:i(1349),Shuffle:i(1350),SwapByIndex:i(1351),TileToWorldX:i(151),TileToWorldXY:i(1352),TileToWorldY:i(152),WeightedRandomize:i(1353),WorldToTileX:i(66),WorldToTileXY:i(1354),WorldToTileY:i(67)}},function(t,e,i){var r=i(104);t.exports=function(t,e,i,n){if(void 0===i&&(i=!1),r(t,e,n)){var s=n.data[e][t]||null;return null!==s&&(-1!==s.index||i)?s:null}return null}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileWidth,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.x+e.scrollX*(1-s.scrollFactorX),n*=s.scaleX),r+t*n}},function(t,e){t.exports=function(t,e,i){var n=i.baseTileHeight,s=i.tilemapLayer,r=0;return s&&(void 0===e&&(e=s.scene.cameras.main),r=s.y+e.scrollY*(1-s.scrollFactorY),n*=s.scaleY),r+t*n}},function(t,e){t.exports=function(t,e,i){var n=i.collideIndexes.indexOf(t);e&&-1===n?i.collideIndexes.push(t):e||-1===n||i.collideIndexes.splice(n,1)}},function(t,e,i){var r=i(2);t.exports=function(t,e,i){if(!e)return{i:0,layers:t.layers,name:"",opacity:1,visible:!0,x:0,y:0};var n=e.x+r(e,"startx",0)*t.tilewidth+r(e,"offsetx",0),s=e.y+r(e,"starty",0)*t.tileheight+r(e,"offsety",0);return{i:0,layers:e.layers,name:i.name+e.name+"/",opacity:i.opacity*e.opacity,visible:i.visible&&e.visible,x:i.x+n,y:i.y+s}}},function(t,e){t.exports=function(o,a,t){return o.hasOwnProperty(a)?"function"==typeof o[a]?function(t,e,i,n,s,r){return o[a](t,e,i,n,s,r)}:function(){return o[a]}:"function"==typeof t?t:function(){return t}}},function(t,e,i){var R=i(243),L=i(15),F=i(90),D=i(71),k=i(155),I=i(526),B=i(241),N=i(6),Y=i(242),X=i(244),U=i(246);t.exports=function(t,e,i){void 0===i&&(i=R);for(var n=i.targets?i.targets:B(e),s=I(e),r=k(e,"delay",i.delay),o=k(e,"duration",i.duration),a=N(e,"easeParams",i.easeParams),h=D(N(e,"ease",i.ease),a),l=k(e,"hold",i.hold),u=k(e,"repeat",i.repeat),c=k(e,"repeatDelay",i.repeatDelay),d=F(e,"yoyo",i.yoyo),f=F(e,"flipX",i.flipX),p=F(e,"flipY",i.flipY),g=[],v=0;vh.getTotalFrames()&&(s=0),r=h.frames[s],0!==s||this.forward||(r=h.getLastFrame()),this.currentFrame=r):console.warn("Missing animation: "+a),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.setCurrentFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.setCurrentFrame(t),this.parent},playAfterDelay:function(t,e){var i,n;return this.isPlaying?(i=this.nextAnim,n=this.nextAnimsQueue,i&&n.unshift(i),this.nextAnim=t,this._pendingStop=1,this._pendingStopValue=e):(this.delayCounter=e,this.play(t,!0)),this.parent},playAfterRepeat:function(t,e){var i,n;return void 0===e&&(e=1),this.isPlaying?(i=this.nextAnim,n=this.nextAnimsQueue,i&&n.unshift(i),-1!==this.repeatCounter&&e>this.repeatCounter&&(e=this.repeatCounter),this.nextAnim=t,this._pendingStop=2,this._pendingStopValue=e):this.play(t),this.parent},play:function(t,e){void 0===e&&(e=!1);var i=this.currentAnim,n=this.parent,s="string"==typeof t?t:t.key;if(e&&this.isPlaying&&i.key===s)return n;if(i&&this.isPlaying){var r=this.animationManager.getMix(i.key,t);if(0this.repeatCounter&&(t=this.repeatCounter),this._pendingStop=2,this._pendingStopValue=t,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},getTotalFrames:function(){return this.currentAnim?this.currentAnim.getTotalFrames():0},update:function(t,e){var i=this.currentAnim;if(this.isPlaying&&i&&!i.paused){if(this.accumulator+=e*this.timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.stop();if(this.hasStarted){if(this.accumulator>=this.nextTick&&(this.forward?i.nextFrame(this):i.previousFrame(this),this.isPlaying&&0===this._pendingStop&&this.skipMissedFrames&&this.accumulator>this.nextTick))for(var n=0;this.forward?i.nextFrame(this):i.previousFrame(this),n++,this.accumulator>this.nextTick&&n<60;);}else this.accumulator>=this.delayCounter&&(this.accumulator-=this.delayCounter,this.handleStart())}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),t.setAlpha&&(e.alpha=t.alpha),e.setSizeToFrame(),e._originComponent&&(t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin()),this.isPlaying&&this.hasStarted&&(this.emitEvents(r.ANIMATION_UPDATE),3===this._pendingStop&&this._pendingStopValue===t&&this.stop()),e},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},get:function(t){return this.anims&&this.anims.get(t)},exists:function(t){return this.anims&&this.anims.has(t)},create:function(t){var e=t.key,i=!1;return e&&((i=this.get(e))||(i=new o(this,e,t),this.anims||(this.anims=new s),this.anims.set(e,i))),i},remove:function(t){var e=this.get(t);return e&&(this.currentAnim===e&&this.stop(),this.anims.delete(t)),e},destroy:function(){this.animationManager.off(r.REMOVE_ANIMATION,this.globalRemove,this),this.anims&&this.anims.clear(),this.animationManager=null,this.parent=null,this.nextAnim=null,this.nextAnimsQueue.length=0,this.currentAnim=null,this.currentFrame=null},isPaused:{get:function(){return this._paused}}});t.exports=a},function(t,e,i){var c={};t.exports=c;var o=i(251),r=i(44),a=i(103),d=i(64);c.create=function(t){return r.extend({id:r.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{}},t)},c.setModified=function(t,e,i,n){if(o.trigger(t,"compositeModified",t),t.isModified=e,i&&t.parent&&c.setModified(t.parent,e,i,n),n)for(var s=0;s=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(1+(s-r)).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},function(t,e,i){var n=i(307),s=i(310),r=i(312),o=i(313);t.exports=function(t){switch(typeof t){case"string":return("rgb"===t.substr(0,3).toLowerCase()?o:n)(t);case"number":return s(t);case"object":return r(t)}}},function(t,e){t.exports=function(t,e,i){return t<<16|e<<8|i}},function(t,e,i){var a=i(175);function h(t,e,i,n){var s=(t+6*e)%6,r=Math.min(s,4-s,1);return Math.round(255*(n-n*i*Math.max(0,r)))}t.exports=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1);var s=h(5,t,e,i),r=h(3,t,e,i),o=h(1,t,e,i);return n?n.setTo?n.setTo(s,r,o,n.alpha,!1):(n.r=s,n.g=r,n.b=o,n.color=a(s,r,o),n):{r:s,g:r,b:o,color:a(s,r,o)}}},function(t,e){var i="";function n(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;is.width&&(t=s.width-r.cutX),r.cutY+e>s.height&&(e=s.height-r.cutY),r.setSize(t,e,r.cutX,r.cutY)),this.updateDisplayOrigin();var a=this.input;return a&&!a.customHitArea&&(a.hitArea.width=t,a.hitArea.height=e),this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e,i,n,s,r){var o=this.gl,a=this.frame,h=this.texture,l=this.camera,u=this.renderer;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=a.cutWidth),void 0===r&&(r=a.cutHeight);var c,d,f,p,g,v,m,y,x,T,w=255&(t>>16|0),b=255&(t>>8|0),E=255&(0|t);return l.preRender(1,1),o?(c=l._cx,d=l._cy,f=l._cw,p=l._ch,u.resetTextures(!0),u.pushScissor(c,d,f,-p),u.setFramebuffer(this.framebuffer,!1),g=this.pipeline,v=h.width,m=h.height,y=g.width/v,x=g.height/m,g.drawFillRect(i*y,(m-r-n)*x,s*y,r*x,S.getTintFromFloats(w/255,b/255,E/255,1),e),g.flush(),u.setFramebuffer(null,!1),u.popScissor()):(T=this.context,u.setContext(T),T.fillStyle="rgba("+w+","+b+","+E+","+e+")",T.fillRect(i+a.cutX,n+a.cutY,s,r),u.setContext()),this.dirty=!0,this},clear:function(){var t,e,i;return this.dirty&&((t=this.gl)?((e=this.renderer).setFramebuffer(this.framebuffer,!0),this.frame.cutWidth===this.canvas.width&&this.frame.cutHeight===this.canvas.height||t.scissor(this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),e.setFramebuffer(null,!0)):((i=this.context).save(),i.setTransform(1,0,0,1,0,0),i.clearRect(this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight),i.restore()),this.dirty=!1),this},erase:function(t,e,i){this._eraseMode=!0;var n=this.renderer.currentBlendMode;return this.renderer.setBlendMode(o.ERASE),this.draw(t,e,i,1,16777215),this.renderer.setBlendMode(n),this._eraseMode=!1,this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r,o,a,h,l,u=this.gl,c=this.camera,d=this.renderer;return c.preRender(1,1),u?(r=c._cx,o=c._cy,a=c._cw,h=c._ch,d.resetTextures(!0),d.setFramebuffer(this.framebuffer,!1),d.pushScissor(r,o,a,h,h),l=this.pipeline,g(l,0,this.texture.width,0,this.texture.height,-1e3,1e3),this.batchList(t,e,i,n,s),d.setFramebuffer(null,!0),d.resetTextures(!0),g(l,0,l.width,l.height,0,-1e3,1e3)):(d.setContext(this.context),this.batchList(t,e,i,n,s),d.setContext()),this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o,a,h,l,u,c=this.gl,d=this.camera,f=this.renderer,p=this.textureManager.getFrame(t,e);return p&&(d.preRender(1,1),c?(o=d._cx,a=d._cy,h=d._cw,l=d._ch,f.resetTextures(!0),f.setFramebuffer(this.framebuffer,!1),f.pushScissor(o,a,h,l,l),u=this.pipeline,g(u,0,this.texture.width,0,this.texture.height,-1e3,1e3),u.batchTextureFrame(p,i+this.frame.cutX,n+this.frame.cutY,r,s,d.matrix,null),u.flush(),f.setFramebuffer(null,!1),f.popScissor(),g(u,0,u.width,u.height,0,-1e3,1e3)):this.batchTextureFrame(p,i+this.frame.cutX,n+this.frame.cutY,s,r),this.dirty=!0),this},batchList:function(t,e,i,n,s){for(var r=0;rs&&(r=t[s]),n[s]=r,t.length>s+1&&(r=t[s+1]),n[s+1]=r;return this},setColors:function(t){var e=this.points.length;if(e<1)return this;var i=this.colors;void 0===t?t=[16777215]:Array.isArray(t)||(t=[t]);var n=0;if(t.length===e)for(r=0;rn&&(s=t[n]),i[n]=s,t.length>n+1&&(s=t[n+1]),i[n+1]=s;return this},setPoints:function(t,e,i){if(void 0===t&&(t=2),"number"==typeof t){var n,s,r,o=t;if(o<2&&(o=2),t=[],this.horizontal)for(r=-this.frame.halfWidth,s=this.frame.width/(o-1),n=0;n=this._markerOut&&(e.loop?(e.currentTime=this._markerIn,this.updateTexture(),this._lastUpdate=t,this.emit(o.VIDEO_LOOP,this)):(this.emit(o.VIDEO_COMPLETE,this),this.stop())))},checkVideoProgress:function(){2<=this.video.readyState?this.updateTexture():(this.retry--,0e._dx?r<(s=t.right-e.x)&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType===o.STATIC_BODY&&(t.blocked.none=!1,t.blocked.right=!0),t.physicsType===o.STATIC_BODY&&(e.blocked.none=!1,e.blocked.left=!0)):t._dxe._dy?r<(s=t.bottom-e.y)&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType===o.STATIC_BODY&&(t.blocked.none=!1,t.blocked.down=!0),t.physicsType===o.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0)):t._dy=t.right||e.position.y>=t.bottom)}},function(t,e,i){var w={};t.exports=w;var o=i(88),b=i(102),a=i(250),h=i(103),l=i(542),u=i(44);w._warming=.4,w._torqueDampen=1,w._minLength=1e-6,w.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var i=e.bodyA?b.add(e.bodyA.position,e.pointA):e.pointA,n=e.bodyB?b.add(e.bodyB.position,e.pointB):e.pointB,s=b.magnitude(b.sub(i,n));e.length=void 0!==e.length?e.length:s,e.id=e.id||u.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(0t&&(t=s.totalDuration),s.delay=o.sleepThreshold&&u.set(o,!0)):0u._motionWakeThreshold*i&&u.set(a,!1)))}},u.set=function(t,e){var i=t.isSleeping;e?(t.isSleeping=!0,t.sleepCounter=t.sleepThreshold,t.positionImpulse.x=0,t.positionImpulse.y=0,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.anglePrev=t.angle,t.speed=0,t.angularSpeed=0,t.motion=0,i||n.trigger(t,"sleepStart")):(t.isSleeping=!1,t.sleepCounter=0,i&&n.trigger(t,"sleepEnd"))}},function(t,e,i){var n={};t.exports=n;var u=i(44);n.on=function(t,e,i){for(var n,s=e.split(" "),r=0;r=t.right&&(o=1,r+=s-t.right,s=t.right);break;case 1:(r+=e)>=t.bottom&&(o=2,s-=r-t.bottom,r=t.bottom);break;case 2:(s-=e)<=t.left&&(o=3,r-=t.left-s,s=t.left);break;case 3:(r-=e)<=t.top&&(o=0,r=t.top)}return n}},function(t,e){t.exports=function(t,e){void 0===e&&(e=1);for(var i=null,n=0;ne.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=n,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration}},destroy:function(){this.frame=void 0}});t.exports=n},function(t,e){t.exports=function(t){var i=/\D/g;return t.sort(function(t,e){return parseInt(t.replace(i,""),10)-parseInt(e.replace(i,""),10)}),t}},function(t,e,i){var n=i(172),s=i(0),r=i(92),o=i(12),a=i(122),h=i(21),T=i(2),d=i(6),f=i(173),p=i(302),l=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.mixes=new r,this.paused=!1,this.name="AnimationManager",t.events.once(h.BOOT,this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once(h.DESTROY,this.destroy,this)},addMix:function(t,e,i){var n,s=this.anims,r=this.mixes,o="string"==typeof t?t:t.key,a="string"==typeof e?e:e.key;return s.has(o)&&s.has(a)&&((n=(n=r.get(o))||{})[a]=i,r.set(o,n)),this},removeMix:function(t,e){var i,n=this.mixes,s="string"==typeof t?t:t.key,r=n.get(s);return r&&(e?(i="string"==typeof e?e:e.key,r.hasOwnProperty(i)&&delete r[i]):e||n.delete(s)),this},getMix:function(t,e){var i=this.mixes,n="string"==typeof t?t:t.key,s="string"==typeof e?e:e.key,r=i.get(n);return r&&r.hasOwnProperty(s)?r[s]:0},add:function(t,e){return this.anims.has(t)?console.warn("Animation key exists: "+t):(e.key=t,this.anims.set(t,e),this.emit(a.ADD_ANIMATION,t,e)),this},exists:function(t){return this.anims.has(t)},createFromAseprite:function(g,v){var m=[],t=this.game.cache.json.get(g);if(!t)return m;var y=this,e=d(t,"meta",null),x=d(t,"frames",null);return e&&x&&d(e,"frameTags",[]).forEach(function(t){var e=[],i=T(t,"name",null),n=T(t,"from",0),s=T(t,"to",0),r=T(t,"direction","forward");if(i&&(!v||v&&-1d.right&&(f=T(f,f+(e-d.right),this.lerp.x)),id.bottom&&(p=T(p,p+(i-d.bottom),this.lerp.y))):(f=T(f,e-l,this.lerp.x),p=T(p,i-u,this.lerp.y))),this.useBounds&&(f=this.clampX(f),p=this.clampY(p)),this.roundPixels&&(l=Math.round(l),u=Math.round(u));var g=(this.scrollX=f)+r,v=(this.scrollY=p)+o;this.midPoint.set(g,v);var m=n/a,y=s/a;this.worldView.setTo(g-m/2,v-y/2,m,y),h.applyITRS(this.x+l,this.y+u,this.rotation,a,a),h.translate(-l,-u),this.shakeEffect.preRender()},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=u(i,0,1),n=u(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var o=this.width/2,a=this.height/2,h=t.x-s,l=t.y-r;return this.midPoint.set(h,l),this.scrollX=h-o,this.scrollY=l-a,this.useBounds&&(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.rotateToEffect.reset(),this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.rotateToEffect.update(t,e),this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.clearRenderToTexture(),this.resetFX(),s.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=c},function(t,e,i){var o=i(32);t.exports=function(t){var e=new o;t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,e,i,n){return e+e+i+i+n+n});var i,n,s,r=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return r&&(i=parseInt(r[1],16),n=parseInt(r[2],16),s=parseInt(r[3],16),e.setTo(i,n,s)),e}},function(t,e){t.exports=function(t,e,i,n){return n<<24|t<<16|e<<8|i}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,l=r;return r!==s&&(r===t?a=(e-i)/o+(e>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},function(t,e,i){var n=i(32);t.exports=function(t){return new n(t.r,t.g,t.b,t.a)}},function(t,e,i){var a=i(32);t.exports=function(t){var e,i,n,s,r=new a,o=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase());return o&&(e=parseInt(o[1],10),i=parseInt(o[2],10),n=parseInt(o[3],10),s=void 0!==o[4]?parseFloat(o[4]):1,r.setTo(e,i,n,255*s)),r}},function(t,e,i){t.exports={Fade:i(688),Flash:i(689),Pan:i(690),Shake:i(723),RotateTo:i(724),Zoom:i(725)}},function(t,e,i){t.exports={In:i(691),Out:i(692),InOut:i(693)}},function(t,e,i){t.exports={In:i(694),Out:i(695),InOut:i(696)}},function(t,e,i){t.exports={In:i(697),Out:i(698),InOut:i(699)}},function(t,e,i){t.exports={In:i(700),Out:i(701),InOut:i(702)}},function(t,e,i){t.exports={In:i(703),Out:i(704),InOut:i(705)}},function(t,e,i){t.exports={In:i(706),Out:i(707),InOut:i(708)}},function(t,e,i){t.exports=i(709)},function(t,e,i){t.exports={In:i(710),Out:i(711),InOut:i(712)}},function(t,e,i){t.exports={In:i(713),Out:i(714),InOut:i(715)}},function(t,e,i){t.exports={In:i(716),Out:i(717),InOut:i(718)}},function(t,e,i){t.exports={In:i(719),Out:i(720),InOut:i(721)}},function(t,e,i){t.exports=i(722)},function(t,e,i){var n=i(0),a=i(34),h=i(328),l=i(2),u=i(6),c=i(7),d=i(180),f=i(1),p=i(184),g=i(174),s=new n({initialize:function(t){void 0===t&&(t={});this.width=u(t,"width",1024),this.height=u(t,"height",768),this.zoom=u(t,"zoom",1),this.resolution=u(t,"resolution",1),this.parent=u(t,"parent",void 0),this.scaleMode=u(t,"scaleMode",0),this.expandParent=u(t,"expandParent",!0),this.autoRound=u(t,"autoRound",!1),this.autoCenter=u(t,"autoCenter",0),this.resizeInterval=u(t,"resizeInterval",500),this.fullscreenTarget=u(t,"fullscreenTarget",null),this.minWidth=u(t,"minWidth",0),this.maxWidth=u(t,"maxWidth",0),this.minHeight=u(t,"minHeight",0),this.maxHeight=u(t,"maxHeight",0);var e=u(t,"scale",null);e&&(this.width=u(e,"width",this.width),this.height=u(e,"height",this.height),this.zoom=u(e,"zoom",this.zoom),this.resolution=u(e,"resolution",this.resolution),this.parent=u(e,"parent",this.parent),this.scaleMode=u(e,"mode",this.scaleMode),this.expandParent=u(e,"expandParent",this.expandParent),this.autoRound=u(e,"autoRound",this.autoRound),this.autoCenter=u(e,"autoCenter",this.autoCenter),this.resizeInterval=u(e,"resizeInterval",this.resizeInterval),this.fullscreenTarget=u(e,"fullscreenTarget",this.fullscreenTarget),this.minWidth=u(e,"min.width",this.minWidth),this.maxWidth=u(e,"max.width",this.maxWidth),this.minHeight=u(e,"min.height",this.minHeight),this.maxHeight=u(e,"max.height",this.maxHeight)),this.renderType=u(t,"type",a.AUTO),this.canvas=u(t,"canvas",null),this.context=u(t,"context",null),this.canvasStyle=u(t,"canvasStyle",null),this.customEnvironment=u(t,"customEnvironment",!1),this.sceneConfig=u(t,"scene",null),this.seed=u(t,"seed",[(Date.now()*Math.random()).toString()]),d.RND=new d.RandomDataGenerator(this.seed),this.gameTitle=u(t,"title",""),this.gameURL=u(t,"url","https://phaser.io"),this.gameVersion=u(t,"version",""),this.autoFocus=u(t,"autoFocus",!0),this.domCreateContainer=u(t,"dom.createContainer",!1),this.domBehindCanvas=u(t,"dom.behindCanvas",!1),this.inputKeyboard=u(t,"input.keyboard",!0),this.inputKeyboardEventTarget=u(t,"input.keyboard.target",window),this.inputKeyboardCapture=u(t,"input.keyboard.capture",[]),this.inputMouse=u(t,"input.mouse",!0),this.inputMouseEventTarget=u(t,"input.mouse.target",null),this.inputMouseCapture=u(t,"input.mouse.capture",!0),this.inputTouch=u(t,"input.touch",h.input.touch),this.inputTouchEventTarget=u(t,"input.touch.target",null),this.inputTouchCapture=u(t,"input.touch.capture",!0),this.inputActivePointers=u(t,"input.activePointers",1),this.inputSmoothFactor=u(t,"input.smoothFactor",0),this.inputWindowEvents=u(t,"input.windowEvents",!0),this.inputGamepad=u(t,"input.gamepad",!1),this.inputGamepadEventTarget=u(t,"input.gamepad.target",window),this.disableContextMenu=u(t,"disableContextMenu",!1),this.audio=u(t,"audio"),this.hideBanner=!1===u(t,"banner",null),this.hidePhaser=u(t,"banner.hidePhaser",!1),this.bannerTextColor=u(t,"banner.text","#ffffff"),this.bannerBackgroundColor=u(t,"banner.background",["#ff0000","#ffff00","#00ff00","#00ffff","#000000"]),""===this.gameTitle&&this.hidePhaser&&(this.hideBanner=!0),this.fps=u(t,"fps",null);var i=u(t,"render",t);this.antialias=u(i,"antialias",!0),this.antialiasGL=u(i,"antialiasGL",!0),this.mipmapFilter=u(i,"mipmapFilter","LINEAR"),this.desynchronized=u(i,"desynchronized",!1),this.roundPixels=u(i,"roundPixels",!1),this.pixelArt=u(i,"pixelArt",1!==this.zoom),this.pixelArt&&(this.antialias=!1,this.roundPixels=!0),this.transparent=u(i,"transparent",!1),this.clearBeforeRender=u(i,"clearBeforeRender",!0),this.premultipliedAlpha=u(i,"premultipliedAlpha",!0),this.failIfMajorPerformanceCaveat=u(i,"failIfMajorPerformanceCaveat",!1),this.powerPreference=u(i,"powerPreference","default"),this.batchSize=u(i,"batchSize",4096),this.maxTextures=u(i,"maxTextures",-1),this.maxLights=u(i,"maxLights",10);var n=u(t,"backgroundColor",0);this.backgroundColor=g(n),0===n&&this.transparent&&(this.backgroundColor.alpha=0),this.preBoot=u(t,"callbacks.preBoot",f),this.postBoot=u(t,"callbacks.postBoot",f),this.physics=u(t,"physics",{}),this.defaultPhysicsSystem=u(this.physics,"default",!1),this.loaderBaseURL=u(t,"loader.baseURL",""),this.loaderPath=u(t,"loader.path",""),this.loaderMaxParallelDownloads=u(t,"loader.maxParallelDownloads",32),this.loaderCrossOrigin=u(t,"loader.crossOrigin",void 0),this.loaderResponseType=u(t,"loader.responseType",""),this.loaderAsync=u(t,"loader.async",!0),this.loaderUser=u(t,"loader.user",""),this.loaderPassword=u(t,"loader.password",""),this.loaderTimeout=u(t,"loader.timeout",0),this.loaderWithCredentials=u(t,"loader.withCredentials",!1),this.installGlobalPlugins=[],this.installScenePlugins=[];var s=u(t,"plugins",null),r=p.DefaultScene;s&&(Array.isArray(s)?this.defaultPlugins=s:c(s)&&(this.installGlobalPlugins=l(s,"global",[]),this.installScenePlugins=l(s,"scene",[]),Array.isArray(s.default)?r=s.default:Array.isArray(s.defaultMerge)&&(r=r.concat(s.defaultMerge)))),this.defaultPlugins=r;var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg";this.defaultImage=u(t,"images.default",o+"AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="),this.missingImage=u(t,"images.missing",o+"CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="),window&&(window.FORCE_WEBGL?this.renderType=a.WEBGL:window.FORCE_CANVAS&&(this.renderType=a.CANVAS))}});t.exports=s},function(t,e,i){t.exports={os:i(125),browser:i(126),features:i(179),input:i(756),audio:i(757),video:i(758),fullscreen:i(759),canvasFeatures:i(329)}},function(t,e,i){var n,s,r,o=i(26),a={supportInverseAlpha:!1,supportNewBlendModes:!1};t.exports=(void 0!==document&&(a.supportNewBlendModes=(n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",s="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",(r=new Image).onload=function(){var i=new Image;i.onload=function(){var t=o.create(i,6,1).getContext("2d");if(t.globalCompositeOperation="multiply",t.drawImage(r,0,0),t.drawImage(i,2,0),!t.getImageData(2,0,1,1))return!1;var e=t.getImageData(2,0,1,1).data;o.remove(i),a.supportNewBlendModes=255===e[0]&&0===e[1]&&0===e[2]},i.src=n+"/wCKxvRF"+s},r.src=n+"AP804Oa6"+s,!1),a.supportInverseAlpha=function(){var t=o.create(this,2,1).getContext("2d");t.fillStyle="rgba(10, 20, 30, 0.5)",t.fillRect(0,0,1,1);var e=t.getImageData(0,0,1,1);if(null===e)return!1;t.putImageData(e,1,0);var i=t.getImageData(1,0,1,1);return i.data[0]===e.data[0]&&i.data[1]===e.data[1]&&i.data[2]===e.data[2]&&i.data[3]===e.data[3]}()),a)},function(t,e){t.exports=function(t,e,i,n){return Math.atan2(n-e,i-t)}},function(t,e){t.exports=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}},function(t,e){t.exports=function(t){return 0<=(t%=2*Math.PI)?t:t+2*Math.PI}},function(t,e){t.exports=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}},function(t,e){t.exports=function(t,e,i,n){var s=t-i,r=e-n;return s*s+r*r}},function(t,e){t.exports=function(t,e,i){return void 0===i&&(i=1e-4),e-ir[0]&&(e=1),r[8]>r[3*e+e]&&(e=2),i=a[e],n=a[i],s=Math.sqrt(r[3*e+e]-r[3*i+i]-r[3*n+n]+1),h[e]=.5*s,s=.5/s,h[i]=(r[3*i+e]+r[3*e+i])*s,h[n]=(r[3*n+e]+r[3*e+n])*s,this.x=h[0],this.y=h[1],this.z=h[2],this.w=(r[3*n+i]-r[3*i+n])*s),this}});t.exports=d},function(t,e,a){var h=a(350),l=a(26),u=a(34),c=a(179);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===u.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==u.HEADLESS)if(e.renderType===u.CANVAS||e.renderType!==u.CANVAS&&!c.webGL){if(!c.canvas)throw new Error("Cannot create Canvas or WebGL context, aborting.");e.renderType=u.CANVAS}else e.renderType=u.WEBGL;e.antialias||l.disableSmoothing();var i,n,s=t.scale.baseSize,r=s.width,o=s.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=r,t.canvas.height=o):t.canvas=l.create(t,r,o,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||h.setCrisp(t.canvas),e.renderType!==u.HEADLESS&&(i=a(532),n=a(535),e.renderType===u.WEBGL?t.renderer=new n(t):(t.renderer=new i(t),t.context=t.renderer.gameContext))}},function(t,e){t.exports={setCrisp:function(e){return["optimizeSpeed","-moz-crisp-edges","-o-crisp-edges","-webkit-optimize-contrast","optimize-contrast","crisp-edges","pixelated"].forEach(function(t){e.style["image-rendering"]=t}),e.style.msInterpolationMode="nearest-neighbor",e},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var l=i(34);t.exports=function(t){var e,i,n,s,r,o,a,h=t.config;h.hideBanner||(e="WebGL",h.renderType===l.CANVAS?e="Canvas":h.renderType===l.HEADLESS&&(e="Headless"),i=h.audio,a=!(n=t.device.audio).webAudio||i&&i.disableWebAudio?i&&i.noAudio||!n.webAudio&&!n.audioData?"No Audio":"HTML5 Audio":"Web Audio",t.device.browser.ie?window.console&&console.log("Phaser v"+l.VERSION+" / https://phaser.io"):(r=[s=""],Array.isArray(h.bannerBackgroundColor)?(h.bannerBackgroundColor.forEach(function(t){s=s.concat("%c "),r.push("background: "+t),o=t}),r[r.length-1]="color: "+h.bannerTextColor+"; background: "+o):(s=s.concat("%c "),r.push("color: "+h.bannerTextColor+"; background: "+h.bannerBackgroundColor)),r.push("background: #fff"),h.gameTitle&&(s=s.concat(h.gameTitle),h.gameVersion&&(s=s.concat(" v"+h.gameVersion)),h.hidePhaser||(s=s.concat(" / "))),h.hidePhaser||(s=s.concat("Phaser v"+l.VERSION+" ("+e+" | "+a+")")),s=s.concat(" %c "+h.gameURL),r[0]=s,console.log.apply(console,r)))}},function(t,e,i){var n=i(0),s=i(6),r=i(1),o=i(353),a=new n({initialize:function(t,e){this.game=t,this.raf=new o,this.started=!1,this.running=!1,this.minFps=s(e,"min",5),this.targetFps=s(e,"target",60),this._min=1e3/this.minFps,this._target=1e3/this.targetFps,this.actualFps=this.targetFps,this.nextFpsUpdate=0,this.framesThisSecond=0,this.callback=r,this.forceSetTimeOut=s(e,"forceSetTimeOut",!1),this.time=0,this.startTime=0,this.lastTime=0,this.frame=0,this.inFocus=!0,this._pauseTime=0,this._coolDown=0,this.delta=0,this.deltaIndex=0,this.deltaHistory=[],this.deltaSmoothingMax=s(e,"deltaHistory",10),this.panicMax=s(e,"panicMax",120),this.rawDelta=0,this.now=0,this.smoothStep=s(e,"smoothStep",!0)},blur:function(){this.inFocus=!1},focus:function(){this.inFocus=!0,this.resetDelta()},pause:function(){this._pauseTime=window.performance.now()},resume:function(){this.resetDelta(),this.startTime+=this.time-this._pauseTime},resetDelta:function(){var t=window.performance.now();this.time=t,this.lastTime=t,this.nextFpsUpdate=t+1e3;for(var e=this.framesThisSecond=0;ethis._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var a=o=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),this.lastTime=t,this.frame++},tick:function(){this.step()},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){this.running||(t&&(this.startTime+=-this.lastTime+(this.lastTime+window.performance.now())),this.raf.start(this.step.bind(this),this.useRAF),this.running=!0,this.step())},getDuration:function(){return Math.round(this.lastTime-this.startTime)/1e3},getDurationMS:function(){return Math.round(this.lastTime-this.startTime)},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.callback=r,this.raf=null,this.game=null}});t.exports=a},function(t,e,i){var n=i(0),s=i(1),r=new n({initialize:function(){this.isRunning=!1,this.callback=s,this.tick=0,this.isSetTimeOut=!1,this.timeOutID=null,this.lastTime=0,this.target=0;var n=this;this.step=function t(){var e=window.performance.now();n.lastTime=n.tick,n.tick=e,n.callback(e),n.timeOutID=window.requestAnimationFrame(t)},this.stepTimeout=function t(){var e=Date.now(),i=Math.min(Math.max(2*n.target+n.tick-e,0),n.target);n.lastTime=n.tick,n.tick=e,n.callback(e),n.timeOutID=window.setTimeout(t,i)}},start:function(t,e,i){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.target=i,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=s}});t.exports=r},function(t,e,i){var n=i(21);t.exports=function(t){var e,i=t.events;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach(function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")});e&&document.addEventListener(e,function(t){document.hidden||"pause"===t.type?i.emit(n.HIDDEN):i.emit(n.VISIBLE)},!1),window.onblur=function(){i.emit(n.BLUR)},window.onfocus=function(){i.emit(n.FOCUS)},window.focus&&t.config.autoFocus&&window.focus()}},function(t,e,i){var m=i(356),y=i(26),x=i(6);t.exports=function(t){var e=x(t,"data",[]),i=x(t,"canvas",null),n=x(t,"palette",m),s=x(t,"pixelWidth",1),r=x(t,"pixelHeight",s),o=x(t,"resizeCanvas",!0),a=x(t,"clearCanvas",!0),h=x(t,"preRender",null),l=x(t,"postRender",null),u=Math.floor(Math.abs(e[0].length*s)),c=Math.floor(Math.abs(e.length*r));i||(i=y.create2D(this,u,c),a=o=!1),o&&(i.width=u,i.height=c);var d=i.getContext("2d");a&&d.clearRect(0,0,u,c),h&&h(i,d);for(var f=0;fi.length-2?i.length-1:s+1],l=i[s>i.length-3?i.length-1:s+2];return e.set(u(r,o.x,a.x,h.x,l.x),u(r,o.y,a.y,h.y,l.y))},toJSON:function(){for(var t=[],e=0;ei.width?s.ORIENTATION.PORTRAIT:s.ORIENTATION.LANDSCAPE;if("number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?s.ORIENTATION.PORTRAIT:s.ORIENTATION.LANDSCAPE;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return s.ORIENTATION.PORTRAIT;if(window.matchMedia("(orientation: landscape)").matches)return s.ORIENTATION.LANDSCAPE}return tthis.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var e=this.listeners;window.removeEventListener("orientationchange",e.orientationChange,!1),window.removeEventListener("resize",e.windowResize,!1);["webkit","moz",""].forEach(function(t){document.removeEventListener(t+"fullscreenchange",e.fullScreenChange,!1),document.removeEventListener(t+"fullscreenerror",e.fullScreenError,!1)}),document.removeEventListener("MSFullscreenChange",e.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",e.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.fullscreenTarget=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy()},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===c.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===c.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=v},function(t,e,i){var n=i(17),s=i(0),r=i(95),o=i(3),a=new s({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===n&&(n=null),this._width=t,this._height=e,this._parent=n,this.aspectMode=i,this.aspectRatio=0===e?1:t/e,this.minWidth=0,this.minHeight=0,this.maxWidth=Number.MAX_VALUE,this.maxHeight=Number.MAX_VALUE,this.snapTo=new o},setAspectMode:function(t){return void 0===t&&(t=0),this.aspectMode=t,this.setSize(this._width,this._height)},setSnap:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.snapTo.set(t,e),this.setSize(this._width,this._height)},setParent:function(t){return this._parent=t,this.setSize(this._width,this._height)},setMin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.minWidth=n(t,0,this.maxWidth),this.minHeight=n(e,0,this.maxHeight),this.setSize(this._width,this._height)},setMax:function(t,e){return void 0===t&&(t=Number.MAX_VALUE),void 0===e&&(e=t),this.maxWidth=n(t,this.minWidth,Number.MAX_VALUE),this.maxHeight=n(e,this.minHeight,Number.MAX_VALUE),this.setSize(this._width,this._height)},setSize:function(t,e){switch(void 0===t&&(t=0),void 0===e&&(e=t),this.aspectMode){case a.NONE:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height;break;case a.WIDTH_CONTROLS_HEIGHT:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(this._width*(1/this.aspectRatio),!1);break;case a.HEIGHT_CONTROLS_WIDTH:this._height=this.getNewHeight(r(e,this.snapTo.y)),this._width=this.getNewWidth(this._height*this.aspectRatio,!1);break;case a.FIT:this.constrain(t,e,!0);break;case a.ENVELOP:this.constrain(t,e,!1)}return this},setAspectRatio:function(t){return this.aspectRatio=t,this.setSize(this._width,this._height)},resize:function(t,e){return this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height,this},getNewWidth:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minWidth,this.maxWidth),e&&this._parent&&t>this._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var n=this.snapTo,s=0===e?1:t/e;return i&&this.aspectRatio>s||!i&&this.aspectRatios)&&(t=(e=r(e,n.y))*this.aspectRatio,0r.START&&n.settings.status<=r.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e=r.LOADING&&i.settings.status=r.x&&t=r.y&&e=r.x&&t=r.y&&e=n-this.manager.loopEndOffset?(this.audio.currentTime=i+Math.max(0,s-n),s=this.audio.currentTime):s>4,l[a++]=(15&i)<<4|n>>2,l[a++]=(3&n)<<6|63&s;return h}},function(t,e,i){var n=i(136),s=i(0),r=i(61),o=new s({Extends:n,initialize:function(t,e,i){if(void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),!this.audioBuffer)throw new Error('There is no audio asset with key "'+e+'" in the audio cache');this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,n.call(this,t,e,i)},play:function(t,e){return!!n.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit(r.PLAY,this),!0)},pause:function(){return!(this.manager.context.currentTime>>16,v=(65280&d)>>>8,m=255&d,l.strokeStyle="rgba("+g+","+v+","+m+","+u+")",l.lineWidth=p,y+=3;break;case x.FILL_STYLE:f=a[y+1],c=a[y+2],g=(16711680&f)>>>16,v=(65280&f)>>>8,m=255&f,l.fillStyle="rgba("+g+","+v+","+m+","+c+")",y+=2;break;case x.BEGIN_PATH:l.beginPath();break;case x.CLOSE_PATH:l.closePath();break;case x.FILL_PATH:o||l.fill();break;case x.STROKE_PATH:o||l.stroke();break;case x.FILL_RECT:o?l.rect(a[y+1],a[y+2],a[y+3],a[y+4]):l.fillRect(a[y+1],a[y+2],a[y+3],a[y+4]),y+=4;break;case x.FILL_TRIANGLE:l.beginPath(),l.moveTo(a[y+1],a[y+2]),l.lineTo(a[y+3],a[y+4]),l.lineTo(a[y+5],a[y+6]),l.closePath(),o||l.fill(),y+=6;break;case x.STROKE_TRIANGLE:l.beginPath(),l.moveTo(a[y+1],a[y+2]),l.lineTo(a[y+3],a[y+4]),l.lineTo(a[y+5],a[y+6]),l.closePath(),o||l.stroke(),y+=6;break;case x.LINE_TO:l.lineTo(a[y+1],a[y+2]),y+=2;break;case x.MOVE_TO:l.moveTo(a[y+1],a[y+2]),y+=2;break;case x.LINE_FX_TO:l.lineTo(a[y+1],a[y+2]),y+=5;break;case x.MOVE_FX_TO:l.moveTo(a[y+1],a[y+2]),y+=5;break;case x.SAVE:l.save();break;case x.RESTORE:l.restore();break;case x.TRANSLATE:l.translate(a[y+1],a[y+2]),y+=2;break;case x.SCALE:l.scale(a[y+1],a[y+2]),y+=2;break;case x.ROTATE:l.rotate(a[y+1]),y+=1;break;case x.GRADIENT_FILL_STYLE:y+=5;break;case x.GRADIENT_LINE_STYLE:y+=6;break;case x.SET_TEXTURE:y+=2}}l.restore()}}},function(t,e,i){var n=i(0),s=i(127),r=i(71),o=i(2),a=i(59),h=new n({initialize:function(t,e,i,n){void 0===n&&(n=!1),this.propertyKey=e,this.propertyValue=i,this.defaultValue=i,this.steps=0,this.counter=0,this.start=0,this.end=0,this.ease,this.emitOnly=n,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.loadConfig(t)},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=o(t,this.propertyKey,this.defaultValue),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return this.propertyValue},onChange:function(t){return this.propertyValue=t,this.setMethods()},setMethods:function(){var t,e,i,n=this.propertyValue,s=typeof n;return"number"==s?(this.onEmit=this.staticValueEmit,this.onUpdate=this.staticValueUpdate):Array.isArray(n)?this.onEmit=this.randomStaticValueEmit:"function"==s?this.emitOnly?this.onEmit=n:this.onUpdate=n:"object"==s&&(this.has(n,"random")||this.hasBoth(n,"start","end")||this.hasBoth(n,"min","max"))?(this.start=this.has(n,"start")?n.start:n.min,this.end=this.has(n,"end")?n.end:n.max,(t=this.hasBoth(n,"min","max")||!!n.random)&&(e=n.random,Array.isArray(e)&&(this.start=e[0],this.end=e[1]),this.onEmit=this.randomRangedValueEmit),this.has(n,"steps")?(this.steps=n.steps,this.counter=this.start,this.onEmit=this.steppedEmit):(i=this.has(n,"ease")?n.ease:"Linear",this.ease=r(i),t||(this.onEmit=this.easedValueEmit),this.onUpdate=this.easeValueUpdate)):"object"==s&&this.hasEither(n,"onEmit","onUpdate")&&(this.has(n,"onEmit")&&(this.onEmit=n.onEmit),this.has(n,"onUpdate")&&(this.onUpdate=n.onUpdate)),this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,n){return n},staticValueEmit:function(){return this.propertyValue},staticValueUpdate:function(){return this.propertyValue},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.propertyValue[t]},randomRangedValueEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i),i},steppedEmit:function(){var t=this.counter,e=this.counter+(this.end-this.start)/this.steps;return this.counter=a(e,this.start,this.end),t},easedValueEmit:function(t,e){var i;return t&&t.data[e]&&((i=t.data[e]).min=this.start,i.max=this.end),this.start},easeValueUpdate:function(t,e,i){var n=t.data[e];return(n.max-n.min)*this.ease(i)+n.min}});t.exports=h},function(t,e,i){var n=i(0),o=i(2),s=new n({initialize:function(t,e,i,n,s){var r;"object"==typeof t?(t=o(r=t,"x",0),e=o(r,"y",0),i=o(r,"power",0),n=o(r,"epsilon",100),s=o(r,"gravity",50)):(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===s&&(s=50)),this.x=t,this.y=e,this.active=!0,this._gravity=s,this._power=0,this._epsilon=0,this.power=i,this.epsilon=n},update:function(t,e){var i,n,s=this.x-t.x,r=this.y-t.y,o=s*s+r*r;0!==o&&(i=Math.sqrt(o),oe.right&&t.collideRight&&(this.x=e.right,this.velocityX*=i),this.ye.bottom&&t.collideBottom&&(this.y=e.bottom,this.velocityY*=i)},update:function(t,e,i){if(0this._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=n},function(t,e){t.exports=function(t,e){for(var i=0;id.PI2?s=d.PI2:s<0&&(s=d.PI2+s%d.PI2);for(var a,h=[r+Math.cos(n)*i,o+Math.sin(n)*i];e<1;)a=s*e+n,h.push(r+Math.cos(a)*i,o+Math.sin(a)*i),e+=t;return a=s+n,h.push(r+Math.cos(a)*i,o+Math.sin(a)*i),h.push(r+Math.cos(n)*i,o+Math.sin(n)*i),this.pathIndexes=u(h),this.pathData=h,this}});t.exports=r},function(t,e,i){var n=i(0),s=i(1023),r=i(60),o=i(9),a=i(30),h=new n({Extends:a,Mixins:[s],initialize:function(t,e,i,n,s,r){void 0===e&&(e=0),void 0===i&&(i=0),a.call(this,t,"Curve",n),this._smoothness=32,this._curveBounds=new o,this.closePath=!1,this.setPosition(e,i),void 0!==s&&this.setFillStyle(s,r),this.updateData()},smoothness:{get:function(){return this._smoothness},set:function(t){this._smoothness=t,this.updateData()}},setSmoothness:function(t){return this._smoothness=t,this.updateData()},updateData:function(){var t=this._curveBounds,e=this._smoothness;this.geom.getBounds(t,e),this.setSize(t.width,t.height),this.updateDisplayOrigin();for(var i=[],n=this.geom.getPoints(e),s=0;st.right||e.rightt.bottom||e.bottome.right||t.righte.bottom||t.bottome.right||t.righte.bottom||t.bottomt.width*t.height)&&(e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(s.BUTTON_DOWN,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(s.BUTTON_UP,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=r},function(t,e,i){var a=i(472),h=i(473),n=i(0),l=i(12),u=i(3),s=new n({Extends:l,initialize:function(t,e){l.call(this),this.manager=t,this.pad=e,this.id=e.id,this.index=e.index;for(var i=[],n=0;n=s;for(this.fixedStep||(n=.001*e,o=!0,this._elapsed=0),h=0;h=s;)this._elapsed-=s,this.step(n)}},step:function(t){for(var e,i=this.bodies.entries,n=i.length,s=0;sc)&&(d.xu))return this.separateCircle(t,e,s)}var f=!1,p=!1;s?(f=A(t,e,s,this.OVERLAP_BIAS),p=C(t,e,s,this.OVERLAP_BIAS)):this.forceX||Math.abs(this.gravity.y+t.gravity.y)=e.right||t.position.y>=e.bottom))},circleBodyIntersects:function(t,e){var i=p(t.center.x,e.left,e.right),n=p(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!0)},collide:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!1)},collideObjects:function(t,e,i,n,s,r){var o;t.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);var a=Array.isArray(t),h=Array.isArray(e);if(this._total=0,a||h)if(!a&&h)for(o=0;od.baseTileWidth&&(h-=a=(d.tileWidth-d.baseTileWidth)*e.scaleX,u+=a),d.tileHeight>d.baseTileHeight&&(c+=(d.tileHeight-d.baseTileHeight)*e.scaleY);var f=e.getTilesWithinWorldXY(h,l,u,c);return 0!==f.length&&this.collideSpriteVsTilesHandler(t,f,i,n,s,r,!0)},collideSpriteVsTilesHandler:function(t,e,i,n,s,r,o){for(var a,h,l=t.body,u={left:0,right:0,top:0,bottom:0},c=!1,d=0;de.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,r=this.blocked.right=!0),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,r=this.blocked.down=!0),r&&(this.blocked.none=!1),r},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this.updateCenter(),this},setSize:function(t,e,i){void 0===i&&(i=!0);var n,s,r=this.gameObject;return!t&&r.frame&&(t=r.frame.realWidth),!e&&r.frame&&(e=r.frame.realHeight),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&r.getCenter&&(n=(r.width-t)/2,s=(r.height-e)/2,this.offset.set(n,s)),this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),0=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-e)*(this.center.y-e)<=this.radius*this.radius:h(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return 0=t.minX&&e.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,i,n,s){for(var r,o=[e,i];o.length;)(i=o.pop())-(e=o.pop())<=n||(r=e+Math.ceil((i-e)/n/2)*n,a(t,r,e,i,s),o.push(e,r,r,i))}n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!l(t,e))return i;for(var s,r,o,a,h=[];e;){for(s=0,r=e.children.length;sthis._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)},_split:function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var r=this._chooseSplitIndex(i,s,n),o=p(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,f(i,this.toBBox),f(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)},_splitRoot:function(t,e){this.data=p([t,e]),this.data.height=t.height+1,this.data.leaf=!1,f(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){for(var n,s,r,o,a,h,l,u,c,d,f,p,g=a=1/0,v=e;v<=i-e;v++)n=m(t,0,v,this.toBBox),s=m(t,v,i,this.toBBox),l=n,u=s,p=f=d=c=void 0,c=Math.max(l.minX,u.minX),d=Math.max(l.minY,u.minY),f=Math.min(l.maxX,u.maxX),p=Math.min(l.maxY,u.maxY),r=Math.max(0,f-c)*Math.max(0,p-d),o=y(n)+y(s),re.deltaAbsY()?g=-1:e.deltaAbsX()i&&s<(o=t.right-i)&&(o=0),0!==o&&(t.customSeparateX?t.overlapX=o:c(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.left=!0):0i&&s<(o=t.bottom-i)&&(o=0),0!==o&&(t.customSeparateY?t.overlapY=o:c(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):0=r.layers.length){if(s.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}r=s.pop()}else{var o,a=r.layers[r.i];if(r.i++,"tilelayer"===a.type)if(a.compression)console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+a.name+"'");else{if(a.encoding&&"base64"===a.encoding){if(a.chunks)for(var h=0;h>>0;return n}},function(t,e,i){var h=i(2),l=i(154);t.exports=function(t){for(var e=[],i=[],n=l(t);n.i=n.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}n=i.pop()}else{var s,r,o,a=n.layers[n.i];n.i++,"imagelayer"===a.type?(s=h(a,"offsetx",0)+h(a,"startx",0),r=h(a,"offsety",0)+h(a,"starty",0),e.push({name:n.name+a.name,image:a.image,x:n.x+s+a.x,y:n.y+r+a.y,alpha:n.opacity*a.opacity,visible:n.visible&&a.visible,properties:h(a,"properties",{})})):"group"===a.type&&(o=l(t,a,n),i.push(n),n=o)}return e}},function(t,e,i){var x=i(107),T=i(513),w=i(239);t.exports=function(t){for(var e,i=[],n=[],s=null,r=0;r=this.firstgid&&t=n.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}n=i.pop()}else{var s,r=n.layers[n.i];if(n.i++,r.opacity*=n.opacity,r.visible=n.visible&&r.visible,"objectgroup"===r.type){r.name=n.name+r.name;for(var o=n.x+d(r,"startx",0)+d(r,"offsetx",0),a=n.y+d(r,"starty",0)+d(r,"offsety",0),h=[],l=0;ln&&(n=e.layer[r].width),e.layer[r].height>s&&(s=e.layer[r].height);var o=new h({width:n,height:s,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:a.WELTMEISTER});return o.layers=l(e,i),o.tilesets=u(e),o}},function(t,e,i){var d=i(105),f=i(75);t.exports=function(t,e){for(var i=[],n=0;nx||!a.visible||(T=this.batchTile(T,a,c,p,g,t,e));else if(1===m)for(h=0;hx||!a.visible||(T=this.batchTile(T,a,c,p,g,t,e));else if(2===m)for(h=f-1;0<=h;h--)for(l=0;lx||!a.visible||(T=this.batchTile(T,a,c,p,g,t,e));else if(3===m)for(h=f-1;0<=h;h--)for(l=d-1;0<=l;l--)!(a=v[h][l])||a.indexx||!a.visible||(T=this.batchTile(T,a,c,p,g,t,e));return this.dirty[e]=!1,null===r&&(r=n.createVertexBuffer(o,s.STATIC_DRAW),this.vertexBuffer[e]=r),n.setVertexBuffer(r),i.setAttribPointers(),s.bufferSubData(s.ARRAY_BUFFER,0,o),this},batchTile:function(t,e,i,n,s,r,o){var a=i.getTileTextureCoordinates(e.index);if(!a)return t;var h=i.tileWidth,l=i.tileHeight,u=h/2,c=l/2,d=a.x/n,f=a.y/s,p=(a.x+h)/n,g=(a.y+l)/s,v=this._tempMatrix,m=-u,y=-c;e.flipX&&(h*=-1,m+=i.tileWidth),e.flipY&&(l*=-1,y+=i.tileHeight);var x=m+h,T=y+l;v.applyITRS(u+e.pixelX,c+e.pixelY,e.rotation,1,1);var w=L.getTintAppendFloatAlpha(16777215,r.alpha*this.alpha*e.alpha),b=v.getX(m,y),E=v.getY(m,y),S=v.getX(m,T),_=v.getY(m,T),A=v.getX(x,T),C=v.getY(x,T),M=v.getX(x,y),O=v.getY(x,y);r.roundPixels&&(b=Math.round(b),E=Math.round(E),S=Math.round(S),_=Math.round(_),A=Math.round(A),C=Math.round(C),M=Math.round(M),O=Math.round(O));var P=this.vertexViewF32[o],R=this.vertexViewU32[o];return P[++t]=b,P[++t]=E,P[++t]=d,P[++t]=f,P[++t]=0,P[++t]=0,R[++t]=w,P[++t]=S,P[++t]=_,P[++t]=d,P[++t]=g,P[++t]=0,P[++t]=0,R[++t]=w,P[++t]=A,P[++t]=C,P[++t]=p,P[++t]=g,P[++t]=0,P[++t]=0,R[++t]=w,P[++t]=b,P[++t]=E,P[++t]=d,P[++t]=f,P[++t]=0,P[++t]=0,R[++t]=w,P[++t]=A,P[++t]=C,P[++t]=p,P[++t]=g,P[++t]=0,P[++t]=0,R[++t]=w,P[++t]=M,P[++t]=O,P[++t]=p,P[++t]=f,P[++t]=0,P[++t]=0,R[++t]=w,this.vertexCount[o]+=6,t},setRenderOrder:function(t){if("string"==typeof t&&(t=["right-down","left-down","right-up","left-up"].indexOf(t)),0<=t&&t<4){this._renderOrder=t;for(var e=0;ethis.vertexCapacity&&(this.flush(),x=!0,y=this.setTexture2D(m));var T=this.vertexViewF32,w=this.vertexViewU32,b=this.vertexCount*this.vertexComponentCount-1;return T[++b]=t,T[++b]=e,T[++b]=h,T[++b]=l,T[++b]=v,w[++b]=d,T[++b]=i,T[++b]=n,T[++b]=h,T[++b]=c,T[++b]=v,w[++b]=p,T[++b]=s,T[++b]=r,T[++b]=u,T[++b]=c,T[++b]=v,w[++b]=g,T[++b]=t,T[++b]=e,T[++b]=h,T[++b]=l,T[++b]=v,w[++b]=d,T[++b]=s,T[++b]=r,T[++b]=u,T[++b]=c,T[++b]=v,w[++b]=g,T[++b]=o,T[++b]=a,T[++b]=u,T[++b]=l,T[++b]=v,w[++b]=f,this.vertexCount+=6,x},batchTri:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g){void 0===g&&(g=this.currentUnit);var v=!1;this.vertexCount+3>this.vertexCapacity&&(this.flush(),v=!0,g=this.setTexture2D(p));var m=this.vertexViewF32,y=this.vertexViewU32,x=this.vertexCount*this.vertexComponentCount-1;return m[++x]=t,m[++x]=e,m[++x]=o,m[++x]=a,m[++x]=f,y[++x]=u,m[++x]=i,m[++x]=n,m[++x]=o,m[++x]=l,m[++x]=f,y[++x]=c,m[++x]=s,m[++x]=r,m[++x]=h,m[++x]=l,m[++x]=f,y[++x]=d,this.vertexCount+=3,v},bind:function(t){return void 0===t&&(t=!1),l.prototype.bind.call(this,t),this}});t.exports=u},function(t,e,i){var C=i(26),M=i(32),O=i(2);t.exports=function(t,e){var i=t.getContext("experimental-webgl"),n=O(e,"callback"),s=O(e,"type","image/png"),r=O(e,"encoder",.92),o=O(e,"x",0),a=O(e,"y",0),h=O(e,"getPixel",!1),l=O(e,"isFramebuffer",!1),u=l?O(e,"bufferWidth",1):i.drawingBufferWidth,c=l?O(e,"bufferHeight",1):i.drawingBufferHeight;if(h){var d=new Uint8Array(4),f=l?a:c-a;i.readPixels(o,f,1,1,i.RGBA,i.UNSIGNED_BYTE,d),n.call(null,new M(d[0],d[1],d[2],d[3]/255))}else{var p=O(e,"width",u),g=O(e,"height",c),v=p*g*4,m=new Uint8Array(v);i.readPixels(o,c-a-g,p,g,i.RGBA,i.UNSIGNED_BYTE,m);for(var y=C.createWebGL(this,p,g),x=y.getContext("2d"),T=x.getImageData(0,0,p,g),w=T.data,b=0;b>>0;if("function"!=typeof t)throw new TypeError;for(var n=2<=arguments.length?arguments[1]:void 0,s=0;sthis.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoom<.001&&(e.zoom=.001)))},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},function(t,e,i){t.exports={Camera:i(306),BaseCamera:i(93),CameraManager:i(726),Effects:i(314),Events:i(42)}},function(t,e){t.exports="cameradestroy"},function(t,e){t.exports="camerafadeincomplete"},function(t,e){t.exports="camerafadeinstart"},function(t,e){t.exports="camerafadeoutcomplete"},function(t,e){t.exports="camerafadeoutstart"},function(t,e){t.exports="cameraflashcomplete"},function(t,e){t.exports="cameraflashstart"},function(t,e){t.exports="camerapancomplete"},function(t,e){t.exports="camerapanstart"},function(t,e){t.exports="postrender"},function(t,e){t.exports="prerender"},function(t,e){t.exports="camerarotatecomplete"},function(t,e){t.exports="camerarotatestart"},function(t,e){t.exports="camerashakecomplete"},function(t,e){t.exports="camerashakestart"},function(t,e){t.exports="camerazoomcomplete"},function(t,e){t.exports="camerazoomstart"},function(t,e,i){var n=i(17),s=i(0),l=i(42),r=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.isComplete=!1,this.direction=!0,this.duration=0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,r,o,a){if(void 0===t&&(t=!0),void 0===e&&(e=1e3),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(o=null),void 0===a&&(a=this.camera.scene),!r&&this.isRunning)return this.camera;this.isRunning=!0,this.isComplete=!1,this.duration=e,this.direction=t,this.progress=0,this.red=i,this.green=n,this.blue=s,this.alpha=t?Number.MIN_VALUE:1,this._elapsed=0,this._onUpdate=o,this._onUpdateScope=a;var h=t?l.FADE_OUT_START:l.FADE_IN_START;return this.camera.emit(h,this.camera,this,e,i,n,s),this.camera},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=n(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsedthis.source?Math.abs(this.destination-this.source):Math.abs(this.destination+h)-this.source)<(u=this.source>this.destination?Math.abs(this.source-this.destination):Math.abs(this.source+h)-this.destination)?this.clockwise=!0:uMath.PI&&(t-=n.PI2),Math.abs(((t+n.TAU)%n.PI2-n.PI2)%n.PI2)}},function(t,e,i){var n=i(127);t.exports=function(){return n(-Math.PI,Math.PI)}},function(t,e,i){var n=i(127);t.exports=function(){return n(-180,180)}},function(t,e,i){var n=i(332);t.exports=function(t){return n(t+Math.PI)}},function(t,e,i){var n=i(13);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e||(Math.abs(e-t)<=i||Math.abs(e-t)>=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(e>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return 2.3283064365386963e-10*((this.n=i)>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.n=4022871197,this.s0=this.hash(" "),this.s1=this.hash(" "),this.s2=this.hash(" "),this.c=1,t)for(var e=0;e=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}s++}return null},getPoints:function(t){void 0===t&&(t=12);for(var e,i=[],n=0;n=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getTangentAt(h,e)}s++}return null},lineTo:function(t,e){t instanceof d?this._tmpVec2B.copy(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new r([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new c(t))},moveTo:function(t,e){return t instanceof d?this.add(new o(t.x,t.y)):this.add(new o(t,e))},toJSON:function(){for(var t=[],e=0;e>16&255,g:t>>8&255,b:255&t,a:255};return 16777215>>24),e}},function(t,e,i){var h=i(32),l=i(366);t.exports=function(t,e,i){var n,s,r=i,o=i,a=i;return 0!==e&&(r=l(s=2*i-(n=i<.5?i*(1+e):i+e-i*e),n,t+1/3),o=l(s,n,t),a=l(s,n,t-1/3)),(new h).setGLTo(r,o,a,1)}},function(t,e,i){var s=i(176);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],n=0;n<=359;n++)i.push(s(n/359,t,e));return i}},function(t,e,i){function o(t,e,i,n,s,r,o,a){void 0===o&&(o=100),void 0===a&&(a=0);var h=a/o;return{r:l(t,n,h),g:l(e,s,h),b:l(i,r,h)}}var l=i(124);t.exports={RGBWithRGB:o,ColorWithRGB:function(t,e,i,n,s,r){return void 0===s&&(s=100),void 0===r&&(r=0),o(t.r,t.g,t.b,e,i,n,s,r)},ColorWithColor:function(t,e,i,n){return void 0===i&&(i=100),void 0===n&&(n=0),o(t.r,t.g,t.b,e.r,e.g,e.b,i,n)}}},function(t,e,i){var n=i(182),s=i(32);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new s(n(t,e),n(t,e),n(t,e))}},function(t,e,i){var r=i(365);t.exports=function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s="#"),"#"===s?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1):"0x"+r(n)+r(t)+r(e)+r(i)}},function(t,e,i){t.exports={BitmapMask:i(287),GeometryMask:i(288)}},function(t,e,i){var n={AddToDOM:i(131),DOMContentLoaded:i(367),GetInnerHeight:i(368),GetScreenOrientation:i(369),GetTarget:i(374),ParseXML:i(375),RemoveFromDOM:i(188),RequestAnimationFrame:i(353)};t.exports=n},function(t,e,i){t.exports={EventEmitter:i(849)}},function(t,e,i){var n=i(0),s=i(12),r=i(23),o=new n({Extends:s,initialize:function(){s.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});r.register("EventEmitter",o,"events"),t.exports=o},function(t,e,i){var n=i(131),s=i(301),r=i(305),o=i(26),a=i(0),h=i(327),l=i(851),u=i(349),c=i(120),d=i(351),f=i(328),p=i(367),g=i(12),v=i(21),m=i(376),y=i(23),x=i(381),T=i(382),w=i(384),b=i(130),E=i(389),S=i(352),_=i(354),A=i(393),C=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.domContainer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new g,this.anims=new s(this),this.textures=new E(this),this.cache=new r(this),this.registry=new c(this),this.input=new m(this,this.config),this.scene=new w(this,this.config.sceneConfig),this.device=f,this.scale=new T(this,this.config),this.sound=null,this.sound=A.create(this),this.loop=new S(this,this.config.fps),this.plugins=new x(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,p(this.boot.bind(this))},boot:function(){y.hasCore("EventEmitter")?(this.isBooted=!0,this.config.preBoot(this),this.scale.preBoot(),u(this),l(this),d(this),n(this.canvas,this.config.parent),this.textures.once(b.READY,this.texturesReady,this),this.events.emit(v.BOOT)):console.warn("Aborting. Core Plugins missing.")},texturesReady:function(){this.events.emit(v.READY),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),_(this);var t=this.events;t.on(v.HIDDEN,this.onHidden,this),t.on(v.VISIBLE,this.onVisible,this),t.on(v.BLUR,this.onBlur,this),t.on(v.FOCUS,this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(v.PRE_STEP,t,e),i.emit(v.STEP,t,e),this.scene.update(t,e),i.emit(v.POST_STEP,t,e);var n=this.renderer;n.preRender(),i.emit(v.PRE_RENDER,n,t,e),this.scene.render(n),n.postRender(),i.emit(v.POST_RENDER,n,t,e)},headlessStep:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(v.PRE_STEP,t,e),i.emit(v.STEP,t,e),this.scene.update(t,e),i.emit(v.POST_STEP,t,e),i.emit(v.PRE_RENDER),i.emit(v.POST_RENDER)},onHidden:function(){this.loop.pause(),this.events.emit(v.PAUSE)},onVisible:function(){this.loop.resume(),this.events.emit(v.RESUME)},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},getFrame:function(){return this.loop.frame},getTime:function(){return this.loop.now},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.scene.destroy(),this.events.emit(v.DESTROY),this.events.removeAllListeners(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.domContainer&&this.domContainer.parentNode.removeChild(this.domContainer),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=C},function(t,e,i){var n=i(131);t.exports=function(t){var e,i=t.config;i.parent&&i.domCreateContainer&&((e=document.createElement("div")).style.cssText=["display: block;","width: "+t.scale.width+"px;","height: "+t.scale.height+"px;","padding: 0; margin: 0;","position: absolute;","overflow: hidden;","pointer-events: none;","transform: scale(1);","transform-origin: left top;"].join(" "),t.domContainer=e,n(e,i.parent))}},function(t,e){t.exports="boot"},function(t,e){t.exports="destroy"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameout"},function(t,e){t.exports="gameover"},function(t,e){t.exports="gameobjectdown"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameobjectmove"},function(t,e){t.exports="gameobjectout"},function(t,e){t.exports="gameobjectover"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="wheel"},function(t,e){t.exports="gameobjectup"},function(t,e){t.exports="gameobjectwheel"},function(t,e){t.exports="boot"},function(t,e){t.exports="process"},function(t,e){t.exports="update"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointerdownoutside"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="pointerupoutside"},function(t,e){t.exports="wheel"},function(t,e){t.exports="pointerlockchange"},function(t,e){t.exports="preupdate"},function(t,e){t.exports="shutdown"},function(t,e){t.exports="start"},function(t,e){t.exports="update"},function(t,e){t.exports="addfile"},function(t,e){t.exports="complete"},function(t,e){t.exports="filecomplete"},function(t,e){t.exports="filecomplete-"},function(t,e){t.exports="loaderror"},function(t,e){t.exports="load"},function(t,e){t.exports="fileprogress"},function(t,e){t.exports="postprocess"},function(t,e){t.exports="progress"},function(t,e){t.exports="start"},function(t,e,i){t.exports={game:"game",renderer:"renderer",anims:"anims",cache:"cache",plugins:"plugins",registry:"registry",scale:"scale",sound:"sound",textures:"textures",events:"events",cameras:"cameras",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},function(t,e){t.exports=function(t,e,i){if(i.getElementsByTagName("TextureAtlas")){var n=t.source[e];t.add("__BASE",e,0,0,n.width,n.height);for(var s=i.getElementsByTagName("SubTexture"),r=0;r=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i,n,s=t.indexOf(e);return-1!==s&&st.length-1)throw new Error("Index out of bounds");var s=r(t,e);return i&&i.call(n,s),s}},function(t,e,i){var l=i(70);t.exports=function(t,e,i,n,s){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===s&&(s=t),l(t,e,i)){var r=i-e,o=t.splice(e,r);if(n)for(var a=0;a?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var T=i(6);t.exports=function(t,e){var i=e.width,n=e.height,s=Math.floor(i/2),r=Math.floor(n/2),o=T(e,"chars","");if(""!==o){var a=T(e,"image",""),h=T(e,"offset.x",0),l=T(e,"offset.y",0),u=T(e,"spacing.x",0),c=T(e,"spacing.y",0),d=T(e,"lineSpacing",0),f=T(e,"charsPerRow",null);null===f&&(f=t.sys.textures.getFrame(a).width/i)>o.length&&(f=o.length);for(var p=h,g=l,v={retroFont:!0,font:a,size:i,lineHeight:n+d,chars:{}},m=0,y=0;yr.vertexCapacity&&r.flush();for(var g=r.setGameObject(e),v=r.vertexViewF32,m=r.vertexViewU32,y=r.vertexCount*r.vertexComponentCount-1,x=0,T=e.tintFill,w=0;w=i&&t.x<=n&&t.y>=s&&t.y<=r}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||s=n&&(p.push(v),f=v)}var m=o[o.length-1];return y(f,m)i&&(i=a.x),a.xs&&(s=a.y),a.yn(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},function(t,e,i){var r=i(9);t.exports=function(t,e,i,n,s){return void 0===s&&(s=new r),s.setTo(Math.min(t,i),Math.min(e,n),Math.abs(t-i),Math.abs(e-n))}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.centerX,e.y=t.centerY,e}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.width,e.y=t.height,e}},function(t,e,i){var r=i(178);t.exports=function(t,e,i){var n=t.centerX,s=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),r(t,n,s)}},function(t,e,i){var n=i(9),s=i(143);t.exports=function(t,e,i){return void 0===i&&(i=new n),s(t,e)?(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y):i.setEmpty(),i}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;oe.x&&t.ye.y}},function(t,e,i){var a=i(4),h=i(41);t.exports=function(t,e,i){void 0===i&&(i=new a),e=h(e);var n=Math.sin(e),s=Math.cos(e),r=0=s||0=t.downTime+n)&&(i=!0),i)return this.setDragState(t,3),this.processDragStartList(t)},processDragStartList:function(t){if(3!==this.getDragState(t))return 0;for(var e=this._drag[t.id],i=0;it._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,n=0;n'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],s=this;try{var r=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return s.state=o.FILE_ERRORED,void s.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){l.revokeObjectURL(s.data),s.onProcessComplete()},this.data.onerror=function(){l.revokeObjectURL(s.data),s.onProcessError()},l.createObjectURL(this.data,r,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});s.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r=n[2];if("^"===i.operator)return 0=i.number:0=n[2]:r[2]===n[2]}return t===e||"*"===t}},function(t,e,i){var n={};t.exports=n;var s=i(158),r=(i(234),i(44));n.create=function(t){var e=s.create(),i={label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}};return r.extend(e,i,t)}},function(t,e,i){var y={};t.exports=y;var a=i(501),n=i(544),r=i(44);y.create=function(t){var e={controller:y,detector:n.collisions,buckets:{},pairs:{},pairsList:[],bucketWidth:48,bucketHeight:48};return r.extend(e,t)},y.update=function(t,e,i,n){for(var s,r,o,a=i.world,h=t.buckets,l=!1,u=i.metrics,c=u.broadphaseTests=0;ca.bounds.max.x||d.bounds.max.ya.bounds.max.y)){var f=y._getRegion(t,d);if(!d.region||f.id!==d.region.id||n){u.broadphaseTests+=1,d.region&&!n||(d.region=f);for(var p=y._regionUnion(f,d.region),g=p.startCol;g<=p.endCol;g++)for(s=p.startRow;s<=p.endRow;s++){r=h[o=y._getBucketId(g,s)];var v=g>=f.startCol&&g<=f.endCol&&s>=f.startRow&&s<=f.endRow,m=g>=d.region.startCol&&g<=d.region.endCol&&s>=d.region.startRow&&s<=d.region.endRow;!v&&m&&m&&r&&y._bucketRemoveBody(t,r,d),(d.region===f||v&&!m||n)&&(r=r||y._createBucket(h,o),y._bucketAddBody(t,r,d))}d.region=f,l=!0}}}l&&(t.pairsList=y._createActivePairsList(t))},y.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]},y._regionUnion=function(t,e){var i=Math.min(t.startCol,e.startCol),n=Math.max(t.endCol,e.endCol),s=Math.min(t.startRow,e.startRow),r=Math.max(t.endRow,e.endRow);return y._createRegion(i,n,s,r)},y._getRegion=function(t,e){var i=e.bounds,n=Math.floor(i.min.x/t.bucketWidth),s=Math.floor(i.max.x/t.bucketWidth),r=Math.floor(i.min.y/t.bucketHeight),o=Math.floor(i.max.y/t.bucketHeight);return y._createRegion(n,s,r,o)},y._createRegion=function(t,e,i,n){return{id:t+","+e+","+i+","+n,startCol:t,endCol:e,startRow:i,endRow:n}},y._getBucketId=function(t,e){return"C"+t+"R"+e},y._createBucket=function(t,e){return t[e]=[]},y._bucketAddBody=function(t,e,i){for(var n=0;nl._pairMaxIdleLife&&a.push(h);for(h=0;hu.friction*u.frictionStatic*R*i&&(F=M,L=U.clamp(u.friction*O*i,-F,F));var D,k,I=X.cross(w,p),B=X.cross(b,p),N=m/(d.inverseMass+f.inverseMass+d.inverseInertia*I*I+f.inverseInertia*B*B);P*=N,L*=N,A<0&&A*A>Y._restingThresh*i?x.normalImpulse=0:(D=x.normalImpulse,x.normalImpulse=Math.min(x.normalImpulse+P,0),P=x.normalImpulse-D),C*C>Y._restingThreshTangent*i?x.tangentImpulse=0:(k=x.tangentImpulse,x.tangentImpulse=U.clamp(x.tangentImpulse+L,-F,F),L=x.tangentImpulse-k),n.x=p.x*P+g.x*L,n.y=p.y*P+g.y*L,d.isStatic||d.isSleeping||(d.positionPrev.x+=n.x*d.inverseMass,d.positionPrev.y+=n.y*d.inverseMass,d.anglePrev+=X.cross(w,n)*d.inverseInertia),f.isStatic||f.isSleeping||(f.positionPrev.x-=n.x*f.inverseMass,f.positionPrev.y-=n.y*f.inverseMass,f.anglePrev-=X.cross(b,n)*f.inverseInertia)}}}}},function(t,e,i){t.exports={BasePlugin:i(502),DefaultPlugins:i(184),PluginCache:i(23),PluginManager:i(381),ScenePlugin:i(1318)}},function(t,e,i){var n=i(502),s=i(0),r=i(20),o=new s({Extends:n,initialize:function(t,e){n.call(this,e),this.scene=t,this.systems=t.sys,t.sys.events.once(r.BOOT,this.boot,this)},boot:function(){},destroy:function(){this.pluginManager=null,this.game=null,this.scene=null,this.systems=null}});t.exports=o},function(t,e,i){var n=i(19),s=i(187),r=n(!1,r={Center:i(370),Events:i(94),Orientation:i(371),ScaleManager:i(382),ScaleModes:i(372),Zoom:i(373)},s.CENTER);r=n(!1,r,s.ORIENTATION),r=n(!1,r,s.SCALE_MODE),r=n(!1,r,s.ZOOM),t.exports=r},function(t,e,i){var n=i(133),s=i(19)(!1,s={Events:i(20),GetPhysicsPlugins:i(386),GetScenePlugins:i(387),SceneManager:i(384),ScenePlugin:i(1321),Settings:i(388),Systems:i(190)},n);t.exports=s},function(t,e,i){var n=i(17),s=i(0),a=i(20),h=i(2),r=i(23),o=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.key=t.sys.settings.key,this.manager=t.sys.game.scene,this.transitionProgress=0,this._elapsed=0,this._target=null,this._duration=0,this._onUpdate,this._onUpdateScope,this._willSleep=!1,this._willRemove=!1,t.sys.events.once(a.BOOT,this.boot,this),t.sys.events.on(a.START,this.pluginStart,this)},boot:function(){this.systems.events.once(a.DESTROY,this.destroy,this)},pluginStart:function(){this._target=null,this.systems.events.once(a.SHUTDOWN,this.shutdown,this)},start:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",this.key),this.manager.queueOp("start",t,e),this},restart:function(t){var e=this.key;return this.manager.queueOp("stop",e),this.manager.queueOp("start",e,t),this},transition:function(t){void 0===t&&(t={});var e=h(t,"target",!1),i=this.manager.getScene(e);if(!e||!this.checkValidTransition(i))return!1;var n=h(t,"duration",1e3);this._elapsed=0,this._target=i,this._duration=n,this._willSleep=h(t,"sleep",!1),this._willRemove=h(t,"remove",!1);var s=h(t,"onUpdate",null);s&&(this._onUpdate=s,this._onUpdateScope=h(t,"onUpdateScope",this.scene));var r=h(t,"allowInput",!1);this.settings.transitionAllowInput=r;var o=i.sys.settings;return o.isTransition=!0,o.transitionFrom=this.scene,o.transitionDuration=n,o.transitionAllowInput=r,h(t,"moveAbove",!1)?this.manager.moveAbove(this.key,e):h(t,"moveBelow",!1)&&this.manager.moveBelow(this.key,e),i.sys.isSleeping()?i.sys.wake(h(t,"data")):this.manager.start(e,h(t,"data")),this.systems.events.emit(a.TRANSITION_OUT,i,n),this.systems.events.on(a.UPDATE,this.step,this),!0},checkValidTransition:function(t){return!(!t||t.sys.isActive()||t.sys.isTransitioning()||t===this.scene||this.systems.isTransitioning())},step:function(t,e){this._elapsed+=e,this.transitionProgress=n(this._elapsed/this._duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.transitionProgress),this._elapsed>=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off(a.UPDATE,this.step,this),t.events.emit(a.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,n){return this.manager.add(t,e,i,n)},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t,e),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(t),this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isPaused:function(t){return void 0===t&&(t=this.key),this.manager.isPaused(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.swapPosition(t,e),this},moveAbove:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveAbove(t,e),this},moveBelow:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveBelow(t,e),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(a.SHUTDOWN,this.shutdown,this),t.off(a.POST_UPDATE,this.step,this),t.off(a.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(a.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});r.register("ScenePlugin",o,"scenePlugin"),t.exports=o},function(t,e,i){t.exports={Events:i(405),List:i(137),Map:i(92),ProcessQueue:i(197),RTree:i(491),Set:i(141),Size:i(383)}},function(t,e,i){var n=i(19),s=i(1324),r=n(!1,r={CanvasTexture:i(390),Events:i(130),FilterMode:s,Frame:i(97),Parsers:i(392),Texture:i(192),TextureManager:i(389),TextureSource:i(391)},s);t.exports=r},function(t,e){t.exports={LINEAR:0,NEAREST:1}},function(t,e,i){t.exports={Components:i(149),Parsers:i(1355),Formats:i(33),ImageCollection:i(513),ParseToTilemap:i(240),Tile:i(75),Tilemap:i(522),TilemapCreator:i(1369),TilemapFactory:i(1370),Tileset:i(107),LayerData:i(105),MapData:i(106),ObjectLayer:i(516),DynamicTilemapLayer:i(523),StaticTilemapLayer:i(524)}},function(t,e,i){var p=i(24),g=i(53);t.exports=function(t,e,i,n,s,r,o,a){t<0&&(t=0),e<0&&(e=0),void 0===o&&(o=!0);for(var h=p(t,e,i,n,null,a),l=s-t,u=r-e,c=0;c=t&&l.index<=e&&u(l,i)}n&&c(0,0,s.width,s.height,s)}}},function(t,e,i){var a=i(65),h=i(53),l=i(153);t.exports=function(t,e,i,n){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var s=0;s=s.delay&&(n=s.elapsed-s.delay,s.elapsed=s.delay,!s.hasDispatched&&s.callback&&(s.hasDispatched=!0,s.callback.apply(s.callbackScope,s.args)),0>2],s+=o[(3&i[r])<<4|i[r+1]>>4],s+=o[(15&i[r+1])<<2|i[r+2]>>6],s+=o[63&i[r+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s}},function(t,e,i){t.exports={Clone:i(69),Extend:i(19),GetAdvancedValue:i(15),GetFastValue:i(2),GetMinMaxValue:i(1395),GetValue:i(6),HasAll:i(1396),HasAny:i(422),HasValue:i(115),IsPlainObject:i(7),Merge:i(134),MergeRight:i(1397),Pick:i(514),SetValue:i(445)}},function(t,e,i){var o=i(6),a=i(17);t.exports=function(t,e,i,n,s){void 0===s&&(s=i);var r=o(t,e,s);return a(r,i,n)}},function(t,e){t.exports=function(t,e){for(var i=0;ii[e][0])&&(e=n);return!S(O(t,e-1),O(t,e),O(t,e+1))&&(function(t){for(var e=[],i=t.length,n=0;n!==i;n++)e.push(t.pop());for(n=0;n!==i;n++)t[n]=e[n]}(t),!0)}};var u=[],c=[];function M(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n}function O(t,e){var i=t.length;return t[e<0?e%i+i:e%i]}function P(t,e,i,n){for(var s=i;sn.deltaMax?n.deltaMax:e)/n.delta,n.delta=e),0!==n.timeScalePrev&&(r*=s.timeScale/n.timeScalePrev),0===s.timeScale&&(r=0),n.timeScalePrev=s.timeScale,n.correction=r,n.frameCounter+=1,1e3<=t-n.counterTimestamp&&(n.fps=n.frameCounter*((t-n.counterTimestamp)/1e3),n.counterTimestamp=t,n.frameCounter=0),T.update(i,e,r))},step:function(t,e){T.update(this.engine,t,e)},update60Hz:function(){return 1e3/60},update30Hz:function(){return 1e3/30},has:function(t){var e=t.hasOwnProperty("body")?t.body:t;return null!==u.get(this.localWorld,e.id,e.type)},getAllBodies:function(){return u.allBodies(this.localWorld)},getAllConstraints:function(){return u.allConstraints(this.localWorld)},getAllComposites:function(){return u.allComposites(this.localWorld)},postUpdate:function(){var t,e,i,n;this.drawDebug&&(t=this.debugConfig,e=this.engine,i=this.debugGraphic,n=u.allBodies(this.localWorld),this.debugGraphic.clear(),t.showBroadphase&&e.broadphase.controller&&this.renderGrid(e.broadphase,i,t.broadphaseColor,.5),t.showBounds&&this.renderBodyBounds(n,i,t.boundsColor,.5),(t.showBody||t.showStaticBody)&&this.renderBodies(n),t.showJoint&&this.renderJoints(),(t.showAxes||t.showAngleIndicator)&&this.renderBodyAxes(n,i,t.showAxes,t.angleColor,.5),t.showVelocity&&this.renderBodyVelocity(n,i,t.velocityColor,1,2),t.showSeparations&&this.renderSeparations(e.pairs.list,i,t.separationColor),t.showCollisions&&this.renderCollisions(e.pairs.list,i,t.collisionColor))},renderGrid:function(t,e,i,n){e.lineStyle(1,i,n);for(var s=y.keys(t.buckets),r=0;re.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?n=e.min.y-t.max.y:t.max.y=this.right?this.width=0:this.width=this.right-t,this.x=t}},right:{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}},top:{get:function(){return this.y},set:function(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}},bottom:{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}});t.exports=u},function(t,e,i){"use strict";var n=Object.prototype.hasOwnProperty,f="~";function s(){}function a(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,i,n,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var r=new a(i,n||t,s),o=f?f+e:e;return t._events[o]?t._events[o].fn?t._events[o]=[t._events[o],r]:t._events[o].push(r):(t._events[o]=r,t._eventsCount++),t}function l(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(f=!1)),o.prototype.eventNames=function(){var t,e,i=[];if(0===this._eventsCount)return i;for(e in t=this._events)n.call(t,e)&&i.push(f?e.slice(1):e);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},o.prototype.listeners=function(t){var e=f?f+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,r=new Array(s);n>>0},getTintAppendFloatAlpha:function(t,e){return((255&(255*e|0))<<24|t)>>>0},getTintAppendFloatAlphaAndSwap:function(t,e){return((255&(255*e|0))<<24|(255&(0|t))<<16|(255&(t>>8|0))<<8|255&(t>>16|0))>>>0},getFloatsFromUintRGB:function(t){return[(255&(t>>16|0))/255,(255&(t>>8|0))/255,(255&(0|t))/255]},checkShaderMax:function(t,e){e&&-1!==e||(e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS));for(var i=t.createShader(t.FRAGMENT_SHADER),n=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");;){var s=n.replace(/%forloop%/gi,function(t){for(var e="",i=0;ir.width&&(i=Math.max(r.width-t,0)),e+n>r.height&&(n=Math.max(r.height-e,0));for(var l=[],u=e;uthis.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});t.exports=l},function(t,e){t.exports=function(t,e,i,n){var s=i||e.fillColor,r=n||e.fillAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.fillStyle="rgba("+o+","+a+","+h+","+r+")"}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n){var s=[];n.forEach(function(t){t&&s.push(t)}),this.loader=t,this.type=e,this.key=i,this.multiKeyIndex=t.multiKeyIndex++,this.files=s,this.complete=!1,this.pending=s.length,this.failed=0,this.config={},this.baseURL=t.baseURL,this.path=t.path,this.prefix=t.prefix;for(var r=0;r=e&&t.y<=i&&t.y+t.height>=i)}},function(t,e){t.exports=function(t,e,i,n){var s=i||e.strokeColor,r=n||e.strokeAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth}},function(t,e,i){var n=i(0),h=i(19),l=i(22),s=i(8),u=i(2),c=i(6),d=i(7),r=new n({Extends:l,initialize:function(t,e,i,n,s){var r,o="json";d(e)&&(e=u(r=e,"key"),i=u(r,"url"),n=u(r,"xhrSettings"),o=u(r,"extension",o),s=u(r,"dataKey",s));var a={type:"json",cache:t.cacheManager.json,extension:o,responseType:"text",key:e,url:i,xhrSettings:n,config:s};l.call(this,t,a),d(i)&&(this.data=s?c(i,s):i,this.state=h.FILE_POPULATED)},onProcess:function(){var t,e;this.state!==h.FILE_POPULATED&&(this.state=h.FILE_PROCESSING,t=JSON.parse(this.xhrLoader.responseText),e=this.config,this.data="string"==typeof e?c(t,e,t):t),this.onProcessComplete()}});s.register("json",function(t,e,i,n){if(Array.isArray(t))for(var s=0;s=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius}},function(t,e){t.exports=function(t){return Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))}},function(t,e){t.exports=function(t,e,i){var n=i-e;return e+((t-e)%n+n)%n}},function(t,e,i){"use strict";function n(t,e,i){i=i||2;var n,s,r,o,a,h,l,u=e&&e.length,c=u?e[0]*i:t.length,d=g(t,0,c,i,!0),f=[];if(!d||d.next===d.prev)return f;if(u&&(d=function(t,e,i,n){var s,r,o,a,h,l=[];for(s=0,r=e.length;s=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&o=n.x&&n.x>=u&&s!==n.x&&T(ri.x||n.x===i.x&&function(t,e){return w(t.prev,t,e.prev)<0&&w(e.next,t,t.next)<0}(i,n)))&&(i=n,d=h)),n=n.next,n!==l;);return i}(t,e))&&(i=E(e,t),v(e,e.next),v(i,i.next))}}(l[s],i),i=v(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=r=t[0],s=o=t[1];for(var p=i;pr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=x(a,h,e,i,n),d=x(l,u,e,i,n),f=t.prevZ,p=t.nextZ;for(;f&&f.z>=c&&p&&p.z<=d;){if(f!==t.prev&&f!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=w(f.prev,f,f.next))return!1;if(f=f.prevZ,p!==t.prev&&p!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&0<=w(p.prev,p,p.next))return!1;p=p.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&0<=w(f.prev,f,f.next))return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&T(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&0<=w(p.prev,p,p.next))return!1;p=p.nextZ}return!0}(t,n,s,r):function(t){var e=t.prev,i=t,n=t.next;if(0<=w(e,i,n))return!1;var s=t.next.next;for(;s!==t.prev;){if(T(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&0<=w(s.prev,s,s.next))return!1;s=s.next}return!0}(t))e.push(a.i/i),e.push(t.i/i),e.push(h.i/i),d(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?m(t=function(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!u(s,r)&&c(s,n,n.next,r)&&b(s,r)&&b(r,s)&&(e.push(s.i/i),e.push(n.i/i),e.push(r.i/i),d(n),d(n.next),n=t=r),n=n.next}while(n!==t);return v(n)}(v(t),e,i),e,i,n,s,r,2):2===o&&function(t,e,i,n,s,r){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&c(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(b(t,e)&&b(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;for(;i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next,i!==t;);return n}(t,e)&&(w(t.prev,t,e.prev)||w(t,e.prev,e))||u(t,e)&&0=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function l(t){return 0c&&(c=u[d].vertexSize);var f=b(e,"batchSize",i.config.batchSize);this.vertexCapacity=6*f;var p=b(e,"vertices",new ArrayBuffer(this.vertexCapacity*c));for(this.vertexData=p,b(e,"vertices",null)?this.vertexBuffer=i.createVertexBuffer(p,t.STATIC_DRAW):this.vertexBuffer=i.createVertexBuffer(p.byteLength,t.DYNAMIC_DRAW),this.bytes=new Uint8Array(p),this.vertexViewF32=new Float32Array(p),this.vertexViewU32=new Uint32Array(p),this.renderer.setVertexBuffer(this.vertexBuffer),d=0;dthis.vertexCapacity},resize:function(t,e){t===this.width&&e===this.height||this.flush(),this.width=t,this.height=e;var i=this.projectionMatrix;i&&i.ortho(0,t,e,0,-1e3,1e3);for(var n=this.renderTargets,s=0;s=this.x2&&this.x1>=this.x3?this.x1-t:this.x2>=this.x1&&this.x2>=this.x3?this.x2-t:this.x3-t;this.x1-=e,this.x2-=e,this.x3-=e}},top:{get:function(){return Math.min(this.y1,this.y2,this.y3)},set:function(t){var e=0,e=this.y1<=this.y2&&this.y1<=this.y3?this.y1-t:this.y2<=this.y1&&this.y2<=this.y3?this.y2-t:this.y3-t;this.y1-=e,this.y2-=e,this.y3-=e}},bottom:{get:function(){return Math.max(this.y1,this.y2,this.y3)},set:function(t){var e=0,e=this.y1>=this.y2&&this.y1>=this.y3?this.y1-t:this.y2>=this.y1&&this.y2>=this.y3?this.y2-t:this.y3-t;this.y1-=e,this.y2-=e,this.y3-=e}}});t.exports=u},function(t,e,i){var n=i(29),s=i(0),r=i(11),o=i(479),a=new s({Mixins:[r.Alpha,r.Flip,r.Visible],initialize:function(t,e,i,n,s,r,o,a){this.layer=t,this.index=e,this.x=i,this.y=n,this.width=s,this.height=r,this.right,this.bottom,this.baseWidth=void 0!==o?o:s,this.baseHeight=void 0!==a?a:r,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=void 0,(this.collisionCallbackContext=this).tint=16777215,this.physics={}},containsPoint:function(t,e){return!(tthis.right||e>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var e=this.tilemapLayer;return e?e.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var e=this.tilemapLayer;return e?this.getLeft(t)+this.width*e.scaleX:this.getLeft(t)+this.width},getTop:function(t){var e=this.tilemapLayer;return e?e.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*e.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var e=this.tilemapLayer;return e?this.getTop(t)+this.height*e.scaleY:this.getTop(t)+this.height},getBounds:function(t,e){return void 0===e&&(e=new o),e.x=this.getLeft(),e.y=this.getTop(),e.width=this.getRight()-e.x,e.height=this.getBottom()-e.y,e},getCenterX:function(t){return(this.getLeft(t)+this.getRight(t))/2},getCenterY:function(t){return(this.getTop(t)+this.getBottom(t))/2},intersects:function(t,e,i,n){return!(i<=this.pixelX||n<=this.pixelY||t>=this.right||e>=this.bottom)},isInteresting:function(t,e){return t&&e?this.canCollide||this.hasInterestingFace:t?this.collides:!!e&&this.hasInterestingFace},resetCollision:function(t){return void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,e,i,n,s){return void 0===e&&(e=t),void 0===i&&(i=t),void 0===n&&(n=t),void 0===s&&(s=!0),this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n,s&&this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y),this},setCollisionCallback:function(t,e){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=e),this},setSize:function(t,e,i,n){return void 0!==t&&(this.width=t),void 0!==e&&(this.height=e),void 0!==i&&(this.baseWidth=i),void 0!==n&&(this.baseHeight=n),this.updatePixelXY(),this},updatePixelXY:function(){var t,e,i=this.layer.orientation;return i===n.ORTHOGONAL?(this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight):i===n.ISOMETRIC?(this.pixelX=(this.x-this.y)*this.baseWidth*.5,this.pixelY=(this.x+this.y)*this.baseHeight*.5):i===n.STAGGERED?(this.pixelX=this.x*this.baseWidth+this.y%2*(this.baseWidth/2),this.pixelY=this.y*(this.baseHeight/2)):i===n.HEXAGONAL&&(t=this.layer.hexSideLength,e=(this.baseHeight-t)/2+t,this.pixelX=this.x*this.baseWidth+this.y%2*(this.baseWidth/2),this.pixelY=this.y*e),this.right=this.pixelX+this.baseWidth,this.bottom=this.pixelY+this.baseHeight,this},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||void 0!==this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.layer.tilemapLayer;if(t){var e=t.gidMap[this.index];if(e)return e}return null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});t.exports=a},function(t,e){t.exports={BITMAPMASK_PIPELINE:"BitmapMaskPipeline",LIGHT_PIPELINE:"Light2D",SINGLE_PIPELINE:"SinglePipeline",MULTI_PIPELINE:"MultiPipeline",ROPE_PIPELINE:"RopePipeline",GRAPHICS_PIPELINE:"GraphicsPipeline",POSTFX_PIPELINE:"PostFXPipeline",UTILITY_PIPELINE:"UtilityPipeline"}},function(t,e){t.exports=function(t){return t.x-t.width*t.originX+.5*t.width}},function(t,e){t.exports=function(t,e){var i=t.width*t.originX;return t.x=e+i-.5*t.width,t}},function(t,e){t.exports=function(t){return t.y-t.height*t.originY+.5*t.height}},function(t,e){t.exports=function(t,e){var i=t.height*t.originY;return t.y=e+i-.5*t.height,t}},function(t,e,i){var h=i(103);t.exports=function(t,e,i,n){if(void 0===n&&(n=t),!Array.isArray(e))return-1!==(o=t.indexOf(e))?(h(t,o),i&&i.call(n,e),e):null;for(var s=e.length-1,r=[];0<=s;){var o,a=e[s];-1!==(o=t.indexOf(a))&&(h(t,o),r.push(a),i&&i.call(n,a)),s--}return r}},function(t,e,i){var n=i(0),s=i(191),r=i(9),o=i(3),a=new n({initialize:function(t){this.type=t,this.defaultDivisions=5,this.arcLengthDivisions=100,this.cacheArcLengths=[],this.needsUpdate=!0,this.active=!0,this._tmpVec2A=new o,this._tmpVec2B=new o},draw:function(t,e){return void 0===e&&(e=32),t.strokePoints(this.getPoints(e))},getBounds:function(t,e){t=t||new r,void 0===e&&(e=16);var i=this.getLength();i=t.length)){for(var i=t.length-1,n=t[e],s=e;sh||a.y>l)?(u=Math.max(a.x,e),c=Math.max(a.y,i),b=d=Math.min(a.r,h)-u,E=f=Math.min(a.b,l)-c,T=r?p+(v-(u-a.x)-d):p+(u-a.x),w=o?g+(m-(c-a.y)-f):g+(c-a.y),e=u,i=c,n=d,s=f):E=b=w=T=0):(r&&(T=p+(v-e-n)),o&&(w=g+(m-i-s)));var A=this.source.width,_=this.source.height;return t.u0=Math.max(0,T/A),t.v0=Math.max(0,w/_),t.u1=Math.min(1,(T+b)/A),t.v1=Math.min(1,(w+E)/_),t.x=e,t.y=i,t.cx=T,t.cy=w,t.cw=b,t.ch=E,t.width=n,t.height=s,t.flipX=r,t.flipY=o,t},updateCropUVs:function(t,e,i){return this.setCropUVs(t,t.x,t.y,t.width,t.height,e,i)},setUVs:function(t,e,i,n,s,r){var o=this.data.drawImage;return o.width=t,o.height=e,this.u0=i,this.v0=n,this.u1=s,this.v1=r,this},updateUVs:function(){var t=this.cutX,e=this.cutY,i=this.cutWidth,n=this.cutHeight,s=this.data.drawImage;s.width=i,s.height=n;var r=this.source.width,o=this.source.height;return this.u0=t/r,this.v0=e/o,this.u1=(t+i)/r,this.v1=(e+n)/o,this},updateUVsInverted:function(){var t=this.source.width,e=this.source.height;return this.u0=(this.cutX+this.cutHeight)/t,this.v0=this.cutY/e,this.u1=this.cutX/t,this.v1=(this.cutY+this.cutWidth)/e,this},clone:function(){var t=new r(this.texture,this.name,this.sourceIndex);return t.cutX=this.cutX,t.cutY=this.cutY,t.cutWidth=this.cutWidth,t.cutHeight=this.cutHeight,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t.halfWidth=this.halfWidth,t.halfHeight=this.halfHeight,t.centerX=this.centerX,t.centerY=this.centerY,t.rotated=this.rotated,t.data=s(!0,t.data,this.data),t.updateUVs(),t},destroy:function(){this.source=null,this.texture=null,this.glTexture=null,this.customData=null,this.data=null},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},canvasData:{get:function(){return this.data.drawImage}}});t.exports=r},function(t,e,i){var s=i(199),n=i(0),r=i(1),o=i(90),a=new n({initialize:function(t){this.parent=t,this.list=[],this.position=0,this.addCallback=r,this.removeCallback=r,this._sortKey=""},add:function(t,e){return e?s.Add(this.list,t):s.Add(this.list,t,0,this.addCallback,this)},addAt:function(t,e,i){return i?s.AddAt(this.list,t,e):s.AddAt(this.list,t,e,0,this.addCallback,this)},getAt:function(t){return this.list[t]},getIndex:function(t){return this.list.indexOf(t)},sort:function(i,t){return i&&(void 0===t&&(t=function(t,e){return t[i]-e[i]}),o(this.list,t)),this},getByName:function(t){return s.GetFirst(this.list,"name",t)},getRandom:function(t,e){return s.GetRandom(this.list,t,e)},getFirst:function(t,e,i,n){return s.GetFirst(this.list,t,e,i,n)},getAll:function(t,e,i,n){return s.GetAll(this.list,t,e,i,n)},count:function(t,e){return s.CountAllMatching(this.list,t,e)},swap:function(t,e){s.Swap(this.list,t,e)},moveTo:function(t,e){return s.MoveTo(this.list,t,e)},remove:function(t,e){return e?s.Remove(this.list,t):s.Remove(this.list,t,this.removeCallback,this)},removeAt:function(t,e){return e?s.RemoveAt(this.list,t):s.RemoveAt(this.list,t,this.removeCallback,this)},removeBetween:function(t,e,i){return i?s.RemoveBetween(this.list,t,e):s.RemoveBetween(this.list,t,e,this.removeCallback,this)},removeAll:function(t){for(var e=this.list.length;e--;)this.remove(this.list[e],t);return this},bringToTop:function(t){return s.BringToTop(this.list,t)},sendToBack:function(t){return s.SendToBack(this.list,t)},moveUp:function(t){return s.MoveUp(this.list,t),t},moveDown:function(t){return s.MoveDown(this.list,t),t},reverse:function(){return this.list.reverse(),this},shuffle:function(){return s.Shuffle(this.list),this},replace:function(t,e){return s.Replace(this.list,t,e)},exists:function(t){return-1=this.maxSize},countActive:function(t){void 0===t&&(t=!0);for(var e=0,i=0;ie.right||t.y>e.bottom)}},function(t,e,i){var n=i(0),r=i(12),u=i(37),s=new n({Extends:u,initialize:function(t,e,i,n,s,r,o,a,h,l){void 0===r&&(r=16777215),void 0===o&&(o=1),void 0===a&&(a=0),void 0===h&&(h=0),void 0===l&&(l=0),u.call(this,t,e,i),this.vx=0,this.vy=0,this.vz=0,this.nx=a,this.ny=h,this.nz=l,this.u=n,this.v=s,this.color=r,this.alpha=o,this.tx=0,this.ty=0,this.ta=0},setUVs:function(t,e){return this.u=t,this.v=e,this},transformCoordinatesLocal:function(t,e,i,n){var s=this.x,r=this.y,o=this.z,a=t.val,h=s*a[0]+r*a[4]+o*a[8]+a[12],l=s*a[1]+r*a[5]+o*a[9]+a[13],u=s*a[2]+r*a[6]+o*a[10]+a[14],c=s*a[3]+r*a[7]+o*a[11]+a[15];this.vx=h/c*e,this.vy=-l/c*i,this.vz=n<=0?u/c:-u/c},update:function(t,e,i,n,s,r,o,a){var h=this.vx*t+this.vy*i+s,l=this.vx*e+this.vy*n+r;return o&&(h=Math.round(h),l=Math.round(l)),this.tx=h,this.ty=l,this.ta=this.alpha*a,this},load:function(t,e,i,n,s){return t[++i]=this.tx,t[++i]=this.ty,t[++i]=this.u,t[++i]=this.v,t[++i]=n,t[++i]=s,e[++i]=r.getTintAppendFloatAlpha(this.color,this.ta),i}});t.exports=s},function(t,e){var i={};(t.exports=i).create=function(t,e){return{x:t||0,y:e||0}},i.clone=function(t){return{x:t.x,y:t.y}},i.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},i.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},i.rotate=function(t,e,i){var n=Math.cos(e),s=Math.sin(e);i=i||{};var r=t.x*n-t.y*s;return i.y=t.x*s+t.y*n,i.x=r,i},i.rotateAbout=function(t,e,i,n){var s=Math.cos(e),r=Math.sin(e);n=n||{};var o=i.x+((t.x-i.x)*s-(t.y-i.y)*r);return n.y=i.y+((t.x-i.x)*r+(t.y-i.y)*s),n.x=o,n},i.normalise=function(t){var e=i.magnitude(t);return 0===e?{x:0,y:0}:{x:t.x/e,y:t.y/e}},i.dot=function(t,e){return t.x*e.x+t.y*e.y},i.cross=function(t,e){return t.x*e.y-t.y*e.x},i.cross3=function(t,e,i){return(e.x-t.x)*(i.y-t.y)-(e.y-t.y)*(i.x-t.x)},i.add=function(t,e,i){return(i=i||{}).x=t.x+e.x,i.y=t.y+e.y,i},i.sub=function(t,e,i){return(i=i||{}).x=t.x-e.x,i.y=t.y-e.y,i},i.mult=function(t,e){return{x:t.x*e,y:t.y*e}},i.div=function(t,e){return{x:t.x/e,y:t.y/e}},i.perp=function(t,e){return{x:(e=!0===e?-1:1)*-t.y,y:e*t.x}},i.neg=function(t){return{x:-t.x,y:-t.y}},i.angle=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},i._temp=[i.create(),i.create(),i.create(),i.create(),i.create(),i.create()]},function(t,e){var i={};(t.exports=i).create=function(t){var e={min:{x:0,y:0},max:{x:0,y:0}};return t&&i.update(e,t),e},i.update=function(t,e,i){t.min.x=1/0,t.max.x=-1/0,t.min.y=1/0,t.max.y=-1/0;for(var n=0;nt.max.x&&(t.max.x=s.x),s.xt.max.y&&(t.max.y=s.y),s.y=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},i.overlaps=function(t,e){return t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y},i.translate=function(t,e){t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},i.shift=function(t,e){var i=t.max.x-t.min.x,n=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+i,t.min.y=e.y,t.max.y=e.y+n}},function(t,e){t.exports=function(t,e,i){return 0<=t&&t=this.firstgid&&th.getTotalFrames()&&(s=0),r=h.frames[s],0!==s||this.forward||(r=h.getLastFrame()),this.currentFrame=r):console.warn("Missing animation: "+a),this.parent},pause:function(t){return this._paused||(this._paused=!0,this._wasPlaying=this.isPlaying,this.isPlaying=!1),void 0!==t&&this.setCurrentFrame(t),this.parent},resume:function(t){return this._paused&&(this._paused=!1,this.isPlaying=this._wasPlaying),void 0!==t&&this.setCurrentFrame(t),this.parent},playAfterDelay:function(t,e){var i,n;return this.isPlaying?(i=this.nextAnim,n=this.nextAnimsQueue,i&&n.unshift(i),this.nextAnim=t,this._pendingStop=1,this._pendingStopValue=e):(this.delayCounter=e,this.play(t,!0)),this.parent},playAfterRepeat:function(t,e){var i,n;return void 0===e&&(e=1),this.isPlaying?(i=this.nextAnim,n=this.nextAnimsQueue,i&&n.unshift(i),-1!==this.repeatCounter&&e>this.repeatCounter&&(e=this.repeatCounter),this.nextAnim=t,this._pendingStop=2,this._pendingStopValue=e):this.play(t),this.parent},play:function(t,e){void 0===e&&(e=!1);var i=this.currentAnim,n=this.parent,s="string"==typeof t?t:t.key;if(e&&this.isPlaying&&i.key===s)return n;if(i&&this.isPlaying){var r=this.animationManager.getMix(i.key,t);if(0this.repeatCounter&&(t=this.repeatCounter),this._pendingStop=2,this._pendingStopValue=t,this.parent},stopOnFrame:function(t){return this._pendingStop=3,this._pendingStopValue=t,this.parent},getTotalFrames:function(){return this.currentAnim?this.currentAnim.getTotalFrames():0},update:function(t,e){var i=this.currentAnim;if(this.isPlaying&&i&&!i.paused){if(this.accumulator+=e*this.timeScale,1===this._pendingStop&&(this._pendingStopValue-=e,this._pendingStopValue<=0))return this.stop();if(this.hasStarted){if(this.accumulator>=this.nextTick&&(this.forward?i.nextFrame(this):i.previousFrame(this),this.isPlaying&&0===this._pendingStop&&this.skipMissedFrames&&this.accumulator>this.nextTick))for(var n=0;this.forward?i.nextFrame(this):i.previousFrame(this),n++,this.accumulator>this.nextTick&&n<60;);}else this.accumulator>=this.delayCounter&&(this.accumulator-=this.delayCounter,this.handleStart())}},setCurrentFrame:function(t){var e=this.parent;return this.currentFrame=t,e.texture=t.frame.texture,e.frame=t.frame,e.isCropped&&e.frame.updateCropUVs(e._crop,e.flipX,e.flipY),t.setAlpha&&(e.alpha=t.alpha),e.setSizeToFrame(),e._originComponent&&(t.frame.customPivot?e.setOrigin(t.frame.pivotX,t.frame.pivotY):e.updateDisplayOrigin()),this.isPlaying&&this.hasStarted&&(this.emitEvents(r.ANIMATION_UPDATE),3===this._pendingStop&&this._pendingStopValue===t&&this.stop()),e},nextFrame:function(){return this.currentAnim&&this.currentAnim.nextFrame(this),this.parent},previousFrame:function(){return this.currentAnim&&this.currentAnim.previousFrame(this),this.parent},get:function(t){return this.anims?this.anims.get(t):null},exists:function(t){return!!this.anims&&this.anims.has(t)},create:function(t){var e=t.key,i=!1;return e&&((i=this.get(e))||(i=new o(this,e,t),this.anims||(this.anims=new s),this.anims.set(e,i))),i},generateFrameNames:function(t,e){return this.animationManager.generateFrameNames(t,e)},generateFrameNumbers:function(t,e){return this.animationManager.generateFrameNumbers(t,e)},remove:function(t){var e=this.get(t);return e&&(this.currentAnim===e&&this.stop(),this.anims.delete(t)),e},destroy:function(){this.animationManager.off(r.REMOVE_ANIMATION,this.globalRemove,this),this.anims&&this.anims.clear(),this.animationManager=null,this.parent=null,this.nextAnim=null,this.nextAnimsQueue.length=0,this.currentAnim=null,this.currentFrame=null},isPaused:{get:function(){return this._paused}}});t.exports=a},function(t,e,i){var n=i(0),s=i(2),r=i(860),o=i(861),a=i(24),z=i(12),h=i(74),l=i(75),u=new n({Extends:l,initialize:function(t){var e=t.game.renderer,i=s(t,"fragShader",r);t.fragShader=z.parseFragmentShaderMaxTextures(i,e.maxTextures),t.vertShader=s(t,"vertShader",o),t.attributes=s(t,"attributes",[{name:"inPosition",size:2,type:h.FLOAT},{name:"inTexCoord",size:2,type:h.FLOAT},{name:"inTexId",size:1,type:h.FLOAT},{name:"inTintEffect",size:1,type:h.FLOAT},{name:"inTint",size:4,type:h.UNSIGNED_BYTE,normalized:!0}]),t.uniforms=s(t,"uniforms",["uProjectionMatrix","uMainSampler"]),l.call(this,t),this._tempMatrix1=new a,this._tempMatrix2=new a,this._tempMatrix3=new a},boot:function(){l.prototype.boot.call(this),this.currentShader.set1iv("uMainSampler",this.renderer.textureIndexes)},batchSprite:function(t,e,i){this.manager.set(this,t);var n,s=this._tempMatrix1,r=this._tempMatrix2,o=this._tempMatrix3,a=t.frame,h=a.glTexture,l=a.u0,u=a.v0,c=a.u1,d=a.v1,f=a.x,p=a.y,g=a.cutWidth,v=a.cutHeight,m=a.customPivot,y=t.displayOriginX,x=t.displayOriginY,T=-y+f,w=-x+p;t.isCropped&&((n=t._crop).flipX===t.flipX&&n.flipY===t.flipY||a.updateCropUVs(n,t.flipX,t.flipY),l=n.u0,u=n.v0,c=n.u1,d=n.v1,g=n.width,v=n.height,T=-y+n.x,w=-x+n.y);var b=1,E=1;t.flipX&&(m||(T+=-a.realWidth+2*y),b=-1),(t.flipY||a.source.isGLTexture&&!h.flipY)&&(m||(w+=-a.realHeight+2*x),E=-1),r.applyITRS(t.x,t.y,t.rotation,t.scaleX*b,t.scaleY*E),s.copyFrom(e.matrix),i?(s.multiplyWithOffset(i,-e.scrollX*t.scrollFactorX,-e.scrollY*t.scrollFactorY),r.e=t.x,r.f=t.y):(r.e-=e.scrollX*t.scrollFactorX,r.f-=e.scrollY*t.scrollFactorY),s.multiply(r,o);var S=T+g,A=w+v,_=e.roundPixels,C=o.getXRound(T,w,_),M=o.getYRound(T,w,_),P=o.getXRound(T,A,_),R=o.getYRound(T,A,_),O=o.getXRound(S,A,_),L=o.getYRound(S,A,_),D=o.getXRound(S,w,_),F=o.getYRound(S,w,_),k=z.getTintAppendFloatAlpha,I=e.alpha,B=k(t.tintTopLeft,I*t._alphaTL),N=k(t.tintTopRight,I*t._alphaTR),Y=k(t.tintBottomLeft,I*t._alphaBL),X=k(t.tintBottomRight,I*t._alphaBR);this.shouldFlush(6)&&this.flush();var U=this.setGameObject(t,a);this.manager.preBatch(t),this.batchQuad(t,C,M,P,R,O,L,D,F,l,u,c,d,B,N,Y,X,t.tintEffect,h,U),this.manager.postBatch(t)},batchTexture:function(t,e,i,n,s,r,o,a,h,l,u,c,d,f,p,g,v,m,y,x,T,w,b,E,S,A,_,C,M,P,R,O){this.manager.set(this,t);var L,D,F,k,I,B=this._tempMatrix1,N=this._tempMatrix2,Y=this._tempMatrix3,X=m/i+_,U=y/n+C,z=(m+x)/i+_,G=(y+T)/n+C,W=o,V=a,H=-g,j=-v;t.isCropped&&(o=W=D=(L=t._crop).width,a=V=F=L.height,k=m=L.x,I=y=L.y,c&&(k=x-L.x-D),d&&(I=T-L.y-F),X=k/i+_,U=I/n+C,z=(k+D)/i+_,G=(I+F)/n+C,H=-g+m,j=-v+y),c&&(W*=-1,H+=o),(d^=!R&&e.isRenderTexture?1:0)&&(V*=-1,j+=a);var q=H+W,K=j+V;N.applyITRS(s,r,u,h,l),B.copyFrom(M.matrix),P?(B.multiplyWithOffset(P,-M.scrollX*f,-M.scrollY*p),N.e=s,N.f=r):(N.e-=M.scrollX*f,N.f-=M.scrollY*p),B.multiply(N,Y);var Z=M.roundPixels,J=Y.getXRound(H,j,Z),Q=Y.getYRound(H,j,Z),$=Y.getXRound(H,K,Z),tt=Y.getYRound(H,K,Z),et=Y.getXRound(q,K,Z),it=Y.getYRound(q,K,Z),nt=Y.getXRound(q,j,Z),st=Y.getYRound(q,j,Z);void 0===O&&(O=this.renderer.setTexture2D(e)),t&&this.manager.preBatch(t),this.batchQuad(t,J,Q,$,tt,et,it,nt,st,X,U,z,G,w,b,E,S,A,e,O),t&&this.manager.postBatch(t)},batchTextureFrame:function(t,e,i,n,s,r,o){this.manager.set(this);var a=this._tempMatrix1.copyFrom(r),h=this._tempMatrix2,l=e+t.width,u=i+t.height;o?a.multiply(o,h):h=a;var c=h.getX(e,i),d=h.getY(e,i),f=h.getX(e,u),p=h.getY(e,u),g=h.getX(l,u),v=h.getY(l,u),m=h.getX(l,i),y=h.getY(l,i),x=this.renderer.setTextureSource(t.source);n=z.getTintAppendFloatAlpha(n,s),this.batchQuad(null,c,d,f,p,g,v,m,y,t.u0,t.v0,t.u1,t.v1,n,n,n,n,0,t.glTexture,x)}});t.exports=u},function(t,e,i){var c={};t.exports=c;var o=i(266),r=i(50),a=i(115),d=i(68);c.create=function(t){return r.extend({id:r.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{}},t)},c.setModified=function(t,e,i,n){if(o.trigger(t,"compositeModified",t),t.isModified=e,i&&t.parent&&c.setModified(t.parent,e,i,n),n)for(var s=0;s=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(1+(s-r)).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t}},function(t,e,i){var n=i(319),s=i(322),r=i(323),o=i(324);t.exports=function(t){switch(typeof t){case"string":return("rgb"===t.substr(0,3).toLowerCase()?o:n)(t);case"number":return s(t);case"object":return r(t)}}},function(t,e,i){var a=i(100);function h(t,e,i,n){var s=(t+6*e)%6,r=Math.min(s,4-s,1);return Math.round(255*(n-n*i*Math.max(0,r)))}t.exports=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1);var s=h(5,t,e,i),r=h(3,t,e,i),o=h(1,t,e,i);return n?n.setTo?n.setTo(s,r,o,n.alpha,!1):(n.r=s,n.g=r,n.b=o,n.color=a(s,r,o),n):{r:s,g:r,b:o,color:a(s,r,o)}}},function(t,e){t.exports=function(t){return 16777215>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{a:255,r:t>>16&255,g:t>>8&255,b:255&t}}},function(t,e){t.exports=function(t,e,i){return t.x=e-t.width/2,t.y=i-t.height/2,t}},function(t,e,i){var n=i(102),r=i(131),o=i(31),a={canvas:!1,canvasBitBltShift:null,file:!1,fileSystem:!1,getUserMedia:!0,littleEndian:!1,localStorage:!1,pointerLock:!1,support32bit:!1,vibration:!1,webGL:!1,worker:!1};t.exports=function(){a.canvas=!!window.CanvasRenderingContext2D;try{a.localStorage=!!localStorage.getItem}catch(t){a.localStorage=!1}a.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),a.fileSystem=!!window.requestFileSystem;var t,e,i,s=!1;return a.webGL=function(){if(window.WebGLRenderingContext)try{var t=o.createWebGL(this),e=t.getContext("webgl")||t.getContext("experimental-webgl"),i=o.create2D(this),n=i.getContext("2d").createImageData(1,1);return s=n.data instanceof Uint8ClampedArray,o.remove(t),o.remove(i),!!e}catch(t){return!1}return!1}(),a.worker=!!window.Worker,a.pointerLock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,a.getUserMedia=a.getUserMedia&&!!navigator.getUserMedia&&!!window.URL,r.firefox&&r.firefoxVersion<21&&(a.getUserMedia=!1),!n.iOS&&(r.ie||r.firefox||r.chrome)&&(a.canvasBitBltShift=!0),(r.safari||r.mobileSafari)&&(a.canvasBitBltShift=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(a.vibration=!0),"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint32Array&&(a.littleEndian=(t=new ArrayBuffer(4),e=new Uint8Array(t),i=new Uint32Array(t),e[0]=161,e[1]=178,e[2]=195,e[3]=212,3569595041===i[0]||2712847316!==i[0]&&null)),a.support32bit="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof Int32Array&&null!==a.littleEndian&&s,a}()},function(t,e){var i="";function n(t){for(var e=["i","webkitI","msI","mozI","oI"],i=0;ic.width&&(t=c.width-d.cutX),d.cutY+e>c.height&&(e=c.height-d.cutY),d.setSize(t,e,d.cutX,d.cutY)),this.updateDisplayOrigin();var f=this.input;return f&&!f.customHitArea&&(f.hitArea.width=t,f.hitArea.height=e),this},setGlobalTint:function(t){return this.globalTint=t,this},setGlobalAlpha:function(t){return this.globalAlpha=t,this},saveTexture:function(t){return this.textureManager.renameTexture(this.texture.key,t),this._saved=!0,this.texture},fill:function(t,e,i,n,s,r){var o=this.frame,a=this.camera,h=this.renderer;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=o.cutWidth),void 0===r&&(r=o.cutHeight);var l,u,c,d,f,p,g=(t>>16&255)/255,v=(t>>8&255)/255,m=(255&t)/255,y=this.renderTarget;return a.preRender(),y?(y.bind(!0),(l=this.pipeline).manager.set(l),u=y.width,c=y.height,d=h.width/u,f=h.height/c,l.drawFillRect(i*d,n*f,s*d,r*f,x.getTintFromFloats(m,v,g,1),e),y.unbind(!0)):(p=this.context,h.setContext(p),p.fillStyle="rgba("+g+","+v+","+m+","+e+")",p.fillRect(i+o.cutX,n+o.cutY,s,r),h.setContext()),this.dirty=!0,this},clear:function(){var t,e;return this.dirty&&((t=this.renderTarget)?t.clear():((e=this.context).save(),e.setTransform(1,0,0,1,0,0),e.clearRect(this.frame.cutX,this.frame.cutY,this.frame.cutWidth,this.frame.cutHeight),e.restore()),this.dirty=!1),this},erase:function(t,e,i){this._eraseMode=!0;var n=this.renderer.currentBlendMode;return this.renderer.setBlendMode(o.ERASE),this.draw(t,e,i,1,16777215),this.renderer.setBlendMode(n),this._eraseMode=!1,this},draw:function(t,e,i,n,s){void 0===n&&(n=this.globalAlpha),s=void 0===s?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(s>>16)+(65280&s)+((255&s)<<16),Array.isArray(t)||(t=[t]);var r=this.camera,o=this.renderer,a=this.renderTarget;return r.preRender(),a?(a.bind(!0),o.resetTextures(!0),this.batchList(t,e,i,n,s),a.unbind(!0)):(o.setContext(this.context),this.batchList(t,e,i,n,s),o.setContext()),this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=this.globalAlpha),r=void 0===r?(this.globalTint>>16)+(65280&this.globalTint)+((255&this.globalTint)<<16):(r>>16)+(65280&r)+((255&r)<<16);var o=this.camera,a=this.renderTarget,h=this.textureManager.getFrame(t,e);return h&&(o.preRender(),a?(a.bind(!0),this.pipeline.batchTextureFrame(h,i,n,r,s,o.matrix,null),a.unbind(!0)):this.batchTextureFrame(h,i+this.frame.cutX,n+this.frame.cutY,s,r),this.dirty=!0),this},batchList:function(t,e,i,n,s){for(var r=0;rs&&(r=t[s]),n[s]=r,t.length>s+1&&(r=t[s+1]),n[s+1]=r;return this},setColors:function(t){var e=this.points.length;if(e<1)return this;var i=this.colors;void 0===t?t=[16777215]:Array.isArray(t)||(t=[t]);var n=0;if(t.length===e)for(r=0;rn&&(s=t[n]),i[n]=s,t.length>n+1&&(s=t[n+1]),i[n+1]=s;return this},setPoints:function(t,e,i){if(void 0===t&&(t=2),"number"==typeof t){var n,s,r,o=t;if(o<2&&(o=2),t=[],this.horizontal)for(r=-this.frame.halfWidth,s=this.frame.width/(o-1),n=0;n=this._markerOut&&(e.loop?(e.currentTime=this._markerIn,this.updateTexture(),this._lastUpdate=t,this.emit(o.VIDEO_LOOP,this)):(this.emit(o.VIDEO_COMPLETE,this),this.stop())))},checkVideoProgress:function(){2<=this.video.readyState?this.updateTexture():(this.retry--,0e._dx?r<(s=t.right-e.x)&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?s=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType!==o.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.right=!0),t.physicsType!==o.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.left=!0)):t._dxe._dy?r<(s=t.bottom-e.y)&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?s=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType!==o.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.down=!0),t.physicsType!==o.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.up=!0)):t._dy=t.right||e.position.y>=t.bottom)}},function(t,e,i){var w={};t.exports=w;var o=i(93),b=i(114),a=i(265),h=i(115),l=i(581),u=i(50);w._warming=.4,w._torqueDampen=1,w._minLength=1e-6,w.create=function(t){var e=t;e.bodyA&&!e.pointA&&(e.pointA={x:0,y:0}),e.bodyB&&!e.pointB&&(e.pointB={x:0,y:0});var i=e.bodyA?b.add(e.bodyA.position,e.pointA):e.pointA,n=e.bodyB?b.add(e.bodyB.position,e.pointB):e.pointB,s=b.magnitude(b.sub(i,n));e.length=void 0!==e.length?e.length:s,e.id=e.id||u.nextId(),e.label=e.label||"Constraint",e.type="constraint",e.stiffness=e.stiffness||(0t&&(t=s.totalDuration),s.delay=o.sleepThreshold&&u.set(o,!0)):0u._motionWakeThreshold*i&&u.set(a,!1)))}},u.set=function(t,e){var i=t.isSleeping;e?(t.isSleeping=!0,t.sleepCounter=t.sleepThreshold,t.positionImpulse.x=0,t.positionImpulse.y=0,t.positionPrev.x=t.position.x,t.positionPrev.y=t.position.y,t.anglePrev=t.angle,t.speed=0,t.angularSpeed=0,t.motion=0,i||n.trigger(t,"sleepStart")):(t.isSleeping=!1,t.sleepCounter=0,i&&n.trigger(t,"sleepEnd"))}},function(t,e,i){var n={};t.exports=n;var u=i(50);n.on=function(t,e,i){for(var n,s=e.split(" "),r=0;r=t.right&&(o=1,r+=s-t.right,s=t.right);break;case 1:(r+=e)>=t.bottom&&(o=2,s-=r-t.bottom,r=t.bottom);break;case 2:(s-=e)<=t.left&&(o=3,r-=t.left-s,s=t.left);break;case 3:(r-=e)<=t.top&&(o=0,r=t.top)}return n}},function(t,e){t.exports=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=[]);var n=Math.round(t.x1),s=Math.round(t.y1),r=Math.round(t.x2),o=Math.round(t.y2),a=Math.abs(r-n),h=Math.abs(o-s),l=ne.length&&(r=e.length),i?(n=e[r-1][i],(s=e[r][i])-t<=t-n?e[r]:e[r-1]):(n=e[r-1],(s=e[r])-t<=t-n?s:n)}},function(t,e,i){var n=new(i(0))({initialize:function(t,e,i,n,s){void 0===s&&(s=!1),this.textureKey=t,this.textureFrame=e,this.index=i,this.frame=n,this.isFirst=!1,this.isLast=!1,this.prevFrame=null,this.nextFrame=null,this.duration=0,this.progress=0,this.isKeyFrame=s},toJSON:function(){return{key:this.textureKey,frame:this.textureFrame,duration:this.duration,keyframe:this.isKeyFrame}},destroy:function(){this.frame=void 0}});t.exports=n},function(t,e){t.exports=function(t){var i=/\D/g;return t.sort(function(t,e){return parseInt(t.replace(i,""),10)-parseInt(e.replace(i,""),10)}),t}},function(t,e,i){var n=i(177),s=i(0),r=i(98),o=i(10),a=i(128),h=i(23),T=i(2),d=i(6),f=i(178),p=i(314),l=new s({Extends:o,initialize:function(t){o.call(this),this.game=t,this.textureManager=null,this.globalTimeScale=1,this.anims=new r,this.mixes=new r,this.paused=!1,this.name="AnimationManager",t.events.once(h.BOOT,this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once(h.DESTROY,this.destroy,this)},addMix:function(t,e,i){var n,s=this.anims,r=this.mixes,o="string"==typeof t?t:t.key,a="string"==typeof e?e:e.key;return s.has(o)&&s.has(a)&&((n=(n=r.get(o))||{})[a]=i,r.set(o,n)),this},removeMix:function(t,e){var i,n=this.mixes,s="string"==typeof t?t:t.key,r=n.get(s);return r&&(e?(i="string"==typeof e?e:e.key,r.hasOwnProperty(i)&&delete r[i]):e||n.delete(s)),this},getMix:function(t,e){var i=this.mixes,n="string"==typeof t?t:t.key,s="string"==typeof e?e:e.key,r=i.get(n);return r&&r.hasOwnProperty(s)?r[s]:0},add:function(t,e){return this.anims.has(t)?console.warn("Animation key exists: "+t):(e.key=t,this.anims.set(t,e),this.emit(a.ADD_ANIMATION,t,e)),this},exists:function(t){return this.anims.has(t)},createFromAseprite:function(g,v){var m=[],t=this.game.cache.json.get(g);if(!t)return m;var y=this,e=d(t,"meta",null),x=d(t,"frames",null);return e&&x&&d(e,"frameTags",[]).forEach(function(t){var e=[],i=T(t,"name",null),n=T(t,"from",0),s=T(t,"to",0),r=T(t,"direction","forward");if(i&&(!v||v&&-1l.right&&(u=E(u,u+(d-l.right),this.lerp.x)),fl.bottom&&(c=E(c,c+(f-l.bottom),this.lerp.y))):(u=E(u,d-o,this.lerp.x),c=E(c,f-a,this.lerp.y)),p=!0),this.useBounds&&(u=this.clampX(u),c=this.clampY(c)),this.roundPixels&&(o=Math.round(o),a=Math.round(a),u=Math.round(u),c=Math.round(c));var g=(this.scrollX=u)+i,v=(this.scrollY=c)+n;this.midPoint.set(g,v);var m=t/s,y=e/s,x=g-m/2,T=v-y/2;this.roundPixels&&(x=Math.round(x),T=Math.round(T)),this.worldView.setTo(x,T,m,y),r.applyITRS(this.x+o,this.y+a,this.rotation,s,s),r.translate(-o,-a),this.shakeEffect.preRender(),p&&this.emit(b.FOLLOW_UPDATE,this,h)},setLerp:function(t,e){return void 0===t&&(t=1),void 0===e&&(e=t),this.lerp.set(t,e),this},setFollowOffset:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.followOffset.set(t,e),this},startFollow:function(t,e,i,n,s,r){void 0===e&&(e=!1),void 0===i&&(i=1),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=s),this._follow=t,this.roundPixels=e,i=u(i,0,1),n=u(n,0,1),this.lerp.set(i,n),this.followOffset.set(s,r);var o=this.width/2,a=this.height/2,h=t.x-s,l=t.y-r;return this.midPoint.set(h,l),this.scrollX=h-o,this.scrollY=l-a,this.useBounds&&(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.rotateToEffect.reset(),this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(t,e){this.visible&&(this.rotateToEffect.update(t,e),this.panEffect.update(t,e),this.zoomEffect.update(t,e),this.shakeEffect.update(t,e),this.flashEffect.update(t,e),this.fadeEffect.update(t,e))},destroy:function(){this.resetFX(),s.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});t.exports=l},function(t,e,i){var o=i(36);t.exports=function(t){var e=new o;t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,e,i,n){return e+e+i+i+n+n});var i,n,s,r=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return r&&(i=parseInt(r[1],16),n=parseInt(r[2],16),s=parseInt(r[3],16),e.setTo(i,n,s)),e}},function(t,e){t.exports=function(t,e,i,n){return n<<24|t<<16|e<<8|i}},function(t,e){t.exports=function(t,e,i,n){void 0===n&&(n={h:0,s:0,v:0}),t/=255,e/=255,i/=255;var s=Math.min(t,e,i),r=Math.max(t,e,i),o=r-s,a=0,h=0===r?0:o/r,l=r;return r!==s&&(r===t?a=(e-i)/o+(er[0]&&(e=1),r[8]>r[3*e+e]&&(e=2),i=a[e],n=a[i],s=Math.sqrt(r[3*e+e]-r[3*i+i]-r[3*n+n]+1),h[e]=.5*s,s=.5/s,h[i]=(r[3*i+e]+r[3*e+i])*s,h[n]=(r[3*n+e]+r[3*e+n])*s,this._x=h[0],this._y=h[1],this._z=h[2],this._w=(r[3*n+i]-r[3*i+n])*s),this.onChangeCallback(this),this}});t.exports=f},function(t,e,a){var h=a(359),l=a(31),u=a(39),c=a(183);t.exports=function(t){var e=t.config;if((e.customEnvironment||e.canvas)&&e.renderType===u.AUTO)throw new Error("Must set explicit renderType in custom environment");if(!e.customEnvironment&&!e.canvas&&e.renderType!==u.HEADLESS)if(e.renderType===u.CANVAS||e.renderType!==u.CANVAS&&!c.webGL){if(!c.canvas)throw new Error("Cannot create Canvas or WebGL context, aborting.");e.renderType=u.CANVAS}else e.renderType=u.WEBGL;e.antialias||l.disableSmoothing();var i,n,s=t.scale.baseSize,r=s.width,o=s.height;e.canvas?(t.canvas=e.canvas,t.canvas.width=r,t.canvas.height=o):t.canvas=l.create(t,r,o,e.renderType),e.canvasStyle&&(t.canvas.style=e.canvasStyle),e.antialias||h.setCrisp(t.canvas),e.renderType!==u.HEADLESS&&(i=a(568),n=a(571),e.renderType===u.WEBGL?t.renderer=new n(t):(t.renderer=new i(t),t.context=t.renderer.gameContext))}},function(t,e){t.exports={setCrisp:function(e){return["optimizeSpeed","-moz-crisp-edges","-o-crisp-edges","-webkit-optimize-contrast","optimize-contrast","crisp-edges","pixelated"].forEach(function(t){e.style["image-rendering"]=t}),e.style.msInterpolationMode="nearest-neighbor",e},setBicubic:function(t){return t.style["image-rendering"]="auto",t.style.msInterpolationMode="bicubic",t}}},function(t,e,i){var l=i(39);t.exports=function(t){var e,i,n,s,r,o,a,h=t.config;h.hideBanner||(e="WebGL",h.renderType===l.CANVAS?e="Canvas":h.renderType===l.HEADLESS&&(e="Headless"),i=h.audio,a=(n=t.device.audio).webAudio&&!i.disableWebAudio?"Web Audio":i.noAudio||!n.webAudio&&!n.audioData?"No Audio":"HTML5 Audio",t.device.browser.ie?window.console&&console.log("Phaser v"+l.VERSION+" / https://phaser.io"):(r=[s=""],Array.isArray(h.bannerBackgroundColor)?(h.bannerBackgroundColor.forEach(function(t){s=s.concat("%c "),r.push("background: "+t),o=t}),r[r.length-1]="color: "+h.bannerTextColor+"; background: "+o):(s=s.concat("%c "),r.push("color: "+h.bannerTextColor+"; background: "+h.bannerBackgroundColor)),r.push("background: #fff"),h.gameTitle&&(s=s.concat(h.gameTitle),h.gameVersion&&(s=s.concat(" v"+h.gameVersion)),h.hidePhaser||(s=s.concat(" / "))),h.hidePhaser||(s=s.concat("Phaser v"+l.VERSION+" ("+e+" | "+a+")")),s=s.concat(" %c "+h.gameURL),r[0]=s,console.log.apply(console,r)))}},function(t,e,i){var n=i(0),s=i(6),r=i(1),o=i(362),a=new n({initialize:function(t,e){this.game=t,this.raf=new o,this.started=!1,this.running=!1,this.minFps=s(e,"min",5),this.targetFps=s(e,"target",60),this._min=1e3/this.minFps,this._target=1e3/this.targetFps,this.actualFps=this.targetFps,this.nextFpsUpdate=0,this.framesThisSecond=0,this.callback=r,this.forceSetTimeOut=s(e,"forceSetTimeOut",!1),this.time=0,this.startTime=0,this.lastTime=0,this.frame=0,this.inFocus=!0,this._pauseTime=0,this._coolDown=0,this.delta=0,this.deltaIndex=0,this.deltaHistory=[],this.deltaSmoothingMax=s(e,"deltaHistory",10),this.panicMax=s(e,"panicMax",120),this.rawDelta=0,this.now=0,this.smoothStep=s(e,"smoothStep",!0)},blur:function(){this.inFocus=!1},focus:function(){this.inFocus=!0,this.resetDelta()},pause:function(){this._pauseTime=window.performance.now()},resume:function(){this.resetDelta(),this.startTime+=this.time-this._pauseTime},resetDelta:function(){var t=window.performance.now();this.time=t,this.lastTime=t,this.nextFpsUpdate=t+1e3;for(var e=this.framesThisSecond=0;ethis._min&&(r=n[i],r=Math.min(r,this._min)),n[i]=r,this.deltaIndex++,this.deltaIndex>s&&(this.deltaIndex=0);for(var a=o=0;athis.nextFpsUpdate&&(this.actualFps=.25*this.framesThisSecond+.75*this.actualFps,this.nextFpsUpdate=t+1e3,this.framesThisSecond=0),this.framesThisSecond++;var h=o/this._target;this.callback(t,o,h),this.lastTime=t,this.frame++},tick:function(){this.step()},sleep:function(){this.running&&(this.raf.stop(),this.running=!1)},wake:function(t){this.running||(t&&(this.startTime+=-this.lastTime+(this.lastTime+window.performance.now())),this.raf.start(this.step.bind(this),this.useRAF),this.running=!0,this.step())},getDuration:function(){return Math.round(this.lastTime-this.startTime)/1e3},getDurationMS:function(){return Math.round(this.lastTime-this.startTime)},stop:function(){return this.running=!1,this.started=!1,this.raf.stop(),this},destroy:function(){this.stop(),this.callback=r,this.raf=null,this.game=null}});t.exports=a},function(t,e,i){var n=i(0),s=i(1),r=new n({initialize:function(){this.isRunning=!1,this.callback=s,this.tick=0,this.isSetTimeOut=!1,this.timeOutID=null,this.lastTime=0,this.target=0;var n=this;this.step=function t(){var e=window.performance.now();n.lastTime=n.tick,n.tick=e,n.callback(e),n.timeOutID=window.requestAnimationFrame(t)},this.stepTimeout=function t(){var e=Date.now(),i=Math.min(Math.max(2*n.target+n.tick-e,0),n.target);n.lastTime=n.tick,n.tick=e,n.callback(e),n.timeOutID=window.setTimeout(t,i)}},start:function(t,e,i){this.isRunning||(this.callback=t,this.isSetTimeOut=e,this.target=i,this.isRunning=!0,this.timeOutID=e?window.setTimeout(this.stepTimeout,0):window.requestAnimationFrame(this.step))},stop:function(){this.isRunning=!1,this.isSetTimeOut?clearTimeout(this.timeOutID):window.cancelAnimationFrame(this.timeOutID)},destroy:function(){this.stop(),this.callback=s}});t.exports=r},function(t,e,i){var n=i(23);t.exports=function(t){var e,i=t.events;void 0!==document.hidden?e="visibilitychange":["webkit","moz","ms"].forEach(function(t){void 0!==document[t+"Hidden"]&&(document.hidden=function(){return document[t+"Hidden"]},e=t+"visibilitychange")});e&&document.addEventListener(e,function(t){document.hidden||"pause"===t.type?i.emit(n.HIDDEN):i.emit(n.VISIBLE)},!1),window.onblur=function(){i.emit(n.BLUR)},window.onfocus=function(){i.emit(n.FOCUS)},window.focus&&t.config.autoFocus&&window.focus()}},function(t,e,i){var m=i(365),y=i(31),x=i(6);t.exports=function(t){var e=x(t,"data",[]),i=x(t,"canvas",null),n=x(t,"palette",m),s=x(t,"pixelWidth",1),r=x(t,"pixelHeight",s),o=x(t,"resizeCanvas",!0),a=x(t,"clearCanvas",!0),h=x(t,"preRender",null),l=x(t,"postRender",null),u=Math.floor(Math.abs(e[0].length*s)),c=Math.floor(Math.abs(e.length*r));i||(i=y.create2D(this,u,c),a=o=!1),o&&(i.width=u,i.height=c);var d=i.getContext("2d");a&&d.clearRect(0,0,u,c),h&&h(i,d);for(var f=0;fi.length-2?i.length-1:s+1],l=i[s>i.length-3?i.length-1:s+2];return e.set(u(r,o.x,a.x,h.x,l.x),u(r,o.y,a.y,h.y,l.y))},toJSON:function(){for(var t=[],e=0;ethis.resizeInterval)&&(this.getParentBounds()&&this.refresh(),this.dirty=!1,this._lastCheck=0))},stopListeners:function(){var e=this.listeners;window.removeEventListener("orientationchange",e.orientationChange,!1),window.removeEventListener("resize",e.windowResize,!1);["webkit","moz",""].forEach(function(t){document.removeEventListener(t+"fullscreenchange",e.fullScreenChange,!1),document.removeEventListener(t+"fullscreenerror",e.fullScreenError,!1)}),document.removeEventListener("MSFullscreenChange",e.fullScreenChange,!1),document.removeEventListener("MSFullscreenError",e.fullScreenError,!1)},destroy:function(){this.removeAllListeners(),this.stopListeners(),this.game=null,this.canvas=null,this.canvasBounds=null,this.parent=null,this.fullscreenTarget=null,this.parentSize.destroy(),this.gameSize.destroy(),this.baseSize.destroy(),this.displaySize.destroy()},isFullscreen:{get:function(){return this.fullscreen.active}},width:{get:function(){return this.gameSize.width}},height:{get:function(){return this.gameSize.height}},isPortrait:{get:function(){return this.orientation===u.ORIENTATION.PORTRAIT}},isLandscape:{get:function(){return this.orientation===u.ORIENTATION.LANDSCAPE}},isGamePortrait:{get:function(){return this.height>this.width}},isGameLandscape:{get:function(){return this.width>this.height}}});t.exports=v},function(t,e,i){var n=i(16),s=i(0),r=i(72),o=i(3),a=new s({initialize:function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===n&&(n=null),this._width=t,this._height=e,this._parent=n,this.aspectMode=i,this.aspectRatio=0===e?1:t/e,this.minWidth=0,this.minHeight=0,this.maxWidth=Number.MAX_VALUE,this.maxHeight=Number.MAX_VALUE,this.snapTo=new o},setAspectMode:function(t){return void 0===t&&(t=0),this.aspectMode=t,this.setSize(this._width,this._height)},setSnap:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.snapTo.set(t,e),this.setSize(this._width,this._height)},setParent:function(t){return this._parent=t,this.setSize(this._width,this._height)},setMin:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.minWidth=n(t,0,this.maxWidth),this.minHeight=n(e,0,this.maxHeight),this.setSize(this._width,this._height)},setMax:function(t,e){return void 0===t&&(t=Number.MAX_VALUE),void 0===e&&(e=t),this.maxWidth=n(t,this.minWidth,Number.MAX_VALUE),this.maxHeight=n(e,this.minHeight,Number.MAX_VALUE),this.setSize(this._width,this._height)},setSize:function(t,e){switch(void 0===t&&(t=0),void 0===e&&(e=t),this.aspectMode){case a.NONE:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height;break;case a.WIDTH_CONTROLS_HEIGHT:this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(this._width*(1/this.aspectRatio),!1);break;case a.HEIGHT_CONTROLS_WIDTH:this._height=this.getNewHeight(r(e,this.snapTo.y)),this._width=this.getNewWidth(this._height*this.aspectRatio,!1);break;case a.FIT:this.constrain(t,e,!0);break;case a.ENVELOP:this.constrain(t,e,!1)}return this},setAspectRatio:function(t){return this.aspectRatio=t,this.setSize(this._width,this._height)},resize:function(t,e){return this._width=this.getNewWidth(r(t,this.snapTo.x)),this._height=this.getNewHeight(r(e,this.snapTo.y)),this.aspectRatio=0===this._height?1:this._width/this._height,this},getNewWidth:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minWidth,this.maxWidth),e&&this._parent&&t>this._parent.width&&(t=Math.max(this.minWidth,this._parent.width)),t},getNewHeight:function(t,e){return void 0===e&&(e=!0),t=n(t,this.minHeight,this.maxHeight),e&&this._parent&&t>this._parent.height&&(t=Math.max(this.minHeight,this._parent.height)),t},constrain:function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=!0),t=this.getNewWidth(t),e=this.getNewHeight(e);var n=this.snapTo,s=0===e?1:t/e;return i&&this.aspectRatio>s||!i&&this.aspectRatios)&&(t=(e=r(e,n.y))*this.aspectRatio,0r.START&&n.settings.status<=r.RUNNING&&n.step(t,e)}},render:function(t){for(var e=0;e=r.LOADING&&i.settings.status=r.x&&t=r.y&&e=r.x&&t=r.y&&e=n-this.manager.loopEndOffset?(this.audio.currentTime=i+Math.max(0,s-n),s=this.audio.currentTime):s>4,l[a++]=(15&i)<<4|n>>2,l[a++]=(3&n)<<6|63&s;return h}},function(t,e,i){var n=i(142),s=i(0),r=i(66),o=new s({Extends:n,initialize:function(t,e,i){if(void 0===i&&(i={}),this.audioBuffer=t.game.cache.audio.get(e),!this.audioBuffer)throw new Error('There is no audio asset with key "'+e+'" in the audio cache');this.source=null,this.loopSource=null,this.muteNode=t.context.createGain(),this.volumeNode=t.context.createGain(),this.playTime=0,this.startTime=0,this.loopTime=0,this.rateUpdates=[],this.hasEnded=!1,this.hasLooped=!1,this.muteNode.connect(this.volumeNode),this.volumeNode.connect(t.destination),this.duration=this.audioBuffer.duration,this.totalDuration=this.audioBuffer.duration,n.call(this,t,e,i)},play:function(t,e){return!!n.prototype.play.call(this,t,e)&&(this.stopAndRemoveBufferSource(),this.createAndStartBufferSource(),this.emit(r.PLAY,this),!0)},pause:function(){return!(this.manager.context.currentTime>>16,g=(65280&c)>>>8,v=255&c,h.strokeStyle="rgba("+p+","+g+","+v+","+l+")",h.lineWidth=f,m+=3;break;case y.FILL_STYLE:d=o[m+1],u=o[m+2],p=(16711680&d)>>>16,g=(65280&d)>>>8,v=255&d,h.fillStyle="rgba("+p+","+g+","+v+","+u+")",m+=2;break;case y.BEGIN_PATH:h.beginPath();break;case y.CLOSE_PATH:h.closePath();break;case y.FILL_PATH:r||h.fill();break;case y.STROKE_PATH:r||h.stroke();break;case y.FILL_RECT:r?h.rect(o[m+1],o[m+2],o[m+3],o[m+4]):h.fillRect(o[m+1],o[m+2],o[m+3],o[m+4]),m+=4;break;case y.FILL_TRIANGLE:h.beginPath(),h.moveTo(o[m+1],o[m+2]),h.lineTo(o[m+3],o[m+4]),h.lineTo(o[m+5],o[m+6]),h.closePath(),r||h.fill(),m+=6;break;case y.STROKE_TRIANGLE:h.beginPath(),h.moveTo(o[m+1],o[m+2]),h.lineTo(o[m+3],o[m+4]),h.lineTo(o[m+5],o[m+6]),h.closePath(),r||h.stroke(),m+=6;break;case y.LINE_TO:h.lineTo(o[m+1],o[m+2]),m+=2;break;case y.MOVE_TO:h.moveTo(o[m+1],o[m+2]),m+=2;break;case y.LINE_FX_TO:h.lineTo(o[m+1],o[m+2]),m+=5;break;case y.MOVE_FX_TO:h.moveTo(o[m+1],o[m+2]),m+=5;break;case y.SAVE:h.save();break;case y.RESTORE:h.restore();break;case y.TRANSLATE:h.translate(o[m+1],o[m+2]),m+=2;break;case y.SCALE:h.scale(o[m+1],o[m+2]),m+=2;break;case y.ROTATE:h.rotate(o[m+1]),m+=1;break;case y.GRADIENT_FILL_STYLE:m+=5;break;case y.GRADIENT_LINE_STYLE:m+=6}}h.restore()}}},function(t,e,i){var n=i(0),s=i(132),r=i(78),o=i(2),a=i(64),h=new n({initialize:function(t,e,i,n){void 0===n&&(n=!1),this.propertyKey=e,this.propertyValue=i,this.defaultValue=i,this.steps=0,this.counter=0,this.start=0,this.end=0,this.ease,this.emitOnly=n,this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,this.loadConfig(t)},loadConfig:function(t,e){void 0===t&&(t={}),e&&(this.propertyKey=e),this.propertyValue=o(t,this.propertyKey,this.defaultValue),this.setMethods(),this.emitOnly&&(this.onUpdate=this.defaultUpdate)},toJSON:function(){return this.propertyValue},onChange:function(t){return this.propertyValue=t,this.setMethods()},setMethods:function(){var t,e,i,n=this.propertyValue,s=typeof n;return this.onEmit=this.defaultEmit,this.onUpdate=this.defaultUpdate,"number"==s?(this.onEmit=this.staticValueEmit,this.onUpdate=this.staticValueUpdate):Array.isArray(n)?this.onEmit=this.randomStaticValueEmit:"function"==s?this.emitOnly?this.onEmit=n:this.onUpdate=n:"object"==s&&this.hasBoth(n,"start","end")?(this.start=n.start,this.end=n.end,(t=this.has(n,"random"))&&(this.onEmit=this.randomRangedValueEmit),this.has(n,"steps")?(this.steps=n.steps,this.counter=this.start,this.onEmit=this.steppedEmit):(e=this.has(n,"ease")?n.ease:"Linear",this.ease=r(e,n.easeParams),t||(this.onEmit=this.easedValueEmit),this.onUpdate=this.easeValueUpdate)):"object"==s&&this.hasBoth(n,"min","max")?(this.start=n.min,this.end=n.max,this.onEmit=this.randomRangedValueEmit):"object"==s&&this.has(n,"random")?(i=n.random,Array.isArray(i)&&(this.start=i[0],this.end=i[1]),this.onEmit=this.randomRangedValueEmit):"object"==s&&this.hasEither(n,"onEmit","onUpdate")&&(this.has(n,"onEmit")&&(this.onEmit=n.onEmit),this.has(n,"onUpdate")&&(this.onUpdate=n.onUpdate)),this},has:function(t,e){return t.hasOwnProperty(e)},hasBoth:function(t,e,i){return t.hasOwnProperty(e)&&t.hasOwnProperty(i)},hasEither:function(t,e,i){return t.hasOwnProperty(e)||t.hasOwnProperty(i)},defaultEmit:function(t,e,i){return i},defaultUpdate:function(t,e,i,n){return n},staticValueEmit:function(){return this.propertyValue},staticValueUpdate:function(){return this.propertyValue},randomStaticValueEmit:function(){var t=Math.floor(Math.random()*this.propertyValue.length);return this.propertyValue[t]},randomRangedValueEmit:function(t,e){var i=s(this.start,this.end);return t&&t.data[e]&&(t.data[e].min=i),i},steppedEmit:function(){var t=this.counter,e=this.counter+(this.end-this.start)/this.steps;return this.counter=a(e,this.start,this.end),t},easedValueEmit:function(t,e){var i;return t&&t.data[e]&&((i=t.data[e]).min=this.start,i.max=this.end),this.start},easeValueUpdate:function(t,e,i){var n=t.data[e];return(n.max-n.min)*this.ease(i)+n.min}});t.exports=h},function(t,e,i){var n=i(0),o=i(2),s=new n({initialize:function(t,e,i,n,s){var r;"object"==typeof t?(t=o(r=t,"x",0),e=o(r,"y",0),i=o(r,"power",0),n=o(r,"epsilon",100),s=o(r,"gravity",50)):(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=100),void 0===s&&(s=50)),this.x=t,this.y=e,this.active=!0,this._gravity=s,this._power=0,this._epsilon=0,this.power=i,this.epsilon=n},update:function(t,e){var i,n,s=this.x-t.x,r=this.y-t.y,o=s*s+r*r;0!==o&&(i=Math.sqrt(o),oe.right&&t.collideRight&&(this.x=e.right,this.velocityX*=i),this.ye.bottom&&t.collideBottom&&(this.y=e.bottom,this.velocityY*=i)},update:function(t,e,i){if(0this._length&&(this.counter=this._length-1),this},changeSource:function(t){return this.source=t,this.updateSource()},getPoint:function(t){0===this._direction?(this.counter++,this.counter>=this._length&&(this.yoyo?(this._direction=1,this.counter=this._length-1):this.counter=0)):(this.counter--,-1===this.counter&&(this.yoyo?(this._direction=0,this.counter=0):this.counter=this._length-1));var e=this.points[this.counter];e&&(t.x=e.x,t.y=e.y)}});t.exports=n},function(t,e){t.exports=function(t,e){for(var i=0;id.PI2?s=d.PI2:s<0&&(s=d.PI2+s%d.PI2);for(var a,h=[r+Math.cos(n)*i,o+Math.sin(n)*i];e<1;)a=s*e+n,h.push(r+Math.cos(a)*i,o+Math.sin(a)*i),e+=t;return a=s+n,h.push(r+Math.cos(a)*i,o+Math.sin(a)*i),h.push(r+Math.cos(n)*i,o+Math.sin(n)*i),this.pathIndexes=u(h),this.pathData=h,this}});t.exports=r},function(t,e,i){var n=i(0),s=i(1083),r=i(65),o=i(9),a=i(33),h=new n({Extends:a,Mixins:[s],initialize:function(t,e,i,n,s,r){void 0===e&&(e=0),void 0===i&&(i=0),a.call(this,t,"Curve",n),this._smoothness=32,this._curveBounds=new o,this.closePath=!1,this.setPosition(e,i),void 0!==s&&this.setFillStyle(s,r),this.updateData()},smoothness:{get:function(){return this._smoothness},set:function(t){this._smoothness=t,this.updateData()}},setSmoothness:function(t){return this._smoothness=t,this.updateData()},updateData:function(){var t=this._curveBounds,e=this._smoothness;this.geom.getBounds(t,e),this.setSize(t.width,t.height),this.updateDisplayOrigin();for(var i=[],n=this.geom.getPoints(e),s=0;st.right||e.rightt.bottom||e.bottome.right||t.righte.bottom||t.bottome.right||t.righte.bottom||t.bottomt.width*t.height)&&(e.x>t.x&&e.xt.x&&e.rightt.y&&e.yt.y&&e.bottom=this.threshold?this.pressed||(this.pressed=!0,this.events.emit(s.BUTTON_DOWN,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_DOWN,i,t,this)):this.pressed&&(this.pressed=!1,this.events.emit(s.BUTTON_UP,e,this,t),this.pad.emit(s.GAMEPAD_BUTTON_UP,i,t,this))},destroy:function(){this.pad=null,this.events=null}});t.exports=r},function(t,e,i){var a=i(486),h=i(487),n=i(0),l=i(10),u=i(3),s=new n({Extends:l,initialize:function(t,e){l.call(this),this.manager=t,this.pad=e,this.id=e.id,this.index=e.index;for(var i=[],n=0;n=s;for(this.fixedStep||(n=.001*e,o=!0,this._elapsed=0),h=0;h=s;)this._elapsed-=s,this.step(n)}},step:function(t){for(var e,i=this.bodies.entries,n=i.length,s=0;sc)&&(d.xu))return this.separateCircle(t,e,s)}var f=!1,p=!1;s?(f=M(t,e,s,this.OVERLAP_BIAS),p=P(t,e,s,this.OVERLAP_BIAS)):this.forceX||Math.abs(this.gravity.y+t.gravity.y)=e.right||t.position.y>=e.bottom))},circleBodyIntersects:function(t,e){var i=p(t.center.x,e.left,e.right),n=p(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},overlap:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!0)},collide:function(t,e,i,n,s){return void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=i),this.collideObjects(t,e,i,n,s,!1)},collideObjects:function(t,e,i,n,s,r){var o;t.isParent&&void 0===t.physicsType&&(t=t.children.entries),e&&e.isParent&&void 0===e.physicsType&&(e=e.children.entries);var a=Array.isArray(t),h=Array.isArray(e);if(this._total=0,a||h)if(!a&&h)for(o=0;od.baseTileWidth&&(h-=a=(d.tileWidth-d.baseTileWidth)*e.scaleX,u+=a),d.tileHeight>d.baseTileHeight&&(c+=(d.tileHeight-d.baseTileHeight)*e.scaleY);var f=S(h,l,u,c,null,e.scene.cameras.main,e.layer);return 0!==f.length&&this.collideSpriteVsTilesHandler(t,f,i,n,s,r,!0)},collideSpriteVsTilesHandler:function(t,e,i,n,s,r,o){for(var a,h,l=t.body,u={left:0,right:0,top:0,bottom:0},c=!1,d=0;de.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,r=this.blocked.right=!0),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,r=this.blocked.down=!0),r&&(this.blocked.none=!1,this.updateCenter()),r},setOffset:function(t,e){return void 0===e&&(e=t),this.offset.set(t,e),this},setSize:function(t,e,i){void 0===i&&(i=!0);var n,s,r=this.gameObject;return!t&&r.frame&&(t=r.frame.realWidth),!e&&r.frame&&(e=r.frame.realHeight),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),i&&r.getCenter&&(n=(r.width-t)/2,s=(r.height-e)/2,this.offset.set(n,s)),this.isCircle=!1,this.radius=0,this},setCircle:function(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),0=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-e)*(this.center.y-e)<=this.radius*this.radius:h(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return 0=t.minX&&e.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(t,e,i,n,s){for(var r,o=[e,i];o.length;)(i=o.pop())-(e=o.pop())<=n||(r=e+Math.ceil((i-e)/n/2)*n,a(t,r,e,i,s),o.push(e,r,r,i))}n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],n=this.toBBox;if(!l(t,e))return i;for(var s,r,o,a,h=[];e;){for(s=0,r=e.children.length;sthis._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)},_split:function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var r=this._chooseSplitIndex(i,s,n),o=p(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,f(i,this.toBBox),f(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)},_splitRoot:function(t,e){this.data=p([t,e]),this.data.height=t.height+1,this.data.leaf=!1,f(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){for(var n,s,r,o,a,h,l,u,c,d,f,p,g=a=1/0,v=e;v<=i-e;v++)n=m(t,0,v,this.toBBox),s=m(t,v,i,this.toBBox),l=n,u=s,p=f=d=c=void 0,c=Math.max(l.minX,u.minX),d=Math.max(l.minY,u.minY),f=Math.min(l.maxX,u.maxX),p=Math.min(l.maxY,u.maxY),r=Math.max(0,f-c)*Math.max(0,p-d),o=y(n)+y(s),re.deltaAbsY()?g=-1:e.deltaAbsX()i&&s<(o=t.right-i)&&(o=0),0!==o&&(t.customSeparateX?t.overlapX=o:c(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.left=!0):0i&&s<(o=t.bottom-i)&&(o=0),0!==o&&(t.customSeparateY?t.overlapY=o:c(t,o)),o}},function(t,e){t.exports=function(t,e){e<0?(t.blocked.none=!1,t.blocked.up=!0):0n.worldView.x+s.scaleX*i.tileWidth*(-r-.5)&&a.xn.worldView.y+s.scaleY*i.tileHeight*(-o-1)&&a.y=n.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}n=i.pop()}else{var s,r,o,a=n.layers[n.i];n.i++,"imagelayer"===a.type?(s=h(a,"offsetx",0)+h(a,"startx",0),r=h(a,"offsety",0)+h(a,"starty",0),e.push({name:n.name+a.name,image:a.image,x:n.x+s+a.x,y:n.y+r+a.y,alpha:n.opacity*a.opacity,visible:n.visible&&a.visible,properties:h(a,"properties",{})})):"group"===a.type&&(o=l(t,a,n),i.push(n),n=o)}return e}},function(t,e,i){var d=i(2),f=i(251),p=i(551),g=i(154);t.exports=function(t){for(var e=[],i=[],n=g(t);n.i=n.layers.length){if(i.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}n=i.pop()}else{var s,r=n.layers[n.i];if(n.i++,r.opacity*=n.opacity,r.visible=n.visible&&r.visible,"objectgroup"===r.type){r.name=n.name+r.name;for(var o=n.x+d(r,"startx",0)+d(r,"offsetx",0),a=n.y+d(r,"starty",0)+d(r,"offsety",0),h=[],l=0;l=r.layers.length){if(s.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}r=s.pop()}else{var o,a=r.layers[r.i];if(r.i++,"tilelayer"===a.type)if(a.compression)console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+a.name+"'");else{if(a.encoding&&"base64"===a.encoding){if(a.chunks)for(var h=0;h>>0;return n}},function(t,e,i){var w=i(119),b=i(555),E=i(251);t.exports=function(t){for(var e,i=[],n=[],s=null,r=0;r=this.firstgid&&tn&&(n=e.layer[r].width),e.layer[r].height>s&&(s=e.layer[r].height);var o=new h({width:n,height:s,name:t,tileWidth:e.layer[0].tilesize,tileHeight:e.layer[0].tilesize,format:a.WELTMEISTER});return o.layers=l(e,i),o.tilesets=u(e),o}},function(t,e,i){var d=i(117),f=i(81);t.exports=function(t,e){for(var i=[],n=0;n>>0;if("function"!=typeof t)throw new TypeError;for(var n=2<=arguments.length?arguments[1]:void 0,s=0;sthis.maxSpeedY&&(this._speedY=this.maxSpeedY)):this.down&&this.down.isDown&&(this._speedY-=this.accelY,this._speedY<-this.maxSpeedY&&(this._speedY=-this.maxSpeedY)),this.left&&this.left.isDown?(this._speedX+=this.accelX,this._speedX>this.maxSpeedX&&(this._speedX=this.maxSpeedX)):this.right&&this.right.isDown&&(this._speedX-=this.accelX,this._speedX<-this.maxSpeedX&&(this._speedX=-this.maxSpeedX)),this.zoomIn&&this.zoomIn.isDown?this._zoom=-this.zoomSpeed:this.zoomOut&&this.zoomOut.isDown?this._zoom=this.zoomSpeed:this._zoom=0,0!==this._speedX&&(e.scrollX-=this._speedX*t|0),0!==this._speedY&&(e.scrollY-=this._speedY*t|0),0!==this._zoom&&(e.zoom+=this._zoom,e.zoom<.001&&(e.zoom=.001)))},destroy:function(){this.camera=null,this.left=null,this.right=null,this.up=null,this.down=null,this.zoomIn=null,this.zoomOut=null}});t.exports=r},function(t,e,i){t.exports={Camera:i(318),BaseCamera:i(99),CameraManager:i(767),Effects:i(325),Events:i(35)}},function(t,e){t.exports="cameradestroy"},function(t,e){t.exports="camerafadeincomplete"},function(t,e){t.exports="camerafadeinstart"},function(t,e){t.exports="camerafadeoutcomplete"},function(t,e){t.exports="camerafadeoutstart"},function(t,e){t.exports="cameraflashcomplete"},function(t,e){t.exports="cameraflashstart"},function(t,e){t.exports="followupdate"},function(t,e){t.exports="camerapancomplete"},function(t,e){t.exports="camerapanstart"},function(t,e){t.exports="postrender"},function(t,e){t.exports="prerender"},function(t,e){t.exports="camerarotatecomplete"},function(t,e){t.exports="camerarotatestart"},function(t,e){t.exports="camerashakecomplete"},function(t,e){t.exports="camerashakestart"},function(t,e){t.exports="camerazoomcomplete"},function(t,e){t.exports="camerazoomstart"},function(t,e,i){var n=i(16),s=i(0),l=i(35),r=new s({initialize:function(t){this.camera=t,this.isRunning=!1,this.isComplete=!1,this.direction=!0,this.duration=0,this.red=0,this.green=0,this.blue=0,this.alpha=0,this.progress=0,this._elapsed=0,this._onUpdate,this._onUpdateScope},start:function(t,e,i,n,s,r,o,a){if(void 0===t&&(t=!0),void 0===e&&(e=1e3),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(o=null),void 0===a&&(a=this.camera.scene),!r&&this.isRunning)return this.camera;this.isRunning=!0,this.isComplete=!1,this.duration=e,this.direction=t,this.progress=0,this.red=i,this.green=n,this.blue=s,this.alpha=t?Number.MIN_VALUE:1,this._elapsed=0,this._onUpdate=o,this._onUpdateScope=a;var h=t?l.FADE_OUT_START:l.FADE_IN_START;return this.camera.emit(h,this.camera,this,e,i,n,s),this.camera},update:function(t,e){this.isRunning&&(this._elapsed+=e,this.progress=n(this._elapsed/this.duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.camera,this.progress),this._elapsedthis.source?Math.abs(this.destination-this.source):Math.abs(this.destination+h)-this.source)<(u=this.source>this.destination?Math.abs(this.source-this.destination):Math.abs(this.source+h)-this.destination)?this.clockwise=!0:uMath.PI&&(t-=n.PI2),Math.abs(((t+n.TAU)%n.PI2-n.PI2)%n.PI2)}},function(t,e,i){var n=i(132);t.exports=function(){return n(-Math.PI,Math.PI)}},function(t,e,i){var n=i(132);t.exports=function(){return n(-180,180)}},function(t,e,i){var n=i(343);t.exports=function(t){return n(t+Math.PI)}},function(t,e,i){var n=i(13);t.exports=function(t,e,i){return void 0===i&&(i=.05),t===e||(Math.abs(e-t)<=i||Math.abs(e-t)>=n.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(e>>0,i=(e*=i)>>>0,i+=4294967296*(e-=i);return 2.3283064365386963e-10*((this.n=i)>>>0)},init:function(t){"string"==typeof t?this.state(t):this.sow(t)},sow:function(t){if(this.n=4022871197,this.s0=this.hash(" "),this.s1=this.hash(" "),this.s2=this.hash(" "),this.c=1,t)for(var e=0;e 0.0)"," {"," c.rgb /= c.a;"," }",""," vec4 result;",""," result.r = (uColorMatrix[0] * c.r) + (uColorMatrix[1] * c.g) + (uColorMatrix[2] * c.b) + (uColorMatrix[3] * c.a) + uColorMatrix[4];"," result.g = (uColorMatrix[5] * c.r) + (uColorMatrix[6] * c.g) + (uColorMatrix[7] * c.b) + (uColorMatrix[8] * c.a) + uColorMatrix[9];"," result.b = (uColorMatrix[10] * c.r) + (uColorMatrix[11] * c.g) + (uColorMatrix[12] * c.b) + (uColorMatrix[13] * c.a) + uColorMatrix[14];"," result.a = (uColorMatrix[15] * c.r) + (uColorMatrix[16] * c.g) + (uColorMatrix[17] * c.b) + (uColorMatrix[18] * c.a) + uColorMatrix[19];",""," vec3 rgb = mix(c.rgb, result.rgb, uAlpha);",""," rgb *= result.a;",""," gl_FragColor = vec4(rgb, result.a);","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_COPY_FS","","precision mediump float;","","uniform sampler2D uMainSampler;","uniform float uBrightness;","","varying vec2 outTexCoord;","","void main ()","{"," gl_FragColor = texture2D(uMainSampler, outTexCoord) * uBrightness;","}",""].join("\n")},function(t,e){t.exports=["#define SHADER_NAME PHASER_LINEAR_BLEND_FS","","precision mediump float;","","uniform sampler2D uMainSampler1;","uniform sampler2D uMainSampler2;","uniform float uStrength;","","varying vec2 outTexCoord;","","void main ()","{"," vec4 frame1 = texture2D(uMainSampler1, outTexCoord);"," vec4 frame2 = texture2D(uMainSampler2, outTexCoord);",""," gl_FragColor = mix(frame1, frame2 * uStrength, 0.5);","}",""].join("\n")},function(t,e){t.exports="addtexture"},function(t,e){t.exports="onerror"},function(t,e){t.exports="onload"},function(t,e){t.exports="ready"},function(t,e){t.exports="removetexture"},function(t,e,i){t.exports={GenerateTexture:i(364),Palettes:i(875)}},function(t,e,i){t.exports={ARNE16:i(365),C64:i(876),CGA:i(877),JMP:i(878),MSX:i(879)}},function(t,e){t.exports={0:"#000",1:"#fff",2:"#8b4131",3:"#7bbdc5",4:"#8b41ac",5:"#6aac41",6:"#3931a4",7:"#d5de73",8:"#945a20",9:"#5a4100",A:"#bd736a",B:"#525252",C:"#838383",D:"#acee8b",E:"#7b73de",F:"#acacac"}},function(t,e){t.exports={0:"#000",1:"#2234d1",2:"#0c7e45",3:"#44aacc",4:"#8a3622",5:"#5c2e78",6:"#aa5c3d",7:"#b5b5b5",8:"#5e606e",9:"#4c81fb",A:"#6cd947",B:"#7be2f9",C:"#eb8a60",D:"#e23d69",E:"#ffd93f",F:"#fff"}},function(t,e){t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#f5f4eb"}},function(t,e){t.exports={0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#fff"}},function(t,e,i){t.exports={Path:i(881),MoveTo:i(369),CubicBezier:i(366),Curve:i(88),Ellipse:i(367),Line:i(368),QuadraticBezier:i(370),Spline:i(371)}},function(t,e,i){var n=i(0),u=i(366),l=i(367),s=i(5),r=i(368),o=i(369),a=i(370),h=i(9),c=i(371),d=i(3),f=i(13),p=new n({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.name="",this.curves=[],this.cacheLengths=[],this.autoClose=!1,this.startPoint=new d,this._tmpVec2A=new d,this._tmpVec2B=new d,"object"==typeof t?this.fromJSON(t):this.startPoint.set(t,e)},add:function(t){return this.curves.push(t),this},circleTo:function(t,e,i){return void 0===e&&(e=!1),this.ellipseTo(t,t,0,360,e,i)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new r(e,t)),this},cubicBezierTo:function(t,e,i,n,s,r){var o,a,h=this.getEndPoint(),l=t instanceof d?(o=t,a=e,i):(o=new d(i,n),a=new d(s,r),new d(t,e));return this.add(new u(h,o,a,l))},quadraticBezierTo:function(t,e,i,n){var s,r=this.getEndPoint(),o=t instanceof d?(s=t,e):(s=new d(i,n),new d(t,e));return this.add(new a(r,s,o))},draw:function(t,e){for(var i=0;i=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getPointAt(h,e)}s++}return null},getPoints:function(t){void 0===t&&(t=12);for(var e,i=[],n=0;n=i){var r=n[s]-i,o=this.curves[s],a=o.getLength(),h=0===a?0:1-r/a;return o.getTangentAt(h,e)}s++}return null},lineTo:function(t,e){t instanceof d?this._tmpVec2B.copy(t):this._tmpVec2B.set(t,e);var i=this.getEndPoint(this._tmpVec2A);return this.add(new r([i.x,i.y,this._tmpVec2B.x,this._tmpVec2B.y]))},splineTo:function(t){return t.unshift(this.getEndPoint()),this.add(new c(t))},moveTo:function(t,e){return t instanceof d?this.add(new o(t.x,t.y)):this.add(new o(t,e))},toJSON:function(){for(var t=[],e=0;e>16&255,g:t>>8&255,b:255&t,a:255};return 16777215>>24),e}},function(t,e,i){var h=i(36),l=i(375);t.exports=function(t,e,i){var n,s,r=i,o=i,a=i;return 0!==e&&(r=l(s=2*i-(n=i<.5?i*(1+e):i+e-i*e),n,t+1/3),o=l(s,n,t),a=l(s,n,t-1/3)),(new h).setGLTo(r,o,a,1)}},function(t,e,i){var s=i(180);t.exports=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],n=0;n<=359;n++)i.push(s(n/359,t,e));return i}},function(t,e,i){function o(t,e,i,n,s,r,o,a){void 0===o&&(o=100),void 0===a&&(a=0);var h=a/o;return{r:l(t,n,h),g:l(e,s,h),b:l(i,r,h)}}var l=i(130);t.exports={RGBWithRGB:o,ColorWithRGB:function(t,e,i,n,s,r){return void 0===s&&(s=100),void 0===r&&(r=0),o(t.r,t.g,t.b,e,i,n,s,r)},ColorWithColor:function(t,e,i,n){return void 0===i&&(i=100),void 0===n&&(n=0),o(t.r,t.g,t.b,e.r,e.g,e.b,i,n)}}},function(t,e,i){var n=i(187),s=i(36);t.exports=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=255),new s(n(t,e),n(t,e),n(t,e))}},function(t,e,i){var r=i(374);t.exports=function(t,e,i,n,s){return void 0===n&&(n=255),void 0===s&&(s="#"),"#"===s?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1):"0x"+r(n)+r(t)+r(e)+r(i)}},function(t,e,i){t.exports={BitmapMask:i(302),GeometryMask:i(303)}},function(t,e,i){var n={AddToDOM:i(137),DOMContentLoaded:i(377),GetInnerHeight:i(378),GetScreenOrientation:i(379),GetTarget:i(384),ParseXML:i(385),RemoveFromDOM:i(193),RequestAnimationFrame:i(362)};t.exports=n},function(t,e,i){t.exports={EventEmitter:i(905)}},function(t,e,i){var n=i(0),s=i(10),r=i(25),o=new n({Extends:s,initialize:function(){s.call(this)},shutdown:function(){this.removeAllListeners()},destroy:function(){this.removeAllListeners()}});r.register("EventEmitter",o,"events"),t.exports=o},function(t,e,i){var n=i(137),s=i(313),r=i(317),o=i(31),a=i(0),h=i(338),l=i(907),u=i(358),c=i(97),d=i(360),f=i(339),p=i(377),g=i(10),v=i(23),m=i(386),y=i(25),x=i(391),T=i(392),w=i(394),b=i(136),E=i(399),S=i(361),A=i(363),_=i(403),C=new a({initialize:function(t){this.config=new h(t),this.renderer=null,this.domContainer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new g,this.anims=new s(this),this.textures=new E(this),this.cache=new r(this),this.registry=new c(this),this.input=new m(this,this.config),this.scene=new w(this,this.config.sceneConfig),this.device=f,this.scale=new T(this,this.config),this.sound=null,this.sound=_.create(this),this.loop=new S(this,this.config.fps),this.plugins=new x(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,p(this.boot.bind(this))},boot:function(){y.hasCore("EventEmitter")?(this.isBooted=!0,this.config.preBoot(this),this.scale.preBoot(),u(this),l(this),d(this),n(this.canvas,this.config.parent),this.textures.once(b.READY,this.texturesReady,this),this.events.emit(v.BOOT)):console.warn("Aborting. Core Plugins missing.")},texturesReady:function(){this.events.emit(v.READY),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),A(this);var t=this.events;t.on(v.HIDDEN,this.onHidden,this),t.on(v.VISIBLE,this.onVisible,this),t.on(v.BLUR,this.onBlur,this),t.on(v.FOCUS,this.onFocus,this)},step:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(v.PRE_STEP,t,e),i.emit(v.STEP,t,e),this.scene.update(t,e),i.emit(v.POST_STEP,t,e);var n=this.renderer;n.preRender(),i.emit(v.PRE_RENDER,n,t,e),this.scene.render(n),n.postRender(),i.emit(v.POST_RENDER,n,t,e)},headlessStep:function(t,e){if(this.pendingDestroy)return this.runDestroy();var i=this.events;i.emit(v.PRE_STEP,t,e),i.emit(v.STEP,t,e),this.scene.update(t,e),i.emit(v.POST_STEP,t,e),i.emit(v.PRE_RENDER),i.emit(v.POST_RENDER)},onHidden:function(){this.loop.pause(),this.events.emit(v.PAUSE)},onVisible:function(){this.loop.resume(),this.events.emit(v.RESUME)},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},getFrame:function(){return this.loop.frame},getTime:function(){return this.loop.now},destroy:function(t,e){void 0===e&&(e=!1),this.pendingDestroy=!0,this.removeCanvas=t,this.noReturn=e},runDestroy:function(){this.scene.destroy(),this.events.emit(v.DESTROY),this.events.removeAllListeners(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(o.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.domContainer&&this.domContainer.parentNode.removeChild(this.domContainer),this.loop.destroy(),this.pendingDestroy=!1}});t.exports=C},function(t,e,i){var n=i(137);t.exports=function(t){var e,i=t.config;i.parent&&i.domCreateContainer&&((e=document.createElement("div")).style.cssText=["display: block;","width: "+t.scale.width+"px;","height: "+t.scale.height+"px;","padding: 0; margin: 0;","position: absolute;","overflow: hidden;","pointer-events: none;","transform: scale(1);","transform-origin: left top;"].join(" "),t.domContainer=e,n(e,i.parent))}},function(t,e){t.exports="boot"},function(t,e){t.exports="destroy"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameout"},function(t,e){t.exports="gameover"},function(t,e){t.exports="gameobjectdown"},function(t,e){t.exports="dragend"},function(t,e){t.exports="dragenter"},function(t,e){t.exports="drag"},function(t,e){t.exports="dragleave"},function(t,e){t.exports="dragover"},function(t,e){t.exports="dragstart"},function(t,e){t.exports="drop"},function(t,e){t.exports="gameobjectmove"},function(t,e){t.exports="gameobjectout"},function(t,e){t.exports="gameobjectover"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="wheel"},function(t,e){t.exports="gameobjectup"},function(t,e){t.exports="gameobjectwheel"},function(t,e){t.exports="boot"},function(t,e){t.exports="process"},function(t,e){t.exports="update"},function(t,e){t.exports="pointerdown"},function(t,e){t.exports="pointerdownoutside"},function(t,e){t.exports="pointermove"},function(t,e){t.exports="pointerout"},function(t,e){t.exports="pointerover"},function(t,e){t.exports="pointerup"},function(t,e){t.exports="pointerupoutside"},function(t,e){t.exports="wheel"},function(t,e){t.exports="pointerlockchange"},function(t,e){t.exports="preupdate"},function(t,e){t.exports="shutdown"},function(t,e){t.exports="start"},function(t,e){t.exports="update"},function(t,e){t.exports="addfile"},function(t,e){t.exports="complete"},function(t,e){t.exports="filecomplete"},function(t,e){t.exports="filecomplete-"},function(t,e){t.exports="loaderror"},function(t,e){t.exports="load"},function(t,e){t.exports="fileprogress"},function(t,e){t.exports="postprocess"},function(t,e){t.exports="progress"},function(t,e){t.exports="start"},function(t,e,i){t.exports={game:"game",renderer:"renderer",anims:"anims",cache:"cache",plugins:"plugins",registry:"registry",scale:"scale",sound:"sound",textures:"textures",events:"events",cameras:"cameras",add:"add",make:"make",scenePlugin:"scene",displayList:"children",lights:"lights",data:"data",input:"input",load:"load",time:"time",tweens:"tweens",arcadePhysics:"physics",impactPhysics:"impact",matterPhysics:"matter"}},function(t,e){t.exports=function(t,e,i){if(i.getElementsByTagName("TextureAtlas")){var n=t.source[e];t.add("__BASE",e,0,0,n.width,n.height);for(var s=i.getElementsByTagName("SubTexture"),r=0;r=t.length)throw new Error("Supplied index out of bounds");return n!==i&&(t.splice(n,1),t.splice(i,0,e)),e}},function(t,e){t.exports=function(t,e){var i,n,s=t.indexOf(e);return-1!==s&&st.length-1)throw new Error("Index out of bounds");var s=r(t,e);return i&&i.call(n,s),s}},function(t,e,i){var l=i(77);t.exports=function(t,e,i,n,s){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===s&&(s=t),l(t,e,i)){var r=i-e,o=t.splice(e,r);if(n)for(var a=0;a?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",TEXT_SET2:" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET3:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",TEXT_SET4:"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",TEXT_SET5:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",TEXT_SET6:"ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",TEXT_SET7:"AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",TEXT_SET8:"0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET9:"ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",TEXT_SET10:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",TEXT_SET11:"ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789"}},function(t,e,i){var P=i(6);t.exports=function(t,e){var i=e.width,n=e.height,s=Math.floor(i/2),r=Math.floor(n/2),o=P(e,"chars","");if(""!==o){var a=P(e,"image",""),h=t.sys.textures.getFrame(a),l=h.cutX,u=h.cutY,c=h.source.width,d=h.source.height,f=P(e,"offset.x",0),p=P(e,"offset.y",0),g=P(e,"spacing.x",0),v=P(e,"spacing.y",0),m=P(e,"lineSpacing",0),y=P(e,"charsPerRow",null);null===y&&(y=c/i)>o.length&&(y=o.length);for(var x=f,T=p,w={retroFont:!0,font:a,size:i,lineHeight:n+m,chars:{}},b=0,E=0;E=i&&t.x<=n&&t.y>=s&&t.y<=r}},function(t,e){t.exports=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||s=n&&(p.push(v),f=v)}var m=o[o.length-1];return y(f,m)i&&(i=a.x),a.xs&&(s=a.y),a.yn(e)?t.setSize(e.height*i,e.height):t.setSize(e.width,e.width/i),t.setPosition(e.centerX-t.width/2,e.centerY-t.height/2)}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t}},function(t,e){t.exports=function(t){return t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height),t}},function(t,e,i){var r=i(9);t.exports=function(t,e,i,n,s){return void 0===s&&(s=new r),s.setTo(Math.min(t,i),Math.min(e,n),Math.abs(t-i),Math.abs(e-n))}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.centerX,e.y=t.centerY,e}},function(t,e,i){var n=i(4);t.exports=function(t,e){return void 0===e&&(e=new n),e.x=t.width,e.y=t.height,e}},function(t,e,i){var r=i(182);t.exports=function(t,e,i){var n=t.centerX,s=t.centerY;return t.setSize(t.width+2*e,t.height+2*i),r(t,n,s)}},function(t,e,i){var n=i(9),s=i(112);t.exports=function(t,e,i){return void 0===i&&(i=new n),s(t,e)?(i.x=Math.max(t.x,e.x),i.y=Math.max(t.y,e.y),i.width=Math.min(t.right,e.right)-i.x,i.height=Math.min(t.bottom,e.bottom)-i.y):i.setEmpty(),i}},function(t,e){t.exports=function(t,e){for(var i=t.x,n=t.right,s=t.y,r=t.bottom,o=0;oe.x&&t.ye.y}},function(t,e,i){var a=i(4),h=i(34);t.exports=function(t,e,i){void 0===i&&(i=new a),e=h(e);var n=Math.sin(e),s=Math.cos(e),r=0=s||0=t.downTime+n)&&(i=!0),i)return this.setDragState(t,3),this.processDragStartList(t)},processDragStartList:function(t){if(3!==this.getDragState(t))return 0;for(var e=this._drag[t.id],i=0;it._tick)return t._tick=i,!0}return!1},update:function(){var t=this.manager.queue,e=t.length;if(this.isActive()&&0!==e)for(var i=this.keys,n=0;n'),i.push(''),i.push(''),i.push(this.xhrLoader.responseText),i.push(""),i.push(""),i.push("");var n=[i.join("\n")],s=this;try{var r=new window.Blob(n,{type:"image/svg+xml;charset=utf-8"})}catch(t){return s.state=o.FILE_ERRORED,void s.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){l.revokeObjectURL(s.data),s.onProcessComplete()},this.data.onerror=function(){l.revokeObjectURL(s.data),s.onProcessError()},l.createObjectURL(this.data,r,"image/svg+xml")},addToCache:function(){var t=this.cache.addImage(this.key,this.data);this.pendingDestroy(t)}});s.register("htmlTexture",function(t,e,i,n,s){if(Array.isArray(t))for(var r=0;r=n[2];if("^"===i.operator)return 0=i.number:0=n[2]:r[2]===n[2]}return t===e||"*"===t}},function(t,e,i){var n={};t.exports=n;var s=i(159),r=(i(241),i(50));n.create=function(t){var e=s.create(),i={label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}};return r.extend(e,i,t)}},function(t,e,i){var y={};t.exports=y;var a=i(518),n=i(583),r=i(50);y.create=function(t){var e={controller:y,detector:n.collisions,buckets:{},pairs:{},pairsList:[],bucketWidth:48,bucketHeight:48};return r.extend(e,t)},y.update=function(t,e,i,n){for(var s,r,o,a=i.world,h=t.buckets,l=!1,u=i.metrics,c=u.broadphaseTests=0;ca.bounds.max.x||d.bounds.max.ya.bounds.max.y)){var f=y._getRegion(t,d);if(!d.region||f.id!==d.region.id||n){u.broadphaseTests+=1,d.region&&!n||(d.region=f);for(var p=y._regionUnion(f,d.region),g=p.startCol;g<=p.endCol;g++)for(s=p.startRow;s<=p.endRow;s++){r=h[o=y._getBucketId(g,s)];var v=g>=f.startCol&&g<=f.endCol&&s>=f.startRow&&s<=f.endRow,m=g>=d.region.startCol&&g<=d.region.endCol&&s>=d.region.startRow&&s<=d.region.endRow;!v&&m&&m&&r&&y._bucketRemoveBody(t,r,d),(d.region===f||v&&!m||n)&&(r=r||y._createBucket(h,o),y._bucketAddBody(t,r,d))}d.region=f,l=!0}}}l&&(t.pairsList=y._createActivePairsList(t))},y.clear=function(t){t.buckets={},t.pairs={},t.pairsList=[]},y._regionUnion=function(t,e){var i=Math.min(t.startCol,e.startCol),n=Math.max(t.endCol,e.endCol),s=Math.min(t.startRow,e.startRow),r=Math.max(t.endRow,e.endRow);return y._createRegion(i,n,s,r)},y._getRegion=function(t,e){var i=e.bounds,n=Math.floor(i.min.x/t.bucketWidth),s=Math.floor(i.max.x/t.bucketWidth),r=Math.floor(i.min.y/t.bucketHeight),o=Math.floor(i.max.y/t.bucketHeight);return y._createRegion(n,s,r,o)},y._createRegion=function(t,e,i,n){return{id:t+","+e+","+i+","+n,startCol:t,endCol:e,startRow:i,endRow:n}},y._getBucketId=function(t,e){return"C"+t+"R"+e},y._createBucket=function(t,e){return t[e]=[]},y._bucketAddBody=function(t,e,i){for(var n=0;nl._pairMaxIdleLife&&a.push(h);for(h=0;hu.friction*u.frictionStatic*O*i&&(D=M,L=U.clamp(u.friction*P*i,-D,D));var F,k,I=X.cross(w,p),B=X.cross(b,p),N=m/(d.inverseMass+f.inverseMass+d.inverseInertia*I*I+f.inverseInertia*B*B);R*=N,L*=N,_<0&&_*_>Y._restingThresh*i?x.normalImpulse=0:(F=x.normalImpulse,x.normalImpulse=Math.min(x.normalImpulse+R,0),R=x.normalImpulse-F),C*C>Y._restingThreshTangent*i?x.tangentImpulse=0:(k=x.tangentImpulse,x.tangentImpulse=U.clamp(x.tangentImpulse+L,-D,D),L=x.tangentImpulse-k),n.x=p.x*R+g.x*L,n.y=p.y*R+g.y*L,d.isStatic||d.isSleeping||(d.positionPrev.x+=n.x*d.inverseMass,d.positionPrev.y+=n.y*d.inverseMass,d.anglePrev+=X.cross(w,n)*d.inverseInertia),f.isStatic||f.isSleeping||(f.positionPrev.x-=n.x*f.inverseMass,f.positionPrev.y-=n.y*f.inverseMass,f.anglePrev-=X.cross(b,n)*f.inverseInertia)}}}}},function(t,e,i){t.exports={BasePlugin:i(519),DefaultPlugins:i(189),PluginCache:i(25),PluginManager:i(391),ScenePlugin:i(1384)}},function(t,e,i){var n=i(519),s=i(0),r=i(20),o=new s({Extends:n,initialize:function(t,e){n.call(this,e),this.scene=t,this.systems=t.sys,t.sys.events.once(r.BOOT,this.boot,this)},boot:function(){},destroy:function(){this.pluginManager=null,this.game=null,this.scene=null,this.systems=null}});t.exports=o},function(t,e,i){var n=i(18),s=i(192),r=n(!1,r={Center:i(380),Events:i(101),Orientation:i(381),ScaleManager:i(392),ScaleModes:i(382),Zoom:i(383)},s.CENTER);r=n(!1,r,s.ORIENTATION),r=n(!1,r,s.SCALE_MODE),r=n(!1,r,s.ZOOM),t.exports=r},function(t,e,i){var n=i(139),s=i(18)(!1,s={Events:i(20),GetPhysicsPlugins:i(396),GetScenePlugins:i(397),SceneManager:i(394),ScenePlugin:i(1387),Settings:i(398),Systems:i(195)},n);t.exports=s},function(t,e,i){var n=i(16),s=i(0),a=i(20),h=i(2),r=i(25),o=new s({initialize:function(t){this.scene=t,this.systems=t.sys,this.settings=t.sys.settings,this.key=t.sys.settings.key,this.manager=t.sys.game.scene,this.transitionProgress=0,this._elapsed=0,this._target=null,this._duration=0,this._onUpdate,this._onUpdateScope,this._willSleep=!1,this._willRemove=!1,t.sys.events.once(a.BOOT,this.boot,this),t.sys.events.on(a.START,this.pluginStart,this)},boot:function(){this.systems.events.once(a.DESTROY,this.destroy,this)},pluginStart:function(){this._target=null,this.systems.events.once(a.SHUTDOWN,this.shutdown,this)},start:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",this.key),this.manager.queueOp("start",t,e),this},restart:function(t){var e=this.key;return this.manager.queueOp("stop",e),this.manager.queueOp("start",e,t),this},transition:function(t){void 0===t&&(t={});var e=h(t,"target",!1),i=this.manager.getScene(e);if(!e||!this.checkValidTransition(i))return!1;var n=h(t,"duration",1e3);this._elapsed=0,this._target=i,this._duration=n,this._willSleep=h(t,"sleep",!1),this._willRemove=h(t,"remove",!1);var s=h(t,"onUpdate",null);s&&(this._onUpdate=s,this._onUpdateScope=h(t,"onUpdateScope",this.scene));var r=h(t,"allowInput",!1);this.settings.transitionAllowInput=r;var o=i.sys.settings;return o.isTransition=!0,o.transitionFrom=this.scene,o.transitionDuration=n,o.transitionAllowInput=r,h(t,"moveAbove",!1)?this.manager.moveAbove(this.key,e):h(t,"moveBelow",!1)&&this.manager.moveBelow(this.key,e),i.sys.isSleeping()?i.sys.wake(h(t,"data")):this.manager.start(e,h(t,"data")),this.systems.events.emit(a.TRANSITION_OUT,i,n),this.systems.events.on(a.UPDATE,this.step,this),!0},checkValidTransition:function(t){return!(!t||t.sys.isActive()||t.sys.isTransitioning()||t===this.scene||this.systems.isTransitioning())},step:function(t,e){this._elapsed+=e,this.transitionProgress=n(this._elapsed/this._duration,0,1),this._onUpdate&&this._onUpdate.call(this._onUpdateScope,this.transitionProgress),this._elapsed>=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,e=this._target.sys.settings;this.systems.events.off(a.UPDATE,this.step,this),t.events.emit(a.TRANSITION_COMPLETE,this.scene),e.isTransition=!1,e.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,e,i,n){return this.manager.add(t,e,i,n)},launch:function(t,e){return t&&t!==this.key&&this.manager.queueOp("start",t,e),this},run:function(t,e){return t&&t!==this.key&&this.manager.queueOp("run",t,e),this},pause:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,e),this},resume:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,e),this},sleep:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,e),this},wake:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,e),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t,e){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t,e),this},setActive:function(t,e,i){void 0===e&&(e=this.key);var n=this.manager.getScene(e);return n&&n.sys.setActive(t,i),this},setVisible:function(t,e){void 0===e&&(e=this.key);var i=this.manager.getScene(e);return i&&i.sys.setVisible(t),this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isPaused:function(t){return void 0===t&&(t=this.key),this.manager.isPaused(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.swapPosition(t,e),this},moveAbove:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveAbove(t,e),this},moveBelow:function(t,e){return void 0===e&&(e=this.key),t!==e&&this.manager.moveBelow(t,e),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(a.SHUTDOWN,this.shutdown,this),t.off(a.POST_UPDATE,this.step,this),t.off(a.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(a.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});r.register("ScenePlugin",o,"scenePlugin"),t.exports=o},function(t,e,i){t.exports={Events:i(415),List:i(105),Map:i(98),ProcessQueue:i(202),RTree:i(508),Set:i(145),Size:i(393)}},function(t,e,i){var n=i(18),s=i(1390),r=n(!1,r={CanvasTexture:i(400),Events:i(136),FilterMode:s,Frame:i(104),Parsers:i(402),Texture:i(197),TextureManager:i(399),TextureSource:i(401)},s);t.exports=r},function(t,e){t.exports={LINEAR:0,NEAREST:1}},function(t,e,i){var n=i(18),s=i(1392),r=n(!1,r={Components:i(243),Parsers:i(1425),Formats:i(38),ImageCollection:i(555),ParseToTilemap:i(253),Tile:i(81),Tilemap:i(559),TilemapCreator:i(1431),TilemapFactory:i(1432),Tileset:i(119),TilemapLayer:i(560),Orientation:i(29),LayerData:i(117),MapData:i(118),ObjectLayer:i(551)},s.ORIENTATION);t.exports=r},function(t,e,i){var n={FromOrientationString:i(242),ORIENTATION:i(29)};t.exports=n},function(t,e,i){var p=i(26),g=i(60);t.exports=function(t,e,i,n,s,r,o,a){void 0===o&&(o=!0),t<0&&(t=0),e<0&&(e=0);for(var h=p(t,e,i,n,null,a),l=s-t,u=r-e,c=0;c=t&&l.index<=e&&u(l,i)}n&&c(0,0,s.width,s.height,s)}}},function(t,e,i){var a=i(69),h=i(60),l=i(153);t.exports=function(t,e,i,n){void 0===e&&(e=!0),void 0===i&&(i=!0),Array.isArray(t)||(t=[t]);for(var s=0;s=s.delay&&(n=s.elapsed-s.delay,s.elapsed=s.delay,!s.hasDispatched&&s.callback&&(s.hasDispatched=!0,s.callback.apply(s.callbackScope,s.args)),0>2],s+=o[(3&i[r])<<4|i[r+1]>>4],s+=o[(15&i[r+1])<<2|i[r+2]>>6],s+=o[63&i[r+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s}},function(t,e,i){t.exports={Clone:i(76),DeepCopy:i(167),Extend:i(18),GetAdvancedValue:i(15),GetFastValue:i(2),GetMinMaxValue:i(1457),GetValue:i(6),HasAll:i(1458),HasAny:i(432),HasValue:i(123),IsPlainObject:i(7),Merge:i(140),MergeRight:i(1459),Pick:i(550),SetValue:i(455)}},function(t,e,i){var o=i(6),a=i(16);t.exports=function(t,e,i,n,s){void 0===s&&(s=i);var r=o(t,e,s);return a(r,i,n)}},function(t,e){t.exports=function(t,e){for(var i=0;ii[e][0])&&(e=n);return!S(P(t,e-1),P(t,e),P(t,e+1))&&(function(t){for(var e=[],i=t.length,n=0;n!==i;n++)e.push(t.pop());for(n=0;n!==i;n++)t[n]=e[n]}(t),!0)}};var u=[],c=[];function M(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n}function P(t,e){var i=t.length;return t[e<0?e%i+i:e%i]}function R(t,e,i,n){for(var s=i;sn.deltaMax?n.deltaMax:e)/n.delta,n.delta=e),0!==n.timeScalePrev&&(r*=s.timeScale/n.timeScalePrev),0===s.timeScale&&(r=0),n.timeScalePrev=s.timeScale,n.correction=r,n.frameCounter+=1,1e3<=t-n.counterTimestamp&&(n.fps=n.frameCounter*((t-n.counterTimestamp)/1e3),n.counterTimestamp=t,n.frameCounter=0),T.update(i,e,r))},step:function(t,e){T.update(this.engine,t,e)},update60Hz:function(){return 1e3/60},update30Hz:function(){return 1e3/30},has:function(t){var e=t.hasOwnProperty("body")?t.body:t;return null!==u.get(this.localWorld,e.id,e.type)},getAllBodies:function(){return u.allBodies(this.localWorld)},getAllConstraints:function(){return u.allConstraints(this.localWorld)},getAllComposites:function(){return u.allComposites(this.localWorld)},postUpdate:function(){var t,e,i,n;this.drawDebug&&(t=this.debugConfig,e=this.engine,i=this.debugGraphic,n=u.allBodies(this.localWorld),this.debugGraphic.clear(),t.showBroadphase&&e.broadphase.controller&&this.renderGrid(e.broadphase,i,t.broadphaseColor,.5),t.showBounds&&this.renderBodyBounds(n,i,t.boundsColor,.5),(t.showBody||t.showStaticBody)&&this.renderBodies(n),t.showJoint&&this.renderJoints(),(t.showAxes||t.showAngleIndicator)&&this.renderBodyAxes(n,i,t.showAxes,t.angleColor,.5),t.showVelocity&&this.renderBodyVelocity(n,i,t.velocityColor,1,2),t.showSeparations&&this.renderSeparations(e.pairs.list,i,t.separationColor),t.showCollisions&&this.renderCollisions(e.pairs.list,i,t.collisionColor))},renderGrid:function(t,e,i,n){e.lineStyle(1,i,n);for(var s=y.keys(t.buckets),r=0;re.max.x?i=e.min.x-t.max.x:t.max.xe.max.y?n=e.min.y-t.max.y:t.max.y