@pixi/particle-container
Advanced tools
Comparing version 6.4.2 to 6.5.0-rc
/*! | ||
* @pixi/particle-container - v6.4.2 | ||
* Compiled Thu, 02 Jun 2022 15:39:26 UTC | ||
* @pixi/particle-container - v6.5.0-rc | ||
* Compiled Thu, 14 Jul 2022 18:30:46 UTC | ||
* | ||
@@ -13,14 +13,14 @@ * @pixi/particle-container is licensed under the MIT License. | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -60,4 +60,6 @@ /* global Reflect, Promise */ | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
{ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) | ||
{ t[p[i]] = s[p[i]]; } } } | ||
{ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
{ t[p[i]] = s[p[i]]; } | ||
} } | ||
return t; | ||
@@ -82,6 +84,7 @@ } | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -119,10 +122,15 @@ }); | ||
function __createBinding(o, m, k, k2) { | ||
if (k2 === undefined) { k2 = k; } | ||
o[k2] = m[k]; | ||
} | ||
function __exportStar(m, exports) { | ||
for (var p in m) { if (!exports.hasOwnProperty(p)) { exports[p] = m[p]; } } | ||
for (var p in m) { if (p !== "default" && !exports.hasOwnProperty(p)) { exports[p] = m[p]; } } | ||
} | ||
function __values(o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) { return m.call(o); } | ||
return { | ||
if (o && typeof o.length === "number") { return { | ||
next: function () { | ||
@@ -132,3 +140,4 @@ if (o && i >= o.length) { o = void 0; } | ||
} | ||
}; | ||
}; } | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
} | ||
@@ -161,2 +170,12 @@ | ||
function __spreadArrays() { | ||
var arguments$1 = arguments; | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) { s += arguments$1[i].length; } | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
{ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
{ r[k] = a[j]; } } | ||
return r; | ||
}; | ||
function __await(v) { | ||
@@ -209,2 +228,17 @@ return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
function __classPrivateFieldGet(receiver, privateMap) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to get private field on non-instance"); | ||
} | ||
return privateMap.get(receiver); | ||
} | ||
function __classPrivateFieldSet(receiver, privateMap, value) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to set private field on non-instance"); | ||
} | ||
privateMap.set(receiver, value); | ||
return value; | ||
} | ||
/** | ||
@@ -608,4 +642,5 @@ * The ParticleContainer class is a really fast version of the Container built solely for speed, | ||
var baseTexture = children[0]._texture.baseTexture; | ||
var premultiplied = baseTexture.alphaMode > 0; | ||
// if the uvs have not updated then no point rendering just yet! | ||
this.state.blendMode = utils.correctBlendMode(container.blendMode, baseTexture.alphaMode); | ||
this.state.blendMode = utils.correctBlendMode(container.blendMode, premultiplied); | ||
renderer.state.set(this.state); | ||
@@ -616,3 +651,3 @@ var gl = renderer.gl; | ||
this.shader.uniforms.translationMatrix = m.toArray(true); | ||
this.shader.uniforms.uColor = utils.premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); | ||
this.shader.uniforms.uColor = utils.premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, premultiplied); | ||
this.shader.uniforms.uSampler = baseTexture; | ||
@@ -672,3 +707,3 @@ this.renderer.shader.bind(this.shader); | ||
* Uploads the vertices. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -719,3 +754,3 @@ * @param amount - the amount of children that will have their vertices uploaded | ||
* Uploads the position. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -743,3 +778,3 @@ * @param amount - the amount of children that will have their positions uploaded | ||
* Uploads the rotation. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -763,3 +798,3 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
* Uploads the UVs. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -801,3 +836,3 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
* Uploads the tint. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -833,2 +868,7 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
}; | ||
/** @ignore */ | ||
ParticleRenderer.extension = { | ||
name: 'particle', | ||
type: core.ExtensionType.RendererPlugin, | ||
}; | ||
return ParticleRenderer; | ||
@@ -835,0 +875,0 @@ }(core.ObjectRenderer)); |
/*! | ||
* @pixi/particle-container - v6.4.2 | ||
* Compiled Thu, 02 Jun 2022 15:39:26 UTC | ||
* @pixi/particle-container - v6.5.0-rc | ||
* Compiled Thu, 14 Jul 2022 18:30:46 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/particle-container is licensed under the MIT License. | ||
*/ | ||
this.PIXI=this.PIXI||{};var _pixi_particle_container=function(t,e,i,r,o,a){"use strict";var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)};function s(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var u=function(t){function i(i,r,o,a){void 0===i&&(i=1500),void 0===o&&(o=16384),void 0===a&&(a=!1);var n=t.call(this)||this;return o>16384&&(o=16384),n._properties=[!1,!0,!1,!1,!1],n._maxSize=i,n._batchSize=o,n._buffers=null,n._bufferUpdateIDs=[],n._updateID=0,n.interactiveChildren=!1,n.blendMode=e.BLEND_MODES.NORMAL,n.autoResize=a,n.roundPixels=!0,n.baseTexture=null,n.setProperties(r),n._tint=0,n.tintRgb=new Float32Array(4),n.tint=16777215,n}return s(i,t),i.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},i.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,r.hex2rgb(t,this.tintRgb)},enumerable:!1,configurable:!0}),i.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(function(){return e.onChildrenChange(0)}))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},i.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID},i.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},i.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},i}(i.Container),h=function(){function t(t,i,r){this.geometry=new o.Geometry,this.indexBuffer=null,this.size=r,this.dynamicProperties=[],this.staticProperties=[];for(var a=0;a<t.length;++a){var n=t[a];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||e.TYPES.FLOAT,offset:n.offset},i[a]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return t.prototype.initBuffers=function(){var t=this.geometry,i=0;this.indexBuffer=new o.Buffer(r.createIndicesForQuads(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(var a=0;a<this.dynamicProperties.length;++a){(h=this.dynamicProperties[a]).offset=i,i+=h.size,this.dynamicStride+=h.size}var n=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(n),this.dynamicDataUint32=new Uint32Array(n),this.dynamicBuffer=new o.Buffer(this.dynamicData,!1,!1);var s=0;this.staticStride=0;for(a=0;a<this.staticProperties.length;++a){(h=this.staticProperties[a]).offset=s,s+=h.size,this.staticStride+=h.size}var u=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(u),this.staticDataUint32=new Uint32Array(u),this.staticBuffer=new o.Buffer(this.staticData,!0,!1);for(a=0;a<this.dynamicProperties.length;++a){var h=this.dynamicProperties[a];t.addAttribute(h.attributeName,this.dynamicBuffer,0,h.type===e.TYPES.UNSIGNED_BYTE,h.type,4*this.dynamicStride,4*h.offset)}for(a=0;a<this.staticProperties.length;++a){h=this.staticProperties[a];t.addAttribute(h.attributeName,this.staticBuffer,0,h.type===e.TYPES.UNSIGNED_BYTE,h.type,4*this.staticStride,4*h.offset)}},t.prototype.uploadDynamic=function(t,i,r){for(var o=0;o<this.dynamicProperties.length;o++){var a=this.dynamicProperties[o];a.uploadFunction(t,i,r,a.type===e.TYPES.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,a.offset)}this.dynamicBuffer._updateID++},t.prototype.uploadStatic=function(t,i,r){for(var o=0;o<this.staticProperties.length;o++){var a=this.staticProperties[o];a.uploadFunction(t,i,r,a.type===e.TYPES.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,a.offset)}this.staticBuffer._updateID++},t.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},t}(),p=function(t){function i(i){var r=t.call(this,i)||this;return r.shader=null,r.properties=null,r.tempMatrix=new a.Matrix,r.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:r.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:r.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:r.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:r.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:e.TYPES.UNSIGNED_BYTE,uploadFunction:r.uploadTint,offset:0}],r.shader=o.Shader.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),r.state=o.State.for2d(),r}return s(i,t),i.prototype.render=function(t){var e=t.children,i=t._maxSize,o=t._batchSize,a=this.renderer,n=e.length;if(0!==n){n>i&&!t.autoResize&&(n=i);var s=t._buffers;s||(s=t._buffers=this.generateBuffers(t));var u=e[0]._texture.baseTexture;this.state.blendMode=r.correctBlendMode(t.blendMode,u.alphaMode),a.state.set(this.state);var h=a.gl,p=t.worldTransform.copyTo(this.tempMatrix);p.prepend(a.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=p.toArray(!0),this.shader.uniforms.uColor=r.premultiplyRgba(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,u.alphaMode),this.shader.uniforms.uSampler=u,this.renderer.shader.bind(this.shader);for(var c=!1,f=0,l=0;f<n;f+=o,l+=1){var d=n-f;d>o&&(d=o),l>=s.length&&s.push(this._generateOneMoreBuffer(t));var y=s[l];y.uploadDynamic(e,f,d);var v=t._bufferUpdateIDs[l]||0;(c=c||y._updateID<v)&&(y._updateID=t._updateID,y.uploadStatic(e,f,d)),a.geometry.bind(y.geometry),h.drawElements(h.TRIANGLES,6*d,h.UNSIGNED_SHORT,0)}}},i.prototype.generateBuffers=function(t){for(var e=[],i=t._maxSize,r=t._batchSize,o=t._properties,a=0;a<i;a+=r)e.push(new h(this.properties,o,r));return e},i.prototype._generateOneMoreBuffer=function(t){var e=t._batchSize,i=t._properties;return new h(this.properties,i,e)},i.prototype.uploadVertices=function(t,e,i,r,o,a){for(var n=0,s=0,u=0,h=0,p=0;p<i;++p){var c=t[e+p],f=c._texture,l=c.scale.x,d=c.scale.y,y=f.trim,v=f.orig;y?(n=(s=y.x-c.anchor.x*v.width)+y.width,u=(h=y.y-c.anchor.y*v.height)+y.height):(n=v.width*(1-c.anchor.x),s=v.width*-c.anchor.x,u=v.height*(1-c.anchor.y),h=v.height*-c.anchor.y),r[a]=s*l,r[a+1]=h*d,r[a+o]=n*l,r[a+o+1]=h*d,r[a+2*o]=n*l,r[a+2*o+1]=u*d,r[a+3*o]=s*l,r[a+3*o+1]=u*d,a+=4*o}},i.prototype.uploadPosition=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].position;r[a]=s.x,r[a+1]=s.y,r[a+o]=s.x,r[a+o+1]=s.y,r[a+2*o]=s.x,r[a+2*o+1]=s.y,r[a+3*o]=s.x,r[a+3*o+1]=s.y,a+=4*o}},i.prototype.uploadRotation=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].rotation;r[a]=s,r[a+o]=s,r[a+2*o]=s,r[a+3*o]=s,a+=4*o}},i.prototype.uploadUvs=function(t,e,i,r,o,a){for(var n=0;n<i;++n){var s=t[e+n]._texture._uvs;s?(r[a]=s.x0,r[a+1]=s.y0,r[a+o]=s.x1,r[a+o+1]=s.y1,r[a+2*o]=s.x2,r[a+2*o+1]=s.y2,r[a+3*o]=s.x3,r[a+3*o+1]=s.y3,a+=4*o):(r[a]=0,r[a+1]=0,r[a+o]=0,r[a+o+1]=0,r[a+2*o]=0,r[a+2*o+1]=0,r[a+3*o]=0,r[a+3*o+1]=0,a+=4*o)}},i.prototype.uploadTint=function(t,e,i,o,a,n){for(var s=0;s<i;++s){var u=t[e+s],h=u._texture.baseTexture.alphaMode>0,p=u.alpha,c=p<1&&h?r.premultiplyTint(u._tintRGB,p):u._tintRGB+(255*p<<24);o[n]=c,o[n+a]=c,o[n+2*a]=c,o[n+3*a]=c,n+=4*a}},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},i}(o.ObjectRenderer);return t.ParticleContainer=u,t.ParticleRenderer=p,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_particle_container); | ||
this.PIXI=this.PIXI||{};var _pixi_particle_container=function(t,e,i,r,o,a){"use strict";var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)};function s(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var u=function(t){function i(i,r,o,a){void 0===i&&(i=1500),void 0===o&&(o=16384),void 0===a&&(a=!1);var n=t.call(this)||this;return o>16384&&(o=16384),n._properties=[!1,!0,!1,!1,!1],n._maxSize=i,n._batchSize=o,n._buffers=null,n._bufferUpdateIDs=[],n._updateID=0,n.interactiveChildren=!1,n.blendMode=e.BLEND_MODES.NORMAL,n.autoResize=a,n.roundPixels=!0,n.baseTexture=null,n.setProperties(r),n._tint=0,n.tintRgb=new Float32Array(4),n.tint=16777215,n}return s(i,t),i.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},i.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,r.hex2rgb(t,this.tintRgb)},enumerable:!1,configurable:!0}),i.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(function(){return e.onChildrenChange(0)}))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},i.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID},i.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},i.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},i}(i.Container),h=function(){function t(t,i,r){this.geometry=new o.Geometry,this.indexBuffer=null,this.size=r,this.dynamicProperties=[],this.staticProperties=[];for(var a=0;a<t.length;++a){var n=t[a];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||e.TYPES.FLOAT,offset:n.offset},i[a]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return t.prototype.initBuffers=function(){var t=this.geometry,i=0;this.indexBuffer=new o.Buffer(r.createIndicesForQuads(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(var a=0;a<this.dynamicProperties.length;++a){(h=this.dynamicProperties[a]).offset=i,i+=h.size,this.dynamicStride+=h.size}var n=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(n),this.dynamicDataUint32=new Uint32Array(n),this.dynamicBuffer=new o.Buffer(this.dynamicData,!1,!1);var s=0;this.staticStride=0;for(a=0;a<this.staticProperties.length;++a){(h=this.staticProperties[a]).offset=s,s+=h.size,this.staticStride+=h.size}var u=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(u),this.staticDataUint32=new Uint32Array(u),this.staticBuffer=new o.Buffer(this.staticData,!0,!1);for(a=0;a<this.dynamicProperties.length;++a){var h=this.dynamicProperties[a];t.addAttribute(h.attributeName,this.dynamicBuffer,0,h.type===e.TYPES.UNSIGNED_BYTE,h.type,4*this.dynamicStride,4*h.offset)}for(a=0;a<this.staticProperties.length;++a){h=this.staticProperties[a];t.addAttribute(h.attributeName,this.staticBuffer,0,h.type===e.TYPES.UNSIGNED_BYTE,h.type,4*this.staticStride,4*h.offset)}},t.prototype.uploadDynamic=function(t,i,r){for(var o=0;o<this.dynamicProperties.length;o++){var a=this.dynamicProperties[o];a.uploadFunction(t,i,r,a.type===e.TYPES.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,a.offset)}this.dynamicBuffer._updateID++},t.prototype.uploadStatic=function(t,i,r){for(var o=0;o<this.staticProperties.length;o++){var a=this.staticProperties[o];a.uploadFunction(t,i,r,a.type===e.TYPES.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,a.offset)}this.staticBuffer._updateID++},t.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},t}(),p=function(t){function i(i){var r=t.call(this,i)||this;return r.shader=null,r.properties=null,r.tempMatrix=new a.Matrix,r.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:r.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:r.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:r.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:r.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:e.TYPES.UNSIGNED_BYTE,uploadFunction:r.uploadTint,offset:0}],r.shader=o.Shader.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),r.state=o.State.for2d(),r}return s(i,t),i.prototype.render=function(t){var e=t.children,i=t._maxSize,o=t._batchSize,a=this.renderer,n=e.length;if(0!==n){n>i&&!t.autoResize&&(n=i);var s=t._buffers;s||(s=t._buffers=this.generateBuffers(t));var u=e[0]._texture.baseTexture,h=u.alphaMode>0;this.state.blendMode=r.correctBlendMode(t.blendMode,h),a.state.set(this.state);var p=a.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(a.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=r.premultiplyRgba(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,h),this.shader.uniforms.uSampler=u,this.renderer.shader.bind(this.shader);for(var f=!1,l=0,d=0;l<n;l+=o,d+=1){var y=n-l;y>o&&(y=o),d>=s.length&&s.push(this._generateOneMoreBuffer(t));var v=s[d];v.uploadDynamic(e,l,y);var _=t._bufferUpdateIDs[d]||0;(f=f||v._updateID<_)&&(v._updateID=t._updateID,v.uploadStatic(e,l,y)),a.geometry.bind(v.geometry),p.drawElements(p.TRIANGLES,6*y,p.UNSIGNED_SHORT,0)}}},i.prototype.generateBuffers=function(t){for(var e=[],i=t._maxSize,r=t._batchSize,o=t._properties,a=0;a<i;a+=r)e.push(new h(this.properties,o,r));return e},i.prototype._generateOneMoreBuffer=function(t){var e=t._batchSize,i=t._properties;return new h(this.properties,i,e)},i.prototype.uploadVertices=function(t,e,i,r,o,a){for(var n=0,s=0,u=0,h=0,p=0;p<i;++p){var c=t[e+p],f=c._texture,l=c.scale.x,d=c.scale.y,y=f.trim,v=f.orig;y?(n=(s=y.x-c.anchor.x*v.width)+y.width,u=(h=y.y-c.anchor.y*v.height)+y.height):(n=v.width*(1-c.anchor.x),s=v.width*-c.anchor.x,u=v.height*(1-c.anchor.y),h=v.height*-c.anchor.y),r[a]=s*l,r[a+1]=h*d,r[a+o]=n*l,r[a+o+1]=h*d,r[a+2*o]=n*l,r[a+2*o+1]=u*d,r[a+3*o]=s*l,r[a+3*o+1]=u*d,a+=4*o}},i.prototype.uploadPosition=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].position;r[a]=s.x,r[a+1]=s.y,r[a+o]=s.x,r[a+o+1]=s.y,r[a+2*o]=s.x,r[a+2*o+1]=s.y,r[a+3*o]=s.x,r[a+3*o+1]=s.y,a+=4*o}},i.prototype.uploadRotation=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].rotation;r[a]=s,r[a+o]=s,r[a+2*o]=s,r[a+3*o]=s,a+=4*o}},i.prototype.uploadUvs=function(t,e,i,r,o,a){for(var n=0;n<i;++n){var s=t[e+n]._texture._uvs;s?(r[a]=s.x0,r[a+1]=s.y0,r[a+o]=s.x1,r[a+o+1]=s.y1,r[a+2*o]=s.x2,r[a+2*o+1]=s.y2,r[a+3*o]=s.x3,r[a+3*o+1]=s.y3,a+=4*o):(r[a]=0,r[a+1]=0,r[a+o]=0,r[a+o+1]=0,r[a+2*o]=0,r[a+2*o+1]=0,r[a+3*o]=0,r[a+3*o+1]=0,a+=4*o)}},i.prototype.uploadTint=function(t,e,i,o,a,n){for(var s=0;s<i;++s){var u=t[e+s],h=u._texture.baseTexture.alphaMode>0,p=u.alpha,c=p<1&&h?r.premultiplyTint(u._tintRGB,p):u._tintRGB+(255*p<<24);o[n]=c,o[n+a]=c,o[n+2*a]=c,o[n+3*a]=c,n+=4*a}},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},i.extension={name:"particle",type:o.ExtensionType.RendererPlugin},i}(o.ObjectRenderer);return t.ParticleContainer=u,t.ParticleRenderer=p,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_particle_container); | ||
//# sourceMappingURL=particle-container.min.js.map |
/*! | ||
* @pixi/particle-container - v6.4.2 | ||
* Compiled Thu, 02 Jun 2022 15:39:26 UTC | ||
* @pixi/particle-container - v6.5.0-rc | ||
* Compiled Thu, 14 Jul 2022 18:30:46 UTC | ||
* | ||
@@ -19,14 +19,14 @@ * @pixi/particle-container is licensed under the MIT License. | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -446,4 +446,5 @@ /* global Reflect, Promise */ | ||
var baseTexture = children[0]._texture.baseTexture; | ||
var premultiplied = baseTexture.alphaMode > 0; | ||
// if the uvs have not updated then no point rendering just yet! | ||
this.state.blendMode = utils.correctBlendMode(container.blendMode, baseTexture.alphaMode); | ||
this.state.blendMode = utils.correctBlendMode(container.blendMode, premultiplied); | ||
renderer.state.set(this.state); | ||
@@ -454,3 +455,3 @@ var gl = renderer.gl; | ||
this.shader.uniforms.translationMatrix = m.toArray(true); | ||
this.shader.uniforms.uColor = utils.premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); | ||
this.shader.uniforms.uColor = utils.premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, premultiplied); | ||
this.shader.uniforms.uSampler = baseTexture; | ||
@@ -510,3 +511,3 @@ this.renderer.shader.bind(this.shader); | ||
* Uploads the vertices. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -557,3 +558,3 @@ * @param amount - the amount of children that will have their vertices uploaded | ||
* Uploads the position. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -581,3 +582,3 @@ * @param amount - the amount of children that will have their positions uploaded | ||
* Uploads the rotation. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -601,3 +602,3 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
* Uploads the UVs. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -639,3 +640,3 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
* Uploads the tint. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -671,2 +672,7 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
}; | ||
/** @ignore */ | ||
ParticleRenderer.extension = { | ||
name: 'particle', | ||
type: core.ExtensionType.RendererPlugin, | ||
}; | ||
return ParticleRenderer; | ||
@@ -673,0 +679,0 @@ }(core.ObjectRenderer)); |
/*! | ||
* @pixi/particle-container - v6.4.2 | ||
* Compiled Thu, 02 Jun 2022 15:39:26 UTC | ||
* @pixi/particle-container - v6.5.0-rc | ||
* Compiled Thu, 14 Jul 2022 18:30:46 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/particle-container is licensed under the MIT License. | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@pixi/constants"),e=require("@pixi/display"),i=require("@pixi/utils"),r=require("@pixi/core"),o=require("@pixi/math"),a=function(t,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},a(t,e)};function n(t,e){function i(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var s=function(e){function r(i,r,o,a){void 0===i&&(i=1500),void 0===o&&(o=16384),void 0===a&&(a=!1);var n=e.call(this)||this;return o>16384&&(o=16384),n._properties=[!1,!0,!1,!1,!1],n._maxSize=i,n._batchSize=o,n._buffers=null,n._bufferUpdateIDs=[],n._updateID=0,n.interactiveChildren=!1,n.blendMode=t.BLEND_MODES.NORMAL,n.autoResize=a,n.roundPixels=!0,n.baseTexture=null,n.setProperties(r),n._tint=0,n.tintRgb=new Float32Array(4),n.tint=16777215,n}return n(r,e),r.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},r.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(r.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,i.hex2rgb(t,this.tintRgb)},enumerable:!1,configurable:!0}),r.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(function(){return e.onChildrenChange(0)}))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},r.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID},r.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},r.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},r}(e.Container),u=function(){function e(e,i,o){this.geometry=new r.Geometry,this.indexBuffer=null,this.size=o,this.dynamicProperties=[],this.staticProperties=[];for(var a=0;a<e.length;++a){var n=e[a];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||t.TYPES.FLOAT,offset:n.offset},i[a]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return e.prototype.initBuffers=function(){var e=this.geometry,o=0;this.indexBuffer=new r.Buffer(i.createIndicesForQuads(this.size),!0,!0),e.addIndex(this.indexBuffer),this.dynamicStride=0;for(var a=0;a<this.dynamicProperties.length;++a){(p=this.dynamicProperties[a]).offset=o,o+=p.size,this.dynamicStride+=p.size}var n=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(n),this.dynamicDataUint32=new Uint32Array(n),this.dynamicBuffer=new r.Buffer(this.dynamicData,!1,!1);var s=0;this.staticStride=0;for(a=0;a<this.staticProperties.length;++a){(p=this.staticProperties[a]).offset=s,s+=p.size,this.staticStride+=p.size}var u=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(u),this.staticDataUint32=new Uint32Array(u),this.staticBuffer=new r.Buffer(this.staticData,!0,!1);for(a=0;a<this.dynamicProperties.length;++a){var p=this.dynamicProperties[a];e.addAttribute(p.attributeName,this.dynamicBuffer,0,p.type===t.TYPES.UNSIGNED_BYTE,p.type,4*this.dynamicStride,4*p.offset)}for(a=0;a<this.staticProperties.length;++a){p=this.staticProperties[a];e.addAttribute(p.attributeName,this.staticBuffer,0,p.type===t.TYPES.UNSIGNED_BYTE,p.type,4*this.staticStride,4*p.offset)}},e.prototype.uploadDynamic=function(e,i,r){for(var o=0;o<this.dynamicProperties.length;o++){var a=this.dynamicProperties[o];a.uploadFunction(e,i,r,a.type===t.TYPES.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,a.offset)}this.dynamicBuffer._updateID++},e.prototype.uploadStatic=function(e,i,r){for(var o=0;o<this.staticProperties.length;o++){var a=this.staticProperties[o];a.uploadFunction(e,i,r,a.type===t.TYPES.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,a.offset)}this.staticBuffer._updateID++},e.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},e}(),p=function(e){function a(i){var a=e.call(this,i)||this;return a.shader=null,a.properties=null,a.tempMatrix=new o.Matrix,a.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:a.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:a.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:a.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:a.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:t.TYPES.UNSIGNED_BYTE,uploadFunction:a.uploadTint,offset:0}],a.shader=r.Shader.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),a.state=r.State.for2d(),a}return n(a,e),a.prototype.render=function(t){var e=t.children,r=t._maxSize,o=t._batchSize,a=this.renderer,n=e.length;if(0!==n){n>r&&!t.autoResize&&(n=r);var s=t._buffers;s||(s=t._buffers=this.generateBuffers(t));var u=e[0]._texture.baseTexture;this.state.blendMode=i.correctBlendMode(t.blendMode,u.alphaMode),a.state.set(this.state);var p=a.gl,h=t.worldTransform.copyTo(this.tempMatrix);h.prepend(a.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=h.toArray(!0),this.shader.uniforms.uColor=i.premultiplyRgba(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,u.alphaMode),this.shader.uniforms.uSampler=u,this.renderer.shader.bind(this.shader);for(var f=!1,d=0,l=0;d<n;d+=o,l+=1){var c=n-d;c>o&&(c=o),l>=s.length&&s.push(this._generateOneMoreBuffer(t));var y=s[l];y.uploadDynamic(e,d,c);var v=t._bufferUpdateIDs[l]||0;(f=f||y._updateID<v)&&(y._updateID=t._updateID,y.uploadStatic(e,d,c)),a.geometry.bind(y.geometry),p.drawElements(p.TRIANGLES,6*c,p.UNSIGNED_SHORT,0)}}},a.prototype.generateBuffers=function(t){for(var e=[],i=t._maxSize,r=t._batchSize,o=t._properties,a=0;a<i;a+=r)e.push(new u(this.properties,o,r));return e},a.prototype._generateOneMoreBuffer=function(t){var e=t._batchSize,i=t._properties;return new u(this.properties,i,e)},a.prototype.uploadVertices=function(t,e,i,r,o,a){for(var n=0,s=0,u=0,p=0,h=0;h<i;++h){var f=t[e+h],d=f._texture,l=f.scale.x,c=f.scale.y,y=d.trim,v=d.orig;y?(n=(s=y.x-f.anchor.x*v.width)+y.width,u=(p=y.y-f.anchor.y*v.height)+y.height):(n=v.width*(1-f.anchor.x),s=v.width*-f.anchor.x,u=v.height*(1-f.anchor.y),p=v.height*-f.anchor.y),r[a]=s*l,r[a+1]=p*c,r[a+o]=n*l,r[a+o+1]=p*c,r[a+2*o]=n*l,r[a+2*o+1]=u*c,r[a+3*o]=s*l,r[a+3*o+1]=u*c,a+=4*o}},a.prototype.uploadPosition=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].position;r[a]=s.x,r[a+1]=s.y,r[a+o]=s.x,r[a+o+1]=s.y,r[a+2*o]=s.x,r[a+2*o+1]=s.y,r[a+3*o]=s.x,r[a+3*o+1]=s.y,a+=4*o}},a.prototype.uploadRotation=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].rotation;r[a]=s,r[a+o]=s,r[a+2*o]=s,r[a+3*o]=s,a+=4*o}},a.prototype.uploadUvs=function(t,e,i,r,o,a){for(var n=0;n<i;++n){var s=t[e+n]._texture._uvs;s?(r[a]=s.x0,r[a+1]=s.y0,r[a+o]=s.x1,r[a+o+1]=s.y1,r[a+2*o]=s.x2,r[a+2*o+1]=s.y2,r[a+3*o]=s.x3,r[a+3*o+1]=s.y3,a+=4*o):(r[a]=0,r[a+1]=0,r[a+o]=0,r[a+o+1]=0,r[a+2*o]=0,r[a+2*o+1]=0,r[a+3*o]=0,r[a+3*o+1]=0,a+=4*o)}},a.prototype.uploadTint=function(t,e,r,o,a,n){for(var s=0;s<r;++s){var u=t[e+s],p=u._texture.baseTexture.alphaMode>0,h=u.alpha,f=h<1&&p?i.premultiplyTint(u._tintRGB,h):u._tintRGB+(255*h<<24);o[n]=f,o[n+a]=f,o[n+2*a]=f,o[n+3*a]=f,n+=4*a}},a.prototype.destroy=function(){e.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},a}(r.ObjectRenderer);exports.ParticleContainer=s,exports.ParticleRenderer=p; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@pixi/constants"),e=require("@pixi/display"),i=require("@pixi/utils"),r=require("@pixi/core"),o=require("@pixi/math"),a=function(t,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},a(t,e)};function n(t,e){function i(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var s=function(e){function r(i,r,o,a){void 0===i&&(i=1500),void 0===o&&(o=16384),void 0===a&&(a=!1);var n=e.call(this)||this;return o>16384&&(o=16384),n._properties=[!1,!0,!1,!1,!1],n._maxSize=i,n._batchSize=o,n._buffers=null,n._bufferUpdateIDs=[],n._updateID=0,n.interactiveChildren=!1,n.blendMode=t.BLEND_MODES.NORMAL,n.autoResize=a,n.roundPixels=!0,n.baseTexture=null,n.setProperties(r),n._tint=0,n.tintRgb=new Float32Array(4),n.tint=16777215,n}return n(r,e),r.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},r.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(r.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,i.hex2rgb(t,this.tintRgb)},enumerable:!1,configurable:!0}),r.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(function(){return e.onChildrenChange(0)}))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},r.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID},r.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},r.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},r}(e.Container),u=function(){function e(e,i,o){this.geometry=new r.Geometry,this.indexBuffer=null,this.size=o,this.dynamicProperties=[],this.staticProperties=[];for(var a=0;a<e.length;++a){var n=e[a];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||t.TYPES.FLOAT,offset:n.offset},i[a]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return e.prototype.initBuffers=function(){var e=this.geometry,o=0;this.indexBuffer=new r.Buffer(i.createIndicesForQuads(this.size),!0,!0),e.addIndex(this.indexBuffer),this.dynamicStride=0;for(var a=0;a<this.dynamicProperties.length;++a){(p=this.dynamicProperties[a]).offset=o,o+=p.size,this.dynamicStride+=p.size}var n=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(n),this.dynamicDataUint32=new Uint32Array(n),this.dynamicBuffer=new r.Buffer(this.dynamicData,!1,!1);var s=0;this.staticStride=0;for(a=0;a<this.staticProperties.length;++a){(p=this.staticProperties[a]).offset=s,s+=p.size,this.staticStride+=p.size}var u=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(u),this.staticDataUint32=new Uint32Array(u),this.staticBuffer=new r.Buffer(this.staticData,!0,!1);for(a=0;a<this.dynamicProperties.length;++a){var p=this.dynamicProperties[a];e.addAttribute(p.attributeName,this.dynamicBuffer,0,p.type===t.TYPES.UNSIGNED_BYTE,p.type,4*this.dynamicStride,4*p.offset)}for(a=0;a<this.staticProperties.length;++a){p=this.staticProperties[a];e.addAttribute(p.attributeName,this.staticBuffer,0,p.type===t.TYPES.UNSIGNED_BYTE,p.type,4*this.staticStride,4*p.offset)}},e.prototype.uploadDynamic=function(e,i,r){for(var o=0;o<this.dynamicProperties.length;o++){var a=this.dynamicProperties[o];a.uploadFunction(e,i,r,a.type===t.TYPES.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,a.offset)}this.dynamicBuffer._updateID++},e.prototype.uploadStatic=function(e,i,r){for(var o=0;o<this.staticProperties.length;o++){var a=this.staticProperties[o];a.uploadFunction(e,i,r,a.type===t.TYPES.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,a.offset)}this.staticBuffer._updateID++},e.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},e}(),p=function(e){function a(i){var a=e.call(this,i)||this;return a.shader=null,a.properties=null,a.tempMatrix=new o.Matrix,a.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:a.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:a.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:a.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:a.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:t.TYPES.UNSIGNED_BYTE,uploadFunction:a.uploadTint,offset:0}],a.shader=r.Shader.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),a.state=r.State.for2d(),a}return n(a,e),a.prototype.render=function(t){var e=t.children,r=t._maxSize,o=t._batchSize,a=this.renderer,n=e.length;if(0!==n){n>r&&!t.autoResize&&(n=r);var s=t._buffers;s||(s=t._buffers=this.generateBuffers(t));var u=e[0]._texture.baseTexture,p=u.alphaMode>0;this.state.blendMode=i.correctBlendMode(t.blendMode,p),a.state.set(this.state);var h=a.gl,f=t.worldTransform.copyTo(this.tempMatrix);f.prepend(a.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=f.toArray(!0),this.shader.uniforms.uColor=i.premultiplyRgba(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,p),this.shader.uniforms.uSampler=u,this.renderer.shader.bind(this.shader);for(var d=!1,l=0,c=0;l<n;l+=o,c+=1){var y=n-l;y>o&&(y=o),c>=s.length&&s.push(this._generateOneMoreBuffer(t));var v=s[c];v.uploadDynamic(e,l,y);var m=t._bufferUpdateIDs[c]||0;(d=d||v._updateID<m)&&(v._updateID=t._updateID,v.uploadStatic(e,l,y)),a.geometry.bind(v.geometry),h.drawElements(h.TRIANGLES,6*y,h.UNSIGNED_SHORT,0)}}},a.prototype.generateBuffers=function(t){for(var e=[],i=t._maxSize,r=t._batchSize,o=t._properties,a=0;a<i;a+=r)e.push(new u(this.properties,o,r));return e},a.prototype._generateOneMoreBuffer=function(t){var e=t._batchSize,i=t._properties;return new u(this.properties,i,e)},a.prototype.uploadVertices=function(t,e,i,r,o,a){for(var n=0,s=0,u=0,p=0,h=0;h<i;++h){var f=t[e+h],d=f._texture,l=f.scale.x,c=f.scale.y,y=d.trim,v=d.orig;y?(n=(s=y.x-f.anchor.x*v.width)+y.width,u=(p=y.y-f.anchor.y*v.height)+y.height):(n=v.width*(1-f.anchor.x),s=v.width*-f.anchor.x,u=v.height*(1-f.anchor.y),p=v.height*-f.anchor.y),r[a]=s*l,r[a+1]=p*c,r[a+o]=n*l,r[a+o+1]=p*c,r[a+2*o]=n*l,r[a+2*o+1]=u*c,r[a+3*o]=s*l,r[a+3*o+1]=u*c,a+=4*o}},a.prototype.uploadPosition=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].position;r[a]=s.x,r[a+1]=s.y,r[a+o]=s.x,r[a+o+1]=s.y,r[a+2*o]=s.x,r[a+2*o+1]=s.y,r[a+3*o]=s.x,r[a+3*o+1]=s.y,a+=4*o}},a.prototype.uploadRotation=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].rotation;r[a]=s,r[a+o]=s,r[a+2*o]=s,r[a+3*o]=s,a+=4*o}},a.prototype.uploadUvs=function(t,e,i,r,o,a){for(var n=0;n<i;++n){var s=t[e+n]._texture._uvs;s?(r[a]=s.x0,r[a+1]=s.y0,r[a+o]=s.x1,r[a+o+1]=s.y1,r[a+2*o]=s.x2,r[a+2*o+1]=s.y2,r[a+3*o]=s.x3,r[a+3*o+1]=s.y3,a+=4*o):(r[a]=0,r[a+1]=0,r[a+o]=0,r[a+o+1]=0,r[a+2*o]=0,r[a+2*o+1]=0,r[a+3*o]=0,r[a+3*o+1]=0,a+=4*o)}},a.prototype.uploadTint=function(t,e,r,o,a,n){for(var s=0;s<r;++s){var u=t[e+s],p=u._texture.baseTexture.alphaMode>0,h=u.alpha,f=h<1&&p?i.premultiplyTint(u._tintRGB,h):u._tintRGB+(255*h<<24);o[n]=f,o[n+a]=f,o[n+2*a]=f,o[n+3*a]=f,n+=4*a}},a.prototype.destroy=function(){e.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},a.extension={name:"particle",type:r.ExtensionType.RendererPlugin},a}(r.ObjectRenderer);exports.ParticleContainer=s,exports.ParticleRenderer=p; | ||
//# sourceMappingURL=particle-container.min.js.map |
/*! | ||
* @pixi/particle-container - v6.4.2 | ||
* Compiled Thu, 02 Jun 2022 15:39:26 UTC | ||
* @pixi/particle-container - v6.5.0-rc | ||
* Compiled Thu, 14 Jul 2022 18:30:46 UTC | ||
* | ||
@@ -11,18 +11,18 @@ * @pixi/particle-container is licensed under the MIT License. | ||
import { hex2rgb, createIndicesForQuads, correctBlendMode, premultiplyRgba, premultiplyTint } from '@pixi/utils'; | ||
import { Geometry, Buffer, ObjectRenderer, Shader, State } from '@pixi/core'; | ||
import { Geometry, Buffer, ExtensionType, ObjectRenderer, Shader, State } from '@pixi/core'; | ||
import { Matrix } from '@pixi/math'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -442,4 +442,5 @@ /* global Reflect, Promise */ | ||
var baseTexture = children[0]._texture.baseTexture; | ||
var premultiplied = baseTexture.alphaMode > 0; | ||
// if the uvs have not updated then no point rendering just yet! | ||
this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode); | ||
this.state.blendMode = correctBlendMode(container.blendMode, premultiplied); | ||
renderer.state.set(this.state); | ||
@@ -450,3 +451,3 @@ var gl = renderer.gl; | ||
this.shader.uniforms.translationMatrix = m.toArray(true); | ||
this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); | ||
this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, premultiplied); | ||
this.shader.uniforms.uSampler = baseTexture; | ||
@@ -506,3 +507,3 @@ this.renderer.shader.bind(this.shader); | ||
* Uploads the vertices. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -553,3 +554,3 @@ * @param amount - the amount of children that will have their vertices uploaded | ||
* Uploads the position. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -577,3 +578,3 @@ * @param amount - the amount of children that will have their positions uploaded | ||
* Uploads the rotation. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -597,3 +598,3 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
* Uploads the UVs. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -635,3 +636,3 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
* Uploads the tint. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -667,2 +668,7 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
}; | ||
/** @ignore */ | ||
ParticleRenderer.extension = { | ||
name: 'particle', | ||
type: ExtensionType.RendererPlugin, | ||
}; | ||
return ParticleRenderer; | ||
@@ -669,0 +675,0 @@ }(ObjectRenderer)); |
/*! | ||
* @pixi/particle-container - v6.4.2 | ||
* Compiled Thu, 02 Jun 2022 15:39:26 UTC | ||
* @pixi/particle-container - v6.5.0-rc | ||
* Compiled Thu, 14 Jul 2022 18:30:46 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/particle-container is licensed under the MIT License. | ||
*/ | ||
import{BLEND_MODES as t,TYPES as e}from"@pixi/constants";import{Container as i}from"@pixi/display";import{hex2rgb as r,createIndicesForQuads as o,correctBlendMode as a,premultiplyRgba as n,premultiplyTint as s}from"@pixi/utils";import{Geometry as u,Buffer as p,ObjectRenderer as h,Shader as f,State as d}from"@pixi/core";import{Matrix as l}from"@pixi/math";var c=function(t,e){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},c(t,e)};function y(t,e){function i(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var v=function(e){function i(i,r,o,a){void 0===i&&(i=1500),void 0===o&&(o=16384),void 0===a&&(a=!1);var n=e.call(this)||this;return o>16384&&(o=16384),n._properties=[!1,!0,!1,!1,!1],n._maxSize=i,n._batchSize=o,n._buffers=null,n._bufferUpdateIDs=[],n._updateID=0,n.interactiveChildren=!1,n.blendMode=t.NORMAL,n.autoResize=a,n.roundPixels=!0,n.baseTexture=null,n.setProperties(r),n._tint=0,n.tintRgb=new Float32Array(4),n.tint=16777215,n}return y(i,e),i.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},i.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,r(t,this.tintRgb)},enumerable:!1,configurable:!0}),i.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(function(){return e.onChildrenChange(0)}))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},i.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID},i.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},i.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},i}(i),m=function(){function t(t,i,r){this.geometry=new u,this.indexBuffer=null,this.size=r,this.dynamicProperties=[],this.staticProperties=[];for(var o=0;o<t.length;++o){var a=t[o];a={attributeName:a.attributeName,size:a.size,uploadFunction:a.uploadFunction,type:a.type||e.FLOAT,offset:a.offset},i[o]?this.dynamicProperties.push(a):this.staticProperties.push(a)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return t.prototype.initBuffers=function(){var t=this.geometry,i=0;this.indexBuffer=new p(o(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(var r=0;r<this.dynamicProperties.length;++r){(u=this.dynamicProperties[r]).offset=i,i+=u.size,this.dynamicStride+=u.size}var a=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(a),this.dynamicDataUint32=new Uint32Array(a),this.dynamicBuffer=new p(this.dynamicData,!1,!1);var n=0;this.staticStride=0;for(r=0;r<this.staticProperties.length;++r){(u=this.staticProperties[r]).offset=n,n+=u.size,this.staticStride+=u.size}var s=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(s),this.staticDataUint32=new Uint32Array(s),this.staticBuffer=new p(this.staticData,!0,!1);for(r=0;r<this.dynamicProperties.length;++r){var u=this.dynamicProperties[r];t.addAttribute(u.attributeName,this.dynamicBuffer,0,u.type===e.UNSIGNED_BYTE,u.type,4*this.dynamicStride,4*u.offset)}for(r=0;r<this.staticProperties.length;++r){u=this.staticProperties[r];t.addAttribute(u.attributeName,this.staticBuffer,0,u.type===e.UNSIGNED_BYTE,u.type,4*this.staticStride,4*u.offset)}},t.prototype.uploadDynamic=function(t,i,r){for(var o=0;o<this.dynamicProperties.length;o++){var a=this.dynamicProperties[o];a.uploadFunction(t,i,r,a.type===e.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,a.offset)}this.dynamicBuffer._updateID++},t.prototype.uploadStatic=function(t,i,r){for(var o=0;o<this.staticProperties.length;o++){var a=this.staticProperties[o];a.uploadFunction(t,i,r,a.type===e.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,a.offset)}this.staticBuffer._updateID++},t.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},t}(),_=function(t){function i(i){var r=t.call(this,i)||this;return r.shader=null,r.properties=null,r.tempMatrix=new l,r.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:r.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:r.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:r.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:r.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:e.UNSIGNED_BYTE,uploadFunction:r.uploadTint,offset:0}],r.shader=f.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),r.state=d.for2d(),r}return y(i,t),i.prototype.render=function(t){var e=t.children,i=t._maxSize,r=t._batchSize,o=this.renderer,s=e.length;if(0!==s){s>i&&!t.autoResize&&(s=i);var u=t._buffers;u||(u=t._buffers=this.generateBuffers(t));var p=e[0]._texture.baseTexture;this.state.blendMode=a(t.blendMode,p.alphaMode),o.state.set(this.state);var h=o.gl,f=t.worldTransform.copyTo(this.tempMatrix);f.prepend(o.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=f.toArray(!0),this.shader.uniforms.uColor=n(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,p.alphaMode),this.shader.uniforms.uSampler=p,this.renderer.shader.bind(this.shader);for(var d=!1,l=0,c=0;l<s;l+=r,c+=1){var y=s-l;y>r&&(y=r),c>=u.length&&u.push(this._generateOneMoreBuffer(t));var v=u[c];v.uploadDynamic(e,l,y);var m=t._bufferUpdateIDs[c]||0;(d=d||v._updateID<m)&&(v._updateID=t._updateID,v.uploadStatic(e,l,y)),o.geometry.bind(v.geometry),h.drawElements(h.TRIANGLES,6*y,h.UNSIGNED_SHORT,0)}}},i.prototype.generateBuffers=function(t){for(var e=[],i=t._maxSize,r=t._batchSize,o=t._properties,a=0;a<i;a+=r)e.push(new m(this.properties,o,r));return e},i.prototype._generateOneMoreBuffer=function(t){var e=t._batchSize,i=t._properties;return new m(this.properties,i,e)},i.prototype.uploadVertices=function(t,e,i,r,o,a){for(var n=0,s=0,u=0,p=0,h=0;h<i;++h){var f=t[e+h],d=f._texture,l=f.scale.x,c=f.scale.y,y=d.trim,v=d.orig;y?(n=(s=y.x-f.anchor.x*v.width)+y.width,u=(p=y.y-f.anchor.y*v.height)+y.height):(n=v.width*(1-f.anchor.x),s=v.width*-f.anchor.x,u=v.height*(1-f.anchor.y),p=v.height*-f.anchor.y),r[a]=s*l,r[a+1]=p*c,r[a+o]=n*l,r[a+o+1]=p*c,r[a+2*o]=n*l,r[a+2*o+1]=u*c,r[a+3*o]=s*l,r[a+3*o+1]=u*c,a+=4*o}},i.prototype.uploadPosition=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].position;r[a]=s.x,r[a+1]=s.y,r[a+o]=s.x,r[a+o+1]=s.y,r[a+2*o]=s.x,r[a+2*o+1]=s.y,r[a+3*o]=s.x,r[a+3*o+1]=s.y,a+=4*o}},i.prototype.uploadRotation=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].rotation;r[a]=s,r[a+o]=s,r[a+2*o]=s,r[a+3*o]=s,a+=4*o}},i.prototype.uploadUvs=function(t,e,i,r,o,a){for(var n=0;n<i;++n){var s=t[e+n]._texture._uvs;s?(r[a]=s.x0,r[a+1]=s.y0,r[a+o]=s.x1,r[a+o+1]=s.y1,r[a+2*o]=s.x2,r[a+2*o+1]=s.y2,r[a+3*o]=s.x3,r[a+3*o+1]=s.y3,a+=4*o):(r[a]=0,r[a+1]=0,r[a+o]=0,r[a+o+1]=0,r[a+2*o]=0,r[a+2*o+1]=0,r[a+3*o]=0,r[a+3*o+1]=0,a+=4*o)}},i.prototype.uploadTint=function(t,e,i,r,o,a){for(var n=0;n<i;++n){var u=t[e+n],p=u._texture.baseTexture.alphaMode>0,h=u.alpha,f=h<1&&p?s(u._tintRGB,h):u._tintRGB+(255*h<<24);r[a]=f,r[a+o]=f,r[a+2*o]=f,r[a+3*o]=f,a+=4*o}},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},i}(h);export{v as ParticleContainer,_ as ParticleRenderer}; | ||
import{BLEND_MODES as t,TYPES as e}from"@pixi/constants";import{Container as i}from"@pixi/display";import{hex2rgb as r,createIndicesForQuads as o,correctBlendMode as a,premultiplyRgba as n,premultiplyTint as s}from"@pixi/utils";import{Geometry as u,Buffer as p,ExtensionType as h,ObjectRenderer as f,Shader as d,State as l}from"@pixi/core";import{Matrix as c}from"@pixi/math";var y=function(t,e){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},y(t,e)};function v(t,e){function i(){this.constructor=t}y(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var m=function(e){function i(i,r,o,a){void 0===i&&(i=1500),void 0===o&&(o=16384),void 0===a&&(a=!1);var n=e.call(this)||this;return o>16384&&(o=16384),n._properties=[!1,!0,!1,!1,!1],n._maxSize=i,n._batchSize=o,n._buffers=null,n._bufferUpdateIDs=[],n._updateID=0,n.interactiveChildren=!1,n.blendMode=t.NORMAL,n.autoResize=a,n.roundPixels=!0,n.baseTexture=null,n.setProperties(r),n._tint=0,n.tintRgb=new Float32Array(4),n.tint=16777215,n}return v(i,e),i.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},i.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,r(t,this.tintRgb)},enumerable:!1,configurable:!0}),i.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(function(){return e.onChildrenChange(0)}))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},i.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID},i.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},i.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},i}(i),_=function(){function t(t,i,r){this.geometry=new u,this.indexBuffer=null,this.size=r,this.dynamicProperties=[],this.staticProperties=[];for(var o=0;o<t.length;++o){var a=t[o];a={attributeName:a.attributeName,size:a.size,uploadFunction:a.uploadFunction,type:a.type||e.FLOAT,offset:a.offset},i[o]?this.dynamicProperties.push(a):this.staticProperties.push(a)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return t.prototype.initBuffers=function(){var t=this.geometry,i=0;this.indexBuffer=new p(o(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(var r=0;r<this.dynamicProperties.length;++r){(u=this.dynamicProperties[r]).offset=i,i+=u.size,this.dynamicStride+=u.size}var a=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(a),this.dynamicDataUint32=new Uint32Array(a),this.dynamicBuffer=new p(this.dynamicData,!1,!1);var n=0;this.staticStride=0;for(r=0;r<this.staticProperties.length;++r){(u=this.staticProperties[r]).offset=n,n+=u.size,this.staticStride+=u.size}var s=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(s),this.staticDataUint32=new Uint32Array(s),this.staticBuffer=new p(this.staticData,!0,!1);for(r=0;r<this.dynamicProperties.length;++r){var u=this.dynamicProperties[r];t.addAttribute(u.attributeName,this.dynamicBuffer,0,u.type===e.UNSIGNED_BYTE,u.type,4*this.dynamicStride,4*u.offset)}for(r=0;r<this.staticProperties.length;++r){u=this.staticProperties[r];t.addAttribute(u.attributeName,this.staticBuffer,0,u.type===e.UNSIGNED_BYTE,u.type,4*this.staticStride,4*u.offset)}},t.prototype.uploadDynamic=function(t,i,r){for(var o=0;o<this.dynamicProperties.length;o++){var a=this.dynamicProperties[o];a.uploadFunction(t,i,r,a.type===e.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,a.offset)}this.dynamicBuffer._updateID++},t.prototype.uploadStatic=function(t,i,r){for(var o=0;o<this.staticProperties.length;o++){var a=this.staticProperties[o];a.uploadFunction(t,i,r,a.type===e.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,a.offset)}this.staticBuffer._updateID++},t.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},t}(),x=function(t){function i(i){var r=t.call(this,i)||this;return r.shader=null,r.properties=null,r.tempMatrix=new c,r.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:r.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:r.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:r.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:r.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:e.UNSIGNED_BYTE,uploadFunction:r.uploadTint,offset:0}],r.shader=d.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),r.state=l.for2d(),r}return v(i,t),i.prototype.render=function(t){var e=t.children,i=t._maxSize,r=t._batchSize,o=this.renderer,s=e.length;if(0!==s){s>i&&!t.autoResize&&(s=i);var u=t._buffers;u||(u=t._buffers=this.generateBuffers(t));var p=e[0]._texture.baseTexture,h=p.alphaMode>0;this.state.blendMode=a(t.blendMode,h),o.state.set(this.state);var f=o.gl,d=t.worldTransform.copyTo(this.tempMatrix);d.prepend(o.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=d.toArray(!0),this.shader.uniforms.uColor=n(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,h),this.shader.uniforms.uSampler=p,this.renderer.shader.bind(this.shader);for(var l=!1,c=0,y=0;c<s;c+=r,y+=1){var v=s-c;v>r&&(v=r),y>=u.length&&u.push(this._generateOneMoreBuffer(t));var m=u[y];m.uploadDynamic(e,c,v);var _=t._bufferUpdateIDs[y]||0;(l=l||m._updateID<_)&&(m._updateID=t._updateID,m.uploadStatic(e,c,v)),o.geometry.bind(m.geometry),f.drawElements(f.TRIANGLES,6*v,f.UNSIGNED_SHORT,0)}}},i.prototype.generateBuffers=function(t){for(var e=[],i=t._maxSize,r=t._batchSize,o=t._properties,a=0;a<i;a+=r)e.push(new _(this.properties,o,r));return e},i.prototype._generateOneMoreBuffer=function(t){var e=t._batchSize,i=t._properties;return new _(this.properties,i,e)},i.prototype.uploadVertices=function(t,e,i,r,o,a){for(var n=0,s=0,u=0,p=0,h=0;h<i;++h){var f=t[e+h],d=f._texture,l=f.scale.x,c=f.scale.y,y=d.trim,v=d.orig;y?(n=(s=y.x-f.anchor.x*v.width)+y.width,u=(p=y.y-f.anchor.y*v.height)+y.height):(n=v.width*(1-f.anchor.x),s=v.width*-f.anchor.x,u=v.height*(1-f.anchor.y),p=v.height*-f.anchor.y),r[a]=s*l,r[a+1]=p*c,r[a+o]=n*l,r[a+o+1]=p*c,r[a+2*o]=n*l,r[a+2*o+1]=u*c,r[a+3*o]=s*l,r[a+3*o+1]=u*c,a+=4*o}},i.prototype.uploadPosition=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].position;r[a]=s.x,r[a+1]=s.y,r[a+o]=s.x,r[a+o+1]=s.y,r[a+2*o]=s.x,r[a+2*o+1]=s.y,r[a+3*o]=s.x,r[a+3*o+1]=s.y,a+=4*o}},i.prototype.uploadRotation=function(t,e,i,r,o,a){for(var n=0;n<i;n++){var s=t[e+n].rotation;r[a]=s,r[a+o]=s,r[a+2*o]=s,r[a+3*o]=s,a+=4*o}},i.prototype.uploadUvs=function(t,e,i,r,o,a){for(var n=0;n<i;++n){var s=t[e+n]._texture._uvs;s?(r[a]=s.x0,r[a+1]=s.y0,r[a+o]=s.x1,r[a+o+1]=s.y1,r[a+2*o]=s.x2,r[a+2*o+1]=s.y2,r[a+3*o]=s.x3,r[a+3*o+1]=s.y3,a+=4*o):(r[a]=0,r[a+1]=0,r[a+o]=0,r[a+o+1]=0,r[a+2*o]=0,r[a+2*o+1]=0,r[a+3*o]=0,r[a+3*o+1]=0,a+=4*o)}},i.prototype.uploadTint=function(t,e,i,r,o,a){for(var n=0;n<i;++n){var u=t[e+n],p=u._texture.baseTexture.alphaMode>0,h=u.alpha,f=h<1&&p?s(u._tintRGB,h):u._tintRGB+(255*h<<24);r[a]=f,r[a+o]=f,r[a+2*o]=f,r[a+3*o]=f,a+=4*o}},i.prototype.destroy=function(){t.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},i.extension={name:"particle",type:h.RendererPlugin},i}(f);export{m as ParticleContainer,x as ParticleRenderer}; | ||
//# sourceMappingURL=particle-container.min.js.map |
@@ -5,3 +5,3 @@ import type { BaseTexture } from '@pixi/core'; | ||
import { Container } from '@pixi/display'; | ||
import type { DisplayObject } from '@pixi/display'; | ||
import type { ExtensionMetadata } from '@pixi/core'; | ||
import { Geometry } from '@pixi/core'; | ||
@@ -13,2 +13,3 @@ import type { IDestroyOptions } from '@pixi/display'; | ||
import { Shader } from '@pixi/core'; | ||
import type { Sprite } from '@pixi/sprite'; | ||
import { State } from '@pixi/core'; | ||
@@ -73,3 +74,3 @@ import { TYPES } from '@pixi/constants'; | ||
*/ | ||
uploadDynamic(children: DisplayObject[], startIndex: number, amount: number): void; | ||
uploadDynamic(children: Sprite[], startIndex: number, amount: number): void; | ||
/** | ||
@@ -81,3 +82,3 @@ * Uploads the static properties. | ||
*/ | ||
uploadStatic(children: DisplayObject[], startIndex: number, amount: number): void; | ||
uploadStatic(children: Sprite[], startIndex: number, amount: number): void; | ||
/** Destroys the ParticleBuffer. */ | ||
@@ -111,3 +112,3 @@ destroy(): void; | ||
*/ | ||
export declare class ParticleContainer extends Container { | ||
export declare class ParticleContainer extends Container<Sprite> { | ||
/** | ||
@@ -224,2 +225,4 @@ * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` | ||
export declare class ParticleRenderer extends ObjectRenderer { | ||
/** @ignore */ | ||
static extension: ExtensionMetadata; | ||
/** The WebGL state in which this renderer will work. */ | ||
@@ -254,3 +257,3 @@ readonly state: State; | ||
* Uploads the vertices. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -262,6 +265,6 @@ * @param amount - the amount of children that will have their vertices uploaded | ||
*/ | ||
uploadVertices(children: DisplayObject[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
uploadVertices(children: Sprite[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
/** | ||
* Uploads the position. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -273,6 +276,6 @@ * @param amount - the amount of children that will have their positions uploaded | ||
*/ | ||
uploadPosition(children: DisplayObject[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
uploadPosition(children: Sprite[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
/** | ||
* Uploads the rotation. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -284,6 +287,6 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
*/ | ||
uploadRotation(children: DisplayObject[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
uploadRotation(children: Sprite[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
/** | ||
* Uploads the UVs. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -295,6 +298,6 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
*/ | ||
uploadUvs(children: DisplayObject[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
uploadUvs(children: Sprite[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
/** | ||
* Uploads the tint. | ||
* @param children - the array of display objects to render | ||
* @param children - the array of sprites to render | ||
* @param startIndex - the index to start from in the children array | ||
@@ -306,3 +309,3 @@ * @param amount - the amount of children that will have their rotation uploaded | ||
*/ | ||
uploadTint(children: DisplayObject[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
uploadTint(children: Sprite[], startIndex: number, amount: number, array: number[], stride: number, offset: number): void; | ||
/** Destroys the ParticleRenderer. */ | ||
@@ -309,0 +312,0 @@ destroy(): void; |
{ | ||
"name": "@pixi/particle-container", | ||
"version": "6.4.2", | ||
"version": "6.5.0-rc", | ||
"main": "dist/cjs/particle-container.js", | ||
@@ -41,9 +41,10 @@ "module": "dist/esm/particle-container.js", | ||
"peerDependencies": { | ||
"@pixi/constants": "6.4.2", | ||
"@pixi/core": "6.4.2", | ||
"@pixi/display": "6.4.2", | ||
"@pixi/math": "6.4.2", | ||
"@pixi/utils": "6.4.2" | ||
"@pixi/constants": "6.5.0-rc", | ||
"@pixi/core": "6.5.0-rc", | ||
"@pixi/display": "6.5.0-rc", | ||
"@pixi/math": "6.5.0-rc", | ||
"@pixi/sprite": "6.5.0-rc", | ||
"@pixi/utils": "6.5.0-rc" | ||
}, | ||
"gitHead": "a87bb87036d5fb9119ee92fd9c3da23b5bb9424b" | ||
"gitHead": "16005f83e7a6d87831ce84f8a6d460606a331ef6" | ||
} |
@@ -13,5 +13,5 @@ # @pixi/particle-container | ||
import {ParticleRenderer} from '@pixi/particle-container'; | ||
import {Renderer} from '@pixi/core'; | ||
import {extensions} from '@pixi/core'; | ||
Renderer.registerPlugin('particle', ParticleRenderer); | ||
extensions.add(ParticleRenderer); | ||
``` |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
525269
0
2588
6
2