spine4.1 plugin about createSkeleton perf issue (also optimize spine plugin spineFileCallback func)

This commit is contained in:
JustinTien 2023-01-14 04:52:24 +08:00
parent 9841602bbe
commit 9fa74e7dc4
26 changed files with 155082 additions and 133386 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -653,12 +653,14 @@ var SpinePlugin = new Class({
* @param {boolean} [preMultipliedAlpha=false] - Do the texture files include pre-multiplied alpha or not?
* @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the Spine json file. Used in replacement of the Loaders default XHR Settings.
* @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the Spine atlas file. Used in replacement of the Loaders default XHR Settings.
* @param {object} [settings] - An external Settings configuration object { prefix: '' }
*
* @return {Phaser.Loader.LoaderPlugin} The Loader instance.
*/
spineFileCallback: function (key, jsonURL, atlasURL, preMultipliedAlpha, jsonXhrSettings, atlasXhrSettings)
spineFileCallback: function (key, jsonURL, atlasURL, preMultipliedAlpha, jsonXhrSettings, atlasXhrSettings, settings)
{
var multifile;
settings = settings || {};
if (Array.isArray(key))
{
@ -666,6 +668,9 @@ var SpinePlugin = new Class({
{
multifile = new SpineFile(this, key[i]);
// Support prefix key
multifile.prefix = multifile.prefix || settings.prefix || '';
this.addFile(multifile.files);
}
}
@ -673,6 +678,9 @@ var SpinePlugin = new Class({
{
multifile = new SpineFile(this, key, jsonURL, atlasURL, preMultipliedAlpha, jsonXhrSettings, atlasXhrSettings);
// Support prefix key
multifile.prefix = multifile.prefix || settings.prefix || '';
this.addFile(multifile.files);
}

View file

@ -24620,35 +24620,33 @@ var SpinePlugin = new Class({
return null;
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
if (this.isWebGL)
if (!this.spineTextures.has(atlasKey))
{
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
else
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
}
else
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
}
}
}
var spineTextureKey = atlasData.prefix ? atlasData.prefix + atlasKey : atlasKey;
if (!this.spineTextures.has(spineTextureKey))
{
this.spineTextures.add(spineTextureKey, atlas);
this.spineTextures.add(atlasKey, atlas);
}
var preMultipliedAlpha = atlasData.preMultipliedAlpha;

File diff suppressed because one or more lines are too long

View file

@ -37208,35 +37208,33 @@ var SpinePlugin = new Class({
return null;
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
if (this.isWebGL)
if (!this.spineTextures.has(atlasKey))
{
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
else
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
}
else
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
}
}
}
var spineTextureKey = atlasData.prefix ? atlasData.prefix + atlasKey : atlasKey;
if (!this.spineTextures.has(spineTextureKey))
{
this.spineTextures.add(spineTextureKey, atlas);
this.spineTextures.add(atlasKey, atlas);
}
var preMultipliedAlpha = atlasData.preMultipliedAlpha;

File diff suppressed because one or more lines are too long

View file

@ -15141,35 +15141,33 @@ var SpinePlugin = new Class({
return null;
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
if (this.isWebGL)
if (!this.spineTextures.has(atlasKey))
{
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
else
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
}
else
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
}
}
}
var spineTextureKey = atlasData.prefix ? atlasData.prefix + atlasKey : atlasKey;
if (!this.spineTextures.has(spineTextureKey))
{
this.spineTextures.add(spineTextureKey, atlas);
this.spineTextures.add(atlasKey, atlas);
}
var preMultipliedAlpha = atlasData.preMultipliedAlpha;

File diff suppressed because one or more lines are too long

View file

@ -37443,35 +37443,33 @@ var SpinePlugin = new Class({
return null;
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
if (this.isWebGL)
if (!this.spineTextures.has(atlasKey))
{
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
else
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
}
else
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
}
}
}
var spineTextureKey = atlasData.prefix ? atlasData.prefix + atlasKey : atlasKey;
if (!this.spineTextures.has(spineTextureKey))
{
this.spineTextures.add(spineTextureKey, atlas);
this.spineTextures.add(atlasKey, atlas);
}
var preMultipliedAlpha = atlasData.preMultipliedAlpha;

File diff suppressed because one or more lines are too long

View file

@ -27178,35 +27178,33 @@ var SpinePlugin = new Class({
return null;
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
if (this.isWebGL)
if (!this.spineTextures.has(atlasKey))
{
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
else
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
}
else
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
}
}
}
var spineTextureKey = atlasData.prefix ? atlasData.prefix + atlasKey : atlasKey;
if (!this.spineTextures.has(spineTextureKey))
{
this.spineTextures.add(spineTextureKey, atlas);
this.spineTextures.add(atlasKey, atlas);
}
var preMultipliedAlpha = atlasData.preMultipliedAlpha;

File diff suppressed because one or more lines are too long

View file

@ -37328,35 +37328,33 @@ var SpinePlugin = new Class({
return null;
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
if (this.isWebGL)
if (!this.spineTextures.has(atlasKey))
{
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
else
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
}
else
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
}
}
}
var spineTextureKey = atlasData.prefix ? atlasData.prefix + atlasKey : atlasKey;
if (!this.spineTextures.has(spineTextureKey))
{
this.spineTextures.add(spineTextureKey, atlas);
this.spineTextures.add(atlasKey, atlas);
}
var preMultipliedAlpha = atlasData.preMultipliedAlpha;

File diff suppressed because one or more lines are too long

View file

@ -638,6 +638,7 @@ var SpinePlugin = new Class({
* @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the Spine json file. Used in replacement of the Loaders default XHR Settings.
* @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the Spine atlas file. Used in replacement of the Loaders default XHR Settings.
* @param {object} [settings] - An external Settings configuration object { prefix: '' }
*
* @return {Phaser.Loader.LoaderPlugin} The Loader instance.
*/
spineFileCallback: function (key, jsonURL, atlasURL, preMultipliedAlpha, jsonXhrSettings, atlasXhrSettings, settings)
@ -971,35 +972,33 @@ var SpinePlugin = new Class({
return null;
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
if (this.isWebGL)
if (!this.spineTextures.has(atlasKey))
{
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
var gl = this.gl;
var i;
var atlasPage;
var realTextureKey;
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}
else
for (i = 0; i < atlas.pages.length; i ++)
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
atlasPage = atlas.pages[i];
realTextureKey = atlasData.prefix ? atlasData.prefix + atlasPage.name : atlasPage.name;
if (this.isWebGL)
{
atlasPage.setTexture(new this.runtime.GLTexture(gl, this.textures.get(realTextureKey).getSourceImage(), false));
}
else
{
atlasPage.setTexture(new this.runtime.CanvasTexture(this.textures.get(realTextureKey).getSourceImage()));
}
}
}
var spineTextureKey = atlasData.prefix ? atlasData.prefix + atlasKey : atlasKey;
if (!this.spineTextures.has(spineTextureKey))
{
this.spineTextures.add(spineTextureKey, atlas);
this.spineTextures.add(atlasKey, atlas);
}
var preMultipliedAlpha = atlasData.preMultipliedAlpha;