/*! * @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 */ 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.lengthi&&!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;cr&&(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;a0,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.mjs.map