/*! * @pixi/particle-container - v6.5.10 * Compiled Thu, 06 Jul 2023 15:25:11 UTC * * @pixi/particle-container is licensed under the MIT License. * http://www.opensource.org/licenses/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.lengthr&&!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;lo&&(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._updateID0,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