mirror of
https://github.com/photonstorm/phaser
synced 2024-11-14 00:47:29 +00:00
New Spine build
This commit is contained in:
parent
7ba1b132ab
commit
7903063efc
2 changed files with 265 additions and 33 deletions
296
plugins/spine/dist/SpinePluginDebug.js
vendored
296
plugins/spine/dist/SpinePluginDebug.js
vendored
|
@ -1898,7 +1898,7 @@ var BitmapMask = new Class({
|
|||
|
||||
function BitmapMask (scene, renderable)
|
||||
{
|
||||
var renderer = scene.sys.game.renderer;
|
||||
var renderer = scene.sys.renderer;
|
||||
|
||||
/**
|
||||
* A reference to either the Canvas or WebGL Renderer that this Mask is using.
|
||||
|
@ -5702,6 +5702,7 @@ module.exports = PathFollower;
|
|||
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
||||
*/
|
||||
|
||||
var DeepCopy = __webpack_require__(/*! ../../utils/object/DeepCopy */ "../../../src/utils/object/DeepCopy.js");
|
||||
var PIPELINE_CONST = __webpack_require__(/*! ../../renderer/webgl/pipelines/const */ "../../../src/renderer/webgl/pipelines/const.js");
|
||||
|
||||
/**
|
||||
|
@ -5717,6 +5718,8 @@ var Pipeline = {
|
|||
/**
|
||||
* The initial WebGL pipeline of this Game Object.
|
||||
*
|
||||
* If you call `resetPipeline` on this Game Object, the pipeline is reset to this default.
|
||||
*
|
||||
* @name Phaser.GameObjects.Components.Pipeline#defaultPipeline
|
||||
* @type {Phaser.Renderer.WebGL.WebGLPipeline}
|
||||
* @default null
|
||||
|
@ -5736,56 +5739,179 @@ var Pipeline = {
|
|||
*/
|
||||
pipeline: null,
|
||||
|
||||
/**
|
||||
* The WebGL Pipeline this Game Object uses for post-render effects.
|
||||
*
|
||||
* @name Phaser.GameObjects.Components.Pipeline#postPipeline
|
||||
* @type {Phaser.Renderer.WebGL.WebGLPipeline}
|
||||
* @default null
|
||||
* @webglOnly
|
||||
* @since 3.50.0
|
||||
*/
|
||||
postPipeline: null,
|
||||
|
||||
/**
|
||||
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
|
||||
*
|
||||
* @name Phaser.GameObjects.Components.Pipeline#pipelineData
|
||||
* @type {object}
|
||||
* @webglOnly
|
||||
* @since 3.50.0
|
||||
*/
|
||||
pipelineData: {},
|
||||
|
||||
/**
|
||||
* Sets the initial WebGL Pipeline of this Game Object.
|
||||
*
|
||||
* This should only be called during the instantiation of the Game Object.
|
||||
* This should only be called during the instantiation of the Game Object. After that, use `setPipeline`.
|
||||
*
|
||||
* @method Phaser.GameObjects.Components.Pipeline#initPipeline
|
||||
* @webglOnly
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} [name=MultiPipeline] - The name of the pipeline to set on this Game Object. Defaults to the Multi Pipeline.
|
||||
* @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set.
|
||||
*
|
||||
* @return {boolean} `true` if the pipeline was set successfully, otherwise `false`.
|
||||
*/
|
||||
initPipeline: function (name)
|
||||
initPipeline: function (pipeline)
|
||||
{
|
||||
if (name === undefined) { name = PIPELINE_CONST.MULTI_PIPELINE; }
|
||||
if (pipeline === undefined) { pipeline = PIPELINE_CONST.MULTI_PIPELINE; }
|
||||
|
||||
var renderer = this.scene.sys.game.renderer;
|
||||
var renderer = this.scene.sys.renderer;
|
||||
var pipelines = renderer.pipelines;
|
||||
|
||||
if (pipelines && pipelines.has(name))
|
||||
if (pipelines)
|
||||
{
|
||||
this.defaultPipeline = pipelines.get(name);
|
||||
this.pipeline = this.defaultPipeline;
|
||||
var instance = pipelines.get(pipeline);
|
||||
|
||||
return true;
|
||||
if (instance)
|
||||
{
|
||||
this.defaultPipeline = instance;
|
||||
this.pipeline = instance;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the active WebGL Pipeline of this Game Object.
|
||||
* Sets the main WebGL Pipeline of this Game Object, and optionally the post-render pipeline as well.
|
||||
*
|
||||
* Also sets the `pipelineData` property, if the parameter is given.
|
||||
*
|
||||
* Both the pipeline and post pipeline share the pipeline data object together.
|
||||
*
|
||||
* @method Phaser.GameObjects.Components.Pipeline#setPipeline
|
||||
* @webglOnly
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} name - The name of the pipeline to set on this Game Object.
|
||||
* @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set.
|
||||
* @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object.
|
||||
* @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead.
|
||||
*
|
||||
* @return {this} This Game Object instance.
|
||||
*/
|
||||
setPipeline: function (name)
|
||||
setPipeline: function (pipeline, pipelineData, copyData)
|
||||
{
|
||||
var renderer = this.scene.sys.game.renderer;
|
||||
var renderer = this.scene.sys.renderer;
|
||||
var pipelines = renderer.pipelines;
|
||||
|
||||
if (pipelines && pipelines.has(name))
|
||||
if (pipelines)
|
||||
{
|
||||
this.pipeline = pipelines.get(name);
|
||||
var instance = pipelines.get(pipeline);
|
||||
|
||||
if (instance)
|
||||
{
|
||||
this.pipeline = instance;
|
||||
}
|
||||
|
||||
if (pipelineData)
|
||||
{
|
||||
this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the post-render WebGL Pipeline of this Game Object.
|
||||
*
|
||||
* Post Pipelines are invoked after this Game Object has rendered to its target and
|
||||
* are commonly used for post-fx.
|
||||
*
|
||||
* Also sets the `pipelineData` property, if the parameter is given and the pipeline is successfully set.
|
||||
*
|
||||
* Both the pipeline and post pipeline share the pipeline data object together.
|
||||
*
|
||||
* @method Phaser.GameObjects.Components.Pipeline#setPostPipeline
|
||||
* @webglOnly
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set.
|
||||
* @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object.
|
||||
* @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead.
|
||||
*
|
||||
* @return {this} This Game Object instance.
|
||||
*/
|
||||
setPostPipeline: function (pipeline, pipelineData, copyData)
|
||||
{
|
||||
var renderer = this.scene.sys.renderer;
|
||||
var pipelines = renderer.pipelines;
|
||||
|
||||
if (pipelines)
|
||||
{
|
||||
var instance = pipelines.get(pipeline);
|
||||
|
||||
if (instance)
|
||||
{
|
||||
this.postPipeline = instance;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.postPipeline = null;
|
||||
}
|
||||
|
||||
if (pipelineData)
|
||||
{
|
||||
this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds an entry to the `pipelineData` object belonging to this Game Object.
|
||||
*
|
||||
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
|
||||
*
|
||||
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
|
||||
*
|
||||
* Both the pipeline and post pipeline share the pipeline data object together.
|
||||
*
|
||||
* @method Phaser.GameObjects.Components.Pipeline#setPipelineData
|
||||
* @webglOnly
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {string} key - The key of the pipeline data to set, update, or delete.
|
||||
* @param {any} [value] - The value to be set with the key. If `undefined` then `key` will be deleted from the object.
|
||||
*
|
||||
* @return {this} This Game Object instance.
|
||||
*/
|
||||
setPipelineData: function (key, value)
|
||||
{
|
||||
var data = this.pipelineData;
|
||||
|
||||
if (value === undefined)
|
||||
{
|
||||
delete data[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
data[key] = value;
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -5798,12 +5924,28 @@ var Pipeline = {
|
|||
* @webglOnly
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {boolean} `true` if the pipeline was set successfully, otherwise `false`.
|
||||
* @param {boolean} [resetPostPipeline=false] - Reset the `postPipeline`?
|
||||
* @param {boolean} [resetData=false] - Reset the `pipelineData` object to being an empty object?
|
||||
*
|
||||
* @return {boolean} `true` if the pipeline was reset successfully, otherwise `false`.
|
||||
*/
|
||||
resetPipeline: function ()
|
||||
resetPipeline: function (resetPostPipeline, resetData)
|
||||
{
|
||||
if (resetPostPipeline === undefined) { resetPostPipeline = false; }
|
||||
if (resetData === undefined) { resetData = false; }
|
||||
|
||||
this.pipeline = this.defaultPipeline;
|
||||
|
||||
if (resetPostPipeline)
|
||||
{
|
||||
this.postPipeline = null;
|
||||
}
|
||||
|
||||
if (resetData)
|
||||
{
|
||||
this.pipelineData = {};
|
||||
}
|
||||
|
||||
return (this.pipeline !== null);
|
||||
},
|
||||
|
||||
|
@ -5819,6 +5961,20 @@ var Pipeline = {
|
|||
getPipelineName: function ()
|
||||
{
|
||||
return this.pipeline.name;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the name of the Post Pipeline this Game Object is currently using, if any.
|
||||
*
|
||||
* @method Phaser.GameObjects.Components.Pipeline#getPostPipelineName
|
||||
* @webglOnly
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @return {string} The string-based name of the post pipeline being used by this Game Object.
|
||||
*/
|
||||
getPostPipelineName: function ()
|
||||
{
|
||||
return (this.postPipeline) ? this.postPipeline.name : '';
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -8648,6 +8804,7 @@ var Vector2 = __webpack_require__(/*! ../../math/Vector2 */ "../../../src/math/V
|
|||
* @extends Phaser.GameObjects.Components.ComputedSize
|
||||
* @extends Phaser.GameObjects.Components.Depth
|
||||
* @extends Phaser.GameObjects.Components.Mask
|
||||
* @extends Phaser.GameObjects.Components.Pipeline
|
||||
* @extends Phaser.GameObjects.Components.Transform
|
||||
* @extends Phaser.GameObjects.Components.Visible
|
||||
*
|
||||
|
@ -8666,6 +8823,7 @@ var Container = new Class({
|
|||
Components.ComputedSize,
|
||||
Components.Depth,
|
||||
Components.Mask,
|
||||
Components.Pipeline,
|
||||
Components.Transform,
|
||||
Components.Visible,
|
||||
Render
|
||||
|
@ -8799,7 +8957,7 @@ var Container = new Class({
|
|||
* @name Phaser.GameObjects.Container#scrollFactorX
|
||||
* @type {number}
|
||||
* @default 1
|
||||
* @since 3.0.0
|
||||
* @since 3.4.0
|
||||
*/
|
||||
this.scrollFactorX = 1;
|
||||
|
||||
|
@ -8826,10 +8984,12 @@ var Container = new Class({
|
|||
* @name Phaser.GameObjects.Container#scrollFactorY
|
||||
* @type {number}
|
||||
* @default 1
|
||||
* @since 3.0.0
|
||||
* @since 3.4.0
|
||||
*/
|
||||
this.scrollFactorY = 1;
|
||||
|
||||
this.initPipeline();
|
||||
|
||||
this.setPosition(x, y);
|
||||
|
||||
this.clearAlpha();
|
||||
|
@ -9762,7 +9922,7 @@ var Container = new Class({
|
|||
* them from physics bodies if not accounted for in your code.
|
||||
*
|
||||
* @method Phaser.GameObjects.Container#setScrollFactor
|
||||
* @since 3.0.0
|
||||
* @since 3.4.0
|
||||
*
|
||||
* @param {number} x - The horizontal scroll factor of this Game Object.
|
||||
* @param {number} [y=x] - The vertical scroll factor of this Game Object. If not set it will use the `x` value.
|
||||
|
@ -10120,8 +10280,9 @@ module.exports = {
|
|||
var ContainerWebGLRenderer = function (renderer, container, camera, parentMatrix)
|
||||
{
|
||||
var children = container.list;
|
||||
var childCount = children.length;
|
||||
|
||||
if (children.length === 0)
|
||||
if (childCount === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -10141,6 +10302,8 @@ var ContainerWebGLRenderer = function (renderer, container, camera, parentMatrix
|
|||
transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY);
|
||||
}
|
||||
|
||||
renderer.pipelines.preBatch(this);
|
||||
|
||||
var containerHasBlendMode = (container.blendMode !== -1);
|
||||
|
||||
if (!containerHasBlendMode)
|
||||
|
@ -10154,9 +10317,6 @@ var ContainerWebGLRenderer = function (renderer, container, camera, parentMatrix
|
|||
var scrollFactorX = container.scrollFactorX;
|
||||
var scrollFactorY = container.scrollFactorY;
|
||||
|
||||
var list = children;
|
||||
var childCount = children.length;
|
||||
|
||||
for (var i = 0; i < childCount; i++)
|
||||
{
|
||||
var child = children[i];
|
||||
|
@ -10212,7 +10372,7 @@ var ContainerWebGLRenderer = function (renderer, container, camera, parentMatrix
|
|||
renderer.currentType = type;
|
||||
}
|
||||
|
||||
renderer.nextTypeMatch = (i < childCount - 1) ? (list[i + 1].type === renderer.currentType) : false;
|
||||
renderer.nextTypeMatch = (i < childCount - 1) ? (children[i + 1].type === renderer.currentType) : false;
|
||||
|
||||
// Set parent values
|
||||
child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY);
|
||||
|
@ -10235,6 +10395,8 @@ var ContainerWebGLRenderer = function (renderer, container, camera, parentMatrix
|
|||
|
||||
renderer.newType = false;
|
||||
}
|
||||
|
||||
renderer.pipelines.postBatch(this);
|
||||
};
|
||||
|
||||
module.exports = ContainerWebGLRenderer;
|
||||
|
@ -27178,8 +27340,27 @@ var PIPELINE_CONST = {
|
|||
* @const
|
||||
* @since 3.50.0
|
||||
*/
|
||||
ROPE_PIPELINE: 'RopePipeline'
|
||||
ROPE_PIPELINE: 'RopePipeline',
|
||||
|
||||
/**
|
||||
* The Graphics and Shapes Pipeline.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.GRAPHICS_PIPELINE
|
||||
* @type {string}
|
||||
* @const
|
||||
* @since 3.50.0
|
||||
*/
|
||||
GRAPHICS_PIPELINE: 'GraphicsPipeline',
|
||||
|
||||
/**
|
||||
* The Post FX Pipeline.
|
||||
*
|
||||
* @name Phaser.Renderer.WebGL.Pipelines.POSTFX_PIPELINE
|
||||
* @type {string}
|
||||
* @const
|
||||
* @since 3.50.0
|
||||
*/
|
||||
POSTFX_PIPELINE: 'PostFXPipeline'
|
||||
};
|
||||
|
||||
module.exports = PIPELINE_CONST;
|
||||
|
@ -31562,6 +31743,60 @@ module.exports = {
|
|||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "../../../src/utils/object/DeepCopy.js":
|
||||
/*!*******************************************************!*\
|
||||
!*** D:/wamp/www/phaser/src/utils/object/DeepCopy.js ***!
|
||||
\*******************************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/**
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2020 Photon Storm Ltd.
|
||||
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Deep Copy the given object or array.
|
||||
*
|
||||
* @function Phaser.Utils.Objects.DeepCopy
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {object} obj - The object to deep copy.
|
||||
*
|
||||
* @return {object} A deep copy of the original object.
|
||||
*/
|
||||
var DeepCopy = function (inObject)
|
||||
{
|
||||
var outObject;
|
||||
var value;
|
||||
var key;
|
||||
|
||||
if (typeof inObject !== 'object' || inObject === null)
|
||||
{
|
||||
// inObject is not an object
|
||||
return inObject;
|
||||
}
|
||||
|
||||
// Create an array or object to hold the values
|
||||
outObject = Array.isArray(inObject) ? [] : {};
|
||||
|
||||
for (key in inObject)
|
||||
{
|
||||
value = inObject[key];
|
||||
|
||||
// Recursively (deep) copy for nested objects, including arrays
|
||||
outObject[key] = DeepCopy(value);
|
||||
}
|
||||
|
||||
return outObject;
|
||||
};
|
||||
|
||||
module.exports = DeepCopy;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "../../../src/utils/object/Extend.js":
|
||||
|
@ -34338,17 +34573,14 @@ var SpineGameObject = new Class({
|
|||
*/
|
||||
willRender: function (camera)
|
||||
{
|
||||
var skeleton = this.skeleton;
|
||||
|
||||
if (!skeleton)
|
||||
if (!this.skeleton)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var GameObjectRenderMask = 15;
|
||||
var childAlpha = skeleton.color.a;
|
||||
|
||||
return !(GameObjectRenderMask !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id)) || childAlpha === 0);
|
||||
return !(GameObjectRenderMask !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id)));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
2
plugins/spine/dist/SpinePluginDebug.js.map
vendored
2
plugins/spine/dist/SpinePluginDebug.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue