mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
v3.80 Beta 2
This commit is contained in:
parent
5ac59c1890
commit
3015fe11eb
12 changed files with 301567 additions and 300936 deletions
348
dist/phaser-arcade-physics.js
vendored
348
dist/phaser-arcade-physics.js
vendored
|
@ -15691,7 +15691,7 @@ var CONST = {
|
|||
* @type {string}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
VERSION: '3.80.0-beta.1',
|
||||
VERSION: '3.80.0-beta.2',
|
||||
|
||||
BlendModes: __webpack_require__(95723),
|
||||
|
||||
|
@ -59282,14 +59282,21 @@ var Mesh = new Class({
|
|||
*
|
||||
* @example
|
||||
* mesh.setInteractive();
|
||||
*
|
||||
* @example
|
||||
* mesh.setInteractive({ useHandCursor: true });
|
||||
*
|
||||
* @method Phaser.GameObjects.Mesh#setInteractive
|
||||
* @since 3.60.0
|
||||
*
|
||||
* @param {(Phaser.Types.Input.InputConfiguration)} [config] - An input configuration object but it will ignore hitArea, hitAreaCallback and pixelPerfect with associated alphaTolerance properties.
|
||||
*
|
||||
* @return {this} This GameObject.
|
||||
*/
|
||||
setInteractive: function ()
|
||||
setInteractive: function (config)
|
||||
{
|
||||
if (config === undefined) { config = {}; }
|
||||
|
||||
var hitAreaCallback = function (area, x, y)
|
||||
{
|
||||
var faces = this.faces;
|
||||
|
@ -59308,7 +59315,7 @@ var Mesh = new Class({
|
|||
return false;
|
||||
}.bind(this);
|
||||
|
||||
this.scene.sys.input.enable(this, hitAreaCallback);
|
||||
this.scene.sys.input.enable(this, config, hitAreaCallback);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -72354,6 +72361,7 @@ var SetValue = __webpack_require__(22440);
|
|||
var ShaderRender = __webpack_require__(24252);
|
||||
var TransformMatrix = __webpack_require__(69360);
|
||||
var ArrayEach = __webpack_require__(36337);
|
||||
var RenderEvents = __webpack_require__(81044);
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -72507,6 +72515,28 @@ var Shader = new Class({
|
|||
*/
|
||||
this.vertexBuffer = renderer.createVertexBuffer(this.vertexData.byteLength, this.gl.STREAM_DRAW);
|
||||
|
||||
/**
|
||||
* Internal property: whether the shader needs to be created,
|
||||
* and if so, the key and textures to use for the shader.
|
||||
*
|
||||
* @name Phaser.GameObjects.Shader#_deferSetShader
|
||||
* @type {?{ key: string, textures: string[]|undefined, textureData: any|undefined }}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._deferSetShader = null;
|
||||
|
||||
/**
|
||||
* Internal property: whether the projection matrix needs to be set,
|
||||
* and if so, the data to use for the orthographic projection.
|
||||
*
|
||||
* @name Phaser.GameObjects.Shader#_deferProjOrtho
|
||||
* @type {?{ left: number, right: number, bottom: number, top: number }}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._deferProjOrtho = null;
|
||||
|
||||
/**
|
||||
* The WebGL shader program this shader uses.
|
||||
*
|
||||
|
@ -72692,6 +72722,8 @@ var Shader = new Class({
|
|||
this.setSize(width, height);
|
||||
this.setOrigin(0.5, 0.5);
|
||||
this.setShader(key, textures, textureData);
|
||||
|
||||
this.renderer.on(RenderEvents.RESTORE_WEBGL, this.onContextRestored, this);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -72816,6 +72848,12 @@ var Shader = new Class({
|
|||
*/
|
||||
setShader: function (key, textures, textureData)
|
||||
{
|
||||
if (this.renderer.contextLost)
|
||||
{
|
||||
this._deferSetShader = { key: key, textures: textures, textureData: textureData };
|
||||
return this;
|
||||
}
|
||||
|
||||
if (textures === undefined) { textures = []; }
|
||||
|
||||
if (typeof key === 'string')
|
||||
|
@ -72926,6 +72964,12 @@ var Shader = new Class({
|
|||
*/
|
||||
projOrtho: function (left, right, bottom, top)
|
||||
{
|
||||
if (this.renderer.contextLost)
|
||||
{
|
||||
this._deferProjOrtho = { left: left, right: right, bottom: bottom, top: top };
|
||||
return;
|
||||
}
|
||||
|
||||
var near = -1000;
|
||||
var far = 1000;
|
||||
|
||||
|
@ -73548,6 +73592,34 @@ var Shader = new Class({
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* Run any logic that was deferred during context loss.
|
||||
*
|
||||
* @method Phaser.GameObjects.Shader#onContextRestored
|
||||
* @since 3.80.0
|
||||
*/
|
||||
onContextRestored: function ()
|
||||
{
|
||||
if (this._deferSetShader !== null)
|
||||
{
|
||||
var key = this._deferSetShader.key;
|
||||
var textures = this._deferSetShader.textures;
|
||||
var textureData = this._deferSetShader.textureData;
|
||||
this._deferSetShader = null;
|
||||
this.setShader(key, textures, textureData);
|
||||
}
|
||||
|
||||
if (this._deferProjOrtho !== null)
|
||||
{
|
||||
var left = this._deferProjOrtho.left;
|
||||
var right = this._deferProjOrtho.right;
|
||||
var bottom = this._deferProjOrtho.bottom;
|
||||
var top = this._deferProjOrtho.top;
|
||||
this._deferProjOrtho = null;
|
||||
this.projOrtho(left, right, bottom, top);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Internal destroy handler, called as part of the destroy process.
|
||||
*
|
||||
|
@ -73559,6 +73631,7 @@ var Shader = new Class({
|
|||
{
|
||||
var renderer = this.renderer;
|
||||
|
||||
renderer.off(RenderEvents.RESTORE_WEBGL, this.onContextRestored, this);
|
||||
renderer.deleteProgram(this.program);
|
||||
renderer.deleteBuffer(this.vertexBuffer);
|
||||
|
||||
|
@ -82320,8 +82393,6 @@ var Text = new Class({
|
|||
{
|
||||
this.frame.source.glTexture = this.renderer.canvasToTexture(canvas, this.frame.source.glTexture, true);
|
||||
|
||||
this.frame.glTexture = this.frame.source.glTexture;
|
||||
|
||||
if (false)
|
||||
{}
|
||||
}
|
||||
|
@ -103175,6 +103246,7 @@ var GetFastValue = __webpack_require__(72632);
|
|||
var GEOM_CONST = __webpack_require__(52394);
|
||||
var InputPluginCache = __webpack_require__(63399);
|
||||
var IsPlainObject = __webpack_require__(42911);
|
||||
var HasAny = __webpack_require__(53523);
|
||||
var PluginCache = __webpack_require__(91963);
|
||||
var Rectangle = __webpack_require__(74118);
|
||||
var RectangleContains = __webpack_require__(94287);
|
||||
|
@ -103940,6 +104012,7 @@ var InputPlugin = new Class({
|
|||
if (input)
|
||||
{
|
||||
this.removeDebug(gameObject);
|
||||
this.manager.resetCursor(input);
|
||||
|
||||
input.gameObject = undefined;
|
||||
input.target = undefined;
|
||||
|
@ -103988,20 +104061,12 @@ var InputPlugin = new Class({
|
|||
input.dragState = 0;
|
||||
}
|
||||
|
||||
// Clear from _temp, _drag and _over
|
||||
var temp = this._temp;
|
||||
// Clear from _drag and _over
|
||||
var drag = this._drag;
|
||||
var over = this._over;
|
||||
var manager = this.manager;
|
||||
|
||||
var index = temp.indexOf(gameObject);
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
temp.splice(index, 1);
|
||||
}
|
||||
|
||||
for (var i = 0; i < manager.pointersTotal; i++)
|
||||
for (var i = 0, index; i < manager.pointersTotal; i++)
|
||||
{
|
||||
index = drag[i].indexOf(gameObject);
|
||||
|
||||
|
@ -104015,8 +104080,6 @@ var InputPlugin = new Class({
|
|||
if (index > -1)
|
||||
{
|
||||
over[i].splice(index, 1);
|
||||
|
||||
manager.resetCursor(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105324,26 +105387,31 @@ var InputPlugin = new Class({
|
|||
var customHitArea = true;
|
||||
|
||||
// Config object?
|
||||
if (IsPlainObject(hitArea))
|
||||
if (IsPlainObject(hitArea) && Object.keys(hitArea).length)
|
||||
{
|
||||
var config = hitArea;
|
||||
|
||||
hitArea = GetFastValue(config, 'hitArea', null);
|
||||
hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null);
|
||||
// Check if any supplied Game Object is a Mesh based Game Object
|
||||
if (!HasAny(gameObjects, 'faces'))
|
||||
{
|
||||
hitArea = GetFastValue(config, 'hitArea', null);
|
||||
hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null);
|
||||
|
||||
pixelPerfect = GetFastValue(config, 'pixelPerfect', false);
|
||||
var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1);
|
||||
|
||||
if (pixelPerfect)
|
||||
{
|
||||
hitArea = {};
|
||||
hitAreaCallback = this.makePixelPerfect(alphaTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
draggable = GetFastValue(config, 'draggable', false);
|
||||
dropZone = GetFastValue(config, 'dropZone', false);
|
||||
cursor = GetFastValue(config, 'cursor', false);
|
||||
useHandCursor = GetFastValue(config, 'useHandCursor', false);
|
||||
|
||||
pixelPerfect = GetFastValue(config, 'pixelPerfect', false);
|
||||
var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1);
|
||||
|
||||
if (pixelPerfect)
|
||||
{
|
||||
hitArea = {};
|
||||
hitAreaCallback = this.makePixelPerfect(alphaTolerance);
|
||||
}
|
||||
|
||||
// Still no hitArea or callback?
|
||||
if (!hitArea || !hitAreaCallback)
|
||||
{
|
||||
|
@ -105351,11 +105419,6 @@ var InputPlugin = new Class({
|
|||
customHitArea = false;
|
||||
}
|
||||
}
|
||||
else if (typeof hitArea === 'function' && !hitAreaCallback)
|
||||
{
|
||||
hitAreaCallback = hitArea;
|
||||
hitArea = {};
|
||||
}
|
||||
|
||||
for (var i = 0; i < gameObjects.length; i++)
|
||||
{
|
||||
|
@ -146239,6 +146302,9 @@ var StaticBody = new Class({
|
|||
|
||||
gameObject.getTopLeft(this.position);
|
||||
|
||||
this.position.x += this.offset.x;
|
||||
this.position.y += this.offset.y;
|
||||
|
||||
this.updateCenter();
|
||||
|
||||
this.world.staticTree.insert(this);
|
||||
|
@ -160627,6 +160693,18 @@ var WebGLRenderer = new Class({
|
|||
*/
|
||||
this.blankTexture = null;
|
||||
|
||||
/**
|
||||
* A blank 1x1 #7f7fff texture, a flat normal map,
|
||||
* as used by the Graphics system where needed.
|
||||
* This is set in the `boot` method.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.WebGLRenderer#normalTexture
|
||||
* @type {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper}
|
||||
* @readonly
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this.normalTexture = null;
|
||||
|
||||
/**
|
||||
* A pure white 4x4 texture, as used by the Graphics system where needed.
|
||||
* This is set in the `boot` method.
|
||||
|
@ -160982,7 +161060,7 @@ var WebGLRenderer = new Class({
|
|||
_this.pipelines.restoreContext();
|
||||
|
||||
// Apply resize.
|
||||
_this.resize(_this.width, _this.height);
|
||||
_this.resize(_this.game.scale.baseSize.width, _this.game.scale.baseSize.height);
|
||||
|
||||
// Restore GL extensions.
|
||||
setupExtensions();
|
||||
|
@ -161135,6 +161213,7 @@ var WebGLRenderer = new Class({
|
|||
// Set-up default textures, fbo and scissor
|
||||
|
||||
this.blankTexture = game.textures.getFrame('__DEFAULT').glTexture;
|
||||
this.normalTexture = game.textures.getFrame('__NORMAL').glTexture;
|
||||
this.whiteTexture = game.textures.getFrame('__WHITE').glTexture;
|
||||
|
||||
var gl = this.gl;
|
||||
|
@ -165538,7 +165617,6 @@ var GetFastValue = __webpack_require__(72632);
|
|||
var LightShaderSourceFS = __webpack_require__(65045);
|
||||
var MultiPipeline = __webpack_require__(77310);
|
||||
var TransformMatrix = __webpack_require__(69360);
|
||||
var UUID = __webpack_require__(76583);
|
||||
var Vec2 = __webpack_require__(93736);
|
||||
var WebGLPipeline = __webpack_require__(44775);
|
||||
|
||||
|
@ -165614,21 +165692,11 @@ var LightPipeline = new Class({
|
|||
0, 0, 1
|
||||
]);
|
||||
|
||||
/**
|
||||
* Stores a default normal map, which is an object with a `glTexture` property that
|
||||
* maps to a 1x1 texture of the color #7f7fff created in the `boot` method.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#defaultNormalMap
|
||||
* @type {object}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.defaultNormalMap;
|
||||
|
||||
/**
|
||||
* The currently bound normal map texture at texture unit one, if any.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.WebGLRenderer#currentNormalMap;
|
||||
* @type {?WebGLTexture}
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#currentNormalMap;
|
||||
* @type {?Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper}
|
||||
* @since 3.60.0
|
||||
*/
|
||||
this.currentNormalMap;
|
||||
|
@ -165686,10 +165754,6 @@ var LightPipeline = new Class({
|
|||
boot: function ()
|
||||
{
|
||||
WebGLPipeline.prototype.boot.call(this);
|
||||
|
||||
var tempTexture = this.renderer.game.textures.addUint8Array(UUID(), new Uint8Array([ 127, 127, 255, 255 ]), 1, 1);
|
||||
|
||||
this.defaultNormalMap = { glTexture: tempTexture };
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -165800,7 +165864,7 @@ var LightPipeline = new Class({
|
|||
* @ignore
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} [texture] - Texture 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)
|
||||
|
@ -165891,8 +165955,8 @@ var LightPipeline = new Class({
|
|||
* @method Phaser.Renderer.WebGL.WebGLRenderer#isNewNormalMap
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {WebGLTexture} texture - The WebGL diffuse texture.
|
||||
* @param {WebGLTexture} normalMap - The WebGL normal map texture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} texture - The diffuse texture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} normalMap - The normal map texture.
|
||||
*
|
||||
* @return {boolean} Returns `false` if this combination is already set, or `true` if it's a new combination.
|
||||
*/
|
||||
|
@ -165902,7 +165966,7 @@ var LightPipeline = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Returns the normal map WebGLTexture from the given Game Object.
|
||||
* Returns the normal map WebGLTextureWrapper from the given Game Object.
|
||||
* If the Game Object doesn't have one, it returns the default normal map from this pipeline instead.
|
||||
*
|
||||
* @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#getNormalMap
|
||||
|
@ -165910,7 +165974,7 @@ var LightPipeline = new Class({
|
|||
*
|
||||
* @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object to get the normal map from.
|
||||
*
|
||||
* @return {WebGLTexture} The normal map texture.
|
||||
* @return {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} The normal map texture.
|
||||
*/
|
||||
getNormalMap: function (gameObject)
|
||||
{
|
||||
|
@ -165918,7 +165982,7 @@ var LightPipeline = new Class({
|
|||
|
||||
if (!gameObject)
|
||||
{
|
||||
normalMap = this.defaultNormalMap;
|
||||
return this.renderer.normalMap;
|
||||
}
|
||||
else if (gameObject.displayTexture)
|
||||
{
|
||||
|
@ -165942,7 +166006,7 @@ var LightPipeline = new Class({
|
|||
|
||||
if (!normalMap)
|
||||
{
|
||||
normalMap = this.defaultNormalMap;
|
||||
return this.renderer.normalMap;
|
||||
}
|
||||
|
||||
return normalMap.glTexture;
|
||||
|
@ -165973,7 +166037,7 @@ var LightPipeline = new Class({
|
|||
* @since 3.50.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject.
|
||||
* @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} texture - Texture associated with the quad.
|
||||
* @param {number} textureWidth - Real texture width.
|
||||
* @param {number} textureHeight - Real texture height.
|
||||
* @param {number} srcX - X coordinate of the quad.
|
||||
|
@ -173388,7 +173452,7 @@ var WebGLAttribLocationWrapper = new Class({
|
|||
* It should only be passed directly to the WebGL API for drawing.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Wrappers.WebGLAttribLocationWrapper#webGLAttribLocation
|
||||
* @type {WebGLAttribLocation}
|
||||
* @type {GLint}
|
||||
* @default -1
|
||||
* @since 3.80.0
|
||||
*/
|
||||
|
@ -173438,7 +173502,16 @@ var WebGLAttribLocationWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.webGLAttribLocation = this.gl.getAttribLocation(this.program.webGLProgram, this.name);
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
this.webGLAttribLocation = gl.getAttribLocation(this.program.webGLProgram, this.name);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -173563,6 +173636,14 @@ var WebGLBufferWrapper = new Class({
|
|||
}
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var bufferType = this.bufferType;
|
||||
var webGLBuffer = gl.createBuffer();
|
||||
|
||||
|
@ -173581,7 +173662,11 @@ var WebGLBufferWrapper = new Class({
|
|||
*/
|
||||
destroy: function ()
|
||||
{
|
||||
this.gl.deleteBuffer(this.webGLBuffer);
|
||||
var gl = this.gl;
|
||||
if (!gl.isContextLost())
|
||||
{
|
||||
gl.deleteBuffer(this.webGLBuffer);
|
||||
}
|
||||
this.webGLBuffer = null;
|
||||
this.initialDataOrSize = null;
|
||||
this.gl = null;
|
||||
|
@ -173711,6 +173796,14 @@ var WebGLFramebufferWrapper = new Class({
|
|||
createResource: function ()
|
||||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var renderTexture = this.renderTexture;
|
||||
var complete = 0;
|
||||
var framebuffer = gl.createFramebuffer();
|
||||
|
@ -173757,32 +173850,34 @@ var WebGLFramebufferWrapper = new Class({
|
|||
|
||||
var gl = this.gl;
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.webGLFramebuffer);
|
||||
if (!gl.isContextLost())
|
||||
{
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.webGLFramebuffer);
|
||||
|
||||
// Check for a color attachment and remove it
|
||||
var colorAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (colorAttachment !== null)
|
||||
{
|
||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
|
||||
|
||||
gl.deleteTexture(colorAttachment);
|
||||
}
|
||||
|
||||
// Check for a depth-stencil attachment and remove it
|
||||
var depthStencilAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (depthStencilAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(depthStencilAttachment);
|
||||
}
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
|
||||
gl.deleteFramebuffer(this.webGLFramebuffer);
|
||||
}
|
||||
|
||||
this.renderTexture = null;
|
||||
|
||||
// Check for a color attachment and remove it
|
||||
var colorAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (colorAttachment !== null)
|
||||
{
|
||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
|
||||
|
||||
gl.deleteTexture(colorAttachment);
|
||||
}
|
||||
|
||||
// Check for a depth-stencil attachment and remove it
|
||||
var depthStencilAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (depthStencilAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(depthStencilAttachment);
|
||||
}
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
|
||||
gl.deleteFramebuffer(this.webGLFramebuffer);
|
||||
|
||||
this.webGLFramebuffer = null;
|
||||
this.gl = null;
|
||||
}
|
||||
|
@ -173879,6 +173974,13 @@ var WebGLProgramWrapper = new Class({
|
|||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var program = gl.createProgram();
|
||||
|
||||
var vs = gl.createShader(gl.VERTEX_SHADER);
|
||||
|
@ -173930,7 +174032,11 @@ var WebGLProgramWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.gl.deleteProgram(this.webGLProgram);
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
this.gl.deleteProgram(this.webGLProgram);
|
||||
}
|
||||
|
||||
this.webGLProgram = null;
|
||||
this.gl = null;
|
||||
}
|
||||
|
@ -174156,6 +174262,15 @@ var WebGLTextureWrapper = new Class({
|
|||
*/
|
||||
createResource: function ()
|
||||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.pixels instanceof WebGLTextureWrapper)
|
||||
{
|
||||
// Use the source texture directly.
|
||||
|
@ -174163,8 +174278,6 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
var texture = gl.createTexture();
|
||||
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
|
@ -174266,8 +174379,21 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
// Assume that the source might change.
|
||||
this.pixels = source;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.flipY = flipY;
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
|
||||
var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D);
|
||||
|
@ -174279,12 +174405,6 @@ var WebGLTextureWrapper = new Class({
|
|||
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
|
||||
|
||||
// Assume that the source might change.
|
||||
this.pixels = source;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.flipY = flipY;
|
||||
|
||||
// Restore previous texture bind.
|
||||
if (currentTexture)
|
||||
{
|
||||
|
@ -174311,8 +174431,12 @@ var WebGLTextureWrapper = new Class({
|
|||
{
|
||||
// eslint-disable-next-line camelcase
|
||||
this.__SPECTOR_Metadata = value;
|
||||
// eslint-disable-next-line camelcase
|
||||
this.webGLTexture.__SPECTOR_Metadata = value;
|
||||
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
// eslint-disable-next-line camelcase
|
||||
this.webGLTexture.__SPECTOR_Metadata = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -174329,10 +174453,13 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(this.pixels instanceof WebGLTextureWrapper))
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
// Do not delete a texture that belongs to another wrapper.
|
||||
this.gl.deleteTexture(this.webGLTexture);
|
||||
if (!(this.pixels instanceof WebGLTextureWrapper))
|
||||
{
|
||||
// Do not delete a texture that belongs to another wrapper.
|
||||
this.gl.deleteTexture(this.webGLTexture);
|
||||
}
|
||||
}
|
||||
|
||||
this.pixels = null;
|
||||
|
@ -174432,7 +174559,16 @@ var WebGLUniformLocationWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.webGLUniformLocation = this.gl.getUniformLocation(this.program.webGLProgram, this.name);
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
this.webGLUniformLocation = gl.getUniformLocation(this.program.webGLProgram, this.name);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -195894,6 +196030,10 @@ var TextureManager = new Class({
|
|||
this.addBase64('__DEFAULT', config.defaultImage);
|
||||
this.addBase64('__MISSING', config.missingImage);
|
||||
this.addBase64('__WHITE', config.whiteImage);
|
||||
if (this.game.renderer && this.game.renderer.gl)
|
||||
{
|
||||
this.addUint8Array('__NORMAL', new Uint8Array([ 127, 127, 255, 255 ]), 1, 1);
|
||||
}
|
||||
|
||||
this.game.events.once(GameEvents.DESTROY, this.destroy, this);
|
||||
|
||||
|
@ -197058,7 +197198,7 @@ var TextureManager = new Class({
|
|||
|
||||
/**
|
||||
* Returns an array with all of the keys of all Textures in this Texture Manager.
|
||||
* The output array will exclude the `__DEFAULT`, `__MISSING`, and `__WHITE` keys.
|
||||
* The output array will exclude the `__DEFAULT`, `__MISSING`, `__WHITE`, and `__NORMAL` keys.
|
||||
*
|
||||
* @method Phaser.Textures.TextureManager#getTextureKeys
|
||||
* @since 3.0.0
|
||||
|
@ -197071,7 +197211,7 @@ var TextureManager = new Class({
|
|||
|
||||
for (var key in this.list)
|
||||
{
|
||||
if (key !== '__DEFAULT' && key !== '__MISSING' && key !== '__WHITE')
|
||||
if (key !== '__DEFAULT' && key !== '__MISSING' && key !== '__WHITE' && key !== '__NORMAL')
|
||||
{
|
||||
output.push(key);
|
||||
}
|
||||
|
|
2
dist/phaser-arcade-physics.min.js
vendored
2
dist/phaser-arcade-physics.min.js
vendored
File diff suppressed because one or more lines are too long
348
dist/phaser-ie9.js
vendored
348
dist/phaser-ie9.js
vendored
|
@ -15691,7 +15691,7 @@ var CONST = {
|
|||
* @type {string}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
VERSION: '3.80.0-beta.1',
|
||||
VERSION: '3.80.0-beta.2',
|
||||
|
||||
BlendModes: __webpack_require__(95723),
|
||||
|
||||
|
@ -59282,14 +59282,21 @@ var Mesh = new Class({
|
|||
*
|
||||
* @example
|
||||
* mesh.setInteractive();
|
||||
*
|
||||
* @example
|
||||
* mesh.setInteractive({ useHandCursor: true });
|
||||
*
|
||||
* @method Phaser.GameObjects.Mesh#setInteractive
|
||||
* @since 3.60.0
|
||||
*
|
||||
* @param {(Phaser.Types.Input.InputConfiguration)} [config] - An input configuration object but it will ignore hitArea, hitAreaCallback and pixelPerfect with associated alphaTolerance properties.
|
||||
*
|
||||
* @return {this} This GameObject.
|
||||
*/
|
||||
setInteractive: function ()
|
||||
setInteractive: function (config)
|
||||
{
|
||||
if (config === undefined) { config = {}; }
|
||||
|
||||
var hitAreaCallback = function (area, x, y)
|
||||
{
|
||||
var faces = this.faces;
|
||||
|
@ -59308,7 +59315,7 @@ var Mesh = new Class({
|
|||
return false;
|
||||
}.bind(this);
|
||||
|
||||
this.scene.sys.input.enable(this, hitAreaCallback);
|
||||
this.scene.sys.input.enable(this, config, hitAreaCallback);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -72354,6 +72361,7 @@ var SetValue = __webpack_require__(22440);
|
|||
var ShaderRender = __webpack_require__(24252);
|
||||
var TransformMatrix = __webpack_require__(69360);
|
||||
var ArrayEach = __webpack_require__(36337);
|
||||
var RenderEvents = __webpack_require__(81044);
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -72507,6 +72515,28 @@ var Shader = new Class({
|
|||
*/
|
||||
this.vertexBuffer = renderer.createVertexBuffer(this.vertexData.byteLength, this.gl.STREAM_DRAW);
|
||||
|
||||
/**
|
||||
* Internal property: whether the shader needs to be created,
|
||||
* and if so, the key and textures to use for the shader.
|
||||
*
|
||||
* @name Phaser.GameObjects.Shader#_deferSetShader
|
||||
* @type {?{ key: string, textures: string[]|undefined, textureData: any|undefined }}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._deferSetShader = null;
|
||||
|
||||
/**
|
||||
* Internal property: whether the projection matrix needs to be set,
|
||||
* and if so, the data to use for the orthographic projection.
|
||||
*
|
||||
* @name Phaser.GameObjects.Shader#_deferProjOrtho
|
||||
* @type {?{ left: number, right: number, bottom: number, top: number }}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._deferProjOrtho = null;
|
||||
|
||||
/**
|
||||
* The WebGL shader program this shader uses.
|
||||
*
|
||||
|
@ -72692,6 +72722,8 @@ var Shader = new Class({
|
|||
this.setSize(width, height);
|
||||
this.setOrigin(0.5, 0.5);
|
||||
this.setShader(key, textures, textureData);
|
||||
|
||||
this.renderer.on(RenderEvents.RESTORE_WEBGL, this.onContextRestored, this);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -72816,6 +72848,12 @@ var Shader = new Class({
|
|||
*/
|
||||
setShader: function (key, textures, textureData)
|
||||
{
|
||||
if (this.renderer.contextLost)
|
||||
{
|
||||
this._deferSetShader = { key: key, textures: textures, textureData: textureData };
|
||||
return this;
|
||||
}
|
||||
|
||||
if (textures === undefined) { textures = []; }
|
||||
|
||||
if (typeof key === 'string')
|
||||
|
@ -72926,6 +72964,12 @@ var Shader = new Class({
|
|||
*/
|
||||
projOrtho: function (left, right, bottom, top)
|
||||
{
|
||||
if (this.renderer.contextLost)
|
||||
{
|
||||
this._deferProjOrtho = { left: left, right: right, bottom: bottom, top: top };
|
||||
return;
|
||||
}
|
||||
|
||||
var near = -1000;
|
||||
var far = 1000;
|
||||
|
||||
|
@ -73548,6 +73592,34 @@ var Shader = new Class({
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* Run any logic that was deferred during context loss.
|
||||
*
|
||||
* @method Phaser.GameObjects.Shader#onContextRestored
|
||||
* @since 3.80.0
|
||||
*/
|
||||
onContextRestored: function ()
|
||||
{
|
||||
if (this._deferSetShader !== null)
|
||||
{
|
||||
var key = this._deferSetShader.key;
|
||||
var textures = this._deferSetShader.textures;
|
||||
var textureData = this._deferSetShader.textureData;
|
||||
this._deferSetShader = null;
|
||||
this.setShader(key, textures, textureData);
|
||||
}
|
||||
|
||||
if (this._deferProjOrtho !== null)
|
||||
{
|
||||
var left = this._deferProjOrtho.left;
|
||||
var right = this._deferProjOrtho.right;
|
||||
var bottom = this._deferProjOrtho.bottom;
|
||||
var top = this._deferProjOrtho.top;
|
||||
this._deferProjOrtho = null;
|
||||
this.projOrtho(left, right, bottom, top);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Internal destroy handler, called as part of the destroy process.
|
||||
*
|
||||
|
@ -73559,6 +73631,7 @@ var Shader = new Class({
|
|||
{
|
||||
var renderer = this.renderer;
|
||||
|
||||
renderer.off(RenderEvents.RESTORE_WEBGL, this.onContextRestored, this);
|
||||
renderer.deleteProgram(this.program);
|
||||
renderer.deleteBuffer(this.vertexBuffer);
|
||||
|
||||
|
@ -82320,8 +82393,6 @@ var Text = new Class({
|
|||
{
|
||||
this.frame.source.glTexture = this.renderer.canvasToTexture(canvas, this.frame.source.glTexture, true);
|
||||
|
||||
this.frame.glTexture = this.frame.source.glTexture;
|
||||
|
||||
if (false)
|
||||
{}
|
||||
}
|
||||
|
@ -103175,6 +103246,7 @@ var GetFastValue = __webpack_require__(72632);
|
|||
var GEOM_CONST = __webpack_require__(52394);
|
||||
var InputPluginCache = __webpack_require__(63399);
|
||||
var IsPlainObject = __webpack_require__(42911);
|
||||
var HasAny = __webpack_require__(53523);
|
||||
var PluginCache = __webpack_require__(91963);
|
||||
var Rectangle = __webpack_require__(74118);
|
||||
var RectangleContains = __webpack_require__(94287);
|
||||
|
@ -103940,6 +104012,7 @@ var InputPlugin = new Class({
|
|||
if (input)
|
||||
{
|
||||
this.removeDebug(gameObject);
|
||||
this.manager.resetCursor(input);
|
||||
|
||||
input.gameObject = undefined;
|
||||
input.target = undefined;
|
||||
|
@ -103988,20 +104061,12 @@ var InputPlugin = new Class({
|
|||
input.dragState = 0;
|
||||
}
|
||||
|
||||
// Clear from _temp, _drag and _over
|
||||
var temp = this._temp;
|
||||
// Clear from _drag and _over
|
||||
var drag = this._drag;
|
||||
var over = this._over;
|
||||
var manager = this.manager;
|
||||
|
||||
var index = temp.indexOf(gameObject);
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
temp.splice(index, 1);
|
||||
}
|
||||
|
||||
for (var i = 0; i < manager.pointersTotal; i++)
|
||||
for (var i = 0, index; i < manager.pointersTotal; i++)
|
||||
{
|
||||
index = drag[i].indexOf(gameObject);
|
||||
|
||||
|
@ -104015,8 +104080,6 @@ var InputPlugin = new Class({
|
|||
if (index > -1)
|
||||
{
|
||||
over[i].splice(index, 1);
|
||||
|
||||
manager.resetCursor(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105324,26 +105387,31 @@ var InputPlugin = new Class({
|
|||
var customHitArea = true;
|
||||
|
||||
// Config object?
|
||||
if (IsPlainObject(hitArea))
|
||||
if (IsPlainObject(hitArea) && Object.keys(hitArea).length)
|
||||
{
|
||||
var config = hitArea;
|
||||
|
||||
hitArea = GetFastValue(config, 'hitArea', null);
|
||||
hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null);
|
||||
// Check if any supplied Game Object is a Mesh based Game Object
|
||||
if (!HasAny(gameObjects, 'faces'))
|
||||
{
|
||||
hitArea = GetFastValue(config, 'hitArea', null);
|
||||
hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null);
|
||||
|
||||
pixelPerfect = GetFastValue(config, 'pixelPerfect', false);
|
||||
var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1);
|
||||
|
||||
if (pixelPerfect)
|
||||
{
|
||||
hitArea = {};
|
||||
hitAreaCallback = this.makePixelPerfect(alphaTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
draggable = GetFastValue(config, 'draggable', false);
|
||||
dropZone = GetFastValue(config, 'dropZone', false);
|
||||
cursor = GetFastValue(config, 'cursor', false);
|
||||
useHandCursor = GetFastValue(config, 'useHandCursor', false);
|
||||
|
||||
pixelPerfect = GetFastValue(config, 'pixelPerfect', false);
|
||||
var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1);
|
||||
|
||||
if (pixelPerfect)
|
||||
{
|
||||
hitArea = {};
|
||||
hitAreaCallback = this.makePixelPerfect(alphaTolerance);
|
||||
}
|
||||
|
||||
// Still no hitArea or callback?
|
||||
if (!hitArea || !hitAreaCallback)
|
||||
{
|
||||
|
@ -105351,11 +105419,6 @@ var InputPlugin = new Class({
|
|||
customHitArea = false;
|
||||
}
|
||||
}
|
||||
else if (typeof hitArea === 'function' && !hitAreaCallback)
|
||||
{
|
||||
hitAreaCallback = hitArea;
|
||||
hitArea = {};
|
||||
}
|
||||
|
||||
for (var i = 0; i < gameObjects.length; i++)
|
||||
{
|
||||
|
@ -146236,6 +146299,9 @@ var StaticBody = new Class({
|
|||
|
||||
gameObject.getTopLeft(this.position);
|
||||
|
||||
this.position.x += this.offset.x;
|
||||
this.position.y += this.offset.y;
|
||||
|
||||
this.updateCenter();
|
||||
|
||||
this.world.staticTree.insert(this);
|
||||
|
@ -179122,6 +179188,18 @@ var WebGLRenderer = new Class({
|
|||
*/
|
||||
this.blankTexture = null;
|
||||
|
||||
/**
|
||||
* A blank 1x1 #7f7fff texture, a flat normal map,
|
||||
* as used by the Graphics system where needed.
|
||||
* This is set in the `boot` method.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.WebGLRenderer#normalTexture
|
||||
* @type {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper}
|
||||
* @readonly
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this.normalTexture = null;
|
||||
|
||||
/**
|
||||
* A pure white 4x4 texture, as used by the Graphics system where needed.
|
||||
* This is set in the `boot` method.
|
||||
|
@ -179477,7 +179555,7 @@ var WebGLRenderer = new Class({
|
|||
_this.pipelines.restoreContext();
|
||||
|
||||
// Apply resize.
|
||||
_this.resize(_this.width, _this.height);
|
||||
_this.resize(_this.game.scale.baseSize.width, _this.game.scale.baseSize.height);
|
||||
|
||||
// Restore GL extensions.
|
||||
setupExtensions();
|
||||
|
@ -179630,6 +179708,7 @@ var WebGLRenderer = new Class({
|
|||
// Set-up default textures, fbo and scissor
|
||||
|
||||
this.blankTexture = game.textures.getFrame('__DEFAULT').glTexture;
|
||||
this.normalTexture = game.textures.getFrame('__NORMAL').glTexture;
|
||||
this.whiteTexture = game.textures.getFrame('__WHITE').glTexture;
|
||||
|
||||
var gl = this.gl;
|
||||
|
@ -184033,7 +184112,6 @@ var GetFastValue = __webpack_require__(72632);
|
|||
var LightShaderSourceFS = __webpack_require__(65045);
|
||||
var MultiPipeline = __webpack_require__(77310);
|
||||
var TransformMatrix = __webpack_require__(69360);
|
||||
var UUID = __webpack_require__(76583);
|
||||
var Vec2 = __webpack_require__(93736);
|
||||
var WebGLPipeline = __webpack_require__(44775);
|
||||
|
||||
|
@ -184109,21 +184187,11 @@ var LightPipeline = new Class({
|
|||
0, 0, 1
|
||||
]);
|
||||
|
||||
/**
|
||||
* Stores a default normal map, which is an object with a `glTexture` property that
|
||||
* maps to a 1x1 texture of the color #7f7fff created in the `boot` method.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#defaultNormalMap
|
||||
* @type {object}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.defaultNormalMap;
|
||||
|
||||
/**
|
||||
* The currently bound normal map texture at texture unit one, if any.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.WebGLRenderer#currentNormalMap;
|
||||
* @type {?WebGLTexture}
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#currentNormalMap;
|
||||
* @type {?Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper}
|
||||
* @since 3.60.0
|
||||
*/
|
||||
this.currentNormalMap;
|
||||
|
@ -184181,10 +184249,6 @@ var LightPipeline = new Class({
|
|||
boot: function ()
|
||||
{
|
||||
WebGLPipeline.prototype.boot.call(this);
|
||||
|
||||
var tempTexture = this.renderer.game.textures.addUint8Array(UUID(), new Uint8Array([ 127, 127, 255, 255 ]), 1, 1);
|
||||
|
||||
this.defaultNormalMap = { glTexture: tempTexture };
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -184295,7 +184359,7 @@ var LightPipeline = new Class({
|
|||
* @ignore
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} [texture] - Texture 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)
|
||||
|
@ -184386,8 +184450,8 @@ var LightPipeline = new Class({
|
|||
* @method Phaser.Renderer.WebGL.WebGLRenderer#isNewNormalMap
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {WebGLTexture} texture - The WebGL diffuse texture.
|
||||
* @param {WebGLTexture} normalMap - The WebGL normal map texture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} texture - The diffuse texture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} normalMap - The normal map texture.
|
||||
*
|
||||
* @return {boolean} Returns `false` if this combination is already set, or `true` if it's a new combination.
|
||||
*/
|
||||
|
@ -184397,7 +184461,7 @@ var LightPipeline = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Returns the normal map WebGLTexture from the given Game Object.
|
||||
* Returns the normal map WebGLTextureWrapper from the given Game Object.
|
||||
* If the Game Object doesn't have one, it returns the default normal map from this pipeline instead.
|
||||
*
|
||||
* @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#getNormalMap
|
||||
|
@ -184405,7 +184469,7 @@ var LightPipeline = new Class({
|
|||
*
|
||||
* @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object to get the normal map from.
|
||||
*
|
||||
* @return {WebGLTexture} The normal map texture.
|
||||
* @return {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} The normal map texture.
|
||||
*/
|
||||
getNormalMap: function (gameObject)
|
||||
{
|
||||
|
@ -184413,7 +184477,7 @@ var LightPipeline = new Class({
|
|||
|
||||
if (!gameObject)
|
||||
{
|
||||
normalMap = this.defaultNormalMap;
|
||||
return this.renderer.normalMap;
|
||||
}
|
||||
else if (gameObject.displayTexture)
|
||||
{
|
||||
|
@ -184437,7 +184501,7 @@ var LightPipeline = new Class({
|
|||
|
||||
if (!normalMap)
|
||||
{
|
||||
normalMap = this.defaultNormalMap;
|
||||
return this.renderer.normalMap;
|
||||
}
|
||||
|
||||
return normalMap.glTexture;
|
||||
|
@ -184468,7 +184532,7 @@ var LightPipeline = new Class({
|
|||
* @since 3.50.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject.
|
||||
* @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} texture - Texture associated with the quad.
|
||||
* @param {number} textureWidth - Real texture width.
|
||||
* @param {number} textureHeight - Real texture height.
|
||||
* @param {number} srcX - X coordinate of the quad.
|
||||
|
@ -191883,7 +191947,7 @@ var WebGLAttribLocationWrapper = new Class({
|
|||
* It should only be passed directly to the WebGL API for drawing.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Wrappers.WebGLAttribLocationWrapper#webGLAttribLocation
|
||||
* @type {WebGLAttribLocation}
|
||||
* @type {GLint}
|
||||
* @default -1
|
||||
* @since 3.80.0
|
||||
*/
|
||||
|
@ -191933,7 +191997,16 @@ var WebGLAttribLocationWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.webGLAttribLocation = this.gl.getAttribLocation(this.program.webGLProgram, this.name);
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
this.webGLAttribLocation = gl.getAttribLocation(this.program.webGLProgram, this.name);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -192058,6 +192131,14 @@ var WebGLBufferWrapper = new Class({
|
|||
}
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var bufferType = this.bufferType;
|
||||
var webGLBuffer = gl.createBuffer();
|
||||
|
||||
|
@ -192076,7 +192157,11 @@ var WebGLBufferWrapper = new Class({
|
|||
*/
|
||||
destroy: function ()
|
||||
{
|
||||
this.gl.deleteBuffer(this.webGLBuffer);
|
||||
var gl = this.gl;
|
||||
if (!gl.isContextLost())
|
||||
{
|
||||
gl.deleteBuffer(this.webGLBuffer);
|
||||
}
|
||||
this.webGLBuffer = null;
|
||||
this.initialDataOrSize = null;
|
||||
this.gl = null;
|
||||
|
@ -192206,6 +192291,14 @@ var WebGLFramebufferWrapper = new Class({
|
|||
createResource: function ()
|
||||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var renderTexture = this.renderTexture;
|
||||
var complete = 0;
|
||||
var framebuffer = gl.createFramebuffer();
|
||||
|
@ -192252,32 +192345,34 @@ var WebGLFramebufferWrapper = new Class({
|
|||
|
||||
var gl = this.gl;
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.webGLFramebuffer);
|
||||
if (!gl.isContextLost())
|
||||
{
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.webGLFramebuffer);
|
||||
|
||||
// Check for a color attachment and remove it
|
||||
var colorAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (colorAttachment !== null)
|
||||
{
|
||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
|
||||
|
||||
gl.deleteTexture(colorAttachment);
|
||||
}
|
||||
|
||||
// Check for a depth-stencil attachment and remove it
|
||||
var depthStencilAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (depthStencilAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(depthStencilAttachment);
|
||||
}
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
|
||||
gl.deleteFramebuffer(this.webGLFramebuffer);
|
||||
}
|
||||
|
||||
this.renderTexture = null;
|
||||
|
||||
// Check for a color attachment and remove it
|
||||
var colorAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (colorAttachment !== null)
|
||||
{
|
||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
|
||||
|
||||
gl.deleteTexture(colorAttachment);
|
||||
}
|
||||
|
||||
// Check for a depth-stencil attachment and remove it
|
||||
var depthStencilAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (depthStencilAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(depthStencilAttachment);
|
||||
}
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
|
||||
gl.deleteFramebuffer(this.webGLFramebuffer);
|
||||
|
||||
this.webGLFramebuffer = null;
|
||||
this.gl = null;
|
||||
}
|
||||
|
@ -192374,6 +192469,13 @@ var WebGLProgramWrapper = new Class({
|
|||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var program = gl.createProgram();
|
||||
|
||||
var vs = gl.createShader(gl.VERTEX_SHADER);
|
||||
|
@ -192425,7 +192527,11 @@ var WebGLProgramWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.gl.deleteProgram(this.webGLProgram);
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
this.gl.deleteProgram(this.webGLProgram);
|
||||
}
|
||||
|
||||
this.webGLProgram = null;
|
||||
this.gl = null;
|
||||
}
|
||||
|
@ -192651,6 +192757,15 @@ var WebGLTextureWrapper = new Class({
|
|||
*/
|
||||
createResource: function ()
|
||||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.pixels instanceof WebGLTextureWrapper)
|
||||
{
|
||||
// Use the source texture directly.
|
||||
|
@ -192658,8 +192773,6 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
var texture = gl.createTexture();
|
||||
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
|
@ -192761,8 +192874,21 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
// Assume that the source might change.
|
||||
this.pixels = source;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.flipY = flipY;
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
|
||||
var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D);
|
||||
|
@ -192774,12 +192900,6 @@ var WebGLTextureWrapper = new Class({
|
|||
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
|
||||
|
||||
// Assume that the source might change.
|
||||
this.pixels = source;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.flipY = flipY;
|
||||
|
||||
// Restore previous texture bind.
|
||||
if (currentTexture)
|
||||
{
|
||||
|
@ -192806,8 +192926,12 @@ var WebGLTextureWrapper = new Class({
|
|||
{
|
||||
// eslint-disable-next-line camelcase
|
||||
this.__SPECTOR_Metadata = value;
|
||||
// eslint-disable-next-line camelcase
|
||||
this.webGLTexture.__SPECTOR_Metadata = value;
|
||||
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
// eslint-disable-next-line camelcase
|
||||
this.webGLTexture.__SPECTOR_Metadata = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -192824,10 +192948,13 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(this.pixels instanceof WebGLTextureWrapper))
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
// Do not delete a texture that belongs to another wrapper.
|
||||
this.gl.deleteTexture(this.webGLTexture);
|
||||
if (!(this.pixels instanceof WebGLTextureWrapper))
|
||||
{
|
||||
// Do not delete a texture that belongs to another wrapper.
|
||||
this.gl.deleteTexture(this.webGLTexture);
|
||||
}
|
||||
}
|
||||
|
||||
this.pixels = null;
|
||||
|
@ -192927,7 +193054,16 @@ var WebGLUniformLocationWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.webGLUniformLocation = this.gl.getUniformLocation(this.program.webGLProgram, this.name);
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
this.webGLUniformLocation = gl.getUniformLocation(this.program.webGLProgram, this.name);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -214389,6 +214525,10 @@ var TextureManager = new Class({
|
|||
this.addBase64('__DEFAULT', config.defaultImage);
|
||||
this.addBase64('__MISSING', config.missingImage);
|
||||
this.addBase64('__WHITE', config.whiteImage);
|
||||
if (this.game.renderer && this.game.renderer.gl)
|
||||
{
|
||||
this.addUint8Array('__NORMAL', new Uint8Array([ 127, 127, 255, 255 ]), 1, 1);
|
||||
}
|
||||
|
||||
this.game.events.once(GameEvents.DESTROY, this.destroy, this);
|
||||
|
||||
|
@ -215553,7 +215693,7 @@ var TextureManager = new Class({
|
|||
|
||||
/**
|
||||
* Returns an array with all of the keys of all Textures in this Texture Manager.
|
||||
* The output array will exclude the `__DEFAULT`, `__MISSING`, and `__WHITE` keys.
|
||||
* The output array will exclude the `__DEFAULT`, `__MISSING`, `__WHITE`, and `__NORMAL` keys.
|
||||
*
|
||||
* @method Phaser.Textures.TextureManager#getTextureKeys
|
||||
* @since 3.0.0
|
||||
|
@ -215566,7 +215706,7 @@ var TextureManager = new Class({
|
|||
|
||||
for (var key in this.list)
|
||||
{
|
||||
if (key !== '__DEFAULT' && key !== '__MISSING' && key !== '__WHITE')
|
||||
if (key !== '__DEFAULT' && key !== '__MISSING' && key !== '__WHITE' && key !== '__NORMAL')
|
||||
{
|
||||
output.push(key);
|
||||
}
|
||||
|
|
2
dist/phaser-ie9.min.js
vendored
2
dist/phaser-ie9.min.js
vendored
File diff suppressed because one or more lines are too long
436
dist/phaser.esm.js
vendored
436
dist/phaser.esm.js
vendored
|
@ -15679,7 +15679,7 @@ var CONST = {
|
|||
* @type {string}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
VERSION: '3.80.0-beta.1',
|
||||
VERSION: '3.80.0-beta.2',
|
||||
|
||||
BlendModes: __webpack_require__(95723),
|
||||
|
||||
|
@ -59270,14 +59270,21 @@ var Mesh = new Class({
|
|||
*
|
||||
* @example
|
||||
* mesh.setInteractive();
|
||||
*
|
||||
* @example
|
||||
* mesh.setInteractive({ useHandCursor: true });
|
||||
*
|
||||
* @method Phaser.GameObjects.Mesh#setInteractive
|
||||
* @since 3.60.0
|
||||
*
|
||||
* @param {(Phaser.Types.Input.InputConfiguration)} [config] - An input configuration object but it will ignore hitArea, hitAreaCallback and pixelPerfect with associated alphaTolerance properties.
|
||||
*
|
||||
* @return {this} This GameObject.
|
||||
*/
|
||||
setInteractive: function ()
|
||||
setInteractive: function (config)
|
||||
{
|
||||
if (config === undefined) { config = {}; }
|
||||
|
||||
var hitAreaCallback = function (area, x, y)
|
||||
{
|
||||
var faces = this.faces;
|
||||
|
@ -59296,7 +59303,7 @@ var Mesh = new Class({
|
|||
return false;
|
||||
}.bind(this);
|
||||
|
||||
this.scene.sys.input.enable(this, hitAreaCallback);
|
||||
this.scene.sys.input.enable(this, config, hitAreaCallback);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -72342,6 +72349,7 @@ var SetValue = __webpack_require__(22440);
|
|||
var ShaderRender = __webpack_require__(24252);
|
||||
var TransformMatrix = __webpack_require__(69360);
|
||||
var ArrayEach = __webpack_require__(36337);
|
||||
var RenderEvents = __webpack_require__(81044);
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -72495,6 +72503,28 @@ var Shader = new Class({
|
|||
*/
|
||||
this.vertexBuffer = renderer.createVertexBuffer(this.vertexData.byteLength, this.gl.STREAM_DRAW);
|
||||
|
||||
/**
|
||||
* Internal property: whether the shader needs to be created,
|
||||
* and if so, the key and textures to use for the shader.
|
||||
*
|
||||
* @name Phaser.GameObjects.Shader#_deferSetShader
|
||||
* @type {?{ key: string, textures: string[]|undefined, textureData: any|undefined }}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._deferSetShader = null;
|
||||
|
||||
/**
|
||||
* Internal property: whether the projection matrix needs to be set,
|
||||
* and if so, the data to use for the orthographic projection.
|
||||
*
|
||||
* @name Phaser.GameObjects.Shader#_deferProjOrtho
|
||||
* @type {?{ left: number, right: number, bottom: number, top: number }}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._deferProjOrtho = null;
|
||||
|
||||
/**
|
||||
* The WebGL shader program this shader uses.
|
||||
*
|
||||
|
@ -72680,6 +72710,8 @@ var Shader = new Class({
|
|||
this.setSize(width, height);
|
||||
this.setOrigin(0.5, 0.5);
|
||||
this.setShader(key, textures, textureData);
|
||||
|
||||
this.renderer.on(RenderEvents.RESTORE_WEBGL, this.onContextRestored, this);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -72804,6 +72836,12 @@ var Shader = new Class({
|
|||
*/
|
||||
setShader: function (key, textures, textureData)
|
||||
{
|
||||
if (this.renderer.contextLost)
|
||||
{
|
||||
this._deferSetShader = { key: key, textures: textures, textureData: textureData };
|
||||
return this;
|
||||
}
|
||||
|
||||
if (textures === undefined) { textures = []; }
|
||||
|
||||
if (typeof key === 'string')
|
||||
|
@ -72914,6 +72952,12 @@ var Shader = new Class({
|
|||
*/
|
||||
projOrtho: function (left, right, bottom, top)
|
||||
{
|
||||
if (this.renderer.contextLost)
|
||||
{
|
||||
this._deferProjOrtho = { left: left, right: right, bottom: bottom, top: top };
|
||||
return;
|
||||
}
|
||||
|
||||
var near = -1000;
|
||||
var far = 1000;
|
||||
|
||||
|
@ -73536,6 +73580,34 @@ var Shader = new Class({
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* Run any logic that was deferred during context loss.
|
||||
*
|
||||
* @method Phaser.GameObjects.Shader#onContextRestored
|
||||
* @since 3.80.0
|
||||
*/
|
||||
onContextRestored: function ()
|
||||
{
|
||||
if (this._deferSetShader !== null)
|
||||
{
|
||||
var key = this._deferSetShader.key;
|
||||
var textures = this._deferSetShader.textures;
|
||||
var textureData = this._deferSetShader.textureData;
|
||||
this._deferSetShader = null;
|
||||
this.setShader(key, textures, textureData);
|
||||
}
|
||||
|
||||
if (this._deferProjOrtho !== null)
|
||||
{
|
||||
var left = this._deferProjOrtho.left;
|
||||
var right = this._deferProjOrtho.right;
|
||||
var bottom = this._deferProjOrtho.bottom;
|
||||
var top = this._deferProjOrtho.top;
|
||||
this._deferProjOrtho = null;
|
||||
this.projOrtho(left, right, bottom, top);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Internal destroy handler, called as part of the destroy process.
|
||||
*
|
||||
|
@ -73547,6 +73619,7 @@ var Shader = new Class({
|
|||
{
|
||||
var renderer = this.renderer;
|
||||
|
||||
renderer.off(RenderEvents.RESTORE_WEBGL, this.onContextRestored, this);
|
||||
renderer.deleteProgram(this.program);
|
||||
renderer.deleteBuffer(this.vertexBuffer);
|
||||
|
||||
|
@ -82308,8 +82381,6 @@ var Text = new Class({
|
|||
{
|
||||
this.frame.source.glTexture = this.renderer.canvasToTexture(canvas, this.frame.source.glTexture, true);
|
||||
|
||||
this.frame.glTexture = this.frame.source.glTexture;
|
||||
|
||||
if (false)
|
||||
{}
|
||||
}
|
||||
|
@ -103162,6 +103233,7 @@ var GetFastValue = __webpack_require__(72632);
|
|||
var GEOM_CONST = __webpack_require__(52394);
|
||||
var InputPluginCache = __webpack_require__(63399);
|
||||
var IsPlainObject = __webpack_require__(42911);
|
||||
var HasAny = __webpack_require__(53523);
|
||||
var PluginCache = __webpack_require__(91963);
|
||||
var Rectangle = __webpack_require__(74118);
|
||||
var RectangleContains = __webpack_require__(94287);
|
||||
|
@ -103927,6 +103999,7 @@ var InputPlugin = new Class({
|
|||
if (input)
|
||||
{
|
||||
this.removeDebug(gameObject);
|
||||
this.manager.resetCursor(input);
|
||||
|
||||
input.gameObject = undefined;
|
||||
input.target = undefined;
|
||||
|
@ -103975,20 +104048,12 @@ var InputPlugin = new Class({
|
|||
input.dragState = 0;
|
||||
}
|
||||
|
||||
// Clear from _temp, _drag and _over
|
||||
var temp = this._temp;
|
||||
// Clear from _drag and _over
|
||||
var drag = this._drag;
|
||||
var over = this._over;
|
||||
var manager = this.manager;
|
||||
|
||||
var index = temp.indexOf(gameObject);
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
temp.splice(index, 1);
|
||||
}
|
||||
|
||||
for (var i = 0; i < manager.pointersTotal; i++)
|
||||
for (var i = 0, index; i < manager.pointersTotal; i++)
|
||||
{
|
||||
index = drag[i].indexOf(gameObject);
|
||||
|
||||
|
@ -104002,8 +104067,6 @@ var InputPlugin = new Class({
|
|||
if (index > -1)
|
||||
{
|
||||
over[i].splice(index, 1);
|
||||
|
||||
manager.resetCursor(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105311,26 +105374,31 @@ var InputPlugin = new Class({
|
|||
var customHitArea = true;
|
||||
|
||||
// Config object?
|
||||
if (IsPlainObject(hitArea))
|
||||
if (IsPlainObject(hitArea) && Object.keys(hitArea).length)
|
||||
{
|
||||
var config = hitArea;
|
||||
|
||||
hitArea = GetFastValue(config, 'hitArea', null);
|
||||
hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null);
|
||||
// Check if any supplied Game Object is a Mesh based Game Object
|
||||
if (!HasAny(gameObjects, 'faces'))
|
||||
{
|
||||
hitArea = GetFastValue(config, 'hitArea', null);
|
||||
hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null);
|
||||
|
||||
pixelPerfect = GetFastValue(config, 'pixelPerfect', false);
|
||||
var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1);
|
||||
|
||||
if (pixelPerfect)
|
||||
{
|
||||
hitArea = {};
|
||||
hitAreaCallback = this.makePixelPerfect(alphaTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
draggable = GetFastValue(config, 'draggable', false);
|
||||
dropZone = GetFastValue(config, 'dropZone', false);
|
||||
cursor = GetFastValue(config, 'cursor', false);
|
||||
useHandCursor = GetFastValue(config, 'useHandCursor', false);
|
||||
|
||||
pixelPerfect = GetFastValue(config, 'pixelPerfect', false);
|
||||
var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1);
|
||||
|
||||
if (pixelPerfect)
|
||||
{
|
||||
hitArea = {};
|
||||
hitAreaCallback = this.makePixelPerfect(alphaTolerance);
|
||||
}
|
||||
|
||||
// Still no hitArea or callback?
|
||||
if (!hitArea || !hitAreaCallback)
|
||||
{
|
||||
|
@ -105338,11 +105406,6 @@ var InputPlugin = new Class({
|
|||
customHitArea = false;
|
||||
}
|
||||
}
|
||||
else if (typeof hitArea === 'function' && !hitAreaCallback)
|
||||
{
|
||||
hitAreaCallback = hitArea;
|
||||
hitArea = {};
|
||||
}
|
||||
|
||||
for (var i = 0; i < gameObjects.length; i++)
|
||||
{
|
||||
|
@ -146129,6 +146192,9 @@ var StaticBody = new Class({
|
|||
|
||||
gameObject.getTopLeft(this.position);
|
||||
|
||||
this.position.x += this.offset.x;
|
||||
this.position.y += this.offset.y;
|
||||
|
||||
this.updateCenter();
|
||||
|
||||
this.world.staticTree.insert(this);
|
||||
|
@ -178572,6 +178638,18 @@ var WebGLRenderer = new Class({
|
|||
*/
|
||||
this.blankTexture = null;
|
||||
|
||||
/**
|
||||
* A blank 1x1 #7f7fff texture, a flat normal map,
|
||||
* as used by the Graphics system where needed.
|
||||
* This is set in the `boot` method.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.WebGLRenderer#normalTexture
|
||||
* @type {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper}
|
||||
* @readonly
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this.normalTexture = null;
|
||||
|
||||
/**
|
||||
* A pure white 4x4 texture, as used by the Graphics system where needed.
|
||||
* This is set in the `boot` method.
|
||||
|
@ -178927,7 +179005,7 @@ var WebGLRenderer = new Class({
|
|||
_this.pipelines.restoreContext();
|
||||
|
||||
// Apply resize.
|
||||
_this.resize(_this.width, _this.height);
|
||||
_this.resize(_this.game.scale.baseSize.width, _this.game.scale.baseSize.height);
|
||||
|
||||
// Restore GL extensions.
|
||||
setupExtensions();
|
||||
|
@ -179080,6 +179158,7 @@ var WebGLRenderer = new Class({
|
|||
// Set-up default textures, fbo and scissor
|
||||
|
||||
this.blankTexture = game.textures.getFrame('__DEFAULT').glTexture;
|
||||
this.normalTexture = game.textures.getFrame('__NORMAL').glTexture;
|
||||
this.whiteTexture = game.textures.getFrame('__WHITE').glTexture;
|
||||
|
||||
var gl = this.gl;
|
||||
|
@ -183483,7 +183562,6 @@ var GetFastValue = __webpack_require__(72632);
|
|||
var LightShaderSourceFS = __webpack_require__(65045);
|
||||
var MultiPipeline = __webpack_require__(77310);
|
||||
var TransformMatrix = __webpack_require__(69360);
|
||||
var UUID = __webpack_require__(76583);
|
||||
var Vec2 = __webpack_require__(93736);
|
||||
var WebGLPipeline = __webpack_require__(44775);
|
||||
|
||||
|
@ -183559,21 +183637,11 @@ var LightPipeline = new Class({
|
|||
0, 0, 1
|
||||
]);
|
||||
|
||||
/**
|
||||
* Stores a default normal map, which is an object with a `glTexture` property that
|
||||
* maps to a 1x1 texture of the color #7f7fff created in the `boot` method.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#defaultNormalMap
|
||||
* @type {object}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.defaultNormalMap;
|
||||
|
||||
/**
|
||||
* The currently bound normal map texture at texture unit one, if any.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.WebGLRenderer#currentNormalMap;
|
||||
* @type {?WebGLTexture}
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#currentNormalMap;
|
||||
* @type {?Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper}
|
||||
* @since 3.60.0
|
||||
*/
|
||||
this.currentNormalMap;
|
||||
|
@ -183631,10 +183699,6 @@ var LightPipeline = new Class({
|
|||
boot: function ()
|
||||
{
|
||||
WebGLPipeline.prototype.boot.call(this);
|
||||
|
||||
var tempTexture = this.renderer.game.textures.addUint8Array(UUID(), new Uint8Array([ 127, 127, 255, 255 ]), 1, 1);
|
||||
|
||||
this.defaultNormalMap = { glTexture: tempTexture };
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -183745,7 +183809,7 @@ var LightPipeline = new Class({
|
|||
* @ignore
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} [texture] - Texture 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)
|
||||
|
@ -183836,8 +183900,8 @@ var LightPipeline = new Class({
|
|||
* @method Phaser.Renderer.WebGL.WebGLRenderer#isNewNormalMap
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {WebGLTexture} texture - The WebGL diffuse texture.
|
||||
* @param {WebGLTexture} normalMap - The WebGL normal map texture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} texture - The diffuse texture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} normalMap - The normal map texture.
|
||||
*
|
||||
* @return {boolean} Returns `false` if this combination is already set, or `true` if it's a new combination.
|
||||
*/
|
||||
|
@ -183847,7 +183911,7 @@ var LightPipeline = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Returns the normal map WebGLTexture from the given Game Object.
|
||||
* Returns the normal map WebGLTextureWrapper from the given Game Object.
|
||||
* If the Game Object doesn't have one, it returns the default normal map from this pipeline instead.
|
||||
*
|
||||
* @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#getNormalMap
|
||||
|
@ -183855,7 +183919,7 @@ var LightPipeline = new Class({
|
|||
*
|
||||
* @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object to get the normal map from.
|
||||
*
|
||||
* @return {WebGLTexture} The normal map texture.
|
||||
* @return {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} The normal map texture.
|
||||
*/
|
||||
getNormalMap: function (gameObject)
|
||||
{
|
||||
|
@ -183863,7 +183927,7 @@ var LightPipeline = new Class({
|
|||
|
||||
if (!gameObject)
|
||||
{
|
||||
normalMap = this.defaultNormalMap;
|
||||
return this.renderer.normalMap;
|
||||
}
|
||||
else if (gameObject.displayTexture)
|
||||
{
|
||||
|
@ -183887,7 +183951,7 @@ var LightPipeline = new Class({
|
|||
|
||||
if (!normalMap)
|
||||
{
|
||||
normalMap = this.defaultNormalMap;
|
||||
return this.renderer.normalMap;
|
||||
}
|
||||
|
||||
return normalMap.glTexture;
|
||||
|
@ -183918,7 +183982,7 @@ var LightPipeline = new Class({
|
|||
* @since 3.50.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject.
|
||||
* @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} texture - Texture associated with the quad.
|
||||
* @param {number} textureWidth - Real texture width.
|
||||
* @param {number} textureHeight - Real texture height.
|
||||
* @param {number} srcX - X coordinate of the quad.
|
||||
|
@ -191333,7 +191397,7 @@ var WebGLAttribLocationWrapper = new Class({
|
|||
* It should only be passed directly to the WebGL API for drawing.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Wrappers.WebGLAttribLocationWrapper#webGLAttribLocation
|
||||
* @type {WebGLAttribLocation}
|
||||
* @type {GLint}
|
||||
* @default -1
|
||||
* @since 3.80.0
|
||||
*/
|
||||
|
@ -191383,7 +191447,16 @@ var WebGLAttribLocationWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.webGLAttribLocation = this.gl.getAttribLocation(this.program.webGLProgram, this.name);
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
this.webGLAttribLocation = gl.getAttribLocation(this.program.webGLProgram, this.name);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -191508,6 +191581,14 @@ var WebGLBufferWrapper = new Class({
|
|||
}
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var bufferType = this.bufferType;
|
||||
var webGLBuffer = gl.createBuffer();
|
||||
|
||||
|
@ -191526,7 +191607,11 @@ var WebGLBufferWrapper = new Class({
|
|||
*/
|
||||
destroy: function ()
|
||||
{
|
||||
this.gl.deleteBuffer(this.webGLBuffer);
|
||||
var gl = this.gl;
|
||||
if (!gl.isContextLost())
|
||||
{
|
||||
gl.deleteBuffer(this.webGLBuffer);
|
||||
}
|
||||
this.webGLBuffer = null;
|
||||
this.initialDataOrSize = null;
|
||||
this.gl = null;
|
||||
|
@ -191656,6 +191741,14 @@ var WebGLFramebufferWrapper = new Class({
|
|||
createResource: function ()
|
||||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var renderTexture = this.renderTexture;
|
||||
var complete = 0;
|
||||
var framebuffer = gl.createFramebuffer();
|
||||
|
@ -191702,32 +191795,34 @@ var WebGLFramebufferWrapper = new Class({
|
|||
|
||||
var gl = this.gl;
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.webGLFramebuffer);
|
||||
if (!gl.isContextLost())
|
||||
{
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.webGLFramebuffer);
|
||||
|
||||
// Check for a color attachment and remove it
|
||||
var colorAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (colorAttachment !== null)
|
||||
{
|
||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
|
||||
|
||||
gl.deleteTexture(colorAttachment);
|
||||
}
|
||||
|
||||
// Check for a depth-stencil attachment and remove it
|
||||
var depthStencilAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (depthStencilAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(depthStencilAttachment);
|
||||
}
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
|
||||
gl.deleteFramebuffer(this.webGLFramebuffer);
|
||||
}
|
||||
|
||||
this.renderTexture = null;
|
||||
|
||||
// Check for a color attachment and remove it
|
||||
var colorAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (colorAttachment !== null)
|
||||
{
|
||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
|
||||
|
||||
gl.deleteTexture(colorAttachment);
|
||||
}
|
||||
|
||||
// Check for a depth-stencil attachment and remove it
|
||||
var depthStencilAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (depthStencilAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(depthStencilAttachment);
|
||||
}
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
|
||||
gl.deleteFramebuffer(this.webGLFramebuffer);
|
||||
|
||||
this.webGLFramebuffer = null;
|
||||
this.gl = null;
|
||||
}
|
||||
|
@ -191824,6 +191919,13 @@ var WebGLProgramWrapper = new Class({
|
|||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var program = gl.createProgram();
|
||||
|
||||
var vs = gl.createShader(gl.VERTEX_SHADER);
|
||||
|
@ -191875,7 +191977,11 @@ var WebGLProgramWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.gl.deleteProgram(this.webGLProgram);
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
this.gl.deleteProgram(this.webGLProgram);
|
||||
}
|
||||
|
||||
this.webGLProgram = null;
|
||||
this.gl = null;
|
||||
}
|
||||
|
@ -192101,6 +192207,15 @@ var WebGLTextureWrapper = new Class({
|
|||
*/
|
||||
createResource: function ()
|
||||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.pixels instanceof WebGLTextureWrapper)
|
||||
{
|
||||
// Use the source texture directly.
|
||||
|
@ -192108,8 +192223,6 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
var texture = gl.createTexture();
|
||||
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
|
@ -192211,8 +192324,21 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
// Assume that the source might change.
|
||||
this.pixels = source;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.flipY = flipY;
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
|
||||
var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D);
|
||||
|
@ -192224,12 +192350,6 @@ var WebGLTextureWrapper = new Class({
|
|||
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
|
||||
|
||||
// Assume that the source might change.
|
||||
this.pixels = source;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.flipY = flipY;
|
||||
|
||||
// Restore previous texture bind.
|
||||
if (currentTexture)
|
||||
{
|
||||
|
@ -192256,8 +192376,12 @@ var WebGLTextureWrapper = new Class({
|
|||
{
|
||||
// eslint-disable-next-line camelcase
|
||||
this.__SPECTOR_Metadata = value;
|
||||
// eslint-disable-next-line camelcase
|
||||
this.webGLTexture.__SPECTOR_Metadata = value;
|
||||
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
// eslint-disable-next-line camelcase
|
||||
this.webGLTexture.__SPECTOR_Metadata = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -192274,10 +192398,13 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(this.pixels instanceof WebGLTextureWrapper))
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
// Do not delete a texture that belongs to another wrapper.
|
||||
this.gl.deleteTexture(this.webGLTexture);
|
||||
if (!(this.pixels instanceof WebGLTextureWrapper))
|
||||
{
|
||||
// Do not delete a texture that belongs to another wrapper.
|
||||
this.gl.deleteTexture(this.webGLTexture);
|
||||
}
|
||||
}
|
||||
|
||||
this.pixels = null;
|
||||
|
@ -192377,7 +192504,16 @@ var WebGLUniformLocationWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.webGLUniformLocation = this.gl.getUniformLocation(this.program.webGLProgram, this.name);
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
this.webGLUniformLocation = gl.getUniformLocation(this.program.webGLProgram, this.name);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -213839,6 +213975,10 @@ var TextureManager = new Class({
|
|||
this.addBase64('__DEFAULT', config.defaultImage);
|
||||
this.addBase64('__MISSING', config.missingImage);
|
||||
this.addBase64('__WHITE', config.whiteImage);
|
||||
if (this.game.renderer && this.game.renderer.gl)
|
||||
{
|
||||
this.addUint8Array('__NORMAL', new Uint8Array([ 127, 127, 255, 255 ]), 1, 1);
|
||||
}
|
||||
|
||||
this.game.events.once(GameEvents.DESTROY, this.destroy, this);
|
||||
|
||||
|
@ -215003,7 +215143,7 @@ var TextureManager = new Class({
|
|||
|
||||
/**
|
||||
* Returns an array with all of the keys of all Textures in this Texture Manager.
|
||||
* The output array will exclude the `__DEFAULT`, `__MISSING`, and `__WHITE` keys.
|
||||
* The output array will exclude the `__DEFAULT`, `__MISSING`, `__WHITE`, and `__NORMAL` keys.
|
||||
*
|
||||
* @method Phaser.Textures.TextureManager#getTextureKeys
|
||||
* @since 3.0.0
|
||||
|
@ -215016,7 +215156,7 @@ var TextureManager = new Class({
|
|||
|
||||
for (var key in this.list)
|
||||
{
|
||||
if (key !== '__DEFAULT' && key !== '__MISSING' && key !== '__WHITE')
|
||||
if (key !== '__DEFAULT' && key !== '__MISSING' && key !== '__WHITE' && key !== '__NORMAL')
|
||||
{
|
||||
output.push(key);
|
||||
}
|
||||
|
@ -244923,50 +245063,50 @@ var __webpack_exports__ = {};
|
|||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
||||
(() => {
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "$u": () => (/* binding */ Sound),
|
||||
/* harmony export */ "$z": () => (/* binding */ WEBGL),
|
||||
/* harmony export */ "B7": () => (/* binding */ AUTO),
|
||||
/* harmony export */ "Ci": () => (/* binding */ Scale),
|
||||
/* harmony export */ "Ct": () => (/* binding */ Cache),
|
||||
/* harmony export */ "FK": () => (/* binding */ Animations),
|
||||
/* harmony export */ "FX": () => (/* binding */ FX),
|
||||
/* harmony export */ "Hn": () => (/* binding */ NONE),
|
||||
/* harmony export */ "II": () => (/* binding */ Input),
|
||||
/* harmony export */ "QY": () => (/* binding */ Core),
|
||||
/* harmony export */ "Qj": () => (/* binding */ Create),
|
||||
/* harmony export */ "RL": () => (/* binding */ LEFT),
|
||||
/* harmony export */ "SO": () => (/* binding */ DOM),
|
||||
/* harmony export */ "Th": () => (/* binding */ Renderer),
|
||||
/* harmony export */ "UP": () => (/* binding */ UP),
|
||||
/* harmony export */ "Ut": () => (/* binding */ Structs),
|
||||
/* harmony export */ "Vn": () => (/* binding */ Plugins),
|
||||
/* harmony export */ "Vw": () => (/* binding */ Data),
|
||||
/* harmony export */ "WV": () => (/* binding */ DOWN),
|
||||
/* harmony export */ "Wk": () => (/* binding */ CANVAS),
|
||||
/* harmony export */ "Yp": () => (/* binding */ ScaleModes),
|
||||
/* harmony export */ "ZX": () => (/* binding */ Math),
|
||||
/* harmony export */ "_t": () => (/* binding */ Scenes),
|
||||
/* harmony export */ "aN": () => (/* binding */ Loader),
|
||||
/* harmony export */ "ak": () => (/* binding */ Tilemaps),
|
||||
/* harmony export */ "cQ": () => (/* binding */ Utils),
|
||||
/* harmony export */ "de": () => (/* binding */ BlendModes),
|
||||
/* harmony export */ "eX": () => (/* binding */ Actions),
|
||||
/* harmony export */ "fS": () => (/* binding */ Curves),
|
||||
/* harmony export */ "hi": () => (/* binding */ GameObjects),
|
||||
/* harmony export */ "lA": () => (/* binding */ Game),
|
||||
/* harmony export */ "oJ": () => (/* binding */ Tweens),
|
||||
/* harmony export */ "pX": () => (/* binding */ RIGHT),
|
||||
/* harmony export */ "py": () => (/* binding */ FOREVER),
|
||||
/* harmony export */ "q4": () => (/* binding */ VERSION),
|
||||
/* harmony export */ "qp": () => (/* binding */ Time),
|
||||
/* harmony export */ "sS": () => (/* binding */ Display),
|
||||
/* harmony export */ "tx": () => (/* binding */ Textures),
|
||||
/* harmony export */ "v6": () => (/* binding */ Geom),
|
||||
/* harmony export */ "vS": () => (/* binding */ HEADLESS),
|
||||
/* harmony export */ "vt": () => (/* binding */ Cameras),
|
||||
/* harmony export */ "wI": () => (/* binding */ Physics),
|
||||
/* harmony export */ "xs": () => (/* binding */ Scene),
|
||||
/* harmony export */ "zW": () => (/* binding */ Events)
|
||||
/* harmony export */ $u: () => (/* binding */ Sound),
|
||||
/* harmony export */ $z: () => (/* binding */ WEBGL),
|
||||
/* harmony export */ B7: () => (/* binding */ AUTO),
|
||||
/* harmony export */ Ci: () => (/* binding */ Scale),
|
||||
/* harmony export */ Ct: () => (/* binding */ Cache),
|
||||
/* harmony export */ FK: () => (/* binding */ Animations),
|
||||
/* harmony export */ FX: () => (/* binding */ FX),
|
||||
/* harmony export */ Hn: () => (/* binding */ NONE),
|
||||
/* harmony export */ II: () => (/* binding */ Input),
|
||||
/* harmony export */ QY: () => (/* binding */ Core),
|
||||
/* harmony export */ Qj: () => (/* binding */ Create),
|
||||
/* harmony export */ RL: () => (/* binding */ LEFT),
|
||||
/* harmony export */ SO: () => (/* binding */ DOM),
|
||||
/* harmony export */ Th: () => (/* binding */ Renderer),
|
||||
/* harmony export */ UP: () => (/* binding */ UP),
|
||||
/* harmony export */ Ut: () => (/* binding */ Structs),
|
||||
/* harmony export */ Vn: () => (/* binding */ Plugins),
|
||||
/* harmony export */ Vw: () => (/* binding */ Data),
|
||||
/* harmony export */ WV: () => (/* binding */ DOWN),
|
||||
/* harmony export */ Wk: () => (/* binding */ CANVAS),
|
||||
/* harmony export */ Yp: () => (/* binding */ ScaleModes),
|
||||
/* harmony export */ ZX: () => (/* binding */ Math),
|
||||
/* harmony export */ _t: () => (/* binding */ Scenes),
|
||||
/* harmony export */ aN: () => (/* binding */ Loader),
|
||||
/* harmony export */ ak: () => (/* binding */ Tilemaps),
|
||||
/* harmony export */ cQ: () => (/* binding */ Utils),
|
||||
/* harmony export */ de: () => (/* binding */ BlendModes),
|
||||
/* harmony export */ eX: () => (/* binding */ Actions),
|
||||
/* harmony export */ fS: () => (/* binding */ Curves),
|
||||
/* harmony export */ hi: () => (/* binding */ GameObjects),
|
||||
/* harmony export */ lA: () => (/* binding */ Game),
|
||||
/* harmony export */ oJ: () => (/* binding */ Tweens),
|
||||
/* harmony export */ pX: () => (/* binding */ RIGHT),
|
||||
/* harmony export */ py: () => (/* binding */ FOREVER),
|
||||
/* harmony export */ q4: () => (/* binding */ VERSION),
|
||||
/* harmony export */ qp: () => (/* binding */ Time),
|
||||
/* harmony export */ sS: () => (/* binding */ Display),
|
||||
/* harmony export */ tx: () => (/* binding */ Textures),
|
||||
/* harmony export */ v6: () => (/* binding */ Geom),
|
||||
/* harmony export */ vS: () => (/* binding */ HEADLESS),
|
||||
/* harmony export */ vt: () => (/* binding */ Cameras),
|
||||
/* harmony export */ wI: () => (/* binding */ Physics),
|
||||
/* harmony export */ xs: () => (/* binding */ Scene),
|
||||
/* harmony export */ zW: () => (/* binding */ Events)
|
||||
/* harmony export */ });
|
||||
/**
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
|
|
2
dist/phaser.esm.min.js
vendored
2
dist/phaser.esm.min.js
vendored
File diff suppressed because one or more lines are too long
348
dist/phaser.js
vendored
348
dist/phaser.js
vendored
|
@ -15691,7 +15691,7 @@ var CONST = {
|
|||
* @type {string}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
VERSION: '3.80.0-beta.1',
|
||||
VERSION: '3.80.0-beta.2',
|
||||
|
||||
BlendModes: __webpack_require__(95723),
|
||||
|
||||
|
@ -59282,14 +59282,21 @@ var Mesh = new Class({
|
|||
*
|
||||
* @example
|
||||
* mesh.setInteractive();
|
||||
*
|
||||
* @example
|
||||
* mesh.setInteractive({ useHandCursor: true });
|
||||
*
|
||||
* @method Phaser.GameObjects.Mesh#setInteractive
|
||||
* @since 3.60.0
|
||||
*
|
||||
* @param {(Phaser.Types.Input.InputConfiguration)} [config] - An input configuration object but it will ignore hitArea, hitAreaCallback and pixelPerfect with associated alphaTolerance properties.
|
||||
*
|
||||
* @return {this} This GameObject.
|
||||
*/
|
||||
setInteractive: function ()
|
||||
setInteractive: function (config)
|
||||
{
|
||||
if (config === undefined) { config = {}; }
|
||||
|
||||
var hitAreaCallback = function (area, x, y)
|
||||
{
|
||||
var faces = this.faces;
|
||||
|
@ -59308,7 +59315,7 @@ var Mesh = new Class({
|
|||
return false;
|
||||
}.bind(this);
|
||||
|
||||
this.scene.sys.input.enable(this, hitAreaCallback);
|
||||
this.scene.sys.input.enable(this, config, hitAreaCallback);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -72354,6 +72361,7 @@ var SetValue = __webpack_require__(22440);
|
|||
var ShaderRender = __webpack_require__(24252);
|
||||
var TransformMatrix = __webpack_require__(69360);
|
||||
var ArrayEach = __webpack_require__(36337);
|
||||
var RenderEvents = __webpack_require__(81044);
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -72507,6 +72515,28 @@ var Shader = new Class({
|
|||
*/
|
||||
this.vertexBuffer = renderer.createVertexBuffer(this.vertexData.byteLength, this.gl.STREAM_DRAW);
|
||||
|
||||
/**
|
||||
* Internal property: whether the shader needs to be created,
|
||||
* and if so, the key and textures to use for the shader.
|
||||
*
|
||||
* @name Phaser.GameObjects.Shader#_deferSetShader
|
||||
* @type {?{ key: string, textures: string[]|undefined, textureData: any|undefined }}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._deferSetShader = null;
|
||||
|
||||
/**
|
||||
* Internal property: whether the projection matrix needs to be set,
|
||||
* and if so, the data to use for the orthographic projection.
|
||||
*
|
||||
* @name Phaser.GameObjects.Shader#_deferProjOrtho
|
||||
* @type {?{ left: number, right: number, bottom: number, top: number }}
|
||||
* @private
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this._deferProjOrtho = null;
|
||||
|
||||
/**
|
||||
* The WebGL shader program this shader uses.
|
||||
*
|
||||
|
@ -72692,6 +72722,8 @@ var Shader = new Class({
|
|||
this.setSize(width, height);
|
||||
this.setOrigin(0.5, 0.5);
|
||||
this.setShader(key, textures, textureData);
|
||||
|
||||
this.renderer.on(RenderEvents.RESTORE_WEBGL, this.onContextRestored, this);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -72816,6 +72848,12 @@ var Shader = new Class({
|
|||
*/
|
||||
setShader: function (key, textures, textureData)
|
||||
{
|
||||
if (this.renderer.contextLost)
|
||||
{
|
||||
this._deferSetShader = { key: key, textures: textures, textureData: textureData };
|
||||
return this;
|
||||
}
|
||||
|
||||
if (textures === undefined) { textures = []; }
|
||||
|
||||
if (typeof key === 'string')
|
||||
|
@ -72926,6 +72964,12 @@ var Shader = new Class({
|
|||
*/
|
||||
projOrtho: function (left, right, bottom, top)
|
||||
{
|
||||
if (this.renderer.contextLost)
|
||||
{
|
||||
this._deferProjOrtho = { left: left, right: right, bottom: bottom, top: top };
|
||||
return;
|
||||
}
|
||||
|
||||
var near = -1000;
|
||||
var far = 1000;
|
||||
|
||||
|
@ -73548,6 +73592,34 @@ var Shader = new Class({
|
|||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* Run any logic that was deferred during context loss.
|
||||
*
|
||||
* @method Phaser.GameObjects.Shader#onContextRestored
|
||||
* @since 3.80.0
|
||||
*/
|
||||
onContextRestored: function ()
|
||||
{
|
||||
if (this._deferSetShader !== null)
|
||||
{
|
||||
var key = this._deferSetShader.key;
|
||||
var textures = this._deferSetShader.textures;
|
||||
var textureData = this._deferSetShader.textureData;
|
||||
this._deferSetShader = null;
|
||||
this.setShader(key, textures, textureData);
|
||||
}
|
||||
|
||||
if (this._deferProjOrtho !== null)
|
||||
{
|
||||
var left = this._deferProjOrtho.left;
|
||||
var right = this._deferProjOrtho.right;
|
||||
var bottom = this._deferProjOrtho.bottom;
|
||||
var top = this._deferProjOrtho.top;
|
||||
this._deferProjOrtho = null;
|
||||
this.projOrtho(left, right, bottom, top);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Internal destroy handler, called as part of the destroy process.
|
||||
*
|
||||
|
@ -73559,6 +73631,7 @@ var Shader = new Class({
|
|||
{
|
||||
var renderer = this.renderer;
|
||||
|
||||
renderer.off(RenderEvents.RESTORE_WEBGL, this.onContextRestored, this);
|
||||
renderer.deleteProgram(this.program);
|
||||
renderer.deleteBuffer(this.vertexBuffer);
|
||||
|
||||
|
@ -82320,8 +82393,6 @@ var Text = new Class({
|
|||
{
|
||||
this.frame.source.glTexture = this.renderer.canvasToTexture(canvas, this.frame.source.glTexture, true);
|
||||
|
||||
this.frame.glTexture = this.frame.source.glTexture;
|
||||
|
||||
if (false)
|
||||
{}
|
||||
}
|
||||
|
@ -103175,6 +103246,7 @@ var GetFastValue = __webpack_require__(72632);
|
|||
var GEOM_CONST = __webpack_require__(52394);
|
||||
var InputPluginCache = __webpack_require__(63399);
|
||||
var IsPlainObject = __webpack_require__(42911);
|
||||
var HasAny = __webpack_require__(53523);
|
||||
var PluginCache = __webpack_require__(91963);
|
||||
var Rectangle = __webpack_require__(74118);
|
||||
var RectangleContains = __webpack_require__(94287);
|
||||
|
@ -103940,6 +104012,7 @@ var InputPlugin = new Class({
|
|||
if (input)
|
||||
{
|
||||
this.removeDebug(gameObject);
|
||||
this.manager.resetCursor(input);
|
||||
|
||||
input.gameObject = undefined;
|
||||
input.target = undefined;
|
||||
|
@ -103988,20 +104061,12 @@ var InputPlugin = new Class({
|
|||
input.dragState = 0;
|
||||
}
|
||||
|
||||
// Clear from _temp, _drag and _over
|
||||
var temp = this._temp;
|
||||
// Clear from _drag and _over
|
||||
var drag = this._drag;
|
||||
var over = this._over;
|
||||
var manager = this.manager;
|
||||
|
||||
var index = temp.indexOf(gameObject);
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
temp.splice(index, 1);
|
||||
}
|
||||
|
||||
for (var i = 0; i < manager.pointersTotal; i++)
|
||||
for (var i = 0, index; i < manager.pointersTotal; i++)
|
||||
{
|
||||
index = drag[i].indexOf(gameObject);
|
||||
|
||||
|
@ -104015,8 +104080,6 @@ var InputPlugin = new Class({
|
|||
if (index > -1)
|
||||
{
|
||||
over[i].splice(index, 1);
|
||||
|
||||
manager.resetCursor(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105324,26 +105387,31 @@ var InputPlugin = new Class({
|
|||
var customHitArea = true;
|
||||
|
||||
// Config object?
|
||||
if (IsPlainObject(hitArea))
|
||||
if (IsPlainObject(hitArea) && Object.keys(hitArea).length)
|
||||
{
|
||||
var config = hitArea;
|
||||
|
||||
hitArea = GetFastValue(config, 'hitArea', null);
|
||||
hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null);
|
||||
// Check if any supplied Game Object is a Mesh based Game Object
|
||||
if (!HasAny(gameObjects, 'faces'))
|
||||
{
|
||||
hitArea = GetFastValue(config, 'hitArea', null);
|
||||
hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null);
|
||||
|
||||
pixelPerfect = GetFastValue(config, 'pixelPerfect', false);
|
||||
var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1);
|
||||
|
||||
if (pixelPerfect)
|
||||
{
|
||||
hitArea = {};
|
||||
hitAreaCallback = this.makePixelPerfect(alphaTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
draggable = GetFastValue(config, 'draggable', false);
|
||||
dropZone = GetFastValue(config, 'dropZone', false);
|
||||
cursor = GetFastValue(config, 'cursor', false);
|
||||
useHandCursor = GetFastValue(config, 'useHandCursor', false);
|
||||
|
||||
pixelPerfect = GetFastValue(config, 'pixelPerfect', false);
|
||||
var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1);
|
||||
|
||||
if (pixelPerfect)
|
||||
{
|
||||
hitArea = {};
|
||||
hitAreaCallback = this.makePixelPerfect(alphaTolerance);
|
||||
}
|
||||
|
||||
// Still no hitArea or callback?
|
||||
if (!hitArea || !hitAreaCallback)
|
||||
{
|
||||
|
@ -105351,11 +105419,6 @@ var InputPlugin = new Class({
|
|||
customHitArea = false;
|
||||
}
|
||||
}
|
||||
else if (typeof hitArea === 'function' && !hitAreaCallback)
|
||||
{
|
||||
hitAreaCallback = hitArea;
|
||||
hitArea = {};
|
||||
}
|
||||
|
||||
for (var i = 0; i < gameObjects.length; i++)
|
||||
{
|
||||
|
@ -146237,6 +146300,9 @@ var StaticBody = new Class({
|
|||
|
||||
gameObject.getTopLeft(this.position);
|
||||
|
||||
this.position.x += this.offset.x;
|
||||
this.position.y += this.offset.y;
|
||||
|
||||
this.updateCenter();
|
||||
|
||||
this.world.staticTree.insert(this);
|
||||
|
@ -178680,6 +178746,18 @@ var WebGLRenderer = new Class({
|
|||
*/
|
||||
this.blankTexture = null;
|
||||
|
||||
/**
|
||||
* A blank 1x1 #7f7fff texture, a flat normal map,
|
||||
* as used by the Graphics system where needed.
|
||||
* This is set in the `boot` method.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.WebGLRenderer#normalTexture
|
||||
* @type {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper}
|
||||
* @readonly
|
||||
* @since 3.80.0
|
||||
*/
|
||||
this.normalTexture = null;
|
||||
|
||||
/**
|
||||
* A pure white 4x4 texture, as used by the Graphics system where needed.
|
||||
* This is set in the `boot` method.
|
||||
|
@ -179035,7 +179113,7 @@ var WebGLRenderer = new Class({
|
|||
_this.pipelines.restoreContext();
|
||||
|
||||
// Apply resize.
|
||||
_this.resize(_this.width, _this.height);
|
||||
_this.resize(_this.game.scale.baseSize.width, _this.game.scale.baseSize.height);
|
||||
|
||||
// Restore GL extensions.
|
||||
setupExtensions();
|
||||
|
@ -179188,6 +179266,7 @@ var WebGLRenderer = new Class({
|
|||
// Set-up default textures, fbo and scissor
|
||||
|
||||
this.blankTexture = game.textures.getFrame('__DEFAULT').glTexture;
|
||||
this.normalTexture = game.textures.getFrame('__NORMAL').glTexture;
|
||||
this.whiteTexture = game.textures.getFrame('__WHITE').glTexture;
|
||||
|
||||
var gl = this.gl;
|
||||
|
@ -183591,7 +183670,6 @@ var GetFastValue = __webpack_require__(72632);
|
|||
var LightShaderSourceFS = __webpack_require__(65045);
|
||||
var MultiPipeline = __webpack_require__(77310);
|
||||
var TransformMatrix = __webpack_require__(69360);
|
||||
var UUID = __webpack_require__(76583);
|
||||
var Vec2 = __webpack_require__(93736);
|
||||
var WebGLPipeline = __webpack_require__(44775);
|
||||
|
||||
|
@ -183667,21 +183745,11 @@ var LightPipeline = new Class({
|
|||
0, 0, 1
|
||||
]);
|
||||
|
||||
/**
|
||||
* Stores a default normal map, which is an object with a `glTexture` property that
|
||||
* maps to a 1x1 texture of the color #7f7fff created in the `boot` method.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#defaultNormalMap
|
||||
* @type {object}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.defaultNormalMap;
|
||||
|
||||
/**
|
||||
* The currently bound normal map texture at texture unit one, if any.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.WebGLRenderer#currentNormalMap;
|
||||
* @type {?WebGLTexture}
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#currentNormalMap;
|
||||
* @type {?Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper}
|
||||
* @since 3.60.0
|
||||
*/
|
||||
this.currentNormalMap;
|
||||
|
@ -183739,10 +183807,6 @@ var LightPipeline = new Class({
|
|||
boot: function ()
|
||||
{
|
||||
WebGLPipeline.prototype.boot.call(this);
|
||||
|
||||
var tempTexture = this.renderer.game.textures.addUint8Array(UUID(), new Uint8Array([ 127, 127, 255, 255 ]), 1, 1);
|
||||
|
||||
this.defaultNormalMap = { glTexture: tempTexture };
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -183853,7 +183917,7 @@ var LightPipeline = new Class({
|
|||
* @ignore
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} [texture] - Texture 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)
|
||||
|
@ -183944,8 +184008,8 @@ var LightPipeline = new Class({
|
|||
* @method Phaser.Renderer.WebGL.WebGLRenderer#isNewNormalMap
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {WebGLTexture} texture - The WebGL diffuse texture.
|
||||
* @param {WebGLTexture} normalMap - The WebGL normal map texture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} texture - The diffuse texture.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} normalMap - The normal map texture.
|
||||
*
|
||||
* @return {boolean} Returns `false` if this combination is already set, or `true` if it's a new combination.
|
||||
*/
|
||||
|
@ -183955,7 +184019,7 @@ var LightPipeline = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Returns the normal map WebGLTexture from the given Game Object.
|
||||
* Returns the normal map WebGLTextureWrapper from the given Game Object.
|
||||
* If the Game Object doesn't have one, it returns the default normal map from this pipeline instead.
|
||||
*
|
||||
* @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#getNormalMap
|
||||
|
@ -183963,7 +184027,7 @@ var LightPipeline = new Class({
|
|||
*
|
||||
* @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object to get the normal map from.
|
||||
*
|
||||
* @return {WebGLTexture} The normal map texture.
|
||||
* @return {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} The normal map texture.
|
||||
*/
|
||||
getNormalMap: function (gameObject)
|
||||
{
|
||||
|
@ -183971,7 +184035,7 @@ var LightPipeline = new Class({
|
|||
|
||||
if (!gameObject)
|
||||
{
|
||||
normalMap = this.defaultNormalMap;
|
||||
return this.renderer.normalMap;
|
||||
}
|
||||
else if (gameObject.displayTexture)
|
||||
{
|
||||
|
@ -183995,7 +184059,7 @@ var LightPipeline = new Class({
|
|||
|
||||
if (!normalMap)
|
||||
{
|
||||
normalMap = this.defaultNormalMap;
|
||||
return this.renderer.normalMap;
|
||||
}
|
||||
|
||||
return normalMap.glTexture;
|
||||
|
@ -184026,7 +184090,7 @@ var LightPipeline = new Class({
|
|||
* @since 3.50.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject.
|
||||
* @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad.
|
||||
* @param {Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper} texture - Texture associated with the quad.
|
||||
* @param {number} textureWidth - Real texture width.
|
||||
* @param {number} textureHeight - Real texture height.
|
||||
* @param {number} srcX - X coordinate of the quad.
|
||||
|
@ -191441,7 +191505,7 @@ var WebGLAttribLocationWrapper = new Class({
|
|||
* It should only be passed directly to the WebGL API for drawing.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Wrappers.WebGLAttribLocationWrapper#webGLAttribLocation
|
||||
* @type {WebGLAttribLocation}
|
||||
* @type {GLint}
|
||||
* @default -1
|
||||
* @since 3.80.0
|
||||
*/
|
||||
|
@ -191491,7 +191555,16 @@ var WebGLAttribLocationWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.webGLAttribLocation = this.gl.getAttribLocation(this.program.webGLProgram, this.name);
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
this.webGLAttribLocation = gl.getAttribLocation(this.program.webGLProgram, this.name);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -191616,6 +191689,14 @@ var WebGLBufferWrapper = new Class({
|
|||
}
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var bufferType = this.bufferType;
|
||||
var webGLBuffer = gl.createBuffer();
|
||||
|
||||
|
@ -191634,7 +191715,11 @@ var WebGLBufferWrapper = new Class({
|
|||
*/
|
||||
destroy: function ()
|
||||
{
|
||||
this.gl.deleteBuffer(this.webGLBuffer);
|
||||
var gl = this.gl;
|
||||
if (!gl.isContextLost())
|
||||
{
|
||||
gl.deleteBuffer(this.webGLBuffer);
|
||||
}
|
||||
this.webGLBuffer = null;
|
||||
this.initialDataOrSize = null;
|
||||
this.gl = null;
|
||||
|
@ -191764,6 +191849,14 @@ var WebGLFramebufferWrapper = new Class({
|
|||
createResource: function ()
|
||||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var renderTexture = this.renderTexture;
|
||||
var complete = 0;
|
||||
var framebuffer = gl.createFramebuffer();
|
||||
|
@ -191810,32 +191903,34 @@ var WebGLFramebufferWrapper = new Class({
|
|||
|
||||
var gl = this.gl;
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.webGLFramebuffer);
|
||||
if (!gl.isContextLost())
|
||||
{
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.webGLFramebuffer);
|
||||
|
||||
// Check for a color attachment and remove it
|
||||
var colorAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (colorAttachment !== null)
|
||||
{
|
||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
|
||||
|
||||
gl.deleteTexture(colorAttachment);
|
||||
}
|
||||
|
||||
// Check for a depth-stencil attachment and remove it
|
||||
var depthStencilAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (depthStencilAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(depthStencilAttachment);
|
||||
}
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
|
||||
gl.deleteFramebuffer(this.webGLFramebuffer);
|
||||
}
|
||||
|
||||
this.renderTexture = null;
|
||||
|
||||
// Check for a color attachment and remove it
|
||||
var colorAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (colorAttachment !== null)
|
||||
{
|
||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
|
||||
|
||||
gl.deleteTexture(colorAttachment);
|
||||
}
|
||||
|
||||
// Check for a depth-stencil attachment and remove it
|
||||
var depthStencilAttachment = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
|
||||
|
||||
if (depthStencilAttachment !== null)
|
||||
{
|
||||
gl.deleteRenderbuffer(depthStencilAttachment);
|
||||
}
|
||||
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
|
||||
gl.deleteFramebuffer(this.webGLFramebuffer);
|
||||
|
||||
this.webGLFramebuffer = null;
|
||||
this.gl = null;
|
||||
}
|
||||
|
@ -191932,6 +192027,13 @@ var WebGLProgramWrapper = new Class({
|
|||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
var program = gl.createProgram();
|
||||
|
||||
var vs = gl.createShader(gl.VERTEX_SHADER);
|
||||
|
@ -191983,7 +192085,11 @@ var WebGLProgramWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.gl.deleteProgram(this.webGLProgram);
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
this.gl.deleteProgram(this.webGLProgram);
|
||||
}
|
||||
|
||||
this.webGLProgram = null;
|
||||
this.gl = null;
|
||||
}
|
||||
|
@ -192209,6 +192315,15 @@ var WebGLTextureWrapper = new Class({
|
|||
*/
|
||||
createResource: function ()
|
||||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.pixels instanceof WebGLTextureWrapper)
|
||||
{
|
||||
// Use the source texture directly.
|
||||
|
@ -192216,8 +192331,6 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
var texture = gl.createTexture();
|
||||
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
|
@ -192319,8 +192432,21 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
// Assume that the source might change.
|
||||
this.pixels = source;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.flipY = flipY;
|
||||
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
|
||||
var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D);
|
||||
|
@ -192332,12 +192458,6 @@ var WebGLTextureWrapper = new Class({
|
|||
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
|
||||
|
||||
// Assume that the source might change.
|
||||
this.pixels = source;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.flipY = flipY;
|
||||
|
||||
// Restore previous texture bind.
|
||||
if (currentTexture)
|
||||
{
|
||||
|
@ -192364,8 +192484,12 @@ var WebGLTextureWrapper = new Class({
|
|||
{
|
||||
// eslint-disable-next-line camelcase
|
||||
this.__SPECTOR_Metadata = value;
|
||||
// eslint-disable-next-line camelcase
|
||||
this.webGLTexture.__SPECTOR_Metadata = value;
|
||||
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
// eslint-disable-next-line camelcase
|
||||
this.webGLTexture.__SPECTOR_Metadata = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -192382,10 +192506,13 @@ var WebGLTextureWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(this.pixels instanceof WebGLTextureWrapper))
|
||||
if (!this.gl.isContextLost())
|
||||
{
|
||||
// Do not delete a texture that belongs to another wrapper.
|
||||
this.gl.deleteTexture(this.webGLTexture);
|
||||
if (!(this.pixels instanceof WebGLTextureWrapper))
|
||||
{
|
||||
// Do not delete a texture that belongs to another wrapper.
|
||||
this.gl.deleteTexture(this.webGLTexture);
|
||||
}
|
||||
}
|
||||
|
||||
this.pixels = null;
|
||||
|
@ -192485,7 +192612,16 @@ var WebGLUniformLocationWrapper = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.webGLUniformLocation = this.gl.getUniformLocation(this.program.webGLProgram, this.name);
|
||||
var gl = this.gl;
|
||||
|
||||
if (gl.isContextLost())
|
||||
{
|
||||
// GL state can't be updated right now.
|
||||
// `createResource` will run when the context is restored.
|
||||
return;
|
||||
}
|
||||
|
||||
this.webGLUniformLocation = gl.getUniformLocation(this.program.webGLProgram, this.name);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -213947,6 +214083,10 @@ var TextureManager = new Class({
|
|||
this.addBase64('__DEFAULT', config.defaultImage);
|
||||
this.addBase64('__MISSING', config.missingImage);
|
||||
this.addBase64('__WHITE', config.whiteImage);
|
||||
if (this.game.renderer && this.game.renderer.gl)
|
||||
{
|
||||
this.addUint8Array('__NORMAL', new Uint8Array([ 127, 127, 255, 255 ]), 1, 1);
|
||||
}
|
||||
|
||||
this.game.events.once(GameEvents.DESTROY, this.destroy, this);
|
||||
|
||||
|
@ -215111,7 +215251,7 @@ var TextureManager = new Class({
|
|||
|
||||
/**
|
||||
* Returns an array with all of the keys of all Textures in this Texture Manager.
|
||||
* The output array will exclude the `__DEFAULT`, `__MISSING`, and `__WHITE` keys.
|
||||
* The output array will exclude the `__DEFAULT`, `__MISSING`, `__WHITE`, and `__NORMAL` keys.
|
||||
*
|
||||
* @method Phaser.Textures.TextureManager#getTextureKeys
|
||||
* @since 3.0.0
|
||||
|
@ -215124,7 +215264,7 @@ var TextureManager = new Class({
|
|||
|
||||
for (var key in this.list)
|
||||
{
|
||||
if (key !== '__DEFAULT' && key !== '__MISSING' && key !== '__WHITE')
|
||||
if (key !== '__DEFAULT' && key !== '__MISSING' && key !== '__WHITE' && key !== '__NORMAL')
|
||||
{
|
||||
output.push(key);
|
||||
}
|
||||
|
|
2
dist/phaser.min.js
vendored
2
dist/phaser.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "phaser",
|
||||
"version": "3.80.0-beta.1",
|
||||
"version": "3.80.0-beta.2",
|
||||
"release": "Nino",
|
||||
"description": "A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.",
|
||||
"author": "Richard Davey <rich@phaser.io> (https://www.phaser.io)",
|
||||
|
|
|
@ -20,7 +20,7 @@ var CONST = {
|
|||
* @type {string}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
VERSION: '3.80.0-beta.1',
|
||||
VERSION: '3.80.0-beta.2',
|
||||
|
||||
BlendModes: require('./renderer/BlendModes'),
|
||||
|
||||
|
|
32927
types/phaser.d.ts
vendored
32927
types/phaser.d.ts
vendored
File diff suppressed because it is too large
Load diff
568084
types/phaser.json
568084
types/phaser.json
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue