1import{g as A}from"./chunk-ATLPHYUF.js";var v=A((E,m)=>{"use strict";var n={distributions:{BOX:1,SPHERE:2,DISC:3},valueOverLifetimeLength:4};typeof define=="function"&&define.amd?define("spe",n):typeof E<"u"&&typeof m<"u"&&(m.exports=n);n.TypedArrayHelper=function(e,t,r,i){"use strict";this.componentSize=r||1,this.size=t||1,this.TypedArrayConstructor=e||Float32Array,this.array=new e(t*this.componentSize),this.indexOffset=i||0};n.TypedArrayHelper.constructor=n.TypedArrayHelper;n.TypedArrayHelper.prototype.setSize=function(e,t){"use strict";var r=this.array.length;if(t||(e=e*this.componentSize),e<r)return this.shrink(e);if(e>r)return this.grow(e);console.info("TypedArray is already of size:",e+".","Will not resize.")};n.TypedArrayHelper.prototype.shrink=function(e){"use strict";return this.array=this.array.subarray(0,e),this.size=e,this};n.TypedArrayHelper.prototype.grow=function(e){"use strict";var t=this.array,r=new this.TypedArrayConstructor(e);return r.set(t),this.array=r,this.size=e,this};n.TypedArrayHelper.prototype.splice=function(e,t){"use strict";e*=this.componentSize,t*=this.componentSize;for(var r=[],i=this.array,s=i.length,a=0;a<s;++a)(a<e||a>=t)&&r.push(i[a]);return this.setFromArray(0,r),this};n.TypedArrayHelper.prototype.setFromArray=function(e,t){"use strict";var r=t.length,i=e+r;return i>this.array.length?this.grow(i):i<this.array.length&&this.shrink(i),this.array.set(t,this.indexOffset+e),this};n.TypedArrayHelper.prototype.setVec2=function(e,t){"use strict";return this.setVec2Components(e,t.x,t.y)};n.TypedArrayHelper.prototype.setVec2Components=function(e,t,r){"use strict";var i=this.array,s=this.indexOffset+e*this.componentSize;return i[s]=t,i[s+1]=r,this};n.TypedArrayHelper.prototype.setVec3=function(e,t){"use strict";return this.setVec3Components(e,t.x,t.y,t.z)};n.TypedArrayHelper.prototype.setVec3Components=function(e,t,r,i){"use strict";var s=this.array,a=this.indexOffset+e*this.componentSize;return s[a]=t,s[a+1]=r,s[a+2]=i,this};n.TypedArrayHelper.prototype.setVec4=function(e,t){"use strict";return this.setVec4Components(e,t.x,t.y,t.z,t.w)};n.TypedArrayHelper.prototype.setVec4Components=function(e,t,r,i,s){"use strict";var a=this.array,o=this.indexOffset+e*this.componentSize;return a[o]=t,a[o+1]=r,a[o+2]=i,a[o+3]=s,this};n.TypedArrayHelper.prototype.setMat3=function(e,t){"use strict";return this.setFromArray(this.indexOffset+e*this.componentSize,t.elements)};n.TypedArrayHelper.prototype.setMat4=function(e,t){"use strict";return this.setFromArray(this.indexOffset+e*this.componentSize,t.elements)};n.TypedArrayHelper.prototype.setColor=function(e,t){"use strict";return this.setVec3Components(e,t.r,t.g,t.b)};n.TypedArrayHelper.prototype.setNumber=function(e,t){"use strict";return this.array[this.indexOffset+e*this.componentSize]=t,this};n.TypedArrayHelper.prototype.getValueAtIndex=function(e){"use strict";return this.array[this.indexOffset+e]};n.TypedArrayHelper.prototype.getComponentValueAtIndex=function(e){"use strict";return this.array.subarray(this.indexOffset+e*this.componentSize)};n.ShaderAttribute=function(e,t,r){"use strict";var i=n.ShaderAttribute.typeSizeMap;this.type=typeof e=="string"&&i.hasOwnProperty(e)?e:"f",this.componentSize=i[this.type],this.arrayType=r||Float32Array,this.typedArray=null,this.bufferAttribute=null,this.dynamicBuffer=!!t,this.updateMin=0,this.updateMax=0};n.ShaderAttribute.constructor=n.ShaderAttribute;n.ShaderAttribute.typeSizeMap={f:1,v2:2,v3:3,v4:4,c:3,m3:9,m4:16};n.ShaderAttribute.prototype.setUpdateRange=function(e,t){"use strict";this.updateMin=Math.min(e*this.componentSize,this.updateMin*this.componentSize),this.updateMax=Math.max(t*this.componentSize,this.updateMax*this.componentSize)};n.ShaderAttribute.prototype.flagUpdate=function(){"use strict";var e=this.bufferAttribute,t=e.updateRange;t.offset=this.updateMin,t.count=Math.min(this.updateMax-this.updateMin+this.componentSize,this.typedArray.array.length),e.needsUpdate=!0};n.ShaderAttribute.prototype.resetUpdateRange=function(){"use strict";this.updateMin=0,this.updateMax=0};n.ShaderAttribute.prototype.resetDynamic=function(){"use strict";this.bufferAttribute.dynamic=this.dynamicBuffer};n.ShaderAttribute.prototype.splice=function(e,t){"use strict";this.typedArray.splice(e,t),this.forceUpdateAll()};n.ShaderAttribute.prototype.forceUpdateAll=function(){"use strict";this.bufferAttribute.array=this.typedArray.array,this.bufferAttribute.updateRange.offset=0,this.bufferAttribute.updateRange.count=-1,this.bufferAttribute.dynamic=!1,this.bufferAttribute.needsUpdate=!0};n.ShaderAttribute.prototype._ensureTypedArray=function(e){"use strict";this.typedArray!==null&&this.typedArray.size===e*this.componentSize||(this.t
1ypedArray!==null&&this.typedArray.size!==e?this.typedArray.setSize(e):this.typedArray===null&&(this.typedArray=new n.TypedArrayHelper(this.arrayType,e,this.componentSize)))};n.ShaderAttribute.prototype._createBufferAttribute=function(e){"use strict";if(this._ensureTypedArray(e),this.bufferAttribute!==null){this.bufferAttribute.array=this.typedArray.array,this.bufferAttribute.needsUpdate=!0;return}this.bufferAttribute=new THREE.BufferAttribute(this.typedArray.array,this.componentSize),this.bufferAttribute.dynamic=this.dynamicBuffer};n.ShaderAttribute.prototype.getLength=function(){"use strict";return this.typedArray===null?0:this.typedArray.array.length};n.shaderChunks={defines:["#define PACKED_COLOR_SIZE 256.0","#define PACKED_COLOR_DIVISOR 255.0"].join("\n"),uniforms:["uniform float deltaTime;","uniform float runTime;","uniform sampler2D texture;","uniform vec4 textureAnimation;","uniform float scale;"].join("\n"),attributes:["attribute vec4 acceleration;","attribute vec3 velocity;","attribute vec4 rotation;","attribute vec3 rotationCenter;","attribute vec4 params;","attribute vec4 size;","attribute vec4 angle;","attribute vec4 color;","attribute vec4 opacity;"].join("\n"),varyings:["varying vec4 vColor;","#ifdef SHOULD_ROTATE_TEXTURE"," varying float vAngle;","#endif","#ifdef SHOULD_CALCULATE_SPRITE"," varying vec4 vSpriteSheet;","#endif"].join("\n"),branchAvoidanceFunctions:["float when_gt(float x, float y) {"," return max(sign(x - y), 0.0);","}","float when_lt(float x, float y) {"," return min( max(1.0 - sign(x - y), 0.0), 1.0 );","}","float when_eq( float x, float y ) {"," return 1.0 - abs( sign( x - y ) );","}","float when_ge(float x, float y) {"," return 1.0 - when_lt(x, y);","}","float when_le(float x, float y) {"," return 1.0 - when_gt(x, y);","}","float and(float a, float b) {"," return a * b;","}","float or(float a, float b) {"," return min(a + b, 1.0);","}"].join("\n"),unpackColor:["vec3 unpackColor( in float hex ) {"," vec3 c = vec3( 0.0 );"," float r = mod( (hex / PACKED_COLOR_SIZE / PACKED_COLOR_SIZE), PACKED_COLOR_SIZE );"," float g = mod( (hex / PACKED_COLOR_SIZE), PACKED_COLOR_SIZE );"," float b = mod( hex, PACKED_COLOR_SIZE );"," c.r = r / PACKED_COLOR_DIVISOR;"," c.g = g / PACKED_COLOR_DIVISOR;"," c.b = b / PACKED_COLOR_DIVISOR;"," return c;","}"].join("\n"),unpackRotationAxis:["vec3 unpackRotationAxis( in float hex ) {"," vec3 c = vec3( 0.0 );"," float r = mod( (hex / PACKED_COLOR_SIZE / PACKED_COLOR_SIZE), PACKED_COLOR_SIZE );"," float g = mod( (hex / PACKED_COLOR_SIZE), PACKED_COLOR_SIZE );"," float b = mod( hex, PACKED_COLOR_SIZE );"," c.r = r / PACKED_COLOR_DIVISOR;"," c.g = g / PACKED_COLOR_DIVISOR;"," c.b = b / PACKED_COLOR_DIVISOR;"," c *= vec3( 2.0 );"," c -= vec3( 1.0 );"," return c;","}"].join("\n"),floatOverLifetime:["float getFloatOverLifetime( in float positionInTime, in vec4 attr ) {"," highp float value = 0.0;"," float deltaAge = positionInTime * float( VALUE_OVER_LIFETIME_LENGTH - 1 );"," float fIndex = 0.0;"," float shouldApplyValue = 0.0;"," value += attr[ 0 ] * when_eq( deltaAge, 0.0 );",""," for( int i = 0; i < VALUE_OVER_LIFETIME_LENGTH - 1; ++i ) {"," fIndex = float( i );"," shouldApplyValue = and( when_gt( deltaAge, fIndex ), when_le( deltaAge, fIndex + 1.0 ) );"," value += shouldApplyValue * mix( attr[ i ], attr[ i + 1 ], deltaAge - fIndex );"," }",""," return value;","}"].join("\n"),colorOverLifetime:["vec3 getColorOverLifetime( in float positionInTime, in vec3 color1, in vec3 color2, in vec3 color3, in vec3 color4 ) {"," vec3 value = vec3( 0.0 );"," value.x = getFloatOverLifetime( positionInTime, vec4( color1.x, color2.x, color3.x, color4.x ) );"," value.y = getFloatOverLifetime( positionInTime, vec4( color1.y, color2.y, color3.y, color4.y ) );"," value.z = getFloatOverLifetime( positionInTime, vec4( color1.z, color2.z, color3.z, color4.z ) );"," return value;","}"].join("\n"),paramFetchingFunctions:["float getAlive() {"," return params.x;","}","float getAge() {"," return params.y;","}","float getMaxAge() {"," return params.z;","}","float getWiggle() {"," return params.w;","}"].join("\n"),forceFetchingFunctions:["vec4 getPosition( in float age ) {"," return modelViewMatrix * vec4( position, 1.0 );","}","vec3 getVelocity( in float age ) {"," return velocity * age;","}","vec3 getAcceleration( in float age ) {"," return acceleration.xyz * age;","}"].join("\n"),rotationFunctions:["#ifdef SHOULD_ROTATE_PARTICLES"," mat4 getRotationMatrix( in vec3 axis, in float angle) {"," axis = normalize(axis);"," float s = sin(angle);"," float c = cos(angle);"," float oc = 1.0 - c;",""," return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,"," oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,"," oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,"," 0.0, 0.0, 0.0, 1.0);"," }",""," vec3 getRotation( in vec3 pos, in float positionInTime ) {"," if( rotation.y == 0.0 ) {"," return pos;"," }",""," vec3 axis = unpackRotationAxis( rotation.x );"," vec3 center = rotationCenter;"," vec3 translated;"," mat4 rotationMatrix;"," float angle = 0.0;"," angle += when_eq( rotation.z, 0.0 ) * rotation.y;"," angle += when_gt( rotation.z, 0.0 ) * mix( 0.0, rotation.y, positionInTime );"," translated = rotationCenter - pos;"," rotationMatrix = getRotationMatrix( axis, angle );"," return center - vec3( rotationMatrix * vec4( translated, 0.0 ) );"," }","#endif"].join("\n"),rotateTexture:[" vec2 vUv = vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y );",""," #ifdef SHOULD_ROTATE_TEXTURE"," float x = gl_PointCoord.x - 0.5;"," float y = 1.0 - gl_PointCoord.y - 0.5;"," float c = cos( -vAngle );"," float s = sin( -vAngle );"," vUv = vec2( c * x + s * y + 0.5, c * y - s * x + 0.5 );"," #endif",""," #ifdef SHOULD_CALCULATE_SPRITE"," float framesX = vSpriteSheet.x;"," float framesY = vSpriteSheet.y;"," float columnNorm = vSpriteSheet.z;"," float rowNorm = vSpriteSheet.w;"," vUv.x = gl_PointCoord.x * framesX + columnNorm;"," vUv.y = 1.0 - (gl_PointCoord.y * framesY + rowNorm);"," #endif",""," vec4 rotatedTexture = texture2D( texture, vUv );"].join("\n")};n.shaders={vertex:[n.shaderChunks.defines,n.shaderChunks.uniforms,n.shaderChunks.attributes,n.shaderChunks.varyings,THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_vertex,THREE.ShaderChunk.fog_pars_vertex,n.shaderChunks.branchAvoidanceFunctions,n.shaderChunks.unpackColor,n.shaderChunks.unpackRotationAxis,n.shaderChunks.floatOver
1Lifetime,n.shaderChunks.colorOverLifetime,n.shaderChunks.paramFetchingFunctions,n.shaderChunks.forceFetchingFunctions,n.shaderChunks.rotationFunctions,"vec4 mvPosition;","void main() {"," highp float age = getAge();"," highp float alive = getAlive();"," highp float maxAge = getMaxAge();"," highp float positionInTime = (age / maxAge);"," highp float isAlive = when_gt( alive, 0.0 );"," #ifdef SHOULD_WIGGLE_PARTICLES"," float wiggleAmount = positionInTime * getWiggle();"," float wiggleSin = isAlive * sin( wiggleAmount );"," float wiggleCos = isAlive * cos( wiggleAmount );"," #endif"," vec3 vel = getVelocity( age );"," vec3 accel = getAcceleration( age );"," vec3 force = vec3( 0.0 );"," vec3 pos = vec3( position );"," float drag = 1.0 - (positionInTime * 0.5) * acceleration.w;"," force += vel;"," force *= drag;"," force += accel * age;"," pos += force;"," #ifdef SHOULD_WIGGLE_PARTICLES"," pos.x += wiggleSin;"," pos.y += wiggleCos;"," pos.z += wiggleSin;"," #endif"," #ifdef SHOULD_ROTATE_PARTICLES"," pos = getRotation( pos, positionInTime );"," #endif"," vec4 mvPos = mvPosition = modelViewMatrix * vec4( pos, 1.0 );"," highp float pointSize = getFloatOverLifetime( positionInTime, size ) * isAlive;"," #ifdef HAS_PERSPECTIVE"," float perspective = scale / length( mvPos.xyz );"," #else"," float perspective = 1.0;"," #endif"," float pointSizePerspective = pointSize * perspective;"," #ifdef COLORIZE"," vec3 c = isAlive * getColorOverLifetime("," positionInTime,"," unpackColor( color.x ),"," unpackColor( color.y ),"," unpackColor( color.z ),"," unpackColor( color.w )"," );"," #else"," vec3 c = vec3(1.0);"," #endif"," float o = isAlive * getFloatOverLifetime( positionInTime, opacity );"," vColor = vec4( c, o );"," #ifdef SHOULD_ROTATE_TEXTURE"," vAngle = isAlive * getFloatOverLifetime( positionInTime, angle );"," #endif"," #ifdef SHOULD_CALCULATE_SPRITE"," float framesX = textureAnimation.x;"," float framesY = textureAnimation.y;"," float loopCount = textureAnimation.w;"," float totalFrames = textureAnimation.z;"," float frameNumber = mod( (positionInTime * loopCount) * totalFrames, totalFrames );"," float column = floor(mod( frameNumber, framesX ));"," float row = floor( (frameNumber - column) / framesX );"," float columnNorm = column / framesX;"," float rowNorm = row / framesY;"," vSpriteSheet.x = 1.0 / framesX;"," vSpriteSheet.y = 1.0 / framesY;"," vSpriteSheet.z = columnNorm;"," vSpriteSheet.w = rowNorm;"," #endif"," gl_PointSize = pointSizePerspective;"," gl_Position = projectionMatrix * mvPos;",THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.fog_vertex,"}"].join("\n"),fragment:[n.shaderChunks.uniforms,THREE.ShaderChunk.common,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,n.shaderChunks.varyings,n.shaderChunks.branchAvoidanceFunctions,"void main() {"," vec3 outgoingLight = vColor.xyz;"," "," #ifdef ALPHATEST"," if ( vColor.w < float(ALPHATEST) ) discard;"," #endif",n.shaderChunks.rotateTexture,THREE.ShaderChunk.logdepthbuf_fragment," outgoingLight = vColor.xyz * rotatedTexture.xyz;"," gl_FragColor = vec4( outgoingLight.xyz, rotatedTexture.w * vColor.w );",THREE.ShaderChunk.fog_fragment,"}"].join("\n")};n.utils={types:{BOOLEAN:"boolean",STRING:"string",NUMBER:"number",OBJECT:"object"},ensureTypedArg:function(e,t,r){"use strict";return typeof e===t?e:r},ensureArrayTypedArg:function(e,t,r){"use strict";if(Array.isArray(e)){for(var i=e.length-1;i>=0;--i)if(typeof e[i]!==t)return r;return e}return this.ensureTypedArg(e,t,r)},ensureInstanceOf:function(e,t,r){"use strict";return t!==void 0&&e instanceof t?e:r},ensureArrayInstanceOf:function(e,t,r){"use strict";if(Array.isArray(e)){for(var i=e.length-1;i>=0;--i)if(t!==void 0&&!(e[i]instanceof t))return r;return e}return this.ensureInstanceOf(e,t,r)},ensureValueOverLifetimeCompliance:function(e,t,r){"use strict";t=t||3,r=r||3,Array.isArray(e._value)===!1&&(e._value=[e._value]),Array.isArray(e._spread)===!1&&(e._spread=[e._spread]);var i=this.clamp(e._value.length,t,r),s=this.clamp(e._spread.length,t,r),a=Math.max(i,s);e._value.length!==a&&(e._value=this.interpolateArray(e._value,a)),e._spread.length!==a&&(e._spread=this.interpolateArray(e._spread,a))},interpolateArray:function(e,t){"use strict";for(var r=e.length,i=[typeof e[0].clone=="function"?e[0].clone():e[0]],s=(r-1)/(t-1),a=1;a<t-1;++a){var o=a*s,u=Math.floor(o),l=Math.ceil(o),c=o-u;i[a]=this.lerpTypeAgnostic(e[u],e[l],c)}return i.push(typeof e[r-1].clone=="function"?e[r-1].clone():e[r-1]),i},clamp:function(e,t,r){"use strict";return Math.max(t,Math.min(e,r))},zeroToEpsilon:function(e,t){"use strict";var r=1e-5,i=e;return i=t?Math.random()*r*10:r,e<0&&e>-r&&(i=-i),i},lerpTypeAgnostic:function(e,t,r){"use strict";var i=this.types,s;if(typeof e===i.NUMBER&&typeof t===i.NUMBER)return e+(t-e)*r;if(e instanceof THREE.Vector2&&t instanceof THREE.Vector2)return s=e.clone(),s.x=this.lerp(e.x,t.x,r),s.y=this.lerp(e.y,t.y,r),s;if(e instanceof THREE.Vector3&&t instanceof THREE.Vector3)return s=e.clone(),s.x=this.lerp(e.x,t.x,r),s.y=this.lerp(e.y,t.y,r),s.z=this.lerp(e.z,t.z,r),s;if(e instanceof THREE.Vector4&&t instanceof THREE.Vector4)return s=e.clone(),s.x=this.lerp(e.x,t.x,r),s.y=this.lerp(e.y,t.y,r),s.z=this.lerp(e.z,t.z,r),s.w=this.lerp(e.w,t.w,r),s;if(e instanceof THREE.Color&&t instanceof THREE.Color)return s=e.clone(),s.r=this.lerp(e.r,t.r,r),s.g=this.lerp(e.g,t.g,r),s.b=this.lerp(e.b,t.b,r),s;console.warn("Invalid argument types, or argument types do not match:",e,t)},lerp:function(e,t,r){"use strict";return e+(t-e)*r},roundToNearestMultiple:function(e,t){"use strict";var r=0;return t===0||(r=Math.abs(e)%t,r===0)?e:e<0?-(Math.abs(e)-r):e+t-r},arrayValuesAreEqual:function(e){"use strict";for(var t=0;t<e.length-1;++t)if(e[t]!==e[t+1])return!1;return!0},randomFloat:function(e,t){"use strict";return e+t*(Math.random()-.5)},randomVector3:function(e,t,r,i,s){"use strict";var a=r.x+(Math.random()*i.x-i.x*.5),o=r.y+(Math.random()*i.y-i.y*.5),u=r.z+(Math.random()*i.z-i.z*.5);s&&(a=-s.x*.5+this.roundToNearestMultiple(a,s.x),o=-s.y*.5+this.roundToNearestMultiple(o,s.y),u=-s.z*.5+this.roundToNearestMultiple(u,s.z)),e.typedArray.setVec3Components(t,a,o,u)},randomColor:function(e,t,r,i){"use strict";var s=r.r+Math.random()*i.x,a=r.g+Math.random()*i.y,o=r.b+Math.random()*i.z;s=this.clamp(s,0,1),a=this.clamp(a,0,1),o=this.clamp(o,0,1),e.typedArray.setVec3Components(t,s,a,o)},randomColorAsHex:(function(){"use strict";var e=new THREE.Color;return function(t,r,i,s){for(var a=i.length,o=[],u=0;u<a;++u){var l=s[u];e.copy(i[u]),e.r+=Math.random()*l.x-l.x*.5,e.g+=Math.random()*l.y-l.y*.5,e.b+=Math.random()*l.z-l.z*.5,e.r=this.clamp(e.r,0,1),e.g=this.clamp(e.g,0,1),e.b=this.clamp(e.b,0,1),o.push(e.getHex())}t.typedArray.setVec4Components(r,o[0],o[1],o[2],o[3])}})(),randomVector3OnSphere:function(e,t,r,i,s,a,o,u){"use strict";var l=2*Math.random()-1,c=6.2832*Math.random(),f=Math.sqrt(1-l*l),p=this.randomFloat(i,s),h=0,d=0,y=0;o&&(p=Math.round(p/o)*o),h=f*Math.cos(c)*p,d=f*Math.sin(c)*p,y=l*p,h*=a.x,d*=a.y,y*=a.z,h+=r.x,d+=r.y,y+=r.z,e.typedArray.setVec3Components(t,h,d,y)},seededRandom:function(e){var t=Math.sin(e)*1e4;return t-(t|0)},randomVector3OnDisc:function(e,t,r,i,s,a,o){"use strict";var u=6.2832*Math.random(),l=Math.abs(this.randomFloat(i,s)),c=0,f=0,p=0;o&&(l=Math.round(l/o)*o),c=Math.cos(u)*l,f=Math.sin(u)*l,c*=a.x,f*=a.y,c+=r.x,f+=r.y,p+=r.z,e.typedArray.setVec3Components(t,c,f,p)},randomDirectionVector3OnSphere:(function(){"use strict";var e=new THREE.Vector3;return function(t,r,i,s,a,o,u,l){e.copy(o),e.x-=i,e.y-=s,e.z-=a,e.normalize().multiplyScalar(-this.randomFloat(u,l)),t.typedArray.setVec3Components(r,e.x,e.y,e.z)}})(),randomDirectionVector3OnDisc:(function(){"use strict";var e=new THREE.Vector3;return function(t,r,i,s,a,o,u,l){e.copy(o),e.x-=i,e.y-=s,e.z-=a,e.normalize().multiplyScalar(-this.randomFloat(u,l)),t.typedArray.setVec3Components(r,e.x,e.y,0)}})(),getPackedRotationAxis:(function(){"use strict";var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Color,i=new THREE.Vector3(1,1,1);return function(s,a){return e.copy(s).normalize(),t.copy(a).normalize(),e.x+=-a.x*.5+Math.random()*a.x,e.y+=-a.y*.5+Math.random()*a.y,e.z+=-a.z*.5+Math.random()*a.z,e.normalize().add(i).multiplyScalar(.5),r.setRGB(e.x,e.y,e.z),r.getHex()}})()};n.Group=function(e){"use strict";var t=n.utils,r=t.types;e=t.ensureTypedArg(e,r.OBJECT,{}),e.texture=t.ensureTypedArg(e.texture,r.OBJECT,{}),this.uuid=THREE.Math.generateUUID(),this.fixedTimeStep=t.ensureTypedArg(e.fixedTimeStep,r.NUMBER,.016),this.texture=t.ensureInstanceOf(e.texture.value,THREE.Texture,null),this.textureFrames=t.ensureInstanceOf(e.texture.frames,THREE.Vector2,new THREE.Vector2(1,1)),this.textureFrameCount=t.ensureTypedArg(e.texture.frameCount,r.NUMBER,this.textureFrames.x*this.textureFrames.y),this.textureLoop=t.ensureTypedArg(e.texture.loop,r.NUMBER,1),this.textureFrames.max(new THREE.Vector2(1,1)),this.hasPerspective=t.ensureTypedArg(e.hasPerspective,r.BOOLEAN,!0),this.colorize=t.ensureTypedArg(e.colorize,r.BOOLEAN,!0),this.maxParticleCount=t.ensureTypedArg(e.maxParticleCount,r.NUMBER,null),this.blending=t.ensureTypedArg(e.blending,r.NUMBER,THREE.AdditiveBlending),this.transparent=t.ensureTypedArg(e.transparent,r.BOOLEAN,!0),this.alphaTest=parseFloat(t.ensureTypedArg(e.alphaTest,r.NUMBER,0)),this.depthWrite=t.ensureTypedArg(e.depthWrite,r.BOOLEAN,!1),this.depthTest=t.ensureTypedArg(e.depthTest,r.BOOLEAN,!0),this.fog=t.ensureTypedArg(e.fog,r.BOOLEAN,!0),this.scale=t.ensureTypedArg(e.scale,r.NUMBER,300),this.emitters=[],this.emitterIDs=[],this._pool=[],this._poolCreationSettings=null,this._createNewWhenPoolEmpty=0,this._attributesNeedRefresh=!1,this._attributesNeedDynamicReset=!1,this.particleCount=0,this.uniforms={texture:{type:"t",value:this.texture},textureAnimation:{type:"v4",value:new THREE.Vector4(this.textureFrames.x,this.textureFrames.y,this.textureFrameCount,Math.max(Math.abs(this.textureLoop),1))},fogColor:{type:"c",value:null},fogNear:{type:"f",value:10},fogFar:{type:"f",value:200},fogDensity:{type:"f",value:.5}
1,deltaTime:{type:"f",value:0},runTime:{type:"f",value:0},scale:{type:"f",value:this.scale}},this.defines={HAS_PERSPECTIVE:this.hasPerspective,COLORIZE:this.colorize,VALUE_OVER_LIFETIME_LENGTH:n.valueOverLifetimeLength,SHOULD_ROTATE_TEXTURE:!1,SHOULD_ROTATE_PARTICLES:!1,SHOULD_WIGGLE_PARTICLES:!1,SHOULD_CALCULATE_SPRITE:this.textureFrames.x>1||this.textureFrames.y>1},this.attributes={position:new n.ShaderAttribute("v3",!0),acceleration:new n.ShaderAttribute("v4",!0),velocity:new n.ShaderAttribute("v3",!0),rotation:new n.ShaderAttribute("v4",!0),rotationCenter:new n.ShaderAttribute("v3",!0),params:new n.ShaderAttribute("v4",!0),size:new n.ShaderAttribute("v4",!0),angle:new n.ShaderAttribute("v4",!0),color:new n.ShaderAttribute("v4",!0),opacity:new n.ShaderAttribute("v4",!0)},this.attributeKeys=Object.keys(this.attributes),this.attributeCount=this.attributeKeys.length,this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:n.shaders.vertex,fragmentShader:n.shaders.fragment,blending:this.blending,transparent:this.transparent,alphaTest:this.alphaTest,depthWrite:this.depthWrite,depthTest:this.depthTest,defines:this.defines,fog:this.fog}),this.geometry=new THREE.BufferGeometry,this.mesh=new THREE.Points(this.geometry,this.material),this.maxParticleCount===null&&console.warn("SPE.Group: No maxParticleCount specified. Adding emitters after rendering will probably cause errors.")};n.Group.constructor=n.Group;n.Group.prototype._updateDefines=function(){"use strict";var e=this.emitters,t=e.length-1,r,i=this.defines;for(t;t>=0;--t)r=e[t],i.SHOULD_CALCULATE_SPRITE||(i.SHOULD_ROTATE_TEXTURE=i.SHOULD_ROTATE_TEXTURE||!!Math.max(Math.max.apply(null,r.angle.value),Math.max.apply(null,r.angle.spread))),i.SHOULD_ROTATE_PARTICLES=i.SHOULD_ROTATE_PARTICLES||!!Math.max(r.rotation.angle,r.rotation.angleSpread),i.SHOULD_WIGGLE_PARTICLES=i.SHOULD_WIGGLE_PARTICLES||!!Math.max(r.wiggle.value,r.wiggle.spread);this.material.needsUpdate=!0};n.Group.prototype._applyAttributesToGeometry=function(){"use strict";var e=this.attributes,t=this.geometry,r=t.attributes,i,s;for(var a in e)e.hasOwnProperty(a)&&(i=e[a],s=r[a],s?s.array=i.typedArray.array:t.addAttribute(a,i.bufferAttribute),i.bufferAttribute.needsUpdate=!0);this.geometry.setDrawRange(0,this.particleCount)}
1;n.Group.prototype.addEmitter=function(e){"use strict";if(e instanceof n.Emitter){if(this.emitterIDs.indexOf(e.uuid)>-1){console.error("Emitter already exists in this group. Will not add again.");return}else if(e.group!==null){console.error("Emitter already belongs to another group. Will not add to requested group.");return}}else{console.error("`emitter` argument must be instance of SPE.Emitter. Was provided with:",e);return}var t=this.attributes,r=this.particleCount,i=r+e.particleCount;this.particleCount=i,this.maxParticleCount!==null&&this.particleCount>this.maxParticleCount&&console.warn("SPE.Group: maxParticleCount exceeded. Requesting",this.particleCount,"particles, can support only",this.maxParticleCount),e._calculatePPSValue(e.maxAge._value+e.maxAge._spread),e._setBufferUpdateRanges(this.attributeKeys),e._setAttributeOffset(r),e.group=this,e.attributes=this.attributes;for(var s in t)t.hasOwnProperty(s)&&t[s]._createBufferAttribute(this.maxParticleCount!==null?this.maxParticleCount:this.particleCount);for(var a=r;a<i;++a)e._assignPositionValue(a),e._assignForceValue(a,"velocity"),e._assignForceValue(a,"acceleration"),e._assignAbsLifetimeValue(a,"opacity"),e._assignAbsLifetimeValue(a,"size"),e._assignAngleValue(a),e._assignRotationValue(a),e._assignParamsValue(a),e._assignColorValue(a);return this._applyAttributesToGeometry(),this.emitters.push(e),this.emitterIDs.push(e.uuid),this._updateDefines(e),this.material.needsUpdate=!0,this.geometry.needsUpdate=!0,this._attributesNeedRefresh=!0,this};n.Group.prototype.removeEmitter=function(e){"use strict";var t=this.emitterIDs.indexOf(e.uuid);if(e instanceof n.Emitter){if(t===-1){console.error("Emitter does not exist in this group. Will not remove.");return}}else{console.error("`emitter` argument must be instance of SPE.Emitter. Was provided with:",e);return}for(var r=e.attributeOffset,i=r+e.particleCount,s=this.attributes.params.typedArray,a=r;a<i;++a)s.array[a*4]=0,s.array[a*4+1]=0;this.emitters.splice(t,1),this.emitterIDs.splice(t,1);for(var o in this.attributes)this.attributes.hasOwnProperty(o)&&this.attributes[o].splice(r,i);this.particleCount-=e.particleCount,e._onRemove(),this._attributesNeedRefresh=!0};n.Group.prototype.getFromPool=function(){"use strict";var e=this._pool,t=this._createNewWhenPoolEmpty;return e.length?e.pop():t?new n.Emitter(this._poolCreationSettings):null};n.Group.prototype.releaseIntoPool=function(e){"use strict";if(!(e instanceof n.Emitter)){console.error("Argument is not instanceof SPE.Emitter:",e);return}return e.reset(),this._pool.unshift(e),this};n.Group.prototype.getPool=function(){"use strict";return this._pool};n.Group.prototype.addPool=function(e,t,r){"use strict";var i;this._poolCreationSettings=t,this._createNewWhenPoolEmpty=!!r;for(var s=0;s<e;++s)Array.isArray(t)?i=new n.Emitter(t[s]):i=new n.Emitter(t),this.addEmitter(i),this.releaseIntoPool(i);return this};n.Group.prototype._triggerSingleEmitter=function(e){"use strict";var t=this.getFromPool(),r=this;if(t===null){console.log("SPE.Group pool ran out.");return}return e instanceof THREE.Vector3&&(t.position.value.copy(e),t.position.value=t.position.value),t.enable(),setTimeout(function(){t.disable(),r.releaseIntoPool(t)},Math.max(t.duration,t.maxAge.value+t.maxAge.spread)*1e3),this};n.Group.prototype.triggerPoolEmitter=function(e,t){"use strict";if(typeof e=="number"&&e>1)for(var r=0;r<e;++r)this._triggerSingleEmitter(t);else this._triggerSingleEmitter(t);return this};n.Group.prototype._updateUniforms=function(e){"use strict";this.uniforms.runTime.value+=e,this.uniforms.deltaTime.value=e};n.Group.prototype._resetBufferRanges=function(){"use strict";var e=this.attributeKeys,t=this.attributeCount-1,r=this.attributes;for(t;t>=0;--t)r[e[t]].resetUpdateRange()};n.Group.prototype._updateBuffers=function(e){"use strict";var t=this.attributeKeys,r=this.attributeCount-1,i=this.attributes,s=e.bufferUpdateRanges,a,o,u;for(r;r>=0;--r)a=t[r],o=s[a],u=i[a],u.setUpdateRange(o.min,o.max),u.flagUpdate()};n.Group.prototype.tick=function(e){"use strict";var t=this.emitters,r=t.length,i=e||this.fixedTimeStep,s=this.attributeKeys,a,o=this.attributes;if(this._updateUniforms(i),this._resetBufferRanges(),!(r===0&&this._attributesNeedRefresh===!1&&this._attributesNeedDynamicReset===!1)){for(var a=0,u;a<r;++a)u=t[a],u.tick(i),this._updateBuffers(u);if(this._attributesNeedDynamicReset===!0){for(a=this.attributeCount-1,a;a>=0;--a)o[s[a]].resetDynamic();this._attributesNeedDynamicReset=!1}if(this._attributesNeedRefresh===!0){for(a=this.attributeCount-1,a;a>=0;--a)o[s[a]].forceUpdateAll();this._attributesNeedRefresh=!1,this._attributesNeedDynamicReset=!0}}};n.Group.prototype.dispose=function(){"use strict";return this.geometry.dispose(),this.material.dispose(),this};n.Emitter=function(e){"use strict";var t=n.utils,r=t.types,i=n.valueOverLifetimeLength;e=t.ensureTypedArg(e,r.OBJECT,{}),e.position=t.ensureTypedArg(e.position,r.OBJECT,{}),e.velocity=t.ensureTypedArg(e.velocity,r.OBJECT,{}),e.acceleration=t.ensureTypedArg(e.acceleration,r.OBJECT,{}
1),e.radius=t.ensureTypedArg(e.radius,r.OBJECT,{}),e.drag=t.ensureTypedArg(e.drag,r.OBJECT,{}),e.rotation=t.ensureTypedArg(e.rotation,r.OBJECT,{}),e.color=t.ensureTypedArg(e.color,r.OBJECT,{}),e.opacity=t.ensureTypedArg(e.opacity,r.OBJECT,{}),e.size=t.ensureTypedArg(e.size,r.OBJECT,{}),e.angle=t.ensureTypedArg(e.angle,r.OBJECT,{}),e.wiggle=t.ensureTypedArg(e.wiggle,r.OBJECT,{}),e.maxAge=t.ensureTypedArg(e.maxAge,r.OBJECT,{}),e.onParticleSpawn&&console.warn("onParticleSpawn has been removed. Please set properties directly to alter values at runtime."),this.uuid=THREE.Math.generateUUID(),this.type=t.ensureTypedArg(e.type,r.NUMBER,n.distributions.BOX),this.position={_value:t.ensureInstanceOf(e.position.value,THREE.Vector3,new THREE.Vector3),_spread:t.ensureInstanceOf(e.position.spread,THREE.Vector3,new THREE.Vector3),_spreadClamp:t.ensureInstanceOf(e.position.spreadClamp,THREE.Vector3,new THREE.Vector3),_distribution:t.ensureTypedArg(e.position.distribution,r.NUMBER,this.type),_randomise:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1),_radius:t.ensureTypedArg(e.position.radius,r.NUMBER,10),_radiusScale:t.ensureInstanceOf(e.position.radiusScale,THREE.Vector3,new THREE.Vector3(1,1,1)),_distributionClamp:t.ensureTypedArg(e.position.distributionClamp,r.NUMBER,0)},this.velocity={_value:t.ensureInstanceOf(e.velocity.value,THREE.Vector3,new THREE.Vector3),_spread:t.ensureInstanceOf(e.velocity.spread,THREE.Vector3,new THREE.Vector3),_distribution:t.ensureTypedArg(e.velocity.distribution,r.NUMBER,this.type),_randomise:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1)},this.acceleration={_value:t.ensureInstanceOf(e.acceleration.value,THREE.Vector3,new THREE.Vector3),_spread:t.ensureInstanceOf(e.acceleration.spread,THREE.Vector3,new THREE.Vector3),_distribution:t.ensureTypedArg(e.acceleration.distribution,r.NUMBER,this.type),_randomise:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1)},this.drag={_value:t.ensureTypedArg(e.drag.value,r.NUMBER,0),_spread:t.ensureTypedArg(e.drag.spread,r.NUMBER,0),_randomise:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1)},this.wiggle={_value:t.ensureTypedArg(e.wiggle.value,r.NUMBER,0),_spread:t.ensureTypedArg(e.wiggle.spread,r.NUMBER,0)},this.rotation={_axis:t.ensureInstanceOf(e.rotation.axis,THREE.Vector3,new THREE.Vector3(0,1,0)),_axisSpread:t.ensureInstanceOf(e.rotation.axisSpread,THREE.Vector3,new THREE.Vector3),_angle:t.ensureTypedArg(e.rotation.angle,r.NUMBER,0),_angleSpread:t.ensureTypedArg(e.rotation.angleSpread,r.NUMBER,0),_static:t.ensureTypedArg(e.rotation.static,r.BOOLEAN,!1),_center:t.ensureInstanceOf(e.rotation.center,THREE.Vector3,this.position._value.clone()),_randomise:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1)},this.maxAge={_value:t.ensureTypedArg(e.maxAge.value,r.NUMBER,2),_spread:t.ensureTypedArg(e.maxAge.spread,r.NUMBER,0)},this.color={_value:t.ensureArrayInstanceOf(e.color.value,THREE.Color,new THREE.Color),_spread:t.ensureArrayInstanceOf(e.color.spread,THREE.Vector3,new THREE.Vector3),_randomise:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1)},this.opacity={_value:t.ensureArrayTypedArg(e.opacity.value,r.NUMBER,1),_spread:t.ensureArrayTypedArg(e.opacity.spread,r.NUMBER,0),_randomise:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1)},this.size={_value:t.ensureArrayTypedArg(e.size.value,r.NUMBER,1),_spread:t.ensureArrayTypedArg(e.size.spread,r.NUMBER,0),_randomise:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1)},this.angle={_value:t.ensureArrayTypedArg(e.angle.value,r.NUMBER,0),_spread:t.ensureArrayTypedArg(e.angle.spread,r.NUMBER,0),_randomise:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1)},this.particleCount=t.ensureTypedArg(e.particleCount,r.NUMBER,100),this.duration=t.ensureTypedArg(e.duration,r.NUMBER,null),this.isStatic=t.ensureTypedArg(e.isStatic,r.BOOLEAN,!1),this.activeMultiplier=t.ensureTypedArg(e.activeMultiplier,r.NUMBER,1),this.direction=t.ensureTypedArg(e.direction,r.NUMBER,1),this.alive=t.ensureTypedArg(e.alive,r.BOOLEAN,!0),this.particlesPerSecond=0,this.activationIndex=0,this.attributeOffset=0,this.attributeEnd=0,this.age=0,this.activeParticleCount=0,this.group=null,this.attributes=null,this.paramsArray=null,this.resetFlags={position:t.ensureTypedArg(e.position.randomise,r.BOOLEAN,!1)||t.ensureTypedArg(e.radiu
1s.randomise,r.BOOLEAN,!1),velocity:t.ensureTypedArg(e.velocity.randomise,r.BOOLEAN,!1),acceleration:t.ensureTypedArg(e.acceleration.randomise,r.BOOLEAN,!1)||t.ensureTypedArg(e.drag.randomise,r.BOOLEAN,!1),rotation:t.ensureTypedArg(e.rotation.randomise,r.BOOLEAN,!1),rotationCenter:t.ensureTypedArg(e.rotation.randomise,r.BOOLEAN,!1),size:t.ensureTypedArg(e.size.randomise,r.BOOLEAN,!1),color:t.ensureTypedArg(e.color.randomise,r.BOOLEAN,!1),opacity:t.ensureTypedArg(e.opacity.randomise,r.BOOLEAN,!1),angle:t.ensureTypedArg(e.angle.randomise,r.BOOLEAN,!1)},this.updateFlags={},this.updateCounts={},this.updateMap={maxAge:"params",position:"position",velocity:"velocity",acceleration:"acceleration",drag:"acceleration",wiggle:"params",rotation:"rotation",size:"size",color:"color",opacity:"opacity",angle:"angle"};for(var s in this.updateMap)this.updateMap.hasOwnProperty(s)&&(this.updateCounts[this.updateMap[s]]=0,this.updateFlags[this.updateMap[s]]=!1,this._createGetterSetters(this[s],s));this.bufferUpdateRanges={},this.attributeKeys=null,this.attributeCount=0,t.ensureValueOverLifetimeCompliance(this.color,i,i),t.ensureValueOverLifetimeCompliance(this.opacity,i,i),t.ensureValueOverLifetimeCompliance(this.size,i,i),t.ensureValueOverLifetimeCompliance(this.angle,i,i)};n.Emitter.constructor=n.Emitter;n.Emitter.prototype._createGetterSetters=function(e,t){"use strict";var r=this;for(var i in e)if(e.hasOwnProperty(i)){var s=i.replace("_","");Object.defineProperty(e,s,{get:(function(a){return function(){return this[a]}})(i),set:(function(a){return function(o){var u=r.updateMap[t],l=this[a],c=n.valueOverLifetimeLength;a==="_rotationCenter"?(r.updateFlags.rotationCenter=!0,r.updateCounts.rotationCenter=0):a==="_randomise"?r.resetFlags[u]=o:(r.updateFlags[u]=!0,r.updateCounts[u]=0),r.group._updateDefines(),this[a]=o,Array.isArray(l)&&n.utils.ensureValueOverLifetimeCompliance(r[t],c,c)}})(i)})}};n.Emitter.prototype._setBufferUpdateRanges=function(e){"use strict";this.attributeKeys=e,this.attributeCount=e.length;for(var t=this.attributeCount-1;t>=0;--t)this.bufferUpdateRanges[e[t]]={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY}};n.Emitter.prototype._calculatePPSValue=function(e){"use strict";var t=this.particleCount;this.duration?this.particlesPerSecond=t/(e<this.duration?e:this.duration):this.particlesPerSecond=t/e};n.Emitter.prototype._setAttributeOffset=function(e){this.attributeOffset=e,this.activationIndex=e,this.activationEnd=e+this.particleCount};n.Emitter.prototype._assignValue=function(e,t){"use strict";switch(e){case"position":this._assignPositionValue(t);break;case"velocity":case"acceleration":this._assignForceValue(t,e);break;case"size":case"opacity":this._assignAbsLifetimeValue(t,e);break;case"angle":this._assignAngleValue(t);break;case"params":this._assignParamsValue(t);break;case"rotation":this._assignRotationValue(t);break;case"color":this._assignColorValue(t);break}};n.Emitter.prototype._assignPositionValue=function(e){"use strict";var t=n.distributions,r=n.utils,i=this.position,s=this.attributes.position,a=i._value,o=i._spread,u=i._distribution;switch(u){case t.BOX:r.randomVector3(s,e,a,o,i._spreadClamp);break;case t.SPHERE:r.randomVector3OnSphere(s,e,a,i._radius,i._spread.x,i._radiusScale,i._spreadClamp.x,i._distributionClamp||this.particleCount);break;case t.DISC:r.randomVector3OnDisc(s,e,a,i._radius,i._spread.x,i._radiusScale,i._spreadClamp.x);break}};n.Emitter.prototype._assignForceValue=function(e,t){"use strict";var r=n.distributions,i=n.utils,s=this[t],a=s._value,o=s._spread,u=s._distribution,l,c,f,p,h;switch(u){case r.BOX:i.randomVector3(this.attributes[t],e,a,o);break;case r.SPHERE:l=this.attributes.position.typedArray.array,h=e*3,c=l[h],f=l[h+1],p=l[h+2],i.randomDirectionVector3OnSphere(this.attributes[t],e,c,f,p,this.position._value,s._value.x,s._spread.x);break;case r.DISC:l=this.attributes.position.typedArray.array,h=e*3,c=l[h],f=l[h+1],p=l[h+2],i.randomDirectionVector3OnDisc(this.attributes[t],e,c,f,p,this.position._value,s._value.x,s._spread.x);break}if(t==="acceleration"){var d=i.clamp(i.randomFloat(this.drag._value,this.drag._spread),0,1);this.attributes.acceleration.typedArray.array[e*4+3]=d}};n.Emitter.prototype._assignAbsLifetimeValue=function(e,t){"use strict";var r=this.attributes[t].typedArray,i=this[t],s=n.utils,a;s.arrayValuesAreEqual(i._value)&&s.arrayValuesAreEqual(i._spread)?(a=Math.abs(s.randomFloat(i._value[0],i._spread[0])),r.setVec4Components(e,a,a,a,a)):r.setVec4Components(e,Math.abs(s.randomFloat(i._value[0],i._spread[0])),Math.abs(s.randomFloat(i._value[1],i._spread[1])),Math.abs(s.randomFloat(i._value[2],i._spread[2])),Math.abs(s.randomFloat(i._value[3],i._spread[3])))};n.Emitter.prototype._assignAngleValue=function(e){"use strict";var t=this.attributes.angle.typedArray,r=this.angle,i=n.utils,s;i.arrayValuesAreEqual(r._value)&&i.arrayValuesAreEqual(r._spread)?(s=i.randomFloat(r._value[0],r._spread[0]),t.setVec4Components(e,s,s,s,s)):t.setVec4Components(e,i.randomFloat(r._value[0],r._spread[0]),i.randomFloat(r._value[1],r._spread[1]),i.randomFloat(r._value[2],r._spread[2]),i.randomFloat(r._value[3],r._spread[3]))};n.Emitter.prototype._assignParamsValue=function(e){"use strict";this.attributes.params.typedArray.setVec4Components(e,this.isStatic?1:0,0,Math.abs(n.utils.randomFloat(this.maxAge._value,this.maxAge._spread)),n.utils.randomFloat(this.wiggle._value,this.wiggle._spread))};n.Emitter.prototype._assignRotationValue=function(e){"use strict";this.attributes.rotation.typedArray.setVec3Components(e,n.utils.getPackedRotationAxis(this.rotation._axis,this.rotation._axisSpread),n.utils.randomFloat(this.rotation._angle,this.rotation._angleSpread),this.rotation._static?0:1),this.attributes.rotationCenter.typedArray.setVec3(e,this.rotation._center)};n.Emitter.prototype._assignColorValue=function(e){"use strict";n.utils.randomColorAsHex(this.attributes.color,e,this.color._value,this.color._spread)};n.Emitter.prototype._resetParticle=function(e){"use strict";for(var t=this.resetFlags,r=this.updateFlags,i=this.updateCounts,s=this.attributeKeys,a,o,u=this.attributeCount-1;u>=0;--u)a=s[u],o=r[a],(t[a]===!0||o===!0)&&(this._assignValue(a,e),this._updateAttributeUpdateRange(a,e),o===!0&&i[a]===this.particleCount?(r[a]=!1,i[a]=0):o==!0&&++i[a])};n.Emitter.prototype._updateAttributeUpdateRange=function(e,t){"use strict";var r=this.bufferUpdateRanges[e];r.min=Math.min(t,r.min),r.max=Math.max(t,r.max)};n.Emitter.prototype._resetBufferRanges=function(){"use strict";var e=this.bufferUpdateRanges,t=this.bufferUpdateKeys,r=this.bufferUpdateCount-1,i;for(r;r>=0;--r)i=t[r],e[i].min=Number.POSITIVE_INFINITY,e[i].max=Number.NEGATIVE_INFINITY};n.Emitter.prototype._onRemove=function(){"use strict";this.particlesPerSecond=0,this.attributeOffset=0,this.activationIndex=0,this.activeParticleCount=0,this.group=null,this.attributes=null,this.paramsArray=null,this.age=0};n.Emitter.prototype._decrementParticleCount=function(){"use strict";--this.activeParticleCount};n.Emitter.prototype._incrementParticleCount=function(){"use strict";++this.activeParticleCount};n.Emitter.prototype._checkParticleAges=function(e,t,r,i){"use strict";for(var s=t-1,a,o,u,l;s>=e;--s)a=s*4,l=r[a],l!==0&&(u=r[a+1],o=r[a+2],this.direction===1?(u+=i,u>=o&&(u=0,l=0,this._decrementParticleCount())):(u-=i,u<=0&&(u=o,l=0,this._decrementParticleCount())),r[a]=l,r[a+1]=u,this._updateAttributeUpdateRange("params",s))};n.Emitter.prototype._activateParticles=function(e,t,r,i){"use strict";for(var s=this.direction,a=e,o,u;a<t;++a)o=a*4,!(r[o]!=0&&this.particleCount!==1)&&(this._incrementParticleCount(),r[o]=1,this._resetParticle(a),u=i*(a-e),r[o+1]=s===-1?r[o+2]-u:u,this._updateAttributeUpdateRange("params",a))};n.Emitter.prototype.tick=function(e){"use strict";if(!this.isStatic){this.paramsArray===null&&(this.paramsArray=this.attributes.params.typedArray.array);var t=this.attributeOffset,r=t+this.particleCount,i=this.paramsArray,s=this.particlesPerSecond*this.activeMultiplier*e,a=this.activationIndex;if(this._resetBufferRanges(),this._checkParticleAges(t,r,i,e),this.alive===!1){this.age=0;return}if(this.duration!==null&&this.age>this.duration){this.alive=!1,this.age=0;return}var o=this.particleCount===1?a:a|0,u=Math.min(o+s,this.activationEnd),l=u-this.activationIndex|0,c=l>0?e/l:0;this._activateParticles(o,u,i,c),this.activationIndex+=s,this.activationIndex>r&&(this.activationIndex=t),this.age+=e}};n.Emitter.prototype.reset=function(e){"use strict";if(this.age=0,this.alive=!1,e===!0){for(var t=this.attributeOffset,r=t+this.particleCount,i=this.paramsArray,s=this.attributes.params.bufferAttribute,a=r-1,o;a>=t;--a)o=a*4,i[o]=0,i[o+1]=0;s.updateRange.offset=0,s.updateRange.count=-1,s.needsUpdate=!0}return this};n.Emitter.prototype.enable=function(){"use strict";return this.alive=!0,this};n.Emitter.prototype.disable=function(){"use strict";return this.alive=!1,this};n.Emitter.prototype.remove=function(){"use strict";return this.group!==null?this.group.removeEmitter(this):console.error("Emitter does not belong to a group, cannot remove."),this}});var g=v();if(typeof AFRAME>"u")throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("particle-system",{schema:{preset:{type:"string",default:"",oneOf:["default","dust","snow","rain"]},maxAge:{type:"number",default:6},positionSpread:{type:"vec3",default:{x:0,y:0,z:0}},type:{type:"number",default:g.distributions.BOX},rotationAxis:{type:"string",default:"x"},rotationAngle:{type:"number",default:0},rotationAngleSpread:{type:"number",default:0},accelerationValue:{type:"vec3",default:{x:0,y:-10,z:0}},accelerationSpread:{type:"vec3",default:{x:10,y:0,z:10}},velocityValue:{type:"vec3",default:{x:0,y:25,z:0}},velocitySpread:{type:"vec3",default:{x:10,y:7.5,z:10}},dragValue:{type:"number",default:0},dragSpread:{type:"number",default:0},dragRandomise:{type:"boolean",default:!1},color:{type:"array",default:["#0000FF","#FF0000"]},size:{type:"number",default:1},direction:{type:"number",default:1},duration:{type:"number",default:null},particleCount:{type:"number",default:1e3},texture:{type:"asset",default:"https://cdn.rawgit.com/IdeaSpaceVR/aframe-particle-system-component/master/dist/images/star2.png"},randomise:{type:"boolean",default:!1},opacity:{type:"array",default:["1"]},maxParticleCount:{type:"number",default:25e4},blending:{type:"number",default:THREE.AdditiveBlending,oneOf:[THREE.NoBlending,THREE.NormalBlending,THREE.AdditiveBlending,THREE.SubtractiveBlending,THREE.MultiplyBlending]},enabled:{type:"boolean",default:!0}},init:function(){this.presets={},this.presets.dust={maxAge:20,positionSpread:{x:100,y:100,z:100},rotationAngle:3.14,accelerationValue:{x:0,y:0,z:0},accelerationSpread:{x:0,y:0,z:0},velocityValue:{x:1,y:.3,z:1},velocitySpread:{x:.5,y:1,z:.5},color:["#FFFFFF"],particleCount:100,texture:"https://cdn.rawgit.com/IdeaSpaceVR/aframe-particle-system-component/master/dist/images/smokeparticle.png"},this.presets.snow={maxAge:20,positionSpread:{x:100,y:100,z:100},rotationAngle:3.14,accelerationValue:{x:0,y:0,z:0},accelerationSpread:{x:.2,y:0,z:.2},velocityValue:{x:0,y:8,z:0},velocitySpread:{x:2,y:0,z:2},color:["#FFFFFF"],particleCount:200,texture:"https://cdn.rawgit.com/IdeaSpaceVR/aframe-particle-system-component/master/dist/images/smokeparticle.png"},this.presets.rain={maxAge:1,positionSpread:{x:100,y:100,z:100},rotationAngle:3.14,accelerationValue:{x:0,y:3,z:0},accelerationSpread:{x:2,y:1,z:2},velocityValue:{x:0,y:75,z:0},velocitySpread:{x:10,y:50,z:10},color:["#FFFFFF"],size:.4,texture:"https://cdn.rawgit.com/IdeaSpaceVR/aframe-particle-system-component/master/dist/images/raindrop.png"}},update:function(e){this.particleGroup&&this.el.removeObject3D("particle-system"),this.preset=this.presets[this.data.preset]||{};for(var t in this.data)this.data[t]=this.applyPreset(t);this.initParticleSystem(this.data),this.data.enabled===!0?this.startParticles():this.stopParticles()},applyPreset:function(e){return!this.attrValue[e]&&this.preset[e]?this.preset[e]:this.data[e]},tick:function(e,t){this.particleGroup.tick(t/1e3)},remove:function(){this.particleGroup&&this.el.removeObject3D("particle-system")}
1,startParticles:function(){this.particleGroup.emitters.forEach(function(e){e.enable()})},stopParticles:function(){this.particleGroup.emitters.forEach(function(e){e.disable()})},initParticleSystem:function(e){var t=new THREE.TextureLoader,r=t.load(e.texture,function(s){return s},function(s){console.log(s.loaded/s.total*100+"% loaded")},function(s){console.log("An error occurred")});this.particleGroup=new g.Group({texture:{value:r},maxParticleCount:e.maxParticleCount,blending:e.blending});var i=new g.Emitter({maxAge:{value:e.maxAge},type:{value:e.type},position:{spread:new THREE.Vector3(e.positionSpread.x,e.positionSpread.y,e.positionSpread.z),randomise:e.randomise},rotation:{axis:e.rotationAxis=="x"?new THREE.Vector3(1,0,0):e.rotationAxis=="y"?new THREE.Vector3(0,1,0):e.rotationAxis=="z"?new THREE.Vector3(0,0,1):new THREE.Vector3(0,1,0),angle:e.rotationAngle,angleSpread:e.rotationAngleSpread,static:!0},acceleration:{value:new THREE.Vector3(e.accelerationValue.x,e.accelerationValue.y,e.accelerationValue.z),spread:new THREE.Vector3(e.accelerationSpread.x,e.accelerationSpread.y,e.accelerationSpread.z)},velocity:{value:new THREE.Vector3(e.velocityValue.x,e.velocityValue.y,e.velocityValue.z),spread:new THREE.Vector3(e.velocitySpread.x,e.velocitySpread.y,e.velocitySpread.z)},drag:{value:new THREE.Vector3(e.dragValue.x,e.dragValue.y,e.dragValue.z),spread:new THREE.Vector3(e.dragSpread.x,e.dragSpread.y,e.dragSpread.z),randomise:e.dragRandomise},color:{value:e.color.map(function(s){return new THREE.Color(s)})},size:{value:e.size},direction:{value:e.direction},duration:e.duration,opacity:{value:e.opacity.map(function(s){return parseFloat(s)})},particleCount:e.particleCount});this.particleGroup.addEmitter(i),this.particleGroup.mesh.frustumCulled=!1,this.el.setObject3D("particle-system",this.particleGroup.mesh)}});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.