@pixi/prepare
Advanced tools
Comparing version 5.1.5 to 5.2.0
/*! | ||
* @pixi/prepare - v5.1.5 | ||
* Compiled Tue, 24 Sep 2019 04:07:05 UTC | ||
* @pixi/prepare - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* | ||
@@ -400,6 +400,6 @@ * @pixi/prepare is licensed under the MIT License. | ||
/** | ||
* Built-in hook to find BaseTextures from Sprites. | ||
* Built-in hook to find BaseTextures from Texture. | ||
* | ||
* @private | ||
* @param {PIXI.DisplayObject} item - Display object to check | ||
* @param {PIXI.Texture} item - Display object to check | ||
* @param {Array<*>} queue - Collection of items to upload | ||
@@ -410,8 +410,9 @@ * @return {boolean} if a PIXI.Texture object was found. | ||
{ | ||
// Objects with textures, like Sprites/Text | ||
if (item instanceof core.BaseTexture) | ||
if (item.baseTexture instanceof core.BaseTexture) | ||
{ | ||
if (queue.indexOf(item) === -1) | ||
var texture = item.baseTexture; | ||
if (queue.indexOf(texture) === -1) | ||
{ | ||
queue.push(item); | ||
queue.push(texture); | ||
} | ||
@@ -585,3 +586,3 @@ | ||
* @param {PIXI.Renderer} renderer - instance of the webgl renderer | ||
* @param {PIXI.DisplayObject} item - Item to check | ||
* @param {PIXI.BaseTexture} item - Item to check | ||
* @return {boolean} If item was uploaded. | ||
@@ -617,15 +618,34 @@ */ | ||
{ | ||
if (item instanceof graphics.Graphics) | ||
if (!(item instanceof graphics.Graphics)) | ||
{ | ||
// if the item is not dirty and already has webgl data, then it got prepared or rendered | ||
// before now and we shouldn't waste time updating it again | ||
if (item.dirty || item.clearDirty || !item._webGL[renderer.plugins.graphics.CONTEXT_UID]) | ||
return false; | ||
} | ||
var geometry = item.geometry; | ||
// update dirty graphics to get batches | ||
item.finishPoly(); | ||
geometry.updateBatches(); | ||
var batches = geometry.batches; | ||
// upload all textures found in styles | ||
for (var i = 0; i < batches.length; i++) | ||
{ | ||
var ref = batches[i].style; | ||
var texture = ref.texture; | ||
if (texture) | ||
{ | ||
renderer.plugins.graphics.updateGraphics(item); | ||
uploadBaseTextures(renderer, texture.baseTexture); | ||
} | ||
} | ||
return true; | ||
// if its not batchable - update vao for particular shader | ||
if (!geometry.batchable) | ||
{ | ||
renderer.geometry.bind(geometry, item._resolveDirectShader()); | ||
} | ||
return false; | ||
return true; | ||
} | ||
@@ -632,0 +652,0 @@ |
/*! | ||
* @pixi/prepare - v5.1.5 | ||
* Compiled Tue, 24 Sep 2019 04:07:05 UTC | ||
* @pixi/prepare - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/prepare is licensed under the MIT License. | ||
*/ | ||
this.PIXI=this.PIXI||{},this.PIXI.prepare=this.PIXI.prepare||{};var _pixi_prepare=function(t,e,i,r,s,o,n){"use strict";e.settings.UPLOADS_PER_FRAME=4;var u=function(t){this.maxItemsPerFrame=t,this.itemsLeft=0};u.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},u.prototype.allowedToUpload=function(){return this.itemsLeft-- >0};var h=function(t){var i=this;this.limiter=new u(e.settings.UPLOADS_PER_FRAME),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){i.queue&&i.prepareItems()},this.registerFindHook(f),this.registerFindHook(k),this.registerFindHook(a),this.registerFindHook(p),this.registerFindHook(l),this.registerUploadHook(c),this.registerUploadHook(d)};function a(t,e){var r=!1;if(t&&t._textures&&t._textures.length)for(var s=0;s<t._textures.length;s++)if(t._textures[s]instanceof i.Texture){var o=t._textures[s].baseTexture;-1===e.indexOf(o)&&(e.push(o),r=!0)}return r}function p(t,e){return t instanceof i.BaseTexture&&(-1===e.indexOf(t)&&e.push(t),!0)}function l(t,e){if(t._texture&&t._texture instanceof i.Texture){var r=t._texture.baseTexture;return-1===e.indexOf(r)&&e.push(r),!0}return!1}function c(t,e){return e instanceof n.Text&&(e.updateText(!0),!0)}function d(t,e){if(e instanceof n.TextStyle){var i=e.toFontString();return n.TextMetrics.measureFont(i),!0}return!1}function f(t,e){if(t instanceof n.Text){-1===e.indexOf(t.style)&&e.push(t.style),-1===e.indexOf(t)&&e.push(t);var i=t._texture.baseTexture;return-1===e.indexOf(i)&&e.push(i),!0}return!1}function k(t,e){return t instanceof n.TextStyle&&(-1===e.indexOf(t)&&e.push(t),!0)}h.prototype.upload=function(t,e){"function"==typeof t&&(e=t,t=null),t&&this.add(t),this.queue.length?(e&&this.completes.push(e),this.ticking||(this.ticking=!0,s.Ticker.system.addOnce(this.tick,this,s.UPDATE_PRIORITY.UTILITY))):e&&e()},h.prototype.tick=function(){setTimeout(this.delayedTick,0)},h.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var t=this.queue[0],e=!1;if(t&&!t._destroyed)for(var i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}e||this.queue.shift()}if(this.queue.length)s.Ticker.system.addOnce(this.tick,this,s.UPDATE_PRIORITY.UTILITY);else{this.ticking=!1;var o=this.completes.slice(0);this.completes.length=0;for(var n=0,u=o.length;n<u;n++)o[n]()}},h.prototype.registerFindHook=function(t){return t&&this.addHooks.push(t),this},h.prototype.registerUploadHook=function(t){return t&&this.uploadHooks.push(t),this},h.prototype.add=function(t){for(var e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof o.Container)for(var r=t.children.length-1;r>=0;r--)this.add(t.children[r]);return this},h.prototype.destroy=function(){this.ticking&&s.Ticker.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null};var g=function(t){function e(e){t.call(this,e),this.uploadHookHelper=this.renderer,this.registerFindHook(I),this.registerUploadHook(m),this.registerUploadHook(x)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(h);function m(t,e){return e instanceof i.BaseTexture&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function x(t,e){return e instanceof r.Graphics&&((e.dirty||e.clearDirty||!e._webGL[t.plugins.graphics.CONTEXT_UID])&&t.plugins.graphics.updateGraphics(e),!0)}function I(t,e){return t instanceof r.Graphics&&(e.push(t),!0)}var T=function(t){this.maxMilliseconds=t,this.frameStart=0};return T.prototype.beginFrame=function(){this.frameStart=Date.now()},T.prototype.allowedToUpload=function(){return Date.now()-this.frameStart<this.maxMilliseconds},t.BasePrepare=h,t.CountLimiter=u,t.Prepare=g,t.TimeLimiter=T,t}({},PIXI,PIXI,PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI.prepare,_pixi_prepare); | ||
this.PIXI=this.PIXI||{},this.PIXI.prepare=this.PIXI.prepare||{};var _pixi_prepare=function(t,e,i,r,s,o,n){"use strict";e.settings.UPLOADS_PER_FRAME=4;var u=function(t){this.maxItemsPerFrame=t,this.itemsLeft=0};u.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},u.prototype.allowedToUpload=function(){return this.itemsLeft-- >0};var a=function(t){var i=this;this.limiter=new u(e.settings.UPLOADS_PER_FRAME),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){i.queue&&i.prepareItems()},this.registerFindHook(d),this.registerFindHook(k),this.registerFindHook(h),this.registerFindHook(p),this.registerFindHook(l),this.registerUploadHook(c),this.registerUploadHook(f)};function h(t,e){var r=!1;if(t&&t._textures&&t._textures.length)for(var s=0;s<t._textures.length;s++)if(t._textures[s]instanceof i.Texture){var o=t._textures[s].baseTexture;-1===e.indexOf(o)&&(e.push(o),r=!0)}return r}function p(t,e){if(t.baseTexture instanceof i.BaseTexture){var r=t.baseTexture;return-1===e.indexOf(r)&&e.push(r),!0}return!1}function l(t,e){if(t._texture&&t._texture instanceof i.Texture){var r=t._texture.baseTexture;return-1===e.indexOf(r)&&e.push(r),!0}return!1}function c(t,e){return e instanceof n.Text&&(e.updateText(!0),!0)}function f(t,e){if(e instanceof n.TextStyle){var i=e.toFontString();return n.TextMetrics.measureFont(i),!0}return!1}function d(t,e){if(t instanceof n.Text){-1===e.indexOf(t.style)&&e.push(t.style),-1===e.indexOf(t)&&e.push(t);var i=t._texture.baseTexture;return-1===e.indexOf(i)&&e.push(i),!0}return!1}function k(t,e){return t instanceof n.TextStyle&&(-1===e.indexOf(t)&&e.push(t),!0)}a.prototype.upload=function(t,e){"function"==typeof t&&(e=t,t=null),t&&this.add(t),this.queue.length?(e&&this.completes.push(e),this.ticking||(this.ticking=!0,s.Ticker.system.addOnce(this.tick,this,s.UPDATE_PRIORITY.UTILITY))):e&&e()},a.prototype.tick=function(){setTimeout(this.delayedTick,0)},a.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var t=this.queue[0],e=!1;if(t&&!t._destroyed)for(var i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}e||this.queue.shift()}if(this.queue.length)s.Ticker.system.addOnce(this.tick,this,s.UPDATE_PRIORITY.UTILITY);else{this.ticking=!1;var o=this.completes.slice(0);this.completes.length=0;for(var n=0,u=o.length;n<u;n++)o[n]()}},a.prototype.registerFindHook=function(t){return t&&this.addHooks.push(t),this},a.prototype.registerUploadHook=function(t){return t&&this.uploadHooks.push(t),this},a.prototype.add=function(t){for(var e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof o.Container)for(var r=t.children.length-1;r>=0;r--)this.add(t.children[r]);return this},a.prototype.destroy=function(){this.ticking&&s.Ticker.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null};var x=function(t){function e(e){t.call(this,e),this.uploadHookHelper=this.renderer,this.registerFindHook(T),this.registerUploadHook(g),this.registerUploadHook(m)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(a);function g(t,e){return e instanceof i.BaseTexture&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function m(t,e){if(!(e instanceof r.Graphics))return!1;var i=e.geometry;e.finishPoly(),i.updateBatches();for(var s=i.batches,o=0;o<s.length;o++){var n=s[o].style.texture;n&&g(t,n.baseTexture)}return i.batchable||t.geometry.bind(i,e._resolveDirectShader()),!0}function T(t,e){return t instanceof r.Graphics&&(e.push(t),!0)}var I=function(t){this.maxMilliseconds=t,this.frameStart=0};return I.prototype.beginFrame=function(){this.frameStart=Date.now()},I.prototype.allowedToUpload=function(){return Date.now()-this.frameStart<this.maxMilliseconds},t.BasePrepare=a,t.CountLimiter=u,t.Prepare=x,t.TimeLimiter=I,t}({},PIXI,PIXI,PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI.prepare,_pixi_prepare); | ||
//# sourceMappingURL=prepare.min.js.map |
/*! | ||
* @pixi/prepare - v5.1.5 | ||
* Compiled Tue, 24 Sep 2019 04:07:05 UTC | ||
* @pixi/prepare - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* | ||
@@ -402,6 +402,6 @@ * @pixi/prepare is licensed under the MIT License. | ||
/** | ||
* Built-in hook to find BaseTextures from Sprites. | ||
* Built-in hook to find BaseTextures from Texture. | ||
* | ||
* @private | ||
* @param {PIXI.DisplayObject} item - Display object to check | ||
* @param {PIXI.Texture} item - Display object to check | ||
* @param {Array<*>} queue - Collection of items to upload | ||
@@ -412,8 +412,9 @@ * @return {boolean} if a PIXI.Texture object was found. | ||
{ | ||
// Objects with textures, like Sprites/Text | ||
if (item instanceof BaseTexture) | ||
if (item.baseTexture instanceof BaseTexture) | ||
{ | ||
if (queue.indexOf(item) === -1) | ||
var texture = item.baseTexture; | ||
if (queue.indexOf(texture) === -1) | ||
{ | ||
queue.push(item); | ||
queue.push(texture); | ||
} | ||
@@ -587,3 +588,3 @@ | ||
* @param {PIXI.Renderer} renderer - instance of the webgl renderer | ||
* @param {PIXI.DisplayObject} item - Item to check | ||
* @param {PIXI.BaseTexture} item - Item to check | ||
* @return {boolean} If item was uploaded. | ||
@@ -619,15 +620,34 @@ */ | ||
{ | ||
if (item instanceof Graphics) | ||
if (!(item instanceof Graphics)) | ||
{ | ||
// if the item is not dirty and already has webgl data, then it got prepared or rendered | ||
// before now and we shouldn't waste time updating it again | ||
if (item.dirty || item.clearDirty || !item._webGL[renderer.plugins.graphics.CONTEXT_UID]) | ||
return false; | ||
} | ||
var geometry = item.geometry; | ||
// update dirty graphics to get batches | ||
item.finishPoly(); | ||
geometry.updateBatches(); | ||
var batches = geometry.batches; | ||
// upload all textures found in styles | ||
for (var i = 0; i < batches.length; i++) | ||
{ | ||
var ref = batches[i].style; | ||
var texture = ref.texture; | ||
if (texture) | ||
{ | ||
renderer.plugins.graphics.updateGraphics(item); | ||
uploadBaseTextures(renderer, texture.baseTexture); | ||
} | ||
} | ||
return true; | ||
// if its not batchable - update vao for particular shader | ||
if (!geometry.batchable) | ||
{ | ||
renderer.geometry.bind(geometry, item._resolveDirectShader()); | ||
} | ||
return false; | ||
return true; | ||
} | ||
@@ -634,0 +654,0 @@ |
/*! | ||
* @pixi/prepare - v5.1.5 | ||
* Compiled Tue, 24 Sep 2019 04:07:05 UTC | ||
* @pixi/prepare - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* | ||
@@ -406,6 +406,6 @@ * @pixi/prepare is licensed under the MIT License. | ||
/** | ||
* Built-in hook to find BaseTextures from Sprites. | ||
* Built-in hook to find BaseTextures from Texture. | ||
* | ||
* @private | ||
* @param {PIXI.DisplayObject} item - Display object to check | ||
* @param {PIXI.Texture} item - Display object to check | ||
* @param {Array<*>} queue - Collection of items to upload | ||
@@ -416,8 +416,9 @@ * @return {boolean} if a PIXI.Texture object was found. | ||
{ | ||
// Objects with textures, like Sprites/Text | ||
if (item instanceof core.BaseTexture) | ||
if (item.baseTexture instanceof core.BaseTexture) | ||
{ | ||
if (queue.indexOf(item) === -1) | ||
var texture = item.baseTexture; | ||
if (queue.indexOf(texture) === -1) | ||
{ | ||
queue.push(item); | ||
queue.push(texture); | ||
} | ||
@@ -591,3 +592,3 @@ | ||
* @param {PIXI.Renderer} renderer - instance of the webgl renderer | ||
* @param {PIXI.DisplayObject} item - Item to check | ||
* @param {PIXI.BaseTexture} item - Item to check | ||
* @return {boolean} If item was uploaded. | ||
@@ -623,15 +624,34 @@ */ | ||
{ | ||
if (item instanceof graphics.Graphics) | ||
if (!(item instanceof graphics.Graphics)) | ||
{ | ||
// if the item is not dirty and already has webgl data, then it got prepared or rendered | ||
// before now and we shouldn't waste time updating it again | ||
if (item.dirty || item.clearDirty || !item._webGL[renderer.plugins.graphics.CONTEXT_UID]) | ||
return false; | ||
} | ||
var geometry = item.geometry; | ||
// update dirty graphics to get batches | ||
item.finishPoly(); | ||
geometry.updateBatches(); | ||
var batches = geometry.batches; | ||
// upload all textures found in styles | ||
for (var i = 0; i < batches.length; i++) | ||
{ | ||
var ref = batches[i].style; | ||
var texture = ref.texture; | ||
if (texture) | ||
{ | ||
renderer.plugins.graphics.updateGraphics(item); | ||
uploadBaseTextures(renderer, texture.baseTexture); | ||
} | ||
} | ||
return true; | ||
// if its not batchable - update vao for particular shader | ||
if (!geometry.batchable) | ||
{ | ||
renderer.geometry.bind(geometry, item._resolveDirectShader()); | ||
} | ||
return false; | ||
return true; | ||
} | ||
@@ -638,0 +658,0 @@ |
{ | ||
"name": "@pixi/prepare", | ||
"version": "5.1.5", | ||
"version": "5.2.0", | ||
"main": "lib/prepare.js", | ||
@@ -28,10 +28,10 @@ "module": "lib/prepare.es.js", | ||
"dependencies": { | ||
"@pixi/core": "^5.1.5", | ||
"@pixi/display": "^5.1.3", | ||
"@pixi/graphics": "^5.1.5", | ||
"@pixi/settings": "^5.1.3", | ||
"@pixi/text": "^5.1.5", | ||
"@pixi/ticker": "^5.1.3" | ||
"@pixi/core": "^5.2.0", | ||
"@pixi/display": "^5.2.0", | ||
"@pixi/graphics": "^5.2.0", | ||
"@pixi/settings": "^5.2.0", | ||
"@pixi/text": "^5.2.0", | ||
"@pixi/ticker": "^5.2.0" | ||
}, | ||
"gitHead": "8cf3db88d06355cbabea64150cdb0774191e502c" | ||
"gitHead": "aaf96b460582b83a1fa73037ef2dd69dd9e84415" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
176025
2002
Updated@pixi/core@^5.2.0
Updated@pixi/display@^5.2.0
Updated@pixi/graphics@^5.2.0
Updated@pixi/settings@^5.2.0
Updated@pixi/text@^5.2.0
Updated@pixi/ticker@^5.2.0